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