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