kvm: external module: test for EXT_CONFIG_KVM_TRACE instead of CONFIG_KVM_TRACE
[qemu-kvm/fedora.git] / configure
blob922a15636bde05db602a594fd2488b5c56a632f9
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"
20 # default parameters
21 prefix=""
22 interp_prefix="/usr/gnemul/qemu-%M"
23 static="no"
24 cross_prefix=""
25 cc="gcc"
26 gcc3_search="yes"
27 gcc3_list="gcc-3.4.6 gcc-3.4 gcc34 gcc-3.3.6 gcc-3.3 gcc33 gcc-3.2 gcc32"
28 audio_drv_list=""
29 audio_card_list=""
30 host_cc="gcc"
31 ar="ar"
32 make="make"
33 install="install"
34 strip="strip"
35 cpu=`uname -m`
36 target_list=""
37 case "$cpu" in
38 i386|i486|i586|i686|i86pc|BePC)
39 cpu="i386"
41 x86_64|amd64)
42 cpu="x86_64"
44 alpha)
45 cpu="alpha"
47 armv*b)
48 cpu="armv4b"
50 armv*l)
51 cpu="armv4l"
53 cris)
54 cpu="cris"
56 parisc|parisc64)
57 cpu="hppa"
59 ia64)
60 cpu="ia64"
62 m68k)
63 cpu="m68k"
65 mips)
66 cpu="mips"
68 mips64)
69 cpu="mips64"
71 "Power Macintosh"|ppc|ppc64)
72 cpu="powerpc"
74 s390*)
75 cpu="s390"
77 sparc|sun4[cdmuv])
78 cpu="sparc"
80 sparc64)
81 cpu="sparc64"
84 cpu="unknown"
86 esac
87 gprof="no"
88 sparse="no"
89 bigendian="no"
90 mingw32="no"
91 EXESUF=""
92 gdbstub="yes"
93 slirp="yes"
94 vde="yes"
95 fmod_lib=""
96 fmod_inc=""
97 oss_lib=""
98 vnc_tls="yes"
99 bsd="no"
100 linux="no"
101 kqemu="no"
102 kvm="no"
103 kvm_cap_pit="no"
104 profiler="no"
105 kernel_path=""
106 cocoa="no"
107 check_gfx="yes"
108 check_gcc="yes"
109 softmmu="yes"
110 linux_user="no"
111 darwin_user="no"
112 build_docs="no"
113 uname_release=""
114 curses="yes"
115 aio="yes"
116 nptl="yes"
117 mixemu="no"
118 bluez="yes"
119 signalfd="no"
120 eventfd="no"
121 cpu_emulation="yes"
122 device_tree_support=""
124 # OS specific
125 targetos=`uname -s`
126 case $targetos in
127 CYGWIN*)
128 mingw32="yes"
129 OS_CFLAGS="-mno-cygwin"
130 if [ "$cpu" = "i386" ] ; then
131 kqemu="yes"
133 audio_possible_drivers="sdl"
135 MINGW32*)
136 mingw32="yes"
137 if [ "$cpu" = "i386" ] ; then
138 kqemu="yes"
140 audio_possible_drivers="dsound sdl fmod"
142 GNU/kFreeBSD)
143 audio_drv_list="oss"
144 audio_possible_drivers="oss sdl esd pa"
145 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
146 kqemu="yes"
149 FreeBSD)
150 bsd="yes"
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"
155 kvm="yes"
158 NetBSD)
159 bsd="yes"
160 audio_drv_list="oss"
161 audio_possible_drivers="oss sdl esd"
163 OpenBSD)
164 bsd="yes"
165 openbsd="yes"
166 audio_drv_list="oss"
167 audio_possible_drivers="oss sdl esd"
168 oss_lib="-lossaudio"
170 Darwin)
171 bsd="yes"
172 darwin="yes"
173 darwin_user="yes"
174 cocoa="yes"
175 audio_drv_list="coreaudio"
176 audio_possible_drivers="coreaudio sdl fmod"
177 OS_CFLAGS="-mdynamic-no-pic"
178 OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
180 SunOS)
181 solaris="yes"
182 make="gmake"
183 install="ginstall"
184 needs_libsunmath="no"
185 solarisrev=`uname -r | cut -f2 -d.`
186 # have to select again, because `uname -m` returns i86pc
187 # even on an x86_64 box.
188 solariscpu=`isainfo -k`
189 if test "${solariscpu}" = "amd64" ; then
190 cpu="x86_64"
192 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
193 if test "$solarisrev" -le 9 ; then
194 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
195 needs_libsunmath="yes"
196 else
197 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
198 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
199 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
200 echo "Studio 11 can be downloaded from www.sun.com."
201 exit 1
204 if test "$solarisrev" -ge 9 ; then
205 kqemu="yes"
208 if test -f /usr/include/sys/soundcard.h ; then
209 audio_drv_list="oss"
211 audio_possible_drivers="oss sdl"
214 audio_drv_list="oss"
215 audio_possible_drivers="oss alsa sdl esd pa"
216 linux="yes"
217 linux_user="yes"
218 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
219 kqemu="yes"
220 audio_possible_drivers="$audio_possible_drivers fmod"
221 kvm="yes"
223 if [ "$cpu" = "ia64" ] ; then
224 kvm="yes"
225 cpu_emulation="no"
226 gdbstub="no"
227 slirp="no"
229 if [ "$cpu" = "powerpc" ]; then
230 kvm="yes"
233 esac
235 if [ "$bsd" = "yes" ] ; then
236 if [ "$darwin" != "yes" ] ; then
237 make="gmake"
241 # find source path
242 source_path=`dirname "$0"`
243 source_path_used="no"
244 workdir=`pwd`
245 if [ -z "$source_path" ]; then
246 source_path=$workdir
247 else
248 source_path=`cd "$source_path"; pwd`
250 [ -f "$workdir/vl.c" ] || source_path_used="yes"
252 werror="no"
253 # generate compile errors on warnings for development builds
254 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
255 #werror="yes";
258 for opt do
259 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
260 case "$opt" in
261 --help|-h) show_help=yes
263 --prefix=*) prefix="$optarg"
265 --interp-prefix=*) interp_prefix="$optarg"
267 --source-path=*) source_path="$optarg"
268 source_path_used="yes"
270 --cross-prefix=*) cross_prefix="$optarg"
272 --cc=*) cc="$optarg"
273 gcc3_search="no"
275 --host-cc=*) host_cc="$optarg"
277 --make=*) make="$optarg"
279 --install=*) install="$optarg"
281 --extra-cflags=*) CFLAGS="$optarg"
283 --extra-ldflags=*) LDFLAGS="$optarg"
285 --cpu=*) cpu="$optarg"
287 --target-list=*) target_list="$optarg"
289 --enable-gprof) gprof="yes"
291 --static) static="yes"
293 --disable-sdl) sdl="no"
295 --fmod-lib=*) fmod_lib="$optarg"
297 --fmod-inc=*) fmod_inc="$optarg"
299 --oss-lib=*) oss_lib="$optarg"
301 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
303 --audio-drv-list=*) audio_drv_list="$optarg"
305 --enable-sparse) sparse="yes"
307 --disable-sparse) sparse="no"
309 --disable-vnc-tls) vnc_tls="no"
311 --disable-slirp) slirp="no"
313 --disable-vde) vde="no"
315 --disable-kqemu) kqemu="no"
317 --disable-kvm) kvm="no"
319 --disable-brlapi) brlapi="no"
321 --disable-bluez) bluez="no"
323 --enable-profiler) profiler="yes"
325 --kernel-path=*) kernel_path="$optarg"
327 --enable-cocoa)
328 cocoa="yes" ;
329 sdl="no" ;
330 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
332 --disable-gfx-check) check_gfx="no"
334 --disable-gcc-check) check_gcc="no"
336 --disable-system) softmmu="no"
338 --enable-system) softmmu="yes"
340 --disable-linux-user) linux_user="no"
342 --enable-linux-user) linux_user="yes"
344 --disable-darwin-user) darwin_user="no"
346 --enable-darwin-user) darwin_user="yes"
348 --enable-uname-release=*) uname_release="$optarg"
350 --sparc_cpu=*)
351 sparc_cpu="$optarg"
352 case $sparc_cpu in
353 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
354 target_cpu="sparc"; cpu="sparc" ;;
355 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
356 target_cpu="sparc"; cpu="sparc" ;;
357 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
358 target_cpu="sparc64"; cpu="sparc64" ;;
359 *) echo "undefined SPARC architecture. Exiting";exit 1;;
360 esac
362 --enable-werror) werror="yes"
364 --disable-werror) werror="no"
366 --disable-curses) curses="no"
368 --disable-nptl) nptl="no"
370 --enable-mixemu) mixemu="yes"
372 --disable-aio) aio="no"
374 --disable-cpu-emulation) cpu_emulation="no"
376 --disable-libfdt) device_tree_support="no"
378 *) echo "ERROR: unknown option $opt"; exit 1
380 esac
381 done
383 # default flags for all hosts
384 CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
385 CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings"
386 LDFLAGS="$LDFLAGS -g"
387 if test "$werror" = "yes" ; then
388 CFLAGS="$CFLAGS -Werror"
391 if ld --version 2>/dev/null | grep -q "GNU ld" ; then
392 LDFLAGS="$LDFLAGS -Wl,--warn-common"
396 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
397 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
399 case "$cpu" in
400 sparc) if test -z "$sparc_cpu" ; then
401 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
402 ARCH_LDFLAGS="-m32"
403 else
404 ARCH_CFLAGS="${SP_CFLAGS}"
405 ARCH_LDFLAGS="${SP_LDFLAGS}"
408 sparc64) if test -z "$sparc_cpu" ; then
409 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
410 ARCH_LDFLAGS="-m64"
411 else
412 ARCH_CFLAGS="${SP_CFLAGS}"
413 ARCH_LDFLAGS="${SP_LDFLAGS}"
416 s390)
417 ARCH_CFLAGS="-march=z900"
419 i386)
420 ARCH_CFLAGS="-m32"
421 ARCH_LDFLAGS="-m32"
423 x86_64)
424 ARCH_CFLAGS="-m64"
425 ARCH_LDFLAGS="-m64"
427 esac
429 if test x"$show_help" = x"yes" ; then
430 cat << EOF
432 Usage: configure [options]
433 Options: [defaults in brackets after descriptions]
436 echo "Standard options:"
437 echo " --help print this message"
438 echo " --prefix=PREFIX install in PREFIX [$prefix]"
439 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
440 echo " use %M for cpu name [$interp_prefix]"
441 echo " --target-list=LIST set target list [$target_list]"
442 echo ""
443 echo "kqemu kernel acceleration support:"
444 echo " --disable-kqemu disable kqemu support"
445 echo " --kernel-path=PATH set the kernel path (configure probes it)"
446 echo " --disable-kvm disable kernel virtual machine support"
447 echo ""
448 echo "Advanced options (experts only):"
449 echo " --source-path=PATH path of source code [$source_path]"
450 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
451 echo " --cc=CC use C compiler CC [$cc]"
452 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
453 echo " --make=MAKE use specified make [$make]"
454 echo " --install=INSTALL use specified install [$install]"
455 echo " --static enable static build [$static]"
456 echo " --enable-sparse enable sparse checker"
457 echo " --disable-sparse disable sparse checker (default)"
458 echo " --disable-werror disable compilation abort on warning"
459 echo " --disable-sdl disable SDL"
460 echo " --enable-cocoa enable COCOA (Mac OS X only)"
461 echo " --audio-drv-list=LIST set audio drivers list:"
462 echo " Available drivers: $audio_possible_drivers"
463 echo " --audio-card-list=LIST set list of additional emulated audio cards"
464 echo " Available cards: ac97 adlib cs4231a gus"
465 echo " --enable-mixemu enable mixer emulation"
466 echo " --disable-brlapi disable BrlAPI"
467 echo " --disable-vnc-tls disable TLS encryption for VNC server"
468 echo " --disable-curses disable curses output"
469 echo " --disable-bluez disable bluez stack connectivity"
470 echo " --disable-nptl disable usermode NPTL support"
471 echo " --enable-system enable all system emulation targets"
472 echo " --disable-system disable all system emulation targets"
473 echo " --enable-linux-user enable all linux usermode emulation targets"
474 echo " --disable-linux-user disable all linux usermode emulation targets"
475 echo " --enable-darwin-user enable all darwin usermode emulation targets"
476 echo " --disable-darwin-user disable all darwin usermode emulation targets"
477 echo " --fmod-lib path to FMOD library"
478 echo " --fmod-inc path to FMOD includes"
479 echo " --oss-lib path to OSS library"
480 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
481 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
482 echo " --disable-vde disable support for vde network"
483 echo " --disable-aio disable AIO support"
484 echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
485 echo " --disable-libfdt disables use of libfdt support for device tree"
486 echo ""
487 echo "NOTE: The object files are built at the place where configure is launched"
488 exit 1
491 cc="${cross_prefix}${cc}"
492 ar="${cross_prefix}${ar}"
493 strip="${cross_prefix}${strip}"
495 # check that the C compiler works.
496 cat > $TMPC <<EOF
497 int main(void) {}
500 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then
501 : C compiler works ok
502 else
503 echo "ERROR: \"$cc\" either does not exist or does not work"
504 exit 1
507 # check compiler to see if we're on mingw32
508 cat > $TMPC <<EOF
509 #include <windows.h>
510 #ifndef _WIN32
511 #error not windows
512 #endif
513 int main(void) {}
516 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then
517 mingw32="yes"
520 if test "$mingw32" = "yes" ; then
521 linux="no"
522 EXESUF=".exe"
523 oss="no"
524 linux_user="no"
527 if [ "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
528 AIOLIBS=
529 elif [ "$bsd" = "yes" ]; then
530 AIOLIBS="-lpthread"
531 else
532 # Some Linux architectures (e.g. s390) don't imply -lpthread automatically.
533 AIOLIBS="-lrt -lpthread"
536 # Check for gcc4, error if pre-gcc4
537 if test "$check_gcc" = "yes" ; then
538 cat > $TMPC <<EOF
539 #if __GNUC__ < 4
540 #error gcc3
541 #endif
542 int main(){return 0;}
544 if "$cc" $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
545 echo "WARNING: \"$cc\" looks like gcc 4.x"
546 found_compat_cc="no"
547 if test "$gcc3_search" = "yes" ; then
548 echo "Looking for gcc 3.x"
549 for compat_cc in $gcc3_list ; do
550 if "$cross_prefix$compat_cc" --version 2> /dev/null | fgrep '(GCC) 3.' > /dev/null 2>&1 ; then
551 echo "Found \"$compat_cc\""
552 cc="$cross_prefix$compat_cc"
553 found_compat_cc="yes"
554 break
556 done
557 if test "$found_compat_cc" = "no" ; then
558 echo "gcc 3.x not found!"
561 if test "$found_compat_cc" = "no" ; then
562 echo "QEMU is known to have problems when compiled with gcc 4.x"
563 echo "It is recommended that you use gcc 3.x to build QEMU"
564 echo "To use this compiler anyway, configure with --disable-gcc-check"
565 exit 1;
570 if test ! -x "$(which cgcc 2>/dev/null)"; then
571 sparse="no"
575 # Solaris specific configure tool chain decisions
577 if test "$solaris" = "yes" ; then
579 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
580 # override the check with --disable-gcc-check
582 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
583 solgcc=`which $cc`
584 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
585 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
586 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
587 echo "or get the latest patch from SunSolve for gcc"
588 exit 1
591 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
592 if test -z "$solinst" ; then
593 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
594 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
595 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
596 exit 1
598 if test "$solinst" = "/usr/sbin/install" ; then
599 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
600 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
601 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
602 exit 1
604 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
605 if test -z "$sol_ar" ; then
606 echo "Error: No path includes ar"
607 if test -f /usr/ccs/bin/ar ; then
608 echo "Add /usr/ccs/bin to your path and rerun configure"
610 exit 1
615 if test -z "$target_list" ; then
616 # these targets are portable
617 if [ "$softmmu" = "yes" ] ; then
618 target_list="\
619 i386-softmmu \
620 x86_64-softmmu \
621 arm-softmmu \
622 cris-softmmu \
623 m68k-softmmu \
624 mips-softmmu \
625 mipsel-softmmu \
626 mips64-softmmu \
627 mips64el-softmmu \
628 ppc-softmmu \
629 ppcemb-softmmu \
630 ppc64-softmmu \
631 sh4-softmmu \
632 sh4eb-softmmu \
633 sparc-softmmu \
636 # the following are Linux specific
637 if [ "$linux_user" = "yes" ] ; then
638 target_list="${target_list}\
639 i386-linux-user \
640 x86_64-linux-user \
641 alpha-linux-user \
642 arm-linux-user \
643 armeb-linux-user \
644 cris-linux-user \
645 m68k-linux-user \
646 mips-linux-user \
647 mipsel-linux-user \
648 ppc-linux-user \
649 ppc64-linux-user \
650 ppc64abi32-linux-user \
651 sh4-linux-user \
652 sh4eb-linux-user \
653 sparc-linux-user \
654 sparc64-linux-user \
655 sparc32plus-linux-user \
658 # the following are Darwin specific
659 if [ "$darwin_user" = "yes" ] ; then
660 target_list="$target_list i386-darwin-user ppc-darwin-user"
662 else
663 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
665 if test -z "$target_list" ; then
666 echo "No targets enabled"
667 exit 1
670 if test -z "$cross_prefix" ; then
672 # ---
673 # big/little endian test
674 cat > $TMPC << EOF
675 #include <inttypes.h>
676 int main(int argc, char ** argv){
677 volatile uint32_t i=0x01234567;
678 return (*((uint8_t*)(&i))) == 0x67;
682 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
683 $TMPE && bigendian="yes"
684 else
685 echo big/little test failed
688 else
690 # if cross compiling, cannot launch a program, so make a static guess
691 if test "$cpu" = "armv4b" \
692 -o "$cpu" = "hppa" \
693 -o "$cpu" = "m68k" \
694 -o "$cpu" = "mips" \
695 -o "$cpu" = "mips64" \
696 -o "$cpu" = "powerpc" \
697 -o "$cpu" = "s390" \
698 -o "$cpu" = "sparc" \
699 -o "$cpu" = "sparc64"; then
700 bigendian="yes"
705 # host long bits test
706 hostlongbits="32"
707 if test "$cpu" = "x86_64" \
708 -o "$cpu" = "alpha" \
709 -o "$cpu" = "ia64" \
710 -o "$cpu" = "sparc64"; then
711 hostlongbits="64"
714 # ppc specific hostlongbits selection
715 if test "$cpu" = "powerpc" ; then
716 if $cc $ARCH_CFLAGS -dM -E - -o $TMPI 2>/dev/null </dev/null; then
717 grep -q __powerpc64__ $TMPI && hostlongbits=64
718 else
719 echo hostlongbits test failed
720 exit 1
724 # check gcc options support
725 cat > $TMPC <<EOF
726 int main(void) {
730 # Check host NPTL support
731 cat > $TMPC <<EOF
732 #include <sched.h>
733 #include <linux/futex.h>
734 void foo()
736 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
737 #error bork
738 #endif
742 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then
744 else
745 nptl="no"
748 ##########################################
749 # KVM probe
751 if test "$kvm" = "yes" ; then
752 cat > $TMPC <<EOF
753 #include <libkvm.h>
754 #ifndef KVM_CAP_PIT
755 #error "kvm no pit capability"
756 #endif
757 int main(void) { return 0; }
759 if $cc $ARCH_CFLAGS $CFLAGS -I"$kernel_path"/include -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev/null ; then
760 kvm_cap_pit="yes"
764 ##########################################
765 # zlib check
767 cat > $TMPC << EOF
768 #include <zlib.h>
769 int main(void) { zlibVersion(); return 0; }
771 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz 2> /dev/null ; then
773 else
774 echo
775 echo "Error: zlib check failed"
776 echo "Make sure to have the zlib libs and headers installed."
777 echo
778 exit 1
781 ##########################################
782 # SDL probe
784 sdl_too_old=no
786 if test -z "$sdl" ; then
787 sdl_config="sdl-config"
788 sdl=no
789 sdl_static=no
791 cat > $TMPC << EOF
792 #include <SDL.h>
793 #undef main /* We don't want SDL to override our main() */
794 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
796 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /tmp/qemu-$$-sdl-config.log ; then
797 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
798 if test "$_sdlversion" -lt 121 ; then
799 sdl_too_old=yes
800 else
801 if test "$cocoa" = "no" ; then
802 sdl=yes
806 # static link with sdl ?
807 if test "$sdl" = "yes" ; then
808 aa="no"
809 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
810 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
811 if [ "$aa" = "yes" ] ; then
812 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
815 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
816 sdl_static=yes
818 fi # static link
819 fi # sdl compile test
820 else
821 # Make sure to disable cocoa if sdl was set
822 if test "$sdl" = "yes" ; then
823 cocoa="no"
824 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
826 fi # -z $sdl
828 ##########################################
829 # VNC TLS detection
830 if test "$vnc_tls" = "yes" ; then
831 cat > $TMPC <<EOF
832 #include <gnutls/gnutls.h>
833 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
835 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
836 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
837 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
838 $vnc_tls_libs 2> /dev/null ; then
840 else
841 vnc_tls="no"
845 ##########################################
846 # vde libraries probe
847 if test "$vde" = "yes" ; then
848 cat > $TMPC << EOF
849 #include <libvdeplug.h>
850 int main(void)
852 struct vde_open_args a = {0, 0, 0};
853 vde_open("", "", &a);
854 return 0;
857 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug 2> /dev/null ; then
859 else
860 vde="no"
864 ##########################################
865 # Sound support libraries probe
867 audio_drv_probe()
869 drv=$1
870 hdr=$2
871 lib=$3
872 exp=$4
873 cfl=$5
874 cat > $TMPC << EOF
875 #include <$hdr>
876 int main(void) { $exp }
878 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib 2> /dev/null ; then
880 else
881 echo
882 echo "Error: $drv check failed"
883 echo "Make sure to have the $drv libs and headers installed."
884 echo
885 exit 1
889 audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
890 for drv in $audio_drv_list; do
891 case $drv in
892 alsa)
893 audio_drv_probe $drv alsa/asoundlib.h -lasound \
894 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
897 fmod)
898 if test -z $fmod_lib || test -z $fmod_inc; then
899 echo
900 echo "Error: You must specify path to FMOD library and headers"
901 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
902 echo
903 exit 1
905 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
908 esd)
909 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
913 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
914 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
917 oss|sdl|core|wav|dsound)
918 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
922 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
923 echo
924 echo "Error: Unknown driver '$drv' selected"
925 echo "Possible drivers are: $audio_possible_drivers"
926 echo
927 exit 1
930 esac
931 done
933 ##########################################
934 # BrlAPI probe
936 if test -z "$brlapi" ; then
937 brlapi=no
938 cat > $TMPC << EOF
939 #include <brlapi.h>
940 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
942 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi 2> /dev/null ; then
943 brlapi=yes
944 fi # brlapi compile test
945 fi # -z $brlapi
947 ##########################################
948 # curses probe
950 if test "$curses" = "yes" ; then
951 curses=no
952 cat > $TMPC << EOF
953 #include <curses.h>
954 int main(void) { return curses_version(); }
956 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses 2> /dev/null ; then
957 curses=yes
959 fi # test "$curses"
961 ##########################################
962 # bluez support probe
963 if test "$bluez" = "yes" ; then
964 `pkg-config bluez` || bluez="no"
966 if test "$bluez" = "yes" ; then
967 cat > $TMPC << EOF
968 #include <bluetooth/bluetooth.h>
969 int main(void) { return bt_error(0); }
971 bluez_cflags=`pkg-config --cflags bluez`
972 bluez_libs=`pkg-config --libs bluez`
973 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
974 $bluez_libs 2> /dev/null ; then
976 else
977 bluez="no"
981 ##########################################
982 # AIO probe
983 if test "$aio" = "yes" ; then
984 aio=no
985 cat > $TMPC << EOF
986 #include <aio.h>
987 int main(void) { return aio_write(NULL); }
989 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
990 aio=yes
994 ##########################################
995 # signalfd probe
996 cat > $TMPC << EOF
997 #define _GNU_SOURCE
998 #include <unistd.h>
999 #include <sys/syscall.h>
1000 #include <signal.h>
1001 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
1004 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1005 signalfd=yes
1008 ##########################################
1009 # eventfd probe
1010 cat > $TMPC << EOF
1011 #define _GNU_SOURCE
1012 #include <unistd.h>
1013 #include <sys/syscall.h>
1014 int main(void) { return syscall(SYS_eventfd, 0); }
1017 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1018 eventfd=yes
1021 # Check if tools are available to build documentation.
1022 if [ -x "`which texi2html 2>/dev/null`" ] && \
1023 [ -x "`which pod2man 2>/dev/null`" ]; then
1024 build_docs="yes"
1027 if test "$mingw32" = "yes" ; then
1028 if test -z "$prefix" ; then
1029 prefix="/c/Program Files/Qemu"
1031 mansuffix=""
1032 datasuffix=""
1033 docsuffix=""
1034 binsuffix=""
1035 else
1036 if test -z "$prefix" ; then
1037 prefix="/usr/local"
1039 mansuffix="/share/man"
1040 datasuffix="/share/qemu"
1041 docsuffix="/share/doc/qemu"
1042 binsuffix="/bin"
1045 ######################################
1046 # libfdt probe
1048 if test -z "$device_tree_support" -a \
1049 "$cpu" = "powerpc"; then
1050 device_tree_support="no"
1051 cat > $TMPC << EOF
1052 #include <libfdt.h>
1053 /* XXX uncomment later when libfdt is built before this test */
1054 //int main(void) { void *fdt; return fdt_create(fdt, 1024); }
1055 int main (void) {return 0;}
1057 # XXX for now do not try to link to libfdt and just check for header */
1058 # if $cc $ARCH_CFLAGS $CFLAGS $LDFLAGS -o $TMPE $TMPC -lfdt 2> /dev/null ; then
1059 if $cc $ARCH_CFLAGS $CFLAGS $LDFLAGS -o $TMPE $TMPC 2> /dev/null; then
1060 device_tree_support="yes"
1061 else
1062 echo
1063 echo "Error: Could not find libfdt"
1064 echo "Make sure to have the libfdt libs and headers installed."
1065 echo
1066 exit 1
1070 echo "Install prefix $prefix"
1071 echo "BIOS directory $prefix$datasuffix"
1072 echo "binary directory $prefix$binsuffix"
1073 if test "$mingw32" = "no" ; then
1074 echo "Manual directory $prefix$mansuffix"
1075 echo "ELF interp prefix $interp_prefix"
1077 echo "Source path $source_path"
1078 echo "C compiler $cc"
1079 echo "Host C compiler $host_cc"
1080 echo "ARCH_CFLAGS $ARCH_CFLAGS"
1081 echo "make $make"
1082 echo "install $install"
1083 echo "host CPU $cpu"
1084 echo "host big endian $bigendian"
1085 echo "target list $target_list"
1086 echo "gprof enabled $gprof"
1087 echo "sparse enabled $sparse"
1088 echo "profiler $profiler"
1089 echo "static build $static"
1090 echo "-Werror enabled $werror"
1091 if test "$darwin" = "yes" ; then
1092 echo "Cocoa support $cocoa"
1094 echo "SDL support $sdl"
1095 if test "$sdl" != "no" ; then
1096 echo "SDL static link $sdl_static"
1098 echo "curses support $curses"
1099 echo "mingw32 support $mingw32"
1100 echo "Audio drivers $audio_drv_list"
1101 echo "Extra audio cards $audio_card_list"
1102 echo "Mixer emulation $mixemu"
1103 echo "VNC TLS support $vnc_tls"
1104 if test "$vnc_tls" = "yes" ; then
1105 echo " TLS CFLAGS $vnc_tls_cflags"
1106 echo " TLS LIBS $vnc_tls_libs"
1108 if test -n "$sparc_cpu"; then
1109 echo "Target Sparc Arch $sparc_cpu"
1111 echo "kqemu support $kqemu"
1112 echo "kvm support $kvm"
1113 echo "CPU emulation $cpu_emulation"
1114 if test $cpu = "powerpc"; then
1115 echo "libfdt support $device_tree_support"
1117 echo "brlapi support $brlapi"
1118 echo "Documentation $build_docs"
1119 [ ! -z "$uname_release" ] && \
1120 echo "uname -r $uname_release"
1121 echo "NPTL support $nptl"
1122 echo "vde support $vde"
1123 echo "AIO support $aio"
1125 if test $sdl_too_old = "yes"; then
1126 echo "-> Your SDL version is too old - please upgrade to have SDL support"
1128 if [ -s /tmp/qemu-$$-sdl-config.log ]; then
1129 echo "The error log from compiling the libSDL test is: "
1130 cat /tmp/qemu-$$-sdl-config.log
1132 rm -f /tmp/qemu-$$-sdl-config.log
1133 #if test "$sdl_static" = "no"; then
1134 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1136 config_mak="config-host.mak"
1137 config_h="config-host.h"
1139 #echo "Creating $config_mak and $config_h"
1141 test -f $config_h && mv $config_h ${config_h}~
1143 echo "# Automatically generated by configure - do not modify" > $config_mak
1144 echo "# Configured with: $0 $@" >> $config_mak
1145 echo "/* Automatically generated by configure - do not modify */" > $config_h
1147 echo "prefix=$prefix" >> $config_mak
1148 echo "bindir=\${prefix}$binsuffix" >> $config_mak
1149 echo "mandir=\${prefix}$mansuffix" >> $config_mak
1150 echo "datadir=\${prefix}$datasuffix" >> $config_mak
1151 echo "docdir=\${prefix}$docsuffix" >> $config_mak
1152 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
1153 echo "MAKE=$make" >> $config_mak
1154 echo "INSTALL=$install" >> $config_mak
1155 echo "CC=$cc" >> $config_mak
1156 echo "HOST_CC=$host_cc" >> $config_mak
1157 echo "AR=$ar" >> $config_mak
1158 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
1159 # XXX: only use CFLAGS and LDFLAGS ?
1160 # XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1161 # compilation of dyngen tool (useful for win32 build on Linux host)
1162 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
1163 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1164 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1165 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
1166 echo "CFLAGS=$CFLAGS" >> $config_mak
1167 echo "LDFLAGS=$LDFLAGS" >> $config_mak
1168 echo "EXESUF=$EXESUF" >> $config_mak
1169 echo "AIOLIBS=$AIOLIBS" >> $config_mak
1170 case "$cpu" in
1171 i386)
1172 echo "ARCH=i386" >> $config_mak
1173 echo "#define HOST_I386 1" >> $config_h
1175 x86_64)
1176 echo "ARCH=x86_64" >> $config_mak
1177 echo "#define HOST_X86_64 1" >> $config_h
1179 alpha)
1180 echo "ARCH=alpha" >> $config_mak
1181 echo "#define HOST_ALPHA 1" >> $config_h
1183 armv4b)
1184 echo "ARCH=arm" >> $config_mak
1185 echo "#define HOST_ARM 1" >> $config_h
1187 armv4l)
1188 echo "ARCH=arm" >> $config_mak
1189 echo "#define HOST_ARM 1" >> $config_h
1191 cris)
1192 echo "ARCH=cris" >> $config_mak
1193 echo "#define HOST_CRIS 1" >> $config_h
1195 hppa)
1196 echo "ARCH=hppa" >> $config_mak
1197 echo "#define HOST_HPPA 1" >> $config_h
1199 ia64)
1200 echo "ARCH=ia64" >> $config_mak
1201 echo "#define HOST_IA64 1" >> $config_h
1203 m68k)
1204 echo "ARCH=m68k" >> $config_mak
1205 echo "#define HOST_M68K 1" >> $config_h
1207 mips)
1208 echo "ARCH=mips" >> $config_mak
1209 echo "#define HOST_MIPS 1" >> $config_h
1211 mips64)
1212 echo "ARCH=mips64" >> $config_mak
1213 echo "#define HOST_MIPS64 1" >> $config_h
1215 powerpc)
1216 if test "$hostlongbits" = "32"; then
1217 echo "ARCH=ppc" >> $config_mak
1218 echo "#define HOST_PPC 1" >> $config_h
1219 else
1220 echo "ARCH=ppc64" >> $config_mak
1221 echo "#define HOST_PPC64 1" >> $config_h
1224 s390)
1225 echo "ARCH=s390" >> $config_mak
1226 echo "#define HOST_S390 1" >> $config_h
1228 sparc)
1229 echo "ARCH=sparc" >> $config_mak
1230 echo "#define HOST_SPARC 1" >> $config_h
1232 sparc64)
1233 echo "ARCH=sparc64" >> $config_mak
1234 echo "#define HOST_SPARC64 1" >> $config_h
1237 echo "Unsupported CPU = $cpu"
1238 exit 1
1240 esac
1241 if test "$sparse" = "yes" ; then
1242 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1243 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1244 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1246 if test "$bigendian" = "yes" ; then
1247 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1248 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1250 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
1251 if test "$mingw32" = "yes" ; then
1252 echo "CONFIG_WIN32=yes" >> $config_mak
1253 echo "#define CONFIG_WIN32 1" >> $config_h
1254 else
1255 cat > $TMPC << EOF
1256 #include <byteswap.h>
1257 int main(void) { return bswap_32(0); }
1259 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1260 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1264 if [ "$openbsd" = "yes" ] ; then
1265 echo "#define ENOTSUP 4096" >> $config_h
1268 if test "$darwin" = "yes" ; then
1269 echo "CONFIG_DARWIN=yes" >> $config_mak
1270 echo "#define CONFIG_DARWIN 1" >> $config_h
1272 if test "$solaris" = "yes" ; then
1273 echo "CONFIG_SOLARIS=yes" >> $config_mak
1274 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
1275 if test "$needs_libsunmath" = "yes" ; then
1276 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1277 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1280 if test -n "$sparc_cpu"; then
1281 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1282 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1284 if test "$gdbstub" = "yes" ; then
1285 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1286 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1288 if test "$gprof" = "yes" ; then
1289 echo "TARGET_GPROF=yes" >> $config_mak
1290 echo "#define HAVE_GPROF 1" >> $config_h
1292 if test "$static" = "yes" ; then
1293 echo "CONFIG_STATIC=yes" >> $config_mak
1294 echo "#define CONFIG_STATIC 1" >> $config_h
1296 if test $profiler = "yes" ; then
1297 echo "#define CONFIG_PROFILER 1" >> $config_h
1299 if test "$slirp" = "yes" ; then
1300 echo "CONFIG_SLIRP=yes" >> $config_mak
1301 echo "#define CONFIG_SLIRP 1" >> $config_h
1303 if test "$vde" = "yes" ; then
1304 echo "CONFIG_VDE=yes" >> $config_mak
1305 echo "#define CONFIG_VDE 1" >> $config_h
1306 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1308 for card in $audio_card_list; do
1309 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
1310 echo "$def=yes" >> $config_mak
1311 echo "#define $def 1" >> $config_h
1312 done
1313 echo "#define AUDIO_DRIVERS \\" >> $config_h
1314 for drv in $audio_drv_list; do
1315 echo " &${drv}_audio_driver, \\" >>$config_h
1316 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
1317 echo "$def=yes" >> $config_mak
1318 if test "$drv" = "fmod"; then
1319 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1320 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1321 elif test "$drv" = "oss"; then
1322 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
1324 done
1325 echo "" >>$config_h
1326 if test "$mixemu" = "yes" ; then
1327 echo "CONFIG_MIXEMU=yes" >> $config_mak
1328 echo "#define CONFIG_MIXEMU 1" >> $config_h
1330 if test "$vnc_tls" = "yes" ; then
1331 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1332 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1333 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1334 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1336 qemu_version=`head $source_path/VERSION`
1337 echo "VERSION=$qemu_version" >>$config_mak
1338 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1339 echo "#define KVM_VERSION \"kvm-devel\"" >> $config_h
1341 echo "SRC_PATH=$source_path" >> $config_mak
1342 if [ "$source_path_used" = "yes" ]; then
1343 echo "VPATH=$source_path" >> $config_mak
1345 echo "TARGET_DIRS=$target_list" >> $config_mak
1346 if [ "$build_docs" = "yes" ] ; then
1347 echo "BUILD_DOCS=yes" >> $config_mak
1349 if test "$static" = "yes"; then
1350 sdl1=$sdl_static
1351 else
1352 sdl1=$sdl
1354 if test "$sdl1" = "yes" ; then
1355 echo "#define CONFIG_SDL 1" >> $config_h
1356 echo "CONFIG_SDL=yes" >> $config_mak
1357 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1358 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1359 else
1360 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1362 if [ "${aa}" = "yes" ] ; then
1363 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1364 else
1365 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1368 if test "$cocoa" = "yes" ; then
1369 echo "#define CONFIG_COCOA 1" >> $config_h
1370 echo "CONFIG_COCOA=yes" >> $config_mak
1372 if test "$curses" = "yes" ; then
1373 echo "#define CONFIG_CURSES 1" >> $config_h
1374 echo "CONFIG_CURSES=yes" >> $config_mak
1375 echo "CURSES_LIBS=-lcurses" >> $config_mak
1377 if test "$brlapi" = "yes" ; then
1378 echo "CONFIG_BRLAPI=yes" >> $config_mak
1379 echo "#define CONFIG_BRLAPI 1" >> $config_h
1380 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1382 if test "$bluez" = "yes" ; then
1383 echo "CONFIG_BLUEZ=yes" >> $config_mak
1384 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1385 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1386 echo "#define CONFIG_BLUEZ 1" >> $config_h
1388 if test "$aio" = "yes" ; then
1389 echo "#define CONFIG_AIO 1" >> $config_h
1390 echo "CONFIG_AIO=yes" >> $config_mak
1392 if test "$signalfd" = "yes" ; then
1393 echo "#define CONFIG_signalfd 1" >> $config_h
1395 if test "$eventfd" = "yes" ; then
1396 echo "#define CONFIG_eventfd 1" >> $config_h
1399 # XXX: suppress that
1400 if [ "$bsd" = "yes" ] ; then
1401 echo "#define O_LARGEFILE 0" >> $config_h
1402 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1403 echo "#define _BSD 1" >> $config_h
1406 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1408 tools=
1409 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1410 tools="qemu-img\$(EXESUF) $tools"
1411 if [ "$linux" = "yes" ] ; then
1412 tools="qemu-nbd\$(EXESUF) $tools"
1415 echo "TOOLS=$tools" >> $config_mak
1417 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1419 for target in $target_list; do
1420 target_dir="$target"
1421 config_mak=$target_dir/config.mak
1422 config_h=$target_dir/config.h
1423 target_cpu=`echo $target | cut -d '-' -f 1`
1424 target_bigendian="no"
1425 [ "$target_cpu" = "armeb" ] && target_bigendian=yes
1426 [ "$target_cpu" = "m68k" ] && target_bigendian=yes
1427 [ "$target_cpu" = "mips" ] && target_bigendian=yes
1428 [ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1429 [ "$target_cpu" = "mips64" ] && target_bigendian=yes
1430 [ "$target_cpu" = "ppc" ] && target_bigendian=yes
1431 [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
1432 [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
1433 [ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
1434 [ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
1435 [ "$target_cpu" = "sparc" ] && target_bigendian=yes
1436 [ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1437 [ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
1438 target_softmmu="no"
1439 target_user_only="no"
1440 target_linux_user="no"
1441 target_darwin_user="no"
1442 case "$target" in
1443 ${target_cpu}-softmmu)
1444 target_softmmu="yes"
1446 ${target_cpu}-linux-user)
1447 target_user_only="yes"
1448 target_linux_user="yes"
1450 ${target_cpu}-darwin-user)
1451 target_user_only="yes"
1452 target_darwin_user="yes"
1455 echo "ERROR: Target '$target' not recognised"
1456 exit 1
1458 esac
1460 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1461 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1462 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1463 echo "To build QEMU without graphical output configure with --disable-gfx-check"
1464 echo "Note that this will disable all output from the virtual graphics card"
1465 echo "except through VNC or curses."
1466 exit 1;
1469 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1471 test -f $config_h && mv $config_h ${config_h}~
1473 mkdir -p $target_dir
1474 mkdir -p $target_dir/fpu
1475 mkdir -p $target_dir/tcg
1476 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then
1477 mkdir -p $target_dir/nwfpe
1481 # don't use ln -sf as not all "ln -sf" over write the file/link
1483 rm -f $target_dir/Makefile
1484 ln -s $source_path/Makefile.target $target_dir/Makefile
1487 echo "# Automatically generated by configure - do not modify" > $config_mak
1488 echo "/* Automatically generated by configure - do not modify */" > $config_h
1491 echo "include ../config-host.mak" >> $config_mak
1492 echo "#include \"../config-host.h\"" >> $config_h
1494 bflt="no"
1495 elfload32="no"
1496 target_nptl="no"
1497 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1498 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1499 gdb_xml_files=""
1501 disable_cpu_emulation() {
1502 if test $cpu_emulation = "no"; then
1503 echo "#define NO_CPU_EMULATION 1" >> $config_h
1504 echo "NO_CPU_EMULATION=1" >> $config_mak
1508 configure_kvm() {
1509 if test $kvm = "yes" -a "$target_softmmu" = "yes" -a \
1510 \( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \); then
1511 echo "#define USE_KVM 1" >> $config_h
1512 echo "USE_KVM=1" >> $config_mak
1513 echo "CONFIG_KVM_KERNEL_INC=$kernel_path/include" >> $config_mak
1514 if test $kvm_cap_pit = "yes" ; then
1515 echo "USE_KVM_PIT=1" >> $config_mak
1516 echo "#define USE_KVM_PIT 1" >> $config_h
1518 disable_cpu_emulation
1522 case "$target_cpu" in
1523 i386)
1524 echo "TARGET_ARCH=i386" >> $config_mak
1525 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1526 echo "#define TARGET_I386 1" >> $config_h
1527 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
1528 then
1529 echo "#define USE_KQEMU 1" >> $config_h
1531 gcc3minver=`$cc --version 2> /dev/null| fgrep "(GCC) 3." | awk '{ print $3 }' | cut -f2 -d.`
1532 if test -n "$gcc3minver" && test $gcc3minver -gt 3
1533 then
1534 echo "HAVE_GT_GCC_3_3=true" >> $config_mak
1535 else
1536 echo "HAVE_GT_GCC_3_3=false" >> $config_mak
1538 configure_kvm
1540 x86_64)
1541 echo "TARGET_ARCH=x86_64" >> $config_mak
1542 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1543 echo "#define TARGET_I386 1" >> $config_h
1544 echo "#define TARGET_X86_64 1" >> $config_h
1545 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1546 then
1547 echo "#define USE_KQEMU 1" >> $config_h
1549 configure_kvm
1551 ia64)
1552 echo "TARGET_ARCH=ia64" >> $config_mak
1553 echo "#define TARGET_ARCH \"ia64\"" >> $config_h
1554 echo "#define TARGET_IA64 1" >> $config_h
1555 configure_kvm
1557 alpha)
1558 echo "TARGET_ARCH=alpha" >> $config_mak
1559 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1560 echo "#define TARGET_ALPHA 1" >> $config_h
1562 arm|armeb)
1563 echo "TARGET_ARCH=arm" >> $config_mak
1564 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1565 echo "#define TARGET_ARM 1" >> $config_h
1566 bflt="yes"
1567 target_nptl="yes"
1568 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
1570 cris)
1571 echo "TARGET_ARCH=cris" >> $config_mak
1572 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1573 echo "#define TARGET_CRIS 1" >> $config_h
1575 m68k)
1576 echo "TARGET_ARCH=m68k" >> $config_mak
1577 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1578 echo "#define TARGET_M68K 1" >> $config_h
1579 bflt="yes"
1580 gdb_xml_files="cf-core.xml cf-fp.xml"
1582 mips|mipsel)
1583 echo "TARGET_ARCH=mips" >> $config_mak
1584 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1585 echo "#define TARGET_MIPS 1" >> $config_h
1586 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1588 mipsn32|mipsn32el)
1589 echo "TARGET_ARCH=mipsn32" >> $config_mak
1590 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1591 echo "#define TARGET_MIPS 1" >> $config_h
1592 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1594 mips64|mips64el)
1595 echo "TARGET_ARCH=mips64" >> $config_mak
1596 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1597 echo "#define TARGET_MIPS 1" >> $config_h
1598 echo "#define TARGET_MIPS64 1" >> $config_h
1599 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1601 ppc)
1602 echo "TARGET_ARCH=ppc" >> $config_mak
1603 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1604 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1605 echo "#define TARGET_PPC 1" >> $config_h
1606 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1608 ppcemb)
1609 echo "TARGET_ARCH=ppcemb" >> $config_mak
1610 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1611 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1612 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1613 echo "#define TARGET_PPC 1" >> $config_h
1614 echo "#define TARGET_PPCEMB 1" >> $config_h
1615 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1616 if test "$device_tree_support" = "yes" ; then
1617 echo "#define CONFIG_LIBFDT 1" >> $config_h
1618 echo "CONFIG_LIBFDT=1" >> $config_mak
1620 configure_kvm
1622 ppc64)
1623 echo "TARGET_ARCH=ppc64" >> $config_mak
1624 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1625 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1626 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1627 echo "#define TARGET_PPC 1" >> $config_h
1628 echo "#define TARGET_PPC64 1" >> $config_h
1629 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1631 ppc64abi32)
1632 echo "TARGET_ARCH=ppc64" >> $config_mak
1633 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1634 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1635 echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1636 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1637 echo "#define TARGET_PPC 1" >> $config_h
1638 echo "#define TARGET_PPC64 1" >> $config_h
1639 echo "#define TARGET_ABI32 1" >> $config_h
1640 echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1642 sh4|sh4eb)
1643 echo "TARGET_ARCH=sh4" >> $config_mak
1644 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1645 echo "#define TARGET_SH4 1" >> $config_h
1646 bflt="yes"
1647 target_nptl="yes"
1649 sparc)
1650 echo "TARGET_ARCH=sparc" >> $config_mak
1651 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1652 echo "#define TARGET_SPARC 1" >> $config_h
1654 sparc64)
1655 echo "TARGET_ARCH=sparc64" >> $config_mak
1656 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1657 echo "#define TARGET_SPARC 1" >> $config_h
1658 echo "#define TARGET_SPARC64 1" >> $config_h
1659 elfload32="yes"
1661 sparc32plus)
1662 echo "TARGET_ARCH=sparc64" >> $config_mak
1663 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1664 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1665 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1666 echo "#define TARGET_SPARC 1" >> $config_h
1667 echo "#define TARGET_SPARC64 1" >> $config_h
1668 echo "#define TARGET_ABI32 1" >> $config_h
1671 echo "Unsupported target CPU"
1672 exit 1
1674 esac
1675 if test "$target_bigendian" = "yes" ; then
1676 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1677 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1679 if test "$target_softmmu" = "yes" ; then
1680 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1681 echo "#define CONFIG_SOFTMMU 1" >> $config_h
1683 if test "$target_user_only" = "yes" ; then
1684 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1685 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1687 if test "$target_linux_user" = "yes" ; then
1688 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1689 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1691 if test "$target_darwin_user" = "yes" ; then
1692 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1693 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1695 list=""
1696 if test ! -z "$gdb_xml_files" ; then
1697 for x in $gdb_xml_files; do
1698 list="$list $source_path/gdb-xml/$x"
1699 done
1701 echo "TARGET_XML_FILES=$list" >> $config_mak
1703 if test "$target_cpu" = "arm" \
1704 -o "$target_cpu" = "armeb" \
1705 -o "$target_cpu" = "m68k" \
1706 -o "$target_cpu" = "mips" \
1707 -o "$target_cpu" = "mipsel" \
1708 -o "$target_cpu" = "mipsn32" \
1709 -o "$target_cpu" = "mipsn32el" \
1710 -o "$target_cpu" = "mips64" \
1711 -o "$target_cpu" = "mips64el" \
1712 -o "$target_cpu" = "sparc" \
1713 -o "$target_cpu" = "sparc64" \
1714 -o "$target_cpu" = "sparc32plus"; then
1715 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1716 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1718 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1719 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1720 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1722 if test "$target_user_only" = "yes" \
1723 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1724 echo "#define USE_NPTL 1" >> $config_h
1726 # 32 bit ELF loader in addition to native 64 bit loader?
1727 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1728 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1729 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1732 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1734 done # for target in $targets
1736 # build tree in object directory if source path is different from current one
1737 if test "$source_path_used" = "yes" ; then
1738 DIRS="tests tests/cris slirp audio"
1739 FILES="Makefile tests/Makefile"
1740 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
1741 FILES="$FILES tests/test-mmap.c"
1742 for dir in $DIRS ; do
1743 mkdir -p $dir
1744 done
1745 # remove the link and recreate it, as not all "ln -sf" overwrite the link
1746 for f in $FILES ; do
1747 rm -f $f
1748 ln -s $source_path/$f $f
1749 done
1752 rm -f $TMPO $TMPC $TMPE $TMPS $TMPI