]> git.proxmox.com Git - qemu.git/blame - configure
ide: Set bus master inactive on error
[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
52166aa0 23compile_object() {
da1d85e3
GH
24 echo $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log
25 $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log 2>&1
52166aa0
JQ
26}
27
28compile_prog() {
29 local_cflags="$1"
30 local_ldflags="$2"
da1d85e3
GH
31 echo $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log
32 $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log 2>&1
52166aa0
JQ
33}
34
0dba6195
LM
35# check whether a command is available to this shell (may be either an
36# executable or a builtin)
37has() {
38 type "$1" >/dev/null 2>&1
39}
40
41# search for an executable in PATH
42path_of() {
43 local_command="$1"
44 local_ifs="$IFS"
45 local_dir=""
46
47 # pathname has a dir component?
48 if [ "${local_command#*/}" != "$local_command" ]; then
49 if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
50 echo "$local_command"
51 return 0
52 fi
53 fi
54 if [ -z "$local_command" ]; then
55 return 1
56 fi
57
58 IFS=:
59 for local_dir in $PATH; do
60 if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
61 echo "$local_dir/$local_command"
62 IFS="${local_ifs:-$(printf ' \t\n')}"
63 return 0
64 fi
65 done
66 # not found
67 IFS="${local_ifs:-$(printf ' \t\n')}"
68 return 1
69}
70
7d13299d 71# default parameters
2ff6b91e 72cpu=""
1e43adfc 73interp_prefix="/usr/gnemul/qemu-%M"
43ce4dfe 74static="no"
ed968ff1 75sparc_cpu=""
7d13299d
FB
76cross_prefix=""
77cc="gcc"
0c58ac1c 78audio_drv_list=""
d61a4ce8
GH
79audio_card_list="ac97 es1370 sb16 hda"
80audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda"
eb852011 81block_drv_whitelist=""
7d13299d
FB
82host_cc="gcc"
83ar="ar"
84make="make"
6a882643 85install="install"
7aa486fe
AL
86objcopy="objcopy"
87ld="ld"
52ba784d 88strip="strip"
9fe6de94 89windres="windres"
c81da56e 90helper_cflags=""
73da375e 91libs_softmmu=""
3e2e0e6b 92libs_tools=""
67f86e8e 93audio_pt_int=""
d5631638 94audio_win_int=""
2b2e59e6 95cc_i386=i386-pc-linux-gnu-gcc
ac0df51d
AL
96
97# parse CC options first
98for opt do
99 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
100 case "$opt" in
101 --cross-prefix=*) cross_prefix="$optarg"
102 ;;
103 --cc=*) cc="$optarg"
104 ;;
2ff6b91e
JQ
105 --cpu=*) cpu="$optarg"
106 ;;
a558ee17 107 --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
e2a2ed06
JQ
108 ;;
109 --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
110 ;;
50e7b1a0
JQ
111 --sparc_cpu=*)
112 sparc_cpu="$optarg"
113 case $sparc_cpu in
ed968ff1 114 v7|v8|v8plus|v8plusa)
50e7b1a0
JQ
115 cpu="sparc"
116 ;;
117 v9)
50e7b1a0
JQ
118 cpu="sparc64"
119 ;;
120 *)
121 echo "undefined SPARC architecture. Exiting";
122 exit 1
123 ;;
124 esac
125 ;;
ac0df51d
AL
126 esac
127done
ac0df51d
AL
128# OS specific
129# Using uname is really, really broken. Once we have the right set of checks
130# we can eliminate it's usage altogether
131
132cc="${cross_prefix}${cc}"
133ar="${cross_prefix}${ar}"
7aa486fe
AL
134objcopy="${cross_prefix}${objcopy}"
135ld="${cross_prefix}${ld}"
52ba784d 136strip="${cross_prefix}${strip}"
9fe6de94 137windres="${cross_prefix}${windres}"
ac0df51d 138
be17dc90
MT
139# default flags for all hosts
140QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
141CFLAGS="-g $CFLAGS"
142QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
143QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
144QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
84958305 145QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
be17dc90
MT
146QEMU_CFLAGS="-I. -I\$(SRC_PATH) $QEMU_CFLAGS"
147LDFLAGS="-g $LDFLAGS"
148
a21493e0
BS
149gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
150gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
0b65b9e1 151gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
a21493e0 152gcc_flags="-fstack-protector-all $gcc_flags"
be17dc90 153cat > $TMPC << EOF
aa527b65 154int main(void) { return 0; }
be17dc90
MT
155EOF
156for flag in $gcc_flags; do
aa527b65 157 if compile_prog "-Werror $QEMU_CFLAGS" "-Werror $flag" ; then
1e027be7 158 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
be17dc90
MT
159 fi
160done
161
ac0df51d
AL
162# check that the C compiler works.
163cat > $TMPC <<EOF
164int main(void) {}
165EOF
166
52166aa0 167if compile_object ; then
ac0df51d
AL
168 : C compiler works ok
169else
170 echo "ERROR: \"$cc\" either does not exist or does not work"
171 exit 1
172fi
173
174check_define() {
175cat > $TMPC <<EOF
176#if !defined($1)
177#error Not defined
178#endif
179int main(void) { return 0; }
180EOF
52166aa0 181 compile_object
ac0df51d
AL
182}
183
2ff6b91e
JQ
184if test ! -z "$cpu" ; then
185 # command line argument
186 :
187elif check_define __i386__ ; then
ac0df51d
AL
188 cpu="i386"
189elif check_define __x86_64__ ; then
190 cpu="x86_64"
3aa9bd6c
BS
191elif check_define __sparc__ ; then
192 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
193 # They must be specified using --sparc_cpu
194 if check_define __arch64__ ; then
195 cpu="sparc64"
196 else
197 cpu="sparc"
198 fi
fdf7ed96 199elif check_define _ARCH_PPC ; then
200 if check_define _ARCH_PPC64 ; then
201 cpu="ppc64"
202 else
203 cpu="ppc"
204 fi
afa05235
AJ
205elif check_define __mips__ ; then
206 cpu="mips"
477ba620
AJ
207elif check_define __ia64__ ; then
208 cpu="ia64"
d66ed0ea
AJ
209elif check_define __s390__ ; then
210 if check_define __s390x__ ; then
211 cpu="s390x"
212 else
213 cpu="s390"
214 fi
ac0df51d 215else
fdf7ed96 216 cpu=`uname -m`
ac0df51d
AL
217fi
218
5327cf48 219target_list=""
7d13299d 220case "$cpu" in
afa05235 221 alpha|cris|ia64|m68k|microblaze|ppc|ppc64|sparc64)
ea8f20f8
JQ
222 cpu="$cpu"
223 ;;
7d13299d 224 i386|i486|i586|i686|i86pc|BePC)
97a847bc 225 cpu="i386"
7d13299d 226 ;;
aaa5fa14
AJ
227 x86_64|amd64)
228 cpu="x86_64"
229 ;;
ba68055e 230 armv*b)
808c4954
FB
231 cpu="armv4b"
232 ;;
ba68055e 233 armv*l)
7d13299d
FB
234 cpu="armv4l"
235 ;;
f54b3f92
AJ
236 parisc|parisc64)
237 cpu="hppa"
238 ;;
afa05235
AJ
239 mips*)
240 cpu="mips"
241 ;;
24e804ec 242 s390)
fb3e5849
FB
243 cpu="s390"
244 ;;
24e804ec
AG
245 s390x)
246 cpu="s390x"
247 ;;
3142255c 248 sparc|sun4[cdmuv])
ae228531
FB
249 cpu="sparc"
250 ;;
7d13299d 251 *)
a447d4dc
PB
252 echo "Unsupported CPU = $cpu"
253 exit 1
7d13299d
FB
254 ;;
255esac
e2d52ad3 256
3a3fb96d
SW
257# Default value for a variable defining feature "foo".
258# * foo="no" feature will only be used if --enable-foo arg is given
259# * foo="" feature will be searched for, and if found, will be used
260# unless --disable-foo is given
261# * foo="yes" this value will only be set by --enable-foo flag.
262# feature will searched for,
263# if not found, configure exits with error
e2d52ad3 264#
3a3fb96d
SW
265# Always add --enable-foo and --disable-foo command line args.
266# Distributions want to ensure that several features are compiled in, and it
267# is impossible without a --enable-foo that exits if a feature is not found.
e2d52ad3 268
a20a6f46 269bluez=""
4ffcedb6 270brlapi=""
788c8196 271curl=""
c584a6d0 272curses=""
a25dba17 273docs=""
2df87df7 274fdt=""
b31a0277 275kvm=""
dae5079a 276kvm_para=""
b0a47e79 277nptl=""
c4198157 278sdl=""
dfffc653 279sparse="no"
ee682d27 280uuid=""
dfb278bd 281vde=""
1be10ad2 282vnc_tls=""
ea784e3b 283vnc_sasl=""
2f6f5c7a 284vnc_jpeg=""
efe556ad 285vnc_png=""
96763cf9 286vnc_thread="no"
fc321b4b 287xen=""
5c6c3a6c 288linux_aio=""
758e8e38 289attr=""
d5970055 290vhost_net=""
dfb278bd 291
7d13299d 292gprof="no"
f8393946 293debug_tcg="no"
b4475aa2 294debug_mon="no"
f3d08ee6 295debug="no"
1625af87 296strip_opt="yes"
7d13299d 297bigendian="no"
67b915a5
FB
298mingw32="no"
299EXESUF=""
683035de
PB
300prefix="/usr/local"
301mandir="\${prefix}/share/man"
302datadir="\${prefix}/share/qemu"
303docdir="\${prefix}/share/doc/qemu"
304bindir="\${prefix}/bin"
305sysconfdir="\${prefix}/etc"
306confsuffix="/qemu"
443f1376 307slirp="yes"
102a52e4
FB
308fmod_lib=""
309fmod_inc=""
2f6a1ab0 310oss_lib=""
b1a550a0 311bsd="no"
5327cf48 312linux="no"
d2c7c9b8 313solaris="no"
05c2a3e7 314profiler="no"
5b0753e0 315cocoa="no"
0a8e90f4 316softmmu="yes"
831b7825
TS
317linux_user="no"
318darwin_user="no"
84778508 319bsd_user="no"
379f6698 320guest_base=""
c5937220 321uname_release=""
e5d355d1 322io_thread="no"
8ff9cbf7 323mixemu="no"
eac30262 324kerneldir=""
b29fe3ed 325aix="no"
179cf400 326haiku="no"
77755340 327blobs="yes"
4a19f1ec 328pkgversion=""
5495ed11 329check_utests="no"
34005a00 330user_pie="no"
20ff6c80 331zero_malloc=""
94a420b1 332trace_backend="nop"
9410b56c 333trace_file="trace"
cd4ec0b4 334spice=""
7d13299d
FB
335
336# OS specific
ac0df51d
AL
337if check_define __linux__ ; then
338 targetos="Linux"
339elif check_define _WIN32 ; then
340 targetos='MINGW32'
169dc5d3
BS
341elif check_define __OpenBSD__ ; then
342 targetos='OpenBSD'
343elif check_define __sun__ ; then
344 targetos='SunOS'
179cf400
AF
345elif check_define __HAIKU__ ; then
346 targetos='Haiku'
ac0df51d
AL
347else
348 targetos=`uname -s`
349fi
0dbfc675 350
7d13299d 351case $targetos in
c326e0af 352CYGWIN*)
0dbfc675 353 mingw32="yes"
a558ee17 354 QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
d5631638 355 audio_possible_drivers="winwave sdl"
356 audio_drv_list="winwave"
c326e0af 357;;
67b915a5 358MINGW32*)
0dbfc675 359 mingw32="yes"
d5631638 360 audio_possible_drivers="winwave dsound sdl fmod"
361 audio_drv_list="winwave"
67b915a5 362;;
5c40d2bd 363GNU/kFreeBSD)
a167ba50 364 bsd="yes"
0dbfc675
JQ
365 audio_drv_list="oss"
366 audio_possible_drivers="oss sdl esd pa"
5c40d2bd 367;;
7d3505c5 368FreeBSD)
0dbfc675 369 bsd="yes"
a167ba50 370 make="gmake"
0dbfc675
JQ
371 audio_drv_list="oss"
372 audio_possible_drivers="oss sdl esd pa"
f01576f1
JL
373 # needed for kinfo_getvmmap(3) in libutil.h
374 LIBS="-lutil $LIBS"
7d3505c5 375;;
c5e97233 376DragonFly)
0dbfc675 377 bsd="yes"
a167ba50 378 make="gmake"
0dbfc675
JQ
379 audio_drv_list="oss"
380 audio_possible_drivers="oss sdl esd pa"
c5e97233 381;;
7d3505c5 382NetBSD)
0dbfc675 383 bsd="yes"
a167ba50 384 make="gmake"
0dbfc675
JQ
385 audio_drv_list="oss"
386 audio_possible_drivers="oss sdl esd"
387 oss_lib="-lossaudio"
7d3505c5
FB
388;;
389OpenBSD)
0dbfc675 390 bsd="yes"
a167ba50 391 make="gmake"
0dbfc675
JQ
392 audio_drv_list="oss"
393 audio_possible_drivers="oss sdl esd"
394 oss_lib="-lossaudio"
7d3505c5 395;;
83fb7adf 396Darwin)
0dbfc675
JQ
397 bsd="yes"
398 darwin="yes"
399 # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can
400 # run 64-bit userspace code
401 if [ "$cpu" = "i386" ] ; then
aab8588a 402 is_x86_64=`sysctl -n hw.optional.x86_64`
403 [ "$is_x86_64" = "1" ] && cpu=x86_64
0dbfc675
JQ
404 fi
405 if [ "$cpu" = "x86_64" ] ; then
a558ee17 406 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
0c439cbf 407 LDFLAGS="-arch x86_64 $LDFLAGS"
0dbfc675 408 else
a558ee17 409 QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
0dbfc675
JQ
410 fi
411 darwin_user="yes"
412 cocoa="yes"
413 audio_drv_list="coreaudio"
414 audio_possible_drivers="coreaudio sdl fmod"
415 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
7973f21c 416 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
83fb7adf 417;;
ec530c81 418SunOS)
0dbfc675
JQ
419 solaris="yes"
420 make="gmake"
421 install="ginstall"
fa58948d 422 ld="gld"
0dbfc675
JQ
423 needs_libsunmath="no"
424 solarisrev=`uname -r | cut -f2 -d.`
425 # have to select again, because `uname -m` returns i86pc
426 # even on an x86_64 box.
427 solariscpu=`isainfo -k`
428 if test "${solariscpu}" = "amd64" ; then
429 cpu="x86_64"
430 fi
431 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
432 if test "$solarisrev" -le 9 ; then
433 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
434 needs_libsunmath="yes"
f14bfdf9
JQ
435 QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
436 LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
437 LIBS="-lsunmath $LIBS"
0dbfc675
JQ
438 else
439 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
440 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
441 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
442 echo "Studio 11 can be downloaded from www.sun.com."
443 exit 1
444 fi
86b2bd93 445 fi
0dbfc675
JQ
446 fi
447 if test -f /usr/include/sys/soundcard.h ; then
448 audio_drv_list="oss"
449 fi
450 audio_possible_drivers="oss sdl"
d741429a
BS
451# needed for CMSG_ macros in sys/socket.h
452 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
453# needed for TIOCWIN* defines in termios.h
454 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
a558ee17 455 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
e174c0bb 456 LIBS="-lsocket -lnsl -lresolv $LIBS"
86b2bd93 457;;
b29fe3ed 458AIX)
0dbfc675
JQ
459 aix="yes"
460 make="gmake"
b29fe3ed 461;;
179cf400
AF
462Haiku)
463 haiku="yes"
464 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
465 LIBS="-lposix_error_mapper -lnetwork $LIBS"
466;;
1d14ffa9 467*)
0dbfc675
JQ
468 audio_drv_list="oss"
469 audio_possible_drivers="oss alsa sdl esd pa"
470 linux="yes"
471 linux_user="yes"
472 usb="linux"
0dbfc675 473 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
c2de5c91 474 audio_possible_drivers="$audio_possible_drivers fmod"
0dbfc675 475 fi
fb065187 476;;
7d13299d
FB
477esac
478
7d3505c5 479if [ "$bsd" = "yes" ] ; then
b1a550a0 480 if [ "$darwin" != "yes" ] ; then
68063649 481 usb="bsd"
83fb7adf 482 fi
84778508 483 bsd_user="yes"
7d3505c5
FB
484fi
485
3457a3f8 486if test "$mingw32" = "yes" ; then
3457a3f8 487 EXESUF=".exe"
a558ee17 488 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
e94a7936
SW
489 # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
490 QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
884044aa 491 LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
683035de
PB
492 prefix="c:/Program Files/Qemu"
493 mandir="\${prefix}"
494 datadir="\${prefix}"
495 docdir="\${prefix}"
496 bindir="\${prefix}"
497 sysconfdir="\${prefix}"
498 confsuffix=""
3457a3f8
JQ
499fi
500
7d13299d 501# find source path
ad064840 502source_path=`dirname "$0"`
59faef3a
AZ
503source_path_used="no"
504workdir=`pwd`
ad064840 505if [ -z "$source_path" ]; then
59faef3a 506 source_path=$workdir
ad064840
PB
507else
508 source_path=`cd "$source_path"; pwd`
7d13299d 509fi
724db118 510[ -f "$workdir/vl.c" ] || source_path_used="yes"
7d13299d 511
487fefdb 512werror=""
85aa5189 513
7d13299d 514for opt do
a46e4035 515 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
7d13299d 516 case "$opt" in
2efc3265
FB
517 --help|-h) show_help=yes
518 ;;
b1a550a0 519 --prefix=*) prefix="$optarg"
7d13299d 520 ;;
b1a550a0 521 --interp-prefix=*) interp_prefix="$optarg"
32ce6337 522 ;;
b1a550a0 523 --source-path=*) source_path="$optarg"
ad064840 524 source_path_used="yes"
7d13299d 525 ;;
ac0df51d 526 --cross-prefix=*)
7d13299d 527 ;;
ac0df51d 528 --cc=*)
7d13299d 529 ;;
b1a550a0 530 --host-cc=*) host_cc="$optarg"
83469015 531 ;;
b1a550a0 532 --make=*) make="$optarg"
7d13299d 533 ;;
6a882643
PB
534 --install=*) install="$optarg"
535 ;;
e2a2ed06 536 --extra-cflags=*)
7d13299d 537 ;;
e2a2ed06 538 --extra-ldflags=*)
7d13299d 539 ;;
2ff6b91e 540 --cpu=*)
7d13299d 541 ;;
b1a550a0 542 --target-list=*) target_list="$optarg"
de83cd02 543 ;;
94a420b1
SH
544 --trace-backend=*) trace_backend="$optarg"
545 ;;
9410b56c
PS
546 --trace-file=*) trace_file="$optarg"
547 ;;
7d13299d
FB
548 --enable-gprof) gprof="yes"
549 ;;
79427693
LM
550 --static)
551 static="yes"
552 LDFLAGS="-static $LDFLAGS"
43ce4dfe 553 ;;
0b24e75f
PB
554 --mandir=*) mandir="$optarg"
555 ;;
556 --bindir=*) bindir="$optarg"
557 ;;
558 --datadir=*) datadir="$optarg"
559 ;;
560 --docdir=*) docdir="$optarg"
561 ;;
ca2fb938 562 --sysconfdir=*) sysconfdir="$optarg"
07381cc1 563 ;;
97a847bc
FB
564 --disable-sdl) sdl="no"
565 ;;
c4198157
JQ
566 --enable-sdl) sdl="yes"
567 ;;
0c58ac1c 568 --fmod-lib=*) fmod_lib="$optarg"
1d14ffa9 569 ;;
c2de5c91 570 --fmod-inc=*) fmod_inc="$optarg"
571 ;;
2f6a1ab0
BS
572 --oss-lib=*) oss_lib="$optarg"
573 ;;
2fa7d3bf 574 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
102a52e4 575 ;;
0c58ac1c 576 --audio-drv-list=*) audio_drv_list="$optarg"
102a52e4 577 ;;
eb852011
MA
578 --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
579 ;;
f8393946
AJ
580 --enable-debug-tcg) debug_tcg="yes"
581 ;;
582 --disable-debug-tcg) debug_tcg="no"
583 ;;
b4475aa2
LC
584 --enable-debug-mon) debug_mon="yes"
585 ;;
586 --disable-debug-mon) debug_mon="no"
587 ;;
f3d08ee6
PB
588 --enable-debug)
589 # Enable debugging options that aren't excessively noisy
590 debug_tcg="yes"
b4475aa2 591 debug_mon="yes"
f3d08ee6
PB
592 debug="yes"
593 strip_opt="no"
594 ;;
03b4fe7d
AL
595 --enable-sparse) sparse="yes"
596 ;;
597 --disable-sparse) sparse="no"
598 ;;
1625af87
AL
599 --disable-strip) strip_opt="no"
600 ;;
8d5d2d4c
TS
601 --disable-vnc-tls) vnc_tls="no"
602 ;;
1be10ad2
JQ
603 --enable-vnc-tls) vnc_tls="yes"
604 ;;
2f9606b3
AL
605 --disable-vnc-sasl) vnc_sasl="no"
606 ;;
ea784e3b
JQ
607 --enable-vnc-sasl) vnc_sasl="yes"
608 ;;
2f6f5c7a
CC
609 --disable-vnc-jpeg) vnc_jpeg="no"
610 ;;
611 --enable-vnc-jpeg) vnc_jpeg="yes"
612 ;;
efe556ad
CC
613 --disable-vnc-png) vnc_png="no"
614 ;;
615 --enable-vnc-png) vnc_png="yes"
616 ;;
bd023f95
CC
617 --disable-vnc-thread) vnc_thread="no"
618 ;;
619 --enable-vnc-thread) vnc_thread="yes"
620 ;;
443f1376 621 --disable-slirp) slirp="no"
1d14ffa9 622 ;;
ee682d27
SW
623 --disable-uuid) uuid="no"
624 ;;
625 --enable-uuid) uuid="yes"
626 ;;
e0e6c8c0 627 --disable-vde) vde="no"
8a16d273 628 ;;
dfb278bd
JQ
629 --enable-vde) vde="yes"
630 ;;
e37630ca
AL
631 --disable-xen) xen="no"
632 ;;
fc321b4b
JQ
633 --enable-xen) xen="yes"
634 ;;
2e4d9fb1
AJ
635 --disable-brlapi) brlapi="no"
636 ;;
4ffcedb6
JQ
637 --enable-brlapi) brlapi="yes"
638 ;;
fb599c9a
AZ
639 --disable-bluez) bluez="no"
640 ;;
a20a6f46
JQ
641 --enable-bluez) bluez="yes"
642 ;;
7ba1e619
AL
643 --disable-kvm) kvm="no"
644 ;;
b31a0277
JQ
645 --enable-kvm) kvm="yes"
646 ;;
cd4ec0b4
GH
647 --disable-spice) spice="no"
648 ;;
649 --enable-spice) spice="yes"
650 ;;
05c2a3e7
FB
651 --enable-profiler) profiler="yes"
652 ;;
c2de5c91 653 --enable-cocoa)
654 cocoa="yes" ;
655 sdl="no" ;
656 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
1d14ffa9 657 ;;
cad25d69 658 --disable-system) softmmu="no"
0a8e90f4 659 ;;
cad25d69 660 --enable-system) softmmu="yes"
0a8e90f4 661 ;;
0953a80f
ZA
662 --disable-user)
663 linux_user="no" ;
664 bsd_user="no" ;
665 darwin_user="no"
666 ;;
667 --enable-user) ;;
831b7825 668 --disable-linux-user) linux_user="no"
0a8e90f4 669 ;;
831b7825
TS
670 --enable-linux-user) linux_user="yes"
671 ;;
672 --disable-darwin-user) darwin_user="no"
673 ;;
674 --enable-darwin-user) darwin_user="yes"
0a8e90f4 675 ;;
84778508
BS
676 --disable-bsd-user) bsd_user="no"
677 ;;
678 --enable-bsd-user) bsd_user="yes"
679 ;;
379f6698
PB
680 --enable-guest-base) guest_base="yes"
681 ;;
682 --disable-guest-base) guest_base="no"
683 ;;
34005a00
KS
684 --enable-user-pie) user_pie="yes"
685 ;;
686 --disable-user-pie) user_pie="no"
687 ;;
c5937220
PB
688 --enable-uname-release=*) uname_release="$optarg"
689 ;;
3142255c 690 --sparc_cpu=*)
3142255c 691 ;;
85aa5189
FB
692 --enable-werror) werror="yes"
693 ;;
694 --disable-werror) werror="no"
695 ;;
4d3b6f6e
AZ
696 --disable-curses) curses="no"
697 ;;
c584a6d0
JQ
698 --enable-curses) curses="yes"
699 ;;
769ce76d
AG
700 --disable-curl) curl="no"
701 ;;
788c8196
JQ
702 --enable-curl) curl="yes"
703 ;;
2df87df7
JQ
704 --disable-fdt) fdt="no"
705 ;;
706 --enable-fdt) fdt="yes"
707 ;;
5495ed11
LC
708 --disable-check-utests) check_utests="no"
709 ;;
710 --enable-check-utests) check_utests="yes"
711 ;;
bd0c5661
PB
712 --disable-nptl) nptl="no"
713 ;;
b0a47e79
JQ
714 --enable-nptl) nptl="yes"
715 ;;
8ff9cbf7 716 --enable-mixemu) mixemu="yes"
717 ;;
5c6c3a6c
CH
718 --disable-linux-aio) linux_aio="no"
719 ;;
720 --enable-linux-aio) linux_aio="yes"
721 ;;
758e8e38
VJJ
722 --disable-attr) attr="no"
723 ;;
724 --enable-attr) attr="yes"
725 ;;
e5d355d1
AL
726 --enable-io-thread) io_thread="yes"
727 ;;
77755340
TS
728 --disable-blobs) blobs="no"
729 ;;
eac30262
AL
730 --kerneldir=*) kerneldir="$optarg"
731 ;;
4a19f1ec
PB
732 --with-pkgversion=*) pkgversion=" ($optarg)"
733 ;;
a25dba17 734 --disable-docs) docs="no"
70ec5dc0 735 ;;
a25dba17 736 --enable-docs) docs="yes"
83a3ab8b 737 ;;
d5970055
MT
738 --disable-vhost-net) vhost_net="no"
739 ;;
740 --enable-vhost-net) vhost_net="yes"
741 ;;
6bde81cb
PB
742 --*dir)
743 ;;
7f1559c6
AZ
744 *) echo "ERROR: unknown option $opt"; show_help="yes"
745 ;;
7d13299d
FB
746 esac
747done
748
3142255c
BS
749#
750# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
a558ee17 751# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
3142255c 752#
379f6698 753host_guest_base="no"
40293e58 754case "$cpu" in
ed968ff1
JQ
755 sparc) case $sparc_cpu in
756 v7|v8)
a558ee17 757 QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
ed968ff1
JQ
758 ;;
759 v8plus|v8plusa)
a558ee17 760 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
ed968ff1
JQ
761 ;;
762 *) # sparc_cpu not defined in the command line
a558ee17 763 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
ed968ff1
JQ
764 esac
765 LDFLAGS="-m32 $LDFLAGS"
a558ee17 766 QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
762e8230 767 if test "$solaris" = "no" ; then
a558ee17 768 QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
c81da56e 769 helper_cflags="-ffixed-i0"
762e8230 770 fi
3142255c 771 ;;
ed968ff1 772 sparc64)
a558ee17 773 QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
ed968ff1 774 LDFLAGS="-m64 $LDFLAGS"
a558ee17 775 QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
ed968ff1 776 if test "$solaris" != "no" ; then
a558ee17 777 QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
762e8230 778 fi
3142255c 779 ;;
76d83bde 780 s390)
28d7cc49
RH
781 QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS"
782 LDFLAGS="-m31 $LDFLAGS"
48bb3750 783 host_guest_base="yes"
28d7cc49
RH
784 ;;
785 s390x)
786 QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS"
787 LDFLAGS="-m64 $LDFLAGS"
48bb3750 788 host_guest_base="yes"
76d83bde 789 ;;
40293e58 790 i386)
a558ee17 791 QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
0c439cbf 792 LDFLAGS="-m32 $LDFLAGS"
2b2e59e6 793 cc_i386='$(CC) -m32'
c81da56e 794 helper_cflags="-fomit-frame-pointer"
379f6698 795 host_guest_base="yes"
40293e58
FB
796 ;;
797 x86_64)
a558ee17 798 QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
0c439cbf 799 LDFLAGS="-m64 $LDFLAGS"
2b2e59e6 800 cc_i386='$(CC) -m32'
379f6698
PB
801 host_guest_base="yes"
802 ;;
803 arm*)
804 host_guest_base="yes"
40293e58 805 ;;
f6548c0a 806 ppc*)
807 host_guest_base="yes"
808 ;;
cc01cc8e
AJ
809 mips*)
810 host_guest_base="yes"
811 ;;
477ba620
AJ
812 ia64*)
813 host_guest_base="yes"
814 ;;
fd76e73a
RH
815 hppa*)
816 host_guest_base="yes"
817 ;;
3142255c
BS
818esac
819
379f6698
PB
820[ -z "$guest_base" ] && guest_base="$host_guest_base"
821
af5db58e
PB
822if test x"$show_help" = x"yes" ; then
823cat << EOF
824
825Usage: configure [options]
826Options: [defaults in brackets after descriptions]
827
828EOF
829echo "Standard options:"
830echo " --help print this message"
831echo " --prefix=PREFIX install in PREFIX [$prefix]"
832echo " --interp-prefix=PREFIX where to find shared libraries, etc."
833echo " use %M for cpu name [$interp_prefix]"
834echo " --target-list=LIST set target list [$target_list]"
835echo ""
af5db58e
PB
836echo "Advanced options (experts only):"
837echo " --source-path=PATH path of source code [$source_path]"
838echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
839echo " --cc=CC use C compiler CC [$cc]"
0bfe8cc0
PB
840echo " --host-cc=CC use C compiler CC [$host_cc] for code run at"
841echo " build time"
a558ee17 842echo " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS"
e3fc14c3 843echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS"
af5db58e 844echo " --make=MAKE use specified make [$make]"
6a882643 845echo " --install=INSTALL use specified install [$install]"
af5db58e 846echo " --static enable static build [$static]"
0b24e75f
PB
847echo " --mandir=PATH install man pages in PATH"
848echo " --datadir=PATH install firmware in PATH"
849echo " --docdir=PATH install documentation in PATH"
850echo " --bindir=PATH install binaries in PATH"
851echo " --sysconfdir=PATH install config in PATH/qemu"
f8393946
AJ
852echo " --enable-debug-tcg enable TCG debugging"
853echo " --disable-debug-tcg disable TCG debugging (default)"
09695a4a 854echo " --enable-debug enable common debug build options"
890b1658
AL
855echo " --enable-sparse enable sparse checker"
856echo " --disable-sparse disable sparse checker (default)"
1625af87 857echo " --disable-strip disable stripping binaries"
85aa5189 858echo " --disable-werror disable compilation abort on warning"
fe8f78e4 859echo " --disable-sdl disable SDL"
c4198157 860echo " --enable-sdl enable SDL"
af5db58e 861echo " --enable-cocoa enable COCOA (Mac OS X only)"
c2de5c91 862echo " --audio-drv-list=LIST set audio drivers list:"
863echo " Available drivers: $audio_possible_drivers"
4c9b53e3 864echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
865echo " Available cards: $audio_possible_cards"
eb852011
MA
866echo " --block-drv-whitelist=L set block driver whitelist"
867echo " (affects only QEMU, not qemu-img)"
8ff9cbf7 868echo " --enable-mixemu enable mixer emulation"
e37630ca 869echo " --disable-xen disable xen backend driver support"
fc321b4b 870echo " --enable-xen enable xen backend driver support"
2e4d9fb1 871echo " --disable-brlapi disable BrlAPI"
4ffcedb6 872echo " --enable-brlapi enable BrlAPI"
8d5d2d4c 873echo " --disable-vnc-tls disable TLS encryption for VNC server"
1be10ad2 874echo " --enable-vnc-tls enable TLS encryption for VNC server"
2f9606b3 875echo " --disable-vnc-sasl disable SASL encryption for VNC server"
ea784e3b 876echo " --enable-vnc-sasl enable SASL encryption for VNC server"
2f6f5c7a
CC
877echo " --disable-vnc-jpeg disable JPEG lossy compression for VNC server"
878echo " --enable-vnc-jpeg enable JPEG lossy compression for VNC server"
96763cf9 879echo " --disable-vnc-png disable PNG compression for VNC server (default)"
efe556ad 880echo " --enable-vnc-png enable PNG compression for VNC server"
bd023f95
CC
881echo " --disable-vnc-thread disable threaded VNC server"
882echo " --enable-vnc-thread enable threaded VNC server"
af896aaa 883echo " --disable-curses disable curses output"
c584a6d0 884echo " --enable-curses enable curses output"
769ce76d 885echo " --disable-curl disable curl connectivity"
788c8196 886echo " --enable-curl enable curl connectivity"
2df87df7
JQ
887echo " --disable-fdt disable fdt device tree"
888echo " --enable-fdt enable fdt device tree"
5495ed11
LC
889echo " --disable-check-utests disable check unit-tests"
890echo " --enable-check-utests enable check unit-tests"
fb599c9a 891echo " --disable-bluez disable bluez stack connectivity"
a20a6f46 892echo " --enable-bluez enable bluez stack connectivity"
7ba1e619 893echo " --disable-kvm disable KVM acceleration support"
b31a0277 894echo " --enable-kvm enable KVM acceleration support"
bd0c5661 895echo " --disable-nptl disable usermode NPTL support"
e5934d33 896echo " --enable-nptl enable usermode NPTL support"
af5db58e
PB
897echo " --enable-system enable all system emulation targets"
898echo " --disable-system disable all system emulation targets"
0953a80f
ZA
899echo " --enable-user enable supported user emulation targets"
900echo " --disable-user disable all user emulation targets"
831b7825
TS
901echo " --enable-linux-user enable all linux usermode emulation targets"
902echo " --disable-linux-user disable all linux usermode emulation targets"
903echo " --enable-darwin-user enable all darwin usermode emulation targets"
904echo " --disable-darwin-user disable all darwin usermode emulation targets"
84778508
BS
905echo " --enable-bsd-user enable all BSD usermode emulation targets"
906echo " --disable-bsd-user disable all BSD usermode emulation targets"
379f6698
PB
907echo " --enable-guest-base enable GUEST_BASE support for usermode"
908echo " emulation targets"
909echo " --disable-guest-base disable GUEST_BASE support"
34005a00
KS
910echo " --enable-user-pie build usermode emulation targets as PIE"
911echo " --disable-user-pie do not build usermode emulation targets as PIE"
af5db58e
PB
912echo " --fmod-lib path to FMOD library"
913echo " --fmod-inc path to FMOD includes"
2f6a1ab0 914echo " --oss-lib path to OSS library"
c5937220 915echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
3142255c 916echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
ee682d27
SW
917echo " --disable-uuid disable uuid support"
918echo " --enable-uuid enable uuid support"
e0e6c8c0 919echo " --disable-vde disable support for vde network"
dfb278bd 920echo " --enable-vde enable support for vde network"
5c6c3a6c
CH
921echo " --disable-linux-aio disable Linux AIO support"
922echo " --enable-linux-aio enable Linux AIO support"
758e8e38
VJJ
923echo " --disable-attr disables attr and xattr support"
924echo " --enable-attr enable attr and xattr support"
e5d355d1 925echo " --enable-io-thread enable IO thread"
77755340 926echo " --disable-blobs disable installing provided firmware blobs"
eac30262 927echo " --kerneldir=PATH look for kernel includes in PATH"
d2807bc9
DU
928echo " --enable-docs enable documentation build"
929echo " --disable-docs disable documentation build"
d5970055
MT
930echo " --disable-vhost-net disable vhost-net acceleration support"
931echo " --enable-vhost-net enable vhost-net acceleration support"
b3d08c02 932echo " --trace-backend=B Trace backend nop simple ust dtrace"
9410b56c
PS
933echo " --trace-file=NAME Full PATH,NAME of file to store traces"
934echo " Default:trace-<pid>"
cd4ec0b4
GH
935echo " --disable-spice disable spice"
936echo " --enable-spice enable spice"
af5db58e 937echo ""
5bf08934 938echo "NOTE: The object files are built at the place where configure is launched"
af5db58e
PB
939exit 1
940fi
941
ec530c81
FB
942#
943# Solaris specific configure tool chain decisions
944#
945if test "$solaris" = "yes" ; then
6792aa11
LM
946 if has $install; then
947 :
948 else
ec530c81
FB
949 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
950 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
951 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
952 exit 1
953 fi
6792aa11 954 if test "`path_of $install`" = "/usr/sbin/install" ; then
ec530c81
FB
955 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
956 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
957 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
958 exit 1
959 fi
6792aa11
LM
960 if has ar; then
961 :
962 else
ec530c81
FB
963 echo "Error: No path includes ar"
964 if test -f /usr/ccs/bin/ar ; then
965 echo "Add /usr/ccs/bin to your path and rerun configure"
966 fi
967 exit 1
968 fi
5fafdf24 969fi
ec530c81
FB
970
971
5327cf48
FB
972if test -z "$target_list" ; then
973# these targets are portable
0a8e90f4 974 if [ "$softmmu" = "yes" ] ; then
2408a527
AJ
975 target_list="\
976i386-softmmu \
977x86_64-softmmu \
978arm-softmmu \
979cris-softmmu \
980m68k-softmmu \
72b675ca 981microblaze-softmmu \
2408a527
AJ
982mips-softmmu \
983mipsel-softmmu \
984mips64-softmmu \
985mips64el-softmmu \
986ppc-softmmu \
987ppcemb-softmmu \
988ppc64-softmmu \
989sh4-softmmu \
990sh4eb-softmmu \
991sparc-softmmu \
1b64fcae 992sparc64-softmmu \
2408a527 993"
0a8e90f4 994 fi
5327cf48 995# the following are Linux specific
831b7825 996 if [ "$linux_user" = "yes" ] ; then
2408a527
AJ
997 target_list="${target_list}\
998i386-linux-user \
999x86_64-linux-user \
1000alpha-linux-user \
1001arm-linux-user \
1002armeb-linux-user \
1003cris-linux-user \
1004m68k-linux-user \
72b675ca 1005microblaze-linux-user \
2408a527
AJ
1006mips-linux-user \
1007mipsel-linux-user \
1008ppc-linux-user \
1009ppc64-linux-user \
1010ppc64abi32-linux-user \
1011sh4-linux-user \
1012sh4eb-linux-user \
1013sparc-linux-user \
1014sparc64-linux-user \
1015sparc32plus-linux-user \
1016"
831b7825
TS
1017 fi
1018# the following are Darwin specific
1019 if [ "$darwin_user" = "yes" ] ; then
6cdc7375 1020 target_list="$target_list i386-darwin-user ppc-darwin-user "
5327cf48 1021 fi
84778508
BS
1022# the following are BSD specific
1023 if [ "$bsd_user" = "yes" ] ; then
1024 target_list="${target_list}\
31fc12df
BS
1025i386-bsd-user \
1026x86_64-bsd-user \
1027sparc-bsd-user \
84778508
BS
1028sparc64-bsd-user \
1029"
1030 fi
6e20a45f 1031else
b1a550a0 1032 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
5327cf48 1033fi
0a8e90f4
PB
1034if test -z "$target_list" ; then
1035 echo "No targets enabled"
1036 exit 1
1037fi
f55fe278
PB
1038# see if system emulation was really requested
1039case " $target_list " in
1040 *"-softmmu "*) softmmu=yes
1041 ;;
1042 *) softmmu=no
1043 ;;
1044esac
5327cf48 1045
249247c9
JQ
1046feature_not_found() {
1047 feature=$1
1048
1049 echo "ERROR"
1050 echo "ERROR: User requested feature $feature"
9332f6a2 1051 echo "ERROR: configure was not able to find it"
249247c9
JQ
1052 echo "ERROR"
1053 exit 1;
1054}
1055
7d13299d
FB
1056if test -z "$cross_prefix" ; then
1057
1058# ---
1059# big/little endian test
1060cat > $TMPC << EOF
1061#include <inttypes.h>
1062int main(int argc, char ** argv){
1d14ffa9
FB
1063 volatile uint32_t i=0x01234567;
1064 return (*((uint8_t*)(&i))) == 0x67;
7d13299d
FB
1065}
1066EOF
1067
52166aa0 1068if compile_prog "" "" ; then
7d13299d
FB
1069$TMPE && bigendian="yes"
1070else
1071echo big/little test failed
1072fi
1073
1074else
1075
1076# if cross compiling, cannot launch a program, so make a static guess
ea8f20f8 1077case "$cpu" in
24e804ec 1078 armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
ea8f20f8
JQ
1079 bigendian=yes
1080 ;;
1081esac
7d13299d
FB
1082
1083fi
1084
b6853697
FB
1085# host long bits test
1086hostlongbits="32"
ea8f20f8 1087case "$cpu" in
24e804ec 1088 x86_64|alpha|ia64|sparc64|ppc64|s390x)
ea8f20f8
JQ
1089 hostlongbits=64
1090 ;;
1091esac
b6853697 1092
b0a47e79
JQ
1093
1094##########################################
1095# NPTL probe
1096
1097if test "$nptl" != "no" ; then
1098 cat > $TMPC <<EOF
bd0c5661 1099#include <sched.h>
30813cea 1100#include <linux/futex.h>
bd0c5661
PB
1101void foo()
1102{
1103#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1104#error bork
1105#endif
1106}
1107EOF
1108
b0a47e79
JQ
1109 if compile_object ; then
1110 nptl=yes
1111 else
1112 if test "$nptl" = "yes" ; then
1113 feature_not_found "nptl"
1114 fi
1115 nptl=no
1116 fi
bd0c5661
PB
1117fi
1118
ac62922e
AZ
1119##########################################
1120# zlib check
1121
1122cat > $TMPC << EOF
1123#include <zlib.h>
1124int main(void) { zlibVersion(); return 0; }
1125EOF
52166aa0 1126if compile_prog "" "-lz" ; then
ac62922e
AZ
1127 :
1128else
1129 echo
1130 echo "Error: zlib check failed"
1131 echo "Make sure to have the zlib libs and headers installed."
1132 echo
1133 exit 1
1134fi
1135
e37630ca
AL
1136##########################################
1137# xen probe
1138
fc321b4b 1139if test "$xen" != "no" ; then
b2266bee
JQ
1140 xen_libs="-lxenstore -lxenctrl -lxenguest"
1141 cat > $TMPC <<EOF
e37630ca
AL
1142#include <xenctrl.h>
1143#include <xs.h>
df7a607b 1144int main(void) { xs_daemon_open(); xc_interface_open(); return 0; }
e37630ca 1145EOF
52166aa0 1146 if compile_prog "" "$xen_libs" ; then
fc321b4b 1147 xen=yes
3efd632b 1148 libs_softmmu="$xen_libs $libs_softmmu"
b2266bee 1149 else
fc321b4b
JQ
1150 if test "$xen" = "yes" ; then
1151 feature_not_found "xen"
1152 fi
1153 xen=no
b2266bee 1154 fi
e37630ca
AL
1155fi
1156
f91672e5
PB
1157##########################################
1158# pkgconfig probe
1159
1160pkgconfig="${cross_prefix}pkg-config"
0dba6195 1161if ! has $pkgconfig; then
f91672e5
PB
1162 # likely not cross compiling, or hope for the best
1163 pkgconfig=pkg-config
1164fi
1165
dfffc653
JQ
1166##########################################
1167# Sparse probe
1168if test "$sparse" != "no" ; then
0dba6195 1169 if has cgcc; then
dfffc653
JQ
1170 sparse=yes
1171 else
1172 if test "$sparse" = "yes" ; then
1173 feature_not_found "sparse"
1174 fi
1175 sparse=no
1176 fi
1177fi
1178
11d9f695
FB
1179##########################################
1180# SDL probe
1181
fec0e3e8
SW
1182# Look for sdl configuration program (pkg-config or sdl-config).
1183# Prefer variant with cross prefix if cross compiling,
1184# and favour pkg-config with sdl over sdl-config.
1185if test -n "$cross_prefix" -a $pkgconfig != pkg-config && \
1186 $pkgconfig sdl --modversion >/dev/null 2>&1; then
1187 sdlconfig="$pkgconfig sdl"
1188 _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
1189elif test -n "$cross_prefix" && has ${cross_prefix}sdl-config; then
1190 sdlconfig="${cross_prefix}sdl-config"
1191 _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1192elif $pkgconfig sdl --modversion >/dev/null 2>&1; then
9316f803
PB
1193 sdlconfig="$pkgconfig sdl"
1194 _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
0dba6195 1195elif has sdl-config; then
9316f803
PB
1196 sdlconfig='sdl-config'
1197 _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
a0dfd8a4
LM
1198else
1199 if test "$sdl" = "yes" ; then
1200 feature_not_found "sdl"
1201 fi
1202 sdl=no
9316f803 1203fi
11d9f695 1204
9316f803 1205sdl_too_old=no
c4198157 1206if test "$sdl" != "no" ; then
ac119f9d 1207 cat > $TMPC << EOF
11d9f695
FB
1208#include <SDL.h>
1209#undef main /* We don't want SDL to override our main() */
1210int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1211EOF
9316f803 1212 sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
74f42e18
T
1213 if test "$static" = "yes" ; then
1214 sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
1215 else
1216 sdl_libs=`$sdlconfig --libs 2> /dev/null`
1217 fi
52166aa0 1218 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
ac119f9d
JQ
1219 if test "$_sdlversion" -lt 121 ; then
1220 sdl_too_old=yes
1221 else
1222 if test "$cocoa" = "no" ; then
1223 sdl=yes
1224 fi
1225 fi
cd01b4a3 1226
67c274d3 1227 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
ac119f9d 1228 if test "$sdl" = "yes" -a "$static" = "yes" ; then
67c274d3 1229 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
f8aa6c7b
SW
1230 sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1231 sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
ac119f9d 1232 fi
52166aa0 1233 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
ac119f9d
JQ
1234 :
1235 else
1236 sdl=no
1237 fi
1238 fi # static link
c4198157
JQ
1239 else # sdl not found
1240 if test "$sdl" = "yes" ; then
1241 feature_not_found "sdl"
1242 fi
1243 sdl=no
ac119f9d 1244 fi # sdl compile test
a68551bc 1245fi
11d9f695 1246
5368a422 1247if test "$sdl" = "yes" ; then
ac119f9d 1248 cat > $TMPC <<EOF
5368a422
AL
1249#include <SDL.h>
1250#if defined(SDL_VIDEO_DRIVER_X11)
1251#include <X11/XKBlib.h>
1252#else
1253#error No x11 support
1254#endif
1255int main(void) { return 0; }
1256EOF
52166aa0 1257 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
ac119f9d
JQ
1258 sdl_libs="$sdl_libs -lX11"
1259 fi
07d9ac44
JQ
1260 if test "$mingw32" = "yes" ; then
1261 sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole"
1262 fi
0705667e 1263 libs_softmmu="$sdl_libs $libs_softmmu"
5368a422
AL
1264fi
1265
8d5d2d4c
TS
1266##########################################
1267# VNC TLS detection
1be10ad2
JQ
1268if test "$vnc_tls" != "no" ; then
1269 cat > $TMPC <<EOF
ae6b5e5a
AL
1270#include <gnutls/gnutls.h>
1271int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1272EOF
f91672e5
PB
1273 vnc_tls_cflags=`$pkgconfig --cflags gnutls 2> /dev/null`
1274 vnc_tls_libs=`$pkgconfig --libs gnutls 2> /dev/null`
1be10ad2
JQ
1275 if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
1276 vnc_tls=yes
1277 libs_softmmu="$vnc_tls_libs $libs_softmmu"
1278 else
1279 if test "$vnc_tls" = "yes" ; then
1280 feature_not_found "vnc-tls"
ae6b5e5a 1281 fi
1be10ad2
JQ
1282 vnc_tls=no
1283 fi
8d5d2d4c
TS
1284fi
1285
2f9606b3
AL
1286##########################################
1287# VNC SASL detection
3aefa744 1288if test "$vnc_sasl" != "no" ; then
ea784e3b 1289 cat > $TMPC <<EOF
2f9606b3
AL
1290#include <sasl/sasl.h>
1291#include <stdio.h>
1292int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
1293EOF
ea784e3b
JQ
1294 # Assuming Cyrus-SASL installed in /usr prefix
1295 vnc_sasl_cflags=""
1296 vnc_sasl_libs="-lsasl2"
1297 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1298 vnc_sasl=yes
1299 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
1300 else
1301 if test "$vnc_sasl" = "yes" ; then
1302 feature_not_found "vnc-sasl"
2f9606b3 1303 fi
ea784e3b
JQ
1304 vnc_sasl=no
1305 fi
2f9606b3
AL
1306fi
1307
2f6f5c7a
CC
1308##########################################
1309# VNC JPEG detection
96763cf9 1310if test "$vnc_jpeg" != "no" ; then
2f6f5c7a
CC
1311cat > $TMPC <<EOF
1312#include <stdio.h>
1313#include <jpeglib.h>
1314int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
1315EOF
1316 vnc_jpeg_cflags=""
1317 vnc_jpeg_libs="-ljpeg"
1318 if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
1319 vnc_jpeg=yes
1320 libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
1321 else
1322 if test "$vnc_jpeg" = "yes" ; then
1323 feature_not_found "vnc-jpeg"
1324 fi
1325 vnc_jpeg=no
1326 fi
1327fi
1328
efe556ad
CC
1329##########################################
1330# VNC PNG detection
96763cf9 1331if test "$vnc_png" != "no" ; then
efe556ad
CC
1332cat > $TMPC <<EOF
1333//#include <stdio.h>
1334#include <png.h>
832ce9c2 1335#include <stddef.h>
efe556ad
CC
1336int main(void) {
1337 png_structp png_ptr;
1338 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
1339 return 0;
1340}
1341EOF
1342 vnc_png_cflags=""
1343 vnc_png_libs="-lpng"
1344 if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
1345 vnc_png=yes
1346 libs_softmmu="$vnc_png_libs $libs_softmmu"
1347 else
1348 if test "$vnc_png" = "yes" ; then
1349 feature_not_found "vnc-png"
1350 fi
1351 vnc_png=no
1352 fi
1353fi
1354
76655d6d
AL
1355##########################################
1356# fnmatch() probe, used for ACL routines
1357fnmatch="no"
1358cat > $TMPC << EOF
1359#include <fnmatch.h>
1360int main(void)
1361{
1362 fnmatch("foo", "foo", 0);
1363 return 0;
1364}
1365EOF
52166aa0 1366if compile_prog "" "" ; then
76655d6d
AL
1367 fnmatch="yes"
1368fi
1369
ee682d27
SW
1370##########################################
1371# uuid_generate() probe, used for vdi block driver
1372if test "$uuid" != "no" ; then
1373 uuid_libs="-luuid"
1374 cat > $TMPC << EOF
1375#include <uuid/uuid.h>
1376int main(void)
1377{
1378 uuid_t my_uuid;
1379 uuid_generate(my_uuid);
1380 return 0;
1381}
1382EOF
1383 if compile_prog "" "$uuid_libs" ; then
1384 uuid="yes"
1385 libs_softmmu="$uuid_libs $libs_softmmu"
1386 libs_tools="$uuid_libs $libs_tools"
1387 else
1388 if test "$uuid" = "yes" ; then
1389 feature_not_found "uuid"
1390 fi
1391 uuid=no
1392 fi
1393fi
1394
8a16d273
TS
1395##########################################
1396# vde libraries probe
dfb278bd 1397if test "$vde" != "no" ; then
4baae0ac 1398 vde_libs="-lvdeplug"
8a16d273
TS
1399 cat > $TMPC << EOF
1400#include <libvdeplug.h>
4a7f0e06
PB
1401int main(void)
1402{
1403 struct vde_open_args a = {0, 0, 0};
1404 vde_open("", "", &a);
1405 return 0;
1406}
8a16d273 1407EOF
52166aa0 1408 if compile_prog "" "$vde_libs" ; then
4baae0ac 1409 vde=yes
8e02e54c
JQ
1410 libs_softmmu="$vde_libs $libs_softmmu"
1411 libs_tools="$vde_libs $libs_tools"
dfb278bd
JQ
1412 else
1413 if test "$vde" = "yes" ; then
1414 feature_not_found "vde"
1415 fi
1416 vde=no
4baae0ac 1417 fi
8a16d273
TS
1418fi
1419
8f28f3fb 1420##########################################
c2de5c91 1421# Sound support libraries probe
8f28f3fb 1422
c2de5c91 1423audio_drv_probe()
1424{
1425 drv=$1
1426 hdr=$2
1427 lib=$3
1428 exp=$4
1429 cfl=$5
1430 cat > $TMPC << EOF
1431#include <$hdr>
1432int main(void) { $exp }
8f28f3fb 1433EOF
52166aa0 1434 if compile_prog "$cfl" "$lib" ; then
c2de5c91 1435 :
1436 else
1437 echo
1438 echo "Error: $drv check failed"
1439 echo "Make sure to have the $drv libs and headers installed."
1440 echo
1441 exit 1
1442 fi
1443}
1444
2fa7d3bf 1445audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
c2de5c91 1446for drv in $audio_drv_list; do
1447 case $drv in
1448 alsa)
1449 audio_drv_probe $drv alsa/asoundlib.h -lasound \
1450 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
a4bf6780 1451 libs_softmmu="-lasound $libs_softmmu"
c2de5c91 1452 ;;
1453
1454 fmod)
1455 if test -z $fmod_lib || test -z $fmod_inc; then
1456 echo
1457 echo "Error: You must specify path to FMOD library and headers"
1458 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1459 echo
1460 exit 1
1461 fi
1462 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
a4bf6780 1463 libs_softmmu="$fmod_lib $libs_softmmu"
c2de5c91 1464 ;;
1465
1466 esd)
1467 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
a4bf6780 1468 libs_softmmu="-lesd $libs_softmmu"
67f86e8e 1469 audio_pt_int="yes"
c2de5c91 1470 ;;
b8e59f18 1471
1472 pa)
493abda6 1473 audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
b8e59f18 1474 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
493abda6 1475 libs_softmmu="-lpulse -lpulse-simple $libs_softmmu"
67f86e8e 1476 audio_pt_int="yes"
b8e59f18 1477 ;;
1478
997e690a
JQ
1479 coreaudio)
1480 libs_softmmu="-framework CoreAudio $libs_softmmu"
1481 ;;
1482
a4bf6780
JQ
1483 dsound)
1484 libs_softmmu="-lole32 -ldxguid $libs_softmmu"
d5631638 1485 audio_win_int="yes"
a4bf6780
JQ
1486 ;;
1487
1488 oss)
1489 libs_softmmu="$oss_lib $libs_softmmu"
1490 ;;
1491
1492 sdl|wav)
2f6a1ab0
BS
1493 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1494 ;;
1495
d5631638 1496 winwave)
1497 libs_softmmu="-lwinmm $libs_softmmu"
1498 audio_win_int="yes"
1499 ;;
1500
e4c63a6a 1501 *)
1c9b2a52 1502 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
e4c63a6a 1503 echo
1504 echo "Error: Unknown driver '$drv' selected"
1505 echo "Possible drivers are: $audio_possible_drivers"
1506 echo
1507 exit 1
1508 }
1509 ;;
c2de5c91 1510 esac
1511done
8f28f3fb 1512
2e4d9fb1
AJ
1513##########################################
1514# BrlAPI probe
1515
4ffcedb6 1516if test "$brlapi" != "no" ; then
eb82284f
JQ
1517 brlapi_libs="-lbrlapi"
1518 cat > $TMPC << EOF
2e4d9fb1 1519#include <brlapi.h>
832ce9c2 1520#include <stddef.h>
2e4d9fb1
AJ
1521int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1522EOF
52166aa0 1523 if compile_prog "" "$brlapi_libs" ; then
eb82284f 1524 brlapi=yes
264606b3 1525 libs_softmmu="$brlapi_libs $libs_softmmu"
4ffcedb6
JQ
1526 else
1527 if test "$brlapi" = "yes" ; then
1528 feature_not_found "brlapi"
1529 fi
1530 brlapi=no
eb82284f
JQ
1531 fi
1532fi
2e4d9fb1 1533
4d3b6f6e
AZ
1534##########################################
1535# curses probe
4f78ef9a 1536curses_list="-lncurses -lcurses"
4d3b6f6e 1537
c584a6d0
JQ
1538if test "$curses" != "no" ; then
1539 curses_found=no
4d3b6f6e
AZ
1540 cat > $TMPC << EOF
1541#include <curses.h>
5a8ff3aa
BS
1542#ifdef __OpenBSD__
1543#define resize_term resizeterm
1544#endif
1545int main(void) { resize_term(0, 0); return curses_version(); }
4d3b6f6e 1546EOF
4f78ef9a
JQ
1547 for curses_lib in $curses_list; do
1548 if compile_prog "" "$curses_lib" ; then
c584a6d0 1549 curses_found=yes
4f78ef9a
JQ
1550 libs_softmmu="$curses_lib $libs_softmmu"
1551 break
1552 fi
1553 done
c584a6d0
JQ
1554 if test "$curses_found" = "yes" ; then
1555 curses=yes
1556 else
1557 if test "$curses" = "yes" ; then
1558 feature_not_found "curses"
1559 fi
1560 curses=no
1561 fi
4f78ef9a 1562fi
4d3b6f6e 1563
769ce76d
AG
1564##########################################
1565# curl probe
1566
4e2b0658
PB
1567if $pkgconfig libcurl --modversion >/dev/null 2>&1; then
1568 curlconfig="$pkgconfig libcurl"
1569else
1570 curlconfig=curl-config
1571fi
1572
788c8196 1573if test "$curl" != "no" ; then
769ce76d
AG
1574 cat > $TMPC << EOF
1575#include <curl/curl.h>
1576int main(void) { return curl_easy_init(); }
1577EOF
4e2b0658
PB
1578 curl_cflags=`$curlconfig --cflags 2>/dev/null`
1579 curl_libs=`$curlconfig --libs 2>/dev/null`
b1d5a277 1580 if compile_prog "$curl_cflags" "$curl_libs" ; then
769ce76d 1581 curl=yes
f0302935
JQ
1582 libs_tools="$curl_libs $libs_tools"
1583 libs_softmmu="$curl_libs $libs_softmmu"
788c8196
JQ
1584 else
1585 if test "$curl" = "yes" ; then
1586 feature_not_found "curl"
1587 fi
1588 curl=no
769ce76d
AG
1589 fi
1590fi # test "$curl"
1591
5495ed11
LC
1592##########################################
1593# check framework probe
1594
1595if test "$check_utests" != "no" ; then
1596 cat > $TMPC << EOF
1597#include <check.h>
1598int main(void) { suite_create("qemu test"); return 0; }
1599EOF
f91672e5 1600 check_libs=`$pkgconfig --libs check`
5495ed11
LC
1601 if compile_prog "" $check_libs ; then
1602 check_utests=yes
1603 libs_tools="$check_libs $libs_tools"
1604 else
1605 if test "$check_utests" = "yes" ; then
1606 feature_not_found "check"
1607 fi
1608 check_utests=no
1609 fi
1610fi # test "$check_utests"
1611
fb599c9a
AZ
1612##########################################
1613# bluez support probe
a20a6f46 1614if test "$bluez" != "no" ; then
e820e3f4
AZ
1615 cat > $TMPC << EOF
1616#include <bluetooth/bluetooth.h>
1617int main(void) { return bt_error(0); }
1618EOF
f91672e5
PB
1619 bluez_cflags=`$pkgconfig --cflags bluez 2> /dev/null`
1620 bluez_libs=`$pkgconfig --libs bluez 2> /dev/null`
52166aa0 1621 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
a20a6f46 1622 bluez=yes
e482d56a 1623 libs_softmmu="$bluez_libs $libs_softmmu"
e820e3f4 1624 else
a20a6f46
JQ
1625 if test "$bluez" = "yes" ; then
1626 feature_not_found "bluez"
1627 fi
e820e3f4
AZ
1628 bluez="no"
1629 fi
fb599c9a
AZ
1630fi
1631
7ba1e619
AL
1632##########################################
1633# kvm probe
b31a0277 1634if test "$kvm" != "no" ; then
7ba1e619
AL
1635 cat > $TMPC <<EOF
1636#include <linux/kvm.h>
9fd8d8d7 1637#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
7ba1e619
AL
1638#error Invalid KVM version
1639#endif
9fd8d8d7
AL
1640#if !defined(KVM_CAP_USER_MEMORY)
1641#error Missing KVM capability KVM_CAP_USER_MEMORY
1642#endif
1643#if !defined(KVM_CAP_SET_TSS_ADDR)
1644#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1645#endif
1646#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1647#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1648#endif
7ba1e619
AL
1649int main(void) { return 0; }
1650EOF
eac30262
AL
1651 if test "$kerneldir" != "" ; then
1652 kvm_cflags=-I"$kerneldir"/include
8444eb6e
AL
1653 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1654 -a -d "$kerneldir/arch/x86/include" ; then
1655 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
406b430d
AL
1656 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1657 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
0e60a699
AG
1658 elif test "$cpu" = "s390x" -a -d "$kerneldir/arch/s390/include" ; then
1659 kvm_cflags="$kvm_cflags -I$kerneldir/arch/s390/include"
8444eb6e
AL
1660 elif test -d "$kerneldir/arch/$cpu/include" ; then
1661 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1662 fi
eac30262 1663 else
f038e8f7 1664 kvm_cflags=`$pkgconfig --cflags kvm-kmod 2>/dev/null`
eac30262 1665 fi
52166aa0 1666 if compile_prog "$kvm_cflags" "" ; then
b31a0277 1667 kvm=yes
dae5079a
JK
1668 cat > $TMPC <<EOF
1669#include <linux/kvm_para.h>
1670int main(void) { return 0; }
1671EOF
1672 if compile_prog "$kvm_cflags" "" ; then
1673 kvm_para=yes
1674 fi
7ba1e619 1675 else
b31a0277 1676 if test "$kvm" = "yes" ; then
0dba6195 1677 if has awk && has grep; then
b31a0277 1678 kvmerr=`LANG=C $cc $QEMU_CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \
9fd8d8d7
AL
1679 | grep "error: " \
1680 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
b31a0277
JQ
1681 if test "$kvmerr" != "" ; then
1682 echo -e "${kvmerr}\n\
1683 NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \
1684 recent kvm-kmod from http://sourceforge.net/projects/kvm."
1685 fi
9fd8d8d7 1686 fi
b31a0277 1687 feature_not_found "kvm"
9fd8d8d7 1688 fi
b31a0277 1689 kvm=no
7ba1e619
AL
1690 fi
1691fi
1692
d5970055
MT
1693##########################################
1694# test for vhost net
1695
1696if test "$vhost_net" != "no"; then
1697 if test "$kvm" != "no"; then
1698 cat > $TMPC <<EOF
1699 #include <linux/vhost.h>
1700 int main(void) { return 0; }
1701EOF
1702 if compile_prog "$kvm_cflags" "" ; then
1703 vhost_net=yes
1704 else
1705 if test "$vhost_net" = "yes" ; then
1706 feature_not_found "vhost-net"
1707 fi
1708 vhost_net=no
1709 fi
1710 else
1711 if test "$vhost_net" = "yes" ; then
4021d247 1712 echo "NOTE: vhost-net feature requires KVM (--enable-kvm)."
d5970055
MT
1713 feature_not_found "vhost-net"
1714 fi
1715 vhost_net=no
1716 fi
1717fi
1718
414f0dab 1719##########################################
e5d355d1 1720# pthread probe
de65fe0f 1721PTHREADLIBS_LIST="-lpthread -lpthreadGC2"
3c529d93 1722
4dd75c70 1723pthread=no
e5d355d1 1724cat > $TMPC << EOF
3c529d93 1725#include <pthread.h>
de65fe0f 1726int main(void) { pthread_create(0,0,0,0); return 0; }
414f0dab 1727EOF
bd00d539
AF
1728if compile_prog "" "" ; then
1729 pthread=yes
1730else
1731 for pthread_lib in $PTHREADLIBS_LIST; do
1732 if compile_prog "" "$pthread_lib" ; then
1733 pthread=yes
1734 LIBS="$pthread_lib $LIBS"
1735 break
1736 fi
1737 done
1738fi
414f0dab 1739
4617e593 1740if test "$mingw32" != yes -a "$pthread" = no; then
4dd75c70
CH
1741 echo
1742 echo "Error: pthread check failed"
1743 echo "Make sure to have the pthread libs and headers installed."
1744 echo
1745 exit 1
e5d355d1
AL
1746fi
1747
5c6c3a6c
CH
1748##########################################
1749# linux-aio probe
5c6c3a6c
CH
1750
1751if test "$linux_aio" != "no" ; then
1752 cat > $TMPC <<EOF
1753#include <libaio.h>
1754#include <sys/eventfd.h>
832ce9c2 1755#include <stddef.h>
5c6c3a6c
CH
1756int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
1757EOF
1758 if compile_prog "" "-laio" ; then
1759 linux_aio=yes
048d179f
PB
1760 libs_softmmu="$libs_softmmu -laio"
1761 libs_tools="$libs_tools -laio"
5c6c3a6c
CH
1762 else
1763 if test "$linux_aio" = "yes" ; then
1764 feature_not_found "linux AIO"
1765 fi
3cfcae3c 1766 linux_aio=no
5c6c3a6c
CH
1767 fi
1768fi
1769
758e8e38
VJJ
1770##########################################
1771# attr probe
1772
1773if test "$attr" != "no" ; then
1774 cat > $TMPC <<EOF
1775#include <stdio.h>
1776#include <sys/types.h>
1777#include <attr/xattr.h>
1778int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
1779EOF
1780 if compile_prog "" "-lattr" ; then
1781 attr=yes
1782 LIBS="-lattr $LIBS"
1783 else
1784 if test "$attr" = "yes" ; then
1785 feature_not_found "ATTR"
1786 fi
1787 attr=no
1788 fi
1789fi
1790
bf9298b9
AL
1791##########################################
1792# iovec probe
1793cat > $TMPC <<EOF
db34f0b3 1794#include <sys/types.h>
bf9298b9 1795#include <sys/uio.h>
db34f0b3 1796#include <unistd.h>
bf9298b9
AL
1797int main(void) { struct iovec iov; return 0; }
1798EOF
1799iovec=no
52166aa0 1800if compile_prog "" "" ; then
bf9298b9
AL
1801 iovec=yes
1802fi
1803
ceb42de8
AL
1804##########################################
1805# preadv probe
1806cat > $TMPC <<EOF
1807#include <sys/types.h>
1808#include <sys/uio.h>
1809#include <unistd.h>
1810int main(void) { preadv; }
1811EOF
1812preadv=no
52166aa0 1813if compile_prog "" "" ; then
ceb42de8
AL
1814 preadv=yes
1815fi
1816
f652e6af
AJ
1817##########################################
1818# fdt probe
2df87df7 1819if test "$fdt" != "no" ; then
b41af4ba
JQ
1820 fdt_libs="-lfdt"
1821 cat > $TMPC << EOF
f652e6af
AJ
1822int main(void) { return 0; }
1823EOF
52166aa0 1824 if compile_prog "" "$fdt_libs" ; then
f652e6af 1825 fdt=yes
e4782985 1826 libs_softmmu="$fdt_libs $libs_softmmu"
2df87df7
JQ
1827 else
1828 if test "$fdt" = "yes" ; then
1829 feature_not_found "fdt"
1830 fi
1831 fdt=no
f652e6af
AJ
1832 fi
1833fi
1834
3b3f24ad
AJ
1835#
1836# Check for xxxat() functions when we are building linux-user
1837# emulator. This is done because older glibc versions don't
1838# have syscall stubs for these implemented.
1839#
1840atfile=no
67ba57f6 1841cat > $TMPC << EOF
3b3f24ad
AJ
1842#define _ATFILE_SOURCE
1843#include <sys/types.h>
1844#include <fcntl.h>
1845#include <unistd.h>
1846
1847int
1848main(void)
1849{
1850 /* try to unlink nonexisting file */
1851 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1852}
1853EOF
52166aa0 1854if compile_prog "" "" ; then
67ba57f6 1855 atfile=yes
3b3f24ad
AJ
1856fi
1857
39386ac7 1858# Check for inotify functions when we are building linux-user
3b3f24ad
AJ
1859# emulator. This is done because older glibc versions don't
1860# have syscall stubs for these implemented. In that case we
1861# don't provide them even if kernel supports them.
1862#
1863inotify=no
67ba57f6 1864cat > $TMPC << EOF
3b3f24ad
AJ
1865#include <sys/inotify.h>
1866
1867int
1868main(void)
1869{
1870 /* try to start inotify */
8690e420 1871 return inotify_init();
3b3f24ad
AJ
1872}
1873EOF
52166aa0 1874if compile_prog "" "" ; then
67ba57f6 1875 inotify=yes
3b3f24ad
AJ
1876fi
1877
c05c7a73
RV
1878inotify1=no
1879cat > $TMPC << EOF
1880#include <sys/inotify.h>
1881
1882int
1883main(void)
1884{
1885 /* try to start inotify */
1886 return inotify_init1(0);
1887}
1888EOF
1889if compile_prog "" "" ; then
1890 inotify1=yes
1891fi
1892
ebc996f3
RV
1893# check if utimensat and futimens are supported
1894utimens=no
1895cat > $TMPC << EOF
1896#define _ATFILE_SOURCE
ebc996f3
RV
1897#include <stddef.h>
1898#include <fcntl.h>
1899
1900int main(void)
1901{
1902 utimensat(AT_FDCWD, "foo", NULL, 0);
1903 futimens(0, NULL);
1904 return 0;
1905}
1906EOF
52166aa0 1907if compile_prog "" "" ; then
ebc996f3
RV
1908 utimens=yes
1909fi
1910
099d6b0f
RV
1911# check if pipe2 is there
1912pipe2=no
1913cat > $TMPC << EOF
099d6b0f
RV
1914#include <unistd.h>
1915#include <fcntl.h>
1916
1917int main(void)
1918{
1919 int pipefd[2];
1920 pipe2(pipefd, O_CLOEXEC);
1921 return 0;
1922}
1923EOF
52166aa0 1924if compile_prog "" "" ; then
099d6b0f
RV
1925 pipe2=yes
1926fi
1927
40ff6d7e
KW
1928# check if accept4 is there
1929accept4=no
1930cat > $TMPC << EOF
40ff6d7e
KW
1931#include <sys/socket.h>
1932#include <stddef.h>
1933
1934int main(void)
1935{
1936 accept4(0, NULL, NULL, SOCK_CLOEXEC);
1937 return 0;
1938}
1939EOF
1940if compile_prog "" "" ; then
1941 accept4=yes
1942fi
1943
3ce34dfb 1944# check if tee/splice is there. vmsplice was added same time.
1945splice=no
1946cat > $TMPC << EOF
3ce34dfb 1947#include <unistd.h>
1948#include <fcntl.h>
1949#include <limits.h>
1950
1951int main(void)
1952{
1953 int len, fd;
1954 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
1955 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
1956 return 0;
1957}
1958EOF
52166aa0 1959if compile_prog "" "" ; then
3ce34dfb 1960 splice=yes
1961fi
1962
dcc38d1c
MT
1963##########################################
1964# signalfd probe
1965signalfd="no"
1966cat > $TMPC << EOF
1967#define _GNU_SOURCE
1968#include <unistd.h>
1969#include <sys/syscall.h>
1970#include <signal.h>
1971int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
1972EOF
1973
1974if compile_prog "" "" ; then
1975 signalfd=yes
1976fi
1977
c2882b96
RV
1978# check if eventfd is supported
1979eventfd=no
1980cat > $TMPC << EOF
1981#include <sys/eventfd.h>
1982
1983int main(void)
1984{
1985 int efd = eventfd(0, 0);
1986 return 0;
1987}
1988EOF
1989if compile_prog "" "" ; then
1990 eventfd=yes
1991fi
1992
d0927938
UH
1993# check for fallocate
1994fallocate=no
1995cat > $TMPC << EOF
1996#include <fcntl.h>
1997
1998int main(void)
1999{
2000 fallocate(0, 0, 0, 0);
2001 return 0;
2002}
2003EOF
be17dc90 2004if compile_prog "$ARCH_CFLAGS" "" ; then
d0927938
UH
2005 fallocate=yes
2006fi
2007
2008# check for dup3
2009dup3=no
2010cat > $TMPC << EOF
2011#include <unistd.h>
2012
2013int main(void)
2014{
2015 dup3(0, 0, 0);
2016 return 0;
2017}
2018EOF
78f5d726 2019if compile_prog "" "" ; then
d0927938
UH
2020 dup3=yes
2021fi
2022
cc8ae6de 2023# Check if tools are available to build documentation.
a25dba17 2024if test "$docs" != "no" ; then
01668d98 2025 if has makeinfo && has pod2man; then
a25dba17 2026 docs=yes
83a3ab8b 2027 else
a25dba17
JQ
2028 if test "$docs" = "yes" ; then
2029 feature_not_found "docs"
83a3ab8b 2030 fi
a25dba17 2031 docs=no
83a3ab8b 2032 fi
cc8ae6de
PB
2033fi
2034
f514f41c 2035# Search for bswap_32 function
6ae9a1f4
JQ
2036byteswap_h=no
2037cat > $TMPC << EOF
2038#include <byteswap.h>
2039int main(void) { return bswap_32(0); }
2040EOF
52166aa0 2041if compile_prog "" "" ; then
6ae9a1f4
JQ
2042 byteswap_h=yes
2043fi
2044
f514f41c 2045# Search for bswap_32 function
6ae9a1f4
JQ
2046bswap_h=no
2047cat > $TMPC << EOF
2048#include <sys/endian.h>
2049#include <sys/types.h>
2050#include <machine/bswap.h>
2051int main(void) { return bswap32(0); }
2052EOF
52166aa0 2053if compile_prog "" "" ; then
6ae9a1f4
JQ
2054 bswap_h=yes
2055fi
2056
da93a1fd
AL
2057##########################################
2058# Do we need librt
2059cat > $TMPC <<EOF
2060#include <signal.h>
2061#include <time.h>
2062int main(void) { clockid_t id; return clock_gettime(id, NULL); }
2063EOF
2064
52166aa0 2065if compile_prog "" "" ; then
07ffa4bd 2066 :
52166aa0 2067elif compile_prog "" "-lrt" ; then
07ffa4bd 2068 LIBS="-lrt $LIBS"
da93a1fd
AL
2069fi
2070
31ff504d 2071if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
179cf400 2072 "$aix" != "yes" -a "$haiku" != "yes" ; then
6362a53f
JQ
2073 libs_softmmu="-lutil $libs_softmmu"
2074fi
2075
de5071c5
BS
2076##########################################
2077# check if the compiler defines offsetof
2078
2079need_offsetof=yes
2080cat > $TMPC << EOF
2081#include <stddef.h>
2082int main(void) { struct s { int f; }; return offsetof(struct s, f); }
2083EOF
2084if compile_prog "" "" ; then
2085 need_offsetof=no
2086fi
2087
747bbdf7
BS
2088##########################################
2089# check if the compiler understands attribute warn_unused_result
2090#
2091# This could be smarter, but gcc -Werror does not error out even when warning
2092# about attribute warn_unused_result
2093
2094gcc_attribute_warn_unused_result=no
2095cat > $TMPC << EOF
2096#if defined(__GNUC__) && (__GNUC__ < 4) && defined(__GNUC_MINOR__) && (__GNUC__ < 4)
2097#error gcc 3.3 or older
2098#endif
2099int main(void) { return 0;}
2100EOF
2101if compile_prog "" ""; then
2102 gcc_attribute_warn_unused_result=yes
2103fi
2104
cd4ec0b4
GH
2105# spice probe
2106if test "$spice" != "no" ; then
2107 cat > $TMPC << EOF
2108#include <spice.h>
2109int main(void) { spice_server_new(); return 0; }
2110EOF
2111 spice_cflags=$($pkgconfig --cflags spice-protocol spice-server 2>/dev/null)
2112 spice_libs=$($pkgconfig --libs spice-protocol spice-server 2>/dev/null)
ba807829 2113 if $pkgconfig --atleast-version=0.5.3 spice-server >/dev/null 2>&1 && \
cd4ec0b4
GH
2114 compile_prog "$spice_cflags" "$spice_libs" ; then
2115 spice="yes"
2116 libs_softmmu="$libs_softmmu $spice_libs"
2117 QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
2118 else
2119 if test "$spice" = "yes" ; then
2120 feature_not_found "spice"
2121 fi
2122 spice="no"
2123 fi
2124fi
2125
2126##########################################
2127
5f6b9e8f
BS
2128##########################################
2129# check if we have fdatasync
2130
2131fdatasync=no
2132cat > $TMPC << EOF
2133#include <unistd.h>
2134int main(void) { return fdatasync(0); }
2135EOF
2136if compile_prog "" "" ; then
2137 fdatasync=yes
2138fi
2139
e78815a5
AF
2140##########################################
2141# check if we have madvise
2142
2143madvise=no
2144cat > $TMPC << EOF
2145#include <sys/types.h>
2146#include <sys/mman.h>
832ce9c2 2147#include <stddef.h>
e78815a5
AF
2148int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
2149EOF
2150if compile_prog "" "" ; then
2151 madvise=yes
2152fi
2153
2154##########################################
2155# check if we have posix_madvise
2156
2157posix_madvise=no
2158cat > $TMPC << EOF
2159#include <sys/mman.h>
832ce9c2 2160#include <stddef.h>
e78815a5
AF
2161int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
2162EOF
2163if compile_prog "" "" ; then
2164 posix_madvise=yes
2165fi
2166
94a420b1
SH
2167##########################################
2168# check if trace backend exists
2169
2170sh "$source_path/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null
2171if test "$?" -ne 0 ; then
2172 echo
2173 echo "Error: invalid trace backend"
2174 echo "Please choose a supported trace backend."
2175 echo
2176 exit 1
2177fi
2178
7e24e92a
SH
2179##########################################
2180# For 'ust' backend, test if ust headers are present
2181if test "$trace_backend" = "ust"; then
2182 cat > $TMPC << EOF
2183#include <ust/tracepoint.h>
2184#include <ust/marker.h>
2185int main(void) { return 0; }
2186EOF
2187 if compile_prog "" "" ; then
2188 LIBS="-lust $LIBS"
2189 else
2190 echo
2191 echo "Error: Trace backend 'ust' missing libust header files"
2192 echo
2193 exit 1
2194 fi
2195fi
b3d08c02
DB
2196
2197##########################################
2198# For 'dtrace' backend, test if 'dtrace' command is present
2199if test "$trace_backend" = "dtrace"; then
2200 if ! has 'dtrace' ; then
2201 echo
2202 echo "Error: dtrace command is not found in PATH $PATH"
2203 echo
2204 exit 1
2205 fi
c276b17d
DB
2206 trace_backend_stap="no"
2207 if has 'stap' ; then
2208 trace_backend_stap="yes"
2209 fi
b3d08c02
DB
2210fi
2211
7e24e92a 2212##########################################
e86ecd4b
JQ
2213# End of CC checks
2214# After here, no more $cc or $ld runs
2215
e86ecd4b 2216if test "$debug" = "no" ; then
1156c669 2217 CFLAGS="-O2 $CFLAGS"
e86ecd4b 2218fi
a316e378 2219
e86ecd4b
JQ
2220# Consult white-list to determine whether to enable werror
2221# by default. Only enable by default for git builds
20ff6c80
AL
2222z_version=`cut -f3 -d. $source_path/VERSION`
2223
e86ecd4b 2224if test -z "$werror" ; then
e86ecd4b
JQ
2225 if test "$z_version" = "50" -a \
2226 "$linux" = "yes" ; then
2227 werror="yes"
2228 else
2229 werror="no"
2230 fi
2231fi
2232
20ff6c80
AL
2233# Disable zero malloc errors for official releases unless explicitly told to
2234# enable/disable
2235if test -z "$zero_malloc" ; then
2236 if test "$z_version" = "50" ; then
2237 zero_malloc="no"
2238 else
2239 zero_malloc="yes"
2240 fi
2241fi
2242
e86ecd4b 2243if test "$werror" = "yes" ; then
a558ee17 2244 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
e86ecd4b
JQ
2245fi
2246
2247if test "$solaris" = "no" ; then
2248 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
1156c669 2249 LDFLAGS="-Wl,--warn-common $LDFLAGS"
e86ecd4b
JQ
2250 fi
2251fi
2252
952afb71
BS
2253# Use ASLR, no-SEH and DEP if available
2254if test "$mingw32" = "yes" ; then
2255 for flag in --dynamicbase --no-seh --nxcompat; do
2256 if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
2257 LDFLAGS="-Wl,$flag $LDFLAGS"
2258 fi
2259 done
2260fi
2261
190e9c59 2262confdir=$sysconfdir$confsuffix
e7b45cc4 2263
ca35f780
PB
2264tools=
2265if test "$softmmu" = yes ; then
2266 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
2267 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
2268 tools="qemu-nbd\$(EXESUF) $tools"
2269 if [ "$check_utests" = "yes" ]; then
2270 tools="check-qint check-qstring check-qdict check-qlist $tools"
2271 tools="check-qfloat check-qjson $tools"
2272 fi
2273 fi
2274fi
2275
2276# Mac OS X ships with a broken assembler
2277roms=
2278if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
2279 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
2280 "$softmmu" = yes ; then
2281 roms="optionrom"
2282fi
2283
2284
43ce4dfe 2285echo "Install prefix $prefix"
f2b9e1e3
PB
2286echo "BIOS directory `eval echo $datadir`"
2287echo "binary directory `eval echo $bindir`"
1c0fd160 2288echo "config directory `eval echo $sysconfdir`"
11d9f695 2289if test "$mingw32" = "no" ; then
f2b9e1e3 2290echo "Manual directory `eval echo $mandir`"
43ce4dfe 2291echo "ELF interp prefix $interp_prefix"
11d9f695 2292fi
5a67135a 2293echo "Source path $source_path"
43ce4dfe 2294echo "C compiler $cc"
83469015 2295echo "Host C compiler $host_cc"
0c439cbf 2296echo "CFLAGS $CFLAGS"
a558ee17 2297echo "QEMU_CFLAGS $QEMU_CFLAGS"
0c439cbf 2298echo "LDFLAGS $LDFLAGS"
43ce4dfe 2299echo "make $make"
6a882643 2300echo "install $install"
43ce4dfe 2301echo "host CPU $cpu"
de83cd02 2302echo "host big endian $bigendian"
97a847bc 2303echo "target list $target_list"
ade25b0d 2304echo "tcg debug enabled $debug_tcg"
b4475aa2 2305echo "Mon debug enabled $debug_mon"
43ce4dfe 2306echo "gprof enabled $gprof"
03b4fe7d 2307echo "sparse enabled $sparse"
1625af87 2308echo "strip binaries $strip_opt"
05c2a3e7 2309echo "profiler $profiler"
43ce4dfe 2310echo "static build $static"
85aa5189 2311echo "-Werror enabled $werror"
5b0753e0
FB
2312if test "$darwin" = "yes" ; then
2313 echo "Cocoa support $cocoa"
2314fi
97a847bc 2315echo "SDL support $sdl"
4d3b6f6e 2316echo "curses support $curses"
769ce76d 2317echo "curl support $curl"
5495ed11 2318echo "check support $check_utests"
67b915a5 2319echo "mingw32 support $mingw32"
0c58ac1c 2320echo "Audio drivers $audio_drv_list"
2321echo "Extra audio cards $audio_card_list"
eb852011 2322echo "Block whitelist $block_drv_whitelist"
8ff9cbf7 2323echo "Mixer emulation $mixemu"
8d5d2d4c 2324echo "VNC TLS support $vnc_tls"
2f9606b3 2325echo "VNC SASL support $vnc_sasl"
2f6f5c7a 2326echo "VNC JPEG support $vnc_jpeg"
efe556ad 2327echo "VNC PNG support $vnc_png"
bd023f95 2328echo "VNC thread $vnc_thread"
3142255c
BS
2329if test -n "$sparc_cpu"; then
2330 echo "Target Sparc Arch $sparc_cpu"
2331fi
e37630ca 2332echo "xen support $xen"
2e4d9fb1 2333echo "brlapi support $brlapi"
a20a6f46 2334echo "bluez support $bluez"
a25dba17 2335echo "Documentation $docs"
c5937220
PB
2336[ ! -z "$uname_release" ] && \
2337echo "uname -r $uname_release"
bd0c5661 2338echo "NPTL support $nptl"
379f6698 2339echo "GUEST_BASE $guest_base"
34005a00 2340echo "PIE user targets $user_pie"
8a16d273 2341echo "vde support $vde"
e5d355d1 2342echo "IO thread $io_thread"
5c6c3a6c 2343echo "Linux AIO support $linux_aio"
758e8e38 2344echo "ATTR/XATTR support $attr"
77755340 2345echo "Install blobs $blobs"
b31a0277 2346echo "KVM support $kvm"
f652e6af 2347echo "fdt support $fdt"
ceb42de8 2348echo "preadv support $preadv"
5f6b9e8f 2349echo "fdatasync $fdatasync"
e78815a5
AF
2350echo "madvise $madvise"
2351echo "posix_madvise $posix_madvise"
ee682d27 2352echo "uuid support $uuid"
d5970055 2353echo "vhost-net support $vhost_net"
94a420b1 2354echo "Trace backend $trace_backend"
9410b56c 2355echo "Trace output file $trace_file-<pid>"
cd4ec0b4 2356echo "spice support $spice"
67b915a5 2357
97a847bc 2358if test $sdl_too_old = "yes"; then
24b55b96 2359echo "-> Your SDL version is too old - please upgrade to have SDL support"
7c1f25b4 2360fi
7d13299d 2361
98ec69ac 2362config_host_mak="config-host.mak"
4bf6b55b 2363config_host_ld="config-host.ld"
98ec69ac 2364
98ec69ac
JQ
2365echo "# Automatically generated by configure - do not modify" > $config_host_mak
2366printf "# Configured with:" >> $config_host_mak
2367printf " '%s'" "$0" "$@" >> $config_host_mak
2368echo >> $config_host_mak
98ec69ac 2369
e6c3b0f7 2370echo all: >> $config_host_mak
99d7cc75
PB
2371echo "prefix=$prefix" >> $config_host_mak
2372echo "bindir=$bindir" >> $config_host_mak
2373echo "mandir=$mandir" >> $config_host_mak
2374echo "datadir=$datadir" >> $config_host_mak
2375echo "sysconfdir=$sysconfdir" >> $config_host_mak
2376echo "docdir=$docdir" >> $config_host_mak
1dabe05c 2377echo "confdir=$confdir" >> $config_host_mak
804edf29 2378
2408a527 2379case "$cpu" in
24e804ec 2380 i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
e0da9dd3 2381 ARCH=$cpu
2408a527 2382 ;;
a302c32d 2383 armv4b|armv4l)
16dbd14f 2384 ARCH=arm
2408a527 2385 ;;
2408a527 2386esac
98ec69ac 2387echo "ARCH=$ARCH" >> $config_host_mak
f8393946 2388if test "$debug_tcg" = "yes" ; then
2358a494 2389 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
f8393946 2390fi
b4475aa2
LC
2391if test "$debug_mon" = "yes" ; then
2392 echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak
2393fi
f3d08ee6 2394if test "$debug" = "yes" ; then
2358a494 2395 echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
f3d08ee6 2396fi
1625af87 2397if test "$strip_opt" = "yes" ; then
52ba784d 2398 echo "STRIP=${strip}" >> $config_host_mak
1625af87 2399fi
7d13299d 2400if test "$bigendian" = "yes" ; then
e2542fe2 2401 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
97a847bc 2402fi
2358a494 2403echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
67b915a5 2404if test "$mingw32" = "yes" ; then
98ec69ac 2405 echo "CONFIG_WIN32=y" >> $config_host_mak
9fe6de94
BS
2406 rc_version=`cat $source_path/VERSION`
2407 version_major=${rc_version%%.*}
2408 rc_version=${rc_version#*.}
2409 version_minor=${rc_version%%.*}
2410 rc_version=${rc_version#*.}
2411 version_subminor=${rc_version%%.*}
2412 version_micro=0
2413 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
2414 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
210fa556 2415else
35f4df27 2416 echo "CONFIG_POSIX=y" >> $config_host_mak
dffcb71c
MM
2417fi
2418
2419if test "$linux" = "yes" ; then
2420 echo "CONFIG_LINUX=y" >> $config_host_mak
67b915a5 2421fi
128ab2ff 2422
83fb7adf 2423if test "$darwin" = "yes" ; then
98ec69ac 2424 echo "CONFIG_DARWIN=y" >> $config_host_mak
83fb7adf 2425fi
b29fe3ed 2426
2427if test "$aix" = "yes" ; then
98ec69ac 2428 echo "CONFIG_AIX=y" >> $config_host_mak
b29fe3ed 2429fi
2430
ec530c81 2431if test "$solaris" = "yes" ; then
98ec69ac 2432 echo "CONFIG_SOLARIS=y" >> $config_host_mak
2358a494 2433 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
0475a5ca 2434 if test "$needs_libsunmath" = "yes" ; then
75b5a697 2435 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
0475a5ca 2436 fi
ec530c81 2437fi
179cf400
AF
2438if test "$haiku" = "yes" ; then
2439 echo "CONFIG_HAIKU=y" >> $config_host_mak
2440fi
97a847bc 2441if test "$static" = "yes" ; then
98ec69ac 2442 echo "CONFIG_STATIC=y" >> $config_host_mak
7d13299d 2443fi
05c2a3e7 2444if test $profiler = "yes" ; then
2358a494 2445 echo "CONFIG_PROFILER=y" >> $config_host_mak
05c2a3e7 2446fi
c20709aa 2447if test "$slirp" = "yes" ; then
98ec69ac 2448 echo "CONFIG_SLIRP=y" >> $config_host_mak
b6e31c12 2449 QEMU_CFLAGS="-I\$(SRC_PATH)/slirp $QEMU_CFLAGS"
c20709aa 2450fi
8a16d273 2451if test "$vde" = "yes" ; then
98ec69ac 2452 echo "CONFIG_VDE=y" >> $config_host_mak
8a16d273 2453fi
0c58ac1c 2454for card in $audio_card_list; do
f6e5889e 2455 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
98ec69ac 2456 echo "$def=y" >> $config_host_mak
0c58ac1c 2457done
2358a494 2458echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
0c58ac1c 2459for drv in $audio_drv_list; do
f6e5889e 2460 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
98ec69ac 2461 echo "$def=y" >> $config_host_mak
923e4521 2462 if test "$drv" = "fmod"; then
7aac6cb1 2463 echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
0c58ac1c 2464 fi
2465done
67f86e8e
JQ
2466if test "$audio_pt_int" = "yes" ; then
2467 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
2468fi
d5631638 2469if test "$audio_win_int" = "yes" ; then
2470 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
2471fi
eb852011 2472echo "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
8ff9cbf7 2473if test "$mixemu" = "yes" ; then
98ec69ac 2474 echo "CONFIG_MIXEMU=y" >> $config_host_mak
8ff9cbf7 2475fi
8d5d2d4c 2476if test "$vnc_tls" = "yes" ; then
98ec69ac 2477 echo "CONFIG_VNC_TLS=y" >> $config_host_mak
525061bf 2478 echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
8d5d2d4c 2479fi
2f9606b3 2480if test "$vnc_sasl" = "yes" ; then
98ec69ac 2481 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
60ddf533 2482 echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
2f9606b3 2483fi
96763cf9 2484if test "$vnc_jpeg" != "no" ; then
2f6f5c7a
CC
2485 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
2486 echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak
2487fi
96763cf9 2488if test "$vnc_png" != "no" ; then
efe556ad
CC
2489 echo "CONFIG_VNC_PNG=y" >> $config_host_mak
2490 echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak
2491fi
96763cf9 2492if test "$vnc_thread" != "no" ; then
bd023f95
CC
2493 echo "CONFIG_VNC_THREAD=y" >> $config_host_mak
2494 echo "CONFIG_THREAD=y" >> $config_host_mak
2495fi
76655d6d 2496if test "$fnmatch" = "yes" ; then
2358a494 2497 echo "CONFIG_FNMATCH=y" >> $config_host_mak
76655d6d 2498fi
ee682d27
SW
2499if test "$uuid" = "yes" ; then
2500 echo "CONFIG_UUID=y" >> $config_host_mak
2501fi
b1a550a0 2502qemu_version=`head $source_path/VERSION`
98ec69ac 2503echo "VERSION=$qemu_version" >>$config_host_mak
2358a494 2504echo "PKGVERSION=$pkgversion" >>$config_host_mak
98ec69ac 2505echo "SRC_PATH=$source_path" >> $config_host_mak
98ec69ac 2506echo "TARGET_DIRS=$target_list" >> $config_host_mak
a25dba17 2507if [ "$docs" = "yes" ] ; then
98ec69ac 2508 echo "BUILD_DOCS=yes" >> $config_host_mak
cc8ae6de 2509fi
1ac88f28 2510if test "$sdl" = "yes" ; then
98ec69ac 2511 echo "CONFIG_SDL=y" >> $config_host_mak
1ac88f28 2512 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
49ecc3fa
FB
2513fi
2514if test "$cocoa" = "yes" ; then
98ec69ac 2515 echo "CONFIG_COCOA=y" >> $config_host_mak
4d3b6f6e
AZ
2516fi
2517if test "$curses" = "yes" ; then
98ec69ac 2518 echo "CONFIG_CURSES=y" >> $config_host_mak
49ecc3fa 2519fi
3b3f24ad 2520if test "$atfile" = "yes" ; then
2358a494 2521 echo "CONFIG_ATFILE=y" >> $config_host_mak
3b3f24ad 2522fi
ebc996f3 2523if test "$utimens" = "yes" ; then
2358a494 2524 echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
ebc996f3 2525fi
099d6b0f 2526if test "$pipe2" = "yes" ; then
2358a494 2527 echo "CONFIG_PIPE2=y" >> $config_host_mak
099d6b0f 2528fi
40ff6d7e
KW
2529if test "$accept4" = "yes" ; then
2530 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
2531fi
3ce34dfb 2532if test "$splice" = "yes" ; then
2358a494 2533 echo "CONFIG_SPLICE=y" >> $config_host_mak
3ce34dfb 2534fi
c2882b96
RV
2535if test "$eventfd" = "yes" ; then
2536 echo "CONFIG_EVENTFD=y" >> $config_host_mak
2537fi
d0927938
UH
2538if test "$fallocate" = "yes" ; then
2539 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
2540fi
2541if test "$dup3" = "yes" ; then
2542 echo "CONFIG_DUP3=y" >> $config_host_mak
2543fi
3b3f24ad 2544if test "$inotify" = "yes" ; then
2358a494 2545 echo "CONFIG_INOTIFY=y" >> $config_host_mak
3b3f24ad 2546fi
c05c7a73
RV
2547if test "$inotify1" = "yes" ; then
2548 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
2549fi
6ae9a1f4
JQ
2550if test "$byteswap_h" = "yes" ; then
2551 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
2552fi
2553if test "$bswap_h" = "yes" ; then
2554 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
2555fi
769ce76d 2556if test "$curl" = "yes" ; then
98ec69ac 2557 echo "CONFIG_CURL=y" >> $config_host_mak
b1d5a277 2558 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
769ce76d 2559fi
2e4d9fb1 2560if test "$brlapi" = "yes" ; then
98ec69ac 2561 echo "CONFIG_BRLAPI=y" >> $config_host_mak
2e4d9fb1 2562fi
fb599c9a 2563if test "$bluez" = "yes" ; then
98ec69ac 2564 echo "CONFIG_BLUEZ=y" >> $config_host_mak
ef7635ec 2565 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
fb599c9a 2566fi
e37630ca 2567if test "$xen" = "yes" ; then
5647eb74 2568 echo "CONFIG_XEN=y" >> $config_host_mak
e37630ca 2569fi
e5d355d1 2570if test "$io_thread" = "yes" ; then
98ec69ac 2571 echo "CONFIG_IOTHREAD=y" >> $config_host_mak
bd023f95 2572 echo "CONFIG_THREAD=y" >> $config_host_mak
e5d355d1 2573fi
5c6c3a6c
CH
2574if test "$linux_aio" = "yes" ; then
2575 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
2576fi
758e8e38
VJJ
2577if test "$attr" = "yes" ; then
2578 echo "CONFIG_ATTR=y" >> $config_host_mak
2579fi
2580if test "$linux" = "yes" ; then
2581 if test "$attr" = "yes" ; then
2582 echo "CONFIG_VIRTFS=y" >> $config_host_mak
2583 fi
2584fi
77755340 2585if test "$blobs" = "yes" ; then
98ec69ac 2586 echo "INSTALL_BLOBS=yes" >> $config_host_mak
77755340 2587fi
bf9298b9 2588if test "$iovec" = "yes" ; then
2358a494 2589 echo "CONFIG_IOVEC=y" >> $config_host_mak
bf9298b9 2590fi
ceb42de8 2591if test "$preadv" = "yes" ; then
2358a494 2592 echo "CONFIG_PREADV=y" >> $config_host_mak
ceb42de8 2593fi
f652e6af 2594if test "$fdt" = "yes" ; then
3f0855b1 2595 echo "CONFIG_FDT=y" >> $config_host_mak
f652e6af 2596fi
dcc38d1c
MT
2597if test "$signalfd" = "yes" ; then
2598 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
2599fi
de5071c5
BS
2600if test "$need_offsetof" = "yes" ; then
2601 echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
2602fi
747bbdf7
BS
2603if test "$gcc_attribute_warn_unused_result" = "yes" ; then
2604 echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak
2605fi
5f6b9e8f
BS
2606if test "$fdatasync" = "yes" ; then
2607 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
2608fi
e78815a5
AF
2609if test "$madvise" = "yes" ; then
2610 echo "CONFIG_MADVISE=y" >> $config_host_mak
2611fi
2612if test "$posix_madvise" = "yes" ; then
2613 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
2614fi
97a847bc 2615
cd4ec0b4
GH
2616if test "$spice" = "yes" ; then
2617 echo "CONFIG_SPICE=y" >> $config_host_mak
2618fi
2619
83fb7adf 2620# XXX: suppress that
7d3505c5 2621if [ "$bsd" = "yes" ] ; then
2358a494 2622 echo "CONFIG_BSD=y" >> $config_host_mak
7d3505c5
FB
2623fi
2624
2358a494 2625echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
c5937220 2626
20ff6c80
AL
2627if test "$zero_malloc" = "yes" ; then
2628 echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
2629fi
2630
68063649
BS
2631# USB host support
2632case "$usb" in
2633linux)
98ec69ac 2634 echo "HOST_USB=linux" >> $config_host_mak
68063649
BS
2635;;
2636bsd)
98ec69ac 2637 echo "HOST_USB=bsd" >> $config_host_mak
68063649
BS
2638;;
2639*)
98ec69ac 2640 echo "HOST_USB=stub" >> $config_host_mak
68063649
BS
2641;;
2642esac
2643
94a420b1 2644echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
22890ab5
PS
2645if test "$trace_backend" = "simple"; then
2646 echo "CONFIG_SIMPLE_TRACE=y" >> $config_host_mak
2647fi
9410b56c
PS
2648# Set the appropriate trace file.
2649if test "$trace_backend" = "simple"; then
2650 trace_file="\"$trace_file-%u\""
2651fi
c276b17d
DB
2652if test "$trace_backend" = "dtrace" -a "$trace_backend_stap" = "yes" ; then
2653 echo "CONFIG_SYSTEMTAP_TRACE=y" >> $config_host_mak
2654fi
9410b56c
PS
2655echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
2656
98ec69ac 2657echo "TOOLS=$tools" >> $config_host_mak
98ec69ac 2658echo "ROMS=$roms" >> $config_host_mak
804edf29
JQ
2659echo "MAKE=$make" >> $config_host_mak
2660echo "INSTALL=$install" >> $config_host_mak
2661echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak
2662echo "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak
2663echo "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak
2664echo "CC=$cc" >> $config_host_mak
2b2e59e6 2665echo "CC_I386=$cc_i386" >> $config_host_mak
804edf29
JQ
2666echo "HOST_CC=$host_cc" >> $config_host_mak
2667if test "$sparse" = "yes" ; then
2668 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
2669 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
a558ee17 2670 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
804edf29
JQ
2671fi
2672echo "AR=$ar" >> $config_host_mak
2673echo "OBJCOPY=$objcopy" >> $config_host_mak
2674echo "LD=$ld" >> $config_host_mak
9fe6de94 2675echo "WINDRES=$windres" >> $config_host_mak
e2a2ed06 2676echo "CFLAGS=$CFLAGS" >> $config_host_mak
a558ee17 2677echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
c81da56e 2678echo "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
e2a2ed06 2679echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
a36abbbb
JQ
2680echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
2681echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
73da375e 2682echo "LIBS+=$LIBS" >> $config_host_mak
3e2e0e6b 2683echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
804edf29 2684echo "EXESUF=$EXESUF" >> $config_host_mak
804edf29 2685
4bf6b55b
JQ
2686# generate list of library paths for linker script
2687
2688$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
2689
2690if test -f ${config_host_ld}~ ; then
2691 if cmp -s $config_host_ld ${config_host_ld}~ ; then
2692 mv ${config_host_ld}~ $config_host_ld
2693 else
2694 rm ${config_host_ld}~
2695 fi
2696fi
2697
4d904533
BS
2698for d in libdis libdis-user; do
2699 mkdir -p $d
2700 rm -f $d/Makefile
2701 ln -s $source_path/Makefile.dis $d/Makefile
2702 echo > $d/config.mak
2703done
d44cff22
RH
2704if test "$static" = "no" -a "$user_pie" = "yes" ; then
2705 echo "QEMU_CFLAGS+=-fpie" > libdis-user/config.mak
2706fi
4d904533 2707
1d14ffa9 2708for target in $target_list; do
97a847bc 2709target_dir="$target"
25be210f 2710config_target_mak=$target_dir/config-target.mak
600309b6 2711target_arch2=`echo $target | cut -d '-' -f 1`
97a847bc 2712target_bigendian="no"
1f3d3c8f 2713
ea2d6a39 2714case "$target_arch2" in
24e804ec 2715 armeb|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus)
ea2d6a39
JQ
2716 target_bigendian=yes
2717 ;;
2718esac
97a847bc 2719target_softmmu="no"
997344f3 2720target_user_only="no"
831b7825 2721target_linux_user="no"
831b7825 2722target_darwin_user="no"
84778508 2723target_bsd_user="no"
9e407a85 2724case "$target" in
600309b6 2725 ${target_arch2}-softmmu)
9e407a85
PB
2726 target_softmmu="yes"
2727 ;;
600309b6 2728 ${target_arch2}-linux-user)
9c7a4202
BS
2729 if test "$linux" != "yes" ; then
2730 echo "ERROR: Target '$target' is only available on a Linux host"
2731 exit 1
2732 fi
9e407a85
PB
2733 target_user_only="yes"
2734 target_linux_user="yes"
2735 ;;
600309b6 2736 ${target_arch2}-darwin-user)
9c7a4202
BS
2737 if test "$darwin" != "yes" ; then
2738 echo "ERROR: Target '$target' is only available on a Darwin host"
2739 exit 1
2740 fi
9e407a85
PB
2741 target_user_only="yes"
2742 target_darwin_user="yes"
2743 ;;
600309b6 2744 ${target_arch2}-bsd-user)
9cf55765 2745 if test "$bsd" != "yes" ; then
9c7a4202
BS
2746 echo "ERROR: Target '$target' is only available on a BSD host"
2747 exit 1
2748 fi
84778508
BS
2749 target_user_only="yes"
2750 target_bsd_user="yes"
2751 ;;
9e407a85
PB
2752 *)
2753 echo "ERROR: Target '$target' not recognised"
2754 exit 1
2755 ;;
2756esac
831b7825 2757
97a847bc 2758mkdir -p $target_dir
158142c2 2759mkdir -p $target_dir/fpu
57fec1fe 2760mkdir -p $target_dir/tcg
59f2a787 2761mkdir -p $target_dir/ide
84778508 2762if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
69de927c
FB
2763 mkdir -p $target_dir/nwfpe
2764fi
2765
ec530c81
FB
2766#
2767# don't use ln -sf as not all "ln -sf" over write the file/link
2768#
2769rm -f $target_dir/Makefile
2770ln -s $source_path/Makefile.target $target_dir/Makefile
2771
97a847bc 2772
25be210f 2773echo "# Automatically generated by configure - do not modify" > $config_target_mak
de83cd02 2774
e5fe0c52 2775bflt="no"
bd0c5661 2776target_nptl="no"
600309b6 2777interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
7ee2822c 2778echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
56aebc89 2779gdb_xml_files=""
7ba1e619 2780
938b1edd 2781TARGET_ARCH="$target_arch2"
6acff7da 2782TARGET_BASE_ARCH=""
e6e91b9c 2783TARGET_ABI_DIR=""
e73aae67 2784
600309b6 2785case "$target_arch2" in
2408a527 2786 i386)
1ad2134f 2787 target_phys_bits=32
2408a527
AJ
2788 ;;
2789 x86_64)
6acff7da 2790 TARGET_BASE_ARCH=i386
1ad2134f 2791 target_phys_bits=64
2408a527
AJ
2792 ;;
2793 alpha)
1ad2134f 2794 target_phys_bits=64
a4b388ff 2795 target_nptl="yes"
2408a527
AJ
2796 ;;
2797 arm|armeb)
b498c8a0 2798 TARGET_ARCH=arm
2408a527 2799 bflt="yes"
bd0c5661 2800 target_nptl="yes"
56aebc89 2801 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
1ad2134f 2802 target_phys_bits=32
2408a527
AJ
2803 ;;
2804 cris)
253bd7f8 2805 target_nptl="yes"
1ad2134f 2806 target_phys_bits=32
2408a527
AJ
2807 ;;
2808 m68k)
2408a527 2809 bflt="yes"
56aebc89 2810 gdb_xml_files="cf-core.xml cf-fp.xml"
1ad2134f 2811 target_phys_bits=32
2408a527 2812 ;;
72b675ca 2813 microblaze)
72b675ca
EI
2814 bflt="yes"
2815 target_nptl="yes"
2816 target_phys_bits=32
2817 ;;
0adcffb1 2818 mips|mipsel)
b498c8a0 2819 TARGET_ARCH=mips
25be210f 2820 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
f04dc72f 2821 target_nptl="yes"
1ad2134f 2822 target_phys_bits=64
2408a527
AJ
2823 ;;
2824 mipsn32|mipsn32el)
b498c8a0 2825 TARGET_ARCH=mipsn32
6acff7da 2826 TARGET_BASE_ARCH=mips
25be210f 2827 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
1ad2134f 2828 target_phys_bits=64
2408a527
AJ
2829 ;;
2830 mips64|mips64el)
b498c8a0 2831 TARGET_ARCH=mips64
6acff7da 2832 TARGET_BASE_ARCH=mips
25be210f 2833 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
1ad2134f 2834 target_phys_bits=64
2408a527
AJ
2835 ;;
2836 ppc)
c8b3532d 2837 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1ad2134f 2838 target_phys_bits=32
d6630708 2839 target_nptl="yes"
2408a527
AJ
2840 ;;
2841 ppcemb)
6acff7da 2842 TARGET_BASE_ARCH=ppc
e6e91b9c 2843 TARGET_ABI_DIR=ppc
c8b3532d 2844 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1ad2134f 2845 target_phys_bits=64
d6630708 2846 target_nptl="yes"
2408a527
AJ
2847 ;;
2848 ppc64)
6acff7da 2849 TARGET_BASE_ARCH=ppc
e6e91b9c 2850 TARGET_ABI_DIR=ppc
c8b3532d 2851 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1ad2134f 2852 target_phys_bits=64
2408a527
AJ
2853 ;;
2854 ppc64abi32)
b498c8a0 2855 TARGET_ARCH=ppc64
6acff7da 2856 TARGET_BASE_ARCH=ppc
e6e91b9c 2857 TARGET_ABI_DIR=ppc
25be210f 2858 echo "TARGET_ABI32=y" >> $config_target_mak
c8b3532d 2859 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1ad2134f 2860 target_phys_bits=64
2408a527
AJ
2861 ;;
2862 sh4|sh4eb)
b498c8a0 2863 TARGET_ARCH=sh4
2408a527 2864 bflt="yes"
0b6d3ae0 2865 target_nptl="yes"
1ad2134f 2866 target_phys_bits=32
2408a527
AJ
2867 ;;
2868 sparc)
1ad2134f 2869 target_phys_bits=64
2408a527
AJ
2870 ;;
2871 sparc64)
6acff7da 2872 TARGET_BASE_ARCH=sparc
1ad2134f 2873 target_phys_bits=64
2408a527
AJ
2874 ;;
2875 sparc32plus)
b498c8a0 2876 TARGET_ARCH=sparc64
6acff7da 2877 TARGET_BASE_ARCH=sparc
e6e91b9c 2878 TARGET_ABI_DIR=sparc
25be210f 2879 echo "TARGET_ABI32=y" >> $config_target_mak
1ad2134f 2880 target_phys_bits=64
2408a527 2881 ;;
24e804ec
AG
2882 s390x)
2883 target_phys_bits=64
2884 ;;
2408a527
AJ
2885 *)
2886 echo "Unsupported target CPU"
2887 exit 1
2888 ;;
2889esac
25be210f 2890echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
053dd92e 2891target_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
25be210f
JQ
2892echo "TARGET_$target_arch_name=y" >> $config_target_mak
2893echo "TARGET_ARCH2=$target_arch2" >> $config_target_mak
42bc608b 2894# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
6acff7da
JQ
2895if [ "$TARGET_BASE_ARCH" = "" ]; then
2896 TARGET_BASE_ARCH=$TARGET_ARCH
6acff7da 2897fi
25be210f 2898echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
e6e91b9c
JQ
2899if [ "$TARGET_ABI_DIR" = "" ]; then
2900 TARGET_ABI_DIR=$TARGET_ARCH
2901fi
25be210f 2902echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
1b0c87fc
JQ
2903case "$target_arch2" in
2904 i386|x86_64)
2905 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
25be210f 2906 echo "CONFIG_XEN=y" >> $config_target_mak
1b0c87fc
JQ
2907 fi
2908esac
c59249f9 2909case "$target_arch2" in
0e60a699 2910 i386|x86_64|ppcemb|ppc|ppc64|s390x)
c59249f9
JQ
2911 # Make sure the target and host cpus are compatible
2912 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
2913 \( "$target_arch2" = "$cpu" -o \
2914 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
5f114bc6 2915 \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \
c59249f9
JQ
2916 \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \
2917 \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then
25be210f
JQ
2918 echo "CONFIG_KVM=y" >> $config_target_mak
2919 echo "KVM_CFLAGS=$kvm_cflags" >> $config_target_mak
dae5079a
JK
2920 if test "$kvm_para" = "yes"; then
2921 echo "CONFIG_KVM_PARA=y" >> $config_target_mak
2922 fi
d5970055
MT
2923 if test $vhost_net = "yes" ; then
2924 echo "CONFIG_VHOST_NET=y" >> $config_target_mak
2925 fi
c59249f9
JQ
2926 fi
2927esac
de83cd02 2928if test "$target_bigendian" = "yes" ; then
25be210f 2929 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
de83cd02 2930fi
97a847bc 2931if test "$target_softmmu" = "yes" ; then
b1aa27c4 2932 echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
25be210f
JQ
2933 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
2934 echo "LIBS+=$libs_softmmu" >> $config_target_mak
0e8c9214 2935 echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
5791f45b 2936 echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
43ce4dfe 2937fi
997344f3 2938if test "$target_user_only" = "yes" ; then
25be210f 2939 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
997344f3 2940fi
831b7825 2941if test "$target_linux_user" = "yes" ; then
25be210f 2942 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
831b7825
TS
2943fi
2944if test "$target_darwin_user" = "yes" ; then
25be210f 2945 echo "CONFIG_DARWIN_USER=y" >> $config_target_mak
831b7825 2946fi
56aebc89
PB
2947list=""
2948if test ! -z "$gdb_xml_files" ; then
2949 for x in $gdb_xml_files; do
2950 list="$list $source_path/gdb-xml/$x"
2951 done
3d0f1517 2952 echo "TARGET_XML_FILES=$list" >> $config_target_mak
56aebc89 2953fi
97a847bc 2954
f57975fb 2955case "$target_arch2" in
990b3e19 2956 alpha|arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|s390x|sparc|sparc64|sparc32plus)
25be210f 2957 echo "CONFIG_SOFTFLOAT=y" >> $config_target_mak
f57975fb 2958 ;;
d6b38939 2959 *)
25be210f 2960 echo "CONFIG_NOSOFTFLOAT=y" >> $config_target_mak
d6b38939 2961 ;;
f57975fb
JQ
2962esac
2963
e5fe0c52 2964if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
25be210f 2965 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
e5fe0c52 2966fi
bd0c5661
PB
2967if test "$target_user_only" = "yes" \
2968 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
25be210f 2969 echo "CONFIG_USE_NPTL=y" >> $config_target_mak
bd0c5661 2970fi
379f6698 2971if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
25be210f 2972 echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
379f6698 2973fi
84778508 2974if test "$target_bsd_user" = "yes" ; then
25be210f 2975 echo "CONFIG_BSD_USER=y" >> $config_target_mak
84778508 2976fi
5b0753e0 2977
4afddb55 2978# generate QEMU_CFLAGS/LDFLAGS for targets
fa282484 2979
4afddb55 2980cflags=""
fa282484 2981ldflags=""
9b8e111f 2982
57ddfbf7
JQ
2983if test "$ARCH" = "sparc64" ; then
2984 cflags="-I\$(SRC_PATH)/tcg/sparc $cflags"
24e804ec
AG
2985elif test "$ARCH" = "s390x" ; then
2986 cflags="-I\$(SRC_PATH)/tcg/s390 $cflags"
5d8a4f8f
RH
2987elif test "$ARCH" = "x86_64" ; then
2988 cflags="-I\$(SRC_PATH)/tcg/i386 $cflags"
57ddfbf7
JQ
2989else
2990 cflags="-I\$(SRC_PATH)/tcg/\$(ARCH) $cflags"
2991fi
2992cflags="-I\$(SRC_PATH)/tcg $cflags"
2993cflags="-I\$(SRC_PATH)/fpu $cflags"
2994
4d904533
BS
2995if test "$target_user_only" = "yes" ; then
2996 libdis_config_mak=libdis-user/config.mak
2997else
2998 libdis_config_mak=libdis/config.mak
2999fi
3000
64656024
JQ
3001for i in $ARCH $TARGET_BASE_ARCH ; do
3002 case "$i" in
3003 alpha)
25be210f 3004 echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
4d904533 3005 echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak
64656024
JQ
3006 ;;
3007 arm)
25be210f 3008 echo "CONFIG_ARM_DIS=y" >> $config_target_mak
4d904533 3009 echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak
64656024
JQ
3010 ;;
3011 cris)
25be210f 3012 echo "CONFIG_CRIS_DIS=y" >> $config_target_mak
4d904533 3013 echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak
64656024
JQ
3014 ;;
3015 hppa)
25be210f 3016 echo "CONFIG_HPPA_DIS=y" >> $config_target_mak
4d904533 3017 echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak
64656024
JQ
3018 ;;
3019 i386|x86_64)
25be210f 3020 echo "CONFIG_I386_DIS=y" >> $config_target_mak
4d904533 3021 echo "CONFIG_I386_DIS=y" >> $libdis_config_mak
64656024 3022 ;;
903ec55c
AJ
3023 ia64*)
3024 echo "CONFIG_IA64_DIS=y" >> $config_target_mak
3025 echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak
3026 ;;
64656024 3027 m68k)
25be210f 3028 echo "CONFIG_M68K_DIS=y" >> $config_target_mak
4d904533 3029 echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak
64656024
JQ
3030 ;;
3031 microblaze)
25be210f 3032 echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak
4d904533 3033 echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak
64656024
JQ
3034 ;;
3035 mips*)
25be210f 3036 echo "CONFIG_MIPS_DIS=y" >> $config_target_mak
4d904533 3037 echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak
64656024
JQ
3038 ;;
3039 ppc*)
25be210f 3040 echo "CONFIG_PPC_DIS=y" >> $config_target_mak
4d904533 3041 echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak
64656024 3042 ;;
24e804ec 3043 s390*)
25be210f 3044 echo "CONFIG_S390_DIS=y" >> $config_target_mak
4d904533 3045 echo "CONFIG_S390_DIS=y" >> $libdis_config_mak
64656024
JQ
3046 ;;
3047 sh4)
25be210f 3048 echo "CONFIG_SH4_DIS=y" >> $config_target_mak
4d904533 3049 echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak
64656024
JQ
3050 ;;
3051 sparc*)
25be210f 3052 echo "CONFIG_SPARC_DIS=y" >> $config_target_mak
4d904533 3053 echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak
64656024
JQ
3054 ;;
3055 esac
3056done
3057
6ee7126f
JQ
3058case "$ARCH" in
3059alpha)
3060 # Ensure there's only a single GP
3061 cflags="-msmall-data $cflags"
3062;;
3063esac
3064
55d9c04b
JQ
3065if test "$target_softmmu" = "yes" ; then
3066 case "$TARGET_BASE_ARCH" in
3067 arm)
3068 cflags="-DHAS_AUDIO $cflags"
3069 ;;
3070 i386|mips|ppc)
3071 cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
3072 ;;
3073 esac
3074fi
3075
34005a00 3076if test "$target_user_only" = "yes" -a "$static" = "no" -a \
50108930 3077 "$user_pie" = "yes" ; then
34005a00
KS
3078 cflags="-fpie $cflags"
3079 ldflags="-pie $ldflags"
3080fi
3081
471857dd
JQ
3082if test "$target_softmmu" = "yes" -a \( \
3083 "$TARGET_ARCH" = "microblaze" -o \
3084 "$TARGET_ARCH" = "cris" \) ; then
25be210f 3085 echo "CONFIG_NEED_MMU=y" >> $config_target_mak
471857dd
JQ
3086fi
3087
d02c1db3 3088if test "$gprof" = "yes" ; then
25be210f 3089 echo "TARGET_GPROF=yes" >> $config_target_mak
d02c1db3
JQ
3090 if test "$target_linux_user" = "yes" ; then
3091 cflags="-p $cflags"
3092 ldflags="-p $ldflags"
3093 fi
3094 if test "$target_softmmu" = "yes" ; then
3095 ldflags="-p $ldflags"
25be210f 3096 echo "GPROF_CFLAGS=-p" >> $config_target_mak
d02c1db3
JQ
3097 fi
3098fi
3099
6ee7126f 3100linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
9b8e111f 3101if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
fa282484 3102 case "$ARCH" in
fa282484
JQ
3103 sparc)
3104 # -static is used to avoid g1/g3 usage by the dynamic linker
322e5878 3105 ldflags="$linker_script -static $ldflags"
fa282484 3106 ;;
4d58be06
RH
3107 alpha | s390x)
3108 # The default placement of the application is fine.
3109 ;;
fd76e73a 3110 *)
322e5878 3111 ldflags="$linker_script $ldflags"
fa282484
JQ
3112 ;;
3113 esac
3114fi
fa282484 3115
25be210f
JQ
3116echo "LDFLAGS+=$ldflags" >> $config_target_mak
3117echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
fa282484 3118
97a847bc 3119done # for target in $targets
7d13299d
FB
3120
3121# build tree in object directory if source path is different from current one
3122if test "$source_path_used" = "yes" ; then
e1144d00 3123 DIRS="tests tests/cris slirp audio block net pc-bios/optionrom"
2d9f27d2 3124 DIRS="$DIRS roms/seabios roms/vgabios"
3e230dd2 3125 DIRS="$DIRS fsdev ui"
7d13299d 3126 FILES="Makefile tests/Makefile"
e7daa605 3127 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
e1ffb0f1 3128 FILES="$FILES tests/test-mmap.c"
ae0bfb79 3129 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
2d9f27d2 3130 FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
7ea78b74
JK
3131 for bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do
3132 FILES="$FILES pc-bios/`basename $bios_file`"
3133 done
7d13299d
FB
3134 for dir in $DIRS ; do
3135 mkdir -p $dir
3136 done
ec530c81 3137 # remove the link and recreate it, as not all "ln -sf" overwrite the link
7d13299d 3138 for f in $FILES ; do
ec530c81
FB
3139 rm -f $f
3140 ln -s $source_path/$f $f
7d13299d
FB
3141 done
3142fi
1ad2134f 3143
c34ebfdc 3144# temporary config to build submodules
2d9f27d2 3145for rom in seabios vgabios ; do
c34ebfdc 3146 config_mak=roms/$rom/config.mak
37116c89 3147 echo "# Automatically generated by configure - do not modify" > $config_mak
c34ebfdc
AL
3148 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
3149 echo "CC=$cc" >> $config_mak
3150 echo "BCC=bcc" >> $config_mak
3151 echo "CPP=${cross_prefix}cpp" >> $config_mak
3152 echo "OBJCOPY=objcopy" >> $config_mak
3153 echo "IASL=iasl" >> $config_mak
3154 echo "HOST_CC=$host_cc" >> $config_mak
3155 echo "LD=$ld" >> $config_mak
3156done
3157
1ad2134f
PB
3158for hwlib in 32 64; do
3159 d=libhw$hwlib
3160 mkdir -p $d
9953b2fc 3161 mkdir -p $d/ide
1ad2134f
PB
3162 rm -f $d/Makefile
3163 ln -s $source_path/Makefile.hw $d/Makefile
37116c89 3164 echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
1ad2134f 3165done
add16157
BS
3166
3167d=libuser
3168mkdir -p $d
3169rm -f $d/Makefile
3170ln -s $source_path/Makefile.user $d/Makefile
299060a0
KS
3171if test "$static" = "no" -a "$user_pie" = "yes" ; then
3172 echo "QEMU_CFLAGS+=-fpie" > $d/config.mak
3173fi
b40292e7
JK
3174
3175if test "$docs" = "yes" ; then
3176 mkdir -p QMP
3177fi