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 TMPD="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.d"
19 trap "rm -f $TMPC $TMPO $TMPE $TMPD ; exit" 0 2 3 15
22 $cc $QEMU_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
28 $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags > /dev/null 2> /dev/null
34 interp_prefix="/usr/gnemul/qemu-%M"
40 audio_card_list="ac97 es1370 sb16"
41 audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus"
54 # parse CC options first
56 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
58 --cross-prefix=*) cross_prefix="$optarg"
62 --cpu=*) cpu="$optarg"
64 --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
66 --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
78 echo "undefined SPARC architecture. Exiting";
86 # Using uname is really, really broken. Once we have the right set of checks
87 # we can eliminate it's usage altogether
89 cc="${cross_prefix}${cc}"
90 ar="${cross_prefix}${ar}"
91 objcopy="${cross_prefix}${objcopy}"
92 ld="${cross_prefix}${ld}"
94 # check that the C compiler works.
99 if compile_object ; then
100 : C compiler works ok
102 echo "ERROR: \"$cc\" either does not exist or does not work"
111 int main(void) { return 0; }
116 if test ! -z "$cpu" ; then
117 # command line argument
119 elif check_define __i386__ ; then
121 elif check_define __x86_64__ ; then
123 elif check_define __sparc__ ; then
124 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
125 # They must be specified using --sparc_cpu
126 if check_define __arch64__ ; then
131 elif check_define _ARCH_PPC ; then
132 if check_define _ARCH_PPC64 ; then
143 alpha|cris|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|sparc64)
146 i386|i486|i586|i686|i86pc|BePC)
172 # Default value for a variable defining feature "foo"
173 # * foo="no", feature will only be used if --enable-foo arg is given
174 # * foo="", feature will be searched for, and if found, will be used
175 # * foo="yes", this value vill only be set by --enable-foo flag.
176 # feature will searched for, if not found, configure exits with error
178 # Always add --enable-foo and --disable-foo command line args. Distributions want
179 # to ensure that several features are compiled in, and it is impossible without a
180 # --enable-foo that exits if feature is not found
231 if check_define __linux__ ; then
233 elif check_define _WIN32 ; then
235 elif check_define __OpenBSD__ ; then
237 elif check_define __sun__ ; then
246 QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
247 audio_possible_drivers="winwave sdl"
248 audio_drv_list="winwave"
252 audio_possible_drivers="winwave dsound sdl fmod"
253 audio_drv_list="winwave"
257 audio_possible_drivers="oss sdl esd pa"
262 audio_possible_drivers="oss sdl esd pa"
267 audio_possible_drivers="oss sdl esd pa"
272 audio_possible_drivers="oss sdl esd"
278 audio_possible_drivers="oss sdl esd"
284 # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can
285 # run 64-bit userspace code
286 if [ "$cpu" = "i386" ] ; then
287 is_x86_64=`sysctl -n hw.optional.x86_64`
288 [ "$is_x86_64" = "1" ] && cpu=x86_64
290 if [ "$cpu" = "x86_64" ] ; then
291 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
292 LDFLAGS="-arch x86_64 $LDFLAGS"
294 QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
298 audio_drv_list="coreaudio"
299 audio_possible_drivers="coreaudio sdl fmod"
300 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
301 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
308 needs_libsunmath="no"
309 solarisrev=`uname -r | cut -f2 -d.`
310 # have to select again, because `uname -m` returns i86pc
311 # even on an x86_64 box.
312 solariscpu=`isainfo -k`
313 if test "${solariscpu}" = "amd64" ; then
316 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
317 if test "$solarisrev" -le 9 ; then
318 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
319 needs_libsunmath="yes"
320 QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
321 LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
322 LIBS="-lsunmath $LIBS"
324 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
325 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
326 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
327 echo "Studio 11 can be downloaded from www.sun.com."
332 if test -f /usr/include/sys/soundcard.h ; then
335 audio_possible_drivers="oss sdl"
336 # needed for CMSG_ macros in sys/socket.h
337 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
338 # needed for TIOCWIN* defines in termios.h
339 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
340 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
341 LIBS="-lsocket -lnsl -lresolv $LIBS"
349 audio_possible_drivers="oss alsa sdl esd pa"
353 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
354 audio_possible_drivers="$audio_possible_drivers fmod"
359 if [ "$bsd" = "yes" ] ; then
360 if [ "$darwin" != "yes" ] ; then
367 if test "$mingw32" = "yes" ; then
369 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
370 LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
374 source_path=`dirname "$0"`
375 source_path_used="no"
377 if [ -z "$source_path" ]; then
380 source_path=`cd "$source_path"; pwd`
382 [ -f "$workdir/vl.c" ] || source_path_used="yes"
387 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
389 --help|-h) show_help=yes
391 --prefix=*) prefix="$optarg"
393 --interp-prefix=*) interp_prefix="$optarg"
395 --source-path=*) source_path="$optarg"
396 source_path_used="yes"
402 --host-cc=*) host_cc="$optarg"
404 --make=*) make="$optarg"
406 --install=*) install="$optarg"
414 --target-list=*) target_list="$optarg"
416 --enable-gprof) gprof="yes"
418 --static) static="yes"
420 --disable-sdl) sdl="no"
422 --enable-sdl) sdl="yes"
424 --fmod-lib=*) fmod_lib="$optarg"
426 --fmod-inc=*) fmod_inc="$optarg"
428 --oss-lib=*) oss_lib="$optarg"
430 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
432 --audio-drv-list=*) audio_drv_list="$optarg"
434 --enable-debug-tcg) debug_tcg="yes"
436 --disable-debug-tcg) debug_tcg="no"
439 # Enable debugging options that aren't excessively noisy
444 --enable-sparse) sparse="yes"
446 --disable-sparse) sparse="no"
448 --disable-strip) strip_opt="no"
450 --disable-vnc-tls) vnc_tls="no"
452 --enable-vnc-tls) vnc_tls="yes"
454 --disable-vnc-sasl) vnc_sasl="no"
456 --enable-vnc-sasl) vnc_sasl="yes"
458 --disable-slirp) slirp="no"
460 --disable-uuid) uuid="no"
462 --enable-uuid) uuid="yes"
464 --disable-vde) vde="no"
466 --enable-vde) vde="yes"
468 --disable-xen) xen="no"
470 --enable-xen) xen="yes"
472 --disable-brlapi) brlapi="no"
474 --enable-brlapi) brlapi="yes"
476 --disable-bluez) bluez="no"
478 --enable-bluez) bluez="yes"
480 --disable-kvm) kvm="no"
482 --enable-kvm) kvm="yes"
484 --enable-profiler) profiler="yes"
489 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
491 --disable-system) softmmu="no"
493 --enable-system) softmmu="yes"
501 --disable-linux-user) linux_user="no"
503 --enable-linux-user) linux_user="yes"
505 --disable-darwin-user) darwin_user="no"
507 --enable-darwin-user) darwin_user="yes"
509 --disable-bsd-user) bsd_user="no"
511 --enable-bsd-user) bsd_user="yes"
513 --enable-guest-base) guest_base="yes"
515 --disable-guest-base) guest_base="no"
517 --enable-user-pie) user_pie="yes"
519 --disable-user-pie) user_pie="no"
521 --enable-uname-release=*) uname_release="$optarg"
525 --enable-werror) werror="yes"
527 --disable-werror) werror="no"
529 --disable-curses) curses="no"
531 --enable-curses) curses="yes"
533 --disable-curl) curl="no"
535 --enable-curl) curl="yes"
537 --disable-fdt) fdt="no"
539 --enable-fdt) fdt="yes"
541 --disable-check-utests) check_utests="no"
543 --enable-check-utests) check_utests="yes"
545 --disable-nptl) nptl="no"
547 --enable-nptl) nptl="yes"
549 --enable-mixemu) mixemu="yes"
551 --disable-linux-aio) linux_aio="no"
553 --enable-linux-aio) linux_aio="yes"
555 --enable-io-thread) io_thread="yes"
557 --disable-blobs) blobs="no"
559 --kerneldir=*) kerneldir="$optarg"
561 --with-pkgversion=*) pkgversion=" ($optarg)"
563 --disable-docs) docs="no"
565 --enable-docs) docs="yes"
567 *) echo "ERROR: unknown option $opt"; show_help="yes"
573 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
574 # QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
578 sparc) case $sparc_cpu in
580 QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
583 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
585 *) # sparc_cpu not defined in the command line
586 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
588 LDFLAGS="-m32 $LDFLAGS"
589 QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
590 if test "$solaris" = "no" ; then
591 QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
592 helper_cflags="-ffixed-i0"
596 QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
597 LDFLAGS="-m64 $LDFLAGS"
598 QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
599 if test "$solaris" != "no" ; then
600 QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
604 QEMU_CFLAGS="-march=z900 $QEMU_CFLAGS"
607 QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
608 LDFLAGS="-m32 $LDFLAGS"
609 helper_cflags="-fomit-frame-pointer"
610 host_guest_base="yes"
613 QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
614 LDFLAGS="-m64 $LDFLAGS"
615 host_guest_base="yes"
618 host_guest_base="yes"
621 host_guest_base="yes"
625 [ -z "$guest_base" ] && guest_base="$host_guest_base"
627 if test x"$show_help" = x"yes" ; then
630 Usage: configure [options]
631 Options: [defaults in brackets after descriptions]
634 echo "Standard options:"
635 echo " --help print this message"
636 echo " --prefix=PREFIX install in PREFIX [$prefix]"
637 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
638 echo " use %M for cpu name [$interp_prefix]"
639 echo " --target-list=LIST set target list [$target_list]"
641 echo "Advanced options (experts only):"
642 echo " --source-path=PATH path of source code [$source_path]"
643 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
644 echo " --cc=CC use C compiler CC [$cc]"
645 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
646 echo " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS"
647 echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS"
648 echo " --make=MAKE use specified make [$make]"
649 echo " --install=INSTALL use specified install [$install]"
650 echo " --static enable static build [$static]"
651 echo " --enable-debug-tcg enable TCG debugging"
652 echo " --disable-debug-tcg disable TCG debugging (default)"
653 echo " --enable-debug enable common debug build options"
654 echo " --enable-sparse enable sparse checker"
655 echo " --disable-sparse disable sparse checker (default)"
656 echo " --disable-strip disable stripping binaries"
657 echo " --disable-werror disable compilation abort on warning"
658 echo " --disable-sdl disable SDL"
659 echo " --enable-sdl enable SDL"
660 echo " --enable-cocoa enable COCOA (Mac OS X only)"
661 echo " --audio-drv-list=LIST set audio drivers list:"
662 echo " Available drivers: $audio_possible_drivers"
663 echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
664 echo " Available cards: $audio_possible_cards"
665 echo " --enable-mixemu enable mixer emulation"
666 echo " --disable-xen disable xen backend driver support"
667 echo " --enable-xen enable xen backend driver support"
668 echo " --disable-brlapi disable BrlAPI"
669 echo " --enable-brlapi enable BrlAPI"
670 echo " --disable-vnc-tls disable TLS encryption for VNC server"
671 echo " --enable-vnc-tls enable TLS encryption for VNC server"
672 echo " --disable-vnc-sasl disable SASL encryption for VNC server"
673 echo " --enable-vnc-sasl enable SASL encryption for VNC server"
674 echo " --disable-curses disable curses output"
675 echo " --enable-curses enable curses output"
676 echo " --disable-curl disable curl connectivity"
677 echo " --enable-curl enable curl connectivity"
678 echo " --disable-fdt disable fdt device tree"
679 echo " --enable-fdt enable fdt device tree"
680 echo " --disable-check-utests disable check unit-tests"
681 echo " --enable-check-utests enable check unit-tests"
682 echo " --disable-bluez disable bluez stack connectivity"
683 echo " --enable-bluez enable bluez stack connectivity"
684 echo " --disable-kvm disable KVM acceleration support"
685 echo " --enable-kvm enable KVM acceleration support"
686 echo " --disable-nptl disable usermode NPTL support"
687 echo " --enable-nptl enable usermode NPTL support"
688 echo " --enable-system enable all system emulation targets"
689 echo " --disable-system disable all system emulation targets"
690 echo " --enable-user enable supported user emulation targets"
691 echo " --disable-user disable all user emulation targets"
692 echo " --enable-linux-user enable all linux usermode emulation targets"
693 echo " --disable-linux-user disable all linux usermode emulation targets"
694 echo " --enable-darwin-user enable all darwin usermode emulation targets"
695 echo " --disable-darwin-user disable all darwin usermode emulation targets"
696 echo " --enable-bsd-user enable all BSD usermode emulation targets"
697 echo " --disable-bsd-user disable all BSD usermode emulation targets"
698 echo " --enable-guest-base enable GUEST_BASE support for usermode"
699 echo " emulation targets"
700 echo " --disable-guest-base disable GUEST_BASE support"
701 echo " --enable-user-pie build usermode emulation targets as PIE"
702 echo " --disable-user-pie do not build usermode emulation targets as PIE"
703 echo " --fmod-lib path to FMOD library"
704 echo " --fmod-inc path to FMOD includes"
705 echo " --oss-lib path to OSS library"
706 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
707 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
708 echo " --disable-uuid disable uuid support"
709 echo " --enable-uuid enable uuid support"
710 echo " --disable-vde disable support for vde network"
711 echo " --enable-vde enable support for vde network"
712 echo " --disable-linux-aio disable Linux AIO support"
713 echo " --enable-linux-aio enable Linux AIO support"
714 echo " --enable-io-thread enable IO thread"
715 echo " --disable-blobs disable installing provided firmware blobs"
716 echo " --kerneldir=PATH look for kernel includes in PATH"
718 echo "NOTE: The object files are built at the place where configure is launched"
723 # Solaris specific configure tool chain decisions
725 if test "$solaris" = "yes" ; then
726 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
727 if test -z "$solinst" ; then
728 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
729 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
730 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
733 if test "$solinst" = "/usr/sbin/install" ; then
734 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
735 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
736 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
739 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
740 if test -z "$sol_ar" ; then
741 echo "Error: No path includes ar"
742 if test -f /usr/ccs/bin/ar ; then
743 echo "Add /usr/ccs/bin to your path and rerun configure"
750 if test -z "$target_list" ; then
751 # these targets are portable
752 if [ "$softmmu" = "yes" ] ; then
773 # the following are Linux specific
774 if [ "$linux_user" = "yes" ] ; then
775 target_list="${target_list}\
783 microblaze-linux-user \
788 ppc64abi32-linux-user \
793 sparc32plus-linux-user \
796 # the following are Darwin specific
797 if [ "$darwin_user" = "yes" ] ; then
798 target_list="$target_list i386-darwin-user ppc-darwin-user "
800 # the following are BSD specific
801 if [ "$bsd_user" = "yes" ] ; then
802 target_list="${target_list}\
810 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
812 if test -z "$target_list" ; then
813 echo "No targets enabled"
817 feature_not_found() {
821 echo "ERROR: User requested feature $feature"
822 echo "ERROR: configure was not able to find it"
827 if test -z "$cross_prefix" ; then
830 # big/little endian test
832 #include <inttypes.h>
833 int main(int argc, char ** argv){
834 volatile uint32_t i=0x01234567;
835 return (*((uint8_t*)(&i))) == 0x67;
839 if compile_prog "" "" ; then
840 $TMPE && bigendian="yes"
842 echo big/little test failed
847 # if cross compiling, cannot launch a program, so make a static guess
849 armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|sparc|sparc64)
856 # host long bits test
859 x86_64|alpha|ia64|sparc64|ppc64)
865 ##########################################
868 if test "$nptl" != "no" ; then
871 #include <linux/futex.h>
874 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
880 if compile_object ; then
883 if test "$nptl" = "yes" ; then
884 feature_not_found "nptl"
890 ##########################################
895 int main(void) { zlibVersion(); return 0; }
897 if compile_prog "" "-lz" ; then
901 echo "Error: zlib check failed"
902 echo "Make sure to have the zlib libs and headers installed."
907 ##########################################
910 if test "$xen" != "no" ; then
911 xen_libs="-lxenstore -lxenctrl -lxenguest"
915 int main(void) { xs_daemon_open(); xc_interface_open(); return 0; }
917 if compile_prog "" "$xen_libs" ; then
919 libs_softmmu="$xen_libs $libs_softmmu"
921 if test "$xen" = "yes" ; then
922 feature_not_found "xen"
928 ##########################################
930 if test "$sparse" != "no" ; then
931 if test -x "$(which cgcc 2>/dev/null)"; then
934 if test "$sparse" = "yes" ; then
935 feature_not_found "sparse"
941 ##########################################
946 if test "$sdl" != "no" ; then
949 #undef main /* We don't want SDL to override our main() */
950 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
952 sdl_cflags=`sdl-config --cflags 2> /dev/null`
953 sdl_libs=`sdl-config --libs 2> /dev/null`
954 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
955 _sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
956 if test "$_sdlversion" -lt 121 ; then
959 if test "$cocoa" = "no" ; then
964 # static link with sdl ?
965 if test "$sdl" = "yes" -a "$static" = "yes" ; then
966 sdl_libs=`sdl-config --static-libs 2>/dev/null`
967 if test `sdl-config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` ; then
968 sdl_libs="$sdl_libs `aalib-config --static-libs >2 /dev/null`"
969 sdl_cflags="$sd_cflags `aalib-config --cflags >2 /dev/null`"
971 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
978 if test "$sdl" = "yes" ; then
979 feature_not_found "sdl"
982 fi # sdl compile test
985 if test "$sdl" = "yes" ; then
988 #if defined(SDL_VIDEO_DRIVER_X11)
989 #include <X11/XKBlib.h>
991 #error No x11 support
993 int main(void) { return 0; }
995 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
996 sdl_libs="$sdl_libs -lX11"
998 if test "$mingw32" = "yes" ; then
999 sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole"
1001 libs_softmmu="$sdl_libs $libs_softmmu"
1004 ##########################################
1006 if test "$vnc_tls" != "no" ; then
1008 #include <gnutls/gnutls.h>
1009 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1011 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
1012 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
1013 if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
1015 libs_softmmu="$vnc_tls_libs $libs_softmmu"
1017 if test "$vnc_tls" = "yes" ; then
1018 feature_not_found "vnc-tls"
1024 ##########################################
1025 # VNC SASL detection
1026 if test "$vnc_sasl" != "no" ; then
1028 #include <sasl/sasl.h>
1030 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
1032 # Assuming Cyrus-SASL installed in /usr prefix
1034 vnc_sasl_libs="-lsasl2"
1035 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1037 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
1039 if test "$vnc_sasl" = "yes" ; then
1040 feature_not_found "vnc-sasl"
1046 ##########################################
1047 # fnmatch() probe, used for ACL routines
1050 #include <fnmatch.h>
1053 fnmatch("foo", "foo", 0);
1057 if compile_prog "" "" ; then
1061 ##########################################
1062 # uuid_generate() probe, used for vdi block driver
1063 if test "$uuid" != "no" ; then
1066 #include <uuid/uuid.h>
1070 uuid_generate(my_uuid);
1074 if compile_prog "" "$uuid_libs" ; then
1076 libs_softmmu="$uuid_libs $libs_softmmu"
1077 libs_tools="$uuid_libs $libs_tools"
1079 if test "$uuid" = "yes" ; then
1080 feature_not_found "uuid"
1086 ##########################################
1087 # vde libraries probe
1088 if test "$vde" != "no" ; then
1089 vde_libs="-lvdeplug"
1091 #include <libvdeplug.h>
1094 struct vde_open_args a = {0, 0, 0};
1095 vde_open("", "", &a);
1099 if compile_prog "" "$vde_libs" ; then
1101 libs_softmmu="$vde_libs $libs_softmmu"
1102 libs_tools="$vde_libs $libs_tools"
1104 if test "$vde" = "yes" ; then
1105 feature_not_found "vde"
1111 ##########################################
1112 # Sound support libraries probe
1123 int main(void) { $exp }
1125 if compile_prog "$cfl" "$lib" ; then
1129 echo "Error: $drv check failed"
1130 echo "Make sure to have the $drv libs and headers installed."
1136 audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1137 for drv in $audio_drv_list; do
1140 audio_drv_probe $drv alsa/asoundlib.h -lasound \
1141 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1142 libs_softmmu="-lasound $libs_softmmu"
1146 if test -z $fmod_lib || test -z $fmod_inc; then
1148 echo "Error: You must specify path to FMOD library and headers"
1149 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1153 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1154 libs_softmmu="$fmod_lib $libs_softmmu"
1158 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1159 libs_softmmu="-lesd $libs_softmmu"
1164 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
1165 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1166 libs_softmmu="-lpulse-simple $libs_softmmu"
1171 libs_softmmu="-framework CoreAudio $libs_softmmu"
1175 libs_softmmu="-lole32 -ldxguid $libs_softmmu"
1180 libs_softmmu="$oss_lib $libs_softmmu"
1184 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1188 libs_softmmu="-lwinmm $libs_softmmu"
1193 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
1195 echo "Error: Unknown driver '$drv' selected"
1196 echo "Possible drivers are: $audio_possible_drivers"
1204 ##########################################
1207 if test "$brlapi" != "no" ; then
1208 brlapi_libs="-lbrlapi"
1211 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1213 if compile_prog "" "$brlapi_libs" ; then
1215 libs_softmmu="$brlapi_libs $libs_softmmu"
1217 if test "$brlapi" = "yes" ; then
1218 feature_not_found "brlapi"
1224 ##########################################
1226 curses_list="-lncurses -lcurses"
1228 if test "$curses" != "no" ; then
1233 #define resize_term resizeterm
1235 int main(void) { resize_term(0, 0); return curses_version(); }
1237 for curses_lib in $curses_list; do
1238 if compile_prog "" "$curses_lib" ; then
1240 libs_softmmu="$curses_lib $libs_softmmu"
1244 if test "$curses_found" = "yes" ; then
1247 if test "$curses" = "yes" ; then
1248 feature_not_found "curses"
1254 ##########################################
1257 if test "$curl" != "no" ; then
1259 #include <curl/curl.h>
1260 int main(void) { return curl_easy_init(); }
1262 curl_cflags=`curl-config --cflags 2>/dev/null`
1263 curl_libs=`curl-config --libs 2>/dev/null`
1264 if compile_prog "$curl_cflags" "$curl_libs" ; then
1266 libs_tools="$curl_libs $libs_tools"
1267 libs_softmmu="$curl_libs $libs_softmmu"
1269 if test "$curl" = "yes" ; then
1270 feature_not_found "curl"
1276 ##########################################
1277 # check framework probe
1279 if test "$check_utests" != "no" ; then
1282 int main(void) { suite_create("qemu test"); return 0; }
1284 check_libs=`pkg-config --libs check`
1285 if compile_prog "" $check_libs ; then
1287 libs_tools="$check_libs $libs_tools"
1289 if test "$check_utests" = "yes" ; then
1290 feature_not_found "check"
1294 fi # test "$check_utests"
1296 ##########################################
1297 # bluez support probe
1298 if test "$bluez" != "no" ; then
1300 #include <bluetooth/bluetooth.h>
1301 int main(void) { return bt_error(0); }
1303 bluez_cflags=`pkg-config --cflags bluez 2> /dev/null`
1304 bluez_libs=`pkg-config --libs bluez 2> /dev/null`
1305 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
1307 libs_softmmu="$bluez_libs $libs_softmmu"
1309 if test "$bluez" = "yes" ; then
1310 feature_not_found "bluez"
1316 ##########################################
1318 if test "$kvm" != "no" ; then
1320 #include <linux/kvm.h>
1321 #if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
1322 #error Invalid KVM version
1324 #if !defined(KVM_CAP_USER_MEMORY)
1325 #error Missing KVM capability KVM_CAP_USER_MEMORY
1327 #if !defined(KVM_CAP_SET_TSS_ADDR)
1328 #error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1330 #if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1331 #error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1333 int main(void) { return 0; }
1335 if test "$kerneldir" != "" ; then
1336 kvm_cflags=-I"$kerneldir"/include
1337 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1338 -a -d "$kerneldir/arch/x86/include" ; then
1339 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
1340 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1341 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
1342 elif test -d "$kerneldir/arch/$cpu/include" ; then
1343 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1348 if compile_prog "$kvm_cflags" "" ; then
1351 if test "$kvm" = "yes" ; then
1352 if [ -x "`which awk 2>/dev/null`" ] && \
1353 [ -x "`which grep 2>/dev/null`" ]; then
1354 kvmerr=`LANG=C $cc $QEMU_CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \
1356 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1357 if test "$kvmerr" != "" ; then
1358 echo -e "${kvmerr}\n\
1359 NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \
1360 recent kvm-kmod from http://sourceforge.net/projects/kvm."
1363 feature_not_found "kvm"
1369 ##########################################
1371 PTHREADLIBS_LIST="-lpthread -lpthreadGC2"
1375 #include <pthread.h>
1376 int main(void) { pthread_create(0,0,0,0); return 0; }
1378 for pthread_lib in $PTHREADLIBS_LIST; do
1379 if compile_prog "" "$pthread_lib" ; then
1381 LIBS="$pthread_lib $LIBS"
1386 if test "$mingw32" != yes -a "$pthread" = no; then
1388 echo "Error: pthread check failed"
1389 echo "Make sure to have the pthread libs and headers installed."
1394 ##########################################
1397 if test "$linux_aio" != "no" ; then
1400 #include <sys/eventfd.h>
1401 int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
1403 if compile_prog "" "-laio" ; then
1407 if test "$linux_aio" = "yes" ; then
1408 feature_not_found "linux AIO"
1414 ##########################################
1417 #include <sys/types.h>
1418 #include <sys/uio.h>
1420 int main(void) { struct iovec iov; return 0; }
1423 if compile_prog "" "" ; then
1427 ##########################################
1430 #include <sys/types.h>
1431 #include <sys/uio.h>
1433 int main(void) { preadv; }
1436 if compile_prog "" "" ; then
1440 ##########################################
1442 if test "$fdt" != "no" ; then
1445 int main(void) { return 0; }
1447 if compile_prog "" "$fdt_libs" ; then
1449 libs_softmmu="$fdt_libs $libs_softmmu"
1451 if test "$fdt" = "yes" ; then
1452 feature_not_found "fdt"
1459 # Check for xxxat() functions when we are building linux-user
1460 # emulator. This is done because older glibc versions don't
1461 # have syscall stubs for these implemented.
1465 #define _ATFILE_SOURCE
1466 #include <sys/types.h>
1473 /* try to unlink nonexisting file */
1474 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1477 if compile_prog "" "" ; then
1481 # Check for inotify functions when we are building linux-user
1482 # emulator. This is done because older glibc versions don't
1483 # have syscall stubs for these implemented. In that case we
1484 # don't provide them even if kernel supports them.
1488 #include <sys/inotify.h>
1493 /* try to start inotify */
1494 return inotify_init();
1497 if compile_prog "" "" ; then
1501 # check if utimensat and futimens are supported
1504 #define _ATFILE_SOURCE
1511 utimensat(AT_FDCWD, "foo", NULL, 0);
1516 if compile_prog "" "" ; then
1520 # check if pipe2 is there
1530 pipe2(pipefd, O_CLOEXEC);
1534 if compile_prog "" "" ; then
1538 # check if tee/splice is there. vmsplice was added same time.
1549 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
1550 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
1554 if compile_prog "" "" ; then
1558 # check if eventfd is supported
1561 #include <sys/eventfd.h>
1565 int efd = eventfd(0, 0);
1569 if compile_prog "" "" ; then
1573 # Check if tools are available to build documentation.
1574 if test "$docs" != "no" ; then
1575 if test -x "`which texi2html 2>/dev/null`" -a \
1576 -x "`which pod2man 2>/dev/null`" ; then
1579 if test "$docs" = "yes" ; then
1580 feature_not_found "docs"
1586 # Search for bsawp_32 function
1589 #include <byteswap.h>
1590 int main(void) { return bswap_32(0); }
1592 if compile_prog "" "" ; then
1596 # Search for bsawp_32 function
1599 #include <sys/endian.h>
1600 #include <sys/types.h>
1601 #include <machine/bswap.h>
1602 int main(void) { return bswap32(0); }
1604 if compile_prog "" "" ; then
1608 ##########################################
1613 int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1616 if compile_prog "" "" ; then
1618 elif compile_prog "" "-lrt" ; then
1622 # Determine what linker flags to use to force archive inclusion
1623 check_linker_flags()
1629 compile_prog "" "-Wl,$1 ${w2}"
1635 if check_linker_flags --whole-archive --no-whole-archive ; then
1637 arlibs_begin="-Wl,--whole-archive"
1638 arlibs_end="-Wl,--no-whole-archive"
1639 elif check_linker_flags -z,allextract -z,defaultextract ; then
1641 arlibs_begin="-Wl,-z,allextract"
1642 arlibs_end="-Wl,-z,defaultextract"
1643 elif check_linker_flags -all_load ; then
1645 arlibs_begin="-all_load"
1648 echo "Error: your linker does not support --whole-archive or -z."
1653 if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
1654 "$aix" != "yes" ; then
1655 libs_softmmu="-lutil $libs_softmmu"
1658 ##########################################
1659 # check if the compiler defines offsetof
1664 int main(void) { struct s { int f; }; return offsetof(struct s, f); }
1666 if compile_prog "" "" ; then
1670 ##########################################
1671 # check if we have fdatasync
1676 int main(void) { return fdatasync(0); }
1678 if compile_prog "" "" ; then
1683 # After here, no more $cc or $ld runs
1685 # default flags for all hosts
1686 QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
1688 if test "$debug" = "no" ; then
1689 CFLAGS="-O2 $CFLAGS"
1691 QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
1692 QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
1693 QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
1694 QEMU_CFLAGS="-U_FORTIFY_SOURCE $QEMU_CFLAGS"
1695 QEMU_CFLAGS="-I. -I\$(SRC_PATH) -MMD -MP -MT \$@ $QEMU_CFLAGS"
1696 LDFLAGS="-g $LDFLAGS"
1698 gcc_flags="-Wold-style-declaration -Wold-style-definition"
1702 for flag in $gcc_flags; do
1703 if compile_prog "$QEMU_CFLAGS" "$flag" ; then
1704 QEMU_CFLAGS="$flag $QEMU_CFLAGS"
1708 # Consult white-list to determine whether to enable werror
1709 # by default. Only enable by default for git builds
1710 if test -z "$werror" ; then
1711 z_version=`cut -f3 -d. $source_path/VERSION`
1712 if test "$z_version" = "50" -a \
1713 "$linux" = "yes" ; then
1720 if test "$werror" = "yes" ; then
1721 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
1724 if test "$solaris" = "no" ; then
1725 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
1726 LDFLAGS="-Wl,--warn-common $LDFLAGS"
1730 if test "$mingw32" = "yes" ; then
1731 if test -z "$prefix" ; then
1732 prefix="c:/Program Files/Qemu"
1739 if test -z "$prefix" ; then
1742 mansuffix="/share/man"
1743 datasuffix="/share/qemu"
1744 docsuffix="/share/doc/qemu"
1748 echo "Install prefix $prefix"
1749 echo "BIOS directory $prefix$datasuffix"
1750 echo "binary directory $prefix$binsuffix"
1751 if test "$mingw32" = "no" ; then
1752 echo "Manual directory $prefix$mansuffix"
1753 echo "ELF interp prefix $interp_prefix"
1755 echo "Source path $source_path"
1756 echo "C compiler $cc"
1757 echo "Host C compiler $host_cc"
1758 echo "CFLAGS $CFLAGS"
1759 echo "QEMU_CFLAGS $QEMU_CFLAGS"
1760 echo "LDFLAGS $LDFLAGS"
1762 echo "install $install"
1763 echo "host CPU $cpu"
1764 echo "host big endian $bigendian"
1765 echo "target list $target_list"
1766 echo "tcg debug enabled $debug_tcg"
1767 echo "gprof enabled $gprof"
1768 echo "sparse enabled $sparse"
1769 echo "strip binaries $strip_opt"
1770 echo "profiler $profiler"
1771 echo "static build $static"
1772 echo "-Werror enabled $werror"
1773 if test "$darwin" = "yes" ; then
1774 echo "Cocoa support $cocoa"
1776 echo "SDL support $sdl"
1777 echo "curses support $curses"
1778 echo "curl support $curl"
1779 echo "check support $check_utests"
1780 echo "mingw32 support $mingw32"
1781 echo "Audio drivers $audio_drv_list"
1782 echo "Extra audio cards $audio_card_list"
1783 echo "Mixer emulation $mixemu"
1784 echo "VNC TLS support $vnc_tls"
1785 echo "VNC SASL support $vnc_sasl"
1786 if test -n "$sparc_cpu"; then
1787 echo "Target Sparc Arch $sparc_cpu"
1789 echo "xen support $xen"
1790 echo "brlapi support $brlapi"
1791 echo "bluez support $bluez"
1792 echo "Documentation $docs"
1793 [ ! -z "$uname_release" ] && \
1794 echo "uname -r $uname_release"
1795 echo "NPTL support $nptl"
1796 echo "GUEST_BASE $guest_base"
1797 echo "PIE user targets $user_pie"
1798 echo "vde support $vde"
1799 echo "IO thread $io_thread"
1800 echo "Linux AIO support $linux_aio"
1801 echo "Install blobs $blobs"
1802 echo "KVM support $kvm"
1803 echo "fdt support $fdt"
1804 echo "preadv support $preadv"
1805 echo "fdatasync $fdatasync"
1806 echo "uuid support $uuid"
1808 if test $sdl_too_old = "yes"; then
1809 echo "-> Your SDL version is too old - please upgrade to have SDL support"
1812 config_host_mak="config-host.mak"
1813 config_host_ld="config-host.ld"
1815 echo "# Automatically generated by configure - do not modify" > $config_host_mak
1816 printf "# Configured with:" >> $config_host_mak
1817 printf " '%s'" "$0" "$@" >> $config_host_mak
1818 echo >> $config_host_mak
1820 echo "CONFIG_QEMU_SHAREDIR=\"$prefix$datasuffix\"" >> $config_host_mak
1823 i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|sparc|sparc64)
1830 echo "Unsupported CPU = $cpu"
1834 echo "ARCH=$ARCH" >> $config_host_mak
1835 if test "$debug_tcg" = "yes" ; then
1836 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
1838 if test "$debug" = "yes" ; then
1839 echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
1841 if test "$strip_opt" = "yes" ; then
1842 echo "STRIP_OPT=-s" >> $config_host_mak
1844 if test "$bigendian" = "yes" ; then
1845 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
1847 echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
1848 if test "$mingw32" = "yes" ; then
1849 echo "CONFIG_WIN32=y" >> $config_host_mak
1851 echo "CONFIG_POSIX=y" >> $config_host_mak
1854 if test "$darwin" = "yes" ; then
1855 echo "CONFIG_DARWIN=y" >> $config_host_mak
1858 if test "$aix" = "yes" ; then
1859 echo "CONFIG_AIX=y" >> $config_host_mak
1862 if test "$solaris" = "yes" ; then
1863 echo "CONFIG_SOLARIS=y" >> $config_host_mak
1864 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
1865 if test "$needs_libsunmath" = "yes" ; then
1866 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
1869 if test "$static" = "yes" ; then
1870 echo "CONFIG_STATIC=y" >> $config_host_mak
1871 LDFLAGS="-static $LDFLAGS"
1873 if test $profiler = "yes" ; then
1874 echo "CONFIG_PROFILER=y" >> $config_host_mak
1876 if test "$slirp" = "yes" ; then
1877 echo "CONFIG_SLIRP=y" >> $config_host_mak
1878 QEMU_CFLAGS="-I\$(SRC_PATH)/slirp $QEMU_CFLAGS"
1880 if test "$vde" = "yes" ; then
1881 echo "CONFIG_VDE=y" >> $config_host_mak
1883 for card in $audio_card_list; do
1884 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
1885 echo "$def=y" >> $config_host_mak
1887 echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
1888 for drv in $audio_drv_list; do
1889 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
1890 echo "$def=y" >> $config_host_mak
1891 if test "$drv" = "fmod"; then
1892 echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
1895 if test "$audio_pt_int" = "yes" ; then
1896 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
1898 if test "$audio_win_int" = "yes" ; then
1899 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
1901 if test "$mixemu" = "yes" ; then
1902 echo "CONFIG_MIXEMU=y" >> $config_host_mak
1904 if test "$vnc_tls" = "yes" ; then
1905 echo "CONFIG_VNC_TLS=y" >> $config_host_mak
1906 echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
1908 if test "$vnc_sasl" = "yes" ; then
1909 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
1910 echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
1912 if test "$fnmatch" = "yes" ; then
1913 echo "CONFIG_FNMATCH=y" >> $config_host_mak
1915 if test "$uuid" = "yes" ; then
1916 echo "CONFIG_UUID=y" >> $config_host_mak
1918 qemu_version=`head $source_path/VERSION`
1919 echo "VERSION=$qemu_version" >>$config_host_mak
1920 echo "PKGVERSION=$pkgversion" >>$config_host_mak
1921 echo "SRC_PATH=$source_path" >> $config_host_mak
1922 if [ "$source_path_used" = "yes" ]; then
1923 echo "VPATH=$source_path" >> $config_host_mak
1925 echo "TARGET_DIRS=$target_list" >> $config_host_mak
1926 if [ "$docs" = "yes" ] ; then
1927 echo "BUILD_DOCS=yes" >> $config_host_mak
1929 if test "$sdl" = "yes" ; then
1930 echo "CONFIG_SDL=y" >> $config_host_mak
1931 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
1933 if test "$cocoa" = "yes" ; then
1934 echo "CONFIG_COCOA=y" >> $config_host_mak
1936 if test "$curses" = "yes" ; then
1937 echo "CONFIG_CURSES=y" >> $config_host_mak
1939 if test "$atfile" = "yes" ; then
1940 echo "CONFIG_ATFILE=y" >> $config_host_mak
1942 if test "$utimens" = "yes" ; then
1943 echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
1945 if test "$pipe2" = "yes" ; then
1946 echo "CONFIG_PIPE2=y" >> $config_host_mak
1948 if test "$splice" = "yes" ; then
1949 echo "CONFIG_SPLICE=y" >> $config_host_mak
1951 if test "$eventfd" = "yes" ; then
1952 echo "CONFIG_EVENTFD=y" >> $config_host_mak
1954 if test "$inotify" = "yes" ; then
1955 echo "CONFIG_INOTIFY=y" >> $config_host_mak
1957 if test "$byteswap_h" = "yes" ; then
1958 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
1960 if test "$bswap_h" = "yes" ; then
1961 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
1963 if test "$curl" = "yes" ; then
1964 echo "CONFIG_CURL=y" >> $config_host_mak
1965 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
1967 if test "$brlapi" = "yes" ; then
1968 echo "CONFIG_BRLAPI=y" >> $config_host_mak
1970 if test "$bluez" = "yes" ; then
1971 echo "CONFIG_BLUEZ=y" >> $config_host_mak
1972 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
1974 if test "$xen" = "yes" ; then
1975 echo "CONFIG_XEN=y" >> $config_host_mak
1977 if test "$io_thread" = "yes" ; then
1978 echo "CONFIG_IOTHREAD=y" >> $config_host_mak
1980 if test "$linux_aio" = "yes" ; then
1981 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
1983 if test "$blobs" = "yes" ; then
1984 echo "INSTALL_BLOBS=yes" >> $config_host_mak
1986 if test "$iovec" = "yes" ; then
1987 echo "CONFIG_IOVEC=y" >> $config_host_mak
1989 if test "$preadv" = "yes" ; then
1990 echo "CONFIG_PREADV=y" >> $config_host_mak
1992 if test "$fdt" = "yes" ; then
1993 echo "CONFIG_FDT=y" >> $config_host_mak
1995 if test "$need_offsetof" = "yes" ; then
1996 echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
1998 if test "$fdatasync" = "yes" ; then
1999 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
2002 # XXX: suppress that
2003 if [ "$bsd" = "yes" ] ; then
2004 echo "CONFIG_BSD=y" >> $config_host_mak
2007 echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
2012 echo "HOST_USB=linux" >> $config_host_mak
2015 echo "HOST_USB=bsd" >> $config_host_mak
2018 echo "HOST_USB=stub" >> $config_host_mak
2023 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
2024 tools="qemu-img\$(EXESUF) $tools"
2025 if [ "$linux" = "yes" ] ; then
2026 tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
2027 if [ "$check_utests" = "yes" ]; then
2028 tools="check-qint check-qstring check-qdict check-qlist $tools"
2030 elif test "$mingw32" = "yes" ; then
2031 tools="qemu-io\$(EXESUF) $tools"
2034 echo "TOOLS=$tools" >> $config_host_mak
2036 # Mac OS X ships with a broken assembler
2038 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
2039 "$targetos" != "Darwin" -a \
2040 `expr "$target_list" : ".*softmmu.*"` != 0 ; then
2043 echo "ROMS=$roms" >> $config_host_mak
2045 echo "prefix=$prefix" >> $config_host_mak
2046 echo "bindir=\${prefix}$binsuffix" >> $config_host_mak
2047 echo "mandir=\${prefix}$mansuffix" >> $config_host_mak
2048 echo "datadir=\${prefix}$datasuffix" >> $config_host_mak
2049 echo "docdir=\${prefix}$docsuffix" >> $config_host_mak
2050 echo "MAKE=$make" >> $config_host_mak
2051 echo "INSTALL=$install" >> $config_host_mak
2052 echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak
2053 echo "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak
2054 echo "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak
2055 echo "CC=$cc" >> $config_host_mak
2056 echo "HOST_CC=$host_cc" >> $config_host_mak
2057 if test "$sparse" = "yes" ; then
2058 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
2059 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
2060 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
2062 echo "AR=$ar" >> $config_host_mak
2063 echo "OBJCOPY=$objcopy" >> $config_host_mak
2064 echo "LD=$ld" >> $config_host_mak
2065 echo "CFLAGS=$CFLAGS" >> $config_host_mak
2066 echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
2067 echo "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
2068 echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
2069 echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
2070 echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
2071 echo "LIBS+=$LIBS" >> $config_host_mak
2072 echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
2073 echo "EXESUF=$EXESUF" >> $config_host_mak
2075 # generate list of library paths for linker script
2077 $ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
2079 if test -f ${config_host_ld}~ ; then
2080 if cmp -s $config_host_ld ${config_host_ld}~ ; then
2081 mv ${config_host_ld}~ $config_host_ld
2083 rm ${config_host_ld}~
2087 for target in $target_list; do
2088 target_dir="$target"
2089 config_target_mak=$target_dir/config-target.mak
2090 target_arch2=`echo $target | cut -d '-' -f 1`
2091 target_bigendian="no"
2093 case "$target_arch2" in
2094 armeb|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|sh4eb|sparc|sparc64|sparc32plus)
2095 target_bigendian=yes
2099 target_user_only="no"
2100 target_linux_user="no"
2101 target_darwin_user="no"
2102 target_bsd_user="no"
2104 ${target_arch2}-softmmu)
2105 target_softmmu="yes"
2107 ${target_arch2}-linux-user)
2108 target_user_only="yes"
2109 target_linux_user="yes"
2111 ${target_arch2}-darwin-user)
2112 target_user_only="yes"
2113 target_darwin_user="yes"
2115 ${target_arch2}-bsd-user)
2116 target_user_only="yes"
2117 target_bsd_user="yes"
2120 echo "ERROR: Target '$target' not recognised"
2125 mkdir -p $target_dir
2126 mkdir -p $target_dir/fpu
2127 mkdir -p $target_dir/tcg
2128 mkdir -p $target_dir/ide
2129 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
2130 mkdir -p $target_dir/nwfpe
2133 if test ! -f $target_dir/config-devices.mak ; then
2134 cp $source_path/default-configs/${target}.mak $target_dir/config-devices.mak
2138 # don't use ln -sf as not all "ln -sf" over write the file/link
2140 rm -f $target_dir/Makefile
2141 ln -s $source_path/Makefile.target $target_dir/Makefile
2144 echo "# Automatically generated by configure - do not modify" > $config_target_mak
2149 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
2150 echo "CONFIG_QEMU_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
2153 TARGET_ARCH="$target_arch2"
2157 case "$target_arch2" in
2162 TARGET_BASE_ARCH=i386
2172 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
2181 gdb_xml_files="cf-core.xml cf-fp.xml"
2191 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
2197 TARGET_BASE_ARCH=mips
2198 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
2203 TARGET_BASE_ARCH=mips
2204 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
2208 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2213 TARGET_BASE_ARCH=ppc
2215 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2220 TARGET_BASE_ARCH=ppc
2222 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2227 TARGET_BASE_ARCH=ppc
2229 echo "TARGET_ABI32=y" >> $config_target_mak
2230 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2243 TARGET_BASE_ARCH=sparc
2249 TARGET_BASE_ARCH=sparc
2250 TARGET_ABI_DIR=sparc
2251 echo "TARGET_ABI32=y" >> $config_target_mak
2255 echo "Unsupported target CPU"
2259 echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
2260 target_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
2261 echo "TARGET_$target_arch_name=y" >> $config_target_mak
2262 echo "TARGET_ARCH2=$target_arch2" >> $config_target_mak
2263 # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
2264 if [ "$TARGET_BASE_ARCH" = "" ]; then
2265 TARGET_BASE_ARCH=$TARGET_ARCH
2267 echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
2268 if [ "$TARGET_ABI_DIR" = "" ]; then
2269 TARGET_ABI_DIR=$TARGET_ARCH
2271 echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
2272 if [ $target_phys_bits -lt $hostlongbits ] ; then
2273 target_phys_bits=$hostlongbits
2275 case "$target_arch2" in
2277 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
2278 echo "CONFIG_XEN=y" >> $config_target_mak
2281 case "$target_arch2" in
2282 i386|x86_64|ppcemb|ppc|ppc64)
2283 # Make sure the target and host cpus are compatible
2284 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
2285 \( "$target_arch2" = "$cpu" -o \
2286 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
2287 \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \
2288 \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \
2289 \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then
2290 echo "CONFIG_KVM=y" >> $config_target_mak
2291 echo "KVM_CFLAGS=$kvm_cflags" >> $config_target_mak
2294 echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
2295 if test "$target_bigendian" = "yes" ; then
2296 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
2298 if test "$target_softmmu" = "yes" ; then
2299 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
2300 echo "LIBS+=$libs_softmmu" >> $config_target_mak
2301 echo "HWLIB=../libhw$target_phys_bits/libqemuhw$target_phys_bits.a" >> $config_target_mak
2302 echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
2304 if test "$target_user_only" = "yes" ; then
2305 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
2307 if test "$target_linux_user" = "yes" ; then
2308 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
2310 if test "$target_darwin_user" = "yes" ; then
2311 echo "CONFIG_DARWIN_USER=y" >> $config_target_mak
2314 if test ! -z "$gdb_xml_files" ; then
2315 for x in $gdb_xml_files; do
2316 list="$list $source_path/gdb-xml/$x"
2318 echo "TARGET_XML_FILES=$list" >> $config_target_mak
2321 case "$target_arch2" in
2322 arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|sparc|sparc64|sparc32plus)
2323 echo "CONFIG_SOFTFLOAT=y" >> $config_target_mak
2326 echo "CONFIG_NOSOFTFLOAT=y" >> $config_target_mak
2330 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
2331 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
2333 if test "$target_user_only" = "yes" \
2334 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
2335 echo "CONFIG_USE_NPTL=y" >> $config_target_mak
2337 # 32 bit ELF loader in addition to native 64 bit loader?
2338 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
2339 echo "TARGET_HAS_ELFLOAD32=y" >> $config_target_mak
2341 if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
2342 echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
2344 if test "$target_bsd_user" = "yes" ; then
2345 echo "CONFIG_BSD_USER=y" >> $config_target_mak
2348 # generate QEMU_CFLAGS/LDFLAGS for targets
2353 if test "$ARCH" = "sparc64" ; then
2354 cflags="-I\$(SRC_PATH)/tcg/sparc $cflags"
2356 cflags="-I\$(SRC_PATH)/tcg/\$(ARCH) $cflags"
2358 cflags="-I\$(SRC_PATH)/tcg $cflags"
2359 cflags="-I\$(SRC_PATH)/fpu $cflags"
2361 for i in $ARCH $TARGET_BASE_ARCH ; do
2364 echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
2367 echo "CONFIG_ARM_DIS=y" >> $config_target_mak
2370 echo "CONFIG_CRIS_DIS=y" >> $config_target_mak
2373 echo "CONFIG_HPPA_DIS=y" >> $config_target_mak
2376 echo "CONFIG_I386_DIS=y" >> $config_target_mak
2379 echo "CONFIG_M68K_DIS=y" >> $config_target_mak
2382 echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak
2385 echo "CONFIG_MIPS_DIS=y" >> $config_target_mak
2388 echo "CONFIG_PPC_DIS=y" >> $config_target_mak
2391 echo "CONFIG_S390_DIS=y" >> $config_target_mak
2394 echo "CONFIG_SH4_DIS=y" >> $config_target_mak
2397 echo "CONFIG_SPARC_DIS=y" >> $config_target_mak
2404 # Ensure there's only a single GP
2405 cflags="-msmall-data $cflags"
2408 cflags="-mno-sdata $cflags"
2412 if test "$target_softmmu" = "yes" ; then
2413 case "$TARGET_BASE_ARCH" in
2415 cflags="-DHAS_AUDIO $cflags"
2418 cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
2423 if test "$target_user_only" = "yes" -a "$static" = "no" -a \
2424 "$user_pie" = "yes" ; then
2425 cflags="-fpie $cflags"
2426 ldflags="-pie $ldflags"
2429 if test "$target_softmmu" = "yes" -a \( \
2430 "$TARGET_ARCH" = "microblaze" -o \
2431 "$TARGET_ARCH" = "cris" \) ; then
2432 echo "CONFIG_NEED_MMU=y" >> $config_target_mak
2435 if test "$gprof" = "yes" ; then
2436 echo "TARGET_GPROF=yes" >> $config_target_mak
2437 if test "$target_linux_user" = "yes" ; then
2439 ldflags="-p $ldflags"
2441 if test "$target_softmmu" = "yes" ; then
2442 ldflags="-p $ldflags"
2443 echo "GPROF_CFLAGS=-p" >> $config_target_mak
2447 linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
2448 if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
2451 # -static is used to avoid g1/g3 usage by the dynamic linker
2452 ldflags="$linker_script -static $ldflags"
2455 ldflags="-Wl,-G0 $linker_script -static $ldflags"
2457 i386|x86_64|ppc|ppc64|s390|sparc64|alpha|arm|m68k|mips|mips64)
2458 ldflags="$linker_script $ldflags"
2462 if test "$target_softmmu" = "yes" ; then
2465 ldflags="-Wl,-G0 $linker_script -static $ldflags"
2470 echo "LDFLAGS+=$ldflags" >> $config_target_mak
2471 echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
2473 done # for target in $targets
2475 # build tree in object directory if source path is different from current one
2476 if test "$source_path_used" = "yes" ; then
2477 DIRS="tests tests/cris slirp audio block pc-bios/optionrom"
2478 DIRS="$DIRS roms/pcbios roms/seabios roms/vgabios"
2479 FILES="Makefile tests/Makefile"
2480 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
2481 FILES="$FILES tests/test-mmap.c"
2482 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps pc-bios/video.x"
2483 FILES="$FILES roms/pcbios/Makefile roms/seabios/Makefile roms/vgabios/Makefile"
2484 for bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do
2485 FILES="$FILES pc-bios/`basename $bios_file`"
2487 for dir in $DIRS ; do
2490 # remove the link and recreate it, as not all "ln -sf" overwrite the link
2491 for f in $FILES ; do
2493 ln -s $source_path/$f $f
2497 # temporary config to build submodules
2498 for rom in seabios vgabios pcbios; do
2499 config_mak=roms/$rom/config.mak
2500 echo "# Automatically generated by configure - do not modify" >> $config_mak
2501 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
2502 echo "CC=$cc" >> $config_mak
2503 echo "BCC=bcc" >> $config_mak
2504 echo "CPP=${cross_prefix}cpp" >> $config_mak
2505 echo "OBJCOPY=objcopy" >> $config_mak
2506 echo "IASL=iasl" >> $config_mak
2507 echo "HOST_CC=$host_cc" >> $config_mak
2508 echo "LD=$ld" >> $config_mak
2511 for hwlib in 32 64; do
2515 ln -s $source_path/Makefile.hw $d/Makefile
2516 echo "HWLIB=libqemuhw$hwlib.a" > $d/config.mak
2517 echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" >> $d/config.mak
2523 ln -s $source_path/Makefile.user $d/Makefile