Move kvm_trim_features where it belongs
[qemu-kvm/fedora.git] / configure
blobdff967d644495e4b2db572e0c6ea398c84960702
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 slirp="yes"
174 vde="yes"
175 fmod_lib=""
176 fmod_inc=""
177 oss_lib=""
178 vnc_tls="yes"
179 vnc_sasl="yes"
180 bsd="no"
181 linux="no"
182 solaris="no"
183 kqemu="no"
184 profiler="no"
185 cocoa="no"
186 softmmu="yes"
187 linux_user="no"
188 darwin_user="no"
189 bsd_user="no"
190 build_docs="yes"
191 uname_release=""
192 curses="yes"
193 curl="yes"
194 pthread="yes"
195 aio="yes"
196 io_thread="no"
197 nptl="yes"
198 mixemu="no"
199 bluez="yes"
200 kvm="yes"
201 kvm_cap_pit="no"
202 kvm_cap_device_assignment="no"
203 kerneldir=""
204 aix="no"
205 blobs="yes"
206 fdt="yes"
207 sdl="yes"
208 sdl_x11="no"
209 xen="yes"
210 pkgversion=" ($(kvm_version))"
211 signalfd="no"
212 eventfd="no"
213 cpu_emulation="yes"
214 kvm_kmod="no"
216 # OS specific
217 if check_define __linux__ ; then
218 targetos="Linux"
219 elif check_define _WIN32 ; then
220 targetos='MINGW32'
221 elif check_define __OpenBSD__ ; then
222 targetos='OpenBSD'
223 elif check_define __sun__ ; then
224 targetos='SunOS'
225 else
226 targetos=`uname -s`
228 case $targetos in
229 CYGWIN*)
230 mingw32="yes"
231 OS_CFLAGS="-mno-cygwin"
232 if [ "$cpu" = "i386" ] ; then
233 kqemu="yes"
235 audio_possible_drivers="sdl"
237 MINGW32*)
238 mingw32="yes"
239 if [ "$cpu" = "i386" ] ; then
240 kqemu="yes"
242 audio_possible_drivers="dsound sdl fmod"
244 GNU/kFreeBSD)
245 audio_drv_list="oss"
246 audio_possible_drivers="oss sdl esd pa"
247 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
248 kqemu="yes"
251 FreeBSD)
252 bsd="yes"
253 audio_drv_list="oss"
254 audio_possible_drivers="oss sdl esd pa"
255 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
256 kqemu="yes"
257 kvm="yes"
260 DragonFly)
261 bsd="yes"
262 audio_drv_list="oss"
263 audio_possible_drivers="oss sdl esd pa"
264 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
265 kqemu="yes"
267 aio="no"
269 NetBSD)
270 bsd="yes"
271 audio_drv_list="oss"
272 audio_possible_drivers="oss sdl esd"
273 oss_lib="-lossaudio"
275 OpenBSD)
276 bsd="yes"
277 openbsd="yes"
278 audio_drv_list="oss"
279 audio_possible_drivers="oss sdl esd"
280 oss_lib="-lossaudio"
282 Darwin)
283 bsd="yes"
284 darwin="yes"
285 # 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
286 if [ "$cpu" = "i386" ] ; then
287 is_x86_64=`sysctl -n hw.optional.x86_64`
288 [ "$is_x86_64" = "1" ] && cpu=x86_64
290 if [ "$cpu" = "x86_64" ] ; then
291 OS_CFLAGS="-arch x86_64"
292 LDFLAGS="-arch x86_64"
293 else
294 OS_CFLAGS="-mdynamic-no-pic"
296 darwin_user="yes"
297 cocoa="yes"
298 audio_drv_list="coreaudio"
299 audio_possible_drivers="coreaudio sdl fmod"
300 OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
302 SunOS)
303 solaris="yes"
304 make="gmake"
305 install="ginstall"
306 needs_libsunmath="no"
307 kvm="no"
308 solarisrev=`uname -r | cut -f2 -d.`
309 # have to select again, because `uname -m` returns i86pc
310 # even on an x86_64 box.
311 solariscpu=`isainfo -k`
312 if test "${solariscpu}" = "amd64" ; then
313 cpu="x86_64"
315 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
316 if test "$solarisrev" -le 9 ; then
317 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
318 needs_libsunmath="yes"
319 else
320 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
321 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
322 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
323 echo "Studio 11 can be downloaded from www.sun.com."
324 exit 1
327 if test "$solarisrev" -ge 9 ; then
328 kqemu="yes"
331 if test -f /usr/include/sys/soundcard.h ; then
332 audio_drv_list="oss"
334 audio_possible_drivers="oss sdl"
335 OS_CFLAGS=-std=gnu99
337 AIX)
338 aix="yes"
339 make="gmake"
342 audio_drv_list="oss"
343 audio_possible_drivers="oss alsa sdl esd pa"
344 linux="yes"
345 linux_user="yes"
346 usb="linux"
347 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
348 kqemu="yes"
349 audio_possible_drivers="$audio_possible_drivers fmod"
350 kvm="yes"
351 kqemu="no"
353 if [ "$cpu" = "ia64" ] ; then
354 kvm="yes"
355 xen="no"
356 target_list="ia64-softmmu"
357 cpu_emulation="no"
358 gdbstub="no"
359 slirp="no"
361 if [ "$cpu" = "powerpc" ]; then
362 kvm="yes"
365 esac
367 if [ "$bsd" = "yes" ] ; then
368 if [ "$darwin" != "yes" ] ; then
369 make="gmake"
370 usb="bsd"
372 bsd_user="yes"
375 # find source path
376 source_path=`dirname "$0"`
377 source_path_used="no"
378 workdir=`pwd`
379 if [ -z "$source_path" ]; then
380 source_path=$workdir
381 else
382 source_path=`cd "$source_path"; pwd`
384 [ -f "$workdir/vl.c" ] || source_path_used="yes"
386 werror="no"
387 # generate compile errors on warnings for development builds
388 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
389 #werror="yes";
392 for opt do
393 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
394 case "$opt" in
395 --help|-h) show_help=yes
397 --prefix=*) prefix="$optarg"
399 --interp-prefix=*) interp_prefix="$optarg"
401 --source-path=*) source_path="$optarg"
402 source_path_used="yes"
404 --cross-prefix=*)
406 --cc=*)
408 --host-cc=*) host_cc="$optarg"
410 --make=*) make="$optarg"
412 --install=*) install="$optarg"
414 --extra-cflags=*) CFLAGS="$optarg"
416 --extra-ldflags=*) LDFLAGS="$optarg"
418 --cpu=*) cpu="$optarg"
420 --target-list=*) target_list="$optarg"
422 --enable-gprof) gprof="yes"
424 --static) static="yes"
426 --disable-sdl) sdl="no"
428 --fmod-lib=*) fmod_lib="$optarg"
430 --fmod-inc=*) fmod_inc="$optarg"
432 --oss-lib=*) oss_lib="$optarg"
434 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
436 --audio-drv-list=*) audio_drv_list="$optarg"
438 --enable-debug-tcg) debug_tcg="yes"
440 --disable-debug-tcg) debug_tcg="no"
442 --enable-sparse) sparse="yes"
444 --disable-sparse) sparse="no"
446 --disable-strip) strip_opt="no"
448 --disable-vnc-tls) vnc_tls="no"
450 --disable-vnc-sasl) vnc_sasl="no"
452 --disable-slirp) slirp="no"
454 --disable-vde) vde="no"
456 --disable-kqemu) kqemu="no"
458 --disable-xen) xen="no"
460 --disable-brlapi) brlapi="no"
462 --disable-bluez) bluez="no"
464 --disable-kvm) kvm="no"
466 --enable-profiler) profiler="yes"
468 --enable-cocoa)
469 cocoa="yes" ;
470 sdl="no" ;
471 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
473 --disable-system) softmmu="no"
475 --enable-system) softmmu="yes"
477 --disable-linux-user) linux_user="no"
479 --enable-linux-user) linux_user="yes"
481 --disable-darwin-user) darwin_user="no"
483 --enable-darwin-user) darwin_user="yes"
485 --disable-bsd-user) bsd_user="no"
487 --enable-bsd-user) bsd_user="yes"
489 --enable-uname-release=*) uname_release="$optarg"
491 --sparc_cpu=*)
492 sparc_cpu="$optarg"
493 case $sparc_cpu in
494 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
495 target_cpu="sparc"; cpu="sparc" ;;
496 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
497 target_cpu="sparc"; cpu="sparc" ;;
498 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
499 target_cpu="sparc64"; cpu="sparc64" ;;
500 *) echo "undefined SPARC architecture. Exiting";exit 1;;
501 esac
503 --enable-werror) werror="yes"
505 --disable-werror) werror="no"
507 --disable-curses) curses="no"
509 --disable-curl) curl="no"
511 --disable-nptl) nptl="no"
513 --enable-mixemu) mixemu="yes"
515 --disable-pthread) pthread="no"
517 --disable-aio) aio="no"
519 --enable-io-thread) io_thread="yes"
521 --disable-blobs) blobs="no"
523 --kerneldir=*) kerneldir="$optarg"
525 --with-pkgversion=*) pkgversion=" ($optarg)"
527 --disable-docs) build_docs="no"
529 --disable-cpu-emulation) cpu_emulation="no"
531 *) echo "ERROR: unknown option $opt"; show_help="yes"
533 esac
534 done
536 # default flags for all hosts
537 CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
538 CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
539 LDFLAGS="$LDFLAGS -g"
540 if test "$werror" = "yes" ; then
541 CFLAGS="$CFLAGS -Werror"
544 if test "$solaris" = "no" ; then
545 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
546 LDFLAGS="$LDFLAGS -Wl,--warn-common"
551 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
552 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
554 case "$cpu" in
555 sparc) if test -z "$sparc_cpu" ; then
556 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
557 ARCH_LDFLAGS="-m32"
558 else
559 ARCH_CFLAGS="${SP_CFLAGS}"
560 ARCH_LDFLAGS="${SP_LDFLAGS}"
562 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g2 -ffixed-g3"
563 if test "$solaris" = "no" ; then
564 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g6"
567 sparc64) if test -z "$sparc_cpu" ; then
568 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
569 ARCH_LDFLAGS="-m64"
570 else
571 ARCH_CFLAGS="${SP_CFLAGS}"
572 ARCH_LDFLAGS="${SP_LDFLAGS}"
574 if test "$solaris" = "no" ; then
575 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g5 -ffixed-g6 -ffixed-g7"
576 else
577 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7"
580 s390)
581 ARCH_CFLAGS="-march=z900"
583 i386)
584 ARCH_CFLAGS="-m32"
585 ARCH_LDFLAGS="-m32"
587 x86_64)
588 ARCH_CFLAGS="-m64"
589 ARCH_LDFLAGS="-m64"
591 esac
593 if test x"$show_help" = x"yes" ; then
594 cat << EOF
596 Usage: configure [options]
597 Options: [defaults in brackets after descriptions]
600 echo "Standard options:"
601 echo " --help print this message"
602 echo " --prefix=PREFIX install in PREFIX [$prefix]"
603 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
604 echo " use %M for cpu name [$interp_prefix]"
605 echo " --target-list=LIST set target list [$target_list]"
606 echo ""
607 echo "kqemu kernel acceleration support:"
608 echo " --disable-kqemu disable kqemu support"
609 echo ""
610 echo "Advanced options (experts only):"
611 echo " --source-path=PATH path of source code [$source_path]"
612 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
613 echo " --cc=CC use C compiler CC [$cc]"
614 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
615 echo " --extra-cflags=CFLAGS add C compiler flags CFLAGS"
616 echo " --extra-ldflags=LDFLAGS add linker flags LDFLAGS"
617 echo " --make=MAKE use specified make [$make]"
618 echo " --install=INSTALL use specified install [$install]"
619 echo " --static enable static build [$static]"
620 echo " --enable-debug-tcg enable TCG debugging"
621 echo " --disable-debug-tcg disable TCG debugging (default)"
622 echo " --enable-sparse enable sparse checker"
623 echo " --disable-sparse disable sparse checker (default)"
624 echo " --disable-strip disable stripping binaries"
625 echo " --disable-werror disable compilation abort on warning"
626 echo " --disable-sdl disable SDL"
627 echo " --enable-cocoa enable COCOA (Mac OS X only)"
628 echo " --audio-drv-list=LIST set audio drivers list:"
629 echo " Available drivers: $audio_possible_drivers"
630 echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
631 echo " Available cards: $audio_possible_cards"
632 echo " --enable-mixemu enable mixer emulation"
633 echo " --disable-xen disable xen backend driver support"
634 echo " --disable-brlapi disable BrlAPI"
635 echo " --disable-vnc-tls disable TLS encryption for VNC server"
636 echo " --disable-vnc-sasl disable SASL encryption for VNC server"
637 echo " --disable-curses disable curses output"
638 echo " --disable-curl disable curl connectivity"
639 echo " --disable-bluez disable bluez stack connectivity"
640 echo " --disable-kvm disable KVM acceleration support"
641 echo " --disable-nptl disable usermode NPTL support"
642 echo " --enable-system enable all system emulation targets"
643 echo " --disable-system disable all system emulation targets"
644 echo " --enable-linux-user enable all linux usermode emulation targets"
645 echo " --disable-linux-user disable all linux usermode emulation targets"
646 echo " --enable-darwin-user enable all darwin usermode emulation targets"
647 echo " --disable-darwin-user disable all darwin usermode emulation targets"
648 echo " --enable-bsd-user enable all BSD usermode emulation targets"
649 echo " --disable-bsd-user disable all BSD usermode emulation targets"
650 echo " --fmod-lib path to FMOD library"
651 echo " --fmod-inc path to FMOD includes"
652 echo " --oss-lib path to OSS library"
653 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
654 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
655 echo " --disable-vde disable support for vde network"
656 echo " --disable-pthread disable pthread support"
657 echo " --disable-aio disable AIO support"
658 echo " --enable-io-thread enable IO thread"
659 echo " --disable-blobs disable installing provided firmware blobs"
660 echo " --kerneldir=PATH look for kernel includes in PATH"
661 echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
662 echo ""
663 echo "NOTE: The object files are built at the place where configure is launched"
664 exit 1
667 if test "$mingw32" = "yes" ; then
668 linux="no"
669 EXESUF=".exe"
670 oss="no"
671 linux_user="no"
672 bsd_user="no"
673 OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
676 if test ! -x "$(which cgcc 2>/dev/null)"; then
677 sparse="no"
681 # Solaris specific configure tool chain decisions
683 if test "$solaris" = "yes" ; then
684 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
685 if test -z "$solinst" ; then
686 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
687 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
688 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
689 exit 1
691 if test "$solinst" = "/usr/sbin/install" ; then
692 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
693 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
694 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
695 exit 1
697 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
698 if test -z "$sol_ar" ; then
699 echo "Error: No path includes ar"
700 if test -f /usr/ccs/bin/ar ; then
701 echo "Add /usr/ccs/bin to your path and rerun configure"
703 exit 1
708 if test -z "$target_list" ; then
709 # these targets are portable
710 if [ "$softmmu" = "yes" ] ; then
711 target_list="\
712 i386-softmmu \
713 x86_64-softmmu \
714 arm-softmmu \
715 cris-softmmu \
716 m68k-softmmu \
717 mips-softmmu \
718 mipsel-softmmu \
719 mips64-softmmu \
720 mips64el-softmmu \
721 ppc-softmmu \
722 ppcemb-softmmu \
723 ppc64-softmmu \
724 sh4-softmmu \
725 sh4eb-softmmu \
726 sparc-softmmu \
729 # the following are Linux specific
730 if [ "$linux_user" = "yes" ] ; then
731 target_list="${target_list}\
732 i386-linux-user \
733 x86_64-linux-user \
734 alpha-linux-user \
735 arm-linux-user \
736 armeb-linux-user \
737 cris-linux-user \
738 m68k-linux-user \
739 mips-linux-user \
740 mipsel-linux-user \
741 ppc-linux-user \
742 ppc64-linux-user \
743 ppc64abi32-linux-user \
744 sh4-linux-user \
745 sh4eb-linux-user \
746 sparc-linux-user \
747 sparc64-linux-user \
748 sparc32plus-linux-user \
751 # the following are Darwin specific
752 if [ "$darwin_user" = "yes" ] ; then
753 target_list="$target_list i386-darwin-user ppc-darwin-user "
755 # the following are BSD specific
756 if [ "$bsd_user" = "yes" ] ; then
757 target_list="${target_list}\
758 i386-bsd-user \
759 x86_64-bsd-user \
760 sparc-bsd-user \
761 sparc64-bsd-user \
764 else
765 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
767 if test -z "$target_list" ; then
768 echo "No targets enabled"
769 exit 1
772 if test -z "$cross_prefix" ; then
774 # ---
775 # big/little endian test
776 cat > $TMPC << EOF
777 #include <inttypes.h>
778 int main(int argc, char ** argv){
779 volatile uint32_t i=0x01234567;
780 return (*((uint8_t*)(&i))) == 0x67;
784 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
785 $TMPE && bigendian="yes"
786 else
787 echo big/little test failed
790 else
792 # if cross compiling, cannot launch a program, so make a static guess
793 if test "$cpu" = "armv4b" \
794 -o "$cpu" = "hppa" \
795 -o "$cpu" = "m68k" \
796 -o "$cpu" = "mips" \
797 -o "$cpu" = "mips64" \
798 -o "$cpu" = "ppc" \
799 -o "$cpu" = "ppc64" \
800 -o "$cpu" = "s390" \
801 -o "$cpu" = "sparc" \
802 -o "$cpu" = "sparc64"; then
803 bigendian="yes"
808 # host long bits test
809 hostlongbits="32"
810 if test "$cpu" = "x86_64" \
811 -o "$cpu" = "alpha" \
812 -o "$cpu" = "ia64" \
813 -o "$cpu" = "sparc64" \
814 -o "$cpu" = "ppc64"; then
815 hostlongbits="64"
818 # Check host NPTL support
819 cat > $TMPC <<EOF
820 #include <sched.h>
821 #include <linux/futex.h>
822 void foo()
824 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
825 #error bork
826 #endif
830 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
832 else
833 nptl="no"
836 ##########################################
837 # KVM probe
839 case "$cpu" in
840 i386 | x86_64)
841 kvm_arch="x86"
843 ppc)
844 kvm_arch="powerpc"
847 kvm_arch="$cpu"
849 esac
851 kvm_cflags=""
853 if test "$kvm" = "yes" ; then
855 kvm_cflags="-I$source_path/kvm/include"
856 kvm_cflags="$kvm_cflags -I$source_path/kvm/include/$kvm_arch"
858 # test for KVM_CAP_PIT
860 cat > $TMPC <<EOF
861 #include <linux/kvm.h>
862 #ifndef KVM_CAP_PIT
863 #error "kvm no pit capability"
864 #endif
865 int main(void) { return 0; }
867 if $cc $ARCH_CFLAGS $CFLAGS $kvm_cflags -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev/null ; then
868 kvm_cap_pit="yes"
871 # test for KVM_CAP_DEVICE_ASSIGNMENT
873 cat > $TMPC <<EOF
874 #include <linux/kvm.h>
875 #ifndef KVM_CAP_DEVICE_ASSIGNMENT
876 #error "kvm no device assignment capability"
877 #endif
878 int main(void) { return 0; }
880 if $cc $ARCH_CFLAGS $CFLAGS $kvm_cflags -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev/null ; then
881 kvm_cap_device_assignment="yes"
885 # libpci probe for kvm_cap_device_assignment
886 if test $kvm_cap_device_assignment = "yes" ; then
887 cat > $TMPC << EOF
888 #include <pci/pci.h>
889 #ifndef PCI_VENDOR_ID
890 #error NO LIBPCI
891 #endif
892 int main(void) { return 0; }
894 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC 2>/dev/null ; then
896 else
897 echo
898 echo "Error: libpci check failed"
899 echo "Disable KVM Device Assignment capability."
900 echo
901 kvm_cap_device_assignment="no"
905 ##########################################
906 # zlib check
908 cat > $TMPC << EOF
909 #include <zlib.h>
910 int main(void) { zlibVersion(); return 0; }
912 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
914 else
915 echo
916 echo "Error: zlib check failed"
917 echo "Make sure to have the zlib libs and headers installed."
918 echo
919 exit 1
922 ##########################################
923 # xen probe
925 if test "$xen" = "yes" ; then
926 cat > $TMPC <<EOF
927 #include <xenctrl.h>
928 #include <xs.h>
929 int main(void) { xs_daemon_open; xc_interface_open; }
931 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC -lxenstore -lxenctrl 2> /dev/null > /dev/null ; then
933 else
934 xen="no"
938 ##########################################
939 # SDL probe
941 sdl_too_old=no
943 if test "$sdl" = "yes" ; then
944 sdl_config="sdl-config"
945 sdl=no
946 sdl_static=no
948 cat > $TMPC << EOF
949 #include <SDL.h>
950 #undef main /* We don't want SDL to override our main() */
951 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
953 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
954 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
955 if test "$_sdlversion" -lt 121 ; then
956 sdl_too_old=yes
957 else
958 if test "$cocoa" = "no" ; then
959 sdl=yes
963 # static link with sdl ?
964 if test "$sdl" = "yes" ; then
965 aa="no"
966 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
967 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
968 if [ "$aa" = "yes" ] ; then
969 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
972 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then
973 sdl_static=yes
975 fi # static link
976 fi # sdl compile test
977 else
978 # Make sure to disable cocoa if sdl was set
979 if test "$sdl" = "yes" ; then
980 cocoa="no"
981 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
983 fi # -z $sdl
985 if test "$sdl" = "yes" ; then
986 cat > $TMPC <<EOF
987 #include <SDL.h>
988 #if defined(SDL_VIDEO_DRIVER_X11)
989 #include <X11/XKBlib.h>
990 #else
991 #error No x11 support
992 #endif
993 int main(void) { return 0; }
995 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
996 sdl_x11="yes"
1000 ##########################################
1001 # VNC TLS detection
1002 if test "$vnc_tls" = "yes" ; then
1003 cat > $TMPC <<EOF
1004 #include <gnutls/gnutls.h>
1005 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1007 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
1008 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
1009 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
1010 $vnc_tls_libs > /dev/null 2> /dev/null ; then
1012 else
1013 vnc_tls="no"
1017 ##########################################
1018 # VNC SASL detection
1019 if test "$vnc_sasl" = "yes" ; then
1020 cat > $TMPC <<EOF
1021 #include <sasl/sasl.h>
1022 #include <stdio.h>
1023 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
1025 # Assuming Cyrus-SASL installed in /usr prefix
1026 vnc_sasl_cflags=""
1027 vnc_sasl_libs="-lsasl2"
1028 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
1029 $vnc_sasl_libs 2> /dev/null > /dev/null ; then
1031 else
1032 vnc_sasl="no"
1036 ##########################################
1037 # fnmatch() probe, used for ACL routines
1038 fnmatch="no"
1039 cat > $TMPC << EOF
1040 #include <fnmatch.h>
1041 int main(void)
1043 fnmatch("foo", "foo", 0);
1044 return 0;
1047 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1048 fnmatch="yes"
1051 ##########################################
1052 # vde libraries probe
1053 if test "$vde" = "yes" ; then
1054 cat > $TMPC << EOF
1055 #include <libvdeplug.h>
1056 int main(void)
1058 struct vde_open_args a = {0, 0, 0};
1059 vde_open("", "", &a);
1060 return 0;
1063 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
1065 else
1066 vde="no"
1070 ##########################################
1071 # Sound support libraries probe
1073 audio_drv_probe()
1075 drv=$1
1076 hdr=$2
1077 lib=$3
1078 exp=$4
1079 cfl=$5
1080 cat > $TMPC << EOF
1081 #include <$hdr>
1082 int main(void) { $exp }
1084 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
1086 else
1087 echo
1088 echo "Error: $drv check failed"
1089 echo "Make sure to have the $drv libs and headers installed."
1090 echo
1091 exit 1
1095 audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1096 for drv in $audio_drv_list; do
1097 case $drv in
1098 alsa)
1099 audio_drv_probe $drv alsa/asoundlib.h -lasound \
1100 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1103 fmod)
1104 if test -z $fmod_lib || test -z $fmod_inc; then
1105 echo
1106 echo "Error: You must specify path to FMOD library and headers"
1107 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1108 echo
1109 exit 1
1111 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1114 esd)
1115 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1119 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
1120 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1123 oss|sdl|core|wav|dsound)
1124 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1128 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
1129 echo
1130 echo "Error: Unknown driver '$drv' selected"
1131 echo "Possible drivers are: $audio_possible_drivers"
1132 echo
1133 exit 1
1136 esac
1137 done
1139 ##########################################
1140 # BrlAPI probe
1142 if test -z "$brlapi" ; then
1143 brlapi=no
1144 cat > $TMPC << EOF
1145 #include <brlapi.h>
1146 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1148 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
1149 brlapi=yes
1150 fi # brlapi compile test
1151 fi # -z $brlapi
1153 ##########################################
1154 # curses probe
1156 if test "$curses" = "yes" ; then
1157 curses=no
1158 cat > $TMPC << EOF
1159 #include <curses.h>
1160 #ifdef __OpenBSD__
1161 #define resize_term resizeterm
1162 #endif
1163 int main(void) { resize_term(0, 0); return curses_version(); }
1165 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
1166 curses=yes
1168 fi # test "$curses"
1170 ##########################################
1171 # curl probe
1173 if test "$curl" = "yes" ; then
1174 curl=no
1175 cat > $TMPC << EOF
1176 #include <curl/curl.h>
1177 int main(void) { return curl_easy_init(); }
1179 curl_libs=`curl-config --libs 2>/dev/null`
1180 if $cc $ARCH_CFLAGS $curl_libs -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1181 curl=yes
1183 fi # test "$curl"
1185 ##########################################
1186 # bluez support probe
1187 if test "$bluez" = "yes" ; then
1188 `pkg-config bluez 2> /dev/null` || bluez="no"
1190 if test "$bluez" = "yes" ; then
1191 cat > $TMPC << EOF
1192 #include <bluetooth/bluetooth.h>
1193 int main(void) { return bt_error(0); }
1195 bluez_cflags=`pkg-config --cflags bluez 2> /dev/null`
1196 bluez_libs=`pkg-config --libs bluez 2> /dev/null`
1197 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
1198 $bluez_libs > /dev/null 2> /dev/null ; then
1200 else
1201 bluez="no"
1205 ##########################################
1206 # kvm probe
1207 if test "$kvm" = "yes" ; then
1208 cat > $TMPC <<EOF
1209 #include <linux/kvm.h>
1210 #if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
1211 #error Invalid KVM version
1212 #endif
1213 #if !defined(KVM_CAP_USER_MEMORY)
1214 #error Missing KVM capability KVM_CAP_USER_MEMORY
1215 #endif
1216 #if !defined(KVM_CAP_SET_TSS_ADDR)
1217 #error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1218 #endif
1219 #if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1220 #error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1221 #endif
1222 int main(void) { return 0; }
1224 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
1225 > /dev/null 2>/dev/null ; then
1227 else
1228 kvm="no";
1229 if [ -x "`which awk 2>/dev/null`" ] && \
1230 [ -x "`which grep 2>/dev/null`" ]; then
1231 kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
1232 | grep "error: " \
1233 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1234 if test "$kvmerr" != "" ; then
1235 kvm="no - (${kvmerr})"
1241 ##########################################
1242 # pthread probe
1243 PTHREADLIBS=""
1245 if test "$pthread" = yes; then
1246 pthread=no
1247 cat > $TMPC << EOF
1248 #include <pthread.h>
1249 int main(void) { pthread_mutex_t lock; return 0; }
1251 if $cc $ARCH_CFLAGS -o $TMPE $PTHREADLIBS $TMPC 2> /dev/null > /dev/null ; then
1252 pthread=yes
1253 PTHREADLIBS="-lpthread"
1257 if test "$pthread" = no; then
1258 aio=no
1259 io_thread=no
1262 ##########################################
1263 # iovec probe
1264 cat > $TMPC <<EOF
1265 #include <sys/types.h>
1266 #include <sys/uio.h>
1267 #include <unistd.h>
1268 int main(void) { struct iovec iov; return 0; }
1270 iovec=no
1271 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1272 iovec=yes
1275 ##########################################
1276 # preadv probe
1277 cat > $TMPC <<EOF
1278 #include <sys/types.h>
1279 #include <sys/uio.h>
1280 #include <unistd.h>
1281 int main(void) { preadv; }
1283 preadv=no
1284 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1285 preadv=yes
1288 ##########################################
1289 # fdt probe
1290 if test "$fdt" = "yes" ; then
1291 fdt=no
1292 cat > $TMPC << EOF
1293 int main(void) { return 0; }
1295 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null > /dev/null ; then
1296 fdt=yes
1301 # Check for xxxat() functions when we are building linux-user
1302 # emulator. This is done because older glibc versions don't
1303 # have syscall stubs for these implemented.
1305 atfile=no
1306 if [ "$linux_user" = "yes" ] ; then
1307 cat > $TMPC << EOF
1308 #define _ATFILE_SOURCE
1309 #include <sys/types.h>
1310 #include <fcntl.h>
1311 #include <unistd.h>
1314 main(void)
1316 /* try to unlink nonexisting file */
1317 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1320 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then
1321 atfile=yes
1325 # Check for inotify functions when we are building linux-user
1326 # emulator. This is done because older glibc versions don't
1327 # have syscall stubs for these implemented. In that case we
1328 # don't provide them even if kernel supports them.
1330 inotify=no
1331 if [ "$linux_user" = "yes" ] ; then
1332 cat > $TMPC << EOF
1333 #include <sys/inotify.h>
1336 main(void)
1338 /* try to start inotify */
1339 return inotify_init();
1342 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then
1343 inotify=yes
1347 ##########################################
1348 # signalfd probe
1349 cat > $TMPC << EOF
1350 #define _GNU_SOURCE
1351 #include <unistd.h>
1352 #include <sys/syscall.h>
1353 #include <signal.h>
1354 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
1357 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1358 signalfd=yes
1361 ##########################################
1362 # eventfd probe
1363 cat > $TMPC << EOF
1364 #define _GNU_SOURCE
1365 #include <unistd.h>
1366 #include <sys/syscall.h>
1367 int main(void) { return syscall(SYS_eventfd, 0); }
1370 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1371 eventfd=yes
1374 # Check if tools are available to build documentation.
1375 if test "$build_docs" = "yes" -a \( ! -x "`which texi2html 2>/dev/null`" -o ! -x "`which pod2man 2>/dev/null`" \) ; then
1376 build_docs="no"
1379 ##########################################
1380 # Do we need librt
1381 CLOCKLIBS=""
1382 cat > $TMPC <<EOF
1383 #include <signal.h>
1384 #include <time.h>
1385 int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1388 rt=no
1389 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1391 elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
1392 rt=yes
1395 if test "$rt" = "yes" ; then
1396 CLOCKLIBS="-lrt"
1399 if test "$mingw32" = "yes" ; then
1400 if test -z "$prefix" ; then
1401 prefix="c:\\\\Program Files\\\\Qemu"
1403 mansuffix=""
1404 datasuffix=""
1405 docsuffix=""
1406 binsuffix=""
1407 else
1408 if test -z "$prefix" ; then
1409 prefix="/usr/local"
1411 mansuffix="/share/man"
1412 datasuffix="/share/qemu"
1413 docsuffix="/share/doc/qemu"
1414 binsuffix="/bin"
1417 if test -f kvm/kernel/configure; then
1418 kvm_kmod="yes"
1419 kmod_args=""
1420 if test -n "$kerneldir"; then
1421 kmod_args="--kerneldir=$kerneldir"
1423 # hope there are no spaces in kmod_args; can't use arrays because of
1424 # dash.
1425 (cd kvm/kernel; ./configure $kmod_args)
1428 echo "Install prefix $prefix"
1429 echo "BIOS directory $prefix$datasuffix"
1430 echo "binary directory $prefix$binsuffix"
1431 if test "$mingw32" = "no" ; then
1432 echo "Manual directory $prefix$mansuffix"
1433 echo "ELF interp prefix $interp_prefix"
1435 echo "Source path $source_path"
1436 echo "C compiler $cc"
1437 echo "Host C compiler $host_cc"
1438 echo "ARCH_CFLAGS $ARCH_CFLAGS"
1439 echo "make $make"
1440 echo "install $install"
1441 echo "host CPU $cpu"
1442 echo "host big endian $bigendian"
1443 echo "target list $target_list"
1444 echo "tcg debug enabled $debug_tcg"
1445 echo "gprof enabled $gprof"
1446 echo "sparse enabled $sparse"
1447 echo "strip binaries $strip_opt"
1448 echo "profiler $profiler"
1449 echo "static build $static"
1450 echo "-Werror enabled $werror"
1451 if test "$darwin" = "yes" ; then
1452 echo "Cocoa support $cocoa"
1454 echo "SDL support $sdl"
1455 if test "$sdl" != "no" ; then
1456 echo "SDL static link $sdl_static"
1458 echo "curses support $curses"
1459 echo "curl support $curl"
1460 echo "mingw32 support $mingw32"
1461 echo "Audio drivers $audio_drv_list"
1462 echo "Extra audio cards $audio_card_list"
1463 echo "Mixer emulation $mixemu"
1464 echo "VNC TLS support $vnc_tls"
1465 if test "$vnc_tls" = "yes" ; then
1466 echo " TLS CFLAGS $vnc_tls_cflags"
1467 echo " TLS LIBS $vnc_tls_libs"
1469 echo "VNC SASL support $vnc_sasl"
1470 if test "$vnc_sasl" = "yes" ; then
1471 echo " SASL CFLAGS $vnc_sasl_cflags"
1472 echo " SASL LIBS $vnc_sasl_libs"
1474 if test -n "$sparc_cpu"; then
1475 echo "Target Sparc Arch $sparc_cpu"
1477 echo "kqemu support $kqemu"
1478 echo "xen support $xen"
1479 echo "CPU emulation $cpu_emulation"
1480 echo "brlapi support $brlapi"
1481 echo "Documentation $build_docs"
1482 [ ! -z "$uname_release" ] && \
1483 echo "uname -r $uname_release"
1484 echo "NPTL support $nptl"
1485 echo "vde support $vde"
1486 echo "AIO support $aio"
1487 echo "IO thread $io_thread"
1488 echo "Install blobs $blobs"
1489 echo "KVM support $kvm"
1490 echo "fdt support $fdt"
1491 echo "preadv support $preadv"
1493 if test $sdl_too_old = "yes"; then
1494 echo "-> Your SDL version is too old - please upgrade to have SDL support"
1496 #if test "$sdl_static" = "no"; then
1497 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1499 config_mak="config-host.mak"
1500 config_h="config-host.h"
1502 #echo "Creating $config_mak and $config_h"
1504 test -f $config_h && mv $config_h ${config_h}~
1506 echo "# Automatically generated by configure - do not modify" > $config_mak
1507 printf "# Configured with:" >> $config_mak
1508 printf " '%s'" "$0" "$@" >> $config_mak
1509 echo >> $config_mak
1510 echo "/* Automatically generated by configure - do not modify */" > $config_h
1512 echo "prefix=$prefix" >> $config_mak
1513 echo "bindir=\${prefix}$binsuffix" >> $config_mak
1514 echo "mandir=\${prefix}$mansuffix" >> $config_mak
1515 echo "datadir=\${prefix}$datasuffix" >> $config_mak
1516 echo "docdir=\${prefix}$docsuffix" >> $config_mak
1517 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
1518 echo "MAKE=$make" >> $config_mak
1519 echo "INSTALL=$install" >> $config_mak
1520 echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_mak
1521 echo "INSTALL_DATA=$install -m0644 -p" >> $config_mak
1522 echo "INSTALL_PROG=$install -m0755 -p" >> $config_mak
1523 echo "CC=$cc" >> $config_mak
1524 echo "HOST_CC=$host_cc" >> $config_mak
1525 echo "AR=$ar" >> $config_mak
1526 # XXX: only use CFLAGS and LDFLAGS ?
1527 # XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1528 # compilation of dyngen tool (useful for win32 build on Linux host)
1529 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
1530 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1531 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1532 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
1533 echo "CFLAGS=$CFLAGS" >> $config_mak
1534 echo "LDFLAGS=$LDFLAGS" >> $config_mak
1535 echo "EXESUF=$EXESUF" >> $config_mak
1536 echo "PTHREADLIBS=$PTHREADLIBS" >> $config_mak
1537 echo "CLOCKLIBS=$CLOCKLIBS" >> $config_mak
1538 case "$cpu" in
1539 i386)
1540 echo "ARCH=i386" >> $config_mak
1541 echo "#define HOST_I386 1" >> $config_h
1543 x86_64)
1544 echo "ARCH=x86_64" >> $config_mak
1545 echo "#define HOST_X86_64 1" >> $config_h
1547 alpha)
1548 echo "ARCH=alpha" >> $config_mak
1549 echo "#define HOST_ALPHA 1" >> $config_h
1551 armv4b)
1552 echo "ARCH=arm" >> $config_mak
1553 echo "#define HOST_ARM 1" >> $config_h
1555 armv4l)
1556 echo "ARCH=arm" >> $config_mak
1557 echo "#define HOST_ARM 1" >> $config_h
1559 cris)
1560 echo "ARCH=cris" >> $config_mak
1561 echo "#define HOST_CRIS 1" >> $config_h
1563 hppa)
1564 echo "ARCH=hppa" >> $config_mak
1565 echo "#define HOST_HPPA 1" >> $config_h
1567 ia64)
1568 echo "ARCH=ia64" >> $config_mak
1569 echo "#define HOST_IA64 1" >> $config_h
1571 m68k)
1572 echo "ARCH=m68k" >> $config_mak
1573 echo "#define HOST_M68K 1" >> $config_h
1575 mips)
1576 echo "ARCH=mips" >> $config_mak
1577 echo "#define HOST_MIPS 1" >> $config_h
1579 mips64)
1580 echo "ARCH=mips64" >> $config_mak
1581 echo "#define HOST_MIPS64 1" >> $config_h
1583 ppc)
1584 echo "ARCH=ppc" >> $config_mak
1585 echo "#define HOST_PPC 1" >> $config_h
1587 ppc64)
1588 echo "ARCH=ppc64" >> $config_mak
1589 echo "#define HOST_PPC64 1" >> $config_h
1591 s390)
1592 echo "ARCH=s390" >> $config_mak
1593 echo "#define HOST_S390 1" >> $config_h
1595 sparc)
1596 echo "ARCH=sparc" >> $config_mak
1597 echo "#define HOST_SPARC 1" >> $config_h
1599 sparc64)
1600 echo "ARCH=sparc64" >> $config_mak
1601 echo "#define HOST_SPARC64 1" >> $config_h
1604 echo "Unsupported CPU = $cpu"
1605 exit 1
1607 esac
1608 if test "$debug_tcg" = "yes" ; then
1609 echo "#define DEBUG_TCG 1" >> $config_h
1611 if test "$sparse" = "yes" ; then
1612 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1613 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1614 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1616 if test "$strip_opt" = "yes" ; then
1617 echo "STRIP_OPT=-s" >> $config_mak
1619 if test "$bigendian" = "yes" ; then
1620 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1621 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1623 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
1624 if test "$mingw32" = "yes" ; then
1625 echo "CONFIG_WIN32=yes" >> $config_mak
1626 echo "#define CONFIG_WIN32 1" >> $config_h
1627 else
1628 cat > $TMPC << EOF
1629 #include <byteswap.h>
1630 int main(void) { return bswap_32(0); }
1632 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
1633 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1635 cat > $TMPC << EOF
1636 #include <sys/endian.h>
1637 #include <sys/types.h>
1638 #include <machine/bswap.h>
1639 int main(void) { return bswap32(0); }
1641 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
1642 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1646 if [ "$openbsd" = "yes" ] ; then
1647 echo "#define ENOTSUP 4096" >> $config_h
1650 if test "$darwin" = "yes" ; then
1651 echo "CONFIG_DARWIN=yes" >> $config_mak
1652 echo "#define CONFIG_DARWIN 1" >> $config_h
1655 if test "$aix" = "yes" ; then
1656 echo "CONFIG_AIX=yes" >> $config_mak
1657 echo "#define CONFIG_AIX 1" >> $config_h
1660 if test "$solaris" = "yes" ; then
1661 echo "CONFIG_SOLARIS=yes" >> $config_mak
1662 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
1663 if test "$needs_libsunmath" = "yes" ; then
1664 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1665 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1668 if test -n "$sparc_cpu"; then
1669 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1670 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1672 if test "$gprof" = "yes" ; then
1673 echo "TARGET_GPROF=yes" >> $config_mak
1674 echo "#define HAVE_GPROF 1" >> $config_h
1676 if test "$static" = "yes" ; then
1677 echo "CONFIG_STATIC=yes" >> $config_mak
1678 echo "#define CONFIG_STATIC 1" >> $config_h
1680 if test $profiler = "yes" ; then
1681 echo "#define CONFIG_PROFILER 1" >> $config_h
1683 if test "$slirp" = "yes" ; then
1684 echo "CONFIG_SLIRP=yes" >> $config_mak
1685 echo "#define CONFIG_SLIRP 1" >> $config_h
1687 if test "$vde" = "yes" ; then
1688 echo "CONFIG_VDE=yes" >> $config_mak
1689 echo "#define CONFIG_VDE 1" >> $config_h
1690 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1692 for card in $audio_card_list; do
1693 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
1694 echo "$def=yes" >> $config_mak
1695 echo "#define $def 1" >> $config_h
1696 done
1697 echo "#define AUDIO_DRIVERS \\" >> $config_h
1698 for drv in $audio_drv_list; do
1699 echo " &${drv}_audio_driver, \\" >>$config_h
1700 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
1701 echo "$def=yes" >> $config_mak
1702 if test "$drv" = "fmod"; then
1703 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1704 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1705 elif test "$drv" = "oss"; then
1706 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
1708 done
1709 echo "" >>$config_h
1710 if test "$mixemu" = "yes" ; then
1711 echo "CONFIG_MIXEMU=yes" >> $config_mak
1712 echo "#define CONFIG_MIXEMU 1" >> $config_h
1714 if test "$vnc_tls" = "yes" ; then
1715 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1716 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1717 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1718 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1720 if test "$vnc_sasl" = "yes" ; then
1721 echo "CONFIG_VNC_SASL=yes" >> $config_mak
1722 echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1723 echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1724 echo "#define CONFIG_VNC_SASL 1" >> $config_h
1726 if test "$fnmatch" = "yes" ; then
1727 echo "#define HAVE_FNMATCH_H 1" >> $config_h
1729 qemu_version=`head $source_path/VERSION`
1730 echo "VERSION=$qemu_version" >>$config_mak
1731 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1732 echo "#define QEMU_PKGVERSION \"$pkgversion\"" >> $config_h
1734 echo "SRC_PATH=$source_path" >> $config_mak
1735 if [ "$source_path_used" = "yes" ]; then
1736 echo "VPATH=$source_path" >> $config_mak
1738 echo "TARGET_DIRS=$target_list" >> $config_mak
1739 if [ "$build_docs" = "yes" ] ; then
1740 echo "BUILD_DOCS=yes" >> $config_mak
1742 if test "$static" = "yes"; then
1743 sdl1=$sdl_static
1744 else
1745 sdl1=$sdl
1747 if test "$sdl1" = "yes" ; then
1748 echo "#define CONFIG_SDL 1" >> $config_h
1749 echo "CONFIG_SDL=yes" >> $config_mak
1750 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1751 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1752 elif test "$sdl_x11" = "yes" ; then
1753 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
1754 else
1755 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1757 if [ "${aa}" = "yes" ] ; then
1758 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1759 else
1760 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1763 if test "$cocoa" = "yes" ; then
1764 echo "#define CONFIG_COCOA 1" >> $config_h
1765 echo "CONFIG_COCOA=yes" >> $config_mak
1767 if test "$curses" = "yes" ; then
1768 echo "#define CONFIG_CURSES 1" >> $config_h
1769 echo "CONFIG_CURSES=yes" >> $config_mak
1770 echo "CURSES_LIBS=-lcurses" >> $config_mak
1772 if test "$atfile" = "yes" ; then
1773 echo "#define CONFIG_ATFILE 1" >> $config_h
1775 if test "$inotify" = "yes" ; then
1776 echo "#define CONFIG_INOTIFY 1" >> $config_h
1778 if test "$curl" = "yes" ; then
1779 echo "CONFIG_CURL=yes" >> $config_mak
1780 echo "CURL_LIBS=$curl_libs" >> $config_mak
1781 echo "#define CONFIG_CURL 1" >> $config_h
1783 if test "$brlapi" = "yes" ; then
1784 echo "CONFIG_BRLAPI=yes" >> $config_mak
1785 echo "#define CONFIG_BRLAPI 1" >> $config_h
1786 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1788 if test "$bluez" = "yes" ; then
1789 echo "CONFIG_BLUEZ=yes" >> $config_mak
1790 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1791 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1792 echo "#define CONFIG_BLUEZ 1" >> $config_h
1794 if test "$xen" = "yes" ; then
1795 echo "XEN_LIBS=-lxenstore -lxenctrl -lxenguest" >> $config_mak
1797 if test "$aio" = "yes" ; then
1798 echo "#define CONFIG_AIO 1" >> $config_h
1799 echo "CONFIG_AIO=yes" >> $config_mak
1801 if test "$io_thread" = "yes" ; then
1802 echo "CONFIG_IOTHREAD=yes" >> $config_mak
1803 echo "#define CONFIG_IOTHREAD 1" >> $config_h
1805 if test "$blobs" = "yes" ; then
1806 echo "INSTALL_BLOBS=yes" >> $config_mak
1808 if test "$iovec" = "yes" ; then
1809 echo "#define HAVE_IOVEC 1" >> $config_h
1811 if test "$preadv" = "yes" ; then
1812 echo "#define HAVE_PREADV 1" >> $config_h
1814 if test "$fdt" = "yes" ; then
1815 echo "#define HAVE_FDT 1" >> $config_h
1816 echo "FDT_LIBS=-lfdt" >> $config_mak
1818 if test "$signalfd" = "yes" ; then
1819 echo "#define CONFIG_signalfd 1" >> $config_h
1821 if test "$eventfd" = "yes" ; then
1822 echo "#define CONFIG_eventfd 1" >> $config_h
1825 # XXX: suppress that
1826 if [ "$bsd" = "yes" ] ; then
1827 echo "#define O_LARGEFILE 0" >> $config_h
1828 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1829 echo "#define HOST_BSD 1" >> $config_h
1832 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1834 # USB host support
1835 case "$usb" in
1836 linux)
1837 echo "HOST_USB=linux" >> $config_mak
1839 bsd)
1840 echo "HOST_USB=bsd" >> $config_mak
1843 echo "HOST_USB=stub" >> $config_mak
1845 esac
1847 # Determine what linker flags to use to force archive inclusion
1848 check_linker_flags()
1850 $cc $ARCH_CFLAGS -o $TMPE $OS_CFLAGS $TMPC -Wl,$1 -Wl,$2 >/dev/null 2>/dev/null
1853 cat > $TMPC << EOF
1854 int main(void) { }
1856 if check_linker_flags --whole-archive --no-whole-archive ; then
1857 # GNU ld
1858 echo "ARLIBS_BEGIN=-Wl,--whole-archive" >> $config_mak
1859 echo "ARLIBS_END=-Wl,--no-whole-archive" >> $config_mak
1860 elif check_linker_flags -z,allextract -z,defaultextract ; then
1861 # Solaris ld
1862 echo "ARLIBS_BEGIN=-Wl,-z,allextract" >> $config_mak
1863 echo "ARLIBS_END=-Wl,-z,defaultextract" >> $config_mak
1864 else
1865 echo "Error: your linker does not support --whole-archive or -z."
1866 echo "Please report to qemu-devel@nongnu.org"
1867 exit 1
1870 if test "$xen" = "yes" ;
1871 then
1872 echo "CONFIG_XEN=yes" >> $config_mak
1875 # this is a temp hack needed for kvm
1876 if test "$kvm" = "yes" ; then
1877 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1880 echo "KVM_KMOD=$kvm_kmod" >> $config_mak
1882 tools=
1883 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1884 tools="qemu-img\$(EXESUF) $tools"
1885 if [ "$linux" = "yes" ] ; then
1886 tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
1889 echo "TOOLS=$tools" >> $config_mak
1891 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1892 config_host_mak=${config_mak}
1894 for target in $target_list; do
1895 target_dir="$target"
1896 config_mak=$target_dir/config.mak
1897 config_h=$target_dir/config.h
1898 target_cpu=`echo $target | cut -d '-' -f 1`
1899 target_bigendian="no"
1900 [ "$target_cpu" = "armeb" ] && target_bigendian=yes
1901 [ "$target_cpu" = "m68k" ] && target_bigendian=yes
1902 [ "$target_cpu" = "mips" ] && target_bigendian=yes
1903 [ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1904 [ "$target_cpu" = "mips64" ] && target_bigendian=yes
1905 [ "$target_cpu" = "ppc" ] && target_bigendian=yes
1906 [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
1907 [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
1908 [ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
1909 [ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
1910 [ "$target_cpu" = "sparc" ] && target_bigendian=yes
1911 [ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1912 [ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
1913 target_softmmu="no"
1914 target_user_only="no"
1915 target_linux_user="no"
1916 target_darwin_user="no"
1917 target_bsd_user="no"
1918 case "$target" in
1919 ${target_cpu}-softmmu)
1920 target_softmmu="yes"
1922 ${target_cpu}-linux-user)
1923 target_user_only="yes"
1924 target_linux_user="yes"
1926 ${target_cpu}-darwin-user)
1927 target_user_only="yes"
1928 target_darwin_user="yes"
1930 ${target_cpu}-bsd-user)
1931 target_user_only="yes"
1932 target_bsd_user="yes"
1935 echo "ERROR: Target '$target' not recognised"
1936 exit 1
1938 esac
1940 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1942 test -f $config_h && mv $config_h ${config_h}~
1944 mkdir -p $target_dir
1945 mkdir -p $target_dir/fpu
1946 mkdir -p $target_dir/tcg
1947 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
1948 mkdir -p $target_dir/nwfpe
1952 # don't use ln -sf as not all "ln -sf" over write the file/link
1954 rm -f $target_dir/Makefile
1955 ln -s $source_path/Makefile.target $target_dir/Makefile
1958 echo "# Automatically generated by configure - do not modify" > $config_mak
1959 echo "/* Automatically generated by configure - do not modify */" > $config_h
1962 echo "include ../config-host.mak" >> $config_mak
1963 echo "#include \"../config-host.h\"" >> $config_h
1965 bflt="no"
1966 elfload32="no"
1967 target_nptl="no"
1968 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1969 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1970 gdb_xml_files=""
1972 disable_cpu_emulation() {
1973 if test $cpu_emulation = "no"; then
1974 echo "#define NO_CPU_EMULATION 1" >> $config_h
1975 echo "NO_CPU_EMULATION=1" >> $config_mak
1979 configure_kvm() {
1980 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
1981 \( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \); then
1982 echo "#define USE_KVM 1" >> $config_h
1983 echo "USE_KVM=1" >> $config_mak
1984 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1985 if test $kvm_cap_pit = "yes" ; then
1986 echo "USE_KVM_PIT=1" >> $config_mak
1987 echo "#define USE_KVM_PIT 1" >> $config_h
1989 if test $kvm_cap_device_assignment = "yes" ; then
1990 echo "USE_KVM_DEVICE_ASSIGNMENT=1" >> $config_mak
1991 echo "#define USE_KVM_DEVICE_ASSIGNMENT 1" >> $config_h
1993 disable_cpu_emulation
1997 if [ use_upstream_kvm = yes ]; then
1999 # Make sure the target and host cpus are compatible
2000 if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
2001 \( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \) -o \
2002 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
2003 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
2004 kvm="no"
2006 # Disable KVM for linux-user
2007 if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
2008 kvm="no"
2013 case "$target_cpu" in
2014 i386)
2015 echo "TARGET_ARCH=i386" >> $config_mak
2016 echo "#define TARGET_ARCH \"i386\"" >> $config_h
2017 echo "#define TARGET_I386 1" >> $config_h
2018 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
2019 then
2020 echo "CONFIG_KQEMU=yes" >> $config_mak
2021 echo "#define CONFIG_KQEMU 1" >> $config_h
2023 if test "$kvm" = "yes" ; then
2024 echo "USE_KVM=yes" >> $config_mak
2025 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
2026 echo "#define USE_KVM 1" >> $config_h
2028 if test "$xen" = "yes" -a "$target_softmmu" = "yes";
2029 then
2030 echo "CONFIG_XEN=yes" >> $config_mak
2031 echo "#define CONFIG_XEN 1" >> $config_h
2033 target_phys_bits=32
2034 configure_kvm
2036 x86_64)
2037 echo "TARGET_ARCH=x86_64" >> $config_mak
2038 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
2039 echo "#define TARGET_I386 1" >> $config_h
2040 echo "#define TARGET_X86_64 1" >> $config_h
2041 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
2042 then
2043 echo "CONFIG_KQEMU=yes" >> $config_mak
2044 echo "#define CONFIG_KQEMU 1" >> $config_h
2046 target_phys_bits=64
2047 configure_kvm
2049 ia64)
2050 echo "TARGET_ARCH=ia64" >> $config_mak
2051 echo "#define TARGET_ARCH \"ia64\"" >> $config_h
2052 echo "#define TARGET_IA64 1" >> $config_h
2053 configure_kvm
2054 if [ use_upstream_kvm = yes ]; then
2055 if test "$kvm" = "yes" ; then
2056 echo "USE_KVM=yes" >> $config_mak
2057 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
2058 echo "#define USE_KVM 1" >> $config_h
2061 if test "$xen" = "yes" -a "$target_softmmu" = "yes"
2062 then
2063 echo "CONFIG_XEN=yes" >> $config_mak
2064 echo "#define CONFIG_XEN 1" >> $config_h
2066 target_phys_bits=64
2068 alpha)
2069 echo "TARGET_ARCH=alpha" >> $config_mak
2070 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
2071 echo "#define TARGET_ALPHA 1" >> $config_h
2072 target_phys_bits=64
2074 arm|armeb)
2075 echo "TARGET_ARCH=arm" >> $config_mak
2076 echo "#define TARGET_ARCH \"arm\"" >> $config_h
2077 echo "#define TARGET_ARM 1" >> $config_h
2078 bflt="yes"
2079 target_nptl="yes"
2080 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
2081 target_phys_bits=32
2083 cris)
2084 echo "TARGET_ARCH=cris" >> $config_mak
2085 echo "#define TARGET_ARCH \"cris\"" >> $config_h
2086 echo "#define TARGET_CRIS 1" >> $config_h
2087 target_nptl="yes"
2088 target_phys_bits=32
2090 m68k)
2091 echo "TARGET_ARCH=m68k" >> $config_mak
2092 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
2093 echo "#define TARGET_M68K 1" >> $config_h
2094 bflt="yes"
2095 gdb_xml_files="cf-core.xml cf-fp.xml"
2096 target_phys_bits=32
2098 mips|mipsel)
2099 echo "TARGET_ARCH=mips" >> $config_mak
2100 echo "#define TARGET_ARCH \"mips\"" >> $config_h
2101 echo "#define TARGET_MIPS 1" >> $config_h
2102 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
2103 target_phys_bits=64
2105 mipsn32|mipsn32el)
2106 echo "TARGET_ARCH=mipsn32" >> $config_mak
2107 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
2108 echo "#define TARGET_MIPS 1" >> $config_h
2109 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
2110 target_phys_bits=64
2112 mips64|mips64el)
2113 echo "TARGET_ARCH=mips64" >> $config_mak
2114 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
2115 echo "#define TARGET_MIPS 1" >> $config_h
2116 echo "#define TARGET_MIPS64 1" >> $config_h
2117 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
2118 target_phys_bits=64
2120 ppc)
2121 echo "TARGET_ARCH=ppc" >> $config_mak
2122 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
2123 echo "#define TARGET_PPC 1" >> $config_h
2124 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2125 target_phys_bits=32
2127 ppcemb)
2128 echo "TARGET_ARCH=ppcemb" >> $config_mak
2129 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2130 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
2131 echo "#define TARGET_PPC 1" >> $config_h
2132 echo "#define TARGET_PPCEMB 1" >> $config_h
2133 if test "$kvm" = "yes" ; then
2134 echo "USE_KVM=yes" >> $config_mak
2135 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
2136 echo "#define USE_KVM 1" >> $config_h
2138 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2139 target_phys_bits=64
2141 ppc64)
2142 echo "TARGET_ARCH=ppc64" >> $config_mak
2143 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2144 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
2145 echo "#define TARGET_PPC 1" >> $config_h
2146 echo "#define TARGET_PPC64 1" >> $config_h
2147 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2148 target_phys_bits=64
2150 ppc64abi32)
2151 echo "TARGET_ARCH=ppc64" >> $config_mak
2152 echo "TARGET_ABI_DIR=ppc" >> $config_mak
2153 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
2154 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
2155 echo "#define TARGET_PPC 1" >> $config_h
2156 echo "#define TARGET_PPC64 1" >> $config_h
2157 echo "#define TARGET_ABI32 1" >> $config_h
2158 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2159 target_phys_bits=64
2161 sh4|sh4eb)
2162 echo "TARGET_ARCH=sh4" >> $config_mak
2163 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
2164 echo "#define TARGET_SH4 1" >> $config_h
2165 bflt="yes"
2166 target_nptl="yes"
2167 target_phys_bits=32
2169 sparc)
2170 echo "TARGET_ARCH=sparc" >> $config_mak
2171 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
2172 echo "#define TARGET_SPARC 1" >> $config_h
2173 target_phys_bits=64
2175 sparc64)
2176 echo "TARGET_ARCH=sparc64" >> $config_mak
2177 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
2178 echo "#define TARGET_SPARC 1" >> $config_h
2179 echo "#define TARGET_SPARC64 1" >> $config_h
2180 elfload32="yes"
2181 target_phys_bits=64
2183 sparc32plus)
2184 echo "TARGET_ARCH=sparc64" >> $config_mak
2185 echo "TARGET_ABI_DIR=sparc" >> $config_mak
2186 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
2187 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
2188 echo "#define TARGET_SPARC 1" >> $config_h
2189 echo "#define TARGET_SPARC64 1" >> $config_h
2190 echo "#define TARGET_ABI32 1" >> $config_h
2191 target_phys_bits=64
2194 echo "Unsupported target CPU"
2195 exit 1
2197 esac
2198 if [ $target_phys_bits -lt $hostlongbits ] ; then
2199 target_phys_bits=$hostlongbits
2201 echo "HWLIB=../libhw$target_phys_bits/libqemuhw$target_phys_bits.a" >> $config_mak
2202 echo "#define TARGET_PHYS_ADDR_BITS $target_phys_bits" >> $config_h
2203 echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
2204 if test "$target_bigendian" = "yes" ; then
2205 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
2206 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
2208 if test "$target_softmmu" = "yes" ; then
2209 echo "CONFIG_SOFTMMU=yes" >> $config_mak
2210 echo "#define CONFIG_SOFTMMU 1" >> $config_h
2212 if test "$target_user_only" = "yes" ; then
2213 echo "CONFIG_USER_ONLY=yes" >> $config_mak
2214 echo "#define CONFIG_USER_ONLY 1" >> $config_h
2216 if test "$target_linux_user" = "yes" ; then
2217 echo "CONFIG_LINUX_USER=yes" >> $config_mak
2218 echo "#define CONFIG_LINUX_USER 1" >> $config_h
2220 if test "$target_darwin_user" = "yes" ; then
2221 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
2222 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
2224 list=""
2225 if test ! -z "$gdb_xml_files" ; then
2226 for x in $gdb_xml_files; do
2227 list="$list $source_path/gdb-xml/$x"
2228 done
2230 echo "TARGET_XML_FILES=$list" >> $config_mak
2232 if test "$target_cpu" = "arm" \
2233 -o "$target_cpu" = "armeb" \
2234 -o "$target_cpu" = "m68k" \
2235 -o "$target_cpu" = "mips" \
2236 -o "$target_cpu" = "mipsel" \
2237 -o "$target_cpu" = "mipsn32" \
2238 -o "$target_cpu" = "mipsn32el" \
2239 -o "$target_cpu" = "mips64" \
2240 -o "$target_cpu" = "mips64el" \
2241 -o "$target_cpu" = "ppc" \
2242 -o "$target_cpu" = "ppc64" \
2243 -o "$target_cpu" = "ppc64abi32" \
2244 -o "$target_cpu" = "ppcemb" \
2245 -o "$target_cpu" = "sparc" \
2246 -o "$target_cpu" = "sparc64" \
2247 -o "$target_cpu" = "sparc32plus"; then
2248 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
2249 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
2251 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
2252 echo "TARGET_HAS_BFLT=yes" >> $config_mak
2253 echo "#define TARGET_HAS_BFLT 1" >> $config_h
2255 if test "$target_user_only" = "yes" \
2256 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
2257 echo "#define USE_NPTL 1" >> $config_h
2259 # 32 bit ELF loader in addition to native 64 bit loader?
2260 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
2261 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
2262 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
2264 if test "$target_bsd_user" = "yes" ; then
2265 echo "CONFIG_BSD_USER=yes" >> $config_mak
2266 echo "#define CONFIG_BSD_USER 1" >> $config_h
2269 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
2271 done # for target in $targets
2273 # build tree in object directory if source path is different from current one
2274 if test "$source_path_used" = "yes" ; then
2275 DIRS="tests tests/cris slirp audio block"
2276 FILES="Makefile tests/Makefile"
2277 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
2278 FILES="$FILES tests/test-mmap.c"
2279 for dir in $DIRS ; do
2280 mkdir -p $dir
2281 done
2282 # remove the link and recreate it, as not all "ln -sf" overwrite the link
2283 for f in $FILES ; do
2284 rm -f $f
2285 ln -s $source_path/$f $f
2286 done
2289 for hwlib in 32 64; do
2290 d=libhw$hwlib
2291 mkdir -p $d
2292 rm -f $d/Makefile
2293 ln -s $source_path/Makefile.hw $d/Makefile
2294 echo "HWLIB=libqemuhw$hwlib.a" > $d/config.mak
2295 echo "CPPFLAGS=-DTARGET_PHYS_ADDR_BITS=$hwlib" >> $d/config.mak
2296 done