Merge commit 'qemu-svn/trunk'
[kvm-userspace.git] / qemu / configure
blob8b6b69365b8bbd77caa792246cf5ac584e159767
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=""
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 # OS specific
200 if check_define __linux__ ; then
201 targetos="Linux"
202 elif check_define _WIN32 ; then
203 targetos='MINGW32'
204 else
205 targetos=`uname -s`
207 case $targetos in
208 CYGWIN*)
209 mingw32="yes"
210 OS_CFLAGS="-mno-cygwin"
211 if [ "$cpu" = "i386" ] ; then
212 kqemu="yes"
214 audio_possible_drivers="sdl"
216 MINGW32*)
217 mingw32="yes"
218 if [ "$cpu" = "i386" ] ; then
219 kqemu="yes"
221 audio_possible_drivers="dsound sdl fmod"
223 GNU/kFreeBSD)
224 audio_drv_list="oss"
225 audio_possible_drivers="oss sdl esd pa"
226 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
227 kqemu="yes"
230 FreeBSD)
231 bsd="yes"
232 audio_drv_list="oss"
233 audio_possible_drivers="oss sdl esd pa"
234 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
235 kqemu="yes"
236 kvm="yes"
239 DragonFly)
240 bsd="yes"
241 audio_drv_list="oss"
242 audio_possible_drivers="oss sdl esd pa"
243 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
244 kqemu="yes"
246 aio="no"
248 NetBSD)
249 bsd="yes"
250 audio_drv_list="oss"
251 audio_possible_drivers="oss sdl esd"
252 oss_lib="-lossaudio"
254 OpenBSD)
255 bsd="yes"
256 openbsd="yes"
257 audio_drv_list="oss"
258 audio_possible_drivers="oss sdl esd"
259 oss_lib="-lossaudio"
261 Darwin)
262 bsd="yes"
263 darwin="yes"
264 # 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
265 if [ "$cpu" = "i386" ] ; then
266 is_x86_64=`sysctl -n hw.optional.x86_64`
267 [ "$is_x86_64" = "1" ] && cpu=x86_64
269 if [ "$cpu" = "x86_64" ] ; then
270 OS_CFLAGS="-arch x86_64"
271 LDFLAGS="-arch x86_64"
272 else
273 OS_CFLAGS="-mdynamic-no-pic"
275 darwin_user="yes"
276 cocoa="yes"
277 audio_drv_list="coreaudio"
278 audio_possible_drivers="coreaudio sdl fmod"
279 OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
281 SunOS)
282 solaris="yes"
283 make="gmake"
284 install="ginstall"
285 needs_libsunmath="no"
286 solarisrev=`uname -r | cut -f2 -d.`
287 # have to select again, because `uname -m` returns i86pc
288 # even on an x86_64 box.
289 solariscpu=`isainfo -k`
290 if test "${solariscpu}" = "amd64" ; then
291 cpu="x86_64"
293 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
294 if test "$solarisrev" -le 9 ; then
295 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
296 needs_libsunmath="yes"
297 else
298 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
299 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
300 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
301 echo "Studio 11 can be downloaded from www.sun.com."
302 exit 1
305 if test "$solarisrev" -ge 9 ; then
306 kqemu="yes"
309 if test -f /usr/include/sys/soundcard.h ; then
310 audio_drv_list="oss"
312 audio_possible_drivers="oss sdl"
314 AIX)
315 aix="yes"
316 make="gmake"
319 audio_drv_list="oss"
320 audio_possible_drivers="oss alsa sdl esd pa"
321 linux="yes"
322 linux_user="yes"
323 usb="linux"
324 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
325 kqemu="yes"
326 audio_possible_drivers="$audio_possible_drivers fmod"
327 kvm="yes"
329 if [ "$cpu" = "ia64" ] ; then
330 kvm="yes"
331 cpu_emulation="no"
332 gdbstub="no"
333 slirp="no"
335 if [ "$cpu" = "powerpc" ]; then
336 kvm="yes"
339 esac
341 if [ "$bsd" = "yes" ] ; then
342 if [ "$darwin" != "yes" ] ; then
343 make="gmake"
344 usb="bsd"
346 bsd_user="yes"
349 # find source path
350 source_path=`dirname "$0"`
351 source_path_used="no"
352 workdir=`pwd`
353 if [ -z "$source_path" ]; then
354 source_path=$workdir
355 else
356 source_path=`cd "$source_path"; pwd`
358 [ -f "$workdir/vl.c" ] || source_path_used="yes"
360 werror="no"
361 # generate compile errors on warnings for development builds
362 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
363 #werror="yes";
366 for opt do
367 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
368 case "$opt" in
369 --help|-h) show_help=yes
371 --prefix=*) prefix="$optarg"
373 --interp-prefix=*) interp_prefix="$optarg"
375 --source-path=*) source_path="$optarg"
376 source_path_used="yes"
378 --cross-prefix=*)
380 --cc=*)
382 --host-cc=*) host_cc="$optarg"
384 --make=*) make="$optarg"
386 --install=*) install="$optarg"
388 --extra-cflags=*) CFLAGS="$optarg"
390 --extra-ldflags=*) LDFLAGS="$optarg"
392 --cpu=*) cpu="$optarg"
394 --target-list=*) target_list="$optarg"
396 --enable-gprof) gprof="yes"
398 --static) static="yes"
400 --disable-sdl) sdl="no"
402 --fmod-lib=*) fmod_lib="$optarg"
404 --fmod-inc=*) fmod_inc="$optarg"
406 --oss-lib=*) oss_lib="$optarg"
408 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
410 --audio-drv-list=*) audio_drv_list="$optarg"
412 --enable-sparse) sparse="yes"
414 --disable-sparse) sparse="no"
416 --disable-strip) strip_opt="no"
418 --disable-vnc-tls) vnc_tls="no"
420 --disable-vnc-sasl) vnc_sasl="no"
422 --disable-slirp) slirp="no"
424 --disable-vde) vde="no"
426 --disable-kqemu) kqemu="no"
428 --disable-brlapi) brlapi="no"
430 --disable-bluez) bluez="no"
432 --disable-kvm) kvm="no"
434 --enable-profiler) profiler="yes"
436 --enable-cocoa)
437 cocoa="yes" ;
438 sdl="no" ;
439 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
441 --disable-gfx-check) check_gfx="no"
443 --disable-system) softmmu="no"
445 --enable-system) softmmu="yes"
447 --disable-linux-user) linux_user="no"
449 --enable-linux-user) linux_user="yes"
451 --disable-darwin-user) darwin_user="no"
453 --enable-darwin-user) darwin_user="yes"
455 --disable-bsd-user) bsd_user="no"
457 --enable-bsd-user) bsd_user="yes"
459 --enable-uname-release=*) uname_release="$optarg"
461 --sparc_cpu=*)
462 sparc_cpu="$optarg"
463 case $sparc_cpu in
464 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
465 target_cpu="sparc"; cpu="sparc" ;;
466 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
467 target_cpu="sparc"; cpu="sparc" ;;
468 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
469 target_cpu="sparc64"; cpu="sparc64" ;;
470 *) echo "undefined SPARC architecture. Exiting";exit 1;;
471 esac
473 --enable-werror) werror="yes"
475 --disable-werror) werror="no"
477 --disable-curses) curses="no"
479 --disable-nptl) nptl="no"
481 --enable-mixemu) mixemu="yes"
483 --disable-aio) aio="no"
485 --disable-blobs) blobs="no"
487 --kerneldir=*) kerneldir="$optarg"
489 --disable-cpu-emulation) cpu_emulation="no"
491 *) echo "ERROR: unknown option $opt"; exit 1
493 esac
494 done
496 # default flags for all hosts
497 CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
498 CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
499 LDFLAGS="$LDFLAGS -g"
500 if test "$werror" = "yes" ; then
501 CFLAGS="$CFLAGS -Werror"
504 if test "$solaris" = "no" ; then
505 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
506 LDFLAGS="$LDFLAGS -Wl,--warn-common"
511 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
512 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
514 case "$cpu" in
515 sparc) if test -z "$sparc_cpu" ; then
516 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
517 ARCH_LDFLAGS="-m32"
518 else
519 ARCH_CFLAGS="${SP_CFLAGS}"
520 ARCH_LDFLAGS="${SP_LDFLAGS}"
522 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g2 -ffixed-g3"
523 if test "$solaris" = "no" ; then
524 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g6"
527 sparc64) if test -z "$sparc_cpu" ; then
528 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
529 ARCH_LDFLAGS="-m64"
530 else
531 ARCH_CFLAGS="${SP_CFLAGS}"
532 ARCH_LDFLAGS="${SP_LDFLAGS}"
534 if test "$solaris" = "no" ; then
535 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g5 -ffixed-g6 -ffixed-g7"
536 else
537 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7"
540 s390)
541 ARCH_CFLAGS="-march=z900"
543 i386)
544 ARCH_CFLAGS="-m32"
545 ARCH_LDFLAGS="-m32"
547 x86_64)
548 ARCH_CFLAGS="-m64"
549 ARCH_LDFLAGS="-m64"
551 esac
553 if test x"$show_help" = x"yes" ; then
554 cat << EOF
556 Usage: configure [options]
557 Options: [defaults in brackets after descriptions]
560 echo "Standard options:"
561 echo " --help print this message"
562 echo " --prefix=PREFIX install in PREFIX [$prefix]"
563 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
564 echo " use %M for cpu name [$interp_prefix]"
565 echo " --target-list=LIST set target list [$target_list]"
566 echo ""
567 echo "kqemu kernel acceleration support:"
568 echo " --disable-kqemu disable kqemu support"
569 echo ""
570 echo "Advanced options (experts only):"
571 echo " --source-path=PATH path of source code [$source_path]"
572 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
573 echo " --cc=CC use C compiler CC [$cc]"
574 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
575 echo " --make=MAKE use specified make [$make]"
576 echo " --install=INSTALL use specified install [$install]"
577 echo " --static enable static build [$static]"
578 echo " --enable-sparse enable sparse checker"
579 echo " --disable-sparse disable sparse checker (default)"
580 echo " --disable-strip disable stripping binaries"
581 echo " --disable-werror disable compilation abort on warning"
582 echo " --disable-sdl disable SDL"
583 echo " --enable-cocoa enable COCOA (Mac OS X only)"
584 echo " --audio-drv-list=LIST set audio drivers list:"
585 echo " Available drivers: $audio_possible_drivers"
586 echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
587 echo " Available cards: $audio_possible_cards"
588 echo " --enable-mixemu enable mixer emulation"
589 echo " --disable-brlapi disable BrlAPI"
590 echo " --disable-vnc-tls disable TLS encryption for VNC server"
591 echo " --disable-vnc-sasl disable SASL encryption for VNC server"
592 echo " --disable-curses disable curses output"
593 echo " --disable-bluez disable bluez stack connectivity"
594 echo " --disable-kvm disable KVM acceleration support"
595 echo " --disable-nptl disable usermode NPTL support"
596 echo " --enable-system enable all system emulation targets"
597 echo " --disable-system disable all system emulation targets"
598 echo " --enable-linux-user enable all linux usermode emulation targets"
599 echo " --disable-linux-user disable all linux usermode emulation targets"
600 echo " --enable-darwin-user enable all darwin usermode emulation targets"
601 echo " --disable-darwin-user disable all darwin usermode emulation targets"
602 echo " --enable-bsd-user enable all BSD usermode emulation targets"
603 echo " --disable-bsd-user disable all BSD usermode emulation targets"
604 echo " --fmod-lib path to FMOD library"
605 echo " --fmod-inc path to FMOD includes"
606 echo " --oss-lib path to OSS library"
607 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
608 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
609 echo " --disable-vde disable support for vde network"
610 echo " --disable-aio disable AIO support"
611 echo " --disable-blobs disable installing provided firmware blobs"
612 echo " --kerneldir=PATH look for kernel includes in PATH"
613 echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
614 echo ""
615 echo "NOTE: The object files are built at the place where configure is launched"
616 exit 1
619 if test "$mingw32" = "yes" ; then
620 linux="no"
621 EXESUF=".exe"
622 oss="no"
623 linux_user="no"
624 bsd_user="no"
625 OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
628 if test ! -x "$(which cgcc 2>/dev/null)"; then
629 sparse="no"
633 # Solaris specific configure tool chain decisions
635 if test "$solaris" = "yes" ; then
636 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
637 if test -z "$solinst" ; then
638 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
639 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
640 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
641 exit 1
643 if test "$solinst" = "/usr/sbin/install" ; then
644 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
645 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
646 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
647 exit 1
649 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
650 if test -z "$sol_ar" ; then
651 echo "Error: No path includes ar"
652 if test -f /usr/ccs/bin/ar ; then
653 echo "Add /usr/ccs/bin to your path and rerun configure"
655 exit 1
660 if test -z "$target_list" ; then
661 # these targets are portable
662 if [ "$softmmu" = "yes" ] ; then
663 target_list="\
664 i386-softmmu \
665 x86_64-softmmu \
666 arm-softmmu \
667 cris-softmmu \
668 m68k-softmmu \
669 mips-softmmu \
670 mipsel-softmmu \
671 mips64-softmmu \
672 mips64el-softmmu \
673 ppc-softmmu \
674 ppcemb-softmmu \
675 ppc64-softmmu \
676 sh4-softmmu \
677 sh4eb-softmmu \
678 sparc-softmmu \
681 # the following are Linux specific
682 if [ "$linux_user" = "yes" ] ; then
683 target_list="${target_list}\
684 i386-linux-user \
685 x86_64-linux-user \
686 alpha-linux-user \
687 arm-linux-user \
688 armeb-linux-user \
689 cris-linux-user \
690 m68k-linux-user \
691 mips-linux-user \
692 mipsel-linux-user \
693 ppc-linux-user \
694 ppc64-linux-user \
695 ppc64abi32-linux-user \
696 sh4-linux-user \
697 sh4eb-linux-user \
698 sparc-linux-user \
699 sparc64-linux-user \
700 sparc32plus-linux-user \
703 # the following are Darwin specific
704 if [ "$darwin_user" = "yes" ] ; then
705 target_list="$target_list i386-darwin-user ppc-darwin-user "
707 # the following are BSD specific
708 if [ "$bsd_user" = "yes" ] ; then
709 target_list="${target_list}\
710 sparc64-bsd-user \
713 else
714 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
716 if test -z "$target_list" ; then
717 echo "No targets enabled"
718 exit 1
721 if test -z "$cross_prefix" ; then
723 # ---
724 # big/little endian test
725 cat > $TMPC << EOF
726 #include <inttypes.h>
727 int main(int argc, char ** argv){
728 volatile uint32_t i=0x01234567;
729 return (*((uint8_t*)(&i))) == 0x67;
733 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
734 $TMPE && bigendian="yes"
735 else
736 echo big/little test failed
739 else
741 # if cross compiling, cannot launch a program, so make a static guess
742 if test "$cpu" = "armv4b" \
743 -o "$cpu" = "hppa" \
744 -o "$cpu" = "m68k" \
745 -o "$cpu" = "mips" \
746 -o "$cpu" = "mips64" \
747 -o "$cpu" = "ppc" \
748 -o "$cpu" = "ppc64" \
749 -o "$cpu" = "s390" \
750 -o "$cpu" = "sparc" \
751 -o "$cpu" = "sparc64"; then
752 bigendian="yes"
757 # host long bits test
758 hostlongbits="32"
759 if test "$cpu" = "x86_64" \
760 -o "$cpu" = "alpha" \
761 -o "$cpu" = "ia64" \
762 -o "$cpu" = "sparc64" \
763 -o "$cpu" = "ppc64"; then
764 hostlongbits="64"
767 # Check host NPTL support
768 cat > $TMPC <<EOF
769 #include <sched.h>
770 #include <linux/futex.h>
771 void foo()
773 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
774 #error bork
775 #endif
779 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
781 else
782 nptl="no"
785 ##########################################
786 # KVM probe
788 if test "$kvm" = "yes" ; then
790 # test for KVM_CAP_PIT
792 cat > $TMPC <<EOF
793 #include <libkvm.h>
794 #ifndef KVM_CAP_PIT
795 #error "kvm no pit capability"
796 #endif
797 int main(void) { return 0; }
799 if $cc $ARCH_CFLAGS $CFLAGS -I"$kerneldir"/include -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev/null ; then
800 kvm_cap_pit="yes"
803 # test for KVM_CAP_DEVICE_ASSIGNMENT
805 cat > $TMPC <<EOF
806 #include <libkvm.h>
807 #ifndef KVM_CAP_DEVICE_ASSIGNMENT
808 #error "kvm no device assignment capability"
809 #endif
810 int main(void) { return 0; }
812 if $cc $ARCH_CFLAGS $CFLAGS -I"$kerneldir"/include -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev/null ; then
813 kvm_cap_device_assignment="yes"
817 # libpci probe for kvm_cap_device_assignment
818 if test $kvm_cap_device_assignment = "yes" ; then
819 cat > $TMPC << EOF
820 #include <pci/pci.h>
821 #ifndef PCI_VENDOR_ID
822 #error NO LIBPCI
823 #endif
824 int main(void) { return 0; }
826 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC 2>/dev/null ; then
828 else
829 echo
830 echo "Error: libpci check failed"
831 echo "Disable KVM Device Assignment capability."
832 echo
833 kvm_cap_device_assignment="no"
837 ##########################################
838 # zlib check
840 cat > $TMPC << EOF
841 #include <zlib.h>
842 int main(void) { zlibVersion(); return 0; }
844 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
846 else
847 echo
848 echo "Error: zlib check failed"
849 echo "Make sure to have the zlib libs and headers installed."
850 echo
851 exit 1
854 ##########################################
855 # SDL probe
857 sdl_too_old=no
859 if test -z "$sdl" ; then
860 sdl_config="sdl-config"
861 sdl=no
862 sdl_static=no
864 cat > $TMPC << EOF
865 #include <SDL.h>
866 #undef main /* We don't want SDL to override our main() */
867 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
869 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
870 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
871 if test "$_sdlversion" -lt 121 ; then
872 sdl_too_old=yes
873 else
874 if test "$cocoa" = "no" ; then
875 sdl=yes
879 # static link with sdl ?
880 if test "$sdl" = "yes" ; then
881 aa="no"
882 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
883 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
884 if [ "$aa" = "yes" ] ; then
885 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
888 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then
889 sdl_static=yes
891 fi # static link
892 fi # sdl compile test
893 else
894 # Make sure to disable cocoa if sdl was set
895 if test "$sdl" = "yes" ; then
896 cocoa="no"
897 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
899 fi # -z $sdl
901 if test "$sdl" = "yes" ; then
902 cat > $TMPC <<EOF
903 #include <SDL.h>
904 #if defined(SDL_VIDEO_DRIVER_X11)
905 #include <X11/XKBlib.h>
906 #else
907 #error No x11 support
908 #endif
909 int main(void) { return 0; }
911 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
912 sdl_x11="yes"
916 ##########################################
917 # VNC TLS detection
918 if test "$vnc_tls" = "yes" ; then
919 cat > $TMPC <<EOF
920 #include <gnutls/gnutls.h>
921 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
923 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
924 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
925 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
926 $vnc_tls_libs > /dev/null 2> /dev/null ; then
928 else
929 vnc_tls="no"
933 ##########################################
934 # VNC SASL detection
935 if test "$vnc_sasl" = "yes" ; then
936 cat > $TMPC <<EOF
937 #include <sasl/sasl.h>
938 #include <stdio.h>
939 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
941 # Assuming Cyrus-SASL installed in /usr prefix
942 vnc_sasl_cflags=""
943 vnc_sasl_libs="-lsasl2"
944 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
945 $vnc_sasl_libs 2> /dev/null ; then
947 else
948 vnc_sasl="no"
952 ##########################################
953 # fnmatch() probe, used for ACL routines
954 fnmatch="no"
955 cat > $TMPC << EOF
956 #include <fnmatch.h>
957 int main(void)
959 fnmatch("foo", "foo", 0);
960 return 0;
963 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
964 fnmatch="yes"
967 ##########################################
968 # vde libraries probe
969 if test "$vde" = "yes" ; then
970 cat > $TMPC << EOF
971 #include <libvdeplug.h>
972 int main(void)
974 struct vde_open_args a = {0, 0, 0};
975 vde_open("", "", &a);
976 return 0;
979 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
981 else
982 vde="no"
986 ##########################################
987 # Sound support libraries probe
989 audio_drv_probe()
991 drv=$1
992 hdr=$2
993 lib=$3
994 exp=$4
995 cfl=$5
996 cat > $TMPC << EOF
997 #include <$hdr>
998 int main(void) { $exp }
1000 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
1002 else
1003 echo
1004 echo "Error: $drv check failed"
1005 echo "Make sure to have the $drv libs and headers installed."
1006 echo
1007 exit 1
1011 audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1012 for drv in $audio_drv_list; do
1013 case $drv in
1014 alsa)
1015 audio_drv_probe $drv alsa/asoundlib.h -lasound \
1016 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1019 fmod)
1020 if test -z $fmod_lib || test -z $fmod_inc; then
1021 echo
1022 echo "Error: You must specify path to FMOD library and headers"
1023 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1024 echo
1025 exit 1
1027 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1030 esd)
1031 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1035 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
1036 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1039 oss|sdl|core|wav|dsound)
1040 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1044 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
1045 echo
1046 echo "Error: Unknown driver '$drv' selected"
1047 echo "Possible drivers are: $audio_possible_drivers"
1048 echo
1049 exit 1
1052 esac
1053 done
1055 ##########################################
1056 # BrlAPI probe
1058 if test -z "$brlapi" ; then
1059 brlapi=no
1060 cat > $TMPC << EOF
1061 #include <brlapi.h>
1062 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1064 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
1065 brlapi=yes
1066 fi # brlapi compile test
1067 fi # -z $brlapi
1069 ##########################################
1070 # curses probe
1072 if test "$curses" = "yes" ; then
1073 curses=no
1074 cat > $TMPC << EOF
1075 #include <curses.h>
1076 int main(void) { return curses_version(); }
1078 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
1079 curses=yes
1081 fi # test "$curses"
1083 ##########################################
1084 # bluez support probe
1085 if test "$bluez" = "yes" ; then
1086 `pkg-config bluez` || bluez="no"
1088 if test "$bluez" = "yes" ; then
1089 cat > $TMPC << EOF
1090 #include <bluetooth/bluetooth.h>
1091 int main(void) { return bt_error(0); }
1093 bluez_cflags=`pkg-config --cflags bluez`
1094 bluez_libs=`pkg-config --libs bluez`
1095 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
1096 $bluez_libs > /dev/null 2> /dev/null ; then
1098 else
1099 bluez="no"
1103 ##########################################
1104 # kvm probe
1105 if test "$kvm" = "yes" ; then
1106 cat > $TMPC <<EOF
1107 #include <linux/kvm.h>
1108 #if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
1109 #error Invalid KVM version
1110 #endif
1111 #if !defined(KVM_CAP_USER_MEMORY)
1112 #error Missing KVM capability KVM_CAP_USER_MEMORY
1113 #endif
1114 #if !defined(KVM_CAP_SET_TSS_ADDR)
1115 #error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1116 #endif
1117 #if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1118 #error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1119 #endif
1120 int main(void) { return 0; }
1122 if test "$kerneldir" != "" ; then
1123 kvm_cflags=-I"$kerneldir"/include
1124 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1125 -a -d "$kerneldir/arch/x86/include" ; then
1126 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
1127 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1128 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
1129 elif test -d "$kerneldir/arch/$cpu/include" ; then
1130 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1132 else
1133 kvm_cflags=""
1135 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
1136 > /dev/null 2>/dev/null ; then
1138 else
1139 kvm="no";
1140 if [ -x "`which awk 2>/dev/null`" ] && \
1141 [ -x "`which grep 2>/dev/null`" ]; then
1142 kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
1143 | grep "error: " \
1144 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1145 if test "$kvmerr" != "" ; then
1146 kvm="no - (${kvmerr})"
1152 ##########################################
1153 # AIO probe
1154 AIOLIBS=""
1156 if test "$aio" = "yes" ; then
1157 aio=no
1158 cat > $TMPC << EOF
1159 #include <pthread.h>
1160 int main(void) { pthread_mutex_t lock; return 0; }
1162 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
1163 aio=yes
1164 AIOLIBS="-lpthread"
1168 ##########################################
1169 # iovec probe
1170 cat > $TMPC <<EOF
1171 #include <sys/types.h>
1172 #include <sys/uio.h>
1173 #include <unistd.h>
1174 int main(void) { struct iovec iov; return 0; }
1176 iovec=no
1177 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1178 iovec=yes
1181 ##########################################
1182 # fdt probe
1183 if test "$fdt" = "yes" ; then
1184 fdt=no
1185 cat > $TMPC << EOF
1186 int main(void) { return 0; }
1188 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null ; then
1189 fdt=yes
1193 ##########################################
1194 # signalfd probe
1195 cat > $TMPC << EOF
1196 #define _GNU_SOURCE
1197 #include <unistd.h>
1198 #include <sys/syscall.h>
1199 #include <signal.h>
1200 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
1203 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1204 signalfd=yes
1207 ##########################################
1208 # eventfd probe
1209 cat > $TMPC << EOF
1210 #define _GNU_SOURCE
1211 #include <unistd.h>
1212 #include <sys/syscall.h>
1213 int main(void) { return syscall(SYS_eventfd, 0); }
1216 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1217 eventfd=yes
1220 # Check if tools are available to build documentation.
1221 if [ -x "`which texi2html 2>/dev/null`" ] && \
1222 [ -x "`which pod2man 2>/dev/null`" ]; then
1223 build_docs="yes"
1226 ##########################################
1227 # Do we need librt
1228 cat > $TMPC <<EOF
1229 #include <signal.h>
1230 #include <time.h>
1231 int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1234 rt=no
1235 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1237 elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
1238 rt=yes
1241 if test "$rt" = "yes" ; then
1242 # Hack, we should have a general purpose LIBS for this sort of thing
1243 AIOLIBS="$AIOLIBS -lrt"
1246 if test "$mingw32" = "yes" ; then
1247 if test -z "$prefix" ; then
1248 prefix="c:\\\\Program Files\\\\Qemu"
1250 mansuffix=""
1251 datasuffix=""
1252 docsuffix=""
1253 binsuffix=""
1254 else
1255 if test -z "$prefix" ; then
1256 prefix="/usr/local"
1258 mansuffix="/share/man"
1259 datasuffix="/share/qemu"
1260 docsuffix="/share/doc/qemu"
1261 binsuffix="/bin"
1264 echo "Install prefix $prefix"
1265 echo "BIOS directory $prefix$datasuffix"
1266 echo "binary directory $prefix$binsuffix"
1267 if test "$mingw32" = "no" ; then
1268 echo "Manual directory $prefix$mansuffix"
1269 echo "ELF interp prefix $interp_prefix"
1271 echo "Source path $source_path"
1272 echo "C compiler $cc"
1273 echo "Host C compiler $host_cc"
1274 echo "ARCH_CFLAGS $ARCH_CFLAGS"
1275 echo "make $make"
1276 echo "install $install"
1277 echo "host CPU $cpu"
1278 echo "host big endian $bigendian"
1279 echo "target list $target_list"
1280 echo "gprof enabled $gprof"
1281 echo "sparse enabled $sparse"
1282 echo "strip binaries $strip_opt"
1283 echo "profiler $profiler"
1284 echo "static build $static"
1285 echo "-Werror enabled $werror"
1286 if test "$darwin" = "yes" ; then
1287 echo "Cocoa support $cocoa"
1289 echo "SDL support $sdl"
1290 if test "$sdl" != "no" ; then
1291 echo "SDL static link $sdl_static"
1293 echo "curses support $curses"
1294 echo "mingw32 support $mingw32"
1295 echo "Audio drivers $audio_drv_list"
1296 echo "Extra audio cards $audio_card_list"
1297 echo "Mixer emulation $mixemu"
1298 echo "VNC TLS support $vnc_tls"
1299 if test "$vnc_tls" = "yes" ; then
1300 echo " TLS CFLAGS $vnc_tls_cflags"
1301 echo " TLS LIBS $vnc_tls_libs"
1303 echo "VNC SASL support $vnc_sasl"
1304 if test "$vnc_sasl" = "yes" ; then
1305 echo " SASL CFLAGS $vnc_sasl_cflags"
1306 echo " SASL LIBS $vnc_sasl_libs"
1308 if test -n "$sparc_cpu"; then
1309 echo "Target Sparc Arch $sparc_cpu"
1311 echo "kqemu support $kqemu"
1312 echo "kvm support $kvm"
1313 echo "CPU emulation $cpu_emulation"
1314 echo "brlapi support $brlapi"
1315 echo "Documentation $build_docs"
1316 [ ! -z "$uname_release" ] && \
1317 echo "uname -r $uname_release"
1318 echo "NPTL support $nptl"
1319 echo "vde support $vde"
1320 echo "AIO support $aio"
1321 echo "Install blobs $blobs"
1322 echo "KVM support $kvm"
1323 echo "fdt support $fdt"
1325 if test $sdl_too_old = "yes"; then
1326 echo "-> Your SDL version is too old - please upgrade to have SDL support"
1328 if [ -s $TMPSDLLOG ]; then
1329 echo "The error log from compiling the libSDL test is: "
1330 cat $TMPSDLLOG
1332 #if test "$sdl_static" = "no"; then
1333 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1335 config_mak="config-host.mak"
1336 config_h="config-host.h"
1338 #echo "Creating $config_mak and $config_h"
1340 test -f $config_h && mv $config_h ${config_h}~
1342 echo "# Automatically generated by configure - do not modify" > $config_mak
1343 printf "# Configured with:" >> $config_mak
1344 printf " '%s'" "$0" "$@" >> $config_mak
1345 echo >> $config_mak
1346 echo "/* Automatically generated by configure - do not modify */" > $config_h
1348 echo "prefix=$prefix" >> $config_mak
1349 echo "bindir=\${prefix}$binsuffix" >> $config_mak
1350 echo "mandir=\${prefix}$mansuffix" >> $config_mak
1351 echo "datadir=\${prefix}$datasuffix" >> $config_mak
1352 echo "docdir=\${prefix}$docsuffix" >> $config_mak
1353 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
1354 echo "MAKE=$make" >> $config_mak
1355 echo "INSTALL=$install" >> $config_mak
1356 echo "CC=$cc" >> $config_mak
1357 echo "HOST_CC=$host_cc" >> $config_mak
1358 echo "AR=$ar" >> $config_mak
1359 # XXX: only use CFLAGS and LDFLAGS ?
1360 # XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1361 # compilation of dyngen tool (useful for win32 build on Linux host)
1362 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
1363 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1364 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1365 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
1366 echo "CFLAGS=$CFLAGS" >> $config_mak
1367 echo "LDFLAGS=$LDFLAGS" >> $config_mak
1368 echo "EXESUF=$EXESUF" >> $config_mak
1369 echo "AIOLIBS=$AIOLIBS" >> $config_mak
1370 case "$cpu" in
1371 i386)
1372 echo "ARCH=i386" >> $config_mak
1373 echo "#define HOST_I386 1" >> $config_h
1375 x86_64)
1376 echo "ARCH=x86_64" >> $config_mak
1377 echo "#define HOST_X86_64 1" >> $config_h
1379 alpha)
1380 echo "ARCH=alpha" >> $config_mak
1381 echo "#define HOST_ALPHA 1" >> $config_h
1383 armv4b)
1384 echo "ARCH=arm" >> $config_mak
1385 echo "#define HOST_ARM 1" >> $config_h
1387 armv4l)
1388 echo "ARCH=arm" >> $config_mak
1389 echo "#define HOST_ARM 1" >> $config_h
1391 cris)
1392 echo "ARCH=cris" >> $config_mak
1393 echo "#define HOST_CRIS 1" >> $config_h
1395 hppa)
1396 echo "ARCH=hppa" >> $config_mak
1397 echo "#define HOST_HPPA 1" >> $config_h
1399 ia64)
1400 echo "ARCH=ia64" >> $config_mak
1401 echo "#define HOST_IA64 1" >> $config_h
1403 m68k)
1404 echo "ARCH=m68k" >> $config_mak
1405 echo "#define HOST_M68K 1" >> $config_h
1407 mips)
1408 echo "ARCH=mips" >> $config_mak
1409 echo "#define HOST_MIPS 1" >> $config_h
1411 mips64)
1412 echo "ARCH=mips64" >> $config_mak
1413 echo "#define HOST_MIPS64 1" >> $config_h
1415 ppc)
1416 echo "ARCH=ppc" >> $config_mak
1417 echo "#define HOST_PPC 1" >> $config_h
1419 ppc64)
1420 echo "ARCH=ppc64" >> $config_mak
1421 echo "#define HOST_PPC64 1" >> $config_h
1423 s390)
1424 echo "ARCH=s390" >> $config_mak
1425 echo "#define HOST_S390 1" >> $config_h
1427 sparc)
1428 echo "ARCH=sparc" >> $config_mak
1429 echo "#define HOST_SPARC 1" >> $config_h
1431 sparc64)
1432 echo "ARCH=sparc64" >> $config_mak
1433 echo "#define HOST_SPARC64 1" >> $config_h
1436 echo "Unsupported CPU = $cpu"
1437 exit 1
1439 esac
1440 if test "$sparse" = "yes" ; then
1441 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1442 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1443 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1445 if test "$strip_opt" = "yes" ; then
1446 echo "STRIP_OPT=-s" >> $config_mak
1448 if test "$bigendian" = "yes" ; then
1449 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1450 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1452 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
1453 if test "$mingw32" = "yes" ; then
1454 echo "CONFIG_WIN32=yes" >> $config_mak
1455 echo "#define CONFIG_WIN32 1" >> $config_h
1456 else
1457 cat > $TMPC << EOF
1458 #include <byteswap.h>
1459 int main(void) { return bswap_32(0); }
1461 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
1462 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1464 cat > $TMPC << EOF
1465 #include <sys/endian.h>
1466 #include <sys/types.h>
1467 #include <machine/bswap.h>
1468 int main(void) { return bswap32(0); }
1470 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
1471 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1475 if [ "$openbsd" = "yes" ] ; then
1476 echo "#define ENOTSUP 4096" >> $config_h
1479 if test "$darwin" = "yes" ; then
1480 echo "CONFIG_DARWIN=yes" >> $config_mak
1481 echo "#define CONFIG_DARWIN 1" >> $config_h
1484 if test "$aix" = "yes" ; then
1485 echo "CONFIG_AIX=yes" >> $config_mak
1486 echo "#define CONFIG_AIX 1" >> $config_h
1489 if test "$solaris" = "yes" ; then
1490 echo "CONFIG_SOLARIS=yes" >> $config_mak
1491 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
1492 if test "$needs_libsunmath" = "yes" ; then
1493 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1494 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1497 if test -n "$sparc_cpu"; then
1498 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1499 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1501 if test "$gdbstub" = "yes" ; then
1502 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1503 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1505 if test "$gprof" = "yes" ; then
1506 echo "TARGET_GPROF=yes" >> $config_mak
1507 echo "#define HAVE_GPROF 1" >> $config_h
1509 if test "$static" = "yes" ; then
1510 echo "CONFIG_STATIC=yes" >> $config_mak
1511 echo "#define CONFIG_STATIC 1" >> $config_h
1513 if test $profiler = "yes" ; then
1514 echo "#define CONFIG_PROFILER 1" >> $config_h
1516 if test "$slirp" = "yes" ; then
1517 echo "CONFIG_SLIRP=yes" >> $config_mak
1518 echo "#define CONFIG_SLIRP 1" >> $config_h
1520 if test "$vde" = "yes" ; then
1521 echo "CONFIG_VDE=yes" >> $config_mak
1522 echo "#define CONFIG_VDE 1" >> $config_h
1523 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1525 for card in $audio_card_list; do
1526 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
1527 echo "$def=yes" >> $config_mak
1528 echo "#define $def 1" >> $config_h
1529 done
1530 echo "#define AUDIO_DRIVERS \\" >> $config_h
1531 for drv in $audio_drv_list; do
1532 echo " &${drv}_audio_driver, \\" >>$config_h
1533 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
1534 echo "$def=yes" >> $config_mak
1535 if test "$drv" = "fmod"; then
1536 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1537 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1538 elif test "$drv" = "oss"; then
1539 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
1541 done
1542 echo "" >>$config_h
1543 if test "$mixemu" = "yes" ; then
1544 echo "CONFIG_MIXEMU=yes" >> $config_mak
1545 echo "#define CONFIG_MIXEMU 1" >> $config_h
1547 if test "$vnc_tls" = "yes" ; then
1548 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1549 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1550 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1551 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1553 if test "$vnc_sasl" = "yes" ; then
1554 echo "CONFIG_VNC_SASL=yes" >> $config_mak
1555 echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1556 echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1557 echo "#define CONFIG_VNC_SASL 1" >> $config_h
1559 if test "$fnmatch" = "yes" ; then
1560 echo "#define HAVE_FNMATCH_H 1" >> $config_h
1562 qemu_version=`head $source_path/VERSION`
1563 echo "VERSION=$qemu_version" >>$config_mak
1564 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1565 echo "#define KVM_VERSION \"kvm-devel\"" >> $config_h
1567 echo "SRC_PATH=$source_path" >> $config_mak
1568 if [ "$source_path_used" = "yes" ]; then
1569 echo "VPATH=$source_path" >> $config_mak
1571 echo "TARGET_DIRS=$target_list" >> $config_mak
1572 if [ "$build_docs" = "yes" ] ; then
1573 echo "BUILD_DOCS=yes" >> $config_mak
1575 if test "$static" = "yes"; then
1576 sdl1=$sdl_static
1577 else
1578 sdl1=$sdl
1580 if test "$sdl1" = "yes" ; then
1581 echo "#define CONFIG_SDL 1" >> $config_h
1582 echo "CONFIG_SDL=yes" >> $config_mak
1583 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1584 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1585 elif test "$sdl_x11" = "yes" ; then
1586 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
1587 else
1588 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1590 if [ "${aa}" = "yes" ] ; then
1591 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1592 else
1593 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1596 if test "$cocoa" = "yes" ; then
1597 echo "#define CONFIG_COCOA 1" >> $config_h
1598 echo "CONFIG_COCOA=yes" >> $config_mak
1600 if test "$curses" = "yes" ; then
1601 echo "#define CONFIG_CURSES 1" >> $config_h
1602 echo "CONFIG_CURSES=yes" >> $config_mak
1603 echo "CURSES_LIBS=-lcurses" >> $config_mak
1605 if test "$brlapi" = "yes" ; then
1606 echo "CONFIG_BRLAPI=yes" >> $config_mak
1607 echo "#define CONFIG_BRLAPI 1" >> $config_h
1608 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1610 if test "$bluez" = "yes" ; then
1611 echo "CONFIG_BLUEZ=yes" >> $config_mak
1612 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1613 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1614 echo "#define CONFIG_BLUEZ 1" >> $config_h
1616 if test "$aio" = "yes" ; then
1617 echo "#define CONFIG_AIO 1" >> $config_h
1618 echo "CONFIG_AIO=yes" >> $config_mak
1620 if test "$blobs" = "yes" ; then
1621 echo "INSTALL_BLOBS=yes" >> $config_mak
1623 if test "$iovec" = "yes" ; then
1624 echo "#define HAVE_IOVEC 1" >> $config_h
1626 if test "$fdt" = "yes" ; then
1627 echo "#define HAVE_FDT 1" >> $config_h
1628 echo "FDT_LIBS=-lfdt" >> $config_mak
1630 if test "$signalfd" = "yes" ; then
1631 echo "#define CONFIG_signalfd 1" >> $config_h
1633 if test "$eventfd" = "yes" ; then
1634 echo "#define CONFIG_eventfd 1" >> $config_h
1637 # XXX: suppress that
1638 if [ "$bsd" = "yes" ] ; then
1639 echo "#define O_LARGEFILE 0" >> $config_h
1640 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1641 echo "#define HOST_BSD 1" >> $config_h
1644 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1646 # USB host support
1647 case "$usb" in
1648 linux)
1649 echo "HOST_USB=linux" >> $config_mak
1651 bsd)
1652 echo "HOST_USB=bsd" >> $config_mak
1655 echo "HOST_USB=stub" >> $config_mak
1657 esac
1659 tools=
1660 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1661 tools="qemu-img\$(EXESUF) $tools"
1662 if [ "$linux" = "yes" ] ; then
1663 tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
1666 echo "TOOLS=$tools" >> $config_mak
1668 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1670 for target in $target_list; do
1671 target_dir="$target"
1672 config_mak=$target_dir/config.mak
1673 config_h=$target_dir/config.h
1674 target_cpu=`echo $target | cut -d '-' -f 1`
1675 target_bigendian="no"
1676 [ "$target_cpu" = "armeb" ] && target_bigendian=yes
1677 [ "$target_cpu" = "m68k" ] && target_bigendian=yes
1678 [ "$target_cpu" = "mips" ] && target_bigendian=yes
1679 [ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1680 [ "$target_cpu" = "mips64" ] && target_bigendian=yes
1681 [ "$target_cpu" = "ppc" ] && target_bigendian=yes
1682 [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
1683 [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
1684 [ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
1685 [ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
1686 [ "$target_cpu" = "sparc" ] && target_bigendian=yes
1687 [ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1688 [ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
1689 target_softmmu="no"
1690 target_user_only="no"
1691 target_linux_user="no"
1692 target_darwin_user="no"
1693 target_bsd_user="no"
1694 case "$target" in
1695 ${target_cpu}-softmmu)
1696 target_softmmu="yes"
1698 ${target_cpu}-linux-user)
1699 target_user_only="yes"
1700 target_linux_user="yes"
1702 ${target_cpu}-darwin-user)
1703 target_user_only="yes"
1704 target_darwin_user="yes"
1706 ${target_cpu}-bsd-user)
1707 target_user_only="yes"
1708 target_bsd_user="yes"
1711 echo "ERROR: Target '$target' not recognised"
1712 exit 1
1714 esac
1716 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1717 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1718 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1719 echo "To build QEMU without graphical output configure with --disable-gfx-check"
1720 echo "Note that this will disable all output from the virtual graphics card"
1721 echo "except through VNC or curses."
1722 exit 1;
1725 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1727 test -f $config_h && mv $config_h ${config_h}~
1729 mkdir -p $target_dir
1730 mkdir -p $target_dir/fpu
1731 mkdir -p $target_dir/tcg
1732 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
1733 mkdir -p $target_dir/nwfpe
1737 # don't use ln -sf as not all "ln -sf" over write the file/link
1739 rm -f $target_dir/Makefile
1740 ln -s $source_path/Makefile.target $target_dir/Makefile
1743 echo "# Automatically generated by configure - do not modify" > $config_mak
1744 echo "/* Automatically generated by configure - do not modify */" > $config_h
1747 echo "include ../config-host.mak" >> $config_mak
1748 echo "#include \"../config-host.h\"" >> $config_h
1750 bflt="no"
1751 elfload32="no"
1752 target_nptl="no"
1753 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1754 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1755 gdb_xml_files=""
1757 disable_cpu_emulation() {
1758 if test $cpu_emulation = "no"; then
1759 echo "#define NO_CPU_EMULATION 1" >> $config_h
1760 echo "NO_CPU_EMULATION=1" >> $config_mak
1764 configure_kvm() {
1765 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
1766 \( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \); then
1767 echo "#define USE_KVM 1" >> $config_h
1768 echo "USE_KVM=1" >> $config_mak
1769 echo "CONFIG_KVM_KERNEL_INC=$kerneldir/include" >> $config_mak
1770 if test $kvm_cap_pit = "yes" ; then
1771 echo "USE_KVM_PIT=1" >> $config_mak
1772 echo "#define USE_KVM_PIT 1" >> $config_h
1774 if test $kvm_cap_device_assignment = "yes" ; then
1775 echo "USE_KVM_DEVICE_ASSIGNMENT=1" >> $config_mak
1776 echo "#define USE_KVM_DEVICE_ASSIGNMENT 1" >> $config_h
1778 disable_cpu_emulation
1782 if [ use_upstream_kvm = yes ]; then
1784 # Make sure the target and host cpus are compatible
1785 if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
1786 \( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \) -o \
1787 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1788 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
1789 kvm="no"
1791 # Disable KVM for linux-user
1792 if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1793 kvm="no"
1798 case "$target_cpu" in
1799 i386)
1800 echo "TARGET_ARCH=i386" >> $config_mak
1801 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1802 echo "#define TARGET_I386 1" >> $config_h
1803 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
1804 then
1805 echo "#define USE_KQEMU 1" >> $config_h
1807 if test "$kvm" = "yes" ; then
1808 echo "CONFIG_KVM=yes" >> $config_mak
1809 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1810 echo "#define CONFIG_KVM 1" >> $config_h
1812 configure_kvm
1814 x86_64)
1815 echo "TARGET_ARCH=x86_64" >> $config_mak
1816 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1817 echo "#define TARGET_I386 1" >> $config_h
1818 echo "#define TARGET_X86_64 1" >> $config_h
1819 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1820 then
1821 echo "#define USE_KQEMU 1" >> $config_h
1823 configure_kvm
1825 ia64)
1826 echo "TARGET_ARCH=ia64" >> $config_mak
1827 echo "#define TARGET_ARCH \"ia64\"" >> $config_h
1828 echo "#define TARGET_IA64 1" >> $config_h
1829 configure_kvm
1830 if [ use_upstream_kvm = yes ]; then
1831 if test "$kvm" = "yes" ; then
1832 echo "CONFIG_KVM=yes" >> $config_mak
1833 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1834 echo "#define CONFIG_KVM 1" >> $config_h
1838 alpha)
1839 echo "TARGET_ARCH=alpha" >> $config_mak
1840 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1841 echo "#define TARGET_ALPHA 1" >> $config_h
1843 arm|armeb)
1844 echo "TARGET_ARCH=arm" >> $config_mak
1845 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1846 echo "#define TARGET_ARM 1" >> $config_h
1847 bflt="yes"
1848 target_nptl="yes"
1849 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
1851 cris)
1852 echo "TARGET_ARCH=cris" >> $config_mak
1853 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1854 echo "#define TARGET_CRIS 1" >> $config_h
1855 target_nptl="yes"
1857 m68k)
1858 echo "TARGET_ARCH=m68k" >> $config_mak
1859 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1860 echo "#define TARGET_M68K 1" >> $config_h
1861 bflt="yes"
1862 gdb_xml_files="cf-core.xml cf-fp.xml"
1864 mips|mipsel)
1865 echo "TARGET_ARCH=mips" >> $config_mak
1866 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1867 echo "#define TARGET_MIPS 1" >> $config_h
1868 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1870 mipsn32|mipsn32el)
1871 echo "TARGET_ARCH=mipsn32" >> $config_mak
1872 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1873 echo "#define TARGET_MIPS 1" >> $config_h
1874 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1876 mips64|mips64el)
1877 echo "TARGET_ARCH=mips64" >> $config_mak
1878 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1879 echo "#define TARGET_MIPS 1" >> $config_h
1880 echo "#define TARGET_MIPS64 1" >> $config_h
1881 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1883 ppc)
1884 echo "TARGET_ARCH=ppc" >> $config_mak
1885 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1886 echo "#define TARGET_PPC 1" >> $config_h
1887 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1889 ppcemb)
1890 echo "TARGET_ARCH=ppcemb" >> $config_mak
1891 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1892 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1893 echo "#define TARGET_PPC 1" >> $config_h
1894 echo "#define TARGET_PPCEMB 1" >> $config_h
1895 if test "$kvm" = "yes" ; then
1896 echo "CONFIG_KVM=yes" >> $config_mak
1897 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1898 echo "#define CONFIG_KVM 1" >> $config_h
1900 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1902 ppc64)
1903 echo "TARGET_ARCH=ppc64" >> $config_mak
1904 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1905 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1906 echo "#define TARGET_PPC 1" >> $config_h
1907 echo "#define TARGET_PPC64 1" >> $config_h
1908 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1910 ppc64abi32)
1911 echo "TARGET_ARCH=ppc64" >> $config_mak
1912 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1913 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1914 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1915 echo "#define TARGET_PPC 1" >> $config_h
1916 echo "#define TARGET_PPC64 1" >> $config_h
1917 echo "#define TARGET_ABI32 1" >> $config_h
1918 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1920 sh4|sh4eb)
1921 echo "TARGET_ARCH=sh4" >> $config_mak
1922 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1923 echo "#define TARGET_SH4 1" >> $config_h
1924 bflt="yes"
1925 target_nptl="yes"
1927 sparc)
1928 echo "TARGET_ARCH=sparc" >> $config_mak
1929 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1930 echo "#define TARGET_SPARC 1" >> $config_h
1932 sparc64)
1933 echo "TARGET_ARCH=sparc64" >> $config_mak
1934 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1935 echo "#define TARGET_SPARC 1" >> $config_h
1936 echo "#define TARGET_SPARC64 1" >> $config_h
1937 elfload32="yes"
1939 sparc32plus)
1940 echo "TARGET_ARCH=sparc64" >> $config_mak
1941 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1942 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1943 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1944 echo "#define TARGET_SPARC 1" >> $config_h
1945 echo "#define TARGET_SPARC64 1" >> $config_h
1946 echo "#define TARGET_ABI32 1" >> $config_h
1949 echo "Unsupported target CPU"
1950 exit 1
1952 esac
1953 if test "$target_bigendian" = "yes" ; then
1954 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1955 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1957 if test "$target_softmmu" = "yes" ; then
1958 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1959 echo "#define CONFIG_SOFTMMU 1" >> $config_h
1961 if test "$target_user_only" = "yes" ; then
1962 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1963 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1965 if test "$target_linux_user" = "yes" ; then
1966 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1967 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1969 if test "$target_darwin_user" = "yes" ; then
1970 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1971 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1973 list=""
1974 if test ! -z "$gdb_xml_files" ; then
1975 for x in $gdb_xml_files; do
1976 list="$list $source_path/gdb-xml/$x"
1977 done
1979 echo "TARGET_XML_FILES=$list" >> $config_mak
1981 if test "$target_cpu" = "arm" \
1982 -o "$target_cpu" = "armeb" \
1983 -o "$target_cpu" = "m68k" \
1984 -o "$target_cpu" = "mips" \
1985 -o "$target_cpu" = "mipsel" \
1986 -o "$target_cpu" = "mipsn32" \
1987 -o "$target_cpu" = "mipsn32el" \
1988 -o "$target_cpu" = "mips64" \
1989 -o "$target_cpu" = "mips64el" \
1990 -o "$target_cpu" = "ppc" \
1991 -o "$target_cpu" = "ppc64" \
1992 -o "$target_cpu" = "ppc64abi32" \
1993 -o "$target_cpu" = "ppcemb" \
1994 -o "$target_cpu" = "sparc" \
1995 -o "$target_cpu" = "sparc64" \
1996 -o "$target_cpu" = "sparc32plus"; then
1997 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1998 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
2000 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
2001 echo "TARGET_HAS_BFLT=yes" >> $config_mak
2002 echo "#define TARGET_HAS_BFLT 1" >> $config_h
2004 if test "$target_user_only" = "yes" \
2005 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
2006 echo "#define USE_NPTL 1" >> $config_h
2008 # 32 bit ELF loader in addition to native 64 bit loader?
2009 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
2010 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
2011 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
2013 if test "$target_bsd_user" = "yes" ; then
2014 echo "CONFIG_BSD_USER=yes" >> $config_mak
2015 echo "#define CONFIG_BSD_USER 1" >> $config_h
2018 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
2020 done # for target in $targets
2022 # build tree in object directory if source path is different from current one
2023 if test "$source_path_used" = "yes" ; then
2024 DIRS="tests tests/cris slirp audio"
2025 FILES="Makefile tests/Makefile"
2026 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
2027 FILES="$FILES tests/test-mmap.c"
2028 for dir in $DIRS ; do
2029 mkdir -p $dir
2030 done
2031 # remove the link and recreate it, as not all "ln -sf" overwrite the link
2032 for f in $FILES ; do
2033 rm -f $f
2034 ln -s $source_path/$f $f
2035 done