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"
21 interp_prefix
="/usr/gnemul/qemu-%M"
26 gcc3_list
="gcc-3.4.6 gcc-3.4 gcc34 gcc-3.3.6 gcc-3.3 gcc33 gcc-3.2 gcc32"
35 i386|i486|i586|i686|i86pc|BePC
)
68 "Power Macintosh"|ppc|ppc64
)
119 device_tree_support
=""
126 OS_CFLAGS
="-mno-cygwin"
127 if [ "$cpu" = "i386" ] ; then
133 if [ "$cpu" = "i386" ] ; then
139 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
146 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
165 OS_CFLAGS
="-mdynamic-no-pic"
166 OS_LDFLAGS
="-framework CoreFoundation -framework IOKit"
172 needs_libsunmath
="no"
173 solarisrev
=`uname -r | cut -f2 -d.`
174 # have to select again, because `uname -m` returns i86pc
175 # even on an x86_64 box.
176 solariscpu
=`isainfo -k`
177 if test "${solariscpu}" = "amd64" ; then
180 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
181 if test "$solarisrev" -le 9 ; then
182 if test -f /opt
/SUNWspro
/prod
/lib
/libsunmath.so
.1; then
183 needs_libsunmath
="yes"
185 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
186 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
187 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
188 echo "Studio 11 can be downloaded from www.sun.com."
192 if test "$solarisrev" -ge 9 ; then
196 if test -f /usr
/include
/sys
/soundcard.h
; then
204 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
208 if [ "$cpu" = "ia64" ] ; then
213 if [ "$cpu" = "powerpc" ]; then
219 if [ "$bsd" = "yes" ] ; then
220 if [ "$darwin" != "yes" ] ; then
226 source_path
=`dirname "$0"`
227 source_path_used
="no"
229 if [ -z "$source_path" ]; then
232 source_path
=`cd "$source_path"; pwd`
234 [ -f "$workdir/vl.c" ] || source_path_used
="yes"
237 # generate compile errors on warnings for development builds
238 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
243 optarg
=`expr "x$opt" : 'x[^=]*=\(.*\)'`
245 --help|
-h) show_help
=yes
247 --prefix=*) prefix
="$optarg"
249 --interp-prefix=*) interp_prefix
="$optarg"
251 --source-path=*) source_path
="$optarg"
252 source_path_used
="yes"
254 --cross-prefix=*) cross_prefix
="$optarg"
259 --host-cc=*) host_cc
="$optarg"
261 --make=*) make="$optarg"
263 --install=*) install="$optarg"
265 --extra-cflags=*) CFLAGS
="$optarg"
267 --extra-ldflags=*) LDFLAGS
="$optarg"
269 --cpu=*) cpu
="$optarg"
271 --target-list=*) target_list
="$optarg"
273 --enable-gprof) gprof
="yes"
275 --static) static
="yes"
277 --disable-sdl) sdl
="no"
279 --enable-coreaudio) coreaudio
="yes"
281 --enable-alsa) alsa
="yes"
283 --enable-esd) esd
="yes"
285 --enable-dsound) dsound
="yes"
287 --enable-fmod) fmod
="yes"
289 --fmod-lib=*) fmod_lib
="$optarg"
291 --fmod-inc=*) fmod_inc
="$optarg"
293 --disable-vnc-tls) vnc_tls
="no"
295 --enable-mingw32) mingw32
="yes" ; cross_prefix
="i386-mingw32-" ; linux_user
="no"
297 --disable-slirp) slirp
="no"
299 --enable-adlib) adlib
="yes"
301 --enable-ac97) ac97
="yes"
303 --enable-gus) gus
="yes"
305 --disable-kqemu) kqemu
="no"
307 --disable-kvm) kvm
="no"
309 --disable-brlapi) brlapi
="no"
311 --enable-profiler) profiler
="yes"
313 --kernel-path=*) kernel_path
="$optarg"
315 --enable-cocoa) cocoa
="yes" ; coreaudio
="yes" ; sdl
="no"
317 --disable-gfx-check) check_gfx
="no"
319 --disable-gcc-check) check_gcc
="no"
321 --disable-system) softmmu
="no"
323 --enable-system) softmmu
="yes"
325 --disable-linux-user) linux_user
="no"
327 --enable-linux-user) linux_user
="yes"
329 --disable-darwin-user) darwin_user
="no"
331 --enable-darwin-user) darwin_user
="yes"
333 --enable-uname-release=*) uname_release
="$optarg"
338 v7|v8
) SP_CFLAGS
="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m32"
339 target_cpu
="sparc"; cpu
="sparc" ;;
340 v8plus|v8plusa
) SP_CFLAGS
="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m32"
341 target_cpu
="sparc"; cpu
="sparc" ;;
342 v9
) SP_CFLAGS
="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m64"
343 target_cpu
="sparc64"; cpu
="sparc64" ;;
344 *) echo "undefined SPARC architecture. Exiting";exit 1;;
347 --enable-werror) werror
="yes"
349 --disable-werror) werror
="no"
351 --disable-curses) curses
="no"
353 --disable-cpu-emulation) cpu_emulation
="no"
355 --disable-libfdt) device_tree_support
="no"
357 *) echo "ERROR: unknown option $opt"; exit 1
362 if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
365 # Some Linux architectures (e.g. s390) don't imply -lpthread automatically.
366 AIOLIBS
="-lrt -lpthread"
369 # default flags for all hosts
370 CFLAGS
="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
371 LDFLAGS
="$LDFLAGS -g"
372 if test "$werror" = "yes" ; then
373 CFLAGS
="$CFLAGS -Werror"
377 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
378 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
381 sparc
) if test -z "$sparc_cpu" ; then
382 ARCH_CFLAGS
="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
385 ARCH_CFLAGS
="${SP_CFLAGS}"
386 ARCH_LDFLAGS
="${SP_LDFLAGS}"
389 sparc64
) if test -z "$sparc_cpu" ; then
390 ARCH_CFLAGS
="-m64 -mcpu=ultrasparc -D__sparc_v9__"
393 ARCH_CFLAGS
="${SP_CFLAGS}"
394 ARCH_LDFLAGS
="${SP_LDFLAGS}"
398 ARCH_CFLAGS
="-march=z900"
410 if test x
"$show_help" = x
"yes" ; then
413 Usage: configure [options]
414 Options: [defaults in brackets after descriptions]
417 echo "Standard options:"
418 echo " --help print this message"
419 echo " --prefix=PREFIX install in PREFIX [$prefix]"
420 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
421 echo " use %M for cpu name [$interp_prefix]"
422 echo " --target-list=LIST set target list [$target_list]"
424 echo "kqemu kernel acceleration support:"
425 echo " --disable-kqemu disable kqemu support"
426 echo " --kernel-path=PATH set the kernel path (configure probes it)"
427 echo " --disable-kvm disable kernel virtual machine support"
429 echo "Advanced options (experts only):"
430 echo " --source-path=PATH path of source code [$source_path]"
431 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
432 echo " --cc=CC use C compiler CC [$cc]"
433 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
434 echo " --make=MAKE use specified make [$make]"
435 echo " --install=INSTALL use specified install [$install]"
436 echo " --static enable static build [$static]"
437 echo " --disable-werror disable compilation abort on warning"
438 echo " --disable-sdl disable SDL"
439 echo " --enable-cocoa enable COCOA (Mac OS X only)"
440 echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
441 echo " --enable-adlib enable Adlib emulation"
442 echo " --enable-ac97 enable AC97 emulation"
443 echo " --enable-gus enable Gravis Ultrasound emulation"
444 echo " --enable-coreaudio enable Coreaudio audio driver"
445 echo " --enable-alsa enable ALSA audio driver"
446 echo " --enable-esd enable EsoundD audio driver"
447 echo " --enable-fmod enable FMOD audio driver"
448 echo " --enable-dsound enable DirectSound audio driver"
449 echo " --disable-brlapi disable BrlAPI"
450 echo " --disable-vnc-tls disable TLS encryption for VNC server"
451 echo " --disable-curses disable curses output"
452 echo " --enable-system enable all system emulation targets"
453 echo " --disable-system disable all system emulation targets"
454 echo " --enable-linux-user enable all linux usermode emulation targets"
455 echo " --disable-linux-user disable all linux usermode emulation targets"
456 echo " --enable-darwin-user enable all darwin usermode emulation targets"
457 echo " --disable-darwin-user disable all darwin usermode emulation targets"
458 echo " --fmod-lib path to FMOD library"
459 echo " --fmod-inc path to FMOD includes"
460 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
461 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
462 echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
463 echo " --disable-libfdt disables use of libfdt support for device tree"
465 echo "NOTE: The object files are built at the place where configure is launched"
469 cc
="${cross_prefix}${cc}"
470 ar="${cross_prefix}${ar}"
471 strip
="${cross_prefix}${strip}"
473 # check that the C compiler works.
478 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev
/null
; then
479 : C compiler works ok
481 echo "ERROR: \"$cc\" either does not exist or does not work"
485 if test "$mingw32" = "yes" ; then
491 # Check for gcc4, error if pre-gcc4
492 if test "$check_gcc" = "yes" ; then
497 int main(){return 0;}
499 if "$cc" $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
500 echo "WARNING: \"$cc\" looks like gcc 4.x"
502 if test "$gcc3_search" = "yes" ; then
503 echo "Looking for gcc 3.x"
504 for compat_cc
in $gcc3_list ; do
505 if "$cross_prefix$compat_cc" --version 2> /dev
/null | fgrep
'(GCC) 3.' > /dev
/null
2>&1 ; then
506 echo "Found \"$compat_cc\""
507 cc
="$cross_prefix$compat_cc"
508 found_compat_cc
="yes"
512 if test "$found_compat_cc" = "no" ; then
513 echo "gcc 3.x not found!"
516 if test "$found_compat_cc" = "no" ; then
517 echo "QEMU is known to have problems when compiled with gcc 4.x"
518 echo "It is recommended that you use gcc 3.x to build QEMU"
519 echo "To use this compiler anyway, configure with --disable-gcc-check"
526 # Solaris specific configure tool chain decisions
528 if test "$solaris" = "yes" ; then
530 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
531 # override the check with --disable-gcc-check
533 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
535 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
536 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
537 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
538 echo "or get the latest patch from SunSolve for gcc"
542 solinst
=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
543 if test -z "$solinst" ; then
544 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
545 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
546 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
549 if test "$solinst" = "/usr/sbin/install" ; then
550 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
551 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
552 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
555 sol_ar
=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
556 if test -z "$sol_ar" ; then
557 echo "Error: No path includes ar"
558 if test -f /usr
/ccs
/bin
/ar ; then
559 echo "Add /usr/ccs/bin to your path and rerun configure"
566 if test -z "$target_list" ; then
567 # these targets are portable
568 if [ "$softmmu" = "yes" ] ; then
587 # the following are Linux specific
588 if [ "$linux_user" = "yes" ] ; then
589 target_list
="${target_list}\
601 ppc64abi32-linux-user \
606 sparc32plus-linux-user \
609 # the following are Darwin specific
610 if [ "$darwin_user" = "yes" ] ; then
611 target_list
="$target_list i386-darwin-user ppc-darwin-user"
614 target_list
=`echo "$target_list" | sed -e 's/,/ /g'`
616 if test -z "$target_list" ; then
617 echo "No targets enabled"
621 if test -z "$cross_prefix" ; then
624 # big/little endian test
626 #include <inttypes.h>
627 int main(int argc, char ** argv){
628 volatile uint32_t i=0x01234567;
629 return (*((uint8_t*)(&i))) == 0x67;
633 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
634 $TMPE && bigendian
="yes"
636 echo big
/little
test failed
641 # if cross compiling, cannot launch a program, so make a static guess
642 if test "$cpu" = "armv4b" \
646 -o "$cpu" = "mips64" \
647 -o "$cpu" = "powerpc" \
649 -o "$cpu" = "sparc" \
650 -o "$cpu" = "sparc64"; then
656 # host long bits test
658 if test "$cpu" = "x86_64" \
659 -o "$cpu" = "alpha" \
661 -o "$cpu" = "sparc64"; then
665 # check gcc options support
671 ##########################################
674 if test "$kvm" = "yes" ; then
678 #error "kvm no pit capability"
680 int main(void) { return 0; }
682 if $cc $ARCH_CFLAGS $CFLAGS -I"$kernel_path"/include
-o $TMPE ${OS_CFLAGS} $TMPC 2> /dev
/null
; then
687 ##########################################
692 if test -z "$sdl" ; then
693 sdl_config
="sdl-config"
697 if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
698 # win32 cross compilation case
699 sdl_config
="i386-mingw32msvc-sdl-config"
705 #undef main /* We don't want SDL to override our main() */
706 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
708 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /tmp
/qemu-$$
-sdl-config.log
; then
709 _sdlversion
=`$sdl_config --version | sed 's/[^0-9]//g'`
710 if test "$_sdlversion" -lt 121 ; then
713 if test "$cocoa" = "no" ; then
718 # static link with sdl ?
719 if test "$sdl" = "yes" ; then
721 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa
="yes"
722 sdl_static_libs
=`$sdl_config --static-libs 2>/dev/null`
723 if [ "$aa" = "yes" ] ; then
724 sdl_static_libs
="$sdl_static_libs `aalib-config --static-libs`"
727 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev
/null
; then
731 fi # sdl compile test
732 fi # cross compilation
734 # Make sure to disable cocoa if sdl was set
735 if test "$sdl" = "yes" ; then
741 ##########################################
743 if test "$vnc_tls" = "yes" ; then
744 `pkg-config gnutls` || vnc_tls
="no"
746 if test "$vnc_tls" = "yes" ; then
747 vnc_tls_cflags
=`pkg-config --cflags gnutls`
748 vnc_tls_libs
=`pkg-config --libs gnutls`
751 ##########################################
752 # alsa sound support libraries
754 if test "$alsa" = "yes" ; then
756 #include <alsa/asoundlib.h>
757 int main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); }
759 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lasound 2> /dev
/null
; then
763 echo "Error: Could not find alsa"
764 echo "Make sure to have the alsa libs and headers installed."
770 ##########################################
773 if test -z "$brlapi" ; then
777 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
779 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi 2> /dev
/null
; then
781 fi # brlapi compile test
784 ##########################################
787 if test "$curses" = "yes" ; then
791 int main(void) { return curses_version(); }
793 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses 2> /dev
/null
; then
798 # Check if tools are available to build documentation.
799 if [ -x "`which texi2html 2>/dev/null`" ] && \
800 [ -x "`which pod2man 2>/dev/null`" ]; then
804 if test "$mingw32" = "yes" ; then
805 if test -z "$prefix" ; then
806 prefix
="/c/Program Files/Qemu"
813 if test -z "$prefix" ; then
816 mansuffix
="/share/man"
817 datasuffix
="/share/qemu"
818 docsuffix
="/share/doc/qemu"
822 ######################################
825 if test -z "$device_tree_support" -a \
826 "$cpu" = "powerpc"; then
827 device_tree_support
="no"
830 /* XXX uncomment later when libfdt is built before this test */
831 //int main(void) { void *fdt; return fdt_create(fdt, 1024); }
832 int main (void) {return 0;}
834 # XXX for now do not try to link to libfdt and just check for header */
835 # if $cc $ARCH_CFLAGS $CFLAGS $LDFLAGS -o $TMPE $TMPC -lfdt 2> /dev/null ; then
836 if $cc $ARCH_CFLAGS $CFLAGS $LDFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
837 device_tree_support
="yes"
840 echo "Error: Could not find libfdt"
841 echo "Make sure to have the libfdt libs and headers installed."
847 echo "Install prefix $prefix"
848 echo "BIOS directory $prefix$datasuffix"
849 echo "binary directory $prefix$binsuffix"
850 if test "$mingw32" = "no" ; then
851 echo "Manual directory $prefix$mansuffix"
852 echo "ELF interp prefix $interp_prefix"
854 echo "Source path $source_path"
855 echo "C compiler $cc"
856 echo "Host C compiler $host_cc"
857 echo "ARCH_CFLAGS $ARCH_CFLAGS"
859 echo "install $install"
861 echo "host big endian $bigendian"
862 echo "target list $target_list"
863 echo "gprof enabled $gprof"
864 echo "profiler $profiler"
865 echo "static build $static"
866 echo "-Werror enabled $werror"
867 if test "$darwin" = "yes" ; then
868 echo "Cocoa support $cocoa"
870 echo "SDL support $sdl"
871 if test "$sdl" != "no" ; then
872 echo "SDL static link $sdl_static"
874 echo "curses support $curses"
875 echo "mingw32 support $mingw32"
876 echo "Adlib support $adlib"
877 echo "AC97 support $ac97"
878 echo "GUS support $gus"
879 echo "CoreAudio support $coreaudio"
880 echo "ALSA support $alsa"
881 echo "EsounD support $esd"
882 echo "DSound support $dsound"
883 if test "$fmod" = "yes"; then
884 if test -z $fmod_lib ||
test -z $fmod_inc; then
886 echo "Error: You must specify path to FMOD library and headers"
887 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
891 fmod_support
=" (lib='$fmod_lib' include='$fmod_inc')"
895 echo "FMOD support $fmod $fmod_support"
896 echo "OSS support $oss"
897 echo "VNC TLS support $vnc_tls"
898 if test "$vnc_tls" = "yes" ; then
899 echo " TLS CFLAGS $vnc_tls_cflags"
900 echo " TLS LIBS $vnc_tls_libs"
902 if test -n "$sparc_cpu"; then
903 echo "Target Sparc Arch $sparc_cpu"
905 echo "kqemu support $kqemu"
906 echo "kvm support $kvm"
907 echo "CPU emulation $cpu_emulation"
908 if test $cpu = "powerpc"; then
909 echo "libfdt support $device_tree_support"
911 echo "brlapi support $brlapi"
912 echo "Documentation $build_docs"
913 [ ! -z "$uname_release" ] && \
914 echo "uname -r $uname_release"
916 if test $sdl_too_old = "yes"; then
917 echo "-> Your SDL version is too old - please upgrade to have SDL support"
919 if [ -s /tmp
/qemu-$$
-sdl-config.log
]; then
920 echo "The error log from compiling the libSDL test is: "
921 cat /tmp
/qemu-$$
-sdl-config.log
923 rm -f /tmp
/qemu-$$
-sdl-config.log
924 #if test "$sdl_static" = "no"; then
925 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
927 config_mak
="config-host.mak"
928 config_h
="config-host.h"
930 #echo "Creating $config_mak and $config_h"
932 test -f $config_h && mv $config_h ${config_h}~
934 echo "# Automatically generated by configure - do not modify" > $config_mak
935 echo "# Configured with: $0 $@" >> $config_mak
936 echo "/* Automatically generated by configure - do not modify */" > $config_h
938 echo "prefix=$prefix" >> $config_mak
939 echo "bindir=\${prefix}$binsuffix" >> $config_mak
940 echo "mandir=\${prefix}$mansuffix" >> $config_mak
941 echo "datadir=\${prefix}$datasuffix" >> $config_mak
942 echo "docdir=\${prefix}$docsuffix" >> $config_mak
943 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
944 echo "MAKE=$make" >> $config_mak
945 echo "INSTALL=$install" >> $config_mak
946 echo "CC=$cc" >> $config_mak
947 echo "HOST_CC=$host_cc" >> $config_mak
948 echo "AR=$ar" >> $config_mak
949 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
950 # XXX: only use CFLAGS and LDFLAGS ?
951 # XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
952 # compilation of dyngen tool (useful for win32 build on Linux host)
953 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
954 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
955 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
956 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
957 echo "CFLAGS=$CFLAGS" >> $config_mak
958 echo "LDFLAGS=$LDFLAGS" >> $config_mak
959 echo "EXESUF=$EXESUF" >> $config_mak
960 echo "AIOLIBS=$AIOLIBS" >> $config_mak
963 echo "ARCH=i386" >> $config_mak
964 echo "#define HOST_I386 1" >> $config_h
967 echo "ARCH=x86_64" >> $config_mak
968 echo "#define HOST_X86_64 1" >> $config_h
971 echo "ARCH=alpha" >> $config_mak
972 echo "#define HOST_ALPHA 1" >> $config_h
975 echo "ARCH=arm" >> $config_mak
976 echo "#define HOST_ARM 1" >> $config_h
979 echo "ARCH=arm" >> $config_mak
980 echo "#define HOST_ARM 1" >> $config_h
983 echo "ARCH=cris" >> $config_mak
984 echo "#define HOST_CRIS 1" >> $config_h
987 echo "ARCH=hppa" >> $config_mak
988 echo "#define HOST_HPPA 1" >> $config_h
991 echo "ARCH=ia64" >> $config_mak
992 echo "#define HOST_IA64 1" >> $config_h
995 echo "ARCH=m68k" >> $config_mak
996 echo "#define HOST_M68K 1" >> $config_h
999 echo "ARCH=mips" >> $config_mak
1000 echo "#define HOST_MIPS 1" >> $config_h
1003 echo "ARCH=mips64" >> $config_mak
1004 echo "#define HOST_MIPS64 1" >> $config_h
1007 echo "ARCH=ppc" >> $config_mak
1008 echo "#define HOST_PPC 1" >> $config_h
1011 echo "ARCH=s390" >> $config_mak
1012 echo "#define HOST_S390 1" >> $config_h
1015 echo "ARCH=sparc" >> $config_mak
1016 echo "#define HOST_SPARC 1" >> $config_h
1019 echo "ARCH=sparc64" >> $config_mak
1020 echo "#define HOST_SPARC64 1" >> $config_h
1023 echo "Unsupported CPU = $cpu"
1027 if test "$bigendian" = "yes" ; then
1028 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1029 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1031 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
1032 if test "$mingw32" = "yes" ; then
1033 echo "CONFIG_WIN32=yes" >> $config_mak
1034 echo "#define CONFIG_WIN32 1" >> $config_h
1037 #include <byteswap.h>
1038 int main(void) { return bswap_32(0); }
1040 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
1041 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1044 if test "$darwin" = "yes" ; then
1045 echo "CONFIG_DARWIN=yes" >> $config_mak
1046 echo "#define CONFIG_DARWIN 1" >> $config_h
1048 if test "$solaris" = "yes" ; then
1049 echo "CONFIG_SOLARIS=yes" >> $config_mak
1050 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
1051 if test "$needs_libsunmath" = "yes" ; then
1052 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1053 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1056 if test -n "$sparc_cpu"; then
1057 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1058 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1060 if test "$gdbstub" = "yes" ; then
1061 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1062 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1064 if test "$gprof" = "yes" ; then
1065 echo "TARGET_GPROF=yes" >> $config_mak
1066 echo "#define HAVE_GPROF 1" >> $config_h
1068 if test "$static" = "yes" ; then
1069 echo "CONFIG_STATIC=yes" >> $config_mak
1070 echo "#define CONFIG_STATIC 1" >> $config_h
1072 if test $profiler = "yes" ; then
1073 echo "#define CONFIG_PROFILER 1" >> $config_h
1075 if test "$slirp" = "yes" ; then
1076 echo "CONFIG_SLIRP=yes" >> $config_mak
1077 echo "#define CONFIG_SLIRP 1" >> $config_h
1079 if test "$adlib" = "yes" ; then
1080 echo "CONFIG_ADLIB=yes" >> $config_mak
1081 echo "#define CONFIG_ADLIB 1" >> $config_h
1083 if test "$ac97" = "yes" ; then
1084 echo "CONFIG_AC97=yes" >> $config_mak
1085 echo "#define CONFIG_AC97 1" >> $config_h
1087 if test "$gus" = "yes" ; then
1088 echo "CONFIG_GUS=yes" >> $config_mak
1089 echo "#define CONFIG_GUS 1" >> $config_h
1091 if test "$oss" = "yes" ; then
1092 echo "CONFIG_OSS=yes" >> $config_mak
1093 echo "#define CONFIG_OSS 1" >> $config_h
1095 if test "$coreaudio" = "yes" ; then
1096 echo "CONFIG_COREAUDIO=yes" >> $config_mak
1097 echo "#define CONFIG_COREAUDIO 1" >> $config_h
1099 if test "$alsa" = "yes" ; then
1100 echo "CONFIG_ALSA=yes" >> $config_mak
1101 echo "#define CONFIG_ALSA 1" >> $config_h
1103 if test "$esd" = "yes" ; then
1104 echo "CONFIG_ESD=yes" >> $config_mak
1105 echo "#define CONFIG_ESD 1" >> $config_h
1107 if test "$dsound" = "yes" ; then
1108 echo "CONFIG_DSOUND=yes" >> $config_mak
1109 echo "#define CONFIG_DSOUND 1" >> $config_h
1111 if test "$fmod" = "yes" ; then
1112 echo "CONFIG_FMOD=yes" >> $config_mak
1113 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1114 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1115 echo "#define CONFIG_FMOD 1" >> $config_h
1117 if test "$vnc_tls" = "yes" ; then
1118 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1119 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1120 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1121 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1123 qemu_version
=`head $source_path/VERSION`
1124 echo "VERSION=$qemu_version" >>$config_mak
1125 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1126 echo "#define KVM_VERSION \"kvm-devel\"" >> $config_h
1128 echo "SRC_PATH=$source_path" >> $config_mak
1129 if [ "$source_path_used" = "yes" ]; then
1130 echo "VPATH=$source_path" >> $config_mak
1132 echo "TARGET_DIRS=$target_list" >> $config_mak
1133 if [ "$build_docs" = "yes" ] ; then
1134 echo "BUILD_DOCS=yes" >> $config_mak
1136 if test "$static" = "yes"; then
1141 if test "$sdl1" = "yes" ; then
1142 echo "#define CONFIG_SDL 1" >> $config_h
1143 echo "CONFIG_SDL=yes" >> $config_mak
1144 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1145 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1147 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1149 if [ "${aa}" = "yes" ] ; then
1150 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1152 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1155 if test "$cocoa" = "yes" ; then
1156 echo "#define CONFIG_COCOA 1" >> $config_h
1157 echo "CONFIG_COCOA=yes" >> $config_mak
1159 if test "$curses" = "yes" ; then
1160 echo "#define CONFIG_CURSES 1" >> $config_h
1161 echo "CONFIG_CURSES=yes" >> $config_mak
1162 echo "CURSES_LIBS=-lcurses" >> $config_mak
1164 if test "$brlapi" = "yes" ; then
1165 echo "CONFIG_BRLAPI=yes" >> $config_mak
1166 echo "#define CONFIG_BRLAPI 1" >> $config_h
1167 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1170 # XXX: suppress that
1171 if [ "$bsd" = "yes" ] ; then
1172 echo "#define O_LARGEFILE 0" >> $config_h
1173 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1174 echo "#define _BSD 1" >> $config_h
1177 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1180 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1181 tools
="qemu-img\$(EXESUF) $tools"
1183 echo "TOOLS=$tools" >> $config_mak
1185 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~
$config_h
1187 for target
in $target_list; do
1188 target_dir
="$target"
1189 config_mak
=$target_dir/config.mak
1190 config_h
=$target_dir/config.h
1191 target_cpu
=`echo $target | cut -d '-' -f 1`
1192 target_bigendian
="no"
1193 [ "$target_cpu" = "armeb" ] && target_bigendian
=yes
1194 [ "$target_cpu" = "m68k" ] && target_bigendian
=yes
1195 [ "$target_cpu" = "mips" ] && target_bigendian
=yes
1196 [ "$target_cpu" = "mipsn32" ] && target_bigendian
=yes
1197 [ "$target_cpu" = "mips64" ] && target_bigendian
=yes
1198 [ "$target_cpu" = "ppc" ] && target_bigendian
=yes
1199 [ "$target_cpu" = "ppcemb" ] && target_bigendian
=yes
1200 [ "$target_cpu" = "ppc64" ] && target_bigendian
=yes
1201 [ "$target_cpu" = "ppc64abi32" ] && target_bigendian
=yes
1202 [ "$target_cpu" = "sh4eb" ] && target_bigendian
=yes
1203 [ "$target_cpu" = "sparc" ] && target_bigendian
=yes
1204 [ "$target_cpu" = "sparc64" ] && target_bigendian
=yes
1205 [ "$target_cpu" = "sparc32plus" ] && target_bigendian
=yes
1207 target_user_only
="no"
1208 target_linux_user
="no"
1209 target_darwin_user
="no"
1211 ${target_cpu}-softmmu)
1212 target_softmmu
="yes"
1214 ${target_cpu}-linux-user)
1215 target_user_only
="yes"
1216 target_linux_user
="yes"
1218 ${target_cpu}-darwin-user)
1219 target_user_only
="yes"
1220 target_darwin_user
="yes"
1223 echo "ERROR: Target '$target' not recognised"
1228 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1229 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1230 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1231 echo "To build QEMU without graphical output configure with --disable-gfx-check"
1232 echo "Note that this will disable all output from the virtual graphics card"
1233 echo "except through VNC or curses."
1237 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1239 test -f $config_h && mv $config_h ${config_h}~
1241 mkdir
-p $target_dir
1242 mkdir
-p $target_dir/fpu
1243 mkdir
-p $target_dir/tcg
1244 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then
1245 mkdir
-p $target_dir/nwfpe
1249 # don't use ln -sf as not all "ln -sf" over write the file/link
1251 rm -f $target_dir/Makefile
1252 ln -s $source_path/Makefile.target
$target_dir/Makefile
1255 echo "# Automatically generated by configure - do not modify" > $config_mak
1256 echo "/* Automatically generated by configure - do not modify */" > $config_h
1259 echo "include ../config-host.mak" >> $config_mak
1260 echo "#include \"../config-host.h\"" >> $config_h
1264 interp_prefix1
=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1265 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1267 disable_cpu_emulation
() {
1268 if test $cpu_emulation = "no"; then
1269 echo "#define NO_CPU_EMULATION 1" >> $config_h
1270 echo "NO_CPU_EMULATION=1" >> $config_mak
1275 if test $kvm = "yes" -a "$target_softmmu" = "yes" -a \
1276 \
( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \
); then
1277 echo "#define USE_KVM 1" >> $config_h
1278 echo "USE_KVM=1" >> $config_mak
1279 echo "CONFIG_KVM_KERNEL_INC=$kernel_path/include" >> $config_mak
1280 if test $kvm_cap_pit = "yes" ; then
1281 echo "USE_KVM_PIT=1" >> $config_mak
1282 echo "#define USE_KVM_PIT 1" >> $config_h
1284 disable_cpu_emulation
1288 case "$target_cpu" in
1290 echo "TARGET_ARCH=i386" >> $config_mak
1291 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1292 echo "#define TARGET_I386 1" >> $config_h
1293 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386"
1295 echo "#define USE_KQEMU 1" >> $config_h
1297 gcc3minver
=`$cc --version 2> /dev/null| fgrep "(GCC) 3." | awk '{ print $3 }' | cut -f2 -d.`
1298 if test -n "$gcc3minver" -a $gcc3minver -gt 3
1300 echo "HAVE_GT_GCC_3_3=true" >> $config_mak
1302 echo "HAVE_GT_GCC_3_3=false" >> $config_mak
1307 echo "TARGET_ARCH=x86_64" >> $config_mak
1308 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1309 echo "#define TARGET_I386 1" >> $config_h
1310 echo "#define TARGET_X86_64 1" >> $config_h
1311 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1313 echo "#define USE_KQEMU 1" >> $config_h
1318 echo "TARGET_ARCH=ia64" >> $config_mak
1319 echo "#define TARGET_ARCH \"ia64\"" >> $config_h
1320 echo "#define TARGET_IA64 1" >> $config_h
1324 echo "TARGET_ARCH=alpha" >> $config_mak
1325 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1326 echo "#define TARGET_ALPHA 1" >> $config_h
1329 echo "TARGET_ARCH=arm" >> $config_mak
1330 echo "CONFIG_NO_DYNGEN_OP=yes" >> $config_mak
1331 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1332 echo "#define TARGET_ARM 1" >> $config_h
1333 echo "#define CONFIG_NO_DYNGEN_OP 1" >> $config_h
1337 echo "TARGET_ARCH=cris" >> $config_mak
1338 echo "CONFIG_NO_DYNGEN_OP=yes" >> $config_mak
1339 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1340 echo "#define TARGET_CRIS 1" >> $config_h
1341 echo "#define CONFIG_NO_DYNGEN_OP 1" >> $config_h
1344 echo "TARGET_ARCH=m68k" >> $config_mak
1345 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1346 echo "#define TARGET_M68K 1" >> $config_h
1350 echo "TARGET_ARCH=mips" >> $config_mak
1351 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1352 echo "#define TARGET_MIPS 1" >> $config_h
1353 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1356 echo "TARGET_ARCH=mipsn32" >> $config_mak
1357 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1358 echo "#define TARGET_MIPS 1" >> $config_h
1359 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1362 echo "TARGET_ARCH=mips64" >> $config_mak
1363 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1364 echo "#define TARGET_MIPS 1" >> $config_h
1365 echo "#define TARGET_MIPS64 1" >> $config_h
1366 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1369 echo "TARGET_ARCH=ppc" >> $config_mak
1370 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1371 echo "#define TARGET_PPC 1" >> $config_h
1374 echo "TARGET_ARCH=ppcemb" >> $config_mak
1375 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1376 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1377 echo "#define TARGET_PPC 1" >> $config_h
1378 echo "#define TARGET_PPCEMB 1" >> $config_h
1379 if test "$device_tree_support" = "yes" ; then
1380 echo "#define CONFIG_LIBFDT 1" >> $config_h
1381 echo "CONFIG_LIBFDT=1" >> $config_mak
1386 echo "TARGET_ARCH=ppc64" >> $config_mak
1387 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1388 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1389 echo "#define TARGET_PPC 1" >> $config_h
1390 echo "#define TARGET_PPC64 1" >> $config_h
1393 echo "TARGET_ARCH=ppc64" >> $config_mak
1394 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1395 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1396 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1397 echo "#define TARGET_PPC 1" >> $config_h
1398 echo "#define TARGET_PPC64 1" >> $config_h
1399 echo "#define TARGET_ABI32 1" >> $config_h
1402 echo "TARGET_ARCH=sh4" >> $config_mak
1403 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1404 echo "#define TARGET_SH4 1" >> $config_h
1408 echo "TARGET_ARCH=sparc" >> $config_mak
1409 echo "CONFIG_NO_DYNGEN_OP=yes" >> $config_mak
1410 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1411 echo "#define TARGET_SPARC 1" >> $config_h
1412 echo "#define CONFIG_NO_DYNGEN_OP 1" >> $config_h
1415 echo "TARGET_ARCH=sparc64" >> $config_mak
1416 echo "CONFIG_NO_DYNGEN_OP=yes" >> $config_mak
1417 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1418 echo "#define TARGET_SPARC 1" >> $config_h
1419 echo "#define TARGET_SPARC64 1" >> $config_h
1420 echo "#define CONFIG_NO_DYNGEN_OP 1" >> $config_h
1424 echo "TARGET_ARCH=sparc64" >> $config_mak
1425 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1426 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1427 echo "CONFIG_NO_DYNGEN_OP=yes" >> $config_mak
1428 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1429 echo "#define TARGET_SPARC 1" >> $config_h
1430 echo "#define TARGET_SPARC64 1" >> $config_h
1431 echo "#define TARGET_ABI32 1" >> $config_h
1432 echo "#define CONFIG_NO_DYNGEN_OP 1" >> $config_h
1435 echo "Unsupported target CPU"
1439 if test "$target_bigendian" = "yes" ; then
1440 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1441 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1443 if test "$target_softmmu" = "yes" ; then
1444 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1445 echo "#define CONFIG_SOFTMMU 1" >> $config_h
1447 if test "$target_user_only" = "yes" ; then
1448 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1449 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1451 if test "$target_linux_user" = "yes" ; then
1452 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1453 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1455 if test "$target_darwin_user" = "yes" ; then
1456 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1457 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1460 if test "$target_cpu" = "arm" \
1461 -o "$target_cpu" = "armeb" \
1462 -o "$target_cpu" = "m68k" \
1463 -o "$target_cpu" = "mips" \
1464 -o "$target_cpu" = "mipsel" \
1465 -o "$target_cpu" = "mipsn32" \
1466 -o "$target_cpu" = "mipsn32el" \
1467 -o "$target_cpu" = "mips64" \
1468 -o "$target_cpu" = "mips64el" \
1469 -o "$target_cpu" = "sparc" \
1470 -o "$target_cpu" = "sparc64" \
1471 -o "$target_cpu" = "sparc32plus"; then
1472 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1473 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1475 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1476 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1477 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1479 # 32 bit ELF loader in addition to native 64 bit loader?
1480 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1481 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1482 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1485 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~
$config_h
1487 done # for target in $targets
1489 # build tree in object directory if source path is different from current one
1490 if test "$source_path_used" = "yes" ; then
1491 DIRS
="tests tests/cris slirp audio"
1492 FILES
="Makefile tests/Makefile"
1493 FILES
="$FILES tests/cris/Makefile tests/cris/.gdbinit"
1494 FILES
="$FILES tests/test-mmap.c"
1495 for dir
in $DIRS ; do
1498 # remove the link and recreate it, as not all "ln -sf" overwrite the link
1499 for f
in $FILES ; do
1501 ln -s $source_path/$f $f
1505 rm -f $TMPO $TMPC $TMPE $TMPS