3 # qemu configure script (c) 2003 Fabrice Bellard
5 # set temporary file name
6 if test ! -z "$TMPDIR" ; then
8 elif test ! -z "$TEMPDIR" ; then
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
25 interp_prefix
="/usr/gnemul/qemu-%M"
30 audio_card_list
="ac97 es1370 sb16"
31 audio_possible_cards
="ac97 es1370 sb16 cs4231a adlib gus"
38 # parse CC options first
40 optarg
=`expr "x$opt" : 'x[^=]*=\(.*\)'`
42 --cross-prefix=*) cross_prefix
="$optarg"
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.
62 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev
/null
2> /dev
/null
; then
65 echo "ERROR: \"$cc\" either does not exist or does not work"
74 int main(void) { return 0; }
76 $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev
/null
2> /dev
/null
79 if check_define __i386__
; then
81 elif check_define __x86_64__
; then
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
91 elif check_define _ARCH_PPC
; then
92 if check_define _ARCH_PPC64
; then
103 i386|i486|i586|i686|i86pc|BePC
)
187 kvm_cap_device_assignment
="no"
197 # qemu-kvm: use local kerneldir
198 kerneldir
="$(readlink -f kvm/kernel)"
201 if check_define __linux__
; then
203 elif check_define _WIN32
; then
211 OS_CFLAGS
="-mno-cygwin"
212 if [ "$cpu" = "i386" ] ; then
215 audio_possible_drivers
="sdl"
219 if [ "$cpu" = "i386" ] ; then
222 audio_possible_drivers
="dsound sdl fmod"
226 audio_possible_drivers
="oss sdl esd pa"
227 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
234 audio_possible_drivers
="oss sdl esd pa"
235 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
243 audio_possible_drivers
="oss sdl esd"
250 audio_possible_drivers
="oss sdl esd"
256 # 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
257 if [ "$cpu" = "i386" ] ; then
258 is_x86_64
=`sysctl -n hw.optional.x86_64`
259 [ "$is_x86_64" = "1" ] && cpu
=x86_64
261 if [ "$cpu" = "x86_64" ] ; then
262 OS_CFLAGS
="-arch x86_64"
263 LDFLAGS
="-arch x86_64"
265 OS_CFLAGS
="-mdynamic-no-pic"
269 audio_drv_list
="coreaudio"
270 audio_possible_drivers
="coreaudio sdl fmod"
271 OS_LDFLAGS
="-framework CoreFoundation -framework IOKit"
277 needs_libsunmath
="no"
278 solarisrev
=`uname -r | cut -f2 -d.`
279 # have to select again, because `uname -m` returns i86pc
280 # even on an x86_64 box.
281 solariscpu
=`isainfo -k`
282 if test "${solariscpu}" = "amd64" ; then
285 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
286 if test "$solarisrev" -le 9 ; then
287 if test -f /opt
/SUNWspro
/prod
/lib
/libsunmath.so
.1; then
288 needs_libsunmath
="yes"
290 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
291 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
292 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
293 echo "Studio 11 can be downloaded from www.sun.com."
297 if test "$solarisrev" -ge 9 ; then
301 if test -f /usr
/include
/sys
/soundcard.h
; then
304 audio_possible_drivers
="oss sdl"
312 audio_possible_drivers
="oss alsa sdl esd pa"
316 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
318 audio_possible_drivers
="$audio_possible_drivers fmod"
321 if [ "$cpu" = "ia64" ] ; then
327 if [ "$cpu" = "powerpc" ]; then
333 if [ "$bsd" = "yes" ] ; then
334 if [ "$darwin" != "yes" ] ; then
342 source_path
=`dirname "$0"`
343 source_path_used
="no"
345 if [ -z "$source_path" ]; then
348 source_path
=`cd "$source_path"; pwd`
350 [ -f "$workdir/vl.c" ] || source_path_used
="yes"
353 # generate compile errors on warnings for development builds
354 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
359 optarg
=`expr "x$opt" : 'x[^=]*=\(.*\)'`
361 --help|
-h) show_help
=yes
363 --prefix=*) prefix
="$optarg"
365 --interp-prefix=*) interp_prefix
="$optarg"
367 --source-path=*) source_path
="$optarg"
368 source_path_used
="yes"
374 --host-cc=*) host_cc
="$optarg"
376 --make=*) make="$optarg"
378 --install=*) install="$optarg"
380 --extra-cflags=*) CFLAGS
="$optarg"
382 --extra-ldflags=*) LDFLAGS
="$optarg"
384 --cpu=*) cpu
="$optarg"
386 --target-list=*) target_list
="$optarg"
388 --enable-gprof) gprof
="yes"
390 --static) static
="yes"
392 --disable-sdl) sdl
="no"
394 --fmod-lib=*) fmod_lib
="$optarg"
396 --fmod-inc=*) fmod_inc
="$optarg"
398 --oss-lib=*) oss_lib
="$optarg"
400 --audio-card-list=*) audio_card_list
=`echo "$optarg" | sed -e 's/,/ /g'`
402 --audio-drv-list=*) audio_drv_list
="$optarg"
404 --enable-sparse) sparse
="yes"
406 --disable-sparse) sparse
="no"
408 --disable-vnc-tls) vnc_tls
="no"
410 --disable-slirp) slirp
="no"
412 --disable-vde) vde
="no"
414 --disable-kqemu) kqemu
="no"
416 --disable-brlapi) brlapi
="no"
418 --disable-bluez) bluez
="no"
420 --disable-kvm) kvm
="no"
422 --enable-profiler) profiler
="yes"
427 audio_drv_list
="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
429 --disable-gfx-check) check_gfx
="no"
431 --disable-system) softmmu
="no"
433 --enable-system) softmmu
="yes"
435 --disable-linux-user) linux_user
="no"
437 --enable-linux-user) linux_user
="yes"
439 --disable-darwin-user) darwin_user
="no"
441 --enable-darwin-user) darwin_user
="yes"
443 --disable-bsd-user) bsd_user
="no"
445 --enable-bsd-user) bsd_user
="yes"
447 --enable-uname-release=*) uname_release
="$optarg"
452 v7|v8
) SP_CFLAGS
="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m32"
453 target_cpu
="sparc"; cpu
="sparc" ;;
454 v8plus|v8plusa
) SP_CFLAGS
="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m32"
455 target_cpu
="sparc"; cpu
="sparc" ;;
456 v9
) SP_CFLAGS
="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m64"
457 target_cpu
="sparc64"; cpu
="sparc64" ;;
458 *) echo "undefined SPARC architecture. Exiting";exit 1;;
461 --enable-werror) werror
="yes"
463 --disable-werror) werror
="no"
465 --disable-curses) curses
="no"
467 --disable-nptl) nptl
="no"
469 --enable-mixemu) mixemu
="yes"
471 --disable-aio) aio
="no"
473 --disable-blobs) blobs
="no"
475 --kerneldir=*) kerneldir
="$optarg"
477 --disable-cpu-emulation) cpu_emulation
="no"
479 *) echo "ERROR: unknown option $opt"; exit 1
484 # default flags for all hosts
485 CFLAGS
="$CFLAGS -O2 -g -fno-strict-aliasing"
486 CFLAGS
="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
487 LDFLAGS
="$LDFLAGS -g"
488 if test "$werror" = "yes" ; then
489 CFLAGS
="$CFLAGS -Werror"
492 if test "$solaris" = "no" ; then
493 if ld
--version 2>/dev
/null |
grep "GNU ld" >/dev
/null
2>/dev
/null
; then
494 LDFLAGS
="$LDFLAGS -Wl,--warn-common"
499 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
500 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
503 sparc
) if test -z "$sparc_cpu" ; then
504 ARCH_CFLAGS
="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
507 ARCH_CFLAGS
="${SP_CFLAGS}"
508 ARCH_LDFLAGS
="${SP_LDFLAGS}"
511 sparc64
) if test -z "$sparc_cpu" ; then
512 ARCH_CFLAGS
="-m64 -mcpu=ultrasparc -D__sparc_v9__"
515 ARCH_CFLAGS
="${SP_CFLAGS}"
516 ARCH_LDFLAGS
="${SP_LDFLAGS}"
520 ARCH_CFLAGS
="-march=z900"
532 if test x
"$show_help" = x
"yes" ; then
535 Usage: configure [options]
536 Options: [defaults in brackets after descriptions]
539 echo "Standard options:"
540 echo " --help print this message"
541 echo " --prefix=PREFIX install in PREFIX [$prefix]"
542 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
543 echo " use %M for cpu name [$interp_prefix]"
544 echo " --target-list=LIST set target list [$target_list]"
546 echo "kqemu kernel acceleration support:"
547 echo " --disable-kqemu disable kqemu support"
549 echo "Advanced options (experts only):"
550 echo " --source-path=PATH path of source code [$source_path]"
551 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
552 echo " --cc=CC use C compiler CC [$cc]"
553 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
554 echo " --make=MAKE use specified make [$make]"
555 echo " --install=INSTALL use specified install [$install]"
556 echo " --static enable static build [$static]"
557 echo " --enable-sparse enable sparse checker"
558 echo " --disable-sparse disable sparse checker (default)"
559 echo " --disable-werror disable compilation abort on warning"
560 echo " --disable-sdl disable SDL"
561 echo " --enable-cocoa enable COCOA (Mac OS X only)"
562 echo " --audio-drv-list=LIST set audio drivers list:"
563 echo " Available drivers: $audio_possible_drivers"
564 echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
565 echo " Available cards: $audio_possible_cards"
566 echo " --enable-mixemu enable mixer emulation"
567 echo " --disable-brlapi disable BrlAPI"
568 echo " --disable-vnc-tls disable TLS encryption for VNC server"
569 echo " --disable-curses disable curses output"
570 echo " --disable-bluez disable bluez stack connectivity"
571 echo " --disable-kvm disable KVM acceleration support"
572 echo " --disable-nptl disable usermode NPTL support"
573 echo " --enable-system enable all system emulation targets"
574 echo " --disable-system disable all system emulation targets"
575 echo " --enable-linux-user enable all linux usermode emulation targets"
576 echo " --disable-linux-user disable all linux usermode emulation targets"
577 echo " --enable-darwin-user enable all darwin usermode emulation targets"
578 echo " --disable-darwin-user disable all darwin usermode emulation targets"
579 echo " --enable-bsd-user enable all BSD usermode emulation targets"
580 echo " --disable-bsd-user disable all BSD usermode emulation targets"
581 echo " --fmod-lib path to FMOD library"
582 echo " --fmod-inc path to FMOD includes"
583 echo " --oss-lib path to OSS library"
584 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
585 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
586 echo " --disable-vde disable support for vde network"
587 echo " --disable-aio disable AIO support"
588 echo " --disable-blobs disable installing provided firmware blobs"
589 echo " --kerneldir=PATH look for kernel includes in PATH"
590 echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
592 echo "NOTE: The object files are built at the place where configure is launched"
596 if test "$mingw32" = "yes" ; then
604 if test ! -x "$(which cgcc 2>/dev/null)"; then
609 # Solaris specific configure tool chain decisions
611 if test "$solaris" = "yes" ; then
612 solinst
=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
613 if test -z "$solinst" ; then
614 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
615 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
616 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
619 if test "$solinst" = "/usr/sbin/install" ; then
620 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
621 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
622 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
625 sol_ar
=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
626 if test -z "$sol_ar" ; then
627 echo "Error: No path includes ar"
628 if test -f /usr
/ccs
/bin
/ar ; then
629 echo "Add /usr/ccs/bin to your path and rerun configure"
636 if test -z "$target_list" ; then
637 # these targets are portable
638 if [ "$softmmu" = "yes" ] ; then
657 # the following are Linux specific
658 if [ "$linux_user" = "yes" ] ; then
659 target_list
="${target_list}\
671 ppc64abi32-linux-user \
676 sparc32plus-linux-user \
679 # the following are Darwin specific
680 if [ "$darwin_user" = "yes" ] ; then
681 target_list
="$target_list i386-darwin-user ppc-darwin-user "
683 # the following are BSD specific
684 if [ "$bsd_user" = "yes" ] ; then
685 target_list
="${target_list}\
690 target_list
=`echo "$target_list" | sed -e 's/,/ /g'`
692 if test -z "$target_list" ; then
693 echo "No targets enabled"
697 if test -z "$cross_prefix" ; then
700 # big/little endian test
702 #include <inttypes.h>
703 int main(int argc, char ** argv){
704 volatile uint32_t i=0x01234567;
705 return (*((uint8_t*)(&i))) == 0x67;
709 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
710 $TMPE && bigendian
="yes"
712 echo big
/little
test failed
717 # if cross compiling, cannot launch a program, so make a static guess
718 if test "$cpu" = "armv4b" \
722 -o "$cpu" = "mips64" \
724 -o "$cpu" = "ppc64" \
726 -o "$cpu" = "sparc" \
727 -o "$cpu" = "sparc64"; then
733 # host long bits test
735 if test "$cpu" = "x86_64" \
736 -o "$cpu" = "alpha" \
738 -o "$cpu" = "sparc64" \
739 -o "$cpu" = "ppc64"; then
743 # check gcc options support
749 # Check host NPTL support
752 #include <linux/futex.h>
755 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
761 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev
/null
2> /dev
/null
; then
767 ##########################################
770 if test "$kvm" = "yes" ; then
772 # test for KVM_CAP_PIT
777 #error "kvm no pit capability"
779 int main(void) { return 0; }
781 if $cc $ARCH_CFLAGS $CFLAGS -I"$kerneldir"/include
-o $TMPE ${OS_CFLAGS} $TMPC 2> /dev
/null
; then
785 # test for KVM_CAP_DEVICE_ASSIGNMENT
789 #ifndef KVM_CAP_DEVICE_ASSIGNMENT
790 #error "kvm no device assignment capability"
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 ##########################################
804 int main(void) { zlibVersion(); return 0; }
806 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev
/null
2> /dev
/null
; then
810 echo "Error: zlib check failed"
811 echo "Make sure to have the zlib libs and headers installed."
816 ##########################################
821 if test -z "$sdl" ; then
822 sdl_config
="sdl-config"
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` > $TMPSDLLOG 2>&1 ; then
832 _sdlversion
=`$sdl_config --version | sed 's/[^0-9]//g'`
833 if test "$_sdlversion" -lt 121 ; then
836 if test "$cocoa" = "no" ; then
841 # static link with sdl ?
842 if test "$sdl" = "yes" ; then
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 > /dev
/null
2> /dev
/null
; then
854 fi # sdl compile test
856 # Make sure to disable cocoa if sdl was set
857 if test "$sdl" = "yes" ; then
859 audio_drv_list
="`echo $audio_drv_list | sed s,coreaudio,,g`"
863 if test "$sdl" = "yes" ; then
866 #if defined(SDL_VIDEO_DRIVER_X11)
867 #include <X11/XKBlib.h>
869 #error No x11 support
871 int main(void) { return 0; }
873 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
878 ##########################################
880 if test "$vnc_tls" = "yes" ; then
882 #include <gnutls/gnutls.h>
883 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
885 vnc_tls_cflags
=`pkg-config --cflags gnutls 2> /dev/null`
886 vnc_tls_libs
=`pkg-config --libs gnutls 2> /dev/null`
887 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
888 $vnc_tls_libs > /dev
/null
2> /dev
/null
; then
895 ##########################################
896 # vde libraries probe
897 if test "$vde" = "yes" ; then
899 #include <libvdeplug.h>
902 struct vde_open_args a = {0, 0, 0};
903 vde_open("", "", &a);
907 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev
/null
2> /dev
/null
; then
914 ##########################################
915 # Sound support libraries probe
926 int main(void) { $exp }
928 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev
/null
2> /dev
/null
; then
932 echo "Error: $drv check failed"
933 echo "Make sure to have the $drv libs and headers installed."
939 audio_drv_list
=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
940 for drv
in $audio_drv_list; do
943 audio_drv_probe
$drv alsa
/asoundlib.h
-lasound \
944 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
948 if test -z $fmod_lib ||
test -z $fmod_inc; then
950 echo "Error: You must specify path to FMOD library and headers"
951 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
955 audio_drv_probe
$drv fmod.h
$fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
959 audio_drv_probe
$drv esd.h
-lesd 'return esd_play_stream(0, 0, "", 0);'
963 audio_drv_probe
$drv pulse
/simple.h
-lpulse-simple \
964 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
967 oss|sdl|core|wav|dsound
)
968 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
972 echo "$audio_possible_drivers" |
grep -q "\<$drv\>" ||
{
974 echo "Error: Unknown driver '$drv' selected"
975 echo "Possible drivers are: $audio_possible_drivers"
983 ##########################################
986 if test -z "$brlapi" ; then
990 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
992 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev
/null
2> /dev
/null
; then
994 fi # brlapi compile test
997 ##########################################
1000 if test "$curses" = "yes" ; then
1004 int main(void) { return curses_version(); }
1006 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev
/null
2> /dev
/null
; then
1011 ##########################################
1012 # bluez support probe
1013 if test "$bluez" = "yes" ; then
1014 `pkg-config bluez` || bluez
="no"
1016 if test "$bluez" = "yes" ; then
1018 #include <bluetooth/bluetooth.h>
1019 int main(void) { return bt_error(0); }
1021 bluez_cflags
=`pkg-config --cflags bluez`
1022 bluez_libs
=`pkg-config --libs bluez`
1023 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
1024 $bluez_libs > /dev
/null
2> /dev
/null
; then
1031 ##########################################
1033 if test "$kvm" = "yes" ; then
1035 #include <linux/kvm.h>
1036 #if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
1037 #error Invalid KVM version
1039 #if !defined(KVM_CAP_USER_MEMORY)
1040 #error Missing KVM capability KVM_CAP_USER_MEMORY
1042 #if !defined(KVM_CAP_SET_TSS_ADDR)
1043 #error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1045 #if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1046 #error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1048 int main(void) { return 0; }
1050 if test "$kerneldir" != "" ; then
1051 kvm_cflags
=-I"$kerneldir"/include
1052 if test \
( "$cpu" = "i386" -o "$cpu" = "x86_64" \
) \
1053 -a -d "$kerneldir/arch/x86/include" ; then
1054 kvm_cflags
="$kvm_cflags -I$kerneldir/arch/x86/include"
1055 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1056 kvm_cflags
="$kvm_cflags -I$kerneldir/arch/powerpc/include"
1057 elif test -d "$kerneldir/arch/$cpu/include" ; then
1058 kvm_cflags
="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1063 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
1064 > /dev
/null
2>/dev
/null
; then
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 \
1072 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1073 if test "$kvmerr" != "" ; then
1074 kvm
="no - (${kvmerr})"
1080 ##########################################
1084 if test "$aio" = "yes" ; then
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
1096 ##########################################
1099 #include <sys/types.h>
1100 #include <sys/uio.h>
1102 int main(void) { struct iovec iov; return 0; }
1105 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
1109 ##########################################
1111 if test "$fdt" = "yes" ; then
1114 int main(void) { return 0; }
1116 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev
/null
; then
1121 ##########################################
1126 #include <sys/syscall.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
1135 ##########################################
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
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
1154 ##########################################
1159 int main(void) { clockid_t id; return clock_gettime(id, NULL); }
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
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"
1183 if test -z "$prefix" ; then
1186 mansuffix
="/share/man"
1187 datasuffix
="/share/qemu"
1188 docsuffix
="/share/doc/qemu"
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"
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: "
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
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
1295 echo "ARCH=i386" >> $config_mak
1296 echo "#define HOST_I386 1" >> $config_h
1299 echo "ARCH=x86_64" >> $config_mak
1300 echo "#define HOST_X86_64 1" >> $config_h
1303 echo "ARCH=alpha" >> $config_mak
1304 echo "#define HOST_ALPHA 1" >> $config_h
1307 echo "ARCH=arm" >> $config_mak
1308 echo "#define HOST_ARM 1" >> $config_h
1311 echo "ARCH=arm" >> $config_mak
1312 echo "#define HOST_ARM 1" >> $config_h
1315 echo "ARCH=cris" >> $config_mak
1316 echo "#define HOST_CRIS 1" >> $config_h
1319 echo "ARCH=hppa" >> $config_mak
1320 echo "#define HOST_HPPA 1" >> $config_h
1323 echo "ARCH=ia64" >> $config_mak
1324 echo "#define HOST_IA64 1" >> $config_h
1327 echo "ARCH=m68k" >> $config_mak
1328 echo "#define HOST_M68K 1" >> $config_h
1331 echo "ARCH=mips" >> $config_mak
1332 echo "#define HOST_MIPS 1" >> $config_h
1335 echo "ARCH=mips64" >> $config_mak
1336 echo "#define HOST_MIPS64 1" >> $config_h
1339 echo "ARCH=ppc" >> $config_mak
1340 echo "#define HOST_PPC 1" >> $config_h
1343 echo "ARCH=ppc64" >> $config_mak
1344 echo "#define HOST_PPC64 1" >> $config_h
1347 echo "ARCH=s390" >> $config_mak
1348 echo "#define HOST_S390 1" >> $config_h
1351 echo "ARCH=sparc" >> $config_mak
1352 echo "#define HOST_SPARC 1" >> $config_h
1355 echo "ARCH=sparc64" >> $config_mak
1356 echo "#define HOST_SPARC64 1" >> $config_h
1359 echo "Unsupported CPU = $cpu"
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
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
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
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
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
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
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
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
1560 echo "HOST_USB=linux" >> $config_mak
1563 echo "HOST_USB=bsd" >> $config_mak
1566 echo "HOST_USB=stub" >> $config_mak
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
1601 target_user_only
="no"
1602 target_linux_user
="no"
1603 target_darwin_user
="no"
1604 target_bsd_user
="no"
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"
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."
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
1664 interp_prefix1
=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1665 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
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
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 "CONFIG_KVM_KERNEL_INC=$kerneldir/include" >> $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
1702 # Disable KVM for linux-user
1703 if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1709 case "$target_cpu" in
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"
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
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"
1732 echo "#define USE_KQEMU 1" >> $config_h
1737 echo "TARGET_ARCH=ia64" >> $config_mak
1738 echo "#define TARGET_ARCH \"ia64\"" >> $config_h
1739 echo "#define TARGET_IA64 1" >> $config_h
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
1750 echo "TARGET_ARCH=alpha" >> $config_mak
1751 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1752 echo "#define TARGET_ALPHA 1" >> $config_h
1755 echo "TARGET_ARCH=arm" >> $config_mak
1756 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1757 echo "#define TARGET_ARM 1" >> $config_h
1760 gdb_xml_files
="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
1763 echo "TARGET_ARCH=cris" >> $config_mak
1764 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1765 echo "#define TARGET_CRIS 1" >> $config_h
1769 echo "TARGET_ARCH=m68k" >> $config_mak
1770 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1771 echo "#define TARGET_M68K 1" >> $config_h
1773 gdb_xml_files
="cf-core.xml cf-fp.xml"
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
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
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
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"
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"
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"
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"
1832 echo "TARGET_ARCH=sh4" >> $config_mak
1833 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1834 echo "#define TARGET_SH4 1" >> $config_h
1839 echo "TARGET_ARCH=sparc" >> $config_mak
1840 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1841 echo "#define TARGET_SPARC 1" >> $config_h
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
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"
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
1885 if test ! -z "$gdb_xml_files" ; then
1886 for x
in $gdb_xml_files; do
1887 list
="$list $source_path/gdb-xml/$x"
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
1942 # remove the link and recreate it, as not all "ln -sf" overwrite the link
1943 for f
in $FILES ; do
1945 ln -s $source_path/$f $f