Ppc: Fix for lost simultaneous interrupts
[qemu-kvm/fedora.git] / configure
blobea2111c3d42983b31918249a2619a8f08c30a2d3
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 x86_64|amd64)
39 cpu="x86_64"
41 alpha)
42 cpu="alpha"
44 armv*b)
45 cpu="armv4b"
47 armv*l)
48 cpu="armv4l"
50 cris)
51 cpu="cris"
53 parisc|parisc64)
54 cpu="hppa"
56 ia64)
57 cpu="ia64"
59 m68k)
60 cpu="m68k"
62 mips)
63 cpu="mips"
65 mips64)
66 cpu="mips64"
68 "Power Macintosh"|ppc|ppc64)
69 cpu="powerpc"
71 s390*)
72 cpu="s390"
74 sparc|sun4[cdmuv])
75 cpu="sparc"
77 sparc64)
78 cpu="sparc64"
81 cpu="unknown"
83 esac
84 gprof="no"
85 bigendian="no"
86 mingw32="no"
87 EXESUF=""
88 gdbstub="yes"
89 slirp="yes"
90 adlib="no"
91 ac97="no"
92 gus="no"
93 oss="no"
94 dsound="no"
95 coreaudio="no"
96 alsa="no"
97 esd="no"
98 fmod="no"
99 fmod_lib=""
100 fmod_inc=""
101 vnc_tls="yes"
102 bsd="no"
103 linux="no"
104 kqemu="no"
105 kvm="no"
106 kvm_cap_pit="no"
107 profiler="no"
108 kernel_path=""
109 cocoa="no"
110 check_gfx="yes"
111 check_gcc="yes"
112 softmmu="yes"
113 linux_user="no"
114 darwin_user="no"
115 build_docs="no"
116 uname_release=""
117 curses="yes"
118 cpu_emulation="yes"
119 device_tree_support=""
121 # OS specific
122 targetos=`uname -s`
123 case $targetos in
124 CYGWIN*)
125 mingw32="yes"
126 OS_CFLAGS="-mno-cygwin"
127 if [ "$cpu" = "i386" ] ; then
128 kqemu="yes"
131 MINGW32*)
132 mingw32="yes"
133 if [ "$cpu" = "i386" ] ; then
134 kqemu="yes"
137 GNU/kFreeBSD)
138 oss="yes"
139 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
140 kqemu="yes"
143 FreeBSD)
144 bsd="yes"
145 oss="yes"
146 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
147 kqemu="yes"
148 kvm="yes"
151 NetBSD)
152 bsd="yes"
153 oss="yes"
155 OpenBSD)
156 bsd="yes"
157 oss="yes"
159 Darwin)
160 bsd="yes"
161 darwin="yes"
162 darwin_user="yes"
163 cocoa="yes"
164 coreaudio="yes"
165 OS_CFLAGS="-mdynamic-no-pic"
166 OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
168 SunOS)
169 solaris="yes"
170 make="gmake"
171 install="ginstall"
172 needs_libsunmath="no"
173 solarisrev=`uname -r | cut -f2 -d.`
174 # have to select again, because `uname -m` returns i86pc
175 # even on an x86_64 box.
176 solariscpu=`isainfo -k`
177 if test "${solariscpu}" = "amd64" ; then
178 cpu="x86_64"
180 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
181 if test "$solarisrev" -le 9 ; then
182 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
183 needs_libsunmath="yes"
184 else
185 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
186 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
187 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
188 echo "Studio 11 can be downloaded from www.sun.com."
189 exit 1
192 if test "$solarisrev" -ge 9 ; then
193 kqemu="yes"
196 if test -f /usr/include/sys/soundcard.h ; then
197 oss=yes
201 oss="yes"
202 linux="yes"
203 linux_user="yes"
204 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
205 kqemu="yes"
206 kvm="yes"
208 if [ "$cpu" = "ia64" ] ; then
209 kvm="yes"
210 gdbstub="no"
211 slirp="no"
213 if [ "$cpu" = "powerpc" ]; then
214 kvm="yes"
217 esac
219 if [ "$bsd" = "yes" ] ; then
220 if [ "$darwin" != "yes" ] ; then
221 make="gmake"
225 # find source path
226 source_path=`dirname "$0"`
227 source_path_used="no"
228 workdir=`pwd`
229 if [ -z "$source_path" ]; then
230 source_path=$workdir
231 else
232 source_path=`cd "$source_path"; pwd`
234 [ -f "$workdir/vl.c" ] || source_path_used="yes"
236 werror="no"
237 # generate compile errors on warnings for development builds
238 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
239 #werror="yes";
242 for opt do
243 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
244 case "$opt" in
245 --help|-h) show_help=yes
247 --prefix=*) prefix="$optarg"
249 --interp-prefix=*) interp_prefix="$optarg"
251 --source-path=*) source_path="$optarg"
252 source_path_used="yes"
254 --cross-prefix=*) cross_prefix="$optarg"
256 --cc=*) cc="$optarg"
257 gcc3_search="no"
259 --host-cc=*) host_cc="$optarg"
261 --make=*) make="$optarg"
263 --install=*) install="$optarg"
265 --extra-cflags=*) CFLAGS="$optarg"
267 --extra-ldflags=*) LDFLAGS="$optarg"
269 --cpu=*) cpu="$optarg"
271 --target-list=*) target_list="$optarg"
273 --enable-gprof) gprof="yes"
275 --static) static="yes"
277 --disable-sdl) sdl="no"
279 --enable-coreaudio) coreaudio="yes"
281 --enable-alsa) alsa="yes"
283 --enable-esd) esd="yes"
285 --enable-dsound) dsound="yes"
287 --enable-fmod) fmod="yes"
289 --fmod-lib=*) fmod_lib="$optarg"
291 --fmod-inc=*) fmod_inc="$optarg"
293 --disable-vnc-tls) vnc_tls="no"
295 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; linux_user="no"
297 --disable-slirp) slirp="no"
299 --enable-adlib) adlib="yes"
301 --enable-ac97) ac97="yes"
303 --enable-gus) gus="yes"
305 --disable-kqemu) kqemu="no"
307 --disable-kvm) kvm="no"
309 --disable-brlapi) brlapi="no"
311 --enable-profiler) profiler="yes"
313 --kernel-path=*) kernel_path="$optarg"
315 --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
317 --disable-gfx-check) check_gfx="no"
319 --disable-gcc-check) check_gcc="no"
321 --disable-system) softmmu="no"
323 --enable-system) softmmu="yes"
325 --disable-linux-user) linux_user="no"
327 --enable-linux-user) linux_user="yes"
329 --disable-darwin-user) darwin_user="no"
331 --enable-darwin-user) darwin_user="yes"
333 --enable-uname-release=*) uname_release="$optarg"
335 --sparc_cpu=*)
336 sparc_cpu="$optarg"
337 case $sparc_cpu in
338 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
339 target_cpu="sparc"; cpu="sparc" ;;
340 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
341 target_cpu="sparc"; cpu="sparc" ;;
342 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
343 target_cpu="sparc64"; cpu="sparc64" ;;
344 *) echo "undefined SPARC architecture. Exiting";exit 1;;
345 esac
347 --enable-werror) werror="yes"
349 --disable-werror) werror="no"
351 --disable-curses) curses="no"
353 --disable-cpu-emulation) cpu_emulation="no"
355 --disable-libfdt) device_tree_support="no"
357 *) echo "ERROR: unknown option $opt"; exit 1
359 esac
360 done
362 if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
363 AIOLIBS=
364 else
365 # Some Linux architectures (e.g. s390) don't imply -lpthread automatically.
366 AIOLIBS="-lrt -lpthread"
369 # default flags for all hosts
370 CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
371 LDFLAGS="$LDFLAGS -g"
372 if test "$werror" = "yes" ; then
373 CFLAGS="$CFLAGS -Werror"
377 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
378 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
380 case "$cpu" in
381 sparc) if test -z "$sparc_cpu" ; then
382 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
383 ARCH_LDFLAGS="-m32"
384 else
385 ARCH_CFLAGS="${SP_CFLAGS}"
386 ARCH_LDFLAGS="${SP_LDFLAGS}"
389 sparc64) if test -z "$sparc_cpu" ; then
390 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
391 ARCH_LDFLAGS="-m64"
392 else
393 ARCH_CFLAGS="${SP_CFLAGS}"
394 ARCH_LDFLAGS="${SP_LDFLAGS}"
397 s390)
398 ARCH_CFLAGS="-march=z900"
400 i386)
401 ARCH_CFLAGS="-m32"
402 ARCH_LDFLAGS="-m32"
404 x86_64)
405 ARCH_CFLAGS="-m64"
406 ARCH_LDFLAGS="-m64"
408 esac
410 if test x"$show_help" = x"yes" ; then
411 cat << EOF
413 Usage: configure [options]
414 Options: [defaults in brackets after descriptions]
417 echo "Standard options:"
418 echo " --help print this message"
419 echo " --prefix=PREFIX install in PREFIX [$prefix]"
420 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
421 echo " use %M for cpu name [$interp_prefix]"
422 echo " --target-list=LIST set target list [$target_list]"
423 echo ""
424 echo "kqemu kernel acceleration support:"
425 echo " --disable-kqemu disable kqemu support"
426 echo " --kernel-path=PATH set the kernel path (configure probes it)"
427 echo " --disable-kvm disable kernel virtual machine support"
428 echo ""
429 echo "Advanced options (experts only):"
430 echo " --source-path=PATH path of source code [$source_path]"
431 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
432 echo " --cc=CC use C compiler CC [$cc]"
433 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
434 echo " --make=MAKE use specified make [$make]"
435 echo " --install=INSTALL use specified install [$install]"
436 echo " --static enable static build [$static]"
437 echo " --disable-werror disable compilation abort on warning"
438 echo " --disable-sdl disable SDL"
439 echo " --enable-cocoa enable COCOA (Mac OS X only)"
440 echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
441 echo " --enable-adlib enable Adlib emulation"
442 echo " --enable-ac97 enable AC97 emulation"
443 echo " --enable-gus enable Gravis Ultrasound emulation"
444 echo " --enable-coreaudio enable Coreaudio audio driver"
445 echo " --enable-alsa enable ALSA audio driver"
446 echo " --enable-esd enable EsoundD audio driver"
447 echo " --enable-fmod enable FMOD audio driver"
448 echo " --enable-dsound enable DirectSound audio driver"
449 echo " --disable-brlapi disable BrlAPI"
450 echo " --disable-vnc-tls disable TLS encryption for VNC server"
451 echo " --disable-curses disable curses output"
452 echo " --enable-system enable all system emulation targets"
453 echo " --disable-system disable all system emulation targets"
454 echo " --enable-linux-user enable all linux usermode emulation targets"
455 echo " --disable-linux-user disable all linux usermode emulation targets"
456 echo " --enable-darwin-user enable all darwin usermode emulation targets"
457 echo " --disable-darwin-user disable all darwin usermode emulation targets"
458 echo " --fmod-lib path to FMOD library"
459 echo " --fmod-inc path to FMOD includes"
460 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
461 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
462 echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
463 echo " --disable-libfdt disables use of libfdt support for device tree"
464 echo ""
465 echo "NOTE: The object files are built at the place where configure is launched"
466 exit 1
469 cc="${cross_prefix}${cc}"
470 ar="${cross_prefix}${ar}"
471 strip="${cross_prefix}${strip}"
473 # check that the C compiler works.
474 cat > $TMPC <<EOF
475 int main(void) {}
478 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then
479 : C compiler works ok
480 else
481 echo "ERROR: \"$cc\" either does not exist or does not work"
482 exit 1
485 if test "$mingw32" = "yes" ; then
486 linux="no"
487 EXESUF=".exe"
488 oss="no"
491 # Check for gcc4, error if pre-gcc4
492 if test "$check_gcc" = "yes" ; then
493 cat > $TMPC <<EOF
494 #if __GNUC__ < 4
495 #error gcc3
496 #endif
497 int main(){return 0;}
499 if "$cc" $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
500 echo "WARNING: \"$cc\" looks like gcc 4.x"
501 found_compat_cc="no"
502 if test "$gcc3_search" = "yes" ; then
503 echo "Looking for gcc 3.x"
504 for compat_cc in $gcc3_list ; do
505 if "$cross_prefix$compat_cc" --version 2> /dev/null | fgrep '(GCC) 3.' > /dev/null 2>&1 ; then
506 echo "Found \"$compat_cc\""
507 cc="$cross_prefix$compat_cc"
508 found_compat_cc="yes"
509 break
511 done
512 if test "$found_compat_cc" = "no" ; then
513 echo "gcc 3.x not found!"
516 if test "$found_compat_cc" = "no" ; then
517 echo "QEMU is known to have problems when compiled with gcc 4.x"
518 echo "It is recommended that you use gcc 3.x to build QEMU"
519 echo "To use this compiler anyway, configure with --disable-gcc-check"
520 exit 1;
526 # Solaris specific configure tool chain decisions
528 if test "$solaris" = "yes" ; then
530 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
531 # override the check with --disable-gcc-check
533 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
534 solgcc=`which $cc`
535 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
536 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
537 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
538 echo "or get the latest patch from SunSolve for gcc"
539 exit 1
542 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
543 if test -z "$solinst" ; then
544 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
545 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
546 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
547 exit 1
549 if test "$solinst" = "/usr/sbin/install" ; then
550 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
551 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
552 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
553 exit 1
555 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
556 if test -z "$sol_ar" ; then
557 echo "Error: No path includes ar"
558 if test -f /usr/ccs/bin/ar ; then
559 echo "Add /usr/ccs/bin to your path and rerun configure"
561 exit 1
566 if test -z "$target_list" ; then
567 # these targets are portable
568 if [ "$softmmu" = "yes" ] ; then
569 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"
571 # the following are Linux specific
572 if [ "$linux_user" = "yes" ] ; then
573 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"
575 # the following are Darwin specific
576 if [ "$darwin_user" = "yes" ] ; then
577 target_list="i386-darwin-user ppc-darwin-user $target_list"
579 else
580 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
582 if test -z "$target_list" ; then
583 echo "No targets enabled"
584 exit 1
587 if test -z "$cross_prefix" ; then
589 # ---
590 # big/little endian test
591 cat > $TMPC << EOF
592 #include <inttypes.h>
593 int main(int argc, char ** argv){
594 volatile uint32_t i=0x01234567;
595 return (*((uint8_t*)(&i))) == 0x67;
599 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
600 $TMPE && bigendian="yes"
601 else
602 echo big/little test failed
605 else
607 # if cross compiling, cannot launch a program, so make a static guess
608 if test "$cpu" = "armv4b" \
609 -o "$cpu" = "hppa" \
610 -o "$cpu" = "m68k" \
611 -o "$cpu" = "mips" \
612 -o "$cpu" = "mips64" \
613 -o "$cpu" = "powerpc" \
614 -o "$cpu" = "s390" \
615 -o "$cpu" = "sparc" \
616 -o "$cpu" = "sparc64"; then
617 bigendian="yes"
622 # host long bits test
623 hostlongbits="32"
624 if test "$cpu" = "x86_64" \
625 -o "$cpu" = "alpha" \
626 -o "$cpu" = "ia64" \
627 -o "$cpu" = "sparc64"; then
628 hostlongbits="64"
631 # check gcc options support
632 cat > $TMPC <<EOF
633 int main(void) {
637 ##########################################
638 # KVM probe
640 if test "$kvm" = "yes" ; then
641 cat > $TMPC <<EOF
642 #include <libkvm.h>
643 #ifndef KVM_CAP_PIT
644 #error "kvm no pit capability"
645 #endif
646 int main(void) { return 0; }
648 if $cc $ARCH_CFLAGS $CFLAGS -I"$kernel_path"/include -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev/null ; then
649 kvm_cap_pit="yes"
653 ##########################################
654 # SDL probe
656 sdl_too_old=no
658 if test -z "$sdl" ; then
659 sdl_config="sdl-config"
660 sdl=no
661 sdl_static=no
663 if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
664 # win32 cross compilation case
665 sdl_config="i386-mingw32msvc-sdl-config"
666 sdl=yes
667 else
668 # normal SDL probe
669 cat > $TMPC << EOF
670 #include <SDL.h>
671 #undef main /* We don't want SDL to override our main() */
672 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
674 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
675 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
676 if test "$_sdlversion" -lt 121 ; then
677 sdl_too_old=yes
678 else
679 if test "$cocoa" = "no" ; then
680 sdl=yes
684 # static link with sdl ?
685 if test "$sdl" = "yes" ; then
686 aa="no"
687 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
688 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
689 if [ "$aa" = "yes" ] ; then
690 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
693 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
694 sdl_static=yes
696 fi # static link
697 fi # sdl compile test
698 fi # cross compilation
699 else
700 # Make sure to disable cocoa if sdl was set
701 if test "$sdl" = "yes" ; then
702 cocoa="no"
703 coreaudio="no"
705 fi # -z $sdl
707 ##########################################
708 # VNC TLS detection
709 if test "$vnc_tls" = "yes" ; then
710 `pkg-config gnutls` || vnc_tls="no"
712 if test "$vnc_tls" = "yes" ; then
713 vnc_tls_cflags=`pkg-config --cflags gnutls`
714 vnc_tls_libs=`pkg-config --libs gnutls`
717 ##########################################
718 # alsa sound support libraries
720 if test "$alsa" = "yes" ; then
721 cat > $TMPC << EOF
722 #include <alsa/asoundlib.h>
723 int main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); }
725 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lasound 2> /dev/null ; then
727 else
728 echo
729 echo "Error: Could not find alsa"
730 echo "Make sure to have the alsa libs and headers installed."
731 echo
732 exit 1
736 ##########################################
737 # BrlAPI probe
739 if test -z "$brlapi" ; then
740 brlapi=no
741 cat > $TMPC << EOF
742 #include <brlapi.h>
743 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
745 if $cc -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi 2> /tmp/qemu-$$-brlapi.log ; then
746 brlapi=yes
747 fi # brlapi compile test
748 fi # -z $brlapi
750 ##########################################
751 # curses probe
753 if test "$curses" = "yes" ; then
754 curses=no
755 cat > $TMPC << EOF
756 #include <curses.h>
757 int main(void) { return curses_version(); }
759 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses 2> /dev/null ; then
760 curses=yes
762 fi # test "$curses"
764 # Check if tools are available to build documentation.
765 if [ -x "`which texi2html 2>/dev/null`" ] && \
766 [ -x "`which pod2man 2>/dev/null`" ]; then
767 build_docs="yes"
770 if test "$mingw32" = "yes" ; then
771 if test -z "$prefix" ; then
772 prefix="/c/Program Files/Qemu"
774 mansuffix=""
775 datasuffix=""
776 docsuffix=""
777 binsuffix=""
778 else
779 if test -z "$prefix" ; then
780 prefix="/usr/local"
782 mansuffix="/share/man"
783 datasuffix="/share/qemu"
784 docsuffix="/share/doc/qemu"
785 binsuffix="/bin"
788 ######################################
789 # libfdt probe
791 if test -z "$device_tree_support" -a \
792 "$cpu" = "powerpc"; then
793 device_tree_support="no"
794 cat > $TMPC << EOF
795 #include <libfdt.h>
796 /* XXX uncomment later when libfdt is built before this test */
797 //int main(void) { void *fdt; return fdt_create(fdt, 1024); }
798 int main (void) {return 0;}
800 # XXX for now do not try to link to libfdt and just check for header */
801 # if $cc $ARCH_CFLAGS $CFLAGS $LDFLAGS -o $TMPE $TMPC -lfdt 2> /dev/null ; then
802 if $cc $ARCH_CFLAGS $CFLAGS $LDFLAGS -o $TMPE $TMPC 2> /dev/null; then
803 device_tree_support="yes"
804 else
805 echo
806 echo "Error: Could not find libfdt"
807 echo "Make sure to have the libfdt libs and headers installed."
808 echo
809 exit 1
813 echo "Install prefix $prefix"
814 echo "BIOS directory $prefix$datasuffix"
815 echo "binary directory $prefix$binsuffix"
816 if test "$mingw32" = "no" ; then
817 echo "Manual directory $prefix$mansuffix"
818 echo "ELF interp prefix $interp_prefix"
820 echo "Source path $source_path"
821 echo "C compiler $cc"
822 echo "Host C compiler $host_cc"
823 echo "ARCH_CFLAGS $ARCH_CFLAGS"
824 echo "make $make"
825 echo "install $install"
826 echo "host CPU $cpu"
827 echo "host big endian $bigendian"
828 echo "target list $target_list"
829 echo "gprof enabled $gprof"
830 echo "profiler $profiler"
831 echo "static build $static"
832 echo "-Werror enabled $werror"
833 if test "$darwin" = "yes" ; then
834 echo "Cocoa support $cocoa"
836 echo "SDL support $sdl"
837 if test "$sdl" != "no" ; then
838 echo "SDL static link $sdl_static"
840 echo "curses support $curses"
841 echo "mingw32 support $mingw32"
842 echo "Adlib support $adlib"
843 echo "AC97 support $ac97"
844 echo "GUS support $gus"
845 echo "CoreAudio support $coreaudio"
846 echo "ALSA support $alsa"
847 echo "EsounD support $esd"
848 echo "DSound support $dsound"
849 if test "$fmod" = "yes"; then
850 if test -z $fmod_lib || test -z $fmod_inc; then
851 echo
852 echo "Error: You must specify path to FMOD library and headers"
853 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
854 echo
855 exit 1
857 fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
858 else
859 fmod_support=""
861 echo "FMOD support $fmod $fmod_support"
862 echo "OSS support $oss"
863 echo "VNC TLS support $vnc_tls"
864 if test "$vnc_tls" = "yes" ; then
865 echo " TLS CFLAGS $vnc_tls_cflags"
866 echo " TLS LIBS $vnc_tls_libs"
868 if test -n "$sparc_cpu"; then
869 echo "Target Sparc Arch $sparc_cpu"
871 echo "kqemu support $kqemu"
872 echo "kvm support $kvm"
873 echo "CPU emulation $cpu_emulation"
874 if test $cpu = "powerpc"; then
875 echo "libfdt support $device_tree_support"
877 echo "brlapi support $brlapi"
878 echo "Documentation $build_docs"
879 [ ! -z "$uname_release" ] && \
880 echo "uname -r $uname_release"
882 if test $sdl_too_old = "yes"; then
883 echo "-> Your SDL version is too old - please upgrade to have SDL support"
885 if [ -s /tmp/qemu-$$-sdl-config.log ]; then
886 echo "The error log from compiling the libSDL test is: "
887 cat /tmp/qemu-$$-sdl-config.log
889 rm -f /tmp/qemu-$$-sdl-config.log
890 #if test "$sdl_static" = "no"; then
891 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
893 config_mak="config-host.mak"
894 config_h="config-host.h"
896 #echo "Creating $config_mak and $config_h"
898 test -f $config_h && mv $config_h ${config_h}~
900 echo "# Automatically generated by configure - do not modify" > $config_mak
901 echo "# Configured with: $0 $@" >> $config_mak
902 echo "/* Automatically generated by configure - do not modify */" > $config_h
904 echo "prefix=$prefix" >> $config_mak
905 echo "bindir=\${prefix}$binsuffix" >> $config_mak
906 echo "mandir=\${prefix}$mansuffix" >> $config_mak
907 echo "datadir=\${prefix}$datasuffix" >> $config_mak
908 echo "docdir=\${prefix}$docsuffix" >> $config_mak
909 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
910 echo "MAKE=$make" >> $config_mak
911 echo "INSTALL=$install" >> $config_mak
912 echo "CC=$cc" >> $config_mak
913 echo "HOST_CC=$host_cc" >> $config_mak
914 echo "AR=$ar" >> $config_mak
915 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
916 # XXX: only use CFLAGS and LDFLAGS ?
917 # XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
918 # compilation of dyngen tool (useful for win32 build on Linux host)
919 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
920 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
921 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
922 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
923 echo "CFLAGS=$CFLAGS" >> $config_mak
924 echo "LDFLAGS=$LDFLAGS" >> $config_mak
925 echo "EXESUF=$EXESUF" >> $config_mak
926 echo "AIOLIBS=$AIOLIBS" >> $config_mak
927 if test "$cpu" = "i386" ; then
928 echo "ARCH=i386" >> $config_mak
929 echo "#define HOST_I386 1" >> $config_h
930 elif test "$cpu" = "x86_64" ; then
931 echo "ARCH=x86_64" >> $config_mak
932 echo "#define HOST_X86_64 1" >> $config_h
933 elif test "$cpu" = "alpha" ; then
934 echo "ARCH=alpha" >> $config_mak
935 echo "#define HOST_ALPHA 1" >> $config_h
936 elif test "$cpu" = "armv4b" ; then
937 echo "ARCH=arm" >> $config_mak
938 echo "#define HOST_ARM 1" >> $config_h
939 elif test "$cpu" = "armv4l" ; then
940 echo "ARCH=arm" >> $config_mak
941 echo "#define HOST_ARM 1" >> $config_h
942 elif test "$cpu" = "cris" ; then
943 echo "ARCH=cris" >> $config_mak
944 echo "#define HOST_CRIS 1" >> $config_h
945 elif test "$cpu" = "hppa" ; then
946 echo "ARCH=hppa" >> $config_mak
947 echo "#define HOST_HPPA 1" >> $config_h
948 elif test "$cpu" = "ia64" ; then
949 echo "ARCH=ia64" >> $config_mak
950 echo "#define HOST_IA64 1" >> $config_h
951 elif test "$cpu" = "m68k" ; then
952 echo "ARCH=m68k" >> $config_mak
953 echo "#define HOST_M68K 1" >> $config_h
954 elif test "$cpu" = "mips" ; then
955 echo "ARCH=mips" >> $config_mak
956 echo "#define HOST_MIPS 1" >> $config_h
957 elif test "$cpu" = "mips64" ; then
958 echo "ARCH=mips64" >> $config_mak
959 echo "#define HOST_MIPS64 1" >> $config_h
960 elif test "$cpu" = "powerpc" ; then
961 echo "ARCH=ppc" >> $config_mak
962 echo "#define HOST_PPC 1" >> $config_h
963 elif test "$cpu" = "s390" ; then
964 echo "ARCH=s390" >> $config_mak
965 echo "#define HOST_S390 1" >> $config_h
966 elif test "$cpu" = "sparc" ; then
967 echo "ARCH=sparc" >> $config_mak
968 echo "#define HOST_SPARC 1" >> $config_h
969 elif test "$cpu" = "sparc64" ; then
970 echo "ARCH=sparc64" >> $config_mak
971 echo "#define HOST_SPARC64 1" >> $config_h
972 else
973 echo "Unsupported CPU = $cpu"
974 exit 1
976 if test "$bigendian" = "yes" ; then
977 echo "WORDS_BIGENDIAN=yes" >> $config_mak
978 echo "#define WORDS_BIGENDIAN 1" >> $config_h
980 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
981 if test "$mingw32" = "yes" ; then
982 echo "CONFIG_WIN32=yes" >> $config_mak
983 echo "#define CONFIG_WIN32 1" >> $config_h
984 else
985 cat > $TMPC << EOF
986 #include <byteswap.h>
987 int main(void) { return bswap_32(0); }
989 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
990 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
993 if test "$darwin" = "yes" ; then
994 echo "CONFIG_DARWIN=yes" >> $config_mak
995 echo "#define CONFIG_DARWIN 1" >> $config_h
997 if test "$solaris" = "yes" ; then
998 echo "CONFIG_SOLARIS=yes" >> $config_mak
999 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
1000 if test "$needs_libsunmath" = "yes" ; then
1001 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1002 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1005 if test -n "$sparc_cpu"; then
1006 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1007 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1009 if test "$gdbstub" = "yes" ; then
1010 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1011 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1013 if test "$gprof" = "yes" ; then
1014 echo "TARGET_GPROF=yes" >> $config_mak
1015 echo "#define HAVE_GPROF 1" >> $config_h
1017 if test "$static" = "yes" ; then
1018 echo "CONFIG_STATIC=yes" >> $config_mak
1019 echo "#define CONFIG_STATIC 1" >> $config_h
1021 if test $profiler = "yes" ; then
1022 echo "#define CONFIG_PROFILER 1" >> $config_h
1024 if test "$slirp" = "yes" ; then
1025 echo "CONFIG_SLIRP=yes" >> $config_mak
1026 echo "#define CONFIG_SLIRP 1" >> $config_h
1028 if test "$adlib" = "yes" ; then
1029 echo "CONFIG_ADLIB=yes" >> $config_mak
1030 echo "#define CONFIG_ADLIB 1" >> $config_h
1032 if test "$ac97" = "yes" ; then
1033 echo "CONFIG_AC97=yes" >> $config_mak
1034 echo "#define CONFIG_AC97 1" >> $config_h
1036 if test "$gus" = "yes" ; then
1037 echo "CONFIG_GUS=yes" >> $config_mak
1038 echo "#define CONFIG_GUS 1" >> $config_h
1040 if test "$oss" = "yes" ; then
1041 echo "CONFIG_OSS=yes" >> $config_mak
1042 echo "#define CONFIG_OSS 1" >> $config_h
1044 if test "$coreaudio" = "yes" ; then
1045 echo "CONFIG_COREAUDIO=yes" >> $config_mak
1046 echo "#define CONFIG_COREAUDIO 1" >> $config_h
1048 if test "$alsa" = "yes" ; then
1049 echo "CONFIG_ALSA=yes" >> $config_mak
1050 echo "#define CONFIG_ALSA 1" >> $config_h
1052 if test "$esd" = "yes" ; then
1053 echo "CONFIG_ESD=yes" >> $config_mak
1054 echo "#define CONFIG_ESD 1" >> $config_h
1056 if test "$dsound" = "yes" ; then
1057 echo "CONFIG_DSOUND=yes" >> $config_mak
1058 echo "#define CONFIG_DSOUND 1" >> $config_h
1060 if test "$fmod" = "yes" ; then
1061 echo "CONFIG_FMOD=yes" >> $config_mak
1062 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1063 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1064 echo "#define CONFIG_FMOD 1" >> $config_h
1066 if test "$vnc_tls" = "yes" ; then
1067 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1068 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1069 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1070 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1072 qemu_version=`head $source_path/VERSION`
1073 echo "VERSION=$qemu_version" >>$config_mak
1074 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1075 echo "#define KVM_VERSION \"kvm-devel\"" >> $config_h
1077 echo "SRC_PATH=$source_path" >> $config_mak
1078 if [ "$source_path_used" = "yes" ]; then
1079 echo "VPATH=$source_path" >> $config_mak
1081 echo "TARGET_DIRS=$target_list" >> $config_mak
1082 if [ "$build_docs" = "yes" ] ; then
1083 echo "BUILD_DOCS=yes" >> $config_mak
1085 if test "$static" = "yes"; then
1086 sdl1=$sdl_static
1087 else
1088 sdl1=$sdl
1090 if test "$sdl1" = "yes" ; then
1091 echo "#define CONFIG_SDL 1" >> $config_h
1092 echo "CONFIG_SDL=yes" >> $config_mak
1093 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1094 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1095 else
1096 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1098 if [ "${aa}" = "yes" ] ; then
1099 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1100 else
1101 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1104 if test "$cocoa" = "yes" ; then
1105 echo "#define CONFIG_COCOA 1" >> $config_h
1106 echo "CONFIG_COCOA=yes" >> $config_mak
1108 if test "$curses" = "yes" ; then
1109 echo "#define CONFIG_CURSES 1" >> $config_h
1110 echo "CONFIG_CURSES=yes" >> $config_mak
1111 echo "CURSES_LIBS=-lcurses" >> $config_mak
1113 if test "$brlapi" = "yes" ; then
1114 echo "CONFIG_BRLAPI=yes" >> $config_mak
1115 echo "#define CONFIG_BRLAPI 1" >> $config_h
1116 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1119 # XXX: suppress that
1120 if [ "$bsd" = "yes" ] ; then
1121 echo "#define O_LARGEFILE 0" >> $config_h
1122 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1123 echo "#define _BSD 1" >> $config_h
1126 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1128 tools=
1129 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1130 tools="qemu-img\$(EXESUF) $tools"
1132 echo "TOOLS=$tools" >> $config_mak
1134 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1136 for target in $target_list; do
1137 target_dir="$target"
1138 config_mak=$target_dir/config.mak
1139 config_h=$target_dir/config.h
1140 target_cpu=`echo $target | cut -d '-' -f 1`
1141 target_bigendian="no"
1142 [ "$target_cpu" = "armeb" ] && target_bigendian=yes
1143 [ "$target_cpu" = "m68k" ] && target_bigendian=yes
1144 [ "$target_cpu" = "mips" ] && target_bigendian=yes
1145 [ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1146 [ "$target_cpu" = "mips64" ] && target_bigendian=yes
1147 [ "$target_cpu" = "ppc" ] && target_bigendian=yes
1148 [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
1149 [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
1150 [ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
1151 [ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
1152 [ "$target_cpu" = "sparc" ] && target_bigendian=yes
1153 [ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1154 [ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
1155 target_softmmu="no"
1156 target_user_only="no"
1157 target_linux_user="no"
1158 target_darwin_user="no"
1159 case "$target" in
1160 ${target_cpu}-softmmu)
1161 target_softmmu="yes"
1163 ${target_cpu}-linux-user)
1164 target_user_only="yes"
1165 target_linux_user="yes"
1167 ${target_cpu}-darwin-user)
1168 target_user_only="yes"
1169 target_darwin_user="yes"
1172 echo "ERROR: Target '$target' not recognised"
1173 exit 1
1175 esac
1177 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1178 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1179 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1180 echo "To build QEMU without graphical output configure with --disable-gfx-check"
1181 echo "Note that this will disable all output from the virtual graphics card"
1182 echo "except through VNC or curses."
1183 exit 1;
1186 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1188 test -f $config_h && mv $config_h ${config_h}~
1190 mkdir -p $target_dir
1191 mkdir -p $target_dir/fpu
1192 mkdir -p $target_dir/tcg
1193 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then
1194 mkdir -p $target_dir/nwfpe
1198 # don't use ln -sf as not all "ln -sf" over write the file/link
1200 rm -f $target_dir/Makefile
1201 ln -s $source_path/Makefile.target $target_dir/Makefile
1204 echo "# Automatically generated by configure - do not modify" > $config_mak
1205 echo "/* Automatically generated by configure - do not modify */" > $config_h
1208 echo "include ../config-host.mak" >> $config_mak
1209 echo "#include \"../config-host.h\"" >> $config_h
1211 bflt="no"
1212 elfload32="no"
1213 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1214 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1216 disable_cpu_emulation() {
1217 if test $cpu_emulation = "no"; then
1218 echo "#define NO_CPU_EMULATION 1" >> $config_h
1219 echo "NO_CPU_EMULATION=1" >> $config_mak
1223 configure_kvm() {
1224 if test $kvm = "yes" -a "$target_softmmu" = "yes" -a \
1225 \( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \); then
1226 echo "#define USE_KVM 1" >> $config_h
1227 echo "USE_KVM=1" >> $config_mak
1228 echo "CONFIG_KVM_KERNEL_INC=$kernel_path/include" >> $config_mak
1229 if test $kvm_cap_pit = "yes" ; then
1230 echo "USE_KVM_PIT=1" >> $config_mak
1231 echo "#define USE_KVM_PIT 1" >> $config_h
1233 disable_cpu_emulation
1237 if test "$target_cpu" = "i386" ; then
1238 echo "TARGET_ARCH=i386" >> $config_mak
1239 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1240 echo "#define TARGET_I386 1" >> $config_h
1241 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
1242 echo "#define USE_KQEMU 1" >> $config_h
1244 configure_kvm
1245 elif test "$target_cpu" = "ia64" ; then
1246 echo "TARGET_ARCH=ia64" >> $config_mak
1247 echo "#define TARGET_ARCH \"ia64\"" >> $config_h
1248 echo "#define TARGET_IA64 1" >> $config_h
1249 configure_kvm
1250 elif test "$target_cpu" = "x86_64" ; then
1251 echo "TARGET_ARCH=x86_64" >> $config_mak
1252 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1253 echo "#define TARGET_I386 1" >> $config_h
1254 echo "#define TARGET_X86_64 1" >> $config_h
1255 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then
1256 echo "#define USE_KQEMU 1" >> $config_h
1258 configure_kvm
1259 elif test "$target_cpu" = "alpha" ; then
1260 echo "TARGET_ARCH=alpha" >> $config_mak
1261 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1262 echo "#define TARGET_ALPHA 1" >> $config_h
1263 elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
1264 echo "TARGET_ARCH=arm" >> $config_mak
1265 echo "CONFIG_NO_DYNGEN_OP=yes" >> $config_mak
1266 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1267 echo "#define TARGET_ARM 1" >> $config_h
1268 echo "#define CONFIG_NO_DYNGEN_OP 1" >> $config_h
1269 bflt="yes"
1270 elif test "$target_cpu" = "cris" ; then
1271 echo "TARGET_ARCH=cris" >> $config_mak
1272 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1273 echo "#define TARGET_CRIS 1" >> $config_h
1274 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1275 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1276 elif test "$target_cpu" = "m68k" ; then
1277 echo "TARGET_ARCH=m68k" >> $config_mak
1278 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1279 echo "#define TARGET_M68K 1" >> $config_h
1280 bflt="yes"
1281 elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
1282 echo "TARGET_ARCH=mips" >> $config_mak
1283 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1284 echo "#define TARGET_MIPS 1" >> $config_h
1285 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1286 elif test "$target_cpu" = "mipsn32" -o "$target_cpu" = "mipsn32el" ; then
1287 echo "TARGET_ARCH=mipsn32" >> $config_mak
1288 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1289 echo "#define TARGET_MIPS 1" >> $config_h
1290 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1291 elif test "$target_cpu" = "mips64" -o "$target_cpu" = "mips64el" ; then
1292 echo "TARGET_ARCH=mips64" >> $config_mak
1293 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1294 echo "#define TARGET_MIPS 1" >> $config_h
1295 echo "#define TARGET_MIPS64 1" >> $config_h
1296 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1297 elif test "$target_cpu" = "ppc" ; then
1298 echo "TARGET_ARCH=ppc" >> $config_mak
1299 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1300 echo "#define TARGET_PPC 1" >> $config_h
1301 elif test "$target_cpu" = "ppcemb" ; then
1302 echo "TARGET_ARCH=ppcemb" >> $config_mak
1303 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1304 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1305 echo "#define TARGET_PPC 1" >> $config_h
1306 echo "#define TARGET_PPCEMB 1" >> $config_h
1307 if test "$device_tree_support" = "yes" ; then
1308 echo "#define CONFIG_LIBFDT 1" >> $config_h
1309 echo "CONFIG_LIBFDT=1" >> $config_mak
1311 configure_kvm
1312 elif test "$target_cpu" = "ppc64" ; then
1313 echo "TARGET_ARCH=ppc64" >> $config_mak
1314 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1315 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1316 echo "#define TARGET_PPC 1" >> $config_h
1317 echo "#define TARGET_PPC64 1" >> $config_h
1318 elif test "$target_cpu" = "ppc64abi32" ; then
1319 echo "TARGET_ARCH=ppc64" >> $config_mak
1320 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1321 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1322 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1323 echo "#define TARGET_PPC 1" >> $config_h
1324 echo "#define TARGET_PPC64 1" >> $config_h
1325 echo "#define TARGET_ABI32 1" >> $config_h
1326 elif test "$target_cpu" = "sh4" -o "$target_cpu" = "sh4eb" ; then
1327 echo "TARGET_ARCH=sh4" >> $config_mak
1328 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1329 echo "#define TARGET_SH4 1" >> $config_h
1330 bflt="yes"
1331 elif test "$target_cpu" = "sparc" ; then
1332 echo "TARGET_ARCH=sparc" >> $config_mak
1333 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1334 echo "#define TARGET_SPARC 1" >> $config_h
1335 elif test "$target_cpu" = "sparc64" ; then
1336 echo "TARGET_ARCH=sparc64" >> $config_mak
1337 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1338 echo "#define TARGET_SPARC 1" >> $config_h
1339 echo "#define TARGET_SPARC64 1" >> $config_h
1340 elfload32="yes"
1341 elif test "$target_cpu" = "sparc32plus" ; then
1342 echo "TARGET_ARCH=sparc64" >> $config_mak
1343 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1344 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1345 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1346 echo "#define TARGET_SPARC 1" >> $config_h
1347 echo "#define TARGET_SPARC64 1" >> $config_h
1348 echo "#define TARGET_ABI32 1" >> $config_h
1349 else
1350 echo "Unsupported target CPU"
1351 exit 1
1353 if test "$target_bigendian" = "yes" ; then
1354 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1355 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1357 if test "$target_softmmu" = "yes" ; then
1358 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1359 echo "#define CONFIG_SOFTMMU 1" >> $config_h
1361 if test "$target_user_only" = "yes" ; then
1362 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1363 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1365 if test "$target_linux_user" = "yes" ; then
1366 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1367 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1369 if test "$target_darwin_user" = "yes" ; then
1370 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1371 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1374 if test "$target_cpu" = "arm" \
1375 -o "$target_cpu" = "armeb" \
1376 -o "$target_cpu" = "m68k" \
1377 -o "$target_cpu" = "mips" \
1378 -o "$target_cpu" = "mipsel" \
1379 -o "$target_cpu" = "mipsn32" \
1380 -o "$target_cpu" = "mipsn32el" \
1381 -o "$target_cpu" = "mips64" \
1382 -o "$target_cpu" = "mips64el" \
1383 -o "$target_cpu" = "sparc" \
1384 -o "$target_cpu" = "sparc64" \
1385 -o "$target_cpu" = "sparc32plus"; then
1386 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1387 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1389 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1390 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1391 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1393 # 32 bit ELF loader in addition to native 64 bit loader?
1394 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1395 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1396 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1399 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1401 done # for target in $targets
1403 # build tree in object directory if source path is different from current one
1404 if test "$source_path_used" = "yes" ; then
1405 DIRS="tests tests/cris slirp audio"
1406 FILES="Makefile tests/Makefile"
1407 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
1408 FILES="$FILES tests/test-mmap.c"
1409 for dir in $DIRS ; do
1410 mkdir -p $dir
1411 done
1412 # remove the link and recreate it, as not all "ln -sf" overwrite the link
1413 for f in $FILES ; do
1414 rm -f $f
1415 ln -s $source_path/$f $f
1416 done
1419 rm -f $TMPO $TMPC $TMPE $TMPS