Propagate make clean into libkvm directory
[qemu-kvm/fedora.git] / configure
blobf16daea22d97c4ffc587b6d96a04be2058f3d55e
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
156 kvm_version() {
157 local fname="$(dirname "$0")/KVM_VERSION"
159 if test -f "$fname"; then
160 cat "$fname"
161 else
162 echo "kvm-devel"
166 gprof="no"
167 debug_tcg="no"
168 sparse="no"
169 strip_opt="yes"
170 bigendian="no"
171 mingw32="no"
172 EXESUF=""
173 gdbstub="yes"
174 slirp="yes"
175 vde="yes"
176 fmod_lib=""
177 fmod_inc=""
178 oss_lib=""
179 vnc_tls="yes"
180 vnc_sasl="yes"
181 bsd="no"
182 linux="no"
183 solaris="no"
184 kqemu="no"
185 profiler="no"
186 cocoa="no"
187 check_gfx="yes"
188 softmmu="yes"
189 linux_user="no"
190 darwin_user="no"
191 bsd_user="no"
192 build_docs="no"
193 uname_release=""
194 curses="yes"
195 aio="yes"
196 nptl="yes"
197 mixemu="no"
198 bluez="yes"
199 kvm="yes"
200 kvm_cap_pit="no"
201 kvm_cap_device_assignment="no"
202 kerneldir=""
203 aix="no"
204 blobs="yes"
205 fdt="yes"
206 sdl_x11="no"
207 xen="yes"
208 pkgversion=" ($(kvm_version))"
209 signalfd="no"
210 eventfd="no"
211 cpu_emulation="yes"
213 # OS specific
214 if check_define __linux__ ; then
215 targetos="Linux"
216 elif check_define _WIN32 ; then
217 targetos='MINGW32'
218 elif check_define __OpenBSD__ ; then
219 targetos='OpenBSD'
220 elif check_define __sun__ ; then
221 targetos='SunOS'
222 else
223 targetos=`uname -s`
225 case $targetos in
226 CYGWIN*)
227 mingw32="yes"
228 OS_CFLAGS="-mno-cygwin"
229 if [ "$cpu" = "i386" ] ; then
230 kqemu="yes"
232 audio_possible_drivers="sdl"
234 MINGW32*)
235 mingw32="yes"
236 if [ "$cpu" = "i386" ] ; then
237 kqemu="yes"
239 audio_possible_drivers="dsound sdl fmod"
241 GNU/kFreeBSD)
242 audio_drv_list="oss"
243 audio_possible_drivers="oss sdl esd pa"
244 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
245 kqemu="yes"
248 FreeBSD)
249 bsd="yes"
250 audio_drv_list="oss"
251 audio_possible_drivers="oss sdl esd pa"
252 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
253 kqemu="yes"
254 kvm="yes"
257 DragonFly)
258 bsd="yes"
259 audio_drv_list="oss"
260 audio_possible_drivers="oss sdl esd pa"
261 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
262 kqemu="yes"
264 aio="no"
266 NetBSD)
267 bsd="yes"
268 audio_drv_list="oss"
269 audio_possible_drivers="oss sdl esd"
270 oss_lib="-lossaudio"
272 OpenBSD)
273 bsd="yes"
274 openbsd="yes"
275 audio_drv_list="oss"
276 audio_possible_drivers="oss sdl esd"
277 oss_lib="-lossaudio"
279 Darwin)
280 bsd="yes"
281 darwin="yes"
282 # 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
283 if [ "$cpu" = "i386" ] ; then
284 is_x86_64=`sysctl -n hw.optional.x86_64`
285 [ "$is_x86_64" = "1" ] && cpu=x86_64
287 if [ "$cpu" = "x86_64" ] ; then
288 OS_CFLAGS="-arch x86_64"
289 LDFLAGS="-arch x86_64"
290 else
291 OS_CFLAGS="-mdynamic-no-pic"
293 darwin_user="yes"
294 cocoa="yes"
295 audio_drv_list="coreaudio"
296 audio_possible_drivers="coreaudio sdl fmod"
297 OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
299 SunOS)
300 solaris="yes"
301 make="gmake"
302 install="ginstall"
303 needs_libsunmath="no"
304 kvm="no"
305 solarisrev=`uname -r | cut -f2 -d.`
306 # have to select again, because `uname -m` returns i86pc
307 # even on an x86_64 box.
308 solariscpu=`isainfo -k`
309 if test "${solariscpu}" = "amd64" ; then
310 cpu="x86_64"
312 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
313 if test "$solarisrev" -le 9 ; then
314 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
315 needs_libsunmath="yes"
316 else
317 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
318 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
319 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
320 echo "Studio 11 can be downloaded from www.sun.com."
321 exit 1
324 if test "$solarisrev" -ge 9 ; then
325 kqemu="yes"
328 if test -f /usr/include/sys/soundcard.h ; then
329 audio_drv_list="oss"
331 audio_possible_drivers="oss sdl"
332 OS_CFLAGS=-std=gnu99
334 AIX)
335 aix="yes"
336 make="gmake"
339 audio_drv_list="oss"
340 audio_possible_drivers="oss alsa sdl esd pa"
341 linux="yes"
342 linux_user="yes"
343 usb="linux"
344 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
345 kqemu="yes"
346 audio_possible_drivers="$audio_possible_drivers fmod"
347 kvm="yes"
348 kqemu="no"
350 if [ "$cpu" = "ia64" ] ; then
351 kvm="yes"
352 xen="no"
353 target_list="ia64-softmmu"
354 cpu_emulation="no"
355 gdbstub="no"
356 slirp="no"
358 if [ "$cpu" = "powerpc" ]; then
359 kvm="yes"
362 esac
364 if [ "$bsd" = "yes" ] ; then
365 if [ "$darwin" != "yes" ] ; then
366 make="gmake"
367 usb="bsd"
369 bsd_user="yes"
372 # find source path
373 source_path=`dirname "$0"`
374 source_path_used="no"
375 workdir=`pwd`
376 if [ -z "$source_path" ]; then
377 source_path=$workdir
378 else
379 source_path=`cd "$source_path"; pwd`
381 [ -f "$workdir/vl.c" ] || source_path_used="yes"
383 werror="no"
384 # generate compile errors on warnings for development builds
385 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
386 #werror="yes";
389 for opt do
390 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
391 case "$opt" in
392 --help|-h) show_help=yes
394 --prefix=*) prefix="$optarg"
396 --interp-prefix=*) interp_prefix="$optarg"
398 --source-path=*) source_path="$optarg"
399 source_path_used="yes"
401 --cross-prefix=*)
403 --cc=*)
405 --host-cc=*) host_cc="$optarg"
407 --make=*) make="$optarg"
409 --install=*) install="$optarg"
411 --extra-cflags=*) CFLAGS="$optarg"
413 --extra-ldflags=*) LDFLAGS="$optarg"
415 --cpu=*) cpu="$optarg"
417 --target-list=*) target_list="$optarg"
419 --enable-gprof) gprof="yes"
421 --static) static="yes"
423 --disable-sdl) sdl="no"
425 --fmod-lib=*) fmod_lib="$optarg"
427 --fmod-inc=*) fmod_inc="$optarg"
429 --oss-lib=*) oss_lib="$optarg"
431 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
433 --audio-drv-list=*) audio_drv_list="$optarg"
435 --enable-debug-tcg) debug_tcg="yes"
437 --disable-debug-tcg) debug_tcg="no"
439 --enable-sparse) sparse="yes"
441 --disable-sparse) sparse="no"
443 --disable-strip) strip_opt="no"
445 --disable-vnc-tls) vnc_tls="no"
447 --disable-vnc-sasl) vnc_sasl="no"
449 --disable-slirp) slirp="no"
451 --disable-vde) vde="no"
453 --disable-kqemu) kqemu="no"
455 --disable-xen) xen="no"
457 --disable-brlapi) brlapi="no"
459 --disable-bluez) bluez="no"
461 --disable-kvm) kvm="no"
463 --enable-profiler) profiler="yes"
465 --enable-cocoa)
466 cocoa="yes" ;
467 sdl="no" ;
468 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
470 --disable-gfx-check) check_gfx="no"
472 --disable-system) softmmu="no"
474 --enable-system) softmmu="yes"
476 --disable-linux-user) linux_user="no"
478 --enable-linux-user) linux_user="yes"
480 --disable-darwin-user) darwin_user="no"
482 --enable-darwin-user) darwin_user="yes"
484 --disable-bsd-user) bsd_user="no"
486 --enable-bsd-user) bsd_user="yes"
488 --enable-uname-release=*) uname_release="$optarg"
490 --sparc_cpu=*)
491 sparc_cpu="$optarg"
492 case $sparc_cpu in
493 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
494 target_cpu="sparc"; cpu="sparc" ;;
495 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
496 target_cpu="sparc"; cpu="sparc" ;;
497 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
498 target_cpu="sparc64"; cpu="sparc64" ;;
499 *) echo "undefined SPARC architecture. Exiting";exit 1;;
500 esac
502 --enable-werror) werror="yes"
504 --disable-werror) werror="no"
506 --disable-curses) curses="no"
508 --disable-nptl) nptl="no"
510 --enable-mixemu) mixemu="yes"
512 --disable-aio) aio="no"
514 --disable-blobs) blobs="no"
516 --kerneldir=*) kerneldir="$optarg"
518 --with-pkgversion=*) pkgversion=" ($optarg)"
520 --disable-cpu-emulation) cpu_emulation="no"
522 *) echo "ERROR: unknown option $opt"; exit 1
524 esac
525 done
527 # default flags for all hosts
528 CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
529 CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
530 LDFLAGS="$LDFLAGS -g"
531 if test "$werror" = "yes" ; then
532 CFLAGS="$CFLAGS -Werror"
535 CFLAGS="$CFLAGS -I$(readlink -f "$source_path/kvm/libkvm")"
537 if test "$solaris" = "no" ; then
538 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
539 LDFLAGS="$LDFLAGS -Wl,--warn-common"
544 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
545 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
547 case "$cpu" in
548 sparc) if test -z "$sparc_cpu" ; then
549 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
550 ARCH_LDFLAGS="-m32"
551 else
552 ARCH_CFLAGS="${SP_CFLAGS}"
553 ARCH_LDFLAGS="${SP_LDFLAGS}"
555 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g2 -ffixed-g3"
556 if test "$solaris" = "no" ; then
557 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g6"
560 sparc64) if test -z "$sparc_cpu" ; then
561 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
562 ARCH_LDFLAGS="-m64"
563 else
564 ARCH_CFLAGS="${SP_CFLAGS}"
565 ARCH_LDFLAGS="${SP_LDFLAGS}"
567 if test "$solaris" = "no" ; then
568 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g5 -ffixed-g6 -ffixed-g7"
569 else
570 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7"
573 s390)
574 ARCH_CFLAGS="-march=z900"
576 i386)
577 ARCH_CFLAGS="-m32"
578 ARCH_LDFLAGS="-m32"
580 x86_64)
581 ARCH_CFLAGS="-m64"
582 ARCH_LDFLAGS="-m64"
584 esac
586 if test x"$show_help" = x"yes" ; then
587 cat << EOF
589 Usage: configure [options]
590 Options: [defaults in brackets after descriptions]
593 echo "Standard options:"
594 echo " --help print this message"
595 echo " --prefix=PREFIX install in PREFIX [$prefix]"
596 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
597 echo " use %M for cpu name [$interp_prefix]"
598 echo " --target-list=LIST set target list [$target_list]"
599 echo ""
600 echo "kqemu kernel acceleration support:"
601 echo " --disable-kqemu disable kqemu support"
602 echo ""
603 echo "Advanced options (experts only):"
604 echo " --source-path=PATH path of source code [$source_path]"
605 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
606 echo " --cc=CC use C compiler CC [$cc]"
607 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
608 echo " --extra-cflags=CFLAGS add C compiler flags CFLAGS"
609 echo " --extra-ldflags=LDFLAGS add linker flags LDFLAGS"
610 echo " --make=MAKE use specified make [$make]"
611 echo " --install=INSTALL use specified install [$install]"
612 echo " --static enable static build [$static]"
613 echo " --enable-debug-tcg enable TCG debugging"
614 echo " --disable-debug-tcg disable TCG debugging (default)"
615 echo " --enable-sparse enable sparse checker"
616 echo " --disable-sparse disable sparse checker (default)"
617 echo " --disable-strip disable stripping binaries"
618 echo " --disable-werror disable compilation abort on warning"
619 echo " --disable-sdl disable SDL"
620 echo " --enable-cocoa enable COCOA (Mac OS X only)"
621 echo " --audio-drv-list=LIST set audio drivers list:"
622 echo " Available drivers: $audio_possible_drivers"
623 echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
624 echo " Available cards: $audio_possible_cards"
625 echo " --enable-mixemu enable mixer emulation"
626 echo " --disable-xen disable xen backend driver support"
627 echo " --disable-brlapi disable BrlAPI"
628 echo " --disable-vnc-tls disable TLS encryption for VNC server"
629 echo " --disable-vnc-sasl disable SASL encryption for VNC server"
630 echo " --disable-curses disable curses output"
631 echo " --disable-bluez disable bluez stack connectivity"
632 echo " --disable-kvm disable KVM acceleration support"
633 echo " --disable-nptl disable usermode NPTL support"
634 echo " --enable-system enable all system emulation targets"
635 echo " --disable-system disable all system emulation targets"
636 echo " --enable-linux-user enable all linux usermode emulation targets"
637 echo " --disable-linux-user disable all linux usermode emulation targets"
638 echo " --enable-darwin-user enable all darwin usermode emulation targets"
639 echo " --disable-darwin-user disable all darwin usermode emulation targets"
640 echo " --enable-bsd-user enable all BSD usermode emulation targets"
641 echo " --disable-bsd-user disable all BSD usermode emulation targets"
642 echo " --fmod-lib path to FMOD library"
643 echo " --fmod-inc path to FMOD includes"
644 echo " --oss-lib path to OSS library"
645 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
646 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
647 echo " --disable-vde disable support for vde network"
648 echo " --disable-aio disable AIO support"
649 echo " --disable-blobs disable installing provided firmware blobs"
650 echo " --kerneldir=PATH look for kernel includes in PATH"
651 echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
652 echo ""
653 echo "NOTE: The object files are built at the place where configure is launched"
654 exit 1
657 if test "$mingw32" = "yes" ; then
658 linux="no"
659 EXESUF=".exe"
660 oss="no"
661 linux_user="no"
662 bsd_user="no"
663 OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
666 if test ! -x "$(which cgcc 2>/dev/null)"; then
667 sparse="no"
671 # Solaris specific configure tool chain decisions
673 if test "$solaris" = "yes" ; then
674 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
675 if test -z "$solinst" ; then
676 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
677 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
678 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
679 exit 1
681 if test "$solinst" = "/usr/sbin/install" ; then
682 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
683 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
684 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
685 exit 1
687 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
688 if test -z "$sol_ar" ; then
689 echo "Error: No path includes ar"
690 if test -f /usr/ccs/bin/ar ; then
691 echo "Add /usr/ccs/bin to your path and rerun configure"
693 exit 1
698 if test -z "$target_list" ; then
699 # these targets are portable
700 if [ "$softmmu" = "yes" ] ; then
701 target_list="\
702 i386-softmmu \
703 x86_64-softmmu \
704 arm-softmmu \
705 cris-softmmu \
706 m68k-softmmu \
707 mips-softmmu \
708 mipsel-softmmu \
709 mips64-softmmu \
710 mips64el-softmmu \
711 ppc-softmmu \
712 ppcemb-softmmu \
713 ppc64-softmmu \
714 sh4-softmmu \
715 sh4eb-softmmu \
716 sparc-softmmu \
719 # the following are Linux specific
720 if [ "$linux_user" = "yes" ] ; then
721 target_list="${target_list}\
722 i386-linux-user \
723 x86_64-linux-user \
724 alpha-linux-user \
725 arm-linux-user \
726 armeb-linux-user \
727 cris-linux-user \
728 m68k-linux-user \
729 mips-linux-user \
730 mipsel-linux-user \
731 ppc-linux-user \
732 ppc64-linux-user \
733 ppc64abi32-linux-user \
734 sh4-linux-user \
735 sh4eb-linux-user \
736 sparc-linux-user \
737 sparc64-linux-user \
738 sparc32plus-linux-user \
741 # the following are Darwin specific
742 if [ "$darwin_user" = "yes" ] ; then
743 target_list="$target_list i386-darwin-user ppc-darwin-user "
745 # the following are BSD specific
746 if [ "$bsd_user" = "yes" ] ; then
747 target_list="${target_list}\
748 i386-bsd-user \
749 x86_64-bsd-user \
750 sparc-bsd-user \
751 sparc64-bsd-user \
754 else
755 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
757 if test -z "$target_list" ; then
758 echo "No targets enabled"
759 exit 1
762 if test -z "$cross_prefix" ; then
764 # ---
765 # big/little endian test
766 cat > $TMPC << EOF
767 #include <inttypes.h>
768 int main(int argc, char ** argv){
769 volatile uint32_t i=0x01234567;
770 return (*((uint8_t*)(&i))) == 0x67;
774 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
775 $TMPE && bigendian="yes"
776 else
777 echo big/little test failed
780 else
782 # if cross compiling, cannot launch a program, so make a static guess
783 if test "$cpu" = "armv4b" \
784 -o "$cpu" = "hppa" \
785 -o "$cpu" = "m68k" \
786 -o "$cpu" = "mips" \
787 -o "$cpu" = "mips64" \
788 -o "$cpu" = "ppc" \
789 -o "$cpu" = "ppc64" \
790 -o "$cpu" = "s390" \
791 -o "$cpu" = "sparc" \
792 -o "$cpu" = "sparc64"; then
793 bigendian="yes"
798 # host long bits test
799 hostlongbits="32"
800 if test "$cpu" = "x86_64" \
801 -o "$cpu" = "alpha" \
802 -o "$cpu" = "ia64" \
803 -o "$cpu" = "sparc64" \
804 -o "$cpu" = "ppc64"; then
805 hostlongbits="64"
808 # Check host NPTL support
809 cat > $TMPC <<EOF
810 #include <sched.h>
811 #include <linux/futex.h>
812 void foo()
814 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
815 #error bork
816 #endif
820 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
822 else
823 nptl="no"
826 ##########################################
827 # KVM probe
829 case "$cpu" in
830 i386 | x86_64)
831 kvm_arch="x86"
833 ppc)
834 kvm_arch="powerpc"
837 kvm_arch="$cpu"
839 esac
841 kvm_cflags=""
843 if test "$kvm" = "yes" ; then
845 kvm_cflags="-I$source_path/kvm/kernel/include"
846 kvm_cflags="$kvm_cflags -I$source_path/kvm/kernel/arch/$kvm_arch/include"
848 # test for KVM_CAP_PIT
850 cat > $TMPC <<EOF
851 #include <libkvm.h>
852 #ifndef KVM_CAP_PIT
853 #error "kvm no pit capability"
854 #endif
855 int main(void) { return 0; }
857 if $cc $ARCH_CFLAGS $CFLAGS $kvm_cflags -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev/null ; then
858 kvm_cap_pit="yes"
861 # test for KVM_CAP_DEVICE_ASSIGNMENT
863 cat > $TMPC <<EOF
864 #include <libkvm.h>
865 #ifndef KVM_CAP_DEVICE_ASSIGNMENT
866 #error "kvm no device assignment capability"
867 #endif
868 int main(void) { return 0; }
870 if $cc $ARCH_CFLAGS $CFLAGS $kvm_cflags -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev/null ; then
871 kvm_cap_device_assignment="yes"
875 # libpci probe for kvm_cap_device_assignment
876 if test $kvm_cap_device_assignment = "yes" ; then
877 cat > $TMPC << EOF
878 #include <pci/pci.h>
879 #ifndef PCI_VENDOR_ID
880 #error NO LIBPCI
881 #endif
882 int main(void) { return 0; }
884 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC 2>/dev/null ; then
886 else
887 echo
888 echo "Error: libpci check failed"
889 echo "Disable KVM Device Assignment capability."
890 echo
891 kvm_cap_device_assignment="no"
895 ##########################################
896 # zlib check
898 cat > $TMPC << EOF
899 #include <zlib.h>
900 int main(void) { zlibVersion(); return 0; }
902 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
904 else
905 echo
906 echo "Error: zlib check failed"
907 echo "Make sure to have the zlib libs and headers installed."
908 echo
909 exit 1
912 ##########################################
913 # xen probe
915 if test "$xen" = "yes" ; then
916 cat > $TMPC <<EOF
917 #include <xenctrl.h>
918 #include <xs.h>
919 int main(void) { xs_daemon_open; xc_interface_open; }
921 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC -lxenstore -lxenctrl 2> /dev/null ; then
923 else
924 xen="no"
928 ##########################################
929 # SDL probe
931 sdl_too_old=no
933 if test -z "$sdl" ; then
934 sdl_config="sdl-config"
935 sdl=no
936 sdl_static=no
938 cat > $TMPC << EOF
939 #include <SDL.h>
940 #undef main /* We don't want SDL to override our main() */
941 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
943 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
944 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
945 if test "$_sdlversion" -lt 121 ; then
946 sdl_too_old=yes
947 else
948 if test "$cocoa" = "no" ; then
949 sdl=yes
953 # static link with sdl ?
954 if test "$sdl" = "yes" ; then
955 aa="no"
956 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
957 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
958 if [ "$aa" = "yes" ] ; then
959 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
962 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then
963 sdl_static=yes
965 fi # static link
966 fi # sdl compile test
967 else
968 # Make sure to disable cocoa if sdl was set
969 if test "$sdl" = "yes" ; then
970 cocoa="no"
971 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
973 fi # -z $sdl
975 if test "$sdl" = "yes" ; then
976 cat > $TMPC <<EOF
977 #include <SDL.h>
978 #if defined(SDL_VIDEO_DRIVER_X11)
979 #include <X11/XKBlib.h>
980 #else
981 #error No x11 support
982 #endif
983 int main(void) { return 0; }
985 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
986 sdl_x11="yes"
990 ##########################################
991 # VNC TLS detection
992 if test "$vnc_tls" = "yes" ; then
993 cat > $TMPC <<EOF
994 #include <gnutls/gnutls.h>
995 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
997 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
998 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
999 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
1000 $vnc_tls_libs > /dev/null 2> /dev/null ; then
1002 else
1003 vnc_tls="no"
1007 ##########################################
1008 # VNC SASL detection
1009 if test "$vnc_sasl" = "yes" ; then
1010 cat > $TMPC <<EOF
1011 #include <sasl/sasl.h>
1012 #include <stdio.h>
1013 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
1015 # Assuming Cyrus-SASL installed in /usr prefix
1016 vnc_sasl_cflags=""
1017 vnc_sasl_libs="-lsasl2"
1018 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
1019 $vnc_sasl_libs 2> /dev/null ; then
1021 else
1022 vnc_sasl="no"
1026 ##########################################
1027 # fnmatch() probe, used for ACL routines
1028 fnmatch="no"
1029 cat > $TMPC << EOF
1030 #include <fnmatch.h>
1031 int main(void)
1033 fnmatch("foo", "foo", 0);
1034 return 0;
1037 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1038 fnmatch="yes"
1041 ##########################################
1042 # vde libraries probe
1043 if test "$vde" = "yes" ; then
1044 cat > $TMPC << EOF
1045 #include <libvdeplug.h>
1046 int main(void)
1048 struct vde_open_args a = {0, 0, 0};
1049 vde_open("", "", &a);
1050 return 0;
1053 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
1055 else
1056 vde="no"
1060 ##########################################
1061 # Sound support libraries probe
1063 audio_drv_probe()
1065 drv=$1
1066 hdr=$2
1067 lib=$3
1068 exp=$4
1069 cfl=$5
1070 cat > $TMPC << EOF
1071 #include <$hdr>
1072 int main(void) { $exp }
1074 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
1076 else
1077 echo
1078 echo "Error: $drv check failed"
1079 echo "Make sure to have the $drv libs and headers installed."
1080 echo
1081 exit 1
1085 audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1086 for drv in $audio_drv_list; do
1087 case $drv in
1088 alsa)
1089 audio_drv_probe $drv alsa/asoundlib.h -lasound \
1090 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1093 fmod)
1094 if test -z $fmod_lib || test -z $fmod_inc; then
1095 echo
1096 echo "Error: You must specify path to FMOD library and headers"
1097 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1098 echo
1099 exit 1
1101 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1104 esd)
1105 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1109 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
1110 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1113 oss|sdl|core|wav|dsound)
1114 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1118 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
1119 echo
1120 echo "Error: Unknown driver '$drv' selected"
1121 echo "Possible drivers are: $audio_possible_drivers"
1122 echo
1123 exit 1
1126 esac
1127 done
1129 ##########################################
1130 # BrlAPI probe
1132 if test -z "$brlapi" ; then
1133 brlapi=no
1134 cat > $TMPC << EOF
1135 #include <brlapi.h>
1136 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1138 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
1139 brlapi=yes
1140 fi # brlapi compile test
1141 fi # -z $brlapi
1143 ##########################################
1144 # curses probe
1146 if test "$curses" = "yes" ; then
1147 curses=no
1148 cat > $TMPC << EOF
1149 #include <curses.h>
1150 #ifdef __OpenBSD__
1151 #define resize_term resizeterm
1152 #endif
1153 int main(void) { resize_term(0, 0); return curses_version(); }
1155 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
1156 curses=yes
1158 fi # test "$curses"
1160 ##########################################
1161 # bluez support probe
1162 if test "$bluez" = "yes" ; then
1163 `pkg-config bluez` || bluez="no"
1165 if test "$bluez" = "yes" ; then
1166 cat > $TMPC << EOF
1167 #include <bluetooth/bluetooth.h>
1168 int main(void) { return bt_error(0); }
1170 bluez_cflags=`pkg-config --cflags bluez`
1171 bluez_libs=`pkg-config --libs bluez`
1172 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
1173 $bluez_libs > /dev/null 2> /dev/null ; then
1175 else
1176 bluez="no"
1180 ##########################################
1181 # kvm probe
1182 if test "$kvm" = "yes" ; then
1183 cat > $TMPC <<EOF
1184 #include <linux/kvm.h>
1185 #if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
1186 #error Invalid KVM version
1187 #endif
1188 #if !defined(KVM_CAP_USER_MEMORY)
1189 #error Missing KVM capability KVM_CAP_USER_MEMORY
1190 #endif
1191 #if !defined(KVM_CAP_SET_TSS_ADDR)
1192 #error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1193 #endif
1194 #if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1195 #error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1196 #endif
1197 int main(void) { return 0; }
1199 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
1200 > /dev/null 2>/dev/null ; then
1202 else
1203 kvm="no";
1204 if [ -x "`which awk 2>/dev/null`" ] && \
1205 [ -x "`which grep 2>/dev/null`" ]; then
1206 kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
1207 | grep "error: " \
1208 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1209 if test "$kvmerr" != "" ; then
1210 kvm="no - (${kvmerr})"
1216 ##########################################
1217 # AIO probe
1218 AIOLIBS=""
1220 if test "$aio" = "yes" ; then
1221 aio=no
1222 cat > $TMPC << EOF
1223 #include <pthread.h>
1224 int main(void) { pthread_mutex_t lock; return 0; }
1226 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
1227 aio=yes
1228 AIOLIBS="-lpthread"
1232 ##########################################
1233 # iovec probe
1234 cat > $TMPC <<EOF
1235 #include <sys/types.h>
1236 #include <sys/uio.h>
1237 #include <unistd.h>
1238 int main(void) { struct iovec iov; return 0; }
1240 iovec=no
1241 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1242 iovec=yes
1245 ##########################################
1246 # preadv probe
1247 cat > $TMPC <<EOF
1248 #include <sys/types.h>
1249 #include <sys/uio.h>
1250 #include <unistd.h>
1251 int main(void) { preadv; }
1253 preadv=no
1254 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1255 preadv=yes
1258 ##########################################
1259 # fdt probe
1260 if test "$fdt" = "yes" ; then
1261 fdt=no
1262 cat > $TMPC << EOF
1263 int main(void) { return 0; }
1265 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null ; then
1266 fdt=yes
1271 # Check for xxxat() functions when we are building linux-user
1272 # emulator. This is done because older glibc versions don't
1273 # have syscall stubs for these implemented.
1275 atfile=no
1276 if [ "$linux_user" = "yes" ] ; then
1277 cat > $TMPC << EOF
1278 #define _ATFILE_SOURCE
1279 #include <sys/types.h>
1280 #include <fcntl.h>
1281 #include <unistd.h>
1284 main(void)
1286 /* try to unlink nonexisting file */
1287 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1290 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1291 atfile=yes
1295 # Check for inotify functions when we are building linux-user
1296 # emulator. This is done because older glibc versions don't
1297 # have syscall stubs for these implemented. In that case we
1298 # don't provide them even if kernel supports them.
1300 inotify=no
1301 if [ "$linux_user" = "yes" ] ; then
1302 cat > $TMPC << EOF
1303 #include <sys/inotify.h>
1306 main(void)
1308 /* try to start inotify */
1309 return inotify_init();
1312 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1313 inotify=yes
1317 ##########################################
1318 # signalfd probe
1319 cat > $TMPC << EOF
1320 #define _GNU_SOURCE
1321 #include <unistd.h>
1322 #include <sys/syscall.h>
1323 #include <signal.h>
1324 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
1327 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1328 signalfd=yes
1331 ##########################################
1332 # eventfd probe
1333 cat > $TMPC << EOF
1334 #define _GNU_SOURCE
1335 #include <unistd.h>
1336 #include <sys/syscall.h>
1337 int main(void) { return syscall(SYS_eventfd, 0); }
1340 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1341 eventfd=yes
1344 # Check if tools are available to build documentation.
1345 if [ -x "`which texi2html 2>/dev/null`" ] && \
1346 [ -x "`which pod2man 2>/dev/null`" ]; then
1347 build_docs="yes"
1350 ##########################################
1351 # Do we need librt
1352 cat > $TMPC <<EOF
1353 #include <signal.h>
1354 #include <time.h>
1355 int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1358 rt=no
1359 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1361 elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
1362 rt=yes
1365 if test "$rt" = "yes" ; then
1366 # Hack, we should have a general purpose LIBS for this sort of thing
1367 AIOLIBS="$AIOLIBS -lrt"
1370 if test "$mingw32" = "yes" ; then
1371 if test -z "$prefix" ; then
1372 prefix="c:\\\\Program Files\\\\Qemu"
1374 mansuffix=""
1375 datasuffix=""
1376 docsuffix=""
1377 binsuffix=""
1378 else
1379 if test -z "$prefix" ; then
1380 prefix="/usr/local"
1382 mansuffix="/share/man"
1383 datasuffix="/share/qemu"
1384 docsuffix="/share/doc/qemu"
1385 binsuffix="/bin"
1388 echo "Install prefix $prefix"
1389 echo "BIOS directory $prefix$datasuffix"
1390 echo "binary directory $prefix$binsuffix"
1391 if test "$mingw32" = "no" ; then
1392 echo "Manual directory $prefix$mansuffix"
1393 echo "ELF interp prefix $interp_prefix"
1395 echo "Source path $source_path"
1396 echo "C compiler $cc"
1397 echo "Host C compiler $host_cc"
1398 echo "ARCH_CFLAGS $ARCH_CFLAGS"
1399 echo "make $make"
1400 echo "install $install"
1401 echo "host CPU $cpu"
1402 echo "host big endian $bigendian"
1403 echo "target list $target_list"
1404 echo "tcg debug enabled $debug_tcg"
1405 echo "gprof enabled $gprof"
1406 echo "sparse enabled $sparse"
1407 echo "strip binaries $strip_opt"
1408 echo "profiler $profiler"
1409 echo "static build $static"
1410 echo "-Werror enabled $werror"
1411 if test "$darwin" = "yes" ; then
1412 echo "Cocoa support $cocoa"
1414 echo "SDL support $sdl"
1415 if test "$sdl" != "no" ; then
1416 echo "SDL static link $sdl_static"
1418 echo "curses support $curses"
1419 echo "mingw32 support $mingw32"
1420 echo "Audio drivers $audio_drv_list"
1421 echo "Extra audio cards $audio_card_list"
1422 echo "Mixer emulation $mixemu"
1423 echo "VNC TLS support $vnc_tls"
1424 if test "$vnc_tls" = "yes" ; then
1425 echo " TLS CFLAGS $vnc_tls_cflags"
1426 echo " TLS LIBS $vnc_tls_libs"
1428 echo "VNC SASL support $vnc_sasl"
1429 if test "$vnc_sasl" = "yes" ; then
1430 echo " SASL CFLAGS $vnc_sasl_cflags"
1431 echo " SASL LIBS $vnc_sasl_libs"
1433 if test -n "$sparc_cpu"; then
1434 echo "Target Sparc Arch $sparc_cpu"
1436 echo "kqemu support $kqemu"
1437 echo "xen support $xen"
1438 echo "CPU emulation $cpu_emulation"
1439 echo "brlapi support $brlapi"
1440 echo "Documentation $build_docs"
1441 [ ! -z "$uname_release" ] && \
1442 echo "uname -r $uname_release"
1443 echo "NPTL support $nptl"
1444 echo "vde support $vde"
1445 echo "AIO support $aio"
1446 echo "Install blobs $blobs"
1447 echo "KVM support $kvm"
1448 echo "fdt support $fdt"
1449 echo "preadv support $preadv"
1451 if test $sdl_too_old = "yes"; then
1452 echo "-> Your SDL version is too old - please upgrade to have SDL support"
1454 if [ -s $TMPSDLLOG ]; then
1455 echo "The error log from compiling the libSDL test is: "
1456 cat $TMPSDLLOG
1458 #if test "$sdl_static" = "no"; then
1459 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1461 config_mak="config-host.mak"
1462 config_h="config-host.h"
1464 #echo "Creating $config_mak and $config_h"
1466 test -f $config_h && mv $config_h ${config_h}~
1468 echo "# Automatically generated by configure - do not modify" > $config_mak
1469 printf "# Configured with:" >> $config_mak
1470 printf " '%s'" "$0" "$@" >> $config_mak
1471 echo >> $config_mak
1472 echo "/* Automatically generated by configure - do not modify */" > $config_h
1474 echo "prefix=$prefix" >> $config_mak
1475 echo "bindir=\${prefix}$binsuffix" >> $config_mak
1476 echo "mandir=\${prefix}$mansuffix" >> $config_mak
1477 echo "datadir=\${prefix}$datasuffix" >> $config_mak
1478 echo "docdir=\${prefix}$docsuffix" >> $config_mak
1479 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
1480 echo "MAKE=$make" >> $config_mak
1481 echo "INSTALL=$install" >> $config_mak
1482 echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_mak
1483 echo "INSTALL_DATA=$install -m0644 -p" >> $config_mak
1484 echo "INSTALL_PROG=$install -m0755 -p" >> $config_mak
1485 echo "CC=$cc" >> $config_mak
1486 echo "HOST_CC=$host_cc" >> $config_mak
1487 echo "AR=$ar" >> $config_mak
1488 # XXX: only use CFLAGS and LDFLAGS ?
1489 # XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1490 # compilation of dyngen tool (useful for win32 build on Linux host)
1491 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
1492 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1493 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1494 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
1495 echo "CFLAGS=$CFLAGS" >> $config_mak
1496 echo "LDFLAGS=$LDFLAGS" >> $config_mak
1497 echo "EXESUF=$EXESUF" >> $config_mak
1498 echo "AIOLIBS=$AIOLIBS" >> $config_mak
1499 case "$cpu" in
1500 i386)
1501 echo "ARCH=i386" >> $config_mak
1502 echo "#define HOST_I386 1" >> $config_h
1504 x86_64)
1505 echo "ARCH=x86_64" >> $config_mak
1506 echo "#define HOST_X86_64 1" >> $config_h
1508 alpha)
1509 echo "ARCH=alpha" >> $config_mak
1510 echo "#define HOST_ALPHA 1" >> $config_h
1512 armv4b)
1513 echo "ARCH=arm" >> $config_mak
1514 echo "#define HOST_ARM 1" >> $config_h
1516 armv4l)
1517 echo "ARCH=arm" >> $config_mak
1518 echo "#define HOST_ARM 1" >> $config_h
1520 cris)
1521 echo "ARCH=cris" >> $config_mak
1522 echo "#define HOST_CRIS 1" >> $config_h
1524 hppa)
1525 echo "ARCH=hppa" >> $config_mak
1526 echo "#define HOST_HPPA 1" >> $config_h
1528 ia64)
1529 echo "ARCH=ia64" >> $config_mak
1530 echo "#define HOST_IA64 1" >> $config_h
1532 m68k)
1533 echo "ARCH=m68k" >> $config_mak
1534 echo "#define HOST_M68K 1" >> $config_h
1536 mips)
1537 echo "ARCH=mips" >> $config_mak
1538 echo "#define HOST_MIPS 1" >> $config_h
1540 mips64)
1541 echo "ARCH=mips64" >> $config_mak
1542 echo "#define HOST_MIPS64 1" >> $config_h
1544 ppc)
1545 echo "ARCH=ppc" >> $config_mak
1546 echo "#define HOST_PPC 1" >> $config_h
1548 ppc64)
1549 echo "ARCH=ppc64" >> $config_mak
1550 echo "#define HOST_PPC64 1" >> $config_h
1552 s390)
1553 echo "ARCH=s390" >> $config_mak
1554 echo "#define HOST_S390 1" >> $config_h
1556 sparc)
1557 echo "ARCH=sparc" >> $config_mak
1558 echo "#define HOST_SPARC 1" >> $config_h
1560 sparc64)
1561 echo "ARCH=sparc64" >> $config_mak
1562 echo "#define HOST_SPARC64 1" >> $config_h
1565 echo "Unsupported CPU = $cpu"
1566 exit 1
1568 esac
1569 if test "$debug_tcg" = "yes" ; then
1570 echo "#define DEBUG_TCG 1" >> $config_h
1572 if test "$sparse" = "yes" ; then
1573 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1574 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1575 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1577 if test "$strip_opt" = "yes" ; then
1578 echo "STRIP_OPT=-s" >> $config_mak
1580 if test "$bigendian" = "yes" ; then
1581 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1582 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1584 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
1585 if test "$mingw32" = "yes" ; then
1586 echo "CONFIG_WIN32=yes" >> $config_mak
1587 echo "#define CONFIG_WIN32 1" >> $config_h
1588 else
1589 cat > $TMPC << EOF
1590 #include <byteswap.h>
1591 int main(void) { return bswap_32(0); }
1593 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
1594 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1596 cat > $TMPC << EOF
1597 #include <sys/endian.h>
1598 #include <sys/types.h>
1599 #include <machine/bswap.h>
1600 int main(void) { return bswap32(0); }
1602 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
1603 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1607 if [ "$openbsd" = "yes" ] ; then
1608 echo "#define ENOTSUP 4096" >> $config_h
1611 if test "$darwin" = "yes" ; then
1612 echo "CONFIG_DARWIN=yes" >> $config_mak
1613 echo "#define CONFIG_DARWIN 1" >> $config_h
1616 if test "$aix" = "yes" ; then
1617 echo "CONFIG_AIX=yes" >> $config_mak
1618 echo "#define CONFIG_AIX 1" >> $config_h
1621 if test "$solaris" = "yes" ; then
1622 echo "CONFIG_SOLARIS=yes" >> $config_mak
1623 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
1624 if test "$needs_libsunmath" = "yes" ; then
1625 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1626 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1629 if test -n "$sparc_cpu"; then
1630 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1631 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1633 if test "$gdbstub" = "yes" ; then
1634 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1635 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1637 if test "$gprof" = "yes" ; then
1638 echo "TARGET_GPROF=yes" >> $config_mak
1639 echo "#define HAVE_GPROF 1" >> $config_h
1641 if test "$static" = "yes" ; then
1642 echo "CONFIG_STATIC=yes" >> $config_mak
1643 echo "#define CONFIG_STATIC 1" >> $config_h
1645 if test $profiler = "yes" ; then
1646 echo "#define CONFIG_PROFILER 1" >> $config_h
1648 if test "$slirp" = "yes" ; then
1649 echo "CONFIG_SLIRP=yes" >> $config_mak
1650 echo "#define CONFIG_SLIRP 1" >> $config_h
1652 if test "$vde" = "yes" ; then
1653 echo "CONFIG_VDE=yes" >> $config_mak
1654 echo "#define CONFIG_VDE 1" >> $config_h
1655 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1657 for card in $audio_card_list; do
1658 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
1659 echo "$def=yes" >> $config_mak
1660 echo "#define $def 1" >> $config_h
1661 done
1662 echo "#define AUDIO_DRIVERS \\" >> $config_h
1663 for drv in $audio_drv_list; do
1664 echo " &${drv}_audio_driver, \\" >>$config_h
1665 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
1666 echo "$def=yes" >> $config_mak
1667 if test "$drv" = "fmod"; then
1668 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1669 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1670 elif test "$drv" = "oss"; then
1671 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
1673 done
1674 echo "" >>$config_h
1675 if test "$mixemu" = "yes" ; then
1676 echo "CONFIG_MIXEMU=yes" >> $config_mak
1677 echo "#define CONFIG_MIXEMU 1" >> $config_h
1679 if test "$vnc_tls" = "yes" ; then
1680 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1681 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1682 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1683 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1685 if test "$vnc_sasl" = "yes" ; then
1686 echo "CONFIG_VNC_SASL=yes" >> $config_mak
1687 echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1688 echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1689 echo "#define CONFIG_VNC_SASL 1" >> $config_h
1691 if test "$fnmatch" = "yes" ; then
1692 echo "#define HAVE_FNMATCH_H 1" >> $config_h
1694 qemu_version=`head $source_path/VERSION`
1695 echo "VERSION=$qemu_version" >>$config_mak
1696 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1697 echo "#define QEMU_PKGVERSION \"$pkgversion\"" >> $config_h
1699 echo "SRC_PATH=$source_path" >> $config_mak
1700 if [ "$source_path_used" = "yes" ]; then
1701 echo "VPATH=$source_path" >> $config_mak
1703 echo "TARGET_DIRS=$target_list" >> $config_mak
1704 if [ "$build_docs" = "yes" ] ; then
1705 echo "BUILD_DOCS=yes" >> $config_mak
1707 if test "$static" = "yes"; then
1708 sdl1=$sdl_static
1709 else
1710 sdl1=$sdl
1712 if test "$sdl1" = "yes" ; then
1713 echo "#define CONFIG_SDL 1" >> $config_h
1714 echo "CONFIG_SDL=yes" >> $config_mak
1715 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1716 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1717 elif test "$sdl_x11" = "yes" ; then
1718 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
1719 else
1720 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1722 if [ "${aa}" = "yes" ] ; then
1723 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1724 else
1725 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1728 if test "$cocoa" = "yes" ; then
1729 echo "#define CONFIG_COCOA 1" >> $config_h
1730 echo "CONFIG_COCOA=yes" >> $config_mak
1732 if test "$curses" = "yes" ; then
1733 echo "#define CONFIG_CURSES 1" >> $config_h
1734 echo "CONFIG_CURSES=yes" >> $config_mak
1735 echo "CURSES_LIBS=-lcurses" >> $config_mak
1737 if test "$atfile" = "yes" ; then
1738 echo "#define CONFIG_ATFILE 1" >> $config_h
1740 if test "$inotify" = "yes" ; then
1741 echo "#define CONFIG_INOTIFY 1" >> $config_h
1743 if test "$brlapi" = "yes" ; then
1744 echo "CONFIG_BRLAPI=yes" >> $config_mak
1745 echo "#define CONFIG_BRLAPI 1" >> $config_h
1746 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1748 if test "$bluez" = "yes" ; then
1749 echo "CONFIG_BLUEZ=yes" >> $config_mak
1750 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1751 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1752 echo "#define CONFIG_BLUEZ 1" >> $config_h
1754 if test "$xen" = "yes" ; then
1755 echo "XEN_LIBS=-lxenstore -lxenctrl -lxenguest" >> $config_mak
1757 if test "$aio" = "yes" ; then
1758 echo "#define CONFIG_AIO 1" >> $config_h
1759 echo "CONFIG_AIO=yes" >> $config_mak
1761 if test "$blobs" = "yes" ; then
1762 echo "INSTALL_BLOBS=yes" >> $config_mak
1764 if test "$iovec" = "yes" ; then
1765 echo "#define HAVE_IOVEC 1" >> $config_h
1767 if test "$preadv" = "yes" ; then
1768 echo "#define HAVE_PREADV 1" >> $config_h
1770 if test "$fdt" = "yes" ; then
1771 echo "#define HAVE_FDT 1" >> $config_h
1772 echo "FDT_LIBS=-lfdt" >> $config_mak
1774 if test "$signalfd" = "yes" ; then
1775 echo "#define CONFIG_signalfd 1" >> $config_h
1777 if test "$eventfd" = "yes" ; then
1778 echo "#define CONFIG_eventfd 1" >> $config_h
1781 # XXX: suppress that
1782 if [ "$bsd" = "yes" ] ; then
1783 echo "#define O_LARGEFILE 0" >> $config_h
1784 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1785 echo "#define HOST_BSD 1" >> $config_h
1788 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1790 # USB host support
1791 case "$usb" in
1792 linux)
1793 echo "HOST_USB=linux" >> $config_mak
1795 bsd)
1796 echo "HOST_USB=bsd" >> $config_mak
1799 echo "HOST_USB=stub" >> $config_mak
1801 esac
1803 # this is a temp hack needed for libkvm
1804 if test "$kvm" = "yes" ; then
1805 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1808 tools=
1809 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1810 tools="qemu-img\$(EXESUF) $tools"
1811 if [ "$linux" = "yes" ] ; then
1812 tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
1815 echo "TOOLS=$tools" >> $config_mak
1817 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1819 for target in $target_list; do
1820 target_dir="$target"
1821 config_mak=$target_dir/config.mak
1822 config_h=$target_dir/config.h
1823 target_cpu=`echo $target | cut -d '-' -f 1`
1824 target_bigendian="no"
1825 [ "$target_cpu" = "armeb" ] && target_bigendian=yes
1826 [ "$target_cpu" = "m68k" ] && target_bigendian=yes
1827 [ "$target_cpu" = "mips" ] && target_bigendian=yes
1828 [ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1829 [ "$target_cpu" = "mips64" ] && target_bigendian=yes
1830 [ "$target_cpu" = "ppc" ] && target_bigendian=yes
1831 [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
1832 [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
1833 [ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
1834 [ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
1835 [ "$target_cpu" = "sparc" ] && target_bigendian=yes
1836 [ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1837 [ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
1838 target_softmmu="no"
1839 target_user_only="no"
1840 target_linux_user="no"
1841 target_darwin_user="no"
1842 target_bsd_user="no"
1843 case "$target" in
1844 ${target_cpu}-softmmu)
1845 target_softmmu="yes"
1847 ${target_cpu}-linux-user)
1848 target_user_only="yes"
1849 target_linux_user="yes"
1851 ${target_cpu}-darwin-user)
1852 target_user_only="yes"
1853 target_darwin_user="yes"
1855 ${target_cpu}-bsd-user)
1856 target_user_only="yes"
1857 target_bsd_user="yes"
1860 echo "ERROR: Target '$target' not recognised"
1861 exit 1
1863 esac
1865 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1866 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1867 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1868 echo "To build QEMU without graphical output configure with --disable-gfx-check"
1869 echo "Note that this will disable all output from the virtual graphics card"
1870 echo "except through VNC or curses."
1871 exit 1;
1874 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1876 test -f $config_h && mv $config_h ${config_h}~
1878 mkdir -p $target_dir
1879 mkdir -p $target_dir/fpu
1880 mkdir -p $target_dir/tcg
1881 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
1882 mkdir -p $target_dir/nwfpe
1886 # don't use ln -sf as not all "ln -sf" over write the file/link
1888 rm -f $target_dir/Makefile
1889 ln -s $source_path/Makefile.target $target_dir/Makefile
1892 echo "# Automatically generated by configure - do not modify" > $config_mak
1893 echo "/* Automatically generated by configure - do not modify */" > $config_h
1896 echo "include ../config-host.mak" >> $config_mak
1897 echo "#include \"../config-host.h\"" >> $config_h
1899 bflt="no"
1900 elfload32="no"
1901 target_nptl="no"
1902 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1903 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1904 gdb_xml_files=""
1906 disable_cpu_emulation() {
1907 if test $cpu_emulation = "no"; then
1908 echo "#define NO_CPU_EMULATION 1" >> $config_h
1909 echo "NO_CPU_EMULATION=1" >> $config_mak
1913 configure_kvm() {
1914 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
1915 \( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \); then
1916 echo "#define USE_KVM 1" >> $config_h
1917 echo "USE_KVM=1" >> $config_mak
1918 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1919 if test $kvm_cap_pit = "yes" ; then
1920 echo "USE_KVM_PIT=1" >> $config_mak
1921 echo "#define USE_KVM_PIT 1" >> $config_h
1923 if test $kvm_cap_device_assignment = "yes" ; then
1924 echo "USE_KVM_DEVICE_ASSIGNMENT=1" >> $config_mak
1925 echo "#define USE_KVM_DEVICE_ASSIGNMENT 1" >> $config_h
1927 disable_cpu_emulation
1931 if [ use_upstream_kvm = yes ]; then
1933 # Make sure the target and host cpus are compatible
1934 if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
1935 \( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \) -o \
1936 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1937 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
1938 kvm="no"
1940 # Disable KVM for linux-user
1941 if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1942 kvm="no"
1947 case "$target_cpu" in
1948 i386)
1949 echo "TARGET_ARCH=i386" >> $config_mak
1950 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1951 echo "#define TARGET_I386 1" >> $config_h
1952 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
1953 then
1954 echo "CONFIG_KQEMU=yes" >> $config_mak
1955 echo "#define CONFIG_KQEMU 1" >> $config_h
1957 if test "$kvm" = "yes" ; then
1958 echo "USE_KVM=yes" >> $config_mak
1959 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1960 echo "#define USE_KVM 1" >> $config_h
1962 if test "$xen" = "yes" -a "$target_softmmu" = "yes";
1963 then
1964 echo "CONFIG_XEN=yes" >> $config_mak
1965 echo "#define CONFIG_XEN 1" >> $config_h
1967 configure_kvm
1969 x86_64)
1970 echo "TARGET_ARCH=x86_64" >> $config_mak
1971 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1972 echo "#define TARGET_I386 1" >> $config_h
1973 echo "#define TARGET_X86_64 1" >> $config_h
1974 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1975 then
1976 echo "CONFIG_KQEMU=yes" >> $config_mak
1977 echo "#define CONFIG_KQEMU 1" >> $config_h
1979 configure_kvm
1981 ia64)
1982 echo "TARGET_ARCH=ia64" >> $config_mak
1983 echo "#define TARGET_ARCH \"ia64\"" >> $config_h
1984 echo "#define TARGET_IA64 1" >> $config_h
1985 configure_kvm
1986 if [ use_upstream_kvm = yes ]; then
1987 if test "$kvm" = "yes" ; then
1988 echo "USE_KVM=yes" >> $config_mak
1989 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1990 echo "#define USE_KVM 1" >> $config_h
1993 if test "$xen" = "yes" -a "$target_softmmu" = "yes"
1994 then
1995 echo "CONFIG_XEN=yes" >> $config_mak
1996 echo "#define CONFIG_XEN 1" >> $config_h
1999 alpha)
2000 echo "TARGET_ARCH=alpha" >> $config_mak
2001 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
2002 echo "#define TARGET_ALPHA 1" >> $config_h
2004 arm|armeb)
2005 echo "TARGET_ARCH=arm" >> $config_mak
2006 echo "#define TARGET_ARCH \"arm\"" >> $config_h
2007 echo "#define TARGET_ARM 1" >> $config_h
2008 bflt="yes"
2009 target_nptl="yes"
2010 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
2012 cris)
2013 echo "TARGET_ARCH=cris" >> $config_mak
2014 echo "#define TARGET_ARCH \"cris\"" >> $config_h
2015 echo "#define TARGET_CRIS 1" >> $config_h
2016 target_nptl="yes"
2018 m68k)
2019 echo "TARGET_ARCH=m68k" >> $config_mak
2020 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
2021 echo "#define TARGET_M68K 1" >> $config_h
2022 bflt="yes"
2023 gdb_xml_files="cf-core.xml cf-fp.xml"
2025 mips|mipsel)
2026 echo "TARGET_ARCH=mips" >> $config_mak
2027 echo "#define TARGET_ARCH \"mips\"" >> $config_h
2028 echo "#define TARGET_MIPS 1" >> $config_h
2029 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
2031 mipsn32|mipsn32el)
2032 echo "TARGET_ARCH=mipsn32" >> $config_mak
2033 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
2034 echo "#define TARGET_MIPS 1" >> $config_h
2035 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
2037 mips64|mips64el)
2038 echo "TARGET_ARCH=mips64" >> $config_mak
2039 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
2040 echo "#define TARGET_MIPS 1" >> $config_h
2041 echo "#define TARGET_MIPS64 1" >> $config_h
2042 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
2044 ppc)
2045 echo "TARGET_ARCH=ppc" >> $config_mak
2046 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
2047 echo "#define TARGET_PPC 1" >> $config_h
2048 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2050 ppcemb)
2051 echo "TARGET_ARCH=ppcemb" >> $config_mak
2052 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2053 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
2054 echo "#define TARGET_PPC 1" >> $config_h
2055 echo "#define TARGET_PPCEMB 1" >> $config_h
2056 if test "$kvm" = "yes" ; then
2057 echo "USE_KVM=yes" >> $config_mak
2058 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
2059 echo "#define USE_KVM 1" >> $config_h
2061 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2063 ppc64)
2064 echo "TARGET_ARCH=ppc64" >> $config_mak
2065 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2066 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
2067 echo "#define TARGET_PPC 1" >> $config_h
2068 echo "#define TARGET_PPC64 1" >> $config_h
2069 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2071 ppc64abi32)
2072 echo "TARGET_ARCH=ppc64" >> $config_mak
2073 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2074 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
2075 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
2076 echo "#define TARGET_PPC 1" >> $config_h
2077 echo "#define TARGET_PPC64 1" >> $config_h
2078 echo "#define TARGET_ABI32 1" >> $config_h
2079 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2081 sh4|sh4eb)
2082 echo "TARGET_ARCH=sh4" >> $config_mak
2083 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
2084 echo "#define TARGET_SH4 1" >> $config_h
2085 bflt="yes"
2086 target_nptl="yes"
2088 sparc)
2089 echo "TARGET_ARCH=sparc" >> $config_mak
2090 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
2091 echo "#define TARGET_SPARC 1" >> $config_h
2093 sparc64)
2094 echo "TARGET_ARCH=sparc64" >> $config_mak
2095 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
2096 echo "#define TARGET_SPARC 1" >> $config_h
2097 echo "#define TARGET_SPARC64 1" >> $config_h
2098 elfload32="yes"
2100 sparc32plus)
2101 echo "TARGET_ARCH=sparc64" >> $config_mak
2102 echo "TARGET_ABI_DIR=sparc" >> $config_mak
2103 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
2104 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
2105 echo "#define TARGET_SPARC 1" >> $config_h
2106 echo "#define TARGET_SPARC64 1" >> $config_h
2107 echo "#define TARGET_ABI32 1" >> $config_h
2110 echo "Unsupported target CPU"
2111 exit 1
2113 esac
2114 if test "$target_bigendian" = "yes" ; then
2115 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
2116 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
2118 if test "$target_softmmu" = "yes" ; then
2119 echo "CONFIG_SOFTMMU=yes" >> $config_mak
2120 echo "#define CONFIG_SOFTMMU 1" >> $config_h
2122 if test "$target_user_only" = "yes" ; then
2123 echo "CONFIG_USER_ONLY=yes" >> $config_mak
2124 echo "#define CONFIG_USER_ONLY 1" >> $config_h
2126 if test "$target_linux_user" = "yes" ; then
2127 echo "CONFIG_LINUX_USER=yes" >> $config_mak
2128 echo "#define CONFIG_LINUX_USER 1" >> $config_h
2130 if test "$target_darwin_user" = "yes" ; then
2131 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
2132 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
2134 list=""
2135 if test ! -z "$gdb_xml_files" ; then
2136 for x in $gdb_xml_files; do
2137 list="$list $source_path/gdb-xml/$x"
2138 done
2140 echo "TARGET_XML_FILES=$list" >> $config_mak
2142 if test "$target_cpu" = "arm" \
2143 -o "$target_cpu" = "armeb" \
2144 -o "$target_cpu" = "m68k" \
2145 -o "$target_cpu" = "mips" \
2146 -o "$target_cpu" = "mipsel" \
2147 -o "$target_cpu" = "mipsn32" \
2148 -o "$target_cpu" = "mipsn32el" \
2149 -o "$target_cpu" = "mips64" \
2150 -o "$target_cpu" = "mips64el" \
2151 -o "$target_cpu" = "ppc" \
2152 -o "$target_cpu" = "ppc64" \
2153 -o "$target_cpu" = "ppc64abi32" \
2154 -o "$target_cpu" = "ppcemb" \
2155 -o "$target_cpu" = "sparc" \
2156 -o "$target_cpu" = "sparc64" \
2157 -o "$target_cpu" = "sparc32plus"; then
2158 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
2159 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
2161 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
2162 echo "TARGET_HAS_BFLT=yes" >> $config_mak
2163 echo "#define TARGET_HAS_BFLT 1" >> $config_h
2165 if test "$target_user_only" = "yes" \
2166 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
2167 echo "#define USE_NPTL 1" >> $config_h
2169 # 32 bit ELF loader in addition to native 64 bit loader?
2170 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
2171 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
2172 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
2174 if test "$target_bsd_user" = "yes" ; then
2175 echo "CONFIG_BSD_USER=yes" >> $config_mak
2176 echo "#define CONFIG_BSD_USER 1" >> $config_h
2179 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
2181 done # for target in $targets
2183 # build tree in object directory if source path is different from current one
2184 if test "$source_path_used" = "yes" ; then
2185 DIRS="tests tests/cris slirp audio kvm/libkvm"
2186 FILES="Makefile tests/Makefile"
2187 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
2188 FILES="$FILES tests/test-mmap.c"
2189 FILES="$FILES kvm/libkvm/Makefile"
2190 for dir in $DIRS ; do
2191 mkdir -p $dir
2192 done
2193 # remove the link and recreate it, as not all "ln -sf" overwrite the link
2194 for f in $FILES ; do
2195 rm -f $f
2196 ln -s $source_path/$f $f
2197 done