Default to building x86_64-softmmu for kvm
[qemu-kvm/fedora.git] / configure
blob3d91a582b6b101682dcb0f9409ad54823b939eac
1 #!/bin/sh
3 # qemu configure script (c) 2003 Fabrice Bellard
5 # set temporary file name
6 if test ! -z "$TMPDIR" ; then
7 TMPDIR1="${TMPDIR}"
8 elif test ! -z "$TEMPDIR" ; then
9 TMPDIR1="${TEMPDIR}"
10 else
11 TMPDIR1="/tmp"
14 TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
15 TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
16 TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"
17 TMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
18 TMPI="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.i"
19 TMPSDLLOG="${TMPDIR1}/qemu-conf-sdl-$$-${RANDOM}.log"
21 trap "rm -f $TMPC $TMPO $TMPE $TMPS $TMPI $TMPSDLLOG; exit" 0 2 3 15
23 # default parameters
24 prefix=""
25 interp_prefix="/usr/gnemul/qemu-%M"
26 static="no"
27 cross_prefix=""
28 cc="gcc"
29 audio_drv_list=""
30 audio_card_list="ac97 es1370 sb16"
31 audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus"
32 host_cc="gcc"
33 ar="ar"
34 make="make"
35 install="install"
36 strip="strip"
38 # parse CC options first
39 for opt do
40 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
41 case "$opt" in
42 --cross-prefix=*) cross_prefix="$optarg"
44 --cc=*) cc="$optarg"
46 esac
47 done
49 # OS specific
50 # Using uname is really, really broken. Once we have the right set of checks
51 # we can eliminate it's usage altogether
53 cc="${cross_prefix}${cc}"
54 ar="${cross_prefix}${ar}"
55 strip="${cross_prefix}${strip}"
57 # check that the C compiler works.
58 cat > $TMPC <<EOF
59 int main(void) {}
60 EOF
62 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
63 : C compiler works ok
64 else
65 echo "ERROR: \"$cc\" either does not exist or does not work"
66 exit 1
69 check_define() {
70 cat > $TMPC <<EOF
71 #if !defined($1)
72 #error Not defined
73 #endif
74 int main(void) { return 0; }
75 EOF
76 $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
79 if check_define __i386__ ; then
80 cpu="i386"
81 elif check_define __x86_64__ ; then
82 cpu="x86_64"
83 elif check_define __sparc__ ; then
84 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
85 # They must be specified using --sparc_cpu
86 if check_define __arch64__ ; then
87 cpu="sparc64"
88 else
89 cpu="sparc"
91 elif check_define _ARCH_PPC ; then
92 if check_define _ARCH_PPC64 ; then
93 cpu="ppc64"
94 else
95 cpu="ppc"
97 else
98 cpu=`uname -m`
101 target_list="x86_64-softmmu"
102 case "$cpu" in
103 i386|i486|i586|i686|i86pc|BePC)
104 cpu="i386"
106 x86_64|amd64)
107 cpu="x86_64"
109 alpha)
110 cpu="alpha"
112 armv*b)
113 cpu="armv4b"
115 armv*l)
116 cpu="armv4l"
118 cris)
119 cpu="cris"
121 parisc|parisc64)
122 cpu="hppa"
124 ia64)
125 cpu="ia64"
127 m68k)
128 cpu="m68k"
130 mips)
131 cpu="mips"
133 mips64)
134 cpu="mips64"
136 ppc)
137 cpu="ppc"
139 ppc64)
140 cpu="ppc64"
142 s390*)
143 cpu="s390"
145 sparc|sun4[cdmuv])
146 cpu="sparc"
148 sparc64)
149 cpu="sparc64"
152 cpu="unknown"
154 esac
155 gprof="no"
156 sparse="no"
157 strip_opt="yes"
158 bigendian="no"
159 mingw32="no"
160 EXESUF=""
161 gdbstub="yes"
162 slirp="yes"
163 vde="yes"
164 fmod_lib=""
165 fmod_inc=""
166 oss_lib=""
167 vnc_tls="yes"
168 vnc_sasl="yes"
169 bsd="no"
170 linux="no"
171 solaris="no"
172 kqemu="no"
173 profiler="no"
174 cocoa="no"
175 check_gfx="yes"
176 softmmu="yes"
177 linux_user="no"
178 darwin_user="no"
179 bsd_user="no"
180 build_docs="no"
181 uname_release=""
182 curses="yes"
183 aio="yes"
184 nptl="yes"
185 mixemu="no"
186 bluez="yes"
187 kvm="yes"
188 kvm_cap_pit="no"
189 kvm_cap_device_assignment="no"
190 kerneldir=""
191 aix="no"
192 blobs="yes"
193 fdt="yes"
194 sdl_x11="no"
195 signalfd="no"
196 eventfd="no"
197 cpu_emulation="yes"
199 # qemu-kvm: use local kerneldir
200 kerneldir="$(readlink -f kvm/kernel)"
202 # OS specific
203 if check_define __linux__ ; then
204 targetos="Linux"
205 elif check_define _WIN32 ; then
206 targetos='MINGW32'
207 else
208 targetos=`uname -s`
210 case $targetos in
211 CYGWIN*)
212 mingw32="yes"
213 OS_CFLAGS="-mno-cygwin"
214 if [ "$cpu" = "i386" ] ; then
215 kqemu="yes"
217 audio_possible_drivers="sdl"
219 MINGW32*)
220 mingw32="yes"
221 if [ "$cpu" = "i386" ] ; then
222 kqemu="yes"
224 audio_possible_drivers="dsound sdl fmod"
226 GNU/kFreeBSD)
227 audio_drv_list="oss"
228 audio_possible_drivers="oss sdl esd pa"
229 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
230 kqemu="yes"
233 FreeBSD)
234 bsd="yes"
235 audio_drv_list="oss"
236 audio_possible_drivers="oss sdl esd pa"
237 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
238 kqemu="yes"
239 kvm="yes"
242 DragonFly)
243 bsd="yes"
244 audio_drv_list="oss"
245 audio_possible_drivers="oss sdl esd pa"
246 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
247 kqemu="yes"
249 aio="no"
251 NetBSD)
252 bsd="yes"
253 audio_drv_list="oss"
254 audio_possible_drivers="oss sdl esd"
255 oss_lib="-lossaudio"
257 OpenBSD)
258 bsd="yes"
259 openbsd="yes"
260 audio_drv_list="oss"
261 audio_possible_drivers="oss sdl esd"
262 oss_lib="-lossaudio"
264 Darwin)
265 bsd="yes"
266 darwin="yes"
267 # 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
268 if [ "$cpu" = "i386" ] ; then
269 is_x86_64=`sysctl -n hw.optional.x86_64`
270 [ "$is_x86_64" = "1" ] && cpu=x86_64
272 if [ "$cpu" = "x86_64" ] ; then
273 OS_CFLAGS="-arch x86_64"
274 LDFLAGS="-arch x86_64"
275 else
276 OS_CFLAGS="-mdynamic-no-pic"
278 darwin_user="yes"
279 cocoa="yes"
280 audio_drv_list="coreaudio"
281 audio_possible_drivers="coreaudio sdl fmod"
282 OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
284 SunOS)
285 solaris="yes"
286 make="gmake"
287 install="ginstall"
288 needs_libsunmath="no"
289 solarisrev=`uname -r | cut -f2 -d.`
290 # have to select again, because `uname -m` returns i86pc
291 # even on an x86_64 box.
292 solariscpu=`isainfo -k`
293 if test "${solariscpu}" = "amd64" ; then
294 cpu="x86_64"
296 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
297 if test "$solarisrev" -le 9 ; then
298 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
299 needs_libsunmath="yes"
300 else
301 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
302 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
303 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
304 echo "Studio 11 can be downloaded from www.sun.com."
305 exit 1
308 if test "$solarisrev" -ge 9 ; then
309 kqemu="yes"
312 if test -f /usr/include/sys/soundcard.h ; then
313 audio_drv_list="oss"
315 audio_possible_drivers="oss sdl"
317 AIX)
318 aix="yes"
319 make="gmake"
322 audio_drv_list="oss"
323 audio_possible_drivers="oss alsa sdl esd pa"
324 linux="yes"
325 linux_user="yes"
326 usb="linux"
327 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
328 kqemu="yes"
329 audio_possible_drivers="$audio_possible_drivers fmod"
330 kvm="yes"
332 if [ "$cpu" = "ia64" ] ; then
333 kvm="yes"
334 cpu_emulation="no"
335 gdbstub="no"
336 slirp="no"
338 if [ "$cpu" = "powerpc" ]; then
339 kvm="yes"
342 esac
344 if [ "$bsd" = "yes" ] ; then
345 if [ "$darwin" != "yes" ] ; then
346 make="gmake"
347 usb="bsd"
349 bsd_user="yes"
352 # find source path
353 source_path=`dirname "$0"`
354 source_path_used="no"
355 workdir=`pwd`
356 if [ -z "$source_path" ]; then
357 source_path=$workdir
358 else
359 source_path=`cd "$source_path"; pwd`
361 [ -f "$workdir/vl.c" ] || source_path_used="yes"
363 werror="no"
364 # generate compile errors on warnings for development builds
365 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
366 #werror="yes";
369 for opt do
370 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
371 case "$opt" in
372 --help|-h) show_help=yes
374 --prefix=*) prefix="$optarg"
376 --interp-prefix=*) interp_prefix="$optarg"
378 --source-path=*) source_path="$optarg"
379 source_path_used="yes"
381 --cross-prefix=*)
383 --cc=*)
385 --host-cc=*) host_cc="$optarg"
387 --make=*) make="$optarg"
389 --install=*) install="$optarg"
391 --extra-cflags=*) CFLAGS="$optarg"
393 --extra-ldflags=*) LDFLAGS="$optarg"
395 --cpu=*) cpu="$optarg"
397 --target-list=*) target_list="$optarg"
399 --enable-gprof) gprof="yes"
401 --static) static="yes"
403 --disable-sdl) sdl="no"
405 --fmod-lib=*) fmod_lib="$optarg"
407 --fmod-inc=*) fmod_inc="$optarg"
409 --oss-lib=*) oss_lib="$optarg"
411 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
413 --audio-drv-list=*) audio_drv_list="$optarg"
415 --enable-sparse) sparse="yes"
417 --disable-sparse) sparse="no"
419 --disable-strip) strip_opt="no"
421 --disable-vnc-tls) vnc_tls="no"
423 --disable-vnc-sasl) vnc_sasl="no"
425 --disable-slirp) slirp="no"
427 --disable-vde) vde="no"
429 --disable-kqemu) kqemu="no"
431 --disable-brlapi) brlapi="no"
433 --disable-bluez) bluez="no"
435 --disable-kvm) kvm="no"
437 --enable-profiler) profiler="yes"
439 --enable-cocoa)
440 cocoa="yes" ;
441 sdl="no" ;
442 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
444 --disable-gfx-check) check_gfx="no"
446 --disable-system) softmmu="no"
448 --enable-system) softmmu="yes"
450 --disable-linux-user) linux_user="no"
452 --enable-linux-user) linux_user="yes"
454 --disable-darwin-user) darwin_user="no"
456 --enable-darwin-user) darwin_user="yes"
458 --disable-bsd-user) bsd_user="no"
460 --enable-bsd-user) bsd_user="yes"
462 --enable-uname-release=*) uname_release="$optarg"
464 --sparc_cpu=*)
465 sparc_cpu="$optarg"
466 case $sparc_cpu in
467 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
468 target_cpu="sparc"; cpu="sparc" ;;
469 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
470 target_cpu="sparc"; cpu="sparc" ;;
471 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
472 target_cpu="sparc64"; cpu="sparc64" ;;
473 *) echo "undefined SPARC architecture. Exiting";exit 1;;
474 esac
476 --enable-werror) werror="yes"
478 --disable-werror) werror="no"
480 --disable-curses) curses="no"
482 --disable-nptl) nptl="no"
484 --enable-mixemu) mixemu="yes"
486 --disable-aio) aio="no"
488 --disable-blobs) blobs="no"
490 --kerneldir=*) kerneldir="$optarg"
492 --disable-cpu-emulation) cpu_emulation="no"
494 *) echo "ERROR: unknown option $opt"; exit 1
496 esac
497 done
499 # default flags for all hosts
500 CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
501 CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
502 LDFLAGS="$LDFLAGS -g"
503 if test "$werror" = "yes" ; then
504 CFLAGS="$CFLAGS -Werror"
507 CFLAGS="$CFLAGS -I$(readlink -f "kvm/libkvm")"
509 if test "$solaris" = "no" ; then
510 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
511 LDFLAGS="$LDFLAGS -Wl,--warn-common"
516 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
517 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
519 case "$cpu" in
520 sparc) if test -z "$sparc_cpu" ; then
521 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
522 ARCH_LDFLAGS="-m32"
523 else
524 ARCH_CFLAGS="${SP_CFLAGS}"
525 ARCH_LDFLAGS="${SP_LDFLAGS}"
527 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g2 -ffixed-g3"
528 if test "$solaris" = "no" ; then
529 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g6"
532 sparc64) if test -z "$sparc_cpu" ; then
533 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
534 ARCH_LDFLAGS="-m64"
535 else
536 ARCH_CFLAGS="${SP_CFLAGS}"
537 ARCH_LDFLAGS="${SP_LDFLAGS}"
539 if test "$solaris" = "no" ; then
540 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g5 -ffixed-g6 -ffixed-g7"
541 else
542 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7"
545 s390)
546 ARCH_CFLAGS="-march=z900"
548 i386)
549 ARCH_CFLAGS="-m32"
550 ARCH_LDFLAGS="-m32"
552 x86_64)
553 ARCH_CFLAGS="-m64"
554 ARCH_LDFLAGS="-m64"
556 esac
558 if test x"$show_help" = x"yes" ; then
559 cat << EOF
561 Usage: configure [options]
562 Options: [defaults in brackets after descriptions]
565 echo "Standard options:"
566 echo " --help print this message"
567 echo " --prefix=PREFIX install in PREFIX [$prefix]"
568 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
569 echo " use %M for cpu name [$interp_prefix]"
570 echo " --target-list=LIST set target list [$target_list]"
571 echo ""
572 echo "kqemu kernel acceleration support:"
573 echo " --disable-kqemu disable kqemu support"
574 echo ""
575 echo "Advanced options (experts only):"
576 echo " --source-path=PATH path of source code [$source_path]"
577 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
578 echo " --cc=CC use C compiler CC [$cc]"
579 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
580 echo " --extra-cflags=CFLAGS add C compiler flags CFLAGS"
581 echo " --extra-ldflags=LDFLAGS add linker flags LDFLAGS"
582 echo " --make=MAKE use specified make [$make]"
583 echo " --install=INSTALL use specified install [$install]"
584 echo " --static enable static build [$static]"
585 echo " --enable-sparse enable sparse checker"
586 echo " --disable-sparse disable sparse checker (default)"
587 echo " --disable-strip disable stripping binaries"
588 echo " --disable-werror disable compilation abort on warning"
589 echo " --disable-sdl disable SDL"
590 echo " --enable-cocoa enable COCOA (Mac OS X only)"
591 echo " --audio-drv-list=LIST set audio drivers list:"
592 echo " Available drivers: $audio_possible_drivers"
593 echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
594 echo " Available cards: $audio_possible_cards"
595 echo " --enable-mixemu enable mixer emulation"
596 echo " --disable-brlapi disable BrlAPI"
597 echo " --disable-vnc-tls disable TLS encryption for VNC server"
598 echo " --disable-vnc-sasl disable SASL encryption for VNC server"
599 echo " --disable-curses disable curses output"
600 echo " --disable-bluez disable bluez stack connectivity"
601 echo " --disable-kvm disable KVM acceleration support"
602 echo " --disable-nptl disable usermode NPTL support"
603 echo " --enable-system enable all system emulation targets"
604 echo " --disable-system disable all system emulation targets"
605 echo " --enable-linux-user enable all linux usermode emulation targets"
606 echo " --disable-linux-user disable all linux usermode emulation targets"
607 echo " --enable-darwin-user enable all darwin usermode emulation targets"
608 echo " --disable-darwin-user disable all darwin usermode emulation targets"
609 echo " --enable-bsd-user enable all BSD usermode emulation targets"
610 echo " --disable-bsd-user disable all BSD usermode emulation targets"
611 echo " --fmod-lib path to FMOD library"
612 echo " --fmod-inc path to FMOD includes"
613 echo " --oss-lib path to OSS library"
614 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
615 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
616 echo " --disable-vde disable support for vde network"
617 echo " --disable-aio disable AIO support"
618 echo " --disable-blobs disable installing provided firmware blobs"
619 echo " --kerneldir=PATH look for kernel includes in PATH"
620 echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
621 echo ""
622 echo "NOTE: The object files are built at the place where configure is launched"
623 exit 1
626 if test "$mingw32" = "yes" ; then
627 linux="no"
628 EXESUF=".exe"
629 oss="no"
630 linux_user="no"
631 bsd_user="no"
632 OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
635 if test ! -x "$(which cgcc 2>/dev/null)"; then
636 sparse="no"
640 # Solaris specific configure tool chain decisions
642 if test "$solaris" = "yes" ; then
643 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
644 if test -z "$solinst" ; then
645 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
646 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
647 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
648 exit 1
650 if test "$solinst" = "/usr/sbin/install" ; then
651 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
652 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
653 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
654 exit 1
656 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
657 if test -z "$sol_ar" ; then
658 echo "Error: No path includes ar"
659 if test -f /usr/ccs/bin/ar ; then
660 echo "Add /usr/ccs/bin to your path and rerun configure"
662 exit 1
667 if test -z "$target_list" ; then
668 # these targets are portable
669 if [ "$softmmu" = "yes" ] ; then
670 target_list="\
671 i386-softmmu \
672 x86_64-softmmu \
673 arm-softmmu \
674 cris-softmmu \
675 m68k-softmmu \
676 mips-softmmu \
677 mipsel-softmmu \
678 mips64-softmmu \
679 mips64el-softmmu \
680 ppc-softmmu \
681 ppcemb-softmmu \
682 ppc64-softmmu \
683 sh4-softmmu \
684 sh4eb-softmmu \
685 sparc-softmmu \
688 # the following are Linux specific
689 if [ "$linux_user" = "yes" ] ; then
690 target_list="${target_list}\
691 i386-linux-user \
692 x86_64-linux-user \
693 alpha-linux-user \
694 arm-linux-user \
695 armeb-linux-user \
696 cris-linux-user \
697 m68k-linux-user \
698 mips-linux-user \
699 mipsel-linux-user \
700 ppc-linux-user \
701 ppc64-linux-user \
702 ppc64abi32-linux-user \
703 sh4-linux-user \
704 sh4eb-linux-user \
705 sparc-linux-user \
706 sparc64-linux-user \
707 sparc32plus-linux-user \
710 # the following are Darwin specific
711 if [ "$darwin_user" = "yes" ] ; then
712 target_list="$target_list i386-darwin-user ppc-darwin-user "
714 # the following are BSD specific
715 if [ "$bsd_user" = "yes" ] ; then
716 target_list="${target_list}\
717 sparc64-bsd-user \
720 else
721 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
723 if test -z "$target_list" ; then
724 echo "No targets enabled"
725 exit 1
728 if test -z "$cross_prefix" ; then
730 # ---
731 # big/little endian test
732 cat > $TMPC << EOF
733 #include <inttypes.h>
734 int main(int argc, char ** argv){
735 volatile uint32_t i=0x01234567;
736 return (*((uint8_t*)(&i))) == 0x67;
740 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
741 $TMPE && bigendian="yes"
742 else
743 echo big/little test failed
746 else
748 # if cross compiling, cannot launch a program, so make a static guess
749 if test "$cpu" = "armv4b" \
750 -o "$cpu" = "hppa" \
751 -o "$cpu" = "m68k" \
752 -o "$cpu" = "mips" \
753 -o "$cpu" = "mips64" \
754 -o "$cpu" = "ppc" \
755 -o "$cpu" = "ppc64" \
756 -o "$cpu" = "s390" \
757 -o "$cpu" = "sparc" \
758 -o "$cpu" = "sparc64"; then
759 bigendian="yes"
764 # host long bits test
765 hostlongbits="32"
766 if test "$cpu" = "x86_64" \
767 -o "$cpu" = "alpha" \
768 -o "$cpu" = "ia64" \
769 -o "$cpu" = "sparc64" \
770 -o "$cpu" = "ppc64"; then
771 hostlongbits="64"
774 # Check host NPTL support
775 cat > $TMPC <<EOF
776 #include <sched.h>
777 #include <linux/futex.h>
778 void foo()
780 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
781 #error bork
782 #endif
786 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
788 else
789 nptl="no"
792 ##########################################
793 # KVM probe
795 if test "$kvm" = "yes" ; then
797 # test for KVM_CAP_PIT
799 cat > $TMPC <<EOF
800 #include <libkvm.h>
801 #ifndef KVM_CAP_PIT
802 #error "kvm no pit capability"
803 #endif
804 int main(void) { return 0; }
806 if $cc $ARCH_CFLAGS $CFLAGS -I"$kerneldir"/include -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev/null ; then
807 kvm_cap_pit="yes"
810 # test for KVM_CAP_DEVICE_ASSIGNMENT
812 cat > $TMPC <<EOF
813 #include <libkvm.h>
814 #ifndef KVM_CAP_DEVICE_ASSIGNMENT
815 #error "kvm no device assignment capability"
816 #endif
817 int main(void) { return 0; }
819 if $cc $ARCH_CFLAGS $CFLAGS -I"$kerneldir"/include -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev/null ; then
820 kvm_cap_device_assignment="yes"
824 # libpci probe for kvm_cap_device_assignment
825 if test $kvm_cap_device_assignment = "yes" ; then
826 cat > $TMPC << EOF
827 #include <pci/pci.h>
828 #ifndef PCI_VENDOR_ID
829 #error NO LIBPCI
830 #endif
831 int main(void) { return 0; }
833 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC 2>/dev/null ; then
835 else
836 echo
837 echo "Error: libpci check failed"
838 echo "Disable KVM Device Assignment capability."
839 echo
840 kvm_cap_device_assignment="no"
844 ##########################################
845 # zlib check
847 cat > $TMPC << EOF
848 #include <zlib.h>
849 int main(void) { zlibVersion(); return 0; }
851 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
853 else
854 echo
855 echo "Error: zlib check failed"
856 echo "Make sure to have the zlib libs and headers installed."
857 echo
858 exit 1
861 ##########################################
862 # SDL probe
864 sdl_too_old=no
866 if test -z "$sdl" ; then
867 sdl_config="sdl-config"
868 sdl=no
869 sdl_static=no
871 cat > $TMPC << EOF
872 #include <SDL.h>
873 #undef main /* We don't want SDL to override our main() */
874 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
876 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
877 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
878 if test "$_sdlversion" -lt 121 ; then
879 sdl_too_old=yes
880 else
881 if test "$cocoa" = "no" ; then
882 sdl=yes
886 # static link with sdl ?
887 if test "$sdl" = "yes" ; then
888 aa="no"
889 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
890 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
891 if [ "$aa" = "yes" ] ; then
892 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
895 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then
896 sdl_static=yes
898 fi # static link
899 fi # sdl compile test
900 else
901 # Make sure to disable cocoa if sdl was set
902 if test "$sdl" = "yes" ; then
903 cocoa="no"
904 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
906 fi # -z $sdl
908 if test "$sdl" = "yes" ; then
909 cat > $TMPC <<EOF
910 #include <SDL.h>
911 #if defined(SDL_VIDEO_DRIVER_X11)
912 #include <X11/XKBlib.h>
913 #else
914 #error No x11 support
915 #endif
916 int main(void) { return 0; }
918 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
919 sdl_x11="yes"
923 ##########################################
924 # VNC TLS detection
925 if test "$vnc_tls" = "yes" ; then
926 cat > $TMPC <<EOF
927 #include <gnutls/gnutls.h>
928 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
930 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
931 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
932 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
933 $vnc_tls_libs > /dev/null 2> /dev/null ; then
935 else
936 vnc_tls="no"
940 ##########################################
941 # VNC SASL detection
942 if test "$vnc_sasl" = "yes" ; then
943 cat > $TMPC <<EOF
944 #include <sasl/sasl.h>
945 #include <stdio.h>
946 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
948 # Assuming Cyrus-SASL installed in /usr prefix
949 vnc_sasl_cflags=""
950 vnc_sasl_libs="-lsasl2"
951 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
952 $vnc_sasl_libs 2> /dev/null ; then
954 else
955 vnc_sasl="no"
959 ##########################################
960 # fnmatch() probe, used for ACL routines
961 fnmatch="no"
962 cat > $TMPC << EOF
963 #include <fnmatch.h>
964 int main(void)
966 fnmatch("foo", "foo", 0);
967 return 0;
970 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
971 fnmatch="yes"
974 ##########################################
975 # vde libraries probe
976 if test "$vde" = "yes" ; then
977 cat > $TMPC << EOF
978 #include <libvdeplug.h>
979 int main(void)
981 struct vde_open_args a = {0, 0, 0};
982 vde_open("", "", &a);
983 return 0;
986 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
988 else
989 vde="no"
993 ##########################################
994 # Sound support libraries probe
996 audio_drv_probe()
998 drv=$1
999 hdr=$2
1000 lib=$3
1001 exp=$4
1002 cfl=$5
1003 cat > $TMPC << EOF
1004 #include <$hdr>
1005 int main(void) { $exp }
1007 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
1009 else
1010 echo
1011 echo "Error: $drv check failed"
1012 echo "Make sure to have the $drv libs and headers installed."
1013 echo
1014 exit 1
1018 audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1019 for drv in $audio_drv_list; do
1020 case $drv in
1021 alsa)
1022 audio_drv_probe $drv alsa/asoundlib.h -lasound \
1023 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1026 fmod)
1027 if test -z $fmod_lib || test -z $fmod_inc; then
1028 echo
1029 echo "Error: You must specify path to FMOD library and headers"
1030 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1031 echo
1032 exit 1
1034 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1037 esd)
1038 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1042 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
1043 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1046 oss|sdl|core|wav|dsound)
1047 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1051 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
1052 echo
1053 echo "Error: Unknown driver '$drv' selected"
1054 echo "Possible drivers are: $audio_possible_drivers"
1055 echo
1056 exit 1
1059 esac
1060 done
1062 ##########################################
1063 # BrlAPI probe
1065 if test -z "$brlapi" ; then
1066 brlapi=no
1067 cat > $TMPC << EOF
1068 #include <brlapi.h>
1069 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1071 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
1072 brlapi=yes
1073 fi # brlapi compile test
1074 fi # -z $brlapi
1076 ##########################################
1077 # curses probe
1079 if test "$curses" = "yes" ; then
1080 curses=no
1081 cat > $TMPC << EOF
1082 #include <curses.h>
1083 int main(void) { return curses_version(); }
1085 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
1086 curses=yes
1088 fi # test "$curses"
1090 ##########################################
1091 # bluez support probe
1092 if test "$bluez" = "yes" ; then
1093 `pkg-config bluez` || bluez="no"
1095 if test "$bluez" = "yes" ; then
1096 cat > $TMPC << EOF
1097 #include <bluetooth/bluetooth.h>
1098 int main(void) { return bt_error(0); }
1100 bluez_cflags=`pkg-config --cflags bluez`
1101 bluez_libs=`pkg-config --libs bluez`
1102 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
1103 $bluez_libs > /dev/null 2> /dev/null ; then
1105 else
1106 bluez="no"
1110 ##########################################
1111 # kvm probe
1112 if test "$kvm" = "yes" ; then
1113 cat > $TMPC <<EOF
1114 #include <linux/kvm.h>
1115 #if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
1116 #error Invalid KVM version
1117 #endif
1118 #if !defined(KVM_CAP_USER_MEMORY)
1119 #error Missing KVM capability KVM_CAP_USER_MEMORY
1120 #endif
1121 #if !defined(KVM_CAP_SET_TSS_ADDR)
1122 #error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1123 #endif
1124 #if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1125 #error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1126 #endif
1127 int main(void) { return 0; }
1129 if test "$kerneldir" != "" ; then
1130 kvm_cflags=-I"$kerneldir"/include
1131 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1132 -a -d "$kerneldir/arch/x86/include" ; then
1133 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
1134 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1135 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
1136 elif test -d "$kerneldir/arch/$cpu/include" ; then
1137 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1139 else
1140 kvm_cflags=""
1142 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
1143 > /dev/null 2>/dev/null ; then
1145 else
1146 kvm="no";
1147 if [ -x "`which awk 2>/dev/null`" ] && \
1148 [ -x "`which grep 2>/dev/null`" ]; then
1149 kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
1150 | grep "error: " \
1151 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1152 if test "$kvmerr" != "" ; then
1153 kvm="no - (${kvmerr})"
1159 ##########################################
1160 # AIO probe
1161 AIOLIBS=""
1163 if test "$aio" = "yes" ; then
1164 aio=no
1165 cat > $TMPC << EOF
1166 #include <pthread.h>
1167 int main(void) { pthread_mutex_t lock; return 0; }
1169 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
1170 aio=yes
1171 AIOLIBS="-lpthread"
1175 ##########################################
1176 # iovec probe
1177 cat > $TMPC <<EOF
1178 #include <sys/types.h>
1179 #include <sys/uio.h>
1180 #include <unistd.h>
1181 int main(void) { struct iovec iov; return 0; }
1183 iovec=no
1184 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1185 iovec=yes
1188 ##########################################
1189 # preadv probe
1190 cat > $TMPC <<EOF
1191 #include <sys/types.h>
1192 #include <sys/uio.h>
1193 #include <unistd.h>
1194 int main(void) { preadv; }
1196 preadv=no
1197 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1198 preadv=yes
1201 ##########################################
1202 # fdt probe
1203 if test "$fdt" = "yes" ; then
1204 fdt=no
1205 cat > $TMPC << EOF
1206 int main(void) { return 0; }
1208 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null ; then
1209 fdt=yes
1213 ##########################################
1214 # signalfd probe
1215 cat > $TMPC << EOF
1216 #define _GNU_SOURCE
1217 #include <unistd.h>
1218 #include <sys/syscall.h>
1219 #include <signal.h>
1220 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
1223 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1224 signalfd=yes
1227 ##########################################
1228 # eventfd probe
1229 cat > $TMPC << EOF
1230 #define _GNU_SOURCE
1231 #include <unistd.h>
1232 #include <sys/syscall.h>
1233 int main(void) { return syscall(SYS_eventfd, 0); }
1236 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1237 eventfd=yes
1240 # Check if tools are available to build documentation.
1241 if [ -x "`which texi2html 2>/dev/null`" ] && \
1242 [ -x "`which pod2man 2>/dev/null`" ]; then
1243 build_docs="yes"
1246 ##########################################
1247 # Do we need librt
1248 cat > $TMPC <<EOF
1249 #include <signal.h>
1250 #include <time.h>
1251 int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1254 rt=no
1255 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1257 elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
1258 rt=yes
1261 if test "$rt" = "yes" ; then
1262 # Hack, we should have a general purpose LIBS for this sort of thing
1263 AIOLIBS="$AIOLIBS -lrt"
1266 if test "$mingw32" = "yes" ; then
1267 if test -z "$prefix" ; then
1268 prefix="c:\\\\Program Files\\\\Qemu"
1270 mansuffix=""
1271 datasuffix=""
1272 docsuffix=""
1273 binsuffix=""
1274 else
1275 if test -z "$prefix" ; then
1276 prefix="/usr/local"
1278 mansuffix="/share/man"
1279 datasuffix="/share/qemu"
1280 docsuffix="/share/doc/qemu"
1281 binsuffix="/bin"
1284 echo "Install prefix $prefix"
1285 echo "BIOS directory $prefix$datasuffix"
1286 echo "binary directory $prefix$binsuffix"
1287 if test "$mingw32" = "no" ; then
1288 echo "Manual directory $prefix$mansuffix"
1289 echo "ELF interp prefix $interp_prefix"
1291 echo "Source path $source_path"
1292 echo "C compiler $cc"
1293 echo "Host C compiler $host_cc"
1294 echo "ARCH_CFLAGS $ARCH_CFLAGS"
1295 echo "make $make"
1296 echo "install $install"
1297 echo "host CPU $cpu"
1298 echo "host big endian $bigendian"
1299 echo "target list $target_list"
1300 echo "gprof enabled $gprof"
1301 echo "sparse enabled $sparse"
1302 echo "strip binaries $strip_opt"
1303 echo "profiler $profiler"
1304 echo "static build $static"
1305 echo "-Werror enabled $werror"
1306 if test "$darwin" = "yes" ; then
1307 echo "Cocoa support $cocoa"
1309 echo "SDL support $sdl"
1310 if test "$sdl" != "no" ; then
1311 echo "SDL static link $sdl_static"
1313 echo "curses support $curses"
1314 echo "mingw32 support $mingw32"
1315 echo "Audio drivers $audio_drv_list"
1316 echo "Extra audio cards $audio_card_list"
1317 echo "Mixer emulation $mixemu"
1318 echo "VNC TLS support $vnc_tls"
1319 if test "$vnc_tls" = "yes" ; then
1320 echo " TLS CFLAGS $vnc_tls_cflags"
1321 echo " TLS LIBS $vnc_tls_libs"
1323 echo "VNC SASL support $vnc_sasl"
1324 if test "$vnc_sasl" = "yes" ; then
1325 echo " SASL CFLAGS $vnc_sasl_cflags"
1326 echo " SASL LIBS $vnc_sasl_libs"
1328 if test -n "$sparc_cpu"; then
1329 echo "Target Sparc Arch $sparc_cpu"
1331 echo "kqemu support $kqemu"
1332 echo "kvm support $kvm"
1333 echo "CPU emulation $cpu_emulation"
1334 echo "brlapi support $brlapi"
1335 echo "Documentation $build_docs"
1336 [ ! -z "$uname_release" ] && \
1337 echo "uname -r $uname_release"
1338 echo "NPTL support $nptl"
1339 echo "vde support $vde"
1340 echo "AIO support $aio"
1341 echo "Install blobs $blobs"
1342 echo "KVM support $kvm"
1343 echo "fdt support $fdt"
1344 echo "preadv support $preadv"
1346 if test $sdl_too_old = "yes"; then
1347 echo "-> Your SDL version is too old - please upgrade to have SDL support"
1349 if [ -s $TMPSDLLOG ]; then
1350 echo "The error log from compiling the libSDL test is: "
1351 cat $TMPSDLLOG
1353 #if test "$sdl_static" = "no"; then
1354 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1356 config_mak="config-host.mak"
1357 config_h="config-host.h"
1359 #echo "Creating $config_mak and $config_h"
1361 test -f $config_h && mv $config_h ${config_h}~
1363 echo "# Automatically generated by configure - do not modify" > $config_mak
1364 printf "# Configured with:" >> $config_mak
1365 printf " '%s'" "$0" "$@" >> $config_mak
1366 echo >> $config_mak
1367 echo "/* Automatically generated by configure - do not modify */" > $config_h
1369 echo "prefix=$prefix" >> $config_mak
1370 echo "bindir=\${prefix}$binsuffix" >> $config_mak
1371 echo "mandir=\${prefix}$mansuffix" >> $config_mak
1372 echo "datadir=\${prefix}$datasuffix" >> $config_mak
1373 echo "docdir=\${prefix}$docsuffix" >> $config_mak
1374 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
1375 echo "MAKE=$make" >> $config_mak
1376 echo "INSTALL=$install" >> $config_mak
1377 echo "CC=$cc" >> $config_mak
1378 echo "HOST_CC=$host_cc" >> $config_mak
1379 echo "AR=$ar" >> $config_mak
1380 # XXX: only use CFLAGS and LDFLAGS ?
1381 # XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1382 # compilation of dyngen tool (useful for win32 build on Linux host)
1383 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
1384 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1385 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1386 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
1387 echo "CFLAGS=$CFLAGS" >> $config_mak
1388 echo "LDFLAGS=$LDFLAGS" >> $config_mak
1389 echo "EXESUF=$EXESUF" >> $config_mak
1390 echo "AIOLIBS=$AIOLIBS" >> $config_mak
1391 case "$cpu" in
1392 i386)
1393 echo "ARCH=i386" >> $config_mak
1394 echo "#define HOST_I386 1" >> $config_h
1396 x86_64)
1397 echo "ARCH=x86_64" >> $config_mak
1398 echo "#define HOST_X86_64 1" >> $config_h
1400 alpha)
1401 echo "ARCH=alpha" >> $config_mak
1402 echo "#define HOST_ALPHA 1" >> $config_h
1404 armv4b)
1405 echo "ARCH=arm" >> $config_mak
1406 echo "#define HOST_ARM 1" >> $config_h
1408 armv4l)
1409 echo "ARCH=arm" >> $config_mak
1410 echo "#define HOST_ARM 1" >> $config_h
1412 cris)
1413 echo "ARCH=cris" >> $config_mak
1414 echo "#define HOST_CRIS 1" >> $config_h
1416 hppa)
1417 echo "ARCH=hppa" >> $config_mak
1418 echo "#define HOST_HPPA 1" >> $config_h
1420 ia64)
1421 echo "ARCH=ia64" >> $config_mak
1422 echo "#define HOST_IA64 1" >> $config_h
1424 m68k)
1425 echo "ARCH=m68k" >> $config_mak
1426 echo "#define HOST_M68K 1" >> $config_h
1428 mips)
1429 echo "ARCH=mips" >> $config_mak
1430 echo "#define HOST_MIPS 1" >> $config_h
1432 mips64)
1433 echo "ARCH=mips64" >> $config_mak
1434 echo "#define HOST_MIPS64 1" >> $config_h
1436 ppc)
1437 echo "ARCH=ppc" >> $config_mak
1438 echo "#define HOST_PPC 1" >> $config_h
1440 ppc64)
1441 echo "ARCH=ppc64" >> $config_mak
1442 echo "#define HOST_PPC64 1" >> $config_h
1444 s390)
1445 echo "ARCH=s390" >> $config_mak
1446 echo "#define HOST_S390 1" >> $config_h
1448 sparc)
1449 echo "ARCH=sparc" >> $config_mak
1450 echo "#define HOST_SPARC 1" >> $config_h
1452 sparc64)
1453 echo "ARCH=sparc64" >> $config_mak
1454 echo "#define HOST_SPARC64 1" >> $config_h
1457 echo "Unsupported CPU = $cpu"
1458 exit 1
1460 esac
1461 if test "$sparse" = "yes" ; then
1462 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1463 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1464 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1466 if test "$strip_opt" = "yes" ; then
1467 echo "STRIP_OPT=-s" >> $config_mak
1469 if test "$bigendian" = "yes" ; then
1470 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1471 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1473 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
1474 if test "$mingw32" = "yes" ; then
1475 echo "CONFIG_WIN32=yes" >> $config_mak
1476 echo "#define CONFIG_WIN32 1" >> $config_h
1477 else
1478 cat > $TMPC << EOF
1479 #include <byteswap.h>
1480 int main(void) { return bswap_32(0); }
1482 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
1483 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1485 cat > $TMPC << EOF
1486 #include <sys/endian.h>
1487 #include <sys/types.h>
1488 #include <machine/bswap.h>
1489 int main(void) { return bswap32(0); }
1491 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
1492 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1496 if [ "$openbsd" = "yes" ] ; then
1497 echo "#define ENOTSUP 4096" >> $config_h
1500 if test "$darwin" = "yes" ; then
1501 echo "CONFIG_DARWIN=yes" >> $config_mak
1502 echo "#define CONFIG_DARWIN 1" >> $config_h
1505 if test "$aix" = "yes" ; then
1506 echo "CONFIG_AIX=yes" >> $config_mak
1507 echo "#define CONFIG_AIX 1" >> $config_h
1510 if test "$solaris" = "yes" ; then
1511 echo "CONFIG_SOLARIS=yes" >> $config_mak
1512 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
1513 if test "$needs_libsunmath" = "yes" ; then
1514 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1515 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1518 if test -n "$sparc_cpu"; then
1519 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1520 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1522 if test "$gdbstub" = "yes" ; then
1523 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1524 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1526 if test "$gprof" = "yes" ; then
1527 echo "TARGET_GPROF=yes" >> $config_mak
1528 echo "#define HAVE_GPROF 1" >> $config_h
1530 if test "$static" = "yes" ; then
1531 echo "CONFIG_STATIC=yes" >> $config_mak
1532 echo "#define CONFIG_STATIC 1" >> $config_h
1534 if test $profiler = "yes" ; then
1535 echo "#define CONFIG_PROFILER 1" >> $config_h
1537 if test "$slirp" = "yes" ; then
1538 echo "CONFIG_SLIRP=yes" >> $config_mak
1539 echo "#define CONFIG_SLIRP 1" >> $config_h
1541 if test "$vde" = "yes" ; then
1542 echo "CONFIG_VDE=yes" >> $config_mak
1543 echo "#define CONFIG_VDE 1" >> $config_h
1544 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1546 for card in $audio_card_list; do
1547 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
1548 echo "$def=yes" >> $config_mak
1549 echo "#define $def 1" >> $config_h
1550 done
1551 echo "#define AUDIO_DRIVERS \\" >> $config_h
1552 for drv in $audio_drv_list; do
1553 echo " &${drv}_audio_driver, \\" >>$config_h
1554 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
1555 echo "$def=yes" >> $config_mak
1556 if test "$drv" = "fmod"; then
1557 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1558 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1559 elif test "$drv" = "oss"; then
1560 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
1562 done
1563 echo "" >>$config_h
1564 if test "$mixemu" = "yes" ; then
1565 echo "CONFIG_MIXEMU=yes" >> $config_mak
1566 echo "#define CONFIG_MIXEMU 1" >> $config_h
1568 if test "$vnc_tls" = "yes" ; then
1569 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1570 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1571 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1572 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1574 if test "$vnc_sasl" = "yes" ; then
1575 echo "CONFIG_VNC_SASL=yes" >> $config_mak
1576 echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1577 echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1578 echo "#define CONFIG_VNC_SASL 1" >> $config_h
1580 if test "$fnmatch" = "yes" ; then
1581 echo "#define HAVE_FNMATCH_H 1" >> $config_h
1583 qemu_version=`head $source_path/VERSION`
1584 echo "VERSION=$qemu_version" >>$config_mak
1585 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1586 echo "#define KVM_VERSION \"kvm-devel\"" >> $config_h
1588 echo "SRC_PATH=$source_path" >> $config_mak
1589 if [ "$source_path_used" = "yes" ]; then
1590 echo "VPATH=$source_path" >> $config_mak
1592 echo "TARGET_DIRS=$target_list" >> $config_mak
1593 if [ "$build_docs" = "yes" ] ; then
1594 echo "BUILD_DOCS=yes" >> $config_mak
1596 if test "$static" = "yes"; then
1597 sdl1=$sdl_static
1598 else
1599 sdl1=$sdl
1601 if test "$sdl1" = "yes" ; then
1602 echo "#define CONFIG_SDL 1" >> $config_h
1603 echo "CONFIG_SDL=yes" >> $config_mak
1604 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1605 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1606 elif test "$sdl_x11" = "yes" ; then
1607 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
1608 else
1609 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1611 if [ "${aa}" = "yes" ] ; then
1612 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1613 else
1614 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1617 if test "$cocoa" = "yes" ; then
1618 echo "#define CONFIG_COCOA 1" >> $config_h
1619 echo "CONFIG_COCOA=yes" >> $config_mak
1621 if test "$curses" = "yes" ; then
1622 echo "#define CONFIG_CURSES 1" >> $config_h
1623 echo "CONFIG_CURSES=yes" >> $config_mak
1624 echo "CURSES_LIBS=-lcurses" >> $config_mak
1626 if test "$brlapi" = "yes" ; then
1627 echo "CONFIG_BRLAPI=yes" >> $config_mak
1628 echo "#define CONFIG_BRLAPI 1" >> $config_h
1629 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1631 if test "$bluez" = "yes" ; then
1632 echo "CONFIG_BLUEZ=yes" >> $config_mak
1633 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1634 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1635 echo "#define CONFIG_BLUEZ 1" >> $config_h
1637 if test "$aio" = "yes" ; then
1638 echo "#define CONFIG_AIO 1" >> $config_h
1639 echo "CONFIG_AIO=yes" >> $config_mak
1641 if test "$blobs" = "yes" ; then
1642 echo "INSTALL_BLOBS=yes" >> $config_mak
1644 if test "$iovec" = "yes" ; then
1645 echo "#define HAVE_IOVEC 1" >> $config_h
1647 if test "$preadv" = "yes" ; then
1648 echo "#define HAVE_PREADV 1" >> $config_h
1650 if test "$fdt" = "yes" ; then
1651 echo "#define HAVE_FDT 1" >> $config_h
1652 echo "FDT_LIBS=-lfdt" >> $config_mak
1654 if test "$signalfd" = "yes" ; then
1655 echo "#define CONFIG_signalfd 1" >> $config_h
1657 if test "$eventfd" = "yes" ; then
1658 echo "#define CONFIG_eventfd 1" >> $config_h
1661 # XXX: suppress that
1662 if [ "$bsd" = "yes" ] ; then
1663 echo "#define O_LARGEFILE 0" >> $config_h
1664 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1665 echo "#define HOST_BSD 1" >> $config_h
1668 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1670 # USB host support
1671 case "$usb" in
1672 linux)
1673 echo "HOST_USB=linux" >> $config_mak
1675 bsd)
1676 echo "HOST_USB=bsd" >> $config_mak
1679 echo "HOST_USB=stub" >> $config_mak
1681 esac
1683 tools=
1684 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1685 tools="qemu-img\$(EXESUF) $tools"
1686 if [ "$linux" = "yes" ] ; then
1687 tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
1690 echo "TOOLS=$tools" >> $config_mak
1692 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1694 for target in $target_list; do
1695 target_dir="$target"
1696 config_mak=$target_dir/config.mak
1697 config_h=$target_dir/config.h
1698 target_cpu=`echo $target | cut -d '-' -f 1`
1699 target_bigendian="no"
1700 [ "$target_cpu" = "armeb" ] && target_bigendian=yes
1701 [ "$target_cpu" = "m68k" ] && target_bigendian=yes
1702 [ "$target_cpu" = "mips" ] && target_bigendian=yes
1703 [ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1704 [ "$target_cpu" = "mips64" ] && target_bigendian=yes
1705 [ "$target_cpu" = "ppc" ] && target_bigendian=yes
1706 [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
1707 [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
1708 [ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
1709 [ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
1710 [ "$target_cpu" = "sparc" ] && target_bigendian=yes
1711 [ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1712 [ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
1713 target_softmmu="no"
1714 target_user_only="no"
1715 target_linux_user="no"
1716 target_darwin_user="no"
1717 target_bsd_user="no"
1718 case "$target" in
1719 ${target_cpu}-softmmu)
1720 target_softmmu="yes"
1722 ${target_cpu}-linux-user)
1723 target_user_only="yes"
1724 target_linux_user="yes"
1726 ${target_cpu}-darwin-user)
1727 target_user_only="yes"
1728 target_darwin_user="yes"
1730 ${target_cpu}-bsd-user)
1731 target_user_only="yes"
1732 target_bsd_user="yes"
1735 echo "ERROR: Target '$target' not recognised"
1736 exit 1
1738 esac
1740 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1741 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1742 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1743 echo "To build QEMU without graphical output configure with --disable-gfx-check"
1744 echo "Note that this will disable all output from the virtual graphics card"
1745 echo "except through VNC or curses."
1746 exit 1;
1749 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1751 test -f $config_h && mv $config_h ${config_h}~
1753 mkdir -p $target_dir
1754 mkdir -p $target_dir/fpu
1755 mkdir -p $target_dir/tcg
1756 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
1757 mkdir -p $target_dir/nwfpe
1761 # don't use ln -sf as not all "ln -sf" over write the file/link
1763 rm -f $target_dir/Makefile
1764 ln -s $source_path/Makefile.target $target_dir/Makefile
1767 echo "# Automatically generated by configure - do not modify" > $config_mak
1768 echo "/* Automatically generated by configure - do not modify */" > $config_h
1771 echo "include ../config-host.mak" >> $config_mak
1772 echo "#include \"../config-host.h\"" >> $config_h
1774 bflt="no"
1775 elfload32="no"
1776 target_nptl="no"
1777 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1778 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1779 gdb_xml_files=""
1781 disable_cpu_emulation() {
1782 if test $cpu_emulation = "no"; then
1783 echo "#define NO_CPU_EMULATION 1" >> $config_h
1784 echo "NO_CPU_EMULATION=1" >> $config_mak
1788 configure_kvm() {
1789 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
1790 \( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \); then
1791 echo "#define USE_KVM 1" >> $config_h
1792 echo "USE_KVM=1" >> $config_mak
1793 echo "CONFIG_KVM_KERNEL_INC=$kerneldir/include" >> $config_mak
1794 if test $kvm_cap_pit = "yes" ; then
1795 echo "USE_KVM_PIT=1" >> $config_mak
1796 echo "#define USE_KVM_PIT 1" >> $config_h
1798 if test $kvm_cap_device_assignment = "yes" ; then
1799 echo "USE_KVM_DEVICE_ASSIGNMENT=1" >> $config_mak
1800 echo "#define USE_KVM_DEVICE_ASSIGNMENT 1" >> $config_h
1802 disable_cpu_emulation
1806 if [ use_upstream_kvm = yes ]; then
1808 # Make sure the target and host cpus are compatible
1809 if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
1810 \( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \) -o \
1811 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1812 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
1813 kvm="no"
1815 # Disable KVM for linux-user
1816 if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1817 kvm="no"
1822 case "$target_cpu" in
1823 i386)
1824 echo "TARGET_ARCH=i386" >> $config_mak
1825 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1826 echo "#define TARGET_I386 1" >> $config_h
1827 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
1828 then
1829 echo "#define USE_KQEMU 1" >> $config_h
1831 if test "$kvm" = "yes" ; then
1832 echo "USE_KVM=yes" >> $config_mak
1833 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1834 echo "#define USE_KVM 1" >> $config_h
1836 configure_kvm
1838 x86_64)
1839 echo "TARGET_ARCH=x86_64" >> $config_mak
1840 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1841 echo "#define TARGET_I386 1" >> $config_h
1842 echo "#define TARGET_X86_64 1" >> $config_h
1843 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1844 then
1845 echo "#define USE_KQEMU 1" >> $config_h
1847 configure_kvm
1849 ia64)
1850 echo "TARGET_ARCH=ia64" >> $config_mak
1851 echo "#define TARGET_ARCH \"ia64\"" >> $config_h
1852 echo "#define TARGET_IA64 1" >> $config_h
1853 configure_kvm
1854 if [ use_upstream_kvm = yes ]; then
1855 if test "$kvm" = "yes" ; then
1856 echo "USE_KVM=yes" >> $config_mak
1857 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1858 echo "#define USE_KVM 1" >> $config_h
1862 alpha)
1863 echo "TARGET_ARCH=alpha" >> $config_mak
1864 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1865 echo "#define TARGET_ALPHA 1" >> $config_h
1867 arm|armeb)
1868 echo "TARGET_ARCH=arm" >> $config_mak
1869 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1870 echo "#define TARGET_ARM 1" >> $config_h
1871 bflt="yes"
1872 target_nptl="yes"
1873 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
1875 cris)
1876 echo "TARGET_ARCH=cris" >> $config_mak
1877 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1878 echo "#define TARGET_CRIS 1" >> $config_h
1879 target_nptl="yes"
1881 m68k)
1882 echo "TARGET_ARCH=m68k" >> $config_mak
1883 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1884 echo "#define TARGET_M68K 1" >> $config_h
1885 bflt="yes"
1886 gdb_xml_files="cf-core.xml cf-fp.xml"
1888 mips|mipsel)
1889 echo "TARGET_ARCH=mips" >> $config_mak
1890 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1891 echo "#define TARGET_MIPS 1" >> $config_h
1892 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1894 mipsn32|mipsn32el)
1895 echo "TARGET_ARCH=mipsn32" >> $config_mak
1896 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1897 echo "#define TARGET_MIPS 1" >> $config_h
1898 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1900 mips64|mips64el)
1901 echo "TARGET_ARCH=mips64" >> $config_mak
1902 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1903 echo "#define TARGET_MIPS 1" >> $config_h
1904 echo "#define TARGET_MIPS64 1" >> $config_h
1905 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1907 ppc)
1908 echo "TARGET_ARCH=ppc" >> $config_mak
1909 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1910 echo "#define TARGET_PPC 1" >> $config_h
1911 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1913 ppcemb)
1914 echo "TARGET_ARCH=ppcemb" >> $config_mak
1915 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1916 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1917 echo "#define TARGET_PPC 1" >> $config_h
1918 echo "#define TARGET_PPCEMB 1" >> $config_h
1919 if test "$kvm" = "yes" ; then
1920 echo "USE_KVM=yes" >> $config_mak
1921 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1922 echo "#define USE_KVM 1" >> $config_h
1924 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1926 ppc64)
1927 echo "TARGET_ARCH=ppc64" >> $config_mak
1928 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1929 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1930 echo "#define TARGET_PPC 1" >> $config_h
1931 echo "#define TARGET_PPC64 1" >> $config_h
1932 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1934 ppc64abi32)
1935 echo "TARGET_ARCH=ppc64" >> $config_mak
1936 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1937 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1938 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1939 echo "#define TARGET_PPC 1" >> $config_h
1940 echo "#define TARGET_PPC64 1" >> $config_h
1941 echo "#define TARGET_ABI32 1" >> $config_h
1942 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1944 sh4|sh4eb)
1945 echo "TARGET_ARCH=sh4" >> $config_mak
1946 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1947 echo "#define TARGET_SH4 1" >> $config_h
1948 bflt="yes"
1949 target_nptl="yes"
1951 sparc)
1952 echo "TARGET_ARCH=sparc" >> $config_mak
1953 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1954 echo "#define TARGET_SPARC 1" >> $config_h
1956 sparc64)
1957 echo "TARGET_ARCH=sparc64" >> $config_mak
1958 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1959 echo "#define TARGET_SPARC 1" >> $config_h
1960 echo "#define TARGET_SPARC64 1" >> $config_h
1961 elfload32="yes"
1963 sparc32plus)
1964 echo "TARGET_ARCH=sparc64" >> $config_mak
1965 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1966 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1967 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1968 echo "#define TARGET_SPARC 1" >> $config_h
1969 echo "#define TARGET_SPARC64 1" >> $config_h
1970 echo "#define TARGET_ABI32 1" >> $config_h
1973 echo "Unsupported target CPU"
1974 exit 1
1976 esac
1977 if test "$target_bigendian" = "yes" ; then
1978 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1979 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1981 if test "$target_softmmu" = "yes" ; then
1982 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1983 echo "#define CONFIG_SOFTMMU 1" >> $config_h
1985 if test "$target_user_only" = "yes" ; then
1986 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1987 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1989 if test "$target_linux_user" = "yes" ; then
1990 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1991 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1993 if test "$target_darwin_user" = "yes" ; then
1994 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1995 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1997 list=""
1998 if test ! -z "$gdb_xml_files" ; then
1999 for x in $gdb_xml_files; do
2000 list="$list $source_path/gdb-xml/$x"
2001 done
2003 echo "TARGET_XML_FILES=$list" >> $config_mak
2005 if test "$target_cpu" = "arm" \
2006 -o "$target_cpu" = "armeb" \
2007 -o "$target_cpu" = "m68k" \
2008 -o "$target_cpu" = "mips" \
2009 -o "$target_cpu" = "mipsel" \
2010 -o "$target_cpu" = "mipsn32" \
2011 -o "$target_cpu" = "mipsn32el" \
2012 -o "$target_cpu" = "mips64" \
2013 -o "$target_cpu" = "mips64el" \
2014 -o "$target_cpu" = "ppc" \
2015 -o "$target_cpu" = "ppc64" \
2016 -o "$target_cpu" = "ppc64abi32" \
2017 -o "$target_cpu" = "ppcemb" \
2018 -o "$target_cpu" = "sparc" \
2019 -o "$target_cpu" = "sparc64" \
2020 -o "$target_cpu" = "sparc32plus"; then
2021 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
2022 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
2024 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
2025 echo "TARGET_HAS_BFLT=yes" >> $config_mak
2026 echo "#define TARGET_HAS_BFLT 1" >> $config_h
2028 if test "$target_user_only" = "yes" \
2029 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
2030 echo "#define USE_NPTL 1" >> $config_h
2032 # 32 bit ELF loader in addition to native 64 bit loader?
2033 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
2034 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
2035 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
2037 if test "$target_bsd_user" = "yes" ; then
2038 echo "CONFIG_BSD_USER=yes" >> $config_mak
2039 echo "#define CONFIG_BSD_USER 1" >> $config_h
2042 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
2044 done # for target in $targets
2046 # build tree in object directory if source path is different from current one
2047 if test "$source_path_used" = "yes" ; then
2048 DIRS="tests tests/cris slirp audio"
2049 FILES="Makefile tests/Makefile"
2050 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
2051 FILES="$FILES tests/test-mmap.c"
2052 for dir in $DIRS ; do
2053 mkdir -p $dir
2054 done
2055 # remove the link and recreate it, as not all "ln -sf" overwrite the link
2056 for f in $FILES ; do
2057 rm -f $f
2058 ln -s $source_path/$f $f
2059 done