kvm: user: ppc: fix build break caused by changes to kvm_callbacks
[qemu-kvm/fedora.git] / configure
blob63a85d69537c911d7b73a5975f53a3234acea7f7
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 gcc3_search="yes"
30 gcc3_list="gcc-3.4.6 gcc-3.4 gcc34 gcc-3.3.6 gcc-3.3 gcc33 gcc-3.2 gcc32"
31 audio_drv_list=""
32 audio_card_list=""
33 host_cc="gcc"
34 ar="ar"
35 make="make"
36 install="install"
37 strip="strip"
38 cpu=`test $(uname -s) = AIX && uname -p || uname -m`
39 target_list=""
40 case "$cpu" in
41 i386|i486|i586|i686|i86pc|BePC)
42 cpu="i386"
44 x86_64|amd64)
45 cpu="x86_64"
47 alpha)
48 cpu="alpha"
50 armv*b)
51 cpu="armv4b"
53 armv*l)
54 cpu="armv4l"
56 cris)
57 cpu="cris"
59 parisc|parisc64)
60 cpu="hppa"
62 ia64)
63 cpu="ia64"
65 m68k)
66 cpu="m68k"
68 mips)
69 cpu="mips"
71 mips64)
72 cpu="mips64"
74 "Power Macintosh"|ppc|ppc64|powerpc)
75 cpu="powerpc"
77 s390*)
78 cpu="s390"
80 sparc|sun4[cdmuv])
81 cpu="sparc"
83 sparc64)
84 cpu="sparc64"
87 cpu="unknown"
89 esac
90 gprof="no"
91 sparse="no"
92 bigendian="no"
93 mingw32="no"
94 EXESUF=""
95 gdbstub="yes"
96 slirp="yes"
97 vde="yes"
98 fmod_lib=""
99 fmod_inc=""
100 oss_lib=""
101 vnc_tls="yes"
102 bsd="no"
103 linux="no"
104 solaris="no"
105 kqemu="no"
106 profiler="no"
107 cocoa="no"
108 check_gfx="yes"
109 check_gcc="yes"
110 softmmu="yes"
111 linux_user="no"
112 darwin_user="no"
113 bsd_user="no"
114 build_docs="no"
115 uname_release=""
116 curses="yes"
117 aio="yes"
118 nptl="yes"
119 mixemu="no"
120 bluez="yes"
121 kvm="yes"
122 kvm_cap_pit="no"
123 kvm_cap_device_assignment="no"
124 kerneldir=""
125 aix="no"
126 blobs="yes"
127 signalfd="no"
128 eventfd="no"
129 cpu_emulation="yes"
130 device_tree_support=""
132 # OS specific
133 targetos=`uname -s`
134 case $targetos in
135 CYGWIN*)
136 mingw32="yes"
137 OS_CFLAGS="-mno-cygwin"
138 if [ "$cpu" = "i386" ] ; then
139 kqemu="yes"
141 audio_possible_drivers="sdl"
143 MINGW32*)
144 mingw32="yes"
145 if [ "$cpu" = "i386" ] ; then
146 kqemu="yes"
148 audio_possible_drivers="dsound sdl fmod"
150 GNU/kFreeBSD)
151 audio_drv_list="oss"
152 audio_possible_drivers="oss sdl esd pa"
153 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
154 kqemu="yes"
157 FreeBSD)
158 bsd="yes"
159 audio_drv_list="oss"
160 audio_possible_drivers="oss sdl esd pa"
161 aio_lib="-lpthread"
162 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
163 kqemu="yes"
164 kvm="yes"
167 NetBSD)
168 bsd="yes"
169 audio_drv_list="oss"
170 audio_possible_drivers="oss sdl esd"
171 oss_lib="-lossaudio"
172 aio_lib="-lrt -lpthread"
174 OpenBSD)
175 bsd="yes"
176 openbsd="yes"
177 audio_drv_list="oss"
178 audio_possible_drivers="oss sdl esd"
179 oss_lib="-lossaudio"
180 aio_lib="-lpthread"
182 Darwin)
183 bsd="yes"
184 darwin="yes"
185 darwin_user="yes"
186 cocoa="yes"
187 audio_drv_list="coreaudio"
188 audio_possible_drivers="coreaudio sdl fmod"
189 OS_CFLAGS="-mdynamic-no-pic"
190 OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
191 aio_lib="-lpthread"
193 SunOS)
194 solaris="yes"
195 make="gmake"
196 install="ginstall"
197 needs_libsunmath="no"
198 solarisrev=`uname -r | cut -f2 -d.`
199 # have to select again, because `uname -m` returns i86pc
200 # even on an x86_64 box.
201 solariscpu=`isainfo -k`
202 if test "${solariscpu}" = "amd64" ; then
203 cpu="x86_64"
205 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
206 if test "$solarisrev" -le 9 ; then
207 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
208 needs_libsunmath="yes"
209 else
210 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
211 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
212 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
213 echo "Studio 11 can be downloaded from www.sun.com."
214 exit 1
217 if test "$solarisrev" -ge 9 ; then
218 kqemu="yes"
221 if test -f /usr/include/sys/soundcard.h ; then
222 audio_drv_list="oss"
224 audio_possible_drivers="oss sdl"
226 AIX)
227 aix="yes"
228 make="gmake"
231 audio_drv_list="oss"
232 audio_possible_drivers="oss alsa sdl esd pa"
233 linux="yes"
234 linux_user="yes"
235 usb="linux"
236 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
237 kqemu="yes"
238 audio_possible_drivers="$audio_possible_drivers fmod"
239 kvm="yes"
241 if [ "$cpu" = "ia64" ] ; then
242 kvm="yes"
243 cpu_emulation="no"
244 gdbstub="no"
245 slirp="no"
247 if [ "$cpu" = "powerpc" ]; then
248 kvm="yes"
251 esac
253 if [ "$bsd" = "yes" ] ; then
254 if [ "$darwin" != "yes" ] ; then
255 make="gmake"
256 usb="bsd"
258 bsd_user="yes"
261 # find source path
262 source_path=`dirname "$0"`
263 source_path_used="no"
264 workdir=`pwd`
265 if [ -z "$source_path" ]; then
266 source_path=$workdir
267 else
268 source_path=`cd "$source_path"; pwd`
270 [ -f "$workdir/vl.c" ] || source_path_used="yes"
272 werror="no"
273 # generate compile errors on warnings for development builds
274 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
275 #werror="yes";
278 for opt do
279 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
280 case "$opt" in
281 --help|-h) show_help=yes
283 --prefix=*) prefix="$optarg"
285 --interp-prefix=*) interp_prefix="$optarg"
287 --source-path=*) source_path="$optarg"
288 source_path_used="yes"
290 --cross-prefix=*) cross_prefix="$optarg"
292 --cc=*) cc="$optarg"
293 gcc3_search="no"
295 --host-cc=*) host_cc="$optarg"
297 --make=*) make="$optarg"
299 --install=*) install="$optarg"
301 --extra-cflags=*) CFLAGS="$optarg"
303 --extra-ldflags=*) LDFLAGS="$optarg"
305 --cpu=*) cpu="$optarg"
307 --target-list=*) target_list="$optarg"
309 --enable-gprof) gprof="yes"
311 --static) static="yes"
313 --disable-sdl) sdl="no"
315 --fmod-lib=*) fmod_lib="$optarg"
317 --fmod-inc=*) fmod_inc="$optarg"
319 --oss-lib=*) oss_lib="$optarg"
321 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
323 --audio-drv-list=*) audio_drv_list="$optarg"
325 --enable-sparse) sparse="yes"
327 --disable-sparse) sparse="no"
329 --disable-vnc-tls) vnc_tls="no"
331 --disable-slirp) slirp="no"
333 --disable-vde) vde="no"
335 --disable-kqemu) kqemu="no"
337 --disable-brlapi) brlapi="no"
339 --disable-bluez) bluez="no"
341 --disable-kvm) kvm="no"
343 --enable-profiler) profiler="yes"
345 --enable-cocoa)
346 cocoa="yes" ;
347 sdl="no" ;
348 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
350 --disable-gfx-check) check_gfx="no"
352 --disable-gcc-check) check_gcc="no"
354 --disable-system) softmmu="no"
356 --enable-system) softmmu="yes"
358 --disable-linux-user) linux_user="no"
360 --enable-linux-user) linux_user="yes"
362 --disable-darwin-user) darwin_user="no"
364 --enable-darwin-user) darwin_user="yes"
366 --disable-bsd-user) bsd_user="no"
368 --enable-bsd-user) bsd_user="yes"
370 --enable-uname-release=*) uname_release="$optarg"
372 --sparc_cpu=*)
373 sparc_cpu="$optarg"
374 case $sparc_cpu in
375 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
376 target_cpu="sparc"; cpu="sparc" ;;
377 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
378 target_cpu="sparc"; cpu="sparc" ;;
379 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
380 target_cpu="sparc64"; cpu="sparc64" ;;
381 *) echo "undefined SPARC architecture. Exiting";exit 1;;
382 esac
384 --enable-werror) werror="yes"
386 --disable-werror) werror="no"
388 --disable-curses) curses="no"
390 --disable-nptl) nptl="no"
392 --enable-mixemu) mixemu="yes"
394 --disable-aio) aio="no"
396 --disable-blobs) blobs="no"
398 --kerneldir=*) kerneldir="$optarg"
400 --disable-cpu-emulation) cpu_emulation="no"
402 --disable-libfdt) device_tree_support="no"
404 *) echo "ERROR: unknown option $opt"; exit 1
406 esac
407 done
409 # default flags for all hosts
410 CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
411 CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings"
412 LDFLAGS="$LDFLAGS -g"
413 if test "$werror" = "yes" ; then
414 CFLAGS="$CFLAGS -Werror"
417 if test "$solaris" = "no" ; then
418 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
419 LDFLAGS="$LDFLAGS -Wl,--warn-common"
424 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
425 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
427 case "$cpu" in
428 sparc) if test -z "$sparc_cpu" ; then
429 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
430 ARCH_LDFLAGS="-m32"
431 else
432 ARCH_CFLAGS="${SP_CFLAGS}"
433 ARCH_LDFLAGS="${SP_LDFLAGS}"
436 sparc64) if test -z "$sparc_cpu" ; then
437 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
438 ARCH_LDFLAGS="-m64"
439 else
440 ARCH_CFLAGS="${SP_CFLAGS}"
441 ARCH_LDFLAGS="${SP_LDFLAGS}"
444 s390)
445 ARCH_CFLAGS="-march=z900"
447 i386)
448 ARCH_CFLAGS="-m32"
449 ARCH_LDFLAGS="-m32"
451 x86_64)
452 ARCH_CFLAGS="-m64"
453 ARCH_LDFLAGS="-m64"
455 esac
457 if test x"$show_help" = x"yes" ; then
458 cat << EOF
460 Usage: configure [options]
461 Options: [defaults in brackets after descriptions]
464 echo "Standard options:"
465 echo " --help print this message"
466 echo " --prefix=PREFIX install in PREFIX [$prefix]"
467 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
468 echo " use %M for cpu name [$interp_prefix]"
469 echo " --target-list=LIST set target list [$target_list]"
470 echo ""
471 echo "kqemu kernel acceleration support:"
472 echo " --disable-kqemu disable kqemu support"
473 echo ""
474 echo "Advanced options (experts only):"
475 echo " --source-path=PATH path of source code [$source_path]"
476 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
477 echo " --cc=CC use C compiler CC [$cc]"
478 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
479 echo " --make=MAKE use specified make [$make]"
480 echo " --install=INSTALL use specified install [$install]"
481 echo " --static enable static build [$static]"
482 echo " --enable-sparse enable sparse checker"
483 echo " --disable-sparse disable sparse checker (default)"
484 echo " --disable-werror disable compilation abort on warning"
485 echo " --disable-sdl disable SDL"
486 echo " --enable-cocoa enable COCOA (Mac OS X only)"
487 echo " --audio-drv-list=LIST set audio drivers list:"
488 echo " Available drivers: $audio_possible_drivers"
489 echo " --audio-card-list=LIST set list of additional emulated audio cards"
490 echo " Available cards: ac97 adlib cs4231a gus"
491 echo " --enable-mixemu enable mixer emulation"
492 echo " --disable-brlapi disable BrlAPI"
493 echo " --disable-vnc-tls disable TLS encryption for VNC server"
494 echo " --disable-curses disable curses output"
495 echo " --disable-bluez disable bluez stack connectivity"
496 echo " --disable-kvm disable KVM acceleration support"
497 echo " --disable-nptl disable usermode NPTL support"
498 echo " --enable-system enable all system emulation targets"
499 echo " --disable-system disable all system emulation targets"
500 echo " --enable-linux-user enable all linux usermode emulation targets"
501 echo " --disable-linux-user disable all linux usermode emulation targets"
502 echo " --enable-darwin-user enable all darwin usermode emulation targets"
503 echo " --disable-darwin-user disable all darwin usermode emulation targets"
504 echo " --enable-bsd-user enable all BSD usermode emulation targets"
505 echo " --disable-bsd-user disable all BSD usermode emulation targets"
506 echo " --fmod-lib path to FMOD library"
507 echo " --fmod-inc path to FMOD includes"
508 echo " --oss-lib path to OSS library"
509 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
510 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
511 echo " --disable-vde disable support for vde network"
512 echo " --disable-aio disable AIO support"
513 echo " --disable-blobs disable installing provided firmware blobs"
514 echo " --kerneldir=PATH look for kernel includes in PATH"
515 echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
516 echo " --disable-libfdt disables use of libfdt support for device tree"
517 echo ""
518 echo "NOTE: The object files are built at the place where configure is launched"
519 exit 1
522 cc="${cross_prefix}${cc}"
523 ar="${cross_prefix}${ar}"
524 strip="${cross_prefix}${strip}"
526 # check that the C compiler works.
527 cat > $TMPC <<EOF
528 int main(void) {}
531 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then
532 : C compiler works ok
533 else
534 echo "ERROR: \"$cc\" either does not exist or does not work"
535 exit 1
538 # check compiler to see if we're on mingw32
539 cat > $TMPC <<EOF
540 #include <windows.h>
541 #ifndef _WIN32
542 #error not windows
543 #endif
544 int main(void) {}
547 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then
548 mingw32="yes"
551 if test "$mingw32" = "yes" ; then
552 linux="no"
553 EXESUF=".exe"
554 oss="no"
555 linux_user="no"
556 bsd_user="no"
559 if [ "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
560 AIOLIBS=
561 elif [ "$bsd" = "yes" ]; then
562 AIOLIBS="$aio_lib"
563 else
564 # Some Linux architectures (e.g. s390) don't imply -lpthread automatically.
565 AIOLIBS="-lrt -lpthread"
568 # Check for gcc4, error if pre-gcc4
569 if test "$check_gcc" = "yes" ; then
570 cat > $TMPC <<EOF
571 #if __GNUC__ < 4
572 #error gcc3
573 #endif
574 int main(){return 0;}
576 if "$cc" $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
577 echo "WARNING: \"$cc\" looks like gcc 4.x"
578 found_compat_cc="no"
579 if test "$gcc3_search" = "yes" ; then
580 echo "Looking for gcc 3.x"
581 for compat_cc in $gcc3_list ; do
582 if "$cross_prefix$compat_cc" --version 2> /dev/null | fgrep '(GCC) 3.' > /dev/null 2>&1 ; then
583 echo "Found \"$compat_cc\""
584 cc="$cross_prefix$compat_cc"
585 found_compat_cc="yes"
586 break
588 done
589 if test "$found_compat_cc" = "no" ; then
590 echo "gcc 3.x not found!"
593 if test "$found_compat_cc" = "no" ; then
594 echo "QEMU is known to have problems when compiled with gcc 4.x"
595 echo "It is recommended that you use gcc 3.x to build QEMU"
596 echo "To use this compiler anyway, configure with --disable-gcc-check"
597 exit 1;
602 if test ! -x "$(which cgcc 2>/dev/null)"; then
603 sparse="no"
607 # Solaris specific configure tool chain decisions
609 if test "$solaris" = "yes" ; then
611 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
612 # override the check with --disable-gcc-check
614 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
615 solgcc=`which $cc`
616 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
617 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
618 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
619 echo "or get the latest patch from SunSolve for gcc"
620 exit 1
623 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
624 if test -z "$solinst" ; then
625 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
626 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
627 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
628 exit 1
630 if test "$solinst" = "/usr/sbin/install" ; then
631 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
632 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
633 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
634 exit 1
636 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
637 if test -z "$sol_ar" ; then
638 echo "Error: No path includes ar"
639 if test -f /usr/ccs/bin/ar ; then
640 echo "Add /usr/ccs/bin to your path and rerun configure"
642 exit 1
647 if test -z "$target_list" ; then
648 # these targets are portable
649 if [ "$softmmu" = "yes" ] ; then
650 target_list="\
651 i386-softmmu \
652 x86_64-softmmu \
653 arm-softmmu \
654 cris-softmmu \
655 m68k-softmmu \
656 mips-softmmu \
657 mipsel-softmmu \
658 mips64-softmmu \
659 mips64el-softmmu \
660 ppc-softmmu \
661 ppcemb-softmmu \
662 ppc64-softmmu \
663 sh4-softmmu \
664 sh4eb-softmmu \
665 sparc-softmmu \
668 # the following are Linux specific
669 if [ "$linux_user" = "yes" ] ; then
670 target_list="${target_list}\
671 i386-linux-user \
672 x86_64-linux-user \
673 alpha-linux-user \
674 arm-linux-user \
675 armeb-linux-user \
676 cris-linux-user \
677 m68k-linux-user \
678 mips-linux-user \
679 mipsel-linux-user \
680 ppc-linux-user \
681 ppc64-linux-user \
682 ppc64abi32-linux-user \
683 sh4-linux-user \
684 sh4eb-linux-user \
685 sparc-linux-user \
686 sparc64-linux-user \
687 sparc32plus-linux-user \
690 # the following are Darwin specific
691 if [ "$darwin_user" = "yes" ] ; then
692 target_list="$target_list i386-darwin-user ppc-darwin-user"
694 # the following are BSD specific
695 if [ "$bsd_user" = "yes" ] ; then
696 target_list="${target_list}\
697 sparc64-bsd-user \
700 else
701 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
703 if test -z "$target_list" ; then
704 echo "No targets enabled"
705 exit 1
708 if test -z "$cross_prefix" ; then
710 # ---
711 # big/little endian test
712 cat > $TMPC << EOF
713 #include <inttypes.h>
714 int main(int argc, char ** argv){
715 volatile uint32_t i=0x01234567;
716 return (*((uint8_t*)(&i))) == 0x67;
720 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
721 $TMPE && bigendian="yes"
722 else
723 echo big/little test failed
726 else
728 # if cross compiling, cannot launch a program, so make a static guess
729 if test "$cpu" = "armv4b" \
730 -o "$cpu" = "hppa" \
731 -o "$cpu" = "m68k" \
732 -o "$cpu" = "mips" \
733 -o "$cpu" = "mips64" \
734 -o "$cpu" = "powerpc" \
735 -o "$cpu" = "s390" \
736 -o "$cpu" = "sparc" \
737 -o "$cpu" = "sparc64"; then
738 bigendian="yes"
743 # host long bits test
744 hostlongbits="32"
745 if test "$cpu" = "x86_64" \
746 -o "$cpu" = "alpha" \
747 -o "$cpu" = "ia64" \
748 -o "$cpu" = "sparc64"; then
749 hostlongbits="64"
752 # ppc specific hostlongbits selection
753 if test "$cpu" = "powerpc" ; then
754 if $cc $ARCH_CFLAGS -dM -E - -o $TMPI 2>/dev/null </dev/null; then
755 grep -q __powerpc64__ $TMPI && hostlongbits=64
756 else
757 echo hostlongbits test failed
758 exit 1
762 # check gcc options support
763 cat > $TMPC <<EOF
764 int main(void) {
768 # Check host NPTL support
769 cat > $TMPC <<EOF
770 #include <sched.h>
771 #include <linux/futex.h>
772 void foo()
774 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
775 #error bork
776 #endif
780 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then
782 else
783 nptl="no"
786 ##########################################
787 # KVM probe
789 if test "$kvm" = "yes" ; then
791 # test for KVM_CAP_PIT
793 cat > $TMPC <<EOF
794 #include <libkvm.h>
795 #ifndef KVM_CAP_PIT
796 #error "kvm no pit capability"
797 #endif
798 int main(void) { return 0; }
800 if $cc $ARCH_CFLAGS $CFLAGS -I"$kerneldir"/include -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev/null ; then
801 kvm_cap_pit="yes"
804 # test for KVM_CAP_DEVICE_ASSIGNMENT
806 cat > $TMPC <<EOF
807 #include <libkvm.h>
808 #ifndef KVM_CAP_DEVICE_ASSIGNMENT
809 #error "kvm no device assignment capability"
810 #endif
811 int main(void) { return 0; }
813 if $cc $ARCH_CFLAGS $CFLAGS -I"$kerneldir"/include -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev/null ; then
814 kvm_cap_device_assignment="yes"
818 ##########################################
819 # zlib check
821 cat > $TMPC << EOF
822 #include <zlib.h>
823 int main(void) { zlibVersion(); return 0; }
825 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz 2> /dev/null ; then
827 else
828 echo
829 echo "Error: zlib check failed"
830 echo "Make sure to have the zlib libs and headers installed."
831 echo
832 exit 1
835 ##########################################
836 # SDL probe
838 sdl_too_old=no
840 if test -z "$sdl" ; then
841 sdl_config="sdl-config"
842 sdl=no
843 sdl_static=no
845 cat > $TMPC << EOF
846 #include <SDL.h>
847 #undef main /* We don't want SDL to override our main() */
848 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
850 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> $TMPSDLLOG ; then
851 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
852 if test "$_sdlversion" -lt 121 ; then
853 sdl_too_old=yes
854 else
855 if test "$cocoa" = "no" ; then
856 sdl=yes
860 # static link with sdl ?
861 if test "$sdl" = "yes" ; then
862 aa="no"
863 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
864 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
865 if [ "$aa" = "yes" ] ; then
866 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
869 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
870 sdl_static=yes
872 fi # static link
873 fi # sdl compile test
874 else
875 # Make sure to disable cocoa if sdl was set
876 if test "$sdl" = "yes" ; then
877 cocoa="no"
878 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
880 fi # -z $sdl
882 ##########################################
883 # VNC TLS detection
884 if test "$vnc_tls" = "yes" ; then
885 cat > $TMPC <<EOF
886 #include <gnutls/gnutls.h>
887 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
889 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
890 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
891 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
892 $vnc_tls_libs 2> /dev/null ; then
894 else
895 vnc_tls="no"
899 ##########################################
900 # vde libraries probe
901 if test "$vde" = "yes" ; then
902 cat > $TMPC << EOF
903 #include <libvdeplug.h>
904 int main(void)
906 struct vde_open_args a = {0, 0, 0};
907 vde_open("", "", &a);
908 return 0;
911 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug 2> /dev/null ; then
913 else
914 vde="no"
918 ##########################################
919 # Sound support libraries probe
921 audio_drv_probe()
923 drv=$1
924 hdr=$2
925 lib=$3
926 exp=$4
927 cfl=$5
928 cat > $TMPC << EOF
929 #include <$hdr>
930 int main(void) { $exp }
932 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib 2> /dev/null ; then
934 else
935 echo
936 echo "Error: $drv check failed"
937 echo "Make sure to have the $drv libs and headers installed."
938 echo
939 exit 1
943 audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
944 for drv in $audio_drv_list; do
945 case $drv in
946 alsa)
947 audio_drv_probe $drv alsa/asoundlib.h -lasound \
948 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
951 fmod)
952 if test -z $fmod_lib || test -z $fmod_inc; then
953 echo
954 echo "Error: You must specify path to FMOD library and headers"
955 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
956 echo
957 exit 1
959 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
962 esd)
963 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
967 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
968 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
971 oss|sdl|core|wav|dsound)
972 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
976 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
977 echo
978 echo "Error: Unknown driver '$drv' selected"
979 echo "Possible drivers are: $audio_possible_drivers"
980 echo
981 exit 1
984 esac
985 done
987 ##########################################
988 # BrlAPI probe
990 if test -z "$brlapi" ; then
991 brlapi=no
992 cat > $TMPC << EOF
993 #include <brlapi.h>
994 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
996 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi 2> /dev/null ; then
997 brlapi=yes
998 fi # brlapi compile test
999 fi # -z $brlapi
1001 ##########################################
1002 # curses probe
1004 if test "$curses" = "yes" ; then
1005 curses=no
1006 cat > $TMPC << EOF
1007 #include <curses.h>
1008 int main(void) { return curses_version(); }
1010 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses 2> /dev/null ; then
1011 curses=yes
1013 fi # test "$curses"
1015 ##########################################
1016 # bluez support probe
1017 if test "$bluez" = "yes" ; then
1018 `pkg-config bluez` || bluez="no"
1020 if test "$bluez" = "yes" ; then
1021 cat > $TMPC << EOF
1022 #include <bluetooth/bluetooth.h>
1023 int main(void) { return bt_error(0); }
1025 bluez_cflags=`pkg-config --cflags bluez`
1026 bluez_libs=`pkg-config --libs bluez`
1027 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
1028 $bluez_libs 2> /dev/null ; then
1030 else
1031 bluez="no"
1035 ##########################################
1036 # kvm probe
1037 if test "$kvm" = "yes" ; then
1038 cat > $TMPC <<EOF
1039 #include <linux/kvm.h>
1040 #if !defined(KVM_API_VERSION) || \
1041 KVM_API_VERSION < 12 || \
1042 KVM_API_VERSION > 12 || \
1043 !defined(KVM_CAP_USER_MEMORY) || \
1044 !defined(KVM_CAP_SET_TSS_ADDR)
1045 #error Invalid KVM version
1046 #endif
1047 int main(void) { return 0; }
1049 if test "$kerneldir" != "" ; then
1050 kvm_cflags=-I"$kerneldir"/include
1051 else
1052 kvm_cflags=""
1054 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
1055 2>/dev/null ; then
1057 else
1058 kvm="no"
1062 ##########################################
1063 # AIO probe
1064 if test "$aio" = "yes" ; then
1065 aio=no
1066 cat > $TMPC << EOF
1067 #include <aio.h>
1068 int main(void) { return aio_write(NULL); }
1070 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
1071 aio=yes
1075 ##########################################
1076 # signalfd probe
1077 cat > $TMPC << EOF
1078 #define _GNU_SOURCE
1079 #include <unistd.h>
1080 #include <sys/syscall.h>
1081 #include <signal.h>
1082 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
1085 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1086 signalfd=yes
1089 ##########################################
1090 # eventfd probe
1091 cat > $TMPC << EOF
1092 #define _GNU_SOURCE
1093 #include <unistd.h>
1094 #include <sys/syscall.h>
1095 int main(void) { return syscall(SYS_eventfd, 0); }
1098 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1099 eventfd=yes
1102 # Check if tools are available to build documentation.
1103 if [ -x "`which texi2html 2>/dev/null`" ] && \
1104 [ -x "`which pod2man 2>/dev/null`" ]; then
1105 build_docs="yes"
1108 if test "$mingw32" = "yes" ; then
1109 if test -z "$prefix" ; then
1110 prefix="c:\\\\Program Files\\\\Qemu"
1112 mansuffix=""
1113 datasuffix=""
1114 docsuffix=""
1115 binsuffix=""
1116 else
1117 if test -z "$prefix" ; then
1118 prefix="/usr/local"
1120 mansuffix="/share/man"
1121 datasuffix="/share/qemu"
1122 docsuffix="/share/doc/qemu"
1123 binsuffix="/bin"
1126 ######################################
1127 # libfdt probe
1129 if test -z "$device_tree_support" -a \
1130 "$cpu" = "powerpc"; then
1131 device_tree_support="no"
1132 cat > $TMPC << EOF
1133 #include <libfdt.h>
1134 /* XXX uncomment later when libfdt is built before this test */
1135 //int main(void) { void *fdt; return fdt_create(fdt, 1024); }
1136 int main (void) {return 0;}
1138 # XXX for now do not try to link to libfdt and just check for header */
1139 # if $cc $ARCH_CFLAGS $CFLAGS $LDFLAGS -o $TMPE $TMPC -lfdt 2> /dev/null ; then
1140 if $cc $ARCH_CFLAGS $CFLAGS $LDFLAGS -o $TMPE $TMPC 2> /dev/null; then
1141 device_tree_support="yes"
1142 else
1143 echo
1144 echo "Error: Could not find libfdt"
1145 echo "Make sure to have the libfdt libs and headers installed."
1146 echo
1147 exit 1
1151 echo "Install prefix $prefix"
1152 echo "BIOS directory $prefix$datasuffix"
1153 echo "binary directory $prefix$binsuffix"
1154 if test "$mingw32" = "no" ; then
1155 echo "Manual directory $prefix$mansuffix"
1156 echo "ELF interp prefix $interp_prefix"
1158 echo "Source path $source_path"
1159 echo "C compiler $cc"
1160 echo "Host C compiler $host_cc"
1161 echo "ARCH_CFLAGS $ARCH_CFLAGS"
1162 echo "make $make"
1163 echo "install $install"
1164 echo "host CPU $cpu"
1165 echo "host big endian $bigendian"
1166 echo "target list $target_list"
1167 echo "gprof enabled $gprof"
1168 echo "sparse enabled $sparse"
1169 echo "profiler $profiler"
1170 echo "static build $static"
1171 echo "-Werror enabled $werror"
1172 if test "$darwin" = "yes" ; then
1173 echo "Cocoa support $cocoa"
1175 echo "SDL support $sdl"
1176 if test "$sdl" != "no" ; then
1177 echo "SDL static link $sdl_static"
1179 echo "curses support $curses"
1180 echo "mingw32 support $mingw32"
1181 echo "Audio drivers $audio_drv_list"
1182 echo "Extra audio cards $audio_card_list"
1183 echo "Mixer emulation $mixemu"
1184 echo "VNC TLS support $vnc_tls"
1185 if test "$vnc_tls" = "yes" ; then
1186 echo " TLS CFLAGS $vnc_tls_cflags"
1187 echo " TLS LIBS $vnc_tls_libs"
1189 if test -n "$sparc_cpu"; then
1190 echo "Target Sparc Arch $sparc_cpu"
1192 echo "kqemu support $kqemu"
1193 echo "kvm support $kvm"
1194 echo "CPU emulation $cpu_emulation"
1195 if test $cpu = "powerpc"; then
1196 echo "libfdt support $device_tree_support"
1198 echo "brlapi support $brlapi"
1199 echo "Documentation $build_docs"
1200 [ ! -z "$uname_release" ] && \
1201 echo "uname -r $uname_release"
1202 echo "NPTL support $nptl"
1203 echo "vde support $vde"
1204 echo "AIO support $aio"
1205 echo "Install blobs $blobs"
1206 echo "KVM support $kvm"
1208 if test $sdl_too_old = "yes"; then
1209 echo "-> Your SDL version is too old - please upgrade to have SDL support"
1211 if [ -s $TMPSDLLOG ]; then
1212 echo "The error log from compiling the libSDL test is: "
1213 cat $TMPSDLLOG
1215 #if test "$sdl_static" = "no"; then
1216 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1218 config_mak="config-host.mak"
1219 config_h="config-host.h"
1221 #echo "Creating $config_mak and $config_h"
1223 test -f $config_h && mv $config_h ${config_h}~
1225 echo "# Automatically generated by configure - do not modify" > $config_mak
1226 echo "# Configured with: $0 $@" >> $config_mak
1227 echo "/* Automatically generated by configure - do not modify */" > $config_h
1229 echo "prefix=$prefix" >> $config_mak
1230 echo "bindir=\${prefix}$binsuffix" >> $config_mak
1231 echo "mandir=\${prefix}$mansuffix" >> $config_mak
1232 echo "datadir=\${prefix}$datasuffix" >> $config_mak
1233 echo "docdir=\${prefix}$docsuffix" >> $config_mak
1234 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
1235 echo "MAKE=$make" >> $config_mak
1236 echo "INSTALL=$install" >> $config_mak
1237 echo "CC=$cc" >> $config_mak
1238 echo "HOST_CC=$host_cc" >> $config_mak
1239 echo "AR=$ar" >> $config_mak
1240 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
1241 # XXX: only use CFLAGS and LDFLAGS ?
1242 # XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1243 # compilation of dyngen tool (useful for win32 build on Linux host)
1244 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
1245 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1246 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1247 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
1248 echo "CFLAGS=$CFLAGS" >> $config_mak
1249 echo "LDFLAGS=$LDFLAGS" >> $config_mak
1250 echo "EXESUF=$EXESUF" >> $config_mak
1251 echo "AIOLIBS=$AIOLIBS" >> $config_mak
1252 case "$cpu" in
1253 i386)
1254 echo "ARCH=i386" >> $config_mak
1255 echo "#define HOST_I386 1" >> $config_h
1257 x86_64)
1258 echo "ARCH=x86_64" >> $config_mak
1259 echo "#define HOST_X86_64 1" >> $config_h
1261 alpha)
1262 echo "ARCH=alpha" >> $config_mak
1263 echo "#define HOST_ALPHA 1" >> $config_h
1265 armv4b)
1266 echo "ARCH=arm" >> $config_mak
1267 echo "#define HOST_ARM 1" >> $config_h
1269 armv4l)
1270 echo "ARCH=arm" >> $config_mak
1271 echo "#define HOST_ARM 1" >> $config_h
1273 cris)
1274 echo "ARCH=cris" >> $config_mak
1275 echo "#define HOST_CRIS 1" >> $config_h
1277 hppa)
1278 echo "ARCH=hppa" >> $config_mak
1279 echo "#define HOST_HPPA 1" >> $config_h
1281 ia64)
1282 echo "ARCH=ia64" >> $config_mak
1283 echo "#define HOST_IA64 1" >> $config_h
1285 m68k)
1286 echo "ARCH=m68k" >> $config_mak
1287 echo "#define HOST_M68K 1" >> $config_h
1289 mips)
1290 echo "ARCH=mips" >> $config_mak
1291 echo "#define HOST_MIPS 1" >> $config_h
1293 mips64)
1294 echo "ARCH=mips64" >> $config_mak
1295 echo "#define HOST_MIPS64 1" >> $config_h
1297 powerpc)
1298 if test "$hostlongbits" = "32"; then
1299 echo "ARCH=ppc" >> $config_mak
1300 echo "#define HOST_PPC 1" >> $config_h
1301 else
1302 echo "ARCH=ppc64" >> $config_mak
1303 echo "#define HOST_PPC64 1" >> $config_h
1306 s390)
1307 echo "ARCH=s390" >> $config_mak
1308 echo "#define HOST_S390 1" >> $config_h
1310 sparc)
1311 echo "ARCH=sparc" >> $config_mak
1312 echo "#define HOST_SPARC 1" >> $config_h
1314 sparc64)
1315 echo "ARCH=sparc64" >> $config_mak
1316 echo "#define HOST_SPARC64 1" >> $config_h
1319 echo "Unsupported CPU = $cpu"
1320 exit 1
1322 esac
1323 if test "$sparse" = "yes" ; then
1324 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1325 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1326 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1328 if test "$bigendian" = "yes" ; then
1329 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1330 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1332 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
1333 if test "$mingw32" = "yes" ; then
1334 echo "CONFIG_WIN32=yes" >> $config_mak
1335 echo "#define CONFIG_WIN32 1" >> $config_h
1336 else
1337 cat > $TMPC << EOF
1338 #include <byteswap.h>
1339 int main(void) { return bswap_32(0); }
1341 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1342 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1346 if [ "$openbsd" = "yes" ] ; then
1347 echo "#define ENOTSUP 4096" >> $config_h
1350 if test "$darwin" = "yes" ; then
1351 echo "CONFIG_DARWIN=yes" >> $config_mak
1352 echo "#define CONFIG_DARWIN 1" >> $config_h
1355 if test "$aix" = "yes" ; then
1356 echo "CONFIG_AIX=yes" >> $config_mak
1357 echo "#define CONFIG_AIX 1" >> $config_h
1360 if test "$solaris" = "yes" ; then
1361 echo "CONFIG_SOLARIS=yes" >> $config_mak
1362 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
1363 if test "$needs_libsunmath" = "yes" ; then
1364 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1365 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1368 if test -n "$sparc_cpu"; then
1369 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1370 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1372 if test "$gdbstub" = "yes" ; then
1373 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1374 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1376 if test "$gprof" = "yes" ; then
1377 echo "TARGET_GPROF=yes" >> $config_mak
1378 echo "#define HAVE_GPROF 1" >> $config_h
1380 if test "$static" = "yes" ; then
1381 echo "CONFIG_STATIC=yes" >> $config_mak
1382 echo "#define CONFIG_STATIC 1" >> $config_h
1384 if test $profiler = "yes" ; then
1385 echo "#define CONFIG_PROFILER 1" >> $config_h
1387 if test "$slirp" = "yes" ; then
1388 echo "CONFIG_SLIRP=yes" >> $config_mak
1389 echo "#define CONFIG_SLIRP 1" >> $config_h
1391 if test "$vde" = "yes" ; then
1392 echo "CONFIG_VDE=yes" >> $config_mak
1393 echo "#define CONFIG_VDE 1" >> $config_h
1394 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1396 for card in $audio_card_list; do
1397 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
1398 echo "$def=yes" >> $config_mak
1399 echo "#define $def 1" >> $config_h
1400 done
1401 echo "#define AUDIO_DRIVERS \\" >> $config_h
1402 for drv in $audio_drv_list; do
1403 echo " &${drv}_audio_driver, \\" >>$config_h
1404 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
1405 echo "$def=yes" >> $config_mak
1406 if test "$drv" = "fmod"; then
1407 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1408 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1409 elif test "$drv" = "oss"; then
1410 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
1412 done
1413 echo "" >>$config_h
1414 if test "$mixemu" = "yes" ; then
1415 echo "CONFIG_MIXEMU=yes" >> $config_mak
1416 echo "#define CONFIG_MIXEMU 1" >> $config_h
1418 if test "$vnc_tls" = "yes" ; then
1419 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1420 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1421 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1422 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1424 qemu_version=`head $source_path/VERSION`
1425 echo "VERSION=$qemu_version" >>$config_mak
1426 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1427 echo "#define KVM_VERSION \"kvm-devel\"" >> $config_h
1429 echo "SRC_PATH=$source_path" >> $config_mak
1430 if [ "$source_path_used" = "yes" ]; then
1431 echo "VPATH=$source_path" >> $config_mak
1433 echo "TARGET_DIRS=$target_list" >> $config_mak
1434 if [ "$build_docs" = "yes" ] ; then
1435 echo "BUILD_DOCS=yes" >> $config_mak
1437 if test "$static" = "yes"; then
1438 sdl1=$sdl_static
1439 else
1440 sdl1=$sdl
1442 if test "$sdl1" = "yes" ; then
1443 echo "#define CONFIG_SDL 1" >> $config_h
1444 echo "CONFIG_SDL=yes" >> $config_mak
1445 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1446 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1447 else
1448 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1450 if [ "${aa}" = "yes" ] ; then
1451 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1452 else
1453 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1456 if test "$cocoa" = "yes" ; then
1457 echo "#define CONFIG_COCOA 1" >> $config_h
1458 echo "CONFIG_COCOA=yes" >> $config_mak
1460 if test "$curses" = "yes" ; then
1461 echo "#define CONFIG_CURSES 1" >> $config_h
1462 echo "CONFIG_CURSES=yes" >> $config_mak
1463 echo "CURSES_LIBS=-lcurses" >> $config_mak
1465 if test "$brlapi" = "yes" ; then
1466 echo "CONFIG_BRLAPI=yes" >> $config_mak
1467 echo "#define CONFIG_BRLAPI 1" >> $config_h
1468 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1470 if test "$bluez" = "yes" ; then
1471 echo "CONFIG_BLUEZ=yes" >> $config_mak
1472 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1473 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1474 echo "#define CONFIG_BLUEZ 1" >> $config_h
1476 if test "$aio" = "yes" ; then
1477 echo "#define CONFIG_AIO 1" >> $config_h
1478 echo "CONFIG_AIO=yes" >> $config_mak
1480 if test "$blobs" = "yes" ; then
1481 echo "INSTALL_BLOBS=yes" >> $config_mak
1483 if test "$signalfd" = "yes" ; then
1484 echo "#define CONFIG_signalfd 1" >> $config_h
1486 if test "$eventfd" = "yes" ; then
1487 echo "#define CONFIG_eventfd 1" >> $config_h
1490 # XXX: suppress that
1491 if [ "$bsd" = "yes" ] ; then
1492 echo "#define O_LARGEFILE 0" >> $config_h
1493 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1494 echo "#define _BSD 1" >> $config_h
1497 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1499 # USB host support
1500 case "$usb" in
1501 linux)
1502 echo "HOST_USB=linux" >> $config_mak
1504 bsd)
1505 echo "HOST_USB=bsd" >> $config_mak
1508 echo "HOST_USB=stub" >> $config_mak
1510 esac
1512 tools=
1513 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1514 tools="qemu-img\$(EXESUF) $tools"
1515 if [ "$linux" = "yes" ] ; then
1516 tools="qemu-nbd\$(EXESUF) $tools"
1519 echo "TOOLS=$tools" >> $config_mak
1521 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1523 for target in $target_list; do
1524 target_dir="$target"
1525 config_mak=$target_dir/config.mak
1526 config_h=$target_dir/config.h
1527 target_cpu=`echo $target | cut -d '-' -f 1`
1528 target_bigendian="no"
1529 [ "$target_cpu" = "armeb" ] && target_bigendian=yes
1530 [ "$target_cpu" = "m68k" ] && target_bigendian=yes
1531 [ "$target_cpu" = "mips" ] && target_bigendian=yes
1532 [ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1533 [ "$target_cpu" = "mips64" ] && target_bigendian=yes
1534 [ "$target_cpu" = "ppc" ] && target_bigendian=yes
1535 [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
1536 [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
1537 [ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
1538 [ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
1539 [ "$target_cpu" = "sparc" ] && target_bigendian=yes
1540 [ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1541 [ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
1542 target_softmmu="no"
1543 target_user_only="no"
1544 target_linux_user="no"
1545 target_darwin_user="no"
1546 target_bsd_user="no"
1547 case "$target" in
1548 ${target_cpu}-softmmu)
1549 target_softmmu="yes"
1551 ${target_cpu}-linux-user)
1552 target_user_only="yes"
1553 target_linux_user="yes"
1555 ${target_cpu}-darwin-user)
1556 target_user_only="yes"
1557 target_darwin_user="yes"
1559 ${target_cpu}-bsd-user)
1560 target_user_only="yes"
1561 target_bsd_user="yes"
1564 echo "ERROR: Target '$target' not recognised"
1565 exit 1
1567 esac
1569 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1570 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1571 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1572 echo "To build QEMU without graphical output configure with --disable-gfx-check"
1573 echo "Note that this will disable all output from the virtual graphics card"
1574 echo "except through VNC or curses."
1575 exit 1;
1578 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1580 test -f $config_h && mv $config_h ${config_h}~
1582 mkdir -p $target_dir
1583 mkdir -p $target_dir/fpu
1584 mkdir -p $target_dir/tcg
1585 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
1586 mkdir -p $target_dir/nwfpe
1590 # don't use ln -sf as not all "ln -sf" over write the file/link
1592 rm -f $target_dir/Makefile
1593 ln -s $source_path/Makefile.target $target_dir/Makefile
1596 echo "# Automatically generated by configure - do not modify" > $config_mak
1597 echo "/* Automatically generated by configure - do not modify */" > $config_h
1600 echo "include ../config-host.mak" >> $config_mak
1601 echo "#include \"../config-host.h\"" >> $config_h
1603 bflt="no"
1604 elfload32="no"
1605 target_nptl="no"
1606 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1607 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1608 gdb_xml_files=""
1610 disable_cpu_emulation() {
1611 if test $cpu_emulation = "no"; then
1612 echo "#define NO_CPU_EMULATION 1" >> $config_h
1613 echo "NO_CPU_EMULATION=1" >> $config_mak
1617 configure_kvm() {
1618 if test $kvm = "yes" -a "$target_softmmu" = "yes" -a \
1619 \( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \); then
1620 echo "#define USE_KVM 1" >> $config_h
1621 echo "USE_KVM=1" >> $config_mak
1622 echo "CONFIG_KVM_KERNEL_INC=$kerneldir/include" >> $config_mak
1623 if test $kvm_cap_pit = "yes" ; then
1624 echo "USE_KVM_PIT=1" >> $config_mak
1625 echo "#define USE_KVM_PIT 1" >> $config_h
1627 if test $kvm_cap_device_assignment = "yes" ; then
1628 echo "USE_KVM_DEVICE_ASSIGNMENT=1" >> $config_mak
1629 echo "#define USE_KVM_DEVICE_ASSIGNMENT 1" >> $config_h
1631 disable_cpu_emulation
1635 if [ use_upstream_kvm = yes ]; then
1637 # Make sure the target and host cpus are compatible
1638 if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
1639 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1640 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
1641 kvm="no"
1643 # Disable KVM for linux-user
1644 if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1645 kvm="no"
1650 case "$target_cpu" in
1651 i386)
1652 echo "TARGET_ARCH=i386" >> $config_mak
1653 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1654 echo "#define TARGET_I386 1" >> $config_h
1655 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
1656 then
1657 echo "#define USE_KQEMU 1" >> $config_h
1659 if test "$kvm" = "yes" ; then
1660 echo "CONFIG_KVM=yes" >> $config_mak
1661 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1662 echo "#define CONFIG_KVM 1" >> $config_h
1664 gcc3minver=`$cc --version 2> /dev/null| fgrep "(GCC) 3." | awk '{ print $3 }' | cut -f2 -d.`
1665 if test -n "$gcc3minver" && test $gcc3minver -gt 3
1666 then
1667 echo "HAVE_GT_GCC_3_3=true" >> $config_mak
1668 else
1669 echo "HAVE_GT_GCC_3_3=false" >> $config_mak
1671 configure_kvm
1673 x86_64)
1674 echo "TARGET_ARCH=x86_64" >> $config_mak
1675 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1676 echo "#define TARGET_I386 1" >> $config_h
1677 echo "#define TARGET_X86_64 1" >> $config_h
1678 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1679 then
1680 echo "#define USE_KQEMU 1" >> $config_h
1682 configure_kvm
1684 ia64)
1685 echo "TARGET_ARCH=ia64" >> $config_mak
1686 echo "#define TARGET_ARCH \"ia64\"" >> $config_h
1687 echo "#define TARGET_IA64 1" >> $config_h
1688 configure_kvm
1689 if [ use_upstream_kvm = yes ]; then
1690 if test "$kvm" = "yes" ; then
1691 echo "CONFIG_KVM=yes" >> $config_mak
1692 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1693 echo "#define CONFIG_KVM 1" >> $config_h
1697 alpha)
1698 echo "TARGET_ARCH=alpha" >> $config_mak
1699 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1700 echo "#define TARGET_ALPHA 1" >> $config_h
1702 arm|armeb)
1703 echo "TARGET_ARCH=arm" >> $config_mak
1704 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1705 echo "#define TARGET_ARM 1" >> $config_h
1706 bflt="yes"
1707 target_nptl="yes"
1708 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
1710 cris)
1711 echo "TARGET_ARCH=cris" >> $config_mak
1712 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1713 echo "#define TARGET_CRIS 1" >> $config_h
1715 m68k)
1716 echo "TARGET_ARCH=m68k" >> $config_mak
1717 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1718 echo "#define TARGET_M68K 1" >> $config_h
1719 bflt="yes"
1720 gdb_xml_files="cf-core.xml cf-fp.xml"
1722 mips|mipsel)
1723 echo "TARGET_ARCH=mips" >> $config_mak
1724 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1725 echo "#define TARGET_MIPS 1" >> $config_h
1726 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1728 mipsn32|mipsn32el)
1729 echo "TARGET_ARCH=mipsn32" >> $config_mak
1730 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1731 echo "#define TARGET_MIPS 1" >> $config_h
1732 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1734 mips64|mips64el)
1735 echo "TARGET_ARCH=mips64" >> $config_mak
1736 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1737 echo "#define TARGET_MIPS 1" >> $config_h
1738 echo "#define TARGET_MIPS64 1" >> $config_h
1739 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1741 ppc)
1742 echo "TARGET_ARCH=ppc" >> $config_mak
1743 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1744 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1745 echo "#define TARGET_PPC 1" >> $config_h
1746 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1748 ppcemb)
1749 echo "TARGET_ARCH=ppcemb" >> $config_mak
1750 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1751 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1752 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1753 echo "#define TARGET_PPC 1" >> $config_h
1754 echo "#define TARGET_PPCEMB 1" >> $config_h
1755 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1756 if test "$device_tree_support" = "yes" ; then
1757 echo "#define CONFIG_LIBFDT 1" >> $config_h
1758 echo "CONFIG_LIBFDT=1" >> $config_mak
1760 configure_kvm
1762 ppc64)
1763 echo "TARGET_ARCH=ppc64" >> $config_mak
1764 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1765 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1766 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1767 echo "#define TARGET_PPC 1" >> $config_h
1768 echo "#define TARGET_PPC64 1" >> $config_h
1769 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1771 ppc64abi32)
1772 echo "TARGET_ARCH=ppc64" >> $config_mak
1773 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1774 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1775 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1776 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1777 echo "#define TARGET_PPC 1" >> $config_h
1778 echo "#define TARGET_PPC64 1" >> $config_h
1779 echo "#define TARGET_ABI32 1" >> $config_h
1780 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1782 sh4|sh4eb)
1783 echo "TARGET_ARCH=sh4" >> $config_mak
1784 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1785 echo "#define TARGET_SH4 1" >> $config_h
1786 bflt="yes"
1787 target_nptl="yes"
1789 sparc)
1790 echo "TARGET_ARCH=sparc" >> $config_mak
1791 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1792 echo "#define TARGET_SPARC 1" >> $config_h
1794 sparc64)
1795 echo "TARGET_ARCH=sparc64" >> $config_mak
1796 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1797 echo "#define TARGET_SPARC 1" >> $config_h
1798 echo "#define TARGET_SPARC64 1" >> $config_h
1799 elfload32="yes"
1801 sparc32plus)
1802 echo "TARGET_ARCH=sparc64" >> $config_mak
1803 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1804 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1805 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1806 echo "#define TARGET_SPARC 1" >> $config_h
1807 echo "#define TARGET_SPARC64 1" >> $config_h
1808 echo "#define TARGET_ABI32 1" >> $config_h
1811 echo "Unsupported target CPU"
1812 exit 1
1814 esac
1815 if test "$target_bigendian" = "yes" ; then
1816 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1817 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1819 if test "$target_softmmu" = "yes" ; then
1820 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1821 echo "#define CONFIG_SOFTMMU 1" >> $config_h
1823 if test "$target_user_only" = "yes" ; then
1824 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1825 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1827 if test "$target_linux_user" = "yes" ; then
1828 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1829 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1831 if test "$target_darwin_user" = "yes" ; then
1832 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1833 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1835 list=""
1836 if test ! -z "$gdb_xml_files" ; then
1837 for x in $gdb_xml_files; do
1838 list="$list $source_path/gdb-xml/$x"
1839 done
1841 echo "TARGET_XML_FILES=$list" >> $config_mak
1843 if test "$target_cpu" = "arm" \
1844 -o "$target_cpu" = "armeb" \
1845 -o "$target_cpu" = "m68k" \
1846 -o "$target_cpu" = "mips" \
1847 -o "$target_cpu" = "mipsel" \
1848 -o "$target_cpu" = "mipsn32" \
1849 -o "$target_cpu" = "mipsn32el" \
1850 -o "$target_cpu" = "mips64" \
1851 -o "$target_cpu" = "mips64el" \
1852 -o "$target_cpu" = "sparc" \
1853 -o "$target_cpu" = "sparc64" \
1854 -o "$target_cpu" = "sparc32plus"; then
1855 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1856 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1858 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1859 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1860 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1862 if test "$target_user_only" = "yes" \
1863 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1864 echo "#define USE_NPTL 1" >> $config_h
1866 # 32 bit ELF loader in addition to native 64 bit loader?
1867 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1868 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1869 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1871 if test "$target_bsd_user" = "yes" ; then
1872 echo "CONFIG_BSD_USER=yes" >> $config_mak
1873 echo "#define CONFIG_BSD_USER 1" >> $config_h
1876 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1878 done # for target in $targets
1880 # build tree in object directory if source path is different from current one
1881 if test "$source_path_used" = "yes" ; then
1882 DIRS="tests tests/cris slirp audio"
1883 FILES="Makefile tests/Makefile"
1884 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
1885 FILES="$FILES tests/test-mmap.c"
1886 for dir in $DIRS ; do
1887 mkdir -p $dir
1888 done
1889 # remove the link and recreate it, as not all "ln -sf" overwrite the link
1890 for f in $FILES ; do
1891 rm -f $f
1892 ln -s $source_path/$f $f
1893 done