3 # qemu configure script (c) 2003 Fabrice Bellard
5 # set temporary file name
6 if test ! -z "$TMPDIR" ; then
8 elif test ! -z "$TEMPDIR" ; then
14 TMPC
="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
15 TMPO
="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
16 TMPE
="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"
17 TMPS
="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
21 interp_prefix
="/usr/gnemul/qemu-%M"
26 gcc3_list
="gcc-3.4.6 gcc-3.4 gcc34 gcc-3.3.6 gcc-3.3 gcc33 gcc-3.2 gcc32"
35 i386|i486|i586|i686|i86pc|BePC
)
68 "Power Macintosh"|ppc|ppc64
)
121 OS_CFLAGS
="-mno-cygwin"
122 if [ "$cpu" = "i386" ] ; then
128 if [ "$cpu" = "i386" ] ; then
134 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
141 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
204 if [ "$bsd" = "yes" ] ; then
205 if [ "$darwin" != "yes" ] ; then
211 source_path
=`dirname "$0"`
212 source_path_used
="no"
214 if [ -z "$source_path" ]; then
217 source_path
=`cd "$source_path"; pwd`
219 [ -f "$workdir/vl.c" ] || source_path_used
="yes"
222 # generate compile errors on warnings for development builds
223 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
228 optarg
=`expr "x$opt" : 'x[^=]*=\(.*\)'`
230 --help|
-h) show_help
=yes
232 --prefix=*) prefix
="$optarg"
234 --interp-prefix=*) interp_prefix
="$optarg"
236 --source-path=*) source_path
="$optarg"
237 source_path_used
="yes"
239 --cross-prefix=*) cross_prefix
="$optarg"
244 --host-cc=*) host_cc
="$optarg"
246 --make=*) make="$optarg"
248 --install=*) install="$optarg"
250 --extra-cflags=*) CFLAGS
="$optarg"
252 --extra-ldflags=*) LDFLAGS
="$optarg"
254 --cpu=*) cpu
="$optarg"
256 --target-list=*) target_list
="$optarg"
258 --enable-gprof) gprof
="yes"
260 --static) static
="yes"
262 --disable-sdl) sdl
="no"
264 --enable-coreaudio) coreaudio
="yes"
266 --enable-alsa) alsa
="yes"
268 --enable-esd) esd
="yes"
270 --enable-dsound) dsound
="yes"
272 --enable-fmod) fmod
="yes"
274 --fmod-lib=*) fmod_lib
="$optarg"
276 --fmod-inc=*) fmod_inc
="$optarg"
278 --disable-vnc-tls) vnc_tls
="no"
280 --enable-mingw32) mingw32
="yes" ; cross_prefix
="i386-mingw32-" ; linux_user
="no"
282 --disable-slirp) slirp
="no"
284 --enable-adlib) adlib
="yes"
286 --enable-ac97) ac97
="yes"
288 --enable-gus) gus
="yes"
290 --disable-kqemu) kqemu
="no"
292 --disable-brlapi) brlapi
="no"
294 --enable-profiler) profiler
="yes"
296 --enable-cocoa) cocoa
="yes" ; coreaudio
="yes" ; sdl
="no"
298 --disable-gfx-check) check_gfx
="no"
300 --disable-gcc-check) check_gcc
="no"
302 --disable-system) softmmu
="no"
304 --enable-system) softmmu
="yes"
306 --disable-linux-user) linux_user
="no"
308 --enable-linux-user) linux_user
="yes"
310 --disable-darwin-user) darwin_user
="no"
312 --enable-darwin-user) darwin_user
="yes"
314 --enable-uname-release=*) uname_release
="$optarg"
319 v7|v8
) SP_CFLAGS
="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m32"
320 target_cpu
="sparc"; cpu
="sparc" ;;
321 v8plus|v8plusa
) SP_CFLAGS
="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m32"
322 target_cpu
="sparc"; cpu
="sparc" ;;
323 v9
) SP_CFLAGS
="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m64"
324 target_cpu
="sparc64"; cpu
="sparc64" ;;
325 *) echo "undefined SPARC architecture. Exiting";exit 1;;
328 --enable-werror) werror
="yes"
330 --disable-werror) werror
="no"
332 --disable-curses) curses
="no"
334 *) echo "ERROR: unknown option $opt"; show_help
="yes"
339 if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
342 # Some Linux architectures (e.g. s390) don't imply -lpthread automatically.
343 AIOLIBS
="-lrt -lpthread"
346 # default flags for all hosts
347 CFLAGS
="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
348 LDFLAGS
="$LDFLAGS -g"
349 if test "$werror" = "yes" ; then
350 CFLAGS
="$CFLAGS -Werror"
354 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
355 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
358 sparc
) if test -z "$sparc_cpu" ; then
359 ARCH_CFLAGS
="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
362 ARCH_CFLAGS
="${SP_CFLAGS}"
363 ARCH_LDFLAGS
="${SP_LDFLAGS}"
366 sparc64
) if test -z "$sparc_cpu" ; then
367 ARCH_CFLAGS
="-m64 -mcpu=ultrasparc -D__sparc_v9__"
370 ARCH_CFLAGS
="${SP_CFLAGS}"
371 ARCH_LDFLAGS
="${SP_LDFLAGS}"
375 ARCH_CFLAGS
="-march=z900"
387 if test x
"$show_help" = x
"yes" ; then
390 Usage: configure [options]
391 Options: [defaults in brackets after descriptions]
394 echo "Standard options:"
395 echo " --help print this message"
396 echo " --prefix=PREFIX install in PREFIX [$prefix]"
397 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
398 echo " use %M for cpu name [$interp_prefix]"
399 echo " --target-list=LIST set target list [$target_list]"
401 echo "kqemu kernel acceleration support:"
402 echo " --disable-kqemu disable kqemu support"
404 echo "Advanced options (experts only):"
405 echo " --source-path=PATH path of source code [$source_path]"
406 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
407 echo " --cc=CC use C compiler CC [$cc]"
408 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
409 echo " --make=MAKE use specified make [$make]"
410 echo " --install=INSTALL use specified install [$install]"
411 echo " --static enable static build [$static]"
412 echo " --disable-werror disable compilation abort on warning"
413 echo " --disable-sdl disable SDL"
414 echo " --enable-cocoa enable COCOA (Mac OS X only)"
415 echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
416 echo " --enable-adlib enable Adlib emulation"
417 echo " --enable-ac97 enable AC97 emulation"
418 echo " --enable-gus enable Gravis Ultrasound emulation"
419 echo " --enable-coreaudio enable Coreaudio audio driver"
420 echo " --enable-alsa enable ALSA audio driver"
421 echo " --enable-esd enable EsoundD audio driver"
422 echo " --enable-fmod enable FMOD audio driver"
423 echo " --enable-dsound enable DirectSound audio driver"
424 echo " --disable-brlapi disable BrlAPI"
425 echo " --disable-vnc-tls disable TLS encryption for VNC server"
426 echo " --disable-curses disable curses output"
427 echo " --enable-system enable all system emulation targets"
428 echo " --disable-system disable all system emulation targets"
429 echo " --enable-linux-user enable all linux usermode emulation targets"
430 echo " --disable-linux-user disable all linux usermode emulation targets"
431 echo " --enable-darwin-user enable all darwin usermode emulation targets"
432 echo " --disable-darwin-user disable all darwin usermode emulation targets"
433 echo " --fmod-lib path to FMOD library"
434 echo " --fmod-inc path to FMOD includes"
435 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
436 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
438 echo "NOTE: The object files are built at the place where configure is launched"
442 cc
="${cross_prefix}${cc}"
443 ar="${cross_prefix}${ar}"
444 strip
="${cross_prefix}${strip}"
446 # check that the C compiler works.
451 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev
/null
; then
452 : C compiler works ok
454 echo "ERROR: \"$cc\" either does not exist or does not work"
458 if test "$mingw32" = "yes" ; then
464 # Check for gcc4, error if pre-gcc4
465 if test "$check_gcc" = "yes" ; then
470 int main(){return 0;}
472 if "$cc" $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
473 echo "WARNING: \"$cc\" looks like gcc 4.x"
475 if test "$gcc3_search" = "yes" ; then
476 echo "Looking for gcc 3.x"
477 for compat_cc
in $gcc3_list ; do
478 if "$cross_prefix$compat_cc" --version 2> /dev
/null | fgrep
'(GCC) 3.' > /dev
/null
2>&1 ; then
479 echo "Found \"$compat_cc\""
480 cc
="$cross_prefix$compat_cc"
481 found_compat_cc
="yes"
485 if test "$found_compat_cc" = "no" ; then
486 echo "gcc 3.x not found!"
489 if test "$found_compat_cc" = "no" ; then
490 echo "QEMU is known to have problems when compiled with gcc 4.x"
491 echo "It is recommended that you use gcc 3.x to build QEMU"
492 echo "To use this compiler anyway, configure with --disable-gcc-check"
499 # Solaris specific configure tool chain decisions
501 if test "$solaris" = "yes" ; then
503 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
504 # override the check with --disable-gcc-check
506 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
508 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
509 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
510 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
511 echo "or get the latest patch from SunSolve for gcc"
515 solinst
=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
516 if test -z "$solinst" ; then
517 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
518 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
519 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
522 if test "$solinst" = "/usr/sbin/install" ; then
523 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
524 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
525 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
528 sol_ar
=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
529 if test -z "$sol_ar" ; then
530 echo "Error: No path includes ar"
531 if test -f /usr
/ccs
/bin
/ar ; then
532 echo "Add /usr/ccs/bin to your path and rerun configure"
539 if test -z "$target_list" ; then
540 # these targets are portable
541 if [ "$softmmu" = "yes" ] ; then
560 # the following are Linux specific
561 if [ "$linux_user" = "yes" ] ; then
562 target_list
="${target_list}\
574 ppc64abi32-linux-user \
579 sparc32plus-linux-user \
582 # the following are Darwin specific
583 if [ "$darwin_user" = "yes" ] ; then
584 target_list
="$target_list i386-darwin-user ppc-darwin-user"
587 target_list
=`echo "$target_list" | sed -e 's/,/ /g'`
589 if test -z "$target_list" ; then
590 echo "No targets enabled"
594 if test -z "$cross_prefix" ; then
597 # big/little endian test
599 #include <inttypes.h>
600 int main(int argc, char ** argv){
601 volatile uint32_t i=0x01234567;
602 return (*((uint8_t*)(&i))) == 0x67;
606 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
607 $TMPE && bigendian
="yes"
609 echo big
/little
test failed
614 # if cross compiling, cannot launch a program, so make a static guess
615 if test "$cpu" = "armv4b" \
619 -o "$cpu" = "mips64" \
620 -o "$cpu" = "powerpc" \
622 -o "$cpu" = "sparc" \
623 -o "$cpu" = "sparc64"; then
629 # host long bits test
631 if test "$cpu" = "x86_64" \
632 -o "$cpu" = "alpha" \
634 -o "$cpu" = "sparc64"; then
638 # check gcc options support
644 ##########################################
649 if test -z "$sdl" ; then
650 sdl_config
="sdl-config"
654 if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
655 # win32 cross compilation case
656 sdl_config
="i386-mingw32msvc-sdl-config"
662 #undef main /* We don't want SDL to override our main() */
663 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
665 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /tmp
/qemu-$$
-sdl-config.log
; then
666 _sdlversion
=`$sdl_config --version | sed 's/[^0-9]//g'`
667 if test "$_sdlversion" -lt 121 ; then
670 if test "$cocoa" = "no" ; then
675 # static link with sdl ?
676 if test "$sdl" = "yes" ; then
678 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa
="yes"
679 sdl_static_libs
=`$sdl_config --static-libs 2>/dev/null`
680 if [ "$aa" = "yes" ] ; then
681 sdl_static_libs
="$sdl_static_libs `aalib-config --static-libs`"
684 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev
/null
; then
688 fi # sdl compile test
689 fi # cross compilation
691 # Make sure to disable cocoa if sdl was set
692 if test "$sdl" = "yes" ; then
698 ##########################################
700 if test "$vnc_tls" = "yes" ; then
701 `pkg-config gnutls` || vnc_tls
="no"
703 if test "$vnc_tls" = "yes" ; then
704 vnc_tls_cflags
=`pkg-config --cflags gnutls`
705 vnc_tls_libs
=`pkg-config --libs gnutls`
708 ##########################################
709 # alsa sound support libraries
711 if test "$alsa" = "yes" ; then
713 #include <alsa/asoundlib.h>
714 int main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); }
716 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lasound 2> /dev
/null
; then
720 echo "Error: Could not find alsa"
721 echo "Make sure to have the alsa libs and headers installed."
727 ##########################################
730 if test -z "$brlapi" ; then
734 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
736 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi 2> /dev
/null
; then
738 fi # brlapi compile test
741 ##########################################
744 if test "$curses" = "yes" ; then
748 int main(void) { return curses_version(); }
750 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses 2> /dev
/null
; then
755 # Check if tools are available to build documentation.
756 if [ -x "`which texi2html 2>/dev/null`" ] && \
757 [ -x "`which pod2man 2>/dev/null`" ]; then
761 if test "$mingw32" = "yes" ; then
762 if test -z "$prefix" ; then
763 prefix
="/c/Program Files/Qemu"
770 if test -z "$prefix" ; then
773 mansuffix
="/share/man"
774 datasuffix
="/share/qemu"
775 docsuffix
="/share/doc/qemu"
779 echo "Install prefix $prefix"
780 echo "BIOS directory $prefix$datasuffix"
781 echo "binary directory $prefix$binsuffix"
782 if test "$mingw32" = "no" ; then
783 echo "Manual directory $prefix$mansuffix"
784 echo "ELF interp prefix $interp_prefix"
786 echo "Source path $source_path"
787 echo "C compiler $cc"
788 echo "Host C compiler $host_cc"
789 echo "ARCH_CFLAGS $ARCH_CFLAGS"
791 echo "install $install"
793 echo "host big endian $bigendian"
794 echo "target list $target_list"
795 echo "gprof enabled $gprof"
796 echo "profiler $profiler"
797 echo "static build $static"
798 echo "-Werror enabled $werror"
799 if test "$darwin" = "yes" ; then
800 echo "Cocoa support $cocoa"
802 echo "SDL support $sdl"
803 if test "$sdl" != "no" ; then
804 echo "SDL static link $sdl_static"
806 echo "curses support $curses"
807 echo "mingw32 support $mingw32"
808 echo "Adlib support $adlib"
809 echo "AC97 support $ac97"
810 echo "GUS support $gus"
811 echo "CoreAudio support $coreaudio"
812 echo "ALSA support $alsa"
813 echo "EsounD support $esd"
814 echo "DSound support $dsound"
815 if test "$fmod" = "yes"; then
816 if test -z $fmod_lib ||
test -z $fmod_inc; then
818 echo "Error: You must specify path to FMOD library and headers"
819 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
823 fmod_support
=" (lib='$fmod_lib' include='$fmod_inc')"
827 echo "FMOD support $fmod $fmod_support"
828 echo "OSS support $oss"
829 echo "VNC TLS support $vnc_tls"
830 if test "$vnc_tls" = "yes" ; then
831 echo " TLS CFLAGS $vnc_tls_cflags"
832 echo " TLS LIBS $vnc_tls_libs"
834 if test -n "$sparc_cpu"; then
835 echo "Target Sparc Arch $sparc_cpu"
837 echo "kqemu support $kqemu"
838 echo "brlapi support $brlapi"
839 echo "Documentation $build_docs"
840 [ ! -z "$uname_release" ] && \
841 echo "uname -r $uname_release"
843 if test $sdl_too_old = "yes"; then
844 echo "-> Your SDL version is too old - please upgrade to have SDL support"
846 if [ -s /tmp
/qemu-$$
-sdl-config.log
]; then
847 echo "The error log from compiling the libSDL test is: "
848 cat /tmp
/qemu-$$
-sdl-config.log
850 rm -f /tmp
/qemu-$$
-sdl-config.log
851 #if test "$sdl_static" = "no"; then
852 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
854 config_mak
="config-host.mak"
855 config_h
="config-host.h"
857 #echo "Creating $config_mak and $config_h"
859 test -f $config_h && mv $config_h ${config_h}~
861 echo "# Automatically generated by configure - do not modify" > $config_mak
862 echo "# Configured with: $0 $@" >> $config_mak
863 echo "/* Automatically generated by configure - do not modify */" > $config_h
865 echo "prefix=$prefix" >> $config_mak
866 echo "bindir=\${prefix}$binsuffix" >> $config_mak
867 echo "mandir=\${prefix}$mansuffix" >> $config_mak
868 echo "datadir=\${prefix}$datasuffix" >> $config_mak
869 echo "docdir=\${prefix}$docsuffix" >> $config_mak
870 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
871 echo "MAKE=$make" >> $config_mak
872 echo "INSTALL=$install" >> $config_mak
873 echo "CC=$cc" >> $config_mak
874 echo "HOST_CC=$host_cc" >> $config_mak
875 echo "AR=$ar" >> $config_mak
876 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
877 # XXX: only use CFLAGS and LDFLAGS ?
878 # XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
879 # compilation of dyngen tool (useful for win32 build on Linux host)
880 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
881 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
882 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
883 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
884 echo "CFLAGS=$CFLAGS" >> $config_mak
885 echo "LDFLAGS=$LDFLAGS" >> $config_mak
886 echo "EXESUF=$EXESUF" >> $config_mak
887 echo "AIOLIBS=$AIOLIBS" >> $config_mak
890 echo "ARCH=i386" >> $config_mak
891 echo "#define HOST_I386 1" >> $config_h
894 echo "ARCH=x86_64" >> $config_mak
895 echo "#define HOST_X86_64 1" >> $config_h
898 echo "ARCH=alpha" >> $config_mak
899 echo "#define HOST_ALPHA 1" >> $config_h
902 echo "ARCH=arm" >> $config_mak
903 echo "#define HOST_ARM 1" >> $config_h
906 echo "ARCH=arm" >> $config_mak
907 echo "#define HOST_ARM 1" >> $config_h
910 echo "ARCH=cris" >> $config_mak
911 echo "#define HOST_CRIS 1" >> $config_h
914 echo "ARCH=hppa" >> $config_mak
915 echo "#define HOST_HPPA 1" >> $config_h
918 echo "ARCH=ia64" >> $config_mak
919 echo "#define HOST_IA64 1" >> $config_h
922 echo "ARCH=m68k" >> $config_mak
923 echo "#define HOST_M68K 1" >> $config_h
926 echo "ARCH=mips" >> $config_mak
927 echo "#define HOST_MIPS 1" >> $config_h
930 echo "ARCH=mips64" >> $config_mak
931 echo "#define HOST_MIPS64 1" >> $config_h
934 echo "ARCH=ppc" >> $config_mak
935 echo "#define HOST_PPC 1" >> $config_h
938 echo "ARCH=s390" >> $config_mak
939 echo "#define HOST_S390 1" >> $config_h
942 echo "ARCH=sparc" >> $config_mak
943 echo "#define HOST_SPARC 1" >> $config_h
946 echo "ARCH=sparc64" >> $config_mak
947 echo "#define HOST_SPARC64 1" >> $config_h
950 echo "Unsupported CPU = $cpu"
954 if test "$bigendian" = "yes" ; then
955 echo "WORDS_BIGENDIAN=yes" >> $config_mak
956 echo "#define WORDS_BIGENDIAN 1" >> $config_h
958 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
959 if test "$mingw32" = "yes" ; then
960 echo "CONFIG_WIN32=yes" >> $config_mak
961 echo "#define CONFIG_WIN32 1" >> $config_h
964 #include <byteswap.h>
965 int main(void) { return bswap_32(0); }
967 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
968 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
971 if test "$darwin" = "yes" ; then
972 echo "CONFIG_DARWIN=yes" >> $config_mak
973 echo "#define CONFIG_DARWIN 1" >> $config_h
975 if test "$solaris" = "yes" ; then
976 echo "CONFIG_SOLARIS=yes" >> $config_mak
977 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
978 if test "$needs_libsunmath" = "yes" ; then
979 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
980 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
983 if test -n "$sparc_cpu"; then
984 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
985 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
987 if test "$gdbstub" = "yes" ; then
988 echo "CONFIG_GDBSTUB=yes" >> $config_mak
989 echo "#define CONFIG_GDBSTUB 1" >> $config_h
991 if test "$gprof" = "yes" ; then
992 echo "TARGET_GPROF=yes" >> $config_mak
993 echo "#define HAVE_GPROF 1" >> $config_h
995 if test "$static" = "yes" ; then
996 echo "CONFIG_STATIC=yes" >> $config_mak
997 echo "#define CONFIG_STATIC 1" >> $config_h
999 if test $profiler = "yes" ; then
1000 echo "#define CONFIG_PROFILER 1" >> $config_h
1002 if test "$slirp" = "yes" ; then
1003 echo "CONFIG_SLIRP=yes" >> $config_mak
1004 echo "#define CONFIG_SLIRP 1" >> $config_h
1006 if test "$adlib" = "yes" ; then
1007 echo "CONFIG_ADLIB=yes" >> $config_mak
1008 echo "#define CONFIG_ADLIB 1" >> $config_h
1010 if test "$ac97" = "yes" ; then
1011 echo "CONFIG_AC97=yes" >> $config_mak
1012 echo "#define CONFIG_AC97 1" >> $config_h
1014 if test "$gus" = "yes" ; then
1015 echo "CONFIG_GUS=yes" >> $config_mak
1016 echo "#define CONFIG_GUS 1" >> $config_h
1018 if test "$oss" = "yes" ; then
1019 echo "CONFIG_OSS=yes" >> $config_mak
1020 echo "#define CONFIG_OSS 1" >> $config_h
1022 if test "$coreaudio" = "yes" ; then
1023 echo "CONFIG_COREAUDIO=yes" >> $config_mak
1024 echo "#define CONFIG_COREAUDIO 1" >> $config_h
1026 if test "$alsa" = "yes" ; then
1027 echo "CONFIG_ALSA=yes" >> $config_mak
1028 echo "#define CONFIG_ALSA 1" >> $config_h
1030 if test "$esd" = "yes" ; then
1031 echo "CONFIG_ESD=yes" >> $config_mak
1032 echo "#define CONFIG_ESD 1" >> $config_h
1034 if test "$dsound" = "yes" ; then
1035 echo "CONFIG_DSOUND=yes" >> $config_mak
1036 echo "#define CONFIG_DSOUND 1" >> $config_h
1038 if test "$fmod" = "yes" ; then
1039 echo "CONFIG_FMOD=yes" >> $config_mak
1040 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1041 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1042 echo "#define CONFIG_FMOD 1" >> $config_h
1044 if test "$vnc_tls" = "yes" ; then
1045 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1046 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1047 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1048 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1050 qemu_version
=`head $source_path/VERSION`
1051 echo "VERSION=$qemu_version" >>$config_mak
1052 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1054 echo "SRC_PATH=$source_path" >> $config_mak
1055 if [ "$source_path_used" = "yes" ]; then
1056 echo "VPATH=$source_path" >> $config_mak
1058 echo "TARGET_DIRS=$target_list" >> $config_mak
1059 if [ "$build_docs" = "yes" ] ; then
1060 echo "BUILD_DOCS=yes" >> $config_mak
1062 if test "$static" = "yes"; then
1067 if test "$sdl1" = "yes" ; then
1068 echo "#define CONFIG_SDL 1" >> $config_h
1069 echo "CONFIG_SDL=yes" >> $config_mak
1070 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1071 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1073 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1075 if [ "${aa}" = "yes" ] ; then
1076 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1078 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1081 if test "$cocoa" = "yes" ; then
1082 echo "#define CONFIG_COCOA 1" >> $config_h
1083 echo "CONFIG_COCOA=yes" >> $config_mak
1085 if test "$curses" = "yes" ; then
1086 echo "#define CONFIG_CURSES 1" >> $config_h
1087 echo "CONFIG_CURSES=yes" >> $config_mak
1088 echo "CURSES_LIBS=-lcurses" >> $config_mak
1090 if test "$brlapi" = "yes" ; then
1091 echo "CONFIG_BRLAPI=yes" >> $config_mak
1092 echo "#define CONFIG_BRLAPI 1" >> $config_h
1093 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1096 # XXX: suppress that
1097 if [ "$bsd" = "yes" ] ; then
1098 echo "#define O_LARGEFILE 0" >> $config_h
1099 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1100 echo "#define _BSD 1" >> $config_h
1103 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1106 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1107 tools
="qemu-img\$(EXESUF) $tools"
1109 echo "TOOLS=$tools" >> $config_mak
1111 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~
$config_h
1113 for target
in $target_list; do
1114 target_dir
="$target"
1115 config_mak
=$target_dir/config.mak
1116 config_h
=$target_dir/config.h
1117 target_cpu
=`echo $target | cut -d '-' -f 1`
1118 target_bigendian
="no"
1119 [ "$target_cpu" = "armeb" ] && target_bigendian
=yes
1120 [ "$target_cpu" = "m68k" ] && target_bigendian
=yes
1121 [ "$target_cpu" = "mips" ] && target_bigendian
=yes
1122 [ "$target_cpu" = "mipsn32" ] && target_bigendian
=yes
1123 [ "$target_cpu" = "mips64" ] && target_bigendian
=yes
1124 [ "$target_cpu" = "ppc" ] && target_bigendian
=yes
1125 [ "$target_cpu" = "ppcemb" ] && target_bigendian
=yes
1126 [ "$target_cpu" = "ppc64" ] && target_bigendian
=yes
1127 [ "$target_cpu" = "ppc64abi32" ] && target_bigendian
=yes
1128 [ "$target_cpu" = "sh4eb" ] && target_bigendian
=yes
1129 [ "$target_cpu" = "sparc" ] && target_bigendian
=yes
1130 [ "$target_cpu" = "sparc64" ] && target_bigendian
=yes
1131 [ "$target_cpu" = "sparc32plus" ] && target_bigendian
=yes
1133 target_user_only
="no"
1134 target_linux_user
="no"
1135 target_darwin_user
="no"
1137 ${target_cpu}-softmmu)
1138 target_softmmu
="yes"
1140 ${target_cpu}-linux-user)
1141 target_user_only
="yes"
1142 target_linux_user
="yes"
1144 ${target_cpu}-darwin-user)
1145 target_user_only
="yes"
1146 target_darwin_user
="yes"
1149 echo "ERROR: Target '$target' not recognised"
1154 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1155 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1156 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1157 echo "To build QEMU without graphical output configure with --disable-gfx-check"
1158 echo "Note that this will disable all output from the virtual graphics card"
1159 echo "except through VNC or curses."
1163 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1165 test -f $config_h && mv $config_h ${config_h}~
1167 mkdir
-p $target_dir
1168 mkdir
-p $target_dir/fpu
1169 mkdir
-p $target_dir/tcg
1170 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then
1171 mkdir
-p $target_dir/nwfpe
1175 # don't use ln -sf as not all "ln -sf" over write the file/link
1177 rm -f $target_dir/Makefile
1178 ln -s $source_path/Makefile.target
$target_dir/Makefile
1181 echo "# Automatically generated by configure - do not modify" > $config_mak
1182 echo "/* Automatically generated by configure - do not modify */" > $config_h
1185 echo "include ../config-host.mak" >> $config_mak
1186 echo "#include \"../config-host.h\"" >> $config_h
1190 interp_prefix1
=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1191 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1193 case "$target_cpu" in
1195 echo "TARGET_ARCH=i386" >> $config_mak
1196 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1197 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1198 echo "#define TARGET_I386 1" >> $config_h
1199 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386"
1201 echo "#define USE_KQEMU 1" >> $config_h
1203 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1204 gcc3minver
=`$cc --version 2> /dev/null| fgrep "(GCC) 3." | awk '{ print $3 }' | cut -f2 -d.`
1205 if test -n "$gcc3minver" -a $gcc3minver -gt 3
1207 echo "HAVE_GT_GCC_3_3=true" >> $config_mak
1209 echo "HAVE_GT_GCC_3_3=false" >> $config_mak
1213 echo "TARGET_ARCH=x86_64" >> $config_mak
1214 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1215 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1216 echo "#define TARGET_I386 1" >> $config_h
1217 echo "#define TARGET_X86_64 1" >> $config_h
1218 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1220 echo "#define USE_KQEMU 1" >> $config_h
1222 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1225 echo "TARGET_ARCH=alpha" >> $config_mak
1226 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1227 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1228 echo "#define TARGET_ALPHA 1" >> $config_h
1229 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1232 echo "TARGET_ARCH=arm" >> $config_mak
1233 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1234 echo "#define TARGET_ARM 1" >> $config_h
1238 echo "TARGET_ARCH=cris" >> $config_mak
1239 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1240 echo "#define TARGET_CRIS 1" >> $config_h
1243 echo "TARGET_ARCH=m68k" >> $config_mak
1244 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1245 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1246 echo "#define TARGET_M68K 1" >> $config_h
1247 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1251 echo "TARGET_ARCH=mips" >> $config_mak
1252 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1253 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1254 echo "#define TARGET_MIPS 1" >> $config_h
1255 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1256 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1259 echo "TARGET_ARCH=mipsn32" >> $config_mak
1260 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1261 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1262 echo "#define TARGET_MIPS 1" >> $config_h
1263 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1264 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1267 echo "TARGET_ARCH=mips64" >> $config_mak
1268 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1269 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1270 echo "#define TARGET_MIPS 1" >> $config_h
1271 echo "#define TARGET_MIPS64 1" >> $config_h
1272 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1273 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1276 echo "TARGET_ARCH=ppc" >> $config_mak
1277 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1278 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1279 echo "#define TARGET_PPC 1" >> $config_h
1280 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1283 echo "TARGET_ARCH=ppcemb" >> $config_mak
1284 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1285 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1286 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1287 echo "#define TARGET_PPC 1" >> $config_h
1288 echo "#define TARGET_PPCEMB 1" >> $config_h
1289 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1292 echo "TARGET_ARCH=ppc64" >> $config_mak
1293 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1294 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1295 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1296 echo "#define TARGET_PPC 1" >> $config_h
1297 echo "#define TARGET_PPC64 1" >> $config_h
1298 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1301 echo "TARGET_ARCH=ppc64" >> $config_mak
1302 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1303 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1304 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1305 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1306 echo "#define TARGET_PPC 1" >> $config_h
1307 echo "#define TARGET_PPC64 1" >> $config_h
1308 echo "#define TARGET_ABI32 1" >> $config_h
1309 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1312 echo "TARGET_ARCH=sh4" >> $config_mak
1313 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1314 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1315 echo "#define TARGET_SH4 1" >> $config_h
1316 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1320 echo "TARGET_ARCH=sparc" >> $config_mak
1321 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1322 echo "#define TARGET_SPARC 1" >> $config_h
1325 echo "TARGET_ARCH=sparc64" >> $config_mak
1326 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1327 echo "#define TARGET_SPARC 1" >> $config_h
1328 echo "#define TARGET_SPARC64 1" >> $config_h
1332 echo "TARGET_ARCH=sparc64" >> $config_mak
1333 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1334 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1335 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1336 echo "#define TARGET_SPARC 1" >> $config_h
1337 echo "#define TARGET_SPARC64 1" >> $config_h
1338 echo "#define TARGET_ABI32 1" >> $config_h
1341 echo "Unsupported target CPU"
1345 if test "$target_bigendian" = "yes" ; then
1346 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1347 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1349 if test "$target_softmmu" = "yes" ; then
1350 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1351 echo "#define CONFIG_SOFTMMU 1" >> $config_h
1353 if test "$target_user_only" = "yes" ; then
1354 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1355 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1357 if test "$target_linux_user" = "yes" ; then
1358 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1359 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1361 if test "$target_darwin_user" = "yes" ; then
1362 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1363 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1366 if test "$target_cpu" = "arm" \
1367 -o "$target_cpu" = "armeb" \
1368 -o "$target_cpu" = "m68k" \
1369 -o "$target_cpu" = "mips" \
1370 -o "$target_cpu" = "mipsel" \
1371 -o "$target_cpu" = "mipsn32" \
1372 -o "$target_cpu" = "mipsn32el" \
1373 -o "$target_cpu" = "mips64" \
1374 -o "$target_cpu" = "mips64el" \
1375 -o "$target_cpu" = "sparc" \
1376 -o "$target_cpu" = "sparc64" \
1377 -o "$target_cpu" = "sparc32plus"; then
1378 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1379 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1381 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1382 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1383 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1385 # 32 bit ELF loader in addition to native 64 bit loader?
1386 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1387 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1388 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1391 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~
$config_h
1393 done # for target in $targets
1395 # build tree in object directory if source path is different from current one
1396 if test "$source_path_used" = "yes" ; then
1397 DIRS
="tests tests/cris slirp audio"
1398 FILES
="Makefile tests/Makefile"
1399 FILES
="$FILES tests/cris/Makefile tests/cris/.gdbinit"
1400 FILES
="$FILES tests/test-mmap.c"
1401 for dir
in $DIRS ; do
1404 # remove the link and recreate it, as not all "ln -sf" overwrite the link
1405 for f
in $FILES ; do
1407 ln -s $source_path/$f $f
1411 rm -f $TMPO $TMPC $TMPE $TMPS