Sync ia64 instruction cache after DMA memory access
[qemu-kvm/fedora.git] / configure
bloba3c9fa809919a552a68efd54bd45135e65428865
1 #!/bin/sh
3 # qemu configure script (c) 2003 Fabrice Bellard
5 # set temporary file name
6 if test ! -z "$TMPDIR" ; then
7 TMPDIR1="${TMPDIR}"
8 elif test ! -z "$TEMPDIR" ; then
9 TMPDIR1="${TEMPDIR}"
10 else
11 TMPDIR1="/tmp"
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"
19 # default parameters
20 prefix=""
21 interp_prefix="/usr/gnemul/qemu-%M"
22 static="no"
23 cross_prefix=""
24 cc="gcc"
25 gcc3_search="yes"
26 gcc3_list="gcc-3.4 gcc34 gcc-3.3.6 gcc-3.3 gcc33 gcc-3.2 gcc32"
27 host_cc="gcc"
28 ar="ar"
29 make="make"
30 install="install"
31 strip="strip"
32 cpu=`uname -m`
33 target_list=""
34 case "$cpu" in
35 i386|i486|i586|i686|i86pc|BePC)
36 cpu="i386"
38 armv*b)
39 cpu="armv4b"
41 armv*l)
42 cpu="armv4l"
44 alpha)
45 cpu="alpha"
47 "Power Macintosh"|ppc|ppc64)
48 cpu="powerpc"
50 mips)
51 cpu="mips"
53 mips64)
54 cpu="mips64"
56 s390*)
57 cpu="s390"
59 sparc|sun4[cdmuv])
60 cpu="sparc"
62 sparc64)
63 cpu="sparc64"
65 ia64)
66 cpu="ia64"
68 m68k)
69 cpu="m68k"
71 x86_64|amd64)
72 cpu="x86_64"
75 cpu="unknown"
77 esac
78 gprof="no"
79 bigendian="no"
80 mingw32="no"
81 EXESUF=""
82 gdbstub="yes"
83 slirp="yes"
84 adlib="no"
85 oss="no"
86 dsound="no"
87 coreaudio="no"
88 alsa="no"
89 fmod="no"
90 fmod_lib=""
91 fmod_inc=""
92 vnc_tls="yes"
93 bsd="no"
94 linux="no"
95 kqemu="no"
96 kvm="no"
97 profiler="no"
98 kernel_path=""
99 cocoa="no"
100 check_gfx="yes"
101 check_gcc="yes"
102 softmmu="yes"
103 linux_user="no"
104 darwin_user="no"
105 build_docs="no"
106 uname_release=""
108 # OS specific
109 targetos=`uname -s`
110 case $targetos in
111 CYGWIN*)
112 mingw32="yes"
113 OS_CFLAGS="-mno-cygwin"
114 VL_OS_LDFLAGS="-mno-cygwin"
115 if [ "$cpu" = "i386" ] ; then
116 kqemu="yes"
119 MINGW32*)
120 mingw32="yes"
121 if [ "$cpu" = "i386" ] ; then
122 kqemu="yes"
125 GNU/kFreeBSD)
126 oss="yes"
127 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
128 kqemu="yes"
131 FreeBSD)
132 bsd="yes"
133 oss="yes"
134 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
135 kqemu="yes"
136 kvm="yes"
139 NetBSD)
140 bsd="yes"
141 oss="yes"
143 OpenBSD)
144 bsd="yes"
145 oss="yes"
147 Darwin)
148 bsd="yes"
149 darwin="yes"
150 darwin_user="yes"
151 cocoa="yes"
152 coreaudio="yes"
153 OS_CFLAGS="-mdynamic-no-pic"
155 SunOS)
156 solaris="yes"
157 make="gmake"
158 install="ginstall"
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
165 cpu="x86_64"
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"
171 else
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."
176 exit 1
179 if test "$solarisrev" -ge 9 ; then
180 kqemu="yes"
183 if test -f /usr/include/sys/soundcard.h ; then
184 oss=yes
188 oss="yes"
189 linux="yes"
190 linux_user="yes"
191 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
192 kqemu="yes"
193 kvm="yes"
196 esac
198 if [ "$bsd" = "yes" ] ; then
199 if [ "$darwin" != "yes" ] ; then
200 make="gmake"
204 # find source path
205 source_path=`dirname "$0"`
206 if [ -z "$source_path" ]; then
207 source_path=`pwd`
208 else
209 source_path=`cd "$source_path"; pwd`
211 if test "$source_path" = `pwd` ; then
212 source_path_used="no"
213 else
214 source_path_used="yes"
217 for opt do
218 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
219 case "$opt" in
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"
231 --cc=*) cc="$optarg"
232 gcc3_search="no"
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"
302 --sparc_cpu=*)
303 sparc_cpu="$optarg"
304 case $sparc_cpu in
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;;
312 esac
314 esac
315 done
317 if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
318 AIOLIBS=
319 else
320 AIOLIBS="-lrt"
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)
331 case $cpu in
332 sparc) if test -z "$sparc_cpu" ; then
333 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
334 ARCH_LDFLAGS="-m32"
335 else
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__"
342 ARCH_LDFLAGS="-m64"
343 else
344 ARCH_CFLAGS="${SP_CFLAGS}"
345 ARCH_LDFLAGS="${SP_LDFLAGS}"
348 esac
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
361 cat << EOF
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]"
373 echo ""
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"
378 echo ""
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"
405 echo ""
406 echo "NOTE: The object files are built at the place where configure is launched"
407 exit 1
410 cc="${cross_prefix}${cc}"
411 ar="${cross_prefix}${ar}"
412 strip="${cross_prefix}${strip}"
414 # check that the C compiler works.
415 cat > $TMPC <<EOF
416 int main(void) {}
419 if $cc -c -o $TMPO $TMPC 2> /dev/null ; then
420 : C compiler works ok
421 else
422 echo "ERROR: \"$cc\" either does not exist or does not work"
423 exit 1
426 if test "$mingw32" = "yes" ; then
427 linux="no"
428 EXESUF=".exe"
429 oss="no"
432 # Check for gcc4, error if pre-gcc4
433 if test "$check_gcc" = "yes" ; then
434 cat > $TMPC <<EOF
435 #if __GNUC__ < 4
436 #error gcc3
437 #endif
438 int main(){return 0;}
440 if "$cc" -o $TMPE $TMPC 2> /dev/null ; then
441 echo "WARNING: \"$cc\" looks like gcc 4.x"
442 found_compat_cc="no"
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"
450 break
452 done
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"
461 exit 1;
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
475 solgcc=`which $cc`
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"
480 exit 1
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)"
488 exit 1
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"
494 exit 1
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"
502 exit 1
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"
520 else
521 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
523 if test -z "$target_list" ; then
524 echo "No targets enabled"
525 exit 1
528 if test -z "$cross_prefix" ; then
530 # ---
531 # big/little endian test
532 cat > $TMPC << EOF
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"
542 else
543 echo big/little test failed
546 else
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
550 bigendian="yes"
555 # host long bits test
556 hostlongbits="32"
557 if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
558 hostlongbits="64"
561 # check gcc options support
562 cat > $TMPC <<EOF
563 int main(void) {
567 ##########################################
568 # SDL probe
570 sdl_too_old=no
572 if test -z "$sdl" ; then
573 sdl_config="sdl-config"
574 sdl=no
575 sdl_static=no
577 if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
578 # win32 cross compilation case
579 sdl_config="i386-mingw32msvc-sdl-config"
580 sdl=yes
581 else
582 # normal SDL probe
583 cat > $TMPC << EOF
584 #include <SDL.h>
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
591 sdl_too_old=yes
592 else
593 if test "$cocoa" = "no" ; then
594 sdl=yes
598 # static link with sdl ?
599 if test "$sdl" = "yes" ; then
600 aa="no"
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
608 sdl_static=yes
610 fi # static link
611 fi # sdl compile test
612 fi # cross compilation
613 else
614 # Make sure to disable cocoa if sdl was set
615 if test "$sdl" = "yes" ; then
616 cocoa="no"
617 coreaudio="no"
619 fi # -z $sdl
621 ##########################################
622 # VNC TLS detection
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
635 cat > $TMPC << EOF
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
641 else
642 echo
643 echo "Error: Could not find alsa"
644 echo "Make sure to have the alsa libs and headers installed."
645 echo
646 exit 1
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
653 build_docs="yes"
656 if test "$mingw32" = "yes" ; then
657 if test -z "$prefix" ; then
658 prefix="/c/Program Files/Qemu"
660 mansuffix=""
661 datasuffix=""
662 docsuffix=""
663 binsuffix=""
664 else
665 if test -z "$prefix" ; then
666 prefix="/usr/local"
668 mansuffix="/share/man"
669 datasuffix="/share/qemu"
670 docsuffix="/share/doc/qemu"
671 binsuffix="/bin"
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"
684 echo "make $make"
685 echo "install $install"
686 echo "host CPU $cpu"
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
706 echo
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"
709 echo
710 exit 1
712 fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
713 else
714 fmod_support=""
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
814 else
815 echo "Unsupported CPU = $cpu"
816 exit 1
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
826 else
827 cat > $TMPC << EOF
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
905 echo "#define KVM_VERSION \"kvm-devel\"" >> $config_h
907 echo "SRC_PATH=$source_path" >> $config_mak
908 if [ "$source_path_used" = "yes" ]; then
909 echo "VPATH=$source_path" >> $config_mak
911 echo "TARGET_DIRS=$target_list" >> $config_mak
912 if [ "$build_docs" = "yes" ] ; then
913 echo "BUILD_DOCS=yes" >> $config_mak
916 # XXX: suppress that
917 if [ "$bsd" = "yes" ] ; then
918 echo "#define O_LARGEFILE 0" >> $config_h
919 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
920 echo "#define _BSD 1" >> $config_h
923 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
925 tools=
926 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
927 tools="qemu-img\$(EXESUF) $tools"
929 echo "TOOLS=$tools" >> $config_mak
931 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
933 for target in $target_list; do
934 target_dir="$target"
935 config_mak=$target_dir/config.mak
936 config_h=$target_dir/config.h
937 target_cpu=`echo $target | cut -d '-' -f 1`
938 target_bigendian="no"
939 [ "$target_cpu" = "armeb" ] && target_bigendian=yes
940 [ "$target_cpu" = "sparc" ] && target_bigendian=yes
941 [ "$target_cpu" = "sparc64" ] && target_bigendian=yes
942 [ "$target_cpu" = "ppc" ] && target_bigendian=yes
943 [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
944 [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
945 [ "$target_cpu" = "mips" ] && target_bigendian=yes
946 [ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
947 [ "$target_cpu" = "mips64" ] && target_bigendian=yes
948 [ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
949 [ "$target_cpu" = "m68k" ] && target_bigendian=yes
950 target_softmmu="no"
951 target_user_only="no"
952 target_linux_user="no"
953 target_darwin_user="no"
954 case "$target" in
955 ${target_cpu}-softmmu)
956 target_softmmu="yes"
958 ${target_cpu}-linux-user)
959 target_user_only="yes"
960 target_linux_user="yes"
962 ${target_cpu}-darwin-user)
963 target_user_only="yes"
964 target_darwin_user="yes"
967 echo "ERROR: Target '$target' not recognised"
968 exit 1
970 esac
972 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
973 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
974 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
975 echo "To build QEMU without graphical output configure with --disable-gfx-check"
976 echo "Note that this will disable all output from the virtual graphics card."
977 exit 1;
980 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
982 test -f $config_h && mv $config_h ${config_h}~
984 mkdir -p $target_dir
985 mkdir -p $target_dir/fpu
986 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then
987 mkdir -p $target_dir/nwfpe
989 if test "$target_user_only" = "no" ; then
990 mkdir -p $target_dir/slirp
994 # don't use ln -sf as not all "ln -sf" over write the file/link
996 rm -f $target_dir/Makefile
997 ln -s $source_path/Makefile.target $target_dir/Makefile
1000 echo "# Automatically generated by configure - do not modify" > $config_mak
1001 echo "/* Automatically generated by configure - do not modify */" > $config_h
1004 echo "include ../config-host.mak" >> $config_mak
1005 echo "#include \"../config-host.h\"" >> $config_h
1007 bflt="no"
1008 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1009 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1011 configure_kvm() {
1012 if test $kvm = "yes" -a "$target_softmmu" = "yes" -a \
1013 \( "$cpu" = "i386" -o "$cpu" = "x86_64" \); then
1014 echo "#define USE_KVM 1" >> $config_h
1015 echo "CONFIG_KVM_KERNEL_INC=$kernel_path/include" >> $config_mak
1019 if test "$target_cpu" = "i386" ; then
1020 echo "TARGET_ARCH=i386" >> $config_mak
1021 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1022 echo "#define TARGET_I386 1" >> $config_h
1023 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
1024 echo "#define USE_KQEMU 1" >> $config_h
1026 configure_kvm
1027 elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
1028 echo "TARGET_ARCH=arm" >> $config_mak
1029 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1030 echo "#define TARGET_ARM 1" >> $config_h
1031 bflt="yes"
1032 elif test "$target_cpu" = "sparc" ; then
1033 echo "TARGET_ARCH=sparc" >> $config_mak
1034 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1035 echo "#define TARGET_SPARC 1" >> $config_h
1036 elif test "$target_cpu" = "sparc64" ; then
1037 echo "TARGET_ARCH=sparc64" >> $config_mak
1038 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1039 echo "#define TARGET_SPARC 1" >> $config_h
1040 echo "#define TARGET_SPARC64 1" >> $config_h
1041 elif test "$target_cpu" = "ppc" ; then
1042 echo "TARGET_ARCH=ppc" >> $config_mak
1043 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1044 echo "#define TARGET_PPC 1" >> $config_h
1045 elif test "$target_cpu" = "ppc64" ; then
1046 echo "TARGET_ARCH=ppc64" >> $config_mak
1047 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1048 echo "#define TARGET_PPC 1" >> $config_h
1049 echo "#define TARGET_PPC64 1" >> $config_h
1050 elif test "$target_cpu" = "ppcemb" ; then
1051 echo "TARGET_ARCH=ppcemb" >> $config_mak
1052 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1053 echo "#define TARGET_PPC 1" >> $config_h
1054 echo "#define TARGET_PPCEMB 1" >> $config_h
1055 elif test "$target_cpu" = "x86_64" ; then
1056 echo "TARGET_ARCH=x86_64" >> $config_mak
1057 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1058 echo "#define TARGET_I386 1" >> $config_h
1059 echo "#define TARGET_X86_64 1" >> $config_h
1060 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then
1061 echo "#define USE_KQEMU 1" >> $config_h
1063 configure_kvm
1064 elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
1065 echo "TARGET_ARCH=mips" >> $config_mak
1066 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1067 echo "#define TARGET_MIPS 1" >> $config_h
1068 elif test "$target_cpu" = "mipsn32" -o "$target_cpu" = "mipsn32el" ; then
1069 echo "TARGET_ARCH=mipsn32" >> $config_mak
1070 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1071 echo "#define TARGET_MIPS 1" >> $config_h
1072 echo "#define TARGET_MIPSN32 1" >> $config_h
1073 elif test "$target_cpu" = "mips64" -o "$target_cpu" = "mips64el" ; then
1074 echo "TARGET_ARCH=mips64" >> $config_mak
1075 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1076 echo "#define TARGET_MIPS 1" >> $config_h
1077 echo "#define TARGET_MIPS64 1" >> $config_h
1078 elif test "$target_cpu" = "sh4" -o "$target_cpu" = "sh4eb" ; then
1079 echo "TARGET_ARCH=sh4" >> $config_mak
1080 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1081 echo "#define TARGET_SH4 1" >> $config_h
1082 bflt="yes"
1083 elif test "$target_cpu" = "m68k" ; then
1084 echo "TARGET_ARCH=m68k" >> $config_mak
1085 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1086 echo "#define TARGET_M68K 1" >> $config_h
1087 bflt="yes"
1088 elif test "$target_cpu" = "alpha" ; then
1089 echo "TARGET_ARCH=alpha" >> $config_mak
1090 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1091 echo "#define TARGET_ALPHA 1" >> $config_h
1092 else
1093 echo "Unsupported target CPU"
1094 exit 1
1096 if test "$target_bigendian" = "yes" ; then
1097 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1098 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1100 if test "$target_softmmu" = "yes" ; then
1101 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1102 echo "#define CONFIG_SOFTMMU 1" >> $config_h
1104 if test "$target_user_only" = "yes" ; then
1105 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1106 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1108 if test "$target_linux_user" = "yes" ; then
1109 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1110 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1112 if test "$target_darwin_user" = "yes" ; then
1113 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1114 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1117 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
1118 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1119 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1121 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1122 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1123 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1125 # sdl defines
1127 if test "$target_user_only" = "no"; then
1128 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1129 sdl1=$sdl_static
1130 else
1131 sdl1=$sdl
1133 if test "$sdl1" = "yes" ; then
1134 echo "#define CONFIG_SDL 1" >> $config_h
1135 echo "CONFIG_SDL=yes" >> $config_mak
1136 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1137 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1138 else
1139 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1141 if [ "${aa}" = "yes" ] ; then
1142 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1143 else
1144 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1149 if test "$cocoa" = "yes" ; then
1150 echo "#define CONFIG_COCOA 1" >> $config_h
1151 echo "CONFIG_COCOA=yes" >> $config_mak
1154 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1156 done # for target in $targets
1158 # build tree in object directory if source path is different from current one
1159 if test "$source_path_used" = "yes" ; then
1160 DIRS="tests"
1161 FILES="Makefile tests/Makefile"
1162 for dir in $DIRS ; do
1163 mkdir -p $dir
1164 done
1165 # remove the link and recreate it, as not all "ln -sf" overwrite the link
1166 for f in $FILES ; do
1167 rm -f $f
1168 ln -s $source_path/$f $f
1169 done
1172 rm -f $TMPO $TMPC $TMPE $TMPS