Add vpkpx instruction.
[qemu/mini2440.git] / configure
blob1e36cf4d3939a28e30f89d022c4b768440efc15f
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"
37 # parse CC options first
38 for opt do
39 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
40 case "$opt" in
41 --cross-prefix=*) cross_prefix="$optarg"
43 --cc=*) cc="$optarg"
45 esac
46 done
48 # OS specific
49 # Using uname is really, really broken. Once we have the right set of checks
50 # we can eliminate it's usage altogether
52 cc="${cross_prefix}${cc}"
53 ar="${cross_prefix}${ar}"
54 strip="${cross_prefix}${strip}"
56 # check that the C compiler works.
57 cat > $TMPC <<EOF
58 int main(void) {}
59 EOF
61 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
62 : C compiler works ok
63 else
64 echo "ERROR: \"$cc\" either does not exist or does not work"
65 exit 1
68 check_define() {
69 cat > $TMPC <<EOF
70 #if !defined($1)
71 #error Not defined
72 #endif
73 int main(void) { return 0; }
74 EOF
75 $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
78 if check_define __i386__ ; then
79 cpu="i386"
80 elif check_define __x86_64__ ; then
81 cpu="x86_64"
82 elif check_define __sparc__ ; then
83 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
84 # They must be specified using --sparc_cpu
85 if check_define __arch64__ ; then
86 cpu="sparc64"
87 else
88 cpu="sparc"
90 else
91 cpu=`test $(uname -s) = AIX && uname -p || uname -m`
94 target_list=""
95 case "$cpu" in
96 i386|i486|i586|i686|i86pc|BePC)
97 cpu="i386"
99 x86_64|amd64)
100 cpu="x86_64"
102 alpha)
103 cpu="alpha"
105 armv*b)
106 cpu="armv4b"
108 armv*l)
109 cpu="armv4l"
111 cris)
112 cpu="cris"
114 parisc|parisc64)
115 cpu="hppa"
117 ia64)
118 cpu="ia64"
120 m68k)
121 cpu="m68k"
123 mips)
124 cpu="mips"
126 mips64)
127 cpu="mips64"
129 "Power Macintosh"|ppc|ppc64|powerpc)
130 cpu="powerpc"
132 s390*)
133 cpu="s390"
135 sparc|sun4[cdmuv])
136 cpu="sparc"
138 sparc64)
139 cpu="sparc64"
142 cpu="unknown"
144 esac
145 gprof="no"
146 sparse="no"
147 bigendian="no"
148 mingw32="no"
149 EXESUF=""
150 gdbstub="yes"
151 slirp="yes"
152 vde="yes"
153 fmod_lib=""
154 fmod_inc=""
155 oss_lib=""
156 vnc_tls="yes"
157 bsd="no"
158 linux="no"
159 solaris="no"
160 kqemu="no"
161 profiler="no"
162 cocoa="no"
163 check_gfx="yes"
164 softmmu="yes"
165 linux_user="no"
166 darwin_user="no"
167 bsd_user="no"
168 build_docs="no"
169 uname_release=""
170 curses="yes"
171 aio="yes"
172 nptl="yes"
173 mixemu="no"
174 bluez="yes"
175 kvm="yes"
176 kerneldir=""
177 aix="no"
178 blobs="yes"
179 fdt="yes"
181 # OS specific
182 if check_define __linux__ ; then
183 targetos="Linux"
184 elif check_define _WIN32 ; then
185 targetos='MINGW32'
186 else
187 targetos=`uname -s`
189 case $targetos in
190 CYGWIN*)
191 mingw32="yes"
192 OS_CFLAGS="-mno-cygwin"
193 if [ "$cpu" = "i386" ] ; then
194 kqemu="yes"
196 audio_possible_drivers="sdl"
198 MINGW32*)
199 mingw32="yes"
200 if [ "$cpu" = "i386" ] ; then
201 kqemu="yes"
203 audio_possible_drivers="dsound sdl fmod"
205 GNU/kFreeBSD)
206 audio_drv_list="oss"
207 audio_possible_drivers="oss sdl esd pa"
208 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
209 kqemu="yes"
212 FreeBSD)
213 bsd="yes"
214 audio_drv_list="oss"
215 audio_possible_drivers="oss sdl esd pa"
216 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
217 kqemu="yes"
220 NetBSD)
221 bsd="yes"
222 audio_drv_list="oss"
223 audio_possible_drivers="oss sdl esd"
224 oss_lib="-lossaudio"
226 OpenBSD)
227 bsd="yes"
228 openbsd="yes"
229 audio_drv_list="oss"
230 audio_possible_drivers="oss sdl esd"
231 oss_lib="-lossaudio"
233 Darwin)
234 bsd="yes"
235 darwin="yes"
236 darwin_user="yes"
237 cocoa="yes"
238 audio_drv_list="coreaudio"
239 audio_possible_drivers="coreaudio sdl fmod"
240 OS_CFLAGS="-mdynamic-no-pic"
241 OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
243 SunOS)
244 solaris="yes"
245 make="gmake"
246 install="ginstall"
247 needs_libsunmath="no"
248 solarisrev=`uname -r | cut -f2 -d.`
249 # have to select again, because `uname -m` returns i86pc
250 # even on an x86_64 box.
251 solariscpu=`isainfo -k`
252 if test "${solariscpu}" = "amd64" ; then
253 cpu="x86_64"
255 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
256 if test "$solarisrev" -le 9 ; then
257 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
258 needs_libsunmath="yes"
259 else
260 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
261 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
262 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
263 echo "Studio 11 can be downloaded from www.sun.com."
264 exit 1
267 if test "$solarisrev" -ge 9 ; then
268 kqemu="yes"
271 if test -f /usr/include/sys/soundcard.h ; then
272 audio_drv_list="oss"
274 audio_possible_drivers="oss sdl"
276 AIX)
277 aix="yes"
278 make="gmake"
281 audio_drv_list="oss"
282 audio_possible_drivers="oss alsa sdl esd pa"
283 linux="yes"
284 linux_user="yes"
285 usb="linux"
286 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
287 kqemu="yes"
288 audio_possible_drivers="$audio_possible_drivers fmod"
291 esac
293 if [ "$bsd" = "yes" ] ; then
294 if [ "$darwin" != "yes" ] ; then
295 make="gmake"
296 usb="bsd"
298 bsd_user="yes"
301 # find source path
302 source_path=`dirname "$0"`
303 source_path_used="no"
304 workdir=`pwd`
305 if [ -z "$source_path" ]; then
306 source_path=$workdir
307 else
308 source_path=`cd "$source_path"; pwd`
310 [ -f "$workdir/vl.c" ] || source_path_used="yes"
312 werror="no"
313 # generate compile errors on warnings for development builds
314 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
315 #werror="yes";
318 for opt do
319 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
320 case "$opt" in
321 --help|-h) show_help=yes
323 --prefix=*) prefix="$optarg"
325 --interp-prefix=*) interp_prefix="$optarg"
327 --source-path=*) source_path="$optarg"
328 source_path_used="yes"
330 --cross-prefix=*)
332 --cc=*)
334 --host-cc=*) host_cc="$optarg"
336 --make=*) make="$optarg"
338 --install=*) install="$optarg"
340 --extra-cflags=*) CFLAGS="$optarg"
342 --extra-ldflags=*) LDFLAGS="$optarg"
344 --cpu=*) cpu="$optarg"
346 --target-list=*) target_list="$optarg"
348 --enable-gprof) gprof="yes"
350 --static) static="yes"
352 --disable-sdl) sdl="no"
354 --fmod-lib=*) fmod_lib="$optarg"
356 --fmod-inc=*) fmod_inc="$optarg"
358 --oss-lib=*) oss_lib="$optarg"
360 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
362 --audio-drv-list=*) audio_drv_list="$optarg"
364 --enable-sparse) sparse="yes"
366 --disable-sparse) sparse="no"
368 --disable-vnc-tls) vnc_tls="no"
370 --disable-slirp) slirp="no"
372 --disable-vde) vde="no"
374 --disable-kqemu) kqemu="no"
376 --disable-brlapi) brlapi="no"
378 --disable-bluez) bluez="no"
380 --disable-kvm) kvm="no"
382 --enable-profiler) profiler="yes"
384 --enable-cocoa)
385 cocoa="yes" ;
386 sdl="no" ;
387 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
389 --disable-gfx-check) check_gfx="no"
391 --disable-system) softmmu="no"
393 --enable-system) softmmu="yes"
395 --disable-linux-user) linux_user="no"
397 --enable-linux-user) linux_user="yes"
399 --disable-darwin-user) darwin_user="no"
401 --enable-darwin-user) darwin_user="yes"
403 --disable-bsd-user) bsd_user="no"
405 --enable-bsd-user) bsd_user="yes"
407 --enable-uname-release=*) uname_release="$optarg"
409 --sparc_cpu=*)
410 sparc_cpu="$optarg"
411 case $sparc_cpu in
412 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
413 target_cpu="sparc"; cpu="sparc" ;;
414 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
415 target_cpu="sparc"; cpu="sparc" ;;
416 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
417 target_cpu="sparc64"; cpu="sparc64" ;;
418 *) echo "undefined SPARC architecture. Exiting";exit 1;;
419 esac
421 --enable-werror) werror="yes"
423 --disable-werror) werror="no"
425 --disable-curses) curses="no"
427 --disable-nptl) nptl="no"
429 --enable-mixemu) mixemu="yes"
431 --disable-aio) aio="no"
433 --disable-blobs) blobs="no"
435 --kerneldir=*) kerneldir="$optarg"
437 *) echo "ERROR: unknown option $opt"; show_help="yes"
439 esac
440 done
442 # default flags for all hosts
443 CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
444 CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
445 LDFLAGS="$LDFLAGS -g"
446 if test "$werror" = "yes" ; then
447 CFLAGS="$CFLAGS -Werror"
450 if test "$solaris" = "no" ; then
451 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
452 LDFLAGS="$LDFLAGS -Wl,--warn-common"
457 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
458 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
460 case "$cpu" in
461 sparc) if test -z "$sparc_cpu" ; then
462 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
463 ARCH_LDFLAGS="-m32"
464 else
465 ARCH_CFLAGS="${SP_CFLAGS}"
466 ARCH_LDFLAGS="${SP_LDFLAGS}"
469 sparc64) if test -z "$sparc_cpu" ; then
470 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
471 ARCH_LDFLAGS="-m64"
472 else
473 ARCH_CFLAGS="${SP_CFLAGS}"
474 ARCH_LDFLAGS="${SP_LDFLAGS}"
477 s390)
478 ARCH_CFLAGS="-march=z900"
480 i386)
481 ARCH_CFLAGS="-m32"
482 ARCH_LDFLAGS="-m32"
484 x86_64)
485 ARCH_CFLAGS="-m64"
486 ARCH_LDFLAGS="-m64"
488 esac
490 if test x"$show_help" = x"yes" ; then
491 cat << EOF
493 Usage: configure [options]
494 Options: [defaults in brackets after descriptions]
497 echo "Standard options:"
498 echo " --help print this message"
499 echo " --prefix=PREFIX install in PREFIX [$prefix]"
500 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
501 echo " use %M for cpu name [$interp_prefix]"
502 echo " --target-list=LIST set target list [$target_list]"
503 echo ""
504 echo "kqemu kernel acceleration support:"
505 echo " --disable-kqemu disable kqemu support"
506 echo ""
507 echo "Advanced options (experts only):"
508 echo " --source-path=PATH path of source code [$source_path]"
509 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
510 echo " --cc=CC use C compiler CC [$cc]"
511 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
512 echo " --make=MAKE use specified make [$make]"
513 echo " --install=INSTALL use specified install [$install]"
514 echo " --static enable static build [$static]"
515 echo " --enable-sparse enable sparse checker"
516 echo " --disable-sparse disable sparse checker (default)"
517 echo " --disable-werror disable compilation abort on warning"
518 echo " --disable-sdl disable SDL"
519 echo " --enable-cocoa enable COCOA (Mac OS X only)"
520 echo " --audio-drv-list=LIST set audio drivers list:"
521 echo " Available drivers: $audio_possible_drivers"
522 echo " --audio-card-list=LIST set list of additional emulated audio cards"
523 echo " Available cards: ac97 adlib cs4231a gus"
524 echo " --enable-mixemu enable mixer emulation"
525 echo " --disable-brlapi disable BrlAPI"
526 echo " --disable-vnc-tls disable TLS encryption for VNC server"
527 echo " --disable-curses disable curses output"
528 echo " --disable-bluez disable bluez stack connectivity"
529 echo " --disable-kvm disable KVM acceleration support"
530 echo " --disable-nptl disable usermode NPTL support"
531 echo " --enable-system enable all system emulation targets"
532 echo " --disable-system disable all system emulation targets"
533 echo " --enable-linux-user enable all linux usermode emulation targets"
534 echo " --disable-linux-user disable all linux usermode emulation targets"
535 echo " --enable-darwin-user enable all darwin usermode emulation targets"
536 echo " --disable-darwin-user disable all darwin usermode emulation targets"
537 echo " --enable-bsd-user enable all BSD usermode emulation targets"
538 echo " --disable-bsd-user disable all BSD usermode emulation targets"
539 echo " --fmod-lib path to FMOD library"
540 echo " --fmod-inc path to FMOD includes"
541 echo " --oss-lib path to OSS library"
542 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
543 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
544 echo " --disable-vde disable support for vde network"
545 echo " --disable-aio disable AIO support"
546 echo " --disable-blobs disable installing provided firmware blobs"
547 echo " --kerneldir=PATH look for kernel includes in PATH"
548 echo ""
549 echo "NOTE: The object files are built at the place where configure is launched"
550 exit 1
553 if test "$mingw32" = "yes" ; then
554 linux="no"
555 EXESUF=".exe"
556 oss="no"
557 linux_user="no"
558 bsd_user="no"
561 if test ! -x "$(which cgcc 2>/dev/null)"; then
562 sparse="no"
566 # Solaris specific configure tool chain decisions
568 if test "$solaris" = "yes" ; then
569 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
570 if test -z "$solinst" ; then
571 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
572 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
573 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
574 exit 1
576 if test "$solinst" = "/usr/sbin/install" ; then
577 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
578 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
579 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
580 exit 1
582 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
583 if test -z "$sol_ar" ; then
584 echo "Error: No path includes ar"
585 if test -f /usr/ccs/bin/ar ; then
586 echo "Add /usr/ccs/bin to your path and rerun configure"
588 exit 1
593 if test -z "$target_list" ; then
594 # these targets are portable
595 if [ "$softmmu" = "yes" ] ; then
596 target_list="\
597 i386-softmmu \
598 x86_64-softmmu \
599 arm-softmmu \
600 cris-softmmu \
601 m68k-softmmu \
602 mips-softmmu \
603 mipsel-softmmu \
604 mips64-softmmu \
605 mips64el-softmmu \
606 ppc-softmmu \
607 ppcemb-softmmu \
608 ppc64-softmmu \
609 sh4-softmmu \
610 sh4eb-softmmu \
611 sparc-softmmu \
614 # the following are Linux specific
615 if [ "$linux_user" = "yes" ] ; then
616 target_list="${target_list}\
617 i386-linux-user \
618 x86_64-linux-user \
619 alpha-linux-user \
620 arm-linux-user \
621 armeb-linux-user \
622 cris-linux-user \
623 m68k-linux-user \
624 mips-linux-user \
625 mipsel-linux-user \
626 ppc-linux-user \
627 ppc64-linux-user \
628 ppc64abi32-linux-user \
629 sh4-linux-user \
630 sh4eb-linux-user \
631 sparc-linux-user \
632 sparc64-linux-user \
633 sparc32plus-linux-user \
636 # the following are Darwin specific
637 if [ "$darwin_user" = "yes" ] ; then
638 target_list="$target_list i386-darwin-user ppc-darwin-user"
640 # the following are BSD specific
641 if [ "$bsd_user" = "yes" ] ; then
642 target_list="${target_list}\
643 sparc64-bsd-user \
646 else
647 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
649 if test -z "$target_list" ; then
650 echo "No targets enabled"
651 exit 1
654 if test -z "$cross_prefix" ; then
656 # ---
657 # big/little endian test
658 cat > $TMPC << EOF
659 #include <inttypes.h>
660 int main(int argc, char ** argv){
661 volatile uint32_t i=0x01234567;
662 return (*((uint8_t*)(&i))) == 0x67;
666 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
667 $TMPE && bigendian="yes"
668 else
669 echo big/little test failed
672 else
674 # if cross compiling, cannot launch a program, so make a static guess
675 if test "$cpu" = "armv4b" \
676 -o "$cpu" = "hppa" \
677 -o "$cpu" = "m68k" \
678 -o "$cpu" = "mips" \
679 -o "$cpu" = "mips64" \
680 -o "$cpu" = "powerpc" \
681 -o "$cpu" = "s390" \
682 -o "$cpu" = "sparc" \
683 -o "$cpu" = "sparc64"; then
684 bigendian="yes"
689 # host long bits test
690 hostlongbits="32"
691 if test "$cpu" = "x86_64" \
692 -o "$cpu" = "alpha" \
693 -o "$cpu" = "ia64" \
694 -o "$cpu" = "sparc64"; then
695 hostlongbits="64"
698 # ppc specific hostlongbits selection
699 if test "$cpu" = "powerpc" ; then
700 if $cc $ARCH_CFLAGS -dM -E - -o $TMPI 2>/dev/null </dev/null; then
701 grep -q __powerpc64__ $TMPI && hostlongbits=64
702 else
703 echo hostlongbits test failed
704 exit 1
708 # check gcc options support
709 cat > $TMPC <<EOF
710 int main(void) {
714 # Check host NPTL support
715 cat > $TMPC <<EOF
716 #include <sched.h>
717 #include <linux/futex.h>
718 void foo()
720 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
721 #error bork
722 #endif
726 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
728 else
729 nptl="no"
732 ##########################################
733 # zlib check
735 cat > $TMPC << EOF
736 #include <zlib.h>
737 int main(void) { zlibVersion(); return 0; }
739 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
741 else
742 echo
743 echo "Error: zlib check failed"
744 echo "Make sure to have the zlib libs and headers installed."
745 echo
746 exit 1
749 ##########################################
750 # SDL probe
752 sdl_too_old=no
754 if test -z "$sdl" ; then
755 sdl_config="sdl-config"
756 sdl=no
757 sdl_static=no
759 cat > $TMPC << EOF
760 #include <SDL.h>
761 #undef main /* We don't want SDL to override our main() */
762 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
764 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
765 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
766 if test "$_sdlversion" -lt 121 ; then
767 sdl_too_old=yes
768 else
769 if test "$cocoa" = "no" ; then
770 sdl=yes
774 # static link with sdl ?
775 if test "$sdl" = "yes" ; then
776 aa="no"
777 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
778 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
779 if [ "$aa" = "yes" ] ; then
780 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
783 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then
784 sdl_static=yes
786 fi # static link
787 fi # sdl compile test
788 else
789 # Make sure to disable cocoa if sdl was set
790 if test "$sdl" = "yes" ; then
791 cocoa="no"
792 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
794 fi # -z $sdl
796 ##########################################
797 # VNC TLS detection
798 if test "$vnc_tls" = "yes" ; then
799 cat > $TMPC <<EOF
800 #include <gnutls/gnutls.h>
801 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
803 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
804 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
805 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
806 $vnc_tls_libs > /dev/null 2> /dev/null ; then
808 else
809 vnc_tls="no"
813 ##########################################
814 # vde libraries probe
815 if test "$vde" = "yes" ; then
816 cat > $TMPC << EOF
817 #include <libvdeplug.h>
818 int main(void)
820 struct vde_open_args a = {0, 0, 0};
821 vde_open("", "", &a);
822 return 0;
825 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
827 else
828 vde="no"
832 ##########################################
833 # Sound support libraries probe
835 audio_drv_probe()
837 drv=$1
838 hdr=$2
839 lib=$3
840 exp=$4
841 cfl=$5
842 cat > $TMPC << EOF
843 #include <$hdr>
844 int main(void) { $exp }
846 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
848 else
849 echo
850 echo "Error: $drv check failed"
851 echo "Make sure to have the $drv libs and headers installed."
852 echo
853 exit 1
857 audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
858 for drv in $audio_drv_list; do
859 case $drv in
860 alsa)
861 audio_drv_probe $drv alsa/asoundlib.h -lasound \
862 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
865 fmod)
866 if test -z $fmod_lib || test -z $fmod_inc; then
867 echo
868 echo "Error: You must specify path to FMOD library and headers"
869 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
870 echo
871 exit 1
873 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
876 esd)
877 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
881 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
882 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
885 oss|sdl|core|wav|dsound)
886 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
890 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
891 echo
892 echo "Error: Unknown driver '$drv' selected"
893 echo "Possible drivers are: $audio_possible_drivers"
894 echo
895 exit 1
898 esac
899 done
901 ##########################################
902 # BrlAPI probe
904 if test -z "$brlapi" ; then
905 brlapi=no
906 cat > $TMPC << EOF
907 #include <brlapi.h>
908 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
910 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
911 brlapi=yes
912 fi # brlapi compile test
913 fi # -z $brlapi
915 ##########################################
916 # curses probe
918 if test "$curses" = "yes" ; then
919 curses=no
920 cat > $TMPC << EOF
921 #include <curses.h>
922 int main(void) { return curses_version(); }
924 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
925 curses=yes
927 fi # test "$curses"
929 ##########################################
930 # bluez support probe
931 if test "$bluez" = "yes" ; then
932 `pkg-config bluez` || bluez="no"
934 if test "$bluez" = "yes" ; then
935 cat > $TMPC << EOF
936 #include <bluetooth/bluetooth.h>
937 int main(void) { return bt_error(0); }
939 bluez_cflags=`pkg-config --cflags bluez`
940 bluez_libs=`pkg-config --libs bluez`
941 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
942 $bluez_libs > /dev/null 2> /dev/null ; then
944 else
945 bluez="no"
949 ##########################################
950 # kvm probe
951 if test "$kvm" = "yes" ; then
952 cat > $TMPC <<EOF
953 #include <linux/kvm.h>
954 #if !defined(KVM_API_VERSION) || \
955 KVM_API_VERSION < 12 || \
956 KVM_API_VERSION > 12 || \
957 !defined(KVM_CAP_USER_MEMORY) || \
958 !defined(KVM_CAP_SET_TSS_ADDR) || \
959 !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
960 #error Invalid KVM version
961 #endif
962 int main(void) { return 0; }
964 if test "$kerneldir" != "" ; then
965 kvm_cflags=-I"$kerneldir"/include
966 else
967 kvm_cflags=""
969 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
970 > /dev/null 2>/dev/null ; then
972 else
973 kvm="no"
977 ##########################################
978 # AIO probe
979 AIOLIBS=""
981 if test "$aio" = "yes" ; then
982 aio=no
983 cat > $TMPC << EOF
984 #include <pthread.h>
985 int main(void) { pthread_mutex_t lock; return 0; }
987 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
988 aio=yes
989 AIOLIBS="-lpthread"
993 ##########################################
994 # iovec probe
995 cat > $TMPC <<EOF
996 #include <sys/uio.h>
997 int main(void) { struct iovec iov; return 0; }
999 iovec=no
1000 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1001 iovec=yes
1004 ##########################################
1005 # fdt probe
1006 if test "$fdt" = "yes" ; then
1007 fdt=no
1008 cat > $TMPC << EOF
1009 int main(void) { return 0; }
1011 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null ; then
1012 fdt=yes
1016 # Check if tools are available to build documentation.
1017 if [ -x "`which texi2html 2>/dev/null`" ] && \
1018 [ -x "`which pod2man 2>/dev/null`" ]; then
1019 build_docs="yes"
1022 ##########################################
1023 # Do we need librt
1024 cat > $TMPC <<EOF
1025 #include <signal.h>
1026 #include <time.h>
1027 int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1030 rt=no
1031 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1033 elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
1034 rt=yes
1037 if test "$rt" = "yes" ; then
1038 # Hack, we should have a general purpose LIBS for this sort of thing
1039 AIOLIBS="$AIOLIBS -lrt"
1042 if test "$mingw32" = "yes" ; then
1043 if test -z "$prefix" ; then
1044 prefix="c:\\\\Program Files\\\\Qemu"
1046 mansuffix=""
1047 datasuffix=""
1048 docsuffix=""
1049 binsuffix=""
1050 else
1051 if test -z "$prefix" ; then
1052 prefix="/usr/local"
1054 mansuffix="/share/man"
1055 datasuffix="/share/qemu"
1056 docsuffix="/share/doc/qemu"
1057 binsuffix="/bin"
1060 echo "Install prefix $prefix"
1061 echo "BIOS directory $prefix$datasuffix"
1062 echo "binary directory $prefix$binsuffix"
1063 if test "$mingw32" = "no" ; then
1064 echo "Manual directory $prefix$mansuffix"
1065 echo "ELF interp prefix $interp_prefix"
1067 echo "Source path $source_path"
1068 echo "C compiler $cc"
1069 echo "Host C compiler $host_cc"
1070 echo "ARCH_CFLAGS $ARCH_CFLAGS"
1071 echo "make $make"
1072 echo "install $install"
1073 echo "host CPU $cpu"
1074 echo "host big endian $bigendian"
1075 echo "target list $target_list"
1076 echo "gprof enabled $gprof"
1077 echo "sparse enabled $sparse"
1078 echo "profiler $profiler"
1079 echo "static build $static"
1080 echo "-Werror enabled $werror"
1081 if test "$darwin" = "yes" ; then
1082 echo "Cocoa support $cocoa"
1084 echo "SDL support $sdl"
1085 if test "$sdl" != "no" ; then
1086 echo "SDL static link $sdl_static"
1088 echo "curses support $curses"
1089 echo "mingw32 support $mingw32"
1090 echo "Audio drivers $audio_drv_list"
1091 echo "Extra audio cards $audio_card_list"
1092 echo "Mixer emulation $mixemu"
1093 echo "VNC TLS support $vnc_tls"
1094 if test "$vnc_tls" = "yes" ; then
1095 echo " TLS CFLAGS $vnc_tls_cflags"
1096 echo " TLS LIBS $vnc_tls_libs"
1098 if test -n "$sparc_cpu"; then
1099 echo "Target Sparc Arch $sparc_cpu"
1101 echo "kqemu support $kqemu"
1102 echo "brlapi support $brlapi"
1103 echo "Documentation $build_docs"
1104 [ ! -z "$uname_release" ] && \
1105 echo "uname -r $uname_release"
1106 echo "NPTL support $nptl"
1107 echo "vde support $vde"
1108 echo "AIO support $aio"
1109 echo "Install blobs $blobs"
1110 echo "KVM support $kvm"
1111 echo "fdt support $fdt"
1113 if test $sdl_too_old = "yes"; then
1114 echo "-> Your SDL version is too old - please upgrade to have SDL support"
1116 if [ -s $TMPSDLLOG ]; then
1117 echo "The error log from compiling the libSDL test is: "
1118 cat $TMPSDLLOG
1120 #if test "$sdl_static" = "no"; then
1121 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1123 config_mak="config-host.mak"
1124 config_h="config-host.h"
1126 #echo "Creating $config_mak and $config_h"
1128 test -f $config_h && mv $config_h ${config_h}~
1130 echo "# Automatically generated by configure - do not modify" > $config_mak
1131 printf "# Configured with:" >> $config_mak
1132 printf " '%s'" "$0" "$@" >> $config_mak
1133 echo >> $config_mak
1134 echo "/* Automatically generated by configure - do not modify */" > $config_h
1136 echo "prefix=$prefix" >> $config_mak
1137 echo "bindir=\${prefix}$binsuffix" >> $config_mak
1138 echo "mandir=\${prefix}$mansuffix" >> $config_mak
1139 echo "datadir=\${prefix}$datasuffix" >> $config_mak
1140 echo "docdir=\${prefix}$docsuffix" >> $config_mak
1141 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
1142 echo "MAKE=$make" >> $config_mak
1143 echo "INSTALL=$install" >> $config_mak
1144 echo "CC=$cc" >> $config_mak
1145 echo "HOST_CC=$host_cc" >> $config_mak
1146 echo "AR=$ar" >> $config_mak
1147 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
1148 # XXX: only use CFLAGS and LDFLAGS ?
1149 # XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1150 # compilation of dyngen tool (useful for win32 build on Linux host)
1151 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
1152 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1153 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1154 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
1155 echo "CFLAGS=$CFLAGS" >> $config_mak
1156 echo "LDFLAGS=$LDFLAGS" >> $config_mak
1157 echo "EXESUF=$EXESUF" >> $config_mak
1158 echo "AIOLIBS=$AIOLIBS" >> $config_mak
1159 case "$cpu" in
1160 i386)
1161 echo "ARCH=i386" >> $config_mak
1162 echo "#define HOST_I386 1" >> $config_h
1164 x86_64)
1165 echo "ARCH=x86_64" >> $config_mak
1166 echo "#define HOST_X86_64 1" >> $config_h
1168 alpha)
1169 echo "ARCH=alpha" >> $config_mak
1170 echo "#define HOST_ALPHA 1" >> $config_h
1172 armv4b)
1173 echo "ARCH=arm" >> $config_mak
1174 echo "#define HOST_ARM 1" >> $config_h
1176 armv4l)
1177 echo "ARCH=arm" >> $config_mak
1178 echo "#define HOST_ARM 1" >> $config_h
1180 cris)
1181 echo "ARCH=cris" >> $config_mak
1182 echo "#define HOST_CRIS 1" >> $config_h
1184 hppa)
1185 echo "ARCH=hppa" >> $config_mak
1186 echo "#define HOST_HPPA 1" >> $config_h
1188 ia64)
1189 echo "ARCH=ia64" >> $config_mak
1190 echo "#define HOST_IA64 1" >> $config_h
1192 m68k)
1193 echo "ARCH=m68k" >> $config_mak
1194 echo "#define HOST_M68K 1" >> $config_h
1196 mips)
1197 echo "ARCH=mips" >> $config_mak
1198 echo "#define HOST_MIPS 1" >> $config_h
1200 mips64)
1201 echo "ARCH=mips64" >> $config_mak
1202 echo "#define HOST_MIPS64 1" >> $config_h
1204 powerpc)
1205 if test "$hostlongbits" = "32"; then
1206 echo "ARCH=ppc" >> $config_mak
1207 echo "#define HOST_PPC 1" >> $config_h
1208 else
1209 echo "ARCH=ppc64" >> $config_mak
1210 echo "#define HOST_PPC64 1" >> $config_h
1213 s390)
1214 echo "ARCH=s390" >> $config_mak
1215 echo "#define HOST_S390 1" >> $config_h
1217 sparc)
1218 echo "ARCH=sparc" >> $config_mak
1219 echo "#define HOST_SPARC 1" >> $config_h
1221 sparc64)
1222 echo "ARCH=sparc64" >> $config_mak
1223 echo "#define HOST_SPARC64 1" >> $config_h
1226 echo "Unsupported CPU = $cpu"
1227 exit 1
1229 esac
1230 if test "$sparse" = "yes" ; then
1231 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1232 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1233 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1235 if test "$bigendian" = "yes" ; then
1236 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1237 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1239 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
1240 if test "$mingw32" = "yes" ; then
1241 echo "CONFIG_WIN32=yes" >> $config_mak
1242 echo "#define CONFIG_WIN32 1" >> $config_h
1243 else
1244 cat > $TMPC << EOF
1245 #include <byteswap.h>
1246 int main(void) { return bswap_32(0); }
1248 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
1249 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1251 cat > $TMPC << EOF
1252 #include <sys/endian.h>
1253 #include <sys/types.h>
1254 #include <machine/bswap.h>
1255 int main(void) { return bswap32(0); }
1257 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
1258 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1262 if [ "$openbsd" = "yes" ] ; then
1263 echo "#define ENOTSUP 4096" >> $config_h
1266 if test "$darwin" = "yes" ; then
1267 echo "CONFIG_DARWIN=yes" >> $config_mak
1268 echo "#define CONFIG_DARWIN 1" >> $config_h
1271 if test "$aix" = "yes" ; then
1272 echo "CONFIG_AIX=yes" >> $config_mak
1273 echo "#define CONFIG_AIX 1" >> $config_h
1276 if test "$solaris" = "yes" ; then
1277 echo "CONFIG_SOLARIS=yes" >> $config_mak
1278 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
1279 if test "$needs_libsunmath" = "yes" ; then
1280 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1281 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1284 if test -n "$sparc_cpu"; then
1285 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1286 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1288 if test "$gdbstub" = "yes" ; then
1289 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1290 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1292 if test "$gprof" = "yes" ; then
1293 echo "TARGET_GPROF=yes" >> $config_mak
1294 echo "#define HAVE_GPROF 1" >> $config_h
1296 if test "$static" = "yes" ; then
1297 echo "CONFIG_STATIC=yes" >> $config_mak
1298 echo "#define CONFIG_STATIC 1" >> $config_h
1300 if test $profiler = "yes" ; then
1301 echo "#define CONFIG_PROFILER 1" >> $config_h
1303 if test "$slirp" = "yes" ; then
1304 echo "CONFIG_SLIRP=yes" >> $config_mak
1305 echo "#define CONFIG_SLIRP 1" >> $config_h
1307 if test "$vde" = "yes" ; then
1308 echo "CONFIG_VDE=yes" >> $config_mak
1309 echo "#define CONFIG_VDE 1" >> $config_h
1310 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1312 for card in $audio_card_list; do
1313 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
1314 echo "$def=yes" >> $config_mak
1315 echo "#define $def 1" >> $config_h
1316 done
1317 echo "#define AUDIO_DRIVERS \\" >> $config_h
1318 for drv in $audio_drv_list; do
1319 echo " &${drv}_audio_driver, \\" >>$config_h
1320 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
1321 echo "$def=yes" >> $config_mak
1322 if test "$drv" = "fmod"; then
1323 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1324 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1325 elif test "$drv" = "oss"; then
1326 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
1328 done
1329 echo "" >>$config_h
1330 if test "$mixemu" = "yes" ; then
1331 echo "CONFIG_MIXEMU=yes" >> $config_mak
1332 echo "#define CONFIG_MIXEMU 1" >> $config_h
1334 if test "$vnc_tls" = "yes" ; then
1335 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1336 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1337 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1338 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1340 qemu_version=`head $source_path/VERSION`
1341 echo "VERSION=$qemu_version" >>$config_mak
1342 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1344 echo "SRC_PATH=$source_path" >> $config_mak
1345 if [ "$source_path_used" = "yes" ]; then
1346 echo "VPATH=$source_path" >> $config_mak
1348 echo "TARGET_DIRS=$target_list" >> $config_mak
1349 if [ "$build_docs" = "yes" ] ; then
1350 echo "BUILD_DOCS=yes" >> $config_mak
1352 if test "$static" = "yes"; then
1353 sdl1=$sdl_static
1354 else
1355 sdl1=$sdl
1357 if test "$sdl1" = "yes" ; then
1358 echo "#define CONFIG_SDL 1" >> $config_h
1359 echo "CONFIG_SDL=yes" >> $config_mak
1360 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1361 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1362 else
1363 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1365 if [ "${aa}" = "yes" ] ; then
1366 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1367 else
1368 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1371 if test "$cocoa" = "yes" ; then
1372 echo "#define CONFIG_COCOA 1" >> $config_h
1373 echo "CONFIG_COCOA=yes" >> $config_mak
1375 if test "$curses" = "yes" ; then
1376 echo "#define CONFIG_CURSES 1" >> $config_h
1377 echo "CONFIG_CURSES=yes" >> $config_mak
1378 echo "CURSES_LIBS=-lcurses" >> $config_mak
1380 if test "$brlapi" = "yes" ; then
1381 echo "CONFIG_BRLAPI=yes" >> $config_mak
1382 echo "#define CONFIG_BRLAPI 1" >> $config_h
1383 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1385 if test "$bluez" = "yes" ; then
1386 echo "CONFIG_BLUEZ=yes" >> $config_mak
1387 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1388 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1389 echo "#define CONFIG_BLUEZ 1" >> $config_h
1391 if test "$aio" = "yes" ; then
1392 echo "#define CONFIG_AIO 1" >> $config_h
1393 echo "CONFIG_AIO=yes" >> $config_mak
1395 if test "$blobs" = "yes" ; then
1396 echo "INSTALL_BLOBS=yes" >> $config_mak
1398 if test "$iovec" = "yes" ; then
1399 echo "#define HAVE_IOVEC 1" >> $config_h
1401 if test "$fdt" = "yes" ; then
1402 echo "#define HAVE_FDT 1" >> $config_h
1403 echo "FDT_LIBS=-lfdt" >> $config_mak
1406 # XXX: suppress that
1407 if [ "$bsd" = "yes" ] ; then
1408 echo "#define O_LARGEFILE 0" >> $config_h
1409 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1410 echo "#define _BSD 1" >> $config_h
1413 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1415 # USB host support
1416 case "$usb" in
1417 linux)
1418 echo "HOST_USB=linux" >> $config_mak
1420 bsd)
1421 echo "HOST_USB=bsd" >> $config_mak
1424 echo "HOST_USB=stub" >> $config_mak
1426 esac
1428 tools=
1429 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1430 tools="qemu-img\$(EXESUF) $tools"
1431 if [ "$linux" = "yes" ] ; then
1432 tools="qemu-nbd\$(EXESUF) $tools"
1435 echo "TOOLS=$tools" >> $config_mak
1437 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1439 for target in $target_list; do
1440 target_dir="$target"
1441 config_mak=$target_dir/config.mak
1442 config_h=$target_dir/config.h
1443 target_cpu=`echo $target | cut -d '-' -f 1`
1444 target_bigendian="no"
1445 [ "$target_cpu" = "armeb" ] && target_bigendian=yes
1446 [ "$target_cpu" = "m68k" ] && target_bigendian=yes
1447 [ "$target_cpu" = "mips" ] && target_bigendian=yes
1448 [ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1449 [ "$target_cpu" = "mips64" ] && target_bigendian=yes
1450 [ "$target_cpu" = "ppc" ] && target_bigendian=yes
1451 [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
1452 [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
1453 [ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
1454 [ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
1455 [ "$target_cpu" = "sparc" ] && target_bigendian=yes
1456 [ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1457 [ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
1458 target_softmmu="no"
1459 target_user_only="no"
1460 target_linux_user="no"
1461 target_darwin_user="no"
1462 target_bsd_user="no"
1463 case "$target" in
1464 ${target_cpu}-softmmu)
1465 target_softmmu="yes"
1467 ${target_cpu}-linux-user)
1468 target_user_only="yes"
1469 target_linux_user="yes"
1471 ${target_cpu}-darwin-user)
1472 target_user_only="yes"
1473 target_darwin_user="yes"
1475 ${target_cpu}-bsd-user)
1476 target_user_only="yes"
1477 target_bsd_user="yes"
1480 echo "ERROR: Target '$target' not recognised"
1481 exit 1
1483 esac
1485 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1486 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1487 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1488 echo "To build QEMU without graphical output configure with --disable-gfx-check"
1489 echo "Note that this will disable all output from the virtual graphics card"
1490 echo "except through VNC or curses."
1491 exit 1;
1494 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1496 test -f $config_h && mv $config_h ${config_h}~
1498 mkdir -p $target_dir
1499 mkdir -p $target_dir/fpu
1500 mkdir -p $target_dir/tcg
1501 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
1502 mkdir -p $target_dir/nwfpe
1506 # don't use ln -sf as not all "ln -sf" over write the file/link
1508 rm -f $target_dir/Makefile
1509 ln -s $source_path/Makefile.target $target_dir/Makefile
1512 echo "# Automatically generated by configure - do not modify" > $config_mak
1513 echo "/* Automatically generated by configure - do not modify */" > $config_h
1516 echo "include ../config-host.mak" >> $config_mak
1517 echo "#include \"../config-host.h\"" >> $config_h
1519 bflt="no"
1520 elfload32="no"
1521 target_nptl="no"
1522 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1523 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1524 gdb_xml_files=""
1526 # Make sure the target and host cpus are compatible
1527 if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
1528 \( "$target_cpu" = "ppcemb" -a "$cpu" = "powerpc" \) -o \
1529 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1530 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
1531 kvm="no"
1533 # Disable KVM for linux-user
1534 if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1535 kvm="no"
1538 case "$target_cpu" in
1539 i386)
1540 echo "TARGET_ARCH=i386" >> $config_mak
1541 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1542 echo "#define TARGET_I386 1" >> $config_h
1543 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
1544 then
1545 echo "#define USE_KQEMU 1" >> $config_h
1547 if test "$kvm" = "yes" ; then
1548 echo "CONFIG_KVM=yes" >> $config_mak
1549 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1550 echo "#define CONFIG_KVM 1" >> $config_h
1553 x86_64)
1554 echo "TARGET_ARCH=x86_64" >> $config_mak
1555 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1556 echo "#define TARGET_I386 1" >> $config_h
1557 echo "#define TARGET_X86_64 1" >> $config_h
1558 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1559 then
1560 echo "#define USE_KQEMU 1" >> $config_h
1562 if test "$kvm" = "yes" ; then
1563 echo "CONFIG_KVM=yes" >> $config_mak
1564 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1565 echo "#define CONFIG_KVM 1" >> $config_h
1568 alpha)
1569 echo "TARGET_ARCH=alpha" >> $config_mak
1570 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1571 echo "#define TARGET_ALPHA 1" >> $config_h
1573 arm|armeb)
1574 echo "TARGET_ARCH=arm" >> $config_mak
1575 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1576 echo "#define TARGET_ARM 1" >> $config_h
1577 bflt="yes"
1578 target_nptl="yes"
1579 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
1581 cris)
1582 echo "TARGET_ARCH=cris" >> $config_mak
1583 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1584 echo "#define TARGET_CRIS 1" >> $config_h
1586 m68k)
1587 echo "TARGET_ARCH=m68k" >> $config_mak
1588 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1589 echo "#define TARGET_M68K 1" >> $config_h
1590 bflt="yes"
1591 gdb_xml_files="cf-core.xml cf-fp.xml"
1593 mips|mipsel)
1594 echo "TARGET_ARCH=mips" >> $config_mak
1595 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1596 echo "#define TARGET_MIPS 1" >> $config_h
1597 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1599 mipsn32|mipsn32el)
1600 echo "TARGET_ARCH=mipsn32" >> $config_mak
1601 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1602 echo "#define TARGET_MIPS 1" >> $config_h
1603 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1605 mips64|mips64el)
1606 echo "TARGET_ARCH=mips64" >> $config_mak
1607 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1608 echo "#define TARGET_MIPS 1" >> $config_h
1609 echo "#define TARGET_MIPS64 1" >> $config_h
1610 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1612 ppc)
1613 echo "TARGET_ARCH=ppc" >> $config_mak
1614 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1615 echo "#define TARGET_PPC 1" >> $config_h
1617 ppcemb)
1618 echo "TARGET_ARCH=ppcemb" >> $config_mak
1619 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1620 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1621 echo "#define TARGET_PPC 1" >> $config_h
1622 echo "#define TARGET_PPCEMB 1" >> $config_h
1623 if test "$kvm" = "yes" ; then
1624 echo "CONFIG_KVM=yes" >> $config_mak
1625 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1626 echo "#define CONFIG_KVM 1" >> $config_h
1629 ppc64)
1630 echo "TARGET_ARCH=ppc64" >> $config_mak
1631 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1632 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1633 echo "#define TARGET_PPC 1" >> $config_h
1634 echo "#define TARGET_PPC64 1" >> $config_h
1636 ppc64abi32)
1637 echo "TARGET_ARCH=ppc64" >> $config_mak
1638 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1639 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1640 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1641 echo "#define TARGET_PPC 1" >> $config_h
1642 echo "#define TARGET_PPC64 1" >> $config_h
1643 echo "#define TARGET_ABI32 1" >> $config_h
1645 sh4|sh4eb)
1646 echo "TARGET_ARCH=sh4" >> $config_mak
1647 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1648 echo "#define TARGET_SH4 1" >> $config_h
1649 bflt="yes"
1650 target_nptl="yes"
1652 sparc)
1653 echo "TARGET_ARCH=sparc" >> $config_mak
1654 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1655 echo "#define TARGET_SPARC 1" >> $config_h
1657 sparc64)
1658 echo "TARGET_ARCH=sparc64" >> $config_mak
1659 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1660 echo "#define TARGET_SPARC 1" >> $config_h
1661 echo "#define TARGET_SPARC64 1" >> $config_h
1662 elfload32="yes"
1664 sparc32plus)
1665 echo "TARGET_ARCH=sparc64" >> $config_mak
1666 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1667 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1668 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1669 echo "#define TARGET_SPARC 1" >> $config_h
1670 echo "#define TARGET_SPARC64 1" >> $config_h
1671 echo "#define TARGET_ABI32 1" >> $config_h
1674 echo "Unsupported target CPU"
1675 exit 1
1677 esac
1678 if test "$target_bigendian" = "yes" ; then
1679 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1680 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1682 if test "$target_softmmu" = "yes" ; then
1683 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1684 echo "#define CONFIG_SOFTMMU 1" >> $config_h
1686 if test "$target_user_only" = "yes" ; then
1687 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1688 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1690 if test "$target_linux_user" = "yes" ; then
1691 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1692 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1694 if test "$target_darwin_user" = "yes" ; then
1695 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1696 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1698 list=""
1699 if test ! -z "$gdb_xml_files" ; then
1700 for x in $gdb_xml_files; do
1701 list="$list $source_path/gdb-xml/$x"
1702 done
1704 echo "TARGET_XML_FILES=$list" >> $config_mak
1706 if test "$target_cpu" = "arm" \
1707 -o "$target_cpu" = "armeb" \
1708 -o "$target_cpu" = "m68k" \
1709 -o "$target_cpu" = "mips" \
1710 -o "$target_cpu" = "mipsel" \
1711 -o "$target_cpu" = "mipsn32" \
1712 -o "$target_cpu" = "mipsn32el" \
1713 -o "$target_cpu" = "mips64" \
1714 -o "$target_cpu" = "mips64el" \
1715 -o "$target_cpu" = "ppc" \
1716 -o "$target_cpu" = "ppc64" \
1717 -o "$target_cpu" = "ppc64abi32" \
1718 -o "$target_cpu" = "ppcemb" \
1719 -o "$target_cpu" = "sparc" \
1720 -o "$target_cpu" = "sparc64" \
1721 -o "$target_cpu" = "sparc32plus"; then
1722 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1723 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1725 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1726 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1727 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1729 if test "$target_user_only" = "yes" \
1730 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1731 echo "#define USE_NPTL 1" >> $config_h
1733 # 32 bit ELF loader in addition to native 64 bit loader?
1734 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1735 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1736 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1738 if test "$target_bsd_user" = "yes" ; then
1739 echo "CONFIG_BSD_USER=yes" >> $config_mak
1740 echo "#define CONFIG_BSD_USER 1" >> $config_h
1743 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1745 done # for target in $targets
1747 # build tree in object directory if source path is different from current one
1748 if test "$source_path_used" = "yes" ; then
1749 DIRS="tests tests/cris slirp audio"
1750 FILES="Makefile tests/Makefile"
1751 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
1752 FILES="$FILES tests/test-mmap.c"
1753 for dir in $DIRS ; do
1754 mkdir -p $dir
1755 done
1756 # remove the link and recreate it, as not all "ln -sf" overwrite the link
1757 for f in $FILES ; do
1758 rm -f $f
1759 ln -s $source_path/$f $f
1760 done