]> git.proxmox.com Git - qemu.git/blame - configure
configure xen in a single place
[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
40293e58
FB
1492# XXX: only use CFLAGS and LDFLAGS ?
1493# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1494# compilation of dyngen tool (useful for win32 build on Linux host)
6f30fa85 1495echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
3142255c
BS
1496echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1497echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1498echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
e3fc14c3
JK
1499echo "CFLAGS=$CFLAGS $EXTRA_CFLAGS" >> $config_mak
1500echo "LDFLAGS=$LDFLAGS $EXTRA_LDFLAGS" >> $config_mak
67b915a5 1501echo "EXESUF=$EXESUF" >> $config_mak
e5d355d1
AL
1502echo "PTHREADLIBS=$PTHREADLIBS" >> $config_mak
1503echo "CLOCKLIBS=$CLOCKLIBS" >> $config_mak
2408a527
AJ
1504case "$cpu" in
1505 i386)
1506 echo "ARCH=i386" >> $config_mak
1507 echo "#define HOST_I386 1" >> $config_h
1508 ;;
1509 x86_64)
1510 echo "ARCH=x86_64" >> $config_mak
1511 echo "#define HOST_X86_64 1" >> $config_h
1512 ;;
1513 alpha)
1514 echo "ARCH=alpha" >> $config_mak
1515 echo "#define HOST_ALPHA 1" >> $config_h
1516 ;;
1517 armv4b)
1518 echo "ARCH=arm" >> $config_mak
1519 echo "#define HOST_ARM 1" >> $config_h
1520 ;;
1521 armv4l)
1522 echo "ARCH=arm" >> $config_mak
1523 echo "#define HOST_ARM 1" >> $config_h
1524 ;;
1525 cris)
1526 echo "ARCH=cris" >> $config_mak
1527 echo "#define HOST_CRIS 1" >> $config_h
1528 ;;
1529 hppa)
1530 echo "ARCH=hppa" >> $config_mak
1531 echo "#define HOST_HPPA 1" >> $config_h
1532 ;;
1533 ia64)
1534 echo "ARCH=ia64" >> $config_mak
1535 echo "#define HOST_IA64 1" >> $config_h
1536 ;;
1537 m68k)
1538 echo "ARCH=m68k" >> $config_mak
1539 echo "#define HOST_M68K 1" >> $config_h
1540 ;;
72b675ca
EI
1541 microblaze)
1542 echo "ARCH=microblaze" >> $config_mak
1543 echo "#define HOST_MICROBLAZE 1" >> $config_h
1544 ;;
2408a527
AJ
1545 mips)
1546 echo "ARCH=mips" >> $config_mak
1547 echo "#define HOST_MIPS 1" >> $config_h
1548 ;;
1549 mips64)
1550 echo "ARCH=mips64" >> $config_mak
1551 echo "#define HOST_MIPS64 1" >> $config_h
1552 ;;
fdf7ed96 1553 ppc)
1554 echo "ARCH=ppc" >> $config_mak
1555 echo "#define HOST_PPC 1" >> $config_h
1556 ;;
1557 ppc64)
1558 echo "ARCH=ppc64" >> $config_mak
1559 echo "#define HOST_PPC64 1" >> $config_h
2408a527
AJ
1560 ;;
1561 s390)
1562 echo "ARCH=s390" >> $config_mak
1563 echo "#define HOST_S390 1" >> $config_h
1564 ;;
1565 sparc)
1566 echo "ARCH=sparc" >> $config_mak
1567 echo "#define HOST_SPARC 1" >> $config_h
1568 ;;
1569 sparc64)
1570 echo "ARCH=sparc64" >> $config_mak
1571 echo "#define HOST_SPARC64 1" >> $config_h
1572 ;;
1573 *)
1574 echo "Unsupported CPU = $cpu"
1575 exit 1
1576 ;;
1577esac
f8393946
AJ
1578if test "$debug_tcg" = "yes" ; then
1579 echo "#define DEBUG_TCG 1" >> $config_h
1580fi
f3d08ee6
PB
1581if test "$debug" = "yes" ; then
1582 echo "#define DEBUG_EXEC 1" >> $config_h
1583fi
03b4fe7d
AL
1584if test "$sparse" = "yes" ; then
1585 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1586 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1587 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1588fi
1625af87
AL
1589if test "$strip_opt" = "yes" ; then
1590 echo "STRIP_OPT=-s" >> $config_mak
1591fi
7d13299d 1592if test "$bigendian" = "yes" ; then
97a847bc
FB
1593 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1594 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1595fi
b6853697 1596echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
67b915a5 1597if test "$mingw32" = "yes" ; then
e34af2ce 1598 echo "CONFIG_WIN32=y" >> $config_mak
11d9f695 1599 echo "#define CONFIG_WIN32 1" >> $config_h
210fa556
PB
1600else
1601 cat > $TMPC << EOF
1602#include <byteswap.h>
1603int main(void) { return bswap_32(0); }
1604EOF
178baee6 1605 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
210fa556
PB
1606 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1607 fi
1360677c
BS
1608 cat > $TMPC << EOF
1609#include <sys/endian.h>
1610#include <sys/types.h>
1611#include <machine/bswap.h>
1612int main(void) { return bswap32(0); }
1613EOF
178baee6 1614 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
1360677c
BS
1615 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1616 fi
67b915a5 1617fi
128ab2ff
BS
1618
1619if [ "$openbsd" = "yes" ] ; then
1620 echo "#define ENOTSUP 4096" >> $config_h
1621fi
1622
83fb7adf 1623if test "$darwin" = "yes" ; then
e34af2ce 1624 echo "CONFIG_DARWIN=y" >> $config_mak
83fb7adf
FB
1625 echo "#define CONFIG_DARWIN 1" >> $config_h
1626fi
b29fe3ed 1627
1628if test "$aix" = "yes" ; then
e34af2ce 1629 echo "CONFIG_AIX=y" >> $config_mak
b29fe3ed 1630 echo "#define CONFIG_AIX 1" >> $config_h
1631fi
1632
ec530c81 1633if test "$solaris" = "yes" ; then
e34af2ce 1634 echo "CONFIG_SOLARIS=y" >> $config_mak
38cfa06c 1635 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
0475a5ca
TS
1636 if test "$needs_libsunmath" = "yes" ; then
1637 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1638 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1639 fi
ec530c81 1640fi
3142255c 1641if test -n "$sparc_cpu"; then
e34af2ce 1642 echo "CONFIG__sparc_${sparc_cpu}__=y" >> $config_mak
3142255c
BS
1643 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1644fi
97a847bc
FB
1645if test "$gprof" = "yes" ; then
1646 echo "TARGET_GPROF=yes" >> $config_mak
1647 echo "#define HAVE_GPROF 1" >> $config_h
1648fi
1649if test "$static" = "yes" ; then
e34af2ce 1650 echo "CONFIG_STATIC=y" >> $config_mak
50863472 1651 echo "#define CONFIG_STATIC 1" >> $config_h
7d13299d 1652fi
05c2a3e7
FB
1653if test $profiler = "yes" ; then
1654 echo "#define CONFIG_PROFILER 1" >> $config_h
1655fi
c20709aa 1656if test "$slirp" = "yes" ; then
e34af2ce 1657 echo "CONFIG_SLIRP=y" >> $config_mak
c20709aa
FB
1658 echo "#define CONFIG_SLIRP 1" >> $config_h
1659fi
8a16d273 1660if test "$vde" = "yes" ; then
e34af2ce 1661 echo "CONFIG_VDE=y" >> $config_mak
8a16d273
TS
1662 echo "#define CONFIG_VDE 1" >> $config_h
1663 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1664fi
0c58ac1c 1665for card in $audio_card_list; do
f6e5889e 1666 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
e34af2ce 1667 echo "$def=y" >> $config_mak
0c58ac1c 1668 echo "#define $def 1" >> $config_h
1669done
1670echo "#define AUDIO_DRIVERS \\" >> $config_h
1671for drv in $audio_drv_list; do
1672 echo " &${drv}_audio_driver, \\" >>$config_h
f6e5889e 1673 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
e34af2ce 1674 echo "$def=y" >> $config_mak
923e4521 1675 if test "$drv" = "fmod"; then
0c58ac1c 1676 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1677 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
2f6a1ab0
BS
1678 elif test "$drv" = "oss"; then
1679 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
0c58ac1c 1680 fi
1681done
1682echo "" >>$config_h
8ff9cbf7 1683if test "$mixemu" = "yes" ; then
e34af2ce 1684 echo "CONFIG_MIXEMU=y" >> $config_mak
8ff9cbf7 1685 echo "#define CONFIG_MIXEMU 1" >> $config_h
1686fi
8d5d2d4c 1687if test "$vnc_tls" = "yes" ; then
e34af2ce 1688 echo "CONFIG_VNC_TLS=y" >> $config_mak
8d5d2d4c
TS
1689 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1690 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1691 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1692fi
2f9606b3 1693if test "$vnc_sasl" = "yes" ; then
e34af2ce 1694 echo "CONFIG_VNC_SASL=y" >> $config_mak
2f9606b3
AL
1695 echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1696 echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1697 echo "#define CONFIG_VNC_SASL 1" >> $config_h
1698fi
76655d6d
AL
1699if test "$fnmatch" = "yes" ; then
1700 echo "#define HAVE_FNMATCH_H 1" >> $config_h
1701fi
b1a550a0
PB
1702qemu_version=`head $source_path/VERSION`
1703echo "VERSION=$qemu_version" >>$config_mak
d4b8f039 1704echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
97a847bc 1705
4a19f1ec
PB
1706echo "#define QEMU_PKGVERSION \"$pkgversion\"" >> $config_h
1707
97a847bc 1708echo "SRC_PATH=$source_path" >> $config_mak
ad064840
PB
1709if [ "$source_path_used" = "yes" ]; then
1710 echo "VPATH=$source_path" >> $config_mak
1711fi
97a847bc 1712echo "TARGET_DIRS=$target_list" >> $config_mak
cc8ae6de
PB
1713if [ "$build_docs" = "yes" ] ; then
1714 echo "BUILD_DOCS=yes" >> $config_mak
1715fi
49ecc3fa
FB
1716if test "$static" = "yes"; then
1717 sdl1=$sdl_static
1718else
1719 sdl1=$sdl
1720fi
1721if test "$sdl1" = "yes" ; then
1722 echo "#define CONFIG_SDL 1" >> $config_h
e34af2ce 1723 echo "CONFIG_SDL=y" >> $config_mak
49ecc3fa
FB
1724 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1725 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
5368a422
AL
1726 elif test "$sdl_x11" = "yes" ; then
1727 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
49ecc3fa
FB
1728 else
1729 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1730 fi
1731 if [ "${aa}" = "yes" ] ; then
1732 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1733 else
1734 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1735 fi
1736fi
1737if test "$cocoa" = "yes" ; then
4d3b6f6e 1738 echo "#define CONFIG_COCOA 1" >> $config_h
e34af2ce 1739 echo "CONFIG_COCOA=y" >> $config_mak
4d3b6f6e
AZ
1740fi
1741if test "$curses" = "yes" ; then
1742 echo "#define CONFIG_CURSES 1" >> $config_h
e34af2ce 1743 echo "CONFIG_CURSES=y" >> $config_mak
ab4e5602
JK
1744 if test "$ncurses" = "yes" ; then
1745 echo "CURSES_LIBS=-lncurses" >> $config_mak
1746 else
1747 echo "CURSES_LIBS=-lcurses" >> $config_mak
1748 fi
49ecc3fa 1749fi
3b3f24ad
AJ
1750if test "$atfile" = "yes" ; then
1751 echo "#define CONFIG_ATFILE 1" >> $config_h
1752fi
ebc996f3
RV
1753if test "$utimens" = "yes" ; then
1754 echo "#define CONFIG_UTIMENSAT 1" >> $config_h
1755fi
099d6b0f
RV
1756if test "$pipe2" = "yes" ; then
1757 echo "#define CONFIG_PIPE2 1" >> $config_h
1758fi
3ce34dfb 1759if test "$splice" = "yes" ; then
1760 echo "#define CONFIG_SPLICE 1" >> $config_h
1761fi
3b3f24ad
AJ
1762if test "$inotify" = "yes" ; then
1763 echo "#define CONFIG_INOTIFY 1" >> $config_h
1764fi
769ce76d 1765if test "$curl" = "yes" ; then
e34af2ce 1766 echo "CONFIG_CURL=y" >> $config_mak
769ce76d
AG
1767 echo "CURL_LIBS=$curl_libs" >> $config_mak
1768 echo "#define CONFIG_CURL 1" >> $config_h
1769fi
2e4d9fb1 1770if test "$brlapi" = "yes" ; then
e34af2ce 1771 echo "CONFIG_BRLAPI=y" >> $config_mak
2e4d9fb1
AJ
1772 echo "#define CONFIG_BRLAPI 1" >> $config_h
1773 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1774fi
fb599c9a 1775if test "$bluez" = "yes" ; then
e34af2ce 1776 echo "CONFIG_BLUEZ=y" >> $config_mak
fb599c9a
AZ
1777 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1778 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1779 echo "#define CONFIG_BLUEZ 1" >> $config_h
1780fi
e37630ca 1781if test "$xen" = "yes" ; then
9306acb5 1782 echo "XEN_LIBS=-lxenstore -lxenctrl -lxenguest" >> $config_mak
e37630ca 1783fi
414f0dab
BS
1784if test "$aio" = "yes" ; then
1785 echo "#define CONFIG_AIO 1" >> $config_h
e34af2ce 1786 echo "CONFIG_AIO=y" >> $config_mak
414f0dab 1787fi
e5d355d1 1788if test "$io_thread" = "yes" ; then
e34af2ce 1789 echo "CONFIG_IOTHREAD=y" >> $config_mak
e5d355d1
AL
1790 echo "#define CONFIG_IOTHREAD 1" >> $config_h
1791fi
77755340
TS
1792if test "$blobs" = "yes" ; then
1793 echo "INSTALL_BLOBS=yes" >> $config_mak
1794fi
bf9298b9
AL
1795if test "$iovec" = "yes" ; then
1796 echo "#define HAVE_IOVEC 1" >> $config_h
1797fi
ceb42de8
AL
1798if test "$preadv" = "yes" ; then
1799 echo "#define HAVE_PREADV 1" >> $config_h
1800fi
f652e6af
AJ
1801if test "$fdt" = "yes" ; then
1802 echo "#define HAVE_FDT 1" >> $config_h
1803 echo "FDT_LIBS=-lfdt" >> $config_mak
1804fi
97a847bc 1805
83fb7adf 1806# XXX: suppress that
7d3505c5 1807if [ "$bsd" = "yes" ] ; then
43003046 1808 echo "#define O_LARGEFILE 0" >> $config_h
43003046 1809 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
179a2c19 1810 echo "#define HOST_BSD 1" >> $config_h
7d3505c5
FB
1811fi
1812
c5937220
PB
1813echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1814
68063649
BS
1815# USB host support
1816case "$usb" in
1817linux)
1818 echo "HOST_USB=linux" >> $config_mak
1819;;
1820bsd)
1821 echo "HOST_USB=bsd" >> $config_mak
1822;;
1823*)
1824 echo "HOST_USB=stub" >> $config_mak
1825;;
1826esac
1827
9abbdbfe
AL
1828# Determine what linker flags to use to force archive inclusion
1829check_linker_flags()
1830{
08b9d66b
AL
1831 w2=
1832 if test "$2" ; then
1833 w2=-Wl,$2
1834 fi
1835 $cc $ARCH_CFLAGS -o $TMPE $OS_CFLAGS $TMPC -Wl,$1 ${w2} >/dev/null 2>/dev/null
9abbdbfe
AL
1836}
1837
1838cat > $TMPC << EOF
1839int main(void) { }
1840EOF
1841if check_linker_flags --whole-archive --no-whole-archive ; then
1842 # GNU ld
1843 echo "ARLIBS_BEGIN=-Wl,--whole-archive" >> $config_mak
1844 echo "ARLIBS_END=-Wl,--no-whole-archive" >> $config_mak
1845elif check_linker_flags -z,allextract -z,defaultextract ; then
1846 # Solaris ld
1847 echo "ARLIBS_BEGIN=-Wl,-z,allextract" >> $config_mak
1848 echo "ARLIBS_END=-Wl,-z,defaultextract" >> $config_mak
08b9d66b
AL
1849elif check_linker_flags -all_load ; then
1850 # Mac OS X
1851 echo "ARLIBS_BEGIN=-all_load" >> $config_mak
1852 echo "ARLIBS_END=" >> $config_mak
9abbdbfe
AL
1853else
1854 echo "Error: your linker does not support --whole-archive or -z."
1855 echo "Please report to qemu-devel@nongnu.org"
1856 exit 1
1857fi
1858
2567f579
BS
1859if test "$xen" = "yes" ;
1860 then
e34af2ce 1861 echo "CONFIG_XEN=y" >> $config_mak
2567f579
BS
1862fi
1863
c39e3338
PB
1864tools=
1865if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
3dd1f8ef 1866 tools="qemu-img\$(EXESUF) $tools"
7a5ca864 1867 if [ "$linux" = "yes" ] ; then
3dd1f8ef 1868 tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
7a5ca864 1869 fi
c39e3338
PB
1870fi
1871echo "TOOLS=$tools" >> $config_mak
1872
253d0942
AG
1873roms=
1874if test "$cpu" = "i386" -o "$cpu" = "x86_64" ; then
1875 roms="pc-bios/optionrom"
1876fi
1877echo "ROMS=$roms" >> $config_mak
1878
370ab986
PB
1879if test -f ${config_h}~ ; then
1880 if cmp -s $config_h ${config_h}~ ; then
1881 mv ${config_h}~ $config_h
1882 else
1883 rm ${config_h}~
1884 fi
1885fi
1886
1ad2134f 1887config_host_mak=${config_mak}
15d9ca0f 1888
1d14ffa9 1889for target in $target_list; do
97a847bc
FB
1890target_dir="$target"
1891config_mak=$target_dir/config.mak
1892config_h=$target_dir/config.h
600309b6 1893target_arch2=`echo $target | cut -d '-' -f 1`
97a847bc 1894target_bigendian="no"
600309b6
BS
1895[ "$target_arch2" = "armeb" ] && target_bigendian=yes
1896[ "$target_arch2" = "m68k" ] && target_bigendian=yes
1897[ "$target_arch2" = "microblaze" ] && target_bigendian=yes
1898[ "$target_arch2" = "mips" ] && target_bigendian=yes
1899[ "$target_arch2" = "mipsn32" ] && target_bigendian=yes
1900[ "$target_arch2" = "mips64" ] && target_bigendian=yes
1901[ "$target_arch2" = "ppc" ] && target_bigendian=yes
1902[ "$target_arch2" = "ppcemb" ] && target_bigendian=yes
1903[ "$target_arch2" = "ppc64" ] && target_bigendian=yes
1904[ "$target_arch2" = "ppc64abi32" ] && target_bigendian=yes
1905[ "$target_arch2" = "sh4eb" ] && target_bigendian=yes
1906[ "$target_arch2" = "sparc" ] && target_bigendian=yes
1907[ "$target_arch2" = "sparc64" ] && target_bigendian=yes
1908[ "$target_arch2" = "sparc32plus" ] && target_bigendian=yes
97a847bc 1909target_softmmu="no"
997344f3 1910target_user_only="no"
831b7825 1911target_linux_user="no"
831b7825 1912target_darwin_user="no"
84778508 1913target_bsd_user="no"
9e407a85 1914case "$target" in
600309b6 1915 ${target_arch2}-softmmu)
9e407a85
PB
1916 target_softmmu="yes"
1917 ;;
600309b6 1918 ${target_arch2}-linux-user)
9e407a85
PB
1919 target_user_only="yes"
1920 target_linux_user="yes"
1921 ;;
600309b6 1922 ${target_arch2}-darwin-user)
9e407a85
PB
1923 target_user_only="yes"
1924 target_darwin_user="yes"
1925 ;;
600309b6 1926 ${target_arch2}-bsd-user)
84778508
BS
1927 target_user_only="yes"
1928 target_bsd_user="yes"
1929 ;;
9e407a85
PB
1930 *)
1931 echo "ERROR: Target '$target' not recognised"
1932 exit 1
1933 ;;
1934esac
831b7825 1935
7c1f25b4 1936#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
97a847bc 1937
15d9ca0f
TS
1938test -f $config_h && mv $config_h ${config_h}~
1939
97a847bc 1940mkdir -p $target_dir
158142c2 1941mkdir -p $target_dir/fpu
57fec1fe 1942mkdir -p $target_dir/tcg
84778508 1943if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
69de927c
FB
1944 mkdir -p $target_dir/nwfpe
1945fi
1946
ec530c81
FB
1947#
1948# don't use ln -sf as not all "ln -sf" over write the file/link
1949#
1950rm -f $target_dir/Makefile
1951ln -s $source_path/Makefile.target $target_dir/Makefile
1952
97a847bc
FB
1953
1954echo "# Automatically generated by configure - do not modify" > $config_mak
1955echo "/* Automatically generated by configure - do not modify */" > $config_h
1956
de83cd02 1957
97a847bc
FB
1958echo "include ../config-host.mak" >> $config_mak
1959echo "#include \"../config-host.h\"" >> $config_h
1e43adfc 1960
e5fe0c52 1961bflt="no"
cb33da57 1962elfload32="no"
bd0c5661 1963target_nptl="no"
600309b6 1964interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
1e43adfc 1965echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
56aebc89 1966gdb_xml_files=""
4ca1a9c6 1967target_kvm="$kvm"
97a847bc 1968
5985ecee 1969# Make sure the target and host cpus are compatible
600309b6
BS
1970if test ! \( "$target_arch2" = "$cpu" -o \
1971 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
1972 \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \
1973 \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then
4ca1a9c6 1974 target_kvm="no"
7ba1e619
AL
1975fi
1976# Disable KVM for linux-user
4ca1a9c6
BS
1977if test "$target_softmmu" = "no" ; then
1978 target_kvm="no"
7ba1e619
AL
1979fi
1980
600309b6 1981case "$target_arch2" in
2408a527
AJ
1982 i386)
1983 echo "TARGET_ARCH=i386" >> $config_mak
1984 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1985 echo "#define TARGET_I386 1" >> $config_h
da260249 1986 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
2408a527 1987 then
e34af2ce 1988 echo "CONFIG_KQEMU=y" >> $config_mak
640f42e4 1989 echo "#define CONFIG_KQEMU 1" >> $config_h
2408a527 1990 fi
4ca1a9c6 1991 if test "$target_kvm" = "yes" ; then
e34af2ce 1992 echo "CONFIG_KVM=y" >> $config_mak
7ba1e619 1993 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
5985ecee 1994 echo "#define CONFIG_KVM 1" >> $config_h
7ba1e619 1995 fi
1ad2134f 1996 target_phys_bits=32
2408a527
AJ
1997 ;;
1998 x86_64)
1999 echo "TARGET_ARCH=x86_64" >> $config_mak
0ba99fc6 2000 echo "TARGET_BASE_ARCH=i386" >> $config_mak
2408a527
AJ
2001 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
2002 echo "#define TARGET_I386 1" >> $config_h
2003 echo "#define TARGET_X86_64 1" >> $config_h
2004 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
2005 then
e34af2ce 2006 echo "CONFIG_KQEMU=y" >> $config_mak
640f42e4 2007 echo "#define CONFIG_KQEMU 1" >> $config_h
2408a527 2008 fi
4ca1a9c6 2009 if test "$target_kvm" = "yes" ; then
e34af2ce 2010 echo "CONFIG_KVM=y" >> $config_mak
7ba1e619
AL
2011 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
2012 echo "#define CONFIG_KVM 1" >> $config_h
2013 fi
1ad2134f 2014 target_phys_bits=64
2408a527
AJ
2015 ;;
2016 alpha)
2017 echo "TARGET_ARCH=alpha" >> $config_mak
2018 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
2019 echo "#define TARGET_ALPHA 1" >> $config_h
1ad2134f 2020 target_phys_bits=64
2408a527
AJ
2021 ;;
2022 arm|armeb)
2023 echo "TARGET_ARCH=arm" >> $config_mak
d2917a47 2024 echo "TARGET_ARCH2=$target_arch2" >> $config_mak
2408a527
AJ
2025 echo "#define TARGET_ARCH \"arm\"" >> $config_h
2026 echo "#define TARGET_ARM 1" >> $config_h
2408a527 2027 bflt="yes"
bd0c5661 2028 target_nptl="yes"
56aebc89 2029 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
1ad2134f 2030 target_phys_bits=32
2408a527
AJ
2031 ;;
2032 cris)
2033 echo "TARGET_ARCH=cris" >> $config_mak
2034 echo "#define TARGET_ARCH \"cris\"" >> $config_h
2035 echo "#define TARGET_CRIS 1" >> $config_h
253bd7f8 2036 target_nptl="yes"
1ad2134f 2037 target_phys_bits=32
2408a527
AJ
2038 ;;
2039 m68k)
2040 echo "TARGET_ARCH=m68k" >> $config_mak
2041 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
2042 echo "#define TARGET_M68K 1" >> $config_h
2043 bflt="yes"
56aebc89 2044 gdb_xml_files="cf-core.xml cf-fp.xml"
1ad2134f 2045 target_phys_bits=32
2408a527 2046 ;;
72b675ca
EI
2047 microblaze)
2048 echo "TARGET_ARCH=microblaze" >> $config_mak
2049 echo "#define TARGET_ARCH \"microblaze\"" >> $config_h
2050 echo "#define TARGET_MICROBLAZE 1" >> $config_h
2051 bflt="yes"
2052 target_nptl="yes"
2053 target_phys_bits=32
2054 ;;
2055 mips|mipsel)
2408a527 2056 echo "TARGET_ARCH=mips" >> $config_mak
d2917a47 2057 echo "TARGET_ARCH2=$target_arch2" >> $config_mak
2408a527
AJ
2058 echo "#define TARGET_ARCH \"mips\"" >> $config_h
2059 echo "#define TARGET_MIPS 1" >> $config_h
2060 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
f04dc72f 2061 target_nptl="yes"
1ad2134f 2062 target_phys_bits=64
2408a527
AJ
2063 ;;
2064 mipsn32|mipsn32el)
2065 echo "TARGET_ARCH=mipsn32" >> $config_mak
d2917a47 2066 echo "TARGET_ARCH2=$target_arch2" >> $config_mak
0ba99fc6 2067 echo "TARGET_BASE_ARCH=mips" >> $config_mak
2408a527
AJ
2068 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
2069 echo "#define TARGET_MIPS 1" >> $config_h
2070 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1ad2134f 2071 target_phys_bits=64
2408a527
AJ
2072 ;;
2073 mips64|mips64el)
2074 echo "TARGET_ARCH=mips64" >> $config_mak
d2917a47 2075 echo "TARGET_ARCH2=$target_arch2" >> $config_mak
0ba99fc6 2076 echo "TARGET_BASE_ARCH=mips" >> $config_mak
2408a527
AJ
2077 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
2078 echo "#define TARGET_MIPS 1" >> $config_h
2079 echo "#define TARGET_MIPS64 1" >> $config_h
2080 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1ad2134f 2081 target_phys_bits=64
2408a527
AJ
2082 ;;
2083 ppc)
2084 echo "TARGET_ARCH=ppc" >> $config_mak
2085 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
2086 echo "#define TARGET_PPC 1" >> $config_h
c8b3532d 2087 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1ad2134f 2088 target_phys_bits=32
2408a527
AJ
2089 ;;
2090 ppcemb)
2091 echo "TARGET_ARCH=ppcemb" >> $config_mak
0ba99fc6 2092 echo "TARGET_BASE_ARCH=ppc" >> $config_mak
2408a527
AJ
2093 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2094 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
2095 echo "#define TARGET_PPC 1" >> $config_h
2096 echo "#define TARGET_PPCEMB 1" >> $config_h
4ca1a9c6 2097 if test "$target_kvm" = "yes" ; then
e34af2ce 2098 echo "CONFIG_KVM=y" >> $config_mak
d76d1650
AJ
2099 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
2100 echo "#define CONFIG_KVM 1" >> $config_h
2101 fi
c8b3532d 2102 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1ad2134f 2103 target_phys_bits=64
2408a527
AJ
2104 ;;
2105 ppc64)
2106 echo "TARGET_ARCH=ppc64" >> $config_mak
0ba99fc6 2107 echo "TARGET_BASE_ARCH=ppc" >> $config_mak
2408a527
AJ
2108 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2109 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
2110 echo "#define TARGET_PPC 1" >> $config_h
2111 echo "#define TARGET_PPC64 1" >> $config_h
c8b3532d 2112 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1ad2134f 2113 target_phys_bits=64
2408a527
AJ
2114 ;;
2115 ppc64abi32)
2116 echo "TARGET_ARCH=ppc64" >> $config_mak
0ba99fc6 2117 echo "TARGET_BASE_ARCH=ppc" >> $config_mak
2408a527
AJ
2118 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2119 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
2120 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
2121 echo "#define TARGET_PPC 1" >> $config_h
2122 echo "#define TARGET_PPC64 1" >> $config_h
2123 echo "#define TARGET_ABI32 1" >> $config_h
c8b3532d 2124 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1ad2134f 2125 target_phys_bits=64
2408a527
AJ
2126 ;;
2127 sh4|sh4eb)
2128 echo "TARGET_ARCH=sh4" >> $config_mak
d2917a47 2129 echo "TARGET_ARCH2=$target_arch2" >> $config_mak
2408a527
AJ
2130 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
2131 echo "#define TARGET_SH4 1" >> $config_h
2132 bflt="yes"
0b6d3ae0 2133 target_nptl="yes"
1ad2134f 2134 target_phys_bits=32
2408a527
AJ
2135 ;;
2136 sparc)
2137 echo "TARGET_ARCH=sparc" >> $config_mak
2138 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
2139 echo "#define TARGET_SPARC 1" >> $config_h
1ad2134f 2140 target_phys_bits=64
2408a527
AJ
2141 ;;
2142 sparc64)
2143 echo "TARGET_ARCH=sparc64" >> $config_mak
0ba99fc6 2144 echo "TARGET_BASE_ARCH=sparc" >> $config_mak
2408a527
AJ
2145 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
2146 echo "#define TARGET_SPARC 1" >> $config_h
2147 echo "#define TARGET_SPARC64 1" >> $config_h
2148 elfload32="yes"
1ad2134f 2149 target_phys_bits=64
2408a527
AJ
2150 ;;
2151 sparc32plus)
2152 echo "TARGET_ARCH=sparc64" >> $config_mak
0ba99fc6 2153 echo "TARGET_BASE_ARCH=sparc" >> $config_mak
2408a527 2154 echo "TARGET_ABI_DIR=sparc" >> $config_mak
d2917a47 2155 echo "TARGET_ARCH2=$target_arch2" >> $config_mak
2408a527
AJ
2156 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
2157 echo "#define TARGET_SPARC 1" >> $config_h
2158 echo "#define TARGET_SPARC64 1" >> $config_h
2159 echo "#define TARGET_ABI32 1" >> $config_h
1ad2134f 2160 target_phys_bits=64
2408a527
AJ
2161 ;;
2162 *)
2163 echo "Unsupported target CPU"
2164 exit 1
2165 ;;
2166esac
1ad2134f
PB
2167if [ $target_phys_bits -lt $hostlongbits ] ; then
2168 target_phys_bits=$hostlongbits
2169fi
1b0c87fc
JQ
2170case "$target_arch2" in
2171 i386|x86_64)
2172 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
2173 echo "CONFIG_XEN=y" >> $config_mak
2174 echo "#define CONFIG_XEN 1" >> $config_h
2175 fi
2176esac
1ad2134f
PB
2177echo "HWLIB=../libhw$target_phys_bits/libqemuhw$target_phys_bits.a" >> $config_mak
2178echo "#define TARGET_PHYS_ADDR_BITS $target_phys_bits" >> $config_h
2179echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
de83cd02 2180if test "$target_bigendian" = "yes" ; then
97a847bc
FB
2181 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
2182 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
de83cd02 2183fi
97a847bc 2184if test "$target_softmmu" = "yes" ; then
e34af2ce 2185 echo "CONFIG_SOFTMMU=y" >> $config_mak
97a847bc 2186 echo "#define CONFIG_SOFTMMU 1" >> $config_h
43ce4dfe 2187fi
997344f3 2188if test "$target_user_only" = "yes" ; then
e34af2ce 2189 echo "CONFIG_USER_ONLY=y" >> $config_mak
997344f3
FB
2190 echo "#define CONFIG_USER_ONLY 1" >> $config_h
2191fi
831b7825 2192if test "$target_linux_user" = "yes" ; then
e34af2ce 2193 echo "CONFIG_LINUX_USER=y" >> $config_mak
831b7825
TS
2194 echo "#define CONFIG_LINUX_USER 1" >> $config_h
2195fi
2196if test "$target_darwin_user" = "yes" ; then
e34af2ce 2197 echo "CONFIG_DARWIN_USER=y" >> $config_mak
831b7825
TS
2198 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
2199fi
56aebc89
PB
2200list=""
2201if test ! -z "$gdb_xml_files" ; then
2202 for x in $gdb_xml_files; do
2203 list="$list $source_path/gdb-xml/$x"
2204 done
2205fi
2206echo "TARGET_XML_FILES=$list" >> $config_mak
97a847bc 2207
600309b6
BS
2208if test "$target_arch2" = "arm" \
2209 -o "$target_arch2" = "armeb" \
2210 -o "$target_arch2" = "m68k" \
2211 -o "$target_arch2" = "microblaze" \
2212 -o "$target_arch2" = "mips" \
2213 -o "$target_arch2" = "mipsel" \
2214 -o "$target_arch2" = "mipsn32" \
2215 -o "$target_arch2" = "mipsn32el" \
2216 -o "$target_arch2" = "mips64" \
2217 -o "$target_arch2" = "mips64el" \
2218 -o "$target_arch2" = "ppc" \
2219 -o "$target_arch2" = "ppc64" \
2220 -o "$target_arch2" = "ppc64abi32" \
2221 -o "$target_arch2" = "ppcemb" \
2222 -o "$target_arch2" = "sparc" \
2223 -o "$target_arch2" = "sparc64" \
2224 -o "$target_arch2" = "sparc32plus"; then
e34af2ce 2225 echo "CONFIG_SOFTFLOAT=y" >> $config_mak
158142c2
FB
2226 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
2227fi
e5fe0c52 2228if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
e34af2ce 2229 echo "TARGET_HAS_BFLT=y" >> $config_mak
e5fe0c52
PB
2230 echo "#define TARGET_HAS_BFLT 1" >> $config_h
2231fi
bd0c5661
PB
2232if test "$target_user_only" = "yes" \
2233 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
2234 echo "#define USE_NPTL 1" >> $config_h
2235fi
cb33da57
BS
2236# 32 bit ELF loader in addition to native 64 bit loader?
2237if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
e34af2ce 2238 echo "TARGET_HAS_ELFLOAD32=y" >> $config_mak
cb33da57
BS
2239 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
2240fi
84778508 2241if test "$target_bsd_user" = "yes" ; then
e34af2ce 2242 echo "CONFIG_BSD_USER=y" >> $config_mak
84778508
BS
2243 echo "#define CONFIG_BSD_USER 1" >> $config_h
2244fi
5b0753e0 2245
15d9ca0f
TS
2246test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
2247
97a847bc 2248done # for target in $targets
7d13299d
FB
2249
2250# build tree in object directory if source path is different from current one
2251if test "$source_path_used" = "yes" ; then
253d0942 2252 DIRS="tests tests/cris slirp audio block pc-bios/optionrom"
7d13299d 2253 FILES="Makefile tests/Makefile"
e7daa605 2254 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
e1ffb0f1 2255 FILES="$FILES tests/test-mmap.c"
253d0942 2256 FILES="$FILES pc-bios/optionrom/Makefile"
7d13299d
FB
2257 for dir in $DIRS ; do
2258 mkdir -p $dir
2259 done
ec530c81 2260 # remove the link and recreate it, as not all "ln -sf" overwrite the link
7d13299d 2261 for f in $FILES ; do
ec530c81
FB
2262 rm -f $f
2263 ln -s $source_path/$f $f
7d13299d
FB
2264 done
2265fi
1ad2134f
PB
2266
2267for hwlib in 32 64; do
2268 d=libhw$hwlib
2269 mkdir -p $d
2270 rm -f $d/Makefile
2271 ln -s $source_path/Makefile.hw $d/Makefile
2272 echo "HWLIB=libqemuhw$hwlib.a" > $d/config.mak
2273 echo "CPPFLAGS=-DTARGET_PHYS_ADDR_BITS=$hwlib" >> $d/config.mak
2274done