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
101 target_list
="x86_64-softmmu"
103 i386|i486|i586|i686|i86pc|BePC
)
190 kvm_cap_device_assignment
="no"
197 pkgversion
="kvm-devel"
203 if check_define __linux__
; then
205 elif check_define _WIN32
; then
207 elif check_define __OpenBSD__
; then
209 elif check_define __sun__
; then
217 OS_CFLAGS
="-mno-cygwin"
218 if [ "$cpu" = "i386" ] ; then
221 audio_possible_drivers
="sdl"
225 if [ "$cpu" = "i386" ] ; then
228 audio_possible_drivers
="dsound sdl fmod"
232 audio_possible_drivers
="oss sdl esd pa"
233 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
240 audio_possible_drivers
="oss sdl esd pa"
241 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
249 audio_possible_drivers
="oss sdl esd pa"
250 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
258 audio_possible_drivers
="oss sdl esd"
265 audio_possible_drivers
="oss sdl esd"
271 # 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
272 if [ "$cpu" = "i386" ] ; then
273 is_x86_64
=`sysctl -n hw.optional.x86_64`
274 [ "$is_x86_64" = "1" ] && cpu
=x86_64
276 if [ "$cpu" = "x86_64" ] ; then
277 OS_CFLAGS
="-arch x86_64"
278 LDFLAGS
="-arch x86_64"
280 OS_CFLAGS
="-mdynamic-no-pic"
284 audio_drv_list
="coreaudio"
285 audio_possible_drivers
="coreaudio sdl fmod"
286 OS_LDFLAGS
="-framework CoreFoundation -framework IOKit"
292 needs_libsunmath
="no"
294 solarisrev
=`uname -r | cut -f2 -d.`
295 # have to select again, because `uname -m` returns i86pc
296 # even on an x86_64 box.
297 solariscpu
=`isainfo -k`
298 if test "${solariscpu}" = "amd64" ; then
301 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
302 if test "$solarisrev" -le 9 ; then
303 if test -f /opt
/SUNWspro
/prod
/lib
/libsunmath.so
.1; then
304 needs_libsunmath
="yes"
306 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
307 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
308 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
309 echo "Studio 11 can be downloaded from www.sun.com."
313 if test "$solarisrev" -ge 9 ; then
317 if test -f /usr
/include
/sys
/soundcard.h
; then
320 audio_possible_drivers
="oss sdl"
329 audio_possible_drivers
="oss alsa sdl esd pa"
333 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
335 audio_possible_drivers
="$audio_possible_drivers fmod"
338 if [ "$cpu" = "ia64" ] ; then
341 target_list
="ia64-softmmu"
346 if [ "$cpu" = "powerpc" ]; then
352 if [ "$bsd" = "yes" ] ; then
353 if [ "$darwin" != "yes" ] ; then
361 source_path
=`dirname "$0"`
362 source_path_used
="no"
364 if [ -z "$source_path" ]; then
367 source_path
=`cd "$source_path"; pwd`
369 [ -f "$workdir/vl.c" ] || source_path_used
="yes"
372 # generate compile errors on warnings for development builds
373 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
378 optarg
=`expr "x$opt" : 'x[^=]*=\(.*\)'`
380 --help|
-h) show_help
=yes
382 --prefix=*) prefix
="$optarg"
384 --interp-prefix=*) interp_prefix
="$optarg"
386 --source-path=*) source_path
="$optarg"
387 source_path_used
="yes"
393 --host-cc=*) host_cc
="$optarg"
395 --make=*) make="$optarg"
397 --install=*) install="$optarg"
399 --extra-cflags=*) CFLAGS
="$optarg"
401 --extra-ldflags=*) LDFLAGS
="$optarg"
403 --cpu=*) cpu
="$optarg"
405 --target-list=*) target_list
="$optarg"
407 --enable-gprof) gprof
="yes"
409 --static) static
="yes"
411 --disable-sdl) sdl
="no"
413 --fmod-lib=*) fmod_lib
="$optarg"
415 --fmod-inc=*) fmod_inc
="$optarg"
417 --oss-lib=*) oss_lib
="$optarg"
419 --audio-card-list=*) audio_card_list
=`echo "$optarg" | sed -e 's/,/ /g'`
421 --audio-drv-list=*) audio_drv_list
="$optarg"
423 --enable-debug-tcg) debug_tcg
="yes"
425 --disable-debug-tcg) debug_tcg
="no"
427 --enable-sparse) sparse
="yes"
429 --disable-sparse) sparse
="no"
431 --disable-strip) strip_opt
="no"
433 --disable-vnc-tls) vnc_tls
="no"
435 --disable-vnc-sasl) vnc_sasl
="no"
437 --disable-slirp) slirp
="no"
439 --disable-vde) vde
="no"
441 --disable-kqemu) kqemu
="no"
443 --disable-xen) xen
="no"
445 --disable-brlapi) brlapi
="no"
447 --disable-bluez) bluez
="no"
449 --disable-kvm) kvm
="no"
451 --enable-profiler) profiler
="yes"
456 audio_drv_list
="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
458 --disable-gfx-check) check_gfx
="no"
460 --disable-system) softmmu
="no"
462 --enable-system) softmmu
="yes"
464 --disable-linux-user) linux_user
="no"
466 --enable-linux-user) linux_user
="yes"
468 --disable-darwin-user) darwin_user
="no"
470 --enable-darwin-user) darwin_user
="yes"
472 --disable-bsd-user) bsd_user
="no"
474 --enable-bsd-user) bsd_user
="yes"
476 --enable-uname-release=*) uname_release
="$optarg"
481 v7|v8
) SP_CFLAGS
="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m32"
482 target_cpu
="sparc"; cpu
="sparc" ;;
483 v8plus|v8plusa
) SP_CFLAGS
="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m32"
484 target_cpu
="sparc"; cpu
="sparc" ;;
485 v9
) SP_CFLAGS
="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m64"
486 target_cpu
="sparc64"; cpu
="sparc64" ;;
487 *) echo "undefined SPARC architecture. Exiting";exit 1;;
490 --enable-werror) werror
="yes"
492 --disable-werror) werror
="no"
494 --disable-curses) curses
="no"
496 --disable-nptl) nptl
="no"
498 --enable-mixemu) mixemu
="yes"
500 --disable-aio) aio
="no"
502 --disable-blobs) blobs
="no"
504 --kerneldir=*) kerneldir
="$optarg"
506 --with-pkgversion=*) pkgversion
=" ($optarg)"
508 --disable-cpu-emulation) cpu_emulation
="no"
510 *) echo "ERROR: unknown option $opt"; exit 1
515 # default flags for all hosts
516 CFLAGS
="$CFLAGS -O2 -g -fno-strict-aliasing"
517 CFLAGS
="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
518 LDFLAGS
="$LDFLAGS -g"
519 if test "$werror" = "yes" ; then
520 CFLAGS
="$CFLAGS -Werror"
523 CFLAGS
="$CFLAGS -I$(readlink -f "kvm
/libkvm
")"
525 if test "$solaris" = "no" ; then
526 if ld
--version 2>/dev
/null |
grep "GNU ld" >/dev
/null
2>/dev
/null
; then
527 LDFLAGS
="$LDFLAGS -Wl,--warn-common"
532 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
533 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
536 sparc
) if test -z "$sparc_cpu" ; then
537 ARCH_CFLAGS
="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
540 ARCH_CFLAGS
="${SP_CFLAGS}"
541 ARCH_LDFLAGS
="${SP_LDFLAGS}"
543 ARCH_CFLAGS
="$ARCH_CFLAGS -ffixed-g2 -ffixed-g3"
544 if test "$solaris" = "no" ; then
545 ARCH_CFLAGS
="$ARCH_CFLAGS -ffixed-g1 -ffixed-g6"
548 sparc64
) if test -z "$sparc_cpu" ; then
549 ARCH_CFLAGS
="-m64 -mcpu=ultrasparc -D__sparc_v9__"
552 ARCH_CFLAGS
="${SP_CFLAGS}"
553 ARCH_LDFLAGS
="${SP_LDFLAGS}"
555 if test "$solaris" = "no" ; then
556 ARCH_CFLAGS
="$ARCH_CFLAGS -ffixed-g5 -ffixed-g6 -ffixed-g7"
558 ARCH_CFLAGS
="$ARCH_CFLAGS -ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7"
562 ARCH_CFLAGS
="-march=z900"
574 if test x
"$show_help" = x
"yes" ; then
577 Usage: configure [options]
578 Options: [defaults in brackets after descriptions]
581 echo "Standard options:"
582 echo " --help print this message"
583 echo " --prefix=PREFIX install in PREFIX [$prefix]"
584 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
585 echo " use %M for cpu name [$interp_prefix]"
586 echo " --target-list=LIST set target list [$target_list]"
588 echo "kqemu kernel acceleration support:"
589 echo " --disable-kqemu disable kqemu support"
591 echo "Advanced options (experts only):"
592 echo " --source-path=PATH path of source code [$source_path]"
593 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
594 echo " --cc=CC use C compiler CC [$cc]"
595 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
596 echo " --extra-cflags=CFLAGS add C compiler flags CFLAGS"
597 echo " --extra-ldflags=LDFLAGS add linker flags LDFLAGS"
598 echo " --make=MAKE use specified make [$make]"
599 echo " --install=INSTALL use specified install [$install]"
600 echo " --static enable static build [$static]"
601 echo " --enable-debug-tcg enable TCG debugging"
602 echo " --disable-debug-tcg disable TCG debugging (default)"
603 echo " --enable-sparse enable sparse checker"
604 echo " --disable-sparse disable sparse checker (default)"
605 echo " --disable-strip disable stripping binaries"
606 echo " --disable-werror disable compilation abort on warning"
607 echo " --disable-sdl disable SDL"
608 echo " --enable-cocoa enable COCOA (Mac OS X only)"
609 echo " --audio-drv-list=LIST set audio drivers list:"
610 echo " Available drivers: $audio_possible_drivers"
611 echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
612 echo " Available cards: $audio_possible_cards"
613 echo " --enable-mixemu enable mixer emulation"
614 echo " --disable-xen disable xen backend driver support"
615 echo " --disable-brlapi disable BrlAPI"
616 echo " --disable-vnc-tls disable TLS encryption for VNC server"
617 echo " --disable-vnc-sasl disable SASL encryption for VNC server"
618 echo " --disable-curses disable curses output"
619 echo " --disable-bluez disable bluez stack connectivity"
620 echo " --disable-kvm disable KVM acceleration support"
621 echo " --disable-nptl disable usermode NPTL support"
622 echo " --enable-system enable all system emulation targets"
623 echo " --disable-system disable all system emulation targets"
624 echo " --enable-linux-user enable all linux usermode emulation targets"
625 echo " --disable-linux-user disable all linux usermode emulation targets"
626 echo " --enable-darwin-user enable all darwin usermode emulation targets"
627 echo " --disable-darwin-user disable all darwin usermode emulation targets"
628 echo " --enable-bsd-user enable all BSD usermode emulation targets"
629 echo " --disable-bsd-user disable all BSD usermode emulation targets"
630 echo " --fmod-lib path to FMOD library"
631 echo " --fmod-inc path to FMOD includes"
632 echo " --oss-lib path to OSS library"
633 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
634 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
635 echo " --disable-vde disable support for vde network"
636 echo " --disable-aio disable AIO support"
637 echo " --disable-blobs disable installing provided firmware blobs"
638 echo " --kerneldir=PATH look for kernel includes in PATH"
639 echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
641 echo "NOTE: The object files are built at the place where configure is launched"
645 if test "$mingw32" = "yes" ; then
651 OS_CFLAGS
="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
654 if test ! -x "$(which cgcc 2>/dev/null)"; then
659 # Solaris specific configure tool chain decisions
661 if test "$solaris" = "yes" ; then
662 solinst
=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
663 if test -z "$solinst" ; then
664 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
665 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
666 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
669 if test "$solinst" = "/usr/sbin/install" ; then
670 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
671 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
672 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
675 sol_ar
=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
676 if test -z "$sol_ar" ; then
677 echo "Error: No path includes ar"
678 if test -f /usr
/ccs
/bin
/ar ; then
679 echo "Add /usr/ccs/bin to your path and rerun configure"
686 if test -z "$target_list" ; then
687 # these targets are portable
688 if [ "$softmmu" = "yes" ] ; then
707 # the following are Linux specific
708 if [ "$linux_user" = "yes" ] ; then
709 target_list
="${target_list}\
721 ppc64abi32-linux-user \
726 sparc32plus-linux-user \
729 # the following are Darwin specific
730 if [ "$darwin_user" = "yes" ] ; then
731 target_list
="$target_list i386-darwin-user ppc-darwin-user "
733 # the following are BSD specific
734 if [ "$bsd_user" = "yes" ] ; then
735 target_list
="${target_list}\
743 target_list
=`echo "$target_list" | sed -e 's/,/ /g'`
745 if test -z "$target_list" ; then
746 echo "No targets enabled"
750 if test -z "$cross_prefix" ; then
753 # big/little endian test
755 #include <inttypes.h>
756 int main(int argc, char ** argv){
757 volatile uint32_t i=0x01234567;
758 return (*((uint8_t*)(&i))) == 0x67;
762 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
763 $TMPE && bigendian
="yes"
765 echo big
/little
test failed
770 # if cross compiling, cannot launch a program, so make a static guess
771 if test "$cpu" = "armv4b" \
775 -o "$cpu" = "mips64" \
777 -o "$cpu" = "ppc64" \
779 -o "$cpu" = "sparc" \
780 -o "$cpu" = "sparc64"; then
786 # host long bits test
788 if test "$cpu" = "x86_64" \
789 -o "$cpu" = "alpha" \
791 -o "$cpu" = "sparc64" \
792 -o "$cpu" = "ppc64"; then
796 # Check host NPTL support
799 #include <linux/futex.h>
802 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
808 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev
/null
2> /dev
/null
; then
814 ##########################################
831 if test "$kvm" = "yes" ; then
833 kvm_cflags
="-I$source_path/kvm/kernel/include"
834 kvm_cflags
="$kvm_cflags -I$source_path/kvm/kernel/arch/$kvm_arch/include"
836 # test for KVM_CAP_PIT
841 #error "kvm no pit capability"
843 int main(void) { return 0; }
845 if $cc $ARCH_CFLAGS $CFLAGS $kvm_cflags -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev
/null
; then
849 # test for KVM_CAP_DEVICE_ASSIGNMENT
853 #ifndef KVM_CAP_DEVICE_ASSIGNMENT
854 #error "kvm no device assignment capability"
856 int main(void) { return 0; }
858 if $cc $ARCH_CFLAGS $CFLAGS $kvm_cflags -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev
/null
; then
859 kvm_cap_device_assignment
="yes"
863 # libpci probe for kvm_cap_device_assignment
864 if test $kvm_cap_device_assignment = "yes" ; then
867 #ifndef PCI_VENDOR_ID
870 int main(void) { return 0; }
872 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC 2>/dev
/null
; then
876 echo "Error: libpci check failed"
877 echo "Disable KVM Device Assignment capability."
879 kvm_cap_device_assignment
="no"
883 ##########################################
888 int main(void) { zlibVersion(); return 0; }
890 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev
/null
2> /dev
/null
; then
894 echo "Error: zlib check failed"
895 echo "Make sure to have the zlib libs and headers installed."
900 ##########################################
903 if test "$xen" = "yes" ; then
907 int main(void) { xs_daemon_open; xc_interface_open; }
909 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC -lxenstore -lxenctrl 2> /dev
/null
; then
916 ##########################################
921 if test -z "$sdl" ; then
922 sdl_config
="sdl-config"
928 #undef main /* We don't want SDL to override our main() */
929 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
931 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
932 _sdlversion
=`$sdl_config --version | sed 's/[^0-9]//g'`
933 if test "$_sdlversion" -lt 121 ; then
936 if test "$cocoa" = "no" ; then
941 # static link with sdl ?
942 if test "$sdl" = "yes" ; then
944 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa
="yes"
945 sdl_static_libs
=`$sdl_config --static-libs 2>/dev/null`
946 if [ "$aa" = "yes" ] ; then
947 sdl_static_libs
="$sdl_static_libs `aalib-config --static-libs`"
950 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev
/null
2> /dev
/null
; then
954 fi # sdl compile test
956 # Make sure to disable cocoa if sdl was set
957 if test "$sdl" = "yes" ; then
959 audio_drv_list
="`echo $audio_drv_list | sed s,coreaudio,,g`"
963 if test "$sdl" = "yes" ; then
966 #if defined(SDL_VIDEO_DRIVER_X11)
967 #include <X11/XKBlib.h>
969 #error No x11 support
971 int main(void) { return 0; }
973 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
978 ##########################################
980 if test "$vnc_tls" = "yes" ; then
982 #include <gnutls/gnutls.h>
983 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
985 vnc_tls_cflags
=`pkg-config --cflags gnutls 2> /dev/null`
986 vnc_tls_libs
=`pkg-config --libs gnutls 2> /dev/null`
987 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
988 $vnc_tls_libs > /dev
/null
2> /dev
/null
; then
995 ##########################################
997 if test "$vnc_sasl" = "yes" ; then
999 #include <sasl/sasl.h>
1001 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
1003 # Assuming Cyrus-SASL installed in /usr prefix
1005 vnc_sasl_libs
="-lsasl2"
1006 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
1007 $vnc_sasl_libs 2> /dev
/null
; then
1014 ##########################################
1015 # fnmatch() probe, used for ACL routines
1018 #include <fnmatch.h>
1021 fnmatch("foo", "foo", 0);
1025 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
1029 ##########################################
1030 # vde libraries probe
1031 if test "$vde" = "yes" ; then
1033 #include <libvdeplug.h>
1036 struct vde_open_args a = {0, 0, 0};
1037 vde_open("", "", &a);
1041 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev
/null
2> /dev
/null
; then
1048 ##########################################
1049 # Sound support libraries probe
1060 int main(void) { $exp }
1062 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev
/null
2> /dev
/null
; then
1066 echo "Error: $drv check failed"
1067 echo "Make sure to have the $drv libs and headers installed."
1073 audio_drv_list
=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1074 for drv
in $audio_drv_list; do
1077 audio_drv_probe
$drv alsa
/asoundlib.h
-lasound \
1078 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1082 if test -z $fmod_lib ||
test -z $fmod_inc; then
1084 echo "Error: You must specify path to FMOD library and headers"
1085 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1089 audio_drv_probe
$drv fmod.h
$fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1093 audio_drv_probe
$drv esd.h
-lesd 'return esd_play_stream(0, 0, "", 0);'
1097 audio_drv_probe
$drv pulse
/simple.h
-lpulse-simple \
1098 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1101 oss|sdl|core|wav|dsound
)
1102 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1106 echo "$audio_possible_drivers" |
grep -q "\<$drv\>" ||
{
1108 echo "Error: Unknown driver '$drv' selected"
1109 echo "Possible drivers are: $audio_possible_drivers"
1117 ##########################################
1120 if test -z "$brlapi" ; then
1124 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1126 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev
/null
2> /dev
/null
; then
1128 fi # brlapi compile test
1131 ##########################################
1134 if test "$curses" = "yes" ; then
1139 #define resize_term resizeterm
1141 int main(void) { resize_term(0, 0); return curses_version(); }
1143 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev
/null
2> /dev
/null
; then
1148 ##########################################
1149 # bluez support probe
1150 if test "$bluez" = "yes" ; then
1151 `pkg-config bluez` || bluez
="no"
1153 if test "$bluez" = "yes" ; then
1155 #include <bluetooth/bluetooth.h>
1156 int main(void) { return bt_error(0); }
1158 bluez_cflags
=`pkg-config --cflags bluez`
1159 bluez_libs
=`pkg-config --libs bluez`
1160 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
1161 $bluez_libs > /dev
/null
2> /dev
/null
; then
1168 ##########################################
1170 if test "$kvm" = "yes" ; then
1172 #include <linux/kvm.h>
1173 #if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
1174 #error Invalid KVM version
1176 #if !defined(KVM_CAP_USER_MEMORY)
1177 #error Missing KVM capability KVM_CAP_USER_MEMORY
1179 #if !defined(KVM_CAP_SET_TSS_ADDR)
1180 #error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1182 #if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1183 #error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1185 int main(void) { return 0; }
1187 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
1188 > /dev
/null
2>/dev
/null
; then
1192 if [ -x "`which awk 2>/dev/null`" ] && \
1193 [ -x "`which grep 2>/dev/null`" ]; then
1194 kvmerr
=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
1196 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1197 if test "$kvmerr" != "" ; then
1198 kvm
="no - (${kvmerr})"
1204 ##########################################
1208 if test "$aio" = "yes" ; then
1211 #include <pthread.h>
1212 int main(void) { pthread_mutex_t lock; return 0; }
1214 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev
/null
; then
1220 ##########################################
1223 #include <sys/types.h>
1224 #include <sys/uio.h>
1226 int main(void) { struct iovec iov; return 0; }
1229 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
1233 ##########################################
1236 #include <sys/types.h>
1237 #include <sys/uio.h>
1239 int main(void) { preadv; }
1242 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
1246 ##########################################
1248 if test "$fdt" = "yes" ; then
1251 int main(void) { return 0; }
1253 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev
/null
; then
1259 # Check for xxxat() functions when we are building linux-user
1260 # emulator. This is done because older glibc versions don't
1261 # have syscall stubs for these implemented.
1264 if [ "$linux_user" = "yes" ] ; then
1266 #define _ATFILE_SOURCE
1267 #include <sys/types.h>
1274 /* try to unlink nonexisting file */
1275 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1278 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
1283 # Check for inotify functions when we are building linux-user
1284 # emulator. This is done because older glibc versions don't
1285 # have syscall stubs for these implemented. In that case we
1286 # don't provide them even if kernel supports them.
1289 if [ "$linux_user" = "yes" ] ; then
1291 #include <sys/inotify.h>
1296 /* try to start inotify */
1297 return inotify_init();
1300 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
1305 ##########################################
1310 #include <sys/syscall.h>
1312 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
1315 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
1319 ##########################################
1324 #include <sys/syscall.h>
1325 int main(void) { return syscall(SYS_eventfd, 0); }
1328 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
1332 # Check if tools are available to build documentation.
1333 if [ -x "`which texi2html 2>/dev/null`" ] && \
1334 [ -x "`which pod2man 2>/dev/null`" ]; then
1338 ##########################################
1343 int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1347 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
1349 elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev
/null
2> /dev
/null
; then
1353 if test "$rt" = "yes" ; then
1354 # Hack, we should have a general purpose LIBS for this sort of thing
1355 AIOLIBS
="$AIOLIBS -lrt"
1358 if test "$mingw32" = "yes" ; then
1359 if test -z "$prefix" ; then
1360 prefix
="c:\\\\Program Files\\\\Qemu"
1367 if test -z "$prefix" ; then
1370 mansuffix
="/share/man"
1371 datasuffix
="/share/qemu"
1372 docsuffix
="/share/doc/qemu"
1376 echo "Install prefix $prefix"
1377 echo "BIOS directory $prefix$datasuffix"
1378 echo "binary directory $prefix$binsuffix"
1379 if test "$mingw32" = "no" ; then
1380 echo "Manual directory $prefix$mansuffix"
1381 echo "ELF interp prefix $interp_prefix"
1383 echo "Source path $source_path"
1384 echo "C compiler $cc"
1385 echo "Host C compiler $host_cc"
1386 echo "ARCH_CFLAGS $ARCH_CFLAGS"
1388 echo "install $install"
1389 echo "host CPU $cpu"
1390 echo "host big endian $bigendian"
1391 echo "target list $target_list"
1392 echo "tcg debug enabled $debug_tcg"
1393 echo "gprof enabled $gprof"
1394 echo "sparse enabled $sparse"
1395 echo "strip binaries $strip_opt"
1396 echo "profiler $profiler"
1397 echo "static build $static"
1398 echo "-Werror enabled $werror"
1399 if test "$darwin" = "yes" ; then
1400 echo "Cocoa support $cocoa"
1402 echo "SDL support $sdl"
1403 if test "$sdl" != "no" ; then
1404 echo "SDL static link $sdl_static"
1406 echo "curses support $curses"
1407 echo "mingw32 support $mingw32"
1408 echo "Audio drivers $audio_drv_list"
1409 echo "Extra audio cards $audio_card_list"
1410 echo "Mixer emulation $mixemu"
1411 echo "VNC TLS support $vnc_tls"
1412 if test "$vnc_tls" = "yes" ; then
1413 echo " TLS CFLAGS $vnc_tls_cflags"
1414 echo " TLS LIBS $vnc_tls_libs"
1416 echo "VNC SASL support $vnc_sasl"
1417 if test "$vnc_sasl" = "yes" ; then
1418 echo " SASL CFLAGS $vnc_sasl_cflags"
1419 echo " SASL LIBS $vnc_sasl_libs"
1421 if test -n "$sparc_cpu"; then
1422 echo "Target Sparc Arch $sparc_cpu"
1424 echo "kqemu support $kqemu"
1425 echo "xen support $xen"
1426 echo "CPU emulation $cpu_emulation"
1427 echo "brlapi support $brlapi"
1428 echo "Documentation $build_docs"
1429 [ ! -z "$uname_release" ] && \
1430 echo "uname -r $uname_release"
1431 echo "NPTL support $nptl"
1432 echo "vde support $vde"
1433 echo "AIO support $aio"
1434 echo "Install blobs $blobs"
1435 echo "KVM support $kvm"
1436 echo "fdt support $fdt"
1437 echo "preadv support $preadv"
1439 if test $sdl_too_old = "yes"; then
1440 echo "-> Your SDL version is too old - please upgrade to have SDL support"
1442 if [ -s $TMPSDLLOG ]; then
1443 echo "The error log from compiling the libSDL test is: "
1446 #if test "$sdl_static" = "no"; then
1447 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1449 config_mak
="config-host.mak"
1450 config_h
="config-host.h"
1452 #echo "Creating $config_mak and $config_h"
1454 test -f $config_h && mv $config_h ${config_h}~
1456 echo "# Automatically generated by configure - do not modify" > $config_mak
1457 printf "# Configured with:" >> $config_mak
1458 printf " '%s'" "$0" "$@" >> $config_mak
1460 echo "/* Automatically generated by configure - do not modify */" > $config_h
1462 echo "prefix=$prefix" >> $config_mak
1463 echo "bindir=\${prefix}$binsuffix" >> $config_mak
1464 echo "mandir=\${prefix}$mansuffix" >> $config_mak
1465 echo "datadir=\${prefix}$datasuffix" >> $config_mak
1466 echo "docdir=\${prefix}$docsuffix" >> $config_mak
1467 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
1468 echo "MAKE=$make" >> $config_mak
1469 echo "INSTALL=$install" >> $config_mak
1470 echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_mak
1471 echo "INSTALL_DATA=$install -m0644 -p" >> $config_mak
1472 echo "INSTALL_PROG=$install -m0755 -p" >> $config_mak
1473 echo "CC=$cc" >> $config_mak
1474 echo "HOST_CC=$host_cc" >> $config_mak
1475 echo "AR=$ar" >> $config_mak
1476 # XXX: only use CFLAGS and LDFLAGS ?
1477 # XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1478 # compilation of dyngen tool (useful for win32 build on Linux host)
1479 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
1480 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1481 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1482 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
1483 echo "CFLAGS=$CFLAGS" >> $config_mak
1484 echo "LDFLAGS=$LDFLAGS" >> $config_mak
1485 echo "EXESUF=$EXESUF" >> $config_mak
1486 echo "AIOLIBS=$AIOLIBS" >> $config_mak
1489 echo "ARCH=i386" >> $config_mak
1490 echo "#define HOST_I386 1" >> $config_h
1493 echo "ARCH=x86_64" >> $config_mak
1494 echo "#define HOST_X86_64 1" >> $config_h
1497 echo "ARCH=alpha" >> $config_mak
1498 echo "#define HOST_ALPHA 1" >> $config_h
1501 echo "ARCH=arm" >> $config_mak
1502 echo "#define HOST_ARM 1" >> $config_h
1505 echo "ARCH=arm" >> $config_mak
1506 echo "#define HOST_ARM 1" >> $config_h
1509 echo "ARCH=cris" >> $config_mak
1510 echo "#define HOST_CRIS 1" >> $config_h
1513 echo "ARCH=hppa" >> $config_mak
1514 echo "#define HOST_HPPA 1" >> $config_h
1517 echo "ARCH=ia64" >> $config_mak
1518 echo "#define HOST_IA64 1" >> $config_h
1521 echo "ARCH=m68k" >> $config_mak
1522 echo "#define HOST_M68K 1" >> $config_h
1525 echo "ARCH=mips" >> $config_mak
1526 echo "#define HOST_MIPS 1" >> $config_h
1529 echo "ARCH=mips64" >> $config_mak
1530 echo "#define HOST_MIPS64 1" >> $config_h
1533 echo "ARCH=ppc" >> $config_mak
1534 echo "#define HOST_PPC 1" >> $config_h
1537 echo "ARCH=ppc64" >> $config_mak
1538 echo "#define HOST_PPC64 1" >> $config_h
1541 echo "ARCH=s390" >> $config_mak
1542 echo "#define HOST_S390 1" >> $config_h
1545 echo "ARCH=sparc" >> $config_mak
1546 echo "#define HOST_SPARC 1" >> $config_h
1549 echo "ARCH=sparc64" >> $config_mak
1550 echo "#define HOST_SPARC64 1" >> $config_h
1553 echo "Unsupported CPU = $cpu"
1557 if test "$debug_tcg" = "yes" ; then
1558 echo "#define DEBUG_TCG 1" >> $config_h
1560 if test "$sparse" = "yes" ; then
1561 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1562 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1563 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1565 if test "$strip_opt" = "yes" ; then
1566 echo "STRIP_OPT=-s" >> $config_mak
1568 if test "$bigendian" = "yes" ; then
1569 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1570 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1572 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
1573 if test "$mingw32" = "yes" ; then
1574 echo "CONFIG_WIN32=yes" >> $config_mak
1575 echo "#define CONFIG_WIN32 1" >> $config_h
1578 #include <byteswap.h>
1579 int main(void) { return bswap_32(0); }
1581 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev
/null
2> /dev
/null
; then
1582 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1585 #include <sys/endian.h>
1586 #include <sys/types.h>
1587 #include <machine/bswap.h>
1588 int main(void) { return bswap32(0); }
1590 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev
/null
2> /dev
/null
; then
1591 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1595 if [ "$openbsd" = "yes" ] ; then
1596 echo "#define ENOTSUP 4096" >> $config_h
1599 if test "$darwin" = "yes" ; then
1600 echo "CONFIG_DARWIN=yes" >> $config_mak
1601 echo "#define CONFIG_DARWIN 1" >> $config_h
1604 if test "$aix" = "yes" ; then
1605 echo "CONFIG_AIX=yes" >> $config_mak
1606 echo "#define CONFIG_AIX 1" >> $config_h
1609 if test "$solaris" = "yes" ; then
1610 echo "CONFIG_SOLARIS=yes" >> $config_mak
1611 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
1612 if test "$needs_libsunmath" = "yes" ; then
1613 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1614 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1617 if test -n "$sparc_cpu"; then
1618 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1619 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1621 if test "$gdbstub" = "yes" ; then
1622 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1623 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1625 if test "$gprof" = "yes" ; then
1626 echo "TARGET_GPROF=yes" >> $config_mak
1627 echo "#define HAVE_GPROF 1" >> $config_h
1629 if test "$static" = "yes" ; then
1630 echo "CONFIG_STATIC=yes" >> $config_mak
1631 echo "#define CONFIG_STATIC 1" >> $config_h
1633 if test $profiler = "yes" ; then
1634 echo "#define CONFIG_PROFILER 1" >> $config_h
1636 if test "$slirp" = "yes" ; then
1637 echo "CONFIG_SLIRP=yes" >> $config_mak
1638 echo "#define CONFIG_SLIRP 1" >> $config_h
1640 if test "$vde" = "yes" ; then
1641 echo "CONFIG_VDE=yes" >> $config_mak
1642 echo "#define CONFIG_VDE 1" >> $config_h
1643 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1645 for card
in $audio_card_list; do
1646 def
=CONFIG_
`echo $card | tr '[:lower:]' '[:upper:]'`
1647 echo "$def=yes" >> $config_mak
1648 echo "#define $def 1" >> $config_h
1650 echo "#define AUDIO_DRIVERS \\" >> $config_h
1651 for drv
in $audio_drv_list; do
1652 echo " &${drv}_audio_driver, \\" >>$config_h
1653 def
=CONFIG_
`echo $drv | tr '[:lower:]' '[:upper:]'`
1654 echo "$def=yes" >> $config_mak
1655 if test "$drv" = "fmod"; then
1656 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1657 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1658 elif test "$drv" = "oss"; then
1659 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
1663 if test "$mixemu" = "yes" ; then
1664 echo "CONFIG_MIXEMU=yes" >> $config_mak
1665 echo "#define CONFIG_MIXEMU 1" >> $config_h
1667 if test "$vnc_tls" = "yes" ; then
1668 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1669 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1670 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1671 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1673 if test "$vnc_sasl" = "yes" ; then
1674 echo "CONFIG_VNC_SASL=yes" >> $config_mak
1675 echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1676 echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1677 echo "#define CONFIG_VNC_SASL 1" >> $config_h
1679 if test "$fnmatch" = "yes" ; then
1680 echo "#define HAVE_FNMATCH_H 1" >> $config_h
1682 qemu_version
=`head $source_path/VERSION`
1683 echo "VERSION=$qemu_version" >>$config_mak
1684 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1685 echo "#define QEMU_PKGVERSION \"$pkgversion\"" >> $config_h
1687 echo "SRC_PATH=$source_path" >> $config_mak
1688 if [ "$source_path_used" = "yes" ]; then
1689 echo "VPATH=$source_path" >> $config_mak
1691 echo "TARGET_DIRS=$target_list" >> $config_mak
1692 if [ "$build_docs" = "yes" ] ; then
1693 echo "BUILD_DOCS=yes" >> $config_mak
1695 if test "$static" = "yes"; then
1700 if test "$sdl1" = "yes" ; then
1701 echo "#define CONFIG_SDL 1" >> $config_h
1702 echo "CONFIG_SDL=yes" >> $config_mak
1703 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1704 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1705 elif test "$sdl_x11" = "yes" ; then
1706 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
1708 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1710 if [ "${aa}" = "yes" ] ; then
1711 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1713 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1716 if test "$cocoa" = "yes" ; then
1717 echo "#define CONFIG_COCOA 1" >> $config_h
1718 echo "CONFIG_COCOA=yes" >> $config_mak
1720 if test "$curses" = "yes" ; then
1721 echo "#define CONFIG_CURSES 1" >> $config_h
1722 echo "CONFIG_CURSES=yes" >> $config_mak
1723 echo "CURSES_LIBS=-lcurses" >> $config_mak
1725 if test "$atfile" = "yes" ; then
1726 echo "#define CONFIG_ATFILE 1" >> $config_h
1728 if test "$inotify" = "yes" ; then
1729 echo "#define CONFIG_INOTIFY 1" >> $config_h
1731 if test "$brlapi" = "yes" ; then
1732 echo "CONFIG_BRLAPI=yes" >> $config_mak
1733 echo "#define CONFIG_BRLAPI 1" >> $config_h
1734 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1736 if test "$bluez" = "yes" ; then
1737 echo "CONFIG_BLUEZ=yes" >> $config_mak
1738 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1739 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1740 echo "#define CONFIG_BLUEZ 1" >> $config_h
1742 if test "$xen" = "yes" ; then
1743 echo "XEN_LIBS=-lxenstore -lxenctrl -lxenguest" >> $config_mak
1745 if test "$aio" = "yes" ; then
1746 echo "#define CONFIG_AIO 1" >> $config_h
1747 echo "CONFIG_AIO=yes" >> $config_mak
1749 if test "$blobs" = "yes" ; then
1750 echo "INSTALL_BLOBS=yes" >> $config_mak
1752 if test "$iovec" = "yes" ; then
1753 echo "#define HAVE_IOVEC 1" >> $config_h
1755 if test "$preadv" = "yes" ; then
1756 echo "#define HAVE_PREADV 1" >> $config_h
1758 if test "$fdt" = "yes" ; then
1759 echo "#define HAVE_FDT 1" >> $config_h
1760 echo "FDT_LIBS=-lfdt" >> $config_mak
1762 if test "$signalfd" = "yes" ; then
1763 echo "#define CONFIG_signalfd 1" >> $config_h
1765 if test "$eventfd" = "yes" ; then
1766 echo "#define CONFIG_eventfd 1" >> $config_h
1769 # XXX: suppress that
1770 if [ "$bsd" = "yes" ] ; then
1771 echo "#define O_LARGEFILE 0" >> $config_h
1772 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1773 echo "#define HOST_BSD 1" >> $config_h
1776 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1781 echo "HOST_USB=linux" >> $config_mak
1784 echo "HOST_USB=bsd" >> $config_mak
1787 echo "HOST_USB=stub" >> $config_mak
1792 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1793 tools
="qemu-img\$(EXESUF) $tools"
1794 if [ "$linux" = "yes" ] ; then
1795 tools
="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
1798 echo "TOOLS=$tools" >> $config_mak
1800 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~
$config_h
1802 for target
in $target_list; do
1803 target_dir
="$target"
1804 config_mak
=$target_dir/config.mak
1805 config_h
=$target_dir/config.h
1806 target_cpu
=`echo $target | cut -d '-' -f 1`
1807 target_bigendian
="no"
1808 [ "$target_cpu" = "armeb" ] && target_bigendian
=yes
1809 [ "$target_cpu" = "m68k" ] && target_bigendian
=yes
1810 [ "$target_cpu" = "mips" ] && target_bigendian
=yes
1811 [ "$target_cpu" = "mipsn32" ] && target_bigendian
=yes
1812 [ "$target_cpu" = "mips64" ] && target_bigendian
=yes
1813 [ "$target_cpu" = "ppc" ] && target_bigendian
=yes
1814 [ "$target_cpu" = "ppcemb" ] && target_bigendian
=yes
1815 [ "$target_cpu" = "ppc64" ] && target_bigendian
=yes
1816 [ "$target_cpu" = "ppc64abi32" ] && target_bigendian
=yes
1817 [ "$target_cpu" = "sh4eb" ] && target_bigendian
=yes
1818 [ "$target_cpu" = "sparc" ] && target_bigendian
=yes
1819 [ "$target_cpu" = "sparc64" ] && target_bigendian
=yes
1820 [ "$target_cpu" = "sparc32plus" ] && target_bigendian
=yes
1822 target_user_only
="no"
1823 target_linux_user
="no"
1824 target_darwin_user
="no"
1825 target_bsd_user
="no"
1827 ${target_cpu}-softmmu)
1828 target_softmmu
="yes"
1830 ${target_cpu}-linux-user)
1831 target_user_only
="yes"
1832 target_linux_user
="yes"
1834 ${target_cpu}-darwin-user)
1835 target_user_only
="yes"
1836 target_darwin_user
="yes"
1838 ${target_cpu}-bsd-user)
1839 target_user_only
="yes"
1840 target_bsd_user
="yes"
1843 echo "ERROR: Target '$target' not recognised"
1848 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1849 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1850 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1851 echo "To build QEMU without graphical output configure with --disable-gfx-check"
1852 echo "Note that this will disable all output from the virtual graphics card"
1853 echo "except through VNC or curses."
1857 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1859 test -f $config_h && mv $config_h ${config_h}~
1861 mkdir
-p $target_dir
1862 mkdir
-p $target_dir/fpu
1863 mkdir
-p $target_dir/tcg
1864 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
1865 mkdir
-p $target_dir/nwfpe
1869 # don't use ln -sf as not all "ln -sf" over write the file/link
1871 rm -f $target_dir/Makefile
1872 ln -s $source_path/Makefile.target
$target_dir/Makefile
1875 echo "# Automatically generated by configure - do not modify" > $config_mak
1876 echo "/* Automatically generated by configure - do not modify */" > $config_h
1879 echo "include ../config-host.mak" >> $config_mak
1880 echo "#include \"../config-host.h\"" >> $config_h
1885 interp_prefix1
=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1886 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1889 disable_cpu_emulation
() {
1890 if test $cpu_emulation = "no"; then
1891 echo "#define NO_CPU_EMULATION 1" >> $config_h
1892 echo "NO_CPU_EMULATION=1" >> $config_mak
1897 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
1898 \
( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \
); then
1899 echo "#define USE_KVM 1" >> $config_h
1900 echo "USE_KVM=1" >> $config_mak
1901 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1902 if test $kvm_cap_pit = "yes" ; then
1903 echo "USE_KVM_PIT=1" >> $config_mak
1904 echo "#define USE_KVM_PIT 1" >> $config_h
1906 if test $kvm_cap_device_assignment = "yes" ; then
1907 echo "USE_KVM_DEVICE_ASSIGNMENT=1" >> $config_mak
1908 echo "#define USE_KVM_DEVICE_ASSIGNMENT 1" >> $config_h
1910 disable_cpu_emulation
1914 if [ use_upstream_kvm
= yes ]; then
1916 # Make sure the target and host cpus are compatible
1917 if test "$kvm" = "yes" -a ! \
( "$target_cpu" = "$cpu" -o \
1918 \
( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \
) -o \
1919 \
( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \
) -o \
1920 \
( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \
) \
) ; then
1923 # Disable KVM for linux-user
1924 if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1930 case "$target_cpu" in
1932 echo "TARGET_ARCH=i386" >> $config_mak
1933 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1934 echo "#define TARGET_I386 1" >> $config_h
1935 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
1937 echo "CONFIG_KQEMU=yes" >> $config_mak
1938 echo "#define CONFIG_KQEMU 1" >> $config_h
1940 if test "$kvm" = "yes" ; then
1941 echo "USE_KVM=yes" >> $config_mak
1942 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1943 echo "#define USE_KVM 1" >> $config_h
1945 if test "$xen" = "yes" -a "$target_softmmu" = "yes";
1947 echo "CONFIG_XEN=yes" >> $config_mak
1948 echo "#define CONFIG_XEN 1" >> $config_h
1953 echo "TARGET_ARCH=x86_64" >> $config_mak
1954 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1955 echo "#define TARGET_I386 1" >> $config_h
1956 echo "#define TARGET_X86_64 1" >> $config_h
1957 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1959 echo "CONFIG_KQEMU=yes" >> $config_mak
1960 echo "#define CONFIG_KQEMU 1" >> $config_h
1965 echo "TARGET_ARCH=ia64" >> $config_mak
1966 echo "#define TARGET_ARCH \"ia64\"" >> $config_h
1967 echo "#define TARGET_IA64 1" >> $config_h
1969 if [ use_upstream_kvm
= yes ]; then
1970 if test "$kvm" = "yes" ; then
1971 echo "USE_KVM=yes" >> $config_mak
1972 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1973 echo "#define USE_KVM 1" >> $config_h
1976 if test "$xen" = "yes" -a "$target_softmmu" = "yes"
1978 echo "CONFIG_XEN=yes" >> $config_mak
1979 echo "#define CONFIG_XEN 1" >> $config_h
1983 echo "TARGET_ARCH=alpha" >> $config_mak
1984 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1985 echo "#define TARGET_ALPHA 1" >> $config_h
1988 echo "TARGET_ARCH=arm" >> $config_mak
1989 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1990 echo "#define TARGET_ARM 1" >> $config_h
1993 gdb_xml_files
="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
1996 echo "TARGET_ARCH=cris" >> $config_mak
1997 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1998 echo "#define TARGET_CRIS 1" >> $config_h
2002 echo "TARGET_ARCH=m68k" >> $config_mak
2003 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
2004 echo "#define TARGET_M68K 1" >> $config_h
2006 gdb_xml_files
="cf-core.xml cf-fp.xml"
2009 echo "TARGET_ARCH=mips" >> $config_mak
2010 echo "#define TARGET_ARCH \"mips\"" >> $config_h
2011 echo "#define TARGET_MIPS 1" >> $config_h
2012 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
2015 echo "TARGET_ARCH=mipsn32" >> $config_mak
2016 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
2017 echo "#define TARGET_MIPS 1" >> $config_h
2018 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
2021 echo "TARGET_ARCH=mips64" >> $config_mak
2022 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
2023 echo "#define TARGET_MIPS 1" >> $config_h
2024 echo "#define TARGET_MIPS64 1" >> $config_h
2025 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
2028 echo "TARGET_ARCH=ppc" >> $config_mak
2029 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
2030 echo "#define TARGET_PPC 1" >> $config_h
2031 gdb_xml_files
="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2034 echo "TARGET_ARCH=ppcemb" >> $config_mak
2035 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2036 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
2037 echo "#define TARGET_PPC 1" >> $config_h
2038 echo "#define TARGET_PPCEMB 1" >> $config_h
2039 if test "$kvm" = "yes" ; then
2040 echo "USE_KVM=yes" >> $config_mak
2041 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
2042 echo "#define USE_KVM 1" >> $config_h
2044 gdb_xml_files
="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2047 echo "TARGET_ARCH=ppc64" >> $config_mak
2048 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2049 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
2050 echo "#define TARGET_PPC 1" >> $config_h
2051 echo "#define TARGET_PPC64 1" >> $config_h
2052 gdb_xml_files
="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2055 echo "TARGET_ARCH=ppc64" >> $config_mak
2056 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2057 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
2058 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
2059 echo "#define TARGET_PPC 1" >> $config_h
2060 echo "#define TARGET_PPC64 1" >> $config_h
2061 echo "#define TARGET_ABI32 1" >> $config_h
2062 gdb_xml_files
="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2065 echo "TARGET_ARCH=sh4" >> $config_mak
2066 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
2067 echo "#define TARGET_SH4 1" >> $config_h
2072 echo "TARGET_ARCH=sparc" >> $config_mak
2073 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
2074 echo "#define TARGET_SPARC 1" >> $config_h
2077 echo "TARGET_ARCH=sparc64" >> $config_mak
2078 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
2079 echo "#define TARGET_SPARC 1" >> $config_h
2080 echo "#define TARGET_SPARC64 1" >> $config_h
2084 echo "TARGET_ARCH=sparc64" >> $config_mak
2085 echo "TARGET_ABI_DIR=sparc" >> $config_mak
2086 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
2087 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
2088 echo "#define TARGET_SPARC 1" >> $config_h
2089 echo "#define TARGET_SPARC64 1" >> $config_h
2090 echo "#define TARGET_ABI32 1" >> $config_h
2093 echo "Unsupported target CPU"
2097 if test "$target_bigendian" = "yes" ; then
2098 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
2099 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
2101 if test "$target_softmmu" = "yes" ; then
2102 echo "CONFIG_SOFTMMU=yes" >> $config_mak
2103 echo "#define CONFIG_SOFTMMU 1" >> $config_h
2105 if test "$target_user_only" = "yes" ; then
2106 echo "CONFIG_USER_ONLY=yes" >> $config_mak
2107 echo "#define CONFIG_USER_ONLY 1" >> $config_h
2109 if test "$target_linux_user" = "yes" ; then
2110 echo "CONFIG_LINUX_USER=yes" >> $config_mak
2111 echo "#define CONFIG_LINUX_USER 1" >> $config_h
2113 if test "$target_darwin_user" = "yes" ; then
2114 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
2115 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
2118 if test ! -z "$gdb_xml_files" ; then
2119 for x
in $gdb_xml_files; do
2120 list
="$list $source_path/gdb-xml/$x"
2123 echo "TARGET_XML_FILES=$list" >> $config_mak
2125 if test "$target_cpu" = "arm" \
2126 -o "$target_cpu" = "armeb" \
2127 -o "$target_cpu" = "m68k" \
2128 -o "$target_cpu" = "mips" \
2129 -o "$target_cpu" = "mipsel" \
2130 -o "$target_cpu" = "mipsn32" \
2131 -o "$target_cpu" = "mipsn32el" \
2132 -o "$target_cpu" = "mips64" \
2133 -o "$target_cpu" = "mips64el" \
2134 -o "$target_cpu" = "ppc" \
2135 -o "$target_cpu" = "ppc64" \
2136 -o "$target_cpu" = "ppc64abi32" \
2137 -o "$target_cpu" = "ppcemb" \
2138 -o "$target_cpu" = "sparc" \
2139 -o "$target_cpu" = "sparc64" \
2140 -o "$target_cpu" = "sparc32plus"; then
2141 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
2142 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
2144 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
2145 echo "TARGET_HAS_BFLT=yes" >> $config_mak
2146 echo "#define TARGET_HAS_BFLT 1" >> $config_h
2148 if test "$target_user_only" = "yes" \
2149 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
2150 echo "#define USE_NPTL 1" >> $config_h
2152 # 32 bit ELF loader in addition to native 64 bit loader?
2153 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
2154 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
2155 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
2157 if test "$target_bsd_user" = "yes" ; then
2158 echo "CONFIG_BSD_USER=yes" >> $config_mak
2159 echo "#define CONFIG_BSD_USER 1" >> $config_h
2162 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~
$config_h
2164 done # for target in $targets
2166 # build tree in object directory if source path is different from current one
2167 if test "$source_path_used" = "yes" ; then
2168 DIRS
="tests tests/cris slirp audio"
2169 FILES
="Makefile tests/Makefile"
2170 FILES
="$FILES tests/cris/Makefile tests/cris/.gdbinit"
2171 FILES
="$FILES tests/test-mmap.c"
2172 for dir
in $DIRS ; do
2175 # remove the link and recreate it, as not all "ln -sf" overwrite the link
2176 for f
in $FILES ; do
2178 ln -s $source_path/$f $f