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