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
)
157 local fname
="$(dirname "$0")/KVM_VERSION"
159 if test -f "$fname"; then
201 kvm_cap_device_assignment
="no"
208 pkgversion
=" ($(kvm_version))"
214 if check_define __linux__
; then
216 elif check_define _WIN32
; then
218 elif check_define __OpenBSD__
; then
220 elif check_define __sun__
; then
228 OS_CFLAGS
="-mno-cygwin"
229 if [ "$cpu" = "i386" ] ; then
232 audio_possible_drivers
="sdl"
236 if [ "$cpu" = "i386" ] ; then
239 audio_possible_drivers
="dsound sdl fmod"
243 audio_possible_drivers
="oss sdl esd pa"
244 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
251 audio_possible_drivers
="oss sdl esd pa"
252 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
260 audio_possible_drivers
="oss sdl esd pa"
261 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
269 audio_possible_drivers
="oss sdl esd"
276 audio_possible_drivers
="oss sdl esd"
282 # 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
283 if [ "$cpu" = "i386" ] ; then
284 is_x86_64
=`sysctl -n hw.optional.x86_64`
285 [ "$is_x86_64" = "1" ] && cpu
=x86_64
287 if [ "$cpu" = "x86_64" ] ; then
288 OS_CFLAGS
="-arch x86_64"
289 LDFLAGS
="-arch x86_64"
291 OS_CFLAGS
="-mdynamic-no-pic"
295 audio_drv_list
="coreaudio"
296 audio_possible_drivers
="coreaudio sdl fmod"
297 OS_LDFLAGS
="-framework CoreFoundation -framework IOKit"
303 needs_libsunmath
="no"
305 solarisrev
=`uname -r | cut -f2 -d.`
306 # have to select again, because `uname -m` returns i86pc
307 # even on an x86_64 box.
308 solariscpu
=`isainfo -k`
309 if test "${solariscpu}" = "amd64" ; then
312 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
313 if test "$solarisrev" -le 9 ; then
314 if test -f /opt
/SUNWspro
/prod
/lib
/libsunmath.so
.1; then
315 needs_libsunmath
="yes"
317 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
318 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
319 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
320 echo "Studio 11 can be downloaded from www.sun.com."
324 if test "$solarisrev" -ge 9 ; then
328 if test -f /usr
/include
/sys
/soundcard.h
; then
331 audio_possible_drivers
="oss sdl"
340 audio_possible_drivers
="oss alsa sdl esd pa"
344 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
346 audio_possible_drivers
="$audio_possible_drivers fmod"
350 if [ "$cpu" = "ia64" ] ; then
353 target_list
="ia64-softmmu"
358 if [ "$cpu" = "powerpc" ]; then
364 if [ "$bsd" = "yes" ] ; then
365 if [ "$darwin" != "yes" ] ; then
373 source_path
=`dirname "$0"`
374 source_path_used
="no"
376 if [ -z "$source_path" ]; then
379 source_path
=`cd "$source_path"; pwd`
381 [ -f "$workdir/vl.c" ] || source_path_used
="yes"
384 # generate compile errors on warnings for development builds
385 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
390 optarg
=`expr "x$opt" : 'x[^=]*=\(.*\)'`
392 --help|
-h) show_help
=yes
394 --prefix=*) prefix
="$optarg"
396 --interp-prefix=*) interp_prefix
="$optarg"
398 --source-path=*) source_path
="$optarg"
399 source_path_used
="yes"
405 --host-cc=*) host_cc
="$optarg"
407 --make=*) make="$optarg"
409 --install=*) install="$optarg"
411 --extra-cflags=*) CFLAGS
="$optarg"
413 --extra-ldflags=*) LDFLAGS
="$optarg"
415 --cpu=*) cpu
="$optarg"
417 --target-list=*) target_list
="$optarg"
419 --enable-gprof) gprof
="yes"
421 --static) static
="yes"
423 --disable-sdl) sdl
="no"
425 --fmod-lib=*) fmod_lib
="$optarg"
427 --fmod-inc=*) fmod_inc
="$optarg"
429 --oss-lib=*) oss_lib
="$optarg"
431 --audio-card-list=*) audio_card_list
=`echo "$optarg" | sed -e 's/,/ /g'`
433 --audio-drv-list=*) audio_drv_list
="$optarg"
435 --enable-debug-tcg) debug_tcg
="yes"
437 --disable-debug-tcg) debug_tcg
="no"
439 --enable-sparse) sparse
="yes"
441 --disable-sparse) sparse
="no"
443 --disable-strip) strip_opt
="no"
445 --disable-vnc-tls) vnc_tls
="no"
447 --disable-vnc-sasl) vnc_sasl
="no"
449 --disable-slirp) slirp
="no"
451 --disable-vde) vde
="no"
453 --disable-kqemu) kqemu
="no"
455 --disable-xen) xen
="no"
457 --disable-brlapi) brlapi
="no"
459 --disable-bluez) bluez
="no"
461 --disable-kvm) kvm
="no"
463 --enable-profiler) profiler
="yes"
468 audio_drv_list
="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
470 --disable-gfx-check) check_gfx
="no"
472 --disable-system) softmmu
="no"
474 --enable-system) softmmu
="yes"
476 --disable-linux-user) linux_user
="no"
478 --enable-linux-user) linux_user
="yes"
480 --disable-darwin-user) darwin_user
="no"
482 --enable-darwin-user) darwin_user
="yes"
484 --disable-bsd-user) bsd_user
="no"
486 --enable-bsd-user) bsd_user
="yes"
488 --enable-uname-release=*) uname_release
="$optarg"
493 v7|v8
) SP_CFLAGS
="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m32"
494 target_cpu
="sparc"; cpu
="sparc" ;;
495 v8plus|v8plusa
) SP_CFLAGS
="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m32"
496 target_cpu
="sparc"; cpu
="sparc" ;;
497 v9
) SP_CFLAGS
="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m64"
498 target_cpu
="sparc64"; cpu
="sparc64" ;;
499 *) echo "undefined SPARC architecture. Exiting";exit 1;;
502 --enable-werror) werror
="yes"
504 --disable-werror) werror
="no"
506 --disable-curses) curses
="no"
508 --disable-nptl) nptl
="no"
510 --enable-mixemu) mixemu
="yes"
512 --disable-aio) aio
="no"
514 --disable-blobs) blobs
="no"
516 --kerneldir=*) kerneldir
="$optarg"
518 --with-pkgversion=*) pkgversion
=" ($optarg)"
520 --disable-cpu-emulation) cpu_emulation
="no"
522 *) echo "ERROR: unknown option $opt"; exit 1
527 # default flags for all hosts
528 CFLAGS
="$CFLAGS -O2 -g -fno-strict-aliasing"
529 CFLAGS
="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
530 LDFLAGS
="$LDFLAGS -g"
531 if test "$werror" = "yes" ; then
532 CFLAGS
="$CFLAGS -Werror"
535 CFLAGS
="$CFLAGS -I$(readlink -f "$source_path/kvm
/libkvm
")"
537 if test "$solaris" = "no" ; then
538 if ld
--version 2>/dev
/null |
grep "GNU ld" >/dev
/null
2>/dev
/null
; then
539 LDFLAGS
="$LDFLAGS -Wl,--warn-common"
544 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
545 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
548 sparc
) if test -z "$sparc_cpu" ; then
549 ARCH_CFLAGS
="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
552 ARCH_CFLAGS
="${SP_CFLAGS}"
553 ARCH_LDFLAGS
="${SP_LDFLAGS}"
555 ARCH_CFLAGS
="$ARCH_CFLAGS -ffixed-g2 -ffixed-g3"
556 if test "$solaris" = "no" ; then
557 ARCH_CFLAGS
="$ARCH_CFLAGS -ffixed-g1 -ffixed-g6"
560 sparc64
) if test -z "$sparc_cpu" ; then
561 ARCH_CFLAGS
="-m64 -mcpu=ultrasparc -D__sparc_v9__"
564 ARCH_CFLAGS
="${SP_CFLAGS}"
565 ARCH_LDFLAGS
="${SP_LDFLAGS}"
567 if test "$solaris" = "no" ; then
568 ARCH_CFLAGS
="$ARCH_CFLAGS -ffixed-g5 -ffixed-g6 -ffixed-g7"
570 ARCH_CFLAGS
="$ARCH_CFLAGS -ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7"
574 ARCH_CFLAGS
="-march=z900"
586 if test x
"$show_help" = x
"yes" ; then
589 Usage: configure [options]
590 Options: [defaults in brackets after descriptions]
593 echo "Standard options:"
594 echo " --help print this message"
595 echo " --prefix=PREFIX install in PREFIX [$prefix]"
596 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
597 echo " use %M for cpu name [$interp_prefix]"
598 echo " --target-list=LIST set target list [$target_list]"
600 echo "kqemu kernel acceleration support:"
601 echo " --disable-kqemu disable kqemu support"
603 echo "Advanced options (experts only):"
604 echo " --source-path=PATH path of source code [$source_path]"
605 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
606 echo " --cc=CC use C compiler CC [$cc]"
607 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
608 echo " --extra-cflags=CFLAGS add C compiler flags CFLAGS"
609 echo " --extra-ldflags=LDFLAGS add linker flags LDFLAGS"
610 echo " --make=MAKE use specified make [$make]"
611 echo " --install=INSTALL use specified install [$install]"
612 echo " --static enable static build [$static]"
613 echo " --enable-debug-tcg enable TCG debugging"
614 echo " --disable-debug-tcg disable TCG debugging (default)"
615 echo " --enable-sparse enable sparse checker"
616 echo " --disable-sparse disable sparse checker (default)"
617 echo " --disable-strip disable stripping binaries"
618 echo " --disable-werror disable compilation abort on warning"
619 echo " --disable-sdl disable SDL"
620 echo " --enable-cocoa enable COCOA (Mac OS X only)"
621 echo " --audio-drv-list=LIST set audio drivers list:"
622 echo " Available drivers: $audio_possible_drivers"
623 echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
624 echo " Available cards: $audio_possible_cards"
625 echo " --enable-mixemu enable mixer emulation"
626 echo " --disable-xen disable xen backend driver support"
627 echo " --disable-brlapi disable BrlAPI"
628 echo " --disable-vnc-tls disable TLS encryption for VNC server"
629 echo " --disable-vnc-sasl disable SASL encryption for VNC server"
630 echo " --disable-curses disable curses output"
631 echo " --disable-bluez disable bluez stack connectivity"
632 echo " --disable-kvm disable KVM acceleration support"
633 echo " --disable-nptl disable usermode NPTL support"
634 echo " --enable-system enable all system emulation targets"
635 echo " --disable-system disable all system emulation targets"
636 echo " --enable-linux-user enable all linux usermode emulation targets"
637 echo " --disable-linux-user disable all linux usermode emulation targets"
638 echo " --enable-darwin-user enable all darwin usermode emulation targets"
639 echo " --disable-darwin-user disable all darwin usermode emulation targets"
640 echo " --enable-bsd-user enable all BSD usermode emulation targets"
641 echo " --disable-bsd-user disable all BSD usermode emulation targets"
642 echo " --fmod-lib path to FMOD library"
643 echo " --fmod-inc path to FMOD includes"
644 echo " --oss-lib path to OSS library"
645 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
646 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
647 echo " --disable-vde disable support for vde network"
648 echo " --disable-aio disable AIO support"
649 echo " --disable-blobs disable installing provided firmware blobs"
650 echo " --kerneldir=PATH look for kernel includes in PATH"
651 echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
653 echo "NOTE: The object files are built at the place where configure is launched"
657 if test "$mingw32" = "yes" ; then
663 OS_CFLAGS
="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
666 if test ! -x "$(which cgcc 2>/dev/null)"; then
671 # Solaris specific configure tool chain decisions
673 if test "$solaris" = "yes" ; then
674 solinst
=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
675 if test -z "$solinst" ; then
676 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
677 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
678 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
681 if test "$solinst" = "/usr/sbin/install" ; then
682 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
683 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
684 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
687 sol_ar
=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
688 if test -z "$sol_ar" ; then
689 echo "Error: No path includes ar"
690 if test -f /usr
/ccs
/bin
/ar ; then
691 echo "Add /usr/ccs/bin to your path and rerun configure"
698 if test -z "$target_list" ; then
699 # these targets are portable
700 if [ "$softmmu" = "yes" ] ; then
719 # the following are Linux specific
720 if [ "$linux_user" = "yes" ] ; then
721 target_list
="${target_list}\
733 ppc64abi32-linux-user \
738 sparc32plus-linux-user \
741 # the following are Darwin specific
742 if [ "$darwin_user" = "yes" ] ; then
743 target_list
="$target_list i386-darwin-user ppc-darwin-user "
745 # the following are BSD specific
746 if [ "$bsd_user" = "yes" ] ; then
747 target_list
="${target_list}\
755 target_list
=`echo "$target_list" | sed -e 's/,/ /g'`
757 if test -z "$target_list" ; then
758 echo "No targets enabled"
762 if test -z "$cross_prefix" ; then
765 # big/little endian test
767 #include <inttypes.h>
768 int main(int argc, char ** argv){
769 volatile uint32_t i=0x01234567;
770 return (*((uint8_t*)(&i))) == 0x67;
774 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
775 $TMPE && bigendian
="yes"
777 echo big
/little
test failed
782 # if cross compiling, cannot launch a program, so make a static guess
783 if test "$cpu" = "armv4b" \
787 -o "$cpu" = "mips64" \
789 -o "$cpu" = "ppc64" \
791 -o "$cpu" = "sparc" \
792 -o "$cpu" = "sparc64"; then
798 # host long bits test
800 if test "$cpu" = "x86_64" \
801 -o "$cpu" = "alpha" \
803 -o "$cpu" = "sparc64" \
804 -o "$cpu" = "ppc64"; then
808 # Check host NPTL support
811 #include <linux/futex.h>
814 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
820 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev
/null
2> /dev
/null
; then
826 ##########################################
843 if test "$kvm" = "yes" ; then
845 kvm_cflags
="-I$source_path/kvm/kernel/include"
846 kvm_cflags
="$kvm_cflags -I$source_path/kvm/kernel/arch/$kvm_arch/include"
848 # test for KVM_CAP_PIT
853 #error "kvm no pit capability"
855 int main(void) { return 0; }
857 if $cc $ARCH_CFLAGS $CFLAGS $kvm_cflags -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev
/null
; then
861 # test for KVM_CAP_DEVICE_ASSIGNMENT
865 #ifndef KVM_CAP_DEVICE_ASSIGNMENT
866 #error "kvm no device assignment capability"
868 int main(void) { return 0; }
870 if $cc $ARCH_CFLAGS $CFLAGS $kvm_cflags -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev
/null
; then
871 kvm_cap_device_assignment
="yes"
875 # libpci probe for kvm_cap_device_assignment
876 if test $kvm_cap_device_assignment = "yes" ; then
879 #ifndef PCI_VENDOR_ID
882 int main(void) { return 0; }
884 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC 2>/dev
/null
; then
888 echo "Error: libpci check failed"
889 echo "Disable KVM Device Assignment capability."
891 kvm_cap_device_assignment
="no"
895 ##########################################
900 int main(void) { zlibVersion(); return 0; }
902 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev
/null
2> /dev
/null
; then
906 echo "Error: zlib check failed"
907 echo "Make sure to have the zlib libs and headers installed."
912 ##########################################
915 if test "$xen" = "yes" ; then
919 int main(void) { xs_daemon_open; xc_interface_open; }
921 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC -lxenstore -lxenctrl 2> /dev
/null
; then
928 ##########################################
933 if test -z "$sdl" ; then
934 sdl_config
="sdl-config"
940 #undef main /* We don't want SDL to override our main() */
941 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
943 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
944 _sdlversion
=`$sdl_config --version | sed 's/[^0-9]//g'`
945 if test "$_sdlversion" -lt 121 ; then
948 if test "$cocoa" = "no" ; then
953 # static link with sdl ?
954 if test "$sdl" = "yes" ; then
956 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa
="yes"
957 sdl_static_libs
=`$sdl_config --static-libs 2>/dev/null`
958 if [ "$aa" = "yes" ] ; then
959 sdl_static_libs
="$sdl_static_libs `aalib-config --static-libs`"
962 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev
/null
2> /dev
/null
; then
966 fi # sdl compile test
968 # Make sure to disable cocoa if sdl was set
969 if test "$sdl" = "yes" ; then
971 audio_drv_list
="`echo $audio_drv_list | sed s,coreaudio,,g`"
975 if test "$sdl" = "yes" ; then
978 #if defined(SDL_VIDEO_DRIVER_X11)
979 #include <X11/XKBlib.h>
981 #error No x11 support
983 int main(void) { return 0; }
985 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
990 ##########################################
992 if test "$vnc_tls" = "yes" ; then
994 #include <gnutls/gnutls.h>
995 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
997 vnc_tls_cflags
=`pkg-config --cflags gnutls 2> /dev/null`
998 vnc_tls_libs
=`pkg-config --libs gnutls 2> /dev/null`
999 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
1000 $vnc_tls_libs > /dev
/null
2> /dev
/null
; then
1007 ##########################################
1008 # VNC SASL detection
1009 if test "$vnc_sasl" = "yes" ; then
1011 #include <sasl/sasl.h>
1013 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
1015 # Assuming Cyrus-SASL installed in /usr prefix
1017 vnc_sasl_libs
="-lsasl2"
1018 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
1019 $vnc_sasl_libs 2> /dev
/null
; then
1026 ##########################################
1027 # fnmatch() probe, used for ACL routines
1030 #include <fnmatch.h>
1033 fnmatch("foo", "foo", 0);
1037 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
1041 ##########################################
1042 # vde libraries probe
1043 if test "$vde" = "yes" ; then
1045 #include <libvdeplug.h>
1048 struct vde_open_args a = {0, 0, 0};
1049 vde_open("", "", &a);
1053 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev
/null
2> /dev
/null
; then
1060 ##########################################
1061 # Sound support libraries probe
1072 int main(void) { $exp }
1074 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev
/null
2> /dev
/null
; then
1078 echo "Error: $drv check failed"
1079 echo "Make sure to have the $drv libs and headers installed."
1085 audio_drv_list
=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1086 for drv
in $audio_drv_list; do
1089 audio_drv_probe
$drv alsa
/asoundlib.h
-lasound \
1090 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1094 if test -z $fmod_lib ||
test -z $fmod_inc; then
1096 echo "Error: You must specify path to FMOD library and headers"
1097 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1101 audio_drv_probe
$drv fmod.h
$fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1105 audio_drv_probe
$drv esd.h
-lesd 'return esd_play_stream(0, 0, "", 0);'
1109 audio_drv_probe
$drv pulse
/simple.h
-lpulse-simple \
1110 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1113 oss|sdl|core|wav|dsound
)
1114 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1118 echo "$audio_possible_drivers" |
grep -q "\<$drv\>" ||
{
1120 echo "Error: Unknown driver '$drv' selected"
1121 echo "Possible drivers are: $audio_possible_drivers"
1129 ##########################################
1132 if test -z "$brlapi" ; then
1136 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1138 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev
/null
2> /dev
/null
; then
1140 fi # brlapi compile test
1143 ##########################################
1146 if test "$curses" = "yes" ; then
1151 #define resize_term resizeterm
1153 int main(void) { resize_term(0, 0); return curses_version(); }
1155 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev
/null
2> /dev
/null
; then
1160 ##########################################
1161 # bluez support probe
1162 if test "$bluez" = "yes" ; then
1163 `pkg-config bluez` || bluez
="no"
1165 if test "$bluez" = "yes" ; then
1167 #include <bluetooth/bluetooth.h>
1168 int main(void) { return bt_error(0); }
1170 bluez_cflags
=`pkg-config --cflags bluez`
1171 bluez_libs
=`pkg-config --libs bluez`
1172 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
1173 $bluez_libs > /dev
/null
2> /dev
/null
; then
1180 ##########################################
1182 if test "$kvm" = "yes" ; then
1184 #include <linux/kvm.h>
1185 #if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
1186 #error Invalid KVM version
1188 #if !defined(KVM_CAP_USER_MEMORY)
1189 #error Missing KVM capability KVM_CAP_USER_MEMORY
1191 #if !defined(KVM_CAP_SET_TSS_ADDR)
1192 #error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1194 #if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1195 #error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1197 int main(void) { return 0; }
1199 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
1200 > /dev
/null
2>/dev
/null
; then
1204 if [ -x "`which awk 2>/dev/null`" ] && \
1205 [ -x "`which grep 2>/dev/null`" ]; then
1206 kvmerr
=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
1208 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1209 if test "$kvmerr" != "" ; then
1210 kvm
="no - (${kvmerr})"
1216 ##########################################
1220 if test "$aio" = "yes" ; then
1223 #include <pthread.h>
1224 int main(void) { pthread_mutex_t lock; return 0; }
1226 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev
/null
; then
1232 ##########################################
1235 #include <sys/types.h>
1236 #include <sys/uio.h>
1238 int main(void) { struct iovec iov; return 0; }
1241 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
1245 ##########################################
1248 #include <sys/types.h>
1249 #include <sys/uio.h>
1251 int main(void) { preadv; }
1254 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
1258 ##########################################
1260 if test "$fdt" = "yes" ; then
1263 int main(void) { return 0; }
1265 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev
/null
; then
1271 # Check for xxxat() functions when we are building linux-user
1272 # emulator. This is done because older glibc versions don't
1273 # have syscall stubs for these implemented.
1276 if [ "$linux_user" = "yes" ] ; then
1278 #define _ATFILE_SOURCE
1279 #include <sys/types.h>
1286 /* try to unlink nonexisting file */
1287 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1290 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
1295 # Check for inotify functions when we are building linux-user
1296 # emulator. This is done because older glibc versions don't
1297 # have syscall stubs for these implemented. In that case we
1298 # don't provide them even if kernel supports them.
1301 if [ "$linux_user" = "yes" ] ; then
1303 #include <sys/inotify.h>
1308 /* try to start inotify */
1309 return inotify_init();
1312 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
1317 ##########################################
1322 #include <sys/syscall.h>
1324 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
1327 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
1331 ##########################################
1336 #include <sys/syscall.h>
1337 int main(void) { return syscall(SYS_eventfd, 0); }
1340 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
1344 # Check if tools are available to build documentation.
1345 if [ -x "`which texi2html 2>/dev/null`" ] && \
1346 [ -x "`which pod2man 2>/dev/null`" ]; then
1350 ##########################################
1355 int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1359 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
1361 elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev
/null
2> /dev
/null
; then
1365 if test "$rt" = "yes" ; then
1366 # Hack, we should have a general purpose LIBS for this sort of thing
1367 AIOLIBS
="$AIOLIBS -lrt"
1370 if test "$mingw32" = "yes" ; then
1371 if test -z "$prefix" ; then
1372 prefix
="c:\\\\Program Files\\\\Qemu"
1379 if test -z "$prefix" ; then
1382 mansuffix
="/share/man"
1383 datasuffix
="/share/qemu"
1384 docsuffix
="/share/doc/qemu"
1388 echo "Install prefix $prefix"
1389 echo "BIOS directory $prefix$datasuffix"
1390 echo "binary directory $prefix$binsuffix"
1391 if test "$mingw32" = "no" ; then
1392 echo "Manual directory $prefix$mansuffix"
1393 echo "ELF interp prefix $interp_prefix"
1395 echo "Source path $source_path"
1396 echo "C compiler $cc"
1397 echo "Host C compiler $host_cc"
1398 echo "ARCH_CFLAGS $ARCH_CFLAGS"
1400 echo "install $install"
1401 echo "host CPU $cpu"
1402 echo "host big endian $bigendian"
1403 echo "target list $target_list"
1404 echo "tcg debug enabled $debug_tcg"
1405 echo "gprof enabled $gprof"
1406 echo "sparse enabled $sparse"
1407 echo "strip binaries $strip_opt"
1408 echo "profiler $profiler"
1409 echo "static build $static"
1410 echo "-Werror enabled $werror"
1411 if test "$darwin" = "yes" ; then
1412 echo "Cocoa support $cocoa"
1414 echo "SDL support $sdl"
1415 if test "$sdl" != "no" ; then
1416 echo "SDL static link $sdl_static"
1418 echo "curses support $curses"
1419 echo "mingw32 support $mingw32"
1420 echo "Audio drivers $audio_drv_list"
1421 echo "Extra audio cards $audio_card_list"
1422 echo "Mixer emulation $mixemu"
1423 echo "VNC TLS support $vnc_tls"
1424 if test "$vnc_tls" = "yes" ; then
1425 echo " TLS CFLAGS $vnc_tls_cflags"
1426 echo " TLS LIBS $vnc_tls_libs"
1428 echo "VNC SASL support $vnc_sasl"
1429 if test "$vnc_sasl" = "yes" ; then
1430 echo " SASL CFLAGS $vnc_sasl_cflags"
1431 echo " SASL LIBS $vnc_sasl_libs"
1433 if test -n "$sparc_cpu"; then
1434 echo "Target Sparc Arch $sparc_cpu"
1436 echo "kqemu support $kqemu"
1437 echo "xen support $xen"
1438 echo "CPU emulation $cpu_emulation"
1439 echo "brlapi support $brlapi"
1440 echo "Documentation $build_docs"
1441 [ ! -z "$uname_release" ] && \
1442 echo "uname -r $uname_release"
1443 echo "NPTL support $nptl"
1444 echo "vde support $vde"
1445 echo "AIO support $aio"
1446 echo "Install blobs $blobs"
1447 echo "KVM support $kvm"
1448 echo "fdt support $fdt"
1449 echo "preadv support $preadv"
1451 if test $sdl_too_old = "yes"; then
1452 echo "-> Your SDL version is too old - please upgrade to have SDL support"
1454 if [ -s $TMPSDLLOG ]; then
1455 echo "The error log from compiling the libSDL test is: "
1458 #if test "$sdl_static" = "no"; then
1459 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1461 config_mak
="config-host.mak"
1462 config_h
="config-host.h"
1464 #echo "Creating $config_mak and $config_h"
1466 test -f $config_h && mv $config_h ${config_h}~
1468 echo "# Automatically generated by configure - do not modify" > $config_mak
1469 printf "# Configured with:" >> $config_mak
1470 printf " '%s'" "$0" "$@" >> $config_mak
1472 echo "/* Automatically generated by configure - do not modify */" > $config_h
1474 echo "prefix=$prefix" >> $config_mak
1475 echo "bindir=\${prefix}$binsuffix" >> $config_mak
1476 echo "mandir=\${prefix}$mansuffix" >> $config_mak
1477 echo "datadir=\${prefix}$datasuffix" >> $config_mak
1478 echo "docdir=\${prefix}$docsuffix" >> $config_mak
1479 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
1480 echo "MAKE=$make" >> $config_mak
1481 echo "INSTALL=$install" >> $config_mak
1482 echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_mak
1483 echo "INSTALL_DATA=$install -m0644 -p" >> $config_mak
1484 echo "INSTALL_PROG=$install -m0755 -p" >> $config_mak
1485 echo "CC=$cc" >> $config_mak
1486 echo "HOST_CC=$host_cc" >> $config_mak
1487 echo "AR=$ar" >> $config_mak
1488 # XXX: only use CFLAGS and LDFLAGS ?
1489 # XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1490 # compilation of dyngen tool (useful for win32 build on Linux host)
1491 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
1492 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1493 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1494 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
1495 echo "CFLAGS=$CFLAGS" >> $config_mak
1496 echo "LDFLAGS=$LDFLAGS" >> $config_mak
1497 echo "EXESUF=$EXESUF" >> $config_mak
1498 echo "AIOLIBS=$AIOLIBS" >> $config_mak
1501 echo "ARCH=i386" >> $config_mak
1502 echo "#define HOST_I386 1" >> $config_h
1505 echo "ARCH=x86_64" >> $config_mak
1506 echo "#define HOST_X86_64 1" >> $config_h
1509 echo "ARCH=alpha" >> $config_mak
1510 echo "#define HOST_ALPHA 1" >> $config_h
1513 echo "ARCH=arm" >> $config_mak
1514 echo "#define HOST_ARM 1" >> $config_h
1517 echo "ARCH=arm" >> $config_mak
1518 echo "#define HOST_ARM 1" >> $config_h
1521 echo "ARCH=cris" >> $config_mak
1522 echo "#define HOST_CRIS 1" >> $config_h
1525 echo "ARCH=hppa" >> $config_mak
1526 echo "#define HOST_HPPA 1" >> $config_h
1529 echo "ARCH=ia64" >> $config_mak
1530 echo "#define HOST_IA64 1" >> $config_h
1533 echo "ARCH=m68k" >> $config_mak
1534 echo "#define HOST_M68K 1" >> $config_h
1537 echo "ARCH=mips" >> $config_mak
1538 echo "#define HOST_MIPS 1" >> $config_h
1541 echo "ARCH=mips64" >> $config_mak
1542 echo "#define HOST_MIPS64 1" >> $config_h
1545 echo "ARCH=ppc" >> $config_mak
1546 echo "#define HOST_PPC 1" >> $config_h
1549 echo "ARCH=ppc64" >> $config_mak
1550 echo "#define HOST_PPC64 1" >> $config_h
1553 echo "ARCH=s390" >> $config_mak
1554 echo "#define HOST_S390 1" >> $config_h
1557 echo "ARCH=sparc" >> $config_mak
1558 echo "#define HOST_SPARC 1" >> $config_h
1561 echo "ARCH=sparc64" >> $config_mak
1562 echo "#define HOST_SPARC64 1" >> $config_h
1565 echo "Unsupported CPU = $cpu"
1569 if test "$debug_tcg" = "yes" ; then
1570 echo "#define DEBUG_TCG 1" >> $config_h
1572 if test "$sparse" = "yes" ; then
1573 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1574 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1575 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1577 if test "$strip_opt" = "yes" ; then
1578 echo "STRIP_OPT=-s" >> $config_mak
1580 if test "$bigendian" = "yes" ; then
1581 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1582 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1584 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
1585 if test "$mingw32" = "yes" ; then
1586 echo "CONFIG_WIN32=yes" >> $config_mak
1587 echo "#define CONFIG_WIN32 1" >> $config_h
1590 #include <byteswap.h>
1591 int main(void) { return bswap_32(0); }
1593 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev
/null
2> /dev
/null
; then
1594 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1597 #include <sys/endian.h>
1598 #include <sys/types.h>
1599 #include <machine/bswap.h>
1600 int main(void) { return bswap32(0); }
1602 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev
/null
2> /dev
/null
; then
1603 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1607 if [ "$openbsd" = "yes" ] ; then
1608 echo "#define ENOTSUP 4096" >> $config_h
1611 if test "$darwin" = "yes" ; then
1612 echo "CONFIG_DARWIN=yes" >> $config_mak
1613 echo "#define CONFIG_DARWIN 1" >> $config_h
1616 if test "$aix" = "yes" ; then
1617 echo "CONFIG_AIX=yes" >> $config_mak
1618 echo "#define CONFIG_AIX 1" >> $config_h
1621 if test "$solaris" = "yes" ; then
1622 echo "CONFIG_SOLARIS=yes" >> $config_mak
1623 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
1624 if test "$needs_libsunmath" = "yes" ; then
1625 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1626 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1629 if test -n "$sparc_cpu"; then
1630 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1631 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1633 if test "$gdbstub" = "yes" ; then
1634 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1635 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1637 if test "$gprof" = "yes" ; then
1638 echo "TARGET_GPROF=yes" >> $config_mak
1639 echo "#define HAVE_GPROF 1" >> $config_h
1641 if test "$static" = "yes" ; then
1642 echo "CONFIG_STATIC=yes" >> $config_mak
1643 echo "#define CONFIG_STATIC 1" >> $config_h
1645 if test $profiler = "yes" ; then
1646 echo "#define CONFIG_PROFILER 1" >> $config_h
1648 if test "$slirp" = "yes" ; then
1649 echo "CONFIG_SLIRP=yes" >> $config_mak
1650 echo "#define CONFIG_SLIRP 1" >> $config_h
1652 if test "$vde" = "yes" ; then
1653 echo "CONFIG_VDE=yes" >> $config_mak
1654 echo "#define CONFIG_VDE 1" >> $config_h
1655 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1657 for card
in $audio_card_list; do
1658 def
=CONFIG_
`echo $card | tr '[:lower:]' '[:upper:]'`
1659 echo "$def=yes" >> $config_mak
1660 echo "#define $def 1" >> $config_h
1662 echo "#define AUDIO_DRIVERS \\" >> $config_h
1663 for drv
in $audio_drv_list; do
1664 echo " &${drv}_audio_driver, \\" >>$config_h
1665 def
=CONFIG_
`echo $drv | tr '[:lower:]' '[:upper:]'`
1666 echo "$def=yes" >> $config_mak
1667 if test "$drv" = "fmod"; then
1668 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1669 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1670 elif test "$drv" = "oss"; then
1671 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
1675 if test "$mixemu" = "yes" ; then
1676 echo "CONFIG_MIXEMU=yes" >> $config_mak
1677 echo "#define CONFIG_MIXEMU 1" >> $config_h
1679 if test "$vnc_tls" = "yes" ; then
1680 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1681 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1682 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1683 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1685 if test "$vnc_sasl" = "yes" ; then
1686 echo "CONFIG_VNC_SASL=yes" >> $config_mak
1687 echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1688 echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1689 echo "#define CONFIG_VNC_SASL 1" >> $config_h
1691 if test "$fnmatch" = "yes" ; then
1692 echo "#define HAVE_FNMATCH_H 1" >> $config_h
1694 qemu_version
=`head $source_path/VERSION`
1695 echo "VERSION=$qemu_version" >>$config_mak
1696 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1697 echo "#define QEMU_PKGVERSION \"$pkgversion\"" >> $config_h
1699 echo "SRC_PATH=$source_path" >> $config_mak
1700 if [ "$source_path_used" = "yes" ]; then
1701 echo "VPATH=$source_path" >> $config_mak
1703 echo "TARGET_DIRS=$target_list" >> $config_mak
1704 if [ "$build_docs" = "yes" ] ; then
1705 echo "BUILD_DOCS=yes" >> $config_mak
1707 if test "$static" = "yes"; then
1712 if test "$sdl1" = "yes" ; then
1713 echo "#define CONFIG_SDL 1" >> $config_h
1714 echo "CONFIG_SDL=yes" >> $config_mak
1715 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1716 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1717 elif test "$sdl_x11" = "yes" ; then
1718 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
1720 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1722 if [ "${aa}" = "yes" ] ; then
1723 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1725 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1728 if test "$cocoa" = "yes" ; then
1729 echo "#define CONFIG_COCOA 1" >> $config_h
1730 echo "CONFIG_COCOA=yes" >> $config_mak
1732 if test "$curses" = "yes" ; then
1733 echo "#define CONFIG_CURSES 1" >> $config_h
1734 echo "CONFIG_CURSES=yes" >> $config_mak
1735 echo "CURSES_LIBS=-lcurses" >> $config_mak
1737 if test "$atfile" = "yes" ; then
1738 echo "#define CONFIG_ATFILE 1" >> $config_h
1740 if test "$inotify" = "yes" ; then
1741 echo "#define CONFIG_INOTIFY 1" >> $config_h
1743 if test "$brlapi" = "yes" ; then
1744 echo "CONFIG_BRLAPI=yes" >> $config_mak
1745 echo "#define CONFIG_BRLAPI 1" >> $config_h
1746 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1748 if test "$bluez" = "yes" ; then
1749 echo "CONFIG_BLUEZ=yes" >> $config_mak
1750 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1751 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1752 echo "#define CONFIG_BLUEZ 1" >> $config_h
1754 if test "$xen" = "yes" ; then
1755 echo "XEN_LIBS=-lxenstore -lxenctrl -lxenguest" >> $config_mak
1757 if test "$aio" = "yes" ; then
1758 echo "#define CONFIG_AIO 1" >> $config_h
1759 echo "CONFIG_AIO=yes" >> $config_mak
1761 if test "$blobs" = "yes" ; then
1762 echo "INSTALL_BLOBS=yes" >> $config_mak
1764 if test "$iovec" = "yes" ; then
1765 echo "#define HAVE_IOVEC 1" >> $config_h
1767 if test "$preadv" = "yes" ; then
1768 echo "#define HAVE_PREADV 1" >> $config_h
1770 if test "$fdt" = "yes" ; then
1771 echo "#define HAVE_FDT 1" >> $config_h
1772 echo "FDT_LIBS=-lfdt" >> $config_mak
1774 if test "$signalfd" = "yes" ; then
1775 echo "#define CONFIG_signalfd 1" >> $config_h
1777 if test "$eventfd" = "yes" ; then
1778 echo "#define CONFIG_eventfd 1" >> $config_h
1781 # XXX: suppress that
1782 if [ "$bsd" = "yes" ] ; then
1783 echo "#define O_LARGEFILE 0" >> $config_h
1784 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1785 echo "#define HOST_BSD 1" >> $config_h
1788 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1793 echo "HOST_USB=linux" >> $config_mak
1796 echo "HOST_USB=bsd" >> $config_mak
1799 echo "HOST_USB=stub" >> $config_mak
1803 # this is a temp hack needed for libkvm
1804 if test "$kvm" = "yes" ; then
1805 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1809 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1810 tools
="qemu-img\$(EXESUF) $tools"
1811 if [ "$linux" = "yes" ] ; then
1812 tools
="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
1815 echo "TOOLS=$tools" >> $config_mak
1817 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~
$config_h
1819 for target
in $target_list; do
1820 target_dir
="$target"
1821 config_mak
=$target_dir/config.mak
1822 config_h
=$target_dir/config.h
1823 target_cpu
=`echo $target | cut -d '-' -f 1`
1824 target_bigendian
="no"
1825 [ "$target_cpu" = "armeb" ] && target_bigendian
=yes
1826 [ "$target_cpu" = "m68k" ] && target_bigendian
=yes
1827 [ "$target_cpu" = "mips" ] && target_bigendian
=yes
1828 [ "$target_cpu" = "mipsn32" ] && target_bigendian
=yes
1829 [ "$target_cpu" = "mips64" ] && target_bigendian
=yes
1830 [ "$target_cpu" = "ppc" ] && target_bigendian
=yes
1831 [ "$target_cpu" = "ppcemb" ] && target_bigendian
=yes
1832 [ "$target_cpu" = "ppc64" ] && target_bigendian
=yes
1833 [ "$target_cpu" = "ppc64abi32" ] && target_bigendian
=yes
1834 [ "$target_cpu" = "sh4eb" ] && target_bigendian
=yes
1835 [ "$target_cpu" = "sparc" ] && target_bigendian
=yes
1836 [ "$target_cpu" = "sparc64" ] && target_bigendian
=yes
1837 [ "$target_cpu" = "sparc32plus" ] && target_bigendian
=yes
1839 target_user_only
="no"
1840 target_linux_user
="no"
1841 target_darwin_user
="no"
1842 target_bsd_user
="no"
1844 ${target_cpu}-softmmu)
1845 target_softmmu
="yes"
1847 ${target_cpu}-linux-user)
1848 target_user_only
="yes"
1849 target_linux_user
="yes"
1851 ${target_cpu}-darwin-user)
1852 target_user_only
="yes"
1853 target_darwin_user
="yes"
1855 ${target_cpu}-bsd-user)
1856 target_user_only
="yes"
1857 target_bsd_user
="yes"
1860 echo "ERROR: Target '$target' not recognised"
1865 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1866 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1867 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1868 echo "To build QEMU without graphical output configure with --disable-gfx-check"
1869 echo "Note that this will disable all output from the virtual graphics card"
1870 echo "except through VNC or curses."
1874 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1876 test -f $config_h && mv $config_h ${config_h}~
1878 mkdir
-p $target_dir
1879 mkdir
-p $target_dir/fpu
1880 mkdir
-p $target_dir/tcg
1881 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
1882 mkdir
-p $target_dir/nwfpe
1886 # don't use ln -sf as not all "ln -sf" over write the file/link
1888 rm -f $target_dir/Makefile
1889 ln -s $source_path/Makefile.target
$target_dir/Makefile
1892 echo "# Automatically generated by configure - do not modify" > $config_mak
1893 echo "/* Automatically generated by configure - do not modify */" > $config_h
1896 echo "include ../config-host.mak" >> $config_mak
1897 echo "#include \"../config-host.h\"" >> $config_h
1902 interp_prefix1
=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1903 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1906 disable_cpu_emulation
() {
1907 if test $cpu_emulation = "no"; then
1908 echo "#define NO_CPU_EMULATION 1" >> $config_h
1909 echo "NO_CPU_EMULATION=1" >> $config_mak
1914 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
1915 \
( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \
); then
1916 echo "#define USE_KVM 1" >> $config_h
1917 echo "USE_KVM=1" >> $config_mak
1918 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1919 if test $kvm_cap_pit = "yes" ; then
1920 echo "USE_KVM_PIT=1" >> $config_mak
1921 echo "#define USE_KVM_PIT 1" >> $config_h
1923 if test $kvm_cap_device_assignment = "yes" ; then
1924 echo "USE_KVM_DEVICE_ASSIGNMENT=1" >> $config_mak
1925 echo "#define USE_KVM_DEVICE_ASSIGNMENT 1" >> $config_h
1927 disable_cpu_emulation
1931 if [ use_upstream_kvm
= yes ]; then
1933 # Make sure the target and host cpus are compatible
1934 if test "$kvm" = "yes" -a ! \
( "$target_cpu" = "$cpu" -o \
1935 \
( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \
) -o \
1936 \
( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \
) -o \
1937 \
( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \
) \
) ; then
1940 # Disable KVM for linux-user
1941 if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1947 case "$target_cpu" in
1949 echo "TARGET_ARCH=i386" >> $config_mak
1950 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1951 echo "#define TARGET_I386 1" >> $config_h
1952 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
1954 echo "CONFIG_KQEMU=yes" >> $config_mak
1955 echo "#define CONFIG_KQEMU 1" >> $config_h
1957 if test "$kvm" = "yes" ; then
1958 echo "USE_KVM=yes" >> $config_mak
1959 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1960 echo "#define USE_KVM 1" >> $config_h
1962 if test "$xen" = "yes" -a "$target_softmmu" = "yes";
1964 echo "CONFIG_XEN=yes" >> $config_mak
1965 echo "#define CONFIG_XEN 1" >> $config_h
1970 echo "TARGET_ARCH=x86_64" >> $config_mak
1971 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1972 echo "#define TARGET_I386 1" >> $config_h
1973 echo "#define TARGET_X86_64 1" >> $config_h
1974 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1976 echo "CONFIG_KQEMU=yes" >> $config_mak
1977 echo "#define CONFIG_KQEMU 1" >> $config_h
1982 echo "TARGET_ARCH=ia64" >> $config_mak
1983 echo "#define TARGET_ARCH \"ia64\"" >> $config_h
1984 echo "#define TARGET_IA64 1" >> $config_h
1986 if [ use_upstream_kvm
= yes ]; then
1987 if test "$kvm" = "yes" ; then
1988 echo "USE_KVM=yes" >> $config_mak
1989 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1990 echo "#define USE_KVM 1" >> $config_h
1993 if test "$xen" = "yes" -a "$target_softmmu" = "yes"
1995 echo "CONFIG_XEN=yes" >> $config_mak
1996 echo "#define CONFIG_XEN 1" >> $config_h
2000 echo "TARGET_ARCH=alpha" >> $config_mak
2001 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
2002 echo "#define TARGET_ALPHA 1" >> $config_h
2005 echo "TARGET_ARCH=arm" >> $config_mak
2006 echo "#define TARGET_ARCH \"arm\"" >> $config_h
2007 echo "#define TARGET_ARM 1" >> $config_h
2010 gdb_xml_files
="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
2013 echo "TARGET_ARCH=cris" >> $config_mak
2014 echo "#define TARGET_ARCH \"cris\"" >> $config_h
2015 echo "#define TARGET_CRIS 1" >> $config_h
2019 echo "TARGET_ARCH=m68k" >> $config_mak
2020 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
2021 echo "#define TARGET_M68K 1" >> $config_h
2023 gdb_xml_files
="cf-core.xml cf-fp.xml"
2026 echo "TARGET_ARCH=mips" >> $config_mak
2027 echo "#define TARGET_ARCH \"mips\"" >> $config_h
2028 echo "#define TARGET_MIPS 1" >> $config_h
2029 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
2032 echo "TARGET_ARCH=mipsn32" >> $config_mak
2033 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
2034 echo "#define TARGET_MIPS 1" >> $config_h
2035 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
2038 echo "TARGET_ARCH=mips64" >> $config_mak
2039 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
2040 echo "#define TARGET_MIPS 1" >> $config_h
2041 echo "#define TARGET_MIPS64 1" >> $config_h
2042 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
2045 echo "TARGET_ARCH=ppc" >> $config_mak
2046 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
2047 echo "#define TARGET_PPC 1" >> $config_h
2048 gdb_xml_files
="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2051 echo "TARGET_ARCH=ppcemb" >> $config_mak
2052 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2053 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
2054 echo "#define TARGET_PPC 1" >> $config_h
2055 echo "#define TARGET_PPCEMB 1" >> $config_h
2056 if test "$kvm" = "yes" ; then
2057 echo "USE_KVM=yes" >> $config_mak
2058 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
2059 echo "#define USE_KVM 1" >> $config_h
2061 gdb_xml_files
="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2064 echo "TARGET_ARCH=ppc64" >> $config_mak
2065 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2066 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
2067 echo "#define TARGET_PPC 1" >> $config_h
2068 echo "#define TARGET_PPC64 1" >> $config_h
2069 gdb_xml_files
="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2072 echo "TARGET_ARCH=ppc64" >> $config_mak
2073 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2074 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
2075 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
2076 echo "#define TARGET_PPC 1" >> $config_h
2077 echo "#define TARGET_PPC64 1" >> $config_h
2078 echo "#define TARGET_ABI32 1" >> $config_h
2079 gdb_xml_files
="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2082 echo "TARGET_ARCH=sh4" >> $config_mak
2083 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
2084 echo "#define TARGET_SH4 1" >> $config_h
2089 echo "TARGET_ARCH=sparc" >> $config_mak
2090 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
2091 echo "#define TARGET_SPARC 1" >> $config_h
2094 echo "TARGET_ARCH=sparc64" >> $config_mak
2095 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
2096 echo "#define TARGET_SPARC 1" >> $config_h
2097 echo "#define TARGET_SPARC64 1" >> $config_h
2101 echo "TARGET_ARCH=sparc64" >> $config_mak
2102 echo "TARGET_ABI_DIR=sparc" >> $config_mak
2103 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
2104 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
2105 echo "#define TARGET_SPARC 1" >> $config_h
2106 echo "#define TARGET_SPARC64 1" >> $config_h
2107 echo "#define TARGET_ABI32 1" >> $config_h
2110 echo "Unsupported target CPU"
2114 if test "$target_bigendian" = "yes" ; then
2115 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
2116 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
2118 if test "$target_softmmu" = "yes" ; then
2119 echo "CONFIG_SOFTMMU=yes" >> $config_mak
2120 echo "#define CONFIG_SOFTMMU 1" >> $config_h
2122 if test "$target_user_only" = "yes" ; then
2123 echo "CONFIG_USER_ONLY=yes" >> $config_mak
2124 echo "#define CONFIG_USER_ONLY 1" >> $config_h
2126 if test "$target_linux_user" = "yes" ; then
2127 echo "CONFIG_LINUX_USER=yes" >> $config_mak
2128 echo "#define CONFIG_LINUX_USER 1" >> $config_h
2130 if test "$target_darwin_user" = "yes" ; then
2131 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
2132 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
2135 if test ! -z "$gdb_xml_files" ; then
2136 for x
in $gdb_xml_files; do
2137 list
="$list $source_path/gdb-xml/$x"
2140 echo "TARGET_XML_FILES=$list" >> $config_mak
2142 if test "$target_cpu" = "arm" \
2143 -o "$target_cpu" = "armeb" \
2144 -o "$target_cpu" = "m68k" \
2145 -o "$target_cpu" = "mips" \
2146 -o "$target_cpu" = "mipsel" \
2147 -o "$target_cpu" = "mipsn32" \
2148 -o "$target_cpu" = "mipsn32el" \
2149 -o "$target_cpu" = "mips64" \
2150 -o "$target_cpu" = "mips64el" \
2151 -o "$target_cpu" = "ppc" \
2152 -o "$target_cpu" = "ppc64" \
2153 -o "$target_cpu" = "ppc64abi32" \
2154 -o "$target_cpu" = "ppcemb" \
2155 -o "$target_cpu" = "sparc" \
2156 -o "$target_cpu" = "sparc64" \
2157 -o "$target_cpu" = "sparc32plus"; then
2158 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
2159 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
2161 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
2162 echo "TARGET_HAS_BFLT=yes" >> $config_mak
2163 echo "#define TARGET_HAS_BFLT 1" >> $config_h
2165 if test "$target_user_only" = "yes" \
2166 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
2167 echo "#define USE_NPTL 1" >> $config_h
2169 # 32 bit ELF loader in addition to native 64 bit loader?
2170 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
2171 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
2172 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
2174 if test "$target_bsd_user" = "yes" ; then
2175 echo "CONFIG_BSD_USER=yes" >> $config_mak
2176 echo "#define CONFIG_BSD_USER 1" >> $config_h
2179 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~
$config_h
2181 done # for target in $targets
2183 # build tree in object directory if source path is different from current one
2184 if test "$source_path_used" = "yes" ; then
2185 DIRS
="tests tests/cris slirp audio kvm/libkvm"
2186 FILES
="Makefile tests/Makefile"
2187 FILES
="$FILES tests/cris/Makefile tests/cris/.gdbinit"
2188 FILES
="$FILES tests/test-mmap.c"
2189 FILES
="$FILES kvm/libkvm/Makefile"
2190 for dir
in $DIRS ; do
2193 # remove the link and recreate it, as not all "ln -sf" overwrite the link
2194 for f
in $FILES ; do
2196 ln -s $source_path/$f $f