ARM 64-bit host fix.
[qemu/mini2440.git] / configure
blobe6c74e4ec55dfdabafc557f6667c7d8dd295d1d5
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 kernel_path=""
92 cocoa="no"
93 check_gfx="yes"
94 check_gcc="yes"
95 softmmu="yes"
96 user="no"
97 build_docs="no"
98 build_acpi_tables="no"
99 uname_release=""
101 # OS specific
102 targetos=`uname -s`
103 case $targetos in
104 CYGWIN*)
105 mingw32="yes"
106 CFLAGS="-O2 -mno-cygwin"
108 MINGW32*)
109 mingw32="yes"
111 FreeBSD)
112 bsd="yes"
113 oss="yes"
114 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
115 kqemu="yes"
118 NetBSD)
119 bsd="yes"
120 oss="yes"
122 OpenBSD)
123 bsd="yes"
124 oss="yes"
126 Darwin)
127 bsd="yes"
128 darwin="yes"
130 SunOS)
131 solaris="yes"
134 oss="yes"
135 linux="yes"
136 user="yes"
137 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
138 kqemu="yes"
141 esac
143 if [ "$bsd" = "yes" ] ; then
144 if [ "$darwin" != "yes" ] ; then
145 make="gmake"
149 if [ "$solaris" = "yes" ] ; then
150 make="gmake"
151 install="ginstall"
152 solarisrev=`uname -r | cut -f2 -d.`
155 # find source path
156 source_path=`dirname "$0"`
157 if [ -z "$source_path" ]; then
158 source_path=`pwd`
159 else
160 source_path=`cd "$source_path"; pwd`
162 if test "$source_path" = `pwd` ; then
163 source_path_used="no"
164 else
165 source_path_used="yes"
168 for opt do
169 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
170 case "$opt" in
171 --help|-h) show_help=yes
173 --prefix=*) prefix="$optarg"
175 --interp-prefix=*) interp_prefix="$optarg"
177 --source-path=*) source_path="$optarg"
178 source_path_used="yes"
180 --cross-prefix=*) cross_prefix="$optarg"
182 --cc=*) cc="$optarg"
184 --host-cc=*) host_cc="$optarg"
186 --make=*) make="$optarg"
188 --install=*) install="$optarg"
190 --extra-cflags=*) CFLAGS="$optarg"
192 --extra-ldflags=*) LDFLAGS="$optarg"
194 --cpu=*) cpu="$optarg"
196 --target-list=*) target_list="$optarg"
198 --enable-gprof) gprof="yes"
200 --static) static="yes"
202 --disable-sdl) sdl="no"
204 --enable-coreaudio) coreaudio="yes"
206 --enable-alsa) alsa="yes"
208 --enable-dsound) dsound="yes"
210 --enable-fmod) fmod="yes"
212 --fmod-lib=*) fmod_lib="$optarg"
214 --fmod-inc=*) fmod_inc="$optarg"
216 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; user="no"
218 --disable-slirp) slirp="no"
220 --enable-adlib) adlib="yes"
222 --disable-kqemu) kqemu="no"
224 --enable-profiler) profiler="yes"
226 --kernel-path=*) kernel_path="$optarg"
228 --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
230 --disable-gfx-check) check_gfx="no"
232 --disable-gcc-check) check_gcc="no"
234 --disable-system) softmmu="no"
236 --enable-system) softmmu="yes"
238 --disable-user) user="no"
240 --enable-user) user="yes"
242 --enable-uname-release=*) uname_release="$optarg"
244 --enable-iasl) build_acpi_tables="yes"
246 esac
247 done
249 # Checking for CFLAGS
250 if test -z "$CFLAGS"; then
251 CFLAGS="-O2"
254 if test x"$show_help" = x"yes" ; then
255 cat << EOF
257 Usage: configure [options]
258 Options: [defaults in brackets after descriptions]
261 echo "Standard options:"
262 echo " --help print this message"
263 echo " --prefix=PREFIX install in PREFIX [$prefix]"
264 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
265 echo " use %M for cpu name [$interp_prefix]"
266 echo " --target-list=LIST set target list [$target_list]"
267 echo ""
268 echo "kqemu kernel acceleration support:"
269 echo " --disable-kqemu disable kqemu support"
270 echo " --kernel-path=PATH set the kernel path (configure probes it)"
271 echo ""
272 echo "Advanced options (experts only):"
273 echo " --source-path=PATH path of source code [$source_path]"
274 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
275 echo " --cc=CC use C compiler CC [$cc]"
276 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
277 echo " --make=MAKE use specified make [$make]"
278 echo " --install=INSTALL use specified install [$install]"
279 echo " --static enable static build [$static]"
280 echo " --enable-cocoa enable COCOA (Mac OS X only)"
281 echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
282 echo " --enable-adlib enable Adlib emulation"
283 echo " --enable-coreaudio enable Coreaudio audio driver"
284 echo " --enable-alsa enable ALSA audio driver"
285 echo " --enable-fmod enable FMOD audio driver"
286 echo " --enabled-dsound enable DirectSound audio driver"
287 echo " --enable-system enable all system emulation targets"
288 echo " --disable-system disable all system emulation targets"
289 echo " --enable-user enable all linux usermode emulation targets"
290 echo " --disable-user disable all linux usermode emulation targets"
291 echo " --fmod-lib path to FMOD library"
292 echo " --fmod-inc path to FMOD includes"
293 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
294 echo " --enable-iasl compilation of ACPI tables with the IASL compiler"
295 echo ""
296 echo "NOTE: The object files are build at the place where configure is launched"
297 exit 1
300 cc="${cross_prefix}${cc}"
301 ar="${cross_prefix}${ar}"
302 strip="${cross_prefix}${strip}"
304 # check that the C compiler works.
305 cat > $TMPC <<EOF
306 int main(void) {}
309 if $cc -c -o $TMPO $TMPC 2>/dev/null ; then
310 : C compiler works ok
311 else
312 echo "ERROR: \"$cc\" either does not exist or does not work"
313 exit 1
316 if test "$mingw32" = "yes" ; then
317 linux="no"
318 EXESUF=".exe"
319 oss="no"
320 if [ "$cpu" = "i386" ] ; then
321 kqemu="yes"
326 # Solaris specific configure tool chain decisions
328 if test "$solaris" = "yes" ; then
330 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
331 # override the check with --disable-gcc-check
333 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
334 solgcc=`which $cc`
335 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
336 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
337 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
338 echo "or get the latest patch from SunSolve for gcc"
339 exit 1
342 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
343 if test -z "$solinst" ; then
344 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
345 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
346 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
347 exit 1
349 if test "$solinst" = "/usr/sbin/install" ; then
350 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
351 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
352 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
353 exit 1
355 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
356 if test -z "$sol_ar" ; then
357 echo "Error: No path includes ar"
358 if test -f /usr/ccs/bin/ar ; then
359 echo "Add /usr/ccs/bin to your path and rerun configure"
361 exit 1
366 if test -z "$target_list" ; then
367 # these targets are portable
368 if [ "$softmmu" = "yes" ] ; then
369 target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu"
371 # the following are Linux specific
372 if [ "$user" = "yes" ] ; then
373 target_list="i386-user arm-user armeb-user sparc-user ppc-user mips-user mipsel-user $target_list"
375 else
376 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
378 if test -z "$target_list" ; then
379 echo "No targets enabled"
380 exit 1
383 if test -z "$cross_prefix" ; then
385 # ---
386 # big/little endian test
387 cat > $TMPC << EOF
388 #include <inttypes.h>
389 int main(int argc, char ** argv){
390 volatile uint32_t i=0x01234567;
391 return (*((uint8_t*)(&i))) == 0x67;
395 if $cc -o $TMPE $TMPC 2>/dev/null ; then
396 $TMPE && bigendian="yes"
397 else
398 echo big/little test failed
401 else
403 # if cross compiling, cannot launch a program, so make a static guess
404 if test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then
405 bigendian="yes"
410 # host long bits test
411 hostlongbits="32"
412 if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
413 hostlongbits="64"
416 # check gcc options support
417 cat > $TMPC <<EOF
418 int main(void) {
422 have_gcc3_options="no"
423 if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
424 have_gcc3_options="yes"
427 # Check for gcc4, error if pre-gcc4
428 if test "$check_gcc" = "yes" ; then
429 cat > $TMPC <<EOF
430 #if __GNUC__ < 4
431 #error gcc3
432 #endif
433 int main(){return 0;}
435 if $cc -o $TMPO $TMPC 2>/dev/null ; then
436 echo "ERROR: \"$cc\" looks like gcc 4.x"
437 echo "QEMU is known to have problems when compiled with gcc 4.x"
438 echo "It is recommended that you use gcc 3.x to build QEMU"
439 echo "To use this compiler anyway, configure with --disable-gcc-check"
440 exit 1;
444 ##########################################
445 # SDL probe
447 sdl_too_old=no
449 if test -z "$sdl" ; then
451 sdl_config="sdl-config"
452 sdl=no
453 sdl_static=no
455 if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
456 # win32 cross compilation case
457 sdl_config="i386-mingw32msvc-sdl-config"
458 sdl=yes
459 else
460 # normal SDL probe
461 cat > $TMPC << EOF
462 #include <SDL.h>
463 #undef main /* We don't want SDL to override our main() */
464 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
467 if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
468 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
469 if test "$_sdlversion" -lt 121 ; then
470 sdl_too_old=yes
471 else
472 sdl=yes
475 # static link with sdl ?
476 if test "$sdl" = "yes" ; then
477 aa="no"
478 `$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
479 sdl_static_libs=`$sdl_config --static-libs`
480 if [ "$aa" = "yes" ] ; then
481 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
484 if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
485 sdl_static=yes
488 fi # static link
490 fi # sdl compile test
492 fi # cross compilation
493 fi # -z $sdl
495 # Check if tools are available to build documentation.
496 if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
497 build_docs="yes"
500 if test "$mingw32" = "yes" ; then
501 if test -z "$prefix" ; then
502 prefix="/c/Program Files/Qemu"
504 mandir="$prefix"
505 datadir="$prefix"
506 docdir="$prefix"
507 bindir="$prefix"
508 else
509 if test -z "$prefix" ; then
510 prefix="/usr/local"
512 mandir="$prefix/share/man"
513 datadir="$prefix/share/qemu"
514 docdir="$prefix/share/doc/qemu"
515 bindir="$prefix/bin"
518 echo "Install prefix $prefix"
519 echo "BIOS directory $datadir"
520 echo "binary directory $bindir"
521 if test "$mingw32" = "no" ; then
522 echo "Manual directory $mandir"
523 echo "ELF interp prefix $interp_prefix"
525 echo "Source path $source_path"
526 echo "C compiler $cc"
527 echo "Host C compiler $host_cc"
528 echo "make $make"
529 echo "install $install"
530 echo "host CPU $cpu"
531 echo "host big endian $bigendian"
532 echo "target list $target_list"
533 echo "gprof enabled $gprof"
534 echo "profiler $profiler"
535 echo "static build $static"
536 if test "$darwin" = "yes" ; then
537 echo "Cocoa support $cocoa"
539 echo "SDL support $sdl"
540 if test "$sdl" != "no" ; then
541 echo "SDL static link $sdl_static"
543 echo "mingw32 support $mingw32"
544 echo "Adlib support $adlib"
545 echo "CoreAudio support $coreaudio"
546 echo "ALSA support $alsa"
547 echo "DSound support $dsound"
548 if test "$fmod" = "yes"; then
549 if test -z $fmod_lib || test -z $fmod_inc; then
550 echo
551 echo "Error: You must specify path to FMOD library and headers"
552 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
553 echo
554 exit 1
556 fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
557 else
558 fmod_support=""
560 echo "FMOD support $fmod $fmod_support"
561 echo "kqemu support $kqemu"
562 echo "Documentation $build_docs"
563 [ ! -z "$uname_release" ] && \
564 echo "uname -r $uname_release"
566 if test $sdl_too_old = "yes"; then
567 echo "-> Your SDL version is too old - please upgrade to have SDL support"
569 #if test "$sdl_static" = "no"; then
570 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
572 config_mak="config-host.mak"
573 config_h="config-host.h"
575 #echo "Creating $config_mak and $config_h"
577 echo "# Automatically generated by configure - do not modify" > $config_mak
578 echo "# Configured with: $0 $@" >> $config_mak
579 echo "/* Automatically generated by configure - do not modify */" > $config_h
581 echo "prefix=$prefix" >> $config_mak
582 echo "bindir=$bindir" >> $config_mak
583 echo "mandir=$mandir" >> $config_mak
584 echo "datadir=$datadir" >> $config_mak
585 echo "docdir=$docdir" >> $config_mak
586 echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
587 echo "MAKE=$make" >> $config_mak
588 echo "INSTALL=$install" >> $config_mak
589 echo "CC=$cc" >> $config_mak
590 if test "$have_gcc3_options" = "yes" ; then
591 echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
593 echo "HOST_CC=$host_cc" >> $config_mak
594 echo "AR=$ar" >> $config_mak
595 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
596 echo "CFLAGS=$CFLAGS" >> $config_mak
597 echo "LDFLAGS=$LDFLAGS" >> $config_mak
598 echo "EXESUF=$EXESUF" >> $config_mak
599 if test "$cpu" = "i386" ; then
600 echo "ARCH=i386" >> $config_mak
601 echo "#define HOST_I386 1" >> $config_h
602 elif test "$cpu" = "x86_64" ; then
603 echo "ARCH=x86_64" >> $config_mak
604 echo "#define HOST_X86_64 1" >> $config_h
605 elif test "$cpu" = "armv4b" ; then
606 echo "ARCH=arm" >> $config_mak
607 echo "#define HOST_ARM 1" >> $config_h
608 elif test "$cpu" = "armv4l" ; then
609 echo "ARCH=arm" >> $config_mak
610 echo "#define HOST_ARM 1" >> $config_h
611 elif test "$cpu" = "powerpc" ; then
612 echo "ARCH=ppc" >> $config_mak
613 echo "#define HOST_PPC 1" >> $config_h
614 elif test "$cpu" = "mips" ; then
615 echo "ARCH=mips" >> $config_mak
616 echo "#define HOST_MIPS 1" >> $config_h
617 elif test "$cpu" = "s390" ; then
618 echo "ARCH=s390" >> $config_mak
619 echo "#define HOST_S390 1" >> $config_h
620 elif test "$cpu" = "alpha" ; then
621 echo "ARCH=alpha" >> $config_mak
622 echo "#define HOST_ALPHA 1" >> $config_h
623 elif test "$cpu" = "sparc" ; then
624 echo "ARCH=sparc" >> $config_mak
625 echo "#define HOST_SPARC 1" >> $config_h
626 elif test "$cpu" = "sparc64" ; then
627 echo "ARCH=sparc64" >> $config_mak
628 echo "#define HOST_SPARC64 1" >> $config_h
629 elif test "$cpu" = "ia64" ; then
630 echo "ARCH=ia64" >> $config_mak
631 echo "#define HOST_IA64 1" >> $config_h
632 elif test "$cpu" = "m68k" ; then
633 echo "ARCH=m68k" >> $config_mak
634 echo "#define HOST_M68K 1" >> $config_h
635 else
636 echo "Unsupported CPU"
637 exit 1
639 if test "$bigendian" = "yes" ; then
640 echo "WORDS_BIGENDIAN=yes" >> $config_mak
641 echo "#define WORDS_BIGENDIAN 1" >> $config_h
643 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
644 if test "$mingw32" = "yes" ; then
645 echo "CONFIG_WIN32=yes" >> $config_mak
646 echo "#define CONFIG_WIN32 1" >> $config_h
647 elif test -f "/usr/include/byteswap.h" ; then
648 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
650 if test "$darwin" = "yes" ; then
651 echo "CONFIG_DARWIN=yes" >> $config_mak
652 echo "#define CONFIG_DARWIN 1" >> $config_h
654 if test "$solaris" = "yes" ; then
655 echo "CONFIG_SOLARIS=yes" >> $config_mak
656 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
658 if test "$gdbstub" = "yes" ; then
659 echo "CONFIG_GDBSTUB=yes" >> $config_mak
660 echo "#define CONFIG_GDBSTUB 1" >> $config_h
662 if test "$gprof" = "yes" ; then
663 echo "TARGET_GPROF=yes" >> $config_mak
664 echo "#define HAVE_GPROF 1" >> $config_h
666 if test "$static" = "yes" ; then
667 echo "CONFIG_STATIC=yes" >> $config_mak
668 echo "#define CONFIG_STATIC 1" >> $config_h
670 if test $profiler = "yes" ; then
671 echo "#define CONFIG_PROFILER 1" >> $config_h
673 if test "$slirp" = "yes" ; then
674 echo "CONFIG_SLIRP=yes" >> $config_mak
675 echo "#define CONFIG_SLIRP 1" >> $config_h
677 if test "$adlib" = "yes" ; then
678 echo "CONFIG_ADLIB=yes" >> $config_mak
679 echo "#define CONFIG_ADLIB 1" >> $config_h
681 if test "$oss" = "yes" ; then
682 echo "CONFIG_OSS=yes" >> $config_mak
683 echo "#define CONFIG_OSS 1" >> $config_h
685 if test "$coreaudio" = "yes" ; then
686 echo "CONFIG_COREAUDIO=yes" >> $config_mak
687 echo "#define CONFIG_COREAUDIO 1" >> $config_h
689 if test "$alsa" = "yes" ; then
690 echo "CONFIG_ALSA=yes" >> $config_mak
691 echo "#define CONFIG_ALSA 1" >> $config_h
693 if test "$dsound" = "yes" ; then
694 echo "CONFIG_DSOUND=yes" >> $config_mak
695 echo "#define CONFIG_DSOUND 1" >> $config_h
697 if test "$fmod" = "yes" ; then
698 echo "CONFIG_FMOD=yes" >> $config_mak
699 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
700 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
701 echo "#define CONFIG_FMOD 1" >> $config_h
703 qemu_version=`head $source_path/VERSION`
704 echo "VERSION=$qemu_version" >>$config_mak
705 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
707 echo "SRC_PATH=$source_path" >> $config_mak
708 if [ "$source_path_used" = "yes" ]; then
709 echo "VPATH=$source_path" >> $config_mak
711 echo "TARGET_DIRS=$target_list" >> $config_mak
712 if [ "$build_docs" = "yes" ] ; then
713 echo "BUILD_DOCS=yes" >> $config_mak
715 if [ "$build_acpi_tables" = "yes" ] ; then
716 echo "BUILD_ACPI_TABLES=yes" >> $config_mak
719 # XXX: suppress that
720 if [ "$bsd" = "yes" ] ; then
721 echo "#define O_LARGEFILE 0" >> $config_h
722 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
723 echo "#define _BSD 1" >> $config_h
726 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
728 for target in $target_list; do
729 target_dir="$target"
730 config_mak=$target_dir/config.mak
731 config_h=$target_dir/config.h
732 target_cpu=`echo $target | cut -d '-' -f 1`
733 target_bigendian="no"
734 [ "$target_cpu" = "armeb" ] && target_bigendian=yes
735 [ "$target_cpu" = "sparc" ] && target_bigendian=yes
736 [ "$target_cpu" = "sparc64" ] && target_bigendian=yes
737 [ "$target_cpu" = "ppc" ] && target_bigendian=yes
738 [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
739 [ "$target_cpu" = "mips" ] && target_bigendian=yes
740 [ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
741 target_softmmu="no"
742 if expr $target : '.*-softmmu' > /dev/null ; then
743 target_softmmu="yes"
745 target_user_only="no"
746 if expr $target : '.*-user' > /dev/null ; then
747 target_user_only="yes"
750 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
751 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
752 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
753 echo "To build QEMU without graphical output configure with --disable-gfx-check"
754 echo "Note that this will disable all output from the virtual graphics card."
755 exit 1;
758 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
760 mkdir -p $target_dir
761 mkdir -p $target_dir/fpu
762 if test "$target" = "arm-user" -o "$target" = "armeb-user" ; then
763 mkdir -p $target_dir/nwfpe
765 if test "$target_user_only" = "no" ; then
766 mkdir -p $target_dir/slirp
770 # don't use ln -sf as not all "ln -sf" over write the file/link
772 rm -f $target_dir/Makefile
773 ln -s $source_path/Makefile.target $target_dir/Makefile
776 echo "# Automatically generated by configure - do not modify" > $config_mak
777 echo "/* Automatically generated by configure - do not modify */" > $config_h
780 echo "include ../config-host.mak" >> $config_mak
781 echo "#include \"../config-host.h\"" >> $config_h
783 bflt="no"
784 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
785 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
787 if test "$target_cpu" = "i386" ; then
788 echo "TARGET_ARCH=i386" >> $config_mak
789 echo "#define TARGET_ARCH \"i386\"" >> $config_h
790 echo "#define TARGET_I386 1" >> $config_h
791 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
792 echo "#define USE_KQEMU 1" >> $config_h
794 elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
795 echo "TARGET_ARCH=arm" >> $config_mak
796 echo "#define TARGET_ARCH \"arm\"" >> $config_h
797 echo "#define TARGET_ARM 1" >> $config_h
798 bflt="yes"
799 elif test "$target_cpu" = "sparc" ; then
800 echo "TARGET_ARCH=sparc" >> $config_mak
801 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
802 echo "#define TARGET_SPARC 1" >> $config_h
803 elif test "$target_cpu" = "sparc64" ; then
804 echo "TARGET_ARCH=sparc64" >> $config_mak
805 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
806 echo "#define TARGET_SPARC 1" >> $config_h
807 echo "#define TARGET_SPARC64 1" >> $config_h
808 elif test "$target_cpu" = "ppc" ; then
809 echo "TARGET_ARCH=ppc" >> $config_mak
810 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
811 echo "#define TARGET_PPC 1" >> $config_h
812 elif test "$target_cpu" = "ppc64" ; then
813 echo "TARGET_ARCH=ppc64" >> $config_mak
814 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
815 echo "#define TARGET_PPC 1" >> $config_h
816 echo "#define TARGET_PPC64 1" >> $config_h
817 elif test "$target_cpu" = "x86_64" ; then
818 echo "TARGET_ARCH=x86_64" >> $config_mak
819 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
820 echo "#define TARGET_I386 1" >> $config_h
821 echo "#define TARGET_X86_64 1" >> $config_h
822 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then
823 echo "#define USE_KQEMU 1" >> $config_h
825 elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
826 echo "TARGET_ARCH=mips" >> $config_mak
827 echo "#define TARGET_ARCH \"mips\"" >> $config_h
828 echo "#define TARGET_MIPS 1" >> $config_h
829 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
830 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
831 elif test "$target_cpu" = "sh4" -o "$target_cpu" = "sh4eb" ; then
832 echo "TARGET_ARCH=sh4" >> $config_mak
833 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
834 echo "#define TARGET_SH4 1" >> $config_h
835 bflt="yes"
836 else
837 echo "Unsupported target CPU"
838 exit 1
840 if test "$target_bigendian" = "yes" ; then
841 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
842 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
844 if test "$target_softmmu" = "yes" ; then
845 echo "CONFIG_SOFTMMU=yes" >> $config_mak
846 echo "#define CONFIG_SOFTMMU 1" >> $config_h
848 if test "$target_user_only" = "yes" ; then
849 echo "CONFIG_USER_ONLY=yes" >> $config_mak
850 echo "#define CONFIG_USER_ONLY 1" >> $config_h
853 if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" -o "$target_cpu" = "sparc" -o "$target_cpu" = "sparc64"; then
854 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
855 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
857 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
858 echo "TARGET_HAS_BFLT=yes" >> $config_mak
859 echo "#define TARGET_HAS_BFLT 1" >> $config_h
861 # sdl defines
863 if test "$target_user_only" = "no"; then
864 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
865 sdl1=$sdl_static
866 else
867 sdl1=$sdl
869 if test "$sdl1" = "yes" ; then
870 echo "#define CONFIG_SDL 1" >> $config_h
871 echo "CONFIG_SDL=yes" >> $config_mak
872 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
873 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
874 else
875 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
877 if [ "${aa}" = "yes" ] ; then
878 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
879 else
880 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
885 if test "$cocoa" = "yes" ; then
886 echo "#define CONFIG_COCOA 1" >> $config_h
887 echo "CONFIG_COCOA=yes" >> $config_mak
890 done # for target in $targets
892 # build tree in object directory if source path is different from current one
893 if test "$source_path_used" = "yes" ; then
894 DIRS="tests"
895 FILES="Makefile tests/Makefile"
896 for dir in $DIRS ; do
897 mkdir -p $dir
898 done
899 # remove the link and recreate it, as not all "ln -sf" overwrite the link
900 for f in $FILES ; do
901 rm -f $f
902 ln -s $source_path/$f $f
903 done
906 rm -f $TMPO $TMPC $TMPE $TMPS