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