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 gcc34 gcc-3.3 gcc33 gcc-3.2 gcc32"
35 i386|i486|i586|i686|i86pc|BePC)
47 "Power Macintosh"|ppc|ppc64)
110 OS_CFLAGS="-mno-cygwin"
117 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
124 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
142 OS_CFLAGS="-mdynamic-no-pic"
148 needs_libsunmath="no"
149 solarisrev=`uname -r | cut -f2 -d.`
150 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
151 if test "$solarisrev" -le 9 ; then
152 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
153 needs_libsunmath="yes"
155 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
156 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
157 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
158 echo "Studio 11 can be downloaded from www.sun.com."
162 if test "$solarisrev" -ge 9 ; then
166 if test -f /usr/include/sys/soundcard.h ; then
174 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
180 if [ "$bsd" = "yes" ] ; then
181 if [ "$darwin" != "yes" ] ; then
187 source_path=`dirname "$0"`
188 if [ -z "$source_path" ]; then
191 source_path=`cd "$source_path"; pwd`
193 if test "$source_path" = `pwd` ; then
194 source_path_used="no"
196 source_path_used="yes"
200 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
202 --help|-h) show_help=yes
204 --prefix=*) prefix="$optarg"
206 --interp-prefix=*) interp_prefix="$optarg"
208 --source-path=*) source_path="$optarg"
209 source_path_used="yes"
211 --cross-prefix=*) cross_prefix="$optarg"
216 --host-cc=*) host_cc="$optarg"
218 --make=*) make="$optarg"
220 --install=*) install="$optarg"
222 --extra-cflags=*) CFLAGS="$optarg"
224 --extra-ldflags=*) LDFLAGS="$optarg"
226 --cpu=*) cpu="$optarg"
228 --target-list=*) target_list="$optarg"
230 --enable-gprof) gprof="yes"
232 --static) static="yes"
234 --disable-sdl) sdl="no"
236 --enable-coreaudio) coreaudio="yes"
238 --enable-alsa) alsa="yes"
240 --enable-dsound) dsound="yes"
242 --enable-fmod) fmod="yes"
244 --fmod-lib=*) fmod_lib="$optarg"
246 --fmod-inc=*) fmod_inc="$optarg"
248 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; linux_user="no"
250 --disable-slirp) slirp="no"
252 --enable-adlib) adlib="yes"
254 --disable-kqemu) kqemu="no"
256 --enable-profiler) profiler="yes"
258 --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
260 --disable-gfx-check) check_gfx="no"
262 --disable-gcc-check) check_gcc="no"
264 --disable-system) softmmu="no"
266 --enable-system) softmmu="yes"
268 --disable-linux-user) linux_user="no"
270 --enable-linux-user) linux_user="yes"
272 --disable-darwin-user) darwin_user="no"
274 --enable-darwin-user) darwin_user="yes"
276 --enable-uname-release=*) uname_release="$optarg"
281 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
282 target_cpu="sparc"; cpu="sparc" ;;
283 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
284 target_cpu="sparc"; cpu="sparc" ;;
285 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
286 target_cpu="sparc64"; cpu="sparc64" ;;
287 *) echo "undefined SPARC architecture. Exiting";exit 1;;
293 if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
299 # default flags for all hosts
300 CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
301 LDFLAGS="$LDFLAGS -g"
304 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
305 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
308 sparc) if test -z "$sparc_cpu" ; then
309 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
312 ARCH_CFLAGS="${SP_CFLAGS}"
313 ARCH_LDFLAGS="${SP_LDFLAGS}"
316 sparc64) if test -z "$sparc_cpu" ; then
317 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
320 ARCH_CFLAGS="${SP_CFLAGS}"
321 ARCH_LDFLAGS="${SP_LDFLAGS}"
326 if test x"$show_help" = x"yes" ; then
329 Usage: configure [options]
330 Options: [defaults in brackets after descriptions]
333 echo "Standard options:"
334 echo " --help print this message"
335 echo " --prefix=PREFIX install in PREFIX [$prefix]"
336 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
337 echo " use %M for cpu name [$interp_prefix]"
338 echo " --target-list=LIST set target list [$target_list]"
340 echo "kqemu kernel acceleration support:"
341 echo " --disable-kqemu disable kqemu support"
343 echo "Advanced options (experts only):"
344 echo " --source-path=PATH path of source code [$source_path]"
345 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
346 echo " --cc=CC use C compiler CC [$cc]"
347 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
348 echo " --make=MAKE use specified make [$make]"
349 echo " --install=INSTALL use specified install [$install]"
350 echo " --static enable static build [$static]"
351 echo " --enable-cocoa enable COCOA (Mac OS X only)"
352 echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
353 echo " --enable-adlib enable Adlib emulation"
354 echo " --enable-coreaudio enable Coreaudio audio driver"
355 echo " --enable-alsa enable ALSA audio driver"
356 echo " --enable-fmod enable FMOD audio driver"
357 echo " --enable-dsound enable DirectSound audio driver"
358 echo " --enable-system enable all system emulation targets"
359 echo " --disable-system disable all system emulation targets"
360 echo " --enable-linux-user enable all linux usermode emulation targets"
361 echo " --disable-linux-user disable all linux usermode emulation targets"
362 echo " --enable-darwin-user enable all darwin usermode emulation targets"
363 echo " --disable-darwin-user disable all darwin usermode emulation targets"
364 echo " --fmod-lib path to FMOD library"
365 echo " --fmod-inc path to FMOD includes"
366 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
367 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
369 echo "NOTE: The object files are built at the place where configure is launched"
373 cc="${cross_prefix}${cc}"
374 ar="${cross_prefix}${ar}"
375 strip="${cross_prefix}${strip}"
377 # check that the C compiler works.
382 if $cc -c -o $TMPO $TMPC 2> /dev/null ; then
383 : C compiler works ok
385 echo "ERROR: \"$cc\" either does not exist or does not work"
389 if test "$mingw32" = "yes" ; then
393 if [ "$cpu" = "i386" ] ; then
398 # Check for gcc4, error if pre-gcc4
399 if test "$check_gcc" = "yes" ; then
404 int main(){return 0;}
406 if "$cc" -o $TMPE $TMPC 2> /dev/null ; then
407 echo "WARNING: \"$cc\" looks like gcc 4.x"
409 if test "$gcc3_search" = "yes" ; then
410 echo "Looking for gcc 3.x"
411 for compat_cc in $gcc3_list ; do
412 if "$cross_prefix$compat_cc" --version > /dev/null 2>&1 ; then
413 echo "Found \"$compat_cc\""
414 cc="$cross_prefix$compat_cc"
415 found_compat_cc="yes"
419 if test "$found_compat_cc" = "no" ; then
420 echo "gcc 3.x not found!"
423 if test "$found_compat_cc" = "no" ; then
424 echo "QEMU is known to have problems when compiled with gcc 4.x"
425 echo "It is recommended that you use gcc 3.x to build QEMU"
426 echo "To use this compiler anyway, configure with --disable-gcc-check"
433 # Solaris specific configure tool chain decisions
435 if test "$solaris" = "yes" ; then
437 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
438 # override the check with --disable-gcc-check
440 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
442 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
443 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
444 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
445 echo "or get the latest patch from SunSolve for gcc"
449 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
450 if test -z "$solinst" ; then
451 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
452 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
453 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
456 if test "$solinst" = "/usr/sbin/install" ; then
457 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
458 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
459 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
462 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
463 if test -z "$sol_ar" ; then
464 echo "Error: No path includes ar"
465 if test -f /usr/ccs/bin/ar ; then
466 echo "Add /usr/ccs/bin to your path and rerun configure"
473 if test -z "$target_list" ; then
474 # these targets are portable
475 if [ "$softmmu" = "yes" ] ; then
476 target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu mips64-softmmu mips64el-softmmu arm-softmmu ppc64-softmmu ppcemb-softmmu m68k-softmmu"
478 # the following are Linux specific
479 if [ "$linux_user" = "yes" ] ; then
480 target_list="i386-linux-user arm-linux-user armeb-linux-user sparc-linux-user ppc-linux-user mips-linux-user mipsel-linux-user m68k-linux-user alpha-linux-user $target_list"
482 # the following are Darwin specific
483 if [ "$darwin_user" = "yes" ] ; then
484 target_list="i386-darwin-user ppc-darwin-user $target_list"
487 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
489 if test -z "$target_list" ; then
490 echo "No targets enabled"
494 if test -z "$cross_prefix" ; then
497 # big/little endian test
499 #include <inttypes.h>
500 int main(int argc, char ** argv){
501 volatile uint32_t i=0x01234567;
502 return (*((uint8_t*)(&i))) == 0x67;
506 if $cc -o $TMPE $TMPC 2> /dev/null ; then
507 $TMPE && bigendian="yes"
509 echo big/little test failed
514 # if cross compiling, cannot launch a program, so make a static guess
515 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
521 # host long bits test
523 if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
527 # check gcc options support
533 ##########################################
538 if test -z "$sdl" ; then
540 sdl_config="sdl-config"
544 if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
545 # win32 cross compilation case
546 sdl_config="i386-mingw32msvc-sdl-config"
552 #undef main /* We don't want SDL to override our main() */
553 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
556 if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /tmp/qemu-$$-sdl-config.log ; then
557 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
558 if test "$_sdlversion" -lt 121 ; then
561 if test "$cocoa" = "no" ; then
566 # static link with sdl ?
567 if test "$sdl" = "yes" ; then
569 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
570 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
571 if [ "$aa" = "yes" ] ; then
572 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
575 if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
581 fi # sdl compile test
583 fi # cross compilation
586 # Make sure to disable cocoa if sdl was set
587 if test "$sdl" = "yes" ; then
593 ##########################################
594 # alsa sound support libraries
596 if test "$alsa" = "yes" ; then
598 #include <alsa/asoundlib.h>
599 int main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); }
601 if $cc -o $TMPE $TMPC -lasound 2> /dev/null ; then
605 echo "Error: Could not find alsa"
606 echo "Make sure to have the alsa libs and headers installed."
612 # Check if tools are available to build documentation.
613 if [ -x "`which texi2html 2>/dev/null`" ] && \
614 [ -x "`which pod2man 2>/dev/null`" ]; then
618 if test "$mingw32" = "yes" ; then
619 if test -z "$prefix" ; then
620 prefix="/c/Program Files/Qemu"
627 if test -z "$prefix" ; then
630 mansuffix="/share/man"
631 datasuffix="/share/qemu"
632 docsuffix="/share/doc/qemu"
636 echo "Install prefix $prefix"
637 echo "BIOS directory $prefix$datasuffix"
638 echo "binary directory $prefix$binsuffix"
639 if test "$mingw32" = "no" ; then
640 echo "Manual directory $prefix$mansuffix"
641 echo "ELF interp prefix $interp_prefix"
643 echo "Source path $source_path"
644 echo "C compiler $cc"
645 echo "Host C compiler $host_cc"
647 echo "install $install"
649 echo "host big endian $bigendian"
650 echo "target list $target_list"
651 echo "gprof enabled $gprof"
652 echo "profiler $profiler"
653 echo "static build $static"
654 if test "$darwin" = "yes" ; then
655 echo "Cocoa support $cocoa"
657 echo "SDL support $sdl"
658 if test "$sdl" != "no" ; then
659 echo "SDL static link $sdl_static"
661 echo "mingw32 support $mingw32"
662 echo "Adlib support $adlib"
663 echo "CoreAudio support $coreaudio"
664 echo "ALSA support $alsa"
665 echo "DSound support $dsound"
666 if test "$fmod" = "yes"; then
667 if test -z $fmod_lib || test -z $fmod_inc; then
669 echo "Error: You must specify path to FMOD library and headers"
670 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
674 fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
678 echo "FMOD support $fmod $fmod_support"
679 echo "OSS support $oss"
680 if test -n "$sparc_cpu"; then
681 echo "Target Sparc Arch $sparc_cpu"
683 echo "kqemu support $kqemu"
684 echo "Documentation $build_docs"
685 [ ! -z "$uname_release" ] && \
686 echo "uname -r $uname_release"
688 if test $sdl_too_old = "yes"; then
689 echo "-> Your SDL version is too old - please upgrade to have SDL support"
691 if [ -s /tmp/qemu-$$-sdl-config.log ]; then
692 echo "The error log from compiling the libSDL test is: "
693 cat /tmp/qemu-$$-sdl-config.log
695 rm -f /tmp/qemu-$$-sdl-config.log
696 #if test "$sdl_static" = "no"; then
697 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
699 config_mak="config-host.mak"
700 config_h="config-host.h"
702 #echo "Creating $config_mak and $config_h"
704 echo "# Automatically generated by configure - do not modify" > $config_mak
705 echo "# Configured with: $0 $@" >> $config_mak
706 echo "/* Automatically generated by configure - do not modify */" > $config_h
708 echo "prefix=$prefix" >> $config_mak
709 echo "bindir=\${prefix}$binsuffix" >> $config_mak
710 echo "mandir=\${prefix}$mansuffix" >> $config_mak
711 echo "datadir=\${prefix}$datasuffix" >> $config_mak
712 echo "docdir=\${prefix}$docsuffix" >> $config_mak
713 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
714 echo "MAKE=$make" >> $config_mak
715 echo "INSTALL=$install" >> $config_mak
716 echo "CC=$cc" >> $config_mak
717 echo "HOST_CC=$host_cc" >> $config_mak
718 echo "AR=$ar" >> $config_mak
719 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
720 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
721 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
722 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
723 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
724 echo "CFLAGS=$CFLAGS" >> $config_mak
725 echo "LDFLAGS=$LDFLAGS" >> $config_mak
726 echo "EXESUF=$EXESUF" >> $config_mak
727 echo "AIOLIBS=$AIOLIBS" >> $config_mak
728 if test "$cpu" = "i386" ; then
729 echo "ARCH=i386" >> $config_mak
730 echo "#define HOST_I386 1" >> $config_h
731 elif test "$cpu" = "x86_64" ; then
732 echo "ARCH=x86_64" >> $config_mak
733 echo "#define HOST_X86_64 1" >> $config_h
734 elif test "$cpu" = "armv4b" ; then
735 echo "ARCH=arm" >> $config_mak
736 echo "#define HOST_ARM 1" >> $config_h
737 elif test "$cpu" = "armv4l" ; then
738 echo "ARCH=arm" >> $config_mak
739 echo "#define HOST_ARM 1" >> $config_h
740 elif test "$cpu" = "powerpc" ; then
741 echo "ARCH=ppc" >> $config_mak
742 echo "#define HOST_PPC 1" >> $config_h
743 elif test "$cpu" = "mips" ; then
744 echo "ARCH=mips" >> $config_mak
745 echo "#define HOST_MIPS 1" >> $config_h
746 elif test "$cpu" = "mips64" ; then
747 echo "ARCH=mips64" >> $config_mak
748 echo "#define HOST_MIPS64 1" >> $config_h
749 elif test "$cpu" = "s390" ; then
750 echo "ARCH=s390" >> $config_mak
751 echo "#define HOST_S390 1" >> $config_h
752 elif test "$cpu" = "alpha" ; then
753 echo "ARCH=alpha" >> $config_mak
754 echo "#define HOST_ALPHA 1" >> $config_h
755 elif test "$cpu" = "sparc" ; then
756 echo "ARCH=sparc" >> $config_mak
757 echo "#define HOST_SPARC 1" >> $config_h
758 elif test "$cpu" = "sparc64" ; then
759 echo "ARCH=sparc64" >> $config_mak
760 echo "#define HOST_SPARC64 1" >> $config_h
761 elif test "$cpu" = "ia64" ; then
762 echo "ARCH=ia64" >> $config_mak
763 echo "#define HOST_IA64 1" >> $config_h
764 elif test "$cpu" = "m68k" ; then
765 echo "ARCH=m68k" >> $config_mak
766 echo "#define HOST_M68K 1" >> $config_h
768 echo "Unsupported CPU = $cpu"
771 if test "$bigendian" = "yes" ; then
772 echo "WORDS_BIGENDIAN=yes" >> $config_mak
773 echo "#define WORDS_BIGENDIAN 1" >> $config_h
775 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
776 if test "$mingw32" = "yes" ; then
777 echo "CONFIG_WIN32=yes" >> $config_mak
778 echo "#define CONFIG_WIN32 1" >> $config_h
781 #include <byteswap.h>
782 int main(void) { return bswap_32(0); }
784 if $cc -o $TMPE $TMPC 2> /dev/null ; then
785 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
788 if test "$darwin" = "yes" ; then
789 echo "CONFIG_DARWIN=yes" >> $config_mak
790 echo "#define CONFIG_DARWIN 1" >> $config_h
792 if test "$solaris" = "yes" ; then
793 echo "CONFIG_SOLARIS=yes" >> $config_mak
794 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
795 if test "$needs_libsunmath" = "yes" ; then
796 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
797 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
800 if test -n "$sparc_cpu"; then
801 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
802 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
804 if test "$gdbstub" = "yes" ; then
805 echo "CONFIG_GDBSTUB=yes" >> $config_mak
806 echo "#define CONFIG_GDBSTUB 1" >> $config_h
808 if test "$gprof" = "yes" ; then
809 echo "TARGET_GPROF=yes" >> $config_mak
810 echo "#define HAVE_GPROF 1" >> $config_h
812 if test "$static" = "yes" ; then
813 echo "CONFIG_STATIC=yes" >> $config_mak
814 echo "#define CONFIG_STATIC 1" >> $config_h
816 if test $profiler = "yes" ; then
817 echo "#define CONFIG_PROFILER 1" >> $config_h
819 if test "$slirp" = "yes" ; then
820 echo "CONFIG_SLIRP=yes" >> $config_mak
821 echo "#define CONFIG_SLIRP 1" >> $config_h
823 if test "$adlib" = "yes" ; then
824 echo "CONFIG_ADLIB=yes" >> $config_mak
825 echo "#define CONFIG_ADLIB 1" >> $config_h
827 if test "$oss" = "yes" ; then
828 echo "CONFIG_OSS=yes" >> $config_mak
829 echo "#define CONFIG_OSS 1" >> $config_h
831 if test "$coreaudio" = "yes" ; then
832 echo "CONFIG_COREAUDIO=yes" >> $config_mak
833 echo "#define CONFIG_COREAUDIO 1" >> $config_h
835 if test "$alsa" = "yes" ; then
836 echo "CONFIG_ALSA=yes" >> $config_mak
837 echo "#define CONFIG_ALSA 1" >> $config_h
839 if test "$dsound" = "yes" ; then
840 echo "CONFIG_DSOUND=yes" >> $config_mak
841 echo "#define CONFIG_DSOUND 1" >> $config_h
843 if test "$fmod" = "yes" ; then
844 echo "CONFIG_FMOD=yes" >> $config_mak
845 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
846 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
847 echo "#define CONFIG_FMOD 1" >> $config_h
849 qemu_version=`head $source_path/VERSION`
850 echo "VERSION=$qemu_version" >>$config_mak
851 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
853 echo "SRC_PATH=$source_path" >> $config_mak
854 if [ "$source_path_used" = "yes" ]; then
855 echo "VPATH=$source_path" >> $config_mak
857 echo "TARGET_DIRS=$target_list" >> $config_mak
858 if [ "$build_docs" = "yes" ] ; then
859 echo "BUILD_DOCS=yes" >> $config_mak
863 if [ "$bsd" = "yes" ] ; then
864 echo "#define O_LARGEFILE 0" >> $config_h
865 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
866 echo "#define _BSD 1" >> $config_h
869 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
871 for target in $target_list; do
873 config_mak=$target_dir/config.mak
874 config_h=$target_dir/config.h
875 target_cpu=`echo $target | cut -d '-' -f 1`
876 target_bigendian="no"
877 [ "$target_cpu" = "armeb" ] && target_bigendian=yes
878 [ "$target_cpu" = "sparc" ] && target_bigendian=yes
879 [ "$target_cpu" = "sparc64" ] && target_bigendian=yes
880 [ "$target_cpu" = "ppc" ] && target_bigendian=yes
881 [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
882 [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
883 [ "$target_cpu" = "mips" ] && target_bigendian=yes
884 [ "$target_cpu" = "mips64" ] && target_bigendian=yes
885 [ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
886 [ "$target_cpu" = "m68k" ] && target_bigendian=yes
888 target_user_only="no"
889 target_linux_user="no"
890 target_darwin_user="no"
892 ${target_cpu}-softmmu)
895 ${target_cpu}-linux-user)
896 target_user_only="yes"
897 target_linux_user="yes"
899 ${target_cpu}-darwin-user)
900 target_user_only="yes"
901 target_darwin_user="yes"
904 echo "ERROR: Target '$target' not recognised"
909 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
910 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
911 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
912 echo "To build QEMU without graphical output configure with --disable-gfx-check"
913 echo "Note that this will disable all output from the virtual graphics card."
917 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
920 mkdir -p $target_dir/fpu
921 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then
922 mkdir -p $target_dir/nwfpe
924 if test "$target_user_only" = "no" ; then
925 mkdir -p $target_dir/slirp
929 # don't use ln -sf as not all "ln -sf" over write the file/link
931 rm -f $target_dir/Makefile
932 ln -s $source_path/Makefile.target $target_dir/Makefile
935 echo "# Automatically generated by configure - do not modify" > $config_mak
936 echo "/* Automatically generated by configure - do not modify */" > $config_h
939 echo "include ../config-host.mak" >> $config_mak
940 echo "#include \"../config-host.h\"" >> $config_h
943 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
944 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
946 if test "$target_cpu" = "i386" ; then
947 echo "TARGET_ARCH=i386" >> $config_mak
948 echo "#define TARGET_ARCH \"i386\"" >> $config_h
949 echo "#define TARGET_I386 1" >> $config_h
950 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
951 echo "#define USE_KQEMU 1" >> $config_h
953 elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
954 echo "TARGET_ARCH=arm" >> $config_mak
955 echo "#define TARGET_ARCH \"arm\"" >> $config_h
956 echo "#define TARGET_ARM 1" >> $config_h
958 elif test "$target_cpu" = "sparc" ; then
959 echo "TARGET_ARCH=sparc" >> $config_mak
960 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
961 echo "#define TARGET_SPARC 1" >> $config_h
962 elif test "$target_cpu" = "sparc64" ; then
963 echo "TARGET_ARCH=sparc64" >> $config_mak
964 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
965 echo "#define TARGET_SPARC 1" >> $config_h
966 echo "#define TARGET_SPARC64 1" >> $config_h
967 elif test "$target_cpu" = "ppc" ; then
968 echo "TARGET_ARCH=ppc" >> $config_mak
969 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
970 echo "#define TARGET_PPC 1" >> $config_h
971 elif test "$target_cpu" = "ppc64" ; then
972 echo "TARGET_ARCH=ppc64" >> $config_mak
973 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
974 echo "#define TARGET_PPC 1" >> $config_h
975 echo "#define TARGET_PPC64 1" >> $config_h
976 elif test "$target_cpu" = "ppcemb" ; then
977 echo "TARGET_ARCH=ppcemb" >> $config_mak
978 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
979 echo "#define TARGET_PPC 1" >> $config_h
980 echo "#define TARGET_PPCEMB 1" >> $config_h
981 elif test "$target_cpu" = "x86_64" ; then
982 echo "TARGET_ARCH=x86_64" >> $config_mak
983 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
984 echo "#define TARGET_I386 1" >> $config_h
985 echo "#define TARGET_X86_64 1" >> $config_h
986 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then
987 echo "#define USE_KQEMU 1" >> $config_h
989 elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
990 echo "TARGET_ARCH=mips" >> $config_mak
991 echo "#define TARGET_ARCH \"mips\"" >> $config_h
992 echo "#define TARGET_MIPS 1" >> $config_h
993 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
994 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
995 elif test "$target_cpu" = "mips64" -o "$target_cpu" = "mips64el" ; then
996 echo "TARGET_ARCH=mips64" >> $config_mak
997 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
998 echo "#define TARGET_MIPS 1" >> $config_h
999 echo "#define TARGET_MIPS64 1" >> $config_h
1000 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1001 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1002 elif test "$target_cpu" = "sh4" -o "$target_cpu" = "sh4eb" ; then
1003 echo "TARGET_ARCH=sh4" >> $config_mak
1004 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1005 echo "#define TARGET_SH4 1" >> $config_h
1007 elif test "$target_cpu" = "m68k" ; then
1008 echo "TARGET_ARCH=m68k" >> $config_mak
1009 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1010 echo "#define TARGET_M68K 1" >> $config_h
1012 elif test "$target_cpu" = "alpha" ; then
1013 echo "TARGET_ARCH=alpha" >> $config_mak
1014 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1015 echo "#define TARGET_ALPHA 1" >> $config_h
1017 echo "Unsupported target CPU"
1020 if test "$target_bigendian" = "yes" ; then
1021 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1022 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1024 if test "$target_softmmu" = "yes" ; then
1025 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1026 echo "#define CONFIG_SOFTMMU 1" >> $config_h
1028 if test "$target_user_only" = "yes" ; then
1029 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1030 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1032 if test "$target_linux_user" = "yes" ; then
1033 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1034 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1036 if test "$target_darwin_user" = "yes" ; then
1037 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1038 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1041 if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" -o "$target_cpu" = "sparc" -o "$target_cpu" = "sparc64" -o "$target_cpu" = "m68k"; then
1042 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1043 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1045 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1046 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1047 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1051 if test "$target_user_only" = "no"; then
1052 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1057 if test "$sdl1" = "yes" ; then
1058 echo "#define CONFIG_SDL 1" >> $config_h
1059 echo "CONFIG_SDL=yes" >> $config_mak
1060 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1061 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1063 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1065 if [ "${aa}" = "yes" ] ; then
1066 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1068 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1073 if test "$cocoa" = "yes" ; then
1074 echo "#define CONFIG_COCOA 1" >> $config_h
1075 echo "CONFIG_COCOA=yes" >> $config_mak
1078 done # for target in $targets
1080 # build tree in object directory if source path is different from current one
1081 if test "$source_path_used" = "yes" ; then
1083 FILES="Makefile tests/Makefile"
1084 for dir in $DIRS ; do
1087 # remove the link and recreate it, as not all "ln -sf" overwrite the link
1088 for f in $FILES ; do
1090 ln -s $source_path/$f $f
1094 rm -f $TMPO $TMPC $TMPE $TMPS