Add doc, html, dvi and .PHONY Makefile targets.
[qemu/mini2440.git] / configure
blobd33e20210246008c491b69604cf15689922a4772
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 uname_release=""
100 # OS specific
101 targetos=`uname -s`
102 case $targetos in
103 CYGWIN*)
104 mingw32="yes"
105 CFLAGS="-O2 -mno-cygwin"
107 MINGW32*)
108 mingw32="yes"
110 FreeBSD)
111 bsd="yes"
112 oss="yes"
113 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
114 kqemu="yes"
117 NetBSD)
118 bsd="yes"
119 oss="yes"
121 OpenBSD)
122 bsd="yes"
123 oss="yes"
125 Darwin)
126 bsd="yes"
127 darwin="yes"
129 SunOS)
130 solaris="yes"
133 oss="yes"
134 linux="yes"
135 user="yes"
136 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
137 kqemu="yes"
140 esac
142 if [ "$bsd" = "yes" ] ; then
143 if [ "$darwin" != "yes" ] ; then
144 make="gmake"
148 if [ "$solaris" = "yes" ] ; then
149 make="gmake"
150 install="ginstall"
151 solarisrev=`uname -r | cut -f2 -d.`
154 # find source path
155 source_path=`dirname "$0"`
156 if [ -z "$source_path" ]; then
157 source_path=`pwd`
158 else
159 source_path=`cd "$source_path"; pwd`
161 if test "$source_path" = `pwd` ; then
162 source_path_used="no"
163 else
164 source_path_used="yes"
167 for opt do
168 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
169 case "$opt" in
170 --help|-h) show_help=yes
172 --prefix=*) prefix="$optarg"
174 --interp-prefix=*) interp_prefix="$optarg"
176 --source-path=*) source_path="$optarg"
177 source_path_used="yes"
179 --cross-prefix=*) cross_prefix="$optarg"
181 --cc=*) cc="$optarg"
183 --host-cc=*) host_cc="$optarg"
185 --make=*) make="$optarg"
187 --install=*) install="$optarg"
189 --extra-cflags=*) CFLAGS="$optarg"
191 --extra-ldflags=*) LDFLAGS="$optarg"
193 --cpu=*) cpu="$optarg"
195 --target-list=*) target_list="$optarg"
197 --enable-gprof) gprof="yes"
199 --static) static="yes"
201 --disable-sdl) sdl="no"
203 --enable-coreaudio) coreaudio="yes"
205 --enable-alsa) alsa="yes"
207 --enable-dsound) dsound="yes"
209 --enable-fmod) fmod="yes"
211 --fmod-lib=*) fmod_lib="$optarg"
213 --fmod-inc=*) fmod_inc="$optarg"
215 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-"
217 --disable-slirp) slirp="no"
219 --enable-adlib) adlib="yes"
221 --disable-kqemu) kqemu="no"
223 --enable-profiler) profiler="yes"
225 --kernel-path=*) kernel_path="$optarg"
227 --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
229 --disable-gfx-check) check_gfx="no"
231 --disable-gcc-check) check_gcc="no"
233 --disable-system) softmmu="no"
235 --enable-system) softmmu="yes"
237 --disable-user) user="no"
239 --enable-user) user="yes"
241 --enable-uname-release=*) uname_release="$optarg"
243 esac
244 done
246 # Checking for CFLAGS
247 if test -z "$CFLAGS"; then
248 CFLAGS="-O2"
251 if test x"$show_help" = x"yes" ; then
252 cat << EOF
254 Usage: configure [options]
255 Options: [defaults in brackets after descriptions]
258 echo "Standard options:"
259 echo " --help print this message"
260 echo " --prefix=PREFIX install in PREFIX [$prefix]"
261 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
262 echo " use %M for cpu name [$interp_prefix]"
263 echo " --target-list=LIST set target list [$target_list]"
264 echo ""
265 echo "kqemu kernel acceleration support:"
266 echo " --disable-kqemu disable kqemu support"
267 echo " --kernel-path=PATH set the kernel path (configure probes it)"
268 echo ""
269 echo "Advanced options (experts only):"
270 echo " --source-path=PATH path of source code [$source_path]"
271 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
272 echo " --cc=CC use C compiler CC [$cc]"
273 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
274 echo " --make=MAKE use specified make [$make]"
275 echo " --install=INSTALL use specified install [$install]"
276 echo " --static enable static build [$static]"
277 echo " --enable-cocoa enable COCOA (Mac OS X only)"
278 echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
279 echo " --enable-adlib enable Adlib emulation"
280 echo " --enable-coreaudio enable Coreaudio audio driver"
281 echo " --enable-alsa enable ALSA audio driver"
282 echo " --enable-fmod enable FMOD audio driver"
283 echo " --enabled-dsound enable DirectSound audio driver"
284 echo " --enable-system enable all system emulation targets"
285 echo " --disable-system disable all system emulation targets"
286 echo " --enable-user enable all linux usermode emulation targets"
287 echo " --disable-user disable all linux usermode emulation targets"
288 echo " --fmod-lib path to FMOD library"
289 echo " --fmod-inc path to FMOD includes"
290 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
291 echo ""
292 echo "NOTE: The object files are build at the place where configure is launched"
293 exit 1
296 cc="${cross_prefix}${cc}"
297 ar="${cross_prefix}${ar}"
298 strip="${cross_prefix}${strip}"
300 # check that the C compiler works.
301 cat > $TMPC <<EOF
302 int main(void) {}
305 if $cc -c -o $TMPO $TMPC 2>/dev/null ; then
306 : C compiler works ok
307 else
308 echo "ERROR: \"$cc\" either does not exist or does not work"
309 exit 1
312 if test "$mingw32" = "yes" ; then
313 linux="no"
314 EXESUF=".exe"
315 gdbstub="no"
316 oss="no"
317 if [ "$cpu" = "i386" ] ; then
318 kqemu="yes"
323 # Solaris specific configure tool chain decisions
325 if test "$solaris" = "yes" ; then
327 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
328 # override the check with --disable-gcc-check
330 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
331 solgcc=`which $cc`
332 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
333 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
334 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
335 echo "or get the latest patch from SunSolve for gcc"
336 exit 1
339 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
340 if test -z "$solinst" ; then
341 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
342 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
343 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
344 exit 1
346 if test "$solinst" = "/usr/sbin/install" ; then
347 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
348 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
349 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
350 exit 1
352 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
353 if test -z "$sol_ar" ; then
354 echo "Error: No path includes ar"
355 if test -f /usr/ccs/bin/ar ; then
356 echo "Add /usr/ccs/bin to your path and rerun configure"
358 exit 1
363 if test -z "$target_list" ; then
364 # these targets are portable
365 if [ "$softmmu" = "yes" ] ; then
366 target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu"
368 # the following are Linux specific
369 if [ "$user" = "yes" ] ; then
370 target_list="i386-user arm-user armeb-user sparc-user ppc-user mips-user mipsel-user $target_list"
372 else
373 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
375 if test -z "$target_list" ; then
376 echo "No targets enabled"
377 exit 1
380 if test -z "$cross_prefix" ; then
382 # ---
383 # big/little endian test
384 cat > $TMPC << EOF
385 #include <inttypes.h>
386 int main(int argc, char ** argv){
387 volatile uint32_t i=0x01234567;
388 return (*((uint8_t*)(&i))) == 0x67;
392 if $cc -o $TMPE $TMPC 2>/dev/null ; then
393 $TMPE && bigendian="yes"
394 else
395 echo big/little test failed
398 else
400 # if cross compiling, cannot launch a program, so make a static guess
401 if test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then
402 bigendian="yes"
407 # host long bits test
408 hostlongbits="32"
409 if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
410 hostlongbits="64"
413 # check gcc options support
414 cat > $TMPC <<EOF
415 int main(void) {
419 have_gcc3_options="no"
420 if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
421 have_gcc3_options="yes"
424 # Check for gcc4, error if pre-gcc4
425 if test "$check_gcc" = "yes" ; then
426 cat > $TMPC <<EOF
427 #if __GNUC__ < 4
428 #error gcc3
429 #endif
430 int main(){return 0;}
432 if $cc -o $TMPO $TMPC 2>/dev/null ; then
433 echo "ERROR: \"$cc\" looks like gcc 4.x"
434 echo "QEMU is known to have problems when compiled with gcc 4.x"
435 echo "It is recommended that you use gcc 3.x to build QEMU"
436 echo "To use this compiler anyway, configure with --disable-gcc-check"
437 exit 1;
441 ##########################################
442 # SDL probe
444 sdl_too_old=no
446 if test -z "$sdl" ; then
448 sdl_config="sdl-config"
449 sdl=no
450 sdl_static=no
452 if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
453 # win32 cross compilation case
454 sdl_config="i386-mingw32msvc-sdl-config"
455 sdl=yes
456 else
457 # normal SDL probe
458 cat > $TMPC << EOF
459 #include <SDL.h>
460 #undef main /* We don't want SDL to override our main() */
461 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
464 if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
465 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
466 if test "$_sdlversion" -lt 121 ; then
467 sdl_too_old=yes
468 else
469 sdl=yes
472 # static link with sdl ?
473 if test "$sdl" = "yes" ; then
474 aa="no"
475 `$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
476 sdl_static_libs=`$sdl_config --static-libs`
477 if [ "$aa" = "yes" ] ; then
478 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
481 if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
482 sdl_static=yes
485 fi # static link
487 fi # sdl compile test
489 fi # cross compilation
490 fi # -z $sdl
492 # Check if tools are available to build documentation.
493 if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
494 build_docs="yes"
497 if test "$mingw32" = "yes" ; then
498 if test -z "$prefix" ; then
499 prefix="/c/Program Files/Qemu"
501 mandir="$prefix"
502 datadir="$prefix"
503 docdir="$prefix"
504 bindir="$prefix"
505 else
506 if test -z "$prefix" ; then
507 prefix="/usr/local"
509 mandir="$prefix/share/man"
510 datadir="$prefix/share/qemu"
511 docdir="$prefix/share/doc/qemu"
512 bindir="$prefix/bin"
515 echo "Install prefix $prefix"
516 echo "BIOS directory $datadir"
517 echo "binary directory $bindir"
518 if test "$mingw32" = "no" ; then
519 echo "Manual directory $mandir"
520 echo "ELF interp prefix $interp_prefix"
522 echo "Source path $source_path"
523 echo "C compiler $cc"
524 echo "Host C compiler $host_cc"
525 echo "make $make"
526 echo "install $install"
527 echo "host CPU $cpu"
528 echo "host big endian $bigendian"
529 echo "target list $target_list"
530 echo "gprof enabled $gprof"
531 echo "profiler $profiler"
532 echo "static build $static"
533 if test "$darwin" = "yes" ; then
534 echo "Cocoa support $cocoa"
536 echo "SDL support $sdl"
537 if test "$sdl" != "no" ; then
538 echo "SDL static link $sdl_static"
540 echo "mingw32 support $mingw32"
541 echo "Adlib support $adlib"
542 echo "CoreAudio support $coreaudio"
543 echo "ALSA support $alsa"
544 echo "DSound support $dsound"
545 if test "$fmod" = "yes"; then
546 if test -z $fmod_lib || test -z $fmod_inc; then
547 echo
548 echo "Error: You must specify path to FMOD library and headers"
549 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
550 echo
551 exit 1
553 fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
554 else
555 fmod_support=""
557 echo "FMOD support $fmod $fmod_support"
558 echo "kqemu support $kqemu"
559 echo "Documentation $build_docs"
560 [ ! -z "$uname_release" ] && \
561 echo "uname -r $uname_release"
563 if test $sdl_too_old = "yes"; then
564 echo "-> Your SDL version is too old - please upgrade to have SDL support"
566 #if test "$sdl_static" = "no"; then
567 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
569 config_mak="config-host.mak"
570 config_h="config-host.h"
572 #echo "Creating $config_mak and $config_h"
574 echo "# Automatically generated by configure - do not modify" > $config_mak
575 echo "# Configured with: $0 $@" >> $config_mak
576 echo "/* Automatically generated by configure - do not modify */" > $config_h
578 echo "prefix=$prefix" >> $config_mak
579 echo "bindir=$bindir" >> $config_mak
580 echo "mandir=$mandir" >> $config_mak
581 echo "datadir=$datadir" >> $config_mak
582 echo "docdir=$docdir" >> $config_mak
583 echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
584 echo "MAKE=$make" >> $config_mak
585 echo "INSTALL=$install" >> $config_mak
586 echo "CC=$cc" >> $config_mak
587 if test "$have_gcc3_options" = "yes" ; then
588 echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
590 echo "HOST_CC=$host_cc" >> $config_mak
591 echo "AR=$ar" >> $config_mak
592 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
593 echo "CFLAGS=$CFLAGS" >> $config_mak
594 echo "LDFLAGS=$LDFLAGS" >> $config_mak
595 echo "EXESUF=$EXESUF" >> $config_mak
596 if test "$cpu" = "i386" ; then
597 echo "ARCH=i386" >> $config_mak
598 echo "#define HOST_I386 1" >> $config_h
599 elif test "$cpu" = "x86_64" ; then
600 echo "ARCH=x86_64" >> $config_mak
601 echo "#define HOST_X86_64 1" >> $config_h
602 elif test "$cpu" = "armv4b" ; then
603 echo "ARCH=arm" >> $config_mak
604 echo "#define HOST_ARM 1" >> $config_h
605 elif test "$cpu" = "armv4l" ; then
606 echo "ARCH=arm" >> $config_mak
607 echo "#define HOST_ARM 1" >> $config_h
608 elif test "$cpu" = "powerpc" ; then
609 echo "ARCH=ppc" >> $config_mak
610 echo "#define HOST_PPC 1" >> $config_h
611 elif test "$cpu" = "mips" ; then
612 echo "ARCH=mips" >> $config_mak
613 echo "#define HOST_MIPS 1" >> $config_h
614 elif test "$cpu" = "s390" ; then
615 echo "ARCH=s390" >> $config_mak
616 echo "#define HOST_S390 1" >> $config_h
617 elif test "$cpu" = "alpha" ; then
618 echo "ARCH=alpha" >> $config_mak
619 echo "#define HOST_ALPHA 1" >> $config_h
620 elif test "$cpu" = "sparc" ; then
621 echo "ARCH=sparc" >> $config_mak
622 echo "#define HOST_SPARC 1" >> $config_h
623 elif test "$cpu" = "sparc64" ; then
624 echo "ARCH=sparc64" >> $config_mak
625 echo "#define HOST_SPARC64 1" >> $config_h
626 elif test "$cpu" = "ia64" ; then
627 echo "ARCH=ia64" >> $config_mak
628 echo "#define HOST_IA64 1" >> $config_h
629 elif test "$cpu" = "m68k" ; then
630 echo "ARCH=m68k" >> $config_mak
631 echo "#define HOST_M68K 1" >> $config_h
632 else
633 echo "Unsupported CPU"
634 exit 1
636 if test "$bigendian" = "yes" ; then
637 echo "WORDS_BIGENDIAN=yes" >> $config_mak
638 echo "#define WORDS_BIGENDIAN 1" >> $config_h
640 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
641 if test "$mingw32" = "yes" ; then
642 echo "CONFIG_WIN32=yes" >> $config_mak
643 echo "#define CONFIG_WIN32 1" >> $config_h
644 elif test -f "/usr/include/byteswap.h" ; then
645 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
647 if test "$darwin" = "yes" ; then
648 echo "CONFIG_DARWIN=yes" >> $config_mak
649 echo "#define CONFIG_DARWIN 1" >> $config_h
651 if test "$solaris" = "yes" ; then
652 echo "CONFIG_SOLARIS=yes" >> $config_mak
653 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
655 if test "$gdbstub" = "yes" ; then
656 echo "CONFIG_GDBSTUB=yes" >> $config_mak
657 echo "#define CONFIG_GDBSTUB 1" >> $config_h
659 if test "$gprof" = "yes" ; then
660 echo "TARGET_GPROF=yes" >> $config_mak
661 echo "#define HAVE_GPROF 1" >> $config_h
663 if test "$static" = "yes" ; then
664 echo "CONFIG_STATIC=yes" >> $config_mak
665 echo "#define CONFIG_STATIC 1" >> $config_h
667 if test $profiler = "yes" ; then
668 echo "#define CONFIG_PROFILER 1" >> $config_h
670 if test "$slirp" = "yes" ; then
671 echo "CONFIG_SLIRP=yes" >> $config_mak
672 echo "#define CONFIG_SLIRP 1" >> $config_h
674 if test "$adlib" = "yes" ; then
675 echo "CONFIG_ADLIB=yes" >> $config_mak
676 echo "#define CONFIG_ADLIB 1" >> $config_h
678 if test "$oss" = "yes" ; then
679 echo "CONFIG_OSS=yes" >> $config_mak
680 echo "#define CONFIG_OSS 1" >> $config_h
682 if test "$coreaudio" = "yes" ; then
683 echo "CONFIG_COREAUDIO=yes" >> $config_mak
684 echo "#define CONFIG_COREAUDIO 1" >> $config_h
686 if test "$alsa" = "yes" ; then
687 echo "CONFIG_ALSA=yes" >> $config_mak
688 echo "#define CONFIG_ALSA 1" >> $config_h
690 if test "$dsound" = "yes" ; then
691 echo "CONFIG_DSOUND=yes" >> $config_mak
692 echo "#define CONFIG_DSOUND 1" >> $config_h
694 if test "$fmod" = "yes" ; then
695 echo "CONFIG_FMOD=yes" >> $config_mak
696 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
697 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
698 echo "#define CONFIG_FMOD 1" >> $config_h
700 qemu_version=`head $source_path/VERSION`
701 echo "VERSION=$qemu_version" >>$config_mak
702 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
704 echo "SRC_PATH=$source_path" >> $config_mak
705 if [ "$source_path_used" = "yes" ]; then
706 echo "VPATH=$source_path" >> $config_mak
708 echo "TARGET_DIRS=$target_list" >> $config_mak
709 if [ "$build_docs" = "yes" ] ; then
710 echo "BUILD_DOCS=yes" >> $config_mak
713 # XXX: suppress that
714 if [ "$bsd" = "yes" ] ; then
715 echo "#define O_LARGEFILE 0" >> $config_h
716 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
717 echo "#define _BSD 1" >> $config_h
720 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
722 for target in $target_list; do
723 target_dir="$target"
724 config_mak=$target_dir/config.mak
725 config_h=$target_dir/config.h
726 target_cpu=`echo $target | cut -d '-' -f 1`
727 target_bigendian="no"
728 [ "$target_cpu" = "armeb" ] && target_bigendian=yes
729 [ "$target_cpu" = "sparc" ] && target_bigendian=yes
730 [ "$target_cpu" = "sparc64" ] && target_bigendian=yes
731 [ "$target_cpu" = "ppc" ] && target_bigendian=yes
732 [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
733 [ "$target_cpu" = "mips" ] && target_bigendian=yes
734 target_softmmu="no"
735 if expr $target : '.*-softmmu' > /dev/null ; then
736 target_softmmu="yes"
738 target_user_only="no"
739 if expr $target : '.*-user' > /dev/null ; then
740 target_user_only="yes"
743 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
744 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
745 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
746 echo "To build QEMU without graphical output configure with --disable-gfx-check"
747 echo "Note that this will disable all output from the virtual graphics card."
748 exit 1;
751 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
753 mkdir -p $target_dir
754 mkdir -p $target_dir/fpu
755 if test "$target" = "arm-user" -o "$target" = "armeb-user" ; then
756 mkdir -p $target_dir/nwfpe
758 if test "$target_user_only" = "no" ; then
759 mkdir -p $target_dir/slirp
763 # don't use ln -sf as not all "ln -sf" over write the file/link
765 rm -f $target_dir/Makefile
766 ln -s $source_path/Makefile.target $target_dir/Makefile
769 echo "# Automatically generated by configure - do not modify" > $config_mak
770 echo "/* Automatically generated by configure - do not modify */" > $config_h
773 echo "include ../config-host.mak" >> $config_mak
774 echo "#include \"../config-host.h\"" >> $config_h
776 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
777 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
779 if test "$target_cpu" = "i386" ; then
780 echo "TARGET_ARCH=i386" >> $config_mak
781 echo "#define TARGET_ARCH \"i386\"" >> $config_h
782 echo "#define TARGET_I386 1" >> $config_h
783 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
784 echo "#define USE_KQEMU 1" >> $config_h
786 elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
787 echo "TARGET_ARCH=arm" >> $config_mak
788 echo "#define TARGET_ARCH \"arm\"" >> $config_h
789 echo "#define TARGET_ARM 1" >> $config_h
790 elif test "$target_cpu" = "sparc" ; then
791 echo "TARGET_ARCH=sparc" >> $config_mak
792 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
793 echo "#define TARGET_SPARC 1" >> $config_h
794 elif test "$target_cpu" = "sparc64" ; then
795 echo "TARGET_ARCH=sparc64" >> $config_mak
796 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
797 echo "#define TARGET_SPARC 1" >> $config_h
798 echo "#define TARGET_SPARC64 1" >> $config_h
799 elif test "$target_cpu" = "ppc" ; then
800 echo "TARGET_ARCH=ppc" >> $config_mak
801 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
802 echo "#define TARGET_PPC 1" >> $config_h
803 elif test "$target_cpu" = "ppc64" ; then
804 echo "TARGET_ARCH=ppc64" >> $config_mak
805 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
806 echo "#define TARGET_PPC 1" >> $config_h
807 echo "#define TARGET_PPC64 1" >> $config_h
808 elif test "$target_cpu" = "x86_64" ; then
809 echo "TARGET_ARCH=x86_64" >> $config_mak
810 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
811 echo "#define TARGET_I386 1" >> $config_h
812 echo "#define TARGET_X86_64 1" >> $config_h
813 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then
814 echo "#define USE_KQEMU 1" >> $config_h
816 elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
817 echo "TARGET_ARCH=mips" >> $config_mak
818 echo "#define TARGET_ARCH \"mips\"" >> $config_h
819 echo "#define TARGET_MIPS 1" >> $config_h
820 elif test "$target_cpu" = "sh4" ; then
821 echo "TARGET_ARCH=sh4" >> $config_mak
822 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
823 echo "#define TARGET_SH4 1" >> $config_h
824 else
825 echo "Unsupported target CPU"
826 exit 1
828 if test "$target_bigendian" = "yes" ; then
829 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
830 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
832 if test "$target_softmmu" = "yes" ; then
833 echo "CONFIG_SOFTMMU=yes" >> $config_mak
834 echo "#define CONFIG_SOFTMMU 1" >> $config_h
836 if test "$target_user_only" = "yes" ; then
837 echo "CONFIG_USER_ONLY=yes" >> $config_mak
838 echo "#define CONFIG_USER_ONLY 1" >> $config_h
841 if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
842 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
843 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
845 # sdl defines
847 if test "$target_user_only" = "no"; then
848 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
849 sdl1=$sdl_static
850 else
851 sdl1=$sdl
853 if test "$sdl1" = "yes" ; then
854 echo "#define CONFIG_SDL 1" >> $config_h
855 echo "CONFIG_SDL=yes" >> $config_mak
856 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
857 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
858 else
859 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
861 if [ "${aa}" = "yes" ] ; then
862 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
863 else
864 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
869 if test "$cocoa" = "yes" ; then
870 echo "#define CONFIG_COCOA 1" >> $config_h
871 echo "CONFIG_COCOA=yes" >> $config_mak
874 done # for target in $targets
876 # build tree in object directory if source path is different from current one
877 if test "$source_path_used" = "yes" ; then
878 DIRS="tests"
879 FILES="Makefile tests/Makefile"
880 for dir in $DIRS ; do
881 mkdir -p $dir
882 done
883 # remove the link and recreate it, as not all "ln -sf" overwrite the link
884 for f in $FILES ; do
885 rm -f $f
886 ln -s $source_path/$f $f
887 done
890 rm -f $TMPO $TMPC $TMPE $TMPS