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