kvm: testsuite: fix smptest.flat makefile rules
[qemu-kvm/fedora.git] / configure
blobd7dd106474e92ed16fecac7621ec43f68e843252
1 #!/bin/sh
3 # qemu configure script (c) 2003 Fabrice Bellard
5 # set temporary file name
6 if test ! -z "$TMPDIR" ; then
7 TMPDIR1="${TMPDIR}"
8 elif test ! -z "$TEMPDIR" ; then
9 TMPDIR1="${TEMPDIR}"
10 else
11 TMPDIR1="/tmp"
14 TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
15 TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
16 TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"
17 TMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
18 TMPI="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.i"
19 TMPSDLLOG="${TMPDIR1}/qemu-conf-sdl-$$-${RANDOM}.log"
21 trap "rm -f $TMPC $TMPO $TMPE $TMPS $TMPI $TMPSDLLOG; exit" 0 2 3 15
23 # default parameters
24 prefix=""
25 interp_prefix="/usr/gnemul/qemu-%M"
26 static="no"
27 cross_prefix=""
28 cc="gcc"
29 audio_drv_list=""
30 audio_card_list=""
31 host_cc="gcc"
32 ar="ar"
33 make="make"
34 install="install"
35 strip="strip"
36 cpu=`test $(uname -s) = AIX && uname -p || uname -m`
37 target_list=""
38 case "$cpu" in
39 i386|i486|i586|i686|i86pc|BePC)
40 cpu="i386"
42 x86_64|amd64)
43 cpu="x86_64"
45 alpha)
46 cpu="alpha"
48 armv*b)
49 cpu="armv4b"
51 armv*l)
52 cpu="armv4l"
54 cris)
55 cpu="cris"
57 parisc|parisc64)
58 cpu="hppa"
60 ia64)
61 cpu="ia64"
63 m68k)
64 cpu="m68k"
66 mips)
67 cpu="mips"
69 mips64)
70 cpu="mips64"
72 "Power Macintosh"|ppc|ppc64|powerpc)
73 cpu="powerpc"
75 s390*)
76 cpu="s390"
78 sparc|sun4[cdmuv])
79 cpu="sparc"
81 sparc64)
82 cpu="sparc64"
85 cpu="unknown"
87 esac
88 gprof="no"
89 sparse="no"
90 bigendian="no"
91 mingw32="no"
92 EXESUF=""
93 gdbstub="yes"
94 slirp="yes"
95 vde="yes"
96 fmod_lib=""
97 fmod_inc=""
98 oss_lib=""
99 vnc_tls="yes"
100 bsd="no"
101 linux="no"
102 solaris="no"
103 kqemu="no"
104 profiler="no"
105 cocoa="no"
106 check_gfx="yes"
107 softmmu="yes"
108 linux_user="no"
109 darwin_user="no"
110 bsd_user="no"
111 build_docs="no"
112 uname_release=""
113 curses="yes"
114 aio="yes"
115 nptl="yes"
116 mixemu="no"
117 bluez="yes"
118 kvm="yes"
119 kvm_cap_pit="no"
120 kvm_cap_device_assignment="no"
121 kerneldir=""
122 aix="no"
123 blobs="yes"
124 fdt="yes"
125 signalfd="no"
126 eventfd="no"
127 cpu_emulation="yes"
129 # OS specific
130 targetos=`uname -s`
131 case $targetos in
132 CYGWIN*)
133 mingw32="yes"
134 OS_CFLAGS="-mno-cygwin"
135 if [ "$cpu" = "i386" ] ; then
136 kqemu="yes"
138 audio_possible_drivers="sdl"
140 MINGW32*)
141 mingw32="yes"
142 if [ "$cpu" = "i386" ] ; then
143 kqemu="yes"
145 audio_possible_drivers="dsound sdl fmod"
147 GNU/kFreeBSD)
148 audio_drv_list="oss"
149 audio_possible_drivers="oss sdl esd pa"
150 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
151 kqemu="yes"
154 FreeBSD)
155 bsd="yes"
156 audio_drv_list="oss"
157 audio_possible_drivers="oss sdl esd pa"
158 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
159 kqemu="yes"
160 kvm="yes"
163 NetBSD)
164 bsd="yes"
165 audio_drv_list="oss"
166 audio_possible_drivers="oss sdl esd"
167 oss_lib="-lossaudio"
169 OpenBSD)
170 bsd="yes"
171 openbsd="yes"
172 audio_drv_list="oss"
173 audio_possible_drivers="oss sdl esd"
174 oss_lib="-lossaudio"
176 Darwin)
177 bsd="yes"
178 darwin="yes"
179 darwin_user="yes"
180 cocoa="yes"
181 audio_drv_list="coreaudio"
182 audio_possible_drivers="coreaudio sdl fmod"
183 OS_CFLAGS="-mdynamic-no-pic"
184 OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
186 SunOS)
187 solaris="yes"
188 make="gmake"
189 install="ginstall"
190 needs_libsunmath="no"
191 solarisrev=`uname -r | cut -f2 -d.`
192 # have to select again, because `uname -m` returns i86pc
193 # even on an x86_64 box.
194 solariscpu=`isainfo -k`
195 if test "${solariscpu}" = "amd64" ; then
196 cpu="x86_64"
198 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
199 if test "$solarisrev" -le 9 ; then
200 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
201 needs_libsunmath="yes"
202 else
203 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
204 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
205 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
206 echo "Studio 11 can be downloaded from www.sun.com."
207 exit 1
210 if test "$solarisrev" -ge 9 ; then
211 kqemu="yes"
214 if test -f /usr/include/sys/soundcard.h ; then
215 audio_drv_list="oss"
217 audio_possible_drivers="oss sdl"
219 AIX)
220 aix="yes"
221 make="gmake"
224 audio_drv_list="oss"
225 audio_possible_drivers="oss alsa sdl esd pa"
226 linux="yes"
227 linux_user="yes"
228 usb="linux"
229 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
230 kqemu="yes"
231 audio_possible_drivers="$audio_possible_drivers fmod"
232 kvm="yes"
234 if [ "$cpu" = "ia64" ] ; then
235 kvm="yes"
236 cpu_emulation="no"
237 gdbstub="no"
238 slirp="no"
240 if [ "$cpu" = "powerpc" ]; then
241 kvm="yes"
244 esac
246 if [ "$bsd" = "yes" ] ; then
247 if [ "$darwin" != "yes" ] ; then
248 make="gmake"
249 usb="bsd"
251 bsd_user="yes"
254 # find source path
255 source_path=`dirname "$0"`
256 source_path_used="no"
257 workdir=`pwd`
258 if [ -z "$source_path" ]; then
259 source_path=$workdir
260 else
261 source_path=`cd "$source_path"; pwd`
263 [ -f "$workdir/vl.c" ] || source_path_used="yes"
265 werror="no"
266 # generate compile errors on warnings for development builds
267 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
268 #werror="yes";
271 for opt do
272 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
273 case "$opt" in
274 --help|-h) show_help=yes
276 --prefix=*) prefix="$optarg"
278 --interp-prefix=*) interp_prefix="$optarg"
280 --source-path=*) source_path="$optarg"
281 source_path_used="yes"
283 --cross-prefix=*) cross_prefix="$optarg"
285 --cc=*) cc="$optarg"
287 --host-cc=*) host_cc="$optarg"
289 --make=*) make="$optarg"
291 --install=*) install="$optarg"
293 --extra-cflags=*) CFLAGS="$optarg"
295 --extra-ldflags=*) LDFLAGS="$optarg"
297 --cpu=*) cpu="$optarg"
299 --target-list=*) target_list="$optarg"
301 --enable-gprof) gprof="yes"
303 --static) static="yes"
305 --disable-sdl) sdl="no"
307 --fmod-lib=*) fmod_lib="$optarg"
309 --fmod-inc=*) fmod_inc="$optarg"
311 --oss-lib=*) oss_lib="$optarg"
313 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
315 --audio-drv-list=*) audio_drv_list="$optarg"
317 --enable-sparse) sparse="yes"
319 --disable-sparse) sparse="no"
321 --disable-vnc-tls) vnc_tls="no"
323 --disable-slirp) slirp="no"
325 --disable-vde) vde="no"
327 --disable-kqemu) kqemu="no"
329 --disable-brlapi) brlapi="no"
331 --disable-bluez) bluez="no"
333 --disable-kvm) kvm="no"
335 --enable-profiler) profiler="yes"
337 --enable-cocoa)
338 cocoa="yes" ;
339 sdl="no" ;
340 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
342 --disable-gfx-check) check_gfx="no"
344 --disable-system) softmmu="no"
346 --enable-system) softmmu="yes"
348 --disable-linux-user) linux_user="no"
350 --enable-linux-user) linux_user="yes"
352 --disable-darwin-user) darwin_user="no"
354 --enable-darwin-user) darwin_user="yes"
356 --disable-bsd-user) bsd_user="no"
358 --enable-bsd-user) bsd_user="yes"
360 --enable-uname-release=*) uname_release="$optarg"
362 --sparc_cpu=*)
363 sparc_cpu="$optarg"
364 case $sparc_cpu in
365 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
366 target_cpu="sparc"; cpu="sparc" ;;
367 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
368 target_cpu="sparc"; cpu="sparc" ;;
369 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
370 target_cpu="sparc64"; cpu="sparc64" ;;
371 *) echo "undefined SPARC architecture. Exiting";exit 1;;
372 esac
374 --enable-werror) werror="yes"
376 --disable-werror) werror="no"
378 --disable-curses) curses="no"
380 --disable-nptl) nptl="no"
382 --enable-mixemu) mixemu="yes"
384 --disable-aio) aio="no"
386 --disable-blobs) blobs="no"
388 --kerneldir=*) kerneldir="$optarg"
390 --disable-cpu-emulation) cpu_emulation="no"
392 *) echo "ERROR: unknown option $opt"; exit 1
394 esac
395 done
397 # default flags for all hosts
398 CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
399 CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
400 LDFLAGS="$LDFLAGS -g"
401 if test "$werror" = "yes" ; then
402 CFLAGS="$CFLAGS -Werror"
405 if test "$solaris" = "no" ; then
406 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
407 LDFLAGS="$LDFLAGS -Wl,--warn-common"
412 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
413 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
415 case "$cpu" in
416 sparc) if test -z "$sparc_cpu" ; then
417 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
418 ARCH_LDFLAGS="-m32"
419 else
420 ARCH_CFLAGS="${SP_CFLAGS}"
421 ARCH_LDFLAGS="${SP_LDFLAGS}"
424 sparc64) if test -z "$sparc_cpu" ; then
425 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
426 ARCH_LDFLAGS="-m64"
427 else
428 ARCH_CFLAGS="${SP_CFLAGS}"
429 ARCH_LDFLAGS="${SP_LDFLAGS}"
432 s390)
433 ARCH_CFLAGS="-march=z900"
435 i386)
436 ARCH_CFLAGS="-m32"
437 ARCH_LDFLAGS="-m32"
439 x86_64)
440 ARCH_CFLAGS="-m64"
441 ARCH_LDFLAGS="-m64"
443 esac
445 if test x"$show_help" = x"yes" ; then
446 cat << EOF
448 Usage: configure [options]
449 Options: [defaults in brackets after descriptions]
452 echo "Standard options:"
453 echo " --help print this message"
454 echo " --prefix=PREFIX install in PREFIX [$prefix]"
455 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
456 echo " use %M for cpu name [$interp_prefix]"
457 echo " --target-list=LIST set target list [$target_list]"
458 echo ""
459 echo "kqemu kernel acceleration support:"
460 echo " --disable-kqemu disable kqemu support"
461 echo ""
462 echo "Advanced options (experts only):"
463 echo " --source-path=PATH path of source code [$source_path]"
464 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
465 echo " --cc=CC use C compiler CC [$cc]"
466 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
467 echo " --make=MAKE use specified make [$make]"
468 echo " --install=INSTALL use specified install [$install]"
469 echo " --static enable static build [$static]"
470 echo " --enable-sparse enable sparse checker"
471 echo " --disable-sparse disable sparse checker (default)"
472 echo " --disable-werror disable compilation abort on warning"
473 echo " --disable-sdl disable SDL"
474 echo " --enable-cocoa enable COCOA (Mac OS X only)"
475 echo " --audio-drv-list=LIST set audio drivers list:"
476 echo " Available drivers: $audio_possible_drivers"
477 echo " --audio-card-list=LIST set list of additional emulated audio cards"
478 echo " Available cards: ac97 adlib cs4231a gus"
479 echo " --enable-mixemu enable mixer emulation"
480 echo " --disable-brlapi disable BrlAPI"
481 echo " --disable-vnc-tls disable TLS encryption for VNC server"
482 echo " --disable-curses disable curses output"
483 echo " --disable-bluez disable bluez stack connectivity"
484 echo " --disable-kvm disable KVM acceleration support"
485 echo " --disable-nptl disable usermode NPTL support"
486 echo " --enable-system enable all system emulation targets"
487 echo " --disable-system disable all system emulation targets"
488 echo " --enable-linux-user enable all linux usermode emulation targets"
489 echo " --disable-linux-user disable all linux usermode emulation targets"
490 echo " --enable-darwin-user enable all darwin usermode emulation targets"
491 echo " --disable-darwin-user disable all darwin usermode emulation targets"
492 echo " --enable-bsd-user enable all BSD usermode emulation targets"
493 echo " --disable-bsd-user disable all BSD usermode emulation targets"
494 echo " --fmod-lib path to FMOD library"
495 echo " --fmod-inc path to FMOD includes"
496 echo " --oss-lib path to OSS library"
497 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
498 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
499 echo " --disable-vde disable support for vde network"
500 echo " --disable-aio disable AIO support"
501 echo " --disable-blobs disable installing provided firmware blobs"
502 echo " --kerneldir=PATH look for kernel includes in PATH"
503 echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
504 echo ""
505 echo "NOTE: The object files are built at the place where configure is launched"
506 exit 1
509 cc="${cross_prefix}${cc}"
510 ar="${cross_prefix}${ar}"
511 strip="${cross_prefix}${strip}"
513 # check that the C compiler works.
514 cat > $TMPC <<EOF
515 int main(void) {}
518 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
519 : C compiler works ok
520 else
521 echo "ERROR: \"$cc\" either does not exist or does not work"
522 exit 1
525 # check compiler to see if we're on mingw32
526 cat > $TMPC <<EOF
527 #include <windows.h>
528 #ifndef _WIN32
529 #error not windows
530 #endif
531 int main(void) {}
534 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
535 mingw32="yes"
538 if test "$mingw32" = "yes" ; then
539 linux="no"
540 EXESUF=".exe"
541 oss="no"
542 linux_user="no"
543 bsd_user="no"
546 if test ! -x "$(which cgcc 2>/dev/null)"; then
547 sparse="no"
551 # Solaris specific configure tool chain decisions
553 if test "$solaris" = "yes" ; then
554 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
555 if test -z "$solinst" ; then
556 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
557 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
558 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
559 exit 1
561 if test "$solinst" = "/usr/sbin/install" ; then
562 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
563 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
564 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
565 exit 1
567 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
568 if test -z "$sol_ar" ; then
569 echo "Error: No path includes ar"
570 if test -f /usr/ccs/bin/ar ; then
571 echo "Add /usr/ccs/bin to your path and rerun configure"
573 exit 1
578 if test -z "$target_list" ; then
579 # these targets are portable
580 if [ "$softmmu" = "yes" ] ; then
581 target_list="\
582 i386-softmmu \
583 x86_64-softmmu \
584 arm-softmmu \
585 cris-softmmu \
586 m68k-softmmu \
587 mips-softmmu \
588 mipsel-softmmu \
589 mips64-softmmu \
590 mips64el-softmmu \
591 ppc-softmmu \
592 ppcemb-softmmu \
593 ppc64-softmmu \
594 sh4-softmmu \
595 sh4eb-softmmu \
596 sparc-softmmu \
599 # the following are Linux specific
600 if [ "$linux_user" = "yes" ] ; then
601 target_list="${target_list}\
602 i386-linux-user \
603 x86_64-linux-user \
604 alpha-linux-user \
605 arm-linux-user \
606 armeb-linux-user \
607 cris-linux-user \
608 m68k-linux-user \
609 mips-linux-user \
610 mipsel-linux-user \
611 ppc-linux-user \
612 ppc64-linux-user \
613 ppc64abi32-linux-user \
614 sh4-linux-user \
615 sh4eb-linux-user \
616 sparc-linux-user \
617 sparc64-linux-user \
618 sparc32plus-linux-user \
621 # the following are Darwin specific
622 if [ "$darwin_user" = "yes" ] ; then
623 target_list="$target_list i386-darwin-user ppc-darwin-user"
625 # the following are BSD specific
626 if [ "$bsd_user" = "yes" ] ; then
627 target_list="${target_list}\
628 sparc64-bsd-user \
631 else
632 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
634 if test -z "$target_list" ; then
635 echo "No targets enabled"
636 exit 1
639 if test -z "$cross_prefix" ; then
641 # ---
642 # big/little endian test
643 cat > $TMPC << EOF
644 #include <inttypes.h>
645 int main(int argc, char ** argv){
646 volatile uint32_t i=0x01234567;
647 return (*((uint8_t*)(&i))) == 0x67;
651 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
652 $TMPE && bigendian="yes"
653 else
654 echo big/little test failed
657 else
659 # if cross compiling, cannot launch a program, so make a static guess
660 if test "$cpu" = "armv4b" \
661 -o "$cpu" = "hppa" \
662 -o "$cpu" = "m68k" \
663 -o "$cpu" = "mips" \
664 -o "$cpu" = "mips64" \
665 -o "$cpu" = "powerpc" \
666 -o "$cpu" = "s390" \
667 -o "$cpu" = "sparc" \
668 -o "$cpu" = "sparc64"; then
669 bigendian="yes"
674 # host long bits test
675 hostlongbits="32"
676 if test "$cpu" = "x86_64" \
677 -o "$cpu" = "alpha" \
678 -o "$cpu" = "ia64" \
679 -o "$cpu" = "sparc64"; then
680 hostlongbits="64"
683 # ppc specific hostlongbits selection
684 if test "$cpu" = "powerpc" ; then
685 if $cc $ARCH_CFLAGS -dM -E - -o $TMPI 2>/dev/null </dev/null; then
686 grep -q __powerpc64__ $TMPI && hostlongbits=64
687 else
688 echo hostlongbits test failed
689 exit 1
693 # check gcc options support
694 cat > $TMPC <<EOF
695 int main(void) {
699 # Check host NPTL support
700 cat > $TMPC <<EOF
701 #include <sched.h>
702 #include <linux/futex.h>
703 void foo()
705 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
706 #error bork
707 #endif
711 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
713 else
714 nptl="no"
717 ##########################################
718 # KVM probe
720 if test "$kvm" = "yes" ; then
722 # test for KVM_CAP_PIT
724 cat > $TMPC <<EOF
725 #include <libkvm.h>
726 #ifndef KVM_CAP_PIT
727 #error "kvm no pit capability"
728 #endif
729 int main(void) { return 0; }
731 if $cc $ARCH_CFLAGS $CFLAGS -I"$kerneldir"/include -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev/null ; then
732 kvm_cap_pit="yes"
735 # test for KVM_CAP_DEVICE_ASSIGNMENT
737 cat > $TMPC <<EOF
738 #include <libkvm.h>
739 #ifndef KVM_CAP_DEVICE_ASSIGNMENT
740 #error "kvm no device assignment capability"
741 #endif
742 int main(void) { return 0; }
744 if $cc $ARCH_CFLAGS $CFLAGS -I"$kerneldir"/include -o $TMPE ${OS_CFLAGS} $TMPC 2> /dev/null ; then
745 kvm_cap_device_assignment="yes"
749 ##########################################
750 # zlib check
752 cat > $TMPC << EOF
753 #include <zlib.h>
754 int main(void) { zlibVersion(); return 0; }
756 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
758 else
759 echo
760 echo "Error: zlib check failed"
761 echo "Make sure to have the zlib libs and headers installed."
762 echo
763 exit 1
766 ##########################################
767 # SDL probe
769 sdl_too_old=no
771 if test -z "$sdl" ; then
772 sdl_config="sdl-config"
773 sdl=no
774 sdl_static=no
776 cat > $TMPC << EOF
777 #include <SDL.h>
778 #undef main /* We don't want SDL to override our main() */
779 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
781 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` > $TMPSDLLOG 2>&1 ; then
782 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
783 if test "$_sdlversion" -lt 121 ; then
784 sdl_too_old=yes
785 else
786 if test "$cocoa" = "no" ; then
787 sdl=yes
791 # static link with sdl ?
792 if test "$sdl" = "yes" ; then
793 aa="no"
794 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
795 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
796 if [ "$aa" = "yes" ] ; then
797 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
800 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then
801 sdl_static=yes
803 fi # static link
804 fi # sdl compile test
805 else
806 # Make sure to disable cocoa if sdl was set
807 if test "$sdl" = "yes" ; then
808 cocoa="no"
809 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
811 fi # -z $sdl
813 ##########################################
814 # VNC TLS detection
815 if test "$vnc_tls" = "yes" ; then
816 cat > $TMPC <<EOF
817 #include <gnutls/gnutls.h>
818 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
820 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
821 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
822 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
823 $vnc_tls_libs > /dev/null 2> /dev/null ; then
825 else
826 vnc_tls="no"
830 ##########################################
831 # vde libraries probe
832 if test "$vde" = "yes" ; then
833 cat > $TMPC << EOF
834 #include <libvdeplug.h>
835 int main(void)
837 struct vde_open_args a = {0, 0, 0};
838 vde_open("", "", &a);
839 return 0;
842 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
844 else
845 vde="no"
849 ##########################################
850 # Sound support libraries probe
852 audio_drv_probe()
854 drv=$1
855 hdr=$2
856 lib=$3
857 exp=$4
858 cfl=$5
859 cat > $TMPC << EOF
860 #include <$hdr>
861 int main(void) { $exp }
863 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
865 else
866 echo
867 echo "Error: $drv check failed"
868 echo "Make sure to have the $drv libs and headers installed."
869 echo
870 exit 1
874 audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
875 for drv in $audio_drv_list; do
876 case $drv in
877 alsa)
878 audio_drv_probe $drv alsa/asoundlib.h -lasound \
879 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
882 fmod)
883 if test -z $fmod_lib || test -z $fmod_inc; then
884 echo
885 echo "Error: You must specify path to FMOD library and headers"
886 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
887 echo
888 exit 1
890 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
893 esd)
894 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
898 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
899 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
902 oss|sdl|core|wav|dsound)
903 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
907 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
908 echo
909 echo "Error: Unknown driver '$drv' selected"
910 echo "Possible drivers are: $audio_possible_drivers"
911 echo
912 exit 1
915 esac
916 done
918 ##########################################
919 # BrlAPI probe
921 if test -z "$brlapi" ; then
922 brlapi=no
923 cat > $TMPC << EOF
924 #include <brlapi.h>
925 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
927 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
928 brlapi=yes
929 fi # brlapi compile test
930 fi # -z $brlapi
932 ##########################################
933 # curses probe
935 if test "$curses" = "yes" ; then
936 curses=no
937 cat > $TMPC << EOF
938 #include <curses.h>
939 int main(void) { return curses_version(); }
941 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
942 curses=yes
944 fi # test "$curses"
946 ##########################################
947 # bluez support probe
948 if test "$bluez" = "yes" ; then
949 `pkg-config bluez` || bluez="no"
951 if test "$bluez" = "yes" ; then
952 cat > $TMPC << EOF
953 #include <bluetooth/bluetooth.h>
954 int main(void) { return bt_error(0); }
956 bluez_cflags=`pkg-config --cflags bluez`
957 bluez_libs=`pkg-config --libs bluez`
958 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
959 $bluez_libs > /dev/null 2> /dev/null ; then
961 else
962 bluez="no"
966 ##########################################
967 # kvm probe
968 if test "$kvm" = "yes" ; then
969 cat > $TMPC <<EOF
970 #include <linux/kvm.h>
971 #if !defined(KVM_API_VERSION) || \
972 KVM_API_VERSION < 12 || \
973 KVM_API_VERSION > 12 || \
974 !defined(KVM_CAP_USER_MEMORY) || \
975 !defined(KVM_CAP_SET_TSS_ADDR) || \
976 !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
977 #error Invalid KVM version
978 #endif
979 int main(void) { return 0; }
981 if test "$kerneldir" != "" ; then
982 kvm_cflags=-I"$kerneldir"/include
983 else
984 kvm_cflags=""
986 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
987 > /dev/null 2>/dev/null ; then
989 else
990 kvm="no"
994 ##########################################
995 # AIO probe
996 AIOLIBS=""
998 if test "$aio" = "yes" ; then
999 aio=no
1000 cat > $TMPC << EOF
1001 #include <pthread.h>
1002 int main(void) { pthread_mutex_t lock; return 0; }
1004 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
1005 aio=yes
1006 AIOLIBS="-lpthread"
1010 ##########################################
1011 # iovec probe
1012 cat > $TMPC <<EOF
1013 #include <sys/uio.h>
1014 int main(void) { struct iovec iov; return 0; }
1016 iovec=no
1017 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1018 iovec=yes
1021 ##########################################
1022 # fdt probe
1023 if test "$fdt" = "yes" ; then
1024 fdt=no
1025 cat > $TMPC << EOF
1026 int main(void) { return 0; }
1028 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null ; then
1029 fdt=yes
1033 ##########################################
1034 # signalfd probe
1035 cat > $TMPC << EOF
1036 #define _GNU_SOURCE
1037 #include <unistd.h>
1038 #include <sys/syscall.h>
1039 #include <signal.h>
1040 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
1043 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1044 signalfd=yes
1047 ##########################################
1048 # eventfd probe
1049 cat > $TMPC << EOF
1050 #define _GNU_SOURCE
1051 #include <unistd.h>
1052 #include <sys/syscall.h>
1053 int main(void) { return syscall(SYS_eventfd, 0); }
1056 if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1057 eventfd=yes
1060 # Check if tools are available to build documentation.
1061 if [ -x "`which texi2html 2>/dev/null`" ] && \
1062 [ -x "`which pod2man 2>/dev/null`" ]; then
1063 build_docs="yes"
1066 ##########################################
1067 # Do we need librt
1068 cat > $TMPC <<EOF
1069 #include <signal.h>
1070 #include <time.h>
1071 int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1074 rt=no
1075 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1077 elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
1078 rt=yes
1081 if test "$rt" = "yes" ; then
1082 # Hack, we should have a general purpose LIBS for this sort of thing
1083 AIOLIBS="$AIOLIBS -lrt"
1086 if test "$mingw32" = "yes" ; then
1087 if test -z "$prefix" ; then
1088 prefix="c:\\\\Program Files\\\\Qemu"
1090 mansuffix=""
1091 datasuffix=""
1092 docsuffix=""
1093 binsuffix=""
1094 else
1095 if test -z "$prefix" ; then
1096 prefix="/usr/local"
1098 mansuffix="/share/man"
1099 datasuffix="/share/qemu"
1100 docsuffix="/share/doc/qemu"
1101 binsuffix="/bin"
1104 echo "Install prefix $prefix"
1105 echo "BIOS directory $prefix$datasuffix"
1106 echo "binary directory $prefix$binsuffix"
1107 if test "$mingw32" = "no" ; then
1108 echo "Manual directory $prefix$mansuffix"
1109 echo "ELF interp prefix $interp_prefix"
1111 echo "Source path $source_path"
1112 echo "C compiler $cc"
1113 echo "Host C compiler $host_cc"
1114 echo "ARCH_CFLAGS $ARCH_CFLAGS"
1115 echo "make $make"
1116 echo "install $install"
1117 echo "host CPU $cpu"
1118 echo "host big endian $bigendian"
1119 echo "target list $target_list"
1120 echo "gprof enabled $gprof"
1121 echo "sparse enabled $sparse"
1122 echo "profiler $profiler"
1123 echo "static build $static"
1124 echo "-Werror enabled $werror"
1125 if test "$darwin" = "yes" ; then
1126 echo "Cocoa support $cocoa"
1128 echo "SDL support $sdl"
1129 if test "$sdl" != "no" ; then
1130 echo "SDL static link $sdl_static"
1132 echo "curses support $curses"
1133 echo "mingw32 support $mingw32"
1134 echo "Audio drivers $audio_drv_list"
1135 echo "Extra audio cards $audio_card_list"
1136 echo "Mixer emulation $mixemu"
1137 echo "VNC TLS support $vnc_tls"
1138 if test "$vnc_tls" = "yes" ; then
1139 echo " TLS CFLAGS $vnc_tls_cflags"
1140 echo " TLS LIBS $vnc_tls_libs"
1142 if test -n "$sparc_cpu"; then
1143 echo "Target Sparc Arch $sparc_cpu"
1145 echo "kqemu support $kqemu"
1146 echo "kvm support $kvm"
1147 echo "CPU emulation $cpu_emulation"
1148 echo "brlapi support $brlapi"
1149 echo "Documentation $build_docs"
1150 [ ! -z "$uname_release" ] && \
1151 echo "uname -r $uname_release"
1152 echo "NPTL support $nptl"
1153 echo "vde support $vde"
1154 echo "AIO support $aio"
1155 echo "Install blobs $blobs"
1156 echo "KVM support $kvm"
1157 echo "fdt support $fdt"
1159 if test $sdl_too_old = "yes"; then
1160 echo "-> Your SDL version is too old - please upgrade to have SDL support"
1162 if [ -s $TMPSDLLOG ]; then
1163 echo "The error log from compiling the libSDL test is: "
1164 cat $TMPSDLLOG
1166 #if test "$sdl_static" = "no"; then
1167 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1169 config_mak="config-host.mak"
1170 config_h="config-host.h"
1172 #echo "Creating $config_mak and $config_h"
1174 test -f $config_h && mv $config_h ${config_h}~
1176 echo "# Automatically generated by configure - do not modify" > $config_mak
1177 printf "# Configured with:" >> $config_mak
1178 printf " '%s'" "$0" "$@" >> $config_mak
1179 echo >> $config_mak
1180 echo "/* Automatically generated by configure - do not modify */" > $config_h
1182 echo "prefix=$prefix" >> $config_mak
1183 echo "bindir=\${prefix}$binsuffix" >> $config_mak
1184 echo "mandir=\${prefix}$mansuffix" >> $config_mak
1185 echo "datadir=\${prefix}$datasuffix" >> $config_mak
1186 echo "docdir=\${prefix}$docsuffix" >> $config_mak
1187 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
1188 echo "MAKE=$make" >> $config_mak
1189 echo "INSTALL=$install" >> $config_mak
1190 echo "CC=$cc" >> $config_mak
1191 echo "HOST_CC=$host_cc" >> $config_mak
1192 echo "AR=$ar" >> $config_mak
1193 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
1194 # XXX: only use CFLAGS and LDFLAGS ?
1195 # XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1196 # compilation of dyngen tool (useful for win32 build on Linux host)
1197 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
1198 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1199 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1200 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
1201 echo "CFLAGS=$CFLAGS" >> $config_mak
1202 echo "LDFLAGS=$LDFLAGS" >> $config_mak
1203 echo "EXESUF=$EXESUF" >> $config_mak
1204 echo "AIOLIBS=$AIOLIBS" >> $config_mak
1205 case "$cpu" in
1206 i386)
1207 echo "ARCH=i386" >> $config_mak
1208 echo "#define HOST_I386 1" >> $config_h
1210 x86_64)
1211 echo "ARCH=x86_64" >> $config_mak
1212 echo "#define HOST_X86_64 1" >> $config_h
1214 alpha)
1215 echo "ARCH=alpha" >> $config_mak
1216 echo "#define HOST_ALPHA 1" >> $config_h
1218 armv4b)
1219 echo "ARCH=arm" >> $config_mak
1220 echo "#define HOST_ARM 1" >> $config_h
1222 armv4l)
1223 echo "ARCH=arm" >> $config_mak
1224 echo "#define HOST_ARM 1" >> $config_h
1226 cris)
1227 echo "ARCH=cris" >> $config_mak
1228 echo "#define HOST_CRIS 1" >> $config_h
1230 hppa)
1231 echo "ARCH=hppa" >> $config_mak
1232 echo "#define HOST_HPPA 1" >> $config_h
1234 ia64)
1235 echo "ARCH=ia64" >> $config_mak
1236 echo "#define HOST_IA64 1" >> $config_h
1238 m68k)
1239 echo "ARCH=m68k" >> $config_mak
1240 echo "#define HOST_M68K 1" >> $config_h
1242 mips)
1243 echo "ARCH=mips" >> $config_mak
1244 echo "#define HOST_MIPS 1" >> $config_h
1246 mips64)
1247 echo "ARCH=mips64" >> $config_mak
1248 echo "#define HOST_MIPS64 1" >> $config_h
1250 powerpc)
1251 if test "$hostlongbits" = "32"; then
1252 echo "ARCH=ppc" >> $config_mak
1253 echo "#define HOST_PPC 1" >> $config_h
1254 else
1255 echo "ARCH=ppc64" >> $config_mak
1256 echo "#define HOST_PPC64 1" >> $config_h
1259 s390)
1260 echo "ARCH=s390" >> $config_mak
1261 echo "#define HOST_S390 1" >> $config_h
1263 sparc)
1264 echo "ARCH=sparc" >> $config_mak
1265 echo "#define HOST_SPARC 1" >> $config_h
1267 sparc64)
1268 echo "ARCH=sparc64" >> $config_mak
1269 echo "#define HOST_SPARC64 1" >> $config_h
1272 echo "Unsupported CPU = $cpu"
1273 exit 1
1275 esac
1276 if test "$sparse" = "yes" ; then
1277 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1278 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1279 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1281 if test "$bigendian" = "yes" ; then
1282 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1283 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1285 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
1286 if test "$mingw32" = "yes" ; then
1287 echo "CONFIG_WIN32=yes" >> $config_mak
1288 echo "#define CONFIG_WIN32 1" >> $config_h
1289 else
1290 cat > $TMPC << EOF
1291 #include <byteswap.h>
1292 int main(void) { return bswap_32(0); }
1294 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
1295 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1297 cat > $TMPC << EOF
1298 #include <sys/endian.h>
1299 #include <sys/types.h>
1300 #include <machine/bswap.h>
1301 int main(void) { return bswap32(0); }
1303 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
1304 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1308 if [ "$openbsd" = "yes" ] ; then
1309 echo "#define ENOTSUP 4096" >> $config_h
1312 if test "$darwin" = "yes" ; then
1313 echo "CONFIG_DARWIN=yes" >> $config_mak
1314 echo "#define CONFIG_DARWIN 1" >> $config_h
1317 if test "$aix" = "yes" ; then
1318 echo "CONFIG_AIX=yes" >> $config_mak
1319 echo "#define CONFIG_AIX 1" >> $config_h
1322 if test "$solaris" = "yes" ; then
1323 echo "CONFIG_SOLARIS=yes" >> $config_mak
1324 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
1325 if test "$needs_libsunmath" = "yes" ; then
1326 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1327 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1330 if test -n "$sparc_cpu"; then
1331 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1332 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1334 if test "$gdbstub" = "yes" ; then
1335 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1336 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1338 if test "$gprof" = "yes" ; then
1339 echo "TARGET_GPROF=yes" >> $config_mak
1340 echo "#define HAVE_GPROF 1" >> $config_h
1342 if test "$static" = "yes" ; then
1343 echo "CONFIG_STATIC=yes" >> $config_mak
1344 echo "#define CONFIG_STATIC 1" >> $config_h
1346 if test $profiler = "yes" ; then
1347 echo "#define CONFIG_PROFILER 1" >> $config_h
1349 if test "$slirp" = "yes" ; then
1350 echo "CONFIG_SLIRP=yes" >> $config_mak
1351 echo "#define CONFIG_SLIRP 1" >> $config_h
1353 if test "$vde" = "yes" ; then
1354 echo "CONFIG_VDE=yes" >> $config_mak
1355 echo "#define CONFIG_VDE 1" >> $config_h
1356 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1358 for card in $audio_card_list; do
1359 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
1360 echo "$def=yes" >> $config_mak
1361 echo "#define $def 1" >> $config_h
1362 done
1363 echo "#define AUDIO_DRIVERS \\" >> $config_h
1364 for drv in $audio_drv_list; do
1365 echo " &${drv}_audio_driver, \\" >>$config_h
1366 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
1367 echo "$def=yes" >> $config_mak
1368 if test "$drv" = "fmod"; then
1369 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1370 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1371 elif test "$drv" = "oss"; then
1372 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
1374 done
1375 echo "" >>$config_h
1376 if test "$mixemu" = "yes" ; then
1377 echo "CONFIG_MIXEMU=yes" >> $config_mak
1378 echo "#define CONFIG_MIXEMU 1" >> $config_h
1380 if test "$vnc_tls" = "yes" ; then
1381 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1382 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1383 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1384 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1386 qemu_version=`head $source_path/VERSION`
1387 echo "VERSION=$qemu_version" >>$config_mak
1388 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1389 echo "#define KVM_VERSION \"kvm-devel\"" >> $config_h
1391 echo "SRC_PATH=$source_path" >> $config_mak
1392 if [ "$source_path_used" = "yes" ]; then
1393 echo "VPATH=$source_path" >> $config_mak
1395 echo "TARGET_DIRS=$target_list" >> $config_mak
1396 if [ "$build_docs" = "yes" ] ; then
1397 echo "BUILD_DOCS=yes" >> $config_mak
1399 if test "$static" = "yes"; then
1400 sdl1=$sdl_static
1401 else
1402 sdl1=$sdl
1404 if test "$sdl1" = "yes" ; then
1405 echo "#define CONFIG_SDL 1" >> $config_h
1406 echo "CONFIG_SDL=yes" >> $config_mak
1407 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1408 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1409 else
1410 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1412 if [ "${aa}" = "yes" ] ; then
1413 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1414 else
1415 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1418 if test "$cocoa" = "yes" ; then
1419 echo "#define CONFIG_COCOA 1" >> $config_h
1420 echo "CONFIG_COCOA=yes" >> $config_mak
1422 if test "$curses" = "yes" ; then
1423 echo "#define CONFIG_CURSES 1" >> $config_h
1424 echo "CONFIG_CURSES=yes" >> $config_mak
1425 echo "CURSES_LIBS=-lcurses" >> $config_mak
1427 if test "$brlapi" = "yes" ; then
1428 echo "CONFIG_BRLAPI=yes" >> $config_mak
1429 echo "#define CONFIG_BRLAPI 1" >> $config_h
1430 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1432 if test "$bluez" = "yes" ; then
1433 echo "CONFIG_BLUEZ=yes" >> $config_mak
1434 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1435 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1436 echo "#define CONFIG_BLUEZ 1" >> $config_h
1438 if test "$aio" = "yes" ; then
1439 echo "#define CONFIG_AIO 1" >> $config_h
1440 echo "CONFIG_AIO=yes" >> $config_mak
1442 if test "$blobs" = "yes" ; then
1443 echo "INSTALL_BLOBS=yes" >> $config_mak
1445 if test "$iovec" = "yes" ; then
1446 echo "#define HAVE_IOVEC 1" >> $config_h
1448 if test "$fdt" = "yes" ; then
1449 echo "#define HAVE_FDT 1" >> $config_h
1450 echo "FDT_LIBS=-lfdt" >> $config_mak
1452 if test "$signalfd" = "yes" ; then
1453 echo "#define CONFIG_signalfd 1" >> $config_h
1455 if test "$eventfd" = "yes" ; then
1456 echo "#define CONFIG_eventfd 1" >> $config_h
1459 # XXX: suppress that
1460 if [ "$bsd" = "yes" ] ; then
1461 echo "#define O_LARGEFILE 0" >> $config_h
1462 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1463 echo "#define _BSD 1" >> $config_h
1466 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1468 # USB host support
1469 case "$usb" in
1470 linux)
1471 echo "HOST_USB=linux" >> $config_mak
1473 bsd)
1474 echo "HOST_USB=bsd" >> $config_mak
1477 echo "HOST_USB=stub" >> $config_mak
1479 esac
1481 tools=
1482 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1483 tools="qemu-img\$(EXESUF) $tools"
1484 if [ "$linux" = "yes" ] ; then
1485 tools="qemu-nbd\$(EXESUF) $tools"
1488 echo "TOOLS=$tools" >> $config_mak
1490 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1492 for target in $target_list; do
1493 target_dir="$target"
1494 config_mak=$target_dir/config.mak
1495 config_h=$target_dir/config.h
1496 target_cpu=`echo $target | cut -d '-' -f 1`
1497 target_bigendian="no"
1498 [ "$target_cpu" = "armeb" ] && target_bigendian=yes
1499 [ "$target_cpu" = "m68k" ] && target_bigendian=yes
1500 [ "$target_cpu" = "mips" ] && target_bigendian=yes
1501 [ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1502 [ "$target_cpu" = "mips64" ] && target_bigendian=yes
1503 [ "$target_cpu" = "ppc" ] && target_bigendian=yes
1504 [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
1505 [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
1506 [ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
1507 [ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
1508 [ "$target_cpu" = "sparc" ] && target_bigendian=yes
1509 [ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1510 [ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
1511 target_softmmu="no"
1512 target_user_only="no"
1513 target_linux_user="no"
1514 target_darwin_user="no"
1515 target_bsd_user="no"
1516 case "$target" in
1517 ${target_cpu}-softmmu)
1518 target_softmmu="yes"
1520 ${target_cpu}-linux-user)
1521 target_user_only="yes"
1522 target_linux_user="yes"
1524 ${target_cpu}-darwin-user)
1525 target_user_only="yes"
1526 target_darwin_user="yes"
1528 ${target_cpu}-bsd-user)
1529 target_user_only="yes"
1530 target_bsd_user="yes"
1533 echo "ERROR: Target '$target' not recognised"
1534 exit 1
1536 esac
1538 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1539 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1540 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1541 echo "To build QEMU without graphical output configure with --disable-gfx-check"
1542 echo "Note that this will disable all output from the virtual graphics card"
1543 echo "except through VNC or curses."
1544 exit 1;
1547 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1549 test -f $config_h && mv $config_h ${config_h}~
1551 mkdir -p $target_dir
1552 mkdir -p $target_dir/fpu
1553 mkdir -p $target_dir/tcg
1554 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
1555 mkdir -p $target_dir/nwfpe
1559 # don't use ln -sf as not all "ln -sf" over write the file/link
1561 rm -f $target_dir/Makefile
1562 ln -s $source_path/Makefile.target $target_dir/Makefile
1565 echo "# Automatically generated by configure - do not modify" > $config_mak
1566 echo "/* Automatically generated by configure - do not modify */" > $config_h
1569 echo "include ../config-host.mak" >> $config_mak
1570 echo "#include \"../config-host.h\"" >> $config_h
1572 bflt="no"
1573 elfload32="no"
1574 target_nptl="no"
1575 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1576 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1577 gdb_xml_files=""
1579 disable_cpu_emulation() {
1580 if test $cpu_emulation = "no"; then
1581 echo "#define NO_CPU_EMULATION 1" >> $config_h
1582 echo "NO_CPU_EMULATION=1" >> $config_mak
1586 configure_kvm() {
1587 if test $kvm = "yes" -a "$target_softmmu" = "yes" -a \
1588 \( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \); then
1589 echo "#define USE_KVM 1" >> $config_h
1590 echo "USE_KVM=1" >> $config_mak
1591 echo "CONFIG_KVM_KERNEL_INC=$kerneldir/include" >> $config_mak
1592 if test $kvm_cap_pit = "yes" ; then
1593 echo "USE_KVM_PIT=1" >> $config_mak
1594 echo "#define USE_KVM_PIT 1" >> $config_h
1596 if test $kvm_cap_device_assignment = "yes" ; then
1597 echo "USE_KVM_DEVICE_ASSIGNMENT=1" >> $config_mak
1598 echo "#define USE_KVM_DEVICE_ASSIGNMENT 1" >> $config_h
1600 disable_cpu_emulation
1604 if [ use_upstream_kvm = yes ]; then
1606 # Make sure the target and host cpus are compatible
1607 if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
1608 \( "$target_cpu" = "ppcemb" -a "$cpu" = "powerpc" \) -o \
1609 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1610 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
1611 kvm="no"
1613 # Disable KVM for linux-user
1614 if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1615 kvm="no"
1620 case "$target_cpu" in
1621 i386)
1622 echo "TARGET_ARCH=i386" >> $config_mak
1623 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1624 echo "#define TARGET_I386 1" >> $config_h
1625 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
1626 then
1627 echo "#define USE_KQEMU 1" >> $config_h
1629 if test "$kvm" = "yes" ; then
1630 echo "CONFIG_KVM=yes" >> $config_mak
1631 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1632 echo "#define CONFIG_KVM 1" >> $config_h
1634 configure_kvm
1636 x86_64)
1637 echo "TARGET_ARCH=x86_64" >> $config_mak
1638 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1639 echo "#define TARGET_I386 1" >> $config_h
1640 echo "#define TARGET_X86_64 1" >> $config_h
1641 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1642 then
1643 echo "#define USE_KQEMU 1" >> $config_h
1645 configure_kvm
1647 ia64)
1648 echo "TARGET_ARCH=ia64" >> $config_mak
1649 echo "#define TARGET_ARCH \"ia64\"" >> $config_h
1650 echo "#define TARGET_IA64 1" >> $config_h
1651 configure_kvm
1652 if [ use_upstream_kvm = yes ]; then
1653 if test "$kvm" = "yes" ; then
1654 echo "CONFIG_KVM=yes" >> $config_mak
1655 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1656 echo "#define CONFIG_KVM 1" >> $config_h
1660 alpha)
1661 echo "TARGET_ARCH=alpha" >> $config_mak
1662 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1663 echo "#define TARGET_ALPHA 1" >> $config_h
1665 arm|armeb)
1666 echo "TARGET_ARCH=arm" >> $config_mak
1667 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1668 echo "#define TARGET_ARM 1" >> $config_h
1669 bflt="yes"
1670 target_nptl="yes"
1671 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
1673 cris)
1674 echo "TARGET_ARCH=cris" >> $config_mak
1675 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1676 echo "#define TARGET_CRIS 1" >> $config_h
1678 m68k)
1679 echo "TARGET_ARCH=m68k" >> $config_mak
1680 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1681 echo "#define TARGET_M68K 1" >> $config_h
1682 bflt="yes"
1683 gdb_xml_files="cf-core.xml cf-fp.xml"
1685 mips|mipsel)
1686 echo "TARGET_ARCH=mips" >> $config_mak
1687 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1688 echo "#define TARGET_MIPS 1" >> $config_h
1689 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1691 mipsn32|mipsn32el)
1692 echo "TARGET_ARCH=mipsn32" >> $config_mak
1693 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1694 echo "#define TARGET_MIPS 1" >> $config_h
1695 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1697 mips64|mips64el)
1698 echo "TARGET_ARCH=mips64" >> $config_mak
1699 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1700 echo "#define TARGET_MIPS 1" >> $config_h
1701 echo "#define TARGET_MIPS64 1" >> $config_h
1702 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1704 ppc)
1705 echo "TARGET_ARCH=ppc" >> $config_mak
1706 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1707 echo "#define TARGET_PPC 1" >> $config_h
1709 ppcemb)
1710 echo "TARGET_ARCH=ppcemb" >> $config_mak
1711 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1712 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1713 echo "#define TARGET_PPC 1" >> $config_h
1714 echo "#define TARGET_PPCEMB 1" >> $config_h
1715 if test "$kvm" = "yes" ; then
1716 echo "CONFIG_KVM=yes" >> $config_mak
1717 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1718 echo "#define CONFIG_KVM 1" >> $config_h
1721 ppc64)
1722 echo "TARGET_ARCH=ppc64" >> $config_mak
1723 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1724 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1725 echo "#define TARGET_PPC 1" >> $config_h
1726 echo "#define TARGET_PPC64 1" >> $config_h
1728 ppc64abi32)
1729 echo "TARGET_ARCH=ppc64" >> $config_mak
1730 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1731 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1732 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1733 echo "#define TARGET_PPC 1" >> $config_h
1734 echo "#define TARGET_PPC64 1" >> $config_h
1735 echo "#define TARGET_ABI32 1" >> $config_h
1737 sh4|sh4eb)
1738 echo "TARGET_ARCH=sh4" >> $config_mak
1739 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1740 echo "#define TARGET_SH4 1" >> $config_h
1741 bflt="yes"
1742 target_nptl="yes"
1744 sparc)
1745 echo "TARGET_ARCH=sparc" >> $config_mak
1746 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1747 echo "#define TARGET_SPARC 1" >> $config_h
1749 sparc64)
1750 echo "TARGET_ARCH=sparc64" >> $config_mak
1751 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1752 echo "#define TARGET_SPARC 1" >> $config_h
1753 echo "#define TARGET_SPARC64 1" >> $config_h
1754 elfload32="yes"
1756 sparc32plus)
1757 echo "TARGET_ARCH=sparc64" >> $config_mak
1758 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1759 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1760 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1761 echo "#define TARGET_SPARC 1" >> $config_h
1762 echo "#define TARGET_SPARC64 1" >> $config_h
1763 echo "#define TARGET_ABI32 1" >> $config_h
1766 echo "Unsupported target CPU"
1767 exit 1
1769 esac
1770 if test "$target_bigendian" = "yes" ; then
1771 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1772 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1774 if test "$target_softmmu" = "yes" ; then
1775 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1776 echo "#define CONFIG_SOFTMMU 1" >> $config_h
1778 if test "$target_user_only" = "yes" ; then
1779 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1780 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1782 if test "$target_linux_user" = "yes" ; then
1783 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1784 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1786 if test "$target_darwin_user" = "yes" ; then
1787 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1788 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1790 list=""
1791 if test ! -z "$gdb_xml_files" ; then
1792 for x in $gdb_xml_files; do
1793 list="$list $source_path/gdb-xml/$x"
1794 done
1796 echo "TARGET_XML_FILES=$list" >> $config_mak
1798 if test "$target_cpu" = "arm" \
1799 -o "$target_cpu" = "armeb" \
1800 -o "$target_cpu" = "m68k" \
1801 -o "$target_cpu" = "mips" \
1802 -o "$target_cpu" = "mipsel" \
1803 -o "$target_cpu" = "mipsn32" \
1804 -o "$target_cpu" = "mipsn32el" \
1805 -o "$target_cpu" = "mips64" \
1806 -o "$target_cpu" = "mips64el" \
1807 -o "$target_cpu" = "ppc" \
1808 -o "$target_cpu" = "ppc64" \
1809 -o "$target_cpu" = "ppc64abi32" \
1810 -o "$target_cpu" = "ppcemb" \
1811 -o "$target_cpu" = "sparc" \
1812 -o "$target_cpu" = "sparc64" \
1813 -o "$target_cpu" = "sparc32plus"; then
1814 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1815 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1817 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1818 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1819 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1821 if test "$target_user_only" = "yes" \
1822 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1823 echo "#define USE_NPTL 1" >> $config_h
1825 # 32 bit ELF loader in addition to native 64 bit loader?
1826 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1827 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1828 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1830 if test "$target_bsd_user" = "yes" ; then
1831 echo "CONFIG_BSD_USER=yes" >> $config_mak
1832 echo "#define CONFIG_BSD_USER 1" >> $config_h
1835 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1837 done # for target in $targets
1839 # build tree in object directory if source path is different from current one
1840 if test "$source_path_used" = "yes" ; then
1841 DIRS="tests tests/cris slirp audio"
1842 FILES="Makefile tests/Makefile"
1843 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
1844 FILES="$FILES tests/test-mmap.c"
1845 for dir in $DIRS ; do
1846 mkdir -p $dir
1847 done
1848 # remove the link and recreate it, as not all "ln -sf" overwrite the link
1849 for f in $FILES ; do
1850 rm -f $f
1851 ln -s $source_path/$f $f
1852 done