Merge branch 'stable_0_10' of git://git.sv.gnu.org/qemu into maint/2.6.30
[qemu-kvm/fedora.git] / configure
blob913bcb8744e86697b9b1d846202ac1563f5ba5f4
1 #!/bin/sh
3 # qemu configure script (c) 2003 Fabrice Bellard
5 # set temporary file name
6 if test ! -z "$TMPDIR" ; then
7 TMPDIR1="${TMPDIR}"
8 elif test ! -z "$TEMPDIR" ; then
9 TMPDIR1="${TEMPDIR}"
10 else
11 TMPDIR1="/tmp"
14 TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
15 TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
16 TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"
17 TMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
18 TMPI="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.i"
19 TMPSDLLOG="${TMPDIR1}/qemu-conf-sdl-$$-${RANDOM}.log"
21 trap "rm -f $TMPC $TMPO $TMPE $TMPS $TMPI $TMPSDLLOG; exit" 0 2 3 15
23 # default parameters
24 prefix=""
25 interp_prefix="/usr/gnemul/qemu-%M"
26 static="no"
27 cross_prefix=""
28 cc="gcc"
29 audio_drv_list=""
30 audio_card_list="ac97 es1370 sb16"
31 audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus"
32 host_cc="gcc"
33 ar="ar"
34 make="make"
35 install="install"
36 strip="strip"
38 # parse CC options first
39 for opt do
40 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
41 case "$opt" in
42 --cross-prefix=*) cross_prefix="$optarg"
44 --cc=*) cc="$optarg"
46 esac
47 done
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
53 cc="${cross_prefix}${cc}"
54 ar="${cross_prefix}${ar}"
55 strip="${cross_prefix}${strip}"
57 # check that the C compiler works.
58 cat > $TMPC <<EOF
59 int main(void) {}
60 EOF
62 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
63 : C compiler works ok
64 else
65 echo "ERROR: \"$cc\" either does not exist or does not work"
66 exit 1
69 check_define() {
70 cat > $TMPC <<EOF
71 #if !defined($1)
72 #error Not defined
73 #endif
74 int main(void) { return 0; }
75 EOF
76 $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
79 if check_define __i386__ ; then
80 cpu="i386"
81 elif check_define __x86_64__ ; then
82 cpu="x86_64"
83 elif 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"
91 elif check_define _ARCH_PPC ; then
92 if check_define _ARCH_PPC64 ; then
93 cpu="ppc64"
94 else
95 cpu="ppc"
97 else
98 cpu=`uname -m`
101 target_list="x86_64-softmmu"
102 case "$cpu" in
103 i386|i486|i586|i686|i86pc|BePC)
104 cpu="i386"
106 x86_64|amd64)
107 cpu="x86_64"
109 alpha)
110 cpu="alpha"
112 armv*b)
113 cpu="armv4b"
115 armv*l)
116 cpu="armv4l"
118 cris)
119 cpu="cris"
121 parisc|parisc64)
122 cpu="hppa"
124 ia64)
125 cpu="ia64"
127 m68k)
128 cpu="m68k"
130 mips)
131 cpu="mips"
133 mips64)
134 cpu="mips64"
136 ppc)
137 cpu="ppc"
139 ppc64)
140 cpu="ppc64"
142 s390*)
143 cpu="s390"
145 sparc|sun4[cdmuv])
146 cpu="sparc"
148 sparc64)
149 cpu="sparc64"
152 cpu="unknown"
154 esac
155 gprof="no"
156 sparse="no"
157 bigendian="no"
158 mingw32="no"
159 EXESUF=""
160 gdbstub="yes"
161 slirp="yes"
162 vde="yes"
163 fmod_lib=""
164 fmod_inc=""
165 oss_lib=""
166 vnc_tls="yes"
167 bsd="no"
168 linux="no"
169 solaris="no"
170 kqemu="no"
171 profiler="no"
172 cocoa="no"
173 check_gfx="yes"
174 softmmu="yes"
175 linux_user="no"
176 darwin_user="no"
177 bsd_user="no"
178 build_docs="no"
179 uname_release=""
180 curses="yes"
181 aio="yes"
182 nptl="yes"
183 mixemu="no"
184 bluez="yes"
185 kvm="yes"
186 kvm_cap_pit="no"
187 kvm_cap_device_assignment="no"
188 kerneldir=""
189 aix="no"
190 blobs="yes"
191 fdt="yes"
192 sdl_x11="no"
193 signalfd="no"
194 eventfd="no"
195 cpu_emulation="yes"
197 # OS specific
198 if check_define __linux__ ; then
199 targetos="Linux"
200 elif check_define _WIN32 ; then
201 targetos='MINGW32'
202 else
203 targetos=`uname -s`
205 case $targetos in
206 CYGWIN*)
207 mingw32="yes"
208 OS_CFLAGS="-mno-cygwin"
209 if [ "$cpu" = "i386" ] ; then
210 kqemu="yes"
212 audio_possible_drivers="sdl"
214 MINGW32*)
215 mingw32="yes"
216 if [ "$cpu" = "i386" ] ; then
217 kqemu="yes"
219 audio_possible_drivers="dsound sdl fmod"
221 GNU/kFreeBSD)
222 audio_drv_list="oss"
223 audio_possible_drivers="oss sdl esd pa"
224 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
225 kqemu="yes"
228 FreeBSD)
229 bsd="yes"
230 audio_drv_list="oss"
231 audio_possible_drivers="oss sdl esd pa"
232 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
233 kqemu="yes"
234 kvm="yes"
237 NetBSD)
238 bsd="yes"
239 audio_drv_list="oss"
240 audio_possible_drivers="oss sdl esd"
241 oss_lib="-lossaudio"
243 OpenBSD)
244 bsd="yes"
245 openbsd="yes"
246 audio_drv_list="oss"
247 audio_possible_drivers="oss sdl esd"
248 oss_lib="-lossaudio"
250 Darwin)
251 bsd="yes"
252 darwin="yes"
253 # 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
254 if [ "$cpu" = "i386" ] ; then
255 is_x86_64=`sysctl -n hw.optional.x86_64`
256 [ "$is_x86_64" = "1" ] && cpu=x86_64
258 if [ "$cpu" = "x86_64" ] ; then
259 OS_CFLAGS="-arch x86_64"
260 LDFLAGS="-arch x86_64"
261 else
262 OS_CFLAGS="-mdynamic-no-pic"
264 darwin_user="yes"
265 cocoa="yes"
266 audio_drv_list="coreaudio"
267 audio_possible_drivers="coreaudio sdl fmod"
268 OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
270 SunOS)
271 solaris="yes"
272 make="gmake"
273 install="ginstall"
274 needs_libsunmath="no"
275 solarisrev=`uname -r | cut -f2 -d.`
276 # have to select again, because `uname -m` returns i86pc
277 # even on an x86_64 box.
278 solariscpu=`isainfo -k`
279 if test "${solariscpu}" = "amd64" ; then
280 cpu="x86_64"
282 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
283 if test "$solarisrev" -le 9 ; then
284 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
285 needs_libsunmath="yes"
286 else
287 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
288 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
289 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
290 echo "Studio 11 can be downloaded from www.sun.com."
291 exit 1
294 if test "$solarisrev" -ge 9 ; then
295 kqemu="yes"
298 if test -f /usr/include/sys/soundcard.h ; then
299 audio_drv_list="oss"
301 audio_possible_drivers="oss sdl"
303 AIX)
304 aix="yes"
305 make="gmake"
308 audio_drv_list="oss"
309 audio_possible_drivers="oss alsa sdl esd pa"
310 linux="yes"
311 linux_user="yes"
312 usb="linux"
313 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
314 kqemu="yes"
315 audio_possible_drivers="$audio_possible_drivers fmod"
316 kvm="yes"
318 if [ "$cpu" = "ia64" ] ; then
319 kvm="yes"
320 cpu_emulation="no"
321 gdbstub="no"
322 slirp="no"
324 if [ "$cpu" = "powerpc" ]; then
325 kvm="yes"
328 esac
330 if [ "$bsd" = "yes" ] ; then
331 if [ "$darwin" != "yes" ] ; then
332 make="gmake"
333 usb="bsd"
335 bsd_user="yes"
338 # find source path
339 source_path=`dirname "$0"`
340 source_path_used="no"
341 workdir=`pwd`
342 if [ -z "$source_path" ]; then
343 source_path=$workdir
344 else
345 source_path=`cd "$source_path"; pwd`
347 [ -f "$workdir/vl.c" ] || source_path_used="yes"
349 werror="no"
350 # generate compile errors on warnings for development builds
351 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
352 #werror="yes";
355 for opt do
356 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
357 case "$opt" in
358 --help|-h) show_help=yes
360 --prefix=*) prefix="$optarg"
362 --interp-prefix=*) interp_prefix="$optarg"
364 --source-path=*) source_path="$optarg"
365 source_path_used="yes"
367 --cross-prefix=*)
369 --cc=*)
371 --host-cc=*) host_cc="$optarg"
373 --make=*) make="$optarg"
375 --install=*) install="$optarg"
377 --extra-cflags=*) CFLAGS="$optarg"
379 --extra-ldflags=*) LDFLAGS="$optarg"
381 --cpu=*) cpu="$optarg"
383 --target-list=*) target_list="$optarg"
385 --enable-gprof) gprof="yes"
387 --static) static="yes"
389 --disable-sdl) sdl="no"
391 --fmod-lib=*) fmod_lib="$optarg"
393 --fmod-inc=*) fmod_inc="$optarg"
395 --oss-lib=*) oss_lib="$optarg"
397 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
399 --audio-drv-list=*) audio_drv_list="$optarg"
401 --enable-sparse) sparse="yes"
403 --disable-sparse) sparse="no"
405 --disable-vnc-tls) vnc_tls="no"
407 --disable-slirp) slirp="no"
409 --disable-vde) vde="no"
411 --disable-kqemu) kqemu="no"
413 --disable-brlapi) brlapi="no"
415 --disable-bluez) bluez="no"
417 --disable-kvm) kvm="no"
419 --enable-profiler) profiler="yes"
421 --enable-cocoa)
422 cocoa="yes" ;
423 sdl="no" ;
424 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
426 --disable-gfx-check) check_gfx="no"
428 --disable-system) softmmu="no"
430 --enable-system) softmmu="yes"
432 --disable-linux-user) linux_user="no"
434 --enable-linux-user) linux_user="yes"
436 --disable-darwin-user) darwin_user="no"
438 --enable-darwin-user) darwin_user="yes"
440 --disable-bsd-user) bsd_user="no"
442 --enable-bsd-user) bsd_user="yes"
444 --enable-uname-release=*) uname_release="$optarg"
446 --sparc_cpu=*)
447 sparc_cpu="$optarg"
448 case $sparc_cpu in
449 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
450 target_cpu="sparc"; cpu="sparc" ;;
451 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
452 target_cpu="sparc"; cpu="sparc" ;;
453 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
454 target_cpu="sparc64"; cpu="sparc64" ;;
455 *) echo "undefined SPARC architecture. Exiting";exit 1;;
456 esac
458 --enable-werror) werror="yes"
460 --disable-werror) werror="no"
462 --disable-curses) curses="no"
464 --disable-nptl) nptl="no"
466 --enable-mixemu) mixemu="yes"
468 --disable-aio) aio="no"
470 --disable-blobs) blobs="no"
472 --kerneldir=*) kerneldir="$optarg"
474 --disable-cpu-emulation) cpu_emulation="no"
476 *) echo "ERROR: unknown option $opt"; exit 1
478 esac
479 done
481 # default flags for all hosts
482 CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
483 CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
484 LDFLAGS="$LDFLAGS -g"
485 if test "$werror" = "yes" ; then
486 CFLAGS="$CFLAGS -Werror"
489 CFLAGS="$CFLAGS -I$(readlink -f "kvm/libkvm")"
491 if test "$solaris" = "no" ; then
492 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
493 LDFLAGS="$LDFLAGS -Wl,--warn-common"
498 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
499 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
501 case "$cpu" in
502 sparc) if test -z "$sparc_cpu" ; then
503 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
504 ARCH_LDFLAGS="-m32"
505 else
506 ARCH_CFLAGS="${SP_CFLAGS}"
507 ARCH_LDFLAGS="${SP_LDFLAGS}"
510 sparc64) if test -z "$sparc_cpu" ; then
511 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
512 ARCH_LDFLAGS="-m64"
513 else
514 ARCH_CFLAGS="${SP_CFLAGS}"
515 ARCH_LDFLAGS="${SP_LDFLAGS}"
518 s390)
519 ARCH_CFLAGS="-march=z900"
521 i386)
522 ARCH_CFLAGS="-m32"
523 ARCH_LDFLAGS="-m32"
525 x86_64)
526 ARCH_CFLAGS="-m64"
527 ARCH_LDFLAGS="-m64"
529 esac
531 if test x"$show_help" = x"yes" ; then
532 cat << EOF
534 Usage: configure [options]
535 Options: [defaults in brackets after descriptions]
538 echo "Standard options:"
539 echo " --help print this message"
540 echo " --prefix=PREFIX install in PREFIX [$prefix]"
541 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
542 echo " use %M for cpu name [$interp_prefix]"
543 echo " --target-list=LIST set target list [$target_list]"
544 echo ""
545 echo "kqemu kernel acceleration support:"
546 echo " --disable-kqemu disable kqemu support"
547 echo ""
548 echo "Advanced options (experts only):"
549 echo " --source-path=PATH path of source code [$source_path]"
550 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
551 echo " --cc=CC use C compiler CC [$cc]"
552 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
553 echo " --make=MAKE use specified make [$make]"
554 echo " --install=INSTALL use specified install [$install]"
555 echo " --static enable static build [$static]"
556 echo " --enable-sparse enable sparse checker"
557 echo " --disable-sparse disable sparse checker (default)"
558 echo " --disable-werror disable compilation abort on warning"
559 echo " --disable-sdl disable SDL"
560 echo " --enable-cocoa enable COCOA (Mac OS X only)"
561 echo " --audio-drv-list=LIST set audio drivers list:"
562 echo " Available drivers: $audio_possible_drivers"
563 echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
564 echo " Available cards: $audio_possible_cards"
565 echo " --enable-mixemu enable mixer emulation"
566 echo " --disable-brlapi disable BrlAPI"
567 echo " --disable-vnc-tls disable TLS encryption for VNC server"
568 echo " --disable-curses disable curses output"
569 echo " --disable-bluez disable bluez stack connectivity"
570 echo " --disable-kvm disable KVM acceleration support"
571 echo " --disable-nptl disable usermode NPTL support"
572 echo " --enable-system enable all system emulation targets"
573 echo " --disable-system disable all system emulation targets"
574 echo " --enable-linux-user enable all linux usermode emulation targets"
575 echo " --disable-linux-user disable all linux usermode emulation targets"
576 echo " --enable-darwin-user enable all darwin usermode emulation targets"
577 echo " --disable-darwin-user disable all darwin usermode emulation targets"
578 echo " --enable-bsd-user enable all BSD usermode emulation targets"
579 echo " --disable-bsd-user disable all BSD usermode emulation targets"
580 echo " --fmod-lib path to FMOD library"
581 echo " --fmod-inc path to FMOD includes"
582 echo " --oss-lib path to OSS library"
583 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
584 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
585 echo " --disable-vde disable support for vde network"
586 echo " --disable-aio disable AIO support"
587 echo " --disable-blobs disable installing provided firmware blobs"
588 echo " --kerneldir=PATH look for kernel includes in PATH"
589 echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
590 echo ""
591 echo "NOTE: The object files are built at the place where configure is launched"
592 exit 1
595 if test "$mingw32" = "yes" ; then
596 linux="no"
597 EXESUF=".exe"
598 oss="no"
599 linux_user="no"
600 bsd_user="no"
603 if test ! -x "$(which cgcc 2>/dev/null)"; then
604 sparse="no"
608 # Solaris specific configure tool chain decisions
610 if test "$solaris" = "yes" ; then
611 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
612 if test -z "$solinst" ; then
613 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
614 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
615 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
616 exit 1
618 if test "$solinst" = "/usr/sbin/install" ; then
619 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
620 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
621 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
622 exit 1
624 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
625 if test -z "$sol_ar" ; then
626 echo "Error: No path includes ar"
627 if test -f /usr/ccs/bin/ar ; then
628 echo "Add /usr/ccs/bin to your path and rerun configure"
630 exit 1
635 if test -z "$target_list" ; then
636 # these targets are portable
637 if [ "$softmmu" = "yes" ] ; then
638 target_list="\
639 i386-softmmu \
640 x86_64-softmmu \
641 arm-softmmu \
642 cris-softmmu \
643 m68k-softmmu \
644 mips-softmmu \
645 mipsel-softmmu \
646 mips64-softmmu \
647 mips64el-softmmu \
648 ppc-softmmu \
649 ppcemb-softmmu \
650 ppc64-softmmu \
651 sh4-softmmu \
652 sh4eb-softmmu \
653 sparc-softmmu \
656 # the following are Linux specific
657 if [ "$linux_user" = "yes" ] ; then
658 target_list="${target_list}\
659 i386-linux-user \
660 x86_64-linux-user \
661 alpha-linux-user \
662 arm-linux-user \
663 armeb-linux-user \
664 cris-linux-user \
665 m68k-linux-user \
666 mips-linux-user \
667 mipsel-linux-user \
668 ppc-linux-user \
669 ppc64-linux-user \
670 ppc64abi32-linux-user \
671 sh4-linux-user \
672 sh4eb-linux-user \
673 sparc-linux-user \
674 sparc64-linux-user \
675 sparc32plus-linux-user \
678 # the following are Darwin specific
679 if [ "$darwin_user" = "yes" ] ; then
680 target_list="$target_list i386-darwin-user ppc-darwin-user "
682 # the following are BSD specific
683 if [ "$bsd_user" = "yes" ] ; then
684 target_list="${target_list}\
685 sparc64-bsd-user \
688 else
689 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
691 if test -z "$target_list" ; then
692 echo "No targets enabled"
693 exit 1
696 if test -z "$cross_prefix" ; then
698 # ---
699 # big/little endian test
700 cat > $TMPC << EOF
701 #include <inttypes.h>
702 int main(int argc, char ** argv){
703 volatile uint32_t i=0x01234567;
704 return (*((uint8_t*)(&i))) == 0x67;
708 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
709 $TMPE && bigendian="yes"
710 else
711 echo big/little test failed
714 else
716 # if cross compiling, cannot launch a program, so make a static guess
717 if test "$cpu" = "armv4b" \
718 -o "$cpu" = "hppa" \
719 -o "$cpu" = "m68k" \
720 -o "$cpu" = "mips" \
721 -o "$cpu" = "mips64" \
722 -o "$cpu" = "ppc" \
723 -o "$cpu" = "ppc64" \
724 -o "$cpu" = "s390" \
725 -o "$cpu" = "sparc" \
726 -o "$cpu" = "sparc64"; then
727 bigendian="yes"
732 # host long bits test
733 hostlongbits="32"
734 if test "$cpu" = "x86_64" \
735 -o "$cpu" = "alpha" \
736 -o "$cpu" = "ia64" \
737 -o "$cpu" = "sparc64" \
738 -o "$cpu" = "ppc64"; then
739 hostlongbits="64"
742 # check gcc options support
743 cat > $TMPC <<EOF
744 int main(void) {
748 # Check host NPTL support
749 cat > $TMPC <<EOF
750 #include <sched.h>
751 #include <linux/futex.h>
752 void foo()
754 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
755 #error bork
756 #endif
760 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
762 else
763 nptl="no"
766 ##########################################
767 # KVM probe
769 case "$cpu" in
770 i386 | x86_64)
771 kvm_arch="x86"
774 kvm_arch="$cpu"
776 esac
778 kvm_cflags=""
780 if test "$kvm" = "yes" ; then
782 kvm_cflags="-I$source_path/kvm/kernel/include"
783 kvm_cflags="$kvm_cflags -I$source_path/kvm/kernel/arch/$kvm_arch/include"
785 # test for KVM_CAP_PIT
787 cat > $TMPC <<EOF
788 #include <libkvm.h>
789 #ifndef KVM_CAP_PIT
790 #error "kvm no pit capability"
791 #endif
792 int main(void) { return 0; }
794 if $cc $ARCH_CFLAGS $CFLAGS $kvm_cflags -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev/null ; then
795 kvm_cap_pit="yes"
798 # test for KVM_CAP_DEVICE_ASSIGNMENT
800 cat > $TMPC <<EOF
801 #include <libkvm.h>
802 #ifndef KVM_CAP_DEVICE_ASSIGNMENT
803 #error "kvm no device assignment capability"
804 #endif
805 int main(void) { return 0; }
807 if $cc $ARCH_CFLAGS $CFLAGS $kvm_cflags -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev/null ; then
808 kvm_cap_device_assignment="yes"
812 ##########################################
813 # zlib check
815 cat > $TMPC << EOF
816 #include <zlib.h>
817 int main(void) { zlibVersion(); return 0; }
819 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
821 else
822 echo
823 echo "Error: zlib check failed"
824 echo "Make sure to have the zlib libs and headers installed."
825 echo
826 exit 1
829 ##########################################
830 # SDL probe
832 sdl_too_old=no
834 if test -z "$sdl" ; then
835 sdl_config="sdl-config"
836 sdl=no
837 sdl_static=no
839 cat > $TMPC << EOF
840 #include <SDL.h>
841 #undef main /* We don't want SDL to override our main() */
842 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
844 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
845 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
846 if test "$_sdlversion" -lt 121 ; then
847 sdl_too_old=yes
848 else
849 if test "$cocoa" = "no" ; then
850 sdl=yes
854 # static link with sdl ?
855 if test "$sdl" = "yes" ; then
856 aa="no"
857 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
858 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
859 if [ "$aa" = "yes" ] ; then
860 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
863 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then
864 sdl_static=yes
866 fi # static link
867 fi # sdl compile test
868 else
869 # Make sure to disable cocoa if sdl was set
870 if test "$sdl" = "yes" ; then
871 cocoa="no"
872 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
874 fi # -z $sdl
876 if test "$sdl" = "yes" ; then
877 cat > $TMPC <<EOF
878 #include <SDL.h>
879 #if defined(SDL_VIDEO_DRIVER_X11)
880 #include <X11/XKBlib.h>
881 #else
882 #error No x11 support
883 #endif
884 int main(void) { return 0; }
886 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
887 sdl_x11="yes"
891 ##########################################
892 # VNC TLS detection
893 if test "$vnc_tls" = "yes" ; then
894 cat > $TMPC <<EOF
895 #include <gnutls/gnutls.h>
896 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
898 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
899 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
900 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
901 $vnc_tls_libs > /dev/null 2> /dev/null ; then
903 else
904 vnc_tls="no"
908 ##########################################
909 # vde libraries probe
910 if test "$vde" = "yes" ; then
911 cat > $TMPC << EOF
912 #include <libvdeplug.h>
913 int main(void)
915 struct vde_open_args a = {0, 0, 0};
916 vde_open("", "", &a);
917 return 0;
920 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
922 else
923 vde="no"
927 ##########################################
928 # Sound support libraries probe
930 audio_drv_probe()
932 drv=$1
933 hdr=$2
934 lib=$3
935 exp=$4
936 cfl=$5
937 cat > $TMPC << EOF
938 #include <$hdr>
939 int main(void) { $exp }
941 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
943 else
944 echo
945 echo "Error: $drv check failed"
946 echo "Make sure to have the $drv libs and headers installed."
947 echo
948 exit 1
952 audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
953 for drv in $audio_drv_list; do
954 case $drv in
955 alsa)
956 audio_drv_probe $drv alsa/asoundlib.h -lasound \
957 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
960 fmod)
961 if test -z $fmod_lib || test -z $fmod_inc; then
962 echo
963 echo "Error: You must specify path to FMOD library and headers"
964 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
965 echo
966 exit 1
968 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
971 esd)
972 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
976 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
977 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
980 oss|sdl|core|wav|dsound)
981 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
985 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
986 echo
987 echo "Error: Unknown driver '$drv' selected"
988 echo "Possible drivers are: $audio_possible_drivers"
989 echo
990 exit 1
993 esac
994 done
996 ##########################################
997 # BrlAPI probe
999 if test -z "$brlapi" ; then
1000 brlapi=no
1001 cat > $TMPC << EOF
1002 #include <brlapi.h>
1003 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1005 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
1006 brlapi=yes
1007 fi # brlapi compile test
1008 fi # -z $brlapi
1010 ##########################################
1011 # curses probe
1013 if test "$curses" = "yes" ; then
1014 curses=no
1015 cat > $TMPC << EOF
1016 #include <curses.h>
1017 int main(void) { return curses_version(); }
1019 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
1020 curses=yes
1022 fi # test "$curses"
1024 ##########################################
1025 # bluez support probe
1026 if test "$bluez" = "yes" ; then
1027 `pkg-config bluez` || bluez="no"
1029 if test "$bluez" = "yes" ; then
1030 cat > $TMPC << EOF
1031 #include <bluetooth/bluetooth.h>
1032 int main(void) { return bt_error(0); }
1034 bluez_cflags=`pkg-config --cflags bluez`
1035 bluez_libs=`pkg-config --libs bluez`
1036 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
1037 $bluez_libs > /dev/null 2> /dev/null ; then
1039 else
1040 bluez="no"
1044 ##########################################
1045 # kvm probe
1046 if test "$kvm" = "yes" ; then
1047 cat > $TMPC <<EOF
1048 #include <linux/kvm.h>
1049 #if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
1050 #error Invalid KVM version
1051 #endif
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
1061 int main(void) { return 0; }
1063 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
1064 > /dev/null 2>/dev/null ; then
1066 else
1067 kvm="no";
1068 if [ -x "`which awk 2>/dev/null`" ] && \
1069 [ -x "`which grep 2>/dev/null`" ]; then
1070 kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
1071 | grep "error: " \
1072 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1073 if test "$kvmerr" != "" ; then
1074 kvm="no - (${kvmerr})"
1080 ##########################################
1081 # AIO probe
1082 AIOLIBS=""
1084 if test "$aio" = "yes" ; then
1085 aio=no
1086 cat > $TMPC << EOF
1087 #include <pthread.h>
1088 int main(void) { pthread_mutex_t lock; return 0; }
1090 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
1091 aio=yes
1092 AIOLIBS="-lpthread"
1096 ##########################################
1097 # iovec probe
1098 cat > $TMPC <<EOF
1099 #include <sys/types.h>
1100 #include <sys/uio.h>
1101 #include <unistd.h>
1102 int main(void) { struct iovec iov; return 0; }
1104 iovec=no
1105 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1106 iovec=yes
1109 ##########################################
1110 # fdt probe
1111 if test "$fdt" = "yes" ; then
1112 fdt=no
1113 cat > $TMPC << EOF
1114 int main(void) { return 0; }
1116 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null ; then
1117 fdt=yes
1121 ##########################################
1122 # signalfd probe
1123 cat > $TMPC << EOF
1124 #define _GNU_SOURCE
1125 #include <unistd.h>
1126 #include <sys/syscall.h>
1127 #include <signal.h>
1128 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
1131 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1132 signalfd=yes
1135 ##########################################
1136 # eventfd probe
1137 cat > $TMPC << EOF
1138 #define _GNU_SOURCE
1139 #include <unistd.h>
1140 #include <sys/syscall.h>
1141 int main(void) { return syscall(SYS_eventfd, 0); }
1144 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1145 eventfd=yes
1148 # Check if tools are available to build documentation.
1149 if [ -x "`which texi2html 2>/dev/null`" ] && \
1150 [ -x "`which pod2man 2>/dev/null`" ]; then
1151 build_docs="yes"
1154 ##########################################
1155 # Do we need librt
1156 cat > $TMPC <<EOF
1157 #include <signal.h>
1158 #include <time.h>
1159 int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1162 rt=no
1163 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1165 elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
1166 rt=yes
1169 if test "$rt" = "yes" ; then
1170 # Hack, we should have a general purpose LIBS for this sort of thing
1171 AIOLIBS="$AIOLIBS -lrt"
1174 if test "$mingw32" = "yes" ; then
1175 if test -z "$prefix" ; then
1176 prefix="c:\\\\Program Files\\\\Qemu"
1178 mansuffix=""
1179 datasuffix=""
1180 docsuffix=""
1181 binsuffix=""
1182 else
1183 if test -z "$prefix" ; then
1184 prefix="/usr/local"
1186 mansuffix="/share/man"
1187 datasuffix="/share/qemu"
1188 docsuffix="/share/doc/qemu"
1189 binsuffix="/bin"
1192 echo "Install prefix $prefix"
1193 echo "BIOS directory $prefix$datasuffix"
1194 echo "binary directory $prefix$binsuffix"
1195 if test "$mingw32" = "no" ; then
1196 echo "Manual directory $prefix$mansuffix"
1197 echo "ELF interp prefix $interp_prefix"
1199 echo "Source path $source_path"
1200 echo "C compiler $cc"
1201 echo "Host C compiler $host_cc"
1202 echo "ARCH_CFLAGS $ARCH_CFLAGS"
1203 echo "make $make"
1204 echo "install $install"
1205 echo "host CPU $cpu"
1206 echo "host big endian $bigendian"
1207 echo "target list $target_list"
1208 echo "gprof enabled $gprof"
1209 echo "sparse enabled $sparse"
1210 echo "profiler $profiler"
1211 echo "static build $static"
1212 echo "-Werror enabled $werror"
1213 if test "$darwin" = "yes" ; then
1214 echo "Cocoa support $cocoa"
1216 echo "SDL support $sdl"
1217 if test "$sdl" != "no" ; then
1218 echo "SDL static link $sdl_static"
1220 echo "curses support $curses"
1221 echo "mingw32 support $mingw32"
1222 echo "Audio drivers $audio_drv_list"
1223 echo "Extra audio cards $audio_card_list"
1224 echo "Mixer emulation $mixemu"
1225 echo "VNC TLS support $vnc_tls"
1226 if test "$vnc_tls" = "yes" ; then
1227 echo " TLS CFLAGS $vnc_tls_cflags"
1228 echo " TLS LIBS $vnc_tls_libs"
1230 if test -n "$sparc_cpu"; then
1231 echo "Target Sparc Arch $sparc_cpu"
1233 echo "kqemu support $kqemu"
1234 echo "kvm support $kvm"
1235 echo "CPU emulation $cpu_emulation"
1236 echo "brlapi support $brlapi"
1237 echo "Documentation $build_docs"
1238 [ ! -z "$uname_release" ] && \
1239 echo "uname -r $uname_release"
1240 echo "NPTL support $nptl"
1241 echo "vde support $vde"
1242 echo "AIO support $aio"
1243 echo "Install blobs $blobs"
1244 echo "KVM support $kvm"
1245 echo "fdt support $fdt"
1247 if test $sdl_too_old = "yes"; then
1248 echo "-> Your SDL version is too old - please upgrade to have SDL support"
1250 if [ -s $TMPSDLLOG ]; then
1251 echo "The error log from compiling the libSDL test is: "
1252 cat $TMPSDLLOG
1254 #if test "$sdl_static" = "no"; then
1255 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1257 config_mak="config-host.mak"
1258 config_h="config-host.h"
1260 #echo "Creating $config_mak and $config_h"
1262 test -f $config_h && mv $config_h ${config_h}~
1264 echo "# Automatically generated by configure - do not modify" > $config_mak
1265 printf "# Configured with:" >> $config_mak
1266 printf " '%s'" "$0" "$@" >> $config_mak
1267 echo >> $config_mak
1268 echo "/* Automatically generated by configure - do not modify */" > $config_h
1270 echo "prefix=$prefix" >> $config_mak
1271 echo "bindir=\${prefix}$binsuffix" >> $config_mak
1272 echo "mandir=\${prefix}$mansuffix" >> $config_mak
1273 echo "datadir=\${prefix}$datasuffix" >> $config_mak
1274 echo "docdir=\${prefix}$docsuffix" >> $config_mak
1275 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
1276 echo "MAKE=$make" >> $config_mak
1277 echo "INSTALL=$install" >> $config_mak
1278 echo "CC=$cc" >> $config_mak
1279 echo "HOST_CC=$host_cc" >> $config_mak
1280 echo "AR=$ar" >> $config_mak
1281 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
1282 # XXX: only use CFLAGS and LDFLAGS ?
1283 # XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1284 # compilation of dyngen tool (useful for win32 build on Linux host)
1285 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
1286 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1287 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1288 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
1289 echo "CFLAGS=$CFLAGS" >> $config_mak
1290 echo "LDFLAGS=$LDFLAGS" >> $config_mak
1291 echo "EXESUF=$EXESUF" >> $config_mak
1292 echo "AIOLIBS=$AIOLIBS" >> $config_mak
1293 case "$cpu" in
1294 i386)
1295 echo "ARCH=i386" >> $config_mak
1296 echo "#define HOST_I386 1" >> $config_h
1298 x86_64)
1299 echo "ARCH=x86_64" >> $config_mak
1300 echo "#define HOST_X86_64 1" >> $config_h
1302 alpha)
1303 echo "ARCH=alpha" >> $config_mak
1304 echo "#define HOST_ALPHA 1" >> $config_h
1306 armv4b)
1307 echo "ARCH=arm" >> $config_mak
1308 echo "#define HOST_ARM 1" >> $config_h
1310 armv4l)
1311 echo "ARCH=arm" >> $config_mak
1312 echo "#define HOST_ARM 1" >> $config_h
1314 cris)
1315 echo "ARCH=cris" >> $config_mak
1316 echo "#define HOST_CRIS 1" >> $config_h
1318 hppa)
1319 echo "ARCH=hppa" >> $config_mak
1320 echo "#define HOST_HPPA 1" >> $config_h
1322 ia64)
1323 echo "ARCH=ia64" >> $config_mak
1324 echo "#define HOST_IA64 1" >> $config_h
1326 m68k)
1327 echo "ARCH=m68k" >> $config_mak
1328 echo "#define HOST_M68K 1" >> $config_h
1330 mips)
1331 echo "ARCH=mips" >> $config_mak
1332 echo "#define HOST_MIPS 1" >> $config_h
1334 mips64)
1335 echo "ARCH=mips64" >> $config_mak
1336 echo "#define HOST_MIPS64 1" >> $config_h
1338 ppc)
1339 echo "ARCH=ppc" >> $config_mak
1340 echo "#define HOST_PPC 1" >> $config_h
1342 ppc64)
1343 echo "ARCH=ppc64" >> $config_mak
1344 echo "#define HOST_PPC64 1" >> $config_h
1346 s390)
1347 echo "ARCH=s390" >> $config_mak
1348 echo "#define HOST_S390 1" >> $config_h
1350 sparc)
1351 echo "ARCH=sparc" >> $config_mak
1352 echo "#define HOST_SPARC 1" >> $config_h
1354 sparc64)
1355 echo "ARCH=sparc64" >> $config_mak
1356 echo "#define HOST_SPARC64 1" >> $config_h
1359 echo "Unsupported CPU = $cpu"
1360 exit 1
1362 esac
1363 if test "$sparse" = "yes" ; then
1364 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1365 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1366 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1368 if test "$bigendian" = "yes" ; then
1369 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1370 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1372 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
1373 if test "$mingw32" = "yes" ; then
1374 echo "CONFIG_WIN32=yes" >> $config_mak
1375 echo "#define CONFIG_WIN32 1" >> $config_h
1376 else
1377 cat > $TMPC << EOF
1378 #include <byteswap.h>
1379 int main(void) { return bswap_32(0); }
1381 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
1382 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1384 cat > $TMPC << EOF
1385 #include <sys/endian.h>
1386 #include <sys/types.h>
1387 #include <machine/bswap.h>
1388 int main(void) { return bswap32(0); }
1390 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
1391 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1395 if [ "$openbsd" = "yes" ] ; then
1396 echo "#define ENOTSUP 4096" >> $config_h
1399 if test "$darwin" = "yes" ; then
1400 echo "CONFIG_DARWIN=yes" >> $config_mak
1401 echo "#define CONFIG_DARWIN 1" >> $config_h
1404 if test "$aix" = "yes" ; then
1405 echo "CONFIG_AIX=yes" >> $config_mak
1406 echo "#define CONFIG_AIX 1" >> $config_h
1409 if test "$solaris" = "yes" ; then
1410 echo "CONFIG_SOLARIS=yes" >> $config_mak
1411 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
1412 if test "$needs_libsunmath" = "yes" ; then
1413 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1414 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1417 if test -n "$sparc_cpu"; then
1418 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1419 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1421 if test "$gdbstub" = "yes" ; then
1422 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1423 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1425 if test "$gprof" = "yes" ; then
1426 echo "TARGET_GPROF=yes" >> $config_mak
1427 echo "#define HAVE_GPROF 1" >> $config_h
1429 if test "$static" = "yes" ; then
1430 echo "CONFIG_STATIC=yes" >> $config_mak
1431 echo "#define CONFIG_STATIC 1" >> $config_h
1433 if test $profiler = "yes" ; then
1434 echo "#define CONFIG_PROFILER 1" >> $config_h
1436 if test "$slirp" = "yes" ; then
1437 echo "CONFIG_SLIRP=yes" >> $config_mak
1438 echo "#define CONFIG_SLIRP 1" >> $config_h
1440 if test "$vde" = "yes" ; then
1441 echo "CONFIG_VDE=yes" >> $config_mak
1442 echo "#define CONFIG_VDE 1" >> $config_h
1443 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1445 for card in $audio_card_list; do
1446 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
1447 echo "$def=yes" >> $config_mak
1448 echo "#define $def 1" >> $config_h
1449 done
1450 echo "#define AUDIO_DRIVERS \\" >> $config_h
1451 for drv in $audio_drv_list; do
1452 echo " &${drv}_audio_driver, \\" >>$config_h
1453 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
1454 echo "$def=yes" >> $config_mak
1455 if test "$drv" = "fmod"; then
1456 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1457 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1458 elif test "$drv" = "oss"; then
1459 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
1461 done
1462 echo "" >>$config_h
1463 if test "$mixemu" = "yes" ; then
1464 echo "CONFIG_MIXEMU=yes" >> $config_mak
1465 echo "#define CONFIG_MIXEMU 1" >> $config_h
1467 if test "$vnc_tls" = "yes" ; then
1468 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1469 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1470 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1471 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1473 qemu_version=`head $source_path/VERSION`
1474 echo "VERSION=$qemu_version" >>$config_mak
1475 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1476 echo "#define KVM_VERSION \"kvm-devel\"" >> $config_h
1478 echo "SRC_PATH=$source_path" >> $config_mak
1479 if [ "$source_path_used" = "yes" ]; then
1480 echo "VPATH=$source_path" >> $config_mak
1482 echo "TARGET_DIRS=$target_list" >> $config_mak
1483 if [ "$build_docs" = "yes" ] ; then
1484 echo "BUILD_DOCS=yes" >> $config_mak
1486 if test "$static" = "yes"; then
1487 sdl1=$sdl_static
1488 else
1489 sdl1=$sdl
1491 if test "$sdl1" = "yes" ; then
1492 echo "#define CONFIG_SDL 1" >> $config_h
1493 echo "CONFIG_SDL=yes" >> $config_mak
1494 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1495 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1496 elif test "$sdl_x11" = "yes" ; then
1497 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
1498 else
1499 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1501 if [ "${aa}" = "yes" ] ; then
1502 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1503 else
1504 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1507 if test "$cocoa" = "yes" ; then
1508 echo "#define CONFIG_COCOA 1" >> $config_h
1509 echo "CONFIG_COCOA=yes" >> $config_mak
1511 if test "$curses" = "yes" ; then
1512 echo "#define CONFIG_CURSES 1" >> $config_h
1513 echo "CONFIG_CURSES=yes" >> $config_mak
1514 echo "CURSES_LIBS=-lcurses" >> $config_mak
1516 if test "$brlapi" = "yes" ; then
1517 echo "CONFIG_BRLAPI=yes" >> $config_mak
1518 echo "#define CONFIG_BRLAPI 1" >> $config_h
1519 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1521 if test "$bluez" = "yes" ; then
1522 echo "CONFIG_BLUEZ=yes" >> $config_mak
1523 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1524 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1525 echo "#define CONFIG_BLUEZ 1" >> $config_h
1527 if test "$aio" = "yes" ; then
1528 echo "#define CONFIG_AIO 1" >> $config_h
1529 echo "CONFIG_AIO=yes" >> $config_mak
1531 if test "$blobs" = "yes" ; then
1532 echo "INSTALL_BLOBS=yes" >> $config_mak
1534 if test "$iovec" = "yes" ; then
1535 echo "#define HAVE_IOVEC 1" >> $config_h
1537 if test "$fdt" = "yes" ; then
1538 echo "#define HAVE_FDT 1" >> $config_h
1539 echo "FDT_LIBS=-lfdt" >> $config_mak
1541 if test "$signalfd" = "yes" ; then
1542 echo "#define CONFIG_signalfd 1" >> $config_h
1544 if test "$eventfd" = "yes" ; then
1545 echo "#define CONFIG_eventfd 1" >> $config_h
1548 # XXX: suppress that
1549 if [ "$bsd" = "yes" ] ; then
1550 echo "#define O_LARGEFILE 0" >> $config_h
1551 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1552 echo "#define _BSD 1" >> $config_h
1555 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1557 # USB host support
1558 case "$usb" in
1559 linux)
1560 echo "HOST_USB=linux" >> $config_mak
1562 bsd)
1563 echo "HOST_USB=bsd" >> $config_mak
1566 echo "HOST_USB=stub" >> $config_mak
1568 esac
1570 tools=
1571 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1572 tools="qemu-img\$(EXESUF) $tools"
1573 if [ "$linux" = "yes" ] ; then
1574 tools="qemu-nbd\$(EXESUF) $tools"
1577 echo "TOOLS=$tools" >> $config_mak
1579 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1581 for target in $target_list; do
1582 target_dir="$target"
1583 config_mak=$target_dir/config.mak
1584 config_h=$target_dir/config.h
1585 target_cpu=`echo $target | cut -d '-' -f 1`
1586 target_bigendian="no"
1587 [ "$target_cpu" = "armeb" ] && target_bigendian=yes
1588 [ "$target_cpu" = "m68k" ] && target_bigendian=yes
1589 [ "$target_cpu" = "mips" ] && target_bigendian=yes
1590 [ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1591 [ "$target_cpu" = "mips64" ] && target_bigendian=yes
1592 [ "$target_cpu" = "ppc" ] && target_bigendian=yes
1593 [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
1594 [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
1595 [ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
1596 [ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
1597 [ "$target_cpu" = "sparc" ] && target_bigendian=yes
1598 [ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1599 [ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
1600 target_softmmu="no"
1601 target_user_only="no"
1602 target_linux_user="no"
1603 target_darwin_user="no"
1604 target_bsd_user="no"
1605 case "$target" in
1606 ${target_cpu}-softmmu)
1607 target_softmmu="yes"
1609 ${target_cpu}-linux-user)
1610 target_user_only="yes"
1611 target_linux_user="yes"
1613 ${target_cpu}-darwin-user)
1614 target_user_only="yes"
1615 target_darwin_user="yes"
1617 ${target_cpu}-bsd-user)
1618 target_user_only="yes"
1619 target_bsd_user="yes"
1622 echo "ERROR: Target '$target' not recognised"
1623 exit 1
1625 esac
1627 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1628 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1629 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1630 echo "To build QEMU without graphical output configure with --disable-gfx-check"
1631 echo "Note that this will disable all output from the virtual graphics card"
1632 echo "except through VNC or curses."
1633 exit 1;
1636 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1638 test -f $config_h && mv $config_h ${config_h}~
1640 mkdir -p $target_dir
1641 mkdir -p $target_dir/fpu
1642 mkdir -p $target_dir/tcg
1643 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
1644 mkdir -p $target_dir/nwfpe
1648 # don't use ln -sf as not all "ln -sf" over write the file/link
1650 rm -f $target_dir/Makefile
1651 ln -s $source_path/Makefile.target $target_dir/Makefile
1654 echo "# Automatically generated by configure - do not modify" > $config_mak
1655 echo "/* Automatically generated by configure - do not modify */" > $config_h
1658 echo "include ../config-host.mak" >> $config_mak
1659 echo "#include \"../config-host.h\"" >> $config_h
1661 bflt="no"
1662 elfload32="no"
1663 target_nptl="no"
1664 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1665 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1666 gdb_xml_files=""
1668 disable_cpu_emulation() {
1669 if test $cpu_emulation = "no"; then
1670 echo "#define NO_CPU_EMULATION 1" >> $config_h
1671 echo "NO_CPU_EMULATION=1" >> $config_mak
1675 configure_kvm() {
1676 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
1677 \( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \); then
1678 echo "#define USE_KVM 1" >> $config_h
1679 echo "USE_KVM=1" >> $config_mak
1680 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1681 if test $kvm_cap_pit = "yes" ; then
1682 echo "USE_KVM_PIT=1" >> $config_mak
1683 echo "#define USE_KVM_PIT 1" >> $config_h
1685 if test $kvm_cap_device_assignment = "yes" ; then
1686 echo "USE_KVM_DEVICE_ASSIGNMENT=1" >> $config_mak
1687 echo "#define USE_KVM_DEVICE_ASSIGNMENT 1" >> $config_h
1689 disable_cpu_emulation
1693 if [ use_upstream_kvm = yes ]; then
1695 # Make sure the target and host cpus are compatible
1696 if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
1697 \( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \) -o \
1698 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1699 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
1700 kvm="no"
1702 # Disable KVM for linux-user
1703 if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1704 kvm="no"
1709 case "$target_cpu" in
1710 i386)
1711 echo "TARGET_ARCH=i386" >> $config_mak
1712 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1713 echo "#define TARGET_I386 1" >> $config_h
1714 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
1715 then
1716 echo "#define USE_KQEMU 1" >> $config_h
1718 if test "$kvm" = "yes" ; then
1719 echo "USE_KVM=yes" >> $config_mak
1720 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1721 echo "#define USE_KVM 1" >> $config_h
1723 configure_kvm
1725 x86_64)
1726 echo "TARGET_ARCH=x86_64" >> $config_mak
1727 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1728 echo "#define TARGET_I386 1" >> $config_h
1729 echo "#define TARGET_X86_64 1" >> $config_h
1730 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1731 then
1732 echo "#define USE_KQEMU 1" >> $config_h
1734 configure_kvm
1736 ia64)
1737 echo "TARGET_ARCH=ia64" >> $config_mak
1738 echo "#define TARGET_ARCH \"ia64\"" >> $config_h
1739 echo "#define TARGET_IA64 1" >> $config_h
1740 configure_kvm
1741 if [ use_upstream_kvm = yes ]; then
1742 if test "$kvm" = "yes" ; then
1743 echo "USE_KVM=yes" >> $config_mak
1744 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1745 echo "#define USE_KVM 1" >> $config_h
1749 alpha)
1750 echo "TARGET_ARCH=alpha" >> $config_mak
1751 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1752 echo "#define TARGET_ALPHA 1" >> $config_h
1754 arm|armeb)
1755 echo "TARGET_ARCH=arm" >> $config_mak
1756 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1757 echo "#define TARGET_ARM 1" >> $config_h
1758 bflt="yes"
1759 target_nptl="yes"
1760 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
1762 cris)
1763 echo "TARGET_ARCH=cris" >> $config_mak
1764 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1765 echo "#define TARGET_CRIS 1" >> $config_h
1766 target_nptl="yes"
1768 m68k)
1769 echo "TARGET_ARCH=m68k" >> $config_mak
1770 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1771 echo "#define TARGET_M68K 1" >> $config_h
1772 bflt="yes"
1773 gdb_xml_files="cf-core.xml cf-fp.xml"
1775 mips|mipsel)
1776 echo "TARGET_ARCH=mips" >> $config_mak
1777 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1778 echo "#define TARGET_MIPS 1" >> $config_h
1779 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1781 mipsn32|mipsn32el)
1782 echo "TARGET_ARCH=mipsn32" >> $config_mak
1783 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1784 echo "#define TARGET_MIPS 1" >> $config_h
1785 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1787 mips64|mips64el)
1788 echo "TARGET_ARCH=mips64" >> $config_mak
1789 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1790 echo "#define TARGET_MIPS 1" >> $config_h
1791 echo "#define TARGET_MIPS64 1" >> $config_h
1792 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1794 ppc)
1795 echo "TARGET_ARCH=ppc" >> $config_mak
1796 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1797 echo "#define TARGET_PPC 1" >> $config_h
1798 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1800 ppcemb)
1801 echo "TARGET_ARCH=ppcemb" >> $config_mak
1802 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1803 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1804 echo "#define TARGET_PPC 1" >> $config_h
1805 echo "#define TARGET_PPCEMB 1" >> $config_h
1806 if test "$kvm" = "yes" ; then
1807 echo "USE_KVM=yes" >> $config_mak
1808 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1809 echo "#define USE_KVM 1" >> $config_h
1811 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1813 ppc64)
1814 echo "TARGET_ARCH=ppc64" >> $config_mak
1815 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1816 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1817 echo "#define TARGET_PPC 1" >> $config_h
1818 echo "#define TARGET_PPC64 1" >> $config_h
1819 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1821 ppc64abi32)
1822 echo "TARGET_ARCH=ppc64" >> $config_mak
1823 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1824 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1825 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1826 echo "#define TARGET_PPC 1" >> $config_h
1827 echo "#define TARGET_PPC64 1" >> $config_h
1828 echo "#define TARGET_ABI32 1" >> $config_h
1829 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1831 sh4|sh4eb)
1832 echo "TARGET_ARCH=sh4" >> $config_mak
1833 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1834 echo "#define TARGET_SH4 1" >> $config_h
1835 bflt="yes"
1836 target_nptl="yes"
1838 sparc)
1839 echo "TARGET_ARCH=sparc" >> $config_mak
1840 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1841 echo "#define TARGET_SPARC 1" >> $config_h
1843 sparc64)
1844 echo "TARGET_ARCH=sparc64" >> $config_mak
1845 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1846 echo "#define TARGET_SPARC 1" >> $config_h
1847 echo "#define TARGET_SPARC64 1" >> $config_h
1848 elfload32="yes"
1850 sparc32plus)
1851 echo "TARGET_ARCH=sparc64" >> $config_mak
1852 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1853 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1854 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1855 echo "#define TARGET_SPARC 1" >> $config_h
1856 echo "#define TARGET_SPARC64 1" >> $config_h
1857 echo "#define TARGET_ABI32 1" >> $config_h
1860 echo "Unsupported target CPU"
1861 exit 1
1863 esac
1864 if test "$target_bigendian" = "yes" ; then
1865 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1866 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1868 if test "$target_softmmu" = "yes" ; then
1869 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1870 echo "#define CONFIG_SOFTMMU 1" >> $config_h
1872 if test "$target_user_only" = "yes" ; then
1873 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1874 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1876 if test "$target_linux_user" = "yes" ; then
1877 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1878 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1880 if test "$target_darwin_user" = "yes" ; then
1881 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1882 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1884 list=""
1885 if test ! -z "$gdb_xml_files" ; then
1886 for x in $gdb_xml_files; do
1887 list="$list $source_path/gdb-xml/$x"
1888 done
1890 echo "TARGET_XML_FILES=$list" >> $config_mak
1892 if test "$target_cpu" = "arm" \
1893 -o "$target_cpu" = "armeb" \
1894 -o "$target_cpu" = "m68k" \
1895 -o "$target_cpu" = "mips" \
1896 -o "$target_cpu" = "mipsel" \
1897 -o "$target_cpu" = "mipsn32" \
1898 -o "$target_cpu" = "mipsn32el" \
1899 -o "$target_cpu" = "mips64" \
1900 -o "$target_cpu" = "mips64el" \
1901 -o "$target_cpu" = "ppc" \
1902 -o "$target_cpu" = "ppc64" \
1903 -o "$target_cpu" = "ppc64abi32" \
1904 -o "$target_cpu" = "ppcemb" \
1905 -o "$target_cpu" = "sparc" \
1906 -o "$target_cpu" = "sparc64" \
1907 -o "$target_cpu" = "sparc32plus"; then
1908 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1909 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1911 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1912 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1913 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1915 if test "$target_user_only" = "yes" \
1916 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1917 echo "#define USE_NPTL 1" >> $config_h
1919 # 32 bit ELF loader in addition to native 64 bit loader?
1920 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1921 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1922 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1924 if test "$target_bsd_user" = "yes" ; then
1925 echo "CONFIG_BSD_USER=yes" >> $config_mak
1926 echo "#define CONFIG_BSD_USER 1" >> $config_h
1929 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1931 done # for target in $targets
1933 # build tree in object directory if source path is different from current one
1934 if test "$source_path_used" = "yes" ; then
1935 DIRS="tests tests/cris slirp audio"
1936 FILES="Makefile tests/Makefile"
1937 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
1938 FILES="$FILES tests/test-mmap.c"
1939 for dir in $DIRS ; do
1940 mkdir -p $dir
1941 done
1942 # remove the link and recreate it, as not all "ln -sf" overwrite the link
1943 for f in $FILES ; do
1944 rm -f $f
1945 ln -s $source_path/$f $f
1946 done