Fix ARM VFP debugging dumps.
[qemu/mini2440.git] / configure
blob84f8ee099039f3fc985927458819d3db164a4c8c
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"
19 # default parameters
20 prefix=""
21 interp_prefix="/usr/gnemul/qemu-%M"
22 static="no"
23 cross_prefix=""
24 cc="gcc"
25 host_cc="gcc"
26 ar="ar"
27 make="make"
28 install="install"
29 strip="strip"
30 cpu=`uname -m`
31 target_list=""
32 case "$cpu" in
33 i386|i486|i586|i686|i86pc|BePC)
34 cpu="i386"
36 armv*b)
37 cpu="armv4b"
39 armv*l)
40 cpu="armv4l"
42 alpha)
43 cpu="alpha"
45 "Power Macintosh"|ppc|ppc64)
46 cpu="powerpc"
48 mips)
49 cpu="mips"
51 s390)
52 cpu="s390"
54 sparc|sun4[muv])
55 cpu="sparc"
57 sparc64)
58 cpu="sparc64"
60 ia64)
61 cpu="ia64"
63 m68k)
64 cpu="m68k"
66 x86_64|amd64)
67 cpu="x86_64"
70 cpu="unknown"
72 esac
73 gprof="no"
74 bigendian="no"
75 mingw32="no"
76 EXESUF=""
77 gdbstub="yes"
78 slirp="yes"
79 adlib="no"
80 oss="no"
81 dsound="no"
82 coreaudio="no"
83 alsa="no"
84 fmod="no"
85 fmod_lib=""
86 fmod_inc=""
87 bsd="no"
88 linux="no"
89 kqemu="no"
90 profiler="no"
91 cocoa="no"
92 check_gfx="yes"
93 check_gcc="yes"
94 softmmu="yes"
95 user="no"
96 build_docs="no"
97 uname_release=""
99 # OS specific
100 targetos=`uname -s`
101 case $targetos in
102 CYGWIN*)
103 mingw32="yes"
104 CFLAGS="-O2 -mno-cygwin"
106 MINGW32*)
107 mingw32="yes"
109 FreeBSD)
110 bsd="yes"
111 oss="yes"
112 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
113 kqemu="yes"
116 NetBSD)
117 bsd="yes"
118 oss="yes"
120 OpenBSD)
121 bsd="yes"
122 oss="yes"
124 Darwin)
125 bsd="yes"
126 darwin="yes"
128 SunOS)
129 solaris="yes"
132 oss="yes"
133 linux="yes"
134 user="yes"
135 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
136 kqemu="yes"
139 esac
141 if [ "$bsd" = "yes" ] ; then
142 if [ "$darwin" != "yes" ] ; then
143 make="gmake"
147 if [ "$solaris" = "yes" ] ; then
148 make="gmake"
149 install="ginstall"
150 solarisrev=`uname -r | cut -f2 -d.`
153 # find source path
154 source_path=`dirname "$0"`
155 if [ -z "$source_path" ]; then
156 source_path=`pwd`
157 else
158 source_path=`cd "$source_path"; pwd`
160 if test "$source_path" = `pwd` ; then
161 source_path_used="no"
162 else
163 source_path_used="yes"
166 for opt do
167 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
168 case "$opt" in
169 --help|-h) show_help=yes
171 --prefix=*) prefix="$optarg"
173 --interp-prefix=*) interp_prefix="$optarg"
175 --source-path=*) source_path="$optarg"
176 source_path_used="yes"
178 --cross-prefix=*) cross_prefix="$optarg"
180 --cc=*) cc="$optarg"
182 --host-cc=*) host_cc="$optarg"
184 --make=*) make="$optarg"
186 --install=*) install="$optarg"
188 --extra-cflags=*) CFLAGS="$optarg"
190 --extra-ldflags=*) LDFLAGS="$optarg"
192 --cpu=*) cpu="$optarg"
194 --target-list=*) target_list="$optarg"
196 --enable-gprof) gprof="yes"
198 --static) static="yes"
200 --disable-sdl) sdl="no"
202 --enable-coreaudio) coreaudio="yes"
204 --enable-alsa) alsa="yes"
206 --enable-dsound) dsound="yes"
208 --enable-fmod) fmod="yes"
210 --fmod-lib=*) fmod_lib="$optarg"
212 --fmod-inc=*) fmod_inc="$optarg"
214 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; user="no"
216 --disable-slirp) slirp="no"
218 --enable-adlib) adlib="yes"
220 --disable-kqemu) kqemu="no"
222 --enable-profiler) profiler="yes"
224 --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
226 --disable-gfx-check) check_gfx="no"
228 --disable-gcc-check) check_gcc="no"
230 --disable-system) softmmu="no"
232 --enable-system) softmmu="yes"
234 --disable-user) user="no"
236 --enable-user) user="yes"
238 --enable-uname-release=*) uname_release="$optarg"
240 esac
241 done
243 # Checking for CFLAGS
244 if test -z "$CFLAGS"; then
245 CFLAGS="-O2"
248 if test x"$show_help" = x"yes" ; then
249 cat << EOF
251 Usage: configure [options]
252 Options: [defaults in brackets after descriptions]
255 echo "Standard options:"
256 echo " --help print this message"
257 echo " --prefix=PREFIX install in PREFIX [$prefix]"
258 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
259 echo " use %M for cpu name [$interp_prefix]"
260 echo " --target-list=LIST set target list [$target_list]"
261 echo ""
262 echo "kqemu kernel acceleration support:"
263 echo " --disable-kqemu disable kqemu support"
264 echo ""
265 echo "Advanced options (experts only):"
266 echo " --source-path=PATH path of source code [$source_path]"
267 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
268 echo " --cc=CC use C compiler CC [$cc]"
269 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
270 echo " --make=MAKE use specified make [$make]"
271 echo " --install=INSTALL use specified install [$install]"
272 echo " --static enable static build [$static]"
273 echo " --enable-cocoa enable COCOA (Mac OS X only)"
274 echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
275 echo " --enable-adlib enable Adlib emulation"
276 echo " --enable-coreaudio enable Coreaudio audio driver"
277 echo " --enable-alsa enable ALSA audio driver"
278 echo " --enable-fmod enable FMOD audio driver"
279 echo " --enabled-dsound enable DirectSound audio driver"
280 echo " --enable-system enable all system emulation targets"
281 echo " --disable-system disable all system emulation targets"
282 echo " --enable-user enable all linux usermode emulation targets"
283 echo " --disable-user disable all linux usermode emulation targets"
284 echo " --fmod-lib path to FMOD library"
285 echo " --fmod-inc path to FMOD includes"
286 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
287 echo ""
288 echo "NOTE: The object files are build at the place where configure is launched"
289 exit 1
292 cc="${cross_prefix}${cc}"
293 ar="${cross_prefix}${ar}"
294 strip="${cross_prefix}${strip}"
296 # check that the C compiler works.
297 cat > $TMPC <<EOF
298 int main(void) {}
301 if $cc -c -o $TMPO $TMPC 2>/dev/null ; then
302 : C compiler works ok
303 else
304 echo "ERROR: \"$cc\" either does not exist or does not work"
305 exit 1
308 if test "$mingw32" = "yes" ; then
309 linux="no"
310 EXESUF=".exe"
311 oss="no"
312 if [ "$cpu" = "i386" ] ; then
313 kqemu="yes"
318 # Solaris specific configure tool chain decisions
320 if test "$solaris" = "yes" ; then
322 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
323 # override the check with --disable-gcc-check
325 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
326 solgcc=`which $cc`
327 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
328 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
329 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
330 echo "or get the latest patch from SunSolve for gcc"
331 exit 1
334 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
335 if test -z "$solinst" ; then
336 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
337 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
338 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
339 exit 1
341 if test "$solinst" = "/usr/sbin/install" ; then
342 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
343 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
344 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
345 exit 1
347 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
348 if test -z "$sol_ar" ; then
349 echo "Error: No path includes ar"
350 if test -f /usr/ccs/bin/ar ; then
351 echo "Add /usr/ccs/bin to your path and rerun configure"
353 exit 1
358 if test -z "$target_list" ; then
359 # these targets are portable
360 if [ "$softmmu" = "yes" ] ; then
361 target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu"
363 # the following are Linux specific
364 if [ "$user" = "yes" ] ; then
365 target_list="i386-user arm-user armeb-user sparc-user ppc-user mips-user mipsel-user m68k-user $target_list"
367 else
368 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
370 if test -z "$target_list" ; then
371 echo "No targets enabled"
372 exit 1
375 if test -z "$cross_prefix" ; then
377 # ---
378 # big/little endian test
379 cat > $TMPC << EOF
380 #include <inttypes.h>
381 int main(int argc, char ** argv){
382 volatile uint32_t i=0x01234567;
383 return (*((uint8_t*)(&i))) == 0x67;
387 if $cc -o $TMPE $TMPC 2>/dev/null ; then
388 $TMPE && bigendian="yes"
389 else
390 echo big/little test failed
393 else
395 # if cross compiling, cannot launch a program, so make a static guess
396 if test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then
397 bigendian="yes"
402 # host long bits test
403 hostlongbits="32"
404 if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
405 hostlongbits="64"
408 # check gcc options support
409 cat > $TMPC <<EOF
410 int main(void) {
414 have_gcc3_options="no"
415 if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
416 have_gcc3_options="yes"
419 # Check for gcc4, error if pre-gcc4
420 if test "$check_gcc" = "yes" ; then
421 cat > $TMPC <<EOF
422 #if __GNUC__ < 4
423 #error gcc3
424 #endif
425 int main(){return 0;}
427 if $cc -o $TMPO $TMPC 2>/dev/null ; then
428 echo "ERROR: \"$cc\" looks like gcc 4.x"
429 echo "QEMU is known to have problems when compiled with gcc 4.x"
430 echo "It is recommended that you use gcc 3.x to build QEMU"
431 echo "To use this compiler anyway, configure with --disable-gcc-check"
432 exit 1;
436 ##########################################
437 # SDL probe
439 sdl_too_old=no
441 if test -z "$sdl" ; then
443 sdl_config="sdl-config"
444 sdl=no
445 sdl_static=no
447 if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
448 # win32 cross compilation case
449 sdl_config="i386-mingw32msvc-sdl-config"
450 sdl=yes
451 else
452 # normal SDL probe
453 cat > $TMPC << EOF
454 #include <SDL.h>
455 #undef main /* We don't want SDL to override our main() */
456 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
459 if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
460 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
461 if test "$_sdlversion" -lt 121 ; then
462 sdl_too_old=yes
463 else
464 sdl=yes
467 # static link with sdl ?
468 if test "$sdl" = "yes" ; then
469 aa="no"
470 `$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
471 sdl_static_libs=`$sdl_config --static-libs`
472 if [ "$aa" = "yes" ] ; then
473 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
476 if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
477 sdl_static=yes
480 fi # static link
482 fi # sdl compile test
484 fi # cross compilation
485 fi # -z $sdl
487 # Check if tools are available to build documentation.
488 if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
489 build_docs="yes"
492 if test "$mingw32" = "yes" ; then
493 if test -z "$prefix" ; then
494 prefix="/c/Program Files/Qemu"
496 mandir="$prefix"
497 datadir="$prefix"
498 docdir="$prefix"
499 bindir="$prefix"
500 else
501 if test -z "$prefix" ; then
502 prefix="/usr/local"
504 mandir="$prefix/share/man"
505 datadir="$prefix/share/qemu"
506 docdir="$prefix/share/doc/qemu"
507 bindir="$prefix/bin"
510 echo "Install prefix $prefix"
511 echo "BIOS directory $datadir"
512 echo "binary directory $bindir"
513 if test "$mingw32" = "no" ; then
514 echo "Manual directory $mandir"
515 echo "ELF interp prefix $interp_prefix"
517 echo "Source path $source_path"
518 echo "C compiler $cc"
519 echo "Host C compiler $host_cc"
520 echo "make $make"
521 echo "install $install"
522 echo "host CPU $cpu"
523 echo "host big endian $bigendian"
524 echo "target list $target_list"
525 echo "gprof enabled $gprof"
526 echo "profiler $profiler"
527 echo "static build $static"
528 if test "$darwin" = "yes" ; then
529 echo "Cocoa support $cocoa"
531 echo "SDL support $sdl"
532 if test "$sdl" != "no" ; then
533 echo "SDL static link $sdl_static"
535 echo "mingw32 support $mingw32"
536 echo "Adlib support $adlib"
537 echo "CoreAudio support $coreaudio"
538 echo "ALSA support $alsa"
539 echo "DSound support $dsound"
540 if test "$fmod" = "yes"; then
541 if test -z $fmod_lib || test -z $fmod_inc; then
542 echo
543 echo "Error: You must specify path to FMOD library and headers"
544 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
545 echo
546 exit 1
548 fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
549 else
550 fmod_support=""
552 echo "FMOD support $fmod $fmod_support"
553 echo "kqemu support $kqemu"
554 echo "Documentation $build_docs"
555 [ ! -z "$uname_release" ] && \
556 echo "uname -r $uname_release"
558 if test $sdl_too_old = "yes"; then
559 echo "-> Your SDL version is too old - please upgrade to have SDL support"
561 #if test "$sdl_static" = "no"; then
562 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
564 config_mak="config-host.mak"
565 config_h="config-host.h"
567 #echo "Creating $config_mak and $config_h"
569 echo "# Automatically generated by configure - do not modify" > $config_mak
570 echo "# Configured with: $0 $@" >> $config_mak
571 echo "/* Automatically generated by configure - do not modify */" > $config_h
573 echo "prefix=$prefix" >> $config_mak
574 echo "bindir=$bindir" >> $config_mak
575 echo "mandir=$mandir" >> $config_mak
576 echo "datadir=$datadir" >> $config_mak
577 echo "docdir=$docdir" >> $config_mak
578 echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
579 echo "MAKE=$make" >> $config_mak
580 echo "INSTALL=$install" >> $config_mak
581 echo "CC=$cc" >> $config_mak
582 if test "$have_gcc3_options" = "yes" ; then
583 echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
585 echo "HOST_CC=$host_cc" >> $config_mak
586 echo "AR=$ar" >> $config_mak
587 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
588 echo "CFLAGS=$CFLAGS" >> $config_mak
589 echo "LDFLAGS=$LDFLAGS" >> $config_mak
590 echo "EXESUF=$EXESUF" >> $config_mak
591 if test "$cpu" = "i386" ; then
592 echo "ARCH=i386" >> $config_mak
593 echo "#define HOST_I386 1" >> $config_h
594 elif test "$cpu" = "x86_64" ; then
595 echo "ARCH=x86_64" >> $config_mak
596 echo "#define HOST_X86_64 1" >> $config_h
597 elif test "$cpu" = "armv4b" ; then
598 echo "ARCH=arm" >> $config_mak
599 echo "#define HOST_ARM 1" >> $config_h
600 elif test "$cpu" = "armv4l" ; then
601 echo "ARCH=arm" >> $config_mak
602 echo "#define HOST_ARM 1" >> $config_h
603 elif test "$cpu" = "powerpc" ; then
604 echo "ARCH=ppc" >> $config_mak
605 echo "#define HOST_PPC 1" >> $config_h
606 elif test "$cpu" = "mips" ; then
607 echo "ARCH=mips" >> $config_mak
608 echo "#define HOST_MIPS 1" >> $config_h
609 elif test "$cpu" = "s390" ; then
610 echo "ARCH=s390" >> $config_mak
611 echo "#define HOST_S390 1" >> $config_h
612 elif test "$cpu" = "alpha" ; then
613 echo "ARCH=alpha" >> $config_mak
614 echo "#define HOST_ALPHA 1" >> $config_h
615 elif test "$cpu" = "sparc" ; then
616 echo "ARCH=sparc" >> $config_mak
617 echo "#define HOST_SPARC 1" >> $config_h
618 elif test "$cpu" = "sparc64" ; then
619 echo "ARCH=sparc64" >> $config_mak
620 echo "#define HOST_SPARC64 1" >> $config_h
621 elif test "$cpu" = "ia64" ; then
622 echo "ARCH=ia64" >> $config_mak
623 echo "#define HOST_IA64 1" >> $config_h
624 elif test "$cpu" = "m68k" ; then
625 echo "ARCH=m68k" >> $config_mak
626 echo "#define HOST_M68K 1" >> $config_h
627 else
628 echo "Unsupported CPU"
629 exit 1
631 if test "$bigendian" = "yes" ; then
632 echo "WORDS_BIGENDIAN=yes" >> $config_mak
633 echo "#define WORDS_BIGENDIAN 1" >> $config_h
635 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
636 if test "$mingw32" = "yes" ; then
637 echo "CONFIG_WIN32=yes" >> $config_mak
638 echo "#define CONFIG_WIN32 1" >> $config_h
639 elif test -f "/usr/include/byteswap.h" ; then
640 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
642 if test "$darwin" = "yes" ; then
643 echo "CONFIG_DARWIN=yes" >> $config_mak
644 echo "#define CONFIG_DARWIN 1" >> $config_h
646 if test "$solaris" = "yes" ; then
647 echo "CONFIG_SOLARIS=yes" >> $config_mak
648 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
650 if test "$gdbstub" = "yes" ; then
651 echo "CONFIG_GDBSTUB=yes" >> $config_mak
652 echo "#define CONFIG_GDBSTUB 1" >> $config_h
654 if test "$gprof" = "yes" ; then
655 echo "TARGET_GPROF=yes" >> $config_mak
656 echo "#define HAVE_GPROF 1" >> $config_h
658 if test "$static" = "yes" ; then
659 echo "CONFIG_STATIC=yes" >> $config_mak
660 echo "#define CONFIG_STATIC 1" >> $config_h
662 if test $profiler = "yes" ; then
663 echo "#define CONFIG_PROFILER 1" >> $config_h
665 if test "$slirp" = "yes" ; then
666 echo "CONFIG_SLIRP=yes" >> $config_mak
667 echo "#define CONFIG_SLIRP 1" >> $config_h
669 if test "$adlib" = "yes" ; then
670 echo "CONFIG_ADLIB=yes" >> $config_mak
671 echo "#define CONFIG_ADLIB 1" >> $config_h
673 if test "$oss" = "yes" ; then
674 echo "CONFIG_OSS=yes" >> $config_mak
675 echo "#define CONFIG_OSS 1" >> $config_h
677 if test "$coreaudio" = "yes" ; then
678 echo "CONFIG_COREAUDIO=yes" >> $config_mak
679 echo "#define CONFIG_COREAUDIO 1" >> $config_h
681 if test "$alsa" = "yes" ; then
682 echo "CONFIG_ALSA=yes" >> $config_mak
683 echo "#define CONFIG_ALSA 1" >> $config_h
685 if test "$dsound" = "yes" ; then
686 echo "CONFIG_DSOUND=yes" >> $config_mak
687 echo "#define CONFIG_DSOUND 1" >> $config_h
689 if test "$fmod" = "yes" ; then
690 echo "CONFIG_FMOD=yes" >> $config_mak
691 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
692 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
693 echo "#define CONFIG_FMOD 1" >> $config_h
695 qemu_version=`head $source_path/VERSION`
696 echo "VERSION=$qemu_version" >>$config_mak
697 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
699 echo "SRC_PATH=$source_path" >> $config_mak
700 if [ "$source_path_used" = "yes" ]; then
701 echo "VPATH=$source_path" >> $config_mak
703 echo "TARGET_DIRS=$target_list" >> $config_mak
704 if [ "$build_docs" = "yes" ] ; then
705 echo "BUILD_DOCS=yes" >> $config_mak
708 # XXX: suppress that
709 if [ "$bsd" = "yes" ] ; then
710 echo "#define O_LARGEFILE 0" >> $config_h
711 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
712 echo "#define _BSD 1" >> $config_h
715 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
717 for target in $target_list; do
718 target_dir="$target"
719 config_mak=$target_dir/config.mak
720 config_h=$target_dir/config.h
721 target_cpu=`echo $target | cut -d '-' -f 1`
722 target_bigendian="no"
723 [ "$target_cpu" = "armeb" ] && target_bigendian=yes
724 [ "$target_cpu" = "sparc" ] && target_bigendian=yes
725 [ "$target_cpu" = "sparc64" ] && target_bigendian=yes
726 [ "$target_cpu" = "ppc" ] && target_bigendian=yes
727 [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
728 [ "$target_cpu" = "mips" ] && target_bigendian=yes
729 [ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
730 [ "$target_cpu" = "m68k" ] && target_bigendian=yes
731 target_softmmu="no"
732 if expr $target : '.*-softmmu' > /dev/null ; then
733 target_softmmu="yes"
735 target_user_only="no"
736 if expr $target : '.*-user' > /dev/null ; then
737 target_user_only="yes"
740 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
741 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
742 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
743 echo "To build QEMU without graphical output configure with --disable-gfx-check"
744 echo "Note that this will disable all output from the virtual graphics card."
745 exit 1;
748 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
750 mkdir -p $target_dir
751 mkdir -p $target_dir/fpu
752 if test "$target" = "arm-user" -o "$target" = "armeb-user" ; then
753 mkdir -p $target_dir/nwfpe
755 if test "$target_user_only" = "no" ; then
756 mkdir -p $target_dir/slirp
760 # don't use ln -sf as not all "ln -sf" over write the file/link
762 rm -f $target_dir/Makefile
763 ln -s $source_path/Makefile.target $target_dir/Makefile
766 echo "# Automatically generated by configure - do not modify" > $config_mak
767 echo "/* Automatically generated by configure - do not modify */" > $config_h
770 echo "include ../config-host.mak" >> $config_mak
771 echo "#include \"../config-host.h\"" >> $config_h
773 bflt="no"
774 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
775 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
777 if test "$target_cpu" = "i386" ; then
778 echo "TARGET_ARCH=i386" >> $config_mak
779 echo "#define TARGET_ARCH \"i386\"" >> $config_h
780 echo "#define TARGET_I386 1" >> $config_h
781 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
782 echo "#define USE_KQEMU 1" >> $config_h
784 elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
785 echo "TARGET_ARCH=arm" >> $config_mak
786 echo "#define TARGET_ARCH \"arm\"" >> $config_h
787 echo "#define TARGET_ARM 1" >> $config_h
788 bflt="yes"
789 elif test "$target_cpu" = "sparc" ; then
790 echo "TARGET_ARCH=sparc" >> $config_mak
791 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
792 echo "#define TARGET_SPARC 1" >> $config_h
793 elif test "$target_cpu" = "sparc64" ; then
794 echo "TARGET_ARCH=sparc64" >> $config_mak
795 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
796 echo "#define TARGET_SPARC 1" >> $config_h
797 echo "#define TARGET_SPARC64 1" >> $config_h
798 elif test "$target_cpu" = "ppc" ; then
799 echo "TARGET_ARCH=ppc" >> $config_mak
800 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
801 echo "#define TARGET_PPC 1" >> $config_h
802 elif test "$target_cpu" = "ppc64" ; then
803 echo "TARGET_ARCH=ppc64" >> $config_mak
804 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
805 echo "#define TARGET_PPC 1" >> $config_h
806 echo "#define TARGET_PPC64 1" >> $config_h
807 elif test "$target_cpu" = "x86_64" ; then
808 echo "TARGET_ARCH=x86_64" >> $config_mak
809 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
810 echo "#define TARGET_I386 1" >> $config_h
811 echo "#define TARGET_X86_64 1" >> $config_h
812 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then
813 echo "#define USE_KQEMU 1" >> $config_h
815 elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
816 echo "TARGET_ARCH=mips" >> $config_mak
817 echo "#define TARGET_ARCH \"mips\"" >> $config_h
818 echo "#define TARGET_MIPS 1" >> $config_h
819 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
820 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
821 elif test "$target_cpu" = "sh4" -o "$target_cpu" = "sh4eb" ; then
822 echo "TARGET_ARCH=sh4" >> $config_mak
823 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
824 echo "#define TARGET_SH4 1" >> $config_h
825 bflt="yes"
826 elif test "$target_cpu" = "m68k" ; then
827 echo "TARGET_ARCH=m68k" >> $config_mak
828 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
829 echo "#define TARGET_M68K 1" >> $config_h
830 bflt="yes"
831 else
832 echo "Unsupported target CPU"
833 exit 1
835 if test "$target_bigendian" = "yes" ; then
836 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
837 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
839 if test "$target_softmmu" = "yes" ; then
840 echo "CONFIG_SOFTMMU=yes" >> $config_mak
841 echo "#define CONFIG_SOFTMMU 1" >> $config_h
843 if test "$target_user_only" = "yes" ; then
844 echo "CONFIG_USER_ONLY=yes" >> $config_mak
845 echo "#define CONFIG_USER_ONLY 1" >> $config_h
848 if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" -o "$target_cpu" = "sparc" -o "$target_cpu" = "sparc64" -o "$target_cpu" = "m68k"; then
849 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
850 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
852 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
853 echo "TARGET_HAS_BFLT=yes" >> $config_mak
854 echo "#define TARGET_HAS_BFLT 1" >> $config_h
856 # sdl defines
858 if test "$target_user_only" = "no"; then
859 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
860 sdl1=$sdl_static
861 else
862 sdl1=$sdl
864 if test "$sdl1" = "yes" ; then
865 echo "#define CONFIG_SDL 1" >> $config_h
866 echo "CONFIG_SDL=yes" >> $config_mak
867 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
868 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
869 else
870 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
872 if [ "${aa}" = "yes" ] ; then
873 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
874 else
875 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
880 if test "$cocoa" = "yes" ; then
881 echo "#define CONFIG_COCOA 1" >> $config_h
882 echo "CONFIG_COCOA=yes" >> $config_mak
885 done # for target in $targets
887 # build tree in object directory if source path is different from current one
888 if test "$source_path_used" = "yes" ; then
889 DIRS="tests"
890 FILES="Makefile tests/Makefile"
891 for dir in $DIRS ; do
892 mkdir -p $dir
893 done
894 # remove the link and recreate it, as not all "ln -sf" overwrite the link
895 for f in $FILES ; do
896 rm -f $f
897 ln -s $source_path/$f $f
898 done
901 rm -f $TMPO $TMPC $TMPE $TMPS