Export qemu_system_reset() for qemu-kvm.c
[qemu-kvm/fedora.git] / configure
blob365b7fbdd71a95a76269b1f66c282a8fe1b6c960
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 gcc3_search="yes"
26 gcc3_list="gcc-3.4 gcc34 gcc-3.3 gcc33 gcc-3.2 gcc32"
27 host_cc="gcc"
28 ar="ar"
29 make="make"
30 install="install"
31 strip="strip"
32 cpu=`uname -m`
33 target_list=""
34 case "$cpu" in
35 i386|i486|i586|i686|i86pc|BePC)
36 cpu="i386"
38 armv*b)
39 cpu="armv4b"
41 armv*l)
42 cpu="armv4l"
44 alpha)
45 cpu="alpha"
47 "Power Macintosh"|ppc|ppc64)
48 cpu="powerpc"
50 mips)
51 cpu="mips"
53 s390)
54 cpu="s390"
56 sparc|sun4[muv])
57 cpu="sparc"
59 sparc64)
60 cpu="sparc64"
62 ia64)
63 cpu="ia64"
65 m68k)
66 cpu="m68k"
68 x86_64|amd64)
69 cpu="x86_64"
72 cpu="unknown"
74 esac
75 gprof="no"
76 bigendian="no"
77 mingw32="no"
78 EXESUF=""
79 gdbstub="yes"
80 slirp="yes"
81 adlib="no"
82 oss="no"
83 dsound="no"
84 coreaudio="no"
85 alsa="no"
86 fmod="no"
87 fmod_lib=""
88 fmod_inc=""
89 bsd="no"
90 linux="no"
91 kqemu="no"
92 kvm="no"
93 profiler="no"
94 kernel_path=""
95 cocoa="no"
96 check_gfx="yes"
97 check_gcc="yes"
98 softmmu="yes"
99 linux_user="no"
100 darwin_user="no"
101 build_docs="no"
102 uname_release=""
104 # OS specific
105 targetos=`uname -s`
106 case $targetos in
107 CYGWIN*)
108 mingw32="yes"
109 OS_CFLAGS="-mno-cygwin"
111 MINGW32*)
112 mingw32="yes"
114 FreeBSD)
115 bsd="yes"
116 oss="yes"
117 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
118 kqemu="yes"
119 kvm="yes"
122 NetBSD)
123 bsd="yes"
124 oss="yes"
126 OpenBSD)
127 bsd="yes"
128 oss="yes"
130 Darwin)
131 bsd="yes"
132 darwin="yes"
133 darwin_user="yes"
134 cocoa="yes"
135 coreaudio="yes"
136 OS_CFLAGS="-mdynamic-no-pic"
138 SunOS)
139 solaris="yes"
142 oss="yes"
143 linux="yes"
144 linux_user="yes"
145 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
146 kqemu="yes"
147 kvm="yes"
150 esac
152 if [ "$bsd" = "yes" ] ; then
153 if [ "$darwin" != "yes" ] ; then
154 make="gmake"
158 if [ "$solaris" = "yes" ] ; then
159 make="gmake"
160 install="ginstall"
161 solarisrev=`uname -r | cut -f2 -d.`
162 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
163 if test "$solarisrev" -gt 10 ; then
164 kqemu="yes"
169 # find source path
170 source_path=`dirname "$0"`
171 if [ -z "$source_path" ]; then
172 source_path=`pwd`
173 else
174 source_path=`cd "$source_path"; pwd`
176 if test "$source_path" = `pwd` ; then
177 source_path_used="no"
178 else
179 source_path_used="yes"
182 for opt do
183 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
184 case "$opt" in
185 --help|-h) show_help=yes
187 --prefix=*) prefix="$optarg"
189 --interp-prefix=*) interp_prefix="$optarg"
191 --source-path=*) source_path="$optarg"
192 source_path_used="yes"
194 --cross-prefix=*) cross_prefix="$optarg"
196 --cc=*) cc="$optarg"
197 gcc3_search="no"
199 --host-cc=*) host_cc="$optarg"
201 --make=*) make="$optarg"
203 --install=*) install="$optarg"
205 --extra-cflags=*) CFLAGS="$optarg"
207 --extra-ldflags=*) LDFLAGS="$optarg"
209 --cpu=*) cpu="$optarg"
211 --target-list=*) target_list="$optarg"
213 --enable-gprof) gprof="yes"
215 --static) static="yes"
217 --disable-sdl) sdl="no"
219 --enable-coreaudio) coreaudio="yes"
221 --enable-alsa) alsa="yes"
223 --enable-dsound) dsound="yes"
225 --enable-fmod) fmod="yes"
227 --fmod-lib=*) fmod_lib="$optarg"
229 --fmod-inc=*) fmod_inc="$optarg"
231 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; user="no"
233 --disable-slirp) slirp="no"
235 --enable-adlib) adlib="yes"
237 --disable-kqemu) kqemu="no"
239 --enable-kvm) kvm="yes"
241 --enable-profiler) profiler="yes"
243 --kernel-path=*) kernel_path="$optarg"
245 --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
247 --disable-gfx-check) check_gfx="no"
249 --disable-gcc-check) check_gcc="no"
251 --disable-system) softmmu="no"
253 --enable-system) softmmu="yes"
255 --disable-linux-user) linux_user="no"
257 --enable-linux-user) linux_user="yes"
259 --disable-darwin-user) darwin_user="no"
261 --enable-darwin-user) darwin_user="yes"
263 --enable-uname-release=*) uname_release="$optarg"
265 esac
266 done
268 # default flags for all hosts
269 CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
270 LDFLAGS="$LDFLAGS -g"
272 if test x"$show_help" = x"yes" ; then
273 cat << EOF
275 Usage: configure [options]
276 Options: [defaults in brackets after descriptions]
279 echo "Standard options:"
280 echo " --help print this message"
281 echo " --prefix=PREFIX install in PREFIX [$prefix]"
282 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
283 echo " use %M for cpu name [$interp_prefix]"
284 echo " --target-list=LIST set target list [$target_list]"
285 echo ""
286 echo "kqemu kernel acceleration support:"
287 echo " --disable-kqemu disable kqemu support"
288 echo " --kernel-path=PATH set the kernel path (configure probes it)"
289 echo " --enable-kvm enable kernel virtual machine support"
290 echo ""
291 echo "Advanced options (experts only):"
292 echo " --source-path=PATH path of source code [$source_path]"
293 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
294 echo " --cc=CC use C compiler CC [$cc]"
295 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
296 echo " --make=MAKE use specified make [$make]"
297 echo " --install=INSTALL use specified install [$install]"
298 echo " --static enable static build [$static]"
299 echo " --enable-cocoa enable COCOA (Mac OS X only)"
300 echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
301 echo " --enable-adlib enable Adlib emulation"
302 echo " --enable-coreaudio enable Coreaudio audio driver"
303 echo " --enable-alsa enable ALSA audio driver"
304 echo " --enable-fmod enable FMOD audio driver"
305 echo " --enabled-dsound enable DirectSound audio driver"
306 echo " --enable-system enable all system emulation targets"
307 echo " --disable-system disable all system emulation targets"
308 echo " --enable-linux-user enable all linux usermode emulation targets"
309 echo " --disable-linux-user disable all linux usermode emulation targets"
310 echo " --enable-darwin-user enable all darwin usermode emulation targets"
311 echo " --disable-darwin-user disable all darwin usermode emulation targets"
312 echo " --fmod-lib path to FMOD library"
313 echo " --fmod-inc path to FMOD includes"
314 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
315 echo ""
316 echo "NOTE: The object files are built at the place where configure is launched"
317 exit 1
320 cc="${cross_prefix}${cc}"
321 ar="${cross_prefix}${ar}"
322 strip="${cross_prefix}${strip}"
324 # check that the C compiler works.
325 cat > $TMPC <<EOF
326 int main(void) {}
329 if $cc -c -o $TMPO $TMPC 2>/dev/null ; then
330 : C compiler works ok
331 else
332 echo "ERROR: \"$cc\" either does not exist or does not work"
333 exit 1
336 if test "$mingw32" = "yes" ; then
337 linux="no"
338 EXESUF=".exe"
339 oss="no"
340 if [ "$cpu" = "i386" ] ; then
341 kqemu="yes"
345 # Check for gcc4, error if pre-gcc4
346 if test "$check_gcc" = "yes" ; then
347 cat > $TMPC <<EOF
348 #if __GNUC__ < 4
349 #error gcc3
350 #endif
351 int main(){return 0;}
353 check_cc() {
354 which "$1" >&/dev/null
355 return $?
358 if "$cc" -o $TMPE $TMPC 2>/dev/null ; then
359 echo "WARNING: \"$cc\" looks like gcc 4.x"
360 found_compat_cc="no"
361 if test "$gcc3_search" = "yes" ; then
362 echo "Looking for gcc 3.x"
363 for compat_cc in $gcc3_list ; do
364 if check_cc "$compat_cc" ; then
365 echo "Found \"$compat_cc\""
366 cc="$compat_cc"
367 found_compat_cc="yes"
368 break
370 done
371 if test "$found_compat_cc" = "no" ; then
372 echo "gcc 3.x not found!"
375 if test "$found_compat_cc" = "no" ; then
376 echo "QEMU is known to have problems when compiled with gcc 4.x"
377 echo "It is recommended that you use gcc 3.x to build QEMU"
378 echo "To use this compiler anyway, configure with --disable-gcc-check"
379 exit 1;
385 # Solaris specific configure tool chain decisions
387 if test "$solaris" = "yes" ; then
389 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
390 # override the check with --disable-gcc-check
392 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
393 solgcc=`which $cc`
394 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
395 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
396 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
397 echo "or get the latest patch from SunSolve for gcc"
398 exit 1
401 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
402 if test -z "$solinst" ; then
403 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
404 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
405 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
406 exit 1
408 if test "$solinst" = "/usr/sbin/install" ; then
409 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
410 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
411 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
412 exit 1
414 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
415 if test -z "$sol_ar" ; then
416 echo "Error: No path includes ar"
417 if test -f /usr/ccs/bin/ar ; then
418 echo "Add /usr/ccs/bin to your path and rerun configure"
420 exit 1
425 if test -z "$target_list" ; then
426 # these targets are portable
427 if [ "$softmmu" = "yes" ] ; then
428 target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu"
430 # the following are Linux specific
431 if [ "$linux_user" = "yes" ] ; then
432 target_list="i386-linux-user arm-linux-user armeb-linux-user sparc-linux-user ppc-linux-user mips-linux-user mipsel-linux-user m68k-linux-user $target_list"
434 # the following are Darwin specific
435 if [ "$darwin_user" = "yes" ] ; then
436 target_list="i386-darwin-user ppc-darwin-user $target_list"
438 else
439 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
441 if test -z "$target_list" ; then
442 echo "No targets enabled"
443 exit 1
446 if test -z "$cross_prefix" ; then
448 # ---
449 # big/little endian test
450 cat > $TMPC << EOF
451 #include <inttypes.h>
452 int main(int argc, char ** argv){
453 volatile uint32_t i=0x01234567;
454 return (*((uint8_t*)(&i))) == 0x67;
458 if $cc -o $TMPE $TMPC 2>/dev/null ; then
459 $TMPE && bigendian="yes"
460 else
461 echo big/little test failed
464 else
466 # if cross compiling, cannot launch a program, so make a static guess
467 if test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then
468 bigendian="yes"
473 # host long bits test
474 hostlongbits="32"
475 if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
476 hostlongbits="64"
479 # check gcc options support
480 cat > $TMPC <<EOF
481 int main(void) {
485 have_gcc3_options="no"
486 if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
487 have_gcc3_options="yes"
490 ##########################################
491 # SDL probe
493 sdl_too_old=no
495 if test -z "$sdl" ; then
497 sdl_config="sdl-config"
498 sdl=no
499 sdl_static=no
501 if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
502 # win32 cross compilation case
503 sdl_config="i386-mingw32msvc-sdl-config"
504 sdl=yes
505 else
506 # normal SDL probe
507 cat > $TMPC << EOF
508 #include <SDL.h>
509 #undef main /* We don't want SDL to override our main() */
510 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
513 if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
514 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
515 if test "$_sdlversion" -lt 121 ; then
516 sdl_too_old=yes
517 else
518 if test "$cocoa" = "no" ; then
519 sdl=yes
523 # static link with sdl ?
524 if test "$sdl" = "yes" ; then
525 aa="no"
526 `$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
527 sdl_static_libs=`$sdl_config --static-libs`
528 if [ "$aa" = "yes" ] ; then
529 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
532 if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
533 sdl_static=yes
536 fi # static link
538 fi # sdl compile test
540 fi # cross compilation
542 else
543 # Make sure to disable cocoa if sdl was set
544 if test "$sdl" = "yes" ; then
545 cocoa="no"
546 coreaudio="no"
548 fi # -z $sdl
550 ##########################################
551 # alsa sound support libraries
553 if test "$alsa" = "yes" ; then
554 cat > $TMPC << EOF
555 #include <alsa/asoundlib.h>
556 int main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); }
558 if $cc -o $TMPE $TMPC -lasound 2> /dev/null ; then
560 else
561 echo
562 echo "Error: Could not find alsa"
563 echo "Make sure to have the alsa libs and headers installed."
564 echo
565 exit 1
569 # Check if tools are available to build documentation.
570 if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
571 build_docs="yes"
574 if test "$mingw32" = "yes" ; then
575 if test -z "$prefix" ; then
576 prefix="/c/Program Files/Qemu"
578 mandir="$prefix"
579 datadir="$prefix"
580 docdir="$prefix"
581 bindir="$prefix"
582 else
583 if test -z "$prefix" ; then
584 prefix="/usr/local"
586 mandir="$prefix/share/man"
587 datadir="$prefix/share/qemu"
588 docdir="$prefix/share/doc/qemu"
589 bindir="$prefix/bin"
592 echo "Install prefix $prefix"
593 echo "BIOS directory $datadir"
594 echo "binary directory $bindir"
595 if test "$mingw32" = "no" ; then
596 echo "Manual directory $mandir"
597 echo "ELF interp prefix $interp_prefix"
599 echo "Source path $source_path"
600 echo "C compiler $cc"
601 echo "Host C compiler $host_cc"
602 echo "make $make"
603 echo "install $install"
604 echo "host CPU $cpu"
605 echo "host big endian $bigendian"
606 echo "target list $target_list"
607 echo "gprof enabled $gprof"
608 echo "profiler $profiler"
609 echo "static build $static"
610 if test "$darwin" = "yes" ; then
611 echo "Cocoa support $cocoa"
613 echo "SDL support $sdl"
614 if test "$sdl" != "no" ; then
615 echo "SDL static link $sdl_static"
617 echo "mingw32 support $mingw32"
618 echo "Adlib support $adlib"
619 echo "CoreAudio support $coreaudio"
620 echo "ALSA support $alsa"
621 echo "DSound support $dsound"
622 if test "$fmod" = "yes"; then
623 if test -z $fmod_lib || test -z $fmod_inc; then
624 echo
625 echo "Error: You must specify path to FMOD library and headers"
626 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
627 echo
628 exit 1
630 fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
631 else
632 fmod_support=""
634 echo "FMOD support $fmod $fmod_support"
635 echo "kqemu support $kqemu"
636 echo "kvm support $kvm"
637 echo "Documentation $build_docs"
638 [ ! -z "$uname_release" ] && \
639 echo "uname -r $uname_release"
641 if test $sdl_too_old = "yes"; then
642 echo "-> Your SDL version is too old - please upgrade to have SDL support"
644 #if test "$sdl_static" = "no"; then
645 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
647 config_mak="config-host.mak"
648 config_h="config-host.h"
650 #echo "Creating $config_mak and $config_h"
652 echo "# Automatically generated by configure - do not modify" > $config_mak
653 echo "# Configured with: $0 $@" >> $config_mak
654 echo "/* Automatically generated by configure - do not modify */" > $config_h
656 echo "prefix=$prefix" >> $config_mak
657 echo "bindir=$bindir" >> $config_mak
658 echo "mandir=$mandir" >> $config_mak
659 echo "datadir=$datadir" >> $config_mak
660 echo "docdir=$docdir" >> $config_mak
661 echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
662 echo "MAKE=$make" >> $config_mak
663 echo "INSTALL=$install" >> $config_mak
664 echo "CC=$cc" >> $config_mak
665 if test "$have_gcc3_options" = "yes" ; then
666 echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
668 echo "HOST_CC=$host_cc" >> $config_mak
669 echo "AR=$ar" >> $config_mak
670 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
671 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
672 echo "CFLAGS=$CFLAGS" >> $config_mak
673 echo "LDFLAGS=$LDFLAGS" >> $config_mak
674 echo "EXESUF=$EXESUF" >> $config_mak
675 if test "$cpu" = "i386" ; then
676 echo "ARCH=i386" >> $config_mak
677 echo "#define HOST_I386 1" >> $config_h
678 elif test "$cpu" = "x86_64" ; then
679 echo "ARCH=x86_64" >> $config_mak
680 echo "#define HOST_X86_64 1" >> $config_h
681 elif test "$cpu" = "armv4b" ; then
682 echo "ARCH=arm" >> $config_mak
683 echo "#define HOST_ARM 1" >> $config_h
684 elif test "$cpu" = "armv4l" ; then
685 echo "ARCH=arm" >> $config_mak
686 echo "#define HOST_ARM 1" >> $config_h
687 elif test "$cpu" = "powerpc" ; then
688 echo "ARCH=ppc" >> $config_mak
689 echo "#define HOST_PPC 1" >> $config_h
690 elif test "$cpu" = "mips" ; then
691 echo "ARCH=mips" >> $config_mak
692 echo "#define HOST_MIPS 1" >> $config_h
693 elif test "$cpu" = "s390" ; then
694 echo "ARCH=s390" >> $config_mak
695 echo "#define HOST_S390 1" >> $config_h
696 elif test "$cpu" = "alpha" ; then
697 echo "ARCH=alpha" >> $config_mak
698 echo "#define HOST_ALPHA 1" >> $config_h
699 elif test "$cpu" = "sparc" ; then
700 echo "ARCH=sparc" >> $config_mak
701 echo "#define HOST_SPARC 1" >> $config_h
702 elif test "$cpu" = "sparc64" ; then
703 echo "ARCH=sparc64" >> $config_mak
704 echo "#define HOST_SPARC64 1" >> $config_h
705 elif test "$cpu" = "ia64" ; then
706 echo "ARCH=ia64" >> $config_mak
707 echo "#define HOST_IA64 1" >> $config_h
708 elif test "$cpu" = "m68k" ; then
709 echo "ARCH=m68k" >> $config_mak
710 echo "#define HOST_M68K 1" >> $config_h
711 else
712 echo "Unsupported CPU"
713 exit 1
715 if test "$bigendian" = "yes" ; then
716 echo "WORDS_BIGENDIAN=yes" >> $config_mak
717 echo "#define WORDS_BIGENDIAN 1" >> $config_h
719 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
720 if test "$mingw32" = "yes" ; then
721 echo "CONFIG_WIN32=yes" >> $config_mak
722 echo "#define CONFIG_WIN32 1" >> $config_h
723 elif test -f "/usr/include/byteswap.h" ; then
724 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
726 if test "$darwin" = "yes" ; then
727 echo "CONFIG_DARWIN=yes" >> $config_mak
728 echo "#define CONFIG_DARWIN 1" >> $config_h
730 if test "$solaris" = "yes" ; then
731 echo "CONFIG_SOLARIS=yes" >> $config_mak
732 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
734 if test "$gdbstub" = "yes" ; then
735 echo "CONFIG_GDBSTUB=yes" >> $config_mak
736 echo "#define CONFIG_GDBSTUB 1" >> $config_h
738 if test "$gprof" = "yes" ; then
739 echo "TARGET_GPROF=yes" >> $config_mak
740 echo "#define HAVE_GPROF 1" >> $config_h
742 if test "$static" = "yes" ; then
743 echo "CONFIG_STATIC=yes" >> $config_mak
744 echo "#define CONFIG_STATIC 1" >> $config_h
746 if test $profiler = "yes" ; then
747 echo "#define CONFIG_PROFILER 1" >> $config_h
749 if test "$slirp" = "yes" ; then
750 echo "CONFIG_SLIRP=yes" >> $config_mak
751 echo "#define CONFIG_SLIRP 1" >> $config_h
753 if test "$adlib" = "yes" ; then
754 echo "CONFIG_ADLIB=yes" >> $config_mak
755 echo "#define CONFIG_ADLIB 1" >> $config_h
757 if test "$oss" = "yes" ; then
758 echo "CONFIG_OSS=yes" >> $config_mak
759 echo "#define CONFIG_OSS 1" >> $config_h
761 if test "$coreaudio" = "yes" ; then
762 echo "CONFIG_COREAUDIO=yes" >> $config_mak
763 echo "#define CONFIG_COREAUDIO 1" >> $config_h
765 if test "$alsa" = "yes" ; then
766 echo "CONFIG_ALSA=yes" >> $config_mak
767 echo "#define CONFIG_ALSA 1" >> $config_h
769 if test "$dsound" = "yes" ; then
770 echo "CONFIG_DSOUND=yes" >> $config_mak
771 echo "#define CONFIG_DSOUND 1" >> $config_h
773 if test "$fmod" = "yes" ; then
774 echo "CONFIG_FMOD=yes" >> $config_mak
775 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
776 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
777 echo "#define CONFIG_FMOD 1" >> $config_h
779 qemu_version=`head $source_path/VERSION`
780 echo "VERSION=$qemu_version" >>$config_mak
781 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
783 echo "SRC_PATH=$source_path" >> $config_mak
784 if [ "$source_path_used" = "yes" ]; then
785 echo "VPATH=$source_path" >> $config_mak
787 echo "TARGET_DIRS=$target_list" >> $config_mak
788 if [ "$build_docs" = "yes" ] ; then
789 echo "BUILD_DOCS=yes" >> $config_mak
792 # XXX: suppress that
793 if [ "$bsd" = "yes" ] ; then
794 echo "#define O_LARGEFILE 0" >> $config_h
795 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
796 echo "#define _BSD 1" >> $config_h
799 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
801 for target in $target_list; do
802 target_dir="$target"
803 config_mak=$target_dir/config.mak
804 config_h=$target_dir/config.h
805 target_cpu=`echo $target | cut -d '-' -f 1`
806 target_bigendian="no"
807 [ "$target_cpu" = "armeb" ] && target_bigendian=yes
808 [ "$target_cpu" = "sparc" ] && target_bigendian=yes
809 [ "$target_cpu" = "sparc64" ] && target_bigendian=yes
810 [ "$target_cpu" = "ppc" ] && target_bigendian=yes
811 [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
812 [ "$target_cpu" = "mips" ] && target_bigendian=yes
813 [ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
814 [ "$target_cpu" = "m68k" ] && target_bigendian=yes
815 target_softmmu="no"
816 if expr $target : '.*-softmmu' > /dev/null ; then
817 target_softmmu="yes"
819 target_user_only="no"
820 if expr $target : '.*-user' > /dev/null ; then
821 target_user_only="yes"
824 target_linux_user="no"
825 if expr $target : '.*-linux-user' > /dev/null ; then
826 target_linux_user="yes"
829 target_darwin_user="no"
830 if expr $target : '.*-darwin-user' > /dev/null ; then
831 target_darwin_user="yes"
834 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
835 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
836 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
837 echo "To build QEMU without graphical output configure with --disable-gfx-check"
838 echo "Note that this will disable all output from the virtual graphics card."
839 exit 1;
842 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
844 mkdir -p $target_dir
845 mkdir -p $target_dir/fpu
846 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then
847 mkdir -p $target_dir/nwfpe
849 if test "$target_user_only" = "no" ; then
850 mkdir -p $target_dir/slirp
854 # don't use ln -sf as not all "ln -sf" over write the file/link
856 rm -f $target_dir/Makefile
857 ln -s $source_path/Makefile.target $target_dir/Makefile
860 echo "# Automatically generated by configure - do not modify" > $config_mak
861 echo "/* Automatically generated by configure - do not modify */" > $config_h
864 echo "include ../config-host.mak" >> $config_mak
865 echo "#include \"../config-host.h\"" >> $config_h
867 bflt="no"
868 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
869 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
871 configure_kvm() {
872 if test $kvm = "yes" -a "$target_softmmu" = "yes" -a \
873 \( "$cpu" = "i386" -o "$cpu" = "x86_64" \); then
874 echo "#define USE_KVM 1" >> $config_h
875 echo "CONFIG_KVM_KERNEL_INC=$kernel_path/include" >> $config_mak
879 if test "$target_cpu" = "i386" ; then
880 echo "TARGET_ARCH=i386" >> $config_mak
881 echo "#define TARGET_ARCH \"i386\"" >> $config_h
882 echo "#define TARGET_I386 1" >> $config_h
883 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
884 echo "#define USE_KQEMU 1" >> $config_h
886 configure_kvm
887 elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
888 echo "TARGET_ARCH=arm" >> $config_mak
889 echo "#define TARGET_ARCH \"arm\"" >> $config_h
890 echo "#define TARGET_ARM 1" >> $config_h
891 bflt="yes"
892 elif test "$target_cpu" = "sparc" ; then
893 echo "TARGET_ARCH=sparc" >> $config_mak
894 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
895 echo "#define TARGET_SPARC 1" >> $config_h
896 elif test "$target_cpu" = "sparc64" ; then
897 echo "TARGET_ARCH=sparc64" >> $config_mak
898 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
899 echo "#define TARGET_SPARC 1" >> $config_h
900 echo "#define TARGET_SPARC64 1" >> $config_h
901 elif test "$target_cpu" = "ppc" ; then
902 echo "TARGET_ARCH=ppc" >> $config_mak
903 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
904 echo "#define TARGET_PPC 1" >> $config_h
905 elif test "$target_cpu" = "ppc64" ; then
906 echo "TARGET_ARCH=ppc64" >> $config_mak
907 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
908 echo "#define TARGET_PPC 1" >> $config_h
909 echo "#define TARGET_PPC64 1" >> $config_h
910 elif test "$target_cpu" = "x86_64" ; then
911 echo "TARGET_ARCH=x86_64" >> $config_mak
912 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
913 echo "#define TARGET_I386 1" >> $config_h
914 echo "#define TARGET_X86_64 1" >> $config_h
915 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then
916 echo "#define USE_KQEMU 1" >> $config_h
918 configure_kvm
919 elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
920 echo "TARGET_ARCH=mips" >> $config_mak
921 echo "#define TARGET_ARCH \"mips\"" >> $config_h
922 echo "#define TARGET_MIPS 1" >> $config_h
923 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
924 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
925 elif test "$target_cpu" = "sh4" -o "$target_cpu" = "sh4eb" ; then
926 echo "TARGET_ARCH=sh4" >> $config_mak
927 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
928 echo "#define TARGET_SH4 1" >> $config_h
929 bflt="yes"
930 elif test "$target_cpu" = "m68k" ; then
931 echo "TARGET_ARCH=m68k" >> $config_mak
932 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
933 echo "#define TARGET_M68K 1" >> $config_h
934 bflt="yes"
935 else
936 echo "Unsupported target CPU"
937 exit 1
939 if test "$target_bigendian" = "yes" ; then
940 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
941 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
943 if test "$target_softmmu" = "yes" ; then
944 echo "CONFIG_SOFTMMU=yes" >> $config_mak
945 echo "#define CONFIG_SOFTMMU 1" >> $config_h
947 if test "$target_user_only" = "yes" ; then
948 echo "CONFIG_USER_ONLY=yes" >> $config_mak
949 echo "#define CONFIG_USER_ONLY 1" >> $config_h
951 if test "$target_linux_user" = "yes" ; then
952 echo "CONFIG_LINUX_USER=yes" >> $config_mak
953 echo "#define CONFIG_LINUX_USER 1" >> $config_h
955 if test "$target_darwin_user" = "yes" ; then
956 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
957 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
960 if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" -o "$target_cpu" = "sparc" -o "$target_cpu" = "sparc64" -o "$target_cpu" = "m68k"; then
961 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
962 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
964 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
965 echo "TARGET_HAS_BFLT=yes" >> $config_mak
966 echo "#define TARGET_HAS_BFLT 1" >> $config_h
968 # sdl defines
970 if test "$target_user_only" = "no"; then
971 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
972 sdl1=$sdl_static
973 else
974 sdl1=$sdl
976 if test "$sdl1" = "yes" ; then
977 echo "#define CONFIG_SDL 1" >> $config_h
978 echo "CONFIG_SDL=yes" >> $config_mak
979 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
980 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
981 else
982 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
984 if [ "${aa}" = "yes" ] ; then
985 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
986 else
987 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
992 if test "$cocoa" = "yes" ; then
993 echo "#define CONFIG_COCOA 1" >> $config_h
994 echo "CONFIG_COCOA=yes" >> $config_mak
997 done # for target in $targets
999 # build tree in object directory if source path is different from current one
1000 if test "$source_path_used" = "yes" ; then
1001 DIRS="tests"
1002 FILES="Makefile tests/Makefile"
1003 for dir in $DIRS ; do
1004 mkdir -p $dir
1005 done
1006 # remove the link and recreate it, as not all "ln -sf" overwrite the link
1007 for f in $FILES ; do
1008 rm -f $f
1009 ln -s $source_path/$f $f
1010 done
1013 rm -f $TMPO $TMPC $TMPE $TMPS