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"
22 interp_prefix
="/usr/gnemul/qemu-%M"
27 gcc3_list
="gcc-3.4.6 gcc-3.4 gcc34 gcc-3.3.6 gcc-3.3 gcc33 gcc-3.2 gcc32"
35 cpu
=`test $(uname -s) = AIX && uname -p || uname -m`
38 i386|i486|i586|i686|i86pc|BePC
)
71 "Power Macintosh"|ppc|ppc64|powerpc
)
120 kvm_cap_device_assignment
="no"
126 device_tree_support
=""
133 OS_CFLAGS
="-mno-cygwin"
134 if [ "$cpu" = "i386" ] ; then
137 audio_possible_drivers
="sdl"
141 if [ "$cpu" = "i386" ] ; then
144 audio_possible_drivers
="dsound sdl fmod"
148 audio_possible_drivers
="oss sdl esd pa"
149 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
156 audio_possible_drivers
="oss sdl esd pa"
158 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
166 audio_possible_drivers
="oss sdl esd"
168 aio_lib
="-lrt -lpthread"
174 audio_possible_drivers
="oss sdl esd"
183 audio_drv_list
="coreaudio"
184 audio_possible_drivers
="coreaudio sdl fmod"
185 OS_CFLAGS
="-mdynamic-no-pic"
186 OS_LDFLAGS
="-framework CoreFoundation -framework IOKit"
193 needs_libsunmath
="no"
194 solarisrev
=`uname -r | cut -f2 -d.`
195 # have to select again, because `uname -m` returns i86pc
196 # even on an x86_64 box.
197 solariscpu
=`isainfo -k`
198 if test "${solariscpu}" = "amd64" ; then
201 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
202 if test "$solarisrev" -le 9 ; then
203 if test -f /opt
/SUNWspro
/prod
/lib
/libsunmath.so
.1; then
204 needs_libsunmath
="yes"
206 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
207 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
208 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
209 echo "Studio 11 can be downloaded from www.sun.com."
213 if test "$solarisrev" -ge 9 ; then
217 if test -f /usr
/include
/sys
/soundcard.h
; then
220 audio_possible_drivers
="oss sdl"
228 audio_possible_drivers
="oss alsa sdl esd pa"
232 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
234 audio_possible_drivers
="$audio_possible_drivers fmod"
237 if [ "$cpu" = "ia64" ] ; then
243 if [ "$cpu" = "powerpc" ]; then
249 if [ "$bsd" = "yes" ] ; then
250 if [ "$darwin" != "yes" ] ; then
258 source_path
=`dirname "$0"`
259 source_path_used
="no"
261 if [ -z "$source_path" ]; then
264 source_path
=`cd "$source_path"; pwd`
266 [ -f "$workdir/vl.c" ] || source_path_used
="yes"
269 # generate compile errors on warnings for development builds
270 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
275 optarg
=`expr "x$opt" : 'x[^=]*=\(.*\)'`
277 --help|
-h) show_help
=yes
279 --prefix=*) prefix
="$optarg"
281 --interp-prefix=*) interp_prefix
="$optarg"
283 --source-path=*) source_path
="$optarg"
284 source_path_used
="yes"
286 --cross-prefix=*) cross_prefix
="$optarg"
291 --host-cc=*) host_cc
="$optarg"
293 --make=*) make="$optarg"
295 --install=*) install="$optarg"
297 --extra-cflags=*) CFLAGS
="$optarg"
299 --extra-ldflags=*) LDFLAGS
="$optarg"
301 --cpu=*) cpu
="$optarg"
303 --target-list=*) target_list
="$optarg"
305 --enable-gprof) gprof
="yes"
307 --static) static
="yes"
309 --disable-sdl) sdl
="no"
311 --fmod-lib=*) fmod_lib
="$optarg"
313 --fmod-inc=*) fmod_inc
="$optarg"
315 --oss-lib=*) oss_lib
="$optarg"
317 --audio-card-list=*) audio_card_list
=`echo "$optarg" | sed -e 's/,/ /g'`
319 --audio-drv-list=*) audio_drv_list
="$optarg"
321 --enable-sparse) sparse
="yes"
323 --disable-sparse) sparse
="no"
325 --disable-vnc-tls) vnc_tls
="no"
327 --disable-slirp) slirp
="no"
329 --disable-vde) vde
="no"
331 --disable-kqemu) kqemu
="no"
333 --disable-brlapi) brlapi
="no"
335 --disable-bluez) bluez
="no"
337 --disable-kvm) kvm
="no"
339 --enable-profiler) profiler
="yes"
344 audio_drv_list
="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
346 --disable-gfx-check) check_gfx
="no"
348 --disable-gcc-check) check_gcc
="no"
350 --disable-system) softmmu
="no"
352 --enable-system) softmmu
="yes"
354 --disable-linux-user) linux_user
="no"
356 --enable-linux-user) linux_user
="yes"
358 --disable-darwin-user) darwin_user
="no"
360 --enable-darwin-user) darwin_user
="yes"
362 --disable-bsd-user) bsd_user
="no"
364 --enable-bsd-user) bsd_user
="yes"
366 --enable-uname-release=*) uname_release
="$optarg"
371 v7|v8
) SP_CFLAGS
="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m32"
372 target_cpu
="sparc"; cpu
="sparc" ;;
373 v8plus|v8plusa
) SP_CFLAGS
="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m32"
374 target_cpu
="sparc"; cpu
="sparc" ;;
375 v9
) SP_CFLAGS
="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m64"
376 target_cpu
="sparc64"; cpu
="sparc64" ;;
377 *) echo "undefined SPARC architecture. Exiting";exit 1;;
380 --enable-werror) werror
="yes"
382 --disable-werror) werror
="no"
384 --disable-curses) curses
="no"
386 --disable-nptl) nptl
="no"
388 --enable-mixemu) mixemu
="yes"
390 --disable-aio) aio
="no"
392 --kerneldir=*) kerneldir
="$optarg"
394 --disable-cpu-emulation) cpu_emulation
="no"
396 --disable-libfdt) device_tree_support
="no"
398 *) echo "ERROR: unknown option $opt"; exit 1
403 # default flags for all hosts
404 CFLAGS
="$CFLAGS -O2 -g -fno-strict-aliasing"
405 CFLAGS
="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings"
406 LDFLAGS
="$LDFLAGS -g"
407 if test "$werror" = "yes" ; then
408 CFLAGS
="$CFLAGS -Werror"
411 if test "$solaris" = "no" ; then
412 if ld
--version 2>/dev
/null |
grep "GNU ld" >/dev
/null
2>/dev
/null
; then
413 LDFLAGS
="$LDFLAGS -Wl,--warn-common"
418 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
419 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
422 sparc
) if test -z "$sparc_cpu" ; then
423 ARCH_CFLAGS
="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
426 ARCH_CFLAGS
="${SP_CFLAGS}"
427 ARCH_LDFLAGS
="${SP_LDFLAGS}"
430 sparc64
) if test -z "$sparc_cpu" ; then
431 ARCH_CFLAGS
="-m64 -mcpu=ultrasparc -D__sparc_v9__"
434 ARCH_CFLAGS
="${SP_CFLAGS}"
435 ARCH_LDFLAGS
="${SP_LDFLAGS}"
439 ARCH_CFLAGS
="-march=z900"
451 if test x
"$show_help" = x
"yes" ; then
454 Usage: configure [options]
455 Options: [defaults in brackets after descriptions]
458 echo "Standard options:"
459 echo " --help print this message"
460 echo " --prefix=PREFIX install in PREFIX [$prefix]"
461 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
462 echo " use %M for cpu name [$interp_prefix]"
463 echo " --target-list=LIST set target list [$target_list]"
465 echo "kqemu kernel acceleration support:"
466 echo " --disable-kqemu disable kqemu support"
468 echo "Advanced options (experts only):"
469 echo " --source-path=PATH path of source code [$source_path]"
470 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
471 echo " --cc=CC use C compiler CC [$cc]"
472 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
473 echo " --make=MAKE use specified make [$make]"
474 echo " --install=INSTALL use specified install [$install]"
475 echo " --static enable static build [$static]"
476 echo " --enable-sparse enable sparse checker"
477 echo " --disable-sparse disable sparse checker (default)"
478 echo " --disable-werror disable compilation abort on warning"
479 echo " --disable-sdl disable SDL"
480 echo " --enable-cocoa enable COCOA (Mac OS X only)"
481 echo " --audio-drv-list=LIST set audio drivers list:"
482 echo " Available drivers: $audio_possible_drivers"
483 echo " --audio-card-list=LIST set list of additional emulated audio cards"
484 echo " Available cards: ac97 adlib cs4231a gus"
485 echo " --enable-mixemu enable mixer emulation"
486 echo " --disable-brlapi disable BrlAPI"
487 echo " --disable-vnc-tls disable TLS encryption for VNC server"
488 echo " --disable-curses disable curses output"
489 echo " --disable-bluez disable bluez stack connectivity"
490 echo " --disable-kvm disable KVM acceleration support"
491 echo " --disable-nptl disable usermode NPTL support"
492 echo " --enable-system enable all system emulation targets"
493 echo " --disable-system disable all system emulation targets"
494 echo " --enable-linux-user enable all linux usermode emulation targets"
495 echo " --disable-linux-user disable all linux usermode emulation targets"
496 echo " --enable-darwin-user enable all darwin usermode emulation targets"
497 echo " --disable-darwin-user disable all darwin usermode emulation targets"
498 echo " --enable-bsd-user enable all BSD usermode emulation targets"
499 echo " --disable-bsd-user disable all BSD usermode emulation targets"
500 echo " --fmod-lib path to FMOD library"
501 echo " --fmod-inc path to FMOD includes"
502 echo " --oss-lib path to OSS library"
503 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
504 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
505 echo " --disable-vde disable support for vde network"
506 echo " --disable-aio disable AIO support"
507 echo " --kerneldir=PATH look for kernel includes in PATH"
508 echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
509 echo " --disable-libfdt disables use of libfdt support for device tree"
511 echo "NOTE: The object files are built at the place where configure is launched"
515 cc
="${cross_prefix}${cc}"
516 ar="${cross_prefix}${ar}"
517 strip
="${cross_prefix}${strip}"
519 # check that the C compiler works.
524 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev
/null
; then
525 : C compiler works ok
527 echo "ERROR: \"$cc\" either does not exist or does not work"
531 # check compiler to see if we're on mingw32
540 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev
/null
; then
544 if test "$mingw32" = "yes" ; then
552 if [ "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
554 elif [ "$bsd" = "yes" ]; then
557 # Some Linux architectures (e.g. s390) don't imply -lpthread automatically.
558 AIOLIBS
="-lrt -lpthread"
561 # Check for gcc4, error if pre-gcc4
562 if test "$check_gcc" = "yes" ; then
567 int main(){return 0;}
569 if "$cc" $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
570 echo "WARNING: \"$cc\" looks like gcc 4.x"
572 if test "$gcc3_search" = "yes" ; then
573 echo "Looking for gcc 3.x"
574 for compat_cc
in $gcc3_list ; do
575 if "$cross_prefix$compat_cc" --version 2> /dev
/null | fgrep
'(GCC) 3.' > /dev
/null
2>&1 ; then
576 echo "Found \"$compat_cc\""
577 cc
="$cross_prefix$compat_cc"
578 found_compat_cc
="yes"
582 if test "$found_compat_cc" = "no" ; then
583 echo "gcc 3.x not found!"
586 if test "$found_compat_cc" = "no" ; then
587 echo "QEMU is known to have problems when compiled with gcc 4.x"
588 echo "It is recommended that you use gcc 3.x to build QEMU"
589 echo "To use this compiler anyway, configure with --disable-gcc-check"
595 if test ! -x "$(which cgcc 2>/dev/null)"; then
600 # Solaris specific configure tool chain decisions
602 if test "$solaris" = "yes" ; then
604 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
605 # override the check with --disable-gcc-check
607 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
609 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
610 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
611 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
612 echo "or get the latest patch from SunSolve for gcc"
616 solinst
=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
617 if test -z "$solinst" ; then
618 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
619 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
620 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
623 if test "$solinst" = "/usr/sbin/install" ; then
624 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
625 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
626 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
629 sol_ar
=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
630 if test -z "$sol_ar" ; then
631 echo "Error: No path includes ar"
632 if test -f /usr
/ccs
/bin
/ar ; then
633 echo "Add /usr/ccs/bin to your path and rerun configure"
640 if test -z "$target_list" ; then
641 # these targets are portable
642 if [ "$softmmu" = "yes" ] ; then
661 # the following are Linux specific
662 if [ "$linux_user" = "yes" ] ; then
663 target_list
="${target_list}\
675 ppc64abi32-linux-user \
680 sparc32plus-linux-user \
683 # the following are Darwin specific
684 if [ "$darwin_user" = "yes" ] ; then
685 target_list
="$target_list i386-darwin-user ppc-darwin-user"
687 # the following are BSD specific
688 if [ "$bsd_user" = "yes" ] ; then
689 target_list
="${target_list}\
694 target_list
=`echo "$target_list" | sed -e 's/,/ /g'`
696 if test -z "$target_list" ; then
697 echo "No targets enabled"
701 if test -z "$cross_prefix" ; then
704 # big/little endian test
706 #include <inttypes.h>
707 int main(int argc, char ** argv){
708 volatile uint32_t i=0x01234567;
709 return (*((uint8_t*)(&i))) == 0x67;
713 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
714 $TMPE && bigendian
="yes"
716 echo big
/little
test failed
721 # if cross compiling, cannot launch a program, so make a static guess
722 if test "$cpu" = "armv4b" \
726 -o "$cpu" = "mips64" \
727 -o "$cpu" = "powerpc" \
729 -o "$cpu" = "sparc" \
730 -o "$cpu" = "sparc64"; then
736 # host long bits test
738 if test "$cpu" = "x86_64" \
739 -o "$cpu" = "alpha" \
741 -o "$cpu" = "sparc64"; then
745 # ppc specific hostlongbits selection
746 if test "$cpu" = "powerpc" ; then
747 if $cc $ARCH_CFLAGS -dM -E - -o $TMPI 2>/dev
/null
</dev
/null
; then
748 grep -q __powerpc64__
$TMPI && hostlongbits
=64
750 echo hostlongbits
test failed
755 # check gcc options support
761 # Check host NPTL support
764 #include <linux/futex.h>
767 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
773 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev
/null
; then
779 ##########################################
782 if test "$kvm" = "yes" ; then
784 # test for KVM_CAP_PIT
789 #error "kvm no pit capability"
791 int main(void) { return 0; }
793 if $cc $ARCH_CFLAGS $CFLAGS -I"$kerneldir"/include
-o $TMPE ${OS_CFLAGS} $TMPC 2> /dev
/null
; then
797 # test for KVM_CAP_DEVICE_ASSIGNMENT
801 #ifndef KVM_CAP_DEVICE_ASSIGNMENT
802 #error "kvm no device assignment 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
807 kvm_cap_device_assignment
="yes"
811 ##########################################
816 int main(void) { zlibVersion(); return 0; }
818 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz 2> /dev
/null
; then
822 echo "Error: zlib check failed"
823 echo "Make sure to have the zlib libs and headers installed."
828 ##########################################
833 if test -z "$sdl" ; then
834 sdl_config
="sdl-config"
840 #undef main /* We don't want SDL to override our main() */
841 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
843 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /tmp
/qemu-$$
-sdl-config.log
; then
844 _sdlversion
=`$sdl_config --version | sed 's/[^0-9]//g'`
845 if test "$_sdlversion" -lt 121 ; then
848 if test "$cocoa" = "no" ; then
853 # static link with sdl ?
854 if test "$sdl" = "yes" ; then
856 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa
="yes"
857 sdl_static_libs
=`$sdl_config --static-libs 2>/dev/null`
858 if [ "$aa" = "yes" ] ; then
859 sdl_static_libs
="$sdl_static_libs `aalib-config --static-libs`"
862 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev
/null
; then
866 fi # sdl compile test
868 # Make sure to disable cocoa if sdl was set
869 if test "$sdl" = "yes" ; then
871 audio_drv_list
="`echo $audio_drv_list | sed s,coreaudio,,g`"
875 ##########################################
877 if test "$vnc_tls" = "yes" ; then
879 #include <gnutls/gnutls.h>
880 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
882 vnc_tls_cflags
=`pkg-config --cflags gnutls 2> /dev/null`
883 vnc_tls_libs
=`pkg-config --libs gnutls 2> /dev/null`
884 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
885 $vnc_tls_libs 2> /dev
/null
; then
892 ##########################################
893 # vde libraries probe
894 if test "$vde" = "yes" ; then
896 #include <libvdeplug.h>
899 struct vde_open_args a = {0, 0, 0};
900 vde_open("", "", &a);
904 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug 2> /dev
/null
; then
911 ##########################################
912 # Sound support libraries probe
923 int main(void) { $exp }
925 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib 2> /dev
/null
; then
929 echo "Error: $drv check failed"
930 echo "Make sure to have the $drv libs and headers installed."
936 audio_drv_list
=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
937 for drv
in $audio_drv_list; do
940 audio_drv_probe
$drv alsa
/asoundlib.h
-lasound \
941 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
945 if test -z $fmod_lib ||
test -z $fmod_inc; then
947 echo "Error: You must specify path to FMOD library and headers"
948 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
952 audio_drv_probe
$drv fmod.h
$fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
956 audio_drv_probe
$drv esd.h
-lesd 'return esd_play_stream(0, 0, "", 0);'
960 audio_drv_probe
$drv pulse
/simple.h
-lpulse-simple \
961 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
964 oss|sdl|core|wav|dsound
)
965 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
969 echo "$audio_possible_drivers" |
grep -q "\<$drv\>" ||
{
971 echo "Error: Unknown driver '$drv' selected"
972 echo "Possible drivers are: $audio_possible_drivers"
980 ##########################################
983 if test -z "$brlapi" ; then
987 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
989 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi 2> /dev
/null
; then
991 fi # brlapi compile test
994 ##########################################
997 if test "$curses" = "yes" ; then
1001 int main(void) { return curses_version(); }
1003 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses 2> /dev
/null
; then
1008 ##########################################
1009 # bluez support probe
1010 if test "$bluez" = "yes" ; then
1011 `pkg-config bluez` || bluez
="no"
1013 if test "$bluez" = "yes" ; then
1015 #include <bluetooth/bluetooth.h>
1016 int main(void) { return bt_error(0); }
1018 bluez_cflags
=`pkg-config --cflags bluez`
1019 bluez_libs
=`pkg-config --libs bluez`
1020 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
1021 $bluez_libs 2> /dev
/null
; then
1028 ##########################################
1030 if test "$kvm" = "yes" ; then
1032 #include <linux/kvm.h>
1033 #if !defined(KVM_API_VERSION) || \
1034 KVM_API_VERSION < 12 || \
1035 KVM_API_VERSION > 12 || \
1036 !defined(KVM_CAP_USER_MEMORY) || \
1037 !defined(KVM_CAP_SET_TSS_ADDR)
1038 #error Invalid KVM version
1040 int main(void) { return 0; }
1042 if test "$kerneldir" != "" ; then
1043 kvm_cflags
=-I"$kerneldir"/include
1047 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
1055 ##########################################
1057 if test "$aio" = "yes" ; then
1061 int main(void) { return aio_write(NULL); }
1063 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev
/null
; then
1068 ##########################################
1073 #include <sys/syscall.h>
1075 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
1078 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
1082 ##########################################
1087 #include <sys/syscall.h>
1088 int main(void) { return syscall(SYS_eventfd, 0); }
1091 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
1095 # Check if tools are available to build documentation.
1096 if [ -x "`which texi2html 2>/dev/null`" ] && \
1097 [ -x "`which pod2man 2>/dev/null`" ]; then
1101 if test "$mingw32" = "yes" ; then
1102 if test -z "$prefix" ; then
1103 prefix
="c:\\\\Program Files\\\\Qemu"
1110 if test -z "$prefix" ; then
1113 mansuffix
="/share/man"
1114 datasuffix
="/share/qemu"
1115 docsuffix
="/share/doc/qemu"
1119 ######################################
1122 if test -z "$device_tree_support" -a \
1123 "$cpu" = "powerpc"; then
1124 device_tree_support
="no"
1127 /* XXX uncomment later when libfdt is built before this test */
1128 //int main(void) { void *fdt; return fdt_create(fdt, 1024); }
1129 int main (void) {return 0;}
1131 # XXX for now do not try to link to libfdt and just check for header */
1132 # if $cc $ARCH_CFLAGS $CFLAGS $LDFLAGS -o $TMPE $TMPC -lfdt 2> /dev/null ; then
1133 if $cc $ARCH_CFLAGS $CFLAGS $LDFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
1134 device_tree_support
="yes"
1137 echo "Error: Could not find libfdt"
1138 echo "Make sure to have the libfdt libs and headers installed."
1144 echo "Install prefix $prefix"
1145 echo "BIOS directory $prefix$datasuffix"
1146 echo "binary directory $prefix$binsuffix"
1147 if test "$mingw32" = "no" ; then
1148 echo "Manual directory $prefix$mansuffix"
1149 echo "ELF interp prefix $interp_prefix"
1151 echo "Source path $source_path"
1152 echo "C compiler $cc"
1153 echo "Host C compiler $host_cc"
1154 echo "ARCH_CFLAGS $ARCH_CFLAGS"
1156 echo "install $install"
1157 echo "host CPU $cpu"
1158 echo "host big endian $bigendian"
1159 echo "target list $target_list"
1160 echo "gprof enabled $gprof"
1161 echo "sparse enabled $sparse"
1162 echo "profiler $profiler"
1163 echo "static build $static"
1164 echo "-Werror enabled $werror"
1165 if test "$darwin" = "yes" ; then
1166 echo "Cocoa support $cocoa"
1168 echo "SDL support $sdl"
1169 if test "$sdl" != "no" ; then
1170 echo "SDL static link $sdl_static"
1172 echo "curses support $curses"
1173 echo "mingw32 support $mingw32"
1174 echo "Audio drivers $audio_drv_list"
1175 echo "Extra audio cards $audio_card_list"
1176 echo "Mixer emulation $mixemu"
1177 echo "VNC TLS support $vnc_tls"
1178 if test "$vnc_tls" = "yes" ; then
1179 echo " TLS CFLAGS $vnc_tls_cflags"
1180 echo " TLS LIBS $vnc_tls_libs"
1182 if test -n "$sparc_cpu"; then
1183 echo "Target Sparc Arch $sparc_cpu"
1185 echo "kqemu support $kqemu"
1186 echo "kvm support $kvm"
1187 echo "CPU emulation $cpu_emulation"
1188 if test $cpu = "powerpc"; then
1189 echo "libfdt support $device_tree_support"
1191 echo "brlapi support $brlapi"
1192 echo "Documentation $build_docs"
1193 [ ! -z "$uname_release" ] && \
1194 echo "uname -r $uname_release"
1195 echo "NPTL support $nptl"
1196 echo "vde support $vde"
1197 echo "AIO support $aio"
1198 echo "KVM support $kvm"
1200 if test $sdl_too_old = "yes"; then
1201 echo "-> Your SDL version is too old - please upgrade to have SDL support"
1203 if [ -s /tmp
/qemu-$$
-sdl-config.log
]; then
1204 echo "The error log from compiling the libSDL test is: "
1205 cat /tmp
/qemu-$$
-sdl-config.log
1207 rm -f /tmp
/qemu-$$
-sdl-config.log
1208 #if test "$sdl_static" = "no"; then
1209 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1211 config_mak
="config-host.mak"
1212 config_h
="config-host.h"
1214 #echo "Creating $config_mak and $config_h"
1216 test -f $config_h && mv $config_h ${config_h}~
1218 echo "# Automatically generated by configure - do not modify" > $config_mak
1219 echo "# Configured with: $0 $@" >> $config_mak
1220 echo "/* Automatically generated by configure - do not modify */" > $config_h
1222 echo "prefix=$prefix" >> $config_mak
1223 echo "bindir=\${prefix}$binsuffix" >> $config_mak
1224 echo "mandir=\${prefix}$mansuffix" >> $config_mak
1225 echo "datadir=\${prefix}$datasuffix" >> $config_mak
1226 echo "docdir=\${prefix}$docsuffix" >> $config_mak
1227 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
1228 echo "MAKE=$make" >> $config_mak
1229 echo "INSTALL=$install" >> $config_mak
1230 echo "CC=$cc" >> $config_mak
1231 echo "HOST_CC=$host_cc" >> $config_mak
1232 echo "AR=$ar" >> $config_mak
1233 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
1234 # XXX: only use CFLAGS and LDFLAGS ?
1235 # XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1236 # compilation of dyngen tool (useful for win32 build on Linux host)
1237 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
1238 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1239 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1240 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
1241 echo "CFLAGS=$CFLAGS" >> $config_mak
1242 echo "LDFLAGS=$LDFLAGS" >> $config_mak
1243 echo "EXESUF=$EXESUF" >> $config_mak
1244 echo "AIOLIBS=$AIOLIBS" >> $config_mak
1247 echo "ARCH=i386" >> $config_mak
1248 echo "#define HOST_I386 1" >> $config_h
1251 echo "ARCH=x86_64" >> $config_mak
1252 echo "#define HOST_X86_64 1" >> $config_h
1255 echo "ARCH=alpha" >> $config_mak
1256 echo "#define HOST_ALPHA 1" >> $config_h
1259 echo "ARCH=arm" >> $config_mak
1260 echo "#define HOST_ARM 1" >> $config_h
1263 echo "ARCH=arm" >> $config_mak
1264 echo "#define HOST_ARM 1" >> $config_h
1267 echo "ARCH=cris" >> $config_mak
1268 echo "#define HOST_CRIS 1" >> $config_h
1271 echo "ARCH=hppa" >> $config_mak
1272 echo "#define HOST_HPPA 1" >> $config_h
1275 echo "ARCH=ia64" >> $config_mak
1276 echo "#define HOST_IA64 1" >> $config_h
1279 echo "ARCH=m68k" >> $config_mak
1280 echo "#define HOST_M68K 1" >> $config_h
1283 echo "ARCH=mips" >> $config_mak
1284 echo "#define HOST_MIPS 1" >> $config_h
1287 echo "ARCH=mips64" >> $config_mak
1288 echo "#define HOST_MIPS64 1" >> $config_h
1291 if test "$hostlongbits" = "32"; then
1292 echo "ARCH=ppc" >> $config_mak
1293 echo "#define HOST_PPC 1" >> $config_h
1295 echo "ARCH=ppc64" >> $config_mak
1296 echo "#define HOST_PPC64 1" >> $config_h
1300 echo "ARCH=s390" >> $config_mak
1301 echo "#define HOST_S390 1" >> $config_h
1304 echo "ARCH=sparc" >> $config_mak
1305 echo "#define HOST_SPARC 1" >> $config_h
1308 echo "ARCH=sparc64" >> $config_mak
1309 echo "#define HOST_SPARC64 1" >> $config_h
1312 echo "Unsupported CPU = $cpu"
1316 if test "$sparse" = "yes" ; then
1317 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1318 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1319 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1321 if test "$bigendian" = "yes" ; then
1322 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1323 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1325 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
1326 if test "$mingw32" = "yes" ; then
1327 echo "CONFIG_WIN32=yes" >> $config_mak
1328 echo "#define CONFIG_WIN32 1" >> $config_h
1331 #include <byteswap.h>
1332 int main(void) { return bswap_32(0); }
1334 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
1335 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1339 if [ "$openbsd" = "yes" ] ; then
1340 echo "#define ENOTSUP 4096" >> $config_h
1343 if test "$darwin" = "yes" ; then
1344 echo "CONFIG_DARWIN=yes" >> $config_mak
1345 echo "#define CONFIG_DARWIN 1" >> $config_h
1348 if test "$aix" = "yes" ; then
1349 echo "CONFIG_AIX=yes" >> $config_mak
1350 echo "#define CONFIG_AIX 1" >> $config_h
1353 if test "$solaris" = "yes" ; then
1354 echo "CONFIG_SOLARIS=yes" >> $config_mak
1355 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
1356 if test "$needs_libsunmath" = "yes" ; then
1357 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1358 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1361 if test -n "$sparc_cpu"; then
1362 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1363 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1365 if test "$gdbstub" = "yes" ; then
1366 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1367 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1369 if test "$gprof" = "yes" ; then
1370 echo "TARGET_GPROF=yes" >> $config_mak
1371 echo "#define HAVE_GPROF 1" >> $config_h
1373 if test "$static" = "yes" ; then
1374 echo "CONFIG_STATIC=yes" >> $config_mak
1375 echo "#define CONFIG_STATIC 1" >> $config_h
1377 if test $profiler = "yes" ; then
1378 echo "#define CONFIG_PROFILER 1" >> $config_h
1380 if test "$slirp" = "yes" ; then
1381 echo "CONFIG_SLIRP=yes" >> $config_mak
1382 echo "#define CONFIG_SLIRP 1" >> $config_h
1384 if test "$vde" = "yes" ; then
1385 echo "CONFIG_VDE=yes" >> $config_mak
1386 echo "#define CONFIG_VDE 1" >> $config_h
1387 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1389 for card
in $audio_card_list; do
1390 def
=CONFIG_
`echo $card | tr '[:lower:]' '[:upper:]'`
1391 echo "$def=yes" >> $config_mak
1392 echo "#define $def 1" >> $config_h
1394 echo "#define AUDIO_DRIVERS \\" >> $config_h
1395 for drv
in $audio_drv_list; do
1396 echo " &${drv}_audio_driver, \\" >>$config_h
1397 def
=CONFIG_
`echo $drv | tr '[:lower:]' '[:upper:]'`
1398 echo "$def=yes" >> $config_mak
1399 if test "$drv" = "fmod"; then
1400 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1401 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1402 elif test "$drv" = "oss"; then
1403 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
1407 if test "$mixemu" = "yes" ; then
1408 echo "CONFIG_MIXEMU=yes" >> $config_mak
1409 echo "#define CONFIG_MIXEMU 1" >> $config_h
1411 if test "$vnc_tls" = "yes" ; then
1412 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1413 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1414 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1415 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1417 qemu_version
=`head $source_path/VERSION`
1418 echo "VERSION=$qemu_version" >>$config_mak
1419 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1420 echo "#define KVM_VERSION \"kvm-devel\"" >> $config_h
1422 echo "SRC_PATH=$source_path" >> $config_mak
1423 if [ "$source_path_used" = "yes" ]; then
1424 echo "VPATH=$source_path" >> $config_mak
1426 echo "TARGET_DIRS=$target_list" >> $config_mak
1427 if [ "$build_docs" = "yes" ] ; then
1428 echo "BUILD_DOCS=yes" >> $config_mak
1430 if test "$static" = "yes"; then
1435 if test "$sdl1" = "yes" ; then
1436 echo "#define CONFIG_SDL 1" >> $config_h
1437 echo "CONFIG_SDL=yes" >> $config_mak
1438 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1439 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1441 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1443 if [ "${aa}" = "yes" ] ; then
1444 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1446 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1449 if test "$cocoa" = "yes" ; then
1450 echo "#define CONFIG_COCOA 1" >> $config_h
1451 echo "CONFIG_COCOA=yes" >> $config_mak
1453 if test "$curses" = "yes" ; then
1454 echo "#define CONFIG_CURSES 1" >> $config_h
1455 echo "CONFIG_CURSES=yes" >> $config_mak
1456 echo "CURSES_LIBS=-lcurses" >> $config_mak
1458 if test "$brlapi" = "yes" ; then
1459 echo "CONFIG_BRLAPI=yes" >> $config_mak
1460 echo "#define CONFIG_BRLAPI 1" >> $config_h
1461 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1463 if test "$bluez" = "yes" ; then
1464 echo "CONFIG_BLUEZ=yes" >> $config_mak
1465 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1466 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1467 echo "#define CONFIG_BLUEZ 1" >> $config_h
1469 if test "$aio" = "yes" ; then
1470 echo "#define CONFIG_AIO 1" >> $config_h
1471 echo "CONFIG_AIO=yes" >> $config_mak
1473 if test "$signalfd" = "yes" ; then
1474 echo "#define CONFIG_signalfd 1" >> $config_h
1476 if test "$eventfd" = "yes" ; then
1477 echo "#define CONFIG_eventfd 1" >> $config_h
1480 # XXX: suppress that
1481 if [ "$bsd" = "yes" ] ; then
1482 echo "#define O_LARGEFILE 0" >> $config_h
1483 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1484 echo "#define _BSD 1" >> $config_h
1487 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1492 echo "HOST_USB=linux" >> $config_mak
1495 echo "HOST_USB=bsd" >> $config_mak
1498 echo "HOST_USB=stub" >> $config_mak
1503 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1504 tools
="qemu-img\$(EXESUF) $tools"
1505 if [ "$linux" = "yes" ] ; then
1506 tools
="qemu-nbd\$(EXESUF) $tools"
1509 echo "TOOLS=$tools" >> $config_mak
1511 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~
$config_h
1513 for target
in $target_list; do
1514 target_dir
="$target"
1515 config_mak
=$target_dir/config.mak
1516 config_h
=$target_dir/config.h
1517 target_cpu
=`echo $target | cut -d '-' -f 1`
1518 target_bigendian
="no"
1519 [ "$target_cpu" = "armeb" ] && target_bigendian
=yes
1520 [ "$target_cpu" = "m68k" ] && target_bigendian
=yes
1521 [ "$target_cpu" = "mips" ] && target_bigendian
=yes
1522 [ "$target_cpu" = "mipsn32" ] && target_bigendian
=yes
1523 [ "$target_cpu" = "mips64" ] && target_bigendian
=yes
1524 [ "$target_cpu" = "ppc" ] && target_bigendian
=yes
1525 [ "$target_cpu" = "ppcemb" ] && target_bigendian
=yes
1526 [ "$target_cpu" = "ppc64" ] && target_bigendian
=yes
1527 [ "$target_cpu" = "ppc64abi32" ] && target_bigendian
=yes
1528 [ "$target_cpu" = "sh4eb" ] && target_bigendian
=yes
1529 [ "$target_cpu" = "sparc" ] && target_bigendian
=yes
1530 [ "$target_cpu" = "sparc64" ] && target_bigendian
=yes
1531 [ "$target_cpu" = "sparc32plus" ] && target_bigendian
=yes
1533 target_user_only
="no"
1534 target_linux_user
="no"
1535 target_darwin_user
="no"
1536 target_bsd_user
="no"
1538 ${target_cpu}-softmmu)
1539 target_softmmu
="yes"
1541 ${target_cpu}-linux-user)
1542 target_user_only
="yes"
1543 target_linux_user
="yes"
1545 ${target_cpu}-darwin-user)
1546 target_user_only
="yes"
1547 target_darwin_user
="yes"
1549 ${target_cpu}-bsd-user)
1550 target_user_only
="yes"
1551 target_bsd_user
="yes"
1554 echo "ERROR: Target '$target' not recognised"
1559 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1560 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1561 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1562 echo "To build QEMU without graphical output configure with --disable-gfx-check"
1563 echo "Note that this will disable all output from the virtual graphics card"
1564 echo "except through VNC or curses."
1568 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1570 test -f $config_h && mv $config_h ${config_h}~
1572 mkdir
-p $target_dir
1573 mkdir
-p $target_dir/fpu
1574 mkdir
-p $target_dir/tcg
1575 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
1576 mkdir
-p $target_dir/nwfpe
1580 # don't use ln -sf as not all "ln -sf" over write the file/link
1582 rm -f $target_dir/Makefile
1583 ln -s $source_path/Makefile.target
$target_dir/Makefile
1586 echo "# Automatically generated by configure - do not modify" > $config_mak
1587 echo "/* Automatically generated by configure - do not modify */" > $config_h
1590 echo "include ../config-host.mak" >> $config_mak
1591 echo "#include \"../config-host.h\"" >> $config_h
1596 interp_prefix1
=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1597 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1600 disable_cpu_emulation
() {
1601 if test $cpu_emulation = "no"; then
1602 echo "#define NO_CPU_EMULATION 1" >> $config_h
1603 echo "NO_CPU_EMULATION=1" >> $config_mak
1608 if test $kvm = "yes" -a "$target_softmmu" = "yes" -a \
1609 \
( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \
); then
1610 echo "#define USE_KVM 1" >> $config_h
1611 echo "USE_KVM=1" >> $config_mak
1612 echo "CONFIG_KVM_KERNEL_INC=$kerneldir/include" >> $config_mak
1613 if test $kvm_cap_pit = "yes" ; then
1614 echo "USE_KVM_PIT=1" >> $config_mak
1615 echo "#define USE_KVM_PIT 1" >> $config_h
1617 if test $kvm_cap_device_assignment = "yes" ; then
1618 echo "USE_KVM_DEVICE_ASSIGNMENT=1" >> $config_mak
1619 echo "#define USE_KVM_DEVICE_ASSIGNMENT 1" >> $config_h
1621 disable_cpu_emulation
1625 if [ use_upstream_kvm
= yes ]; then
1627 # Make sure the target and host cpus are compatible
1628 if test "$kvm" = "yes" -a ! \
( "$target_cpu" = "$cpu" -o \
1629 \
( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \
) -o \
1630 \
( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \
) \
) ; then
1633 # Disable KVM for linux-user
1634 if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1640 case "$target_cpu" in
1642 echo "TARGET_ARCH=i386" >> $config_mak
1643 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1644 echo "#define TARGET_I386 1" >> $config_h
1645 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
1647 echo "#define USE_KQEMU 1" >> $config_h
1649 if test "$kvm" = "yes" ; then
1650 echo "CONFIG_KVM=yes" >> $config_mak
1651 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1652 echo "#define CONFIG_KVM 1" >> $config_h
1654 gcc3minver
=`$cc --version 2> /dev/null| fgrep "(GCC) 3." | awk '{ print $3 }' | cut -f2 -d.`
1655 if test -n "$gcc3minver" && test $gcc3minver -gt 3
1657 echo "HAVE_GT_GCC_3_3=true" >> $config_mak
1659 echo "HAVE_GT_GCC_3_3=false" >> $config_mak
1664 echo "TARGET_ARCH=x86_64" >> $config_mak
1665 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1666 echo "#define TARGET_I386 1" >> $config_h
1667 echo "#define TARGET_X86_64 1" >> $config_h
1668 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1670 echo "#define USE_KQEMU 1" >> $config_h
1675 echo "TARGET_ARCH=ia64" >> $config_mak
1676 echo "#define TARGET_ARCH \"ia64\"" >> $config_h
1677 echo "#define TARGET_IA64 1" >> $config_h
1679 if [ use_upstream_kvm
= yes ]; then
1680 if test "$kvm" = "yes" ; then
1681 echo "CONFIG_KVM=yes" >> $config_mak
1682 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1683 echo "#define CONFIG_KVM 1" >> $config_h
1688 echo "TARGET_ARCH=alpha" >> $config_mak
1689 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1690 echo "#define TARGET_ALPHA 1" >> $config_h
1693 echo "TARGET_ARCH=arm" >> $config_mak
1694 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1695 echo "#define TARGET_ARM 1" >> $config_h
1698 gdb_xml_files
="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
1701 echo "TARGET_ARCH=cris" >> $config_mak
1702 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1703 echo "#define TARGET_CRIS 1" >> $config_h
1706 echo "TARGET_ARCH=m68k" >> $config_mak
1707 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1708 echo "#define TARGET_M68K 1" >> $config_h
1710 gdb_xml_files
="cf-core.xml cf-fp.xml"
1713 echo "TARGET_ARCH=mips" >> $config_mak
1714 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1715 echo "#define TARGET_MIPS 1" >> $config_h
1716 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1719 echo "TARGET_ARCH=mipsn32" >> $config_mak
1720 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1721 echo "#define TARGET_MIPS 1" >> $config_h
1722 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1725 echo "TARGET_ARCH=mips64" >> $config_mak
1726 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1727 echo "#define TARGET_MIPS 1" >> $config_h
1728 echo "#define TARGET_MIPS64 1" >> $config_h
1729 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1732 echo "TARGET_ARCH=ppc" >> $config_mak
1733 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1734 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1735 echo "#define TARGET_PPC 1" >> $config_h
1736 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1739 echo "TARGET_ARCH=ppcemb" >> $config_mak
1740 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1741 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1742 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1743 echo "#define TARGET_PPC 1" >> $config_h
1744 echo "#define TARGET_PPCEMB 1" >> $config_h
1745 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1746 if test "$device_tree_support" = "yes" ; then
1747 echo "#define CONFIG_LIBFDT 1" >> $config_h
1748 echo "CONFIG_LIBFDT=1" >> $config_mak
1753 echo "TARGET_ARCH=ppc64" >> $config_mak
1754 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1755 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1756 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1757 echo "#define TARGET_PPC 1" >> $config_h
1758 echo "#define TARGET_PPC64 1" >> $config_h
1759 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1762 echo "TARGET_ARCH=ppc64" >> $config_mak
1763 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1764 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1765 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1766 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1767 echo "#define TARGET_PPC 1" >> $config_h
1768 echo "#define TARGET_PPC64 1" >> $config_h
1769 echo "#define TARGET_ABI32 1" >> $config_h
1770 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1773 echo "TARGET_ARCH=sh4" >> $config_mak
1774 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1775 echo "#define TARGET_SH4 1" >> $config_h
1780 echo "TARGET_ARCH=sparc" >> $config_mak
1781 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1782 echo "#define TARGET_SPARC 1" >> $config_h
1785 echo "TARGET_ARCH=sparc64" >> $config_mak
1786 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1787 echo "#define TARGET_SPARC 1" >> $config_h
1788 echo "#define TARGET_SPARC64 1" >> $config_h
1792 echo "TARGET_ARCH=sparc64" >> $config_mak
1793 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1794 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1795 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1796 echo "#define TARGET_SPARC 1" >> $config_h
1797 echo "#define TARGET_SPARC64 1" >> $config_h
1798 echo "#define TARGET_ABI32 1" >> $config_h
1801 echo "Unsupported target CPU"
1805 if test "$target_bigendian" = "yes" ; then
1806 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1807 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1809 if test "$target_softmmu" = "yes" ; then
1810 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1811 echo "#define CONFIG_SOFTMMU 1" >> $config_h
1813 if test "$target_user_only" = "yes" ; then
1814 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1815 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1817 if test "$target_linux_user" = "yes" ; then
1818 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1819 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1821 if test "$target_darwin_user" = "yes" ; then
1822 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1823 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1826 if test ! -z "$gdb_xml_files" ; then
1827 for x
in $gdb_xml_files; do
1828 list
="$list $source_path/gdb-xml/$x"
1831 echo "TARGET_XML_FILES=$list" >> $config_mak
1833 if test "$target_cpu" = "arm" \
1834 -o "$target_cpu" = "armeb" \
1835 -o "$target_cpu" = "m68k" \
1836 -o "$target_cpu" = "mips" \
1837 -o "$target_cpu" = "mipsel" \
1838 -o "$target_cpu" = "mipsn32" \
1839 -o "$target_cpu" = "mipsn32el" \
1840 -o "$target_cpu" = "mips64" \
1841 -o "$target_cpu" = "mips64el" \
1842 -o "$target_cpu" = "sparc" \
1843 -o "$target_cpu" = "sparc64" \
1844 -o "$target_cpu" = "sparc32plus"; then
1845 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1846 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1848 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1849 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1850 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1852 if test "$target_user_only" = "yes" \
1853 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1854 echo "#define USE_NPTL 1" >> $config_h
1856 # 32 bit ELF loader in addition to native 64 bit loader?
1857 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1858 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1859 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1861 if test "$target_bsd_user" = "yes" ; then
1862 echo "CONFIG_BSD_USER=yes" >> $config_mak
1863 echo "#define CONFIG_BSD_USER 1" >> $config_h
1866 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~
$config_h
1868 done # for target in $targets
1870 # build tree in object directory if source path is different from current one
1871 if test "$source_path_used" = "yes" ; then
1872 DIRS
="tests tests/cris slirp audio"
1873 FILES
="Makefile tests/Makefile"
1874 FILES
="$FILES tests/cris/Makefile tests/cris/.gdbinit"
1875 FILES
="$FILES tests/test-mmap.c"
1876 for dir
in $DIRS ; do
1879 # remove the link and recreate it, as not all "ln -sf" overwrite the link
1880 for f
in $FILES ; do
1882 ln -s $source_path/$f $f
1886 rm -f $TMPO $TMPC $TMPE $TMPS $TMPI