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
202 kvm_cap_device_assignment
="no"
210 pkgversion
=" ($(kvm_version))"
217 if check_define __linux__
; then
219 elif check_define _WIN32
; then
221 elif check_define __OpenBSD__
; then
223 elif check_define __sun__
; then
231 OS_CFLAGS
="-mno-cygwin"
232 if [ "$cpu" = "i386" ] ; then
235 audio_possible_drivers
="sdl"
239 if [ "$cpu" = "i386" ] ; then
242 audio_possible_drivers
="dsound sdl fmod"
246 audio_possible_drivers
="oss sdl esd pa"
247 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
254 audio_possible_drivers
="oss sdl esd pa"
255 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
263 audio_possible_drivers
="oss sdl esd pa"
264 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
272 audio_possible_drivers
="oss sdl esd"
279 audio_possible_drivers
="oss sdl esd"
285 # 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
286 if [ "$cpu" = "i386" ] ; then
287 is_x86_64
=`sysctl -n hw.optional.x86_64`
288 [ "$is_x86_64" = "1" ] && cpu
=x86_64
290 if [ "$cpu" = "x86_64" ] ; then
291 OS_CFLAGS
="-arch x86_64"
292 LDFLAGS
="-arch x86_64"
294 OS_CFLAGS
="-mdynamic-no-pic"
298 audio_drv_list
="coreaudio"
299 audio_possible_drivers
="coreaudio sdl fmod"
300 OS_LDFLAGS
="-framework CoreFoundation -framework IOKit"
306 needs_libsunmath
="no"
308 solarisrev
=`uname -r | cut -f2 -d.`
309 # have to select again, because `uname -m` returns i86pc
310 # even on an x86_64 box.
311 solariscpu
=`isainfo -k`
312 if test "${solariscpu}" = "amd64" ; then
315 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
316 if test "$solarisrev" -le 9 ; then
317 if test -f /opt
/SUNWspro
/prod
/lib
/libsunmath.so
.1; then
318 needs_libsunmath
="yes"
320 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
321 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
322 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
323 echo "Studio 11 can be downloaded from www.sun.com."
327 if test "$solarisrev" -ge 9 ; then
331 if test -f /usr
/include
/sys
/soundcard.h
; then
334 audio_possible_drivers
="oss sdl"
343 audio_possible_drivers
="oss alsa sdl esd pa"
347 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
349 audio_possible_drivers
="$audio_possible_drivers fmod"
353 if [ "$cpu" = "ia64" ] ; then
356 target_list
="ia64-softmmu"
361 if [ "$cpu" = "powerpc" ]; then
367 if [ "$bsd" = "yes" ] ; then
368 if [ "$darwin" != "yes" ] ; then
376 source_path
=`dirname "$0"`
377 source_path_used
="no"
379 if [ -z "$source_path" ]; then
382 source_path
=`cd "$source_path"; pwd`
384 [ -f "$workdir/vl.c" ] || source_path_used
="yes"
387 # generate compile errors on warnings for development builds
388 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
393 optarg
=`expr "x$opt" : 'x[^=]*=\(.*\)'`
395 --help|
-h) show_help
=yes
397 --prefix=*) prefix
="$optarg"
399 --interp-prefix=*) interp_prefix
="$optarg"
401 --source-path=*) source_path
="$optarg"
402 source_path_used
="yes"
408 --host-cc=*) host_cc
="$optarg"
410 --make=*) make="$optarg"
412 --install=*) install="$optarg"
414 --extra-cflags=*) CFLAGS
="$optarg"
416 --extra-ldflags=*) LDFLAGS
="$optarg"
418 --cpu=*) cpu
="$optarg"
420 --target-list=*) target_list
="$optarg"
422 --enable-gprof) gprof
="yes"
424 --static) static
="yes"
426 --disable-sdl) sdl
="no"
428 --fmod-lib=*) fmod_lib
="$optarg"
430 --fmod-inc=*) fmod_inc
="$optarg"
432 --oss-lib=*) oss_lib
="$optarg"
434 --audio-card-list=*) audio_card_list
=`echo "$optarg" | sed -e 's/,/ /g'`
436 --audio-drv-list=*) audio_drv_list
="$optarg"
438 --enable-debug-tcg) debug_tcg
="yes"
440 --disable-debug-tcg) debug_tcg
="no"
442 --enable-sparse) sparse
="yes"
444 --disable-sparse) sparse
="no"
446 --disable-strip) strip_opt
="no"
448 --disable-vnc-tls) vnc_tls
="no"
450 --disable-vnc-sasl) vnc_sasl
="no"
452 --disable-slirp) slirp
="no"
454 --disable-vde) vde
="no"
456 --disable-kqemu) kqemu
="no"
458 --disable-xen) xen
="no"
460 --disable-brlapi) brlapi
="no"
462 --disable-bluez) bluez
="no"
464 --disable-kvm) kvm
="no"
466 --enable-profiler) profiler
="yes"
471 audio_drv_list
="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
473 --disable-system) softmmu
="no"
475 --enable-system) softmmu
="yes"
477 --disable-linux-user) linux_user
="no"
479 --enable-linux-user) linux_user
="yes"
481 --disable-darwin-user) darwin_user
="no"
483 --enable-darwin-user) darwin_user
="yes"
485 --disable-bsd-user) bsd_user
="no"
487 --enable-bsd-user) bsd_user
="yes"
489 --enable-uname-release=*) uname_release
="$optarg"
494 v7|v8
) SP_CFLAGS
="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m32"
495 target_cpu
="sparc"; cpu
="sparc" ;;
496 v8plus|v8plusa
) SP_CFLAGS
="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m32"
497 target_cpu
="sparc"; cpu
="sparc" ;;
498 v9
) SP_CFLAGS
="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m64"
499 target_cpu
="sparc64"; cpu
="sparc64" ;;
500 *) echo "undefined SPARC architecture. Exiting";exit 1;;
503 --enable-werror) werror
="yes"
505 --disable-werror) werror
="no"
507 --disable-curses) curses
="no"
509 --disable-curl) curl
="no"
511 --disable-nptl) nptl
="no"
513 --enable-mixemu) mixemu
="yes"
515 --disable-pthread) pthread
="no"
517 --disable-aio) aio
="no"
519 --enable-io-thread) io_thread
="yes"
521 --disable-blobs) blobs
="no"
523 --kerneldir=*) kerneldir
="$optarg"
525 --with-pkgversion=*) pkgversion
=" ($optarg)"
527 --disable-docs) build_docs
="no"
529 --disable-cpu-emulation) cpu_emulation
="no"
531 *) echo "ERROR: unknown option $opt"; show_help
="yes"
536 # default flags for all hosts
537 CFLAGS
="$CFLAGS -O2 -g -fno-strict-aliasing"
538 CFLAGS
="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
539 LDFLAGS
="$LDFLAGS -g"
540 if test "$werror" = "yes" ; then
541 CFLAGS
="$CFLAGS -Werror"
544 if test "$solaris" = "no" ; then
545 if ld
--version 2>/dev
/null |
grep "GNU ld" >/dev
/null
2>/dev
/null
; then
546 LDFLAGS
="$LDFLAGS -Wl,--warn-common"
551 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
552 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
555 sparc
) if test -z "$sparc_cpu" ; then
556 ARCH_CFLAGS
="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
559 ARCH_CFLAGS
="${SP_CFLAGS}"
560 ARCH_LDFLAGS
="${SP_LDFLAGS}"
562 ARCH_CFLAGS
="$ARCH_CFLAGS -ffixed-g2 -ffixed-g3"
563 if test "$solaris" = "no" ; then
564 ARCH_CFLAGS
="$ARCH_CFLAGS -ffixed-g1 -ffixed-g6"
567 sparc64
) if test -z "$sparc_cpu" ; then
568 ARCH_CFLAGS
="-m64 -mcpu=ultrasparc -D__sparc_v9__"
571 ARCH_CFLAGS
="${SP_CFLAGS}"
572 ARCH_LDFLAGS
="${SP_LDFLAGS}"
574 if test "$solaris" = "no" ; then
575 ARCH_CFLAGS
="$ARCH_CFLAGS -ffixed-g5 -ffixed-g6 -ffixed-g7"
577 ARCH_CFLAGS
="$ARCH_CFLAGS -ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7"
581 ARCH_CFLAGS
="-march=z900"
593 if test x
"$show_help" = x
"yes" ; then
596 Usage: configure [options]
597 Options: [defaults in brackets after descriptions]
600 echo "Standard options:"
601 echo " --help print this message"
602 echo " --prefix=PREFIX install in PREFIX [$prefix]"
603 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
604 echo " use %M for cpu name [$interp_prefix]"
605 echo " --target-list=LIST set target list [$target_list]"
607 echo "kqemu kernel acceleration support:"
608 echo " --disable-kqemu disable kqemu support"
610 echo "Advanced options (experts only):"
611 echo " --source-path=PATH path of source code [$source_path]"
612 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
613 echo " --cc=CC use C compiler CC [$cc]"
614 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
615 echo " --extra-cflags=CFLAGS add C compiler flags CFLAGS"
616 echo " --extra-ldflags=LDFLAGS add linker flags LDFLAGS"
617 echo " --make=MAKE use specified make [$make]"
618 echo " --install=INSTALL use specified install [$install]"
619 echo " --static enable static build [$static]"
620 echo " --enable-debug-tcg enable TCG debugging"
621 echo " --disable-debug-tcg disable TCG debugging (default)"
622 echo " --enable-sparse enable sparse checker"
623 echo " --disable-sparse disable sparse checker (default)"
624 echo " --disable-strip disable stripping binaries"
625 echo " --disable-werror disable compilation abort on warning"
626 echo " --disable-sdl disable SDL"
627 echo " --enable-cocoa enable COCOA (Mac OS X only)"
628 echo " --audio-drv-list=LIST set audio drivers list:"
629 echo " Available drivers: $audio_possible_drivers"
630 echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
631 echo " Available cards: $audio_possible_cards"
632 echo " --enable-mixemu enable mixer emulation"
633 echo " --disable-xen disable xen backend driver support"
634 echo " --disable-brlapi disable BrlAPI"
635 echo " --disable-vnc-tls disable TLS encryption for VNC server"
636 echo " --disable-vnc-sasl disable SASL encryption for VNC server"
637 echo " --disable-curses disable curses output"
638 echo " --disable-curl disable curl connectivity"
639 echo " --disable-bluez disable bluez stack connectivity"
640 echo " --disable-kvm disable KVM acceleration support"
641 echo " --disable-nptl disable usermode NPTL support"
642 echo " --enable-system enable all system emulation targets"
643 echo " --disable-system disable all system emulation targets"
644 echo " --enable-linux-user enable all linux usermode emulation targets"
645 echo " --disable-linux-user disable all linux usermode emulation targets"
646 echo " --enable-darwin-user enable all darwin usermode emulation targets"
647 echo " --disable-darwin-user disable all darwin usermode emulation targets"
648 echo " --enable-bsd-user enable all BSD usermode emulation targets"
649 echo " --disable-bsd-user disable all BSD usermode emulation targets"
650 echo " --fmod-lib path to FMOD library"
651 echo " --fmod-inc path to FMOD includes"
652 echo " --oss-lib path to OSS library"
653 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
654 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
655 echo " --disable-vde disable support for vde network"
656 echo " --disable-pthread disable pthread support"
657 echo " --disable-aio disable AIO support"
658 echo " --enable-io-thread enable IO thread"
659 echo " --disable-blobs disable installing provided firmware blobs"
660 echo " --kerneldir=PATH look for kernel includes in PATH"
661 echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
663 echo "NOTE: The object files are built at the place where configure is launched"
667 if test "$mingw32" = "yes" ; then
673 OS_CFLAGS
="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
676 if test ! -x "$(which cgcc 2>/dev/null)"; then
681 # Solaris specific configure tool chain decisions
683 if test "$solaris" = "yes" ; then
684 solinst
=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
685 if test -z "$solinst" ; then
686 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
687 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
688 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
691 if test "$solinst" = "/usr/sbin/install" ; then
692 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
693 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
694 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
697 sol_ar
=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
698 if test -z "$sol_ar" ; then
699 echo "Error: No path includes ar"
700 if test -f /usr
/ccs
/bin
/ar ; then
701 echo "Add /usr/ccs/bin to your path and rerun configure"
708 if test -z "$target_list" ; then
709 # these targets are portable
710 if [ "$softmmu" = "yes" ] ; then
729 # the following are Linux specific
730 if [ "$linux_user" = "yes" ] ; then
731 target_list
="${target_list}\
743 ppc64abi32-linux-user \
748 sparc32plus-linux-user \
751 # the following are Darwin specific
752 if [ "$darwin_user" = "yes" ] ; then
753 target_list
="$target_list i386-darwin-user ppc-darwin-user "
755 # the following are BSD specific
756 if [ "$bsd_user" = "yes" ] ; then
757 target_list
="${target_list}\
765 target_list
=`echo "$target_list" | sed -e 's/,/ /g'`
767 if test -z "$target_list" ; then
768 echo "No targets enabled"
772 if test -z "$cross_prefix" ; then
775 # big/little endian test
777 #include <inttypes.h>
778 int main(int argc, char ** argv){
779 volatile uint32_t i=0x01234567;
780 return (*((uint8_t*)(&i))) == 0x67;
784 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
785 $TMPE && bigendian
="yes"
787 echo big
/little
test failed
792 # if cross compiling, cannot launch a program, so make a static guess
793 if test "$cpu" = "armv4b" \
797 -o "$cpu" = "mips64" \
799 -o "$cpu" = "ppc64" \
801 -o "$cpu" = "sparc" \
802 -o "$cpu" = "sparc64"; then
808 # host long bits test
810 if test "$cpu" = "x86_64" \
811 -o "$cpu" = "alpha" \
813 -o "$cpu" = "sparc64" \
814 -o "$cpu" = "ppc64"; then
818 # Check host NPTL support
821 #include <linux/futex.h>
824 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
830 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev
/null
2> /dev
/null
; then
836 ##########################################
853 if test "$kvm" = "yes" ; then
855 kvm_cflags
="-I$source_path/kvm/include"
856 kvm_cflags
="$kvm_cflags -I$source_path/kvm/include/$kvm_arch"
858 # test for KVM_CAP_PIT
861 #include <linux/kvm.h>
863 #error "kvm no pit capability"
865 int main(void) { return 0; }
867 if $cc $ARCH_CFLAGS $CFLAGS $kvm_cflags -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev
/null
; then
871 # test for KVM_CAP_DEVICE_ASSIGNMENT
874 #include <linux/kvm.h>
875 #ifndef KVM_CAP_DEVICE_ASSIGNMENT
876 #error "kvm no device assignment capability"
878 int main(void) { return 0; }
880 if $cc $ARCH_CFLAGS $CFLAGS $kvm_cflags -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev
/null
; then
881 kvm_cap_device_assignment
="yes"
885 # libpci probe for kvm_cap_device_assignment
886 if test $kvm_cap_device_assignment = "yes" ; then
889 #ifndef PCI_VENDOR_ID
892 int main(void) { return 0; }
894 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC 2>/dev
/null
; then
898 echo "Error: libpci check failed"
899 echo "Disable KVM Device Assignment capability."
901 kvm_cap_device_assignment
="no"
905 ##########################################
910 int main(void) { zlibVersion(); return 0; }
912 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev
/null
2> /dev
/null
; then
916 echo "Error: zlib check failed"
917 echo "Make sure to have the zlib libs and headers installed."
922 ##########################################
925 if test "$xen" = "yes" ; then
929 int main(void) { xs_daemon_open; xc_interface_open; }
931 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC -lxenstore -lxenctrl 2> /dev
/null
> /dev
/null
; then
938 ##########################################
943 if test "$sdl" = "yes" ; then
944 sdl_config
="sdl-config"
950 #undef main /* We don't want SDL to override our main() */
951 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
953 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
954 _sdlversion
=`$sdl_config --version | sed 's/[^0-9]//g'`
955 if test "$_sdlversion" -lt 121 ; then
958 if test "$cocoa" = "no" ; then
963 # static link with sdl ?
964 if test "$sdl" = "yes" ; then
966 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa
="yes"
967 sdl_static_libs
=`$sdl_config --static-libs 2>/dev/null`
968 if [ "$aa" = "yes" ] ; then
969 sdl_static_libs
="$sdl_static_libs `aalib-config --static-libs`"
972 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev
/null
2> /dev
/null
; then
976 fi # sdl compile test
978 # Make sure to disable cocoa if sdl was set
979 if test "$sdl" = "yes" ; then
981 audio_drv_list
="`echo $audio_drv_list | sed s,coreaudio,,g`"
985 if test "$sdl" = "yes" ; then
988 #if defined(SDL_VIDEO_DRIVER_X11)
989 #include <X11/XKBlib.h>
991 #error No x11 support
993 int main(void) { return 0; }
995 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
1000 ##########################################
1002 if test "$vnc_tls" = "yes" ; then
1004 #include <gnutls/gnutls.h>
1005 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1007 vnc_tls_cflags
=`pkg-config --cflags gnutls 2> /dev/null`
1008 vnc_tls_libs
=`pkg-config --libs gnutls 2> /dev/null`
1009 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
1010 $vnc_tls_libs > /dev
/null
2> /dev
/null
; then
1017 ##########################################
1018 # VNC SASL detection
1019 if test "$vnc_sasl" = "yes" ; then
1021 #include <sasl/sasl.h>
1023 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
1025 # Assuming Cyrus-SASL installed in /usr prefix
1027 vnc_sasl_libs
="-lsasl2"
1028 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
1029 $vnc_sasl_libs 2> /dev
/null
> /dev
/null
; then
1036 ##########################################
1037 # fnmatch() probe, used for ACL routines
1040 #include <fnmatch.h>
1043 fnmatch("foo", "foo", 0);
1047 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
1051 ##########################################
1052 # vde libraries probe
1053 if test "$vde" = "yes" ; then
1055 #include <libvdeplug.h>
1058 struct vde_open_args a = {0, 0, 0};
1059 vde_open("", "", &a);
1063 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev
/null
2> /dev
/null
; then
1070 ##########################################
1071 # Sound support libraries probe
1082 int main(void) { $exp }
1084 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev
/null
2> /dev
/null
; then
1088 echo "Error: $drv check failed"
1089 echo "Make sure to have the $drv libs and headers installed."
1095 audio_drv_list
=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1096 for drv
in $audio_drv_list; do
1099 audio_drv_probe
$drv alsa
/asoundlib.h
-lasound \
1100 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1104 if test -z $fmod_lib ||
test -z $fmod_inc; then
1106 echo "Error: You must specify path to FMOD library and headers"
1107 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1111 audio_drv_probe
$drv fmod.h
$fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1115 audio_drv_probe
$drv esd.h
-lesd 'return esd_play_stream(0, 0, "", 0);'
1119 audio_drv_probe
$drv pulse
/simple.h
-lpulse-simple \
1120 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1123 oss|sdl|core|wav|dsound
)
1124 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1128 echo "$audio_possible_drivers" |
grep -q "\<$drv\>" ||
{
1130 echo "Error: Unknown driver '$drv' selected"
1131 echo "Possible drivers are: $audio_possible_drivers"
1139 ##########################################
1142 if test -z "$brlapi" ; then
1146 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1148 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev
/null
2> /dev
/null
; then
1150 fi # brlapi compile test
1153 ##########################################
1156 if test "$curses" = "yes" ; then
1161 #define resize_term resizeterm
1163 int main(void) { resize_term(0, 0); return curses_version(); }
1165 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev
/null
2> /dev
/null
; then
1170 ##########################################
1173 if test "$curl" = "yes" ; then
1176 #include <curl/curl.h>
1177 int main(void) { return curl_easy_init(); }
1179 curl_libs
=`curl-config --libs 2>/dev/null`
1180 if $cc $ARCH_CFLAGS $curl_libs -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
1185 ##########################################
1186 # bluez support probe
1187 if test "$bluez" = "yes" ; then
1188 `pkg-config bluez 2> /dev/null` || bluez
="no"
1190 if test "$bluez" = "yes" ; then
1192 #include <bluetooth/bluetooth.h>
1193 int main(void) { return bt_error(0); }
1195 bluez_cflags
=`pkg-config --cflags bluez 2> /dev/null`
1196 bluez_libs
=`pkg-config --libs bluez 2> /dev/null`
1197 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
1198 $bluez_libs > /dev
/null
2> /dev
/null
; then
1205 ##########################################
1207 if test "$kvm" = "yes" ; then
1209 #include <linux/kvm.h>
1210 #if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
1211 #error Invalid KVM version
1213 #if !defined(KVM_CAP_USER_MEMORY)
1214 #error Missing KVM capability KVM_CAP_USER_MEMORY
1216 #if !defined(KVM_CAP_SET_TSS_ADDR)
1217 #error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1219 #if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1220 #error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1222 int main(void) { return 0; }
1224 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
1225 > /dev
/null
2>/dev
/null
; then
1229 if [ -x "`which awk 2>/dev/null`" ] && \
1230 [ -x "`which grep 2>/dev/null`" ]; then
1231 kvmerr
=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
1233 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1234 if test "$kvmerr" != "" ; then
1235 kvm
="no - (${kvmerr})"
1241 ##########################################
1245 if test "$pthread" = yes; then
1248 #include <pthread.h>
1249 int main(void) { pthread_mutex_t lock; return 0; }
1251 if $cc $ARCH_CFLAGS -o $TMPE $PTHREADLIBS $TMPC 2> /dev
/null
> /dev
/null
; then
1253 PTHREADLIBS
="-lpthread"
1257 if test "$pthread" = no
; then
1262 ##########################################
1265 #include <sys/types.h>
1266 #include <sys/uio.h>
1268 int main(void) { struct iovec iov; return 0; }
1271 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
1275 ##########################################
1278 #include <sys/types.h>
1279 #include <sys/uio.h>
1281 int main(void) { preadv; }
1284 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
1288 ##########################################
1290 if test "$fdt" = "yes" ; then
1293 int main(void) { return 0; }
1295 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev
/null
> /dev
/null
; then
1301 # Check for xxxat() functions when we are building linux-user
1302 # emulator. This is done because older glibc versions don't
1303 # have syscall stubs for these implemented.
1306 if [ "$linux_user" = "yes" ] ; then
1308 #define _ATFILE_SOURCE
1309 #include <sys/types.h>
1316 /* try to unlink nonexisting file */
1317 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1320 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
> /dev
/null
; then
1325 # Check for inotify functions when we are building linux-user
1326 # emulator. This is done because older glibc versions don't
1327 # have syscall stubs for these implemented. In that case we
1328 # don't provide them even if kernel supports them.
1331 if [ "$linux_user" = "yes" ] ; then
1333 #include <sys/inotify.h>
1338 /* try to start inotify */
1339 return inotify_init();
1342 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
> /dev
/null
; then
1347 ##########################################
1352 #include <sys/syscall.h>
1354 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
1357 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
1361 ##########################################
1366 #include <sys/syscall.h>
1367 int main(void) { return syscall(SYS_eventfd, 0); }
1370 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
1374 # Check if tools are available to build documentation.
1375 if test "$build_docs" = "yes" -a \
( ! -x "`which texi2html 2>/dev/null`" -o ! -x "`which pod2man 2>/dev/null`" \
) ; then
1379 ##########################################
1385 int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1389 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
1391 elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev
/null
2> /dev
/null
; then
1395 if test "$rt" = "yes" ; then
1399 if test "$mingw32" = "yes" ; then
1400 if test -z "$prefix" ; then
1401 prefix
="c:\\\\Program Files\\\\Qemu"
1408 if test -z "$prefix" ; then
1411 mansuffix
="/share/man"
1412 datasuffix
="/share/qemu"
1413 docsuffix
="/share/doc/qemu"
1417 if test -f kvm
/kernel
/configure
; then
1420 if test -n "$kerneldir"; then
1421 kmod_args
="--kerneldir=$kerneldir"
1423 # hope there are no spaces in kmod_args; can't use arrays because of
1425 (cd kvm
/kernel
; .
/configure
$kmod_args)
1428 echo "Install prefix $prefix"
1429 echo "BIOS directory $prefix$datasuffix"
1430 echo "binary directory $prefix$binsuffix"
1431 if test "$mingw32" = "no" ; then
1432 echo "Manual directory $prefix$mansuffix"
1433 echo "ELF interp prefix $interp_prefix"
1435 echo "Source path $source_path"
1436 echo "C compiler $cc"
1437 echo "Host C compiler $host_cc"
1438 echo "ARCH_CFLAGS $ARCH_CFLAGS"
1440 echo "install $install"
1441 echo "host CPU $cpu"
1442 echo "host big endian $bigendian"
1443 echo "target list $target_list"
1444 echo "tcg debug enabled $debug_tcg"
1445 echo "gprof enabled $gprof"
1446 echo "sparse enabled $sparse"
1447 echo "strip binaries $strip_opt"
1448 echo "profiler $profiler"
1449 echo "static build $static"
1450 echo "-Werror enabled $werror"
1451 if test "$darwin" = "yes" ; then
1452 echo "Cocoa support $cocoa"
1454 echo "SDL support $sdl"
1455 if test "$sdl" != "no" ; then
1456 echo "SDL static link $sdl_static"
1458 echo "curses support $curses"
1459 echo "curl support $curl"
1460 echo "mingw32 support $mingw32"
1461 echo "Audio drivers $audio_drv_list"
1462 echo "Extra audio cards $audio_card_list"
1463 echo "Mixer emulation $mixemu"
1464 echo "VNC TLS support $vnc_tls"
1465 if test "$vnc_tls" = "yes" ; then
1466 echo " TLS CFLAGS $vnc_tls_cflags"
1467 echo " TLS LIBS $vnc_tls_libs"
1469 echo "VNC SASL support $vnc_sasl"
1470 if test "$vnc_sasl" = "yes" ; then
1471 echo " SASL CFLAGS $vnc_sasl_cflags"
1472 echo " SASL LIBS $vnc_sasl_libs"
1474 if test -n "$sparc_cpu"; then
1475 echo "Target Sparc Arch $sparc_cpu"
1477 echo "kqemu support $kqemu"
1478 echo "xen support $xen"
1479 echo "CPU emulation $cpu_emulation"
1480 echo "brlapi support $brlapi"
1481 echo "Documentation $build_docs"
1482 [ ! -z "$uname_release" ] && \
1483 echo "uname -r $uname_release"
1484 echo "NPTL support $nptl"
1485 echo "vde support $vde"
1486 echo "AIO support $aio"
1487 echo "IO thread $io_thread"
1488 echo "Install blobs $blobs"
1489 echo "KVM support $kvm"
1490 echo "fdt support $fdt"
1491 echo "preadv support $preadv"
1493 if test $sdl_too_old = "yes"; then
1494 echo "-> Your SDL version is too old - please upgrade to have SDL support"
1496 #if test "$sdl_static" = "no"; then
1497 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1499 config_mak
="config-host.mak"
1500 config_h
="config-host.h"
1502 #echo "Creating $config_mak and $config_h"
1504 test -f $config_h && mv $config_h ${config_h}~
1506 echo "# Automatically generated by configure - do not modify" > $config_mak
1507 printf "# Configured with:" >> $config_mak
1508 printf " '%s'" "$0" "$@" >> $config_mak
1510 echo "/* Automatically generated by configure - do not modify */" > $config_h
1512 echo "prefix=$prefix" >> $config_mak
1513 echo "bindir=\${prefix}$binsuffix" >> $config_mak
1514 echo "mandir=\${prefix}$mansuffix" >> $config_mak
1515 echo "datadir=\${prefix}$datasuffix" >> $config_mak
1516 echo "docdir=\${prefix}$docsuffix" >> $config_mak
1517 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
1518 echo "MAKE=$make" >> $config_mak
1519 echo "INSTALL=$install" >> $config_mak
1520 echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_mak
1521 echo "INSTALL_DATA=$install -m0644 -p" >> $config_mak
1522 echo "INSTALL_PROG=$install -m0755 -p" >> $config_mak
1523 echo "CC=$cc" >> $config_mak
1524 echo "HOST_CC=$host_cc" >> $config_mak
1525 echo "AR=$ar" >> $config_mak
1526 # XXX: only use CFLAGS and LDFLAGS ?
1527 # XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1528 # compilation of dyngen tool (useful for win32 build on Linux host)
1529 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
1530 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1531 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1532 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
1533 echo "CFLAGS=$CFLAGS" >> $config_mak
1534 echo "LDFLAGS=$LDFLAGS" >> $config_mak
1535 echo "EXESUF=$EXESUF" >> $config_mak
1536 echo "PTHREADLIBS=$PTHREADLIBS" >> $config_mak
1537 echo "CLOCKLIBS=$CLOCKLIBS" >> $config_mak
1540 echo "ARCH=i386" >> $config_mak
1541 echo "#define HOST_I386 1" >> $config_h
1544 echo "ARCH=x86_64" >> $config_mak
1545 echo "#define HOST_X86_64 1" >> $config_h
1548 echo "ARCH=alpha" >> $config_mak
1549 echo "#define HOST_ALPHA 1" >> $config_h
1552 echo "ARCH=arm" >> $config_mak
1553 echo "#define HOST_ARM 1" >> $config_h
1556 echo "ARCH=arm" >> $config_mak
1557 echo "#define HOST_ARM 1" >> $config_h
1560 echo "ARCH=cris" >> $config_mak
1561 echo "#define HOST_CRIS 1" >> $config_h
1564 echo "ARCH=hppa" >> $config_mak
1565 echo "#define HOST_HPPA 1" >> $config_h
1568 echo "ARCH=ia64" >> $config_mak
1569 echo "#define HOST_IA64 1" >> $config_h
1572 echo "ARCH=m68k" >> $config_mak
1573 echo "#define HOST_M68K 1" >> $config_h
1576 echo "ARCH=mips" >> $config_mak
1577 echo "#define HOST_MIPS 1" >> $config_h
1580 echo "ARCH=mips64" >> $config_mak
1581 echo "#define HOST_MIPS64 1" >> $config_h
1584 echo "ARCH=ppc" >> $config_mak
1585 echo "#define HOST_PPC 1" >> $config_h
1588 echo "ARCH=ppc64" >> $config_mak
1589 echo "#define HOST_PPC64 1" >> $config_h
1592 echo "ARCH=s390" >> $config_mak
1593 echo "#define HOST_S390 1" >> $config_h
1596 echo "ARCH=sparc" >> $config_mak
1597 echo "#define HOST_SPARC 1" >> $config_h
1600 echo "ARCH=sparc64" >> $config_mak
1601 echo "#define HOST_SPARC64 1" >> $config_h
1604 echo "Unsupported CPU = $cpu"
1608 if test "$debug_tcg" = "yes" ; then
1609 echo "#define DEBUG_TCG 1" >> $config_h
1611 if test "$sparse" = "yes" ; then
1612 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1613 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1614 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1616 if test "$strip_opt" = "yes" ; then
1617 echo "STRIP_OPT=-s" >> $config_mak
1619 if test "$bigendian" = "yes" ; then
1620 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1621 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1623 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
1624 if test "$mingw32" = "yes" ; then
1625 echo "CONFIG_WIN32=yes" >> $config_mak
1626 echo "#define CONFIG_WIN32 1" >> $config_h
1629 #include <byteswap.h>
1630 int main(void) { return bswap_32(0); }
1632 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev
/null
2> /dev
/null
; then
1633 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1636 #include <sys/endian.h>
1637 #include <sys/types.h>
1638 #include <machine/bswap.h>
1639 int main(void) { return bswap32(0); }
1641 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev
/null
2> /dev
/null
; then
1642 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1646 if [ "$openbsd" = "yes" ] ; then
1647 echo "#define ENOTSUP 4096" >> $config_h
1650 if test "$darwin" = "yes" ; then
1651 echo "CONFIG_DARWIN=yes" >> $config_mak
1652 echo "#define CONFIG_DARWIN 1" >> $config_h
1655 if test "$aix" = "yes" ; then
1656 echo "CONFIG_AIX=yes" >> $config_mak
1657 echo "#define CONFIG_AIX 1" >> $config_h
1660 if test "$solaris" = "yes" ; then
1661 echo "CONFIG_SOLARIS=yes" >> $config_mak
1662 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
1663 if test "$needs_libsunmath" = "yes" ; then
1664 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1665 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1668 if test -n "$sparc_cpu"; then
1669 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1670 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1672 if test "$gprof" = "yes" ; then
1673 echo "TARGET_GPROF=yes" >> $config_mak
1674 echo "#define HAVE_GPROF 1" >> $config_h
1676 if test "$static" = "yes" ; then
1677 echo "CONFIG_STATIC=yes" >> $config_mak
1678 echo "#define CONFIG_STATIC 1" >> $config_h
1680 if test $profiler = "yes" ; then
1681 echo "#define CONFIG_PROFILER 1" >> $config_h
1683 if test "$slirp" = "yes" ; then
1684 echo "CONFIG_SLIRP=yes" >> $config_mak
1685 echo "#define CONFIG_SLIRP 1" >> $config_h
1687 if test "$vde" = "yes" ; then
1688 echo "CONFIG_VDE=yes" >> $config_mak
1689 echo "#define CONFIG_VDE 1" >> $config_h
1690 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1692 for card
in $audio_card_list; do
1693 def
=CONFIG_
`echo $card | tr '[:lower:]' '[:upper:]'`
1694 echo "$def=yes" >> $config_mak
1695 echo "#define $def 1" >> $config_h
1697 echo "#define AUDIO_DRIVERS \\" >> $config_h
1698 for drv
in $audio_drv_list; do
1699 echo " &${drv}_audio_driver, \\" >>$config_h
1700 def
=CONFIG_
`echo $drv | tr '[:lower:]' '[:upper:]'`
1701 echo "$def=yes" >> $config_mak
1702 if test "$drv" = "fmod"; then
1703 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1704 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1705 elif test "$drv" = "oss"; then
1706 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
1710 if test "$mixemu" = "yes" ; then
1711 echo "CONFIG_MIXEMU=yes" >> $config_mak
1712 echo "#define CONFIG_MIXEMU 1" >> $config_h
1714 if test "$vnc_tls" = "yes" ; then
1715 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1716 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1717 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1718 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1720 if test "$vnc_sasl" = "yes" ; then
1721 echo "CONFIG_VNC_SASL=yes" >> $config_mak
1722 echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1723 echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1724 echo "#define CONFIG_VNC_SASL 1" >> $config_h
1726 if test "$fnmatch" = "yes" ; then
1727 echo "#define HAVE_FNMATCH_H 1" >> $config_h
1729 qemu_version
=`head $source_path/VERSION`
1730 echo "VERSION=$qemu_version" >>$config_mak
1731 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1732 echo "#define QEMU_PKGVERSION \"$pkgversion\"" >> $config_h
1734 echo "SRC_PATH=$source_path" >> $config_mak
1735 if [ "$source_path_used" = "yes" ]; then
1736 echo "VPATH=$source_path" >> $config_mak
1738 echo "TARGET_DIRS=$target_list" >> $config_mak
1739 if [ "$build_docs" = "yes" ] ; then
1740 echo "BUILD_DOCS=yes" >> $config_mak
1742 if test "$static" = "yes"; then
1747 if test "$sdl1" = "yes" ; then
1748 echo "#define CONFIG_SDL 1" >> $config_h
1749 echo "CONFIG_SDL=yes" >> $config_mak
1750 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1751 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1752 elif test "$sdl_x11" = "yes" ; then
1753 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
1755 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1757 if [ "${aa}" = "yes" ] ; then
1758 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1760 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1763 if test "$cocoa" = "yes" ; then
1764 echo "#define CONFIG_COCOA 1" >> $config_h
1765 echo "CONFIG_COCOA=yes" >> $config_mak
1767 if test "$curses" = "yes" ; then
1768 echo "#define CONFIG_CURSES 1" >> $config_h
1769 echo "CONFIG_CURSES=yes" >> $config_mak
1770 echo "CURSES_LIBS=-lcurses" >> $config_mak
1772 if test "$atfile" = "yes" ; then
1773 echo "#define CONFIG_ATFILE 1" >> $config_h
1775 if test "$inotify" = "yes" ; then
1776 echo "#define CONFIG_INOTIFY 1" >> $config_h
1778 if test "$curl" = "yes" ; then
1779 echo "CONFIG_CURL=yes" >> $config_mak
1780 echo "CURL_LIBS=$curl_libs" >> $config_mak
1781 echo "#define CONFIG_CURL 1" >> $config_h
1783 if test "$brlapi" = "yes" ; then
1784 echo "CONFIG_BRLAPI=yes" >> $config_mak
1785 echo "#define CONFIG_BRLAPI 1" >> $config_h
1786 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1788 if test "$bluez" = "yes" ; then
1789 echo "CONFIG_BLUEZ=yes" >> $config_mak
1790 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1791 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1792 echo "#define CONFIG_BLUEZ 1" >> $config_h
1794 if test "$xen" = "yes" ; then
1795 echo "XEN_LIBS=-lxenstore -lxenctrl -lxenguest" >> $config_mak
1797 if test "$aio" = "yes" ; then
1798 echo "#define CONFIG_AIO 1" >> $config_h
1799 echo "CONFIG_AIO=yes" >> $config_mak
1801 if test "$io_thread" = "yes" ; then
1802 echo "CONFIG_IOTHREAD=yes" >> $config_mak
1803 echo "#define CONFIG_IOTHREAD 1" >> $config_h
1805 if test "$blobs" = "yes" ; then
1806 echo "INSTALL_BLOBS=yes" >> $config_mak
1808 if test "$iovec" = "yes" ; then
1809 echo "#define HAVE_IOVEC 1" >> $config_h
1811 if test "$preadv" = "yes" ; then
1812 echo "#define HAVE_PREADV 1" >> $config_h
1814 if test "$fdt" = "yes" ; then
1815 echo "#define HAVE_FDT 1" >> $config_h
1816 echo "FDT_LIBS=-lfdt" >> $config_mak
1818 if test "$signalfd" = "yes" ; then
1819 echo "#define CONFIG_signalfd 1" >> $config_h
1821 if test "$eventfd" = "yes" ; then
1822 echo "#define CONFIG_eventfd 1" >> $config_h
1825 # XXX: suppress that
1826 if [ "$bsd" = "yes" ] ; then
1827 echo "#define O_LARGEFILE 0" >> $config_h
1828 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1829 echo "#define HOST_BSD 1" >> $config_h
1832 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1837 echo "HOST_USB=linux" >> $config_mak
1840 echo "HOST_USB=bsd" >> $config_mak
1843 echo "HOST_USB=stub" >> $config_mak
1847 # Determine what linker flags to use to force archive inclusion
1848 check_linker_flags
()
1850 $cc $ARCH_CFLAGS -o $TMPE $OS_CFLAGS $TMPC -Wl,$1 -Wl,$2 >/dev
/null
2>/dev
/null
1856 if check_linker_flags
--whole-archive --no-whole-archive ; then
1858 echo "ARLIBS_BEGIN=-Wl,--whole-archive" >> $config_mak
1859 echo "ARLIBS_END=-Wl,--no-whole-archive" >> $config_mak
1860 elif check_linker_flags
-z,allextract
-z,defaultextract
; then
1862 echo "ARLIBS_BEGIN=-Wl,-z,allextract" >> $config_mak
1863 echo "ARLIBS_END=-Wl,-z,defaultextract" >> $config_mak
1865 echo "Error: your linker does not support --whole-archive or -z."
1866 echo "Please report to qemu-devel@nongnu.org"
1870 if test "$xen" = "yes" ;
1872 echo "CONFIG_XEN=yes" >> $config_mak
1875 # this is a temp hack needed for kvm
1876 if test "$kvm" = "yes" ; then
1877 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1880 echo "KVM_KMOD=$kvm_kmod" >> $config_mak
1883 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1884 tools
="qemu-img\$(EXESUF) $tools"
1885 if [ "$linux" = "yes" ] ; then
1886 tools
="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
1889 echo "TOOLS=$tools" >> $config_mak
1891 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~
$config_h
1892 config_host_mak
=${config_mak}
1894 for target
in $target_list; do
1895 target_dir
="$target"
1896 config_mak
=$target_dir/config.mak
1897 config_h
=$target_dir/config.h
1898 target_cpu
=`echo $target | cut -d '-' -f 1`
1899 target_bigendian
="no"
1900 [ "$target_cpu" = "armeb" ] && target_bigendian
=yes
1901 [ "$target_cpu" = "m68k" ] && target_bigendian
=yes
1902 [ "$target_cpu" = "mips" ] && target_bigendian
=yes
1903 [ "$target_cpu" = "mipsn32" ] && target_bigendian
=yes
1904 [ "$target_cpu" = "mips64" ] && target_bigendian
=yes
1905 [ "$target_cpu" = "ppc" ] && target_bigendian
=yes
1906 [ "$target_cpu" = "ppcemb" ] && target_bigendian
=yes
1907 [ "$target_cpu" = "ppc64" ] && target_bigendian
=yes
1908 [ "$target_cpu" = "ppc64abi32" ] && target_bigendian
=yes
1909 [ "$target_cpu" = "sh4eb" ] && target_bigendian
=yes
1910 [ "$target_cpu" = "sparc" ] && target_bigendian
=yes
1911 [ "$target_cpu" = "sparc64" ] && target_bigendian
=yes
1912 [ "$target_cpu" = "sparc32plus" ] && target_bigendian
=yes
1914 target_user_only
="no"
1915 target_linux_user
="no"
1916 target_darwin_user
="no"
1917 target_bsd_user
="no"
1919 ${target_cpu}-softmmu)
1920 target_softmmu
="yes"
1922 ${target_cpu}-linux-user)
1923 target_user_only
="yes"
1924 target_linux_user
="yes"
1926 ${target_cpu}-darwin-user)
1927 target_user_only
="yes"
1928 target_darwin_user
="yes"
1930 ${target_cpu}-bsd-user)
1931 target_user_only
="yes"
1932 target_bsd_user
="yes"
1935 echo "ERROR: Target '$target' not recognised"
1940 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1942 test -f $config_h && mv $config_h ${config_h}~
1944 mkdir
-p $target_dir
1945 mkdir
-p $target_dir/fpu
1946 mkdir
-p $target_dir/tcg
1947 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
1948 mkdir
-p $target_dir/nwfpe
1952 # don't use ln -sf as not all "ln -sf" over write the file/link
1954 rm -f $target_dir/Makefile
1955 ln -s $source_path/Makefile.target
$target_dir/Makefile
1958 echo "# Automatically generated by configure - do not modify" > $config_mak
1959 echo "/* Automatically generated by configure - do not modify */" > $config_h
1962 echo "include ../config-host.mak" >> $config_mak
1963 echo "#include \"../config-host.h\"" >> $config_h
1968 interp_prefix1
=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1969 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1972 disable_cpu_emulation
() {
1973 if test $cpu_emulation = "no"; then
1974 echo "#define NO_CPU_EMULATION 1" >> $config_h
1975 echo "NO_CPU_EMULATION=1" >> $config_mak
1980 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
1981 \
( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \
); then
1982 echo "#define USE_KVM 1" >> $config_h
1983 echo "USE_KVM=1" >> $config_mak
1984 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1985 if test $kvm_cap_pit = "yes" ; then
1986 echo "USE_KVM_PIT=1" >> $config_mak
1987 echo "#define USE_KVM_PIT 1" >> $config_h
1989 if test $kvm_cap_device_assignment = "yes" ; then
1990 echo "USE_KVM_DEVICE_ASSIGNMENT=1" >> $config_mak
1991 echo "#define USE_KVM_DEVICE_ASSIGNMENT 1" >> $config_h
1993 disable_cpu_emulation
1997 if [ use_upstream_kvm
= yes ]; then
1999 # Make sure the target and host cpus are compatible
2000 if test "$kvm" = "yes" -a ! \
( "$target_cpu" = "$cpu" -o \
2001 \
( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \
) -o \
2002 \
( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \
) -o \
2003 \
( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \
) \
) ; then
2006 # Disable KVM for linux-user
2007 if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
2013 case "$target_cpu" in
2015 echo "TARGET_ARCH=i386" >> $config_mak
2016 echo "#define TARGET_ARCH \"i386\"" >> $config_h
2017 echo "#define TARGET_I386 1" >> $config_h
2018 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
2020 echo "CONFIG_KQEMU=yes" >> $config_mak
2021 echo "#define CONFIG_KQEMU 1" >> $config_h
2023 if test "$kvm" = "yes" ; then
2024 echo "USE_KVM=yes" >> $config_mak
2025 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
2026 echo "#define USE_KVM 1" >> $config_h
2028 if test "$xen" = "yes" -a "$target_softmmu" = "yes";
2030 echo "CONFIG_XEN=yes" >> $config_mak
2031 echo "#define CONFIG_XEN 1" >> $config_h
2037 echo "TARGET_ARCH=x86_64" >> $config_mak
2038 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
2039 echo "#define TARGET_I386 1" >> $config_h
2040 echo "#define TARGET_X86_64 1" >> $config_h
2041 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
2043 echo "CONFIG_KQEMU=yes" >> $config_mak
2044 echo "#define CONFIG_KQEMU 1" >> $config_h
2050 echo "TARGET_ARCH=ia64" >> $config_mak
2051 echo "#define TARGET_ARCH \"ia64\"" >> $config_h
2052 echo "#define TARGET_IA64 1" >> $config_h
2054 if [ use_upstream_kvm
= yes ]; then
2055 if test "$kvm" = "yes" ; then
2056 echo "USE_KVM=yes" >> $config_mak
2057 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
2058 echo "#define USE_KVM 1" >> $config_h
2061 if test "$xen" = "yes" -a "$target_softmmu" = "yes"
2063 echo "CONFIG_XEN=yes" >> $config_mak
2064 echo "#define CONFIG_XEN 1" >> $config_h
2069 echo "TARGET_ARCH=alpha" >> $config_mak
2070 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
2071 echo "#define TARGET_ALPHA 1" >> $config_h
2075 echo "TARGET_ARCH=arm" >> $config_mak
2076 echo "#define TARGET_ARCH \"arm\"" >> $config_h
2077 echo "#define TARGET_ARM 1" >> $config_h
2080 gdb_xml_files
="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
2084 echo "TARGET_ARCH=cris" >> $config_mak
2085 echo "#define TARGET_ARCH \"cris\"" >> $config_h
2086 echo "#define TARGET_CRIS 1" >> $config_h
2091 echo "TARGET_ARCH=m68k" >> $config_mak
2092 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
2093 echo "#define TARGET_M68K 1" >> $config_h
2095 gdb_xml_files
="cf-core.xml cf-fp.xml"
2099 echo "TARGET_ARCH=mips" >> $config_mak
2100 echo "#define TARGET_ARCH \"mips\"" >> $config_h
2101 echo "#define TARGET_MIPS 1" >> $config_h
2102 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
2106 echo "TARGET_ARCH=mipsn32" >> $config_mak
2107 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
2108 echo "#define TARGET_MIPS 1" >> $config_h
2109 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
2113 echo "TARGET_ARCH=mips64" >> $config_mak
2114 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
2115 echo "#define TARGET_MIPS 1" >> $config_h
2116 echo "#define TARGET_MIPS64 1" >> $config_h
2117 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
2121 echo "TARGET_ARCH=ppc" >> $config_mak
2122 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
2123 echo "#define TARGET_PPC 1" >> $config_h
2124 gdb_xml_files
="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2128 echo "TARGET_ARCH=ppcemb" >> $config_mak
2129 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2130 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
2131 echo "#define TARGET_PPC 1" >> $config_h
2132 echo "#define TARGET_PPCEMB 1" >> $config_h
2133 if test "$kvm" = "yes" ; then
2134 echo "USE_KVM=yes" >> $config_mak
2135 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
2136 echo "#define USE_KVM 1" >> $config_h
2138 gdb_xml_files
="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2142 echo "TARGET_ARCH=ppc64" >> $config_mak
2143 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2144 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
2145 echo "#define TARGET_PPC 1" >> $config_h
2146 echo "#define TARGET_PPC64 1" >> $config_h
2147 gdb_xml_files
="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2151 echo "TARGET_ARCH=ppc64" >> $config_mak
2152 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2153 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
2154 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
2155 echo "#define TARGET_PPC 1" >> $config_h
2156 echo "#define TARGET_PPC64 1" >> $config_h
2157 echo "#define TARGET_ABI32 1" >> $config_h
2158 gdb_xml_files
="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2162 echo "TARGET_ARCH=sh4" >> $config_mak
2163 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
2164 echo "#define TARGET_SH4 1" >> $config_h
2170 echo "TARGET_ARCH=sparc" >> $config_mak
2171 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
2172 echo "#define TARGET_SPARC 1" >> $config_h
2176 echo "TARGET_ARCH=sparc64" >> $config_mak
2177 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
2178 echo "#define TARGET_SPARC 1" >> $config_h
2179 echo "#define TARGET_SPARC64 1" >> $config_h
2184 echo "TARGET_ARCH=sparc64" >> $config_mak
2185 echo "TARGET_ABI_DIR=sparc" >> $config_mak
2186 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
2187 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
2188 echo "#define TARGET_SPARC 1" >> $config_h
2189 echo "#define TARGET_SPARC64 1" >> $config_h
2190 echo "#define TARGET_ABI32 1" >> $config_h
2194 echo "Unsupported target CPU"
2198 if [ $target_phys_bits -lt $hostlongbits ] ; then
2199 target_phys_bits
=$hostlongbits
2201 echo "HWLIB=../libhw$target_phys_bits/libqemuhw$target_phys_bits.a" >> $config_mak
2202 echo "#define TARGET_PHYS_ADDR_BITS $target_phys_bits" >> $config_h
2203 echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
2204 if test "$target_bigendian" = "yes" ; then
2205 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
2206 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
2208 if test "$target_softmmu" = "yes" ; then
2209 echo "CONFIG_SOFTMMU=yes" >> $config_mak
2210 echo "#define CONFIG_SOFTMMU 1" >> $config_h
2212 if test "$target_user_only" = "yes" ; then
2213 echo "CONFIG_USER_ONLY=yes" >> $config_mak
2214 echo "#define CONFIG_USER_ONLY 1" >> $config_h
2216 if test "$target_linux_user" = "yes" ; then
2217 echo "CONFIG_LINUX_USER=yes" >> $config_mak
2218 echo "#define CONFIG_LINUX_USER 1" >> $config_h
2220 if test "$target_darwin_user" = "yes" ; then
2221 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
2222 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
2225 if test ! -z "$gdb_xml_files" ; then
2226 for x
in $gdb_xml_files; do
2227 list
="$list $source_path/gdb-xml/$x"
2230 echo "TARGET_XML_FILES=$list" >> $config_mak
2232 if test "$target_cpu" = "arm" \
2233 -o "$target_cpu" = "armeb" \
2234 -o "$target_cpu" = "m68k" \
2235 -o "$target_cpu" = "mips" \
2236 -o "$target_cpu" = "mipsel" \
2237 -o "$target_cpu" = "mipsn32" \
2238 -o "$target_cpu" = "mipsn32el" \
2239 -o "$target_cpu" = "mips64" \
2240 -o "$target_cpu" = "mips64el" \
2241 -o "$target_cpu" = "ppc" \
2242 -o "$target_cpu" = "ppc64" \
2243 -o "$target_cpu" = "ppc64abi32" \
2244 -o "$target_cpu" = "ppcemb" \
2245 -o "$target_cpu" = "sparc" \
2246 -o "$target_cpu" = "sparc64" \
2247 -o "$target_cpu" = "sparc32plus"; then
2248 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
2249 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
2251 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
2252 echo "TARGET_HAS_BFLT=yes" >> $config_mak
2253 echo "#define TARGET_HAS_BFLT 1" >> $config_h
2255 if test "$target_user_only" = "yes" \
2256 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
2257 echo "#define USE_NPTL 1" >> $config_h
2259 # 32 bit ELF loader in addition to native 64 bit loader?
2260 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
2261 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
2262 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
2264 if test "$target_bsd_user" = "yes" ; then
2265 echo "CONFIG_BSD_USER=yes" >> $config_mak
2266 echo "#define CONFIG_BSD_USER 1" >> $config_h
2269 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~
$config_h
2271 done # for target in $targets
2273 # build tree in object directory if source path is different from current one
2274 if test "$source_path_used" = "yes" ; then
2275 DIRS
="tests tests/cris slirp audio block"
2276 FILES
="Makefile tests/Makefile"
2277 FILES
="$FILES tests/cris/Makefile tests/cris/.gdbinit"
2278 FILES
="$FILES tests/test-mmap.c"
2279 for dir
in $DIRS ; do
2282 # remove the link and recreate it, as not all "ln -sf" overwrite the link
2283 for f
in $FILES ; do
2285 ln -s $source_path/$f $f
2289 for hwlib
in 32 64; do
2293 ln -s $source_path/Makefile.hw
$d/Makefile
2294 echo "HWLIB=libqemuhw$hwlib.a" > $d/config.mak
2295 echo "CPPFLAGS=-DTARGET_PHYS_ADDR_BITS=$hwlib" >> $d/config.mak