Merge branch 'master' of ../qemu
[qemu/z80.git] / configure
blob9e2eeea8104c14bedcbe3d9db85fad4e564c57d3
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 libspectrum="no"
153 vde="yes"
154 fmod_lib=""
155 fmod_inc=""
156 oss_lib=""
157 vnc_tls="yes"
158 bsd="no"
159 linux="no"
160 solaris="no"
161 kqemu="no"
162 profiler="no"
163 cocoa="no"
164 check_gfx="yes"
165 softmmu="yes"
166 linux_user="no"
167 darwin_user="no"
168 bsd_user="no"
169 build_docs="no"
170 uname_release=""
171 curses="yes"
172 aio="yes"
173 nptl="yes"
174 mixemu="no"
175 bluez="yes"
176 kvm="yes"
177 kerneldir=""
178 aix="no"
179 blobs="yes"
180 fdt="yes"
182 # OS specific
183 if check_define __linux__ ; then
184 targetos="Linux"
185 elif check_define _WIN32 ; then
186 targetos='MINGW32'
187 else
188 targetos=`uname -s`
190 case $targetos in
191 CYGWIN*)
192 mingw32="yes"
193 OS_CFLAGS="-mno-cygwin"
194 if [ "$cpu" = "i386" ] ; then
195 kqemu="yes"
197 audio_possible_drivers="sdl"
199 MINGW32*)
200 mingw32="yes"
201 if [ "$cpu" = "i386" ] ; then
202 kqemu="yes"
204 audio_possible_drivers="dsound sdl fmod"
206 GNU/kFreeBSD)
207 audio_drv_list="oss"
208 audio_possible_drivers="oss sdl esd pa"
209 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
210 kqemu="yes"
213 FreeBSD)
214 bsd="yes"
215 audio_drv_list="oss"
216 audio_possible_drivers="oss sdl esd pa"
217 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
218 kqemu="yes"
221 NetBSD)
222 bsd="yes"
223 audio_drv_list="oss"
224 audio_possible_drivers="oss sdl esd"
225 oss_lib="-lossaudio"
227 OpenBSD)
228 bsd="yes"
229 openbsd="yes"
230 audio_drv_list="oss"
231 audio_possible_drivers="oss sdl esd"
232 oss_lib="-lossaudio"
234 Darwin)
235 bsd="yes"
236 darwin="yes"
237 darwin_user="yes"
238 cocoa="yes"
239 audio_drv_list="coreaudio"
240 audio_possible_drivers="coreaudio sdl fmod"
241 OS_CFLAGS="-mdynamic-no-pic"
242 OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
244 SunOS)
245 solaris="yes"
246 make="gmake"
247 install="ginstall"
248 needs_libsunmath="no"
249 solarisrev=`uname -r | cut -f2 -d.`
250 # have to select again, because `uname -m` returns i86pc
251 # even on an x86_64 box.
252 solariscpu=`isainfo -k`
253 if test "${solariscpu}" = "amd64" ; then
254 cpu="x86_64"
256 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
257 if test "$solarisrev" -le 9 ; then
258 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
259 needs_libsunmath="yes"
260 else
261 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
262 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
263 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
264 echo "Studio 11 can be downloaded from www.sun.com."
265 exit 1
268 if test "$solarisrev" -ge 9 ; then
269 kqemu="yes"
272 if test -f /usr/include/sys/soundcard.h ; then
273 audio_drv_list="oss"
275 audio_possible_drivers="oss sdl"
277 AIX)
278 aix="yes"
279 make="gmake"
282 audio_drv_list="oss"
283 audio_possible_drivers="oss alsa sdl esd pa"
284 linux="yes"
285 linux_user="yes"
286 usb="linux"
287 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
288 kqemu="yes"
289 audio_possible_drivers="$audio_possible_drivers fmod"
292 esac
294 if [ "$bsd" = "yes" ] ; then
295 if [ "$darwin" != "yes" ] ; then
296 make="gmake"
297 usb="bsd"
299 bsd_user="yes"
302 # find source path
303 source_path=`dirname "$0"`
304 source_path_used="no"
305 workdir=`pwd`
306 if [ -z "$source_path" ]; then
307 source_path=$workdir
308 else
309 source_path=`cd "$source_path"; pwd`
311 [ -f "$workdir/vl.c" ] || source_path_used="yes"
313 werror="no"
314 # generate compile errors on warnings for development builds
315 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
316 #werror="yes";
319 for opt do
320 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
321 case "$opt" in
322 --help|-h) show_help=yes
324 --prefix=*) prefix="$optarg"
326 --interp-prefix=*) interp_prefix="$optarg"
328 --source-path=*) source_path="$optarg"
329 source_path_used="yes"
331 --cross-prefix=*)
333 --cc=*)
335 --host-cc=*) host_cc="$optarg"
337 --make=*) make="$optarg"
339 --install=*) install="$optarg"
341 --extra-cflags=*) CFLAGS="$optarg"
343 --extra-ldflags=*) LDFLAGS="$optarg"
345 --cpu=*) cpu="$optarg"
347 --target-list=*) target_list="$optarg"
349 --enable-gprof) gprof="yes"
351 --static) static="yes"
353 --disable-sdl) sdl="no"
355 --enable-libspectrum) libspectrum="yes"
357 --fmod-lib=*) fmod_lib="$optarg"
359 --fmod-inc=*) fmod_inc="$optarg"
361 --oss-lib=*) oss_lib="$optarg"
363 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
365 --audio-drv-list=*) audio_drv_list="$optarg"
367 --enable-sparse) sparse="yes"
369 --disable-sparse) sparse="no"
371 --disable-vnc-tls) vnc_tls="no"
373 --disable-slirp) slirp="no"
375 --disable-vde) vde="no"
377 --disable-kqemu) kqemu="no"
379 --disable-brlapi) brlapi="no"
381 --disable-bluez) bluez="no"
383 --disable-kvm) kvm="no"
385 --enable-profiler) profiler="yes"
387 --enable-cocoa)
388 cocoa="yes" ;
389 sdl="no" ;
390 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
392 --disable-gfx-check) check_gfx="no"
394 --disable-system) softmmu="no"
396 --enable-system) softmmu="yes"
398 --disable-linux-user) linux_user="no"
400 --enable-linux-user) linux_user="yes"
402 --disable-darwin-user) darwin_user="no"
404 --enable-darwin-user) darwin_user="yes"
406 --disable-bsd-user) bsd_user="no"
408 --enable-bsd-user) bsd_user="yes"
410 --enable-uname-release=*) uname_release="$optarg"
412 --sparc_cpu=*)
413 sparc_cpu="$optarg"
414 case $sparc_cpu in
415 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
416 target_cpu="sparc"; cpu="sparc" ;;
417 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
418 target_cpu="sparc"; cpu="sparc" ;;
419 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
420 target_cpu="sparc64"; cpu="sparc64" ;;
421 *) echo "undefined SPARC architecture. Exiting";exit 1;;
422 esac
424 --enable-werror) werror="yes"
426 --disable-werror) werror="no"
428 --disable-curses) curses="no"
430 --disable-nptl) nptl="no"
432 --enable-mixemu) mixemu="yes"
434 --disable-aio) aio="no"
436 --disable-blobs) blobs="no"
438 --kerneldir=*) kerneldir="$optarg"
440 *) echo "ERROR: unknown option $opt"; show_help="yes"
442 esac
443 done
445 # default flags for all hosts
446 CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
447 CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
448 LDFLAGS="$LDFLAGS -g"
449 if test "$werror" = "yes" ; then
450 CFLAGS="$CFLAGS -Werror"
453 if test "$solaris" = "no" ; then
454 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
455 LDFLAGS="$LDFLAGS -Wl,--warn-common"
460 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
461 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
463 case "$cpu" in
464 sparc) if test -z "$sparc_cpu" ; then
465 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
466 ARCH_LDFLAGS="-m32"
467 else
468 ARCH_CFLAGS="${SP_CFLAGS}"
469 ARCH_LDFLAGS="${SP_LDFLAGS}"
472 sparc64) if test -z "$sparc_cpu" ; then
473 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
474 ARCH_LDFLAGS="-m64"
475 else
476 ARCH_CFLAGS="${SP_CFLAGS}"
477 ARCH_LDFLAGS="${SP_LDFLAGS}"
480 s390)
481 ARCH_CFLAGS="-march=z900"
483 i386)
484 ARCH_CFLAGS="-m32"
485 ARCH_LDFLAGS="-m32"
487 x86_64)
488 ARCH_CFLAGS="-m64"
489 ARCH_LDFLAGS="-m64"
491 esac
493 if test x"$show_help" = x"yes" ; then
494 cat << EOF
496 Usage: configure [options]
497 Options: [defaults in brackets after descriptions]
500 echo "Standard options:"
501 echo " --help print this message"
502 echo " --prefix=PREFIX install in PREFIX [$prefix]"
503 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
504 echo " use %M for cpu name [$interp_prefix]"
505 echo " --target-list=LIST set target list [$target_list]"
506 echo ""
507 echo "kqemu kernel acceleration support:"
508 echo " --disable-kqemu disable kqemu support"
509 echo ""
510 echo "Advanced options (experts only):"
511 echo " --source-path=PATH path of source code [$source_path]"
512 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
513 echo " --cc=CC use C compiler CC [$cc]"
514 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
515 echo " --make=MAKE use specified make [$make]"
516 echo " --install=INSTALL use specified install [$install]"
517 echo " --static enable static build [$static]"
518 echo " --enable-sparse enable sparse checker"
519 echo " --disable-sparse disable sparse checker (default)"
520 echo " --disable-werror disable compilation abort on warning"
521 echo " --disable-sdl disable SDL"
522 echo " --enable-cocoa enable COCOA (Mac OS X only)"
523 echo " --enable-libspectrum enable ZX Spectrum snapshot loading"
524 echo " --audio-drv-list=LIST set audio drivers list:"
525 echo " Available drivers: $audio_possible_drivers"
526 echo " --audio-card-list=LIST set list of additional emulated audio cards"
527 echo " Available cards: ac97 adlib cs4231a gus"
528 echo " --enable-mixemu enable mixer emulation"
529 echo " --disable-brlapi disable BrlAPI"
530 echo " --disable-vnc-tls disable TLS encryption for VNC server"
531 echo " --disable-curses disable curses output"
532 echo " --disable-bluez disable bluez stack connectivity"
533 echo " --disable-kvm disable KVM acceleration support"
534 echo " --disable-nptl disable usermode NPTL support"
535 echo " --enable-system enable all system emulation targets"
536 echo " --disable-system disable all system emulation targets"
537 echo " --enable-linux-user enable all linux usermode emulation targets"
538 echo " --disable-linux-user disable all linux usermode emulation targets"
539 echo " --enable-darwin-user enable all darwin usermode emulation targets"
540 echo " --disable-darwin-user disable all darwin usermode emulation targets"
541 echo " --enable-bsd-user enable all BSD usermode emulation targets"
542 echo " --disable-bsd-user disable all BSD usermode emulation targets"
543 echo " --fmod-lib path to FMOD library"
544 echo " --fmod-inc path to FMOD includes"
545 echo " --oss-lib path to OSS library"
546 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
547 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
548 echo " --disable-vde disable support for vde network"
549 echo " --disable-aio disable AIO support"
550 echo " --disable-blobs disable installing provided firmware blobs"
551 echo " --kerneldir=PATH look for kernel includes in PATH"
552 echo ""
553 echo "NOTE: The object files are built at the place where configure is launched"
554 exit 1
557 if test "$mingw32" = "yes" ; then
558 linux="no"
559 EXESUF=".exe"
560 oss="no"
561 linux_user="no"
562 bsd_user="no"
565 if test ! -x "$(which cgcc 2>/dev/null)"; then
566 sparse="no"
570 # Solaris specific configure tool chain decisions
572 if test "$solaris" = "yes" ; then
573 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
574 if test -z "$solinst" ; then
575 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
576 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
577 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
578 exit 1
580 if test "$solinst" = "/usr/sbin/install" ; then
581 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
582 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
583 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
584 exit 1
586 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
587 if test -z "$sol_ar" ; then
588 echo "Error: No path includes ar"
589 if test -f /usr/ccs/bin/ar ; then
590 echo "Add /usr/ccs/bin to your path and rerun configure"
592 exit 1
597 if test -z "$target_list" ; then
598 # these targets are portable
599 if [ "$softmmu" = "yes" ] ; then
600 target_list="\
601 i386-softmmu \
602 x86_64-softmmu \
603 arm-softmmu \
604 cris-softmmu \
605 m68k-softmmu \
606 mips-softmmu \
607 mipsel-softmmu \
608 mips64-softmmu \
609 mips64el-softmmu \
610 ppc-softmmu \
611 ppcemb-softmmu \
612 ppc64-softmmu \
613 sh4-softmmu \
614 sh4eb-softmmu \
615 sparc-softmmu \
616 z80-softmmu \
619 # the following are Linux specific
620 if [ "$linux_user" = "yes" ] ; then
621 target_list="${target_list}\
622 i386-linux-user \
623 x86_64-linux-user \
624 alpha-linux-user \
625 arm-linux-user \
626 armeb-linux-user \
627 cris-linux-user \
628 m68k-linux-user \
629 mips-linux-user \
630 mipsel-linux-user \
631 ppc-linux-user \
632 ppc64-linux-user \
633 ppc64abi32-linux-user \
634 sh4-linux-user \
635 sh4eb-linux-user \
636 sparc-linux-user \
637 sparc64-linux-user \
638 sparc32plus-linux-user \
641 # the following are Darwin specific
642 if [ "$darwin_user" = "yes" ] ; then
643 target_list="$target_list i386-darwin-user ppc-darwin-user"
645 # the following are BSD specific
646 if [ "$bsd_user" = "yes" ] ; then
647 target_list="${target_list}\
648 sparc64-bsd-user \
651 else
652 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
654 if test -z "$target_list" ; then
655 echo "No targets enabled"
656 exit 1
659 if test -z "$cross_prefix" ; then
661 # ---
662 # big/little endian test
663 cat > $TMPC << EOF
664 #include <inttypes.h>
665 int main(int argc, char ** argv){
666 volatile uint32_t i=0x01234567;
667 return (*((uint8_t*)(&i))) == 0x67;
671 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
672 $TMPE && bigendian="yes"
673 else
674 echo big/little test failed
677 else
679 # if cross compiling, cannot launch a program, so make a static guess
680 if test "$cpu" = "armv4b" \
681 -o "$cpu" = "hppa" \
682 -o "$cpu" = "m68k" \
683 -o "$cpu" = "mips" \
684 -o "$cpu" = "mips64" \
685 -o "$cpu" = "powerpc" \
686 -o "$cpu" = "s390" \
687 -o "$cpu" = "sparc" \
688 -o "$cpu" = "sparc64"; then
689 bigendian="yes"
694 # host long bits test
695 hostlongbits="32"
696 if test "$cpu" = "x86_64" \
697 -o "$cpu" = "alpha" \
698 -o "$cpu" = "ia64" \
699 -o "$cpu" = "sparc64"; then
700 hostlongbits="64"
703 # ppc specific hostlongbits selection
704 if test "$cpu" = "powerpc" ; then
705 if $cc $ARCH_CFLAGS -dM -E - -o $TMPI 2>/dev/null </dev/null; then
706 grep -q __powerpc64__ $TMPI && hostlongbits=64
707 else
708 echo hostlongbits test failed
709 exit 1
713 # check gcc options support
714 cat > $TMPC <<EOF
715 int main(void) {
719 # Check host NPTL support
720 cat > $TMPC <<EOF
721 #include <sched.h>
722 #include <linux/futex.h>
723 void foo()
725 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
726 #error bork
727 #endif
731 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
733 else
734 nptl="no"
737 ##########################################
738 # zlib check
740 cat > $TMPC << EOF
741 #include <zlib.h>
742 int main(void) { zlibVersion(); return 0; }
744 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
746 else
747 echo
748 echo "Error: zlib check failed"
749 echo "Make sure to have the zlib libs and headers installed."
750 echo
751 exit 1
754 ##########################################
755 # SDL probe
757 sdl_too_old=no
759 if test -z "$sdl" ; then
760 sdl_config="sdl-config"
761 sdl=no
762 sdl_static=no
764 cat > $TMPC << EOF
765 #include <SDL.h>
766 #undef main /* We don't want SDL to override our main() */
767 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
769 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
770 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
771 if test "$_sdlversion" -lt 121 ; then
772 sdl_too_old=yes
773 else
774 if test "$cocoa" = "no" ; then
775 sdl=yes
779 # static link with sdl ?
780 if test "$sdl" = "yes" ; then
781 aa="no"
782 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
783 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
784 if [ "$aa" = "yes" ] ; then
785 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
788 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then
789 sdl_static=yes
791 fi # static link
792 fi # sdl compile test
793 else
794 # Make sure to disable cocoa if sdl was set
795 if test "$sdl" = "yes" ; then
796 cocoa="no"
797 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
799 fi # -z $sdl
801 ##########################################
802 # VNC TLS detection
803 if test "$vnc_tls" = "yes" ; then
804 cat > $TMPC <<EOF
805 #include <gnutls/gnutls.h>
806 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
808 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
809 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
810 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
811 $vnc_tls_libs > /dev/null 2> /dev/null ; then
813 else
814 vnc_tls="no"
818 ##########################################
819 # vde libraries probe
820 if test "$vde" = "yes" ; then
821 cat > $TMPC << EOF
822 #include <libvdeplug.h>
823 int main(void)
825 struct vde_open_args a = {0, 0, 0};
826 vde_open("", "", &a);
827 return 0;
830 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
832 else
833 vde="no"
837 ##########################################
838 # Sound support libraries probe
840 audio_drv_probe()
842 drv=$1
843 hdr=$2
844 lib=$3
845 exp=$4
846 cfl=$5
847 cat > $TMPC << EOF
848 #include <$hdr>
849 int main(void) { $exp }
851 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
853 else
854 echo
855 echo "Error: $drv check failed"
856 echo "Make sure to have the $drv libs and headers installed."
857 echo
858 exit 1
862 audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
863 for drv in $audio_drv_list; do
864 case $drv in
865 alsa)
866 audio_drv_probe $drv alsa/asoundlib.h -lasound \
867 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
870 fmod)
871 if test -z $fmod_lib || test -z $fmod_inc; then
872 echo
873 echo "Error: You must specify path to FMOD library and headers"
874 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
875 echo
876 exit 1
878 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
881 esd)
882 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
886 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
887 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
890 oss|sdl|core|wav|dsound)
891 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
895 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
896 echo
897 echo "Error: Unknown driver '$drv' selected"
898 echo "Possible drivers are: $audio_possible_drivers"
899 echo
900 exit 1
903 esac
904 done
906 ##########################################
907 # BrlAPI probe
909 if test -z "$brlapi" ; then
910 brlapi=no
911 cat > $TMPC << EOF
912 #include <brlapi.h>
913 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
915 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
916 brlapi=yes
917 fi # brlapi compile test
918 fi # -z $brlapi
920 ##########################################
921 # curses probe
923 if test "$curses" = "yes" ; then
924 curses=no
925 cat > $TMPC << EOF
926 #include <curses.h>
927 int main(void) { return curses_version(); }
929 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
930 curses=yes
932 fi # test "$curses"
934 ##########################################
935 # bluez support probe
936 if test "$bluez" = "yes" ; then
937 `pkg-config bluez` || bluez="no"
939 if test "$bluez" = "yes" ; then
940 cat > $TMPC << EOF
941 #include <bluetooth/bluetooth.h>
942 int main(void) { return bt_error(0); }
944 bluez_cflags=`pkg-config --cflags bluez`
945 bluez_libs=`pkg-config --libs bluez`
946 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
947 $bluez_libs > /dev/null 2> /dev/null ; then
949 else
950 bluez="no"
954 ##########################################
955 # kvm probe
956 if test "$kvm" = "yes" ; then
957 cat > $TMPC <<EOF
958 #include <linux/kvm.h>
959 #if !defined(KVM_API_VERSION) || \
960 KVM_API_VERSION < 12 || \
961 KVM_API_VERSION > 12 || \
962 !defined(KVM_CAP_USER_MEMORY) || \
963 !defined(KVM_CAP_SET_TSS_ADDR) || \
964 !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
965 #error Invalid KVM version
966 #endif
967 int main(void) { return 0; }
969 if test "$kerneldir" != "" ; then
970 kvm_cflags=-I"$kerneldir"/include
971 else
972 kvm_cflags=""
974 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
975 > /dev/null 2>/dev/null ; then
977 else
978 kvm="no"
982 ##########################################
983 # AIO probe
984 AIOLIBS=""
986 if test "$aio" = "yes" ; then
987 aio=no
988 cat > $TMPC << EOF
989 #include <pthread.h>
990 int main(void) { pthread_mutex_t lock; return 0; }
992 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
993 aio=yes
994 AIOLIBS="-lpthread"
998 ##########################################
999 # iovec probe
1000 cat > $TMPC <<EOF
1001 #include <sys/uio.h>
1002 int main(void) { struct iovec iov; return 0; }
1004 iovec=no
1005 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1006 iovec=yes
1009 ##########################################
1010 # fdt probe
1011 if test "$fdt" = "yes" ; then
1012 fdt=no
1013 cat > $TMPC << EOF
1014 int main(void) { return 0; }
1016 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null ; then
1017 fdt=yes
1021 # Check if tools are available to build documentation.
1022 if [ -x "`which texi2html 2>/dev/null`" ] && \
1023 [ -x "`which pod2man 2>/dev/null`" ]; then
1024 build_docs="yes"
1027 ##########################################
1028 # Do we need librt
1029 cat > $TMPC <<EOF
1030 #include <signal.h>
1031 #include <time.h>
1032 int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1035 rt=no
1036 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1038 elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
1039 rt=yes
1042 if test "$rt" = "yes" ; then
1043 # Hack, we should have a general purpose LIBS for this sort of thing
1044 AIOLIBS="$AIOLIBS -lrt"
1047 if test "$mingw32" = "yes" ; then
1048 if test -z "$prefix" ; then
1049 prefix="c:\\\\Program Files\\\\Qemu"
1051 mansuffix=""
1052 datasuffix=""
1053 docsuffix=""
1054 binsuffix=""
1055 else
1056 if test -z "$prefix" ; then
1057 prefix="/usr/local"
1059 mansuffix="/share/man"
1060 datasuffix="/share/qemu"
1061 docsuffix="/share/doc/qemu"
1062 binsuffix="/bin"
1065 echo "Install prefix $prefix"
1066 echo "BIOS directory $prefix$datasuffix"
1067 echo "binary directory $prefix$binsuffix"
1068 if test "$mingw32" = "no" ; then
1069 echo "Manual directory $prefix$mansuffix"
1070 echo "ELF interp prefix $interp_prefix"
1072 echo "Source path $source_path"
1073 echo "C compiler $cc"
1074 echo "Host C compiler $host_cc"
1075 echo "ARCH_CFLAGS $ARCH_CFLAGS"
1076 echo "make $make"
1077 echo "install $install"
1078 echo "host CPU $cpu"
1079 echo "host big endian $bigendian"
1080 echo "target list $target_list"
1081 echo "gprof enabled $gprof"
1082 echo "sparse enabled $sparse"
1083 echo "profiler $profiler"
1084 echo "static build $static"
1085 echo "-Werror enabled $werror"
1086 if test "$darwin" = "yes" ; then
1087 echo "Cocoa support $cocoa"
1089 echo "SDL support $sdl"
1090 if test "$sdl" != "no" ; then
1091 echo "SDL static link $sdl_static"
1093 echo "curses support $curses"
1094 echo "mingw32 support $mingw32"
1095 echo "Audio drivers $audio_drv_list"
1096 echo "Extra audio cards $audio_card_list"
1097 echo "Mixer emulation $mixemu"
1098 echo "VNC TLS support $vnc_tls"
1099 if test "$vnc_tls" = "yes" ; then
1100 echo " TLS CFLAGS $vnc_tls_cflags"
1101 echo " TLS LIBS $vnc_tls_libs"
1103 if test -n "$sparc_cpu"; then
1104 echo "Target Sparc Arch $sparc_cpu"
1106 echo "libspec. support $libspectrum"
1107 echo "kqemu support $kqemu"
1108 echo "brlapi support $brlapi"
1109 echo "Documentation $build_docs"
1110 [ ! -z "$uname_release" ] && \
1111 echo "uname -r $uname_release"
1112 echo "NPTL support $nptl"
1113 echo "vde support $vde"
1114 echo "AIO support $aio"
1115 echo "Install blobs $blobs"
1116 echo "KVM support $kvm"
1117 echo "fdt support $fdt"
1119 if test $sdl_too_old = "yes"; then
1120 echo "-> Your SDL version is too old - please upgrade to have SDL support"
1122 if [ -s $TMPSDLLOG ]; then
1123 echo "The error log from compiling the libSDL test is: "
1124 cat $TMPSDLLOG
1126 #if test "$sdl_static" = "no"; then
1127 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1129 config_mak="config-host.mak"
1130 config_h="config-host.h"
1132 #echo "Creating $config_mak and $config_h"
1134 test -f $config_h && mv $config_h ${config_h}~
1136 echo "# Automatically generated by configure - do not modify" > $config_mak
1137 printf "# Configured with:" >> $config_mak
1138 printf " '%s'" "$0" "$@" >> $config_mak
1139 echo >> $config_mak
1140 echo "/* Automatically generated by configure - do not modify */" > $config_h
1142 echo "prefix=$prefix" >> $config_mak
1143 echo "bindir=\${prefix}$binsuffix" >> $config_mak
1144 echo "mandir=\${prefix}$mansuffix" >> $config_mak
1145 echo "datadir=\${prefix}$datasuffix" >> $config_mak
1146 echo "docdir=\${prefix}$docsuffix" >> $config_mak
1147 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
1148 echo "MAKE=$make" >> $config_mak
1149 echo "INSTALL=$install" >> $config_mak
1150 echo "CC=$cc" >> $config_mak
1151 echo "HOST_CC=$host_cc" >> $config_mak
1152 echo "AR=$ar" >> $config_mak
1153 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
1154 # XXX: only use CFLAGS and LDFLAGS ?
1155 # XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1156 # compilation of dyngen tool (useful for win32 build on Linux host)
1157 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
1158 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1159 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1160 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
1161 echo "CFLAGS=$CFLAGS" >> $config_mak
1162 echo "LDFLAGS=$LDFLAGS" >> $config_mak
1163 echo "EXESUF=$EXESUF" >> $config_mak
1164 echo "AIOLIBS=$AIOLIBS" >> $config_mak
1165 case "$cpu" in
1166 i386)
1167 echo "ARCH=i386" >> $config_mak
1168 echo "#define HOST_I386 1" >> $config_h
1170 x86_64)
1171 echo "ARCH=x86_64" >> $config_mak
1172 echo "#define HOST_X86_64 1" >> $config_h
1174 alpha)
1175 echo "ARCH=alpha" >> $config_mak
1176 echo "#define HOST_ALPHA 1" >> $config_h
1178 armv4b)
1179 echo "ARCH=arm" >> $config_mak
1180 echo "#define HOST_ARM 1" >> $config_h
1182 armv4l)
1183 echo "ARCH=arm" >> $config_mak
1184 echo "#define HOST_ARM 1" >> $config_h
1186 cris)
1187 echo "ARCH=cris" >> $config_mak
1188 echo "#define HOST_CRIS 1" >> $config_h
1190 hppa)
1191 echo "ARCH=hppa" >> $config_mak
1192 echo "#define HOST_HPPA 1" >> $config_h
1194 ia64)
1195 echo "ARCH=ia64" >> $config_mak
1196 echo "#define HOST_IA64 1" >> $config_h
1198 m68k)
1199 echo "ARCH=m68k" >> $config_mak
1200 echo "#define HOST_M68K 1" >> $config_h
1202 mips)
1203 echo "ARCH=mips" >> $config_mak
1204 echo "#define HOST_MIPS 1" >> $config_h
1206 mips64)
1207 echo "ARCH=mips64" >> $config_mak
1208 echo "#define HOST_MIPS64 1" >> $config_h
1210 powerpc)
1211 if test "$hostlongbits" = "32"; then
1212 echo "ARCH=ppc" >> $config_mak
1213 echo "#define HOST_PPC 1" >> $config_h
1214 else
1215 echo "ARCH=ppc64" >> $config_mak
1216 echo "#define HOST_PPC64 1" >> $config_h
1219 s390)
1220 echo "ARCH=s390" >> $config_mak
1221 echo "#define HOST_S390 1" >> $config_h
1223 sparc)
1224 echo "ARCH=sparc" >> $config_mak
1225 echo "#define HOST_SPARC 1" >> $config_h
1227 sparc64)
1228 echo "ARCH=sparc64" >> $config_mak
1229 echo "#define HOST_SPARC64 1" >> $config_h
1232 echo "Unsupported CPU = $cpu"
1233 exit 1
1235 esac
1236 if test "$sparse" = "yes" ; then
1237 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1238 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1239 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1241 if test "$bigendian" = "yes" ; then
1242 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1243 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1245 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
1246 if test "$mingw32" = "yes" ; then
1247 echo "CONFIG_WIN32=yes" >> $config_mak
1248 echo "#define CONFIG_WIN32 1" >> $config_h
1249 else
1250 cat > $TMPC << EOF
1251 #include <byteswap.h>
1252 int main(void) { return bswap_32(0); }
1254 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
1255 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1257 cat > $TMPC << EOF
1258 #include <sys/endian.h>
1259 #include <sys/types.h>
1260 #include <machine/bswap.h>
1261 int main(void) { return bswap32(0); }
1263 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
1264 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1268 if [ "$openbsd" = "yes" ] ; then
1269 echo "#define ENOTSUP 4096" >> $config_h
1272 if test "$darwin" = "yes" ; then
1273 echo "CONFIG_DARWIN=yes" >> $config_mak
1274 echo "#define CONFIG_DARWIN 1" >> $config_h
1277 if test "$aix" = "yes" ; then
1278 echo "CONFIG_AIX=yes" >> $config_mak
1279 echo "#define CONFIG_AIX 1" >> $config_h
1282 if test "$solaris" = "yes" ; then
1283 echo "CONFIG_SOLARIS=yes" >> $config_mak
1284 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
1285 if test "$needs_libsunmath" = "yes" ; then
1286 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1287 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1290 if test -n "$sparc_cpu"; then
1291 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1292 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1294 if test "$gdbstub" = "yes" ; then
1295 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1296 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1298 if test "$gprof" = "yes" ; then
1299 echo "TARGET_GPROF=yes" >> $config_mak
1300 echo "#define HAVE_GPROF 1" >> $config_h
1302 if test "$static" = "yes" ; then
1303 echo "CONFIG_STATIC=yes" >> $config_mak
1304 echo "#define CONFIG_STATIC 1" >> $config_h
1306 if test $profiler = "yes" ; then
1307 echo "#define CONFIG_PROFILER 1" >> $config_h
1309 if test "$slirp" = "yes" ; then
1310 echo "CONFIG_SLIRP=yes" >> $config_mak
1311 echo "#define CONFIG_SLIRP 1" >> $config_h
1313 if test "$vde" = "yes" ; then
1314 echo "CONFIG_VDE=yes" >> $config_mak
1315 echo "#define CONFIG_VDE 1" >> $config_h
1316 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1318 for card in $audio_card_list; do
1319 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
1320 echo "$def=yes" >> $config_mak
1321 echo "#define $def 1" >> $config_h
1322 done
1323 echo "#define AUDIO_DRIVERS \\" >> $config_h
1324 for drv in $audio_drv_list; do
1325 echo " &${drv}_audio_driver, \\" >>$config_h
1326 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
1327 echo "$def=yes" >> $config_mak
1328 if test "$drv" = "fmod"; then
1329 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1330 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1331 elif test "$drv" = "oss"; then
1332 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
1334 done
1335 echo "" >>$config_h
1336 if test "$mixemu" = "yes" ; then
1337 echo "CONFIG_MIXEMU=yes" >> $config_mak
1338 echo "#define CONFIG_MIXEMU 1" >> $config_h
1340 if test "$libspectrum" = "yes" ; then
1341 echo "CONFIG_LIBSPECTRUM=yes" >> $config_mak
1342 echo "#define CONFIG_LIBSPECTRUM 1" >> $config_h
1344 if test "$vnc_tls" = "yes" ; then
1345 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1346 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1347 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1348 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1350 qemu_version=`head $source_path/VERSION`
1351 echo "VERSION=$qemu_version" >>$config_mak
1352 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1354 echo "SRC_PATH=$source_path" >> $config_mak
1355 if [ "$source_path_used" = "yes" ]; then
1356 echo "VPATH=$source_path" >> $config_mak
1358 echo "TARGET_DIRS=$target_list" >> $config_mak
1359 if [ "$build_docs" = "yes" ] ; then
1360 echo "BUILD_DOCS=yes" >> $config_mak
1362 if test "$static" = "yes"; then
1363 sdl1=$sdl_static
1364 else
1365 sdl1=$sdl
1367 if test "$sdl1" = "yes" ; then
1368 echo "#define CONFIG_SDL 1" >> $config_h
1369 echo "CONFIG_SDL=yes" >> $config_mak
1370 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1371 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1372 else
1373 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1375 if [ "${aa}" = "yes" ] ; then
1376 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1377 else
1378 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1381 if test "$cocoa" = "yes" ; then
1382 echo "#define CONFIG_COCOA 1" >> $config_h
1383 echo "CONFIG_COCOA=yes" >> $config_mak
1385 if test "$curses" = "yes" ; then
1386 echo "#define CONFIG_CURSES 1" >> $config_h
1387 echo "CONFIG_CURSES=yes" >> $config_mak
1388 echo "CURSES_LIBS=-lcurses" >> $config_mak
1390 if test "$brlapi" = "yes" ; then
1391 echo "CONFIG_BRLAPI=yes" >> $config_mak
1392 echo "#define CONFIG_BRLAPI 1" >> $config_h
1393 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1395 if test "$bluez" = "yes" ; then
1396 echo "CONFIG_BLUEZ=yes" >> $config_mak
1397 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1398 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1399 echo "#define CONFIG_BLUEZ 1" >> $config_h
1401 if test "$aio" = "yes" ; then
1402 echo "#define CONFIG_AIO 1" >> $config_h
1403 echo "CONFIG_AIO=yes" >> $config_mak
1405 if test "$blobs" = "yes" ; then
1406 echo "INSTALL_BLOBS=yes" >> $config_mak
1408 if test "$iovec" = "yes" ; then
1409 echo "#define HAVE_IOVEC 1" >> $config_h
1411 if test "$fdt" = "yes" ; then
1412 echo "#define HAVE_FDT 1" >> $config_h
1413 echo "FDT_LIBS=-lfdt" >> $config_mak
1416 # XXX: suppress that
1417 if [ "$bsd" = "yes" ] ; then
1418 echo "#define O_LARGEFILE 0" >> $config_h
1419 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1420 echo "#define _BSD 1" >> $config_h
1423 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1425 # USB host support
1426 case "$usb" in
1427 linux)
1428 echo "HOST_USB=linux" >> $config_mak
1430 bsd)
1431 echo "HOST_USB=bsd" >> $config_mak
1434 echo "HOST_USB=stub" >> $config_mak
1436 esac
1438 tools=
1439 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1440 tools="qemu-img\$(EXESUF) $tools"
1441 if [ "$linux" = "yes" ] ; then
1442 tools="qemu-nbd\$(EXESUF) $tools"
1445 echo "TOOLS=$tools" >> $config_mak
1447 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1449 for target in $target_list; do
1450 target_dir="$target"
1451 config_mak=$target_dir/config.mak
1452 config_h=$target_dir/config.h
1453 target_cpu=`echo $target | cut -d '-' -f 1`
1454 target_bigendian="no"
1455 [ "$target_cpu" = "armeb" ] && target_bigendian=yes
1456 [ "$target_cpu" = "m68k" ] && target_bigendian=yes
1457 [ "$target_cpu" = "mips" ] && target_bigendian=yes
1458 [ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1459 [ "$target_cpu" = "mips64" ] && target_bigendian=yes
1460 [ "$target_cpu" = "ppc" ] && target_bigendian=yes
1461 [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
1462 [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
1463 [ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
1464 [ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
1465 [ "$target_cpu" = "sparc" ] && target_bigendian=yes
1466 [ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1467 [ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
1468 target_softmmu="no"
1469 target_user_only="no"
1470 target_linux_user="no"
1471 target_darwin_user="no"
1472 target_bsd_user="no"
1473 case "$target" in
1474 ${target_cpu}-softmmu)
1475 target_softmmu="yes"
1477 ${target_cpu}-linux-user)
1478 target_user_only="yes"
1479 target_linux_user="yes"
1481 ${target_cpu}-darwin-user)
1482 target_user_only="yes"
1483 target_darwin_user="yes"
1485 ${target_cpu}-bsd-user)
1486 target_user_only="yes"
1487 target_bsd_user="yes"
1490 echo "ERROR: Target '$target' not recognised"
1491 exit 1
1493 esac
1495 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1496 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1497 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1498 echo "To build QEMU without graphical output configure with --disable-gfx-check"
1499 echo "Note that this will disable all output from the virtual graphics card"
1500 echo "except through VNC or curses."
1501 exit 1;
1504 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1506 test -f $config_h && mv $config_h ${config_h}~
1508 mkdir -p $target_dir
1509 mkdir -p $target_dir/fpu
1510 mkdir -p $target_dir/tcg
1511 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
1512 mkdir -p $target_dir/nwfpe
1516 # don't use ln -sf as not all "ln -sf" over write the file/link
1518 rm -f $target_dir/Makefile
1519 ln -s $source_path/Makefile.target $target_dir/Makefile
1522 echo "# Automatically generated by configure - do not modify" > $config_mak
1523 echo "/* Automatically generated by configure - do not modify */" > $config_h
1526 echo "include ../config-host.mak" >> $config_mak
1527 echo "#include \"../config-host.h\"" >> $config_h
1529 bflt="no"
1530 elfload32="no"
1531 target_nptl="no"
1532 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1533 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1534 gdb_xml_files=""
1536 # Make sure the target and host cpus are compatible
1537 if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
1538 \( "$target_cpu" = "ppcemb" -a "$cpu" = "powerpc" \) -o \
1539 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1540 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
1541 kvm="no"
1543 # Disable KVM for linux-user
1544 if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1545 kvm="no"
1548 case "$target_cpu" in
1549 i386)
1550 echo "TARGET_ARCH=i386" >> $config_mak
1551 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1552 echo "#define TARGET_I386 1" >> $config_h
1553 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
1554 then
1555 echo "#define USE_KQEMU 1" >> $config_h
1557 if test "$kvm" = "yes" ; then
1558 echo "CONFIG_KVM=yes" >> $config_mak
1559 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1560 echo "#define CONFIG_KVM 1" >> $config_h
1563 x86_64)
1564 echo "TARGET_ARCH=x86_64" >> $config_mak
1565 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1566 echo "#define TARGET_I386 1" >> $config_h
1567 echo "#define TARGET_X86_64 1" >> $config_h
1568 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1569 then
1570 echo "#define USE_KQEMU 1" >> $config_h
1572 if test "$kvm" = "yes" ; then
1573 echo "CONFIG_KVM=yes" >> $config_mak
1574 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1575 echo "#define CONFIG_KVM 1" >> $config_h
1578 alpha)
1579 echo "TARGET_ARCH=alpha" >> $config_mak
1580 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1581 echo "#define TARGET_ALPHA 1" >> $config_h
1583 arm|armeb)
1584 echo "TARGET_ARCH=arm" >> $config_mak
1585 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1586 echo "#define TARGET_ARM 1" >> $config_h
1587 bflt="yes"
1588 target_nptl="yes"
1589 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
1591 cris)
1592 echo "TARGET_ARCH=cris" >> $config_mak
1593 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1594 echo "#define TARGET_CRIS 1" >> $config_h
1596 m68k)
1597 echo "TARGET_ARCH=m68k" >> $config_mak
1598 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1599 echo "#define TARGET_M68K 1" >> $config_h
1600 bflt="yes"
1601 gdb_xml_files="cf-core.xml cf-fp.xml"
1603 mips|mipsel)
1604 echo "TARGET_ARCH=mips" >> $config_mak
1605 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1606 echo "#define TARGET_MIPS 1" >> $config_h
1607 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1609 mipsn32|mipsn32el)
1610 echo "TARGET_ARCH=mipsn32" >> $config_mak
1611 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1612 echo "#define TARGET_MIPS 1" >> $config_h
1613 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1615 mips64|mips64el)
1616 echo "TARGET_ARCH=mips64" >> $config_mak
1617 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1618 echo "#define TARGET_MIPS 1" >> $config_h
1619 echo "#define TARGET_MIPS64 1" >> $config_h
1620 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1622 ppc)
1623 echo "TARGET_ARCH=ppc" >> $config_mak
1624 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1625 echo "#define TARGET_PPC 1" >> $config_h
1627 ppcemb)
1628 echo "TARGET_ARCH=ppcemb" >> $config_mak
1629 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1630 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1631 echo "#define TARGET_PPC 1" >> $config_h
1632 echo "#define TARGET_PPCEMB 1" >> $config_h
1633 if test "$kvm" = "yes" ; then
1634 echo "CONFIG_KVM=yes" >> $config_mak
1635 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1636 echo "#define CONFIG_KVM 1" >> $config_h
1639 ppc64)
1640 echo "TARGET_ARCH=ppc64" >> $config_mak
1641 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1642 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1643 echo "#define TARGET_PPC 1" >> $config_h
1644 echo "#define TARGET_PPC64 1" >> $config_h
1646 ppc64abi32)
1647 echo "TARGET_ARCH=ppc64" >> $config_mak
1648 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1649 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1650 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1651 echo "#define TARGET_PPC 1" >> $config_h
1652 echo "#define TARGET_PPC64 1" >> $config_h
1653 echo "#define TARGET_ABI32 1" >> $config_h
1655 sh4|sh4eb)
1656 echo "TARGET_ARCH=sh4" >> $config_mak
1657 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1658 echo "#define TARGET_SH4 1" >> $config_h
1659 bflt="yes"
1660 target_nptl="yes"
1662 sparc)
1663 echo "TARGET_ARCH=sparc" >> $config_mak
1664 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1665 echo "#define TARGET_SPARC 1" >> $config_h
1667 sparc64)
1668 echo "TARGET_ARCH=sparc64" >> $config_mak
1669 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1670 echo "#define TARGET_SPARC 1" >> $config_h
1671 echo "#define TARGET_SPARC64 1" >> $config_h
1672 elfload32="yes"
1674 sparc32plus)
1675 echo "TARGET_ARCH=sparc64" >> $config_mak
1676 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1677 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1678 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1679 echo "#define TARGET_SPARC 1" >> $config_h
1680 echo "#define TARGET_SPARC64 1" >> $config_h
1681 echo "#define TARGET_ABI32 1" >> $config_h
1683 z80)
1684 echo "TARGET_ARCH=z80" >> $config_mak
1685 echo "#define TARGET_ARCH \"z80\"" >> $config_h
1686 echo "#define TARGET_Z80 1" >> $config_h
1689 echo "Unsupported target CPU"
1690 exit 1
1692 esac
1693 if test "$target_bigendian" = "yes" ; then
1694 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1695 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1697 if test "$target_softmmu" = "yes" ; then
1698 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1699 echo "#define CONFIG_SOFTMMU 1" >> $config_h
1701 if test "$target_user_only" = "yes" ; then
1702 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1703 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1705 if test "$target_linux_user" = "yes" ; then
1706 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1707 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1709 if test "$target_darwin_user" = "yes" ; then
1710 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1711 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1713 list=""
1714 if test ! -z "$gdb_xml_files" ; then
1715 for x in $gdb_xml_files; do
1716 list="$list $source_path/gdb-xml/$x"
1717 done
1719 echo "TARGET_XML_FILES=$list" >> $config_mak
1721 if test "$target_cpu" = "arm" \
1722 -o "$target_cpu" = "armeb" \
1723 -o "$target_cpu" = "m68k" \
1724 -o "$target_cpu" = "mips" \
1725 -o "$target_cpu" = "mipsel" \
1726 -o "$target_cpu" = "mipsn32" \
1727 -o "$target_cpu" = "mipsn32el" \
1728 -o "$target_cpu" = "mips64" \
1729 -o "$target_cpu" = "mips64el" \
1730 -o "$target_cpu" = "ppc" \
1731 -o "$target_cpu" = "ppc64" \
1732 -o "$target_cpu" = "ppc64abi32" \
1733 -o "$target_cpu" = "ppcemb" \
1734 -o "$target_cpu" = "sparc" \
1735 -o "$target_cpu" = "sparc64" \
1736 -o "$target_cpu" = "sparc32plus"; then
1737 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1738 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1740 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1741 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1742 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1744 if test "$target_user_only" = "yes" \
1745 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1746 echo "#define USE_NPTL 1" >> $config_h
1748 # 32 bit ELF loader in addition to native 64 bit loader?
1749 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1750 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1751 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1753 if test "$target_bsd_user" = "yes" ; then
1754 echo "CONFIG_BSD_USER=yes" >> $config_mak
1755 echo "#define CONFIG_BSD_USER 1" >> $config_h
1758 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1760 done # for target in $targets
1762 # build tree in object directory if source path is different from current one
1763 if test "$source_path_used" = "yes" ; then
1764 DIRS="tests tests/cris slirp audio"
1765 FILES="Makefile tests/Makefile"
1766 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
1767 FILES="$FILES tests/test-mmap.c"
1768 for dir in $DIRS ; do
1769 mkdir -p $dir
1770 done
1771 # remove the link and recreate it, as not all "ln -sf" overwrite the link
1772 for f in $FILES ; do
1773 rm -f $f
1774 ln -s $source_path/$f $f
1775 done