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