kvm: external module: include <linux/time.h>
[qemu-kvm/fedora.git] / configure
blobaddd6e8cdc4dcde885592d28ccdf70ccf877e690
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 nptl="yes"
119 cpu_emulation="yes"
120 device_tree_support=""
122 # OS specific
123 targetos=`uname -s`
124 case $targetos in
125 CYGWIN*)
126 mingw32="yes"
127 OS_CFLAGS="-mno-cygwin"
128 if [ "$cpu" = "i386" ] ; then
129 kqemu="yes"
132 MINGW32*)
133 mingw32="yes"
134 if [ "$cpu" = "i386" ] ; then
135 kqemu="yes"
138 GNU/kFreeBSD)
139 oss="yes"
140 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
141 kqemu="yes"
144 FreeBSD)
145 bsd="yes"
146 oss="yes"
147 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
148 kqemu="yes"
149 kvm="yes"
152 NetBSD)
153 bsd="yes"
154 oss="yes"
156 OpenBSD)
157 bsd="yes"
158 oss="yes"
160 Darwin)
161 bsd="yes"
162 darwin="yes"
163 darwin_user="yes"
164 cocoa="yes"
165 coreaudio="yes"
166 OS_CFLAGS="-mdynamic-no-pic"
167 OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
169 SunOS)
170 solaris="yes"
171 make="gmake"
172 install="ginstall"
173 needs_libsunmath="no"
174 solarisrev=`uname -r | cut -f2 -d.`
175 # have to select again, because `uname -m` returns i86pc
176 # even on an x86_64 box.
177 solariscpu=`isainfo -k`
178 if test "${solariscpu}" = "amd64" ; then
179 cpu="x86_64"
181 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
182 if test "$solarisrev" -le 9 ; then
183 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
184 needs_libsunmath="yes"
185 else
186 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
187 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
188 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
189 echo "Studio 11 can be downloaded from www.sun.com."
190 exit 1
193 if test "$solarisrev" -ge 9 ; then
194 kqemu="yes"
197 if test -f /usr/include/sys/soundcard.h ; then
198 oss=yes
202 oss="yes"
203 linux="yes"
204 linux_user="yes"
205 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
206 kqemu="yes"
207 kvm="yes"
209 if [ "$cpu" = "ia64" ] ; then
210 kvm="yes"
211 gdbstub="no"
212 slirp="no"
214 if [ "$cpu" = "powerpc" ]; then
215 kvm="yes"
218 esac
220 if [ "$bsd" = "yes" ] ; then
221 if [ "$darwin" != "yes" ] ; then
222 make="gmake"
226 # find source path
227 source_path=`dirname "$0"`
228 source_path_used="no"
229 workdir=`pwd`
230 if [ -z "$source_path" ]; then
231 source_path=$workdir
232 else
233 source_path=`cd "$source_path"; pwd`
235 [ -f "$workdir/vl.c" ] || source_path_used="yes"
237 werror="no"
238 # generate compile errors on warnings for development builds
239 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
240 #werror="yes";
243 for opt do
244 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
245 case "$opt" in
246 --help|-h) show_help=yes
248 --prefix=*) prefix="$optarg"
250 --interp-prefix=*) interp_prefix="$optarg"
252 --source-path=*) source_path="$optarg"
253 source_path_used="yes"
255 --cross-prefix=*) cross_prefix="$optarg"
257 --cc=*) cc="$optarg"
258 gcc3_search="no"
260 --host-cc=*) host_cc="$optarg"
262 --make=*) make="$optarg"
264 --install=*) install="$optarg"
266 --extra-cflags=*) CFLAGS="$optarg"
268 --extra-ldflags=*) LDFLAGS="$optarg"
270 --cpu=*) cpu="$optarg"
272 --target-list=*) target_list="$optarg"
274 --enable-gprof) gprof="yes"
276 --static) static="yes"
278 --disable-sdl) sdl="no"
280 --enable-coreaudio) coreaudio="yes"
282 --enable-alsa) alsa="yes"
284 --enable-esd) esd="yes"
286 --enable-dsound) dsound="yes"
288 --enable-fmod) fmod="yes"
290 --fmod-lib=*) fmod_lib="$optarg"
292 --fmod-inc=*) fmod_inc="$optarg"
294 --disable-vnc-tls) vnc_tls="no"
296 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; linux_user="no"
298 --disable-slirp) slirp="no"
300 --enable-adlib) adlib="yes"
302 --enable-ac97) ac97="yes"
304 --enable-gus) gus="yes"
306 --disable-kqemu) kqemu="no"
308 --disable-kvm) kvm="no"
310 --disable-brlapi) brlapi="no"
312 --enable-profiler) profiler="yes"
314 --kernel-path=*) kernel_path="$optarg"
316 --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
318 --disable-gfx-check) check_gfx="no"
320 --disable-gcc-check) check_gcc="no"
322 --disable-system) softmmu="no"
324 --enable-system) softmmu="yes"
326 --disable-linux-user) linux_user="no"
328 --enable-linux-user) linux_user="yes"
330 --disable-darwin-user) darwin_user="no"
332 --enable-darwin-user) darwin_user="yes"
334 --enable-uname-release=*) uname_release="$optarg"
336 --sparc_cpu=*)
337 sparc_cpu="$optarg"
338 case $sparc_cpu in
339 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
340 target_cpu="sparc"; cpu="sparc" ;;
341 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
342 target_cpu="sparc"; cpu="sparc" ;;
343 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
344 target_cpu="sparc64"; cpu="sparc64" ;;
345 *) echo "undefined SPARC architecture. Exiting";exit 1;;
346 esac
348 --enable-werror) werror="yes"
350 --disable-werror) werror="no"
352 --disable-curses) curses="no"
354 --disable-nptl) nptl="no"
356 --disable-cpu-emulation) cpu_emulation="no"
358 --disable-libfdt) device_tree_support="no"
360 *) echo "ERROR: unknown option $opt"; exit 1
362 esac
363 done
365 if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
366 AIOLIBS=
367 else
368 # Some Linux architectures (e.g. s390) don't imply -lpthread automatically.
369 AIOLIBS="-lrt -lpthread"
372 # default flags for all hosts
373 CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
374 LDFLAGS="$LDFLAGS -g"
375 if test "$werror" = "yes" ; then
376 CFLAGS="$CFLAGS -Werror"
380 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
381 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
383 case "$cpu" in
384 sparc) if test -z "$sparc_cpu" ; then
385 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
386 ARCH_LDFLAGS="-m32"
387 else
388 ARCH_CFLAGS="${SP_CFLAGS}"
389 ARCH_LDFLAGS="${SP_LDFLAGS}"
392 sparc64) if test -z "$sparc_cpu" ; then
393 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
394 ARCH_LDFLAGS="-m64"
395 else
396 ARCH_CFLAGS="${SP_CFLAGS}"
397 ARCH_LDFLAGS="${SP_LDFLAGS}"
400 s390)
401 ARCH_CFLAGS="-march=z900"
403 i386)
404 ARCH_CFLAGS="-m32"
405 ARCH_LDFLAGS="-m32"
407 x86_64)
408 ARCH_CFLAGS="-m64"
409 ARCH_LDFLAGS="-m64"
411 esac
413 if test x"$show_help" = x"yes" ; then
414 cat << EOF
416 Usage: configure [options]
417 Options: [defaults in brackets after descriptions]
420 echo "Standard options:"
421 echo " --help print this message"
422 echo " --prefix=PREFIX install in PREFIX [$prefix]"
423 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
424 echo " use %M for cpu name [$interp_prefix]"
425 echo " --target-list=LIST set target list [$target_list]"
426 echo ""
427 echo "kqemu kernel acceleration support:"
428 echo " --disable-kqemu disable kqemu support"
429 echo " --kernel-path=PATH set the kernel path (configure probes it)"
430 echo " --disable-kvm disable kernel virtual machine support"
431 echo ""
432 echo "Advanced options (experts only):"
433 echo " --source-path=PATH path of source code [$source_path]"
434 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
435 echo " --cc=CC use C compiler CC [$cc]"
436 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
437 echo " --make=MAKE use specified make [$make]"
438 echo " --install=INSTALL use specified install [$install]"
439 echo " --static enable static build [$static]"
440 echo " --disable-werror disable compilation abort on warning"
441 echo " --disable-sdl disable SDL"
442 echo " --enable-cocoa enable COCOA (Mac OS X only)"
443 echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
444 echo " --enable-adlib enable Adlib emulation"
445 echo " --enable-ac97 enable AC97 emulation"
446 echo " --enable-gus enable Gravis Ultrasound emulation"
447 echo " --enable-coreaudio enable Coreaudio audio driver"
448 echo " --enable-alsa enable ALSA audio driver"
449 echo " --enable-esd enable EsoundD audio driver"
450 echo " --enable-fmod enable FMOD audio driver"
451 echo " --enable-dsound enable DirectSound audio driver"
452 echo " --disable-brlapi disable BrlAPI"
453 echo " --disable-vnc-tls disable TLS encryption for VNC server"
454 echo " --disable-curses disable curses output"
455 echo " --disable-nptl disable usermode NPTL support"
456 echo " --enable-system enable all system emulation targets"
457 echo " --disable-system disable all system emulation targets"
458 echo " --enable-linux-user enable all linux usermode emulation targets"
459 echo " --disable-linux-user disable all linux usermode emulation targets"
460 echo " --enable-darwin-user enable all darwin usermode emulation targets"
461 echo " --disable-darwin-user disable all darwin usermode emulation targets"
462 echo " --fmod-lib path to FMOD library"
463 echo " --fmod-inc path to FMOD includes"
464 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
465 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
466 echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
467 echo " --disable-libfdt disables use of libfdt support for device tree"
468 echo ""
469 echo "NOTE: The object files are built at the place where configure is launched"
470 exit 1
473 cc="${cross_prefix}${cc}"
474 ar="${cross_prefix}${ar}"
475 strip="${cross_prefix}${strip}"
477 # check that the C compiler works.
478 cat > $TMPC <<EOF
479 int main(void) {}
482 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then
483 : C compiler works ok
484 else
485 echo "ERROR: \"$cc\" either does not exist or does not work"
486 exit 1
489 if test "$mingw32" = "yes" ; then
490 linux="no"
491 EXESUF=".exe"
492 oss="no"
495 # Check for gcc4, error if pre-gcc4
496 if test "$check_gcc" = "yes" ; then
497 cat > $TMPC <<EOF
498 #if __GNUC__ < 4
499 #error gcc3
500 #endif
501 int main(){return 0;}
503 if "$cc" $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
504 echo "WARNING: \"$cc\" looks like gcc 4.x"
505 found_compat_cc="no"
506 if test "$gcc3_search" = "yes" ; then
507 echo "Looking for gcc 3.x"
508 for compat_cc in $gcc3_list ; do
509 if "$cross_prefix$compat_cc" --version 2> /dev/null | fgrep '(GCC) 3.' > /dev/null 2>&1 ; then
510 echo "Found \"$compat_cc\""
511 cc="$cross_prefix$compat_cc"
512 found_compat_cc="yes"
513 break
515 done
516 if test "$found_compat_cc" = "no" ; then
517 echo "gcc 3.x not found!"
520 if test "$found_compat_cc" = "no" ; then
521 echo "QEMU is known to have problems when compiled with gcc 4.x"
522 echo "It is recommended that you use gcc 3.x to build QEMU"
523 echo "To use this compiler anyway, configure with --disable-gcc-check"
524 exit 1;
530 # Solaris specific configure tool chain decisions
532 if test "$solaris" = "yes" ; then
534 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
535 # override the check with --disable-gcc-check
537 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
538 solgcc=`which $cc`
539 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
540 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
541 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
542 echo "or get the latest patch from SunSolve for gcc"
543 exit 1
546 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
547 if test -z "$solinst" ; then
548 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
549 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
550 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
551 exit 1
553 if test "$solinst" = "/usr/sbin/install" ; then
554 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
555 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
556 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
557 exit 1
559 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
560 if test -z "$sol_ar" ; then
561 echo "Error: No path includes ar"
562 if test -f /usr/ccs/bin/ar ; then
563 echo "Add /usr/ccs/bin to your path and rerun configure"
565 exit 1
570 if test -z "$target_list" ; then
571 # these targets are portable
572 if [ "$softmmu" = "yes" ] ; then
573 target_list="\
574 i386-softmmu \
575 x86_64-softmmu \
576 arm-softmmu \
577 cris-softmmu \
578 m68k-softmmu \
579 mips-softmmu \
580 mipsel-softmmu \
581 mips64-softmmu \
582 mips64el-softmmu \
583 ppc-softmmu \
584 ppcemb-softmmu \
585 ppc64-softmmu \
586 sh4-softmmu \
587 sh4eb-softmmu \
588 sparc-softmmu \
591 # the following are Linux specific
592 if [ "$linux_user" = "yes" ] ; then
593 target_list="${target_list}\
594 i386-linux-user \
595 x86_64-linux-user \
596 alpha-linux-user \
597 arm-linux-user \
598 armeb-linux-user \
599 cris-linux-user \
600 m68k-linux-user \
601 mips-linux-user \
602 mipsel-linux-user \
603 ppc-linux-user \
604 ppc64-linux-user \
605 ppc64abi32-linux-user \
606 sh4-linux-user \
607 sh4eb-linux-user \
608 sparc-linux-user \
609 sparc64-linux-user \
610 sparc32plus-linux-user \
613 # the following are Darwin specific
614 if [ "$darwin_user" = "yes" ] ; then
615 target_list="$target_list i386-darwin-user ppc-darwin-user"
617 else
618 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
620 if test -z "$target_list" ; then
621 echo "No targets enabled"
622 exit 1
625 if test -z "$cross_prefix" ; then
627 # ---
628 # big/little endian test
629 cat > $TMPC << EOF
630 #include <inttypes.h>
631 int main(int argc, char ** argv){
632 volatile uint32_t i=0x01234567;
633 return (*((uint8_t*)(&i))) == 0x67;
637 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
638 $TMPE && bigendian="yes"
639 else
640 echo big/little test failed
643 else
645 # if cross compiling, cannot launch a program, so make a static guess
646 if test "$cpu" = "armv4b" \
647 -o "$cpu" = "hppa" \
648 -o "$cpu" = "m68k" \
649 -o "$cpu" = "mips" \
650 -o "$cpu" = "mips64" \
651 -o "$cpu" = "powerpc" \
652 -o "$cpu" = "s390" \
653 -o "$cpu" = "sparc" \
654 -o "$cpu" = "sparc64"; then
655 bigendian="yes"
660 # host long bits test
661 hostlongbits="32"
662 if test "$cpu" = "x86_64" \
663 -o "$cpu" = "alpha" \
664 -o "$cpu" = "ia64" \
665 -o "$cpu" = "sparc64"; then
666 hostlongbits="64"
669 # check gcc options support
670 cat > $TMPC <<EOF
671 int main(void) {
675 # Check host NPTL support
676 cat > $TMPC <<EOF
677 #include <sched.h>
678 #include <linux/futex.h>
679 void foo()
681 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
682 #error bork
683 #endif
687 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then
689 else
690 nptl="no"
693 ##########################################
694 # KVM probe
696 if test "$kvm" = "yes" ; then
697 cat > $TMPC <<EOF
698 #include <libkvm.h>
699 #ifndef KVM_CAP_PIT
700 #error "kvm no pit capability"
701 #endif
702 int main(void) { return 0; }
704 if $cc $ARCH_CFLAGS $CFLAGS -I"$kernel_path"/include -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev/null ; then
705 kvm_cap_pit="yes"
709 ##########################################
710 # SDL probe
712 sdl_too_old=no
714 if test -z "$sdl" ; then
715 sdl_config="sdl-config"
716 sdl=no
717 sdl_static=no
719 if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
720 # win32 cross compilation case
721 sdl_config="i386-mingw32msvc-sdl-config"
722 sdl=yes
723 else
724 # normal SDL probe
725 cat > $TMPC << EOF
726 #include <SDL.h>
727 #undef main /* We don't want SDL to override our main() */
728 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
730 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
731 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
732 if test "$_sdlversion" -lt 121 ; then
733 sdl_too_old=yes
734 else
735 if test "$cocoa" = "no" ; then
736 sdl=yes
740 # static link with sdl ?
741 if test "$sdl" = "yes" ; then
742 aa="no"
743 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
744 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
745 if [ "$aa" = "yes" ] ; then
746 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
749 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
750 sdl_static=yes
752 fi # static link
753 fi # sdl compile test
754 fi # cross compilation
755 else
756 # Make sure to disable cocoa if sdl was set
757 if test "$sdl" = "yes" ; then
758 cocoa="no"
759 coreaudio="no"
761 fi # -z $sdl
763 ##########################################
764 # VNC TLS detection
765 if test "$vnc_tls" = "yes" ; then
766 `pkg-config gnutls` || vnc_tls="no"
768 if test "$vnc_tls" = "yes" ; then
769 vnc_tls_cflags=`pkg-config --cflags gnutls`
770 vnc_tls_libs=`pkg-config --libs gnutls`
773 ##########################################
774 # alsa sound support libraries
776 if test "$alsa" = "yes" ; then
777 cat > $TMPC << EOF
778 #include <alsa/asoundlib.h>
779 int main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); }
781 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lasound 2> /dev/null ; then
783 else
784 echo
785 echo "Error: Could not find alsa"
786 echo "Make sure to have the alsa libs and headers installed."
787 echo
788 exit 1
792 ##########################################
793 # BrlAPI probe
795 if test -z "$brlapi" ; then
796 brlapi=no
797 cat > $TMPC << EOF
798 #include <brlapi.h>
799 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
801 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi 2> /dev/null ; then
802 brlapi=yes
803 fi # brlapi compile test
804 fi # -z $brlapi
806 ##########################################
807 # curses probe
809 if test "$curses" = "yes" ; then
810 curses=no
811 cat > $TMPC << EOF
812 #include <curses.h>
813 int main(void) { return curses_version(); }
815 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses 2> /dev/null ; then
816 curses=yes
818 fi # test "$curses"
820 # Check if tools are available to build documentation.
821 if [ -x "`which texi2html 2>/dev/null`" ] && \
822 [ -x "`which pod2man 2>/dev/null`" ]; then
823 build_docs="yes"
826 if test "$mingw32" = "yes" ; then
827 if test -z "$prefix" ; then
828 prefix="/c/Program Files/Qemu"
830 mansuffix=""
831 datasuffix=""
832 docsuffix=""
833 binsuffix=""
834 else
835 if test -z "$prefix" ; then
836 prefix="/usr/local"
838 mansuffix="/share/man"
839 datasuffix="/share/qemu"
840 docsuffix="/share/doc/qemu"
841 binsuffix="/bin"
844 ######################################
845 # libfdt probe
847 if test -z "$device_tree_support" -a \
848 "$cpu" = "powerpc"; then
849 device_tree_support="no"
850 cat > $TMPC << EOF
851 #include <libfdt.h>
852 /* XXX uncomment later when libfdt is built before this test */
853 //int main(void) { void *fdt; return fdt_create(fdt, 1024); }
854 int main (void) {return 0;}
856 # XXX for now do not try to link to libfdt and just check for header */
857 # if $cc $ARCH_CFLAGS $CFLAGS $LDFLAGS -o $TMPE $TMPC -lfdt 2> /dev/null ; then
858 if $cc $ARCH_CFLAGS $CFLAGS $LDFLAGS -o $TMPE $TMPC 2> /dev/null; then
859 device_tree_support="yes"
860 else
861 echo
862 echo "Error: Could not find libfdt"
863 echo "Make sure to have the libfdt libs and headers installed."
864 echo
865 exit 1
869 echo "Install prefix $prefix"
870 echo "BIOS directory $prefix$datasuffix"
871 echo "binary directory $prefix$binsuffix"
872 if test "$mingw32" = "no" ; then
873 echo "Manual directory $prefix$mansuffix"
874 echo "ELF interp prefix $interp_prefix"
876 echo "Source path $source_path"
877 echo "C compiler $cc"
878 echo "Host C compiler $host_cc"
879 echo "ARCH_CFLAGS $ARCH_CFLAGS"
880 echo "make $make"
881 echo "install $install"
882 echo "host CPU $cpu"
883 echo "host big endian $bigendian"
884 echo "target list $target_list"
885 echo "gprof enabled $gprof"
886 echo "profiler $profiler"
887 echo "static build $static"
888 echo "-Werror enabled $werror"
889 if test "$darwin" = "yes" ; then
890 echo "Cocoa support $cocoa"
892 echo "SDL support $sdl"
893 if test "$sdl" != "no" ; then
894 echo "SDL static link $sdl_static"
896 echo "curses support $curses"
897 echo "mingw32 support $mingw32"
898 echo "Adlib support $adlib"
899 echo "AC97 support $ac97"
900 echo "GUS support $gus"
901 echo "CoreAudio support $coreaudio"
902 echo "ALSA support $alsa"
903 echo "EsounD support $esd"
904 echo "DSound support $dsound"
905 if test "$fmod" = "yes"; then
906 if test -z $fmod_lib || test -z $fmod_inc; then
907 echo
908 echo "Error: You must specify path to FMOD library and headers"
909 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
910 echo
911 exit 1
913 fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
914 else
915 fmod_support=""
917 echo "FMOD support $fmod $fmod_support"
918 echo "OSS support $oss"
919 echo "VNC TLS support $vnc_tls"
920 if test "$vnc_tls" = "yes" ; then
921 echo " TLS CFLAGS $vnc_tls_cflags"
922 echo " TLS LIBS $vnc_tls_libs"
924 if test -n "$sparc_cpu"; then
925 echo "Target Sparc Arch $sparc_cpu"
927 echo "kqemu support $kqemu"
928 echo "kvm support $kvm"
929 echo "CPU emulation $cpu_emulation"
930 if test $cpu = "powerpc"; then
931 echo "libfdt support $device_tree_support"
933 echo "brlapi support $brlapi"
934 echo "Documentation $build_docs"
935 [ ! -z "$uname_release" ] && \
936 echo "uname -r $uname_release"
937 echo "NPTL support $nptl"
939 if test $sdl_too_old = "yes"; then
940 echo "-> Your SDL version is too old - please upgrade to have SDL support"
942 if [ -s /tmp/qemu-$$-sdl-config.log ]; then
943 echo "The error log from compiling the libSDL test is: "
944 cat /tmp/qemu-$$-sdl-config.log
946 rm -f /tmp/qemu-$$-sdl-config.log
947 #if test "$sdl_static" = "no"; then
948 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
950 config_mak="config-host.mak"
951 config_h="config-host.h"
953 #echo "Creating $config_mak and $config_h"
955 test -f $config_h && mv $config_h ${config_h}~
957 echo "# Automatically generated by configure - do not modify" > $config_mak
958 echo "# Configured with: $0 $@" >> $config_mak
959 echo "/* Automatically generated by configure - do not modify */" > $config_h
961 echo "prefix=$prefix" >> $config_mak
962 echo "bindir=\${prefix}$binsuffix" >> $config_mak
963 echo "mandir=\${prefix}$mansuffix" >> $config_mak
964 echo "datadir=\${prefix}$datasuffix" >> $config_mak
965 echo "docdir=\${prefix}$docsuffix" >> $config_mak
966 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
967 echo "MAKE=$make" >> $config_mak
968 echo "INSTALL=$install" >> $config_mak
969 echo "CC=$cc" >> $config_mak
970 echo "HOST_CC=$host_cc" >> $config_mak
971 echo "AR=$ar" >> $config_mak
972 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
973 # XXX: only use CFLAGS and LDFLAGS ?
974 # XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
975 # compilation of dyngen tool (useful for win32 build on Linux host)
976 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
977 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
978 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
979 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
980 echo "CFLAGS=$CFLAGS" >> $config_mak
981 echo "LDFLAGS=$LDFLAGS" >> $config_mak
982 echo "EXESUF=$EXESUF" >> $config_mak
983 echo "AIOLIBS=$AIOLIBS" >> $config_mak
984 case "$cpu" in
985 i386)
986 echo "ARCH=i386" >> $config_mak
987 echo "#define HOST_I386 1" >> $config_h
989 x86_64)
990 echo "ARCH=x86_64" >> $config_mak
991 echo "#define HOST_X86_64 1" >> $config_h
993 alpha)
994 echo "ARCH=alpha" >> $config_mak
995 echo "#define HOST_ALPHA 1" >> $config_h
997 armv4b)
998 echo "ARCH=arm" >> $config_mak
999 echo "#define HOST_ARM 1" >> $config_h
1001 armv4l)
1002 echo "ARCH=arm" >> $config_mak
1003 echo "#define HOST_ARM 1" >> $config_h
1005 cris)
1006 echo "ARCH=cris" >> $config_mak
1007 echo "#define HOST_CRIS 1" >> $config_h
1009 hppa)
1010 echo "ARCH=hppa" >> $config_mak
1011 echo "#define HOST_HPPA 1" >> $config_h
1013 ia64)
1014 echo "ARCH=ia64" >> $config_mak
1015 echo "#define HOST_IA64 1" >> $config_h
1017 m68k)
1018 echo "ARCH=m68k" >> $config_mak
1019 echo "#define HOST_M68K 1" >> $config_h
1021 mips)
1022 echo "ARCH=mips" >> $config_mak
1023 echo "#define HOST_MIPS 1" >> $config_h
1025 mips64)
1026 echo "ARCH=mips64" >> $config_mak
1027 echo "#define HOST_MIPS64 1" >> $config_h
1029 powerpc)
1030 echo "ARCH=ppc" >> $config_mak
1031 echo "#define HOST_PPC 1" >> $config_h
1033 s390)
1034 echo "ARCH=s390" >> $config_mak
1035 echo "#define HOST_S390 1" >> $config_h
1037 sparc)
1038 echo "ARCH=sparc" >> $config_mak
1039 echo "#define HOST_SPARC 1" >> $config_h
1041 sparc64)
1042 echo "ARCH=sparc64" >> $config_mak
1043 echo "#define HOST_SPARC64 1" >> $config_h
1046 echo "Unsupported CPU = $cpu"
1047 exit 1
1049 esac
1050 if test "$bigendian" = "yes" ; then
1051 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1052 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1054 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
1055 if test "$mingw32" = "yes" ; then
1056 echo "CONFIG_WIN32=yes" >> $config_mak
1057 echo "#define CONFIG_WIN32 1" >> $config_h
1058 else
1059 cat > $TMPC << EOF
1060 #include <byteswap.h>
1061 int main(void) { return bswap_32(0); }
1063 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1064 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1067 if test "$darwin" = "yes" ; then
1068 echo "CONFIG_DARWIN=yes" >> $config_mak
1069 echo "#define CONFIG_DARWIN 1" >> $config_h
1071 if test "$solaris" = "yes" ; then
1072 echo "CONFIG_SOLARIS=yes" >> $config_mak
1073 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
1074 if test "$needs_libsunmath" = "yes" ; then
1075 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1076 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1079 if test -n "$sparc_cpu"; then
1080 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1081 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1083 if test "$gdbstub" = "yes" ; then
1084 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1085 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1087 if test "$gprof" = "yes" ; then
1088 echo "TARGET_GPROF=yes" >> $config_mak
1089 echo "#define HAVE_GPROF 1" >> $config_h
1091 if test "$static" = "yes" ; then
1092 echo "CONFIG_STATIC=yes" >> $config_mak
1093 echo "#define CONFIG_STATIC 1" >> $config_h
1095 if test $profiler = "yes" ; then
1096 echo "#define CONFIG_PROFILER 1" >> $config_h
1098 if test "$slirp" = "yes" ; then
1099 echo "CONFIG_SLIRP=yes" >> $config_mak
1100 echo "#define CONFIG_SLIRP 1" >> $config_h
1102 if test "$adlib" = "yes" ; then
1103 echo "CONFIG_ADLIB=yes" >> $config_mak
1104 echo "#define CONFIG_ADLIB 1" >> $config_h
1106 if test "$ac97" = "yes" ; then
1107 echo "CONFIG_AC97=yes" >> $config_mak
1108 echo "#define CONFIG_AC97 1" >> $config_h
1110 if test "$gus" = "yes" ; then
1111 echo "CONFIG_GUS=yes" >> $config_mak
1112 echo "#define CONFIG_GUS 1" >> $config_h
1114 if test "$oss" = "yes" ; then
1115 echo "CONFIG_OSS=yes" >> $config_mak
1116 echo "#define CONFIG_OSS 1" >> $config_h
1118 if test "$coreaudio" = "yes" ; then
1119 echo "CONFIG_COREAUDIO=yes" >> $config_mak
1120 echo "#define CONFIG_COREAUDIO 1" >> $config_h
1122 if test "$alsa" = "yes" ; then
1123 echo "CONFIG_ALSA=yes" >> $config_mak
1124 echo "#define CONFIG_ALSA 1" >> $config_h
1126 if test "$esd" = "yes" ; then
1127 echo "CONFIG_ESD=yes" >> $config_mak
1128 echo "#define CONFIG_ESD 1" >> $config_h
1130 if test "$dsound" = "yes" ; then
1131 echo "CONFIG_DSOUND=yes" >> $config_mak
1132 echo "#define CONFIG_DSOUND 1" >> $config_h
1134 if test "$fmod" = "yes" ; then
1135 echo "CONFIG_FMOD=yes" >> $config_mak
1136 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1137 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1138 echo "#define CONFIG_FMOD 1" >> $config_h
1140 if test "$vnc_tls" = "yes" ; then
1141 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1142 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1143 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1144 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1146 qemu_version=`head $source_path/VERSION`
1147 echo "VERSION=$qemu_version" >>$config_mak
1148 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1149 echo "#define KVM_VERSION \"kvm-devel\"" >> $config_h
1151 echo "SRC_PATH=$source_path" >> $config_mak
1152 if [ "$source_path_used" = "yes" ]; then
1153 echo "VPATH=$source_path" >> $config_mak
1155 echo "TARGET_DIRS=$target_list" >> $config_mak
1156 if [ "$build_docs" = "yes" ] ; then
1157 echo "BUILD_DOCS=yes" >> $config_mak
1159 if test "$static" = "yes"; then
1160 sdl1=$sdl_static
1161 else
1162 sdl1=$sdl
1164 if test "$sdl1" = "yes" ; then
1165 echo "#define CONFIG_SDL 1" >> $config_h
1166 echo "CONFIG_SDL=yes" >> $config_mak
1167 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1168 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1169 else
1170 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1172 if [ "${aa}" = "yes" ] ; then
1173 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1174 else
1175 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1178 if test "$cocoa" = "yes" ; then
1179 echo "#define CONFIG_COCOA 1" >> $config_h
1180 echo "CONFIG_COCOA=yes" >> $config_mak
1182 if test "$curses" = "yes" ; then
1183 echo "#define CONFIG_CURSES 1" >> $config_h
1184 echo "CONFIG_CURSES=yes" >> $config_mak
1185 echo "CURSES_LIBS=-lcurses" >> $config_mak
1187 if test "$brlapi" = "yes" ; then
1188 echo "CONFIG_BRLAPI=yes" >> $config_mak
1189 echo "#define CONFIG_BRLAPI 1" >> $config_h
1190 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1193 # XXX: suppress that
1194 if [ "$bsd" = "yes" ] ; then
1195 echo "#define O_LARGEFILE 0" >> $config_h
1196 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1197 echo "#define _BSD 1" >> $config_h
1200 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1202 tools=
1203 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1204 tools="qemu-img\$(EXESUF) $tools"
1205 if [ "$linux" = "yes" ] ; then
1206 tools="qemu-nbd\$(EXESUF) $tools"
1209 echo "TOOLS=$tools" >> $config_mak
1211 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1213 for target in $target_list; do
1214 target_dir="$target"
1215 config_mak=$target_dir/config.mak
1216 config_h=$target_dir/config.h
1217 target_cpu=`echo $target | cut -d '-' -f 1`
1218 target_bigendian="no"
1219 [ "$target_cpu" = "armeb" ] && target_bigendian=yes
1220 [ "$target_cpu" = "m68k" ] && target_bigendian=yes
1221 [ "$target_cpu" = "mips" ] && target_bigendian=yes
1222 [ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1223 [ "$target_cpu" = "mips64" ] && target_bigendian=yes
1224 [ "$target_cpu" = "ppc" ] && target_bigendian=yes
1225 [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
1226 [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
1227 [ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
1228 [ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
1229 [ "$target_cpu" = "sparc" ] && target_bigendian=yes
1230 [ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1231 [ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
1232 target_softmmu="no"
1233 target_user_only="no"
1234 target_linux_user="no"
1235 target_darwin_user="no"
1236 case "$target" in
1237 ${target_cpu}-softmmu)
1238 target_softmmu="yes"
1240 ${target_cpu}-linux-user)
1241 target_user_only="yes"
1242 target_linux_user="yes"
1244 ${target_cpu}-darwin-user)
1245 target_user_only="yes"
1246 target_darwin_user="yes"
1249 echo "ERROR: Target '$target' not recognised"
1250 exit 1
1252 esac
1254 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1255 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1256 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1257 echo "To build QEMU without graphical output configure with --disable-gfx-check"
1258 echo "Note that this will disable all output from the virtual graphics card"
1259 echo "except through VNC or curses."
1260 exit 1;
1263 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1265 test -f $config_h && mv $config_h ${config_h}~
1267 mkdir -p $target_dir
1268 mkdir -p $target_dir/fpu
1269 mkdir -p $target_dir/tcg
1270 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then
1271 mkdir -p $target_dir/nwfpe
1275 # don't use ln -sf as not all "ln -sf" over write the file/link
1277 rm -f $target_dir/Makefile
1278 ln -s $source_path/Makefile.target $target_dir/Makefile
1281 echo "# Automatically generated by configure - do not modify" > $config_mak
1282 echo "/* Automatically generated by configure - do not modify */" > $config_h
1285 echo "include ../config-host.mak" >> $config_mak
1286 echo "#include \"../config-host.h\"" >> $config_h
1288 bflt="no"
1289 elfload32="no"
1290 target_nptl="no"
1291 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1292 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1294 disable_cpu_emulation() {
1295 if test $cpu_emulation = "no"; then
1296 echo "#define NO_CPU_EMULATION 1" >> $config_h
1297 echo "NO_CPU_EMULATION=1" >> $config_mak
1301 configure_kvm() {
1302 if test $kvm = "yes" -a "$target_softmmu" = "yes" -a \
1303 \( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \); then
1304 echo "#define USE_KVM 1" >> $config_h
1305 echo "USE_KVM=1" >> $config_mak
1306 echo "CONFIG_KVM_KERNEL_INC=$kernel_path/include" >> $config_mak
1307 if test $kvm_cap_pit = "yes" ; then
1308 echo "USE_KVM_PIT=1" >> $config_mak
1309 echo "#define USE_KVM_PIT 1" >> $config_h
1311 disable_cpu_emulation
1315 case "$target_cpu" in
1316 i386)
1317 echo "TARGET_ARCH=i386" >> $config_mak
1318 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1319 echo "#define TARGET_I386 1" >> $config_h
1320 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
1321 then
1322 echo "#define USE_KQEMU 1" >> $config_h
1324 gcc3minver=`$cc --version 2> /dev/null| fgrep "(GCC) 3." | awk '{ print $3 }' | cut -f2 -d.`
1325 if test -n "$gcc3minver" && test $gcc3minver -gt 3
1326 then
1327 echo "HAVE_GT_GCC_3_3=true" >> $config_mak
1328 else
1329 echo "HAVE_GT_GCC_3_3=false" >> $config_mak
1331 configure_kvm
1333 x86_64)
1334 echo "TARGET_ARCH=x86_64" >> $config_mak
1335 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1336 echo "#define TARGET_I386 1" >> $config_h
1337 echo "#define TARGET_X86_64 1" >> $config_h
1338 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1339 then
1340 echo "#define USE_KQEMU 1" >> $config_h
1342 configure_kvm
1344 ia64)
1345 echo "TARGET_ARCH=ia64" >> $config_mak
1346 echo "#define TARGET_ARCH \"ia64\"" >> $config_h
1347 echo "#define TARGET_IA64 1" >> $config_h
1348 configure_kvm
1350 alpha)
1351 echo "TARGET_ARCH=alpha" >> $config_mak
1352 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1353 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1354 echo "#define TARGET_ALPHA 1" >> $config_h
1355 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1357 arm|armeb)
1358 echo "TARGET_ARCH=arm" >> $config_mak
1359 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1360 echo "#define TARGET_ARM 1" >> $config_h
1361 bflt="yes"
1362 target_nptl="yes"
1364 cris)
1365 echo "TARGET_ARCH=cris" >> $config_mak
1366 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1367 echo "#define TARGET_CRIS 1" >> $config_h
1369 m68k)
1370 echo "TARGET_ARCH=m68k" >> $config_mak
1371 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1372 echo "#define TARGET_M68K 1" >> $config_h
1373 bflt="yes"
1375 mips|mipsel)
1376 echo "TARGET_ARCH=mips" >> $config_mak
1377 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1378 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1379 echo "#define TARGET_MIPS 1" >> $config_h
1380 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1381 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1383 mipsn32|mipsn32el)
1384 echo "TARGET_ARCH=mipsn32" >> $config_mak
1385 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1386 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1387 echo "#define TARGET_MIPS 1" >> $config_h
1388 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1389 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1391 mips64|mips64el)
1392 echo "TARGET_ARCH=mips64" >> $config_mak
1393 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1394 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1395 echo "#define TARGET_MIPS 1" >> $config_h
1396 echo "#define TARGET_MIPS64 1" >> $config_h
1397 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1398 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1400 ppc)
1401 echo "TARGET_ARCH=ppc" >> $config_mak
1402 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1403 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1404 echo "#define TARGET_PPC 1" >> $config_h
1405 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1407 ppcemb)
1408 echo "TARGET_ARCH=ppcemb" >> $config_mak
1409 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1410 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1411 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1412 echo "#define TARGET_PPC 1" >> $config_h
1413 echo "#define TARGET_PPCEMB 1" >> $config_h
1414 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1415 if test "$device_tree_support" = "yes" ; then
1416 echo "#define CONFIG_LIBFDT 1" >> $config_h
1417 echo "CONFIG_LIBFDT=1" >> $config_mak
1419 configure_kvm
1421 ppc64)
1422 echo "TARGET_ARCH=ppc64" >> $config_mak
1423 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1424 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1425 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1426 echo "#define TARGET_PPC 1" >> $config_h
1427 echo "#define TARGET_PPC64 1" >> $config_h
1428 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1430 ppc64abi32)
1431 echo "TARGET_ARCH=ppc64" >> $config_mak
1432 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1433 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1434 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1435 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1436 echo "#define TARGET_PPC 1" >> $config_h
1437 echo "#define TARGET_PPC64 1" >> $config_h
1438 echo "#define TARGET_ABI32 1" >> $config_h
1439 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1441 sh4|sh4eb)
1442 echo "TARGET_ARCH=sh4" >> $config_mak
1443 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1444 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1445 echo "#define TARGET_SH4 1" >> $config_h
1446 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1447 bflt="yes"
1449 sparc)
1450 echo "TARGET_ARCH=sparc" >> $config_mak
1451 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1452 echo "#define TARGET_SPARC 1" >> $config_h
1454 sparc64)
1455 echo "TARGET_ARCH=sparc64" >> $config_mak
1456 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1457 echo "#define TARGET_SPARC 1" >> $config_h
1458 echo "#define TARGET_SPARC64 1" >> $config_h
1459 elfload32="yes"
1461 sparc32plus)
1462 echo "TARGET_ARCH=sparc64" >> $config_mak
1463 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1464 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1465 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1466 echo "#define TARGET_SPARC 1" >> $config_h
1467 echo "#define TARGET_SPARC64 1" >> $config_h
1468 echo "#define TARGET_ABI32 1" >> $config_h
1471 echo "Unsupported target CPU"
1472 exit 1
1474 esac
1475 if test "$target_bigendian" = "yes" ; then
1476 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1477 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1479 if test "$target_softmmu" = "yes" ; then
1480 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1481 echo "#define CONFIG_SOFTMMU 1" >> $config_h
1483 if test "$target_user_only" = "yes" ; then
1484 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1485 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1487 if test "$target_linux_user" = "yes" ; then
1488 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1489 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1491 if test "$target_darwin_user" = "yes" ; then
1492 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1493 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1496 if test "$target_cpu" = "arm" \
1497 -o "$target_cpu" = "armeb" \
1498 -o "$target_cpu" = "m68k" \
1499 -o "$target_cpu" = "mips" \
1500 -o "$target_cpu" = "mipsel" \
1501 -o "$target_cpu" = "mipsn32" \
1502 -o "$target_cpu" = "mipsn32el" \
1503 -o "$target_cpu" = "mips64" \
1504 -o "$target_cpu" = "mips64el" \
1505 -o "$target_cpu" = "sparc" \
1506 -o "$target_cpu" = "sparc64" \
1507 -o "$target_cpu" = "sparc32plus"; then
1508 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1509 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1511 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1512 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1513 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1515 if test "$target_user_only" = "yes" \
1516 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1517 echo "#define USE_NPTL 1" >> $config_h
1519 # 32 bit ELF loader in addition to native 64 bit loader?
1520 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1521 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1522 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1525 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1527 done # for target in $targets
1529 # build tree in object directory if source path is different from current one
1530 if test "$source_path_used" = "yes" ; then
1531 DIRS="tests tests/cris slirp audio"
1532 FILES="Makefile tests/Makefile"
1533 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
1534 FILES="$FILES tests/test-mmap.c"
1535 for dir in $DIRS ; do
1536 mkdir -p $dir
1537 done
1538 # remove the link and recreate it, as not all "ln -sf" overwrite the link
1539 for f in $FILES ; do
1540 rm -f $f
1541 ln -s $source_path/$f $f
1542 done
1545 rm -f $TMPO $TMPC $TMPE $TMPS