3 # qemu configure script (c) 2003 Fabrice Bellard
5 # set temporary file name
6 if test ! -z "$TMPDIR" ; then
8 elif test ! -z "$TEMPDIR" ; then
14 TMPC
="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
15 TMPO
="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
16 TMPE
="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"
17 TMPS
="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
21 interp_prefix
="/usr/gnemul/qemu-%M"
26 gcc3_list
="gcc-3.4.6 gcc-3.4 gcc34 gcc-3.3.6 gcc-3.3 gcc33 gcc-3.2 gcc32"
35 i386|i486|i586|i686|i86pc|BePC
)
47 "Power Macintosh"|ppc|ppc64
)
116 device_tree_support
=""
123 OS_CFLAGS
="-mno-cygwin"
124 if [ "$cpu" = "i386" ] ; then
130 if [ "$cpu" = "i386" ] ; then
136 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
143 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
162 OS_CFLAGS
="-mdynamic-no-pic"
163 OS_LDFLAGS
="-framework CoreFoundation -framework IOKit"
169 needs_libsunmath
="no"
170 solarisrev
=`uname -r | cut -f2 -d.`
171 # have to select again, because `uname -m` returns i86pc
172 # even on an x86_64 box.
173 solariscpu
=`isainfo -k`
174 if test "${solariscpu}" = "amd64" ; then
177 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
178 if test "$solarisrev" -le 9 ; then
179 if test -f /opt
/SUNWspro
/prod
/lib
/libsunmath.so
.1; then
180 needs_libsunmath
="yes"
182 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
183 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
184 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
185 echo "Studio 11 can be downloaded from www.sun.com."
189 if test "$solarisrev" -ge 9 ; then
193 if test -f /usr
/include
/sys
/soundcard.h
; then
201 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
205 if [ "$cpu" = "ia64" ] ; then
210 if [ "$cpu" = "powerpc" ]; then
216 if [ "$bsd" = "yes" ] ; then
217 if [ "$darwin" != "yes" ] ; then
223 source_path
=`dirname "$0"`
224 source_path_used
="no"
226 if [ -z "$source_path" ]; then
229 source_path
=`cd "$source_path"; pwd`
231 [ -f "$workdir/vl.c" ] || source_path_used
="yes"
234 # generate compile errors on warnings for development builds
235 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
240 optarg
=`expr "x$opt" : 'x[^=]*=\(.*\)'`
242 --help|
-h) show_help
=yes
244 --prefix=*) prefix
="$optarg"
246 --interp-prefix=*) interp_prefix
="$optarg"
248 --source-path=*) source_path
="$optarg"
249 source_path_used
="yes"
251 --cross-prefix=*) cross_prefix
="$optarg"
256 --host-cc=*) host_cc
="$optarg"
258 --make=*) make="$optarg"
260 --install=*) install="$optarg"
262 --extra-cflags=*) CFLAGS
="$optarg"
264 --extra-ldflags=*) LDFLAGS
="$optarg"
266 --cpu=*) cpu
="$optarg"
268 --target-list=*) target_list
="$optarg"
270 --enable-gprof) gprof
="yes"
272 --static) static
="yes"
274 --disable-sdl) sdl
="no"
276 --enable-coreaudio) coreaudio
="yes"
278 --enable-alsa) alsa
="yes"
280 --enable-esd) esd
="yes"
282 --enable-dsound) dsound
="yes"
284 --enable-fmod) fmod
="yes"
286 --fmod-lib=*) fmod_lib
="$optarg"
288 --fmod-inc=*) fmod_inc
="$optarg"
290 --disable-vnc-tls) vnc_tls
="no"
292 --enable-mingw32) mingw32
="yes" ; cross_prefix
="i386-mingw32-" ; linux_user
="no"
294 --disable-slirp) slirp
="no"
296 --enable-adlib) adlib
="yes"
298 --enable-ac97) ac97
="yes"
300 --enable-gus) gus
="yes"
302 --disable-kqemu) kqemu
="no"
304 --disable-kvm) kvm
="no"
306 --enable-profiler) profiler
="yes"
308 --kernel-path=*) kernel_path
="$optarg"
310 --enable-cocoa) cocoa
="yes" ; coreaudio
="yes" ; sdl
="no"
312 --disable-gfx-check) check_gfx
="no"
314 --disable-gcc-check) check_gcc
="no"
316 --disable-system) softmmu
="no"
318 --enable-system) softmmu
="yes"
320 --disable-linux-user) linux_user
="no"
322 --enable-linux-user) linux_user
="yes"
324 --disable-darwin-user) darwin_user
="no"
326 --enable-darwin-user) darwin_user
="yes"
328 --enable-uname-release=*) uname_release
="$optarg"
333 v7|v8
) SP_CFLAGS
="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m32"
334 target_cpu
="sparc"; cpu
="sparc" ;;
335 v8plus|v8plusa
) SP_CFLAGS
="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m32"
336 target_cpu
="sparc"; cpu
="sparc" ;;
337 v9
) SP_CFLAGS
="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS
="-m64"
338 target_cpu
="sparc64"; cpu
="sparc64" ;;
339 *) echo "undefined SPARC architecture. Exiting";exit 1;;
342 --enable-werror) werror
="yes"
344 --disable-werror) werror
="no"
346 --disable-curses) curses
="no"
348 --disable-cpu-emulation) cpu_emulation
="no"
350 --disable-libfdt) device_tree_support
="no"
352 *) echo "ERROR: unknown option $opt"; exit 1
357 if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
360 # Some Linux architectures (e.g. s390) don't imply -lpthread automatically.
361 AIOLIBS
="-lrt -lpthread"
364 # default flags for all hosts
365 CFLAGS
="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
366 LDFLAGS
="$LDFLAGS -g"
367 if test "$werror" = "yes" ; then
368 CFLAGS
="$CFLAGS -Werror"
372 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
373 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
376 sparc
) if test -z "$sparc_cpu" ; then
377 ARCH_CFLAGS
="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
380 ARCH_CFLAGS
="${SP_CFLAGS}"
381 ARCH_LDFLAGS
="${SP_LDFLAGS}"
384 sparc64
) if test -z "$sparc_cpu" ; then
385 ARCH_CFLAGS
="-m64 -mcpu=ultrasparc -D__sparc_v9__"
388 ARCH_CFLAGS
="${SP_CFLAGS}"
389 ARCH_LDFLAGS
="${SP_LDFLAGS}"
393 ARCH_CFLAGS
="-march=z900"
405 if test x
"$show_help" = x
"yes" ; then
408 Usage: configure [options]
409 Options: [defaults in brackets after descriptions]
412 echo "Standard options:"
413 echo " --help print this message"
414 echo " --prefix=PREFIX install in PREFIX [$prefix]"
415 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
416 echo " use %M for cpu name [$interp_prefix]"
417 echo " --target-list=LIST set target list [$target_list]"
419 echo "kqemu kernel acceleration support:"
420 echo " --disable-kqemu disable kqemu support"
421 echo " --kernel-path=PATH set the kernel path (configure probes it)"
422 echo " --disable-kvm disable kernel virtual machine support"
424 echo "Advanced options (experts only):"
425 echo " --source-path=PATH path of source code [$source_path]"
426 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
427 echo " --cc=CC use C compiler CC [$cc]"
428 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
429 echo " --make=MAKE use specified make [$make]"
430 echo " --install=INSTALL use specified install [$install]"
431 echo " --static enable static build [$static]"
432 echo " --disable-werror disable compilation abort on warning"
433 echo " --disable-sdl disable SDL"
434 echo " --enable-cocoa enable COCOA (Mac OS X only)"
435 echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
436 echo " --enable-adlib enable Adlib emulation"
437 echo " --enable-ac97 enable AC97 emulation"
438 echo " --enable-gus enable Gravis Ultrasound emulation"
439 echo " --enable-coreaudio enable Coreaudio audio driver"
440 echo " --enable-alsa enable ALSA audio driver"
441 echo " --enable-esd enable EsoundD audio driver"
442 echo " --enable-fmod enable FMOD audio driver"
443 echo " --enable-dsound enable DirectSound audio driver"
444 echo " --disable-vnc-tls disable TLS encryption for VNC server"
445 echo " --enable-system enable all system emulation targets"
446 echo " --disable-system disable all system emulation targets"
447 echo " --enable-linux-user enable all linux usermode emulation targets"
448 echo " --disable-linux-user disable all linux usermode emulation targets"
449 echo " --enable-darwin-user enable all darwin usermode emulation targets"
450 echo " --disable-darwin-user disable all darwin usermode emulation targets"
451 echo " --fmod-lib path to FMOD library"
452 echo " --fmod-inc path to FMOD includes"
453 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
454 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
455 echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
456 echo " --disable-libfdt disables use of libfdt support for device tree"
458 echo "NOTE: The object files are built at the place where configure is launched"
462 cc
="${cross_prefix}${cc}"
463 ar="${cross_prefix}${ar}"
464 strip
="${cross_prefix}${strip}"
466 # check that the C compiler works.
471 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev
/null
; then
472 : C compiler works ok
474 echo "ERROR: \"$cc\" either does not exist or does not work"
478 if test "$mingw32" = "yes" ; then
484 # Check for gcc4, error if pre-gcc4
485 if test "$check_gcc" = "yes" ; then
490 int main(){return 0;}
492 if "$cc" $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
493 echo "WARNING: \"$cc\" looks like gcc 4.x"
495 if test "$gcc3_search" = "yes" ; then
496 echo "Looking for gcc 3.x"
497 for compat_cc
in $gcc3_list ; do
498 if "$cross_prefix$compat_cc" --version 2> /dev
/null | fgrep
'(GCC) 3.' > /dev
/null
2>&1 ; then
499 echo "Found \"$compat_cc\""
500 cc
="$cross_prefix$compat_cc"
501 found_compat_cc
="yes"
505 if test "$found_compat_cc" = "no" ; then
506 echo "gcc 3.x not found!"
509 if test "$found_compat_cc" = "no" ; then
510 echo "QEMU is known to have problems when compiled with gcc 4.x"
511 echo "It is recommended that you use gcc 3.x to build QEMU"
512 echo "To use this compiler anyway, configure with --disable-gcc-check"
519 # Solaris specific configure tool chain decisions
521 if test "$solaris" = "yes" ; then
523 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
524 # override the check with --disable-gcc-check
526 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
528 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
529 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
530 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
531 echo "or get the latest patch from SunSolve for gcc"
535 solinst
=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
536 if test -z "$solinst" ; then
537 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
538 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
539 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
542 if test "$solinst" = "/usr/sbin/install" ; then
543 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
544 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
545 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
548 sol_ar
=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
549 if test -z "$sol_ar" ; then
550 echo "Error: No path includes ar"
551 if test -f /usr
/ccs
/bin
/ar ; then
552 echo "Add /usr/ccs/bin to your path and rerun configure"
559 if test -z "$target_list" ; then
560 # these targets are portable
561 if [ "$softmmu" = "yes" ] ; then
562 target_list
="i386-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu mips64-softmmu mips64el-softmmu arm-softmmu ppc-softmmu ppcemb-softmmu ppc64-softmmu m68k-softmmu sh4-softmmu sh4eb-softmmu cris-softmmu"
564 # the following are Linux specific
565 if [ "$linux_user" = "yes" ] ; then
566 target_list
="i386-linux-user arm-linux-user armeb-linux-user sparc-linux-user sparc64-linux-user sparc32plus-linux-user mips-linux-user mipsel-linux-user m68k-linux-user alpha-linux-user sh4-linux-user sh4eb-linux-user ppc-linux-user ppc64-linux-user ppc64abi32-linux-user x86_64-linux-user cris-linux-user $target_list"
568 # the following are Darwin specific
569 if [ "$darwin_user" = "yes" ] ; then
570 target_list
="i386-darwin-user ppc-darwin-user $target_list"
573 target_list
=`echo "$target_list" | sed -e 's/,/ /g'`
575 if test -z "$target_list" ; then
576 echo "No targets enabled"
580 if test -z "$cross_prefix" ; then
583 # big/little endian test
585 #include <inttypes.h>
586 int main(int argc, char ** argv){
587 volatile uint32_t i=0x01234567;
588 return (*((uint8_t*)(&i))) == 0x67;
592 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
593 $TMPE && bigendian
="yes"
595 echo big
/little
test failed
600 # if cross compiling, cannot launch a program, so make a static guess
601 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
607 # host long bits test
609 if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
613 # check gcc options support
619 ##########################################
622 if test "$kvm" = "yes" ; then
626 #error "kvm no pit capability"
628 int main(void) { return 0; }
630 if $cc $ARCH_CFLAGS $CFLAGS -I"$kernel_path"/include
-o $TMPE ${OS_CFLAGS} $TMPC 2> /dev
/null
; then
635 ##########################################
640 if test -z "$sdl" ; then
641 sdl_config
="sdl-config"
645 if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
646 # win32 cross compilation case
647 sdl_config
="i386-mingw32msvc-sdl-config"
653 #undef main /* We don't want SDL to override our main() */
654 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
656 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
657 _sdlversion
=`$sdl_config --version | sed 's/[^0-9]//g'`
658 if test "$_sdlversion" -lt 121 ; then
661 if test "$cocoa" = "no" ; then
666 # static link with sdl ?
667 if test "$sdl" = "yes" ; then
669 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa
="yes"
670 sdl_static_libs
=`$sdl_config --static-libs 2>/dev/null`
671 if [ "$aa" = "yes" ] ; then
672 sdl_static_libs
="$sdl_static_libs `aalib-config --static-libs`"
675 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev
/null
; then
679 fi # sdl compile test
680 fi # cross compilation
682 # Make sure to disable cocoa if sdl was set
683 if test "$sdl" = "yes" ; then
689 ##########################################
691 if test "$vnc_tls" = "yes" ; then
692 `pkg-config gnutls` || vnc_tls
="no"
694 if test "$vnc_tls" = "yes" ; then
695 vnc_tls_cflags
=`pkg-config --cflags gnutls`
696 vnc_tls_libs
=`pkg-config --libs gnutls`
699 ##########################################
700 # alsa sound support libraries
702 if test "$alsa" = "yes" ; then
704 #include <alsa/asoundlib.h>
705 int main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); }
707 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lasound 2> /dev
/null
; then
711 echo "Error: Could not find alsa"
712 echo "Make sure to have the alsa libs and headers installed."
718 ##########################################
721 if test "$curses" = "yes" ; then
725 int main(void) { return curses_version(); }
727 if $cc -o $TMPE $TMPC -lcurses 2> /dev
/null
; then
732 # Check if tools are available to build documentation.
733 if [ -x "`which texi2html 2>/dev/null`" ] && \
734 [ -x "`which pod2man 2>/dev/null`" ]; then
738 if test "$mingw32" = "yes" ; then
739 if test -z "$prefix" ; then
740 prefix
="/c/Program Files/Qemu"
747 if test -z "$prefix" ; then
750 mansuffix
="/share/man"
751 datasuffix
="/share/qemu"
752 docsuffix
="/share/doc/qemu"
756 ######################################
759 if test -z "$device_tree_support" -a \
760 "$cpu" = "powerpc"; then
761 device_tree_support
="no"
764 /* XXX uncomment later when libfdt is built before this test */
765 //int main(void) { void *fdt; return fdt_create(fdt, 1024); }
766 int main (void) {return 0;}
768 # XXX for now do not try to link to libfdt and just check for header */
769 # if $cc $ARCH_CFLAGS $CFLAGS $LDFLAGS -o $TMPE $TMPC -lfdt 2> /dev/null ; then
770 if $cc $ARCH_CFLAGS $CFLAGS $LDFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
771 device_tree_support
="yes"
774 echo "Error: Could not find libfdt"
775 echo "Make sure to have the libfdt libs and headers installed."
781 echo "Install prefix $prefix"
782 echo "BIOS directory $prefix$datasuffix"
783 echo "binary directory $prefix$binsuffix"
784 if test "$mingw32" = "no" ; then
785 echo "Manual directory $prefix$mansuffix"
786 echo "ELF interp prefix $interp_prefix"
788 echo "Source path $source_path"
789 echo "C compiler $cc"
790 echo "Host C compiler $host_cc"
791 echo "ARCH_CFLAGS $ARCH_CFLAGS"
793 echo "install $install"
795 echo "host big endian $bigendian"
796 echo "target list $target_list"
797 echo "gprof enabled $gprof"
798 echo "profiler $profiler"
799 echo "static build $static"
800 echo "-Werror enabled $werror"
801 if test "$darwin" = "yes" ; then
802 echo "Cocoa support $cocoa"
804 echo "SDL support $sdl"
805 if test "$sdl" != "no" ; then
806 echo "SDL static link $sdl_static"
808 echo "curses support $curses"
809 echo "mingw32 support $mingw32"
810 echo "Adlib support $adlib"
811 echo "AC97 support $ac97"
812 echo "GUS support $gus"
813 echo "CoreAudio support $coreaudio"
814 echo "ALSA support $alsa"
815 echo "EsounD support $esd"
816 echo "DSound support $dsound"
817 if test "$fmod" = "yes"; then
818 if test -z $fmod_lib ||
test -z $fmod_inc; then
820 echo "Error: You must specify path to FMOD library and headers"
821 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
825 fmod_support
=" (lib='$fmod_lib' include='$fmod_inc')"
829 echo "FMOD support $fmod $fmod_support"
830 echo "OSS support $oss"
831 echo "VNC TLS support $vnc_tls"
832 if test "$vnc_tls" = "yes" ; then
833 echo " TLS CFLAGS $vnc_tls_cflags"
834 echo " TLS LIBS $vnc_tls_libs"
836 if test -n "$sparc_cpu"; then
837 echo "Target Sparc Arch $sparc_cpu"
839 echo "kqemu support $kqemu"
840 echo "kvm support $kvm"
841 echo "CPU emulation $cpu_emulation"
842 if test $cpu = "powerpc"; then
843 echo "libfdt support $device_tree_support"
845 echo "Documentation $build_docs"
846 [ ! -z "$uname_release" ] && \
847 echo "uname -r $uname_release"
849 if test $sdl_too_old = "yes"; then
850 echo "-> Your SDL version is too old - please upgrade to have SDL support"
852 if [ -s /tmp
/qemu-$$
-sdl-config.log
]; then
853 echo "The error log from compiling the libSDL test is: "
854 cat /tmp
/qemu-$$
-sdl-config.log
856 rm -f /tmp
/qemu-$$
-sdl-config.log
857 #if test "$sdl_static" = "no"; then
858 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
860 config_mak
="config-host.mak"
861 config_h
="config-host.h"
863 #echo "Creating $config_mak and $config_h"
865 test -f $config_h && mv $config_h ${config_h}~
867 echo "# Automatically generated by configure - do not modify" > $config_mak
868 echo "# Configured with: $0 $@" >> $config_mak
869 echo "/* Automatically generated by configure - do not modify */" > $config_h
871 echo "prefix=$prefix" >> $config_mak
872 echo "bindir=\${prefix}$binsuffix" >> $config_mak
873 echo "mandir=\${prefix}$mansuffix" >> $config_mak
874 echo "datadir=\${prefix}$datasuffix" >> $config_mak
875 echo "docdir=\${prefix}$docsuffix" >> $config_mak
876 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
877 echo "MAKE=$make" >> $config_mak
878 echo "INSTALL=$install" >> $config_mak
879 echo "CC=$cc" >> $config_mak
880 echo "HOST_CC=$host_cc" >> $config_mak
881 echo "AR=$ar" >> $config_mak
882 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
883 # XXX: only use CFLAGS and LDFLAGS ?
884 # XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
885 # compilation of dyngen tool (useful for win32 build on Linux host)
886 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
887 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
888 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
889 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
890 echo "CFLAGS=$CFLAGS" >> $config_mak
891 echo "LDFLAGS=$LDFLAGS" >> $config_mak
892 echo "EXESUF=$EXESUF" >> $config_mak
893 echo "AIOLIBS=$AIOLIBS" >> $config_mak
894 if test "$cpu" = "i386" ; then
895 echo "ARCH=i386" >> $config_mak
896 echo "#define HOST_I386 1" >> $config_h
897 elif test "$cpu" = "x86_64" ; then
898 echo "ARCH=x86_64" >> $config_mak
899 echo "#define HOST_X86_64 1" >> $config_h
900 elif test "$cpu" = "armv4b" ; then
901 echo "ARCH=arm" >> $config_mak
902 echo "#define HOST_ARM 1" >> $config_h
903 elif test "$cpu" = "armv4l" ; then
904 echo "ARCH=arm" >> $config_mak
905 echo "#define HOST_ARM 1" >> $config_h
906 elif test "$cpu" = "powerpc" ; then
907 echo "ARCH=ppc" >> $config_mak
908 echo "#define HOST_PPC 1" >> $config_h
909 elif test "$cpu" = "mips" ; then
910 echo "ARCH=mips" >> $config_mak
911 echo "#define HOST_MIPS 1" >> $config_h
912 elif test "$cpu" = "mips64" ; then
913 echo "ARCH=mips64" >> $config_mak
914 echo "#define HOST_MIPS64 1" >> $config_h
915 elif test "$cpu" = "cris" ; then
916 echo "ARCH=cris" >> $config_mak
917 echo "#define HOST_CRIS 1" >> $config_h
918 elif test "$cpu" = "s390" ; then
919 echo "ARCH=s390" >> $config_mak
920 echo "#define HOST_S390 1" >> $config_h
921 elif test "$cpu" = "alpha" ; then
922 echo "ARCH=alpha" >> $config_mak
923 echo "#define HOST_ALPHA 1" >> $config_h
924 elif test "$cpu" = "sparc" ; then
925 echo "ARCH=sparc" >> $config_mak
926 echo "#define HOST_SPARC 1" >> $config_h
927 elif test "$cpu" = "sparc64" ; then
928 echo "ARCH=sparc64" >> $config_mak
929 echo "#define HOST_SPARC64 1" >> $config_h
930 elif test "$cpu" = "ia64" ; then
931 echo "ARCH=ia64" >> $config_mak
932 echo "#define HOST_IA64 1" >> $config_h
933 elif test "$cpu" = "m68k" ; then
934 echo "ARCH=m68k" >> $config_mak
935 echo "#define HOST_M68K 1" >> $config_h
937 echo "Unsupported CPU = $cpu"
940 if test "$bigendian" = "yes" ; then
941 echo "WORDS_BIGENDIAN=yes" >> $config_mak
942 echo "#define WORDS_BIGENDIAN 1" >> $config_h
944 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
945 if test "$mingw32" = "yes" ; then
946 echo "CONFIG_WIN32=yes" >> $config_mak
947 echo "#define CONFIG_WIN32 1" >> $config_h
950 #include <byteswap.h>
951 int main(void) { return bswap_32(0); }
953 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev
/null
; then
954 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
957 if test "$darwin" = "yes" ; then
958 echo "CONFIG_DARWIN=yes" >> $config_mak
959 echo "#define CONFIG_DARWIN 1" >> $config_h
961 if test "$solaris" = "yes" ; then
962 echo "CONFIG_SOLARIS=yes" >> $config_mak
963 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
964 if test "$needs_libsunmath" = "yes" ; then
965 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
966 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
969 if test -n "$sparc_cpu"; then
970 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
971 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
973 if test "$gdbstub" = "yes" ; then
974 echo "CONFIG_GDBSTUB=yes" >> $config_mak
975 echo "#define CONFIG_GDBSTUB 1" >> $config_h
977 if test "$gprof" = "yes" ; then
978 echo "TARGET_GPROF=yes" >> $config_mak
979 echo "#define HAVE_GPROF 1" >> $config_h
981 if test "$static" = "yes" ; then
982 echo "CONFIG_STATIC=yes" >> $config_mak
983 echo "#define CONFIG_STATIC 1" >> $config_h
985 if test $profiler = "yes" ; then
986 echo "#define CONFIG_PROFILER 1" >> $config_h
988 if test "$slirp" = "yes" ; then
989 echo "CONFIG_SLIRP=yes" >> $config_mak
990 echo "#define CONFIG_SLIRP 1" >> $config_h
992 if test "$adlib" = "yes" ; then
993 echo "CONFIG_ADLIB=yes" >> $config_mak
994 echo "#define CONFIG_ADLIB 1" >> $config_h
996 if test "$ac97" = "yes" ; then
997 echo "CONFIG_AC97=yes" >> $config_mak
998 echo "#define CONFIG_AC97 1" >> $config_h
1000 if test "$gus" = "yes" ; then
1001 echo "CONFIG_GUS=yes" >> $config_mak
1002 echo "#define CONFIG_GUS 1" >> $config_h
1004 if test "$oss" = "yes" ; then
1005 echo "CONFIG_OSS=yes" >> $config_mak
1006 echo "#define CONFIG_OSS 1" >> $config_h
1008 if test "$coreaudio" = "yes" ; then
1009 echo "CONFIG_COREAUDIO=yes" >> $config_mak
1010 echo "#define CONFIG_COREAUDIO 1" >> $config_h
1012 if test "$alsa" = "yes" ; then
1013 echo "CONFIG_ALSA=yes" >> $config_mak
1014 echo "#define CONFIG_ALSA 1" >> $config_h
1016 if test "$esd" = "yes" ; then
1017 echo "CONFIG_ESD=yes" >> $config_mak
1018 echo "#define CONFIG_ESD 1" >> $config_h
1020 if test "$dsound" = "yes" ; then
1021 echo "CONFIG_DSOUND=yes" >> $config_mak
1022 echo "#define CONFIG_DSOUND 1" >> $config_h
1024 if test "$fmod" = "yes" ; then
1025 echo "CONFIG_FMOD=yes" >> $config_mak
1026 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1027 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1028 echo "#define CONFIG_FMOD 1" >> $config_h
1030 if test "$vnc_tls" = "yes" ; then
1031 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1032 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1033 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1034 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1036 qemu_version
=`head $source_path/VERSION`
1037 echo "VERSION=$qemu_version" >>$config_mak
1038 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1039 echo "#define KVM_VERSION \"kvm-devel\"" >> $config_h
1041 echo "SRC_PATH=$source_path" >> $config_mak
1042 if [ "$source_path_used" = "yes" ]; then
1043 echo "VPATH=$source_path" >> $config_mak
1045 echo "TARGET_DIRS=$target_list" >> $config_mak
1046 if [ "$build_docs" = "yes" ] ; then
1047 echo "BUILD_DOCS=yes" >> $config_mak
1049 if test "$static" = "yes"; then
1054 if test "$sdl1" = "yes" ; then
1055 echo "#define CONFIG_SDL 1" >> $config_h
1056 echo "CONFIG_SDL=yes" >> $config_mak
1057 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1058 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1060 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1062 if [ "${aa}" = "yes" ] ; then
1063 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1065 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1068 if test "$cocoa" = "yes" ; then
1069 echo "#define CONFIG_COCOA 1" >> $config_h
1070 echo "CONFIG_COCOA=yes" >> $config_mak
1072 if test "$curses" = "yes" ; then
1073 echo "#define CONFIG_CURSES 1" >> $config_h
1074 echo "CONFIG_CURSES=yes" >> $config_mak
1075 echo "CURSES_LIBS=-lcurses" >> $config_mak
1078 # XXX: suppress that
1079 if [ "$bsd" = "yes" ] ; then
1080 echo "#define O_LARGEFILE 0" >> $config_h
1081 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1082 echo "#define _BSD 1" >> $config_h
1085 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1088 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1089 tools
="qemu-img\$(EXESUF) $tools"
1091 echo "TOOLS=$tools" >> $config_mak
1093 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~
$config_h
1095 for target
in $target_list; do
1096 target_dir
="$target"
1097 config_mak
=$target_dir/config.mak
1098 config_h
=$target_dir/config.h
1099 target_cpu
=`echo $target | cut -d '-' -f 1`
1100 target_bigendian
="no"
1101 [ "$target_cpu" = "armeb" ] && target_bigendian
=yes
1102 [ "$target_cpu" = "sparc" ] && target_bigendian
=yes
1103 [ "$target_cpu" = "sparc64" ] && target_bigendian
=yes
1104 [ "$target_cpu" = "sparc32plus" ] && target_bigendian
=yes
1105 [ "$target_cpu" = "ppc" ] && target_bigendian
=yes
1106 [ "$target_cpu" = "ppcemb" ] && target_bigendian
=yes
1107 [ "$target_cpu" = "ppc64" ] && target_bigendian
=yes
1108 [ "$target_cpu" = "ppc64abi32" ] && target_bigendian
=yes
1109 [ "$target_cpu" = "mips" ] && target_bigendian
=yes
1110 [ "$target_cpu" = "mipsn32" ] && target_bigendian
=yes
1111 [ "$target_cpu" = "mips64" ] && target_bigendian
=yes
1112 [ "$target_cpu" = "sh4eb" ] && target_bigendian
=yes
1113 [ "$target_cpu" = "m68k" ] && target_bigendian
=yes
1115 target_user_only
="no"
1116 target_linux_user
="no"
1117 target_darwin_user
="no"
1119 ${target_cpu}-softmmu)
1120 target_softmmu
="yes"
1122 ${target_cpu}-linux-user)
1123 target_user_only
="yes"
1124 target_linux_user
="yes"
1126 ${target_cpu}-darwin-user)
1127 target_user_only
="yes"
1128 target_darwin_user
="yes"
1131 echo "ERROR: Target '$target' not recognised"
1136 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1137 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1138 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1139 echo "To build QEMU without graphical output configure with --disable-gfx-check"
1140 echo "Note that this will disable all output from the virtual graphics card"
1141 echo "except through VNC or curses."
1145 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1147 test -f $config_h && mv $config_h ${config_h}~
1149 mkdir
-p $target_dir
1150 mkdir
-p $target_dir/fpu
1151 mkdir
-p $target_dir/tcg
1152 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then
1153 mkdir
-p $target_dir/nwfpe
1157 # don't use ln -sf as not all "ln -sf" over write the file/link
1159 rm -f $target_dir/Makefile
1160 ln -s $source_path/Makefile.target
$target_dir/Makefile
1163 echo "# Automatically generated by configure - do not modify" > $config_mak
1164 echo "/* Automatically generated by configure - do not modify */" > $config_h
1167 echo "include ../config-host.mak" >> $config_mak
1168 echo "#include \"../config-host.h\"" >> $config_h
1172 interp_prefix1
=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1173 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1175 disable_cpu_emulation
() {
1176 if test $cpu_emulation = "no"; then
1177 echo "#define NO_CPU_EMULATION 1" >> $config_h
1178 echo "NO_CPU_EMULATION=1" >> $config_mak
1183 if test $kvm = "yes" -a "$target_softmmu" = "yes" -a \
1184 \
( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \
); then
1185 echo "#define USE_KVM 1" >> $config_h
1186 echo "USE_KVM=1" >> $config_mak
1187 echo "CONFIG_KVM_KERNEL_INC=$kernel_path/include" >> $config_mak
1188 if test $kvm_cap_pit = "yes" ; then
1189 echo "USE_KVM_PIT=1" >> $config_mak
1191 disable_cpu_emulation
1195 if test "$target_cpu" = "i386" ; then
1196 echo "TARGET_ARCH=i386" >> $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" ; then
1200 echo "#define USE_KQEMU 1" >> $config_h
1203 elif test "$target_cpu" = "ia64" ; then
1204 echo "TARGET_ARCH=ia64" >> $config_mak
1205 echo "#define TARGET_ARCH \"ia64\"" >> $config_h
1206 echo "#define TARGET_IA64 1" >> $config_h
1208 elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
1209 echo "TARGET_ARCH=arm" >> $config_mak
1210 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1211 echo "#define TARGET_ARM 1" >> $config_h
1213 elif test "$target_cpu" = "sparc" ; then
1214 echo "TARGET_ARCH=sparc" >> $config_mak
1215 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1216 echo "#define TARGET_SPARC 1" >> $config_h
1217 elif test "$target_cpu" = "sparc64" ; then
1218 echo "TARGET_ARCH=sparc64" >> $config_mak
1219 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1220 echo "#define TARGET_SPARC 1" >> $config_h
1221 echo "#define TARGET_SPARC64 1" >> $config_h
1223 elif test "$target_cpu" = "sparc32plus" ; then
1224 echo "TARGET_ARCH=sparc64" >> $config_mak
1225 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1226 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1227 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1228 echo "#define TARGET_SPARC 1" >> $config_h
1229 echo "#define TARGET_SPARC64 1" >> $config_h
1230 echo "#define TARGET_ABI32 1" >> $config_h
1231 elif test "$target_cpu" = "ppc" ; then
1232 echo "TARGET_ARCH=ppc" >> $config_mak
1233 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1234 echo "#define TARGET_PPC 1" >> $config_h
1235 elif test "$target_cpu" = "ppcemb" ; then
1236 echo "TARGET_ARCH=ppcemb" >> $config_mak
1237 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1238 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1239 echo "#define TARGET_PPC 1" >> $config_h
1240 echo "#define TARGET_PPCEMB 1" >> $config_h
1241 if test "$device_tree_support" = "yes" ; then
1242 echo "#define CONFIG_LIBFDT 1" >> $config_h
1243 echo "CONFIG_LIBFDT=1" >> $config_mak
1246 elif test "$target_cpu" = "ppc64" ; then
1247 echo "TARGET_ARCH=ppc64" >> $config_mak
1248 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1249 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1250 echo "#define TARGET_PPC 1" >> $config_h
1251 echo "#define TARGET_PPC64 1" >> $config_h
1252 elif test "$target_cpu" = "ppc64abi32" ; then
1253 echo "TARGET_ARCH=ppc64" >> $config_mak
1254 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1255 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1256 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1257 echo "#define TARGET_PPC 1" >> $config_h
1258 echo "#define TARGET_PPC64 1" >> $config_h
1259 echo "#define TARGET_ABI32 1" >> $config_h
1260 elif test "$target_cpu" = "x86_64" ; then
1261 echo "TARGET_ARCH=x86_64" >> $config_mak
1262 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1263 echo "#define TARGET_I386 1" >> $config_h
1264 echo "#define TARGET_X86_64 1" >> $config_h
1265 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then
1266 echo "#define USE_KQEMU 1" >> $config_h
1269 elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
1270 echo "TARGET_ARCH=mips" >> $config_mak
1271 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1272 echo "#define TARGET_MIPS 1" >> $config_h
1273 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1274 elif test "$target_cpu" = "mipsn32" -o "$target_cpu" = "mipsn32el" ; then
1275 echo "TARGET_ARCH=mipsn32" >> $config_mak
1276 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1277 echo "#define TARGET_MIPS 1" >> $config_h
1278 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1279 elif test "$target_cpu" = "mips64" -o "$target_cpu" = "mips64el" ; then
1280 echo "TARGET_ARCH=mips64" >> $config_mak
1281 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1282 echo "#define TARGET_MIPS 1" >> $config_h
1283 echo "#define TARGET_MIPS64 1" >> $config_h
1284 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1285 elif test "$target_cpu" = "cris" ; then
1286 echo "TARGET_ARCH=cris" >> $config_mak
1287 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1288 echo "#define TARGET_CRIS 1" >> $config_h
1289 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1290 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1291 elif test "$target_cpu" = "sh4" -o "$target_cpu" = "sh4eb" ; then
1292 echo "TARGET_ARCH=sh4" >> $config_mak
1293 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1294 echo "#define TARGET_SH4 1" >> $config_h
1296 elif test "$target_cpu" = "m68k" ; then
1297 echo "TARGET_ARCH=m68k" >> $config_mak
1298 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1299 echo "#define TARGET_M68K 1" >> $config_h
1301 elif test "$target_cpu" = "alpha" ; then
1302 echo "TARGET_ARCH=alpha" >> $config_mak
1303 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1304 echo "#define TARGET_ALPHA 1" >> $config_h
1306 echo "Unsupported target CPU"
1309 if test "$target_bigendian" = "yes" ; then
1310 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1311 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1313 if test "$target_softmmu" = "yes" ; then
1314 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1315 echo "#define CONFIG_SOFTMMU 1" >> $config_h
1317 if test "$target_user_only" = "yes" ; then
1318 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1319 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1321 if test "$target_linux_user" = "yes" ; then
1322 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1323 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1325 if test "$target_darwin_user" = "yes" ; then
1326 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1327 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1330 if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" -o "$target_cpu" = "sparc" -o "$target_cpu" = "sparc64" -o "$target_cpu" = "sparc32plus" -o "$target_cpu" = "m68k" -o "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" -o "$target_cpu" = "mipsn32" -o "$target_cpu" = "mipsn32el" -o "$target_cpu" = "mips64" -o "$target_cpu" = "mips64el"; then
1331 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1332 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1334 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1335 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1336 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1338 # 32 bit ELF loader in addition to native 64 bit loader?
1339 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1340 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1341 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1344 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~
$config_h
1346 done # for target in $targets
1348 # build tree in object directory if source path is different from current one
1349 if test "$source_path_used" = "yes" ; then
1350 DIRS
="tests tests/cris slirp audio"
1351 FILES
="Makefile tests/Makefile"
1352 FILES
="$FILES tests/cris/Makefile tests/cris/.gdbinit"
1353 FILES
="$FILES tests/test-mmap.c"
1354 for dir
in $DIRS ; do
1357 # remove the link and recreate it, as not all "ln -sf" overwrite the link
1358 for f
in $FILES ; do
1360 ln -s $source_path/$f $f
1364 rm -f $TMPO $TMPC $TMPE $TMPS