]> git.proxmox.com Git - mirror_qemu.git/blame - configure
xen: groundwork for xen support (Gerd Hoffmann)
[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"
16TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"
17TMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
9d56d2dc 18TMPI="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.i"
d4742de8 19TMPSDLLOG="${TMPDIR1}/qemu-conf-sdl-$$-${RANDOM}.log"
7d13299d 20
d4742de8 21trap "rm -f $TMPC $TMPO $TMPE $TMPS $TMPI $TMPSDLLOG; exit" 0 2 3 15
9ac81bbb 22
7d13299d 23# default parameters
11d9f695 24prefix=""
1e43adfc 25interp_prefix="/usr/gnemul/qemu-%M"
43ce4dfe 26static="no"
7d13299d
FB
27cross_prefix=""
28cc="gcc"
0c58ac1c 29audio_drv_list=""
4c9b53e3 30audio_card_list="ac97 es1370 sb16"
31audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus"
7d13299d
FB
32host_cc="gcc"
33ar="ar"
34make="make"
6a882643 35install="install"
7d13299d 36strip="strip"
ac0df51d
AL
37
38# parse CC options first
39for opt do
40 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
41 case "$opt" in
42 --cross-prefix=*) cross_prefix="$optarg"
43 ;;
44 --cc=*) cc="$optarg"
45 ;;
46 esac
47done
48
49# OS specific
50# Using uname is really, really broken. Once we have the right set of checks
51# we can eliminate it's usage altogether
52
53cc="${cross_prefix}${cc}"
54ar="${cross_prefix}${ar}"
55strip="${cross_prefix}${strip}"
56
57# check that the C compiler works.
58cat > $TMPC <<EOF
59int main(void) {}
60EOF
61
62if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
63 : C compiler works ok
64else
65 echo "ERROR: \"$cc\" either does not exist or does not work"
66 exit 1
67fi
68
69check_define() {
70cat > $TMPC <<EOF
71#if !defined($1)
72#error Not defined
73#endif
74int main(void) { return 0; }
75EOF
76 $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
77}
78
79if check_define __i386__ ; then
80 cpu="i386"
81elif check_define __x86_64__ ; then
82 cpu="x86_64"
3aa9bd6c
BS
83elif check_define __sparc__ ; then
84 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
85 # They must be specified using --sparc_cpu
86 if check_define __arch64__ ; then
87 cpu="sparc64"
88 else
89 cpu="sparc"
90 fi
fdf7ed96 91elif check_define _ARCH_PPC ; then
92 if check_define _ARCH_PPC64 ; then
93 cpu="ppc64"
94 else
95 cpu="ppc"
96 fi
ac0df51d 97else
fdf7ed96 98 cpu=`uname -m`
ac0df51d
AL
99fi
100
5327cf48 101target_list=""
7d13299d
FB
102case "$cpu" in
103 i386|i486|i586|i686|i86pc|BePC)
97a847bc 104 cpu="i386"
7d13299d 105 ;;
aaa5fa14
AJ
106 x86_64|amd64)
107 cpu="x86_64"
108 ;;
109 alpha)
110 cpu="alpha"
111 ;;
ba68055e 112 armv*b)
808c4954
FB
113 cpu="armv4b"
114 ;;
ba68055e 115 armv*l)
7d13299d
FB
116 cpu="armv4l"
117 ;;
aaa5fa14
AJ
118 cris)
119 cpu="cris"
7d13299d 120 ;;
f54b3f92
AJ
121 parisc|parisc64)
122 cpu="hppa"
123 ;;
aaa5fa14
AJ
124 ia64)
125 cpu="ia64"
126 ;;
127 m68k)
128 cpu="m68k"
7d13299d
FB
129 ;;
130 mips)
131 cpu="mips"
132 ;;
fbe4f65b
TS
133 mips64)
134 cpu="mips64"
135 ;;
fdf7ed96 136 ppc)
137 cpu="ppc"
138 ;;
139 ppc64)
140 cpu="ppc64"
e7daa605 141 ;;
0e7b8a9f 142 s390*)
fb3e5849
FB
143 cpu="s390"
144 ;;
3142255c 145 sparc|sun4[cdmuv])
ae228531
FB
146 cpu="sparc"
147 ;;
148 sparc64)
149 cpu="sparc64"
150 ;;
7d13299d
FB
151 *)
152 cpu="unknown"
153 ;;
154esac
155gprof="no"
f8393946 156debug_tcg="no"
03b4fe7d 157sparse="no"
1625af87 158strip_opt="yes"
7d13299d 159bigendian="no"
67b915a5
FB
160mingw32="no"
161EXESUF=""
162gdbstub="yes"
443f1376 163slirp="yes"
e0e6c8c0 164vde="yes"
102a52e4
FB
165fmod_lib=""
166fmod_inc=""
2f6a1ab0 167oss_lib=""
8d5d2d4c 168vnc_tls="yes"
2f9606b3 169vnc_sasl="yes"
b1a550a0 170bsd="no"
5327cf48 171linux="no"
d2c7c9b8 172solaris="no"
c9ec1fe4 173kqemu="no"
05c2a3e7 174profiler="no"
5b0753e0 175cocoa="no"
97ccc689 176check_gfx="yes"
0a8e90f4 177softmmu="yes"
831b7825
TS
178linux_user="no"
179darwin_user="no"
84778508 180bsd_user="no"
cc8ae6de 181build_docs="no"
c5937220 182uname_release=""
4d3b6f6e 183curses="yes"
414f0dab 184aio="yes"
bd0c5661 185nptl="yes"
8ff9cbf7 186mixemu="no"
fb599c9a 187bluez="yes"
7ba1e619 188kvm="yes"
eac30262 189kerneldir=""
b29fe3ed 190aix="no"
77755340 191blobs="yes"
f652e6af 192fdt="yes"
5368a422 193sdl_x11="no"
e37630ca 194xen="yes"
4a19f1ec 195pkgversion=""
7d13299d
FB
196
197# OS specific
ac0df51d
AL
198if check_define __linux__ ; then
199 targetos="Linux"
200elif check_define _WIN32 ; then
201 targetos='MINGW32'
169dc5d3
BS
202elif check_define __OpenBSD__ ; then
203 targetos='OpenBSD'
204elif check_define __sun__ ; then
205 targetos='SunOS'
ac0df51d
AL
206else
207 targetos=`uname -s`
208fi
7d13299d 209case $targetos in
c326e0af
FB
210CYGWIN*)
211mingw32="yes"
6f30fa85 212OS_CFLAGS="-mno-cygwin"
db8d7dd1
TS
213if [ "$cpu" = "i386" ] ; then
214 kqemu="yes"
215fi
c2de5c91 216audio_possible_drivers="sdl"
c326e0af 217;;
67b915a5
FB
218MINGW32*)
219mingw32="yes"
db8d7dd1
TS
220if [ "$cpu" = "i386" ] ; then
221 kqemu="yes"
222fi
c2de5c91 223audio_possible_drivers="dsound sdl fmod"
67b915a5 224;;
5c40d2bd 225GNU/kFreeBSD)
0c58ac1c 226audio_drv_list="oss"
f34af52c 227audio_possible_drivers="oss sdl esd pa"
5c40d2bd
TS
228if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
229 kqemu="yes"
230fi
231;;
7d3505c5
FB
232FreeBSD)
233bsd="yes"
0c58ac1c 234audio_drv_list="oss"
f34af52c 235audio_possible_drivers="oss sdl esd pa"
e99f9060 236if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
07f4ddbf
FB
237 kqemu="yes"
238fi
7d3505c5 239;;
c5e97233
BS
240DragonFly)
241bsd="yes"
242audio_drv_list="oss"
243audio_possible_drivers="oss sdl esd pa"
244if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
245 kqemu="yes"
246fi
247aio="no"
248;;
7d3505c5
FB
249NetBSD)
250bsd="yes"
0c58ac1c 251audio_drv_list="oss"
c2de5c91 252audio_possible_drivers="oss sdl esd"
8ef92a88 253oss_lib="-lossaudio"
7d3505c5
FB
254;;
255OpenBSD)
256bsd="yes"
128ab2ff 257openbsd="yes"
0c58ac1c 258audio_drv_list="oss"
c2de5c91 259audio_possible_drivers="oss sdl esd"
2f6a1ab0 260oss_lib="-lossaudio"
7d3505c5 261;;
83fb7adf
FB
262Darwin)
263bsd="yes"
264darwin="yes"
1b0f9cc2 265# on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can run 64-bit userspace code
aab8588a 266if [ "$cpu" = "i386" ] ; then
267 is_x86_64=`sysctl -n hw.optional.x86_64`
268 [ "$is_x86_64" = "1" ] && cpu=x86_64
1b0f9cc2
AL
269fi
270if [ "$cpu" = "x86_64" ] ; then
271 OS_CFLAGS="-arch x86_64"
272 LDFLAGS="-arch x86_64"
273else
274 OS_CFLAGS="-mdynamic-no-pic"
275fi
831b7825 276darwin_user="yes"
fd677642 277cocoa="yes"
0c58ac1c 278audio_drv_list="coreaudio"
c2de5c91 279audio_possible_drivers="coreaudio sdl fmod"
c2c59c3e 280OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
83fb7adf 281;;
ec530c81 282SunOS)
c2b84fab
TS
283 solaris="yes"
284 make="gmake"
285 install="ginstall"
0475a5ca 286 needs_libsunmath="no"
acda94b1 287 kvm="no"
c2b84fab 288 solarisrev=`uname -r | cut -f2 -d.`
ef18c883
TS
289 # have to select again, because `uname -m` returns i86pc
290 # even on an x86_64 box.
291 solariscpu=`isainfo -k`
292 if test "${solariscpu}" = "amd64" ; then
293 cpu="x86_64"
294 fi
c2b84fab 295 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
0475a5ca
TS
296 if test "$solarisrev" -le 9 ; then
297 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
298 needs_libsunmath="yes"
299 else
300 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
301 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
302 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
303 echo "Studio 11 can be downloaded from www.sun.com."
304 exit 1
305 fi
306 fi
307 if test "$solarisrev" -ge 9 ; then
c2b84fab
TS
308 kqemu="yes"
309 fi
86b2bd93 310 fi
6b4d2ba1 311 if test -f /usr/include/sys/soundcard.h ; then
0c58ac1c 312 audio_drv_list="oss"
6b4d2ba1 313 fi
c2de5c91 314 audio_possible_drivers="oss sdl"
14d483ec 315 OS_CFLAGS=-std=gnu99
86b2bd93 316;;
b29fe3ed 317AIX)
318aix="yes"
319make="gmake"
320;;
1d14ffa9 321*)
0c58ac1c 322audio_drv_list="oss"
b8e59f18 323audio_possible_drivers="oss alsa sdl esd pa"
5327cf48 324linux="yes"
831b7825 325linux_user="yes"
68063649 326usb="linux"
07f4ddbf 327if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
c9ec1fe4 328 kqemu="yes"
c2de5c91 329 audio_possible_drivers="$audio_possible_drivers fmod"
c9ec1fe4 330fi
fb065187 331;;
7d13299d
FB
332esac
333
7d3505c5 334if [ "$bsd" = "yes" ] ; then
b1a550a0 335 if [ "$darwin" != "yes" ] ; then
83fb7adf 336 make="gmake"
68063649 337 usb="bsd"
83fb7adf 338 fi
84778508 339 bsd_user="yes"
7d3505c5
FB
340fi
341
7d13299d 342# find source path
ad064840 343source_path=`dirname "$0"`
59faef3a
AZ
344source_path_used="no"
345workdir=`pwd`
ad064840 346if [ -z "$source_path" ]; then
59faef3a 347 source_path=$workdir
ad064840
PB
348else
349 source_path=`cd "$source_path"; pwd`
7d13299d 350fi
724db118 351[ -f "$workdir/vl.c" ] || source_path_used="yes"
7d13299d 352
85aa5189 353werror="no"
0d1e2394
FB
354# generate compile errors on warnings for development builds
355#if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
356#werror="yes";
357#fi
85aa5189 358
7d13299d 359for opt do
a46e4035 360 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
7d13299d 361 case "$opt" in
2efc3265
FB
362 --help|-h) show_help=yes
363 ;;
b1a550a0 364 --prefix=*) prefix="$optarg"
7d13299d 365 ;;
b1a550a0 366 --interp-prefix=*) interp_prefix="$optarg"
32ce6337 367 ;;
b1a550a0 368 --source-path=*) source_path="$optarg"
ad064840 369 source_path_used="yes"
7d13299d 370 ;;
ac0df51d 371 --cross-prefix=*)
7d13299d 372 ;;
ac0df51d 373 --cc=*)
7d13299d 374 ;;
b1a550a0 375 --host-cc=*) host_cc="$optarg"
83469015 376 ;;
b1a550a0 377 --make=*) make="$optarg"
7d13299d 378 ;;
6a882643
PB
379 --install=*) install="$optarg"
380 ;;
b1a550a0 381 --extra-cflags=*) CFLAGS="$optarg"
7d13299d 382 ;;
b1a550a0 383 --extra-ldflags=*) LDFLAGS="$optarg"
7d13299d 384 ;;
b1a550a0 385 --cpu=*) cpu="$optarg"
7d13299d 386 ;;
b1a550a0 387 --target-list=*) target_list="$optarg"
de83cd02 388 ;;
7d13299d
FB
389 --enable-gprof) gprof="yes"
390 ;;
43ce4dfe
FB
391 --static) static="yes"
392 ;;
97a847bc
FB
393 --disable-sdl) sdl="no"
394 ;;
0c58ac1c 395 --fmod-lib=*) fmod_lib="$optarg"
1d14ffa9 396 ;;
c2de5c91 397 --fmod-inc=*) fmod_inc="$optarg"
398 ;;
2f6a1ab0
BS
399 --oss-lib=*) oss_lib="$optarg"
400 ;;
2fa7d3bf 401 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
102a52e4 402 ;;
0c58ac1c 403 --audio-drv-list=*) audio_drv_list="$optarg"
102a52e4 404 ;;
f8393946
AJ
405 --enable-debug-tcg) debug_tcg="yes"
406 ;;
407 --disable-debug-tcg) debug_tcg="no"
408 ;;
03b4fe7d
AL
409 --enable-sparse) sparse="yes"
410 ;;
411 --disable-sparse) sparse="no"
412 ;;
1625af87
AL
413 --disable-strip) strip_opt="no"
414 ;;
8d5d2d4c
TS
415 --disable-vnc-tls) vnc_tls="no"
416 ;;
2f9606b3
AL
417 --disable-vnc-sasl) vnc_sasl="no"
418 ;;
443f1376 419 --disable-slirp) slirp="no"
1d14ffa9 420 ;;
e0e6c8c0 421 --disable-vde) vde="no"
8a16d273 422 ;;
c9ec1fe4 423 --disable-kqemu) kqemu="no"
1d14ffa9 424 ;;
e37630ca
AL
425 --disable-xen) xen="no"
426 ;;
2e4d9fb1
AJ
427 --disable-brlapi) brlapi="no"
428 ;;
fb599c9a
AZ
429 --disable-bluez) bluez="no"
430 ;;
7ba1e619
AL
431 --disable-kvm) kvm="no"
432 ;;
05c2a3e7
FB
433 --enable-profiler) profiler="yes"
434 ;;
c2de5c91 435 --enable-cocoa)
436 cocoa="yes" ;
437 sdl="no" ;
438 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
1d14ffa9 439 ;;
97ccc689
FB
440 --disable-gfx-check) check_gfx="no"
441 ;;
cad25d69 442 --disable-system) softmmu="no"
0a8e90f4 443 ;;
cad25d69 444 --enable-system) softmmu="yes"
0a8e90f4 445 ;;
831b7825 446 --disable-linux-user) linux_user="no"
0a8e90f4 447 ;;
831b7825
TS
448 --enable-linux-user) linux_user="yes"
449 ;;
450 --disable-darwin-user) darwin_user="no"
451 ;;
452 --enable-darwin-user) darwin_user="yes"
0a8e90f4 453 ;;
84778508
BS
454 --disable-bsd-user) bsd_user="no"
455 ;;
456 --enable-bsd-user) bsd_user="yes"
457 ;;
c5937220
PB
458 --enable-uname-release=*) uname_release="$optarg"
459 ;;
3142255c
BS
460 --sparc_cpu=*)
461 sparc_cpu="$optarg"
462 case $sparc_cpu in
463 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
464 target_cpu="sparc"; cpu="sparc" ;;
465 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
466 target_cpu="sparc"; cpu="sparc" ;;
467 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
468 target_cpu="sparc64"; cpu="sparc64" ;;
469 *) echo "undefined SPARC architecture. Exiting";exit 1;;
470 esac
471 ;;
85aa5189
FB
472 --enable-werror) werror="yes"
473 ;;
474 --disable-werror) werror="no"
475 ;;
4d3b6f6e
AZ
476 --disable-curses) curses="no"
477 ;;
bd0c5661
PB
478 --disable-nptl) nptl="no"
479 ;;
8ff9cbf7 480 --enable-mixemu) mixemu="yes"
481 ;;
414f0dab
BS
482 --disable-aio) aio="no"
483 ;;
77755340
TS
484 --disable-blobs) blobs="no"
485 ;;
eac30262
AL
486 --kerneldir=*) kerneldir="$optarg"
487 ;;
4a19f1ec
PB
488 --with-pkgversion=*) pkgversion=" ($optarg)"
489 ;;
7f1559c6
AZ
490 *) echo "ERROR: unknown option $opt"; show_help="yes"
491 ;;
7d13299d
FB
492 esac
493done
494
6f30fa85 495# default flags for all hosts
ac41a620 496CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
e0e36fe9 497CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
6f30fa85 498LDFLAGS="$LDFLAGS -g"
85aa5189
FB
499if test "$werror" = "yes" ; then
500CFLAGS="$CFLAGS -Werror"
501fi
6f30fa85 502
d2c7c9b8
BS
503if test "$solaris" = "no" ; then
504 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
505 LDFLAGS="$LDFLAGS -Wl,--warn-common"
506 fi
49237acd
BS
507fi
508
3142255c
BS
509#
510# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
511# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
512#
40293e58 513case "$cpu" in
3142255c
BS
514 sparc) if test -z "$sparc_cpu" ; then
515 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
516 ARCH_LDFLAGS="-m32"
517 else
518 ARCH_CFLAGS="${SP_CFLAGS}"
519 ARCH_LDFLAGS="${SP_LDFLAGS}"
520 fi
762e8230
BS
521 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g2 -ffixed-g3"
522 if test "$solaris" = "no" ; then
523 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g6"
524 fi
3142255c
BS
525 ;;
526 sparc64) if test -z "$sparc_cpu" ; then
527 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
528 ARCH_LDFLAGS="-m64"
529 else
530 ARCH_CFLAGS="${SP_CFLAGS}"
531 ARCH_LDFLAGS="${SP_LDFLAGS}"
532 fi
762e8230
BS
533 if test "$solaris" = "no" ; then
534 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g5 -ffixed-g6 -ffixed-g7"
535 else
536 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7"
537 fi
3142255c 538 ;;
76d83bde
TS
539 s390)
540 ARCH_CFLAGS="-march=z900"
541 ;;
40293e58
FB
542 i386)
543 ARCH_CFLAGS="-m32"
544 ARCH_LDFLAGS="-m32"
545 ;;
546 x86_64)
547 ARCH_CFLAGS="-m64"
548 ARCH_LDFLAGS="-m64"
549 ;;
3142255c
BS
550esac
551
af5db58e
PB
552if test x"$show_help" = x"yes" ; then
553cat << EOF
554
555Usage: configure [options]
556Options: [defaults in brackets after descriptions]
557
558EOF
559echo "Standard options:"
560echo " --help print this message"
561echo " --prefix=PREFIX install in PREFIX [$prefix]"
562echo " --interp-prefix=PREFIX where to find shared libraries, etc."
563echo " use %M for cpu name [$interp_prefix]"
564echo " --target-list=LIST set target list [$target_list]"
565echo ""
566echo "kqemu kernel acceleration support:"
567echo " --disable-kqemu disable kqemu support"
af5db58e
PB
568echo ""
569echo "Advanced options (experts only):"
570echo " --source-path=PATH path of source code [$source_path]"
571echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
572echo " --cc=CC use C compiler CC [$cc]"
573echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
2981fa96
AJ
574echo " --extra-cflags=CFLAGS add C compiler flags CFLAGS"
575echo " --extra-ldflags=LDFLAGS add linker flags LDFLAGS"
af5db58e 576echo " --make=MAKE use specified make [$make]"
6a882643 577echo " --install=INSTALL use specified install [$install]"
af5db58e 578echo " --static enable static build [$static]"
f8393946
AJ
579echo " --enable-debug-tcg enable TCG debugging"
580echo " --disable-debug-tcg disable TCG debugging (default)"
890b1658
AL
581echo " --enable-sparse enable sparse checker"
582echo " --disable-sparse disable sparse checker (default)"
1625af87 583echo " --disable-strip disable stripping binaries"
85aa5189 584echo " --disable-werror disable compilation abort on warning"
fe8f78e4 585echo " --disable-sdl disable SDL"
af5db58e 586echo " --enable-cocoa enable COCOA (Mac OS X only)"
c2de5c91 587echo " --audio-drv-list=LIST set audio drivers list:"
588echo " Available drivers: $audio_possible_drivers"
4c9b53e3 589echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
590echo " Available cards: $audio_possible_cards"
8ff9cbf7 591echo " --enable-mixemu enable mixer emulation"
e37630ca 592echo " --disable-xen disable xen backend driver support"
2e4d9fb1 593echo " --disable-brlapi disable BrlAPI"
8d5d2d4c 594echo " --disable-vnc-tls disable TLS encryption for VNC server"
2f9606b3 595echo " --disable-vnc-sasl disable SASL encryption for VNC server"
af896aaa 596echo " --disable-curses disable curses output"
fb599c9a 597echo " --disable-bluez disable bluez stack connectivity"
7ba1e619 598echo " --disable-kvm disable KVM acceleration support"
bd0c5661 599echo " --disable-nptl disable usermode NPTL support"
af5db58e
PB
600echo " --enable-system enable all system emulation targets"
601echo " --disable-system disable all system emulation targets"
831b7825
TS
602echo " --enable-linux-user enable all linux usermode emulation targets"
603echo " --disable-linux-user disable all linux usermode emulation targets"
604echo " --enable-darwin-user enable all darwin usermode emulation targets"
605echo " --disable-darwin-user disable all darwin usermode emulation targets"
84778508
BS
606echo " --enable-bsd-user enable all BSD usermode emulation targets"
607echo " --disable-bsd-user disable all BSD usermode emulation targets"
af5db58e
PB
608echo " --fmod-lib path to FMOD library"
609echo " --fmod-inc path to FMOD includes"
2f6a1ab0 610echo " --oss-lib path to OSS library"
c5937220 611echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
3142255c 612echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
e0e6c8c0 613echo " --disable-vde disable support for vde network"
414f0dab 614echo " --disable-aio disable AIO support"
77755340 615echo " --disable-blobs disable installing provided firmware blobs"
eac30262 616echo " --kerneldir=PATH look for kernel includes in PATH"
af5db58e 617echo ""
5bf08934 618echo "NOTE: The object files are built at the place where configure is launched"
af5db58e
PB
619exit 1
620fi
621
67b915a5 622if test "$mingw32" = "yes" ; then
5327cf48 623 linux="no"
67b915a5 624 EXESUF=".exe"
9f059eca 625 oss="no"
cd01b4a3 626 linux_user="no"
84778508 627 bsd_user="no"
49dc768d 628 OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
cd01b4a3
AL
629fi
630
03b4fe7d
AL
631if test ! -x "$(which cgcc 2>/dev/null)"; then
632 sparse="no"
633fi
634
ec530c81
FB
635#
636# Solaris specific configure tool chain decisions
637#
638if test "$solaris" = "yes" ; then
ec530c81
FB
639 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
640 if test -z "$solinst" ; then
641 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
642 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
643 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
644 exit 1
645 fi
646 if test "$solinst" = "/usr/sbin/install" ; then
647 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
648 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
649 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
650 exit 1
651 fi
ec530c81
FB
652 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
653 if test -z "$sol_ar" ; then
654 echo "Error: No path includes ar"
655 if test -f /usr/ccs/bin/ar ; then
656 echo "Add /usr/ccs/bin to your path and rerun configure"
657 fi
658 exit 1
659 fi
5fafdf24 660fi
ec530c81
FB
661
662
5327cf48
FB
663if test -z "$target_list" ; then
664# these targets are portable
0a8e90f4 665 if [ "$softmmu" = "yes" ] ; then
2408a527
AJ
666 target_list="\
667i386-softmmu \
668x86_64-softmmu \
669arm-softmmu \
670cris-softmmu \
671m68k-softmmu \
672mips-softmmu \
673mipsel-softmmu \
674mips64-softmmu \
675mips64el-softmmu \
676ppc-softmmu \
677ppcemb-softmmu \
678ppc64-softmmu \
679sh4-softmmu \
680sh4eb-softmmu \
681sparc-softmmu \
682"
0a8e90f4 683 fi
5327cf48 684# the following are Linux specific
831b7825 685 if [ "$linux_user" = "yes" ] ; then
2408a527
AJ
686 target_list="${target_list}\
687i386-linux-user \
688x86_64-linux-user \
689alpha-linux-user \
690arm-linux-user \
691armeb-linux-user \
692cris-linux-user \
693m68k-linux-user \
694mips-linux-user \
695mipsel-linux-user \
696ppc-linux-user \
697ppc64-linux-user \
698ppc64abi32-linux-user \
699sh4-linux-user \
700sh4eb-linux-user \
701sparc-linux-user \
702sparc64-linux-user \
703sparc32plus-linux-user \
704"
831b7825
TS
705 fi
706# the following are Darwin specific
707 if [ "$darwin_user" = "yes" ] ; then
6cdc7375 708 target_list="$target_list i386-darwin-user ppc-darwin-user "
5327cf48 709 fi
84778508
BS
710# the following are BSD specific
711 if [ "$bsd_user" = "yes" ] ; then
712 target_list="${target_list}\
31fc12df
BS
713i386-bsd-user \
714x86_64-bsd-user \
715sparc-bsd-user \
84778508
BS
716sparc64-bsd-user \
717"
718 fi
6e20a45f 719else
b1a550a0 720 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
5327cf48 721fi
0a8e90f4
PB
722if test -z "$target_list" ; then
723 echo "No targets enabled"
724 exit 1
725fi
5327cf48 726
7d13299d
FB
727if test -z "$cross_prefix" ; then
728
729# ---
730# big/little endian test
731cat > $TMPC << EOF
732#include <inttypes.h>
733int main(int argc, char ** argv){
1d14ffa9
FB
734 volatile uint32_t i=0x01234567;
735 return (*((uint8_t*)(&i))) == 0x67;
7d13299d
FB
736}
737EOF
738
178baee6 739if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
7d13299d
FB
740$TMPE && bigendian="yes"
741else
742echo big/little test failed
743fi
744
745else
746
747# if cross compiling, cannot launch a program, so make a static guess
0938cda5 748if test "$cpu" = "armv4b" \
f54b3f92 749 -o "$cpu" = "hppa" \
0938cda5
AJ
750 -o "$cpu" = "m68k" \
751 -o "$cpu" = "mips" \
752 -o "$cpu" = "mips64" \
fdf7ed96 753 -o "$cpu" = "ppc" \
754 -o "$cpu" = "ppc64" \
0938cda5
AJ
755 -o "$cpu" = "s390" \
756 -o "$cpu" = "sparc" \
757 -o "$cpu" = "sparc64"; then
7d13299d
FB
758 bigendian="yes"
759fi
760
761fi
762
b6853697
FB
763# host long bits test
764hostlongbits="32"
0938cda5
AJ
765if test "$cpu" = "x86_64" \
766 -o "$cpu" = "alpha" \
767 -o "$cpu" = "ia64" \
fdf7ed96 768 -o "$cpu" = "sparc64" \
769 -o "$cpu" = "ppc64"; then
b6853697
FB
770 hostlongbits="64"
771fi
772
bd0c5661
PB
773# Check host NPTL support
774cat > $TMPC <<EOF
775#include <sched.h>
30813cea 776#include <linux/futex.h>
bd0c5661
PB
777void foo()
778{
779#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
780#error bork
781#endif
782}
783EOF
784
8c7f7574 785if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
bd0c5661
PB
786 :
787else
788 nptl="no"
789fi
790
ac62922e
AZ
791##########################################
792# zlib check
793
794cat > $TMPC << EOF
795#include <zlib.h>
796int main(void) { zlibVersion(); return 0; }
797EOF
8c7f7574 798if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
ac62922e
AZ
799 :
800else
801 echo
802 echo "Error: zlib check failed"
803 echo "Make sure to have the zlib libs and headers installed."
804 echo
805 exit 1
806fi
807
e37630ca
AL
808##########################################
809# xen probe
810
811if test "$xen" = "yes" ; then
812cat > $TMPC <<EOF
813#include <xenctrl.h>
814#include <xs.h>
815int main(void) { xs_daemon_open; xc_interface_open; }
816EOF
817 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC -lxenstore -lxenctrl 2> /dev/null ; then
818 :
819 else
820 xen="no"
821 fi
822fi
823
11d9f695
FB
824##########################################
825# SDL probe
826
827sdl_too_old=no
828
829if test -z "$sdl" ; then
069b0bda
TS
830 sdl_config="sdl-config"
831 sdl=no
832 sdl_static=no
833
11d9f695
FB
834cat > $TMPC << EOF
835#include <SDL.h>
836#undef main /* We don't want SDL to override our main() */
837int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
838EOF
8c7f7574 839 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` > $TMPSDLLOG 2>&1 ; then
cd01b4a3
AL
840 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
841 if test "$_sdlversion" -lt 121 ; then
842 sdl_too_old=yes
843 else
844 if test "$cocoa" = "no" ; then
845 sdl=yes
069b0bda 846 fi
cd01b4a3 847 fi
11d9f695 848
cd01b4a3
AL
849 # static link with sdl ?
850 if test "$sdl" = "yes" ; then
851 aa="no"
852 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
853 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
854 if [ "$aa" = "yes" ] ; then
855 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
856 fi
857
8c7f7574 858 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then
cd01b4a3
AL
859 sdl_static=yes
860 fi
861 fi # static link
862 fi # sdl compile test
fd677642 863else
069b0bda
TS
864 # Make sure to disable cocoa if sdl was set
865 if test "$sdl" = "yes" ; then
866 cocoa="no"
c2de5c91 867 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
069b0bda 868 fi
a6e022ad 869fi # -z $sdl
11d9f695 870
5368a422
AL
871if test "$sdl" = "yes" ; then
872cat > $TMPC <<EOF
873#include <SDL.h>
874#if defined(SDL_VIDEO_DRIVER_X11)
875#include <X11/XKBlib.h>
876#else
877#error No x11 support
878#endif
879int main(void) { return 0; }
880EOF
881 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` > /dev/null 2>&1 ; then
882 sdl_x11="yes"
883 fi
884fi
885
8d5d2d4c
TS
886##########################################
887# VNC TLS detection
888if test "$vnc_tls" = "yes" ; then
ae6b5e5a
AL
889cat > $TMPC <<EOF
890#include <gnutls/gnutls.h>
891int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
892EOF
893 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
894 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
895 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
8c7f7574 896 $vnc_tls_libs > /dev/null 2> /dev/null ; then
ae6b5e5a
AL
897 :
898 else
899 vnc_tls="no"
900 fi
8d5d2d4c
TS
901fi
902
2f9606b3
AL
903##########################################
904# VNC SASL detection
905if test "$vnc_sasl" = "yes" ; then
906cat > $TMPC <<EOF
907#include <sasl/sasl.h>
908#include <stdio.h>
909int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
910EOF
911 # Assuming Cyrus-SASL installed in /usr prefix
912 vnc_sasl_cflags=""
913 vnc_sasl_libs="-lsasl2"
914 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
915 $vnc_sasl_libs 2> /dev/null ; then
916 :
917 else
918 vnc_sasl="no"
919 fi
920fi
921
76655d6d
AL
922##########################################
923# fnmatch() probe, used for ACL routines
924fnmatch="no"
925cat > $TMPC << EOF
926#include <fnmatch.h>
927int main(void)
928{
929 fnmatch("foo", "foo", 0);
930 return 0;
931}
932EOF
933if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
934 fnmatch="yes"
935fi
936
8a16d273
TS
937##########################################
938# vde libraries probe
939if test "$vde" = "yes" ; then
940 cat > $TMPC << EOF
941#include <libvdeplug.h>
4a7f0e06
PB
942int main(void)
943{
944 struct vde_open_args a = {0, 0, 0};
945 vde_open("", "", &a);
946 return 0;
947}
8a16d273 948EOF
8c7f7574 949 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
8a16d273
TS
950 :
951 else
e0e6c8c0 952 vde="no"
8a16d273
TS
953 fi
954fi
955
8f28f3fb 956##########################################
c2de5c91 957# Sound support libraries probe
8f28f3fb 958
c2de5c91 959audio_drv_probe()
960{
961 drv=$1
962 hdr=$2
963 lib=$3
964 exp=$4
965 cfl=$5
966 cat > $TMPC << EOF
967#include <$hdr>
968int main(void) { $exp }
8f28f3fb 969EOF
8c7f7574 970 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
c2de5c91 971 :
972 else
973 echo
974 echo "Error: $drv check failed"
975 echo "Make sure to have the $drv libs and headers installed."
976 echo
977 exit 1
978 fi
979}
980
2fa7d3bf 981audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
c2de5c91 982for drv in $audio_drv_list; do
983 case $drv in
984 alsa)
985 audio_drv_probe $drv alsa/asoundlib.h -lasound \
986 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
987 ;;
988
989 fmod)
990 if test -z $fmod_lib || test -z $fmod_inc; then
991 echo
992 echo "Error: You must specify path to FMOD library and headers"
993 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
994 echo
995 exit 1
996 fi
997 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
998 ;;
999
1000 esd)
1001 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1002 ;;
b8e59f18 1003
1004 pa)
1005 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
1006 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1007 ;;
1008
2f6a1ab0
BS
1009 oss|sdl|core|wav|dsound)
1010 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1011 ;;
1012
e4c63a6a 1013 *)
1c9b2a52 1014 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
e4c63a6a 1015 echo
1016 echo "Error: Unknown driver '$drv' selected"
1017 echo "Possible drivers are: $audio_possible_drivers"
1018 echo
1019 exit 1
1020 }
1021 ;;
c2de5c91 1022 esac
1023done
8f28f3fb 1024
2e4d9fb1
AJ
1025##########################################
1026# BrlAPI probe
1027
1028if test -z "$brlapi" ; then
1029 brlapi=no
1030cat > $TMPC << EOF
1031#include <brlapi.h>
1032int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1033EOF
178baee6 1034 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
2e4d9fb1
AJ
1035 brlapi=yes
1036 fi # brlapi compile test
1037fi # -z $brlapi
1038
4d3b6f6e
AZ
1039##########################################
1040# curses probe
1041
1042if test "$curses" = "yes" ; then
1043 curses=no
1044 cat > $TMPC << EOF
1045#include <curses.h>
5a8ff3aa
BS
1046#ifdef __OpenBSD__
1047#define resize_term resizeterm
1048#endif
1049int main(void) { resize_term(0, 0); return curses_version(); }
4d3b6f6e 1050EOF
178baee6 1051 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
4d3b6f6e
AZ
1052 curses=yes
1053 fi
1054fi # test "$curses"
1055
fb599c9a
AZ
1056##########################################
1057# bluez support probe
1058if test "$bluez" = "yes" ; then
1059 `pkg-config bluez` || bluez="no"
1060fi
1061if test "$bluez" = "yes" ; then
e820e3f4
AZ
1062 cat > $TMPC << EOF
1063#include <bluetooth/bluetooth.h>
1064int main(void) { return bt_error(0); }
1065EOF
fb599c9a
AZ
1066 bluez_cflags=`pkg-config --cflags bluez`
1067 bluez_libs=`pkg-config --libs bluez`
17e1592d 1068 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
8c7f7574 1069 $bluez_libs > /dev/null 2> /dev/null ; then
e820e3f4
AZ
1070 :
1071 else
1072 bluez="no"
1073 fi
fb599c9a
AZ
1074fi
1075
7ba1e619
AL
1076##########################################
1077# kvm probe
1078if test "$kvm" = "yes" ; then
1079 cat > $TMPC <<EOF
1080#include <linux/kvm.h>
9fd8d8d7 1081#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
7ba1e619
AL
1082#error Invalid KVM version
1083#endif
9fd8d8d7
AL
1084#if !defined(KVM_CAP_USER_MEMORY)
1085#error Missing KVM capability KVM_CAP_USER_MEMORY
1086#endif
1087#if !defined(KVM_CAP_SET_TSS_ADDR)
1088#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1089#endif
1090#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1091#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1092#endif
7ba1e619
AL
1093int main(void) { return 0; }
1094EOF
eac30262
AL
1095 if test "$kerneldir" != "" ; then
1096 kvm_cflags=-I"$kerneldir"/include
8444eb6e
AL
1097 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1098 -a -d "$kerneldir/arch/x86/include" ; then
1099 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
406b430d
AL
1100 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1101 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
8444eb6e
AL
1102 elif test -d "$kerneldir/arch/$cpu/include" ; then
1103 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1104 fi
eac30262
AL
1105 else
1106 kvm_cflags=""
1107 fi
7ba1e619 1108 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
8c7f7574 1109 > /dev/null 2>/dev/null ; then
7ba1e619
AL
1110 :
1111 else
9fd8d8d7
AL
1112 kvm="no";
1113 if [ -x "`which awk 2>/dev/null`" ] && \
1114 [ -x "`which grep 2>/dev/null`" ]; then
e4f5100c 1115 kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
9fd8d8d7
AL
1116 | grep "error: " \
1117 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1118 if test "$kvmerr" != "" ; then
1119 kvm="no - (${kvmerr})"
1120 fi
1121 fi
7ba1e619
AL
1122 fi
1123fi
1124
414f0dab
BS
1125##########################################
1126# AIO probe
3c529d93
AL
1127AIOLIBS=""
1128
414f0dab
BS
1129if test "$aio" = "yes" ; then
1130 aio=no
1131 cat > $TMPC << EOF
3c529d93 1132#include <pthread.h>
c9db92fc 1133int main(void) { pthread_mutex_t lock; return 0; }
414f0dab
BS
1134EOF
1135 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
1136 aio=yes
3c529d93 1137 AIOLIBS="-lpthread"
414f0dab
BS
1138 fi
1139fi
1140
bf9298b9
AL
1141##########################################
1142# iovec probe
1143cat > $TMPC <<EOF
db34f0b3 1144#include <sys/types.h>
bf9298b9 1145#include <sys/uio.h>
db34f0b3 1146#include <unistd.h>
bf9298b9
AL
1147int main(void) { struct iovec iov; return 0; }
1148EOF
1149iovec=no
8c7f7574 1150if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
bf9298b9
AL
1151 iovec=yes
1152fi
1153
ceb42de8
AL
1154##########################################
1155# preadv probe
1156cat > $TMPC <<EOF
1157#include <sys/types.h>
1158#include <sys/uio.h>
1159#include <unistd.h>
1160int main(void) { preadv; }
1161EOF
1162preadv=no
1163if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1164 preadv=yes
1165fi
1166
f652e6af
AJ
1167##########################################
1168# fdt probe
1169if test "$fdt" = "yes" ; then
1170 fdt=no
1171 cat > $TMPC << EOF
1172int main(void) { return 0; }
1173EOF
1174 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null ; then
1175 fdt=yes
1176 fi
1177fi
1178
3b3f24ad
AJ
1179#
1180# Check for xxxat() functions when we are building linux-user
1181# emulator. This is done because older glibc versions don't
1182# have syscall stubs for these implemented.
1183#
1184atfile=no
1185if [ "$linux_user" = "yes" ] ; then
1186 cat > $TMPC << EOF
1187#define _ATFILE_SOURCE
1188#include <sys/types.h>
1189#include <fcntl.h>
1190#include <unistd.h>
1191
1192int
1193main(void)
1194{
1195 /* try to unlink nonexisting file */
1196 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1197}
1198EOF
1199 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1200 atfile=yes
1201 fi
1202fi
1203
39386ac7 1204# Check for inotify functions when we are building linux-user
3b3f24ad
AJ
1205# emulator. This is done because older glibc versions don't
1206# have syscall stubs for these implemented. In that case we
1207# don't provide them even if kernel supports them.
1208#
1209inotify=no
1210if [ "$linux_user" = "yes" ] ; then
1211 cat > $TMPC << EOF
1212#include <sys/inotify.h>
1213
1214int
1215main(void)
1216{
1217 /* try to start inotify */
8690e420 1218 return inotify_init();
3b3f24ad
AJ
1219}
1220EOF
1221 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1222 inotify=yes
1223 fi
1224fi
1225
cc8ae6de 1226# Check if tools are available to build documentation.
6c591867
TS
1227if [ -x "`which texi2html 2>/dev/null`" ] && \
1228 [ -x "`which pod2man 2>/dev/null`" ]; then
cc8ae6de
PB
1229 build_docs="yes"
1230fi
1231
da93a1fd
AL
1232##########################################
1233# Do we need librt
1234cat > $TMPC <<EOF
1235#include <signal.h>
1236#include <time.h>
1237int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1238EOF
1239
1240rt=no
8c7f7574 1241if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
da93a1fd 1242 :
8c7f7574 1243elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
da93a1fd
AL
1244 rt=yes
1245fi
1246
1247if test "$rt" = "yes" ; then
1248 # Hack, we should have a general purpose LIBS for this sort of thing
1249 AIOLIBS="$AIOLIBS -lrt"
1250fi
1251
11d9f695 1252if test "$mingw32" = "yes" ; then
308c3593 1253 if test -z "$prefix" ; then
17e90973 1254 prefix="c:\\\\Program Files\\\\Qemu"
308c3593
PB
1255 fi
1256 mansuffix=""
1257 datasuffix=""
1258 docsuffix=""
1259 binsuffix=""
11d9f695 1260else
308c3593
PB
1261 if test -z "$prefix" ; then
1262 prefix="/usr/local"
1263 fi
1264 mansuffix="/share/man"
1265 datasuffix="/share/qemu"
1266 docsuffix="/share/doc/qemu"
1267 binsuffix="/bin"
11d9f695 1268fi
5a67135a 1269
43ce4dfe 1270echo "Install prefix $prefix"
308c3593
PB
1271echo "BIOS directory $prefix$datasuffix"
1272echo "binary directory $prefix$binsuffix"
11d9f695 1273if test "$mingw32" = "no" ; then
308c3593 1274echo "Manual directory $prefix$mansuffix"
43ce4dfe 1275echo "ELF interp prefix $interp_prefix"
11d9f695 1276fi
5a67135a 1277echo "Source path $source_path"
43ce4dfe 1278echo "C compiler $cc"
83469015 1279echo "Host C compiler $host_cc"
db7287ed 1280echo "ARCH_CFLAGS $ARCH_CFLAGS"
43ce4dfe 1281echo "make $make"
6a882643 1282echo "install $install"
43ce4dfe 1283echo "host CPU $cpu"
de83cd02 1284echo "host big endian $bigendian"
97a847bc 1285echo "target list $target_list"
ade25b0d 1286echo "tcg debug enabled $debug_tcg"
43ce4dfe 1287echo "gprof enabled $gprof"
03b4fe7d 1288echo "sparse enabled $sparse"
1625af87 1289echo "strip binaries $strip_opt"
05c2a3e7 1290echo "profiler $profiler"
43ce4dfe 1291echo "static build $static"
85aa5189 1292echo "-Werror enabled $werror"
5b0753e0
FB
1293if test "$darwin" = "yes" ; then
1294 echo "Cocoa support $cocoa"
1295fi
97a847bc 1296echo "SDL support $sdl"
e4afee97
FB
1297if test "$sdl" != "no" ; then
1298 echo "SDL static link $sdl_static"
1299fi
4d3b6f6e 1300echo "curses support $curses"
67b915a5 1301echo "mingw32 support $mingw32"
0c58ac1c 1302echo "Audio drivers $audio_drv_list"
1303echo "Extra audio cards $audio_card_list"
8ff9cbf7 1304echo "Mixer emulation $mixemu"
8d5d2d4c
TS
1305echo "VNC TLS support $vnc_tls"
1306if test "$vnc_tls" = "yes" ; then
1307 echo " TLS CFLAGS $vnc_tls_cflags"
1308 echo " TLS LIBS $vnc_tls_libs"
1309fi
2f9606b3
AL
1310echo "VNC SASL support $vnc_sasl"
1311if test "$vnc_sasl" = "yes" ; then
1312 echo " SASL CFLAGS $vnc_sasl_cflags"
1313 echo " SASL LIBS $vnc_sasl_libs"
1314fi
3142255c
BS
1315if test -n "$sparc_cpu"; then
1316 echo "Target Sparc Arch $sparc_cpu"
1317fi
07f4ddbf 1318echo "kqemu support $kqemu"
e37630ca 1319echo "xen support $xen"
2e4d9fb1 1320echo "brlapi support $brlapi"
cc8ae6de 1321echo "Documentation $build_docs"
c5937220
PB
1322[ ! -z "$uname_release" ] && \
1323echo "uname -r $uname_release"
bd0c5661 1324echo "NPTL support $nptl"
8a16d273 1325echo "vde support $vde"
414f0dab 1326echo "AIO support $aio"
77755340 1327echo "Install blobs $blobs"
7ba1e619 1328echo "KVM support $kvm"
f652e6af 1329echo "fdt support $fdt"
ceb42de8 1330echo "preadv support $preadv"
67b915a5 1331
97a847bc 1332if test $sdl_too_old = "yes"; then
24b55b96 1333echo "-> Your SDL version is too old - please upgrade to have SDL support"
7c1f25b4 1334fi
d4742de8 1335if [ -s $TMPSDLLOG ]; then
20b40c6a 1336 echo "The error log from compiling the libSDL test is: "
d4742de8 1337 cat $TMPSDLLOG
20b40c6a 1338fi
24b55b96
FB
1339#if test "$sdl_static" = "no"; then
1340# echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1341#fi
97a847bc
FB
1342config_mak="config-host.mak"
1343config_h="config-host.h"
7d13299d 1344
7c1f25b4 1345#echo "Creating $config_mak and $config_h"
7d13299d 1346
15d9ca0f
TS
1347test -f $config_h && mv $config_h ${config_h}~
1348
97a847bc 1349echo "# Automatically generated by configure - do not modify" > $config_mak
fc9902d9 1350printf "# Configured with:" >> $config_mak
fd69fe2b 1351printf " '%s'" "$0" "$@" >> $config_mak
1352echo >> $config_mak
97a847bc 1353echo "/* Automatically generated by configure - do not modify */" > $config_h
7d13299d 1354
97a847bc 1355echo "prefix=$prefix" >> $config_mak
308c3593
PB
1356echo "bindir=\${prefix}$binsuffix" >> $config_mak
1357echo "mandir=\${prefix}$mansuffix" >> $config_mak
1358echo "datadir=\${prefix}$datasuffix" >> $config_mak
4ad5b06d 1359echo "docdir=\${prefix}$docsuffix" >> $config_mak
308c3593 1360echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
97a847bc 1361echo "MAKE=$make" >> $config_mak
6a882643 1362echo "INSTALL=$install" >> $config_mak
58f8aead
AL
1363echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_mak
1364echo "INSTALL_DATA=$install -m0644 -p" >> $config_mak
1365echo "INSTALL_PROG=$install -m0755 -p" >> $config_mak
97a847bc 1366echo "CC=$cc" >> $config_mak
97a847bc
FB
1367echo "HOST_CC=$host_cc" >> $config_mak
1368echo "AR=$ar" >> $config_mak
40293e58
FB
1369# XXX: only use CFLAGS and LDFLAGS ?
1370# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1371# compilation of dyngen tool (useful for win32 build on Linux host)
6f30fa85 1372echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
3142255c
BS
1373echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1374echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1375echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
97a847bc
FB
1376echo "CFLAGS=$CFLAGS" >> $config_mak
1377echo "LDFLAGS=$LDFLAGS" >> $config_mak
67b915a5 1378echo "EXESUF=$EXESUF" >> $config_mak
70956b77 1379echo "AIOLIBS=$AIOLIBS" >> $config_mak
2408a527
AJ
1380case "$cpu" in
1381 i386)
1382 echo "ARCH=i386" >> $config_mak
1383 echo "#define HOST_I386 1" >> $config_h
1384 ;;
1385 x86_64)
1386 echo "ARCH=x86_64" >> $config_mak
1387 echo "#define HOST_X86_64 1" >> $config_h
1388 ;;
1389 alpha)
1390 echo "ARCH=alpha" >> $config_mak
1391 echo "#define HOST_ALPHA 1" >> $config_h
1392 ;;
1393 armv4b)
1394 echo "ARCH=arm" >> $config_mak
1395 echo "#define HOST_ARM 1" >> $config_h
1396 ;;
1397 armv4l)
1398 echo "ARCH=arm" >> $config_mak
1399 echo "#define HOST_ARM 1" >> $config_h
1400 ;;
1401 cris)
1402 echo "ARCH=cris" >> $config_mak
1403 echo "#define HOST_CRIS 1" >> $config_h
1404 ;;
1405 hppa)
1406 echo "ARCH=hppa" >> $config_mak
1407 echo "#define HOST_HPPA 1" >> $config_h
1408 ;;
1409 ia64)
1410 echo "ARCH=ia64" >> $config_mak
1411 echo "#define HOST_IA64 1" >> $config_h
1412 ;;
1413 m68k)
1414 echo "ARCH=m68k" >> $config_mak
1415 echo "#define HOST_M68K 1" >> $config_h
1416 ;;
1417 mips)
1418 echo "ARCH=mips" >> $config_mak
1419 echo "#define HOST_MIPS 1" >> $config_h
1420 ;;
1421 mips64)
1422 echo "ARCH=mips64" >> $config_mak
1423 echo "#define HOST_MIPS64 1" >> $config_h
1424 ;;
fdf7ed96 1425 ppc)
1426 echo "ARCH=ppc" >> $config_mak
1427 echo "#define HOST_PPC 1" >> $config_h
1428 ;;
1429 ppc64)
1430 echo "ARCH=ppc64" >> $config_mak
1431 echo "#define HOST_PPC64 1" >> $config_h
2408a527
AJ
1432 ;;
1433 s390)
1434 echo "ARCH=s390" >> $config_mak
1435 echo "#define HOST_S390 1" >> $config_h
1436 ;;
1437 sparc)
1438 echo "ARCH=sparc" >> $config_mak
1439 echo "#define HOST_SPARC 1" >> $config_h
1440 ;;
1441 sparc64)
1442 echo "ARCH=sparc64" >> $config_mak
1443 echo "#define HOST_SPARC64 1" >> $config_h
1444 ;;
1445 *)
1446 echo "Unsupported CPU = $cpu"
1447 exit 1
1448 ;;
1449esac
f8393946
AJ
1450if test "$debug_tcg" = "yes" ; then
1451 echo "#define DEBUG_TCG 1" >> $config_h
1452fi
03b4fe7d
AL
1453if test "$sparse" = "yes" ; then
1454 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1455 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1456 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1457fi
1625af87
AL
1458if test "$strip_opt" = "yes" ; then
1459 echo "STRIP_OPT=-s" >> $config_mak
1460fi
7d13299d 1461if test "$bigendian" = "yes" ; then
97a847bc
FB
1462 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1463 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1464fi
b6853697 1465echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
67b915a5
FB
1466if test "$mingw32" = "yes" ; then
1467 echo "CONFIG_WIN32=yes" >> $config_mak
11d9f695 1468 echo "#define CONFIG_WIN32 1" >> $config_h
210fa556
PB
1469else
1470 cat > $TMPC << EOF
1471#include <byteswap.h>
1472int main(void) { return bswap_32(0); }
1473EOF
178baee6 1474 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
210fa556
PB
1475 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1476 fi
1360677c
BS
1477 cat > $TMPC << EOF
1478#include <sys/endian.h>
1479#include <sys/types.h>
1480#include <machine/bswap.h>
1481int main(void) { return bswap32(0); }
1482EOF
178baee6 1483 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
1360677c
BS
1484 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1485 fi
67b915a5 1486fi
128ab2ff
BS
1487
1488if [ "$openbsd" = "yes" ] ; then
1489 echo "#define ENOTSUP 4096" >> $config_h
1490fi
1491
83fb7adf
FB
1492if test "$darwin" = "yes" ; then
1493 echo "CONFIG_DARWIN=yes" >> $config_mak
1494 echo "#define CONFIG_DARWIN 1" >> $config_h
1495fi
b29fe3ed 1496
1497if test "$aix" = "yes" ; then
1498 echo "CONFIG_AIX=yes" >> $config_mak
1499 echo "#define CONFIG_AIX 1" >> $config_h
1500fi
1501
ec530c81
FB
1502if test "$solaris" = "yes" ; then
1503 echo "CONFIG_SOLARIS=yes" >> $config_mak
38cfa06c 1504 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
0475a5ca
TS
1505 if test "$needs_libsunmath" = "yes" ; then
1506 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1507 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1508 fi
ec530c81 1509fi
3142255c
BS
1510if test -n "$sparc_cpu"; then
1511 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1512 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1513fi
67b915a5
FB
1514if test "$gdbstub" = "yes" ; then
1515 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1516 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1517fi
97a847bc
FB
1518if test "$gprof" = "yes" ; then
1519 echo "TARGET_GPROF=yes" >> $config_mak
1520 echo "#define HAVE_GPROF 1" >> $config_h
1521fi
1522if test "$static" = "yes" ; then
1523 echo "CONFIG_STATIC=yes" >> $config_mak
50863472 1524 echo "#define CONFIG_STATIC 1" >> $config_h
7d13299d 1525fi
05c2a3e7
FB
1526if test $profiler = "yes" ; then
1527 echo "#define CONFIG_PROFILER 1" >> $config_h
1528fi
c20709aa
FB
1529if test "$slirp" = "yes" ; then
1530 echo "CONFIG_SLIRP=yes" >> $config_mak
1531 echo "#define CONFIG_SLIRP 1" >> $config_h
1532fi
8a16d273
TS
1533if test "$vde" = "yes" ; then
1534 echo "CONFIG_VDE=yes" >> $config_mak
1535 echo "#define CONFIG_VDE 1" >> $config_h
1536 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1537fi
0c58ac1c 1538for card in $audio_card_list; do
f6e5889e 1539 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
0c58ac1c 1540 echo "$def=yes" >> $config_mak
1541 echo "#define $def 1" >> $config_h
1542done
1543echo "#define AUDIO_DRIVERS \\" >> $config_h
1544for drv in $audio_drv_list; do
1545 echo " &${drv}_audio_driver, \\" >>$config_h
f6e5889e 1546 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
0c58ac1c 1547 echo "$def=yes" >> $config_mak
923e4521 1548 if test "$drv" = "fmod"; then
0c58ac1c 1549 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1550 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
2f6a1ab0
BS
1551 elif test "$drv" = "oss"; then
1552 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
0c58ac1c 1553 fi
1554done
1555echo "" >>$config_h
8ff9cbf7 1556if test "$mixemu" = "yes" ; then
1557 echo "CONFIG_MIXEMU=yes" >> $config_mak
1558 echo "#define CONFIG_MIXEMU 1" >> $config_h
1559fi
8d5d2d4c
TS
1560if test "$vnc_tls" = "yes" ; then
1561 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1562 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1563 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1564 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1565fi
2f9606b3
AL
1566if test "$vnc_sasl" = "yes" ; then
1567 echo "CONFIG_VNC_SASL=yes" >> $config_mak
1568 echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1569 echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1570 echo "#define CONFIG_VNC_SASL 1" >> $config_h
1571fi
76655d6d
AL
1572if test "$fnmatch" = "yes" ; then
1573 echo "#define HAVE_FNMATCH_H 1" >> $config_h
1574fi
b1a550a0
PB
1575qemu_version=`head $source_path/VERSION`
1576echo "VERSION=$qemu_version" >>$config_mak
d4b8f039 1577echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
97a847bc 1578
4a19f1ec
PB
1579echo "#define QEMU_PKGVERSION \"$pkgversion\"" >> $config_h
1580
97a847bc 1581echo "SRC_PATH=$source_path" >> $config_mak
ad064840
PB
1582if [ "$source_path_used" = "yes" ]; then
1583 echo "VPATH=$source_path" >> $config_mak
1584fi
97a847bc 1585echo "TARGET_DIRS=$target_list" >> $config_mak
cc8ae6de
PB
1586if [ "$build_docs" = "yes" ] ; then
1587 echo "BUILD_DOCS=yes" >> $config_mak
1588fi
49ecc3fa
FB
1589if test "$static" = "yes"; then
1590 sdl1=$sdl_static
1591else
1592 sdl1=$sdl
1593fi
1594if test "$sdl1" = "yes" ; then
1595 echo "#define CONFIG_SDL 1" >> $config_h
1596 echo "CONFIG_SDL=yes" >> $config_mak
1597 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1598 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
5368a422
AL
1599 elif test "$sdl_x11" = "yes" ; then
1600 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
49ecc3fa
FB
1601 else
1602 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1603 fi
1604 if [ "${aa}" = "yes" ] ; then
1605 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1606 else
1607 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1608 fi
1609fi
1610if test "$cocoa" = "yes" ; then
4d3b6f6e
AZ
1611 echo "#define CONFIG_COCOA 1" >> $config_h
1612 echo "CONFIG_COCOA=yes" >> $config_mak
1613fi
1614if test "$curses" = "yes" ; then
1615 echo "#define CONFIG_CURSES 1" >> $config_h
1616 echo "CONFIG_CURSES=yes" >> $config_mak
1617 echo "CURSES_LIBS=-lcurses" >> $config_mak
49ecc3fa 1618fi
3b3f24ad
AJ
1619if test "$atfile" = "yes" ; then
1620 echo "#define CONFIG_ATFILE 1" >> $config_h
1621fi
1622if test "$inotify" = "yes" ; then
1623 echo "#define CONFIG_INOTIFY 1" >> $config_h
1624fi
2e4d9fb1
AJ
1625if test "$brlapi" = "yes" ; then
1626 echo "CONFIG_BRLAPI=yes" >> $config_mak
1627 echo "#define CONFIG_BRLAPI 1" >> $config_h
1628 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1629fi
fb599c9a
AZ
1630if test "$bluez" = "yes" ; then
1631 echo "CONFIG_BLUEZ=yes" >> $config_mak
1632 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1633 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1634 echo "#define CONFIG_BLUEZ 1" >> $config_h
1635fi
e37630ca
AL
1636if test "$xen" = "yes" ; then
1637 echo "XEN_LIBS=-lxenstore -lxenctrl" >> $config_mak
1638fi
414f0dab
BS
1639if test "$aio" = "yes" ; then
1640 echo "#define CONFIG_AIO 1" >> $config_h
a3392f9b 1641 echo "CONFIG_AIO=yes" >> $config_mak
414f0dab 1642fi
77755340
TS
1643if test "$blobs" = "yes" ; then
1644 echo "INSTALL_BLOBS=yes" >> $config_mak
1645fi
bf9298b9
AL
1646if test "$iovec" = "yes" ; then
1647 echo "#define HAVE_IOVEC 1" >> $config_h
1648fi
ceb42de8
AL
1649if test "$preadv" = "yes" ; then
1650 echo "#define HAVE_PREADV 1" >> $config_h
1651fi
f652e6af
AJ
1652if test "$fdt" = "yes" ; then
1653 echo "#define HAVE_FDT 1" >> $config_h
1654 echo "FDT_LIBS=-lfdt" >> $config_mak
1655fi
97a847bc 1656
83fb7adf 1657# XXX: suppress that
7d3505c5 1658if [ "$bsd" = "yes" ] ; then
43003046 1659 echo "#define O_LARGEFILE 0" >> $config_h
43003046 1660 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
179a2c19 1661 echo "#define HOST_BSD 1" >> $config_h
7d3505c5
FB
1662fi
1663
c5937220
PB
1664echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1665
68063649
BS
1666# USB host support
1667case "$usb" in
1668linux)
1669 echo "HOST_USB=linux" >> $config_mak
1670;;
1671bsd)
1672 echo "HOST_USB=bsd" >> $config_mak
1673;;
1674*)
1675 echo "HOST_USB=stub" >> $config_mak
1676;;
1677esac
1678
c39e3338
PB
1679tools=
1680if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
3dd1f8ef 1681 tools="qemu-img\$(EXESUF) $tools"
7a5ca864 1682 if [ "$linux" = "yes" ] ; then
3dd1f8ef 1683 tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
7a5ca864 1684 fi
c39e3338
PB
1685fi
1686echo "TOOLS=$tools" >> $config_mak
1687
15d9ca0f
TS
1688test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1689
1d14ffa9 1690for target in $target_list; do
97a847bc
FB
1691target_dir="$target"
1692config_mak=$target_dir/config.mak
1693config_h=$target_dir/config.h
1694target_cpu=`echo $target | cut -d '-' -f 1`
1695target_bigendian="no"
808c4954 1696[ "$target_cpu" = "armeb" ] && target_bigendian=yes
0938cda5
AJ
1697[ "$target_cpu" = "m68k" ] && target_bigendian=yes
1698[ "$target_cpu" = "mips" ] && target_bigendian=yes
1699[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1700[ "$target_cpu" = "mips64" ] && target_bigendian=yes
67867308 1701[ "$target_cpu" = "ppc" ] && target_bigendian=yes
d4082e95 1702[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
22f8a8b3 1703[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
e85e7c6e 1704[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
908f52b0 1705[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
0938cda5
AJ
1706[ "$target_cpu" = "sparc" ] && target_bigendian=yes
1707[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1708[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
97a847bc 1709target_softmmu="no"
997344f3 1710target_user_only="no"
831b7825 1711target_linux_user="no"
831b7825 1712target_darwin_user="no"
84778508 1713target_bsd_user="no"
9e407a85
PB
1714case "$target" in
1715 ${target_cpu}-softmmu)
1716 target_softmmu="yes"
1717 ;;
1718 ${target_cpu}-linux-user)
1719 target_user_only="yes"
1720 target_linux_user="yes"
1721 ;;
1722 ${target_cpu}-darwin-user)
1723 target_user_only="yes"
1724 target_darwin_user="yes"
1725 ;;
84778508
BS
1726 ${target_cpu}-bsd-user)
1727 target_user_only="yes"
1728 target_bsd_user="yes"
1729 ;;
9e407a85
PB
1730 *)
1731 echo "ERROR: Target '$target' not recognised"
1732 exit 1
1733 ;;
1734esac
831b7825 1735
97ccc689 1736if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1d14ffa9 1737 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
97ccc689 1738 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
9c038506 1739 echo "To build QEMU without graphical output configure with --disable-gfx-check"
4d3b6f6e
AZ
1740 echo "Note that this will disable all output from the virtual graphics card"
1741 echo "except through VNC or curses."
97ccc689
FB
1742 exit 1;
1743fi
1744
7c1f25b4 1745#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
97a847bc 1746
15d9ca0f
TS
1747test -f $config_h && mv $config_h ${config_h}~
1748
97a847bc 1749mkdir -p $target_dir
158142c2 1750mkdir -p $target_dir/fpu
57fec1fe 1751mkdir -p $target_dir/tcg
84778508 1752if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
69de927c
FB
1753 mkdir -p $target_dir/nwfpe
1754fi
1755
ec530c81
FB
1756#
1757# don't use ln -sf as not all "ln -sf" over write the file/link
1758#
1759rm -f $target_dir/Makefile
1760ln -s $source_path/Makefile.target $target_dir/Makefile
1761
97a847bc
FB
1762
1763echo "# Automatically generated by configure - do not modify" > $config_mak
1764echo "/* Automatically generated by configure - do not modify */" > $config_h
1765
de83cd02 1766
97a847bc
FB
1767echo "include ../config-host.mak" >> $config_mak
1768echo "#include \"../config-host.h\"" >> $config_h
1e43adfc 1769
e5fe0c52 1770bflt="no"
cb33da57 1771elfload32="no"
bd0c5661 1772target_nptl="no"
1e43adfc
FB
1773interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1774echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
56aebc89 1775gdb_xml_files=""
97a847bc 1776
5985ecee
AL
1777# Make sure the target and host cpus are compatible
1778if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
fdf7ed96 1779 \( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \) -o \
5985ecee
AL
1780 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1781 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
7ba1e619
AL
1782 kvm="no"
1783fi
1784# Disable KVM for linux-user
1785if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1786 kvm="no"
1787fi
1788
2408a527
AJ
1789case "$target_cpu" in
1790 i386)
1791 echo "TARGET_ARCH=i386" >> $config_mak
1792 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1793 echo "#define TARGET_I386 1" >> $config_h
da260249 1794 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
2408a527 1795 then
2d6ebb0c 1796 echo "CONFIG_KQEMU=yes" >> $config_mak
640f42e4 1797 echo "#define CONFIG_KQEMU 1" >> $config_h
2408a527 1798 fi
7ba1e619
AL
1799 if test "$kvm" = "yes" ; then
1800 echo "CONFIG_KVM=yes" >> $config_mak
1801 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
5985ecee 1802 echo "#define CONFIG_KVM 1" >> $config_h
7ba1e619 1803 fi
e37630ca
AL
1804 if test "$xen" = "yes" -a "$target_softmmu" = "yes";
1805 then
1806 echo "CONFIG_XEN=yes" >> $config_mak
1807 echo "#define CONFIG_XEN 1" >> $config_h
1808 fi
2408a527
AJ
1809 ;;
1810 x86_64)
1811 echo "TARGET_ARCH=x86_64" >> $config_mak
1812 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1813 echo "#define TARGET_I386 1" >> $config_h
1814 echo "#define TARGET_X86_64 1" >> $config_h
1815 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1816 then
2d6ebb0c 1817 echo "CONFIG_KQEMU=yes" >> $config_mak
640f42e4 1818 echo "#define CONFIG_KQEMU 1" >> $config_h
2408a527 1819 fi
7ba1e619
AL
1820 if test "$kvm" = "yes" ; then
1821 echo "CONFIG_KVM=yes" >> $config_mak
1822 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1823 echo "#define CONFIG_KVM 1" >> $config_h
1824 fi
e37630ca
AL
1825 if test "$xen" = "yes" -a "$target_softmmu" = "yes"
1826 then
1827 echo "CONFIG_XEN=yes" >> $config_mak
1828 echo "#define CONFIG_XEN 1" >> $config_h
1829 fi
2408a527
AJ
1830 ;;
1831 alpha)
1832 echo "TARGET_ARCH=alpha" >> $config_mak
1833 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1834 echo "#define TARGET_ALPHA 1" >> $config_h
1835 ;;
1836 arm|armeb)
1837 echo "TARGET_ARCH=arm" >> $config_mak
2408a527
AJ
1838 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1839 echo "#define TARGET_ARM 1" >> $config_h
2408a527 1840 bflt="yes"
bd0c5661 1841 target_nptl="yes"
56aebc89 1842 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
2408a527
AJ
1843 ;;
1844 cris)
1845 echo "TARGET_ARCH=cris" >> $config_mak
1846 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1847 echo "#define TARGET_CRIS 1" >> $config_h
253bd7f8 1848 target_nptl="yes"
2408a527
AJ
1849 ;;
1850 m68k)
1851 echo "TARGET_ARCH=m68k" >> $config_mak
1852 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1853 echo "#define TARGET_M68K 1" >> $config_h
1854 bflt="yes"
56aebc89 1855 gdb_xml_files="cf-core.xml cf-fp.xml"
2408a527
AJ
1856 ;;
1857 mips|mipsel)
1858 echo "TARGET_ARCH=mips" >> $config_mak
1859 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1860 echo "#define TARGET_MIPS 1" >> $config_h
1861 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1862 ;;
1863 mipsn32|mipsn32el)
1864 echo "TARGET_ARCH=mipsn32" >> $config_mak
1865 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1866 echo "#define TARGET_MIPS 1" >> $config_h
1867 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1868 ;;
1869 mips64|mips64el)
1870 echo "TARGET_ARCH=mips64" >> $config_mak
1871 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1872 echo "#define TARGET_MIPS 1" >> $config_h
1873 echo "#define TARGET_MIPS64 1" >> $config_h
1874 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1875 ;;
1876 ppc)
1877 echo "TARGET_ARCH=ppc" >> $config_mak
1878 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1879 echo "#define TARGET_PPC 1" >> $config_h
c8b3532d 1880 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2408a527
AJ
1881 ;;
1882 ppcemb)
1883 echo "TARGET_ARCH=ppcemb" >> $config_mak
1884 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1885 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1886 echo "#define TARGET_PPC 1" >> $config_h
1887 echo "#define TARGET_PPCEMB 1" >> $config_h
d76d1650
AJ
1888 if test "$kvm" = "yes" ; then
1889 echo "CONFIG_KVM=yes" >> $config_mak
1890 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1891 echo "#define CONFIG_KVM 1" >> $config_h
1892 fi
c8b3532d 1893 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2408a527
AJ
1894 ;;
1895 ppc64)
1896 echo "TARGET_ARCH=ppc64" >> $config_mak
1897 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1898 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1899 echo "#define TARGET_PPC 1" >> $config_h
1900 echo "#define TARGET_PPC64 1" >> $config_h
c8b3532d 1901 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2408a527
AJ
1902 ;;
1903 ppc64abi32)
1904 echo "TARGET_ARCH=ppc64" >> $config_mak
1905 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1906 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1907 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1908 echo "#define TARGET_PPC 1" >> $config_h
1909 echo "#define TARGET_PPC64 1" >> $config_h
1910 echo "#define TARGET_ABI32 1" >> $config_h
c8b3532d 1911 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2408a527
AJ
1912 ;;
1913 sh4|sh4eb)
1914 echo "TARGET_ARCH=sh4" >> $config_mak
1915 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1916 echo "#define TARGET_SH4 1" >> $config_h
1917 bflt="yes"
0b6d3ae0 1918 target_nptl="yes"
2408a527
AJ
1919 ;;
1920 sparc)
1921 echo "TARGET_ARCH=sparc" >> $config_mak
1922 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1923 echo "#define TARGET_SPARC 1" >> $config_h
1924 ;;
1925 sparc64)
1926 echo "TARGET_ARCH=sparc64" >> $config_mak
1927 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1928 echo "#define TARGET_SPARC 1" >> $config_h
1929 echo "#define TARGET_SPARC64 1" >> $config_h
1930 elfload32="yes"
1931 ;;
1932 sparc32plus)
1933 echo "TARGET_ARCH=sparc64" >> $config_mak
1934 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1935 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1936 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1937 echo "#define TARGET_SPARC 1" >> $config_h
1938 echo "#define TARGET_SPARC64 1" >> $config_h
1939 echo "#define TARGET_ABI32 1" >> $config_h
1940 ;;
1941 *)
1942 echo "Unsupported target CPU"
1943 exit 1
1944 ;;
1945esac
de83cd02 1946if test "$target_bigendian" = "yes" ; then
97a847bc
FB
1947 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1948 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
de83cd02 1949fi
97a847bc
FB
1950if test "$target_softmmu" = "yes" ; then
1951 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1952 echo "#define CONFIG_SOFTMMU 1" >> $config_h
43ce4dfe 1953fi
997344f3
FB
1954if test "$target_user_only" = "yes" ; then
1955 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1956 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1957fi
831b7825
TS
1958if test "$target_linux_user" = "yes" ; then
1959 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1960 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1961fi
1962if test "$target_darwin_user" = "yes" ; then
1963 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1964 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1965fi
56aebc89
PB
1966list=""
1967if test ! -z "$gdb_xml_files" ; then
1968 for x in $gdb_xml_files; do
1969 list="$list $source_path/gdb-xml/$x"
1970 done
1971fi
1972echo "TARGET_XML_FILES=$list" >> $config_mak
97a847bc 1973
0938cda5
AJ
1974if test "$target_cpu" = "arm" \
1975 -o "$target_cpu" = "armeb" \
1976 -o "$target_cpu" = "m68k" \
1977 -o "$target_cpu" = "mips" \
1978 -o "$target_cpu" = "mipsel" \
1979 -o "$target_cpu" = "mipsn32" \
1980 -o "$target_cpu" = "mipsn32el" \
1981 -o "$target_cpu" = "mips64" \
1982 -o "$target_cpu" = "mips64el" \
3147d1e8
AJ
1983 -o "$target_cpu" = "ppc" \
1984 -o "$target_cpu" = "ppc64" \
71e991fd
AJ
1985 -o "$target_cpu" = "ppc64abi32" \
1986 -o "$target_cpu" = "ppcemb" \
0938cda5
AJ
1987 -o "$target_cpu" = "sparc" \
1988 -o "$target_cpu" = "sparc64" \
1989 -o "$target_cpu" = "sparc32plus"; then
158142c2
FB
1990 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1991 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1992fi
e5fe0c52
PB
1993if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1994 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1995 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1996fi
bd0c5661
PB
1997if test "$target_user_only" = "yes" \
1998 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1999 echo "#define USE_NPTL 1" >> $config_h
2000fi
cb33da57
BS
2001# 32 bit ELF loader in addition to native 64 bit loader?
2002if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
2003 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
2004 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
2005fi
84778508
BS
2006if test "$target_bsd_user" = "yes" ; then
2007 echo "CONFIG_BSD_USER=yes" >> $config_mak
2008 echo "#define CONFIG_BSD_USER 1" >> $config_h
2009fi
5b0753e0 2010
15d9ca0f
TS
2011test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
2012
97a847bc 2013done # for target in $targets
7d13299d
FB
2014
2015# build tree in object directory if source path is different from current one
2016if test "$source_path_used" = "yes" ; then
49ecc3fa 2017 DIRS="tests tests/cris slirp audio"
7d13299d 2018 FILES="Makefile tests/Makefile"
e7daa605 2019 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
e1ffb0f1 2020 FILES="$FILES tests/test-mmap.c"
7d13299d
FB
2021 for dir in $DIRS ; do
2022 mkdir -p $dir
2023 done
ec530c81 2024 # remove the link and recreate it, as not all "ln -sf" overwrite the link
7d13299d 2025 for f in $FILES ; do
ec530c81
FB
2026 rm -f $f
2027 ln -s $source_path/$f $f
7d13299d
FB
2028 done
2029fi