Remove devfn from BlockDriverState
[qemu-kvm/fedora.git] / configure
blob9a635ae87cc7e4a647af8fda7b3df8634851845b
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 xen="no"
341 target_list="ia64-softmmu"
342 cpu_emulation="no"
343 gdbstub="no"
344 slirp="no"
346 if [ "$cpu" = "powerpc" ]; then
347 kvm="yes"
350 esac
352 if [ "$bsd" = "yes" ] ; then
353 if [ "$darwin" != "yes" ] ; then
354 make="gmake"
355 usb="bsd"
357 bsd_user="yes"
360 # find source path
361 source_path=`dirname "$0"`
362 source_path_used="no"
363 workdir=`pwd`
364 if [ -z "$source_path" ]; then
365 source_path=$workdir
366 else
367 source_path=`cd "$source_path"; pwd`
369 [ -f "$workdir/vl.c" ] || source_path_used="yes"
371 werror="no"
372 # generate compile errors on warnings for development builds
373 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
374 #werror="yes";
377 for opt do
378 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
379 case "$opt" in
380 --help|-h) show_help=yes
382 --prefix=*) prefix="$optarg"
384 --interp-prefix=*) interp_prefix="$optarg"
386 --source-path=*) source_path="$optarg"
387 source_path_used="yes"
389 --cross-prefix=*)
391 --cc=*)
393 --host-cc=*) host_cc="$optarg"
395 --make=*) make="$optarg"
397 --install=*) install="$optarg"
399 --extra-cflags=*) CFLAGS="$optarg"
401 --extra-ldflags=*) LDFLAGS="$optarg"
403 --cpu=*) cpu="$optarg"
405 --target-list=*) target_list="$optarg"
407 --enable-gprof) gprof="yes"
409 --static) static="yes"
411 --disable-sdl) sdl="no"
413 --fmod-lib=*) fmod_lib="$optarg"
415 --fmod-inc=*) fmod_inc="$optarg"
417 --oss-lib=*) oss_lib="$optarg"
419 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
421 --audio-drv-list=*) audio_drv_list="$optarg"
423 --enable-debug-tcg) debug_tcg="yes"
425 --disable-debug-tcg) debug_tcg="no"
427 --enable-sparse) sparse="yes"
429 --disable-sparse) sparse="no"
431 --disable-strip) strip_opt="no"
433 --disable-vnc-tls) vnc_tls="no"
435 --disable-vnc-sasl) vnc_sasl="no"
437 --disable-slirp) slirp="no"
439 --disable-vde) vde="no"
441 --disable-kqemu) kqemu="no"
443 --disable-xen) xen="no"
445 --disable-brlapi) brlapi="no"
447 --disable-bluez) bluez="no"
449 --disable-kvm) kvm="no"
451 --enable-profiler) profiler="yes"
453 --enable-cocoa)
454 cocoa="yes" ;
455 sdl="no" ;
456 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
458 --disable-gfx-check) check_gfx="no"
460 --disable-system) softmmu="no"
462 --enable-system) softmmu="yes"
464 --disable-linux-user) linux_user="no"
466 --enable-linux-user) linux_user="yes"
468 --disable-darwin-user) darwin_user="no"
470 --enable-darwin-user) darwin_user="yes"
472 --disable-bsd-user) bsd_user="no"
474 --enable-bsd-user) bsd_user="yes"
476 --enable-uname-release=*) uname_release="$optarg"
478 --sparc_cpu=*)
479 sparc_cpu="$optarg"
480 case $sparc_cpu in
481 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
482 target_cpu="sparc"; cpu="sparc" ;;
483 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
484 target_cpu="sparc"; cpu="sparc" ;;
485 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
486 target_cpu="sparc64"; cpu="sparc64" ;;
487 *) echo "undefined SPARC architecture. Exiting";exit 1;;
488 esac
490 --enable-werror) werror="yes"
492 --disable-werror) werror="no"
494 --disable-curses) curses="no"
496 --disable-nptl) nptl="no"
498 --enable-mixemu) mixemu="yes"
500 --disable-aio) aio="no"
502 --disable-blobs) blobs="no"
504 --kerneldir=*) kerneldir="$optarg"
506 --with-pkgversion=*) pkgversion=" ($optarg)"
508 --disable-cpu-emulation) cpu_emulation="no"
510 *) echo "ERROR: unknown option $opt"; exit 1
512 esac
513 done
515 # default flags for all hosts
516 CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
517 CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
518 LDFLAGS="$LDFLAGS -g"
519 if test "$werror" = "yes" ; then
520 CFLAGS="$CFLAGS -Werror"
523 CFLAGS="$CFLAGS -I$(readlink -f "kvm/libkvm")"
525 if test "$solaris" = "no" ; then
526 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
527 LDFLAGS="$LDFLAGS -Wl,--warn-common"
532 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
533 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
535 case "$cpu" in
536 sparc) if test -z "$sparc_cpu" ; then
537 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
538 ARCH_LDFLAGS="-m32"
539 else
540 ARCH_CFLAGS="${SP_CFLAGS}"
541 ARCH_LDFLAGS="${SP_LDFLAGS}"
543 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g2 -ffixed-g3"
544 if test "$solaris" = "no" ; then
545 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g6"
548 sparc64) if test -z "$sparc_cpu" ; then
549 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
550 ARCH_LDFLAGS="-m64"
551 else
552 ARCH_CFLAGS="${SP_CFLAGS}"
553 ARCH_LDFLAGS="${SP_LDFLAGS}"
555 if test "$solaris" = "no" ; then
556 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g5 -ffixed-g6 -ffixed-g7"
557 else
558 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7"
561 s390)
562 ARCH_CFLAGS="-march=z900"
564 i386)
565 ARCH_CFLAGS="-m32"
566 ARCH_LDFLAGS="-m32"
568 x86_64)
569 ARCH_CFLAGS="-m64"
570 ARCH_LDFLAGS="-m64"
572 esac
574 if test x"$show_help" = x"yes" ; then
575 cat << EOF
577 Usage: configure [options]
578 Options: [defaults in brackets after descriptions]
581 echo "Standard options:"
582 echo " --help print this message"
583 echo " --prefix=PREFIX install in PREFIX [$prefix]"
584 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
585 echo " use %M for cpu name [$interp_prefix]"
586 echo " --target-list=LIST set target list [$target_list]"
587 echo ""
588 echo "kqemu kernel acceleration support:"
589 echo " --disable-kqemu disable kqemu support"
590 echo ""
591 echo "Advanced options (experts only):"
592 echo " --source-path=PATH path of source code [$source_path]"
593 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
594 echo " --cc=CC use C compiler CC [$cc]"
595 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
596 echo " --extra-cflags=CFLAGS add C compiler flags CFLAGS"
597 echo " --extra-ldflags=LDFLAGS add linker flags LDFLAGS"
598 echo " --make=MAKE use specified make [$make]"
599 echo " --install=INSTALL use specified install [$install]"
600 echo " --static enable static build [$static]"
601 echo " --enable-debug-tcg enable TCG debugging"
602 echo " --disable-debug-tcg disable TCG debugging (default)"
603 echo " --enable-sparse enable sparse checker"
604 echo " --disable-sparse disable sparse checker (default)"
605 echo " --disable-strip disable stripping binaries"
606 echo " --disable-werror disable compilation abort on warning"
607 echo " --disable-sdl disable SDL"
608 echo " --enable-cocoa enable COCOA (Mac OS X only)"
609 echo " --audio-drv-list=LIST set audio drivers list:"
610 echo " Available drivers: $audio_possible_drivers"
611 echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
612 echo " Available cards: $audio_possible_cards"
613 echo " --enable-mixemu enable mixer emulation"
614 echo " --disable-xen disable xen backend driver support"
615 echo " --disable-brlapi disable BrlAPI"
616 echo " --disable-vnc-tls disable TLS encryption for VNC server"
617 echo " --disable-vnc-sasl disable SASL encryption for VNC server"
618 echo " --disable-curses disable curses output"
619 echo " --disable-bluez disable bluez stack connectivity"
620 echo " --disable-kvm disable KVM acceleration support"
621 echo " --disable-nptl disable usermode NPTL support"
622 echo " --enable-system enable all system emulation targets"
623 echo " --disable-system disable all system emulation targets"
624 echo " --enable-linux-user enable all linux usermode emulation targets"
625 echo " --disable-linux-user disable all linux usermode emulation targets"
626 echo " --enable-darwin-user enable all darwin usermode emulation targets"
627 echo " --disable-darwin-user disable all darwin usermode emulation targets"
628 echo " --enable-bsd-user enable all BSD usermode emulation targets"
629 echo " --disable-bsd-user disable all BSD usermode emulation targets"
630 echo " --fmod-lib path to FMOD library"
631 echo " --fmod-inc path to FMOD includes"
632 echo " --oss-lib path to OSS library"
633 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
634 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
635 echo " --disable-vde disable support for vde network"
636 echo " --disable-aio disable AIO support"
637 echo " --disable-blobs disable installing provided firmware blobs"
638 echo " --kerneldir=PATH look for kernel includes in PATH"
639 echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
640 echo ""
641 echo "NOTE: The object files are built at the place where configure is launched"
642 exit 1
645 if test "$mingw32" = "yes" ; then
646 linux="no"
647 EXESUF=".exe"
648 oss="no"
649 linux_user="no"
650 bsd_user="no"
651 OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
654 if test ! -x "$(which cgcc 2>/dev/null)"; then
655 sparse="no"
659 # Solaris specific configure tool chain decisions
661 if test "$solaris" = "yes" ; then
662 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
663 if test -z "$solinst" ; then
664 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
665 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
666 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
667 exit 1
669 if test "$solinst" = "/usr/sbin/install" ; then
670 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
671 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
672 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
673 exit 1
675 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
676 if test -z "$sol_ar" ; then
677 echo "Error: No path includes ar"
678 if test -f /usr/ccs/bin/ar ; then
679 echo "Add /usr/ccs/bin to your path and rerun configure"
681 exit 1
686 if test -z "$target_list" ; then
687 # these targets are portable
688 if [ "$softmmu" = "yes" ] ; then
689 target_list="\
690 i386-softmmu \
691 x86_64-softmmu \
692 arm-softmmu \
693 cris-softmmu \
694 m68k-softmmu \
695 mips-softmmu \
696 mipsel-softmmu \
697 mips64-softmmu \
698 mips64el-softmmu \
699 ppc-softmmu \
700 ppcemb-softmmu \
701 ppc64-softmmu \
702 sh4-softmmu \
703 sh4eb-softmmu \
704 sparc-softmmu \
707 # the following are Linux specific
708 if [ "$linux_user" = "yes" ] ; then
709 target_list="${target_list}\
710 i386-linux-user \
711 x86_64-linux-user \
712 alpha-linux-user \
713 arm-linux-user \
714 armeb-linux-user \
715 cris-linux-user \
716 m68k-linux-user \
717 mips-linux-user \
718 mipsel-linux-user \
719 ppc-linux-user \
720 ppc64-linux-user \
721 ppc64abi32-linux-user \
722 sh4-linux-user \
723 sh4eb-linux-user \
724 sparc-linux-user \
725 sparc64-linux-user \
726 sparc32plus-linux-user \
729 # the following are Darwin specific
730 if [ "$darwin_user" = "yes" ] ; then
731 target_list="$target_list i386-darwin-user ppc-darwin-user "
733 # the following are BSD specific
734 if [ "$bsd_user" = "yes" ] ; then
735 target_list="${target_list}\
736 i386-bsd-user \
737 x86_64-bsd-user \
738 sparc-bsd-user \
739 sparc64-bsd-user \
742 else
743 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
745 if test -z "$target_list" ; then
746 echo "No targets enabled"
747 exit 1
750 if test -z "$cross_prefix" ; then
752 # ---
753 # big/little endian test
754 cat > $TMPC << EOF
755 #include <inttypes.h>
756 int main(int argc, char ** argv){
757 volatile uint32_t i=0x01234567;
758 return (*((uint8_t*)(&i))) == 0x67;
762 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
763 $TMPE && bigendian="yes"
764 else
765 echo big/little test failed
768 else
770 # if cross compiling, cannot launch a program, so make a static guess
771 if test "$cpu" = "armv4b" \
772 -o "$cpu" = "hppa" \
773 -o "$cpu" = "m68k" \
774 -o "$cpu" = "mips" \
775 -o "$cpu" = "mips64" \
776 -o "$cpu" = "ppc" \
777 -o "$cpu" = "ppc64" \
778 -o "$cpu" = "s390" \
779 -o "$cpu" = "sparc" \
780 -o "$cpu" = "sparc64"; then
781 bigendian="yes"
786 # host long bits test
787 hostlongbits="32"
788 if test "$cpu" = "x86_64" \
789 -o "$cpu" = "alpha" \
790 -o "$cpu" = "ia64" \
791 -o "$cpu" = "sparc64" \
792 -o "$cpu" = "ppc64"; then
793 hostlongbits="64"
796 # Check host NPTL support
797 cat > $TMPC <<EOF
798 #include <sched.h>
799 #include <linux/futex.h>
800 void foo()
802 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
803 #error bork
804 #endif
808 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
810 else
811 nptl="no"
814 ##########################################
815 # KVM probe
817 case "$cpu" in
818 i386 | x86_64)
819 kvm_arch="x86"
821 ppc)
822 kvm_arch="powerpc"
825 kvm_arch="$cpu"
827 esac
829 kvm_cflags=""
831 if test "$kvm" = "yes" ; then
833 kvm_cflags="-I$source_path/kvm/kernel/include"
834 kvm_cflags="$kvm_cflags -I$source_path/kvm/kernel/arch/$kvm_arch/include"
836 # test for KVM_CAP_PIT
838 cat > $TMPC <<EOF
839 #include <libkvm.h>
840 #ifndef KVM_CAP_PIT
841 #error "kvm no pit capability"
842 #endif
843 int main(void) { return 0; }
845 if $cc $ARCH_CFLAGS $CFLAGS $kvm_cflags -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev/null ; then
846 kvm_cap_pit="yes"
849 # test for KVM_CAP_DEVICE_ASSIGNMENT
851 cat > $TMPC <<EOF
852 #include <libkvm.h>
853 #ifndef KVM_CAP_DEVICE_ASSIGNMENT
854 #error "kvm no device assignment capability"
855 #endif
856 int main(void) { return 0; }
858 if $cc $ARCH_CFLAGS $CFLAGS $kvm_cflags -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev/null ; then
859 kvm_cap_device_assignment="yes"
863 # libpci probe for kvm_cap_device_assignment
864 if test $kvm_cap_device_assignment = "yes" ; then
865 cat > $TMPC << EOF
866 #include <pci/pci.h>
867 #ifndef PCI_VENDOR_ID
868 #error NO LIBPCI
869 #endif
870 int main(void) { return 0; }
872 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC 2>/dev/null ; then
874 else
875 echo
876 echo "Error: libpci check failed"
877 echo "Disable KVM Device Assignment capability."
878 echo
879 kvm_cap_device_assignment="no"
883 ##########################################
884 # zlib check
886 cat > $TMPC << EOF
887 #include <zlib.h>
888 int main(void) { zlibVersion(); return 0; }
890 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
892 else
893 echo
894 echo "Error: zlib check failed"
895 echo "Make sure to have the zlib libs and headers installed."
896 echo
897 exit 1
900 ##########################################
901 # xen probe
903 if test "$xen" = "yes" ; then
904 cat > $TMPC <<EOF
905 #include <xenctrl.h>
906 #include <xs.h>
907 int main(void) { xs_daemon_open; xc_interface_open; }
909 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC -lxenstore -lxenctrl 2> /dev/null ; then
911 else
912 xen="no"
916 ##########################################
917 # SDL probe
919 sdl_too_old=no
921 if test -z "$sdl" ; then
922 sdl_config="sdl-config"
923 sdl=no
924 sdl_static=no
926 cat > $TMPC << EOF
927 #include <SDL.h>
928 #undef main /* We don't want SDL to override our main() */
929 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
931 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
932 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
933 if test "$_sdlversion" -lt 121 ; then
934 sdl_too_old=yes
935 else
936 if test "$cocoa" = "no" ; then
937 sdl=yes
941 # static link with sdl ?
942 if test "$sdl" = "yes" ; then
943 aa="no"
944 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
945 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
946 if [ "$aa" = "yes" ] ; then
947 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
950 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then
951 sdl_static=yes
953 fi # static link
954 fi # sdl compile test
955 else
956 # Make sure to disable cocoa if sdl was set
957 if test "$sdl" = "yes" ; then
958 cocoa="no"
959 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
961 fi # -z $sdl
963 if test "$sdl" = "yes" ; then
964 cat > $TMPC <<EOF
965 #include <SDL.h>
966 #if defined(SDL_VIDEO_DRIVER_X11)
967 #include <X11/XKBlib.h>
968 #else
969 #error No x11 support
970 #endif
971 int main(void) { return 0; }
973 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
974 sdl_x11="yes"
978 ##########################################
979 # VNC TLS detection
980 if test "$vnc_tls" = "yes" ; then
981 cat > $TMPC <<EOF
982 #include <gnutls/gnutls.h>
983 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
985 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
986 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
987 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
988 $vnc_tls_libs > /dev/null 2> /dev/null ; then
990 else
991 vnc_tls="no"
995 ##########################################
996 # VNC SASL detection
997 if test "$vnc_sasl" = "yes" ; then
998 cat > $TMPC <<EOF
999 #include <sasl/sasl.h>
1000 #include <stdio.h>
1001 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
1003 # Assuming Cyrus-SASL installed in /usr prefix
1004 vnc_sasl_cflags=""
1005 vnc_sasl_libs="-lsasl2"
1006 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
1007 $vnc_sasl_libs 2> /dev/null ; then
1009 else
1010 vnc_sasl="no"
1014 ##########################################
1015 # fnmatch() probe, used for ACL routines
1016 fnmatch="no"
1017 cat > $TMPC << EOF
1018 #include <fnmatch.h>
1019 int main(void)
1021 fnmatch("foo", "foo", 0);
1022 return 0;
1025 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1026 fnmatch="yes"
1029 ##########################################
1030 # vde libraries probe
1031 if test "$vde" = "yes" ; then
1032 cat > $TMPC << EOF
1033 #include <libvdeplug.h>
1034 int main(void)
1036 struct vde_open_args a = {0, 0, 0};
1037 vde_open("", "", &a);
1038 return 0;
1041 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
1043 else
1044 vde="no"
1048 ##########################################
1049 # Sound support libraries probe
1051 audio_drv_probe()
1053 drv=$1
1054 hdr=$2
1055 lib=$3
1056 exp=$4
1057 cfl=$5
1058 cat > $TMPC << EOF
1059 #include <$hdr>
1060 int main(void) { $exp }
1062 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
1064 else
1065 echo
1066 echo "Error: $drv check failed"
1067 echo "Make sure to have the $drv libs and headers installed."
1068 echo
1069 exit 1
1073 audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1074 for drv in $audio_drv_list; do
1075 case $drv in
1076 alsa)
1077 audio_drv_probe $drv alsa/asoundlib.h -lasound \
1078 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1081 fmod)
1082 if test -z $fmod_lib || test -z $fmod_inc; then
1083 echo
1084 echo "Error: You must specify path to FMOD library and headers"
1085 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1086 echo
1087 exit 1
1089 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1092 esd)
1093 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1097 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
1098 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1101 oss|sdl|core|wav|dsound)
1102 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1106 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
1107 echo
1108 echo "Error: Unknown driver '$drv' selected"
1109 echo "Possible drivers are: $audio_possible_drivers"
1110 echo
1111 exit 1
1114 esac
1115 done
1117 ##########################################
1118 # BrlAPI probe
1120 if test -z "$brlapi" ; then
1121 brlapi=no
1122 cat > $TMPC << EOF
1123 #include <brlapi.h>
1124 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1126 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
1127 brlapi=yes
1128 fi # brlapi compile test
1129 fi # -z $brlapi
1131 ##########################################
1132 # curses probe
1134 if test "$curses" = "yes" ; then
1135 curses=no
1136 cat > $TMPC << EOF
1137 #include <curses.h>
1138 #ifdef __OpenBSD__
1139 #define resize_term resizeterm
1140 #endif
1141 int main(void) { resize_term(0, 0); return curses_version(); }
1143 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
1144 curses=yes
1146 fi # test "$curses"
1148 ##########################################
1149 # bluez support probe
1150 if test "$bluez" = "yes" ; then
1151 `pkg-config bluez` || bluez="no"
1153 if test "$bluez" = "yes" ; then
1154 cat > $TMPC << EOF
1155 #include <bluetooth/bluetooth.h>
1156 int main(void) { return bt_error(0); }
1158 bluez_cflags=`pkg-config --cflags bluez`
1159 bluez_libs=`pkg-config --libs bluez`
1160 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
1161 $bluez_libs > /dev/null 2> /dev/null ; then
1163 else
1164 bluez="no"
1168 ##########################################
1169 # kvm probe
1170 if test "$kvm" = "yes" ; then
1171 cat > $TMPC <<EOF
1172 #include <linux/kvm.h>
1173 #if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
1174 #error Invalid KVM version
1175 #endif
1176 #if !defined(KVM_CAP_USER_MEMORY)
1177 #error Missing KVM capability KVM_CAP_USER_MEMORY
1178 #endif
1179 #if !defined(KVM_CAP_SET_TSS_ADDR)
1180 #error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1181 #endif
1182 #if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1183 #error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1184 #endif
1185 int main(void) { return 0; }
1187 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
1188 > /dev/null 2>/dev/null ; then
1190 else
1191 kvm="no";
1192 if [ -x "`which awk 2>/dev/null`" ] && \
1193 [ -x "`which grep 2>/dev/null`" ]; then
1194 kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
1195 | grep "error: " \
1196 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1197 if test "$kvmerr" != "" ; then
1198 kvm="no - (${kvmerr})"
1204 ##########################################
1205 # AIO probe
1206 AIOLIBS=""
1208 if test "$aio" = "yes" ; then
1209 aio=no
1210 cat > $TMPC << EOF
1211 #include <pthread.h>
1212 int main(void) { pthread_mutex_t lock; return 0; }
1214 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
1215 aio=yes
1216 AIOLIBS="-lpthread"
1220 ##########################################
1221 # iovec probe
1222 cat > $TMPC <<EOF
1223 #include <sys/types.h>
1224 #include <sys/uio.h>
1225 #include <unistd.h>
1226 int main(void) { struct iovec iov; return 0; }
1228 iovec=no
1229 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1230 iovec=yes
1233 ##########################################
1234 # preadv probe
1235 cat > $TMPC <<EOF
1236 #include <sys/types.h>
1237 #include <sys/uio.h>
1238 #include <unistd.h>
1239 int main(void) { preadv; }
1241 preadv=no
1242 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1243 preadv=yes
1246 ##########################################
1247 # fdt probe
1248 if test "$fdt" = "yes" ; then
1249 fdt=no
1250 cat > $TMPC << EOF
1251 int main(void) { return 0; }
1253 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null ; then
1254 fdt=yes
1259 # Check for xxxat() functions when we are building linux-user
1260 # emulator. This is done because older glibc versions don't
1261 # have syscall stubs for these implemented.
1263 atfile=no
1264 if [ "$linux_user" = "yes" ] ; then
1265 cat > $TMPC << EOF
1266 #define _ATFILE_SOURCE
1267 #include <sys/types.h>
1268 #include <fcntl.h>
1269 #include <unistd.h>
1272 main(void)
1274 /* try to unlink nonexisting file */
1275 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1278 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1279 atfile=yes
1283 # Check for inotify functions when we are building linux-user
1284 # emulator. This is done because older glibc versions don't
1285 # have syscall stubs for these implemented. In that case we
1286 # don't provide them even if kernel supports them.
1288 inotify=no
1289 if [ "$linux_user" = "yes" ] ; then
1290 cat > $TMPC << EOF
1291 #include <sys/inotify.h>
1294 main(void)
1296 /* try to start inotify */
1297 return inotify_init();
1300 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1301 inotify=yes
1305 ##########################################
1306 # signalfd probe
1307 cat > $TMPC << EOF
1308 #define _GNU_SOURCE
1309 #include <unistd.h>
1310 #include <sys/syscall.h>
1311 #include <signal.h>
1312 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
1315 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1316 signalfd=yes
1319 ##########################################
1320 # eventfd probe
1321 cat > $TMPC << EOF
1322 #define _GNU_SOURCE
1323 #include <unistd.h>
1324 #include <sys/syscall.h>
1325 int main(void) { return syscall(SYS_eventfd, 0); }
1328 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1329 eventfd=yes
1332 # Check if tools are available to build documentation.
1333 if [ -x "`which texi2html 2>/dev/null`" ] && \
1334 [ -x "`which pod2man 2>/dev/null`" ]; then
1335 build_docs="yes"
1338 ##########################################
1339 # Do we need librt
1340 cat > $TMPC <<EOF
1341 #include <signal.h>
1342 #include <time.h>
1343 int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1346 rt=no
1347 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1349 elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
1350 rt=yes
1353 if test "$rt" = "yes" ; then
1354 # Hack, we should have a general purpose LIBS for this sort of thing
1355 AIOLIBS="$AIOLIBS -lrt"
1358 if test "$mingw32" = "yes" ; then
1359 if test -z "$prefix" ; then
1360 prefix="c:\\\\Program Files\\\\Qemu"
1362 mansuffix=""
1363 datasuffix=""
1364 docsuffix=""
1365 binsuffix=""
1366 else
1367 if test -z "$prefix" ; then
1368 prefix="/usr/local"
1370 mansuffix="/share/man"
1371 datasuffix="/share/qemu"
1372 docsuffix="/share/doc/qemu"
1373 binsuffix="/bin"
1376 echo "Install prefix $prefix"
1377 echo "BIOS directory $prefix$datasuffix"
1378 echo "binary directory $prefix$binsuffix"
1379 if test "$mingw32" = "no" ; then
1380 echo "Manual directory $prefix$mansuffix"
1381 echo "ELF interp prefix $interp_prefix"
1383 echo "Source path $source_path"
1384 echo "C compiler $cc"
1385 echo "Host C compiler $host_cc"
1386 echo "ARCH_CFLAGS $ARCH_CFLAGS"
1387 echo "make $make"
1388 echo "install $install"
1389 echo "host CPU $cpu"
1390 echo "host big endian $bigendian"
1391 echo "target list $target_list"
1392 echo "tcg debug enabled $debug_tcg"
1393 echo "gprof enabled $gprof"
1394 echo "sparse enabled $sparse"
1395 echo "strip binaries $strip_opt"
1396 echo "profiler $profiler"
1397 echo "static build $static"
1398 echo "-Werror enabled $werror"
1399 if test "$darwin" = "yes" ; then
1400 echo "Cocoa support $cocoa"
1402 echo "SDL support $sdl"
1403 if test "$sdl" != "no" ; then
1404 echo "SDL static link $sdl_static"
1406 echo "curses support $curses"
1407 echo "mingw32 support $mingw32"
1408 echo "Audio drivers $audio_drv_list"
1409 echo "Extra audio cards $audio_card_list"
1410 echo "Mixer emulation $mixemu"
1411 echo "VNC TLS support $vnc_tls"
1412 if test "$vnc_tls" = "yes" ; then
1413 echo " TLS CFLAGS $vnc_tls_cflags"
1414 echo " TLS LIBS $vnc_tls_libs"
1416 echo "VNC SASL support $vnc_sasl"
1417 if test "$vnc_sasl" = "yes" ; then
1418 echo " SASL CFLAGS $vnc_sasl_cflags"
1419 echo " SASL LIBS $vnc_sasl_libs"
1421 if test -n "$sparc_cpu"; then
1422 echo "Target Sparc Arch $sparc_cpu"
1424 echo "kqemu support $kqemu"
1425 echo "xen support $xen"
1426 echo "CPU emulation $cpu_emulation"
1427 echo "brlapi support $brlapi"
1428 echo "Documentation $build_docs"
1429 [ ! -z "$uname_release" ] && \
1430 echo "uname -r $uname_release"
1431 echo "NPTL support $nptl"
1432 echo "vde support $vde"
1433 echo "AIO support $aio"
1434 echo "Install blobs $blobs"
1435 echo "KVM support $kvm"
1436 echo "fdt support $fdt"
1437 echo "preadv support $preadv"
1439 if test $sdl_too_old = "yes"; then
1440 echo "-> Your SDL version is too old - please upgrade to have SDL support"
1442 if [ -s $TMPSDLLOG ]; then
1443 echo "The error log from compiling the libSDL test is: "
1444 cat $TMPSDLLOG
1446 #if test "$sdl_static" = "no"; then
1447 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1449 config_mak="config-host.mak"
1450 config_h="config-host.h"
1452 #echo "Creating $config_mak and $config_h"
1454 test -f $config_h && mv $config_h ${config_h}~
1456 echo "# Automatically generated by configure - do not modify" > $config_mak
1457 printf "# Configured with:" >> $config_mak
1458 printf " '%s'" "$0" "$@" >> $config_mak
1459 echo >> $config_mak
1460 echo "/* Automatically generated by configure - do not modify */" > $config_h
1462 echo "prefix=$prefix" >> $config_mak
1463 echo "bindir=\${prefix}$binsuffix" >> $config_mak
1464 echo "mandir=\${prefix}$mansuffix" >> $config_mak
1465 echo "datadir=\${prefix}$datasuffix" >> $config_mak
1466 echo "docdir=\${prefix}$docsuffix" >> $config_mak
1467 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
1468 echo "MAKE=$make" >> $config_mak
1469 echo "INSTALL=$install" >> $config_mak
1470 echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_mak
1471 echo "INSTALL_DATA=$install -m0644 -p" >> $config_mak
1472 echo "INSTALL_PROG=$install -m0755 -p" >> $config_mak
1473 echo "CC=$cc" >> $config_mak
1474 echo "HOST_CC=$host_cc" >> $config_mak
1475 echo "AR=$ar" >> $config_mak
1476 # XXX: only use CFLAGS and LDFLAGS ?
1477 # XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1478 # compilation of dyngen tool (useful for win32 build on Linux host)
1479 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
1480 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1481 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1482 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
1483 echo "CFLAGS=$CFLAGS" >> $config_mak
1484 echo "LDFLAGS=$LDFLAGS" >> $config_mak
1485 echo "EXESUF=$EXESUF" >> $config_mak
1486 echo "AIOLIBS=$AIOLIBS" >> $config_mak
1487 case "$cpu" in
1488 i386)
1489 echo "ARCH=i386" >> $config_mak
1490 echo "#define HOST_I386 1" >> $config_h
1492 x86_64)
1493 echo "ARCH=x86_64" >> $config_mak
1494 echo "#define HOST_X86_64 1" >> $config_h
1496 alpha)
1497 echo "ARCH=alpha" >> $config_mak
1498 echo "#define HOST_ALPHA 1" >> $config_h
1500 armv4b)
1501 echo "ARCH=arm" >> $config_mak
1502 echo "#define HOST_ARM 1" >> $config_h
1504 armv4l)
1505 echo "ARCH=arm" >> $config_mak
1506 echo "#define HOST_ARM 1" >> $config_h
1508 cris)
1509 echo "ARCH=cris" >> $config_mak
1510 echo "#define HOST_CRIS 1" >> $config_h
1512 hppa)
1513 echo "ARCH=hppa" >> $config_mak
1514 echo "#define HOST_HPPA 1" >> $config_h
1516 ia64)
1517 echo "ARCH=ia64" >> $config_mak
1518 echo "#define HOST_IA64 1" >> $config_h
1520 m68k)
1521 echo "ARCH=m68k" >> $config_mak
1522 echo "#define HOST_M68K 1" >> $config_h
1524 mips)
1525 echo "ARCH=mips" >> $config_mak
1526 echo "#define HOST_MIPS 1" >> $config_h
1528 mips64)
1529 echo "ARCH=mips64" >> $config_mak
1530 echo "#define HOST_MIPS64 1" >> $config_h
1532 ppc)
1533 echo "ARCH=ppc" >> $config_mak
1534 echo "#define HOST_PPC 1" >> $config_h
1536 ppc64)
1537 echo "ARCH=ppc64" >> $config_mak
1538 echo "#define HOST_PPC64 1" >> $config_h
1540 s390)
1541 echo "ARCH=s390" >> $config_mak
1542 echo "#define HOST_S390 1" >> $config_h
1544 sparc)
1545 echo "ARCH=sparc" >> $config_mak
1546 echo "#define HOST_SPARC 1" >> $config_h
1548 sparc64)
1549 echo "ARCH=sparc64" >> $config_mak
1550 echo "#define HOST_SPARC64 1" >> $config_h
1553 echo "Unsupported CPU = $cpu"
1554 exit 1
1556 esac
1557 if test "$debug_tcg" = "yes" ; then
1558 echo "#define DEBUG_TCG 1" >> $config_h
1560 if test "$sparse" = "yes" ; then
1561 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1562 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1563 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1565 if test "$strip_opt" = "yes" ; then
1566 echo "STRIP_OPT=-s" >> $config_mak
1568 if test "$bigendian" = "yes" ; then
1569 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1570 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1572 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
1573 if test "$mingw32" = "yes" ; then
1574 echo "CONFIG_WIN32=yes" >> $config_mak
1575 echo "#define CONFIG_WIN32 1" >> $config_h
1576 else
1577 cat > $TMPC << EOF
1578 #include <byteswap.h>
1579 int main(void) { return bswap_32(0); }
1581 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
1582 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1584 cat > $TMPC << EOF
1585 #include <sys/endian.h>
1586 #include <sys/types.h>
1587 #include <machine/bswap.h>
1588 int main(void) { return bswap32(0); }
1590 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
1591 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1595 if [ "$openbsd" = "yes" ] ; then
1596 echo "#define ENOTSUP 4096" >> $config_h
1599 if test "$darwin" = "yes" ; then
1600 echo "CONFIG_DARWIN=yes" >> $config_mak
1601 echo "#define CONFIG_DARWIN 1" >> $config_h
1604 if test "$aix" = "yes" ; then
1605 echo "CONFIG_AIX=yes" >> $config_mak
1606 echo "#define CONFIG_AIX 1" >> $config_h
1609 if test "$solaris" = "yes" ; then
1610 echo "CONFIG_SOLARIS=yes" >> $config_mak
1611 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
1612 if test "$needs_libsunmath" = "yes" ; then
1613 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1614 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1617 if test -n "$sparc_cpu"; then
1618 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1619 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1621 if test "$gdbstub" = "yes" ; then
1622 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1623 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1625 if test "$gprof" = "yes" ; then
1626 echo "TARGET_GPROF=yes" >> $config_mak
1627 echo "#define HAVE_GPROF 1" >> $config_h
1629 if test "$static" = "yes" ; then
1630 echo "CONFIG_STATIC=yes" >> $config_mak
1631 echo "#define CONFIG_STATIC 1" >> $config_h
1633 if test $profiler = "yes" ; then
1634 echo "#define CONFIG_PROFILER 1" >> $config_h
1636 if test "$slirp" = "yes" ; then
1637 echo "CONFIG_SLIRP=yes" >> $config_mak
1638 echo "#define CONFIG_SLIRP 1" >> $config_h
1640 if test "$vde" = "yes" ; then
1641 echo "CONFIG_VDE=yes" >> $config_mak
1642 echo "#define CONFIG_VDE 1" >> $config_h
1643 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1645 for card in $audio_card_list; do
1646 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
1647 echo "$def=yes" >> $config_mak
1648 echo "#define $def 1" >> $config_h
1649 done
1650 echo "#define AUDIO_DRIVERS \\" >> $config_h
1651 for drv in $audio_drv_list; do
1652 echo " &${drv}_audio_driver, \\" >>$config_h
1653 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
1654 echo "$def=yes" >> $config_mak
1655 if test "$drv" = "fmod"; then
1656 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1657 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1658 elif test "$drv" = "oss"; then
1659 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
1661 done
1662 echo "" >>$config_h
1663 if test "$mixemu" = "yes" ; then
1664 echo "CONFIG_MIXEMU=yes" >> $config_mak
1665 echo "#define CONFIG_MIXEMU 1" >> $config_h
1667 if test "$vnc_tls" = "yes" ; then
1668 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1669 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1670 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1671 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1673 if test "$vnc_sasl" = "yes" ; then
1674 echo "CONFIG_VNC_SASL=yes" >> $config_mak
1675 echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1676 echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1677 echo "#define CONFIG_VNC_SASL 1" >> $config_h
1679 if test "$fnmatch" = "yes" ; then
1680 echo "#define HAVE_FNMATCH_H 1" >> $config_h
1682 qemu_version=`head $source_path/VERSION`
1683 echo "VERSION=$qemu_version" >>$config_mak
1684 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1685 echo "#define KVM_VERSION \"kvm-devel\"" >> $config_h
1687 echo "#define QEMU_PKGVERSION \"$pkgversion\"" >> $config_h
1689 echo "SRC_PATH=$source_path" >> $config_mak
1690 if [ "$source_path_used" = "yes" ]; then
1691 echo "VPATH=$source_path" >> $config_mak
1693 echo "TARGET_DIRS=$target_list" >> $config_mak
1694 if [ "$build_docs" = "yes" ] ; then
1695 echo "BUILD_DOCS=yes" >> $config_mak
1697 if test "$static" = "yes"; then
1698 sdl1=$sdl_static
1699 else
1700 sdl1=$sdl
1702 if test "$sdl1" = "yes" ; then
1703 echo "#define CONFIG_SDL 1" >> $config_h
1704 echo "CONFIG_SDL=yes" >> $config_mak
1705 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1706 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1707 elif test "$sdl_x11" = "yes" ; then
1708 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
1709 else
1710 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1712 if [ "${aa}" = "yes" ] ; then
1713 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1714 else
1715 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1718 if test "$cocoa" = "yes" ; then
1719 echo "#define CONFIG_COCOA 1" >> $config_h
1720 echo "CONFIG_COCOA=yes" >> $config_mak
1722 if test "$curses" = "yes" ; then
1723 echo "#define CONFIG_CURSES 1" >> $config_h
1724 echo "CONFIG_CURSES=yes" >> $config_mak
1725 echo "CURSES_LIBS=-lcurses" >> $config_mak
1727 if test "$atfile" = "yes" ; then
1728 echo "#define CONFIG_ATFILE 1" >> $config_h
1730 if test "$inotify" = "yes" ; then
1731 echo "#define CONFIG_INOTIFY 1" >> $config_h
1733 if test "$brlapi" = "yes" ; then
1734 echo "CONFIG_BRLAPI=yes" >> $config_mak
1735 echo "#define CONFIG_BRLAPI 1" >> $config_h
1736 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1738 if test "$bluez" = "yes" ; then
1739 echo "CONFIG_BLUEZ=yes" >> $config_mak
1740 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1741 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1742 echo "#define CONFIG_BLUEZ 1" >> $config_h
1744 if test "$xen" = "yes" ; then
1745 echo "XEN_LIBS=-lxenstore -lxenctrl -lxenguest" >> $config_mak
1747 if test "$aio" = "yes" ; then
1748 echo "#define CONFIG_AIO 1" >> $config_h
1749 echo "CONFIG_AIO=yes" >> $config_mak
1751 if test "$blobs" = "yes" ; then
1752 echo "INSTALL_BLOBS=yes" >> $config_mak
1754 if test "$iovec" = "yes" ; then
1755 echo "#define HAVE_IOVEC 1" >> $config_h
1757 if test "$preadv" = "yes" ; then
1758 echo "#define HAVE_PREADV 1" >> $config_h
1760 if test "$fdt" = "yes" ; then
1761 echo "#define HAVE_FDT 1" >> $config_h
1762 echo "FDT_LIBS=-lfdt" >> $config_mak
1764 if test "$signalfd" = "yes" ; then
1765 echo "#define CONFIG_signalfd 1" >> $config_h
1767 if test "$eventfd" = "yes" ; then
1768 echo "#define CONFIG_eventfd 1" >> $config_h
1771 # XXX: suppress that
1772 if [ "$bsd" = "yes" ] ; then
1773 echo "#define O_LARGEFILE 0" >> $config_h
1774 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1775 echo "#define HOST_BSD 1" >> $config_h
1778 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1780 # USB host support
1781 case "$usb" in
1782 linux)
1783 echo "HOST_USB=linux" >> $config_mak
1785 bsd)
1786 echo "HOST_USB=bsd" >> $config_mak
1789 echo "HOST_USB=stub" >> $config_mak
1791 esac
1793 tools=
1794 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1795 tools="qemu-img\$(EXESUF) $tools"
1796 if [ "$linux" = "yes" ] ; then
1797 tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
1800 echo "TOOLS=$tools" >> $config_mak
1802 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1804 for target in $target_list; do
1805 target_dir="$target"
1806 config_mak=$target_dir/config.mak
1807 config_h=$target_dir/config.h
1808 target_cpu=`echo $target | cut -d '-' -f 1`
1809 target_bigendian="no"
1810 [ "$target_cpu" = "armeb" ] && target_bigendian=yes
1811 [ "$target_cpu" = "m68k" ] && target_bigendian=yes
1812 [ "$target_cpu" = "mips" ] && target_bigendian=yes
1813 [ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1814 [ "$target_cpu" = "mips64" ] && target_bigendian=yes
1815 [ "$target_cpu" = "ppc" ] && target_bigendian=yes
1816 [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
1817 [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
1818 [ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
1819 [ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
1820 [ "$target_cpu" = "sparc" ] && target_bigendian=yes
1821 [ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1822 [ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
1823 target_softmmu="no"
1824 target_user_only="no"
1825 target_linux_user="no"
1826 target_darwin_user="no"
1827 target_bsd_user="no"
1828 case "$target" in
1829 ${target_cpu}-softmmu)
1830 target_softmmu="yes"
1832 ${target_cpu}-linux-user)
1833 target_user_only="yes"
1834 target_linux_user="yes"
1836 ${target_cpu}-darwin-user)
1837 target_user_only="yes"
1838 target_darwin_user="yes"
1840 ${target_cpu}-bsd-user)
1841 target_user_only="yes"
1842 target_bsd_user="yes"
1845 echo "ERROR: Target '$target' not recognised"
1846 exit 1
1848 esac
1850 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1851 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1852 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1853 echo "To build QEMU without graphical output configure with --disable-gfx-check"
1854 echo "Note that this will disable all output from the virtual graphics card"
1855 echo "except through VNC or curses."
1856 exit 1;
1859 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1861 test -f $config_h && mv $config_h ${config_h}~
1863 mkdir -p $target_dir
1864 mkdir -p $target_dir/fpu
1865 mkdir -p $target_dir/tcg
1866 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
1867 mkdir -p $target_dir/nwfpe
1871 # don't use ln -sf as not all "ln -sf" over write the file/link
1873 rm -f $target_dir/Makefile
1874 ln -s $source_path/Makefile.target $target_dir/Makefile
1877 echo "# Automatically generated by configure - do not modify" > $config_mak
1878 echo "/* Automatically generated by configure - do not modify */" > $config_h
1881 echo "include ../config-host.mak" >> $config_mak
1882 echo "#include \"../config-host.h\"" >> $config_h
1884 bflt="no"
1885 elfload32="no"
1886 target_nptl="no"
1887 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1888 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1889 gdb_xml_files=""
1891 disable_cpu_emulation() {
1892 if test $cpu_emulation = "no"; then
1893 echo "#define NO_CPU_EMULATION 1" >> $config_h
1894 echo "NO_CPU_EMULATION=1" >> $config_mak
1898 configure_kvm() {
1899 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
1900 \( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \); then
1901 echo "#define USE_KVM 1" >> $config_h
1902 echo "USE_KVM=1" >> $config_mak
1903 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1904 if test $kvm_cap_pit = "yes" ; then
1905 echo "USE_KVM_PIT=1" >> $config_mak
1906 echo "#define USE_KVM_PIT 1" >> $config_h
1908 if test $kvm_cap_device_assignment = "yes" ; then
1909 echo "USE_KVM_DEVICE_ASSIGNMENT=1" >> $config_mak
1910 echo "#define USE_KVM_DEVICE_ASSIGNMENT 1" >> $config_h
1912 disable_cpu_emulation
1916 if [ use_upstream_kvm = yes ]; then
1918 # Make sure the target and host cpus are compatible
1919 if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
1920 \( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \) -o \
1921 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1922 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
1923 kvm="no"
1925 # Disable KVM for linux-user
1926 if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1927 kvm="no"
1932 case "$target_cpu" in
1933 i386)
1934 echo "TARGET_ARCH=i386" >> $config_mak
1935 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1936 echo "#define TARGET_I386 1" >> $config_h
1937 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
1938 then
1939 echo "CONFIG_KQEMU=yes" >> $config_mak
1940 echo "#define CONFIG_KQEMU 1" >> $config_h
1942 if test "$kvm" = "yes" ; then
1943 echo "USE_KVM=yes" >> $config_mak
1944 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1945 echo "#define USE_KVM 1" >> $config_h
1947 if test "$xen" = "yes" -a "$target_softmmu" = "yes";
1948 then
1949 echo "CONFIG_XEN=yes" >> $config_mak
1950 echo "#define CONFIG_XEN 1" >> $config_h
1952 configure_kvm
1954 x86_64)
1955 echo "TARGET_ARCH=x86_64" >> $config_mak
1956 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1957 echo "#define TARGET_I386 1" >> $config_h
1958 echo "#define TARGET_X86_64 1" >> $config_h
1959 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1960 then
1961 echo "CONFIG_KQEMU=yes" >> $config_mak
1962 echo "#define CONFIG_KQEMU 1" >> $config_h
1964 configure_kvm
1966 ia64)
1967 echo "TARGET_ARCH=ia64" >> $config_mak
1968 echo "#define TARGET_ARCH \"ia64\"" >> $config_h
1969 echo "#define TARGET_IA64 1" >> $config_h
1970 configure_kvm
1971 if [ use_upstream_kvm = yes ]; then
1972 if test "$kvm" = "yes" ; then
1973 echo "USE_KVM=yes" >> $config_mak
1974 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1975 echo "#define USE_KVM 1" >> $config_h
1978 if test "$xen" = "yes" -a "$target_softmmu" = "yes"
1979 then
1980 echo "CONFIG_XEN=yes" >> $config_mak
1981 echo "#define CONFIG_XEN 1" >> $config_h
1984 alpha)
1985 echo "TARGET_ARCH=alpha" >> $config_mak
1986 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1987 echo "#define TARGET_ALPHA 1" >> $config_h
1989 arm|armeb)
1990 echo "TARGET_ARCH=arm" >> $config_mak
1991 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1992 echo "#define TARGET_ARM 1" >> $config_h
1993 bflt="yes"
1994 target_nptl="yes"
1995 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
1997 cris)
1998 echo "TARGET_ARCH=cris" >> $config_mak
1999 echo "#define TARGET_ARCH \"cris\"" >> $config_h
2000 echo "#define TARGET_CRIS 1" >> $config_h
2001 target_nptl="yes"
2003 m68k)
2004 echo "TARGET_ARCH=m68k" >> $config_mak
2005 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
2006 echo "#define TARGET_M68K 1" >> $config_h
2007 bflt="yes"
2008 gdb_xml_files="cf-core.xml cf-fp.xml"
2010 mips|mipsel)
2011 echo "TARGET_ARCH=mips" >> $config_mak
2012 echo "#define TARGET_ARCH \"mips\"" >> $config_h
2013 echo "#define TARGET_MIPS 1" >> $config_h
2014 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
2016 mipsn32|mipsn32el)
2017 echo "TARGET_ARCH=mipsn32" >> $config_mak
2018 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
2019 echo "#define TARGET_MIPS 1" >> $config_h
2020 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
2022 mips64|mips64el)
2023 echo "TARGET_ARCH=mips64" >> $config_mak
2024 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
2025 echo "#define TARGET_MIPS 1" >> $config_h
2026 echo "#define TARGET_MIPS64 1" >> $config_h
2027 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
2029 ppc)
2030 echo "TARGET_ARCH=ppc" >> $config_mak
2031 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
2032 echo "#define TARGET_PPC 1" >> $config_h
2033 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2035 ppcemb)
2036 echo "TARGET_ARCH=ppcemb" >> $config_mak
2037 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2038 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
2039 echo "#define TARGET_PPC 1" >> $config_h
2040 echo "#define TARGET_PPCEMB 1" >> $config_h
2041 if test "$kvm" = "yes" ; then
2042 echo "USE_KVM=yes" >> $config_mak
2043 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
2044 echo "#define USE_KVM 1" >> $config_h
2046 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2048 ppc64)
2049 echo "TARGET_ARCH=ppc64" >> $config_mak
2050 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2051 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
2052 echo "#define TARGET_PPC 1" >> $config_h
2053 echo "#define TARGET_PPC64 1" >> $config_h
2054 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2056 ppc64abi32)
2057 echo "TARGET_ARCH=ppc64" >> $config_mak
2058 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2059 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
2060 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
2061 echo "#define TARGET_PPC 1" >> $config_h
2062 echo "#define TARGET_PPC64 1" >> $config_h
2063 echo "#define TARGET_ABI32 1" >> $config_h
2064 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2066 sh4|sh4eb)
2067 echo "TARGET_ARCH=sh4" >> $config_mak
2068 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
2069 echo "#define TARGET_SH4 1" >> $config_h
2070 bflt="yes"
2071 target_nptl="yes"
2073 sparc)
2074 echo "TARGET_ARCH=sparc" >> $config_mak
2075 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
2076 echo "#define TARGET_SPARC 1" >> $config_h
2078 sparc64)
2079 echo "TARGET_ARCH=sparc64" >> $config_mak
2080 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
2081 echo "#define TARGET_SPARC 1" >> $config_h
2082 echo "#define TARGET_SPARC64 1" >> $config_h
2083 elfload32="yes"
2085 sparc32plus)
2086 echo "TARGET_ARCH=sparc64" >> $config_mak
2087 echo "TARGET_ABI_DIR=sparc" >> $config_mak
2088 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
2089 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
2090 echo "#define TARGET_SPARC 1" >> $config_h
2091 echo "#define TARGET_SPARC64 1" >> $config_h
2092 echo "#define TARGET_ABI32 1" >> $config_h
2095 echo "Unsupported target CPU"
2096 exit 1
2098 esac
2099 if test "$target_bigendian" = "yes" ; then
2100 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
2101 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
2103 if test "$target_softmmu" = "yes" ; then
2104 echo "CONFIG_SOFTMMU=yes" >> $config_mak
2105 echo "#define CONFIG_SOFTMMU 1" >> $config_h
2107 if test "$target_user_only" = "yes" ; then
2108 echo "CONFIG_USER_ONLY=yes" >> $config_mak
2109 echo "#define CONFIG_USER_ONLY 1" >> $config_h
2111 if test "$target_linux_user" = "yes" ; then
2112 echo "CONFIG_LINUX_USER=yes" >> $config_mak
2113 echo "#define CONFIG_LINUX_USER 1" >> $config_h
2115 if test "$target_darwin_user" = "yes" ; then
2116 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
2117 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
2119 list=""
2120 if test ! -z "$gdb_xml_files" ; then
2121 for x in $gdb_xml_files; do
2122 list="$list $source_path/gdb-xml/$x"
2123 done
2125 echo "TARGET_XML_FILES=$list" >> $config_mak
2127 if test "$target_cpu" = "arm" \
2128 -o "$target_cpu" = "armeb" \
2129 -o "$target_cpu" = "m68k" \
2130 -o "$target_cpu" = "mips" \
2131 -o "$target_cpu" = "mipsel" \
2132 -o "$target_cpu" = "mipsn32" \
2133 -o "$target_cpu" = "mipsn32el" \
2134 -o "$target_cpu" = "mips64" \
2135 -o "$target_cpu" = "mips64el" \
2136 -o "$target_cpu" = "ppc" \
2137 -o "$target_cpu" = "ppc64" \
2138 -o "$target_cpu" = "ppc64abi32" \
2139 -o "$target_cpu" = "ppcemb" \
2140 -o "$target_cpu" = "sparc" \
2141 -o "$target_cpu" = "sparc64" \
2142 -o "$target_cpu" = "sparc32plus"; then
2143 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
2144 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
2146 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
2147 echo "TARGET_HAS_BFLT=yes" >> $config_mak
2148 echo "#define TARGET_HAS_BFLT 1" >> $config_h
2150 if test "$target_user_only" = "yes" \
2151 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
2152 echo "#define USE_NPTL 1" >> $config_h
2154 # 32 bit ELF loader in addition to native 64 bit loader?
2155 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
2156 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
2157 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
2159 if test "$target_bsd_user" = "yes" ; then
2160 echo "CONFIG_BSD_USER=yes" >> $config_mak
2161 echo "#define CONFIG_BSD_USER 1" >> $config_h
2164 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
2166 done # for target in $targets
2168 # build tree in object directory if source path is different from current one
2169 if test "$source_path_used" = "yes" ; then
2170 DIRS="tests tests/cris slirp audio"
2171 FILES="Makefile tests/Makefile"
2172 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
2173 FILES="$FILES tests/test-mmap.c"
2174 for dir in $DIRS ; do
2175 mkdir -p $dir
2176 done
2177 # remove the link and recreate it, as not all "ln -sf" overwrite the link
2178 for f in $FILES ; do
2179 rm -f $f
2180 ln -s $source_path/$f $f
2181 done