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"
39 # parse CC options first
41 optarg
=`expr "x$opt" : 'x[^=]*=\(.*\)'`
43 --cross-prefix=*) cross_prefix
="$optarg"
51 # Using uname is really, really broken. Once we have the right set of checks
52 # we can eliminate it's usage altogether
54 cc
="${cross_prefix}${cc}"
55 ar="${cross_prefix}${ar}"
56 objcopy
="${cross_prefix}${objcopy}"
57 ld
="${cross_prefix}${ld}"
59 # check that the C compiler works.
64 if $cc $CFLAGS -c -o $TMPO $TMPC > /dev
/null
2> /dev
/null
; then
67 echo "ERROR: \"$cc\" either does not exist or does not work"
76 int main(void) { return 0; }
78 $cc $CFLAGS -c -o $TMPO $TMPC > /dev
/null
2> /dev
/null
81 if check_define __i386__
; then
83 elif check_define __x86_64__
; then
85 elif check_define __sparc__
; then
86 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
87 # They must be specified using --sparc_cpu
88 if check_define __arch64__
; then
93 elif check_define _ARCH_PPC
; then
94 if check_define _ARCH_PPC64
; then
105 i386|i486|i586|i686|i86pc|BePC
)
207 if check_define __linux__
; then
209 elif check_define _WIN32
; then
211 elif check_define __OpenBSD__
; then
213 elif check_define __sun__
; then
221 OS_CFLAGS
="-mno-cygwin"
222 if [ "$cpu" = "i386" ] ; then
225 audio_possible_drivers
="sdl"
229 if [ "$cpu" = "i386" ] ; then
232 audio_possible_drivers
="dsound sdl fmod"
236 audio_possible_drivers
="oss sdl esd pa"
237 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
244 audio_possible_drivers
="oss sdl esd pa"
245 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
252 audio_possible_drivers
="oss sdl esd pa"
253 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
261 audio_possible_drivers
="oss sdl esd"
267 audio_possible_drivers
="oss sdl esd"
273 # 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
274 if [ "$cpu" = "i386" ] ; then
275 is_x86_64
=`sysctl -n hw.optional.x86_64`
276 [ "$is_x86_64" = "1" ] && cpu
=x86_64
278 if [ "$cpu" = "x86_64" ] ; then
279 OS_CFLAGS
="-arch x86_64"
280 LDFLAGS
="-arch x86_64"
282 OS_CFLAGS
="-mdynamic-no-pic"
286 audio_drv_list
="coreaudio"
287 audio_possible_drivers
="coreaudio sdl fmod"
288 OS_LDFLAGS
="-framework CoreFoundation -framework IOKit"
294 needs_libsunmath
="no"
295 solarisrev
=`uname -r | cut -f2 -d.`
296 # have to select again, because `uname -m` returns i86pc
297 # even on an x86_64 box.
298 solariscpu
=`isainfo -k`
299 if test "${solariscpu}" = "amd64" ; then
302 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
303 if test "$solarisrev" -le 9 ; then
304 if test -f /opt
/SUNWspro
/prod
/lib
/libsunmath.so
.1; then
305 needs_libsunmath
="yes"
307 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
308 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
309 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
310 echo "Studio 11 can be downloaded from www.sun.com."
314 if test "$solarisrev" -ge 9 ; then
318 if test -f /usr
/include
/sys
/soundcard.h
; then
321 audio_possible_drivers
="oss sdl"
330 audio_possible_drivers
="oss alsa sdl esd pa"
335 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
337 audio_possible_drivers
="$audio_possible_drivers fmod"
342 if [ "$bsd" = "yes" ] ; then
343 if [ "$darwin" != "yes" ] ; then
351 source_path
=`dirname "$0"`
352 source_path_used
="no"
354 if [ -z "$source_path" ]; then
357 source_path
=`cd "$source_path"; pwd`
359 [ -f "$workdir/vl.c" ] || source_path_used
="yes"
364 optarg
=`expr "x$opt" : 'x[^=]*=\(.*\)'`
366 --help|
-h) show_help
=yes
368 --prefix=*) prefix
="$optarg"
370 --interp-prefix=*) interp_prefix
="$optarg"
372 --source-path=*) source_path
="$optarg"
373 source_path_used
="yes"
379 --host-cc=*) host_cc
="$optarg"
381 --make=*) make="$optarg"
383 --install=*) install="$optarg"
385 --extra-cflags=*) EXTRA_CFLAGS
="$optarg"
387 --extra-ldflags=*) EXTRA_LDFLAGS
="$optarg"
389 --cpu=*) cpu
="$optarg"
391 --target-list=*) target_list
="$optarg"
393 --enable-gprof) gprof
="yes"
395 --static) static
="yes"
397 --disable-sdl) sdl
="no"
399 --fmod-lib=*) fmod_lib
="$optarg"
401 --fmod-inc=*) fmod_inc
="$optarg"
403 --oss-lib=*) oss_lib
="$optarg"
405 --audio-card-list=*) audio_card_list
=`echo "$optarg" | sed -e 's/,/ /g'`
407 --audio-drv-list=*) audio_drv_list
="$optarg"
409 --enable-debug-tcg) debug_tcg
="yes"
411 --disable-debug-tcg) debug_tcg
="no"
414 # Enable debugging options that aren't excessively noisy
419 --enable-sparse) sparse
="yes"
421 --disable-sparse) sparse
="no"
423 --disable-strip) strip_opt
="no"
425 --disable-vnc-tls) vnc_tls
="no"
427 --disable-vnc-sasl) vnc_sasl
="no"
429 --disable-slirp) slirp
="no"
431 --disable-vde) vde
="no"
433 --disable-kqemu) kqemu
="no"
435 --disable-xen) xen
="no"
437 --disable-brlapi) brlapi
="no"
439 --disable-bluez) bluez
="no"
441 --disable-kvm) kvm
="no"
443 --enable-profiler) profiler
="yes"
448 audio_drv_list
="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
450 --disable-system) softmmu
="no"
452 --enable-system) softmmu
="yes"
454 --disable-linux-user) linux_user
="no"
456 --enable-linux-user) linux_user
="yes"
458 --disable-darwin-user) darwin_user
="no"
460 --enable-darwin-user) darwin_user
="yes"
462 --disable-bsd-user) bsd_user
="no"
464 --enable-bsd-user) bsd_user
="yes"
466 --enable-guest-base) guest_base
="yes"
468 --disable-guest-base) guest_base
="no"
470 --enable-uname-release=*) uname_release
="$optarg"
476 ARCH_CFLAGS
="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"
481 ARCH_CFLAGS
="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"
486 ARCH_CFLAGS
="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"
491 echo "undefined SPARC architecture. Exiting";
496 --enable-werror) werror
="yes"
498 --disable-werror) werror
="no"
500 --disable-curses) curses
="no"
502 --disable-curl) curl
="no"
504 --disable-nptl) nptl
="no"
506 --enable-mixemu) mixemu
="yes"
508 --disable-pthread) pthread
="no"
510 --disable-aio) aio
="no"
512 --enable-io-thread) io_thread
="yes"
514 --disable-blobs) blobs
="no"
516 --kerneldir=*) kerneldir
="$optarg"
518 --with-pkgversion=*) pkgversion
=" ($optarg)"
520 --disable-docs) build_docs
="no"
522 *) echo "ERROR: unknown option $opt"; show_help
="yes"
527 # default flags for all hosts
528 CFLAGS
="$CFLAGS -g -fno-strict-aliasing"
529 if test "$debug" = "no" ; then
532 CFLAGS
="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
533 LDFLAGS
="$LDFLAGS -g"
535 # Consult white-list to determine whether to enable werror
536 # by default. Only enable by default for git builds
537 if test -z "$werror" ; then
538 z_version
=`cut -f3 -d. $source_path/VERSION`
539 if test "$z_version" = "50" -a \
540 "$linux" = "yes" ; then
547 if test "$werror" = "yes" ; then
548 CFLAGS
="$CFLAGS -Werror"
551 if test "$solaris" = "no" ; then
552 if ld
--version 2>/dev
/null |
grep "GNU ld" >/dev
/null
2>/dev
/null
; then
553 LDFLAGS
="$LDFLAGS -Wl,--warn-common"
558 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
559 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
563 sparc
) if test -z "$sparc_cpu" ; then
564 ARCH_CFLAGS
="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
567 ARCH_CFLAGS
="$ARCH_CFLAGS -ffixed-g2 -ffixed-g3"
568 if test "$solaris" = "no" ; then
569 ARCH_CFLAGS
="$ARCH_CFLAGS -ffixed-g1 -ffixed-g6"
572 sparc64
) if test -z "$sparc_cpu" ; then
573 ARCH_CFLAGS
="-m64 -mcpu=ultrasparc -D__sparc_v9__"
576 if test "$solaris" = "no" ; then
577 ARCH_CFLAGS
="$ARCH_CFLAGS -ffixed-g5 -ffixed-g6 -ffixed-g7"
579 ARCH_CFLAGS
="$ARCH_CFLAGS -ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7"
583 ARCH_CFLAGS
="-march=z900"
588 host_guest_base
="yes"
593 host_guest_base
="yes"
596 host_guest_base
="yes"
599 host_guest_base
="yes"
603 [ -z "$guest_base" ] && guest_base
="$host_guest_base"
605 if test x
"$show_help" = x
"yes" ; then
608 Usage: configure [options]
609 Options: [defaults in brackets after descriptions]
612 echo "Standard options:"
613 echo " --help print this message"
614 echo " --prefix=PREFIX install in PREFIX [$prefix]"
615 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
616 echo " use %M for cpu name [$interp_prefix]"
617 echo " --target-list=LIST set target list [$target_list]"
619 echo "kqemu kernel acceleration support:"
620 echo " --disable-kqemu disable kqemu support"
622 echo "Advanced options (experts only):"
623 echo " --source-path=PATH path of source code [$source_path]"
624 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
625 echo " --cc=CC use C compiler CC [$cc]"
626 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
627 echo " --extra-cflags=CFLAGS append extra C compiler flags CFLAGS"
628 echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS"
629 echo " --make=MAKE use specified make [$make]"
630 echo " --install=INSTALL use specified install [$install]"
631 echo " --static enable static build [$static]"
632 echo " --enable-debug-tcg enable TCG debugging"
633 echo " --disable-debug-tcg disable TCG debugging (default)"
634 echo " --enable-debug enable common debug build options"
635 echo " --enable-sparse enable sparse checker"
636 echo " --disable-sparse disable sparse checker (default)"
637 echo " --disable-strip disable stripping binaries"
638 echo " --disable-werror disable compilation abort on warning"
639 echo " --disable-sdl disable SDL"
640 echo " --enable-cocoa enable COCOA (Mac OS X only)"
641 echo " --audio-drv-list=LIST set audio drivers list:"
642 echo " Available drivers: $audio_possible_drivers"
643 echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
644 echo " Available cards: $audio_possible_cards"
645 echo " --enable-mixemu enable mixer emulation"
646 echo " --disable-xen disable xen backend driver support"
647 echo " --disable-brlapi disable BrlAPI"
648 echo " --disable-vnc-tls disable TLS encryption for VNC server"
649 echo " --disable-vnc-sasl disable SASL encryption for VNC server"
650 echo " --disable-curses disable curses output"
651 echo " --disable-curl disable curl connectivity"
652 echo " --disable-bluez disable bluez stack connectivity"
653 echo " --disable-kvm disable KVM acceleration support"
654 echo " --disable-nptl disable usermode NPTL support"
655 echo " --enable-system enable all system emulation targets"
656 echo " --disable-system disable all system emulation targets"
657 echo " --enable-linux-user enable all linux usermode emulation targets"
658 echo " --disable-linux-user disable all linux usermode emulation targets"
659 echo " --enable-darwin-user enable all darwin usermode emulation targets"
660 echo " --disable-darwin-user disable all darwin usermode emulation targets"
661 echo " --enable-bsd-user enable all BSD usermode emulation targets"
662 echo " --disable-bsd-user disable all BSD usermode emulation targets"
663 echo " --enable-guest-base enable GUEST_BASE support for usermode"
664 echo " emulation targets"
665 echo " --disable-guest-base disable GUEST_BASE support"
666 echo " --fmod-lib path to FMOD library"
667 echo " --fmod-inc path to FMOD includes"
668 echo " --oss-lib path to OSS library"
669 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
670 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
671 echo " --disable-vde disable support for vde network"
672 echo " --disable-pthread disable pthread support"
673 echo " --disable-aio disable AIO support"
674 echo " --enable-io-thread enable IO thread"
675 echo " --disable-blobs disable installing provided firmware blobs"
676 echo " --kerneldir=PATH look for kernel includes in PATH"
678 echo "NOTE: The object files are built at the place where configure is launched"
682 if test "$mingw32" = "yes" ; then
687 OS_CFLAGS
="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
690 if test ! -x "$(which cgcc 2>/dev/null)"; then
695 # Solaris specific configure tool chain decisions
697 if test "$solaris" = "yes" ; then
698 solinst
=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
699 if test -z "$solinst" ; then
700 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
701 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
702 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
705 if test "$solinst" = "/usr/sbin/install" ; then
706 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
707 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
708 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
711 sol_ar
=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
712 if test -z "$sol_ar" ; then
713 echo "Error: No path includes ar"
714 if test -f /usr
/ccs
/bin
/ar ; then
715 echo "Add /usr/ccs/bin to your path and rerun configure"
722 if test -z "$target_list" ; then
723 # these targets are portable
724 if [ "$softmmu" = "yes" ] ; then
745 # the following are Linux specific
746 if [ "$linux_user" = "yes" ] ; then
747 target_list
="${target_list}\
755 microblaze-linux-user \
760 ppc64abi32-linux-user \
765 sparc32plus-linux-user \
768 # the following are Darwin specific
769 if [ "$darwin_user" = "yes" ] ; then
770 target_list
="$target_list i386-darwin-user ppc-darwin-user "
772 # the following are BSD specific
773 if [ "$bsd_user" = "yes" ] ; then
774 target_list
="${target_list}\
782 target_list
=`echo "$target_list" | sed -e 's/,/ /g'`
784 if test -z "$target_list" ; then
785 echo "No targets enabled"
789 if test -z "$cross_prefix" ; then
792 # big/little endian test
794 #include <inttypes.h>
795 int main(int argc, char ** argv){
796 volatile uint32_t i=0x01234567;
797 return (*((uint8_t*)(&i))) == 0x67;
801 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
802 $TMPE && bigendian
="yes"
804 echo big
/little
test failed
809 # if cross compiling, cannot launch a program, so make a static guess
810 if test "$cpu" = "armv4b" \
814 -o "$cpu" = "mips64" \
816 -o "$cpu" = "ppc64" \
818 -o "$cpu" = "sparc" \
819 -o "$cpu" = "sparc64"; then
825 # host long bits test
827 if test "$cpu" = "x86_64" \
828 -o "$cpu" = "alpha" \
830 -o "$cpu" = "sparc64" \
831 -o "$cpu" = "ppc64"; then
835 # Check host NPTL support
838 #include <linux/futex.h>
841 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
847 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev
/null
2> /dev
/null
; then
853 ##########################################
858 int main(void) { zlibVersion(); return 0; }
860 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev
/null
2> /dev
/null
; then
864 echo "Error: zlib check failed"
865 echo "Make sure to have the zlib libs and headers installed."
870 ##########################################
873 if test "$xen" = "yes" ; then
874 xen_libs
="-lxenstore -lxenctrl -lxenguest"
878 int main(void) { xs_daemon_open(); xc_interface_open(); return 0; }
880 if $cc $CFLAGS $ARCH_CFLAGS $EXTRA_CFLAGS -c -o $TMPO $TMPC $LDFLAGS $EXTRA_LDFLAGS $xen_libs 2> /dev
/null
> /dev
/null
; then
887 ##########################################
892 if test "$sdl" = "yes" ; then
896 #undef main /* We don't want SDL to override our main() */
897 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
899 sdl_cflags
=`sdl-config --cflags 2> /dev/null`
900 sdl_libs
=`sdl-config --libs 2> /dev/null`
901 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $sdl_cflags $TMPC $sdl_libs > $TMPSDLLOG 2>&1 ; then
902 _sdlversion
=`sdl-config --version | sed 's/[^0-9]//g'`
903 if test "$_sdlversion" -lt 121 ; then
906 if test "$cocoa" = "no" ; then
911 # static link with sdl ?
912 if test "$sdl" = "yes" -a "$static" = "yes" ; then
913 sdl_libs
=`sdl-config --static-libs 2>/dev/null`
914 if test `sdl-config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` ; then
915 sdl_libs
="$sdl_libs `aalib-config --static-libs >2 /dev/null`"
916 sdl_cflags
="$sd_cflags `aalib-config --cflags >2 /dev/null`"
918 if $cc -o $TMPE ${OS_CFLAGS} $sdl_cflags $TMPC $sdl_libs > /dev
/null
2> /dev
/null
; then
924 fi # sdl compile test
927 if test "$sdl" = "yes" ; then
930 #if defined(SDL_VIDEO_DRIVER_X11)
931 #include <X11/XKBlib.h>
933 #error No x11 support
935 int main(void) { return 0; }
937 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $sdl_cflags $TMPC $sdl_libs > /dev
/null
2>&1 ; then
938 sdl_libs
="$sdl_libs -lX11"
942 ##########################################
944 if test "$vnc_tls" = "yes" ; then
946 #include <gnutls/gnutls.h>
947 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
949 vnc_tls_cflags
=`pkg-config --cflags gnutls 2> /dev/null`
950 vnc_tls_libs
=`pkg-config --libs gnutls 2> /dev/null`
951 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
952 $vnc_tls_libs > /dev
/null
2> /dev
/null
; then
959 ##########################################
961 if test "$vnc_sasl" = "yes" ; then
963 #include <sasl/sasl.h>
965 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
967 # Assuming Cyrus-SASL installed in /usr prefix
969 vnc_sasl_libs
="-lsasl2"
970 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
971 $vnc_sasl_libs 2> /dev
/null
> /dev
/null
; then
978 ##########################################
979 # fnmatch() probe, used for ACL routines
985 fnmatch("foo", "foo", 0);
989 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
993 ##########################################
994 # vde libraries probe
995 if test "$vde" = "yes" ; then
999 #include <libvdeplug.h>
1002 struct vde_open_args a = {0, 0, 0};
1003 vde_open("", "", &a);
1007 if $cc $ARCH_CFLAGS -o $TMPE $TMPC $vde_libs > /dev
/null
2> /dev
/null
; then
1012 ##########################################
1013 # Sound support libraries probe
1024 int main(void) { $exp }
1026 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev
/null
2> /dev
/null
; then
1030 echo "Error: $drv check failed"
1031 echo "Make sure to have the $drv libs and headers installed."
1037 audio_drv_list
=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1038 for drv
in $audio_drv_list; do
1041 audio_drv_probe
$drv alsa
/asoundlib.h
-lasound \
1042 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1046 if test -z $fmod_lib ||
test -z $fmod_inc; then
1048 echo "Error: You must specify path to FMOD library and headers"
1049 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1053 audio_drv_probe
$drv fmod.h
$fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1057 audio_drv_probe
$drv esd.h
-lesd 'return esd_play_stream(0, 0, "", 0);'
1061 audio_drv_probe
$drv pulse
/simple.h
-lpulse-simple \
1062 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1065 oss|sdl|core|wav|dsound
)
1066 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1070 echo "$audio_possible_drivers" |
grep -q "\<$drv\>" ||
{
1072 echo "Error: Unknown driver '$drv' selected"
1073 echo "Possible drivers are: $audio_possible_drivers"
1081 ##########################################
1084 if test "$brlapi" = "yes" ; then
1086 brlapi_libs
="-lbrlapi"
1089 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1091 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC $brlapi_libs > /dev
/null
2> /dev
/null
; then
1096 ##########################################
1099 if test "$curses" = "yes" ; then
1103 #define resize_term resizeterm
1105 int main(void) { resize_term(0, 0); return curses_version(); }
1107 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lncurses > /dev
/null
2> /dev
/null
; then
1108 curses_libs
="-lncurses"
1109 elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev
/null
2> /dev
/null
; then
1110 curses_libs
="-lcurses"
1116 ##########################################
1119 if test "$curl" = "yes" ; then
1122 #include <curl/curl.h>
1123 int main(void) { return curl_easy_init(); }
1125 curl_libs
=`curl-config --libs 2>/dev/null`
1126 if $cc $ARCH_CFLAGS $curl_libs -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
1131 ##########################################
1132 # bluez support probe
1133 if test "$bluez" = "yes" ; then
1134 `pkg-config bluez 2> /dev/null` || bluez
="no"
1136 if test "$bluez" = "yes" ; then
1138 #include <bluetooth/bluetooth.h>
1139 int main(void) { return bt_error(0); }
1141 bluez_cflags
=`pkg-config --cflags bluez 2> /dev/null`
1142 bluez_libs
=`pkg-config --libs bluez 2> /dev/null`
1143 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
1144 $bluez_libs > /dev
/null
2> /dev
/null
; then
1151 ##########################################
1153 if test "$kvm" = "yes" ; then
1155 #include <linux/kvm.h>
1156 #if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
1157 #error Invalid KVM version
1159 #if !defined(KVM_CAP_USER_MEMORY)
1160 #error Missing KVM capability KVM_CAP_USER_MEMORY
1162 #if !defined(KVM_CAP_SET_TSS_ADDR)
1163 #error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1165 #if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1166 #error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1168 int main(void) { return 0; }
1170 if test "$kerneldir" != "" ; then
1171 kvm_cflags
=-I"$kerneldir"/include
1172 if test \
( "$cpu" = "i386" -o "$cpu" = "x86_64" \
) \
1173 -a -d "$kerneldir/arch/x86/include" ; then
1174 kvm_cflags
="$kvm_cflags -I$kerneldir/arch/x86/include"
1175 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1176 kvm_cflags
="$kvm_cflags -I$kerneldir/arch/powerpc/include"
1177 elif test -d "$kerneldir/arch/$cpu/include" ; then
1178 kvm_cflags
="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1183 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
1184 > /dev
/null
2>/dev
/null
; then
1188 if [ -x "`which awk 2>/dev/null`" ] && \
1189 [ -x "`which grep 2>/dev/null`" ]; then
1190 kvmerr
=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
1192 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1193 if test "$kvmerr" != "" ; then
1194 kvm
="no - (${kvmerr})\n\
1195 NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \
1196 recent kvm-kmod from http://sourceforge.net/projects/kvm."
1202 ##########################################
1204 PTHREADLIBS_LIST
="-lpthread -lpthreadGC2"
1207 if test "$pthread" = yes; then
1210 #include <pthread.h>
1211 int main(void) { pthread_create(0,0,0,0); return 0; }
1213 for pthread_lib
in $PTHREADLIBS_LIST; do
1214 if $cc $ARCH_CFLAGS -o $TMPE $TMPC $pthread_lib 2> /dev
/null
> /dev
/null
; then
1216 PTHREADLIBS
="$pthread_lib"
1222 if test "$pthread" = no
; then
1227 ##########################################
1230 #include <sys/types.h>
1231 #include <sys/uio.h>
1233 int main(void) { struct iovec iov; return 0; }
1236 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
1240 ##########################################
1243 #include <sys/types.h>
1244 #include <sys/uio.h>
1246 int main(void) { preadv; }
1249 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
1253 ##########################################
1255 if test "$fdt" = "yes" ; then
1259 int main(void) { return 0; }
1261 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC $fdt_libs 2> /dev
/null
> /dev
/null
; then
1267 # Check for xxxat() functions when we are building linux-user
1268 # emulator. This is done because older glibc versions don't
1269 # have syscall stubs for these implemented.
1273 #define _ATFILE_SOURCE
1274 #include <sys/types.h>
1281 /* try to unlink nonexisting file */
1282 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1285 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
> /dev
/null
; then
1289 # Check for inotify functions when we are building linux-user
1290 # emulator. This is done because older glibc versions don't
1291 # have syscall stubs for these implemented. In that case we
1292 # don't provide them even if kernel supports them.
1296 #include <sys/inotify.h>
1301 /* try to start inotify */
1302 return inotify_init();
1305 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
> /dev
/null
; then
1309 # check if utimensat and futimens are supported
1312 #define _ATFILE_SOURCE
1319 utimensat(AT_FDCWD, "foo", NULL, 0);
1324 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
1328 # check if pipe2 is there
1338 pipe2(pipefd, O_CLOEXEC);
1342 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
1346 # check if tee/splice is there. vmsplice was added same time.
1357 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
1358 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
1362 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
1366 # Check if tools are available to build documentation.
1367 if test "$build_docs" = "yes" -a \
( ! -x "`which texi2html 2>/dev/null`" -o ! -x "`which pod2man 2>/dev/null`" \
) ; then
1371 ##########################################
1377 int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1381 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev
/null
2> /dev
/null
; then
1383 elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev
/null
2> /dev
/null
; then
1387 if test "$rt" = "yes" ; then
1391 if test "$mingw32" = "yes" ; then
1392 if test -z "$prefix" ; then
1393 prefix
="c:/Program Files/Qemu"
1400 if test -z "$prefix" ; then
1403 mansuffix
="/share/man"
1404 datasuffix
="/share/qemu"
1405 docsuffix
="/share/doc/qemu"
1409 echo "Install prefix $prefix"
1410 echo "BIOS directory $prefix$datasuffix"
1411 echo "binary directory $prefix$binsuffix"
1412 if test "$mingw32" = "no" ; then
1413 echo "Manual directory $prefix$mansuffix"
1414 echo "ELF interp prefix $interp_prefix"
1416 echo "Source path $source_path"
1417 echo "C compiler $cc"
1418 echo "Host C compiler $host_cc"
1419 echo "ARCH_CFLAGS $ARCH_CFLAGS"
1421 echo "install $install"
1422 echo "host CPU $cpu"
1423 echo "host big endian $bigendian"
1424 echo "target list $target_list"
1425 echo "tcg debug enabled $debug_tcg"
1426 echo "gprof enabled $gprof"
1427 echo "sparse enabled $sparse"
1428 echo "strip binaries $strip_opt"
1429 echo "profiler $profiler"
1430 echo "static build $static"
1431 echo "-Werror enabled $werror"
1432 if test "$darwin" = "yes" ; then
1433 echo "Cocoa support $cocoa"
1435 echo "SDL support $sdl"
1436 echo "curses support $curses"
1437 echo "curl support $curl"
1438 echo "mingw32 support $mingw32"
1439 echo "Audio drivers $audio_drv_list"
1440 echo "Extra audio cards $audio_card_list"
1441 echo "Mixer emulation $mixemu"
1442 echo "VNC TLS support $vnc_tls"
1443 if test "$vnc_tls" = "yes" ; then
1444 echo " TLS CFLAGS $vnc_tls_cflags"
1445 echo " TLS LIBS $vnc_tls_libs"
1447 echo "VNC SASL support $vnc_sasl"
1448 if test "$vnc_sasl" = "yes" ; then
1449 echo " SASL CFLAGS $vnc_sasl_cflags"
1450 echo " SASL LIBS $vnc_sasl_libs"
1452 if test -n "$sparc_cpu"; then
1453 echo "Target Sparc Arch $sparc_cpu"
1455 echo "kqemu support $kqemu"
1456 echo "xen support $xen"
1457 echo "brlapi support $brlapi"
1458 echo "Documentation $build_docs"
1459 [ ! -z "$uname_release" ] && \
1460 echo "uname -r $uname_release"
1461 echo "NPTL support $nptl"
1462 echo "GUEST_BASE $guest_base"
1463 echo "vde support $vde"
1464 echo "AIO support $aio"
1465 echo "IO thread $io_thread"
1466 echo "Install blobs $blobs"
1467 echo -e "KVM support $kvm"
1468 echo "fdt support $fdt"
1469 echo "preadv support $preadv"
1471 if test $sdl_too_old = "yes"; then
1472 echo "-> Your SDL version is too old - please upgrade to have SDL support"
1475 config_host_mak
="config-host.mak"
1476 config_host_h
="config-host.h"
1477 config_host_ld
="config-host.ld"
1479 #echo "Creating $config_host_mak and $config_host_h"
1481 test -f $config_host_h && mv $config_host_h ${config_host_h}~
1483 echo "# Automatically generated by configure - do not modify" > $config_host_mak
1484 printf "# Configured with:" >> $config_host_mak
1485 printf " '%s'" "$0" "$@" >> $config_host_mak
1486 echo >> $config_host_mak
1488 echo "CONFIG_QEMU_SHAREDIR=\"$prefix$datasuffix\"" >> $config_host_mak
1491 i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|sparc|sparc64
)
1498 echo "Unsupported CPU = $cpu"
1502 echo "ARCH=$ARCH" >> $config_host_mak
1503 if test "$debug_tcg" = "yes" ; then
1504 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
1506 if test "$debug" = "yes" ; then
1507 echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
1509 if test "$strip_opt" = "yes" ; then
1510 echo "STRIP_OPT=-s" >> $config_host_mak
1512 if test "$bigendian" = "yes" ; then
1513 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
1515 echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
1516 if test "$mingw32" = "yes" ; then
1517 echo "CONFIG_WIN32=y" >> $config_host_mak
1519 echo "CONFIG_POSIX=y" >> $config_host_mak
1521 #include <byteswap.h>
1522 int main(void) { return bswap_32(0); }
1524 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev
/null
2> /dev
/null
; then
1525 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
1528 #include <sys/endian.h>
1529 #include <sys/types.h>
1530 #include <machine/bswap.h>
1531 int main(void) { return bswap32(0); }
1533 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev
/null
2> /dev
/null
; then
1534 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
1538 if test "$darwin" = "yes" ; then
1539 echo "CONFIG_DARWIN=y" >> $config_host_mak
1542 if test "$aix" = "yes" ; then
1543 echo "CONFIG_AIX=y" >> $config_host_mak
1546 if test "$solaris" = "yes" ; then
1547 echo "CONFIG_SOLARIS=y" >> $config_host_mak
1548 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
1549 if test "$needs_libsunmath" = "yes" ; then
1550 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
1553 if test -n "$sparc_cpu"; then
1554 echo "CONFIG__sparc_${sparc_cpu}__=y" >> $config_host_mak
1556 if test "$gprof" = "yes" ; then
1557 echo "TARGET_GPROF=yes" >> $config_host_mak
1559 if test "$static" = "yes" ; then
1560 echo "CONFIG_STATIC=y" >> $config_host_mak
1561 LDFLAGS
="$LDFLAGS -static"
1563 if test $profiler = "yes" ; then
1564 echo "CONFIG_PROFILER=y" >> $config_host_mak
1566 if test "$slirp" = "yes" ; then
1567 echo "CONFIG_SLIRP=y" >> $config_host_mak
1569 if test "$vde" = "yes" ; then
1570 echo "CONFIG_VDE=y" >> $config_host_mak
1571 echo "VDE_LIBS=$vde_libs" >> $config_host_mak
1573 for card
in $audio_card_list; do
1574 def
=CONFIG_
`echo $card | tr '[:lower:]' '[:upper:]'`
1575 echo "$def=y" >> $config_host_mak
1577 echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
1578 for drv
in $audio_drv_list; do
1579 def
=CONFIG_
`echo $drv | tr '[:lower:]' '[:upper:]'`
1580 echo "$def=y" >> $config_host_mak
1581 if test "$drv" = "fmod"; then
1582 echo "FMOD_LIBS=$fmod_lib" >> $config_host_mak
1583 echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
1584 elif test "$drv" = "oss"; then
1585 echo "OSS_LIBS=$oss_lib" >> $config_host_mak
1588 if test "$mixemu" = "yes" ; then
1589 echo "CONFIG_MIXEMU=y" >> $config_host_mak
1591 if test "$vnc_tls" = "yes" ; then
1592 echo "CONFIG_VNC_TLS=y" >> $config_host_mak
1593 echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
1594 echo "VNC_TLS_LIBS=$vnc_tls_libs" >> $config_host_mak
1596 if test "$vnc_sasl" = "yes" ; then
1597 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
1598 echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
1599 echo "VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_host_mak
1601 if test "$fnmatch" = "yes" ; then
1602 echo "CONFIG_FNMATCH=y" >> $config_host_mak
1604 qemu_version
=`head $source_path/VERSION`
1605 echo "VERSION=$qemu_version" >>$config_host_mak
1606 echo "PKGVERSION=$pkgversion" >>$config_host_mak
1607 echo "SRC_PATH=$source_path" >> $config_host_mak
1608 if [ "$source_path_used" = "yes" ]; then
1609 echo "VPATH=$source_path" >> $config_host_mak
1611 echo "TARGET_DIRS=$target_list" >> $config_host_mak
1612 if [ "$build_docs" = "yes" ] ; then
1613 echo "BUILD_DOCS=yes" >> $config_host_mak
1615 if test "$sdl" = "yes" ; then
1616 echo "CONFIG_SDL=y" >> $config_host_mak
1617 echo "SDL_LIBS=$sdl_libs" >> $config_host_mak
1618 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
1620 if test "$cocoa" = "yes" ; then
1621 echo "CONFIG_COCOA=y" >> $config_host_mak
1623 if test "$curses" = "yes" ; then
1624 echo "CONFIG_CURSES=y" >> $config_host_mak
1625 echo "CURSES_LIBS=$curses_libs" >> $config_host_mak
1627 if test "$atfile" = "yes" ; then
1628 echo "CONFIG_ATFILE=y" >> $config_host_mak
1630 if test "$utimens" = "yes" ; then
1631 echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
1633 if test "$pipe2" = "yes" ; then
1634 echo "CONFIG_PIPE2=y" >> $config_host_mak
1636 if test "$splice" = "yes" ; then
1637 echo "CONFIG_SPLICE=y" >> $config_host_mak
1639 if test "$inotify" = "yes" ; then
1640 echo "CONFIG_INOTIFY=y" >> $config_host_mak
1642 if test "$curl" = "yes" ; then
1643 echo "CONFIG_CURL=y" >> $config_host_mak
1644 echo "CURL_LIBS=$curl_libs" >> $config_host_mak
1646 if test "$brlapi" = "yes" ; then
1647 echo "CONFIG_BRLAPI=y" >> $config_host_mak
1648 echo "BRLAPI_LIBS=$brlapi_libs" >> $config_host_mak
1650 if test "$bluez" = "yes" ; then
1651 echo "CONFIG_BLUEZ=y" >> $config_host_mak
1652 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
1653 echo "BLUEZ_LIBS=$bluez_libs" >> $config_host_mak
1655 if test "$xen" = "yes" ; then
1656 echo "CONFIG_XEN=y" >> $config_host_mak
1657 echo "XEN_LIBS=$xen_libs" >> $config_host_mak
1659 if test "$aio" = "yes" ; then
1660 echo "CONFIG_AIO=y" >> $config_host_mak
1662 if test "$io_thread" = "yes" ; then
1663 echo "CONFIG_IOTHREAD=y" >> $config_host_mak
1665 if test "$blobs" = "yes" ; then
1666 echo "INSTALL_BLOBS=yes" >> $config_host_mak
1668 if test "$iovec" = "yes" ; then
1669 echo "CONFIG_IOVEC=y" >> $config_host_mak
1671 if test "$preadv" = "yes" ; then
1672 echo "CONFIG_PREADV=y" >> $config_host_mak
1674 if test "$fdt" = "yes" ; then
1675 echo "CONFIG_FDT=y" >> $config_host_mak
1676 echo "FDT_LIBS=$fdt_libs" >> $config_host_mak
1679 # XXX: suppress that
1680 if [ "$bsd" = "yes" ] ; then
1681 echo "CONFIG_BSD=y" >> $config_host_mak
1684 echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
1689 echo "HOST_USB=linux" >> $config_host_mak
1692 echo "HOST_USB=bsd" >> $config_host_mak
1695 echo "HOST_USB=stub" >> $config_host_mak
1699 # Determine what linker flags to use to force archive inclusion
1700 check_linker_flags
()
1706 $cc $ARCH_CFLAGS -o $TMPE $OS_CFLAGS $TMPC -Wl,$1 ${w2} >/dev
/null
2>/dev
/null
1712 if check_linker_flags
--whole-archive --no-whole-archive ; then
1714 echo "ARLIBS_BEGIN=-Wl,--whole-archive" >> $config_host_mak
1715 echo "ARLIBS_END=-Wl,--no-whole-archive" >> $config_host_mak
1716 elif check_linker_flags
-z,allextract
-z,defaultextract
; then
1718 echo "ARLIBS_BEGIN=-Wl,-z,allextract" >> $config_host_mak
1719 echo "ARLIBS_END=-Wl,-z,defaultextract" >> $config_host_mak
1720 elif check_linker_flags
-all_load ; then
1722 echo "ARLIBS_BEGIN=-all_load" >> $config_host_mak
1723 echo "ARLIBS_END=" >> $config_host_mak
1725 echo "Error: your linker does not support --whole-archive or -z."
1726 echo "Please report to qemu-devel@nongnu.org"
1731 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1732 tools
="qemu-img\$(EXESUF) $tools"
1733 if [ "$linux" = "yes" ] ; then
1734 tools
="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
1737 echo "TOOLS=$tools" >> $config_host_mak
1739 # Mac OS X ships with a broken assembler
1741 if test \
( "$cpu" = "i386" -o "$cpu" = "x86_64" \
) -a \
1742 "$targetos" != "Darwin" ; then
1745 echo "ROMS=$roms" >> $config_host_mak
1747 echo "prefix=$prefix" >> $config_host_mak
1748 echo "bindir=\${prefix}$binsuffix" >> $config_host_mak
1749 echo "mandir=\${prefix}$mansuffix" >> $config_host_mak
1750 echo "datadir=\${prefix}$datasuffix" >> $config_host_mak
1751 echo "docdir=\${prefix}$docsuffix" >> $config_host_mak
1752 echo "MAKE=$make" >> $config_host_mak
1753 echo "INSTALL=$install" >> $config_host_mak
1754 echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak
1755 echo "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak
1756 echo "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak
1757 echo "CC=$cc" >> $config_host_mak
1758 echo "HOST_CC=$host_cc" >> $config_host_mak
1759 if test "$sparse" = "yes" ; then
1760 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
1761 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
1762 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
1764 echo "AR=$ar" >> $config_host_mak
1765 echo "OBJCOPY=$objcopy" >> $config_host_mak
1766 echo "LD=$ld" >> $config_host_mak
1767 echo "CFLAGS=$CFLAGS $OS_CFLAGS $ARCH_CFLAGS $EXTRA_CFLAGS" >> $config_host_mak
1768 echo "LDFLAGS=$LDFLAGS $OS_LDFLAGS $ARCH_LDFLAGS $EXTRA_LDFLAGS" >> $config_host_mak
1769 echo "EXESUF=$EXESUF" >> $config_host_mak
1770 echo "PTHREADLIBS=$PTHREADLIBS" >> $config_host_mak
1771 echo "CLOCKLIBS=$CLOCKLIBS" >> $config_host_mak
1773 echo "/* Automatically generated by configure - do not modify */" > $config_host_h
1775 $SHELL $source_path/create_config
< $config_host_mak >> $config_host_h
1777 if test -f ${config_host_h}~
; then
1778 if cmp -s $config_host_h ${config_host_h}~
; then
1779 mv ${config_host_h}~
$config_host_h
1781 rm ${config_host_h}~
1785 # generate list of library paths for linker script
1787 $ld --verbose -v 2> /dev
/null |
grep SEARCH_DIR
> ${config_host_ld}
1789 if test -f ${config_host_ld}~
; then
1790 if cmp -s $config_host_ld ${config_host_ld}~
; then
1791 mv ${config_host_ld}~
$config_host_ld
1793 rm ${config_host_ld}~
1797 for target
in $target_list; do
1798 target_dir
="$target"
1799 config_mak
=$target_dir/config.mak
1800 config_h
=$target_dir/config.h
1801 target_arch2
=`echo $target | cut -d '-' -f 1`
1802 target_bigendian
="no"
1803 case "$target_arch2" in
1804 armeb|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|sh4eb|sparc|sparc64|sparc32plus
)
1805 target_bigendian
=yes
1809 target_user_only
="no"
1810 target_linux_user
="no"
1811 target_darwin_user
="no"
1812 target_bsd_user
="no"
1814 ${target_arch2}-softmmu)
1815 target_softmmu
="yes"
1817 ${target_arch2}-linux-user)
1818 target_user_only
="yes"
1819 target_linux_user
="yes"
1821 ${target_arch2}-darwin-user)
1822 target_user_only
="yes"
1823 target_darwin_user
="yes"
1825 ${target_arch2}-bsd-user)
1826 target_user_only
="yes"
1827 target_bsd_user
="yes"
1830 echo "ERROR: Target '$target' not recognised"
1835 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1837 test -f $config_h && mv $config_h ${config_h}~
1839 mkdir
-p $target_dir
1840 mkdir
-p $target_dir/fpu
1841 mkdir
-p $target_dir/tcg
1842 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
1843 mkdir
-p $target_dir/nwfpe
1847 # don't use ln -sf as not all "ln -sf" over write the file/link
1849 rm -f $target_dir/Makefile
1850 ln -s $source_path/Makefile.target
$target_dir/Makefile
1853 echo "# Automatically generated by configure - do not modify" > $config_mak
1855 echo "include ../config-host.mak" >> $config_mak
1860 interp_prefix1
=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
1861 echo "CONFIG_QEMU_PREFIX=\"$interp_prefix1\"" >> $config_mak
1864 TARGET_ARCH
="$target_arch2"
1868 case "$target_arch2" in
1873 TARGET_BASE_ARCH
=i386
1883 gdb_xml_files
="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
1892 gdb_xml_files
="cf-core.xml cf-fp.xml"
1902 echo "TARGET_ABI_MIPSO32=y" >> $config_mak
1908 TARGET_BASE_ARCH
=mips
1909 echo "TARGET_ABI_MIPSN32=y" >> $config_mak
1914 TARGET_BASE_ARCH
=mips
1915 echo "TARGET_ABI_MIPSN64=y" >> $config_mak
1919 gdb_xml_files
="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1924 TARGET_BASE_ARCH
=ppc
1926 gdb_xml_files
="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1931 TARGET_BASE_ARCH
=ppc
1933 gdb_xml_files
="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1938 TARGET_BASE_ARCH
=ppc
1940 echo "TARGET_ABI32=y" >> $config_mak
1941 gdb_xml_files
="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1954 TARGET_BASE_ARCH
=sparc
1960 TARGET_BASE_ARCH
=sparc
1961 TARGET_ABI_DIR
=sparc
1962 echo "TARGET_ABI32=y" >> $config_mak
1966 echo "Unsupported target CPU"
1970 echo "TARGET_ARCH=$TARGET_ARCH" >> $config_mak
1971 echo "TARGET_ARCH2=$target_arch2" >> $config_mak
1972 # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
1973 if [ "$TARGET_BASE_ARCH" = "" ]; then
1974 TARGET_BASE_ARCH
=$TARGET_ARCH
1976 echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_mak
1977 if [ "$TARGET_ABI_DIR" = "" ]; then
1978 TARGET_ABI_DIR
=$TARGET_ARCH
1980 echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_mak
1981 if [ $target_phys_bits -lt $hostlongbits ] ; then
1982 target_phys_bits
=$hostlongbits
1984 case "$target_arch2" in
1986 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
1987 echo "CONFIG_XEN=y" >> $config_mak
1989 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
1991 echo "CONFIG_KQEMU=y" >> $config_mak
1994 case "$target_arch2" in
1995 i386|x86_64|ppcemb|ppc|ppc64
)
1996 # Make sure the target and host cpus are compatible
1997 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
1998 \
( "$target_arch2" = "$cpu" -o \
1999 \
( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \
) -o \
2000 \
( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \
) -o \
2001 \
( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \
) -o \
2002 \
( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \
) \
) ; then
2003 echo "CONFIG_KVM=y" >> $config_mak
2004 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
2007 echo "HWLIB=../libhw$target_phys_bits/libqemuhw$target_phys_bits.a" >> $config_mak
2008 echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_mak
2009 echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
2010 if test "$target_bigendian" = "yes" ; then
2011 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_mak
2013 if test "$target_softmmu" = "yes" ; then
2014 echo "CONFIG_SOFTMMU=y" >> $config_mak
2016 if test "$target_user_only" = "yes" ; then
2017 echo "CONFIG_USER_ONLY=y" >> $config_mak
2019 if test "$target_linux_user" = "yes" ; then
2020 echo "CONFIG_LINUX_USER=y" >> $config_mak
2022 if test "$target_darwin_user" = "yes" ; then
2023 echo "CONFIG_DARWIN_USER=y" >> $config_mak
2026 if test ! -z "$gdb_xml_files" ; then
2027 for x
in $gdb_xml_files; do
2028 list
="$list $source_path/gdb-xml/$x"
2031 echo "TARGET_XML_FILES=$list" >> $config_mak
2033 case "$target_arch2" in
2034 arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|sparc|sparc64|sparc32plus
)
2035 echo "CONFIG_SOFTFLOAT=y" >> $config_mak
2039 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
2040 echo "TARGET_HAS_BFLT=y" >> $config_mak
2042 if test "$target_user_only" = "yes" \
2043 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
2044 echo "CONFIG_USE_NPTL=y" >> $config_mak
2046 # 32 bit ELF loader in addition to native 64 bit loader?
2047 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
2048 echo "TARGET_HAS_ELFLOAD32=y" >> $config_mak
2050 if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
2051 echo "CONFIG_USE_GUEST_BASE=y" >> $config_mak
2053 if test "$target_bsd_user" = "yes" ; then
2054 echo "CONFIG_BSD_USER=y" >> $config_mak
2057 # generate LDFLAGS for targets
2060 if test "$target_linux_user" = "yes" -o "$target_linux_user" = "yes" ; then
2063 if test "$gprof" = "yes" -o "$static" = "yes" ; then
2064 ldflags
='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld'
2066 # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
2067 # that the kernel ELF loader considers as an executable. I think this
2068 # is the simplest way to make it self virtualizable!
2069 ldflags
='-Wl,-shared'
2073 # -static is used to avoid g1/g3 usage by the dynamic linker
2074 ldflags
='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
2077 ldflags
='-Wl,-G0 -Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
2079 x86_64|ppc|ppc64|s390|sparc64|alpha|arm|m68k|mips|mips64
)
2080 ldflags
='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld'
2084 if test "$target_softmmu" = "yes" ; then
2087 ldflags
='-Wl,-G0 -Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
2092 if test "$ldflags" != "" ; then
2093 echo "LDFLAGS+=$ldflags" >> $config_mak
2096 echo "/* Automatically generated by configure - do not modify */" > $config_h
2097 echo "#include \"../config-host.h\"" >> $config_h
2099 $SHELL $source_path/create_config
< $config_mak >> $config_h
2101 if test -f ${config_h}~
; then
2102 if cmp -s $config_h ${config_h}~
; then
2103 mv ${config_h}~
$config_h
2109 done # for target in $targets
2111 # build tree in object directory if source path is different from current one
2112 if test "$source_path_used" = "yes" ; then
2113 DIRS
="tests tests/cris slirp audio block pc-bios/optionrom"
2114 FILES
="Makefile tests/Makefile"
2115 FILES
="$FILES tests/cris/Makefile tests/cris/.gdbinit"
2116 FILES
="$FILES tests/test-mmap.c"
2117 FILES
="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps pc-bios/video.x"
2118 for bios_file
in $source_path/pc-bios
/*.bin
$source_path/pc-bios
/*.dtb
$source_path/pc-bios
/openbios-
*; do
2119 FILES
="$FILES pc-bios/`basename $bios_file`"
2121 for dir
in $DIRS ; do
2124 # remove the link and recreate it, as not all "ln -sf" overwrite the link
2125 for f
in $FILES ; do
2127 ln -s $source_path/$f $f
2131 for hwlib
in 32 64; do
2135 ln -s $source_path/Makefile.hw
$d/Makefile
2136 echo "HWLIB=libqemuhw$hwlib.a" > $d/config.mak
2137 echo "CPPFLAGS=-DTARGET_PHYS_ADDR_BITS=$hwlib" >> $d/config.mak