3 # qemu configure script (c) 2003 Fabrice Bellard
5 # set temporary file name
6 if test ! -z "$TMPDIR" ; then
8 elif test ! -z "$TEMPDIR" ; then
14 TMPC
="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
15 TMPO
="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
16 TMPE
="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"
17 TMPS
="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
18 TMPI
="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.i"
19 TMPSDLLOG
="${TMPDIR1}/qemu-conf-sdl-$$-${RANDOM}.log"
21 trap "rm -f $TMPC $TMPO $TMPE $TMPS $TMPI $TMPSDLLOG; exit" 0 2 3 15
25 interp_prefix
="/usr/gnemul/qemu-%M"
30 audio_card_list
="ac97 es1370 sb16"
31 audio_possible_cards
="ac97 es1370 sb16 cs4231a adlib gus"
38 # parse CC options first
40 optarg
=`expr "x$opt" : 'x[^=]*=\(.*\)'`
42 --cross-prefix=*) cross_prefix
="$optarg"
50 # Using uname is really, really broken. Once we have the right set of checks
51 # we can eliminate it's usage altogether
53 cc
="${cross_prefix}${cc}"
54 ar="${cross_prefix}${ar}"
55 strip
="${cross_prefix}${strip}"
57 # check that the C compiler works.
62 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev
/null
2> /dev
/null
; then
65 echo "ERROR: \"$cc\" either does not exist or does not work"
74 int main(void) { return 0; }
76 $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev
/null
2> /dev
/null
79 if check_define __i386__
; then
81 elif check_define __x86_64__
; then
83 elif check_define __sparc__
; then
84 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
85 # They must be specified using --sparc_cpu
86 if check_define __arch64__
; then
91 elif check_define _ARCH_PPC
; then
92 if check_define _ARCH_PPC64
; then
103 i386|i486|i586|i686|i86pc|BePC
)
188 kvm_cap_device_assignment
="no"
199 if check_define __linux__
; then
201 elif check_define _WIN32
; then
209 OS_CFLAGS
="-mno-cygwin"
210 if [ "$cpu" = "i386" ] ; then
213 audio_possible_drivers
="sdl"
217 if [ "$cpu" = "i386" ] ; then
220 audio_possible_drivers
="dsound sdl fmod"
224 audio_possible_drivers
="oss sdl esd pa"
225 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
232 audio_possible_drivers
="oss sdl esd pa"
233 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
241 audio_possible_drivers
="oss sdl esd pa"
242 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
250 audio_possible_drivers
="oss sdl esd"
257 audio_possible_drivers
="oss sdl esd"
263 # 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
264 if [ "$cpu" = "i386" ] ; then
265 is_x86_64
=`sysctl -n hw.optional.x86_64`
266 [ "$is_x86_64" = "1" ] && cpu
=x86_64
268 if [ "$cpu" = "x86_64" ] ; then
269 OS_CFLAGS
="-arch x86_64"
270 LDFLAGS
="-arch x86_64"
272 OS_CFLAGS
="-mdynamic-no-pic"
276 audio_drv_list
="coreaudio"
277 audio_possible_drivers
="coreaudio sdl fmod"
278 OS_LDFLAGS
="-framework CoreFoundation -framework IOKit"
284 needs_libsunmath
="no"
285 solarisrev
=`uname -r | cut -f2 -d.`
286 # have to select again, because `uname -m` returns i86pc
287 # even on an x86_64 box.
288 solariscpu
=`isainfo -k`
289 if test "${solariscpu}" = "amd64" ; then
292 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
293 if test "$solarisrev" -le 9 ; then
294 if test -f /opt
/SUNWspro
/prod
/lib
/libsunmath.so
.1; then
295 needs_libsunmath
="yes"
297 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
298 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
299 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
300 echo "Studio 11 can be downloaded from www.sun.com."
304 if test "$solarisrev" -ge 9 ; then
308 if test -f /usr
/include
/sys
/soundcard.h
; then
311 audio_possible_drivers
="oss sdl"
319 audio_possible_drivers
="oss alsa sdl esd pa"
323 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
325 audio_possible_drivers
="$audio_possible_drivers fmod"
328 if [ "$cpu" = "ia64" ] ; then
334 if [ "$cpu" = "powerpc" ]; then
340 if [ "$bsd" = "yes" ] ; then
341 if [ "$darwin" != "yes" ] ; then
349 source_path
=`dirname "$0"`
350 source_path_used
="no"
352 if [ -z "$source_path" ]; then
355 source_path
=`cd "$source_path"; pwd`
357 [ -f "$workdir/vl.c" ] || source_path_used
="yes"
360 # generate compile errors on warnings for development builds
361 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
366 optarg
=`expr "x$opt" : 'x[^=]*=\(.*\)'`
368 --help|
-h) show_help
=yes
370 --prefix=*) prefix
="$optarg"
372 --interp-prefix=*) interp_prefix
="$optarg"
374 --source-path=*) source_path
="$optarg"
375 source_path_used
="yes"
381 --host-cc=*) host_cc
="$optarg"
383 --make=*) make="$optarg"
385 --install=*) install="$optarg"
387 --extra-cflags=*) CFLAGS
="$optarg"
389 --extra-ldflags=*) LDFLAGS
="$optarg"
391 --cpu=*) cpu
="$optarg"
393 --target-list=*) target_list
="$optarg"
395 --enable-gprof) gprof
="yes"
397 --static) static
="yes"
399 --disable-sdl) sdl
="no"
401 --fmod-lib=*) fmod_lib
="$optarg"
403 --fmod-inc=*) fmod_inc
="$optarg"
405 --oss-lib=*) oss_lib
="$optarg"
407 --audio-card-list=*) audio_card_list
=`echo "$optarg" | sed -e 's/,/ /g'`
409 --audio-drv-list=*) audio_drv_list
="$optarg"
411 --enable-sparse) sparse
="yes"
413 --disable-sparse) sparse
="no"
415 --disable-vnc-tls) vnc_tls
="no"
417 --disable-vnc-sasl) vnc_sasl
="no"
419 --disable-slirp) slirp
="no"
421 --disable-vde) vde
="no"
423 --disable-kqemu) kqemu
="no"
425 --disable-brlapi) brlapi
="no"
427 --disable-bluez) bluez
="no"
429 --disable-kvm) kvm
="no"
431 --enable-profiler) profiler
="yes"
436 audio_drv_list
="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
438 --disable-gfx-check) check_gfx
="no"
440 --disable-system) softmmu
="no"
442 --enable-system) softmmu
="yes"
444 --disable-linux-user) linux_user
="no"
446 --enable-linux-user) linux_user
="yes"
448 --disable-darwin-user) darwin_user
="no"
450 --enable-darwin-user) darwin_user
="yes"
452 --disable-bsd-user) bsd_user
="no"
454 --enable-bsd-user) bsd_user
="yes"
456 --enable-uname-release=*) uname_release
="$optarg"
461 v7|v8
) SP_CFLAGS
="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m32"
462 target_cpu
="sparc"; cpu
="sparc" ;;
463 v8plus|v8plusa
) SP_CFLAGS
="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m32"
464 target_cpu
="sparc"; cpu
="sparc" ;;
465 v9
) SP_CFLAGS
="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m64"
466 target_cpu
="sparc64"; cpu
="sparc64" ;;
467 *) echo "undefined SPARC architecture. Exiting";exit 1;;
470 --enable-werror) werror
="yes"
472 --disable-werror) werror
="no"
474 --disable-curses) curses
="no"
476 --disable-nptl) nptl
="no"
478 --enable-mixemu) mixemu
="yes"
480 --disable-aio) aio
="no"
482 --disable-blobs) blobs
="no"
484 --kerneldir=*) kerneldir
="$optarg"
486 --disable-cpu-emulation) cpu_emulation
="no"
488 *) echo "ERROR: unknown option $opt"; exit 1
493 # default flags for all hosts
494 CFLAGS
="$CFLAGS -O2 -g -fno-strict-aliasing"
495 CFLAGS
="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
496 LDFLAGS
="$LDFLAGS -g"
497 if test "$werror" = "yes" ; then
498 CFLAGS
="$CFLAGS -Werror"
501 if test "$solaris" = "no" ; then
502 if ld
--version 2>/dev
/null |
grep "GNU ld" >/dev
/null
2>/dev
/null
; then
503 LDFLAGS
="$LDFLAGS -Wl,--warn-common"
508 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
509 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
512 sparc
) if test -z "$sparc_cpu" ; then
513 ARCH_CFLAGS
="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
516 ARCH_CFLAGS
="${SP_CFLAGS}"
517 ARCH_LDFLAGS
="${SP_LDFLAGS}"
520 sparc64
) if test -z "$sparc_cpu" ; then
521 ARCH_CFLAGS
="-m64 -mcpu=ultrasparc -D__sparc_v9__"
524 ARCH_CFLAGS
="${SP_CFLAGS}"
525 ARCH_LDFLAGS
="${SP_LDFLAGS}"
529 ARCH_CFLAGS
="-march=z900"
541 if test x
"$show_help" = x
"yes" ; then
544 Usage: configure [options]
545 Options: [defaults in brackets after descriptions]
548 echo "Standard options:"
549 echo " --help print this message"
550 echo " --prefix=PREFIX install in PREFIX [$prefix]"
551 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
552 echo " use %M for cpu name [$interp_prefix]"
553 echo " --target-list=LIST set target list [$target_list]"
555 echo "kqemu kernel acceleration support:"
556 echo " --disable-kqemu disable kqemu support"
558 echo "Advanced options (experts only):"
559 echo " --source-path=PATH path of source code [$source_path]"
560 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
561 echo " --cc=CC use C compiler CC [$cc]"
562 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
563 echo " --make=MAKE use specified make [$make]"
564 echo " --install=INSTALL use specified install [$install]"
565 echo " --static enable static build [$static]"
566 echo " --enable-sparse enable sparse checker"
567 echo " --disable-sparse disable sparse checker (default)"
568 echo " --disable-werror disable compilation abort on warning"
569 echo " --disable-sdl disable SDL"
570 echo " --enable-cocoa enable COCOA (Mac OS X only)"
571 echo " --audio-drv-list=LIST set audio drivers list:"
572 echo " Available drivers: $audio_possible_drivers"
573 echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
574 echo " Available cards: $audio_possible_cards"
575 echo " --enable-mixemu enable mixer emulation"
576 echo " --disable-brlapi disable BrlAPI"
577 echo " --disable-vnc-tls disable TLS encryption for VNC server"
578 echo " --disable-vnc-sasl disable SASL encryption for VNC server"
579 echo " --disable-curses disable curses output"
580 echo " --disable-bluez disable bluez stack connectivity"
581 echo " --disable-kvm disable KVM acceleration support"
582 echo " --disable-nptl disable usermode NPTL support"
583 echo " --enable-system enable all system emulation targets"
584 echo " --disable-system disable all system emulation targets"
585 echo " --enable-linux-user enable all linux usermode emulation targets"
586 echo " --disable-linux-user disable all linux usermode emulation targets"
587 echo " --enable-darwin-user enable all darwin usermode emulation targets"
588 echo " --disable-darwin-user disable all darwin usermode emulation targets"
589 echo " --enable-bsd-user enable all BSD usermode emulation targets"
590 echo " --disable-bsd-user disable all BSD usermode emulation targets"
591 echo " --fmod-lib path to FMOD library"
592 echo " --fmod-inc path to FMOD includes"
593 echo " --oss-lib path to OSS library"
594 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
595 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
596 echo " --disable-vde disable support for vde network"
597 echo " --disable-aio disable AIO support"
598 echo " --disable-blobs disable installing provided firmware blobs"
599 echo " --kerneldir=PATH look for kernel includes in PATH"
600 echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
602 echo "NOTE: The object files are built at the place where configure is launched"
606 if test "$mingw32" = "yes" ; then
612 OS_CFLAGS
="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
615 if test ! -x "$(which cgcc 2>/dev/null)"; then
620 # Solaris specific configure tool chain decisions
622 if test "$solaris" = "yes" ; then
623 solinst
=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
624 if test -z "$solinst" ; then
625 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
626 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
627 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
630 if test "$solinst" = "/usr/sbin/install" ; then
631 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
632 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
633 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
636 sol_ar
=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
637 if test -z "$sol_ar" ; then
638 echo "Error: No path includes ar"
639 if test -f /usr
/ccs
/bin
/ar ; then
640 echo "Add /usr/ccs/bin to your path and rerun configure"
647 if test -z "$target_list" ; then
648 # these targets are portable
649 if [ "$softmmu" = "yes" ] ; then
668 # the following are Linux specific
669 if [ "$linux_user" = "yes" ] ; then
670 target_list
="${target_list}\
682 ppc64abi32-linux-user \
687 sparc32plus-linux-user \
690 # the following are Darwin specific
691 if [ "$darwin_user" = "yes" ] ; then
692 target_list
="$target_list i386-darwin-user ppc-darwin-user "
694 # the following are BSD specific
695 if [ "$bsd_user" = "yes" ] ; then
696 target_list
="${target_list}\
701 target_list
=`echo "$target_list" | sed -e 's/,/ /g'`
703 if test -z "$target_list" ; then
704 echo "No targets enabled"
708 if test -z "$cross_prefix" ; then
711 # big/little endian test
713 #include <inttypes.h>
714 int main(int argc, char ** argv){
715 volatile uint32_t i=0x01234567;
716 return (*((uint8_t*)(&i))) == 0x67;
720 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
721 $TMPE && bigendian
="yes"
723 echo big
/little
test failed
728 # if cross compiling, cannot launch a program, so make a static guess
729 if test "$cpu" = "armv4b" \
733 -o "$cpu" = "mips64" \
735 -o "$cpu" = "ppc64" \
737 -o "$cpu" = "sparc" \
738 -o "$cpu" = "sparc64"; then
744 # host long bits test
746 if test "$cpu" = "x86_64" \
747 -o "$cpu" = "alpha" \
749 -o "$cpu" = "sparc64" \
750 -o "$cpu" = "ppc64"; then
754 # check gcc options support
760 # Check host NPTL support
763 #include <linux/futex.h>
766 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
772 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev
/null
2> /dev
/null
; then
778 ##########################################
781 if test "$kvm" = "yes" ; then
783 # test for KVM_CAP_PIT
788 #error "kvm no pit capability"
790 int main(void) { return 0; }
792 if $cc $ARCH_CFLAGS $CFLAGS -I"$kerneldir"/include
-o $TMPE ${OS_CFLAGS} $TMPC 2> /dev
/null
; then
796 # test for KVM_CAP_DEVICE_ASSIGNMENT
800 #ifndef KVM_CAP_DEVICE_ASSIGNMENT
801 #error "kvm no device assignment capability"
803 int main(void) { return 0; }
805 if $cc $ARCH_CFLAGS $CFLAGS -I"$kerneldir"/include
-o $TMPE ${OS_CFLAGS} $TMPC 2> /dev
/null
; then
806 kvm_cap_device_assignment
="yes"
810 # libpci probe for kvm_cap_device_assignment
811 if test $kvm_cap_device_assignment = "yes" ; then
814 #ifndef PCI_VENDOR_ID
817 int main(void) { return 0; }
819 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC 2>/dev
/null
; then
823 echo "Error: libpci check failed"
824 echo "Disable KVM Device Assignment capability."
826 kvm_cap_device_assignment
="no"
830 ##########################################
835 int main(void) { zlibVersion(); return 0; }
837 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev
/null
2> /dev
/null
; then
841 echo "Error: zlib check failed"
842 echo "Make sure to have the zlib libs and headers installed."
847 ##########################################
852 if test -z "$sdl" ; then
853 sdl_config
="sdl-config"
859 #undef main /* We don't want SDL to override our main() */
860 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
862 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
863 _sdlversion
=`$sdl_config --version | sed 's/[^0-9]//g'`
864 if test "$_sdlversion" -lt 121 ; then
867 if test "$cocoa" = "no" ; then
872 # static link with sdl ?
873 if test "$sdl" = "yes" ; then
875 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa
="yes"
876 sdl_static_libs
=`$sdl_config --static-libs 2>/dev/null`
877 if [ "$aa" = "yes" ] ; then
878 sdl_static_libs
="$sdl_static_libs `aalib-config --static-libs`"
881 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev
/null
2> /dev
/null
; then
885 fi # sdl compile test
887 # Make sure to disable cocoa if sdl was set
888 if test "$sdl" = "yes" ; then
890 audio_drv_list
="`echo $audio_drv_list | sed s,coreaudio,,g`"
894 if test "$sdl" = "yes" ; then
897 #if defined(SDL_VIDEO_DRIVER_X11)
898 #include <X11/XKBlib.h>
900 #error No x11 support
902 int main(void) { return 0; }
904 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
909 ##########################################
911 if test "$vnc_tls" = "yes" ; then
913 #include <gnutls/gnutls.h>
914 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
916 vnc_tls_cflags
=`pkg-config --cflags gnutls 2> /dev/null`
917 vnc_tls_libs
=`pkg-config --libs gnutls 2> /dev/null`
918 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
919 $vnc_tls_libs > /dev
/null
2> /dev
/null
; then
926 ##########################################
928 if test "$vnc_sasl" = "yes" ; then
930 #include <sasl/sasl.h>
932 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
934 # Assuming Cyrus-SASL installed in /usr prefix
936 vnc_sasl_libs
="-lsasl2"
937 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
938 $vnc_sasl_libs 2> /dev
/null
; then
945 ##########################################
946 # fnmatch() probe, used for ACL routines
952 fnmatch("foo", "foo", 0);
956 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
960 ##########################################
961 # vde libraries probe
962 if test "$vde" = "yes" ; then
964 #include <libvdeplug.h>
967 struct vde_open_args a = {0, 0, 0};
968 vde_open("", "", &a);
972 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev
/null
2> /dev
/null
; then
979 ##########################################
980 # Sound support libraries probe
991 int main(void) { $exp }
993 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev
/null
2> /dev
/null
; then
997 echo "Error: $drv check failed"
998 echo "Make sure to have the $drv libs and headers installed."
1004 audio_drv_list
=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1005 for drv
in $audio_drv_list; do
1008 audio_drv_probe
$drv alsa
/asoundlib.h
-lasound \
1009 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1013 if test -z $fmod_lib ||
test -z $fmod_inc; then
1015 echo "Error: You must specify path to FMOD library and headers"
1016 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1020 audio_drv_probe
$drv fmod.h
$fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1024 audio_drv_probe
$drv esd.h
-lesd 'return esd_play_stream(0, 0, "", 0);'
1028 audio_drv_probe
$drv pulse
/simple.h
-lpulse-simple \
1029 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1032 oss|sdl|core|wav|dsound
)
1033 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1037 echo "$audio_possible_drivers" |
grep -q "\<$drv\>" ||
{
1039 echo "Error: Unknown driver '$drv' selected"
1040 echo "Possible drivers are: $audio_possible_drivers"
1048 ##########################################
1051 if test -z "$brlapi" ; then
1055 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1057 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev
/null
2> /dev
/null
; then
1059 fi # brlapi compile test
1062 ##########################################
1065 if test "$curses" = "yes" ; then
1069 int main(void) { return curses_version(); }
1071 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev
/null
2> /dev
/null
; then
1076 ##########################################
1077 # bluez support probe
1078 if test "$bluez" = "yes" ; then
1079 `pkg-config bluez` || bluez
="no"
1081 if test "$bluez" = "yes" ; then
1083 #include <bluetooth/bluetooth.h>
1084 int main(void) { return bt_error(0); }
1086 bluez_cflags
=`pkg-config --cflags bluez`
1087 bluez_libs
=`pkg-config --libs bluez`
1088 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
1089 $bluez_libs > /dev
/null
2> /dev
/null
; then
1096 ##########################################
1098 if test "$kvm" = "yes" ; then
1100 #include <linux/kvm.h>
1101 #if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
1102 #error Invalid KVM version
1104 #if !defined(KVM_CAP_USER_MEMORY)
1105 #error Missing KVM capability KVM_CAP_USER_MEMORY
1107 #if !defined(KVM_CAP_SET_TSS_ADDR)
1108 #error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1110 #if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1111 #error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1113 int main(void) { return 0; }
1115 if test "$kerneldir" != "" ; then
1116 kvm_cflags
=-I"$kerneldir"/include
1117 if test \
( "$cpu" = "i386" -o "$cpu" = "x86_64" \
) \
1118 -a -d "$kerneldir/arch/x86/include" ; then
1119 kvm_cflags
="$kvm_cflags -I$kerneldir/arch/x86/include"
1120 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1121 kvm_cflags
="$kvm_cflags -I$kerneldir/arch/powerpc/include"
1122 elif test -d "$kerneldir/arch/$cpu/include" ; then
1123 kvm_cflags
="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1128 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
1129 > /dev
/null
2>/dev
/null
; then
1133 if [ -x "`which awk 2>/dev/null`" ] && \
1134 [ -x "`which grep 2>/dev/null`" ]; then
1135 kvmerr
=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
1137 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1138 if test "$kvmerr" != "" ; then
1139 kvm
="no - (${kvmerr})"
1145 ##########################################
1149 if test "$aio" = "yes" ; then
1152 #include <pthread.h>
1153 int main(void) { pthread_mutex_t lock; return 0; }
1155 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev
/null
; then
1161 ##########################################
1164 #include <sys/types.h>
1165 #include <sys/uio.h>
1167 int main(void) { struct iovec iov; return 0; }
1170 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
1174 ##########################################
1176 if test "$fdt" = "yes" ; then
1179 int main(void) { return 0; }
1181 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev
/null
; then
1186 ##########################################
1191 #include <sys/syscall.h>
1193 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
1196 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
1200 ##########################################
1205 #include <sys/syscall.h>
1206 int main(void) { return syscall(SYS_eventfd, 0); }
1209 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
1213 # Check if tools are available to build documentation.
1214 if [ -x "`which texi2html 2>/dev/null`" ] && \
1215 [ -x "`which pod2man 2>/dev/null`" ]; then
1219 ##########################################
1224 int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1228 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
1230 elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev
/null
2> /dev
/null
; then
1234 if test "$rt" = "yes" ; then
1235 # Hack, we should have a general purpose LIBS for this sort of thing
1236 AIOLIBS
="$AIOLIBS -lrt"
1239 if test "$mingw32" = "yes" ; then
1240 if test -z "$prefix" ; then
1241 prefix
="c:\\\\Program Files\\\\Qemu"
1248 if test -z "$prefix" ; then
1251 mansuffix
="/share/man"
1252 datasuffix
="/share/qemu"
1253 docsuffix
="/share/doc/qemu"
1257 echo "Install prefix $prefix"
1258 echo "BIOS directory $prefix$datasuffix"
1259 echo "binary directory $prefix$binsuffix"
1260 if test "$mingw32" = "no" ; then
1261 echo "Manual directory $prefix$mansuffix"
1262 echo "ELF interp prefix $interp_prefix"
1264 echo "Source path $source_path"
1265 echo "C compiler $cc"
1266 echo "Host C compiler $host_cc"
1267 echo "ARCH_CFLAGS $ARCH_CFLAGS"
1269 echo "install $install"
1270 echo "host CPU $cpu"
1271 echo "host big endian $bigendian"
1272 echo "target list $target_list"
1273 echo "gprof enabled $gprof"
1274 echo "sparse enabled $sparse"
1275 echo "profiler $profiler"
1276 echo "static build $static"
1277 echo "-Werror enabled $werror"
1278 if test "$darwin" = "yes" ; then
1279 echo "Cocoa support $cocoa"
1281 echo "SDL support $sdl"
1282 if test "$sdl" != "no" ; then
1283 echo "SDL static link $sdl_static"
1285 echo "curses support $curses"
1286 echo "mingw32 support $mingw32"
1287 echo "Audio drivers $audio_drv_list"
1288 echo "Extra audio cards $audio_card_list"
1289 echo "Mixer emulation $mixemu"
1290 echo "VNC TLS support $vnc_tls"
1291 if test "$vnc_tls" = "yes" ; then
1292 echo " TLS CFLAGS $vnc_tls_cflags"
1293 echo " TLS LIBS $vnc_tls_libs"
1295 echo "VNC SASL support $vnc_sasl"
1296 if test "$vnc_sasl" = "yes" ; then
1297 echo " SASL CFLAGS $vnc_sasl_cflags"
1298 echo " SASL LIBS $vnc_sasl_libs"
1300 if test -n "$sparc_cpu"; then
1301 echo "Target Sparc Arch $sparc_cpu"
1303 echo "kqemu support $kqemu"
1304 echo "kvm support $kvm"
1305 echo "CPU emulation $cpu_emulation"
1306 echo "brlapi support $brlapi"
1307 echo "Documentation $build_docs"
1308 [ ! -z "$uname_release" ] && \
1309 echo "uname -r $uname_release"
1310 echo "NPTL support $nptl"
1311 echo "vde support $vde"
1312 echo "AIO support $aio"
1313 echo "Install blobs $blobs"
1314 echo "KVM support $kvm"
1315 echo "fdt support $fdt"
1317 if test $sdl_too_old = "yes"; then
1318 echo "-> Your SDL version is too old - please upgrade to have SDL support"
1320 if [ -s $TMPSDLLOG ]; then
1321 echo "The error log from compiling the libSDL test is: "
1324 #if test "$sdl_static" = "no"; then
1325 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1327 config_mak
="config-host.mak"
1328 config_h
="config-host.h"
1330 #echo "Creating $config_mak and $config_h"
1332 test -f $config_h && mv $config_h ${config_h}~
1334 echo "# Automatically generated by configure - do not modify" > $config_mak
1335 printf "# Configured with:" >> $config_mak
1336 printf " '%s'" "$0" "$@" >> $config_mak
1338 echo "/* Automatically generated by configure - do not modify */" > $config_h
1340 echo "prefix=$prefix" >> $config_mak
1341 echo "bindir=\${prefix}$binsuffix" >> $config_mak
1342 echo "mandir=\${prefix}$mansuffix" >> $config_mak
1343 echo "datadir=\${prefix}$datasuffix" >> $config_mak
1344 echo "docdir=\${prefix}$docsuffix" >> $config_mak
1345 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
1346 echo "MAKE=$make" >> $config_mak
1347 echo "INSTALL=$install" >> $config_mak
1348 echo "CC=$cc" >> $config_mak
1349 echo "HOST_CC=$host_cc" >> $config_mak
1350 echo "AR=$ar" >> $config_mak
1351 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
1352 # XXX: only use CFLAGS and LDFLAGS ?
1353 # XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1354 # compilation of dyngen tool (useful for win32 build on Linux host)
1355 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
1356 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1357 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1358 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
1359 echo "CFLAGS=$CFLAGS" >> $config_mak
1360 echo "LDFLAGS=$LDFLAGS" >> $config_mak
1361 echo "EXESUF=$EXESUF" >> $config_mak
1362 echo "AIOLIBS=$AIOLIBS" >> $config_mak
1365 echo "ARCH=i386" >> $config_mak
1366 echo "#define HOST_I386 1" >> $config_h
1369 echo "ARCH=x86_64" >> $config_mak
1370 echo "#define HOST_X86_64 1" >> $config_h
1373 echo "ARCH=alpha" >> $config_mak
1374 echo "#define HOST_ALPHA 1" >> $config_h
1377 echo "ARCH=arm" >> $config_mak
1378 echo "#define HOST_ARM 1" >> $config_h
1381 echo "ARCH=arm" >> $config_mak
1382 echo "#define HOST_ARM 1" >> $config_h
1385 echo "ARCH=cris" >> $config_mak
1386 echo "#define HOST_CRIS 1" >> $config_h
1389 echo "ARCH=hppa" >> $config_mak
1390 echo "#define HOST_HPPA 1" >> $config_h
1393 echo "ARCH=ia64" >> $config_mak
1394 echo "#define HOST_IA64 1" >> $config_h
1397 echo "ARCH=m68k" >> $config_mak
1398 echo "#define HOST_M68K 1" >> $config_h
1401 echo "ARCH=mips" >> $config_mak
1402 echo "#define HOST_MIPS 1" >> $config_h
1405 echo "ARCH=mips64" >> $config_mak
1406 echo "#define HOST_MIPS64 1" >> $config_h
1409 echo "ARCH=ppc" >> $config_mak
1410 echo "#define HOST_PPC 1" >> $config_h
1413 echo "ARCH=ppc64" >> $config_mak
1414 echo "#define HOST_PPC64 1" >> $config_h
1417 echo "ARCH=s390" >> $config_mak
1418 echo "#define HOST_S390 1" >> $config_h
1421 echo "ARCH=sparc" >> $config_mak
1422 echo "#define HOST_SPARC 1" >> $config_h
1425 echo "ARCH=sparc64" >> $config_mak
1426 echo "#define HOST_SPARC64 1" >> $config_h
1429 echo "Unsupported CPU = $cpu"
1433 if test "$sparse" = "yes" ; then
1434 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1435 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1436 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1438 if test "$bigendian" = "yes" ; then
1439 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1440 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1442 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
1443 if test "$mingw32" = "yes" ; then
1444 echo "CONFIG_WIN32=yes" >> $config_mak
1445 echo "#define CONFIG_WIN32 1" >> $config_h
1448 #include <byteswap.h>
1449 int main(void) { return bswap_32(0); }
1451 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev
/null
2> /dev
/null
; then
1452 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1455 #include <sys/endian.h>
1456 #include <sys/types.h>
1457 #include <machine/bswap.h>
1458 int main(void) { return bswap32(0); }
1460 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev
/null
2> /dev
/null
; then
1461 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1465 if [ "$openbsd" = "yes" ] ; then
1466 echo "#define ENOTSUP 4096" >> $config_h
1469 if test "$darwin" = "yes" ; then
1470 echo "CONFIG_DARWIN=yes" >> $config_mak
1471 echo "#define CONFIG_DARWIN 1" >> $config_h
1474 if test "$aix" = "yes" ; then
1475 echo "CONFIG_AIX=yes" >> $config_mak
1476 echo "#define CONFIG_AIX 1" >> $config_h
1479 if test "$solaris" = "yes" ; then
1480 echo "CONFIG_SOLARIS=yes" >> $config_mak
1481 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
1482 if test "$needs_libsunmath" = "yes" ; then
1483 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1484 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1487 if test -n "$sparc_cpu"; then
1488 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1489 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1491 if test "$gdbstub" = "yes" ; then
1492 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1493 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1495 if test "$gprof" = "yes" ; then
1496 echo "TARGET_GPROF=yes" >> $config_mak
1497 echo "#define HAVE_GPROF 1" >> $config_h
1499 if test "$static" = "yes" ; then
1500 echo "CONFIG_STATIC=yes" >> $config_mak
1501 echo "#define CONFIG_STATIC 1" >> $config_h
1503 if test $profiler = "yes" ; then
1504 echo "#define CONFIG_PROFILER 1" >> $config_h
1506 if test "$slirp" = "yes" ; then
1507 echo "CONFIG_SLIRP=yes" >> $config_mak
1508 echo "#define CONFIG_SLIRP 1" >> $config_h
1510 if test "$vde" = "yes" ; then
1511 echo "CONFIG_VDE=yes" >> $config_mak
1512 echo "#define CONFIG_VDE 1" >> $config_h
1513 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1515 for card
in $audio_card_list; do
1516 def
=CONFIG_
`echo $card | tr '[:lower:]' '[:upper:]'`
1517 echo "$def=yes" >> $config_mak
1518 echo "#define $def 1" >> $config_h
1520 echo "#define AUDIO_DRIVERS \\" >> $config_h
1521 for drv
in $audio_drv_list; do
1522 echo " &${drv}_audio_driver, \\" >>$config_h
1523 def
=CONFIG_
`echo $drv | tr '[:lower:]' '[:upper:]'`
1524 echo "$def=yes" >> $config_mak
1525 if test "$drv" = "fmod"; then
1526 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1527 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1528 elif test "$drv" = "oss"; then
1529 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
1533 if test "$mixemu" = "yes" ; then
1534 echo "CONFIG_MIXEMU=yes" >> $config_mak
1535 echo "#define CONFIG_MIXEMU 1" >> $config_h
1537 if test "$vnc_tls" = "yes" ; then
1538 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1539 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1540 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1541 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1543 if test "$vnc_sasl" = "yes" ; then
1544 echo "CONFIG_VNC_SASL=yes" >> $config_mak
1545 echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1546 echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1547 echo "#define CONFIG_VNC_SASL 1" >> $config_h
1549 if test "$fnmatch" = "yes" ; then
1550 echo "#define HAVE_FNMATCH_H 1" >> $config_h
1552 qemu_version
=`head $source_path/VERSION`
1553 echo "VERSION=$qemu_version" >>$config_mak
1554 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1555 echo "#define KVM_VERSION \"kvm-devel\"" >> $config_h
1557 echo "SRC_PATH=$source_path" >> $config_mak
1558 if [ "$source_path_used" = "yes" ]; then
1559 echo "VPATH=$source_path" >> $config_mak
1561 echo "TARGET_DIRS=$target_list" >> $config_mak
1562 if [ "$build_docs" = "yes" ] ; then
1563 echo "BUILD_DOCS=yes" >> $config_mak
1565 if test "$static" = "yes"; then
1570 if test "$sdl1" = "yes" ; then
1571 echo "#define CONFIG_SDL 1" >> $config_h
1572 echo "CONFIG_SDL=yes" >> $config_mak
1573 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1574 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1575 elif test "$sdl_x11" = "yes" ; then
1576 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
1578 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1580 if [ "${aa}" = "yes" ] ; then
1581 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1583 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1586 if test "$cocoa" = "yes" ; then
1587 echo "#define CONFIG_COCOA 1" >> $config_h
1588 echo "CONFIG_COCOA=yes" >> $config_mak
1590 if test "$curses" = "yes" ; then
1591 echo "#define CONFIG_CURSES 1" >> $config_h
1592 echo "CONFIG_CURSES=yes" >> $config_mak
1593 echo "CURSES_LIBS=-lcurses" >> $config_mak
1595 if test "$brlapi" = "yes" ; then
1596 echo "CONFIG_BRLAPI=yes" >> $config_mak
1597 echo "#define CONFIG_BRLAPI 1" >> $config_h
1598 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1600 if test "$bluez" = "yes" ; then
1601 echo "CONFIG_BLUEZ=yes" >> $config_mak
1602 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1603 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1604 echo "#define CONFIG_BLUEZ 1" >> $config_h
1606 if test "$aio" = "yes" ; then
1607 echo "#define CONFIG_AIO 1" >> $config_h
1608 echo "CONFIG_AIO=yes" >> $config_mak
1610 if test "$blobs" = "yes" ; then
1611 echo "INSTALL_BLOBS=yes" >> $config_mak
1613 if test "$iovec" = "yes" ; then
1614 echo "#define HAVE_IOVEC 1" >> $config_h
1616 if test "$fdt" = "yes" ; then
1617 echo "#define HAVE_FDT 1" >> $config_h
1618 echo "FDT_LIBS=-lfdt" >> $config_mak
1620 if test "$signalfd" = "yes" ; then
1621 echo "#define CONFIG_signalfd 1" >> $config_h
1623 if test "$eventfd" = "yes" ; then
1624 echo "#define CONFIG_eventfd 1" >> $config_h
1627 # XXX: suppress that
1628 if [ "$bsd" = "yes" ] ; then
1629 echo "#define O_LARGEFILE 0" >> $config_h
1630 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1631 echo "#define HOST_BSD 1" >> $config_h
1634 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1639 echo "HOST_USB=linux" >> $config_mak
1642 echo "HOST_USB=bsd" >> $config_mak
1645 echo "HOST_USB=stub" >> $config_mak
1650 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1651 tools
="qemu-img\$(EXESUF) $tools"
1652 if [ "$linux" = "yes" ] ; then
1653 tools
="qemu-nbd\$(EXESUF) $tools"
1656 echo "TOOLS=$tools" >> $config_mak
1658 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~
$config_h
1660 for target
in $target_list; do
1661 target_dir
="$target"
1662 config_mak
=$target_dir/config.mak
1663 config_h
=$target_dir/config.h
1664 target_cpu
=`echo $target | cut -d '-' -f 1`
1665 target_bigendian
="no"
1666 [ "$target_cpu" = "armeb" ] && target_bigendian
=yes
1667 [ "$target_cpu" = "m68k" ] && target_bigendian
=yes
1668 [ "$target_cpu" = "mips" ] && target_bigendian
=yes
1669 [ "$target_cpu" = "mipsn32" ] && target_bigendian
=yes
1670 [ "$target_cpu" = "mips64" ] && target_bigendian
=yes
1671 [ "$target_cpu" = "ppc" ] && target_bigendian
=yes
1672 [ "$target_cpu" = "ppcemb" ] && target_bigendian
=yes
1673 [ "$target_cpu" = "ppc64" ] && target_bigendian
=yes
1674 [ "$target_cpu" = "ppc64abi32" ] && target_bigendian
=yes
1675 [ "$target_cpu" = "sh4eb" ] && target_bigendian
=yes
1676 [ "$target_cpu" = "sparc" ] && target_bigendian
=yes
1677 [ "$target_cpu" = "sparc64" ] && target_bigendian
=yes
1678 [ "$target_cpu" = "sparc32plus" ] && target_bigendian
=yes
1680 target_user_only
="no"
1681 target_linux_user
="no"
1682 target_darwin_user
="no"
1683 target_bsd_user
="no"
1685 ${target_cpu}-softmmu)
1686 target_softmmu
="yes"
1688 ${target_cpu}-linux-user)
1689 target_user_only
="yes"
1690 target_linux_user
="yes"
1692 ${target_cpu}-darwin-user)
1693 target_user_only
="yes"
1694 target_darwin_user
="yes"
1696 ${target_cpu}-bsd-user)
1697 target_user_only
="yes"
1698 target_bsd_user
="yes"
1701 echo "ERROR: Target '$target' not recognised"
1706 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1707 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1708 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1709 echo "To build QEMU without graphical output configure with --disable-gfx-check"
1710 echo "Note that this will disable all output from the virtual graphics card"
1711 echo "except through VNC or curses."
1715 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1717 test -f $config_h && mv $config_h ${config_h}~
1719 mkdir
-p $target_dir
1720 mkdir
-p $target_dir/fpu
1721 mkdir
-p $target_dir/tcg
1722 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
1723 mkdir
-p $target_dir/nwfpe
1727 # don't use ln -sf as not all "ln -sf" over write the file/link
1729 rm -f $target_dir/Makefile
1730 ln -s $source_path/Makefile.target
$target_dir/Makefile
1733 echo "# Automatically generated by configure - do not modify" > $config_mak
1734 echo "/* Automatically generated by configure - do not modify */" > $config_h
1737 echo "include ../config-host.mak" >> $config_mak
1738 echo "#include \"../config-host.h\"" >> $config_h
1743 interp_prefix1
=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1744 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1747 disable_cpu_emulation
() {
1748 if test $cpu_emulation = "no"; then
1749 echo "#define NO_CPU_EMULATION 1" >> $config_h
1750 echo "NO_CPU_EMULATION=1" >> $config_mak
1755 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
1756 \
( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \
); then
1757 echo "#define USE_KVM 1" >> $config_h
1758 echo "USE_KVM=1" >> $config_mak
1759 echo "CONFIG_KVM_KERNEL_INC=$kerneldir/include" >> $config_mak
1760 if test $kvm_cap_pit = "yes" ; then
1761 echo "USE_KVM_PIT=1" >> $config_mak
1762 echo "#define USE_KVM_PIT 1" >> $config_h
1764 if test $kvm_cap_device_assignment = "yes" ; then
1765 echo "USE_KVM_DEVICE_ASSIGNMENT=1" >> $config_mak
1766 echo "#define USE_KVM_DEVICE_ASSIGNMENT 1" >> $config_h
1768 disable_cpu_emulation
1772 if [ use_upstream_kvm
= yes ]; then
1774 # Make sure the target and host cpus are compatible
1775 if test "$kvm" = "yes" -a ! \
( "$target_cpu" = "$cpu" -o \
1776 \
( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \
) -o \
1777 \
( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \
) -o \
1778 \
( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \
) \
) ; then
1781 # Disable KVM for linux-user
1782 if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1788 case "$target_cpu" in
1790 echo "TARGET_ARCH=i386" >> $config_mak
1791 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1792 echo "#define TARGET_I386 1" >> $config_h
1793 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
1795 echo "#define USE_KQEMU 1" >> $config_h
1797 if test "$kvm" = "yes" ; then
1798 echo "CONFIG_KVM=yes" >> $config_mak
1799 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1800 echo "#define CONFIG_KVM 1" >> $config_h
1805 echo "TARGET_ARCH=x86_64" >> $config_mak
1806 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1807 echo "#define TARGET_I386 1" >> $config_h
1808 echo "#define TARGET_X86_64 1" >> $config_h
1809 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1811 echo "#define USE_KQEMU 1" >> $config_h
1816 echo "TARGET_ARCH=ia64" >> $config_mak
1817 echo "#define TARGET_ARCH \"ia64\"" >> $config_h
1818 echo "#define TARGET_IA64 1" >> $config_h
1820 if [ use_upstream_kvm
= yes ]; then
1821 if test "$kvm" = "yes" ; then
1822 echo "CONFIG_KVM=yes" >> $config_mak
1823 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1824 echo "#define CONFIG_KVM 1" >> $config_h
1829 echo "TARGET_ARCH=alpha" >> $config_mak
1830 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1831 echo "#define TARGET_ALPHA 1" >> $config_h
1834 echo "TARGET_ARCH=arm" >> $config_mak
1835 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1836 echo "#define TARGET_ARM 1" >> $config_h
1839 gdb_xml_files
="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
1842 echo "TARGET_ARCH=cris" >> $config_mak
1843 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1844 echo "#define TARGET_CRIS 1" >> $config_h
1848 echo "TARGET_ARCH=m68k" >> $config_mak
1849 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1850 echo "#define TARGET_M68K 1" >> $config_h
1852 gdb_xml_files
="cf-core.xml cf-fp.xml"
1855 echo "TARGET_ARCH=mips" >> $config_mak
1856 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1857 echo "#define TARGET_MIPS 1" >> $config_h
1858 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1861 echo "TARGET_ARCH=mipsn32" >> $config_mak
1862 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1863 echo "#define TARGET_MIPS 1" >> $config_h
1864 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1867 echo "TARGET_ARCH=mips64" >> $config_mak
1868 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1869 echo "#define TARGET_MIPS 1" >> $config_h
1870 echo "#define TARGET_MIPS64 1" >> $config_h
1871 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1874 echo "TARGET_ARCH=ppc" >> $config_mak
1875 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1876 echo "#define TARGET_PPC 1" >> $config_h
1877 gdb_xml_files
="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1880 echo "TARGET_ARCH=ppcemb" >> $config_mak
1881 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1882 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1883 echo "#define TARGET_PPC 1" >> $config_h
1884 echo "#define TARGET_PPCEMB 1" >> $config_h
1885 if test "$kvm" = "yes" ; then
1886 echo "CONFIG_KVM=yes" >> $config_mak
1887 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1888 echo "#define CONFIG_KVM 1" >> $config_h
1890 gdb_xml_files
="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1893 echo "TARGET_ARCH=ppc64" >> $config_mak
1894 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1895 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1896 echo "#define TARGET_PPC 1" >> $config_h
1897 echo "#define TARGET_PPC64 1" >> $config_h
1898 gdb_xml_files
="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1901 echo "TARGET_ARCH=ppc64" >> $config_mak
1902 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1903 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1904 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1905 echo "#define TARGET_PPC 1" >> $config_h
1906 echo "#define TARGET_PPC64 1" >> $config_h
1907 echo "#define TARGET_ABI32 1" >> $config_h
1908 gdb_xml_files
="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1911 echo "TARGET_ARCH=sh4" >> $config_mak
1912 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1913 echo "#define TARGET_SH4 1" >> $config_h
1918 echo "TARGET_ARCH=sparc" >> $config_mak
1919 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1920 echo "#define TARGET_SPARC 1" >> $config_h
1923 echo "TARGET_ARCH=sparc64" >> $config_mak
1924 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1925 echo "#define TARGET_SPARC 1" >> $config_h
1926 echo "#define TARGET_SPARC64 1" >> $config_h
1930 echo "TARGET_ARCH=sparc64" >> $config_mak
1931 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1932 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1933 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1934 echo "#define TARGET_SPARC 1" >> $config_h
1935 echo "#define TARGET_SPARC64 1" >> $config_h
1936 echo "#define TARGET_ABI32 1" >> $config_h
1939 echo "Unsupported target CPU"
1943 if test "$target_bigendian" = "yes" ; then
1944 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1945 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1947 if test "$target_softmmu" = "yes" ; then
1948 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1949 echo "#define CONFIG_SOFTMMU 1" >> $config_h
1951 if test "$target_user_only" = "yes" ; then
1952 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1953 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1955 if test "$target_linux_user" = "yes" ; then
1956 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1957 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1959 if test "$target_darwin_user" = "yes" ; then
1960 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1961 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1964 if test ! -z "$gdb_xml_files" ; then
1965 for x
in $gdb_xml_files; do
1966 list
="$list $source_path/gdb-xml/$x"
1969 echo "TARGET_XML_FILES=$list" >> $config_mak
1971 if test "$target_cpu" = "arm" \
1972 -o "$target_cpu" = "armeb" \
1973 -o "$target_cpu" = "m68k" \
1974 -o "$target_cpu" = "mips" \
1975 -o "$target_cpu" = "mipsel" \
1976 -o "$target_cpu" = "mipsn32" \
1977 -o "$target_cpu" = "mipsn32el" \
1978 -o "$target_cpu" = "mips64" \
1979 -o "$target_cpu" = "mips64el" \
1980 -o "$target_cpu" = "ppc" \
1981 -o "$target_cpu" = "ppc64" \
1982 -o "$target_cpu" = "ppc64abi32" \
1983 -o "$target_cpu" = "ppcemb" \
1984 -o "$target_cpu" = "sparc" \
1985 -o "$target_cpu" = "sparc64" \
1986 -o "$target_cpu" = "sparc32plus"; then
1987 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1988 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1990 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1991 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1992 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1994 if test "$target_user_only" = "yes" \
1995 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1996 echo "#define USE_NPTL 1" >> $config_h
1998 # 32 bit ELF loader in addition to native 64 bit loader?
1999 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
2000 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
2001 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
2003 if test "$target_bsd_user" = "yes" ; then
2004 echo "CONFIG_BSD_USER=yes" >> $config_mak
2005 echo "#define CONFIG_BSD_USER 1" >> $config_h
2008 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~
$config_h
2010 done # for target in $targets
2012 # build tree in object directory if source path is different from current one
2013 if test "$source_path_used" = "yes" ; then
2014 DIRS
="tests tests/cris slirp audio"
2015 FILES
="Makefile tests/Makefile"
2016 FILES
="$FILES tests/cris/Makefile tests/cris/.gdbinit"
2017 FILES
="$FILES tests/test-mmap.c"
2018 for dir
in $DIRS ; do
2021 # remove the link and recreate it, as not all "ln -sf" overwrite the link
2022 for f
in $FILES ; do
2024 ln -s $source_path/$f $f