Drop qemu-kvm.h from e1000.c
[qemu-kvm/fedora.git] / configure
blobfc0fb9b6ef58d60e00266dec7215ca5ad9997c25
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"
18 TMPI="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.i"
19 TMPSDLLOG="${TMPDIR1}/qemu-conf-sdl-$$-${RANDOM}.log"
21 trap "rm -f $TMPC $TMPO $TMPE $TMPS $TMPI $TMPSDLLOG; exit" 0 2 3 15
23 # default parameters
24 prefix=""
25 interp_prefix="/usr/gnemul/qemu-%M"
26 static="no"
27 cross_prefix=""
28 cc="gcc"
29 audio_drv_list=""
30 audio_card_list="ac97 es1370 sb16"
31 audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus"
32 host_cc="gcc"
33 ar="ar"
34 make="make"
35 install="install"
36 strip="strip"
38 # parse CC options first
39 for opt do
40 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
41 case "$opt" in
42 --cross-prefix=*) cross_prefix="$optarg"
44 --cc=*) cc="$optarg"
46 esac
47 done
49 # OS specific
50 # Using uname is really, really broken. Once we have the right set of checks
51 # we can eliminate it's usage altogether
53 cc="${cross_prefix}${cc}"
54 ar="${cross_prefix}${ar}"
55 strip="${cross_prefix}${strip}"
57 # check that the C compiler works.
58 cat > $TMPC <<EOF
59 int main(void) {}
60 EOF
62 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
63 : C compiler works ok
64 else
65 echo "ERROR: \"$cc\" either does not exist or does not work"
66 exit 1
69 check_define() {
70 cat > $TMPC <<EOF
71 #if !defined($1)
72 #error Not defined
73 #endif
74 int main(void) { return 0; }
75 EOF
76 $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
79 if check_define __i386__ ; then
80 cpu="i386"
81 elif check_define __x86_64__ ; then
82 cpu="x86_64"
83 elif check_define __sparc__ ; then
84 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
85 # They must be specified using --sparc_cpu
86 if check_define __arch64__ ; then
87 cpu="sparc64"
88 else
89 cpu="sparc"
91 elif check_define _ARCH_PPC ; then
92 if check_define _ARCH_PPC64 ; then
93 cpu="ppc64"
94 else
95 cpu="ppc"
97 else
98 cpu=`uname -m`
101 target_list="x86_64-softmmu"
102 case "$cpu" in
103 i386|i486|i586|i686|i86pc|BePC)
104 cpu="i386"
106 x86_64|amd64)
107 cpu="x86_64"
109 alpha)
110 cpu="alpha"
112 armv*b)
113 cpu="armv4b"
115 armv*l)
116 cpu="armv4l"
118 cris)
119 cpu="cris"
121 parisc|parisc64)
122 cpu="hppa"
124 ia64)
125 cpu="ia64"
127 m68k)
128 cpu="m68k"
130 mips)
131 cpu="mips"
133 mips64)
134 cpu="mips64"
136 ppc)
137 cpu="ppc"
139 ppc64)
140 cpu="ppc64"
142 s390*)
143 cpu="s390"
145 sparc|sun4[cdmuv])
146 cpu="sparc"
148 sparc64)
149 cpu="sparc64"
152 cpu="unknown"
154 esac
155 gprof="no"
156 debug_tcg="no"
157 sparse="no"
158 strip_opt="yes"
159 bigendian="no"
160 mingw32="no"
161 EXESUF=""
162 gdbstub="yes"
163 slirp="yes"
164 vde="yes"
165 fmod_lib=""
166 fmod_inc=""
167 oss_lib=""
168 vnc_tls="yes"
169 vnc_sasl="yes"
170 bsd="no"
171 linux="no"
172 solaris="no"
173 kqemu="no"
174 profiler="no"
175 cocoa="no"
176 check_gfx="yes"
177 softmmu="yes"
178 linux_user="no"
179 darwin_user="no"
180 bsd_user="no"
181 build_docs="no"
182 uname_release=""
183 curses="yes"
184 aio="yes"
185 nptl="yes"
186 mixemu="no"
187 bluez="yes"
188 kvm="yes"
189 kvm_cap_pit="no"
190 kvm_cap_device_assignment="no"
191 kerneldir=""
192 aix="no"
193 blobs="yes"
194 fdt="yes"
195 sdl_x11="no"
196 xen="yes"
197 pkgversion=""
198 signalfd="no"
199 eventfd="no"
200 cpu_emulation="yes"
202 # OS specific
203 if check_define __linux__ ; then
204 targetos="Linux"
205 elif check_define _WIN32 ; then
206 targetos='MINGW32'
207 elif check_define __OpenBSD__ ; then
208 targetos='OpenBSD'
209 elif check_define __sun__ ; then
210 targetos='SunOS'
211 else
212 targetos=`uname -s`
214 case $targetos in
215 CYGWIN*)
216 mingw32="yes"
217 OS_CFLAGS="-mno-cygwin"
218 if [ "$cpu" = "i386" ] ; then
219 kqemu="yes"
221 audio_possible_drivers="sdl"
223 MINGW32*)
224 mingw32="yes"
225 if [ "$cpu" = "i386" ] ; then
226 kqemu="yes"
228 audio_possible_drivers="dsound sdl fmod"
230 GNU/kFreeBSD)
231 audio_drv_list="oss"
232 audio_possible_drivers="oss sdl esd pa"
233 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
234 kqemu="yes"
237 FreeBSD)
238 bsd="yes"
239 audio_drv_list="oss"
240 audio_possible_drivers="oss sdl esd pa"
241 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
242 kqemu="yes"
243 kvm="yes"
246 DragonFly)
247 bsd="yes"
248 audio_drv_list="oss"
249 audio_possible_drivers="oss sdl esd pa"
250 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
251 kqemu="yes"
253 aio="no"
255 NetBSD)
256 bsd="yes"
257 audio_drv_list="oss"
258 audio_possible_drivers="oss sdl esd"
259 oss_lib="-lossaudio"
261 OpenBSD)
262 bsd="yes"
263 openbsd="yes"
264 audio_drv_list="oss"
265 audio_possible_drivers="oss sdl esd"
266 oss_lib="-lossaudio"
268 Darwin)
269 bsd="yes"
270 darwin="yes"
271 # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can run 64-bit userspace code
272 if [ "$cpu" = "i386" ] ; then
273 is_x86_64=`sysctl -n hw.optional.x86_64`
274 [ "$is_x86_64" = "1" ] && cpu=x86_64
276 if [ "$cpu" = "x86_64" ] ; then
277 OS_CFLAGS="-arch x86_64"
278 LDFLAGS="-arch x86_64"
279 else
280 OS_CFLAGS="-mdynamic-no-pic"
282 darwin_user="yes"
283 cocoa="yes"
284 audio_drv_list="coreaudio"
285 audio_possible_drivers="coreaudio sdl fmod"
286 OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
288 SunOS)
289 solaris="yes"
290 make="gmake"
291 install="ginstall"
292 needs_libsunmath="no"
293 kvm="no"
294 solarisrev=`uname -r | cut -f2 -d.`
295 # have to select again, because `uname -m` returns i86pc
296 # even on an x86_64 box.
297 solariscpu=`isainfo -k`
298 if test "${solariscpu}" = "amd64" ; then
299 cpu="x86_64"
301 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
302 if test "$solarisrev" -le 9 ; then
303 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
304 needs_libsunmath="yes"
305 else
306 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
307 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
308 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
309 echo "Studio 11 can be downloaded from www.sun.com."
310 exit 1
313 if test "$solarisrev" -ge 9 ; then
314 kqemu="yes"
317 if test -f /usr/include/sys/soundcard.h ; then
318 audio_drv_list="oss"
320 audio_possible_drivers="oss sdl"
321 OS_CFLAGS=-std=gnu99
323 AIX)
324 aix="yes"
325 make="gmake"
328 audio_drv_list="oss"
329 audio_possible_drivers="oss alsa sdl esd pa"
330 linux="yes"
331 linux_user="yes"
332 usb="linux"
333 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
334 kqemu="yes"
335 audio_possible_drivers="$audio_possible_drivers fmod"
336 kvm="yes"
338 if [ "$cpu" = "ia64" ] ; then
339 kvm="yes"
340 cpu_emulation="no"
341 gdbstub="no"
342 slirp="no"
344 if [ "$cpu" = "powerpc" ]; then
345 kvm="yes"
348 esac
350 if [ "$bsd" = "yes" ] ; then
351 if [ "$darwin" != "yes" ] ; then
352 make="gmake"
353 usb="bsd"
355 bsd_user="yes"
358 # find source path
359 source_path=`dirname "$0"`
360 source_path_used="no"
361 workdir=`pwd`
362 if [ -z "$source_path" ]; then
363 source_path=$workdir
364 else
365 source_path=`cd "$source_path"; pwd`
367 [ -f "$workdir/vl.c" ] || source_path_used="yes"
369 werror="no"
370 # generate compile errors on warnings for development builds
371 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
372 #werror="yes";
375 for opt do
376 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
377 case "$opt" in
378 --help|-h) show_help=yes
380 --prefix=*) prefix="$optarg"
382 --interp-prefix=*) interp_prefix="$optarg"
384 --source-path=*) source_path="$optarg"
385 source_path_used="yes"
387 --cross-prefix=*)
389 --cc=*)
391 --host-cc=*) host_cc="$optarg"
393 --make=*) make="$optarg"
395 --install=*) install="$optarg"
397 --extra-cflags=*) CFLAGS="$optarg"
399 --extra-ldflags=*) LDFLAGS="$optarg"
401 --cpu=*) cpu="$optarg"
403 --target-list=*) target_list="$optarg"
405 --enable-gprof) gprof="yes"
407 --static) static="yes"
409 --disable-sdl) sdl="no"
411 --fmod-lib=*) fmod_lib="$optarg"
413 --fmod-inc=*) fmod_inc="$optarg"
415 --oss-lib=*) oss_lib="$optarg"
417 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
419 --audio-drv-list=*) audio_drv_list="$optarg"
421 --enable-debug-tcg) debug_tcg="yes"
423 --disable-debug-tcg) debug_tcg="no"
425 --enable-sparse) sparse="yes"
427 --disable-sparse) sparse="no"
429 --disable-strip) strip_opt="no"
431 --disable-vnc-tls) vnc_tls="no"
433 --disable-vnc-sasl) vnc_sasl="no"
435 --disable-slirp) slirp="no"
437 --disable-vde) vde="no"
439 --disable-kqemu) kqemu="no"
441 --disable-xen) xen="no"
443 --disable-brlapi) brlapi="no"
445 --disable-bluez) bluez="no"
447 --disable-kvm) kvm="no"
449 --enable-profiler) profiler="yes"
451 --enable-cocoa)
452 cocoa="yes" ;
453 sdl="no" ;
454 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
456 --disable-gfx-check) check_gfx="no"
458 --disable-system) softmmu="no"
460 --enable-system) softmmu="yes"
462 --disable-linux-user) linux_user="no"
464 --enable-linux-user) linux_user="yes"
466 --disable-darwin-user) darwin_user="no"
468 --enable-darwin-user) darwin_user="yes"
470 --disable-bsd-user) bsd_user="no"
472 --enable-bsd-user) bsd_user="yes"
474 --enable-uname-release=*) uname_release="$optarg"
476 --sparc_cpu=*)
477 sparc_cpu="$optarg"
478 case $sparc_cpu in
479 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
480 target_cpu="sparc"; cpu="sparc" ;;
481 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
482 target_cpu="sparc"; cpu="sparc" ;;
483 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
484 target_cpu="sparc64"; cpu="sparc64" ;;
485 *) echo "undefined SPARC architecture. Exiting";exit 1;;
486 esac
488 --enable-werror) werror="yes"
490 --disable-werror) werror="no"
492 --disable-curses) curses="no"
494 --disable-nptl) nptl="no"
496 --enable-mixemu) mixemu="yes"
498 --disable-aio) aio="no"
500 --disable-blobs) blobs="no"
502 --kerneldir=*) kerneldir="$optarg"
504 --with-pkgversion=*) pkgversion=" ($optarg)"
506 --disable-cpu-emulation) cpu_emulation="no"
508 *) echo "ERROR: unknown option $opt"; exit 1
510 esac
511 done
513 # default flags for all hosts
514 CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
515 CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
516 LDFLAGS="$LDFLAGS -g"
517 if test "$werror" = "yes" ; then
518 CFLAGS="$CFLAGS -Werror"
521 CFLAGS="$CFLAGS -I$(readlink -f "kvm/libkvm")"
523 if test "$solaris" = "no" ; then
524 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
525 LDFLAGS="$LDFLAGS -Wl,--warn-common"
530 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
531 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
533 case "$cpu" in
534 sparc) if test -z "$sparc_cpu" ; then
535 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
536 ARCH_LDFLAGS="-m32"
537 else
538 ARCH_CFLAGS="${SP_CFLAGS}"
539 ARCH_LDFLAGS="${SP_LDFLAGS}"
541 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g2 -ffixed-g3"
542 if test "$solaris" = "no" ; then
543 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g6"
546 sparc64) if test -z "$sparc_cpu" ; then
547 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
548 ARCH_LDFLAGS="-m64"
549 else
550 ARCH_CFLAGS="${SP_CFLAGS}"
551 ARCH_LDFLAGS="${SP_LDFLAGS}"
553 if test "$solaris" = "no" ; then
554 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g5 -ffixed-g6 -ffixed-g7"
555 else
556 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7"
559 s390)
560 ARCH_CFLAGS="-march=z900"
562 i386)
563 ARCH_CFLAGS="-m32"
564 ARCH_LDFLAGS="-m32"
566 x86_64)
567 ARCH_CFLAGS="-m64"
568 ARCH_LDFLAGS="-m64"
570 esac
572 if test x"$show_help" = x"yes" ; then
573 cat << EOF
575 Usage: configure [options]
576 Options: [defaults in brackets after descriptions]
579 echo "Standard options:"
580 echo " --help print this message"
581 echo " --prefix=PREFIX install in PREFIX [$prefix]"
582 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
583 echo " use %M for cpu name [$interp_prefix]"
584 echo " --target-list=LIST set target list [$target_list]"
585 echo ""
586 echo "kqemu kernel acceleration support:"
587 echo " --disable-kqemu disable kqemu support"
588 echo ""
589 echo "Advanced options (experts only):"
590 echo " --source-path=PATH path of source code [$source_path]"
591 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
592 echo " --cc=CC use C compiler CC [$cc]"
593 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
594 echo " --extra-cflags=CFLAGS add C compiler flags CFLAGS"
595 echo " --extra-ldflags=LDFLAGS add linker flags LDFLAGS"
596 echo " --make=MAKE use specified make [$make]"
597 echo " --install=INSTALL use specified install [$install]"
598 echo " --static enable static build [$static]"
599 echo " --enable-debug-tcg enable TCG debugging"
600 echo " --disable-debug-tcg disable TCG debugging (default)"
601 echo " --enable-sparse enable sparse checker"
602 echo " --disable-sparse disable sparse checker (default)"
603 echo " --disable-strip disable stripping binaries"
604 echo " --disable-werror disable compilation abort on warning"
605 echo " --disable-sdl disable SDL"
606 echo " --enable-cocoa enable COCOA (Mac OS X only)"
607 echo " --audio-drv-list=LIST set audio drivers list:"
608 echo " Available drivers: $audio_possible_drivers"
609 echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
610 echo " Available cards: $audio_possible_cards"
611 echo " --enable-mixemu enable mixer emulation"
612 echo " --disable-xen disable xen backend driver support"
613 echo " --disable-brlapi disable BrlAPI"
614 echo " --disable-vnc-tls disable TLS encryption for VNC server"
615 echo " --disable-vnc-sasl disable SASL encryption for VNC server"
616 echo " --disable-curses disable curses output"
617 echo " --disable-bluez disable bluez stack connectivity"
618 echo " --disable-kvm disable KVM acceleration support"
619 echo " --disable-nptl disable usermode NPTL support"
620 echo " --enable-system enable all system emulation targets"
621 echo " --disable-system disable all system emulation targets"
622 echo " --enable-linux-user enable all linux usermode emulation targets"
623 echo " --disable-linux-user disable all linux usermode emulation targets"
624 echo " --enable-darwin-user enable all darwin usermode emulation targets"
625 echo " --disable-darwin-user disable all darwin usermode emulation targets"
626 echo " --enable-bsd-user enable all BSD usermode emulation targets"
627 echo " --disable-bsd-user disable all BSD usermode emulation targets"
628 echo " --fmod-lib path to FMOD library"
629 echo " --fmod-inc path to FMOD includes"
630 echo " --oss-lib path to OSS library"
631 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
632 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
633 echo " --disable-vde disable support for vde network"
634 echo " --disable-aio disable AIO support"
635 echo " --disable-blobs disable installing provided firmware blobs"
636 echo " --kerneldir=PATH look for kernel includes in PATH"
637 echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
638 echo ""
639 echo "NOTE: The object files are built at the place where configure is launched"
640 exit 1
643 if test "$mingw32" = "yes" ; then
644 linux="no"
645 EXESUF=".exe"
646 oss="no"
647 linux_user="no"
648 bsd_user="no"
649 OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
652 if test ! -x "$(which cgcc 2>/dev/null)"; then
653 sparse="no"
657 # Solaris specific configure tool chain decisions
659 if test "$solaris" = "yes" ; then
660 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
661 if test -z "$solinst" ; then
662 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
663 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
664 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
665 exit 1
667 if test "$solinst" = "/usr/sbin/install" ; then
668 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
669 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
670 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
671 exit 1
673 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
674 if test -z "$sol_ar" ; then
675 echo "Error: No path includes ar"
676 if test -f /usr/ccs/bin/ar ; then
677 echo "Add /usr/ccs/bin to your path and rerun configure"
679 exit 1
684 if test -z "$target_list" ; then
685 # these targets are portable
686 if [ "$softmmu" = "yes" ] ; then
687 target_list="\
688 i386-softmmu \
689 x86_64-softmmu \
690 arm-softmmu \
691 cris-softmmu \
692 m68k-softmmu \
693 mips-softmmu \
694 mipsel-softmmu \
695 mips64-softmmu \
696 mips64el-softmmu \
697 ppc-softmmu \
698 ppcemb-softmmu \
699 ppc64-softmmu \
700 sh4-softmmu \
701 sh4eb-softmmu \
702 sparc-softmmu \
705 # the following are Linux specific
706 if [ "$linux_user" = "yes" ] ; then
707 target_list="${target_list}\
708 i386-linux-user \
709 x86_64-linux-user \
710 alpha-linux-user \
711 arm-linux-user \
712 armeb-linux-user \
713 cris-linux-user \
714 m68k-linux-user \
715 mips-linux-user \
716 mipsel-linux-user \
717 ppc-linux-user \
718 ppc64-linux-user \
719 ppc64abi32-linux-user \
720 sh4-linux-user \
721 sh4eb-linux-user \
722 sparc-linux-user \
723 sparc64-linux-user \
724 sparc32plus-linux-user \
727 # the following are Darwin specific
728 if [ "$darwin_user" = "yes" ] ; then
729 target_list="$target_list i386-darwin-user ppc-darwin-user "
731 # the following are BSD specific
732 if [ "$bsd_user" = "yes" ] ; then
733 target_list="${target_list}\
734 i386-bsd-user \
735 x86_64-bsd-user \
736 sparc-bsd-user \
737 sparc64-bsd-user \
740 else
741 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
743 if test -z "$target_list" ; then
744 echo "No targets enabled"
745 exit 1
748 if test -z "$cross_prefix" ; then
750 # ---
751 # big/little endian test
752 cat > $TMPC << EOF
753 #include <inttypes.h>
754 int main(int argc, char ** argv){
755 volatile uint32_t i=0x01234567;
756 return (*((uint8_t*)(&i))) == 0x67;
760 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
761 $TMPE && bigendian="yes"
762 else
763 echo big/little test failed
766 else
768 # if cross compiling, cannot launch a program, so make a static guess
769 if test "$cpu" = "armv4b" \
770 -o "$cpu" = "hppa" \
771 -o "$cpu" = "m68k" \
772 -o "$cpu" = "mips" \
773 -o "$cpu" = "mips64" \
774 -o "$cpu" = "ppc" \
775 -o "$cpu" = "ppc64" \
776 -o "$cpu" = "s390" \
777 -o "$cpu" = "sparc" \
778 -o "$cpu" = "sparc64"; then
779 bigendian="yes"
784 # host long bits test
785 hostlongbits="32"
786 if test "$cpu" = "x86_64" \
787 -o "$cpu" = "alpha" \
788 -o "$cpu" = "ia64" \
789 -o "$cpu" = "sparc64" \
790 -o "$cpu" = "ppc64"; then
791 hostlongbits="64"
794 # Check host NPTL support
795 cat > $TMPC <<EOF
796 #include <sched.h>
797 #include <linux/futex.h>
798 void foo()
800 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
801 #error bork
802 #endif
806 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
808 else
809 nptl="no"
812 ##########################################
813 # KVM probe
815 case "$cpu" in
816 i386 | x86_64)
817 kvm_arch="x86"
820 kvm_arch="$cpu"
822 esac
824 kvm_cflags=""
826 if test "$kvm" = "yes" ; then
828 kvm_cflags="-I$source_path/kvm/kernel/include"
829 kvm_cflags="$kvm_cflags -I$source_path/kvm/kernel/arch/$kvm_arch/include"
831 # test for KVM_CAP_PIT
833 cat > $TMPC <<EOF
834 #include <libkvm.h>
835 #ifndef KVM_CAP_PIT
836 #error "kvm no pit capability"
837 #endif
838 int main(void) { return 0; }
840 if $cc $ARCH_CFLAGS $CFLAGS $kvm_cflags -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev/null ; then
841 kvm_cap_pit="yes"
844 # test for KVM_CAP_DEVICE_ASSIGNMENT
846 cat > $TMPC <<EOF
847 #include <libkvm.h>
848 #ifndef KVM_CAP_DEVICE_ASSIGNMENT
849 #error "kvm no device assignment capability"
850 #endif
851 int main(void) { return 0; }
853 if $cc $ARCH_CFLAGS $CFLAGS $kvm_cflags -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev/null ; then
854 kvm_cap_device_assignment="yes"
858 # libpci probe for kvm_cap_device_assignment
859 if test $kvm_cap_device_assignment = "yes" ; then
860 cat > $TMPC << EOF
861 #include <pci/pci.h>
862 #ifndef PCI_VENDOR_ID
863 #error NO LIBPCI
864 #endif
865 int main(void) { return 0; }
867 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC 2>/dev/null ; then
869 else
870 echo
871 echo "Error: libpci check failed"
872 echo "Disable KVM Device Assignment capability."
873 echo
874 kvm_cap_device_assignment="no"
878 ##########################################
879 # zlib check
881 cat > $TMPC << EOF
882 #include <zlib.h>
883 int main(void) { zlibVersion(); return 0; }
885 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
887 else
888 echo
889 echo "Error: zlib check failed"
890 echo "Make sure to have the zlib libs and headers installed."
891 echo
892 exit 1
895 ##########################################
896 # xen probe
898 if test "$xen" = "yes" ; then
899 cat > $TMPC <<EOF
900 #include <xenctrl.h>
901 #include <xs.h>
902 int main(void) { xs_daemon_open; xc_interface_open; }
904 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC -lxenstore -lxenctrl 2> /dev/null ; then
906 else
907 xen="no"
911 ##########################################
912 # SDL probe
914 sdl_too_old=no
916 if test -z "$sdl" ; then
917 sdl_config="sdl-config"
918 sdl=no
919 sdl_static=no
921 cat > $TMPC << EOF
922 #include <SDL.h>
923 #undef main /* We don't want SDL to override our main() */
924 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
926 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` > $TMPSDLLOG 2>&1 ; then
927 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
928 if test "$_sdlversion" -lt 121 ; then
929 sdl_too_old=yes
930 else
931 if test "$cocoa" = "no" ; then
932 sdl=yes
936 # static link with sdl ?
937 if test "$sdl" = "yes" ; then
938 aa="no"
939 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
940 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
941 if [ "$aa" = "yes" ] ; then
942 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
945 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then
946 sdl_static=yes
948 fi # static link
949 fi # sdl compile test
950 else
951 # Make sure to disable cocoa if sdl was set
952 if test "$sdl" = "yes" ; then
953 cocoa="no"
954 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
956 fi # -z $sdl
958 if test "$sdl" = "yes" ; then
959 cat > $TMPC <<EOF
960 #include <SDL.h>
961 #if defined(SDL_VIDEO_DRIVER_X11)
962 #include <X11/XKBlib.h>
963 #else
964 #error No x11 support
965 #endif
966 int main(void) { return 0; }
968 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` > /dev/null 2>&1 ; then
969 sdl_x11="yes"
973 ##########################################
974 # VNC TLS detection
975 if test "$vnc_tls" = "yes" ; then
976 cat > $TMPC <<EOF
977 #include <gnutls/gnutls.h>
978 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
980 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
981 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
982 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
983 $vnc_tls_libs > /dev/null 2> /dev/null ; then
985 else
986 vnc_tls="no"
990 ##########################################
991 # VNC SASL detection
992 if test "$vnc_sasl" = "yes" ; then
993 cat > $TMPC <<EOF
994 #include <sasl/sasl.h>
995 #include <stdio.h>
996 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
998 # Assuming Cyrus-SASL installed in /usr prefix
999 vnc_sasl_cflags=""
1000 vnc_sasl_libs="-lsasl2"
1001 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
1002 $vnc_sasl_libs 2> /dev/null ; then
1004 else
1005 vnc_sasl="no"
1009 ##########################################
1010 # fnmatch() probe, used for ACL routines
1011 fnmatch="no"
1012 cat > $TMPC << EOF
1013 #include <fnmatch.h>
1014 int main(void)
1016 fnmatch("foo", "foo", 0);
1017 return 0;
1020 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1021 fnmatch="yes"
1024 ##########################################
1025 # vde libraries probe
1026 if test "$vde" = "yes" ; then
1027 cat > $TMPC << EOF
1028 #include <libvdeplug.h>
1029 int main(void)
1031 struct vde_open_args a = {0, 0, 0};
1032 vde_open("", "", &a);
1033 return 0;
1036 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
1038 else
1039 vde="no"
1043 ##########################################
1044 # Sound support libraries probe
1046 audio_drv_probe()
1048 drv=$1
1049 hdr=$2
1050 lib=$3
1051 exp=$4
1052 cfl=$5
1053 cat > $TMPC << EOF
1054 #include <$hdr>
1055 int main(void) { $exp }
1057 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
1059 else
1060 echo
1061 echo "Error: $drv check failed"
1062 echo "Make sure to have the $drv libs and headers installed."
1063 echo
1064 exit 1
1068 audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1069 for drv in $audio_drv_list; do
1070 case $drv in
1071 alsa)
1072 audio_drv_probe $drv alsa/asoundlib.h -lasound \
1073 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1076 fmod)
1077 if test -z $fmod_lib || test -z $fmod_inc; then
1078 echo
1079 echo "Error: You must specify path to FMOD library and headers"
1080 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1081 echo
1082 exit 1
1084 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1087 esd)
1088 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1092 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
1093 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1096 oss|sdl|core|wav|dsound)
1097 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1101 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
1102 echo
1103 echo "Error: Unknown driver '$drv' selected"
1104 echo "Possible drivers are: $audio_possible_drivers"
1105 echo
1106 exit 1
1109 esac
1110 done
1112 ##########################################
1113 # BrlAPI probe
1115 if test -z "$brlapi" ; then
1116 brlapi=no
1117 cat > $TMPC << EOF
1118 #include <brlapi.h>
1119 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1121 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
1122 brlapi=yes
1123 fi # brlapi compile test
1124 fi # -z $brlapi
1126 ##########################################
1127 # curses probe
1129 if test "$curses" = "yes" ; then
1130 curses=no
1131 cat > $TMPC << EOF
1132 #include <curses.h>
1133 #ifdef __OpenBSD__
1134 #define resize_term resizeterm
1135 #endif
1136 int main(void) { resize_term(0, 0); return curses_version(); }
1138 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
1139 curses=yes
1141 fi # test "$curses"
1143 ##########################################
1144 # bluez support probe
1145 if test "$bluez" = "yes" ; then
1146 `pkg-config bluez` || bluez="no"
1148 if test "$bluez" = "yes" ; then
1149 cat > $TMPC << EOF
1150 #include <bluetooth/bluetooth.h>
1151 int main(void) { return bt_error(0); }
1153 bluez_cflags=`pkg-config --cflags bluez`
1154 bluez_libs=`pkg-config --libs bluez`
1155 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
1156 $bluez_libs > /dev/null 2> /dev/null ; then
1158 else
1159 bluez="no"
1163 ##########################################
1164 # kvm probe
1165 if test "$kvm" = "yes" ; then
1166 cat > $TMPC <<EOF
1167 #include <linux/kvm.h>
1168 #if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
1169 #error Invalid KVM version
1170 #endif
1171 #if !defined(KVM_CAP_USER_MEMORY)
1172 #error Missing KVM capability KVM_CAP_USER_MEMORY
1173 #endif
1174 #if !defined(KVM_CAP_SET_TSS_ADDR)
1175 #error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1176 #endif
1177 #if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1178 #error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1179 #endif
1180 int main(void) { return 0; }
1182 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
1183 > /dev/null 2>/dev/null ; then
1185 else
1186 kvm="no";
1187 if [ -x "`which awk 2>/dev/null`" ] && \
1188 [ -x "`which grep 2>/dev/null`" ]; then
1189 kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
1190 | grep "error: " \
1191 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1192 if test "$kvmerr" != "" ; then
1193 kvm="no - (${kvmerr})"
1199 ##########################################
1200 # AIO probe
1201 AIOLIBS=""
1203 if test "$aio" = "yes" ; then
1204 aio=no
1205 cat > $TMPC << EOF
1206 #include <pthread.h>
1207 int main(void) { pthread_mutex_t lock; return 0; }
1209 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
1210 aio=yes
1211 AIOLIBS="-lpthread"
1215 ##########################################
1216 # iovec probe
1217 cat > $TMPC <<EOF
1218 #include <sys/types.h>
1219 #include <sys/uio.h>
1220 #include <unistd.h>
1221 int main(void) { struct iovec iov; return 0; }
1223 iovec=no
1224 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1225 iovec=yes
1228 ##########################################
1229 # preadv probe
1230 cat > $TMPC <<EOF
1231 #include <sys/types.h>
1232 #include <sys/uio.h>
1233 #include <unistd.h>
1234 int main(void) { preadv; }
1236 preadv=no
1237 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1238 preadv=yes
1241 ##########################################
1242 # fdt probe
1243 if test "$fdt" = "yes" ; then
1244 fdt=no
1245 cat > $TMPC << EOF
1246 int main(void) { return 0; }
1248 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null ; then
1249 fdt=yes
1254 # Check for xxxat() functions when we are building linux-user
1255 # emulator. This is done because older glibc versions don't
1256 # have syscall stubs for these implemented.
1258 atfile=no
1259 if [ "$linux_user" = "yes" ] ; then
1260 cat > $TMPC << EOF
1261 #define _ATFILE_SOURCE
1262 #include <sys/types.h>
1263 #include <fcntl.h>
1264 #include <unistd.h>
1267 main(void)
1269 /* try to unlink nonexisting file */
1270 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1273 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1274 atfile=yes
1278 # Check for inotify functions when we are building linux-user
1279 # emulator. This is done because older glibc versions don't
1280 # have syscall stubs for these implemented. In that case we
1281 # don't provide them even if kernel supports them.
1283 inotify=no
1284 if [ "$linux_user" = "yes" ] ; then
1285 cat > $TMPC << EOF
1286 #include <sys/inotify.h>
1289 main(void)
1291 /* try to start inotify */
1292 return inotify_init();
1295 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1296 inotify=yes
1300 ##########################################
1301 # signalfd probe
1302 cat > $TMPC << EOF
1303 #define _GNU_SOURCE
1304 #include <unistd.h>
1305 #include <sys/syscall.h>
1306 #include <signal.h>
1307 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
1310 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1311 signalfd=yes
1314 ##########################################
1315 # eventfd probe
1316 cat > $TMPC << EOF
1317 #define _GNU_SOURCE
1318 #include <unistd.h>
1319 #include <sys/syscall.h>
1320 int main(void) { return syscall(SYS_eventfd, 0); }
1323 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1324 eventfd=yes
1327 # Check if tools are available to build documentation.
1328 if [ -x "`which texi2html 2>/dev/null`" ] && \
1329 [ -x "`which pod2man 2>/dev/null`" ]; then
1330 build_docs="yes"
1333 ##########################################
1334 # Do we need librt
1335 cat > $TMPC <<EOF
1336 #include <signal.h>
1337 #include <time.h>
1338 int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1341 rt=no
1342 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1344 elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
1345 rt=yes
1348 if test "$rt" = "yes" ; then
1349 # Hack, we should have a general purpose LIBS for this sort of thing
1350 AIOLIBS="$AIOLIBS -lrt"
1353 if test "$mingw32" = "yes" ; then
1354 if test -z "$prefix" ; then
1355 prefix="c:\\\\Program Files\\\\Qemu"
1357 mansuffix=""
1358 datasuffix=""
1359 docsuffix=""
1360 binsuffix=""
1361 else
1362 if test -z "$prefix" ; then
1363 prefix="/usr/local"
1365 mansuffix="/share/man"
1366 datasuffix="/share/qemu"
1367 docsuffix="/share/doc/qemu"
1368 binsuffix="/bin"
1371 echo "Install prefix $prefix"
1372 echo "BIOS directory $prefix$datasuffix"
1373 echo "binary directory $prefix$binsuffix"
1374 if test "$mingw32" = "no" ; then
1375 echo "Manual directory $prefix$mansuffix"
1376 echo "ELF interp prefix $interp_prefix"
1378 echo "Source path $source_path"
1379 echo "C compiler $cc"
1380 echo "Host C compiler $host_cc"
1381 echo "ARCH_CFLAGS $ARCH_CFLAGS"
1382 echo "make $make"
1383 echo "install $install"
1384 echo "host CPU $cpu"
1385 echo "host big endian $bigendian"
1386 echo "target list $target_list"
1387 echo "tcg debug enabled $debug_tcg"
1388 echo "gprof enabled $gprof"
1389 echo "sparse enabled $sparse"
1390 echo "strip binaries $strip_opt"
1391 echo "profiler $profiler"
1392 echo "static build $static"
1393 echo "-Werror enabled $werror"
1394 if test "$darwin" = "yes" ; then
1395 echo "Cocoa support $cocoa"
1397 echo "SDL support $sdl"
1398 if test "$sdl" != "no" ; then
1399 echo "SDL static link $sdl_static"
1401 echo "curses support $curses"
1402 echo "mingw32 support $mingw32"
1403 echo "Audio drivers $audio_drv_list"
1404 echo "Extra audio cards $audio_card_list"
1405 echo "Mixer emulation $mixemu"
1406 echo "VNC TLS support $vnc_tls"
1407 if test "$vnc_tls" = "yes" ; then
1408 echo " TLS CFLAGS $vnc_tls_cflags"
1409 echo " TLS LIBS $vnc_tls_libs"
1411 echo "VNC SASL support $vnc_sasl"
1412 if test "$vnc_sasl" = "yes" ; then
1413 echo " SASL CFLAGS $vnc_sasl_cflags"
1414 echo " SASL LIBS $vnc_sasl_libs"
1416 if test -n "$sparc_cpu"; then
1417 echo "Target Sparc Arch $sparc_cpu"
1419 echo "kqemu support $kqemu"
1420 echo "xen support $xen"
1421 echo "CPU emulation $cpu_emulation"
1422 echo "brlapi support $brlapi"
1423 echo "Documentation $build_docs"
1424 [ ! -z "$uname_release" ] && \
1425 echo "uname -r $uname_release"
1426 echo "NPTL support $nptl"
1427 echo "vde support $vde"
1428 echo "AIO support $aio"
1429 echo "Install blobs $blobs"
1430 echo "KVM support $kvm"
1431 echo "fdt support $fdt"
1432 echo "preadv support $preadv"
1434 if test $sdl_too_old = "yes"; then
1435 echo "-> Your SDL version is too old - please upgrade to have SDL support"
1437 if [ -s $TMPSDLLOG ]; then
1438 echo "The error log from compiling the libSDL test is: "
1439 cat $TMPSDLLOG
1441 #if test "$sdl_static" = "no"; then
1442 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1444 config_mak="config-host.mak"
1445 config_h="config-host.h"
1447 #echo "Creating $config_mak and $config_h"
1449 test -f $config_h && mv $config_h ${config_h}~
1451 echo "# Automatically generated by configure - do not modify" > $config_mak
1452 printf "# Configured with:" >> $config_mak
1453 printf " '%s'" "$0" "$@" >> $config_mak
1454 echo >> $config_mak
1455 echo "/* Automatically generated by configure - do not modify */" > $config_h
1457 echo "prefix=$prefix" >> $config_mak
1458 echo "bindir=\${prefix}$binsuffix" >> $config_mak
1459 echo "mandir=\${prefix}$mansuffix" >> $config_mak
1460 echo "datadir=\${prefix}$datasuffix" >> $config_mak
1461 echo "docdir=\${prefix}$docsuffix" >> $config_mak
1462 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
1463 echo "MAKE=$make" >> $config_mak
1464 echo "INSTALL=$install" >> $config_mak
1465 echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_mak
1466 echo "INSTALL_DATA=$install -m0644 -p" >> $config_mak
1467 echo "INSTALL_PROG=$install -m0755 -p" >> $config_mak
1468 echo "CC=$cc" >> $config_mak
1469 echo "HOST_CC=$host_cc" >> $config_mak
1470 echo "AR=$ar" >> $config_mak
1471 # XXX: only use CFLAGS and LDFLAGS ?
1472 # XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1473 # compilation of dyngen tool (useful for win32 build on Linux host)
1474 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
1475 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1476 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1477 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
1478 echo "CFLAGS=$CFLAGS" >> $config_mak
1479 echo "LDFLAGS=$LDFLAGS" >> $config_mak
1480 echo "EXESUF=$EXESUF" >> $config_mak
1481 echo "AIOLIBS=$AIOLIBS" >> $config_mak
1482 case "$cpu" in
1483 i386)
1484 echo "ARCH=i386" >> $config_mak
1485 echo "#define HOST_I386 1" >> $config_h
1487 x86_64)
1488 echo "ARCH=x86_64" >> $config_mak
1489 echo "#define HOST_X86_64 1" >> $config_h
1491 alpha)
1492 echo "ARCH=alpha" >> $config_mak
1493 echo "#define HOST_ALPHA 1" >> $config_h
1495 armv4b)
1496 echo "ARCH=arm" >> $config_mak
1497 echo "#define HOST_ARM 1" >> $config_h
1499 armv4l)
1500 echo "ARCH=arm" >> $config_mak
1501 echo "#define HOST_ARM 1" >> $config_h
1503 cris)
1504 echo "ARCH=cris" >> $config_mak
1505 echo "#define HOST_CRIS 1" >> $config_h
1507 hppa)
1508 echo "ARCH=hppa" >> $config_mak
1509 echo "#define HOST_HPPA 1" >> $config_h
1511 ia64)
1512 echo "ARCH=ia64" >> $config_mak
1513 echo "#define HOST_IA64 1" >> $config_h
1515 m68k)
1516 echo "ARCH=m68k" >> $config_mak
1517 echo "#define HOST_M68K 1" >> $config_h
1519 mips)
1520 echo "ARCH=mips" >> $config_mak
1521 echo "#define HOST_MIPS 1" >> $config_h
1523 mips64)
1524 echo "ARCH=mips64" >> $config_mak
1525 echo "#define HOST_MIPS64 1" >> $config_h
1527 ppc)
1528 echo "ARCH=ppc" >> $config_mak
1529 echo "#define HOST_PPC 1" >> $config_h
1531 ppc64)
1532 echo "ARCH=ppc64" >> $config_mak
1533 echo "#define HOST_PPC64 1" >> $config_h
1535 s390)
1536 echo "ARCH=s390" >> $config_mak
1537 echo "#define HOST_S390 1" >> $config_h
1539 sparc)
1540 echo "ARCH=sparc" >> $config_mak
1541 echo "#define HOST_SPARC 1" >> $config_h
1543 sparc64)
1544 echo "ARCH=sparc64" >> $config_mak
1545 echo "#define HOST_SPARC64 1" >> $config_h
1548 echo "Unsupported CPU = $cpu"
1549 exit 1
1551 esac
1552 if test "$debug_tcg" = "yes" ; then
1553 echo "#define DEBUG_TCG 1" >> $config_h
1555 if test "$sparse" = "yes" ; then
1556 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1557 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1558 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1560 if test "$strip_opt" = "yes" ; then
1561 echo "STRIP_OPT=-s" >> $config_mak
1563 if test "$bigendian" = "yes" ; then
1564 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1565 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1567 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
1568 if test "$mingw32" = "yes" ; then
1569 echo "CONFIG_WIN32=yes" >> $config_mak
1570 echo "#define CONFIG_WIN32 1" >> $config_h
1571 else
1572 cat > $TMPC << EOF
1573 #include <byteswap.h>
1574 int main(void) { return bswap_32(0); }
1576 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
1577 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1579 cat > $TMPC << EOF
1580 #include <sys/endian.h>
1581 #include <sys/types.h>
1582 #include <machine/bswap.h>
1583 int main(void) { return bswap32(0); }
1585 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
1586 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1590 if [ "$openbsd" = "yes" ] ; then
1591 echo "#define ENOTSUP 4096" >> $config_h
1594 if test "$darwin" = "yes" ; then
1595 echo "CONFIG_DARWIN=yes" >> $config_mak
1596 echo "#define CONFIG_DARWIN 1" >> $config_h
1599 if test "$aix" = "yes" ; then
1600 echo "CONFIG_AIX=yes" >> $config_mak
1601 echo "#define CONFIG_AIX 1" >> $config_h
1604 if test "$solaris" = "yes" ; then
1605 echo "CONFIG_SOLARIS=yes" >> $config_mak
1606 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
1607 if test "$needs_libsunmath" = "yes" ; then
1608 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1609 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1612 if test -n "$sparc_cpu"; then
1613 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1614 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1616 if test "$gdbstub" = "yes" ; then
1617 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1618 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1620 if test "$gprof" = "yes" ; then
1621 echo "TARGET_GPROF=yes" >> $config_mak
1622 echo "#define HAVE_GPROF 1" >> $config_h
1624 if test "$static" = "yes" ; then
1625 echo "CONFIG_STATIC=yes" >> $config_mak
1626 echo "#define CONFIG_STATIC 1" >> $config_h
1628 if test $profiler = "yes" ; then
1629 echo "#define CONFIG_PROFILER 1" >> $config_h
1631 if test "$slirp" = "yes" ; then
1632 echo "CONFIG_SLIRP=yes" >> $config_mak
1633 echo "#define CONFIG_SLIRP 1" >> $config_h
1635 if test "$vde" = "yes" ; then
1636 echo "CONFIG_VDE=yes" >> $config_mak
1637 echo "#define CONFIG_VDE 1" >> $config_h
1638 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1640 for card in $audio_card_list; do
1641 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
1642 echo "$def=yes" >> $config_mak
1643 echo "#define $def 1" >> $config_h
1644 done
1645 echo "#define AUDIO_DRIVERS \\" >> $config_h
1646 for drv in $audio_drv_list; do
1647 echo " &${drv}_audio_driver, \\" >>$config_h
1648 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
1649 echo "$def=yes" >> $config_mak
1650 if test "$drv" = "fmod"; then
1651 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1652 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1653 elif test "$drv" = "oss"; then
1654 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
1656 done
1657 echo "" >>$config_h
1658 if test "$mixemu" = "yes" ; then
1659 echo "CONFIG_MIXEMU=yes" >> $config_mak
1660 echo "#define CONFIG_MIXEMU 1" >> $config_h
1662 if test "$vnc_tls" = "yes" ; then
1663 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1664 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1665 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1666 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1668 if test "$vnc_sasl" = "yes" ; then
1669 echo "CONFIG_VNC_SASL=yes" >> $config_mak
1670 echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1671 echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1672 echo "#define CONFIG_VNC_SASL 1" >> $config_h
1674 if test "$fnmatch" = "yes" ; then
1675 echo "#define HAVE_FNMATCH_H 1" >> $config_h
1677 qemu_version=`head $source_path/VERSION`
1678 echo "VERSION=$qemu_version" >>$config_mak
1679 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1680 echo "#define KVM_VERSION \"kvm-devel\"" >> $config_h
1682 echo "#define QEMU_PKGVERSION \"$pkgversion\"" >> $config_h
1684 echo "SRC_PATH=$source_path" >> $config_mak
1685 if [ "$source_path_used" = "yes" ]; then
1686 echo "VPATH=$source_path" >> $config_mak
1688 echo "TARGET_DIRS=$target_list" >> $config_mak
1689 if [ "$build_docs" = "yes" ] ; then
1690 echo "BUILD_DOCS=yes" >> $config_mak
1692 if test "$static" = "yes"; then
1693 sdl1=$sdl_static
1694 else
1695 sdl1=$sdl
1697 if test "$sdl1" = "yes" ; then
1698 echo "#define CONFIG_SDL 1" >> $config_h
1699 echo "CONFIG_SDL=yes" >> $config_mak
1700 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1701 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1702 elif test "$sdl_x11" = "yes" ; then
1703 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
1704 else
1705 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1707 if [ "${aa}" = "yes" ] ; then
1708 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1709 else
1710 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1713 if test "$cocoa" = "yes" ; then
1714 echo "#define CONFIG_COCOA 1" >> $config_h
1715 echo "CONFIG_COCOA=yes" >> $config_mak
1717 if test "$curses" = "yes" ; then
1718 echo "#define CONFIG_CURSES 1" >> $config_h
1719 echo "CONFIG_CURSES=yes" >> $config_mak
1720 echo "CURSES_LIBS=-lcurses" >> $config_mak
1722 if test "$atfile" = "yes" ; then
1723 echo "#define CONFIG_ATFILE 1" >> $config_h
1725 if test "$inotify" = "yes" ; then
1726 echo "#define CONFIG_INOTIFY 1" >> $config_h
1728 if test "$brlapi" = "yes" ; then
1729 echo "CONFIG_BRLAPI=yes" >> $config_mak
1730 echo "#define CONFIG_BRLAPI 1" >> $config_h
1731 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1733 if test "$bluez" = "yes" ; then
1734 echo "CONFIG_BLUEZ=yes" >> $config_mak
1735 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1736 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1737 echo "#define CONFIG_BLUEZ 1" >> $config_h
1739 if test "$xen" = "yes" ; then
1740 echo "XEN_LIBS=-lxenstore -lxenctrl -lxenguest" >> $config_mak
1742 if test "$aio" = "yes" ; then
1743 echo "#define CONFIG_AIO 1" >> $config_h
1744 echo "CONFIG_AIO=yes" >> $config_mak
1746 if test "$blobs" = "yes" ; then
1747 echo "INSTALL_BLOBS=yes" >> $config_mak
1749 if test "$iovec" = "yes" ; then
1750 echo "#define HAVE_IOVEC 1" >> $config_h
1752 if test "$preadv" = "yes" ; then
1753 echo "#define HAVE_PREADV 1" >> $config_h
1755 if test "$fdt" = "yes" ; then
1756 echo "#define HAVE_FDT 1" >> $config_h
1757 echo "FDT_LIBS=-lfdt" >> $config_mak
1759 if test "$signalfd" = "yes" ; then
1760 echo "#define CONFIG_signalfd 1" >> $config_h
1762 if test "$eventfd" = "yes" ; then
1763 echo "#define CONFIG_eventfd 1" >> $config_h
1766 # XXX: suppress that
1767 if [ "$bsd" = "yes" ] ; then
1768 echo "#define O_LARGEFILE 0" >> $config_h
1769 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1770 echo "#define HOST_BSD 1" >> $config_h
1773 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1775 # USB host support
1776 case "$usb" in
1777 linux)
1778 echo "HOST_USB=linux" >> $config_mak
1780 bsd)
1781 echo "HOST_USB=bsd" >> $config_mak
1784 echo "HOST_USB=stub" >> $config_mak
1786 esac
1788 tools=
1789 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1790 tools="qemu-img\$(EXESUF) $tools"
1791 if [ "$linux" = "yes" ] ; then
1792 tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
1795 echo "TOOLS=$tools" >> $config_mak
1797 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1799 for target in $target_list; do
1800 target_dir="$target"
1801 config_mak=$target_dir/config.mak
1802 config_h=$target_dir/config.h
1803 target_cpu=`echo $target | cut -d '-' -f 1`
1804 target_bigendian="no"
1805 [ "$target_cpu" = "armeb" ] && target_bigendian=yes
1806 [ "$target_cpu" = "m68k" ] && target_bigendian=yes
1807 [ "$target_cpu" = "mips" ] && target_bigendian=yes
1808 [ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1809 [ "$target_cpu" = "mips64" ] && target_bigendian=yes
1810 [ "$target_cpu" = "ppc" ] && target_bigendian=yes
1811 [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
1812 [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
1813 [ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
1814 [ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
1815 [ "$target_cpu" = "sparc" ] && target_bigendian=yes
1816 [ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1817 [ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
1818 target_softmmu="no"
1819 target_user_only="no"
1820 target_linux_user="no"
1821 target_darwin_user="no"
1822 target_bsd_user="no"
1823 case "$target" in
1824 ${target_cpu}-softmmu)
1825 target_softmmu="yes"
1827 ${target_cpu}-linux-user)
1828 target_user_only="yes"
1829 target_linux_user="yes"
1831 ${target_cpu}-darwin-user)
1832 target_user_only="yes"
1833 target_darwin_user="yes"
1835 ${target_cpu}-bsd-user)
1836 target_user_only="yes"
1837 target_bsd_user="yes"
1840 echo "ERROR: Target '$target' not recognised"
1841 exit 1
1843 esac
1845 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1846 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1847 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1848 echo "To build QEMU without graphical output configure with --disable-gfx-check"
1849 echo "Note that this will disable all output from the virtual graphics card"
1850 echo "except through VNC or curses."
1851 exit 1;
1854 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1856 test -f $config_h && mv $config_h ${config_h}~
1858 mkdir -p $target_dir
1859 mkdir -p $target_dir/fpu
1860 mkdir -p $target_dir/tcg
1861 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
1862 mkdir -p $target_dir/nwfpe
1866 # don't use ln -sf as not all "ln -sf" over write the file/link
1868 rm -f $target_dir/Makefile
1869 ln -s $source_path/Makefile.target $target_dir/Makefile
1872 echo "# Automatically generated by configure - do not modify" > $config_mak
1873 echo "/* Automatically generated by configure - do not modify */" > $config_h
1876 echo "include ../config-host.mak" >> $config_mak
1877 echo "#include \"../config-host.h\"" >> $config_h
1879 bflt="no"
1880 elfload32="no"
1881 target_nptl="no"
1882 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1883 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1884 gdb_xml_files=""
1886 disable_cpu_emulation() {
1887 if test $cpu_emulation = "no"; then
1888 echo "#define NO_CPU_EMULATION 1" >> $config_h
1889 echo "NO_CPU_EMULATION=1" >> $config_mak
1893 configure_kvm() {
1894 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
1895 \( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \); then
1896 echo "#define USE_KVM 1" >> $config_h
1897 echo "USE_KVM=1" >> $config_mak
1898 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1899 if test $kvm_cap_pit = "yes" ; then
1900 echo "USE_KVM_PIT=1" >> $config_mak
1901 echo "#define USE_KVM_PIT 1" >> $config_h
1903 if test $kvm_cap_device_assignment = "yes" ; then
1904 echo "USE_KVM_DEVICE_ASSIGNMENT=1" >> $config_mak
1905 echo "#define USE_KVM_DEVICE_ASSIGNMENT 1" >> $config_h
1907 disable_cpu_emulation
1911 if [ use_upstream_kvm = yes ]; then
1913 # Make sure the target and host cpus are compatible
1914 if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
1915 \( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \) -o \
1916 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1917 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
1918 kvm="no"
1920 # Disable KVM for linux-user
1921 if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1922 kvm="no"
1927 case "$target_cpu" in
1928 i386)
1929 echo "TARGET_ARCH=i386" >> $config_mak
1930 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1931 echo "#define TARGET_I386 1" >> $config_h
1932 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
1933 then
1934 echo "CONFIG_KQEMU=yes" >> $config_mak
1935 echo "#define CONFIG_KQEMU 1" >> $config_h
1937 if test "$kvm" = "yes" ; then
1938 echo "USE_KVM=yes" >> $config_mak
1939 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1940 echo "#define USE_KVM 1" >> $config_h
1942 if test "$xen" = "yes" -a "$target_softmmu" = "yes";
1943 then
1944 echo "CONFIG_XEN=yes" >> $config_mak
1945 echo "#define CONFIG_XEN 1" >> $config_h
1947 configure_kvm
1949 x86_64)
1950 echo "TARGET_ARCH=x86_64" >> $config_mak
1951 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1952 echo "#define TARGET_I386 1" >> $config_h
1953 echo "#define TARGET_X86_64 1" >> $config_h
1954 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1955 then
1956 echo "CONFIG_KQEMU=yes" >> $config_mak
1957 echo "#define CONFIG_KQEMU 1" >> $config_h
1959 configure_kvm
1961 ia64)
1962 echo "TARGET_ARCH=ia64" >> $config_mak
1963 echo "#define TARGET_ARCH \"ia64\"" >> $config_h
1964 echo "#define TARGET_IA64 1" >> $config_h
1965 configure_kvm
1966 if [ use_upstream_kvm = yes ]; then
1967 if test "$kvm" = "yes" ; then
1968 echo "USE_KVM=yes" >> $config_mak
1969 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1970 echo "#define USE_KVM 1" >> $config_h
1973 if test "$xen" = "yes" -a "$target_softmmu" = "yes"
1974 then
1975 echo "CONFIG_XEN=yes" >> $config_mak
1976 echo "#define CONFIG_XEN 1" >> $config_h
1979 alpha)
1980 echo "TARGET_ARCH=alpha" >> $config_mak
1981 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1982 echo "#define TARGET_ALPHA 1" >> $config_h
1984 arm|armeb)
1985 echo "TARGET_ARCH=arm" >> $config_mak
1986 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1987 echo "#define TARGET_ARM 1" >> $config_h
1988 bflt="yes"
1989 target_nptl="yes"
1990 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
1992 cris)
1993 echo "TARGET_ARCH=cris" >> $config_mak
1994 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1995 echo "#define TARGET_CRIS 1" >> $config_h
1996 target_nptl="yes"
1998 m68k)
1999 echo "TARGET_ARCH=m68k" >> $config_mak
2000 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
2001 echo "#define TARGET_M68K 1" >> $config_h
2002 bflt="yes"
2003 gdb_xml_files="cf-core.xml cf-fp.xml"
2005 mips|mipsel)
2006 echo "TARGET_ARCH=mips" >> $config_mak
2007 echo "#define TARGET_ARCH \"mips\"" >> $config_h
2008 echo "#define TARGET_MIPS 1" >> $config_h
2009 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
2011 mipsn32|mipsn32el)
2012 echo "TARGET_ARCH=mipsn32" >> $config_mak
2013 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
2014 echo "#define TARGET_MIPS 1" >> $config_h
2015 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
2017 mips64|mips64el)
2018 echo "TARGET_ARCH=mips64" >> $config_mak
2019 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
2020 echo "#define TARGET_MIPS 1" >> $config_h
2021 echo "#define TARGET_MIPS64 1" >> $config_h
2022 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
2024 ppc)
2025 echo "TARGET_ARCH=ppc" >> $config_mak
2026 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
2027 echo "#define TARGET_PPC 1" >> $config_h
2028 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2030 ppcemb)
2031 echo "TARGET_ARCH=ppcemb" >> $config_mak
2032 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2033 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
2034 echo "#define TARGET_PPC 1" >> $config_h
2035 echo "#define TARGET_PPCEMB 1" >> $config_h
2036 if test "$kvm" = "yes" ; then
2037 echo "USE_KVM=yes" >> $config_mak
2038 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
2039 echo "#define USE_KVM 1" >> $config_h
2041 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2043 ppc64)
2044 echo "TARGET_ARCH=ppc64" >> $config_mak
2045 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2046 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
2047 echo "#define TARGET_PPC 1" >> $config_h
2048 echo "#define TARGET_PPC64 1" >> $config_h
2049 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2051 ppc64abi32)
2052 echo "TARGET_ARCH=ppc64" >> $config_mak
2053 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2054 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
2055 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
2056 echo "#define TARGET_PPC 1" >> $config_h
2057 echo "#define TARGET_PPC64 1" >> $config_h
2058 echo "#define TARGET_ABI32 1" >> $config_h
2059 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2061 sh4|sh4eb)
2062 echo "TARGET_ARCH=sh4" >> $config_mak
2063 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
2064 echo "#define TARGET_SH4 1" >> $config_h
2065 bflt="yes"
2066 target_nptl="yes"
2068 sparc)
2069 echo "TARGET_ARCH=sparc" >> $config_mak
2070 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
2071 echo "#define TARGET_SPARC 1" >> $config_h
2073 sparc64)
2074 echo "TARGET_ARCH=sparc64" >> $config_mak
2075 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
2076 echo "#define TARGET_SPARC 1" >> $config_h
2077 echo "#define TARGET_SPARC64 1" >> $config_h
2078 elfload32="yes"
2080 sparc32plus)
2081 echo "TARGET_ARCH=sparc64" >> $config_mak
2082 echo "TARGET_ABI_DIR=sparc" >> $config_mak
2083 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
2084 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
2085 echo "#define TARGET_SPARC 1" >> $config_h
2086 echo "#define TARGET_SPARC64 1" >> $config_h
2087 echo "#define TARGET_ABI32 1" >> $config_h
2090 echo "Unsupported target CPU"
2091 exit 1
2093 esac
2094 if test "$target_bigendian" = "yes" ; then
2095 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
2096 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
2098 if test "$target_softmmu" = "yes" ; then
2099 echo "CONFIG_SOFTMMU=yes" >> $config_mak
2100 echo "#define CONFIG_SOFTMMU 1" >> $config_h
2102 if test "$target_user_only" = "yes" ; then
2103 echo "CONFIG_USER_ONLY=yes" >> $config_mak
2104 echo "#define CONFIG_USER_ONLY 1" >> $config_h
2106 if test "$target_linux_user" = "yes" ; then
2107 echo "CONFIG_LINUX_USER=yes" >> $config_mak
2108 echo "#define CONFIG_LINUX_USER 1" >> $config_h
2110 if test "$target_darwin_user" = "yes" ; then
2111 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
2112 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
2114 list=""
2115 if test ! -z "$gdb_xml_files" ; then
2116 for x in $gdb_xml_files; do
2117 list="$list $source_path/gdb-xml/$x"
2118 done
2120 echo "TARGET_XML_FILES=$list" >> $config_mak
2122 if test "$target_cpu" = "arm" \
2123 -o "$target_cpu" = "armeb" \
2124 -o "$target_cpu" = "m68k" \
2125 -o "$target_cpu" = "mips" \
2126 -o "$target_cpu" = "mipsel" \
2127 -o "$target_cpu" = "mipsn32" \
2128 -o "$target_cpu" = "mipsn32el" \
2129 -o "$target_cpu" = "mips64" \
2130 -o "$target_cpu" = "mips64el" \
2131 -o "$target_cpu" = "ppc" \
2132 -o "$target_cpu" = "ppc64" \
2133 -o "$target_cpu" = "ppc64abi32" \
2134 -o "$target_cpu" = "ppcemb" \
2135 -o "$target_cpu" = "sparc" \
2136 -o "$target_cpu" = "sparc64" \
2137 -o "$target_cpu" = "sparc32plus"; then
2138 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
2139 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
2141 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
2142 echo "TARGET_HAS_BFLT=yes" >> $config_mak
2143 echo "#define TARGET_HAS_BFLT 1" >> $config_h
2145 if test "$target_user_only" = "yes" \
2146 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
2147 echo "#define USE_NPTL 1" >> $config_h
2149 # 32 bit ELF loader in addition to native 64 bit loader?
2150 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
2151 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
2152 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
2154 if test "$target_bsd_user" = "yes" ; then
2155 echo "CONFIG_BSD_USER=yes" >> $config_mak
2156 echo "#define CONFIG_BSD_USER 1" >> $config_h
2159 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
2161 done # for target in $targets
2163 # build tree in object directory if source path is different from current one
2164 if test "$source_path_used" = "yes" ; then
2165 DIRS="tests tests/cris slirp audio"
2166 FILES="Makefile tests/Makefile"
2167 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
2168 FILES="$FILES tests/test-mmap.c"
2169 for dir in $DIRS ; do
2170 mkdir -p $dir
2171 done
2172 # remove the link and recreate it, as not all "ln -sf" overwrite the link
2173 for f in $FILES ; do
2174 rm -f $f
2175 ln -s $source_path/$f $f
2176 done