kvm: external module: adjust for vmx.h and svm.h moving to include/asm
[qemu-kvm/fedora.git] / configure
blobde30a957c71dc09417c629b987de8a7f1b36a416
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"
20 # default parameters
21 prefix=""
22 interp_prefix="/usr/gnemul/qemu-%M"
23 static="no"
24 cross_prefix=""
25 cc="gcc"
26 gcc3_search="yes"
27 gcc3_list="gcc-3.4.6 gcc-3.4 gcc34 gcc-3.3.6 gcc-3.3 gcc33 gcc-3.2 gcc32"
28 audio_drv_list=""
29 audio_card_list=""
30 host_cc="gcc"
31 ar="ar"
32 make="make"
33 install="install"
34 strip="strip"
35 cpu=`uname -m`
36 target_list=""
37 case "$cpu" in
38 i386|i486|i586|i686|i86pc|BePC)
39 cpu="i386"
41 x86_64|amd64)
42 cpu="x86_64"
44 alpha)
45 cpu="alpha"
47 armv*b)
48 cpu="armv4b"
50 armv*l)
51 cpu="armv4l"
53 cris)
54 cpu="cris"
56 parisc|parisc64)
57 cpu="hppa"
59 ia64)
60 cpu="ia64"
62 m68k)
63 cpu="m68k"
65 mips)
66 cpu="mips"
68 mips64)
69 cpu="mips64"
71 "Power Macintosh"|ppc|ppc64)
72 cpu="powerpc"
74 s390*)
75 cpu="s390"
77 sparc|sun4[cdmuv])
78 cpu="sparc"
80 sparc64)
81 cpu="sparc64"
84 cpu="unknown"
86 esac
87 gprof="no"
88 sparse="no"
89 bigendian="no"
90 mingw32="no"
91 EXESUF=""
92 gdbstub="yes"
93 slirp="yes"
94 vde="yes"
95 fmod_lib=""
96 fmod_inc=""
97 oss_lib=""
98 vnc_tls="yes"
99 bsd="no"
100 linux="no"
101 solaris="no"
102 kqemu="no"
103 profiler="no"
104 cocoa="no"
105 check_gfx="yes"
106 check_gcc="yes"
107 softmmu="yes"
108 linux_user="no"
109 darwin_user="no"
110 bsd_user="no"
111 build_docs="no"
112 uname_release=""
113 curses="yes"
114 aio="yes"
115 nptl="yes"
116 mixemu="no"
117 bluez="yes"
118 kvm="yes"
119 kvm_cap_pit="no"
120 kvm_cap_device_assignment="no"
121 kerneldir=""
122 signalfd="no"
123 eventfd="no"
124 cpu_emulation="yes"
125 device_tree_support=""
127 # OS specific
128 targetos=`uname -s`
129 case $targetos in
130 CYGWIN*)
131 mingw32="yes"
132 OS_CFLAGS="-mno-cygwin"
133 if [ "$cpu" = "i386" ] ; then
134 kqemu="yes"
136 audio_possible_drivers="sdl"
138 MINGW32*)
139 mingw32="yes"
140 if [ "$cpu" = "i386" ] ; then
141 kqemu="yes"
143 audio_possible_drivers="dsound sdl fmod"
145 GNU/kFreeBSD)
146 audio_drv_list="oss"
147 audio_possible_drivers="oss sdl esd pa"
148 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
149 kqemu="yes"
152 FreeBSD)
153 bsd="yes"
154 audio_drv_list="oss"
155 audio_possible_drivers="oss sdl esd pa"
156 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
157 kqemu="yes"
158 kvm="yes"
161 NetBSD)
162 bsd="yes"
163 audio_drv_list="oss"
164 audio_possible_drivers="oss sdl esd"
166 OpenBSD)
167 bsd="yes"
168 openbsd="yes"
169 audio_drv_list="oss"
170 audio_possible_drivers="oss sdl esd"
171 oss_lib="-lossaudio"
173 Darwin)
174 bsd="yes"
175 darwin="yes"
176 darwin_user="yes"
177 cocoa="yes"
178 audio_drv_list="coreaudio"
179 audio_possible_drivers="coreaudio sdl fmod"
180 OS_CFLAGS="-mdynamic-no-pic"
181 OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
183 SunOS)
184 solaris="yes"
185 make="gmake"
186 install="ginstall"
187 needs_libsunmath="no"
188 solarisrev=`uname -r | cut -f2 -d.`
189 # have to select again, because `uname -m` returns i86pc
190 # even on an x86_64 box.
191 solariscpu=`isainfo -k`
192 if test "${solariscpu}" = "amd64" ; then
193 cpu="x86_64"
195 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
196 if test "$solarisrev" -le 9 ; then
197 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
198 needs_libsunmath="yes"
199 else
200 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
201 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
202 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
203 echo "Studio 11 can be downloaded from www.sun.com."
204 exit 1
207 if test "$solarisrev" -ge 9 ; then
208 kqemu="yes"
211 if test -f /usr/include/sys/soundcard.h ; then
212 audio_drv_list="oss"
214 audio_possible_drivers="oss sdl"
217 audio_drv_list="oss"
218 audio_possible_drivers="oss alsa sdl esd pa"
219 linux="yes"
220 linux_user="yes"
221 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
222 kqemu="yes"
223 audio_possible_drivers="$audio_possible_drivers fmod"
224 kvm="yes"
226 if [ "$cpu" = "ia64" ] ; then
227 kvm="yes"
228 cpu_emulation="no"
229 gdbstub="no"
230 slirp="no"
232 if [ "$cpu" = "powerpc" ]; then
233 kvm="yes"
236 esac
238 if [ "$bsd" = "yes" ] ; then
239 if [ "$darwin" != "yes" ] ; then
240 make="gmake"
242 bsd_user="yes"
245 # find source path
246 source_path=`dirname "$0"`
247 source_path_used="no"
248 workdir=`pwd`
249 if [ -z "$source_path" ]; then
250 source_path=$workdir
251 else
252 source_path=`cd "$source_path"; pwd`
254 [ -f "$workdir/vl.c" ] || source_path_used="yes"
256 werror="no"
257 # generate compile errors on warnings for development builds
258 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
259 #werror="yes";
262 for opt do
263 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
264 case "$opt" in
265 --help|-h) show_help=yes
267 --prefix=*) prefix="$optarg"
269 --interp-prefix=*) interp_prefix="$optarg"
271 --source-path=*) source_path="$optarg"
272 source_path_used="yes"
274 --cross-prefix=*) cross_prefix="$optarg"
276 --cc=*) cc="$optarg"
277 gcc3_search="no"
279 --host-cc=*) host_cc="$optarg"
281 --make=*) make="$optarg"
283 --install=*) install="$optarg"
285 --extra-cflags=*) CFLAGS="$optarg"
287 --extra-ldflags=*) LDFLAGS="$optarg"
289 --cpu=*) cpu="$optarg"
291 --target-list=*) target_list="$optarg"
293 --enable-gprof) gprof="yes"
295 --static) static="yes"
297 --disable-sdl) sdl="no"
299 --fmod-lib=*) fmod_lib="$optarg"
301 --fmod-inc=*) fmod_inc="$optarg"
303 --oss-lib=*) oss_lib="$optarg"
305 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
307 --audio-drv-list=*) audio_drv_list="$optarg"
309 --enable-sparse) sparse="yes"
311 --disable-sparse) sparse="no"
313 --disable-vnc-tls) vnc_tls="no"
315 --disable-slirp) slirp="no"
317 --disable-vde) vde="no"
319 --disable-kqemu) kqemu="no"
321 --disable-brlapi) brlapi="no"
323 --disable-bluez) bluez="no"
325 --disable-kvm) kvm="no"
327 --enable-profiler) profiler="yes"
329 --enable-cocoa)
330 cocoa="yes" ;
331 sdl="no" ;
332 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
334 --disable-gfx-check) check_gfx="no"
336 --disable-gcc-check) check_gcc="no"
338 --disable-system) softmmu="no"
340 --enable-system) softmmu="yes"
342 --disable-linux-user) linux_user="no"
344 --enable-linux-user) linux_user="yes"
346 --disable-darwin-user) darwin_user="no"
348 --enable-darwin-user) darwin_user="yes"
350 --disable-bsd-user) bsd_user="no"
352 --enable-bsd-user) bsd_user="yes"
354 --enable-uname-release=*) uname_release="$optarg"
356 --sparc_cpu=*)
357 sparc_cpu="$optarg"
358 case $sparc_cpu in
359 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
360 target_cpu="sparc"; cpu="sparc" ;;
361 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
362 target_cpu="sparc"; cpu="sparc" ;;
363 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
364 target_cpu="sparc64"; cpu="sparc64" ;;
365 *) echo "undefined SPARC architecture. Exiting";exit 1;;
366 esac
368 --enable-werror) werror="yes"
370 --disable-werror) werror="no"
372 --disable-curses) curses="no"
374 --disable-nptl) nptl="no"
376 --enable-mixemu) mixemu="yes"
378 --disable-aio) aio="no"
380 --kerneldir=*) kerneldir="$optarg"
382 --disable-cpu-emulation) cpu_emulation="no"
384 --disable-libfdt) device_tree_support="no"
386 *) echo "ERROR: unknown option $opt"; exit 1
388 esac
389 done
391 # default flags for all hosts
392 CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
393 CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings"
394 LDFLAGS="$LDFLAGS -g"
395 if test "$werror" = "yes" ; then
396 CFLAGS="$CFLAGS -Werror"
399 if test "$solaris" = "no" ; then
400 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
401 LDFLAGS="$LDFLAGS -Wl,--warn-common"
406 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
407 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
409 case "$cpu" in
410 sparc) if test -z "$sparc_cpu" ; then
411 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
412 ARCH_LDFLAGS="-m32"
413 else
414 ARCH_CFLAGS="${SP_CFLAGS}"
415 ARCH_LDFLAGS="${SP_LDFLAGS}"
418 sparc64) if test -z "$sparc_cpu" ; then
419 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
420 ARCH_LDFLAGS="-m64"
421 else
422 ARCH_CFLAGS="${SP_CFLAGS}"
423 ARCH_LDFLAGS="${SP_LDFLAGS}"
426 s390)
427 ARCH_CFLAGS="-march=z900"
429 i386)
430 ARCH_CFLAGS="-m32"
431 ARCH_LDFLAGS="-m32"
433 x86_64)
434 ARCH_CFLAGS="-m64"
435 ARCH_LDFLAGS="-m64"
437 esac
439 if test x"$show_help" = x"yes" ; then
440 cat << EOF
442 Usage: configure [options]
443 Options: [defaults in brackets after descriptions]
446 echo "Standard options:"
447 echo " --help print this message"
448 echo " --prefix=PREFIX install in PREFIX [$prefix]"
449 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
450 echo " use %M for cpu name [$interp_prefix]"
451 echo " --target-list=LIST set target list [$target_list]"
452 echo ""
453 echo "kqemu kernel acceleration support:"
454 echo " --disable-kqemu disable kqemu support"
455 echo ""
456 echo "Advanced options (experts only):"
457 echo " --source-path=PATH path of source code [$source_path]"
458 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
459 echo " --cc=CC use C compiler CC [$cc]"
460 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
461 echo " --make=MAKE use specified make [$make]"
462 echo " --install=INSTALL use specified install [$install]"
463 echo " --static enable static build [$static]"
464 echo " --enable-sparse enable sparse checker"
465 echo " --disable-sparse disable sparse checker (default)"
466 echo " --disable-werror disable compilation abort on warning"
467 echo " --disable-sdl disable SDL"
468 echo " --enable-cocoa enable COCOA (Mac OS X only)"
469 echo " --audio-drv-list=LIST set audio drivers list:"
470 echo " Available drivers: $audio_possible_drivers"
471 echo " --audio-card-list=LIST set list of additional emulated audio cards"
472 echo " Available cards: ac97 adlib cs4231a gus"
473 echo " --enable-mixemu enable mixer emulation"
474 echo " --disable-brlapi disable BrlAPI"
475 echo " --disable-vnc-tls disable TLS encryption for VNC server"
476 echo " --disable-curses disable curses output"
477 echo " --disable-bluez disable bluez stack connectivity"
478 echo " --disable-kvm disable KVM acceleration support"
479 echo " --disable-nptl disable usermode NPTL support"
480 echo " --enable-system enable all system emulation targets"
481 echo " --disable-system disable all system emulation targets"
482 echo " --enable-linux-user enable all linux usermode emulation targets"
483 echo " --disable-linux-user disable all linux usermode emulation targets"
484 echo " --enable-darwin-user enable all darwin usermode emulation targets"
485 echo " --disable-darwin-user disable all darwin usermode emulation targets"
486 echo " --enable-bsd-user enable all BSD usermode emulation targets"
487 echo " --disable-bsd-user disable all BSD usermode emulation targets"
488 echo " --fmod-lib path to FMOD library"
489 echo " --fmod-inc path to FMOD includes"
490 echo " --oss-lib path to OSS library"
491 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
492 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
493 echo " --disable-vde disable support for vde network"
494 echo " --disable-aio disable AIO support"
495 echo " --kerneldir=PATH look for kernel includes in PATH"
496 echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
497 echo " --disable-libfdt disables use of libfdt support for device tree"
498 echo ""
499 echo "NOTE: The object files are built at the place where configure is launched"
500 exit 1
503 cc="${cross_prefix}${cc}"
504 ar="${cross_prefix}${ar}"
505 strip="${cross_prefix}${strip}"
507 # check that the C compiler works.
508 cat > $TMPC <<EOF
509 int main(void) {}
512 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then
513 : C compiler works ok
514 else
515 echo "ERROR: \"$cc\" either does not exist or does not work"
516 exit 1
519 # check compiler to see if we're on mingw32
520 cat > $TMPC <<EOF
521 #include <windows.h>
522 #ifndef _WIN32
523 #error not windows
524 #endif
525 int main(void) {}
528 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then
529 mingw32="yes"
532 if test "$mingw32" = "yes" ; then
533 linux="no"
534 EXESUF=".exe"
535 oss="no"
536 linux_user="no"
537 bsd_user="no"
540 if [ "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
541 AIOLIBS=
542 elif [ "$bsd" = "yes" ]; then
543 AIOLIBS="-lpthread"
544 else
545 # Some Linux architectures (e.g. s390) don't imply -lpthread automatically.
546 AIOLIBS="-lrt -lpthread"
549 # Check for gcc4, error if pre-gcc4
550 if test "$check_gcc" = "yes" ; then
551 cat > $TMPC <<EOF
552 #if __GNUC__ < 4
553 #error gcc3
554 #endif
555 int main(){return 0;}
557 if "$cc" $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
558 echo "WARNING: \"$cc\" looks like gcc 4.x"
559 found_compat_cc="no"
560 if test "$gcc3_search" = "yes" ; then
561 echo "Looking for gcc 3.x"
562 for compat_cc in $gcc3_list ; do
563 if "$cross_prefix$compat_cc" --version 2> /dev/null | fgrep '(GCC) 3.' > /dev/null 2>&1 ; then
564 echo "Found \"$compat_cc\""
565 cc="$cross_prefix$compat_cc"
566 found_compat_cc="yes"
567 break
569 done
570 if test "$found_compat_cc" = "no" ; then
571 echo "gcc 3.x not found!"
574 if test "$found_compat_cc" = "no" ; then
575 echo "QEMU is known to have problems when compiled with gcc 4.x"
576 echo "It is recommended that you use gcc 3.x to build QEMU"
577 echo "To use this compiler anyway, configure with --disable-gcc-check"
578 exit 1;
583 if test ! -x "$(which cgcc 2>/dev/null)"; then
584 sparse="no"
588 # Solaris specific configure tool chain decisions
590 if test "$solaris" = "yes" ; then
592 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
593 # override the check with --disable-gcc-check
595 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
596 solgcc=`which $cc`
597 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
598 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
599 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
600 echo "or get the latest patch from SunSolve for gcc"
601 exit 1
604 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
605 if test -z "$solinst" ; then
606 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
607 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
608 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
609 exit 1
611 if test "$solinst" = "/usr/sbin/install" ; then
612 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
613 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
614 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
615 exit 1
617 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
618 if test -z "$sol_ar" ; then
619 echo "Error: No path includes ar"
620 if test -f /usr/ccs/bin/ar ; then
621 echo "Add /usr/ccs/bin to your path and rerun configure"
623 exit 1
628 if test -z "$target_list" ; then
629 # these targets are portable
630 if [ "$softmmu" = "yes" ] ; then
631 target_list="\
632 i386-softmmu \
633 x86_64-softmmu \
634 arm-softmmu \
635 cris-softmmu \
636 m68k-softmmu \
637 mips-softmmu \
638 mipsel-softmmu \
639 mips64-softmmu \
640 mips64el-softmmu \
641 ppc-softmmu \
642 ppcemb-softmmu \
643 ppc64-softmmu \
644 sh4-softmmu \
645 sh4eb-softmmu \
646 sparc-softmmu \
649 # the following are Linux specific
650 if [ "$linux_user" = "yes" ] ; then
651 target_list="${target_list}\
652 i386-linux-user \
653 x86_64-linux-user \
654 alpha-linux-user \
655 arm-linux-user \
656 armeb-linux-user \
657 cris-linux-user \
658 m68k-linux-user \
659 mips-linux-user \
660 mipsel-linux-user \
661 ppc-linux-user \
662 ppc64-linux-user \
663 ppc64abi32-linux-user \
664 sh4-linux-user \
665 sh4eb-linux-user \
666 sparc-linux-user \
667 sparc64-linux-user \
668 sparc32plus-linux-user \
671 # the following are Darwin specific
672 if [ "$darwin_user" = "yes" ] ; then
673 target_list="$target_list i386-darwin-user ppc-darwin-user"
675 # the following are BSD specific
676 if [ "$bsd_user" = "yes" ] ; then
677 target_list="${target_list}\
678 sparc64-bsd-user \
681 else
682 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
684 if test -z "$target_list" ; then
685 echo "No targets enabled"
686 exit 1
689 if test -z "$cross_prefix" ; then
691 # ---
692 # big/little endian test
693 cat > $TMPC << EOF
694 #include <inttypes.h>
695 int main(int argc, char ** argv){
696 volatile uint32_t i=0x01234567;
697 return (*((uint8_t*)(&i))) == 0x67;
701 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
702 $TMPE && bigendian="yes"
703 else
704 echo big/little test failed
707 else
709 # if cross compiling, cannot launch a program, so make a static guess
710 if test "$cpu" = "armv4b" \
711 -o "$cpu" = "hppa" \
712 -o "$cpu" = "m68k" \
713 -o "$cpu" = "mips" \
714 -o "$cpu" = "mips64" \
715 -o "$cpu" = "powerpc" \
716 -o "$cpu" = "s390" \
717 -o "$cpu" = "sparc" \
718 -o "$cpu" = "sparc64"; then
719 bigendian="yes"
724 # host long bits test
725 hostlongbits="32"
726 if test "$cpu" = "x86_64" \
727 -o "$cpu" = "alpha" \
728 -o "$cpu" = "ia64" \
729 -o "$cpu" = "sparc64"; then
730 hostlongbits="64"
733 # ppc specific hostlongbits selection
734 if test "$cpu" = "powerpc" ; then
735 if $cc $ARCH_CFLAGS -dM -E - -o $TMPI 2>/dev/null </dev/null; then
736 grep -q __powerpc64__ $TMPI && hostlongbits=64
737 else
738 echo hostlongbits test failed
739 exit 1
743 # check gcc options support
744 cat > $TMPC <<EOF
745 int main(void) {
749 # Check host NPTL support
750 cat > $TMPC <<EOF
751 #include <sched.h>
752 #include <linux/futex.h>
753 void foo()
755 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
756 #error bork
757 #endif
761 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then
763 else
764 nptl="no"
767 ##########################################
768 # KVM probe
770 if test "$kvm" = "yes" ; then
772 # test for KVM_CAP_PIT
774 cat > $TMPC <<EOF
775 #include <libkvm.h>
776 #ifndef KVM_CAP_PIT
777 #error "kvm no pit capability"
778 #endif
779 int main(void) { return 0; }
781 if $cc $ARCH_CFLAGS $CFLAGS -I"$kerneldir"/include -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev/null ; then
782 kvm_cap_pit="yes"
785 # test for KVM_CAP_DEVICE_ASSIGNMENT
787 cat > $TMPC <<EOF
788 #include <libkvm.h>
789 #ifndef KVM_CAP_DEVICE_ASSIGNMENT
790 #error "kvm no device assignment capability"
791 #endif
792 int main(void) { return 0; }
794 if $cc $ARCH_CFLAGS $CFLAGS -I"$kerneldir"/include -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev/null ; then
795 kvm_cap_device_assignment="yes"
799 ##########################################
800 # zlib check
802 cat > $TMPC << EOF
803 #include <zlib.h>
804 int main(void) { zlibVersion(); return 0; }
806 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz 2> /dev/null ; then
808 else
809 echo
810 echo "Error: zlib check failed"
811 echo "Make sure to have the zlib libs and headers installed."
812 echo
813 exit 1
816 ##########################################
817 # SDL probe
819 sdl_too_old=no
821 if test -z "$sdl" ; then
822 sdl_config="sdl-config"
823 sdl=no
824 sdl_static=no
826 cat > $TMPC << EOF
827 #include <SDL.h>
828 #undef main /* We don't want SDL to override our main() */
829 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
831 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /tmp/qemu-$$-sdl-config.log ; then
832 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
833 if test "$_sdlversion" -lt 121 ; then
834 sdl_too_old=yes
835 else
836 if test "$cocoa" = "no" ; then
837 sdl=yes
841 # static link with sdl ?
842 if test "$sdl" = "yes" ; then
843 aa="no"
844 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
845 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
846 if [ "$aa" = "yes" ] ; then
847 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
850 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
851 sdl_static=yes
853 fi # static link
854 fi # sdl compile test
855 else
856 # Make sure to disable cocoa if sdl was set
857 if test "$sdl" = "yes" ; then
858 cocoa="no"
859 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
861 fi # -z $sdl
863 ##########################################
864 # VNC TLS detection
865 if test "$vnc_tls" = "yes" ; then
866 cat > $TMPC <<EOF
867 #include <gnutls/gnutls.h>
868 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
870 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
871 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
872 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
873 $vnc_tls_libs 2> /dev/null ; then
875 else
876 vnc_tls="no"
880 ##########################################
881 # vde libraries probe
882 if test "$vde" = "yes" ; then
883 cat > $TMPC << EOF
884 #include <libvdeplug.h>
885 int main(void)
887 struct vde_open_args a = {0, 0, 0};
888 vde_open("", "", &a);
889 return 0;
892 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug 2> /dev/null ; then
894 else
895 vde="no"
899 ##########################################
900 # Sound support libraries probe
902 audio_drv_probe()
904 drv=$1
905 hdr=$2
906 lib=$3
907 exp=$4
908 cfl=$5
909 cat > $TMPC << EOF
910 #include <$hdr>
911 int main(void) { $exp }
913 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib 2> /dev/null ; then
915 else
916 echo
917 echo "Error: $drv check failed"
918 echo "Make sure to have the $drv libs and headers installed."
919 echo
920 exit 1
924 audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
925 for drv in $audio_drv_list; do
926 case $drv in
927 alsa)
928 audio_drv_probe $drv alsa/asoundlib.h -lasound \
929 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
932 fmod)
933 if test -z $fmod_lib || test -z $fmod_inc; then
934 echo
935 echo "Error: You must specify path to FMOD library and headers"
936 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
937 echo
938 exit 1
940 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
943 esd)
944 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
948 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
949 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
952 oss|sdl|core|wav|dsound)
953 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
957 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
958 echo
959 echo "Error: Unknown driver '$drv' selected"
960 echo "Possible drivers are: $audio_possible_drivers"
961 echo
962 exit 1
965 esac
966 done
968 ##########################################
969 # BrlAPI probe
971 if test -z "$brlapi" ; then
972 brlapi=no
973 cat > $TMPC << EOF
974 #include <brlapi.h>
975 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
977 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi 2> /dev/null ; then
978 brlapi=yes
979 fi # brlapi compile test
980 fi # -z $brlapi
982 ##########################################
983 # curses probe
985 if test "$curses" = "yes" ; then
986 curses=no
987 cat > $TMPC << EOF
988 #include <curses.h>
989 int main(void) { return curses_version(); }
991 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses 2> /dev/null ; then
992 curses=yes
994 fi # test "$curses"
996 ##########################################
997 # bluez support probe
998 if test "$bluez" = "yes" ; then
999 `pkg-config bluez` || bluez="no"
1001 if test "$bluez" = "yes" ; then
1002 cat > $TMPC << EOF
1003 #include <bluetooth/bluetooth.h>
1004 int main(void) { return bt_error(0); }
1006 bluez_cflags=`pkg-config --cflags bluez`
1007 bluez_libs=`pkg-config --libs bluez`
1008 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
1009 $bluez_libs 2> /dev/null ; then
1011 else
1012 bluez="no"
1016 ##########################################
1017 # kvm probe
1018 if test "$kvm" = "yes" ; then
1019 cat > $TMPC <<EOF
1020 #include <linux/kvm.h>
1021 #if !defined(KVM_API_VERSION) || \
1022 KVM_API_VERSION < 12 || \
1023 KVM_API_VERSION > 12 || \
1024 !defined(KVM_CAP_USER_MEMORY) || \
1025 !defined(KVM_CAP_SET_TSS_ADDR)
1026 #error Invalid KVM version
1027 #endif
1028 int main(void) { return 0; }
1030 if test "$kerneldir" != "" ; then
1031 kvm_cflags=-I"$kerneldir"/include
1032 else
1033 kvm_cflags=""
1035 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
1036 2>/dev/null ; then
1038 else
1039 kvm="no"
1043 ##########################################
1044 # AIO probe
1045 if test "$aio" = "yes" ; then
1046 aio=no
1047 cat > $TMPC << EOF
1048 #include <aio.h>
1049 int main(void) { return aio_write(NULL); }
1051 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
1052 aio=yes
1056 ##########################################
1057 # signalfd probe
1058 cat > $TMPC << EOF
1059 #define _GNU_SOURCE
1060 #include <unistd.h>
1061 #include <sys/syscall.h>
1062 #include <signal.h>
1063 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
1066 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1067 signalfd=yes
1070 ##########################################
1071 # eventfd probe
1072 cat > $TMPC << EOF
1073 #define _GNU_SOURCE
1074 #include <unistd.h>
1075 #include <sys/syscall.h>
1076 int main(void) { return syscall(SYS_eventfd, 0); }
1079 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1080 eventfd=yes
1083 # Check if tools are available to build documentation.
1084 if [ -x "`which texi2html 2>/dev/null`" ] && \
1085 [ -x "`which pod2man 2>/dev/null`" ]; then
1086 build_docs="yes"
1089 if test "$mingw32" = "yes" ; then
1090 if test -z "$prefix" ; then
1091 prefix="c:\\\\Program Files\\\\Qemu"
1093 mansuffix=""
1094 datasuffix=""
1095 docsuffix=""
1096 binsuffix=""
1097 else
1098 if test -z "$prefix" ; then
1099 prefix="/usr/local"
1101 mansuffix="/share/man"
1102 datasuffix="/share/qemu"
1103 docsuffix="/share/doc/qemu"
1104 binsuffix="/bin"
1107 ######################################
1108 # libfdt probe
1110 if test -z "$device_tree_support" -a \
1111 "$cpu" = "powerpc"; then
1112 device_tree_support="no"
1113 cat > $TMPC << EOF
1114 #include <libfdt.h>
1115 /* XXX uncomment later when libfdt is built before this test */
1116 //int main(void) { void *fdt; return fdt_create(fdt, 1024); }
1117 int main (void) {return 0;}
1119 # XXX for now do not try to link to libfdt and just check for header */
1120 # if $cc $ARCH_CFLAGS $CFLAGS $LDFLAGS -o $TMPE $TMPC -lfdt 2> /dev/null ; then
1121 if $cc $ARCH_CFLAGS $CFLAGS $LDFLAGS -o $TMPE $TMPC 2> /dev/null; then
1122 device_tree_support="yes"
1123 else
1124 echo
1125 echo "Error: Could not find libfdt"
1126 echo "Make sure to have the libfdt libs and headers installed."
1127 echo
1128 exit 1
1132 echo "Install prefix $prefix"
1133 echo "BIOS directory $prefix$datasuffix"
1134 echo "binary directory $prefix$binsuffix"
1135 if test "$mingw32" = "no" ; then
1136 echo "Manual directory $prefix$mansuffix"
1137 echo "ELF interp prefix $interp_prefix"
1139 echo "Source path $source_path"
1140 echo "C compiler $cc"
1141 echo "Host C compiler $host_cc"
1142 echo "ARCH_CFLAGS $ARCH_CFLAGS"
1143 echo "make $make"
1144 echo "install $install"
1145 echo "host CPU $cpu"
1146 echo "host big endian $bigendian"
1147 echo "target list $target_list"
1148 echo "gprof enabled $gprof"
1149 echo "sparse enabled $sparse"
1150 echo "profiler $profiler"
1151 echo "static build $static"
1152 echo "-Werror enabled $werror"
1153 if test "$darwin" = "yes" ; then
1154 echo "Cocoa support $cocoa"
1156 echo "SDL support $sdl"
1157 if test "$sdl" != "no" ; then
1158 echo "SDL static link $sdl_static"
1160 echo "curses support $curses"
1161 echo "mingw32 support $mingw32"
1162 echo "Audio drivers $audio_drv_list"
1163 echo "Extra audio cards $audio_card_list"
1164 echo "Mixer emulation $mixemu"
1165 echo "VNC TLS support $vnc_tls"
1166 if test "$vnc_tls" = "yes" ; then
1167 echo " TLS CFLAGS $vnc_tls_cflags"
1168 echo " TLS LIBS $vnc_tls_libs"
1170 if test -n "$sparc_cpu"; then
1171 echo "Target Sparc Arch $sparc_cpu"
1173 echo "kqemu support $kqemu"
1174 echo "kvm support $kvm"
1175 echo "CPU emulation $cpu_emulation"
1176 if test $cpu = "powerpc"; then
1177 echo "libfdt support $device_tree_support"
1179 echo "brlapi support $brlapi"
1180 echo "Documentation $build_docs"
1181 [ ! -z "$uname_release" ] && \
1182 echo "uname -r $uname_release"
1183 echo "NPTL support $nptl"
1184 echo "vde support $vde"
1185 echo "AIO support $aio"
1186 echo "KVM support $kvm"
1188 if test $sdl_too_old = "yes"; then
1189 echo "-> Your SDL version is too old - please upgrade to have SDL support"
1191 if [ -s /tmp/qemu-$$-sdl-config.log ]; then
1192 echo "The error log from compiling the libSDL test is: "
1193 cat /tmp/qemu-$$-sdl-config.log
1195 rm -f /tmp/qemu-$$-sdl-config.log
1196 #if test "$sdl_static" = "no"; then
1197 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1199 config_mak="config-host.mak"
1200 config_h="config-host.h"
1202 #echo "Creating $config_mak and $config_h"
1204 test -f $config_h && mv $config_h ${config_h}~
1206 echo "# Automatically generated by configure - do not modify" > $config_mak
1207 echo "# Configured with: $0 $@" >> $config_mak
1208 echo "/* Automatically generated by configure - do not modify */" > $config_h
1210 echo "prefix=$prefix" >> $config_mak
1211 echo "bindir=\${prefix}$binsuffix" >> $config_mak
1212 echo "mandir=\${prefix}$mansuffix" >> $config_mak
1213 echo "datadir=\${prefix}$datasuffix" >> $config_mak
1214 echo "docdir=\${prefix}$docsuffix" >> $config_mak
1215 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
1216 echo "MAKE=$make" >> $config_mak
1217 echo "INSTALL=$install" >> $config_mak
1218 echo "CC=$cc" >> $config_mak
1219 echo "HOST_CC=$host_cc" >> $config_mak
1220 echo "AR=$ar" >> $config_mak
1221 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
1222 # XXX: only use CFLAGS and LDFLAGS ?
1223 # XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1224 # compilation of dyngen tool (useful for win32 build on Linux host)
1225 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
1226 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1227 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1228 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
1229 echo "CFLAGS=$CFLAGS" >> $config_mak
1230 echo "LDFLAGS=$LDFLAGS" >> $config_mak
1231 echo "EXESUF=$EXESUF" >> $config_mak
1232 echo "AIOLIBS=$AIOLIBS" >> $config_mak
1233 case "$cpu" in
1234 i386)
1235 echo "ARCH=i386" >> $config_mak
1236 echo "#define HOST_I386 1" >> $config_h
1238 x86_64)
1239 echo "ARCH=x86_64" >> $config_mak
1240 echo "#define HOST_X86_64 1" >> $config_h
1242 alpha)
1243 echo "ARCH=alpha" >> $config_mak
1244 echo "#define HOST_ALPHA 1" >> $config_h
1246 armv4b)
1247 echo "ARCH=arm" >> $config_mak
1248 echo "#define HOST_ARM 1" >> $config_h
1250 armv4l)
1251 echo "ARCH=arm" >> $config_mak
1252 echo "#define HOST_ARM 1" >> $config_h
1254 cris)
1255 echo "ARCH=cris" >> $config_mak
1256 echo "#define HOST_CRIS 1" >> $config_h
1258 hppa)
1259 echo "ARCH=hppa" >> $config_mak
1260 echo "#define HOST_HPPA 1" >> $config_h
1262 ia64)
1263 echo "ARCH=ia64" >> $config_mak
1264 echo "#define HOST_IA64 1" >> $config_h
1266 m68k)
1267 echo "ARCH=m68k" >> $config_mak
1268 echo "#define HOST_M68K 1" >> $config_h
1270 mips)
1271 echo "ARCH=mips" >> $config_mak
1272 echo "#define HOST_MIPS 1" >> $config_h
1274 mips64)
1275 echo "ARCH=mips64" >> $config_mak
1276 echo "#define HOST_MIPS64 1" >> $config_h
1278 powerpc)
1279 if test "$hostlongbits" = "32"; then
1280 echo "ARCH=ppc" >> $config_mak
1281 echo "#define HOST_PPC 1" >> $config_h
1282 else
1283 echo "ARCH=ppc64" >> $config_mak
1284 echo "#define HOST_PPC64 1" >> $config_h
1287 s390)
1288 echo "ARCH=s390" >> $config_mak
1289 echo "#define HOST_S390 1" >> $config_h
1291 sparc)
1292 echo "ARCH=sparc" >> $config_mak
1293 echo "#define HOST_SPARC 1" >> $config_h
1295 sparc64)
1296 echo "ARCH=sparc64" >> $config_mak
1297 echo "#define HOST_SPARC64 1" >> $config_h
1300 echo "Unsupported CPU = $cpu"
1301 exit 1
1303 esac
1304 if test "$sparse" = "yes" ; then
1305 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1306 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1307 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1309 if test "$bigendian" = "yes" ; then
1310 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1311 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1313 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
1314 if test "$mingw32" = "yes" ; then
1315 echo "CONFIG_WIN32=yes" >> $config_mak
1316 echo "#define CONFIG_WIN32 1" >> $config_h
1317 else
1318 cat > $TMPC << EOF
1319 #include <byteswap.h>
1320 int main(void) { return bswap_32(0); }
1322 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1323 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1327 if [ "$openbsd" = "yes" ] ; then
1328 echo "#define ENOTSUP 4096" >> $config_h
1331 if test "$darwin" = "yes" ; then
1332 echo "CONFIG_DARWIN=yes" >> $config_mak
1333 echo "#define CONFIG_DARWIN 1" >> $config_h
1335 if test "$solaris" = "yes" ; then
1336 echo "CONFIG_SOLARIS=yes" >> $config_mak
1337 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
1338 if test "$needs_libsunmath" = "yes" ; then
1339 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1340 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1343 if test -n "$sparc_cpu"; then
1344 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1345 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1347 if test "$gdbstub" = "yes" ; then
1348 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1349 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1351 if test "$gprof" = "yes" ; then
1352 echo "TARGET_GPROF=yes" >> $config_mak
1353 echo "#define HAVE_GPROF 1" >> $config_h
1355 if test "$static" = "yes" ; then
1356 echo "CONFIG_STATIC=yes" >> $config_mak
1357 echo "#define CONFIG_STATIC 1" >> $config_h
1359 if test $profiler = "yes" ; then
1360 echo "#define CONFIG_PROFILER 1" >> $config_h
1362 if test "$slirp" = "yes" ; then
1363 echo "CONFIG_SLIRP=yes" >> $config_mak
1364 echo "#define CONFIG_SLIRP 1" >> $config_h
1366 if test "$vde" = "yes" ; then
1367 echo "CONFIG_VDE=yes" >> $config_mak
1368 echo "#define CONFIG_VDE 1" >> $config_h
1369 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1371 for card in $audio_card_list; do
1372 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
1373 echo "$def=yes" >> $config_mak
1374 echo "#define $def 1" >> $config_h
1375 done
1376 echo "#define AUDIO_DRIVERS \\" >> $config_h
1377 for drv in $audio_drv_list; do
1378 echo " &${drv}_audio_driver, \\" >>$config_h
1379 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
1380 echo "$def=yes" >> $config_mak
1381 if test "$drv" = "fmod"; then
1382 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1383 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1384 elif test "$drv" = "oss"; then
1385 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
1387 done
1388 echo "" >>$config_h
1389 if test "$mixemu" = "yes" ; then
1390 echo "CONFIG_MIXEMU=yes" >> $config_mak
1391 echo "#define CONFIG_MIXEMU 1" >> $config_h
1393 if test "$vnc_tls" = "yes" ; then
1394 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1395 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1396 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1397 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1399 qemu_version=`head $source_path/VERSION`
1400 echo "VERSION=$qemu_version" >>$config_mak
1401 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1402 echo "#define KVM_VERSION \"kvm-devel\"" >> $config_h
1404 echo "SRC_PATH=$source_path" >> $config_mak
1405 if [ "$source_path_used" = "yes" ]; then
1406 echo "VPATH=$source_path" >> $config_mak
1408 echo "TARGET_DIRS=$target_list" >> $config_mak
1409 if [ "$build_docs" = "yes" ] ; then
1410 echo "BUILD_DOCS=yes" >> $config_mak
1412 if test "$static" = "yes"; then
1413 sdl1=$sdl_static
1414 else
1415 sdl1=$sdl
1417 if test "$sdl1" = "yes" ; then
1418 echo "#define CONFIG_SDL 1" >> $config_h
1419 echo "CONFIG_SDL=yes" >> $config_mak
1420 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1421 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1422 else
1423 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1425 if [ "${aa}" = "yes" ] ; then
1426 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1427 else
1428 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1431 if test "$cocoa" = "yes" ; then
1432 echo "#define CONFIG_COCOA 1" >> $config_h
1433 echo "CONFIG_COCOA=yes" >> $config_mak
1435 if test "$curses" = "yes" ; then
1436 echo "#define CONFIG_CURSES 1" >> $config_h
1437 echo "CONFIG_CURSES=yes" >> $config_mak
1438 echo "CURSES_LIBS=-lcurses" >> $config_mak
1440 if test "$brlapi" = "yes" ; then
1441 echo "CONFIG_BRLAPI=yes" >> $config_mak
1442 echo "#define CONFIG_BRLAPI 1" >> $config_h
1443 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1445 if test "$bluez" = "yes" ; then
1446 echo "CONFIG_BLUEZ=yes" >> $config_mak
1447 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1448 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1449 echo "#define CONFIG_BLUEZ 1" >> $config_h
1451 if test "$aio" = "yes" ; then
1452 echo "#define CONFIG_AIO 1" >> $config_h
1453 echo "CONFIG_AIO=yes" >> $config_mak
1455 if test "$signalfd" = "yes" ; then
1456 echo "#define CONFIG_signalfd 1" >> $config_h
1458 if test "$eventfd" = "yes" ; then
1459 echo "#define CONFIG_eventfd 1" >> $config_h
1462 # XXX: suppress that
1463 if [ "$bsd" = "yes" ] ; then
1464 echo "#define O_LARGEFILE 0" >> $config_h
1465 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1466 echo "#define _BSD 1" >> $config_h
1469 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1471 tools=
1472 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1473 tools="qemu-img\$(EXESUF) $tools"
1474 if [ "$linux" = "yes" ] ; then
1475 tools="qemu-nbd\$(EXESUF) $tools"
1478 echo "TOOLS=$tools" >> $config_mak
1480 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1482 for target in $target_list; do
1483 target_dir="$target"
1484 config_mak=$target_dir/config.mak
1485 config_h=$target_dir/config.h
1486 target_cpu=`echo $target | cut -d '-' -f 1`
1487 target_bigendian="no"
1488 [ "$target_cpu" = "armeb" ] && target_bigendian=yes
1489 [ "$target_cpu" = "m68k" ] && target_bigendian=yes
1490 [ "$target_cpu" = "mips" ] && target_bigendian=yes
1491 [ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1492 [ "$target_cpu" = "mips64" ] && target_bigendian=yes
1493 [ "$target_cpu" = "ppc" ] && target_bigendian=yes
1494 [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
1495 [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
1496 [ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
1497 [ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
1498 [ "$target_cpu" = "sparc" ] && target_bigendian=yes
1499 [ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1500 [ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
1501 target_softmmu="no"
1502 target_user_only="no"
1503 target_linux_user="no"
1504 target_darwin_user="no"
1505 target_bsd_user="no"
1506 case "$target" in
1507 ${target_cpu}-softmmu)
1508 target_softmmu="yes"
1510 ${target_cpu}-linux-user)
1511 target_user_only="yes"
1512 target_linux_user="yes"
1514 ${target_cpu}-darwin-user)
1515 target_user_only="yes"
1516 target_darwin_user="yes"
1518 ${target_cpu}-bsd-user)
1519 target_user_only="yes"
1520 target_bsd_user="yes"
1523 echo "ERROR: Target '$target' not recognised"
1524 exit 1
1526 esac
1528 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1529 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1530 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1531 echo "To build QEMU without graphical output configure with --disable-gfx-check"
1532 echo "Note that this will disable all output from the virtual graphics card"
1533 echo "except through VNC or curses."
1534 exit 1;
1537 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1539 test -f $config_h && mv $config_h ${config_h}~
1541 mkdir -p $target_dir
1542 mkdir -p $target_dir/fpu
1543 mkdir -p $target_dir/tcg
1544 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
1545 mkdir -p $target_dir/nwfpe
1549 # don't use ln -sf as not all "ln -sf" over write the file/link
1551 rm -f $target_dir/Makefile
1552 ln -s $source_path/Makefile.target $target_dir/Makefile
1555 echo "# Automatically generated by configure - do not modify" > $config_mak
1556 echo "/* Automatically generated by configure - do not modify */" > $config_h
1559 echo "include ../config-host.mak" >> $config_mak
1560 echo "#include \"../config-host.h\"" >> $config_h
1562 bflt="no"
1563 elfload32="no"
1564 target_nptl="no"
1565 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1566 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1567 gdb_xml_files=""
1569 disable_cpu_emulation() {
1570 if test $cpu_emulation = "no"; then
1571 echo "#define NO_CPU_EMULATION 1" >> $config_h
1572 echo "NO_CPU_EMULATION=1" >> $config_mak
1576 configure_kvm() {
1577 if test $kvm = "yes" -a "$target_softmmu" = "yes" -a \
1578 \( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \); then
1579 echo "#define USE_KVM 1" >> $config_h
1580 echo "USE_KVM=1" >> $config_mak
1581 echo "CONFIG_KVM_KERNEL_INC=$kerneldir/include" >> $config_mak
1582 if test $kvm_cap_pit = "yes" ; then
1583 echo "USE_KVM_PIT=1" >> $config_mak
1584 echo "#define USE_KVM_PIT 1" >> $config_h
1586 if test $kvm_cap_device_assignment = "yes" ; then
1587 echo "USE_KVM_DEVICE_ASSIGNMENT=1" >> $config_mak
1588 echo "#define USE_KVM_DEVICE_ASSIGNMENT 1" >> $config_h
1590 disable_cpu_emulation
1594 if [ use_upstream_kvm = yes ]; then
1596 # Make sure the target and host cpus are compatible
1597 if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
1598 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1599 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
1600 kvm="no"
1602 # Disable KVM for linux-user
1603 if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1604 kvm="no"
1609 case "$target_cpu" in
1610 i386)
1611 echo "TARGET_ARCH=i386" >> $config_mak
1612 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1613 echo "#define TARGET_I386 1" >> $config_h
1614 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
1615 then
1616 echo "#define USE_KQEMU 1" >> $config_h
1618 if test "$kvm" = "yes" ; then
1619 echo "CONFIG_KVM=yes" >> $config_mak
1620 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1621 echo "#define CONFIG_KVM 1" >> $config_h
1623 gcc3minver=`$cc --version 2> /dev/null| fgrep "(GCC) 3." | awk '{ print $3 }' | cut -f2 -d.`
1624 if test -n "$gcc3minver" && test $gcc3minver -gt 3
1625 then
1626 echo "HAVE_GT_GCC_3_3=true" >> $config_mak
1627 else
1628 echo "HAVE_GT_GCC_3_3=false" >> $config_mak
1630 configure_kvm
1632 x86_64)
1633 echo "TARGET_ARCH=x86_64" >> $config_mak
1634 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1635 echo "#define TARGET_I386 1" >> $config_h
1636 echo "#define TARGET_X86_64 1" >> $config_h
1637 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1638 then
1639 echo "#define USE_KQEMU 1" >> $config_h
1641 configure_kvm
1643 ia64)
1644 echo "TARGET_ARCH=ia64" >> $config_mak
1645 echo "#define TARGET_ARCH \"ia64\"" >> $config_h
1646 echo "#define TARGET_IA64 1" >> $config_h
1647 configure_kvm
1648 if [ use_upstream_kvm = yes ]; then
1649 if test "$kvm" = "yes" ; then
1650 echo "CONFIG_KVM=yes" >> $config_mak
1651 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1652 echo "#define CONFIG_KVM 1" >> $config_h
1656 alpha)
1657 echo "TARGET_ARCH=alpha" >> $config_mak
1658 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1659 echo "#define TARGET_ALPHA 1" >> $config_h
1661 arm|armeb)
1662 echo "TARGET_ARCH=arm" >> $config_mak
1663 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1664 echo "#define TARGET_ARM 1" >> $config_h
1665 bflt="yes"
1666 target_nptl="yes"
1667 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
1669 cris)
1670 echo "TARGET_ARCH=cris" >> $config_mak
1671 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1672 echo "#define TARGET_CRIS 1" >> $config_h
1674 m68k)
1675 echo "TARGET_ARCH=m68k" >> $config_mak
1676 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1677 echo "#define TARGET_M68K 1" >> $config_h
1678 bflt="yes"
1679 gdb_xml_files="cf-core.xml cf-fp.xml"
1681 mips|mipsel)
1682 echo "TARGET_ARCH=mips" >> $config_mak
1683 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1684 echo "#define TARGET_MIPS 1" >> $config_h
1685 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1687 mipsn32|mipsn32el)
1688 echo "TARGET_ARCH=mipsn32" >> $config_mak
1689 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1690 echo "#define TARGET_MIPS 1" >> $config_h
1691 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1693 mips64|mips64el)
1694 echo "TARGET_ARCH=mips64" >> $config_mak
1695 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1696 echo "#define TARGET_MIPS 1" >> $config_h
1697 echo "#define TARGET_MIPS64 1" >> $config_h
1698 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1700 ppc)
1701 echo "TARGET_ARCH=ppc" >> $config_mak
1702 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1703 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1704 echo "#define TARGET_PPC 1" >> $config_h
1705 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1707 ppcemb)
1708 echo "TARGET_ARCH=ppcemb" >> $config_mak
1709 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1710 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1711 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1712 echo "#define TARGET_PPC 1" >> $config_h
1713 echo "#define TARGET_PPCEMB 1" >> $config_h
1714 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1715 if test "$device_tree_support" = "yes" ; then
1716 echo "#define CONFIG_LIBFDT 1" >> $config_h
1717 echo "CONFIG_LIBFDT=1" >> $config_mak
1719 configure_kvm
1721 ppc64)
1722 echo "TARGET_ARCH=ppc64" >> $config_mak
1723 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1724 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1725 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1726 echo "#define TARGET_PPC 1" >> $config_h
1727 echo "#define TARGET_PPC64 1" >> $config_h
1728 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1730 ppc64abi32)
1731 echo "TARGET_ARCH=ppc64" >> $config_mak
1732 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1733 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1734 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1735 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1736 echo "#define TARGET_PPC 1" >> $config_h
1737 echo "#define TARGET_PPC64 1" >> $config_h
1738 echo "#define TARGET_ABI32 1" >> $config_h
1739 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1741 sh4|sh4eb)
1742 echo "TARGET_ARCH=sh4" >> $config_mak
1743 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1744 echo "#define TARGET_SH4 1" >> $config_h
1745 bflt="yes"
1746 target_nptl="yes"
1748 sparc)
1749 echo "TARGET_ARCH=sparc" >> $config_mak
1750 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1751 echo "#define TARGET_SPARC 1" >> $config_h
1753 sparc64)
1754 echo "TARGET_ARCH=sparc64" >> $config_mak
1755 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1756 echo "#define TARGET_SPARC 1" >> $config_h
1757 echo "#define TARGET_SPARC64 1" >> $config_h
1758 elfload32="yes"
1760 sparc32plus)
1761 echo "TARGET_ARCH=sparc64" >> $config_mak
1762 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1763 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1764 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1765 echo "#define TARGET_SPARC 1" >> $config_h
1766 echo "#define TARGET_SPARC64 1" >> $config_h
1767 echo "#define TARGET_ABI32 1" >> $config_h
1770 echo "Unsupported target CPU"
1771 exit 1
1773 esac
1774 if test "$target_bigendian" = "yes" ; then
1775 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1776 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1778 if test "$target_softmmu" = "yes" ; then
1779 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1780 echo "#define CONFIG_SOFTMMU 1" >> $config_h
1782 if test "$target_user_only" = "yes" ; then
1783 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1784 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1786 if test "$target_linux_user" = "yes" ; then
1787 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1788 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1790 if test "$target_darwin_user" = "yes" ; then
1791 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1792 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1794 list=""
1795 if test ! -z "$gdb_xml_files" ; then
1796 for x in $gdb_xml_files; do
1797 list="$list $source_path/gdb-xml/$x"
1798 done
1800 echo "TARGET_XML_FILES=$list" >> $config_mak
1802 if test "$target_cpu" = "arm" \
1803 -o "$target_cpu" = "armeb" \
1804 -o "$target_cpu" = "m68k" \
1805 -o "$target_cpu" = "mips" \
1806 -o "$target_cpu" = "mipsel" \
1807 -o "$target_cpu" = "mipsn32" \
1808 -o "$target_cpu" = "mipsn32el" \
1809 -o "$target_cpu" = "mips64" \
1810 -o "$target_cpu" = "mips64el" \
1811 -o "$target_cpu" = "sparc" \
1812 -o "$target_cpu" = "sparc64" \
1813 -o "$target_cpu" = "sparc32plus"; then
1814 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1815 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1817 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1818 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1819 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1821 if test "$target_user_only" = "yes" \
1822 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1823 echo "#define USE_NPTL 1" >> $config_h
1825 # 32 bit ELF loader in addition to native 64 bit loader?
1826 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1827 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1828 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1830 if test "$target_bsd_user" = "yes" ; then
1831 echo "CONFIG_BSD_USER=yes" >> $config_mak
1832 echo "#define CONFIG_BSD_USER 1" >> $config_h
1835 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1837 done # for target in $targets
1839 # build tree in object directory if source path is different from current one
1840 if test "$source_path_used" = "yes" ; then
1841 DIRS="tests tests/cris slirp audio"
1842 FILES="Makefile tests/Makefile"
1843 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
1844 FILES="$FILES tests/test-mmap.c"
1845 for dir in $DIRS ; do
1846 mkdir -p $dir
1847 done
1848 # remove the link and recreate it, as not all "ln -sf" overwrite the link
1849 for f in $FILES ; do
1850 rm -f $f
1851 ln -s $source_path/$f $f
1852 done
1855 rm -f $TMPO $TMPC $TMPE $TMPS $TMPI