]> git.proxmox.com Git - qemu.git/blame - configure
Add a DTrace tracing backend targetted for SystemTAP compatability
[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
2206fi
2207
7e24e92a 2208##########################################
e86ecd4b
JQ
2209# End of CC checks
2210# After here, no more $cc or $ld runs
2211
e86ecd4b 2212if test "$debug" = "no" ; then
1156c669 2213 CFLAGS="-O2 $CFLAGS"
e86ecd4b 2214fi
a316e378 2215
e86ecd4b
JQ
2216# Consult white-list to determine whether to enable werror
2217# by default. Only enable by default for git builds
20ff6c80
AL
2218z_version=`cut -f3 -d. $source_path/VERSION`
2219
e86ecd4b 2220if test -z "$werror" ; then
e86ecd4b
JQ
2221 if test "$z_version" = "50" -a \
2222 "$linux" = "yes" ; then
2223 werror="yes"
2224 else
2225 werror="no"
2226 fi
2227fi
2228
20ff6c80
AL
2229# Disable zero malloc errors for official releases unless explicitly told to
2230# enable/disable
2231if test -z "$zero_malloc" ; then
2232 if test "$z_version" = "50" ; then
2233 zero_malloc="no"
2234 else
2235 zero_malloc="yes"
2236 fi
2237fi
2238
e86ecd4b 2239if test "$werror" = "yes" ; then
a558ee17 2240 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
e86ecd4b
JQ
2241fi
2242
2243if test "$solaris" = "no" ; then
2244 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
1156c669 2245 LDFLAGS="-Wl,--warn-common $LDFLAGS"
e86ecd4b
JQ
2246 fi
2247fi
2248
952afb71
BS
2249# Use ASLR, no-SEH and DEP if available
2250if test "$mingw32" = "yes" ; then
2251 for flag in --dynamicbase --no-seh --nxcompat; do
2252 if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
2253 LDFLAGS="-Wl,$flag $LDFLAGS"
2254 fi
2255 done
2256fi
2257
190e9c59 2258confdir=$sysconfdir$confsuffix
e7b45cc4 2259
ca35f780
PB
2260tools=
2261if test "$softmmu" = yes ; then
2262 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
2263 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
2264 tools="qemu-nbd\$(EXESUF) $tools"
2265 if [ "$check_utests" = "yes" ]; then
2266 tools="check-qint check-qstring check-qdict check-qlist $tools"
2267 tools="check-qfloat check-qjson $tools"
2268 fi
2269 fi
2270fi
2271
2272# Mac OS X ships with a broken assembler
2273roms=
2274if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
2275 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
2276 "$softmmu" = yes ; then
2277 roms="optionrom"
2278fi
2279
2280
43ce4dfe 2281echo "Install prefix $prefix"
f2b9e1e3
PB
2282echo "BIOS directory `eval echo $datadir`"
2283echo "binary directory `eval echo $bindir`"
1c0fd160 2284echo "config directory `eval echo $sysconfdir`"
11d9f695 2285if test "$mingw32" = "no" ; then
f2b9e1e3 2286echo "Manual directory `eval echo $mandir`"
43ce4dfe 2287echo "ELF interp prefix $interp_prefix"
11d9f695 2288fi
5a67135a 2289echo "Source path $source_path"
43ce4dfe 2290echo "C compiler $cc"
83469015 2291echo "Host C compiler $host_cc"
0c439cbf 2292echo "CFLAGS $CFLAGS"
a558ee17 2293echo "QEMU_CFLAGS $QEMU_CFLAGS"
0c439cbf 2294echo "LDFLAGS $LDFLAGS"
43ce4dfe 2295echo "make $make"
6a882643 2296echo "install $install"
43ce4dfe 2297echo "host CPU $cpu"
de83cd02 2298echo "host big endian $bigendian"
97a847bc 2299echo "target list $target_list"
ade25b0d 2300echo "tcg debug enabled $debug_tcg"
b4475aa2 2301echo "Mon debug enabled $debug_mon"
43ce4dfe 2302echo "gprof enabled $gprof"
03b4fe7d 2303echo "sparse enabled $sparse"
1625af87 2304echo "strip binaries $strip_opt"
05c2a3e7 2305echo "profiler $profiler"
43ce4dfe 2306echo "static build $static"
85aa5189 2307echo "-Werror enabled $werror"
5b0753e0
FB
2308if test "$darwin" = "yes" ; then
2309 echo "Cocoa support $cocoa"
2310fi
97a847bc 2311echo "SDL support $sdl"
4d3b6f6e 2312echo "curses support $curses"
769ce76d 2313echo "curl support $curl"
5495ed11 2314echo "check support $check_utests"
67b915a5 2315echo "mingw32 support $mingw32"
0c58ac1c 2316echo "Audio drivers $audio_drv_list"
2317echo "Extra audio cards $audio_card_list"
eb852011 2318echo "Block whitelist $block_drv_whitelist"
8ff9cbf7 2319echo "Mixer emulation $mixemu"
8d5d2d4c 2320echo "VNC TLS support $vnc_tls"
2f9606b3 2321echo "VNC SASL support $vnc_sasl"
2f6f5c7a 2322echo "VNC JPEG support $vnc_jpeg"
efe556ad 2323echo "VNC PNG support $vnc_png"
bd023f95 2324echo "VNC thread $vnc_thread"
3142255c
BS
2325if test -n "$sparc_cpu"; then
2326 echo "Target Sparc Arch $sparc_cpu"
2327fi
e37630ca 2328echo "xen support $xen"
2e4d9fb1 2329echo "brlapi support $brlapi"
a20a6f46 2330echo "bluez support $bluez"
a25dba17 2331echo "Documentation $docs"
c5937220
PB
2332[ ! -z "$uname_release" ] && \
2333echo "uname -r $uname_release"
bd0c5661 2334echo "NPTL support $nptl"
379f6698 2335echo "GUEST_BASE $guest_base"
34005a00 2336echo "PIE user targets $user_pie"
8a16d273 2337echo "vde support $vde"
e5d355d1 2338echo "IO thread $io_thread"
5c6c3a6c 2339echo "Linux AIO support $linux_aio"
758e8e38 2340echo "ATTR/XATTR support $attr"
77755340 2341echo "Install blobs $blobs"
b31a0277 2342echo "KVM support $kvm"
f652e6af 2343echo "fdt support $fdt"
ceb42de8 2344echo "preadv support $preadv"
5f6b9e8f 2345echo "fdatasync $fdatasync"
e78815a5
AF
2346echo "madvise $madvise"
2347echo "posix_madvise $posix_madvise"
ee682d27 2348echo "uuid support $uuid"
d5970055 2349echo "vhost-net support $vhost_net"
94a420b1 2350echo "Trace backend $trace_backend"
9410b56c 2351echo "Trace output file $trace_file-<pid>"
cd4ec0b4 2352echo "spice support $spice"
67b915a5 2353
97a847bc 2354if test $sdl_too_old = "yes"; then
24b55b96 2355echo "-> Your SDL version is too old - please upgrade to have SDL support"
7c1f25b4 2356fi
7d13299d 2357
98ec69ac 2358config_host_mak="config-host.mak"
4bf6b55b 2359config_host_ld="config-host.ld"
98ec69ac 2360
98ec69ac
JQ
2361echo "# Automatically generated by configure - do not modify" > $config_host_mak
2362printf "# Configured with:" >> $config_host_mak
2363printf " '%s'" "$0" "$@" >> $config_host_mak
2364echo >> $config_host_mak
98ec69ac 2365
e6c3b0f7 2366echo all: >> $config_host_mak
99d7cc75
PB
2367echo "prefix=$prefix" >> $config_host_mak
2368echo "bindir=$bindir" >> $config_host_mak
2369echo "mandir=$mandir" >> $config_host_mak
2370echo "datadir=$datadir" >> $config_host_mak
2371echo "sysconfdir=$sysconfdir" >> $config_host_mak
2372echo "docdir=$docdir" >> $config_host_mak
1dabe05c 2373echo "confdir=$confdir" >> $config_host_mak
804edf29 2374
2408a527 2375case "$cpu" in
24e804ec 2376 i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
e0da9dd3 2377 ARCH=$cpu
2408a527 2378 ;;
a302c32d 2379 armv4b|armv4l)
16dbd14f 2380 ARCH=arm
2408a527 2381 ;;
2408a527 2382esac
98ec69ac 2383echo "ARCH=$ARCH" >> $config_host_mak
f8393946 2384if test "$debug_tcg" = "yes" ; then
2358a494 2385 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
f8393946 2386fi
b4475aa2
LC
2387if test "$debug_mon" = "yes" ; then
2388 echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak
2389fi
f3d08ee6 2390if test "$debug" = "yes" ; then
2358a494 2391 echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
f3d08ee6 2392fi
1625af87 2393if test "$strip_opt" = "yes" ; then
52ba784d 2394 echo "STRIP=${strip}" >> $config_host_mak
1625af87 2395fi
7d13299d 2396if test "$bigendian" = "yes" ; then
e2542fe2 2397 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
97a847bc 2398fi
2358a494 2399echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
67b915a5 2400if test "$mingw32" = "yes" ; then
98ec69ac 2401 echo "CONFIG_WIN32=y" >> $config_host_mak
9fe6de94
BS
2402 rc_version=`cat $source_path/VERSION`
2403 version_major=${rc_version%%.*}
2404 rc_version=${rc_version#*.}
2405 version_minor=${rc_version%%.*}
2406 rc_version=${rc_version#*.}
2407 version_subminor=${rc_version%%.*}
2408 version_micro=0
2409 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
2410 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
210fa556 2411else
35f4df27 2412 echo "CONFIG_POSIX=y" >> $config_host_mak
dffcb71c
MM
2413fi
2414
2415if test "$linux" = "yes" ; then
2416 echo "CONFIG_LINUX=y" >> $config_host_mak
67b915a5 2417fi
128ab2ff 2418
83fb7adf 2419if test "$darwin" = "yes" ; then
98ec69ac 2420 echo "CONFIG_DARWIN=y" >> $config_host_mak
83fb7adf 2421fi
b29fe3ed 2422
2423if test "$aix" = "yes" ; then
98ec69ac 2424 echo "CONFIG_AIX=y" >> $config_host_mak
b29fe3ed 2425fi
2426
ec530c81 2427if test "$solaris" = "yes" ; then
98ec69ac 2428 echo "CONFIG_SOLARIS=y" >> $config_host_mak
2358a494 2429 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
0475a5ca 2430 if test "$needs_libsunmath" = "yes" ; then
75b5a697 2431 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
0475a5ca 2432 fi
ec530c81 2433fi
179cf400
AF
2434if test "$haiku" = "yes" ; then
2435 echo "CONFIG_HAIKU=y" >> $config_host_mak
2436fi
97a847bc 2437if test "$static" = "yes" ; then
98ec69ac 2438 echo "CONFIG_STATIC=y" >> $config_host_mak
7d13299d 2439fi
05c2a3e7 2440if test $profiler = "yes" ; then
2358a494 2441 echo "CONFIG_PROFILER=y" >> $config_host_mak
05c2a3e7 2442fi
c20709aa 2443if test "$slirp" = "yes" ; then
98ec69ac 2444 echo "CONFIG_SLIRP=y" >> $config_host_mak
b6e31c12 2445 QEMU_CFLAGS="-I\$(SRC_PATH)/slirp $QEMU_CFLAGS"
c20709aa 2446fi
8a16d273 2447if test "$vde" = "yes" ; then
98ec69ac 2448 echo "CONFIG_VDE=y" >> $config_host_mak
8a16d273 2449fi
0c58ac1c 2450for card in $audio_card_list; do
f6e5889e 2451 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
98ec69ac 2452 echo "$def=y" >> $config_host_mak
0c58ac1c 2453done
2358a494 2454echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
0c58ac1c 2455for drv in $audio_drv_list; do
f6e5889e 2456 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
98ec69ac 2457 echo "$def=y" >> $config_host_mak
923e4521 2458 if test "$drv" = "fmod"; then
7aac6cb1 2459 echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
0c58ac1c 2460 fi
2461done
67f86e8e
JQ
2462if test "$audio_pt_int" = "yes" ; then
2463 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
2464fi
d5631638 2465if test "$audio_win_int" = "yes" ; then
2466 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
2467fi
eb852011 2468echo "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
8ff9cbf7 2469if test "$mixemu" = "yes" ; then
98ec69ac 2470 echo "CONFIG_MIXEMU=y" >> $config_host_mak
8ff9cbf7 2471fi
8d5d2d4c 2472if test "$vnc_tls" = "yes" ; then
98ec69ac 2473 echo "CONFIG_VNC_TLS=y" >> $config_host_mak
525061bf 2474 echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
8d5d2d4c 2475fi
2f9606b3 2476if test "$vnc_sasl" = "yes" ; then
98ec69ac 2477 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
60ddf533 2478 echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
2f9606b3 2479fi
96763cf9 2480if test "$vnc_jpeg" != "no" ; then
2f6f5c7a
CC
2481 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
2482 echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak
2483fi
96763cf9 2484if test "$vnc_png" != "no" ; then
efe556ad
CC
2485 echo "CONFIG_VNC_PNG=y" >> $config_host_mak
2486 echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak
2487fi
96763cf9 2488if test "$vnc_thread" != "no" ; then
bd023f95
CC
2489 echo "CONFIG_VNC_THREAD=y" >> $config_host_mak
2490 echo "CONFIG_THREAD=y" >> $config_host_mak
2491fi
76655d6d 2492if test "$fnmatch" = "yes" ; then
2358a494 2493 echo "CONFIG_FNMATCH=y" >> $config_host_mak
76655d6d 2494fi
ee682d27
SW
2495if test "$uuid" = "yes" ; then
2496 echo "CONFIG_UUID=y" >> $config_host_mak
2497fi
b1a550a0 2498qemu_version=`head $source_path/VERSION`
98ec69ac 2499echo "VERSION=$qemu_version" >>$config_host_mak
2358a494 2500echo "PKGVERSION=$pkgversion" >>$config_host_mak
98ec69ac 2501echo "SRC_PATH=$source_path" >> $config_host_mak
98ec69ac 2502echo "TARGET_DIRS=$target_list" >> $config_host_mak
a25dba17 2503if [ "$docs" = "yes" ] ; then
98ec69ac 2504 echo "BUILD_DOCS=yes" >> $config_host_mak
cc8ae6de 2505fi
1ac88f28 2506if test "$sdl" = "yes" ; then
98ec69ac 2507 echo "CONFIG_SDL=y" >> $config_host_mak
1ac88f28 2508 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
49ecc3fa
FB
2509fi
2510if test "$cocoa" = "yes" ; then
98ec69ac 2511 echo "CONFIG_COCOA=y" >> $config_host_mak
4d3b6f6e
AZ
2512fi
2513if test "$curses" = "yes" ; then
98ec69ac 2514 echo "CONFIG_CURSES=y" >> $config_host_mak
49ecc3fa 2515fi
3b3f24ad 2516if test "$atfile" = "yes" ; then
2358a494 2517 echo "CONFIG_ATFILE=y" >> $config_host_mak
3b3f24ad 2518fi
ebc996f3 2519if test "$utimens" = "yes" ; then
2358a494 2520 echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
ebc996f3 2521fi
099d6b0f 2522if test "$pipe2" = "yes" ; then
2358a494 2523 echo "CONFIG_PIPE2=y" >> $config_host_mak
099d6b0f 2524fi
40ff6d7e
KW
2525if test "$accept4" = "yes" ; then
2526 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
2527fi
3ce34dfb 2528if test "$splice" = "yes" ; then
2358a494 2529 echo "CONFIG_SPLICE=y" >> $config_host_mak
3ce34dfb 2530fi
c2882b96
RV
2531if test "$eventfd" = "yes" ; then
2532 echo "CONFIG_EVENTFD=y" >> $config_host_mak
2533fi
d0927938
UH
2534if test "$fallocate" = "yes" ; then
2535 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
2536fi
2537if test "$dup3" = "yes" ; then
2538 echo "CONFIG_DUP3=y" >> $config_host_mak
2539fi
3b3f24ad 2540if test "$inotify" = "yes" ; then
2358a494 2541 echo "CONFIG_INOTIFY=y" >> $config_host_mak
3b3f24ad 2542fi
c05c7a73
RV
2543if test "$inotify1" = "yes" ; then
2544 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
2545fi
6ae9a1f4
JQ
2546if test "$byteswap_h" = "yes" ; then
2547 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
2548fi
2549if test "$bswap_h" = "yes" ; then
2550 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
2551fi
769ce76d 2552if test "$curl" = "yes" ; then
98ec69ac 2553 echo "CONFIG_CURL=y" >> $config_host_mak
b1d5a277 2554 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
769ce76d 2555fi
2e4d9fb1 2556if test "$brlapi" = "yes" ; then
98ec69ac 2557 echo "CONFIG_BRLAPI=y" >> $config_host_mak
2e4d9fb1 2558fi
fb599c9a 2559if test "$bluez" = "yes" ; then
98ec69ac 2560 echo "CONFIG_BLUEZ=y" >> $config_host_mak
ef7635ec 2561 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
fb599c9a 2562fi
e37630ca 2563if test "$xen" = "yes" ; then
5647eb74 2564 echo "CONFIG_XEN=y" >> $config_host_mak
e37630ca 2565fi
e5d355d1 2566if test "$io_thread" = "yes" ; then
98ec69ac 2567 echo "CONFIG_IOTHREAD=y" >> $config_host_mak
bd023f95 2568 echo "CONFIG_THREAD=y" >> $config_host_mak
e5d355d1 2569fi
5c6c3a6c
CH
2570if test "$linux_aio" = "yes" ; then
2571 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
2572fi
758e8e38
VJJ
2573if test "$attr" = "yes" ; then
2574 echo "CONFIG_ATTR=y" >> $config_host_mak
2575fi
2576if test "$linux" = "yes" ; then
2577 if test "$attr" = "yes" ; then
2578 echo "CONFIG_VIRTFS=y" >> $config_host_mak
2579 fi
2580fi
77755340 2581if test "$blobs" = "yes" ; then
98ec69ac 2582 echo "INSTALL_BLOBS=yes" >> $config_host_mak
77755340 2583fi
bf9298b9 2584if test "$iovec" = "yes" ; then
2358a494 2585 echo "CONFIG_IOVEC=y" >> $config_host_mak
bf9298b9 2586fi
ceb42de8 2587if test "$preadv" = "yes" ; then
2358a494 2588 echo "CONFIG_PREADV=y" >> $config_host_mak
ceb42de8 2589fi
f652e6af 2590if test "$fdt" = "yes" ; then
3f0855b1 2591 echo "CONFIG_FDT=y" >> $config_host_mak
f652e6af 2592fi
dcc38d1c
MT
2593if test "$signalfd" = "yes" ; then
2594 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
2595fi
de5071c5
BS
2596if test "$need_offsetof" = "yes" ; then
2597 echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
2598fi
747bbdf7
BS
2599if test "$gcc_attribute_warn_unused_result" = "yes" ; then
2600 echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak
2601fi
5f6b9e8f
BS
2602if test "$fdatasync" = "yes" ; then
2603 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
2604fi
e78815a5
AF
2605if test "$madvise" = "yes" ; then
2606 echo "CONFIG_MADVISE=y" >> $config_host_mak
2607fi
2608if test "$posix_madvise" = "yes" ; then
2609 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
2610fi
97a847bc 2611
cd4ec0b4
GH
2612if test "$spice" = "yes" ; then
2613 echo "CONFIG_SPICE=y" >> $config_host_mak
2614fi
2615
83fb7adf 2616# XXX: suppress that
7d3505c5 2617if [ "$bsd" = "yes" ] ; then
2358a494 2618 echo "CONFIG_BSD=y" >> $config_host_mak
7d3505c5
FB
2619fi
2620
2358a494 2621echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
c5937220 2622
20ff6c80
AL
2623if test "$zero_malloc" = "yes" ; then
2624 echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
2625fi
2626
68063649
BS
2627# USB host support
2628case "$usb" in
2629linux)
98ec69ac 2630 echo "HOST_USB=linux" >> $config_host_mak
68063649
BS
2631;;
2632bsd)
98ec69ac 2633 echo "HOST_USB=bsd" >> $config_host_mak
68063649
BS
2634;;
2635*)
98ec69ac 2636 echo "HOST_USB=stub" >> $config_host_mak
68063649
BS
2637;;
2638esac
2639
94a420b1 2640echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
22890ab5
PS
2641if test "$trace_backend" = "simple"; then
2642 echo "CONFIG_SIMPLE_TRACE=y" >> $config_host_mak
2643fi
9410b56c
PS
2644# Set the appropriate trace file.
2645if test "$trace_backend" = "simple"; then
2646 trace_file="\"$trace_file-%u\""
2647fi
2648echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
2649
98ec69ac 2650echo "TOOLS=$tools" >> $config_host_mak
98ec69ac 2651echo "ROMS=$roms" >> $config_host_mak
804edf29
JQ
2652echo "MAKE=$make" >> $config_host_mak
2653echo "INSTALL=$install" >> $config_host_mak
2654echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak
2655echo "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak
2656echo "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak
2657echo "CC=$cc" >> $config_host_mak
2b2e59e6 2658echo "CC_I386=$cc_i386" >> $config_host_mak
804edf29
JQ
2659echo "HOST_CC=$host_cc" >> $config_host_mak
2660if test "$sparse" = "yes" ; then
2661 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
2662 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
a558ee17 2663 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
804edf29
JQ
2664fi
2665echo "AR=$ar" >> $config_host_mak
2666echo "OBJCOPY=$objcopy" >> $config_host_mak
2667echo "LD=$ld" >> $config_host_mak
9fe6de94 2668echo "WINDRES=$windres" >> $config_host_mak
e2a2ed06 2669echo "CFLAGS=$CFLAGS" >> $config_host_mak
a558ee17 2670echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
c81da56e 2671echo "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
e2a2ed06 2672echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
a36abbbb
JQ
2673echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
2674echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
73da375e 2675echo "LIBS+=$LIBS" >> $config_host_mak
3e2e0e6b 2676echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
804edf29 2677echo "EXESUF=$EXESUF" >> $config_host_mak
804edf29 2678
4bf6b55b
JQ
2679# generate list of library paths for linker script
2680
2681$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
2682
2683if test -f ${config_host_ld}~ ; then
2684 if cmp -s $config_host_ld ${config_host_ld}~ ; then
2685 mv ${config_host_ld}~ $config_host_ld
2686 else
2687 rm ${config_host_ld}~
2688 fi
2689fi
2690
4d904533
BS
2691for d in libdis libdis-user; do
2692 mkdir -p $d
2693 rm -f $d/Makefile
2694 ln -s $source_path/Makefile.dis $d/Makefile
2695 echo > $d/config.mak
2696done
d44cff22
RH
2697if test "$static" = "no" -a "$user_pie" = "yes" ; then
2698 echo "QEMU_CFLAGS+=-fpie" > libdis-user/config.mak
2699fi
4d904533 2700
1d14ffa9 2701for target in $target_list; do
97a847bc 2702target_dir="$target"
25be210f 2703config_target_mak=$target_dir/config-target.mak
600309b6 2704target_arch2=`echo $target | cut -d '-' -f 1`
97a847bc 2705target_bigendian="no"
1f3d3c8f 2706
ea2d6a39 2707case "$target_arch2" in
24e804ec 2708 armeb|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus)
ea2d6a39
JQ
2709 target_bigendian=yes
2710 ;;
2711esac
97a847bc 2712target_softmmu="no"
997344f3 2713target_user_only="no"
831b7825 2714target_linux_user="no"
831b7825 2715target_darwin_user="no"
84778508 2716target_bsd_user="no"
9e407a85 2717case "$target" in
600309b6 2718 ${target_arch2}-softmmu)
9e407a85
PB
2719 target_softmmu="yes"
2720 ;;
600309b6 2721 ${target_arch2}-linux-user)
9c7a4202
BS
2722 if test "$linux" != "yes" ; then
2723 echo "ERROR: Target '$target' is only available on a Linux host"
2724 exit 1
2725 fi
9e407a85
PB
2726 target_user_only="yes"
2727 target_linux_user="yes"
2728 ;;
600309b6 2729 ${target_arch2}-darwin-user)
9c7a4202
BS
2730 if test "$darwin" != "yes" ; then
2731 echo "ERROR: Target '$target' is only available on a Darwin host"
2732 exit 1
2733 fi
9e407a85
PB
2734 target_user_only="yes"
2735 target_darwin_user="yes"
2736 ;;
600309b6 2737 ${target_arch2}-bsd-user)
9cf55765 2738 if test "$bsd" != "yes" ; then
9c7a4202
BS
2739 echo "ERROR: Target '$target' is only available on a BSD host"
2740 exit 1
2741 fi
84778508
BS
2742 target_user_only="yes"
2743 target_bsd_user="yes"
2744 ;;
9e407a85
PB
2745 *)
2746 echo "ERROR: Target '$target' not recognised"
2747 exit 1
2748 ;;
2749esac
831b7825 2750
97a847bc 2751mkdir -p $target_dir
158142c2 2752mkdir -p $target_dir/fpu
57fec1fe 2753mkdir -p $target_dir/tcg
59f2a787 2754mkdir -p $target_dir/ide
84778508 2755if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
69de927c
FB
2756 mkdir -p $target_dir/nwfpe
2757fi
2758
ec530c81
FB
2759#
2760# don't use ln -sf as not all "ln -sf" over write the file/link
2761#
2762rm -f $target_dir/Makefile
2763ln -s $source_path/Makefile.target $target_dir/Makefile
2764
97a847bc 2765
25be210f 2766echo "# Automatically generated by configure - do not modify" > $config_target_mak
de83cd02 2767
e5fe0c52 2768bflt="no"
bd0c5661 2769target_nptl="no"
600309b6 2770interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
7ee2822c 2771echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
56aebc89 2772gdb_xml_files=""
7ba1e619 2773
938b1edd 2774TARGET_ARCH="$target_arch2"
6acff7da 2775TARGET_BASE_ARCH=""
e6e91b9c 2776TARGET_ABI_DIR=""
e73aae67 2777
600309b6 2778case "$target_arch2" in
2408a527 2779 i386)
1ad2134f 2780 target_phys_bits=32
2408a527
AJ
2781 ;;
2782 x86_64)
6acff7da 2783 TARGET_BASE_ARCH=i386
1ad2134f 2784 target_phys_bits=64
2408a527
AJ
2785 ;;
2786 alpha)
1ad2134f 2787 target_phys_bits=64
a4b388ff 2788 target_nptl="yes"
2408a527
AJ
2789 ;;
2790 arm|armeb)
b498c8a0 2791 TARGET_ARCH=arm
2408a527 2792 bflt="yes"
bd0c5661 2793 target_nptl="yes"
56aebc89 2794 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
1ad2134f 2795 target_phys_bits=32
2408a527
AJ
2796 ;;
2797 cris)
253bd7f8 2798 target_nptl="yes"
1ad2134f 2799 target_phys_bits=32
2408a527
AJ
2800 ;;
2801 m68k)
2408a527 2802 bflt="yes"
56aebc89 2803 gdb_xml_files="cf-core.xml cf-fp.xml"
1ad2134f 2804 target_phys_bits=32
2408a527 2805 ;;
72b675ca 2806 microblaze)
72b675ca
EI
2807 bflt="yes"
2808 target_nptl="yes"
2809 target_phys_bits=32
2810 ;;
0adcffb1 2811 mips|mipsel)
b498c8a0 2812 TARGET_ARCH=mips
25be210f 2813 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
f04dc72f 2814 target_nptl="yes"
1ad2134f 2815 target_phys_bits=64
2408a527
AJ
2816 ;;
2817 mipsn32|mipsn32el)
b498c8a0 2818 TARGET_ARCH=mipsn32
6acff7da 2819 TARGET_BASE_ARCH=mips
25be210f 2820 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
1ad2134f 2821 target_phys_bits=64
2408a527
AJ
2822 ;;
2823 mips64|mips64el)
b498c8a0 2824 TARGET_ARCH=mips64
6acff7da 2825 TARGET_BASE_ARCH=mips
25be210f 2826 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
1ad2134f 2827 target_phys_bits=64
2408a527
AJ
2828 ;;
2829 ppc)
c8b3532d 2830 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1ad2134f 2831 target_phys_bits=32
d6630708 2832 target_nptl="yes"
2408a527
AJ
2833 ;;
2834 ppcemb)
6acff7da 2835 TARGET_BASE_ARCH=ppc
e6e91b9c 2836 TARGET_ABI_DIR=ppc
c8b3532d 2837 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1ad2134f 2838 target_phys_bits=64
d6630708 2839 target_nptl="yes"
2408a527
AJ
2840 ;;
2841 ppc64)
6acff7da 2842 TARGET_BASE_ARCH=ppc
e6e91b9c 2843 TARGET_ABI_DIR=ppc
c8b3532d 2844 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1ad2134f 2845 target_phys_bits=64
2408a527
AJ
2846 ;;
2847 ppc64abi32)
b498c8a0 2848 TARGET_ARCH=ppc64
6acff7da 2849 TARGET_BASE_ARCH=ppc
e6e91b9c 2850 TARGET_ABI_DIR=ppc
25be210f 2851 echo "TARGET_ABI32=y" >> $config_target_mak
c8b3532d 2852 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1ad2134f 2853 target_phys_bits=64
2408a527
AJ
2854 ;;
2855 sh4|sh4eb)
b498c8a0 2856 TARGET_ARCH=sh4
2408a527 2857 bflt="yes"
0b6d3ae0 2858 target_nptl="yes"
1ad2134f 2859 target_phys_bits=32
2408a527
AJ
2860 ;;
2861 sparc)
1ad2134f 2862 target_phys_bits=64
2408a527
AJ
2863 ;;
2864 sparc64)
6acff7da 2865 TARGET_BASE_ARCH=sparc
1ad2134f 2866 target_phys_bits=64
2408a527
AJ
2867 ;;
2868 sparc32plus)
b498c8a0 2869 TARGET_ARCH=sparc64
6acff7da 2870 TARGET_BASE_ARCH=sparc
e6e91b9c 2871 TARGET_ABI_DIR=sparc
25be210f 2872 echo "TARGET_ABI32=y" >> $config_target_mak
1ad2134f 2873 target_phys_bits=64
2408a527 2874 ;;
24e804ec
AG
2875 s390x)
2876 target_phys_bits=64
2877 ;;
2408a527
AJ
2878 *)
2879 echo "Unsupported target CPU"
2880 exit 1
2881 ;;
2882esac
25be210f 2883echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
053dd92e 2884target_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
25be210f
JQ
2885echo "TARGET_$target_arch_name=y" >> $config_target_mak
2886echo "TARGET_ARCH2=$target_arch2" >> $config_target_mak
42bc608b 2887# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
6acff7da
JQ
2888if [ "$TARGET_BASE_ARCH" = "" ]; then
2889 TARGET_BASE_ARCH=$TARGET_ARCH
6acff7da 2890fi
25be210f 2891echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
e6e91b9c
JQ
2892if [ "$TARGET_ABI_DIR" = "" ]; then
2893 TARGET_ABI_DIR=$TARGET_ARCH
2894fi
25be210f 2895echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
1b0c87fc
JQ
2896case "$target_arch2" in
2897 i386|x86_64)
2898 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
25be210f 2899 echo "CONFIG_XEN=y" >> $config_target_mak
1b0c87fc
JQ
2900 fi
2901esac
c59249f9 2902case "$target_arch2" in
0e60a699 2903 i386|x86_64|ppcemb|ppc|ppc64|s390x)
c59249f9
JQ
2904 # Make sure the target and host cpus are compatible
2905 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
2906 \( "$target_arch2" = "$cpu" -o \
2907 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
5f114bc6 2908 \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \
c59249f9
JQ
2909 \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \
2910 \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then
25be210f
JQ
2911 echo "CONFIG_KVM=y" >> $config_target_mak
2912 echo "KVM_CFLAGS=$kvm_cflags" >> $config_target_mak
dae5079a
JK
2913 if test "$kvm_para" = "yes"; then
2914 echo "CONFIG_KVM_PARA=y" >> $config_target_mak
2915 fi
d5970055
MT
2916 if test $vhost_net = "yes" ; then
2917 echo "CONFIG_VHOST_NET=y" >> $config_target_mak
2918 fi
c59249f9
JQ
2919 fi
2920esac
de83cd02 2921if test "$target_bigendian" = "yes" ; then
25be210f 2922 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
de83cd02 2923fi
97a847bc 2924if test "$target_softmmu" = "yes" ; then
b1aa27c4 2925 echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
25be210f
JQ
2926 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
2927 echo "LIBS+=$libs_softmmu" >> $config_target_mak
0e8c9214 2928 echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
5791f45b 2929 echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
43ce4dfe 2930fi
997344f3 2931if test "$target_user_only" = "yes" ; then
25be210f 2932 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
997344f3 2933fi
831b7825 2934if test "$target_linux_user" = "yes" ; then
25be210f 2935 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
831b7825
TS
2936fi
2937if test "$target_darwin_user" = "yes" ; then
25be210f 2938 echo "CONFIG_DARWIN_USER=y" >> $config_target_mak
831b7825 2939fi
56aebc89
PB
2940list=""
2941if test ! -z "$gdb_xml_files" ; then
2942 for x in $gdb_xml_files; do
2943 list="$list $source_path/gdb-xml/$x"
2944 done
3d0f1517 2945 echo "TARGET_XML_FILES=$list" >> $config_target_mak
56aebc89 2946fi
97a847bc 2947
f57975fb 2948case "$target_arch2" in
990b3e19 2949 alpha|arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|s390x|sparc|sparc64|sparc32plus)
25be210f 2950 echo "CONFIG_SOFTFLOAT=y" >> $config_target_mak
f57975fb 2951 ;;
d6b38939 2952 *)
25be210f 2953 echo "CONFIG_NOSOFTFLOAT=y" >> $config_target_mak
d6b38939 2954 ;;
f57975fb
JQ
2955esac
2956
e5fe0c52 2957if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
25be210f 2958 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
e5fe0c52 2959fi
bd0c5661
PB
2960if test "$target_user_only" = "yes" \
2961 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
25be210f 2962 echo "CONFIG_USE_NPTL=y" >> $config_target_mak
bd0c5661 2963fi
379f6698 2964if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
25be210f 2965 echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
379f6698 2966fi
84778508 2967if test "$target_bsd_user" = "yes" ; then
25be210f 2968 echo "CONFIG_BSD_USER=y" >> $config_target_mak
84778508 2969fi
5b0753e0 2970
4afddb55 2971# generate QEMU_CFLAGS/LDFLAGS for targets
fa282484 2972
4afddb55 2973cflags=""
fa282484 2974ldflags=""
9b8e111f 2975
57ddfbf7
JQ
2976if test "$ARCH" = "sparc64" ; then
2977 cflags="-I\$(SRC_PATH)/tcg/sparc $cflags"
24e804ec
AG
2978elif test "$ARCH" = "s390x" ; then
2979 cflags="-I\$(SRC_PATH)/tcg/s390 $cflags"
5d8a4f8f
RH
2980elif test "$ARCH" = "x86_64" ; then
2981 cflags="-I\$(SRC_PATH)/tcg/i386 $cflags"
57ddfbf7
JQ
2982else
2983 cflags="-I\$(SRC_PATH)/tcg/\$(ARCH) $cflags"
2984fi
2985cflags="-I\$(SRC_PATH)/tcg $cflags"
2986cflags="-I\$(SRC_PATH)/fpu $cflags"
2987
4d904533
BS
2988if test "$target_user_only" = "yes" ; then
2989 libdis_config_mak=libdis-user/config.mak
2990else
2991 libdis_config_mak=libdis/config.mak
2992fi
2993
64656024
JQ
2994for i in $ARCH $TARGET_BASE_ARCH ; do
2995 case "$i" in
2996 alpha)
25be210f 2997 echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
4d904533 2998 echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak
64656024
JQ
2999 ;;
3000 arm)
25be210f 3001 echo "CONFIG_ARM_DIS=y" >> $config_target_mak
4d904533 3002 echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak
64656024
JQ
3003 ;;
3004 cris)
25be210f 3005 echo "CONFIG_CRIS_DIS=y" >> $config_target_mak
4d904533 3006 echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak
64656024
JQ
3007 ;;
3008 hppa)
25be210f 3009 echo "CONFIG_HPPA_DIS=y" >> $config_target_mak
4d904533 3010 echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak
64656024
JQ
3011 ;;
3012 i386|x86_64)
25be210f 3013 echo "CONFIG_I386_DIS=y" >> $config_target_mak
4d904533 3014 echo "CONFIG_I386_DIS=y" >> $libdis_config_mak
64656024 3015 ;;
903ec55c
AJ
3016 ia64*)
3017 echo "CONFIG_IA64_DIS=y" >> $config_target_mak
3018 echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak
3019 ;;
64656024 3020 m68k)
25be210f 3021 echo "CONFIG_M68K_DIS=y" >> $config_target_mak
4d904533 3022 echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak
64656024
JQ
3023 ;;
3024 microblaze)
25be210f 3025 echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak
4d904533 3026 echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak
64656024
JQ
3027 ;;
3028 mips*)
25be210f 3029 echo "CONFIG_MIPS_DIS=y" >> $config_target_mak
4d904533 3030 echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak
64656024
JQ
3031 ;;
3032 ppc*)
25be210f 3033 echo "CONFIG_PPC_DIS=y" >> $config_target_mak
4d904533 3034 echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak
64656024 3035 ;;
24e804ec 3036 s390*)
25be210f 3037 echo "CONFIG_S390_DIS=y" >> $config_target_mak
4d904533 3038 echo "CONFIG_S390_DIS=y" >> $libdis_config_mak
64656024
JQ
3039 ;;
3040 sh4)
25be210f 3041 echo "CONFIG_SH4_DIS=y" >> $config_target_mak
4d904533 3042 echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak
64656024
JQ
3043 ;;
3044 sparc*)
25be210f 3045 echo "CONFIG_SPARC_DIS=y" >> $config_target_mak
4d904533 3046 echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak
64656024
JQ
3047 ;;
3048 esac
3049done
3050
6ee7126f
JQ
3051case "$ARCH" in
3052alpha)
3053 # Ensure there's only a single GP
3054 cflags="-msmall-data $cflags"
3055;;
3056esac
3057
55d9c04b
JQ
3058if test "$target_softmmu" = "yes" ; then
3059 case "$TARGET_BASE_ARCH" in
3060 arm)
3061 cflags="-DHAS_AUDIO $cflags"
3062 ;;
3063 i386|mips|ppc)
3064 cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
3065 ;;
3066 esac
3067fi
3068
34005a00 3069if test "$target_user_only" = "yes" -a "$static" = "no" -a \
50108930 3070 "$user_pie" = "yes" ; then
34005a00
KS
3071 cflags="-fpie $cflags"
3072 ldflags="-pie $ldflags"
3073fi
3074
471857dd
JQ
3075if test "$target_softmmu" = "yes" -a \( \
3076 "$TARGET_ARCH" = "microblaze" -o \
3077 "$TARGET_ARCH" = "cris" \) ; then
25be210f 3078 echo "CONFIG_NEED_MMU=y" >> $config_target_mak
471857dd
JQ
3079fi
3080
d02c1db3 3081if test "$gprof" = "yes" ; then
25be210f 3082 echo "TARGET_GPROF=yes" >> $config_target_mak
d02c1db3
JQ
3083 if test "$target_linux_user" = "yes" ; then
3084 cflags="-p $cflags"
3085 ldflags="-p $ldflags"
3086 fi
3087 if test "$target_softmmu" = "yes" ; then
3088 ldflags="-p $ldflags"
25be210f 3089 echo "GPROF_CFLAGS=-p" >> $config_target_mak
d02c1db3
JQ
3090 fi
3091fi
3092
6ee7126f 3093linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
9b8e111f 3094if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
fa282484 3095 case "$ARCH" in
fa282484
JQ
3096 sparc)
3097 # -static is used to avoid g1/g3 usage by the dynamic linker
322e5878 3098 ldflags="$linker_script -static $ldflags"
fa282484 3099 ;;
4d58be06
RH
3100 alpha | s390x)
3101 # The default placement of the application is fine.
3102 ;;
fd76e73a 3103 *)
322e5878 3104 ldflags="$linker_script $ldflags"
fa282484
JQ
3105 ;;
3106 esac
3107fi
fa282484 3108
25be210f
JQ
3109echo "LDFLAGS+=$ldflags" >> $config_target_mak
3110echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
fa282484 3111
97a847bc 3112done # for target in $targets
7d13299d
FB
3113
3114# build tree in object directory if source path is different from current one
3115if test "$source_path_used" = "yes" ; then
e1144d00 3116 DIRS="tests tests/cris slirp audio block net pc-bios/optionrom"
2d9f27d2 3117 DIRS="$DIRS roms/seabios roms/vgabios"
3e230dd2 3118 DIRS="$DIRS fsdev ui"
7d13299d 3119 FILES="Makefile tests/Makefile"
e7daa605 3120 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
e1ffb0f1 3121 FILES="$FILES tests/test-mmap.c"
ae0bfb79 3122 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
2d9f27d2 3123 FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
7ea78b74
JK
3124 for bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do
3125 FILES="$FILES pc-bios/`basename $bios_file`"
3126 done
7d13299d
FB
3127 for dir in $DIRS ; do
3128 mkdir -p $dir
3129 done
ec530c81 3130 # remove the link and recreate it, as not all "ln -sf" overwrite the link
7d13299d 3131 for f in $FILES ; do
ec530c81
FB
3132 rm -f $f
3133 ln -s $source_path/$f $f
7d13299d
FB
3134 done
3135fi
1ad2134f 3136
c34ebfdc 3137# temporary config to build submodules
2d9f27d2 3138for rom in seabios vgabios ; do
c34ebfdc 3139 config_mak=roms/$rom/config.mak
37116c89 3140 echo "# Automatically generated by configure - do not modify" > $config_mak
c34ebfdc
AL
3141 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
3142 echo "CC=$cc" >> $config_mak
3143 echo "BCC=bcc" >> $config_mak
3144 echo "CPP=${cross_prefix}cpp" >> $config_mak
3145 echo "OBJCOPY=objcopy" >> $config_mak
3146 echo "IASL=iasl" >> $config_mak
3147 echo "HOST_CC=$host_cc" >> $config_mak
3148 echo "LD=$ld" >> $config_mak
3149done
3150
1ad2134f
PB
3151for hwlib in 32 64; do
3152 d=libhw$hwlib
3153 mkdir -p $d
9953b2fc 3154 mkdir -p $d/ide
1ad2134f
PB
3155 rm -f $d/Makefile
3156 ln -s $source_path/Makefile.hw $d/Makefile
37116c89 3157 echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
1ad2134f 3158done
add16157
BS
3159
3160d=libuser
3161mkdir -p $d
3162rm -f $d/Makefile
3163ln -s $source_path/Makefile.user $d/Makefile
299060a0
KS
3164if test "$static" = "no" -a "$user_pie" = "yes" ; then
3165 echo "QEMU_CFLAGS+=-fpie" > $d/config.mak
3166fi
b40292e7
JK
3167
3168if test "$docs" = "yes" ; then
3169 mkdir -p QMP
3170fi