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