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.6 gcc-3.3 gcc33 gcc-3.2 gcc32"
35 i386|i486|i586|i686|i86pc|BePC
)
47 "Power Macintosh"|ppc|ppc64
)
113 OS_CFLAGS
="-mno-cygwin"
114 VL_OS_LDFLAGS
="-mno-cygwin"
115 if [ "$cpu" = "i386" ] ; then
121 if [ "$cpu" = "i386" ] ; then
127 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
134 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
153 OS_CFLAGS
="-mdynamic-no-pic"
159 needs_libsunmath
="no"
160 solarisrev
=`uname -r | cut -f2 -d.`
161 # have to select again, because `uname -m` returns i86pc
162 # even on an x86_64 box.
163 solariscpu
=`isainfo -k`
164 if test "${solariscpu}" = "amd64" ; then
167 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
168 if test "$solarisrev" -le 9 ; then
169 if test -f /opt
/SUNWspro
/prod
/lib
/libsunmath.so
.1; then
170 needs_libsunmath
="yes"
172 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
173 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
174 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
175 echo "Studio 11 can be downloaded from www.sun.com."
179 if test "$solarisrev" -ge 9 ; then
183 if test -f /usr
/include
/sys
/soundcard.h
; then
191 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
198 if [ "$bsd" = "yes" ] ; then
199 if [ "$darwin" != "yes" ] ; then
205 source_path
=`dirname "$0"`
206 if [ -z "$source_path" ]; then
209 source_path
=`cd "$source_path"; pwd`
211 if test "$source_path" = `pwd` ; then
212 source_path_used
="no"
214 source_path_used
="yes"
218 optarg
=`expr "x$opt" : 'x[^=]*=\(.*\)'`
220 --help|
-h) show_help
=yes
222 --prefix=*) prefix
="$optarg"
224 --interp-prefix=*) interp_prefix
="$optarg"
226 --source-path=*) source_path
="$optarg"
227 source_path_used
="yes"
229 --cross-prefix=*) cross_prefix
="$optarg"
234 --host-cc=*) host_cc
="$optarg"
236 --make=*) make="$optarg"
238 --install=*) install="$optarg"
240 --extra-cflags=*) CFLAGS
="$optarg"
242 --extra-ldflags=*) LDFLAGS
="$optarg"
244 --cpu=*) cpu
="$optarg"
246 --target-list=*) target_list
="$optarg"
248 --enable-gprof) gprof
="yes"
250 --static) static
="yes"
252 --disable-sdl) sdl
="no"
254 --enable-coreaudio) coreaudio
="yes"
256 --enable-alsa) alsa
="yes"
258 --enable-dsound) dsound
="yes"
260 --enable-fmod) fmod
="yes"
262 --fmod-lib=*) fmod_lib
="$optarg"
264 --fmod-inc=*) fmod_inc
="$optarg"
266 --disable-vnc-tls) vnc_tls
="no"
268 --enable-mingw32) mingw32
="yes" ; cross_prefix
="i386-mingw32-" ; linux_user
="no"
270 --disable-slirp) slirp
="no"
272 --enable-adlib) adlib
="yes"
274 --disable-kqemu) kqemu
="no"
276 --enable-kvm) kvm
="yes"
278 --enable-profiler) profiler
="yes"
280 --kernel-path=*) kernel_path
="$optarg"
282 --enable-cocoa) cocoa
="yes" ; coreaudio
="yes" ; sdl
="no"
284 --disable-gfx-check) check_gfx
="no"
286 --disable-gcc-check) check_gcc
="no"
288 --disable-system) softmmu
="no"
290 --enable-system) softmmu
="yes"
292 --disable-linux-user) linux_user
="no"
294 --enable-linux-user) linux_user
="yes"
296 --disable-darwin-user) darwin_user
="no"
298 --enable-darwin-user) darwin_user
="yes"
300 --enable-uname-release=*) uname_release
="$optarg"
305 v7|v8
) SP_CFLAGS
="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m32"
306 target_cpu
="sparc"; cpu
="sparc" ;;
307 v8plus|v8plusa
) SP_CFLAGS
="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m32"
308 target_cpu
="sparc"; cpu
="sparc" ;;
309 v9
) SP_CFLAGS
="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m64"
310 target_cpu
="sparc64"; cpu
="sparc64" ;;
311 *) echo "undefined SPARC architecture. Exiting";exit 1;;
317 if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
323 # default flags for all hosts
324 CFLAGS
="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
325 LDFLAGS
="$LDFLAGS -g"
328 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
329 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
332 sparc
) if test -z "$sparc_cpu" ; then
333 ARCH_CFLAGS
="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
336 ARCH_CFLAGS
="${SP_CFLAGS}"
337 ARCH_LDFLAGS
="${SP_LDFLAGS}"
340 sparc64
) if test -z "$sparc_cpu" ; then
341 ARCH_CFLAGS
="-m64 -mcpu=ultrasparc -D__sparc_v9__"
344 ARCH_CFLAGS
="${SP_CFLAGS}"
345 ARCH_LDFLAGS
="${SP_LDFLAGS}"
350 if [ "$solaris" = "yes" -a "$cpu" = "x86_64" ] ; then
351 CFLAGS
="${CFLAGS} -m64"
352 OS_CFLAGS
="${OS_CFLAGS} -m64"
355 if [ "$solaris" = "yes" -a "$cpu" = "i386" ] ; then
356 CFLAGS
="${CFLAGS} -m32"
357 OS_CFLAGS
="${OS_CFLAGS} -m32"
360 if test x
"$show_help" = x
"yes" ; then
363 Usage: configure [options]
364 Options: [defaults in brackets after descriptions]
367 echo "Standard options:"
368 echo " --help print this message"
369 echo " --prefix=PREFIX install in PREFIX [$prefix]"
370 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
371 echo " use %M for cpu name [$interp_prefix]"
372 echo " --target-list=LIST set target list [$target_list]"
374 echo "kqemu kernel acceleration support:"
375 echo " --disable-kqemu disable kqemu support"
376 echo " --kernel-path=PATH set the kernel path (configure probes it)"
377 echo " --enable-kvm enable kernel virtual machine support"
379 echo "Advanced options (experts only):"
380 echo " --source-path=PATH path of source code [$source_path]"
381 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
382 echo " --cc=CC use C compiler CC [$cc]"
383 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
384 echo " --make=MAKE use specified make [$make]"
385 echo " --install=INSTALL use specified install [$install]"
386 echo " --static enable static build [$static]"
387 echo " --enable-cocoa enable COCOA (Mac OS X only)"
388 echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
389 echo " --enable-adlib enable Adlib emulation"
390 echo " --enable-coreaudio enable Coreaudio audio driver"
391 echo " --enable-alsa enable ALSA audio driver"
392 echo " --enable-fmod enable FMOD audio driver"
393 echo " --enable-dsound enable DirectSound audio driver"
394 echo " --disable-vnc-tls disable TLS encryption for VNC server"
395 echo " --enable-system enable all system emulation targets"
396 echo " --disable-system disable all system emulation targets"
397 echo " --enable-linux-user enable all linux usermode emulation targets"
398 echo " --disable-linux-user disable all linux usermode emulation targets"
399 echo " --enable-darwin-user enable all darwin usermode emulation targets"
400 echo " --disable-darwin-user disable all darwin usermode emulation targets"
401 echo " --fmod-lib path to FMOD library"
402 echo " --fmod-inc path to FMOD includes"
403 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
404 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
406 echo "NOTE: The object files are built at the place where configure is launched"
410 cc
="${cross_prefix}${cc}"
411 ar="${cross_prefix}${ar}"
412 strip
="${cross_prefix}${strip}"
414 # check that the C compiler works.
419 if $cc -c -o $TMPO $TMPC 2> /dev
/null
; then
420 : C compiler works ok
422 echo "ERROR: \"$cc\" either does not exist or does not work"
426 if test "$mingw32" = "yes" ; then
432 # Check for gcc4, error if pre-gcc4
433 if test "$check_gcc" = "yes" ; then
438 int main(){return 0;}
440 if "$cc" -o $TMPE $TMPC 2> /dev
/null
; then
441 echo "WARNING: \"$cc\" looks like gcc 4.x"
443 if test "$gcc3_search" = "yes" ; then
444 echo "Looking for gcc 3.x"
445 for compat_cc
in $gcc3_list ; do
446 if "$cross_prefix$compat_cc" --version 2> /dev
/null | fgrep
'(GCC) 3.' > /dev
/null
2>&1 ; then
447 echo "Found \"$compat_cc\""
448 cc
="$cross_prefix$compat_cc"
449 found_compat_cc
="yes"
453 if test "$found_compat_cc" = "no" ; then
454 echo "gcc 3.x not found!"
457 if test "$found_compat_cc" = "no" ; then
458 echo "QEMU is known to have problems when compiled with gcc 4.x"
459 echo "It is recommended that you use gcc 3.x to build QEMU"
460 echo "To use this compiler anyway, configure with --disable-gcc-check"
467 # Solaris specific configure tool chain decisions
469 if test "$solaris" = "yes" ; then
471 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
472 # override the check with --disable-gcc-check
474 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
476 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
477 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
478 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
479 echo "or get the latest patch from SunSolve for gcc"
483 solinst
=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
484 if test -z "$solinst" ; then
485 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
486 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
487 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
490 if test "$solinst" = "/usr/sbin/install" ; then
491 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
492 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
493 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
496 sol_ar
=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
497 if test -z "$sol_ar" ; then
498 echo "Error: No path includes ar"
499 if test -f /usr
/ccs
/bin
/ar ; then
500 echo "Add /usr/ccs/bin to your path and rerun configure"
507 if test -z "$target_list" ; then
508 # these targets are portable
509 if [ "$softmmu" = "yes" ] ; then
510 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 sh4-softmmu"
512 # the following are Linux specific
513 if [ "$linux_user" = "yes" ] ; then
514 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 ppc64-linux-user sh4-linux-user $target_list"
516 # the following are Darwin specific
517 if [ "$darwin_user" = "yes" ] ; then
518 target_list
="i386-darwin-user ppc-darwin-user $target_list"
521 target_list
=`echo "$target_list" | sed -e 's/,/ /g'`
523 if test -z "$target_list" ; then
524 echo "No targets enabled"
528 if test -z "$cross_prefix" ; then
531 # big/little endian test
533 #include <inttypes.h>
534 int main(int argc, char ** argv){
535 volatile uint32_t i=0x01234567;
536 return (*((uint8_t*)(&i))) == 0x67;
540 if $cc -o $TMPE $TMPC 2> /dev
/null
; then
541 $TMPE && bigendian
="yes"
543 echo big
/little
test failed
548 # if cross compiling, cannot launch a program, so make a static guess
549 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
555 # host long bits test
557 if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
561 # check gcc options support
567 ##########################################
572 if test -z "$sdl" ; then
573 sdl_config
="sdl-config"
577 if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
578 # win32 cross compilation case
579 sdl_config
="i386-mingw32msvc-sdl-config"
585 #undef main /* We don't want SDL to override our main() */
586 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
588 if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /tmp
/qemu-$$
-sdl-config.log
; then
589 _sdlversion
=`$sdl_config --version | sed 's/[^0-9]//g'`
590 if test "$_sdlversion" -lt 121 ; then
593 if test "$cocoa" = "no" ; then
598 # static link with sdl ?
599 if test "$sdl" = "yes" ; then
601 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa
="yes"
602 sdl_static_libs
=`$sdl_config --static-libs 2>/dev/null`
603 if [ "$aa" = "yes" ] ; then
604 sdl_static_libs
="$sdl_static_libs `aalib-config --static-libs`"
607 if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev
/null
; then
611 fi # sdl compile test
612 fi # cross compilation
614 # Make sure to disable cocoa if sdl was set
615 if test "$sdl" = "yes" ; then
621 ##########################################
623 if test "$vnc_tls" = "yes" ; then
624 `pkg-config gnutls` || vnc_tls
="no"
626 if test "$vnc_tls" = "yes" ; then
627 vnc_tls_cflags
=`pkg-config --cflags gnutls`
628 vnc_tls_libs
=`pkg-config --libs gnutls`
631 ##########################################
632 # alsa sound support libraries
634 if test "$alsa" = "yes" ; then
636 #include <alsa/asoundlib.h>
637 int main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); }
639 if $cc -o $TMPE $TMPC -lasound 2> /dev
/null
; then
643 echo "Error: Could not find alsa"
644 echo "Make sure to have the alsa libs and headers installed."
650 # Check if tools are available to build documentation.
651 if [ -x "`which texi2html 2>/dev/null`" ] && \
652 [ -x "`which pod2man 2>/dev/null`" ]; then
656 if test "$mingw32" = "yes" ; then
657 if test -z "$prefix" ; then
658 prefix
="/c/Program Files/Qemu"
665 if test -z "$prefix" ; then
668 mansuffix
="/share/man"
669 datasuffix
="/share/qemu"
670 docsuffix
="/share/doc/qemu"
674 echo "Install prefix $prefix"
675 echo "BIOS directory $prefix$datasuffix"
676 echo "binary directory $prefix$binsuffix"
677 if test "$mingw32" = "no" ; then
678 echo "Manual directory $prefix$mansuffix"
679 echo "ELF interp prefix $interp_prefix"
681 echo "Source path $source_path"
682 echo "C compiler $cc"
683 echo "Host C compiler $host_cc"
685 echo "install $install"
687 echo "host big endian $bigendian"
688 echo "target list $target_list"
689 echo "gprof enabled $gprof"
690 echo "profiler $profiler"
691 echo "static build $static"
692 if test "$darwin" = "yes" ; then
693 echo "Cocoa support $cocoa"
695 echo "SDL support $sdl"
696 if test "$sdl" != "no" ; then
697 echo "SDL static link $sdl_static"
699 echo "mingw32 support $mingw32"
700 echo "Adlib support $adlib"
701 echo "CoreAudio support $coreaudio"
702 echo "ALSA support $alsa"
703 echo "DSound support $dsound"
704 if test "$fmod" = "yes"; then
705 if test -z $fmod_lib ||
test -z $fmod_inc; then
707 echo "Error: You must specify path to FMOD library and headers"
708 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
712 fmod_support
=" (lib='$fmod_lib' include='$fmod_inc')"
716 echo "FMOD support $fmod $fmod_support"
717 echo "OSS support $oss"
718 echo "VNC TLS support $vnc_tls"
719 if test "$vnc_tls" = "yes" ; then
720 echo " TLS CFLAGS $vnc_tls_cflags"
721 echo " TLS LIBS $vnc_tls_libs"
723 if test -n "$sparc_cpu"; then
724 echo "Target Sparc Arch $sparc_cpu"
726 echo "kqemu support $kqemu"
727 echo "kvm support $kvm"
728 echo "Documentation $build_docs"
729 [ ! -z "$uname_release" ] && \
730 echo "uname -r $uname_release"
732 if test $sdl_too_old = "yes"; then
733 echo "-> Your SDL version is too old - please upgrade to have SDL support"
735 if [ -s /tmp
/qemu-$$
-sdl-config.log
]; then
736 echo "The error log from compiling the libSDL test is: "
737 cat /tmp
/qemu-$$
-sdl-config.log
739 rm -f /tmp
/qemu-$$
-sdl-config.log
740 #if test "$sdl_static" = "no"; then
741 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
743 config_mak
="config-host.mak"
744 config_h
="config-host.h"
746 #echo "Creating $config_mak and $config_h"
748 test -f $config_h && mv $config_h ${config_h}~
750 echo "# Automatically generated by configure - do not modify" > $config_mak
751 echo "# Configured with: $0 $@" >> $config_mak
752 echo "/* Automatically generated by configure - do not modify */" > $config_h
754 echo "prefix=$prefix" >> $config_mak
755 echo "bindir=\${prefix}$binsuffix" >> $config_mak
756 echo "mandir=\${prefix}$mansuffix" >> $config_mak
757 echo "datadir=\${prefix}$datasuffix" >> $config_mak
758 echo "docdir=\${prefix}$docsuffix" >> $config_mak
759 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
760 echo "MAKE=$make" >> $config_mak
761 echo "INSTALL=$install" >> $config_mak
762 echo "CC=$cc" >> $config_mak
763 echo "HOST_CC=$host_cc" >> $config_mak
764 echo "AR=$ar" >> $config_mak
765 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
766 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
767 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
768 echo "VL_OS_LDFLAGS=$VL_OS_LDFLAGS" >> $config_mak
769 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
770 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
771 echo "CFLAGS=$CFLAGS" >> $config_mak
772 echo "LDFLAGS=$LDFLAGS" >> $config_mak
773 echo "EXESUF=$EXESUF" >> $config_mak
774 echo "AIOLIBS=$AIOLIBS" >> $config_mak
775 if test "$cpu" = "i386" ; then
776 echo "ARCH=i386" >> $config_mak
777 echo "#define HOST_I386 1" >> $config_h
778 elif test "$cpu" = "x86_64" ; then
779 echo "ARCH=x86_64" >> $config_mak
780 echo "#define HOST_X86_64 1" >> $config_h
781 elif test "$cpu" = "armv4b" ; then
782 echo "ARCH=arm" >> $config_mak
783 echo "#define HOST_ARM 1" >> $config_h
784 elif test "$cpu" = "armv4l" ; then
785 echo "ARCH=arm" >> $config_mak
786 echo "#define HOST_ARM 1" >> $config_h
787 elif test "$cpu" = "powerpc" ; then
788 echo "ARCH=ppc" >> $config_mak
789 echo "#define HOST_PPC 1" >> $config_h
790 elif test "$cpu" = "mips" ; then
791 echo "ARCH=mips" >> $config_mak
792 echo "#define HOST_MIPS 1" >> $config_h
793 elif test "$cpu" = "mips64" ; then
794 echo "ARCH=mips64" >> $config_mak
795 echo "#define HOST_MIPS64 1" >> $config_h
796 elif test "$cpu" = "s390" ; then
797 echo "ARCH=s390" >> $config_mak
798 echo "#define HOST_S390 1" >> $config_h
799 elif test "$cpu" = "alpha" ; then
800 echo "ARCH=alpha" >> $config_mak
801 echo "#define HOST_ALPHA 1" >> $config_h
802 elif test "$cpu" = "sparc" ; then
803 echo "ARCH=sparc" >> $config_mak
804 echo "#define HOST_SPARC 1" >> $config_h
805 elif test "$cpu" = "sparc64" ; then
806 echo "ARCH=sparc64" >> $config_mak
807 echo "#define HOST_SPARC64 1" >> $config_h
808 elif test "$cpu" = "ia64" ; then
809 echo "ARCH=ia64" >> $config_mak
810 echo "#define HOST_IA64 1" >> $config_h
811 elif test "$cpu" = "m68k" ; then
812 echo "ARCH=m68k" >> $config_mak
813 echo "#define HOST_M68K 1" >> $config_h
815 echo "Unsupported CPU = $cpu"
818 if test "$bigendian" = "yes" ; then
819 echo "WORDS_BIGENDIAN=yes" >> $config_mak
820 echo "#define WORDS_BIGENDIAN 1" >> $config_h
822 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
823 if test "$mingw32" = "yes" ; then
824 echo "CONFIG_WIN32=yes" >> $config_mak
825 echo "#define CONFIG_WIN32 1" >> $config_h
828 #include <byteswap.h>
829 int main(void) { return bswap_32(0); }
831 if $cc -o $TMPE $TMPC 2> /dev
/null
; then
832 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
835 if test "$darwin" = "yes" ; then
836 echo "CONFIG_DARWIN=yes" >> $config_mak
837 echo "#define CONFIG_DARWIN 1" >> $config_h
839 if test "$solaris" = "yes" ; then
840 echo "CONFIG_SOLARIS=yes" >> $config_mak
841 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
842 if test "$needs_libsunmath" = "yes" ; then
843 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
844 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
847 if test -n "$sparc_cpu"; then
848 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
849 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
851 if test "$gdbstub" = "yes" ; then
852 echo "CONFIG_GDBSTUB=yes" >> $config_mak
853 echo "#define CONFIG_GDBSTUB 1" >> $config_h
855 if test "$gprof" = "yes" ; then
856 echo "TARGET_GPROF=yes" >> $config_mak
857 echo "#define HAVE_GPROF 1" >> $config_h
859 if test "$static" = "yes" ; then
860 echo "CONFIG_STATIC=yes" >> $config_mak
861 echo "#define CONFIG_STATIC 1" >> $config_h
863 if test $profiler = "yes" ; then
864 echo "#define CONFIG_PROFILER 1" >> $config_h
866 if test "$slirp" = "yes" ; then
867 echo "CONFIG_SLIRP=yes" >> $config_mak
868 echo "#define CONFIG_SLIRP 1" >> $config_h
870 if test "$adlib" = "yes" ; then
871 echo "CONFIG_ADLIB=yes" >> $config_mak
872 echo "#define CONFIG_ADLIB 1" >> $config_h
874 if test "$oss" = "yes" ; then
875 echo "CONFIG_OSS=yes" >> $config_mak
876 echo "#define CONFIG_OSS 1" >> $config_h
878 if test "$coreaudio" = "yes" ; then
879 echo "CONFIG_COREAUDIO=yes" >> $config_mak
880 echo "#define CONFIG_COREAUDIO 1" >> $config_h
882 if test "$alsa" = "yes" ; then
883 echo "CONFIG_ALSA=yes" >> $config_mak
884 echo "#define CONFIG_ALSA 1" >> $config_h
886 if test "$dsound" = "yes" ; then
887 echo "CONFIG_DSOUND=yes" >> $config_mak
888 echo "#define CONFIG_DSOUND 1" >> $config_h
890 if test "$fmod" = "yes" ; then
891 echo "CONFIG_FMOD=yes" >> $config_mak
892 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
893 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
894 echo "#define CONFIG_FMOD 1" >> $config_h
896 if test "$vnc_tls" = "yes" ; then
897 echo "CONFIG_VNC_TLS=yes" >> $config_mak
898 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
899 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
900 echo "#define CONFIG_VNC_TLS 1" >> $config_h
902 qemu_version
=`head $source_path/VERSION`
903 echo "VERSION=$qemu_version" >>$config_mak
904 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
906 echo "SRC_PATH=$source_path" >> $config_mak
907 if [ "$source_path_used" = "yes" ]; then
908 echo "VPATH=$source_path" >> $config_mak
910 echo "TARGET_DIRS=$target_list" >> $config_mak
911 if [ "$build_docs" = "yes" ] ; then
912 echo "BUILD_DOCS=yes" >> $config_mak
916 if [ "$bsd" = "yes" ] ; then
917 echo "#define O_LARGEFILE 0" >> $config_h
918 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
919 echo "#define _BSD 1" >> $config_h
922 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
925 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
926 tools
="qemu-img\$(EXESUF) $tools"
928 echo "TOOLS=$tools" >> $config_mak
930 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~
$config_h
932 for target
in $target_list; do
934 config_mak
=$target_dir/config.mak
935 config_h
=$target_dir/config.h
936 target_cpu
=`echo $target | cut -d '-' -f 1`
937 target_bigendian
="no"
938 [ "$target_cpu" = "armeb" ] && target_bigendian
=yes
939 [ "$target_cpu" = "sparc" ] && target_bigendian
=yes
940 [ "$target_cpu" = "sparc64" ] && target_bigendian
=yes
941 [ "$target_cpu" = "ppc" ] && target_bigendian
=yes
942 [ "$target_cpu" = "ppc64" ] && target_bigendian
=yes
943 [ "$target_cpu" = "ppcemb" ] && target_bigendian
=yes
944 [ "$target_cpu" = "mips" ] && target_bigendian
=yes
945 [ "$target_cpu" = "mipsn32" ] && target_bigendian
=yes
946 [ "$target_cpu" = "mips64" ] && target_bigendian
=yes
947 [ "$target_cpu" = "sh4eb" ] && target_bigendian
=yes
948 [ "$target_cpu" = "m68k" ] && target_bigendian
=yes
950 target_user_only
="no"
951 target_linux_user
="no"
952 target_darwin_user
="no"
954 ${target_cpu}-softmmu)
957 ${target_cpu}-linux-user)
958 target_user_only
="yes"
959 target_linux_user
="yes"
961 ${target_cpu}-darwin-user)
962 target_user_only
="yes"
963 target_darwin_user
="yes"
966 echo "ERROR: Target '$target' not recognised"
971 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
972 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
973 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
974 echo "To build QEMU without graphical output configure with --disable-gfx-check"
975 echo "Note that this will disable all output from the virtual graphics card."
979 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
981 test -f $config_h && mv $config_h ${config_h}~
984 mkdir
-p $target_dir/fpu
985 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then
986 mkdir
-p $target_dir/nwfpe
988 if test "$target_user_only" = "no" ; then
989 mkdir
-p $target_dir/slirp
993 # don't use ln -sf as not all "ln -sf" over write the file/link
995 rm -f $target_dir/Makefile
996 ln -s $source_path/Makefile.target
$target_dir/Makefile
999 echo "# Automatically generated by configure - do not modify" > $config_mak
1000 echo "/* Automatically generated by configure - do not modify */" > $config_h
1003 echo "include ../config-host.mak" >> $config_mak
1004 echo "#include \"../config-host.h\"" >> $config_h
1007 interp_prefix1
=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1008 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1011 if test $kvm = "yes" -a "$target_softmmu" = "yes" -a \
1012 \
( "$cpu" = "i386" -o "$cpu" = "x86_64" \
); then
1013 echo "#define USE_KVM 1" >> $config_h
1014 echo "CONFIG_KVM_KERNEL_INC=$kernel_path/include" >> $config_mak
1018 if test "$target_cpu" = "i386" ; then
1019 echo "TARGET_ARCH=i386" >> $config_mak
1020 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1021 echo "#define TARGET_I386 1" >> $config_h
1022 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
1023 echo "#define USE_KQEMU 1" >> $config_h
1026 elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
1027 echo "TARGET_ARCH=arm" >> $config_mak
1028 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1029 echo "#define TARGET_ARM 1" >> $config_h
1031 elif test "$target_cpu" = "sparc" ; then
1032 echo "TARGET_ARCH=sparc" >> $config_mak
1033 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1034 echo "#define TARGET_SPARC 1" >> $config_h
1035 elif test "$target_cpu" = "sparc64" ; then
1036 echo "TARGET_ARCH=sparc64" >> $config_mak
1037 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1038 echo "#define TARGET_SPARC 1" >> $config_h
1039 echo "#define TARGET_SPARC64 1" >> $config_h
1040 elif test "$target_cpu" = "ppc" ; then
1041 echo "TARGET_ARCH=ppc" >> $config_mak
1042 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1043 echo "#define TARGET_PPC 1" >> $config_h
1044 elif test "$target_cpu" = "ppc64" ; then
1045 echo "TARGET_ARCH=ppc64" >> $config_mak
1046 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1047 echo "#define TARGET_PPC 1" >> $config_h
1048 echo "#define TARGET_PPC64 1" >> $config_h
1049 elif test "$target_cpu" = "ppcemb" ; then
1050 echo "TARGET_ARCH=ppcemb" >> $config_mak
1051 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1052 echo "#define TARGET_PPC 1" >> $config_h
1053 echo "#define TARGET_PPCEMB 1" >> $config_h
1054 elif test "$target_cpu" = "x86_64" ; then
1055 echo "TARGET_ARCH=x86_64" >> $config_mak
1056 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1057 echo "#define TARGET_I386 1" >> $config_h
1058 echo "#define TARGET_X86_64 1" >> $config_h
1059 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then
1060 echo "#define USE_KQEMU 1" >> $config_h
1063 elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
1064 echo "TARGET_ARCH=mips" >> $config_mak
1065 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1066 echo "#define TARGET_MIPS 1" >> $config_h
1067 elif test "$target_cpu" = "mipsn32" -o "$target_cpu" = "mipsn32el" ; then
1068 echo "TARGET_ARCH=mipsn32" >> $config_mak
1069 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1070 echo "#define TARGET_MIPS 1" >> $config_h
1071 echo "#define TARGET_MIPSN32 1" >> $config_h
1072 elif test "$target_cpu" = "mips64" -o "$target_cpu" = "mips64el" ; then
1073 echo "TARGET_ARCH=mips64" >> $config_mak
1074 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1075 echo "#define TARGET_MIPS 1" >> $config_h
1076 echo "#define TARGET_MIPS64 1" >> $config_h
1077 elif test "$target_cpu" = "sh4" -o "$target_cpu" = "sh4eb" ; then
1078 echo "TARGET_ARCH=sh4" >> $config_mak
1079 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1080 echo "#define TARGET_SH4 1" >> $config_h
1082 elif test "$target_cpu" = "m68k" ; then
1083 echo "TARGET_ARCH=m68k" >> $config_mak
1084 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1085 echo "#define TARGET_M68K 1" >> $config_h
1087 elif test "$target_cpu" = "alpha" ; then
1088 echo "TARGET_ARCH=alpha" >> $config_mak
1089 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1090 echo "#define TARGET_ALPHA 1" >> $config_h
1092 echo "Unsupported target CPU"
1095 if test "$target_bigendian" = "yes" ; then
1096 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1097 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1099 if test "$target_softmmu" = "yes" ; then
1100 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1101 echo "#define CONFIG_SOFTMMU 1" >> $config_h
1103 if test "$target_user_only" = "yes" ; then
1104 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1105 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1107 if test "$target_linux_user" = "yes" ; then
1108 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1109 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1111 if test "$target_darwin_user" = "yes" ; then
1112 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1113 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1116 if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" -o "$target_cpu" = "sparc" -o "$target_cpu" = "sparc64" -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
1117 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1118 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1120 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1121 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1122 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1126 if test "$target_user_only" = "no"; then
1127 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1132 if test "$sdl1" = "yes" ; then
1133 echo "#define CONFIG_SDL 1" >> $config_h
1134 echo "CONFIG_SDL=yes" >> $config_mak
1135 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1136 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1138 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1140 if [ "${aa}" = "yes" ] ; then
1141 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1143 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1148 if test "$cocoa" = "yes" ; then
1149 echo "#define CONFIG_COCOA 1" >> $config_h
1150 echo "CONFIG_COCOA=yes" >> $config_mak
1153 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~
$config_h
1155 done # for target in $targets
1157 # build tree in object directory if source path is different from current one
1158 if test "$source_path_used" = "yes" ; then
1160 FILES
="Makefile tests/Makefile"
1161 for dir
in $DIRS ; do
1164 # remove the link and recreate it, as not all "ln -sf" overwrite the link
1165 for f
in $FILES ; do
1167 ln -s $source_path/$f $f
1171 rm -f $TMPO $TMPC $TMPE $TMPS