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
)
189 kvm_cap_device_assignment
="no"
199 # qemu-kvm: use local kerneldir
200 kerneldir
="$(readlink -f kvm/kernel)"
203 if check_define __linux__
; then
205 elif check_define _WIN32
; then
213 OS_CFLAGS
="-mno-cygwin"
214 if [ "$cpu" = "i386" ] ; then
217 audio_possible_drivers
="sdl"
221 if [ "$cpu" = "i386" ] ; then
224 audio_possible_drivers
="dsound sdl fmod"
228 audio_possible_drivers
="oss sdl esd pa"
229 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
236 audio_possible_drivers
="oss sdl esd pa"
237 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
245 audio_possible_drivers
="oss sdl esd pa"
246 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
254 audio_possible_drivers
="oss sdl esd"
261 audio_possible_drivers
="oss sdl esd"
267 # 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
268 if [ "$cpu" = "i386" ] ; then
269 is_x86_64
=`sysctl -n hw.optional.x86_64`
270 [ "$is_x86_64" = "1" ] && cpu
=x86_64
272 if [ "$cpu" = "x86_64" ] ; then
273 OS_CFLAGS
="-arch x86_64"
274 LDFLAGS
="-arch x86_64"
276 OS_CFLAGS
="-mdynamic-no-pic"
280 audio_drv_list
="coreaudio"
281 audio_possible_drivers
="coreaudio sdl fmod"
282 OS_LDFLAGS
="-framework CoreFoundation -framework IOKit"
288 needs_libsunmath
="no"
289 solarisrev
=`uname -r | cut -f2 -d.`
290 # have to select again, because `uname -m` returns i86pc
291 # even on an x86_64 box.
292 solariscpu
=`isainfo -k`
293 if test "${solariscpu}" = "amd64" ; then
296 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
297 if test "$solarisrev" -le 9 ; then
298 if test -f /opt
/SUNWspro
/prod
/lib
/libsunmath.so
.1; then
299 needs_libsunmath
="yes"
301 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
302 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
303 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
304 echo "Studio 11 can be downloaded from www.sun.com."
308 if test "$solarisrev" -ge 9 ; then
312 if test -f /usr
/include
/sys
/soundcard.h
; then
315 audio_possible_drivers
="oss sdl"
323 audio_possible_drivers
="oss alsa sdl esd pa"
327 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
329 audio_possible_drivers
="$audio_possible_drivers fmod"
332 if [ "$cpu" = "ia64" ] ; then
338 if [ "$cpu" = "powerpc" ]; then
344 if [ "$bsd" = "yes" ] ; then
345 if [ "$darwin" != "yes" ] ; then
353 source_path
=`dirname "$0"`
354 source_path_used
="no"
356 if [ -z "$source_path" ]; then
359 source_path
=`cd "$source_path"; pwd`
361 [ -f "$workdir/vl.c" ] || source_path_used
="yes"
364 # generate compile errors on warnings for development builds
365 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
370 optarg
=`expr "x$opt" : 'x[^=]*=\(.*\)'`
372 --help|
-h) show_help
=yes
374 --prefix=*) prefix
="$optarg"
376 --interp-prefix=*) interp_prefix
="$optarg"
378 --source-path=*) source_path
="$optarg"
379 source_path_used
="yes"
385 --host-cc=*) host_cc
="$optarg"
387 --make=*) make="$optarg"
389 --install=*) install="$optarg"
391 --extra-cflags=*) CFLAGS
="$optarg"
393 --extra-ldflags=*) LDFLAGS
="$optarg"
395 --cpu=*) cpu
="$optarg"
397 --target-list=*) target_list
="$optarg"
399 --enable-gprof) gprof
="yes"
401 --static) static
="yes"
403 --disable-sdl) sdl
="no"
405 --fmod-lib=*) fmod_lib
="$optarg"
407 --fmod-inc=*) fmod_inc
="$optarg"
409 --oss-lib=*) oss_lib
="$optarg"
411 --audio-card-list=*) audio_card_list
=`echo "$optarg" | sed -e 's/,/ /g'`
413 --audio-drv-list=*) audio_drv_list
="$optarg"
415 --enable-sparse) sparse
="yes"
417 --disable-sparse) sparse
="no"
419 --disable-strip) strip_opt
="no"
421 --disable-vnc-tls) vnc_tls
="no"
423 --disable-vnc-sasl) vnc_sasl
="no"
425 --disable-slirp) slirp
="no"
427 --disable-vde) vde
="no"
429 --disable-kqemu) kqemu
="no"
431 --disable-brlapi) brlapi
="no"
433 --disable-bluez) bluez
="no"
435 --disable-kvm) kvm
="no"
437 --enable-profiler) profiler
="yes"
442 audio_drv_list
="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
444 --disable-gfx-check) check_gfx
="no"
446 --disable-system) softmmu
="no"
448 --enable-system) softmmu
="yes"
450 --disable-linux-user) linux_user
="no"
452 --enable-linux-user) linux_user
="yes"
454 --disable-darwin-user) darwin_user
="no"
456 --enable-darwin-user) darwin_user
="yes"
458 --disable-bsd-user) bsd_user
="no"
460 --enable-bsd-user) bsd_user
="yes"
462 --enable-uname-release=*) uname_release
="$optarg"
467 v7|v8
) SP_CFLAGS
="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m32"
468 target_cpu
="sparc"; cpu
="sparc" ;;
469 v8plus|v8plusa
) SP_CFLAGS
="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m32"
470 target_cpu
="sparc"; cpu
="sparc" ;;
471 v9
) SP_CFLAGS
="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m64"
472 target_cpu
="sparc64"; cpu
="sparc64" ;;
473 *) echo "undefined SPARC architecture. Exiting";exit 1;;
476 --enable-werror) werror
="yes"
478 --disable-werror) werror
="no"
480 --disable-curses) curses
="no"
482 --disable-nptl) nptl
="no"
484 --enable-mixemu) mixemu
="yes"
486 --disable-aio) aio
="no"
488 --disable-blobs) blobs
="no"
490 --kerneldir=*) kerneldir
="$optarg"
492 --disable-cpu-emulation) cpu_emulation
="no"
494 *) echo "ERROR: unknown option $opt"; exit 1
499 # default flags for all hosts
500 CFLAGS
="$CFLAGS -O2 -g -fno-strict-aliasing"
501 CFLAGS
="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
502 LDFLAGS
="$LDFLAGS -g"
503 if test "$werror" = "yes" ; then
504 CFLAGS
="$CFLAGS -Werror"
507 CFLAGS
="$CFLAGS -I$(readlink -f "kvm
/libkvm
")"
509 if test "$solaris" = "no" ; then
510 if ld
--version 2>/dev
/null |
grep "GNU ld" >/dev
/null
2>/dev
/null
; then
511 LDFLAGS
="$LDFLAGS -Wl,--warn-common"
516 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
517 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
520 sparc
) if test -z "$sparc_cpu" ; then
521 ARCH_CFLAGS
="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
524 ARCH_CFLAGS
="${SP_CFLAGS}"
525 ARCH_LDFLAGS
="${SP_LDFLAGS}"
527 ARCH_CFLAGS
="$ARCH_CFLAGS -ffixed-g2 -ffixed-g3"
528 if test "$solaris" = "no" ; then
529 ARCH_CFLAGS
="$ARCH_CFLAGS -ffixed-g1 -ffixed-g6"
532 sparc64
) if test -z "$sparc_cpu" ; then
533 ARCH_CFLAGS
="-m64 -mcpu=ultrasparc -D__sparc_v9__"
536 ARCH_CFLAGS
="${SP_CFLAGS}"
537 ARCH_LDFLAGS
="${SP_LDFLAGS}"
539 if test "$solaris" = "no" ; then
540 ARCH_CFLAGS
="$ARCH_CFLAGS -ffixed-g5 -ffixed-g6 -ffixed-g7"
542 ARCH_CFLAGS
="$ARCH_CFLAGS -ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7"
546 ARCH_CFLAGS
="-march=z900"
558 if test x
"$show_help" = x
"yes" ; then
561 Usage: configure [options]
562 Options: [defaults in brackets after descriptions]
565 echo "Standard options:"
566 echo " --help print this message"
567 echo " --prefix=PREFIX install in PREFIX [$prefix]"
568 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
569 echo " use %M for cpu name [$interp_prefix]"
570 echo " --target-list=LIST set target list [$target_list]"
572 echo "kqemu kernel acceleration support:"
573 echo " --disable-kqemu disable kqemu support"
575 echo "Advanced options (experts only):"
576 echo " --source-path=PATH path of source code [$source_path]"
577 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
578 echo " --cc=CC use C compiler CC [$cc]"
579 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
580 echo " --extra-cflags=CFLAGS add C compiler flags CFLAGS"
581 echo " --extra-ldflags=LDFLAGS add linker flags LDFLAGS"
582 echo " --make=MAKE use specified make [$make]"
583 echo " --install=INSTALL use specified install [$install]"
584 echo " --static enable static build [$static]"
585 echo " --enable-sparse enable sparse checker"
586 echo " --disable-sparse disable sparse checker (default)"
587 echo " --disable-strip disable stripping binaries"
588 echo " --disable-werror disable compilation abort on warning"
589 echo " --disable-sdl disable SDL"
590 echo " --enable-cocoa enable COCOA (Mac OS X only)"
591 echo " --audio-drv-list=LIST set audio drivers list:"
592 echo " Available drivers: $audio_possible_drivers"
593 echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
594 echo " Available cards: $audio_possible_cards"
595 echo " --enable-mixemu enable mixer emulation"
596 echo " --disable-brlapi disable BrlAPI"
597 echo " --disable-vnc-tls disable TLS encryption for VNC server"
598 echo " --disable-vnc-sasl disable SASL encryption for VNC server"
599 echo " --disable-curses disable curses output"
600 echo " --disable-bluez disable bluez stack connectivity"
601 echo " --disable-kvm disable KVM acceleration support"
602 echo " --disable-nptl disable usermode NPTL support"
603 echo " --enable-system enable all system emulation targets"
604 echo " --disable-system disable all system emulation targets"
605 echo " --enable-linux-user enable all linux usermode emulation targets"
606 echo " --disable-linux-user disable all linux usermode emulation targets"
607 echo " --enable-darwin-user enable all darwin usermode emulation targets"
608 echo " --disable-darwin-user disable all darwin usermode emulation targets"
609 echo " --enable-bsd-user enable all BSD usermode emulation targets"
610 echo " --disable-bsd-user disable all BSD usermode emulation targets"
611 echo " --fmod-lib path to FMOD library"
612 echo " --fmod-inc path to FMOD includes"
613 echo " --oss-lib path to OSS library"
614 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
615 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
616 echo " --disable-vde disable support for vde network"
617 echo " --disable-aio disable AIO support"
618 echo " --disable-blobs disable installing provided firmware blobs"
619 echo " --kerneldir=PATH look for kernel includes in PATH"
620 echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
622 echo "NOTE: The object files are built at the place where configure is launched"
626 if test "$mingw32" = "yes" ; then
632 OS_CFLAGS
="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
635 if test ! -x "$(which cgcc 2>/dev/null)"; then
640 # Solaris specific configure tool chain decisions
642 if test "$solaris" = "yes" ; then
643 solinst
=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
644 if test -z "$solinst" ; then
645 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
646 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
647 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
650 if test "$solinst" = "/usr/sbin/install" ; then
651 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
652 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
653 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
656 sol_ar
=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
657 if test -z "$sol_ar" ; then
658 echo "Error: No path includes ar"
659 if test -f /usr
/ccs
/bin
/ar ; then
660 echo "Add /usr/ccs/bin to your path and rerun configure"
667 if test -z "$target_list" ; then
668 # these targets are portable
669 if [ "$softmmu" = "yes" ] ; then
688 # the following are Linux specific
689 if [ "$linux_user" = "yes" ] ; then
690 target_list
="${target_list}\
702 ppc64abi32-linux-user \
707 sparc32plus-linux-user \
710 # the following are Darwin specific
711 if [ "$darwin_user" = "yes" ] ; then
712 target_list
="$target_list i386-darwin-user ppc-darwin-user "
714 # the following are BSD specific
715 if [ "$bsd_user" = "yes" ] ; then
716 target_list
="${target_list}\
721 target_list
=`echo "$target_list" | sed -e 's/,/ /g'`
723 if test -z "$target_list" ; then
724 echo "No targets enabled"
728 if test -z "$cross_prefix" ; then
731 # big/little endian test
733 #include <inttypes.h>
734 int main(int argc, char ** argv){
735 volatile uint32_t i=0x01234567;
736 return (*((uint8_t*)(&i))) == 0x67;
740 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
741 $TMPE && bigendian
="yes"
743 echo big
/little
test failed
748 # if cross compiling, cannot launch a program, so make a static guess
749 if test "$cpu" = "armv4b" \
753 -o "$cpu" = "mips64" \
755 -o "$cpu" = "ppc64" \
757 -o "$cpu" = "sparc" \
758 -o "$cpu" = "sparc64"; then
764 # host long bits test
766 if test "$cpu" = "x86_64" \
767 -o "$cpu" = "alpha" \
769 -o "$cpu" = "sparc64" \
770 -o "$cpu" = "ppc64"; then
774 # Check host NPTL support
777 #include <linux/futex.h>
780 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
786 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev
/null
2> /dev
/null
; then
792 ##########################################
795 if test "$kvm" = "yes" ; then
797 # test for KVM_CAP_PIT
802 #error "kvm no pit capability"
804 int main(void) { return 0; }
806 if $cc $ARCH_CFLAGS $CFLAGS -I"$kerneldir"/include
-o $TMPE ${OS_CFLAGS} $TMPC 2> /dev
/null
; then
810 # test for KVM_CAP_DEVICE_ASSIGNMENT
814 #ifndef KVM_CAP_DEVICE_ASSIGNMENT
815 #error "kvm no device assignment capability"
817 int main(void) { return 0; }
819 if $cc $ARCH_CFLAGS $CFLAGS -I"$kerneldir"/include
-o $TMPE ${OS_CFLAGS} $TMPC 2> /dev
/null
; then
820 kvm_cap_device_assignment
="yes"
824 # libpci probe for kvm_cap_device_assignment
825 if test $kvm_cap_device_assignment = "yes" ; then
828 #ifndef PCI_VENDOR_ID
831 int main(void) { return 0; }
833 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC 2>/dev
/null
; then
837 echo "Error: libpci check failed"
838 echo "Disable KVM Device Assignment capability."
840 kvm_cap_device_assignment
="no"
844 ##########################################
849 int main(void) { zlibVersion(); return 0; }
851 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev
/null
2> /dev
/null
; then
855 echo "Error: zlib check failed"
856 echo "Make sure to have the zlib libs and headers installed."
861 ##########################################
866 if test -z "$sdl" ; then
867 sdl_config
="sdl-config"
873 #undef main /* We don't want SDL to override our main() */
874 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
876 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
877 _sdlversion
=`$sdl_config --version | sed 's/[^0-9]//g'`
878 if test "$_sdlversion" -lt 121 ; then
881 if test "$cocoa" = "no" ; then
886 # static link with sdl ?
887 if test "$sdl" = "yes" ; then
889 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa
="yes"
890 sdl_static_libs
=`$sdl_config --static-libs 2>/dev/null`
891 if [ "$aa" = "yes" ] ; then
892 sdl_static_libs
="$sdl_static_libs `aalib-config --static-libs`"
895 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev
/null
2> /dev
/null
; then
899 fi # sdl compile test
901 # Make sure to disable cocoa if sdl was set
902 if test "$sdl" = "yes" ; then
904 audio_drv_list
="`echo $audio_drv_list | sed s,coreaudio,,g`"
908 if test "$sdl" = "yes" ; then
911 #if defined(SDL_VIDEO_DRIVER_X11)
912 #include <X11/XKBlib.h>
914 #error No x11 support
916 int main(void) { return 0; }
918 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
923 ##########################################
925 if test "$vnc_tls" = "yes" ; then
927 #include <gnutls/gnutls.h>
928 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
930 vnc_tls_cflags
=`pkg-config --cflags gnutls 2> /dev/null`
931 vnc_tls_libs
=`pkg-config --libs gnutls 2> /dev/null`
932 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
933 $vnc_tls_libs > /dev
/null
2> /dev
/null
; then
940 ##########################################
942 if test "$vnc_sasl" = "yes" ; then
944 #include <sasl/sasl.h>
946 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
948 # Assuming Cyrus-SASL installed in /usr prefix
950 vnc_sasl_libs
="-lsasl2"
951 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
952 $vnc_sasl_libs 2> /dev
/null
; then
959 ##########################################
960 # fnmatch() probe, used for ACL routines
966 fnmatch("foo", "foo", 0);
970 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
974 ##########################################
975 # vde libraries probe
976 if test "$vde" = "yes" ; then
978 #include <libvdeplug.h>
981 struct vde_open_args a = {0, 0, 0};
982 vde_open("", "", &a);
986 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev
/null
2> /dev
/null
; then
993 ##########################################
994 # Sound support libraries probe
1005 int main(void) { $exp }
1007 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev
/null
2> /dev
/null
; then
1011 echo "Error: $drv check failed"
1012 echo "Make sure to have the $drv libs and headers installed."
1018 audio_drv_list
=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1019 for drv
in $audio_drv_list; do
1022 audio_drv_probe
$drv alsa
/asoundlib.h
-lasound \
1023 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1027 if test -z $fmod_lib ||
test -z $fmod_inc; then
1029 echo "Error: You must specify path to FMOD library and headers"
1030 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1034 audio_drv_probe
$drv fmod.h
$fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1038 audio_drv_probe
$drv esd.h
-lesd 'return esd_play_stream(0, 0, "", 0);'
1042 audio_drv_probe
$drv pulse
/simple.h
-lpulse-simple \
1043 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1046 oss|sdl|core|wav|dsound
)
1047 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1051 echo "$audio_possible_drivers" |
grep -q "\<$drv\>" ||
{
1053 echo "Error: Unknown driver '$drv' selected"
1054 echo "Possible drivers are: $audio_possible_drivers"
1062 ##########################################
1065 if test -z "$brlapi" ; then
1069 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1071 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev
/null
2> /dev
/null
; then
1073 fi # brlapi compile test
1076 ##########################################
1079 if test "$curses" = "yes" ; then
1083 int main(void) { return curses_version(); }
1085 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev
/null
2> /dev
/null
; then
1090 ##########################################
1091 # bluez support probe
1092 if test "$bluez" = "yes" ; then
1093 `pkg-config bluez` || bluez
="no"
1095 if test "$bluez" = "yes" ; then
1097 #include <bluetooth/bluetooth.h>
1098 int main(void) { return bt_error(0); }
1100 bluez_cflags
=`pkg-config --cflags bluez`
1101 bluez_libs
=`pkg-config --libs bluez`
1102 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
1103 $bluez_libs > /dev
/null
2> /dev
/null
; then
1110 ##########################################
1112 if test "$kvm" = "yes" ; then
1114 #include <linux/kvm.h>
1115 #if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
1116 #error Invalid KVM version
1118 #if !defined(KVM_CAP_USER_MEMORY)
1119 #error Missing KVM capability KVM_CAP_USER_MEMORY
1121 #if !defined(KVM_CAP_SET_TSS_ADDR)
1122 #error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1124 #if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1125 #error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1127 int main(void) { return 0; }
1129 if test "$kerneldir" != "" ; then
1130 kvm_cflags
=-I"$kerneldir"/include
1131 if test \
( "$cpu" = "i386" -o "$cpu" = "x86_64" \
) \
1132 -a -d "$kerneldir/arch/x86/include" ; then
1133 kvm_cflags
="$kvm_cflags -I$kerneldir/arch/x86/include"
1134 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1135 kvm_cflags
="$kvm_cflags -I$kerneldir/arch/powerpc/include"
1136 elif test -d "$kerneldir/arch/$cpu/include" ; then
1137 kvm_cflags
="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1142 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
1143 > /dev
/null
2>/dev
/null
; then
1147 if [ -x "`which awk 2>/dev/null`" ] && \
1148 [ -x "`which grep 2>/dev/null`" ]; then
1149 kvmerr
=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
1151 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1152 if test "$kvmerr" != "" ; then
1153 kvm
="no - (${kvmerr})"
1159 ##########################################
1163 if test "$aio" = "yes" ; then
1166 #include <pthread.h>
1167 int main(void) { pthread_mutex_t lock; return 0; }
1169 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev
/null
; then
1175 ##########################################
1178 #include <sys/types.h>
1179 #include <sys/uio.h>
1181 int main(void) { struct iovec iov; return 0; }
1184 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
1188 ##########################################
1191 #include <sys/types.h>
1192 #include <sys/uio.h>
1194 int main(void) { preadv; }
1197 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
1201 ##########################################
1203 if test "$fdt" = "yes" ; then
1206 int main(void) { return 0; }
1208 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev
/null
; then
1213 ##########################################
1218 #include <sys/syscall.h>
1220 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
1223 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
1227 ##########################################
1232 #include <sys/syscall.h>
1233 int main(void) { return syscall(SYS_eventfd, 0); }
1236 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
1240 # Check if tools are available to build documentation.
1241 if [ -x "`which texi2html 2>/dev/null`" ] && \
1242 [ -x "`which pod2man 2>/dev/null`" ]; then
1246 ##########################################
1251 int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1255 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
1257 elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev
/null
2> /dev
/null
; then
1261 if test "$rt" = "yes" ; then
1262 # Hack, we should have a general purpose LIBS for this sort of thing
1263 AIOLIBS
="$AIOLIBS -lrt"
1266 if test "$mingw32" = "yes" ; then
1267 if test -z "$prefix" ; then
1268 prefix
="c:\\\\Program Files\\\\Qemu"
1275 if test -z "$prefix" ; then
1278 mansuffix
="/share/man"
1279 datasuffix
="/share/qemu"
1280 docsuffix
="/share/doc/qemu"
1284 echo "Install prefix $prefix"
1285 echo "BIOS directory $prefix$datasuffix"
1286 echo "binary directory $prefix$binsuffix"
1287 if test "$mingw32" = "no" ; then
1288 echo "Manual directory $prefix$mansuffix"
1289 echo "ELF interp prefix $interp_prefix"
1291 echo "Source path $source_path"
1292 echo "C compiler $cc"
1293 echo "Host C compiler $host_cc"
1294 echo "ARCH_CFLAGS $ARCH_CFLAGS"
1296 echo "install $install"
1297 echo "host CPU $cpu"
1298 echo "host big endian $bigendian"
1299 echo "target list $target_list"
1300 echo "gprof enabled $gprof"
1301 echo "sparse enabled $sparse"
1302 echo "strip binaries $strip_opt"
1303 echo "profiler $profiler"
1304 echo "static build $static"
1305 echo "-Werror enabled $werror"
1306 if test "$darwin" = "yes" ; then
1307 echo "Cocoa support $cocoa"
1309 echo "SDL support $sdl"
1310 if test "$sdl" != "no" ; then
1311 echo "SDL static link $sdl_static"
1313 echo "curses support $curses"
1314 echo "mingw32 support $mingw32"
1315 echo "Audio drivers $audio_drv_list"
1316 echo "Extra audio cards $audio_card_list"
1317 echo "Mixer emulation $mixemu"
1318 echo "VNC TLS support $vnc_tls"
1319 if test "$vnc_tls" = "yes" ; then
1320 echo " TLS CFLAGS $vnc_tls_cflags"
1321 echo " TLS LIBS $vnc_tls_libs"
1323 echo "VNC SASL support $vnc_sasl"
1324 if test "$vnc_sasl" = "yes" ; then
1325 echo " SASL CFLAGS $vnc_sasl_cflags"
1326 echo " SASL LIBS $vnc_sasl_libs"
1328 if test -n "$sparc_cpu"; then
1329 echo "Target Sparc Arch $sparc_cpu"
1331 echo "kqemu support $kqemu"
1332 echo "kvm support $kvm"
1333 echo "CPU emulation $cpu_emulation"
1334 echo "brlapi support $brlapi"
1335 echo "Documentation $build_docs"
1336 [ ! -z "$uname_release" ] && \
1337 echo "uname -r $uname_release"
1338 echo "NPTL support $nptl"
1339 echo "vde support $vde"
1340 echo "AIO support $aio"
1341 echo "Install blobs $blobs"
1342 echo "KVM support $kvm"
1343 echo "fdt support $fdt"
1344 echo "preadv support $preadv"
1346 if test $sdl_too_old = "yes"; then
1347 echo "-> Your SDL version is too old - please upgrade to have SDL support"
1349 if [ -s $TMPSDLLOG ]; then
1350 echo "The error log from compiling the libSDL test is: "
1353 #if test "$sdl_static" = "no"; then
1354 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1356 config_mak
="config-host.mak"
1357 config_h
="config-host.h"
1359 #echo "Creating $config_mak and $config_h"
1361 test -f $config_h && mv $config_h ${config_h}~
1363 echo "# Automatically generated by configure - do not modify" > $config_mak
1364 printf "# Configured with:" >> $config_mak
1365 printf " '%s'" "$0" "$@" >> $config_mak
1367 echo "/* Automatically generated by configure - do not modify */" > $config_h
1369 echo "prefix=$prefix" >> $config_mak
1370 echo "bindir=\${prefix}$binsuffix" >> $config_mak
1371 echo "mandir=\${prefix}$mansuffix" >> $config_mak
1372 echo "datadir=\${prefix}$datasuffix" >> $config_mak
1373 echo "docdir=\${prefix}$docsuffix" >> $config_mak
1374 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
1375 echo "MAKE=$make" >> $config_mak
1376 echo "INSTALL=$install" >> $config_mak
1377 echo "CC=$cc" >> $config_mak
1378 echo "HOST_CC=$host_cc" >> $config_mak
1379 echo "AR=$ar" >> $config_mak
1380 # XXX: only use CFLAGS and LDFLAGS ?
1381 # XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1382 # compilation of dyngen tool (useful for win32 build on Linux host)
1383 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
1384 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1385 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1386 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
1387 echo "CFLAGS=$CFLAGS" >> $config_mak
1388 echo "LDFLAGS=$LDFLAGS" >> $config_mak
1389 echo "EXESUF=$EXESUF" >> $config_mak
1390 echo "AIOLIBS=$AIOLIBS" >> $config_mak
1393 echo "ARCH=i386" >> $config_mak
1394 echo "#define HOST_I386 1" >> $config_h
1397 echo "ARCH=x86_64" >> $config_mak
1398 echo "#define HOST_X86_64 1" >> $config_h
1401 echo "ARCH=alpha" >> $config_mak
1402 echo "#define HOST_ALPHA 1" >> $config_h
1405 echo "ARCH=arm" >> $config_mak
1406 echo "#define HOST_ARM 1" >> $config_h
1409 echo "ARCH=arm" >> $config_mak
1410 echo "#define HOST_ARM 1" >> $config_h
1413 echo "ARCH=cris" >> $config_mak
1414 echo "#define HOST_CRIS 1" >> $config_h
1417 echo "ARCH=hppa" >> $config_mak
1418 echo "#define HOST_HPPA 1" >> $config_h
1421 echo "ARCH=ia64" >> $config_mak
1422 echo "#define HOST_IA64 1" >> $config_h
1425 echo "ARCH=m68k" >> $config_mak
1426 echo "#define HOST_M68K 1" >> $config_h
1429 echo "ARCH=mips" >> $config_mak
1430 echo "#define HOST_MIPS 1" >> $config_h
1433 echo "ARCH=mips64" >> $config_mak
1434 echo "#define HOST_MIPS64 1" >> $config_h
1437 echo "ARCH=ppc" >> $config_mak
1438 echo "#define HOST_PPC 1" >> $config_h
1441 echo "ARCH=ppc64" >> $config_mak
1442 echo "#define HOST_PPC64 1" >> $config_h
1445 echo "ARCH=s390" >> $config_mak
1446 echo "#define HOST_S390 1" >> $config_h
1449 echo "ARCH=sparc" >> $config_mak
1450 echo "#define HOST_SPARC 1" >> $config_h
1453 echo "ARCH=sparc64" >> $config_mak
1454 echo "#define HOST_SPARC64 1" >> $config_h
1457 echo "Unsupported CPU = $cpu"
1461 if test "$sparse" = "yes" ; then
1462 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1463 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1464 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1466 if test "$strip_opt" = "yes" ; then
1467 echo "STRIP_OPT=-s" >> $config_mak
1469 if test "$bigendian" = "yes" ; then
1470 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1471 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1473 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
1474 if test "$mingw32" = "yes" ; then
1475 echo "CONFIG_WIN32=yes" >> $config_mak
1476 echo "#define CONFIG_WIN32 1" >> $config_h
1479 #include <byteswap.h>
1480 int main(void) { return bswap_32(0); }
1482 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev
/null
2> /dev
/null
; then
1483 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1486 #include <sys/endian.h>
1487 #include <sys/types.h>
1488 #include <machine/bswap.h>
1489 int main(void) { return bswap32(0); }
1491 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev
/null
2> /dev
/null
; then
1492 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1496 if [ "$openbsd" = "yes" ] ; then
1497 echo "#define ENOTSUP 4096" >> $config_h
1500 if test "$darwin" = "yes" ; then
1501 echo "CONFIG_DARWIN=yes" >> $config_mak
1502 echo "#define CONFIG_DARWIN 1" >> $config_h
1505 if test "$aix" = "yes" ; then
1506 echo "CONFIG_AIX=yes" >> $config_mak
1507 echo "#define CONFIG_AIX 1" >> $config_h
1510 if test "$solaris" = "yes" ; then
1511 echo "CONFIG_SOLARIS=yes" >> $config_mak
1512 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
1513 if test "$needs_libsunmath" = "yes" ; then
1514 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1515 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1518 if test -n "$sparc_cpu"; then
1519 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1520 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1522 if test "$gdbstub" = "yes" ; then
1523 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1524 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1526 if test "$gprof" = "yes" ; then
1527 echo "TARGET_GPROF=yes" >> $config_mak
1528 echo "#define HAVE_GPROF 1" >> $config_h
1530 if test "$static" = "yes" ; then
1531 echo "CONFIG_STATIC=yes" >> $config_mak
1532 echo "#define CONFIG_STATIC 1" >> $config_h
1534 if test $profiler = "yes" ; then
1535 echo "#define CONFIG_PROFILER 1" >> $config_h
1537 if test "$slirp" = "yes" ; then
1538 echo "CONFIG_SLIRP=yes" >> $config_mak
1539 echo "#define CONFIG_SLIRP 1" >> $config_h
1541 if test "$vde" = "yes" ; then
1542 echo "CONFIG_VDE=yes" >> $config_mak
1543 echo "#define CONFIG_VDE 1" >> $config_h
1544 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1546 for card
in $audio_card_list; do
1547 def
=CONFIG_
`echo $card | tr '[:lower:]' '[:upper:]'`
1548 echo "$def=yes" >> $config_mak
1549 echo "#define $def 1" >> $config_h
1551 echo "#define AUDIO_DRIVERS \\" >> $config_h
1552 for drv
in $audio_drv_list; do
1553 echo " &${drv}_audio_driver, \\" >>$config_h
1554 def
=CONFIG_
`echo $drv | tr '[:lower:]' '[:upper:]'`
1555 echo "$def=yes" >> $config_mak
1556 if test "$drv" = "fmod"; then
1557 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1558 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1559 elif test "$drv" = "oss"; then
1560 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
1564 if test "$mixemu" = "yes" ; then
1565 echo "CONFIG_MIXEMU=yes" >> $config_mak
1566 echo "#define CONFIG_MIXEMU 1" >> $config_h
1568 if test "$vnc_tls" = "yes" ; then
1569 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1570 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1571 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1572 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1574 if test "$vnc_sasl" = "yes" ; then
1575 echo "CONFIG_VNC_SASL=yes" >> $config_mak
1576 echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1577 echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1578 echo "#define CONFIG_VNC_SASL 1" >> $config_h
1580 if test "$fnmatch" = "yes" ; then
1581 echo "#define HAVE_FNMATCH_H 1" >> $config_h
1583 qemu_version
=`head $source_path/VERSION`
1584 echo "VERSION=$qemu_version" >>$config_mak
1585 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1586 echo "#define KVM_VERSION \"kvm-devel\"" >> $config_h
1588 echo "SRC_PATH=$source_path" >> $config_mak
1589 if [ "$source_path_used" = "yes" ]; then
1590 echo "VPATH=$source_path" >> $config_mak
1592 echo "TARGET_DIRS=$target_list" >> $config_mak
1593 if [ "$build_docs" = "yes" ] ; then
1594 echo "BUILD_DOCS=yes" >> $config_mak
1596 if test "$static" = "yes"; then
1601 if test "$sdl1" = "yes" ; then
1602 echo "#define CONFIG_SDL 1" >> $config_h
1603 echo "CONFIG_SDL=yes" >> $config_mak
1604 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1605 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1606 elif test "$sdl_x11" = "yes" ; then
1607 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
1609 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1611 if [ "${aa}" = "yes" ] ; then
1612 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1614 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1617 if test "$cocoa" = "yes" ; then
1618 echo "#define CONFIG_COCOA 1" >> $config_h
1619 echo "CONFIG_COCOA=yes" >> $config_mak
1621 if test "$curses" = "yes" ; then
1622 echo "#define CONFIG_CURSES 1" >> $config_h
1623 echo "CONFIG_CURSES=yes" >> $config_mak
1624 echo "CURSES_LIBS=-lcurses" >> $config_mak
1626 if test "$brlapi" = "yes" ; then
1627 echo "CONFIG_BRLAPI=yes" >> $config_mak
1628 echo "#define CONFIG_BRLAPI 1" >> $config_h
1629 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1631 if test "$bluez" = "yes" ; then
1632 echo "CONFIG_BLUEZ=yes" >> $config_mak
1633 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1634 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1635 echo "#define CONFIG_BLUEZ 1" >> $config_h
1637 if test "$aio" = "yes" ; then
1638 echo "#define CONFIG_AIO 1" >> $config_h
1639 echo "CONFIG_AIO=yes" >> $config_mak
1641 if test "$blobs" = "yes" ; then
1642 echo "INSTALL_BLOBS=yes" >> $config_mak
1644 if test "$iovec" = "yes" ; then
1645 echo "#define HAVE_IOVEC 1" >> $config_h
1647 if test "$preadv" = "yes" ; then
1648 echo "#define HAVE_PREADV 1" >> $config_h
1650 if test "$fdt" = "yes" ; then
1651 echo "#define HAVE_FDT 1" >> $config_h
1652 echo "FDT_LIBS=-lfdt" >> $config_mak
1654 if test "$signalfd" = "yes" ; then
1655 echo "#define CONFIG_signalfd 1" >> $config_h
1657 if test "$eventfd" = "yes" ; then
1658 echo "#define CONFIG_eventfd 1" >> $config_h
1661 # XXX: suppress that
1662 if [ "$bsd" = "yes" ] ; then
1663 echo "#define O_LARGEFILE 0" >> $config_h
1664 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1665 echo "#define HOST_BSD 1" >> $config_h
1668 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1673 echo "HOST_USB=linux" >> $config_mak
1676 echo "HOST_USB=bsd" >> $config_mak
1679 echo "HOST_USB=stub" >> $config_mak
1684 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1685 tools
="qemu-img\$(EXESUF) $tools"
1686 if [ "$linux" = "yes" ] ; then
1687 tools
="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
1690 echo "TOOLS=$tools" >> $config_mak
1692 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~
$config_h
1694 for target
in $target_list; do
1695 target_dir
="$target"
1696 config_mak
=$target_dir/config.mak
1697 config_h
=$target_dir/config.h
1698 target_cpu
=`echo $target | cut -d '-' -f 1`
1699 target_bigendian
="no"
1700 [ "$target_cpu" = "armeb" ] && target_bigendian
=yes
1701 [ "$target_cpu" = "m68k" ] && target_bigendian
=yes
1702 [ "$target_cpu" = "mips" ] && target_bigendian
=yes
1703 [ "$target_cpu" = "mipsn32" ] && target_bigendian
=yes
1704 [ "$target_cpu" = "mips64" ] && target_bigendian
=yes
1705 [ "$target_cpu" = "ppc" ] && target_bigendian
=yes
1706 [ "$target_cpu" = "ppcemb" ] && target_bigendian
=yes
1707 [ "$target_cpu" = "ppc64" ] && target_bigendian
=yes
1708 [ "$target_cpu" = "ppc64abi32" ] && target_bigendian
=yes
1709 [ "$target_cpu" = "sh4eb" ] && target_bigendian
=yes
1710 [ "$target_cpu" = "sparc" ] && target_bigendian
=yes
1711 [ "$target_cpu" = "sparc64" ] && target_bigendian
=yes
1712 [ "$target_cpu" = "sparc32plus" ] && target_bigendian
=yes
1714 target_user_only
="no"
1715 target_linux_user
="no"
1716 target_darwin_user
="no"
1717 target_bsd_user
="no"
1719 ${target_cpu}-softmmu)
1720 target_softmmu
="yes"
1722 ${target_cpu}-linux-user)
1723 target_user_only
="yes"
1724 target_linux_user
="yes"
1726 ${target_cpu}-darwin-user)
1727 target_user_only
="yes"
1728 target_darwin_user
="yes"
1730 ${target_cpu}-bsd-user)
1731 target_user_only
="yes"
1732 target_bsd_user
="yes"
1735 echo "ERROR: Target '$target' not recognised"
1740 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1741 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1742 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1743 echo "To build QEMU without graphical output configure with --disable-gfx-check"
1744 echo "Note that this will disable all output from the virtual graphics card"
1745 echo "except through VNC or curses."
1749 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1751 test -f $config_h && mv $config_h ${config_h}~
1753 mkdir
-p $target_dir
1754 mkdir
-p $target_dir/fpu
1755 mkdir
-p $target_dir/tcg
1756 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
1757 mkdir
-p $target_dir/nwfpe
1761 # don't use ln -sf as not all "ln -sf" over write the file/link
1763 rm -f $target_dir/Makefile
1764 ln -s $source_path/Makefile.target
$target_dir/Makefile
1767 echo "# Automatically generated by configure - do not modify" > $config_mak
1768 echo "/* Automatically generated by configure - do not modify */" > $config_h
1771 echo "include ../config-host.mak" >> $config_mak
1772 echo "#include \"../config-host.h\"" >> $config_h
1777 interp_prefix1
=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1778 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1781 disable_cpu_emulation
() {
1782 if test $cpu_emulation = "no"; then
1783 echo "#define NO_CPU_EMULATION 1" >> $config_h
1784 echo "NO_CPU_EMULATION=1" >> $config_mak
1789 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
1790 \
( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \
); then
1791 echo "#define USE_KVM 1" >> $config_h
1792 echo "USE_KVM=1" >> $config_mak
1793 echo "CONFIG_KVM_KERNEL_INC=$kerneldir/include" >> $config_mak
1794 if test $kvm_cap_pit = "yes" ; then
1795 echo "USE_KVM_PIT=1" >> $config_mak
1796 echo "#define USE_KVM_PIT 1" >> $config_h
1798 if test $kvm_cap_device_assignment = "yes" ; then
1799 echo "USE_KVM_DEVICE_ASSIGNMENT=1" >> $config_mak
1800 echo "#define USE_KVM_DEVICE_ASSIGNMENT 1" >> $config_h
1802 disable_cpu_emulation
1806 if [ use_upstream_kvm
= yes ]; then
1808 # Make sure the target and host cpus are compatible
1809 if test "$kvm" = "yes" -a ! \
( "$target_cpu" = "$cpu" -o \
1810 \
( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \
) -o \
1811 \
( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \
) -o \
1812 \
( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \
) \
) ; then
1815 # Disable KVM for linux-user
1816 if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1822 case "$target_cpu" in
1824 echo "TARGET_ARCH=i386" >> $config_mak
1825 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1826 echo "#define TARGET_I386 1" >> $config_h
1827 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
1829 echo "#define USE_KQEMU 1" >> $config_h
1831 if test "$kvm" = "yes" ; then
1832 echo "USE_KVM=yes" >> $config_mak
1833 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1834 echo "#define USE_KVM 1" >> $config_h
1839 echo "TARGET_ARCH=x86_64" >> $config_mak
1840 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1841 echo "#define TARGET_I386 1" >> $config_h
1842 echo "#define TARGET_X86_64 1" >> $config_h
1843 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1845 echo "#define USE_KQEMU 1" >> $config_h
1850 echo "TARGET_ARCH=ia64" >> $config_mak
1851 echo "#define TARGET_ARCH \"ia64\"" >> $config_h
1852 echo "#define TARGET_IA64 1" >> $config_h
1854 if [ use_upstream_kvm
= yes ]; then
1855 if test "$kvm" = "yes" ; then
1856 echo "USE_KVM=yes" >> $config_mak
1857 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1858 echo "#define USE_KVM 1" >> $config_h
1863 echo "TARGET_ARCH=alpha" >> $config_mak
1864 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1865 echo "#define TARGET_ALPHA 1" >> $config_h
1868 echo "TARGET_ARCH=arm" >> $config_mak
1869 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1870 echo "#define TARGET_ARM 1" >> $config_h
1873 gdb_xml_files
="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
1876 echo "TARGET_ARCH=cris" >> $config_mak
1877 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1878 echo "#define TARGET_CRIS 1" >> $config_h
1882 echo "TARGET_ARCH=m68k" >> $config_mak
1883 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1884 echo "#define TARGET_M68K 1" >> $config_h
1886 gdb_xml_files
="cf-core.xml cf-fp.xml"
1889 echo "TARGET_ARCH=mips" >> $config_mak
1890 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1891 echo "#define TARGET_MIPS 1" >> $config_h
1892 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1895 echo "TARGET_ARCH=mipsn32" >> $config_mak
1896 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1897 echo "#define TARGET_MIPS 1" >> $config_h
1898 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1901 echo "TARGET_ARCH=mips64" >> $config_mak
1902 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1903 echo "#define TARGET_MIPS 1" >> $config_h
1904 echo "#define TARGET_MIPS64 1" >> $config_h
1905 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1908 echo "TARGET_ARCH=ppc" >> $config_mak
1909 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1910 echo "#define TARGET_PPC 1" >> $config_h
1911 gdb_xml_files
="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1914 echo "TARGET_ARCH=ppcemb" >> $config_mak
1915 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1916 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1917 echo "#define TARGET_PPC 1" >> $config_h
1918 echo "#define TARGET_PPCEMB 1" >> $config_h
1919 if test "$kvm" = "yes" ; then
1920 echo "USE_KVM=yes" >> $config_mak
1921 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1922 echo "#define USE_KVM 1" >> $config_h
1924 gdb_xml_files
="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1927 echo "TARGET_ARCH=ppc64" >> $config_mak
1928 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1929 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1930 echo "#define TARGET_PPC 1" >> $config_h
1931 echo "#define TARGET_PPC64 1" >> $config_h
1932 gdb_xml_files
="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1935 echo "TARGET_ARCH=ppc64" >> $config_mak
1936 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1937 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1938 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1939 echo "#define TARGET_PPC 1" >> $config_h
1940 echo "#define TARGET_PPC64 1" >> $config_h
1941 echo "#define TARGET_ABI32 1" >> $config_h
1942 gdb_xml_files
="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1945 echo "TARGET_ARCH=sh4" >> $config_mak
1946 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1947 echo "#define TARGET_SH4 1" >> $config_h
1952 echo "TARGET_ARCH=sparc" >> $config_mak
1953 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1954 echo "#define TARGET_SPARC 1" >> $config_h
1957 echo "TARGET_ARCH=sparc64" >> $config_mak
1958 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1959 echo "#define TARGET_SPARC 1" >> $config_h
1960 echo "#define TARGET_SPARC64 1" >> $config_h
1964 echo "TARGET_ARCH=sparc64" >> $config_mak
1965 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1966 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1967 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1968 echo "#define TARGET_SPARC 1" >> $config_h
1969 echo "#define TARGET_SPARC64 1" >> $config_h
1970 echo "#define TARGET_ABI32 1" >> $config_h
1973 echo "Unsupported target CPU"
1977 if test "$target_bigendian" = "yes" ; then
1978 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1979 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1981 if test "$target_softmmu" = "yes" ; then
1982 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1983 echo "#define CONFIG_SOFTMMU 1" >> $config_h
1985 if test "$target_user_only" = "yes" ; then
1986 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1987 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1989 if test "$target_linux_user" = "yes" ; then
1990 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1991 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1993 if test "$target_darwin_user" = "yes" ; then
1994 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1995 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1998 if test ! -z "$gdb_xml_files" ; then
1999 for x
in $gdb_xml_files; do
2000 list
="$list $source_path/gdb-xml/$x"
2003 echo "TARGET_XML_FILES=$list" >> $config_mak
2005 if test "$target_cpu" = "arm" \
2006 -o "$target_cpu" = "armeb" \
2007 -o "$target_cpu" = "m68k" \
2008 -o "$target_cpu" = "mips" \
2009 -o "$target_cpu" = "mipsel" \
2010 -o "$target_cpu" = "mipsn32" \
2011 -o "$target_cpu" = "mipsn32el" \
2012 -o "$target_cpu" = "mips64" \
2013 -o "$target_cpu" = "mips64el" \
2014 -o "$target_cpu" = "ppc" \
2015 -o "$target_cpu" = "ppc64" \
2016 -o "$target_cpu" = "ppc64abi32" \
2017 -o "$target_cpu" = "ppcemb" \
2018 -o "$target_cpu" = "sparc" \
2019 -o "$target_cpu" = "sparc64" \
2020 -o "$target_cpu" = "sparc32plus"; then
2021 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
2022 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
2024 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
2025 echo "TARGET_HAS_BFLT=yes" >> $config_mak
2026 echo "#define TARGET_HAS_BFLT 1" >> $config_h
2028 if test "$target_user_only" = "yes" \
2029 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
2030 echo "#define USE_NPTL 1" >> $config_h
2032 # 32 bit ELF loader in addition to native 64 bit loader?
2033 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
2034 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
2035 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
2037 if test "$target_bsd_user" = "yes" ; then
2038 echo "CONFIG_BSD_USER=yes" >> $config_mak
2039 echo "#define CONFIG_BSD_USER 1" >> $config_h
2042 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~
$config_h
2044 done # for target in $targets
2046 # build tree in object directory if source path is different from current one
2047 if test "$source_path_used" = "yes" ; then
2048 DIRS
="tests tests/cris slirp audio"
2049 FILES
="Makefile tests/Makefile"
2050 FILES
="$FILES tests/cris/Makefile tests/cris/.gdbinit"
2051 FILES
="$FILES tests/test-mmap.c"
2052 for dir
in $DIRS ; do
2055 # remove the link and recreate it, as not all "ln -sf" overwrite the link
2056 for f
in $FILES ; do
2058 ln -s $source_path/$f $f