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
)
47 "Power Macintosh"|ppc|ppc64
)
119 OS_CFLAGS
="-mno-cygwin"
120 VL_OS_LDFLAGS
="-mno-cygwin"
121 if [ "$cpu" = "i386" ] ; then
127 if [ "$cpu" = "i386" ] ; then
133 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
140 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
159 OS_CFLAGS
="-mdynamic-no-pic"
160 OS_LDFLAGS
="-framework CoreFoundation -framework IOKit"
166 needs_libsunmath
="no"
167 solarisrev
=`uname -r | cut -f2 -d.`
168 # have to select again, because `uname -m` returns i86pc
169 # even on an x86_64 box.
170 solariscpu
=`isainfo -k`
171 if test "${solariscpu}" = "amd64" ; then
174 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
175 if test "$solarisrev" -le 9 ; then
176 if test -f /opt
/SUNWspro
/prod
/lib
/libsunmath.so
.1; then
177 needs_libsunmath
="yes"
179 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
180 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
181 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
182 echo "Studio 11 can be downloaded from www.sun.com."
186 if test "$solarisrev" -ge 9 ; then
190 if test -f /usr
/include
/sys
/soundcard.h
; then
198 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
202 if [ "$cpu" = "ia64" ] ; then
207 if [ "$cpu" = "powerpc" ]; then
213 if [ "$bsd" = "yes" ] ; then
214 if [ "$darwin" != "yes" ] ; then
220 source_path
=`dirname "$0"`
221 if [ -z "$source_path" ]; then
224 source_path
=`cd "$source_path"; pwd`
226 if test "$source_path" = `pwd` ; then
227 source_path_used
="no"
229 source_path_used
="yes"
233 # generate compile errors on warnings for development builds
234 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
239 optarg
=`expr "x$opt" : 'x[^=]*=\(.*\)'`
241 --help|
-h) show_help
=yes
243 --prefix=*) prefix
="$optarg"
245 --interp-prefix=*) interp_prefix
="$optarg"
247 --source-path=*) source_path
="$optarg"
248 source_path_used
="yes"
250 --cross-prefix=*) cross_prefix
="$optarg"
255 --host-cc=*) host_cc
="$optarg"
257 --make=*) make="$optarg"
259 --install=*) install="$optarg"
261 --extra-cflags=*) CFLAGS
="$optarg"
263 --extra-ldflags=*) LDFLAGS
="$optarg"
265 --cpu=*) cpu
="$optarg"
267 --target-list=*) target_list
="$optarg"
269 --enable-gprof) gprof
="yes"
271 --static) static
="yes"
273 --disable-sdl) sdl
="no"
275 --enable-coreaudio) coreaudio
="yes"
277 --enable-alsa) alsa
="yes"
279 --enable-esd) esd
="yes"
281 --enable-dsound) dsound
="yes"
283 --enable-fmod) fmod
="yes"
285 --fmod-lib=*) fmod_lib
="$optarg"
287 --fmod-inc=*) fmod_inc
="$optarg"
289 --disable-vnc-tls) vnc_tls
="no"
291 --enable-mingw32) mingw32
="yes" ; cross_prefix
="i386-mingw32-" ; linux_user
="no"
293 --disable-slirp) slirp
="no"
295 --enable-adlib) adlib
="yes"
297 --enable-ac97) ac97
="yes"
299 --enable-gus) gus
="yes"
301 --disable-kqemu) kqemu
="no"
303 --disable-kvm) kvm
="no"
305 --enable-profiler) profiler
="yes"
307 --kernel-path=*) kernel_path
="$optarg"
309 --enable-cocoa) cocoa
="yes" ; coreaudio
="yes" ; sdl
="no"
311 --disable-gfx-check) check_gfx
="no"
313 --disable-gcc-check) check_gcc
="no"
315 --disable-system) softmmu
="no"
317 --enable-system) softmmu
="yes"
319 --disable-linux-user) linux_user
="no"
321 --enable-linux-user) linux_user
="yes"
323 --disable-darwin-user) darwin_user
="no"
325 --enable-darwin-user) darwin_user
="yes"
327 --enable-uname-release=*) uname_release
="$optarg"
332 v7|v8
) SP_CFLAGS
="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m32"
333 target_cpu
="sparc"; cpu
="sparc" ;;
334 v8plus|v8plusa
) SP_CFLAGS
="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m32"
335 target_cpu
="sparc"; cpu
="sparc" ;;
336 v9
) SP_CFLAGS
="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m64"
337 target_cpu
="sparc64"; cpu
="sparc64" ;;
338 *) echo "undefined SPARC architecture. Exiting";exit 1;;
341 --enable-werror) werror
="yes"
343 --disable-werror) werror
="no"
345 *) echo "ERROR: unknown option $opt"; exit 1
350 if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
353 # Some Linux architectures (e.g. s390) don't imply -lpthread automatically.
354 AIOLIBS
="-lrt -lpthread"
357 # default flags for all hosts
358 CFLAGS
="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
359 LDFLAGS
="$LDFLAGS -g"
360 if test "$werror" = "yes" ; then
361 CFLAGS
="$CFLAGS -Werror"
365 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
366 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
369 sparc
) if test -z "$sparc_cpu" ; then
370 ARCH_CFLAGS
="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
373 ARCH_CFLAGS
="${SP_CFLAGS}"
374 ARCH_LDFLAGS
="${SP_LDFLAGS}"
377 sparc64
) if test -z "$sparc_cpu" ; then
378 ARCH_CFLAGS
="-m64 -mcpu=ultrasparc -D__sparc_v9__"
381 ARCH_CFLAGS
="${SP_CFLAGS}"
382 ARCH_LDFLAGS
="${SP_LDFLAGS}"
386 ARCH_CFLAGS
="-march=z900"
390 if [ "$solaris" = "yes" -a "$cpu" = "x86_64" ] ; then
391 CFLAGS
="${CFLAGS} -m64"
392 OS_CFLAGS
="${OS_CFLAGS} -m64"
393 OS_LDFLAGS
="${OS_LDFLAGS} -m64"
396 if [ "$solaris" = "yes" -a "$cpu" = "i386" ] ; then
397 CFLAGS
="${CFLAGS} -m32"
398 OS_CFLAGS
="${OS_CFLAGS} -m32"
401 if test x
"$show_help" = x
"yes" ; then
404 Usage: configure [options]
405 Options: [defaults in brackets after descriptions]
408 echo "Standard options:"
409 echo " --help print this message"
410 echo " --prefix=PREFIX install in PREFIX [$prefix]"
411 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
412 echo " use %M for cpu name [$interp_prefix]"
413 echo " --target-list=LIST set target list [$target_list]"
415 echo "kqemu kernel acceleration support:"
416 echo " --disable-kqemu disable kqemu support"
417 echo " --kernel-path=PATH set the kernel path (configure probes it)"
418 echo " --disable-kvm disable kernel virtual machine support"
420 echo "Advanced options (experts only):"
421 echo " --source-path=PATH path of source code [$source_path]"
422 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
423 echo " --cc=CC use C compiler CC [$cc]"
424 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
425 echo " --make=MAKE use specified make [$make]"
426 echo " --install=INSTALL use specified install [$install]"
427 echo " --static enable static build [$static]"
428 echo " --disable-werror disable compilation abort on warning"
429 echo " --disable-sdl disable SDL"
430 echo " --enable-cocoa enable COCOA (Mac OS X only)"
431 echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
432 echo " --enable-adlib enable Adlib emulation"
433 echo " --enable-ac97 enable AC97 emulation"
434 echo " --enable-gus enable Gravis Ultrasound emulation"
435 echo " --enable-coreaudio enable Coreaudio audio driver"
436 echo " --enable-alsa enable ALSA audio driver"
437 echo " --enable-esd enable EsoundD audio driver"
438 echo " --enable-fmod enable FMOD audio driver"
439 echo " --enable-dsound enable DirectSound audio driver"
440 echo " --disable-vnc-tls disable TLS encryption for VNC server"
441 echo " --enable-system enable all system emulation targets"
442 echo " --disable-system disable all system emulation targets"
443 echo " --enable-linux-user enable all linux usermode emulation targets"
444 echo " --disable-linux-user disable all linux usermode emulation targets"
445 echo " --enable-darwin-user enable all darwin usermode emulation targets"
446 echo " --disable-darwin-user disable all darwin usermode emulation targets"
447 echo " --fmod-lib path to FMOD library"
448 echo " --fmod-inc path to FMOD includes"
449 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
450 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
452 echo "NOTE: The object files are built at the place where configure is launched"
456 cc
="${cross_prefix}${cc}"
457 ar="${cross_prefix}${ar}"
458 strip
="${cross_prefix}${strip}"
460 # check that the C compiler works.
465 if $cc -c -o $TMPO $TMPC 2> /dev
/null
; then
466 : C compiler works ok
468 echo "ERROR: \"$cc\" either does not exist or does not work"
472 if test "$mingw32" = "yes" ; then
478 # Check for gcc4, error if pre-gcc4
479 if test "$check_gcc" = "yes" ; then
484 int main(){return 0;}
486 if "$cc" -o $TMPE $TMPC 2> /dev
/null
; then
487 echo "WARNING: \"$cc\" looks like gcc 4.x"
489 if test "$gcc3_search" = "yes" ; then
490 echo "Looking for gcc 3.x"
491 for compat_cc
in $gcc3_list ; do
492 if "$cross_prefix$compat_cc" --version 2> /dev
/null | fgrep
'(GCC) 3.' > /dev
/null
2>&1 ; then
493 echo "Found \"$compat_cc\""
494 cc
="$cross_prefix$compat_cc"
495 found_compat_cc
="yes"
499 if test "$found_compat_cc" = "no" ; then
500 echo "gcc 3.x not found!"
503 if test "$found_compat_cc" = "no" ; then
504 echo "QEMU is known to have problems when compiled with gcc 4.x"
505 echo "It is recommended that you use gcc 3.x to build QEMU"
506 echo "To use this compiler anyway, configure with --disable-gcc-check"
513 # Solaris specific configure tool chain decisions
515 if test "$solaris" = "yes" ; then
517 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
518 # override the check with --disable-gcc-check
520 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
522 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
523 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
524 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
525 echo "or get the latest patch from SunSolve for gcc"
529 solinst
=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
530 if test -z "$solinst" ; then
531 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
532 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
533 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
536 if test "$solinst" = "/usr/sbin/install" ; then
537 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
538 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
539 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
542 sol_ar
=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
543 if test -z "$sol_ar" ; then
544 echo "Error: No path includes ar"
545 if test -f /usr
/ccs
/bin
/ar ; then
546 echo "Add /usr/ccs/bin to your path and rerun configure"
553 if test -z "$target_list" ; then
554 # these targets are portable
555 if [ "$softmmu" = "yes" ] ; then
556 target_list
="i386-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu mips64-softmmu mips64el-softmmu arm-softmmu ppc-softmmu ppcemb-softmmu ppc64-softmmu m68k-softmmu sh4-softmmu sh4eb-softmmu cris-softmmu"
558 # the following are Linux specific
559 if [ "$linux_user" = "yes" ] ; then
560 target_list
="i386-linux-user arm-linux-user armeb-linux-user sparc-linux-user sparc64-linux-user sparc32plus-linux-user mips-linux-user mipsel-linux-user m68k-linux-user alpha-linux-user sh4-linux-user sh4eb-linux-user ppc-linux-user ppc64-linux-user ppc64abi32-linux-user x86_64-linux-user cris-linux-user $target_list"
562 # the following are Darwin specific
563 if [ "$darwin_user" = "yes" ] ; then
564 target_list
="i386-darwin-user ppc-darwin-user $target_list"
567 target_list
=`echo "$target_list" | sed -e 's/,/ /g'`
569 if test -z "$target_list" ; then
570 echo "No targets enabled"
574 if test -z "$cross_prefix" ; then
577 # big/little endian test
579 #include <inttypes.h>
580 int main(int argc, char ** argv){
581 volatile uint32_t i=0x01234567;
582 return (*((uint8_t*)(&i))) == 0x67;
586 if $cc -o $TMPE $TMPC 2> /dev
/null
; then
587 $TMPE && bigendian
="yes"
589 echo big
/little
test failed
594 # if cross compiling, cannot launch a program, so make a static guess
595 if test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "mips64" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then
601 # host long bits test
603 if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
607 # check gcc options support
613 ##########################################
618 if test -z "$sdl" ; then
619 sdl_config
="sdl-config"
623 if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
624 # win32 cross compilation case
625 sdl_config
="i386-mingw32msvc-sdl-config"
631 #undef main /* We don't want SDL to override our main() */
632 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
634 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /tmp
/qemu-$$
-sdl-config.log
; then
635 _sdlversion
=`$sdl_config --version | sed 's/[^0-9]//g'`
636 if test "$_sdlversion" -lt 121 ; then
639 if test "$cocoa" = "no" ; then
644 # static link with sdl ?
645 if test "$sdl" = "yes" ; then
647 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa
="yes"
648 sdl_static_libs
=`$sdl_config --static-libs 2>/dev/null`
649 if [ "$aa" = "yes" ] ; then
650 sdl_static_libs
="$sdl_static_libs `aalib-config --static-libs`"
653 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev
/null
; then
657 fi # sdl compile test
658 fi # cross compilation
660 # Make sure to disable cocoa if sdl was set
661 if test "$sdl" = "yes" ; then
667 ##########################################
669 if test "$vnc_tls" = "yes" ; then
670 `pkg-config gnutls` || vnc_tls
="no"
672 if test "$vnc_tls" = "yes" ; then
673 vnc_tls_cflags
=`pkg-config --cflags gnutls`
674 vnc_tls_libs
=`pkg-config --libs gnutls`
677 ##########################################
678 # alsa sound support libraries
680 if test "$alsa" = "yes" ; then
682 #include <alsa/asoundlib.h>
683 int main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); }
685 if $cc -o $TMPE $TMPC -lasound 2> /dev
/null
; then
689 echo "Error: Could not find alsa"
690 echo "Make sure to have the alsa libs and headers installed."
696 # Check if tools are available to build documentation.
697 if [ -x "`which texi2html 2>/dev/null`" ] && \
698 [ -x "`which pod2man 2>/dev/null`" ]; then
702 if test "$mingw32" = "yes" ; then
703 if test -z "$prefix" ; then
704 prefix
="/c/Program Files/Qemu"
711 if test -z "$prefix" ; then
714 mansuffix
="/share/man"
715 datasuffix
="/share/qemu"
716 docsuffix
="/share/doc/qemu"
720 echo "Install prefix $prefix"
721 echo "BIOS directory $prefix$datasuffix"
722 echo "binary directory $prefix$binsuffix"
723 if test "$mingw32" = "no" ; then
724 echo "Manual directory $prefix$mansuffix"
725 echo "ELF interp prefix $interp_prefix"
727 echo "Source path $source_path"
728 echo "C compiler $cc"
729 echo "Host C compiler $host_cc"
731 echo "install $install"
733 echo "host big endian $bigendian"
734 echo "target list $target_list"
735 echo "gprof enabled $gprof"
736 echo "profiler $profiler"
737 echo "static build $static"
738 echo "-Werror enabled $werror"
739 if test "$darwin" = "yes" ; then
740 echo "Cocoa support $cocoa"
742 echo "SDL support $sdl"
743 if test "$sdl" != "no" ; then
744 echo "SDL static link $sdl_static"
746 echo "mingw32 support $mingw32"
747 echo "Adlib support $adlib"
748 echo "AC97 support $ac97"
749 echo "GUS support $gus"
750 echo "CoreAudio support $coreaudio"
751 echo "ALSA support $alsa"
752 echo "EsounD support $esd"
753 echo "DSound support $dsound"
754 if test "$fmod" = "yes"; then
755 if test -z $fmod_lib ||
test -z $fmod_inc; then
757 echo "Error: You must specify path to FMOD library and headers"
758 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
762 fmod_support
=" (lib='$fmod_lib' include='$fmod_inc')"
766 echo "FMOD support $fmod $fmod_support"
767 echo "OSS support $oss"
768 echo "VNC TLS support $vnc_tls"
769 if test "$vnc_tls" = "yes" ; then
770 echo " TLS CFLAGS $vnc_tls_cflags"
771 echo " TLS LIBS $vnc_tls_libs"
773 if test -n "$sparc_cpu"; then
774 echo "Target Sparc Arch $sparc_cpu"
776 echo "kqemu support $kqemu"
777 echo "kvm support $kvm"
778 echo "Documentation $build_docs"
779 [ ! -z "$uname_release" ] && \
780 echo "uname -r $uname_release"
782 if test $sdl_too_old = "yes"; then
783 echo "-> Your SDL version is too old - please upgrade to have SDL support"
785 if [ -s /tmp
/qemu-$$
-sdl-config.log
]; then
786 echo "The error log from compiling the libSDL test is: "
787 cat /tmp
/qemu-$$
-sdl-config.log
789 rm -f /tmp
/qemu-$$
-sdl-config.log
790 #if test "$sdl_static" = "no"; then
791 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
793 config_mak
="config-host.mak"
794 config_h
="config-host.h"
796 #echo "Creating $config_mak and $config_h"
798 test -f $config_h && mv $config_h ${config_h}~
800 echo "# Automatically generated by configure - do not modify" > $config_mak
801 echo "# Configured with: $0 $@" >> $config_mak
802 echo "/* Automatically generated by configure - do not modify */" > $config_h
804 echo "prefix=$prefix" >> $config_mak
805 echo "bindir=\${prefix}$binsuffix" >> $config_mak
806 echo "mandir=\${prefix}$mansuffix" >> $config_mak
807 echo "datadir=\${prefix}$datasuffix" >> $config_mak
808 echo "docdir=\${prefix}$docsuffix" >> $config_mak
809 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
810 echo "MAKE=$make" >> $config_mak
811 echo "INSTALL=$install" >> $config_mak
812 echo "CC=$cc" >> $config_mak
813 echo "HOST_CC=$host_cc" >> $config_mak
814 echo "AR=$ar" >> $config_mak
815 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
816 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
817 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
818 echo "VL_OS_LDFLAGS=$VL_OS_LDFLAGS" >> $config_mak
819 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
820 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
821 echo "CFLAGS=$CFLAGS" >> $config_mak
822 echo "LDFLAGS=$LDFLAGS" >> $config_mak
823 echo "EXESUF=$EXESUF" >> $config_mak
824 echo "AIOLIBS=$AIOLIBS" >> $config_mak
825 if test "$cpu" = "i386" ; then
826 echo "ARCH=i386" >> $config_mak
827 echo "#define HOST_I386 1" >> $config_h
828 elif test "$cpu" = "x86_64" ; then
829 echo "ARCH=x86_64" >> $config_mak
830 echo "#define HOST_X86_64 1" >> $config_h
831 elif test "$cpu" = "armv4b" ; then
832 echo "ARCH=arm" >> $config_mak
833 echo "#define HOST_ARM 1" >> $config_h
834 elif test "$cpu" = "armv4l" ; then
835 echo "ARCH=arm" >> $config_mak
836 echo "#define HOST_ARM 1" >> $config_h
837 elif test "$cpu" = "powerpc" ; then
838 echo "ARCH=ppc" >> $config_mak
839 echo "#define HOST_PPC 1" >> $config_h
840 elif test "$cpu" = "mips" ; then
841 echo "ARCH=mips" >> $config_mak
842 echo "#define HOST_MIPS 1" >> $config_h
843 elif test "$cpu" = "mips64" ; then
844 echo "ARCH=mips64" >> $config_mak
845 echo "#define HOST_MIPS64 1" >> $config_h
846 elif test "$cpu" = "cris" ; then
847 echo "ARCH=cris" >> $config_mak
848 echo "#define HOST_CRIS 1" >> $config_h
849 elif test "$cpu" = "s390" ; then
850 echo "ARCH=s390" >> $config_mak
851 echo "#define HOST_S390 1" >> $config_h
852 elif test "$cpu" = "alpha" ; then
853 echo "ARCH=alpha" >> $config_mak
854 echo "#define HOST_ALPHA 1" >> $config_h
855 elif test "$cpu" = "sparc" ; then
856 echo "ARCH=sparc" >> $config_mak
857 echo "#define HOST_SPARC 1" >> $config_h
858 elif test "$cpu" = "sparc64" ; then
859 echo "ARCH=sparc64" >> $config_mak
860 echo "#define HOST_SPARC64 1" >> $config_h
861 elif test "$cpu" = "ia64" ; then
862 echo "ARCH=ia64" >> $config_mak
863 echo "#define HOST_IA64 1" >> $config_h
864 elif test "$cpu" = "m68k" ; then
865 echo "ARCH=m68k" >> $config_mak
866 echo "#define HOST_M68K 1" >> $config_h
868 echo "Unsupported CPU = $cpu"
871 if test "$bigendian" = "yes" ; then
872 echo "WORDS_BIGENDIAN=yes" >> $config_mak
873 echo "#define WORDS_BIGENDIAN 1" >> $config_h
875 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
876 if test "$mingw32" = "yes" ; then
877 echo "CONFIG_WIN32=yes" >> $config_mak
878 echo "#define CONFIG_WIN32 1" >> $config_h
881 #include <byteswap.h>
882 int main(void) { return bswap_32(0); }
884 if $cc -o $TMPE $TMPC 2> /dev
/null
; then
885 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
888 if test "$darwin" = "yes" ; then
889 echo "CONFIG_DARWIN=yes" >> $config_mak
890 echo "#define CONFIG_DARWIN 1" >> $config_h
892 if test "$solaris" = "yes" ; then
893 echo "CONFIG_SOLARIS=yes" >> $config_mak
894 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
895 if test "$needs_libsunmath" = "yes" ; then
896 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
897 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
900 if test -n "$sparc_cpu"; then
901 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
902 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
904 if test "$gdbstub" = "yes" ; then
905 echo "CONFIG_GDBSTUB=yes" >> $config_mak
906 echo "#define CONFIG_GDBSTUB 1" >> $config_h
908 if test "$gprof" = "yes" ; then
909 echo "TARGET_GPROF=yes" >> $config_mak
910 echo "#define HAVE_GPROF 1" >> $config_h
912 if test "$static" = "yes" ; then
913 echo "CONFIG_STATIC=yes" >> $config_mak
914 echo "#define CONFIG_STATIC 1" >> $config_h
916 if test $profiler = "yes" ; then
917 echo "#define CONFIG_PROFILER 1" >> $config_h
919 if test "$slirp" = "yes" ; then
920 echo "CONFIG_SLIRP=yes" >> $config_mak
921 echo "#define CONFIG_SLIRP 1" >> $config_h
923 if test "$adlib" = "yes" ; then
924 echo "CONFIG_ADLIB=yes" >> $config_mak
925 echo "#define CONFIG_ADLIB 1" >> $config_h
927 if test "$ac97" = "yes" ; then
928 echo "CONFIG_AC97=yes" >> $config_mak
929 echo "#define CONFIG_AC97 1" >> $config_h
931 if test "$gus" = "yes" ; then
932 echo "CONFIG_GUS=yes" >> $config_mak
933 echo "#define CONFIG_GUS 1" >> $config_h
935 if test "$oss" = "yes" ; then
936 echo "CONFIG_OSS=yes" >> $config_mak
937 echo "#define CONFIG_OSS 1" >> $config_h
939 if test "$coreaudio" = "yes" ; then
940 echo "CONFIG_COREAUDIO=yes" >> $config_mak
941 echo "#define CONFIG_COREAUDIO 1" >> $config_h
943 if test "$alsa" = "yes" ; then
944 echo "CONFIG_ALSA=yes" >> $config_mak
945 echo "#define CONFIG_ALSA 1" >> $config_h
947 if test "$esd" = "yes" ; then
948 echo "CONFIG_ESD=yes" >> $config_mak
949 echo "#define CONFIG_ESD 1" >> $config_h
951 if test "$dsound" = "yes" ; then
952 echo "CONFIG_DSOUND=yes" >> $config_mak
953 echo "#define CONFIG_DSOUND 1" >> $config_h
955 if test "$fmod" = "yes" ; then
956 echo "CONFIG_FMOD=yes" >> $config_mak
957 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
958 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
959 echo "#define CONFIG_FMOD 1" >> $config_h
961 if test "$vnc_tls" = "yes" ; then
962 echo "CONFIG_VNC_TLS=yes" >> $config_mak
963 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
964 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
965 echo "#define CONFIG_VNC_TLS 1" >> $config_h
967 qemu_version
=`head $source_path/VERSION`
968 echo "VERSION=$qemu_version" >>$config_mak
969 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
970 echo "#define KVM_VERSION \"kvm-devel\"" >> $config_h
972 echo "SRC_PATH=$source_path" >> $config_mak
973 if [ "$source_path_used" = "yes" ]; then
974 echo "VPATH=$source_path" >> $config_mak
976 echo "TARGET_DIRS=$target_list" >> $config_mak
977 if [ "$build_docs" = "yes" ] ; then
978 echo "BUILD_DOCS=yes" >> $config_mak
980 if test "$static" = "yes"; then
985 if test "$sdl1" = "yes" ; then
986 echo "#define CONFIG_SDL 1" >> $config_h
987 echo "CONFIG_SDL=yes" >> $config_mak
988 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
989 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
991 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
993 if [ "${aa}" = "yes" ] ; then
994 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
996 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
999 if test "$cocoa" = "yes" ; then
1000 echo "#define CONFIG_COCOA 1" >> $config_h
1001 echo "CONFIG_COCOA=yes" >> $config_mak
1004 # XXX: suppress that
1005 if [ "$bsd" = "yes" ] ; then
1006 echo "#define O_LARGEFILE 0" >> $config_h
1007 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1008 echo "#define _BSD 1" >> $config_h
1011 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1014 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1015 tools
="qemu-img\$(EXESUF) $tools"
1017 echo "TOOLS=$tools" >> $config_mak
1019 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~
$config_h
1021 for target
in $target_list; do
1022 target_dir
="$target"
1023 config_mak
=$target_dir/config.mak
1024 config_h
=$target_dir/config.h
1025 target_cpu
=`echo $target | cut -d '-' -f 1`
1026 target_bigendian
="no"
1027 [ "$target_cpu" = "armeb" ] && target_bigendian
=yes
1028 [ "$target_cpu" = "sparc" ] && target_bigendian
=yes
1029 [ "$target_cpu" = "sparc64" ] && target_bigendian
=yes
1030 [ "$target_cpu" = "sparc32plus" ] && target_bigendian
=yes
1031 [ "$target_cpu" = "ppc" ] && target_bigendian
=yes
1032 [ "$target_cpu" = "ppcemb" ] && target_bigendian
=yes
1033 [ "$target_cpu" = "ppc64" ] && target_bigendian
=yes
1034 [ "$target_cpu" = "ppc64abi32" ] && target_bigendian
=yes
1035 [ "$target_cpu" = "mips" ] && target_bigendian
=yes
1036 [ "$target_cpu" = "mipsn32" ] && target_bigendian
=yes
1037 [ "$target_cpu" = "mips64" ] && target_bigendian
=yes
1038 [ "$target_cpu" = "sh4eb" ] && target_bigendian
=yes
1039 [ "$target_cpu" = "m68k" ] && target_bigendian
=yes
1041 target_user_only
="no"
1042 target_linux_user
="no"
1043 target_darwin_user
="no"
1045 ${target_cpu}-softmmu)
1046 target_softmmu
="yes"
1048 ${target_cpu}-linux-user)
1049 target_user_only
="yes"
1050 target_linux_user
="yes"
1052 ${target_cpu}-darwin-user)
1053 target_user_only
="yes"
1054 target_darwin_user
="yes"
1057 echo "ERROR: Target '$target' not recognised"
1062 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1063 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1064 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1065 echo "To build QEMU without graphical output configure with --disable-gfx-check"
1066 echo "Note that this will disable all output from the virtual graphics card."
1070 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1072 test -f $config_h && mv $config_h ${config_h}~
1074 mkdir
-p $target_dir
1075 mkdir
-p $target_dir/fpu
1076 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then
1077 mkdir
-p $target_dir/nwfpe
1081 # don't use ln -sf as not all "ln -sf" over write the file/link
1083 rm -f $target_dir/Makefile
1084 ln -s $source_path/Makefile.target
$target_dir/Makefile
1087 echo "# Automatically generated by configure - do not modify" > $config_mak
1088 echo "/* Automatically generated by configure - do not modify */" > $config_h
1091 echo "include ../config-host.mak" >> $config_mak
1092 echo "#include \"../config-host.h\"" >> $config_h
1096 interp_prefix1
=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1097 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1100 if test $kvm = "yes" -a "$target_softmmu" = "yes" -a \
1101 \
( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \
); then
1102 echo "#define USE_KVM 1" >> $config_h
1103 echo "USE_KVM=1" >> $config_mak
1104 echo "CONFIG_KVM_KERNEL_INC=$kernel_path/include" >> $config_mak
1108 if test "$target_cpu" = "i386" ; then
1109 echo "TARGET_ARCH=i386" >> $config_mak
1110 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1111 echo "#define TARGET_I386 1" >> $config_h
1112 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
1113 echo "#define USE_KQEMU 1" >> $config_h
1116 elif test "$target_cpu" = "ia64" ; then
1117 echo "TARGET_ARCH=ia64" >> $config_mak
1118 echo "#define TARGET_ARCH \"ia64\"" >> $config_h
1119 echo "#define TARGET_IA64 1" >> $config_h
1121 elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
1122 echo "TARGET_ARCH=arm" >> $config_mak
1123 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1124 echo "#define TARGET_ARM 1" >> $config_h
1126 elif test "$target_cpu" = "sparc" ; then
1127 echo "TARGET_ARCH=sparc" >> $config_mak
1128 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1129 echo "#define TARGET_SPARC 1" >> $config_h
1130 elif test "$target_cpu" = "sparc64" ; then
1131 echo "TARGET_ARCH=sparc64" >> $config_mak
1132 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1133 echo "#define TARGET_SPARC 1" >> $config_h
1134 echo "#define TARGET_SPARC64 1" >> $config_h
1136 elif test "$target_cpu" = "sparc32plus" ; then
1137 echo "TARGET_ARCH=sparc64" >> $config_mak
1138 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1139 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1140 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1141 echo "#define TARGET_SPARC 1" >> $config_h
1142 echo "#define TARGET_SPARC64 1" >> $config_h
1143 echo "#define TARGET_ABI32 1" >> $config_h
1144 elif test "$target_cpu" = "ppc" ; then
1145 echo "TARGET_ARCH=ppc" >> $config_mak
1146 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1147 echo "#define TARGET_PPC 1" >> $config_h
1148 elif test "$target_cpu" = "ppcemb" ; then
1149 echo "TARGET_ARCH=ppcemb" >> $config_mak
1150 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1151 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1152 echo "#define TARGET_PPC 1" >> $config_h
1153 echo "#define TARGET_PPCEMB 1" >> $config_h
1155 elif test "$target_cpu" = "ppc64" ; then
1156 echo "TARGET_ARCH=ppc64" >> $config_mak
1157 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1158 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1159 echo "#define TARGET_PPC 1" >> $config_h
1160 echo "#define TARGET_PPC64 1" >> $config_h
1161 elif test "$target_cpu" = "ppc64abi32" ; then
1162 echo "TARGET_ARCH=ppc64" >> $config_mak
1163 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1164 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1165 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1166 echo "#define TARGET_PPC 1" >> $config_h
1167 echo "#define TARGET_PPC64 1" >> $config_h
1168 echo "#define TARGET_ABI32 1" >> $config_h
1169 elif test "$target_cpu" = "x86_64" ; then
1170 echo "TARGET_ARCH=x86_64" >> $config_mak
1171 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1172 echo "#define TARGET_I386 1" >> $config_h
1173 echo "#define TARGET_X86_64 1" >> $config_h
1174 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then
1175 echo "#define USE_KQEMU 1" >> $config_h
1178 elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
1179 echo "TARGET_ARCH=mips" >> $config_mak
1180 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1181 echo "#define TARGET_MIPS 1" >> $config_h
1182 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1183 elif test "$target_cpu" = "mipsn32" -o "$target_cpu" = "mipsn32el" ; then
1184 echo "TARGET_ARCH=mipsn32" >> $config_mak
1185 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1186 echo "#define TARGET_MIPS 1" >> $config_h
1187 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1188 elif test "$target_cpu" = "mips64" -o "$target_cpu" = "mips64el" ; then
1189 echo "TARGET_ARCH=mips64" >> $config_mak
1190 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1191 echo "#define TARGET_MIPS 1" >> $config_h
1192 echo "#define TARGET_MIPS64 1" >> $config_h
1193 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1194 elif test "$target_cpu" = "cris" ; then
1195 echo "TARGET_ARCH=cris" >> $config_mak
1196 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1197 echo "#define TARGET_CRIS 1" >> $config_h
1198 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1199 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1200 elif test "$target_cpu" = "sh4" -o "$target_cpu" = "sh4eb" ; then
1201 echo "TARGET_ARCH=sh4" >> $config_mak
1202 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1203 echo "#define TARGET_SH4 1" >> $config_h
1205 elif test "$target_cpu" = "m68k" ; then
1206 echo "TARGET_ARCH=m68k" >> $config_mak
1207 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1208 echo "#define TARGET_M68K 1" >> $config_h
1210 elif test "$target_cpu" = "alpha" ; then
1211 echo "TARGET_ARCH=alpha" >> $config_mak
1212 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1213 echo "#define TARGET_ALPHA 1" >> $config_h
1215 echo "Unsupported target CPU"
1218 if test "$target_bigendian" = "yes" ; then
1219 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1220 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1222 if test "$target_softmmu" = "yes" ; then
1223 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1224 echo "#define CONFIG_SOFTMMU 1" >> $config_h
1226 if test "$target_user_only" = "yes" ; then
1227 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1228 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1230 if test "$target_linux_user" = "yes" ; then
1231 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1232 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1234 if test "$target_darwin_user" = "yes" ; then
1235 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1236 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1239 if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" -o "$target_cpu" = "sparc" -o "$target_cpu" = "sparc64" -o "$target_cpu" = "sparc32plus" -o "$target_cpu" = "m68k" -o "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" -o "$target_cpu" = "mipsn32" -o "$target_cpu" = "mipsn32el" -o "$target_cpu" = "mips64" -o "$target_cpu" = "mips64el"; then
1240 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1241 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1243 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1244 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1245 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1247 # 32 bit ELF loader in addition to native 64 bit loader?
1248 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1249 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1250 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1253 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~
$config_h
1255 done # for target in $targets
1257 # build tree in object directory if source path is different from current one
1258 if test "$source_path_used" = "yes" ; then
1259 DIRS
="tests tests/cris slirp audio"
1260 FILES
="Makefile tests/Makefile"
1261 FILES
="$FILES tests/cris/Makefile tests/cris/.gdbinit"
1262 for dir
in $DIRS ; do
1265 # remove the link and recreate it, as not all "ln -sf" overwrite the link
1266 for f
in $FILES ; do
1268 ln -s $source_path/$f $f
1272 rm -f $TMPO $TMPC $TMPE $TMPS