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