ia64/xen-unstable

view tools/ioemu/configure @ 17042:a905c582a406

Add stubdomain support. See stubdom/README for usage details.

- Move PAGE_SIZE and STACK_SIZE into __PAGE_SIZE and __STACK_SIZE in
arch_limits.h so as to permit getting them from there without
pulling all the internal Mini-OS defines.
- Setup a xen-elf cross-compilation environment in stubdom/cross-root
- Add a POSIX layer on top of Mini-OS by linking against the newlib C
library and lwIP, and implementing the Unixish part in mini-os/lib/sys.c
- Cross-compile zlib and libpci too.
- Add an xs.h-compatible layer on top of Mini-OS' xenbus.
- Cross-compile libxc with an additional xc_minios.c and a few things
disabled.
- Cross-compile ioemu with an additional block-vbd, but without sound,
tpm and other details. A few hacks are needed:
- Align ide and scsi buffers at least on sector size to permit
direct transmission to the block backend. While we are at it, just
page-align it to possibly save a segment. Also, limit the scsi
buffer size because of limitations of the block paravirtualization
protocol.
- Allocate big tables dynamically rather that letting them go to
bss: when Mini-OS gets installed in memory, bss is not lazily
allocated, and doing so during Mini-OS is unnecessarily trick while
we can simply use malloc.
- Had to change the Mini-OS compilation somehow, so as to export
Mini-OS compilation flags to the Makefiles of libxc and ioemu.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Feb 12 14:35:39 2008 +0000 (2008-02-12)
parents 5e60a38ffcf2
children cbb0dffdc07a
line source
1 #!/bin/sh
2 #
3 # qemu configure script (c) 2003 Fabrice Bellard
4 #
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"
12 fi
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 static="no"
22 libdir="lib"
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 target_list=""
33 case "$XEN_TARGET_ARCH" in
34 x86_32)
35 cpu="i386"
36 ;;
37 powerpc)
38 cpu="powerpc"
39 ;;
40 ia64)
41 cpu="ia64"
42 ;;
43 x86_64)
44 cpu="x86_64"
45 [ `uname -s` = "Linux" ] && libdir="lib64"
46 ;;
47 *)
48 cpu="unknown"
49 ;;
50 esac
51 gprof="no"
52 bigendian="no"
53 mingw32="no"
54 EXESUF=""
55 gdbstub="no"
56 slirp="no"
57 adlib="no"
58 oss="no"
59 dsound="no"
60 coreaudio="no"
61 alsa="no"
62 fmod="no"
63 fmod_lib=""
64 fmod_inc=""
65 vnc_tls="yes"
66 bsd="no"
67 linux="no"
68 kqemu="no"
69 profiler="no"
70 cocoa="no"
71 check_gfx="yes"
72 check_gcc="no"
73 softmmu="yes"
74 linux_user="no"
75 darwin_user="no"
76 build_docs="no"
77 stubdom="no"
78 uname_release=""
80 # OS specific
81 targetos=`uname -s`
82 case $targetos in
83 CYGWIN*)
84 mingw32="yes"
85 OS_CFLAGS="-mno-cygwin"
86 ;;
87 MINGW32*)
88 mingw32="yes"
89 ;;
90 FreeBSD)
91 bsd="yes"
92 oss="yes"
93 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
94 kqemu="yes"
95 fi
96 ;;
97 NetBSD)
98 bsd="yes"
99 oss="yes"
100 ;;
101 OpenBSD)
102 bsd="yes"
103 oss="yes"
104 ;;
105 Darwin)
106 bsd="yes"
107 darwin="yes"
108 darwin_user="yes"
109 cocoa="yes"
110 coreaudio="yes"
111 OS_CFLAGS="-mdynamic-no-pic"
112 ;;
113 SunOS)
114 solaris="yes"
115 ;;
116 *)
117 oss="yes"
118 linux="yes"
119 linux_user="yes"
120 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
121 kqemu="yes"
122 fi
123 ;;
124 esac
126 if [ "$bsd" = "yes" ] ; then
127 if [ "$darwin" != "yes" ] ; then
128 make="gmake"
129 fi
130 fi
132 if [ "$solaris" = "yes" ] ; then
133 make="gmake"
134 install="ginstall"
135 solarisrev=`uname -r | cut -f2 -d.`
136 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
137 if test "$solarisrev" -gt 10 ; then
138 kqemu="yes"
139 fi
140 fi
141 fi
143 # find source path
144 source_path=`dirname "$0"`
145 if [ -z "$source_path" ]; then
146 source_path=`pwd`
147 else
148 source_path=`cd "$source_path"; pwd`
149 fi
150 if test "$source_path" = `pwd` ; then
151 source_path_used="no"
152 else
153 source_path_used="yes"
154 fi
156 for opt do
157 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
158 case "$opt" in
159 --help|-h) show_help=yes
160 ;;
161 --prefix=*) prefix="$optarg"
162 ;;
163 --interp-prefix=*) interp_prefix="$optarg"
164 ;;
165 --source-path=*) source_path="$optarg"
166 source_path_used="yes"
167 ;;
168 --cross-prefix=*) cross_prefix="$optarg"
169 ;;
170 --cc=*) cc="$optarg"
171 gcc3_search="no"
172 ;;
173 --host-cc=*) host_cc="$optarg"
174 ;;
175 --make=*) make="$optarg"
176 ;;
177 --install=*) install="$optarg"
178 ;;
179 --extra-cflags=*) CFLAGS="$optarg"
180 ;;
181 --extra-ldflags=*) LDFLAGS="$optarg"
182 ;;
183 --cpu=*) cpu="$optarg"
184 ;;
185 --target-list=*) target_list="$optarg"
186 ;;
187 --enable-gprof) gprof="yes"
188 ;;
189 --static) static="yes"
190 ;;
191 --disable-sdl) sdl="no"
192 ;;
193 --enable-coreaudio) coreaudio="yes"
194 ;;
195 --enable-alsa) alsa="yes"
196 ;;
197 --enable-dsound) dsound="yes"
198 ;;
199 --enable-fmod) fmod="yes"
200 ;;
201 --fmod-lib=*) fmod_lib="$optarg"
202 ;;
203 --fmod-inc=*) fmod_inc="$optarg"
204 ;;
205 --disable-vnc-tls) vnc_tls="no"
206 ;;
207 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; user="no"
208 ;;
209 --disable-slirp) slirp="no"
210 ;;
211 --enable-adlib) adlib="yes"
212 ;;
213 --disable-kqemu) kqemu="no"
214 ;;
215 --enable-profiler) profiler="yes"
216 ;;
217 --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
218 ;;
219 --disable-gcc-check) check_gcc="no"
220 ;;
221 --disable-system) softmmu="no"
222 ;;
223 --enable-system) softmmu="yes"
224 ;;
225 --disable-linux-user) linux_user="no"
226 ;;
227 --enable-linux-user) linux_user="yes"
228 ;;
229 --disable-darwin-user) darwin_user="no"
230 ;;
231 --enable-darwin-user) darwin_user="yes"
232 ;;
233 --enable-uname-release=*) uname_release="$optarg"
234 ;;
235 --enable-stubdom) stubdom="yes"
236 ;;
237 esac
238 done
240 # default flags for all hosts
241 CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
242 LDFLAGS="$LDFLAGS -g"
244 if test x"$show_help" = x"yes" ; then
245 cat << EOF
247 Usage: configure [options]
248 Options: [defaults in brackets after descriptions]
250 EOF
251 echo "Standard options:"
252 echo " --help print this message"
253 echo " --prefix=PREFIX install in PREFIX [$prefix]"
254 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
255 echo " use %M for cpu name [$interp_prefix]"
256 echo " --target-list=LIST set target list [$target_list]"
257 echo ""
258 echo "kqemu kernel acceleration support:"
259 echo " --disable-kqemu disable kqemu support"
260 echo ""
261 echo "Advanced options (experts only):"
262 echo " --source-path=PATH path of source code [$source_path]"
263 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
264 echo " --cc=CC use C compiler CC [$cc]"
265 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
266 echo " --make=MAKE use specified make [$make]"
267 echo " --install=INSTALL use specified install [$install]"
268 echo " --static enable static build [$static]"
269 echo " --enable-cocoa enable COCOA (Mac OS X only)"
270 echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
271 echo " --enable-adlib enable Adlib emulation"
272 echo " --enable-coreaudio enable Coreaudio audio driver"
273 echo " --enable-alsa enable ALSA audio driver"
274 echo " --enable-fmod enable FMOD audio driver"
275 echo " --enabled-dsound enable DirectSound audio driver"
276 echo " --disable-vnc-tls disable TLS encryption for VNC server"
277 echo " --enable-system enable all system emulation targets"
278 echo " --disable-system disable all system emulation targets"
279 echo " --enable-linux-user enable all linux usermode emulation targets"
280 echo " --disable-linux-user disable all linux usermode emulation targets"
281 echo " --enable-darwin-user enable all darwin usermode emulation targets"
282 echo " --disable-darwin-user disable all darwin usermode emulation targets"
283 echo " --fmod-lib path to FMOD library"
284 echo " --fmod-inc path to FMOD includes"
285 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
286 echo ""
287 echo "NOTE: The object files are built at the place where configure is launched"
288 exit 1
289 fi
291 cc="${cross_prefix}${cc}"
292 ar="${cross_prefix}${ar}"
293 strip="${cross_prefix}${strip}"
295 # check that the C compiler works.
296 cat > $TMPC <<EOF
297 int main(void) {}
298 EOF
300 if $cc -c -o $TMPO $TMPC 2>/dev/null ; then
301 : C compiler works ok
302 else
303 echo "ERROR: \"$cc\" either does not exist or does not work"
304 exit 1
305 fi
307 if test "$mingw32" = "yes" ; then
308 linux="no"
309 EXESUF=".exe"
310 oss="no"
311 if [ "$cpu" = "i386" ] ; then
312 kqemu="yes"
313 fi
314 fi
316 # Check for gcc4, error if pre-gcc4
317 if test "$check_gcc" = "yes" ; then
318 cat > $TMPC <<EOF
319 #if __GNUC__ < 4
320 #error gcc3
321 #endif
322 int main(){return 0;}
323 EOF
324 check_cc() {
325 which "$1" >&/dev/null
326 return $?
327 }
329 if "$cc" -o $TMPE $TMPC 2>/dev/null ; then
330 echo "WARNING: \"$cc\" looks like gcc 4.x"
331 found_compat_cc="no"
332 if test "$gcc3_search" = "yes" ; then
333 echo "Looking for gcc 3.x"
334 for compat_cc in $gcc3_list ; do
335 if check_cc "$compat_cc" ; then
336 echo "Found \"$compat_cc\""
337 cc="$compat_cc"
338 found_compat_cc="yes"
339 break
340 fi
341 done
342 if test "$found_compat_cc" = "no" ; then
343 echo "gcc 3.x not found!"
344 fi
345 fi
346 if test "$found_compat_cc" = "no" ; then
347 echo "QEMU is known to have problems when compiled with gcc 4.x"
348 echo "It is recommended that you use gcc 3.x to build QEMU"
349 echo "To use this compiler anyway, configure with --disable-gcc-check"
350 exit 1;
351 fi
352 fi
353 fi
355 #
356 # Solaris specific configure tool chain decisions
357 #
358 if test "$solaris" = "yes" ; then
359 #
360 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
361 # override the check with --disable-gcc-check
362 #
363 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
364 solgcc=`which $cc`
365 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
366 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
367 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
368 echo "or get the latest patch from SunSolve for gcc"
369 exit 1
370 fi
371 fi
372 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
373 if test -z "$solinst" ; then
374 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
375 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
376 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
377 exit 1
378 fi
379 if test "$solinst" = "/usr/sbin/install" ; then
380 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
381 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
382 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
383 exit 1
384 fi
385 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
386 if test -z "$sol_ar" ; then
387 echo "Error: No path includes ar"
388 if test -f /usr/ccs/bin/ar ; then
389 echo "Add /usr/ccs/bin to your path and rerun configure"
390 fi
391 exit 1
392 fi
393 fi
395 ##########################################
397 # VNC TLS detection
398 if test "$vnc_tls" = "yes" ; then
399 `pkg-config gnutls` || vnc_tls="no"
400 fi
401 if test "$vnc_tls" = "yes" ; then
402 vnc_tls_cflags=`pkg-config --cflags gnutls`
403 vnc_tls_libs=`pkg-config --libs gnutls`
404 fi
406 ##########################################
408 if test -z "$target_list" ; then
409 # these targets are portable
410 if [ "$softmmu" = "yes" ] ; then
411 target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu"
412 fi
413 # the following are Linux specific
414 if [ "$linux_user" = "yes" ] ; then
415 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"
416 fi
417 # the following are Darwin specific
418 if [ "$darwin_user" = "yes" ] ; then
419 target_list="i386-darwin-user ppc-darwin-user $target_list"
420 fi
421 # the i386-dm target
422 if test "$stubdom" = "yes"; then
423 target_list="i386-dm-stubdom"
424 else
425 target_list="i386-dm"
426 fi
427 else
428 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
429 fi
430 if test -z "$target_list" ; then
431 echo "No targets enabled"
432 exit 1
433 fi
435 kqemu="no"
437 if test -z "$cross_prefix" ; then
439 # ---
440 # big/little endian test
441 cat > $TMPC << EOF
442 #include <inttypes.h>
443 int main(int argc, char ** argv){
444 volatile uint32_t i=0x01234567;
445 return (*((uint8_t*)(&i))) == 0x67;
446 }
447 EOF
449 if $cc -o $TMPE $TMPC 2>/dev/null ; then
450 $TMPE && bigendian="yes"
451 else
452 echo big/little test failed
453 fi
455 else
457 # if cross compiling, cannot launch a program, so make a static guess
458 if test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then
459 bigendian="yes"
460 fi
462 fi
464 # host long bits test
465 hostlongbits="32"
466 if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
467 hostlongbits="64"
468 fi
470 # check gcc options support
471 cat > $TMPC <<EOF
472 int main(void) {
473 }
474 EOF
476 have_gcc3_options="no"
477 if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
478 have_gcc3_options="yes"
479 fi
481 ##########################################
482 # SDL probe
484 sdl_too_old=no
486 if test -z "$sdl" ; then
488 sdl_config="sdl-config"
489 sdl=no
490 sdl_static=no
492 if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
493 # win32 cross compilation case
494 sdl_config="i386-mingw32msvc-sdl-config"
495 sdl=yes
496 else
497 # normal SDL probe
498 cat > $TMPC << EOF
499 #include <SDL.h>
500 #undef main /* We don't want SDL to override our main() */
501 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
502 EOF
504 if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
505 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
506 if test "$_sdlversion" -lt 121 ; then
507 sdl_too_old=yes
508 else
509 if test "$cocoa" = "no" ; then
510 sdl=yes
511 fi
512 fi
514 # static link with sdl ?
515 if test "$sdl" = "yes" ; then
516 aa="no"
517 `$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
518 sdl_static_libs=`$sdl_config --static-libs`
519 if [ "$aa" = "yes" ] ; then
520 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
521 fi
523 if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
524 sdl_static=yes
525 fi
527 fi # static link
529 fi # sdl compile test
531 fi # cross compilation
533 else
534 # Make sure to disable cocoa if sdl was set
535 if test "$sdl" = "yes" ; then
536 cocoa="no"
537 coreaudio="no"
538 fi
539 fi # -z $sdl
541 ##########################################
542 # alsa sound support libraries
544 if test "$alsa" = "yes" ; then
545 cat > $TMPC << EOF
546 #include <alsa/asoundlib.h>
547 int main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); }
548 EOF
549 if $cc -o $TMPE $TMPC -lasound 2> /dev/null ; then
550 :
551 else
552 echo
553 echo "Error: Could not find alsa"
554 echo "Make sure to have the alsa libs and headers installed."
555 echo
556 exit 1
557 fi
558 fi
560 # Check if tools are available to build documentation.
561 if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
562 build_docs="yes"
563 fi
565 if test "$mingw32" = "yes" ; then
566 if test -z "$prefix" ; then
567 prefix="/c/Program Files/Qemu"
568 fi
569 mandir="$prefix"
570 datadir="$prefix"
571 docdir="$prefix"
572 bindir="$prefix"
573 configdir=""
574 else
575 if test -z "$prefix" ; then
576 prefix="/usr/local"
577 fi
578 mandir="$prefix/share/man"
579 datadir="$prefix/share/xen/qemu"
580 docdir="$prefix/share/doc/qemu"
581 bindir="$prefix/$libdir/xen/bin"
582 configdir="/etc/xen"
583 fi
585 if test "$stubdom" = "yes"; then
586 oss="no"
587 sdl="no"
588 fi
590 echo "Install prefix $prefix"
591 echo "BIOS directory $datadir"
592 echo "binary directory $bindir"
593 if test "$mingw32" = "no" ; then
594 echo "Manual directory $mandir"
595 echo "ELF interp prefix $interp_prefix"
596 fi
597 echo "Source path $source_path"
598 echo "C compiler $cc"
599 echo "Host C compiler $host_cc"
600 echo "make $make"
601 echo "install $install"
602 echo "host CPU $cpu"
603 echo "host big endian $bigendian"
604 echo "target list $target_list"
605 echo "gprof enabled $gprof"
606 echo "profiler $profiler"
607 echo "static build $static"
608 if test "$darwin" = "yes" ; then
609 echo "Cocoa support $cocoa"
610 fi
611 echo "SDL support $sdl"
612 if test "$sdl" != "no" ; then
613 echo "SDL static link $sdl_static"
614 fi
615 echo "mingw32 support $mingw32"
616 echo "Adlib support $adlib"
617 echo "CoreAudio support $coreaudio"
618 echo "ALSA support $alsa"
619 echo "DSound support $dsound"
620 if test "$fmod" = "yes"; then
621 if test -z $fmod_lib || test -z $fmod_inc; then
622 echo
623 echo "Error: You must specify path to FMOD library and headers"
624 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
625 echo
626 exit 1
627 fi
628 fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
629 else
630 fmod_support=""
631 fi
632 echo "FMOD support $fmod $fmod_support"
633 echo "kqemu support $kqemu"
634 echo "Documentation $build_docs"
635 [ ! -z "$uname_release" ] && \
636 echo "uname -r $uname_release"
638 if test $sdl_too_old = "yes"; then
639 echo "-> Your SDL version is too old - please upgrade to have SDL support"
640 fi
641 #if test "$sdl_static" = "no"; then
642 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
643 #fi
644 config_mak="config-host.mak"
645 config_h="config-host.h"
647 #echo "Creating $config_mak and $config_h"
649 echo "# Automatically generated by configure - do not modify" > $config_mak
650 echo "# Configured with: $0 $@" >> $config_mak
651 echo "/* Automatically generated by configure - do not modify */" > $config_h
653 echo "prefix=$prefix" >> $config_mak
654 echo "bindir=$bindir" >> $config_mak
655 echo "mandir=$mandir" >> $config_mak
656 echo "datadir=$datadir" >> $config_mak
657 echo "docdir=$docdir" >> $config_mak
658 echo "configdir=$configdir" >> $config_mak
659 echo "LIBDIR=$libdir" >> $config_mak
660 echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
661 echo "MAKE=$make" >> $config_mak
662 echo "INSTALL=$install" >> $config_mak
663 echo "CC=$cc" >> $config_mak
664 if test "$have_gcc3_options" = "yes" ; then
665 echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
666 fi
667 echo "HOST_CC=$host_cc" >> $config_mak
668 echo "AR=$ar" >> $config_mak
669 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
670 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
671 echo "CFLAGS=$CFLAGS" >> $config_mak
672 echo "LDFLAGS=$LDFLAGS" >> $config_mak
673 echo "EXESUF=$EXESUF" >> $config_mak
674 if test "$cpu" = "i386" ; then
675 echo "ARCH=i386" >> $config_mak
676 echo "#define HOST_I386 1" >> $config_h
677 elif test "$cpu" = "x86_64" ; then
678 echo "ARCH=x86_64" >> $config_mak
679 echo "#define HOST_X86_64 1" >> $config_h
680 elif test "$cpu" = "armv4b" ; then
681 echo "ARCH=arm" >> $config_mak
682 echo "#define HOST_ARM 1" >> $config_h
683 elif test "$cpu" = "armv4l" ; then
684 echo "ARCH=arm" >> $config_mak
685 echo "#define HOST_ARM 1" >> $config_h
686 elif test "$cpu" = "powerpc" ; then
687 echo "ARCH=ppc" >> $config_mak
688 echo "#define HOST_PPC 1" >> $config_h
689 elif test "$cpu" = "mips" ; then
690 echo "ARCH=mips" >> $config_mak
691 echo "#define HOST_MIPS 1" >> $config_h
692 elif test "$cpu" = "s390" ; then
693 echo "ARCH=s390" >> $config_mak
694 echo "#define HOST_S390 1" >> $config_h
695 elif test "$cpu" = "alpha" ; then
696 echo "ARCH=alpha" >> $config_mak
697 echo "#define HOST_ALPHA 1" >> $config_h
698 elif test "$cpu" = "sparc" ; then
699 echo "ARCH=sparc" >> $config_mak
700 echo "#define HOST_SPARC 1" >> $config_h
701 elif test "$cpu" = "sparc64" ; then
702 echo "ARCH=sparc64" >> $config_mak
703 echo "#define HOST_SPARC64 1" >> $config_h
704 elif test "$cpu" = "ia64" ; then
705 echo "ARCH=ia64" >> $config_mak
706 echo "#define HOST_IA64 1" >> $config_h
707 elif test "$cpu" = "m68k" ; then
708 echo "ARCH=m68k" >> $config_mak
709 echo "#define HOST_M68K 1" >> $config_h
710 else
711 echo "Unsupported CPU"
712 exit 1
713 fi
714 if test "$bigendian" = "yes" ; then
715 echo "WORDS_BIGENDIAN=yes" >> $config_mak
716 echo "#define WORDS_BIGENDIAN 1" >> $config_h
717 fi
718 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
719 if test "$mingw32" = "yes" ; then
720 echo "CONFIG_WIN32=yes" >> $config_mak
721 echo "#define CONFIG_WIN32 1" >> $config_h
722 elif test -f "/usr/include/byteswap.h" ; then
723 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
724 fi
725 if test "$darwin" = "yes" ; then
726 echo "CONFIG_DARWIN=yes" >> $config_mak
727 echo "#define CONFIG_DARWIN 1" >> $config_h
728 fi
729 if test "$solaris" = "yes" ; then
730 echo "CONFIG_SOLARIS=yes" >> $config_mak
731 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
732 fi
733 if test "$gdbstub" = "yes" ; then
734 echo "CONFIG_GDBSTUB=yes" >> $config_mak
735 echo "#define CONFIG_GDBSTUB 1" >> $config_h
736 fi
737 if test "$gprof" = "yes" ; then
738 echo "TARGET_GPROF=yes" >> $config_mak
739 echo "#define HAVE_GPROF 1" >> $config_h
740 fi
741 if test "$static" = "yes" ; then
742 echo "CONFIG_STATIC=yes" >> $config_mak
743 echo "#define CONFIG_STATIC 1" >> $config_h
744 fi
745 if test $profiler = "yes" ; then
746 echo "#define CONFIG_PROFILER 1" >> $config_h
747 fi
748 if test "$slirp" = "yes" ; then
749 echo "CONFIG_SLIRP=yes" >> $config_mak
750 echo "#define CONFIG_SLIRP 1" >> $config_h
751 fi
752 if test "$adlib" = "yes" ; then
753 echo "CONFIG_ADLIB=yes" >> $config_mak
754 echo "#define CONFIG_ADLIB 1" >> $config_h
755 fi
756 if test "$oss" = "yes" ; then
757 echo "CONFIG_OSS=yes" >> $config_mak
758 echo "#define CONFIG_OSS 1" >> $config_h
759 fi
760 if test "$coreaudio" = "yes" ; then
761 echo "CONFIG_COREAUDIO=yes" >> $config_mak
762 echo "#define CONFIG_COREAUDIO 1" >> $config_h
763 fi
764 if test "$alsa" = "yes" ; then
765 echo "CONFIG_ALSA=yes" >> $config_mak
766 echo "#define CONFIG_ALSA 1" >> $config_h
767 fi
768 if test "$dsound" = "yes" ; then
769 echo "CONFIG_DSOUND=yes" >> $config_mak
770 echo "#define CONFIG_DSOUND 1" >> $config_h
771 fi
772 if test "$fmod" = "yes" ; then
773 echo "CONFIG_FMOD=yes" >> $config_mak
774 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
775 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
776 echo "#define CONFIG_FMOD 1" >> $config_h
777 fi
778 if test "$vnc_tls" = "yes" ; then
779 echo "CONFIG_VNC_TLS=yes" >> $config_mak
780 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
781 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
782 echo "#define CONFIG_VNC_TLS 1" >> $config_h
783 fi
784 qemu_version=`head $source_path/VERSION`
785 echo "VERSION=$qemu_version" >>$config_mak
786 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
788 echo "SRC_PATH=$source_path" >> $config_mak
789 if [ "$source_path_used" = "yes" ]; then
790 echo "VPATH=$source_path" >> $config_mak
791 fi
792 echo "TARGET_DIRS=$target_list" >> $config_mak
793 if [ "$build_docs" = "yes" ] ; then
794 echo "BUILD_DOCS=yes" >> $config_mak
795 fi
797 # XXX: suppress that
798 if [ "$bsd" = "yes" ] ; then
799 echo "#define O_LARGEFILE 0" >> $config_h
800 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
801 echo "#define _BSD 1" >> $config_h
802 fi
804 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
806 for target in $target_list; do
807 target_dir="$target"
808 config_mak=$target_dir/config.mak
809 config_h=$target_dir/config.h
810 target_cpu=`echo $target | cut -d '-' -f 1`
811 target_bigendian="no"
812 [ "$target_cpu" = "armeb" ] && target_bigendian=yes
813 [ "$target_cpu" = "sparc" ] && target_bigendian=yes
814 [ "$target_cpu" = "sparc64" ] && target_bigendian=yes
815 [ "$target_cpu" = "ppc" ] && target_bigendian=yes
816 [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
817 [ "$target_cpu" = "mips" ] && target_bigendian=yes
818 [ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
819 [ "$target_cpu" = "m68k" ] && target_bigendian=yes
820 target_softmmu="no"
821 if expr $target : '.*-softmmu' > /dev/null ; then
822 target_softmmu="yes"
823 fi
824 #for support 256M guest
825 target_softmmu="yes"
826 target_user_only="no"
827 if expr $target : '.*-user' > /dev/null ; then
828 target_user_only="yes"
829 fi
831 target_linux_user="no"
832 if expr $target : '.*-linux-user' > /dev/null ; then
833 target_linux_user="yes"
834 fi
836 target_darwin_user="no"
837 if expr $target : '.*-darwin-user' > /dev/null ; then
838 target_darwin_user="yes"
839 fi
841 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
843 mkdir -p $target_dir
844 mkdir -p $target_dir/fpu
845 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then
846 mkdir -p $target_dir/nwfpe
847 fi
848 if test "$target_user_only" = "no" ; then
849 mkdir -p $target_dir/slirp
850 fi
852 #
853 # don't use ln -sf as not all "ln -sf" over write the file/link
854 #
855 rm -f $target_dir/Makefile
856 ln -s ../Makefile.target $target_dir/Makefile
859 echo "# Automatically generated by configure - do not modify" > $config_mak
860 echo "/* Automatically generated by configure - do not modify */" > $config_h
863 echo "include ../config-host.mak" >> $config_mak
864 echo "#include \"../config-host.h\"" >> $config_h
866 bflt="no"
867 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
868 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
870 target_sub=
871 if expr $target : '.*-dm' > /dev/null ; then
872 target_sub=-dm
873 fi
874 echo "TARGET_SUB=${target_sub}" >> $config_mak
876 if test "$target_cpu" = "i386" ; then
877 echo "TARGET_ARCH=i386" >> $config_mak
878 echo "#define TARGET_ARCH \"i386\"" >> $config_h
879 echo "#define TARGET_I386 1" >> $config_h
880 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
881 echo "#define USE_KQEMU 1" >> $config_h
882 fi
883 elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
884 echo "TARGET_ARCH=arm" >> $config_mak
885 echo "#define TARGET_ARCH \"arm\"" >> $config_h
886 echo "#define TARGET_ARM 1" >> $config_h
887 bflt="yes"
888 elif test "$target_cpu" = "sparc" ; then
889 echo "TARGET_ARCH=sparc" >> $config_mak
890 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
891 echo "#define TARGET_SPARC 1" >> $config_h
892 elif test "$target_cpu" = "sparc64" ; then
893 echo "TARGET_ARCH=sparc64" >> $config_mak
894 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
895 echo "#define TARGET_SPARC 1" >> $config_h
896 echo "#define TARGET_SPARC64 1" >> $config_h
897 elif test "$target_cpu" = "ppc" ; then
898 echo "TARGET_ARCH=ppc" >> $config_mak
899 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
900 echo "#define TARGET_PPC 1" >> $config_h
901 elif test "$target_cpu" = "ppc64" ; then
902 echo "TARGET_ARCH=ppc64" >> $config_mak
903 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
904 echo "#define TARGET_PPC 1" >> $config_h
905 echo "#define TARGET_PPC64 1" >> $config_h
906 elif test "$target_cpu" = "x86_64" ; then
907 echo "TARGET_ARCH=x86_64" >> $config_mak
908 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
909 echo "#define TARGET_I386 1" >> $config_h
910 echo "#define TARGET_X86_64 1" >> $config_h
911 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then
912 echo "#define USE_KQEMU 1" >> $config_h
913 fi
914 elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
915 echo "TARGET_ARCH=mips" >> $config_mak
916 echo "#define TARGET_ARCH \"mips\"" >> $config_h
917 echo "#define TARGET_MIPS 1" >> $config_h
918 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
919 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
920 elif test "$target_cpu" = "sh4" -o "$target_cpu" = "sh4eb" ; then
921 echo "TARGET_ARCH=sh4" >> $config_mak
922 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
923 echo "#define TARGET_SH4 1" >> $config_h
924 bflt="yes"
925 elif test "$target_cpu" = "m68k" ; then
926 echo "TARGET_ARCH=m68k" >> $config_mak
927 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
928 echo "#define TARGET_M68K 1" >> $config_h
929 bflt="yes"
930 else
931 echo "Unsupported target CPU"
932 exit 1
933 fi
934 if test "$target_bigendian" = "yes" ; then
935 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
936 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
937 fi
938 if test "$target_softmmu" = "yes" ; then
939 echo "CONFIG_SOFTMMU=yes" >> $config_mak
940 echo "#define CONFIG_SOFTMMU 1" >> $config_h
941 fi
942 if test "$target_user_only" = "yes" ; then
943 echo "CONFIG_USER_ONLY=yes" >> $config_mak
944 echo "#define CONFIG_USER_ONLY 1" >> $config_h
945 fi
946 if test "$target_linux_user" = "yes" ; then
947 echo "CONFIG_LINUX_USER=yes" >> $config_mak
948 echo "#define CONFIG_LINUX_USER 1" >> $config_h
949 fi
950 if test "$target_darwin_user" = "yes" ; then
951 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
952 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
953 fi
954 if expr $target : '.*-dm' > /dev/null ; then
955 echo "#define CONFIG_DM 1" >> $config_h
956 fi
958 if test "$stubdom" = "yes" ; then
959 echo "CONFIG_STUBDOM=yes" >> $config_mak
960 echo "#define CONFIG_STUBDOM 1" >> $config_h
961 echo "#define NO_UNIX_SOCKETS 1" >> $config_h
962 echo "#define NO_DAEMONIZE 1" >> $config_h
963 echo "#define NO_AIO 1" >> $config_h
964 fi
966 if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" -o "$target_cpu" = "sparc" -o "$target_cpu" = "sparc64" -o "$target_cpu" = "m68k"; then
967 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
968 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
969 fi
970 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
971 echo "TARGET_HAS_BFLT=yes" >> $config_mak
972 echo "#define TARGET_HAS_BFLT 1" >> $config_h
973 fi
974 # sdl defines
976 if test "$target_user_only" = "no"; then
977 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
978 sdl1=$sdl_static
979 else
980 sdl1=$sdl
981 fi
982 if test "$sdl1" = "yes" ; then
983 echo "#define CONFIG_SDL 1" >> $config_h
984 echo "CONFIG_SDL=yes" >> $config_mak
985 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
986 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
987 else
988 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
989 fi
990 if [ "${aa}" = "yes" ] ; then
991 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
992 else
993 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
994 fi
995 fi
996 fi
998 if test "$cocoa" = "yes" ; then
999 echo "#define CONFIG_COCOA 1" >> $config_h
1000 echo "CONFIG_COCOA=yes" >> $config_mak
1001 fi
1003 done # for target in $targets
1005 # build tree in object directory if source path is different from current one
1006 if test "$source_path_used" = "yes" ; then
1007 DIRS="tests"
1008 FILES="Makefile tests/Makefile"
1009 for dir in $DIRS ; do
1010 mkdir -p $dir
1011 done
1012 # remove the link and recreate it, as not all "ln -sf" overwrite the link
1013 for f in $FILES ; do
1014 rm -f $f
1015 ln -s $source_path/$f $f
1016 done
1017 fi
1019 echo "VNC TLS support $vnc_tls"
1020 if test "$vnc_tls" = "yes" ; then
1021 echo " TLS CFLAGS $vnc_tls_cflags"
1022 echo " TLS LIBS $vnc_tls_libs"
1023 fi
1025 rm -f $TMPO $TMPC $TMPE $TMPS