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