Separate thread for IO handling
[qemu-kvm/fedora.git] / configure
blobca9bce20f445fc875b4ffbcae477e164c8623ca4
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.6 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 cris)
57 cpu="cris"
59 s390*)
60 cpu="s390"
62 sparc|sun4[cdmuv])
63 cpu="sparc"
65 sparc64)
66 cpu="sparc64"
68 ia64)
69 cpu="ia64"
71 m68k)
72 cpu="m68k"
74 x86_64|amd64)
75 cpu="x86_64"
78 cpu="unknown"
80 esac
81 gprof="no"
82 bigendian="no"
83 mingw32="no"
84 EXESUF=""
85 gdbstub="yes"
86 slirp="yes"
87 adlib="no"
88 ac97="no"
89 gus="no"
90 oss="no"
91 dsound="no"
92 coreaudio="no"
93 alsa="no"
94 esd="no"
95 fmod="no"
96 fmod_lib=""
97 fmod_inc=""
98 vnc_tls="yes"
99 bsd="no"
100 linux="no"
101 kqemu="no"
102 kvm="no"
103 kvm_cap_pit="no"
104 profiler="no"
105 kernel_path=""
106 cocoa="no"
107 check_gfx="yes"
108 check_gcc="yes"
109 softmmu="yes"
110 linux_user="no"
111 darwin_user="no"
112 build_docs="no"
113 uname_release=""
114 curses="yes"
115 cpu_emulation="yes"
116 device_tree_support=""
118 # OS specific
119 targetos=`uname -s`
120 case $targetos in
121 CYGWIN*)
122 mingw32="yes"
123 OS_CFLAGS="-mno-cygwin"
124 if [ "$cpu" = "i386" ] ; then
125 kqemu="yes"
128 MINGW32*)
129 mingw32="yes"
130 if [ "$cpu" = "i386" ] ; then
131 kqemu="yes"
134 GNU/kFreeBSD)
135 oss="yes"
136 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
137 kqemu="yes"
140 FreeBSD)
141 bsd="yes"
142 oss="yes"
143 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
144 kqemu="yes"
145 kvm="yes"
148 NetBSD)
149 bsd="yes"
150 oss="yes"
152 OpenBSD)
153 bsd="yes"
154 oss="yes"
156 Darwin)
157 bsd="yes"
158 darwin="yes"
159 darwin_user="yes"
160 cocoa="yes"
161 coreaudio="yes"
162 OS_CFLAGS="-mdynamic-no-pic"
163 OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
165 SunOS)
166 solaris="yes"
167 make="gmake"
168 install="ginstall"
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
175 cpu="x86_64"
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"
181 else
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."
186 exit 1
189 if test "$solarisrev" -ge 9 ; then
190 kqemu="yes"
193 if test -f /usr/include/sys/soundcard.h ; then
194 oss=yes
198 oss="yes"
199 linux="yes"
200 linux_user="yes"
201 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
202 kqemu="yes"
203 kvm="yes"
205 if [ "$cpu" = "ia64" ] ; then
206 kvm="yes"
207 gdbstub="no"
208 slirp="no"
210 if [ "$cpu" = "powerpc" ]; then
211 kvm="yes"
214 esac
216 if [ "$bsd" = "yes" ] ; then
217 if [ "$darwin" != "yes" ] ; then
218 make="gmake"
222 # find source path
223 source_path=`dirname "$0"`
224 source_path_used="no"
225 workdir=`pwd`
226 if [ -z "$source_path" ]; then
227 source_path=$workdir
228 else
229 source_path=`cd "$source_path"; pwd`
231 [ -f "$workdir/vl.c" ] || source_path_used="yes"
233 werror="no"
234 # generate compile errors on warnings for development builds
235 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
236 #werror="yes";
239 for opt do
240 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
241 case "$opt" in
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"
253 --cc=*) cc="$optarg"
254 gcc3_search="no"
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"
330 --sparc_cpu=*)
331 sparc_cpu="$optarg"
332 case $sparc_cpu in
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;;
340 esac
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
354 esac
355 done
357 if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
358 AIOLIBS=
359 else
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)
375 case "$cpu" in
376 sparc) if test -z "$sparc_cpu" ; then
377 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
378 ARCH_LDFLAGS="-m32"
379 else
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__"
386 ARCH_LDFLAGS="-m64"
387 else
388 ARCH_CFLAGS="${SP_CFLAGS}"
389 ARCH_LDFLAGS="${SP_LDFLAGS}"
392 s390)
393 ARCH_CFLAGS="-march=z900"
395 i386)
396 ARCH_CFLAGS="-m32"
397 ARCH_LDFLAGS="-m32"
399 x86_64)
400 ARCH_CFLAGS="-m64"
401 ARCH_LDFLAGS="-m64"
403 esac
405 if test x"$show_help" = x"yes" ; then
406 cat << EOF
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]"
418 echo ""
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"
423 echo ""
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"
457 echo ""
458 echo "NOTE: The object files are built at the place where configure is launched"
459 exit 1
462 cc="${cross_prefix}${cc}"
463 ar="${cross_prefix}${ar}"
464 strip="${cross_prefix}${strip}"
466 # check that the C compiler works.
467 cat > $TMPC <<EOF
468 int main(void) {}
471 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then
472 : C compiler works ok
473 else
474 echo "ERROR: \"$cc\" either does not exist or does not work"
475 exit 1
478 if test "$mingw32" = "yes" ; then
479 linux="no"
480 EXESUF=".exe"
481 oss="no"
484 # Check for gcc4, error if pre-gcc4
485 if test "$check_gcc" = "yes" ; then
486 cat > $TMPC <<EOF
487 #if __GNUC__ < 4
488 #error gcc3
489 #endif
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"
494 found_compat_cc="no"
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"
502 break
504 done
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"
513 exit 1;
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
527 solgcc=`which $cc`
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"
532 exit 1
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)"
540 exit 1
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"
546 exit 1
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"
554 exit 1
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"
572 else
573 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
575 if test -z "$target_list" ; then
576 echo "No targets enabled"
577 exit 1
580 if test -z "$cross_prefix" ; then
582 # ---
583 # big/little endian test
584 cat > $TMPC << EOF
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"
594 else
595 echo big/little test failed
598 else
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
602 bigendian="yes"
607 # host long bits test
608 hostlongbits="32"
609 if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
610 hostlongbits="64"
613 # check gcc options support
614 cat > $TMPC <<EOF
615 int main(void) {
619 ##########################################
620 # KVM probe
622 if test "$kvm" = "yes" ; then
623 cat > $TMPC <<EOF
624 #include <libkvm.h>
625 #ifndef KVM_CAP_PIT
626 #error "kvm no pit capability"
627 #endif
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
631 kvm_cap_pit="yes"
635 ##########################################
636 # SDL probe
638 sdl_too_old=no
640 if test -z "$sdl" ; then
641 sdl_config="sdl-config"
642 sdl=no
643 sdl_static=no
645 if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
646 # win32 cross compilation case
647 sdl_config="i386-mingw32msvc-sdl-config"
648 sdl=yes
649 else
650 # normal SDL probe
651 cat > $TMPC << EOF
652 #include <SDL.h>
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
659 sdl_too_old=yes
660 else
661 if test "$cocoa" = "no" ; then
662 sdl=yes
666 # static link with sdl ?
667 if test "$sdl" = "yes" ; then
668 aa="no"
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
676 sdl_static=yes
678 fi # static link
679 fi # sdl compile test
680 fi # cross compilation
681 else
682 # Make sure to disable cocoa if sdl was set
683 if test "$sdl" = "yes" ; then
684 cocoa="no"
685 coreaudio="no"
687 fi # -z $sdl
689 ##########################################
690 # VNC TLS detection
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
703 cat > $TMPC << EOF
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
709 else
710 echo
711 echo "Error: Could not find alsa"
712 echo "Make sure to have the alsa libs and headers installed."
713 echo
714 exit 1
718 ##########################################
719 # curses probe
721 if test "$curses" = "yes" ; then
722 curses=no
723 cat > $TMPC << EOF
724 #include <curses.h>
725 int main(void) { return curses_version(); }
727 if $cc -o $TMPE $TMPC -lcurses 2> /dev/null ; then
728 curses=yes
730 fi # test "$curses"
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
735 build_docs="yes"
738 if test "$mingw32" = "yes" ; then
739 if test -z "$prefix" ; then
740 prefix="/c/Program Files/Qemu"
742 mansuffix=""
743 datasuffix=""
744 docsuffix=""
745 binsuffix=""
746 else
747 if test -z "$prefix" ; then
748 prefix="/usr/local"
750 mansuffix="/share/man"
751 datasuffix="/share/qemu"
752 docsuffix="/share/doc/qemu"
753 binsuffix="/bin"
756 ######################################
757 # libfdt probe
759 if test -z "$device_tree_support" -a \
760 "$cpu" = "powerpc"; then
761 device_tree_support="no"
762 cat > $TMPC << EOF
763 #include <libfdt.h>
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"
772 else
773 echo
774 echo "Error: Could not find libfdt"
775 echo "Make sure to have the libfdt libs and headers installed."
776 echo
777 exit 1
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"
792 echo "make $make"
793 echo "install $install"
794 echo "host CPU $cpu"
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
819 echo
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"
822 echo
823 exit 1
825 fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
826 else
827 fmod_support=""
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
936 else
937 echo "Unsupported CPU = $cpu"
938 exit 1
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
948 else
949 cat > $TMPC << EOF
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
1050 sdl1=$sdl_static
1051 else
1052 sdl1=$sdl
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
1059 else
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
1064 else
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
1087 tools=
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
1114 target_softmmu="no"
1115 target_user_only="no"
1116 target_linux_user="no"
1117 target_darwin_user="no"
1118 case "$target" in
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"
1132 exit 1
1134 esac
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."
1142 exit 1;
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
1170 bflt="no"
1171 elfload32="no"
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
1182 configure_kvm() {
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
1202 configure_kvm
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
1207 configure_kvm
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
1212 bflt="yes"
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
1222 elfload32="yes"
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
1245 configure_kvm
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
1268 configure_kvm
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
1295 bflt="yes"
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
1300 bflt="yes"
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
1305 else
1306 echo "Unsupported target CPU"
1307 exit 1
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
1355 mkdir -p $dir
1356 done
1357 # remove the link and recreate it, as not all "ln -sf" overwrite the link
1358 for f in $FILES ; do
1359 rm -f $f
1360 ln -s $source_path/$f $f
1361 done
1364 rm -f $TMPO $TMPC $TMPE $TMPS