ia64/xen-unstable

view tools/ioemu/configure @ 17260:0901aec1d00b

ioemu: Improve SDL openGL configure-script detection.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Mar 19 00:01:25 2008 +0000 (2008-03-19)
parents cbb0dffdc07a
children
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 --disable-opengl) opengl="no"
194 ;;
195 --enable-coreaudio) coreaudio="yes"
196 ;;
197 --enable-alsa) alsa="yes"
198 ;;
199 --enable-dsound) dsound="yes"
200 ;;
201 --enable-fmod) fmod="yes"
202 ;;
203 --fmod-lib=*) fmod_lib="$optarg"
204 ;;
205 --fmod-inc=*) fmod_inc="$optarg"
206 ;;
207 --disable-vnc-tls) vnc_tls="no"
208 ;;
209 --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; user="no"
210 ;;
211 --disable-slirp) slirp="no"
212 ;;
213 --enable-adlib) adlib="yes"
214 ;;
215 --disable-kqemu) kqemu="no"
216 ;;
217 --enable-profiler) profiler="yes"
218 ;;
219 --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
220 ;;
221 --disable-gcc-check) check_gcc="no"
222 ;;
223 --disable-system) softmmu="no"
224 ;;
225 --enable-system) softmmu="yes"
226 ;;
227 --disable-linux-user) linux_user="no"
228 ;;
229 --enable-linux-user) linux_user="yes"
230 ;;
231 --disable-darwin-user) darwin_user="no"
232 ;;
233 --enable-darwin-user) darwin_user="yes"
234 ;;
235 --enable-uname-release=*) uname_release="$optarg"
236 ;;
237 --enable-stubdom) stubdom="yes"
238 ;;
239 esac
240 done
242 # default flags for all hosts
243 CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
244 LDFLAGS="$LDFLAGS -g"
246 if test x"$show_help" = x"yes" ; then
247 cat << EOF
249 Usage: configure [options]
250 Options: [defaults in brackets after descriptions]
252 EOF
253 echo "Standard options:"
254 echo " --help print this message"
255 echo " --prefix=PREFIX install in PREFIX [$prefix]"
256 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
257 echo " use %M for cpu name [$interp_prefix]"
258 echo " --target-list=LIST set target list [$target_list]"
259 echo ""
260 echo "kqemu kernel acceleration support:"
261 echo " --disable-kqemu disable kqemu support"
262 echo ""
263 echo "Advanced options (experts only):"
264 echo " --source-path=PATH path of source code [$source_path]"
265 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
266 echo " --cc=CC use C compiler CC [$cc]"
267 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
268 echo " --make=MAKE use specified make [$make]"
269 echo " --install=INSTALL use specified install [$install]"
270 echo " --static enable static build [$static]"
271 echo " --enable-cocoa enable COCOA (Mac OS X only)"
272 echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
273 echo " --enable-adlib enable Adlib emulation"
274 echo " --enable-coreaudio enable Coreaudio audio driver"
275 echo " --enable-alsa enable ALSA audio driver"
276 echo " --enable-fmod enable FMOD audio driver"
277 echo " --enabled-dsound enable DirectSound audio driver"
278 echo " --disable-vnc-tls disable TLS encryption for VNC server"
279 echo " --enable-system enable all system emulation targets"
280 echo " --disable-system disable all system emulation targets"
281 echo " --enable-linux-user enable all linux usermode emulation targets"
282 echo " --disable-linux-user disable all linux usermode emulation targets"
283 echo " --enable-darwin-user enable all darwin usermode emulation targets"
284 echo " --disable-darwin-user disable all darwin usermode emulation targets"
285 echo " --fmod-lib path to FMOD library"
286 echo " --fmod-inc path to FMOD includes"
287 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
288 echo ""
289 echo "NOTE: The object files are built at the place where configure is launched"
290 exit 1
291 fi
293 cc="${cross_prefix}${cc}"
294 ar="${cross_prefix}${ar}"
295 strip="${cross_prefix}${strip}"
297 # check that the C compiler works.
298 cat > $TMPC <<EOF
299 int main(void) {}
300 EOF
302 if $cc -c -o $TMPO $TMPC 2>/dev/null ; then
303 : C compiler works ok
304 else
305 echo "ERROR: \"$cc\" either does not exist or does not work"
306 exit 1
307 fi
309 if test "$mingw32" = "yes" ; then
310 linux="no"
311 EXESUF=".exe"
312 oss="no"
313 if [ "$cpu" = "i386" ] ; then
314 kqemu="yes"
315 fi
316 fi
318 # Check for gcc4, error if pre-gcc4
319 if test "$check_gcc" = "yes" ; then
320 cat > $TMPC <<EOF
321 #if __GNUC__ < 4
322 #error gcc3
323 #endif
324 int main(){return 0;}
325 EOF
326 check_cc() {
327 which "$1" >&/dev/null
328 return $?
329 }
331 if "$cc" -o $TMPE $TMPC 2>/dev/null ; then
332 echo "WARNING: \"$cc\" looks like gcc 4.x"
333 found_compat_cc="no"
334 if test "$gcc3_search" = "yes" ; then
335 echo "Looking for gcc 3.x"
336 for compat_cc in $gcc3_list ; do
337 if check_cc "$compat_cc" ; then
338 echo "Found \"$compat_cc\""
339 cc="$compat_cc"
340 found_compat_cc="yes"
341 break
342 fi
343 done
344 if test "$found_compat_cc" = "no" ; then
345 echo "gcc 3.x not found!"
346 fi
347 fi
348 if test "$found_compat_cc" = "no" ; then
349 echo "QEMU is known to have problems when compiled with gcc 4.x"
350 echo "It is recommended that you use gcc 3.x to build QEMU"
351 echo "To use this compiler anyway, configure with --disable-gcc-check"
352 exit 1;
353 fi
354 fi
355 fi
357 #
358 # Solaris specific configure tool chain decisions
359 #
360 if test "$solaris" = "yes" ; then
361 #
362 # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
363 # override the check with --disable-gcc-check
364 #
365 if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
366 solgcc=`which $cc`
367 if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
368 echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
369 echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
370 echo "or get the latest patch from SunSolve for gcc"
371 exit 1
372 fi
373 fi
374 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
375 if test -z "$solinst" ; then
376 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
377 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
378 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
379 exit 1
380 fi
381 if test "$solinst" = "/usr/sbin/install" ; then
382 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
383 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
384 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
385 exit 1
386 fi
387 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
388 if test -z "$sol_ar" ; then
389 echo "Error: No path includes ar"
390 if test -f /usr/ccs/bin/ar ; then
391 echo "Add /usr/ccs/bin to your path and rerun configure"
392 fi
393 exit 1
394 fi
395 fi
397 ##########################################
399 # VNC TLS detection
400 if test "$vnc_tls" = "yes" ; then
401 `pkg-config gnutls` || vnc_tls="no"
402 fi
403 if test "$vnc_tls" = "yes" ; then
404 vnc_tls_cflags=`pkg-config --cflags gnutls`
405 vnc_tls_libs=`pkg-config --libs gnutls`
406 fi
408 ##########################################
410 if test -z "$target_list" ; then
411 # these targets are portable
412 if [ "$softmmu" = "yes" ] ; then
413 target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu"
414 fi
415 # the following are Linux specific
416 if [ "$linux_user" = "yes" ] ; then
417 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"
418 fi
419 # the following are Darwin specific
420 if [ "$darwin_user" = "yes" ] ; then
421 target_list="i386-darwin-user ppc-darwin-user $target_list"
422 fi
423 # the i386-dm target
424 if test "$stubdom" = "yes"; then
425 target_list="i386-dm-stubdom"
426 else
427 target_list="i386-dm"
428 fi
429 else
430 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
431 fi
432 if test -z "$target_list" ; then
433 echo "No targets enabled"
434 exit 1
435 fi
437 kqemu="no"
439 if test -z "$cross_prefix" ; then
441 # ---
442 # big/little endian test
443 cat > $TMPC << EOF
444 #include <inttypes.h>
445 int main(int argc, char ** argv){
446 volatile uint32_t i=0x01234567;
447 return (*((uint8_t*)(&i))) == 0x67;
448 }
449 EOF
451 if $cc -o $TMPE $TMPC 2>/dev/null ; then
452 $TMPE && bigendian="yes"
453 else
454 echo big/little test failed
455 fi
457 else
459 # if cross compiling, cannot launch a program, so make a static guess
460 if test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then
461 bigendian="yes"
462 fi
464 fi
466 # host long bits test
467 hostlongbits="32"
468 if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
469 hostlongbits="64"
470 fi
472 # check gcc options support
473 cat > $TMPC <<EOF
474 int main(void) {
475 }
476 EOF
478 have_gcc3_options="no"
479 if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
480 have_gcc3_options="yes"
481 fi
483 ##########################################
484 # SDL probe
486 sdl_too_old=no
488 if test -z "$sdl" ; then
490 sdl_config="sdl-config"
491 sdl=no
492 sdl_static=no
494 if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
495 # win32 cross compilation case
496 sdl_config="i386-mingw32msvc-sdl-config"
497 sdl=yes
498 else
499 # normal SDL probe
500 cat > $TMPC << EOF
501 #include <SDL.h>
502 #undef main /* We don't want SDL to override our main() */
503 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
504 EOF
506 if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
507 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
508 if test "$_sdlversion" -lt 121 ; then
509 sdl_too_old=yes
510 else
511 if test "$cocoa" = "no" ; then
512 sdl=yes
513 fi
514 fi
516 # static link with sdl ?
517 if test "$sdl" = "yes" ; then
518 aa="no"
519 `$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
520 sdl_static_libs=`$sdl_config --static-libs`
521 if [ "$aa" = "yes" ] ; then
522 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
523 fi
525 if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
526 sdl_static=yes
527 fi
529 fi # static link
531 fi # sdl compile test
533 fi # cross compilation
535 else
536 # Make sure to disable cocoa if sdl was set
537 if test "$sdl" = "yes" ; then
538 cocoa="no"
539 coreaudio="no"
540 fi
541 fi # -z $sdl
543 ##########################################
544 # OpenGL test
546 if test -z "$opengl" && test "$sdl" = "yes"
547 then
548 cat > $TMPC << EOF
549 #include <SDL_opengl.h>
550 #ifndef GL_TEXTURE_RECTANGLE_ARB
551 #error "Opengl doesn't support GL_TEXTURE_RECTANGLE_ARB"
552 #endif
553 int main( void ) { return (int) glGetString(GL_EXTENSIONS); }
554 EOF
555 if $cc -o $TMPE `$sdl_config --cflags --libs 2> /dev/null` -I/usr/include/GL $TMPC -lXext -lGL 2> /dev/null
556 then
557 opengl="yes"
558 else
559 opengl="no"
560 fi
561 fi
563 ##########################################
564 # alsa sound support libraries
566 if test "$alsa" = "yes" ; then
567 cat > $TMPC << EOF
568 #include <alsa/asoundlib.h>
569 int main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); }
570 EOF
571 if $cc -o $TMPE $TMPC -lasound 2> /dev/null ; then
572 :
573 else
574 echo
575 echo "Error: Could not find alsa"
576 echo "Make sure to have the alsa libs and headers installed."
577 echo
578 exit 1
579 fi
580 fi
582 # Check if tools are available to build documentation.
583 if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
584 build_docs="yes"
585 fi
587 if test "$mingw32" = "yes" ; then
588 if test -z "$prefix" ; then
589 prefix="/c/Program Files/Qemu"
590 fi
591 mandir="$prefix"
592 datadir="$prefix"
593 docdir="$prefix"
594 bindir="$prefix"
595 configdir=""
596 else
597 if test -z "$prefix" ; then
598 prefix="/usr/local"
599 fi
600 mandir="$prefix/share/man"
601 datadir="$prefix/share/xen/qemu"
602 docdir="$prefix/share/doc/qemu"
603 bindir="$prefix/$libdir/xen/bin"
604 configdir="/etc/xen"
605 fi
607 if test "$stubdom" = "yes"; then
608 oss="no"
609 sdl="no"
610 fi
612 echo "Install prefix $prefix"
613 echo "BIOS directory $datadir"
614 echo "binary directory $bindir"
615 if test "$mingw32" = "no" ; then
616 echo "Manual directory $mandir"
617 echo "ELF interp prefix $interp_prefix"
618 fi
619 echo "Source path $source_path"
620 echo "C compiler $cc"
621 echo "Host C compiler $host_cc"
622 echo "make $make"
623 echo "install $install"
624 echo "host CPU $cpu"
625 echo "host big endian $bigendian"
626 echo "target list $target_list"
627 echo "gprof enabled $gprof"
628 echo "profiler $profiler"
629 echo "static build $static"
630 if test "$darwin" = "yes" ; then
631 echo "Cocoa support $cocoa"
632 fi
633 echo "SDL support $sdl"
634 if test "$sdl" != "no" ; then
635 echo "SDL static link $sdl_static"
636 fi
637 echo "OpenGL support $opengl"
638 echo "mingw32 support $mingw32"
639 echo "Adlib support $adlib"
640 echo "CoreAudio support $coreaudio"
641 echo "ALSA support $alsa"
642 echo "DSound support $dsound"
643 if test "$fmod" = "yes"; then
644 if test -z $fmod_lib || test -z $fmod_inc; then
645 echo
646 echo "Error: You must specify path to FMOD library and headers"
647 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
648 echo
649 exit 1
650 fi
651 fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
652 else
653 fmod_support=""
654 fi
655 echo "FMOD support $fmod $fmod_support"
656 echo "kqemu support $kqemu"
657 echo "Documentation $build_docs"
658 [ ! -z "$uname_release" ] && \
659 echo "uname -r $uname_release"
661 if test $sdl_too_old = "yes"; then
662 echo "-> Your SDL version is too old - please upgrade to have SDL support"
663 fi
664 #if test "$sdl_static" = "no"; then
665 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
666 #fi
667 config_mak="config-host.mak"
668 config_h="config-host.h"
670 #echo "Creating $config_mak and $config_h"
672 echo "# Automatically generated by configure - do not modify" > $config_mak
673 echo "# Configured with: $0 $@" >> $config_mak
674 echo "/* Automatically generated by configure - do not modify */" > $config_h
676 echo "prefix=$prefix" >> $config_mak
677 echo "bindir=$bindir" >> $config_mak
678 echo "mandir=$mandir" >> $config_mak
679 echo "datadir=$datadir" >> $config_mak
680 echo "docdir=$docdir" >> $config_mak
681 echo "configdir=$configdir" >> $config_mak
682 echo "LIBDIR=$libdir" >> $config_mak
683 echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
684 echo "MAKE=$make" >> $config_mak
685 echo "INSTALL=$install" >> $config_mak
686 echo "CC=$cc" >> $config_mak
687 if test "$have_gcc3_options" = "yes" ; then
688 echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
689 fi
690 echo "HOST_CC=$host_cc" >> $config_mak
691 echo "AR=$ar" >> $config_mak
692 echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
693 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
694 echo "CFLAGS=$CFLAGS" >> $config_mak
695 echo "LDFLAGS=$LDFLAGS" >> $config_mak
696 echo "EXESUF=$EXESUF" >> $config_mak
697 if test "$cpu" = "i386" ; then
698 echo "ARCH=i386" >> $config_mak
699 echo "#define HOST_I386 1" >> $config_h
700 elif test "$cpu" = "x86_64" ; then
701 echo "ARCH=x86_64" >> $config_mak
702 echo "#define HOST_X86_64 1" >> $config_h
703 elif test "$cpu" = "armv4b" ; then
704 echo "ARCH=arm" >> $config_mak
705 echo "#define HOST_ARM 1" >> $config_h
706 elif test "$cpu" = "armv4l" ; then
707 echo "ARCH=arm" >> $config_mak
708 echo "#define HOST_ARM 1" >> $config_h
709 elif test "$cpu" = "powerpc" ; then
710 echo "ARCH=ppc" >> $config_mak
711 echo "#define HOST_PPC 1" >> $config_h
712 elif test "$cpu" = "mips" ; then
713 echo "ARCH=mips" >> $config_mak
714 echo "#define HOST_MIPS 1" >> $config_h
715 elif test "$cpu" = "s390" ; then
716 echo "ARCH=s390" >> $config_mak
717 echo "#define HOST_S390 1" >> $config_h
718 elif test "$cpu" = "alpha" ; then
719 echo "ARCH=alpha" >> $config_mak
720 echo "#define HOST_ALPHA 1" >> $config_h
721 elif test "$cpu" = "sparc" ; then
722 echo "ARCH=sparc" >> $config_mak
723 echo "#define HOST_SPARC 1" >> $config_h
724 elif test "$cpu" = "sparc64" ; then
725 echo "ARCH=sparc64" >> $config_mak
726 echo "#define HOST_SPARC64 1" >> $config_h
727 elif test "$cpu" = "ia64" ; then
728 echo "ARCH=ia64" >> $config_mak
729 echo "#define HOST_IA64 1" >> $config_h
730 elif test "$cpu" = "m68k" ; then
731 echo "ARCH=m68k" >> $config_mak
732 echo "#define HOST_M68K 1" >> $config_h
733 else
734 echo "Unsupported CPU"
735 exit 1
736 fi
737 if test "$bigendian" = "yes" ; then
738 echo "WORDS_BIGENDIAN=yes" >> $config_mak
739 echo "#define WORDS_BIGENDIAN 1" >> $config_h
740 fi
741 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
742 if test "$mingw32" = "yes" ; then
743 echo "CONFIG_WIN32=yes" >> $config_mak
744 echo "#define CONFIG_WIN32 1" >> $config_h
745 elif test -f "/usr/include/byteswap.h" ; then
746 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
747 fi
748 if test "$darwin" = "yes" ; then
749 echo "CONFIG_DARWIN=yes" >> $config_mak
750 echo "#define CONFIG_DARWIN 1" >> $config_h
751 fi
752 if test "$solaris" = "yes" ; then
753 echo "CONFIG_SOLARIS=yes" >> $config_mak
754 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
755 fi
756 if test "$gdbstub" = "yes" ; then
757 echo "CONFIG_GDBSTUB=yes" >> $config_mak
758 echo "#define CONFIG_GDBSTUB 1" >> $config_h
759 fi
760 if test "$gprof" = "yes" ; then
761 echo "TARGET_GPROF=yes" >> $config_mak
762 echo "#define HAVE_GPROF 1" >> $config_h
763 fi
764 if test "$static" = "yes" ; then
765 echo "CONFIG_STATIC=yes" >> $config_mak
766 echo "#define CONFIG_STATIC 1" >> $config_h
767 fi
768 if test $profiler = "yes" ; then
769 echo "#define CONFIG_PROFILER 1" >> $config_h
770 fi
771 if test "$slirp" = "yes" ; then
772 echo "CONFIG_SLIRP=yes" >> $config_mak
773 echo "#define CONFIG_SLIRP 1" >> $config_h
774 fi
775 if test "$adlib" = "yes" ; then
776 echo "CONFIG_ADLIB=yes" >> $config_mak
777 echo "#define CONFIG_ADLIB 1" >> $config_h
778 fi
779 if test "$oss" = "yes" ; then
780 echo "CONFIG_OSS=yes" >> $config_mak
781 echo "#define CONFIG_OSS 1" >> $config_h
782 fi
783 if test "$coreaudio" = "yes" ; then
784 echo "CONFIG_COREAUDIO=yes" >> $config_mak
785 echo "#define CONFIG_COREAUDIO 1" >> $config_h
786 fi
787 if test "$alsa" = "yes" ; then
788 echo "CONFIG_ALSA=yes" >> $config_mak
789 echo "#define CONFIG_ALSA 1" >> $config_h
790 fi
791 if test "$dsound" = "yes" ; then
792 echo "CONFIG_DSOUND=yes" >> $config_mak
793 echo "#define CONFIG_DSOUND 1" >> $config_h
794 fi
795 if test "$fmod" = "yes" ; then
796 echo "CONFIG_FMOD=yes" >> $config_mak
797 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
798 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
799 echo "#define CONFIG_FMOD 1" >> $config_h
800 fi
801 if test "$vnc_tls" = "yes" ; then
802 echo "CONFIG_VNC_TLS=yes" >> $config_mak
803 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
804 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
805 echo "#define CONFIG_VNC_TLS 1" >> $config_h
806 fi
807 qemu_version=`head $source_path/VERSION`
808 echo "VERSION=$qemu_version" >>$config_mak
809 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
811 echo "SRC_PATH=$source_path" >> $config_mak
812 if [ "$source_path_used" = "yes" ]; then
813 echo "VPATH=$source_path" >> $config_mak
814 fi
815 echo "TARGET_DIRS=$target_list" >> $config_mak
816 if [ "$build_docs" = "yes" ] ; then
817 echo "BUILD_DOCS=yes" >> $config_mak
818 fi
820 # XXX: suppress that
821 if [ "$bsd" = "yes" ] ; then
822 echo "#define O_LARGEFILE 0" >> $config_h
823 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
824 echo "#define _BSD 1" >> $config_h
825 fi
827 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
829 for target in $target_list; do
830 target_dir="$target"
831 config_mak=$target_dir/config.mak
832 config_h=$target_dir/config.h
833 target_cpu=`echo $target | cut -d '-' -f 1`
834 target_bigendian="no"
835 [ "$target_cpu" = "armeb" ] && target_bigendian=yes
836 [ "$target_cpu" = "sparc" ] && target_bigendian=yes
837 [ "$target_cpu" = "sparc64" ] && target_bigendian=yes
838 [ "$target_cpu" = "ppc" ] && target_bigendian=yes
839 [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
840 [ "$target_cpu" = "mips" ] && target_bigendian=yes
841 [ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
842 [ "$target_cpu" = "m68k" ] && target_bigendian=yes
843 target_softmmu="no"
844 if expr $target : '.*-softmmu' > /dev/null ; then
845 target_softmmu="yes"
846 fi
847 #for support 256M guest
848 target_softmmu="yes"
849 target_user_only="no"
850 if expr $target : '.*-user' > /dev/null ; then
851 target_user_only="yes"
852 fi
854 target_linux_user="no"
855 if expr $target : '.*-linux-user' > /dev/null ; then
856 target_linux_user="yes"
857 fi
859 target_darwin_user="no"
860 if expr $target : '.*-darwin-user' > /dev/null ; then
861 target_darwin_user="yes"
862 fi
864 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
866 mkdir -p $target_dir
867 mkdir -p $target_dir/fpu
868 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then
869 mkdir -p $target_dir/nwfpe
870 fi
871 if test "$target_user_only" = "no" ; then
872 mkdir -p $target_dir/slirp
873 fi
875 #
876 # don't use ln -sf as not all "ln -sf" over write the file/link
877 #
878 rm -f $target_dir/Makefile
879 ln -s ../Makefile.target $target_dir/Makefile
882 echo "# Automatically generated by configure - do not modify" > $config_mak
883 echo "/* Automatically generated by configure - do not modify */" > $config_h
886 echo "include ../config-host.mak" >> $config_mak
887 echo "#include \"../config-host.h\"" >> $config_h
889 bflt="no"
890 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
891 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
893 target_sub=
894 if expr $target : '.*-dm' > /dev/null ; then
895 target_sub=-dm
896 fi
897 echo "TARGET_SUB=${target_sub}" >> $config_mak
899 if test "$target_cpu" = "i386" ; then
900 echo "TARGET_ARCH=i386" >> $config_mak
901 echo "#define TARGET_ARCH \"i386\"" >> $config_h
902 echo "#define TARGET_I386 1" >> $config_h
903 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
904 echo "#define USE_KQEMU 1" >> $config_h
905 fi
906 elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
907 echo "TARGET_ARCH=arm" >> $config_mak
908 echo "#define TARGET_ARCH \"arm\"" >> $config_h
909 echo "#define TARGET_ARM 1" >> $config_h
910 bflt="yes"
911 elif test "$target_cpu" = "sparc" ; then
912 echo "TARGET_ARCH=sparc" >> $config_mak
913 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
914 echo "#define TARGET_SPARC 1" >> $config_h
915 elif test "$target_cpu" = "sparc64" ; then
916 echo "TARGET_ARCH=sparc64" >> $config_mak
917 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
918 echo "#define TARGET_SPARC 1" >> $config_h
919 echo "#define TARGET_SPARC64 1" >> $config_h
920 elif test "$target_cpu" = "ppc" ; then
921 echo "TARGET_ARCH=ppc" >> $config_mak
922 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
923 echo "#define TARGET_PPC 1" >> $config_h
924 elif test "$target_cpu" = "ppc64" ; then
925 echo "TARGET_ARCH=ppc64" >> $config_mak
926 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
927 echo "#define TARGET_PPC 1" >> $config_h
928 echo "#define TARGET_PPC64 1" >> $config_h
929 elif test "$target_cpu" = "x86_64" ; then
930 echo "TARGET_ARCH=x86_64" >> $config_mak
931 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
932 echo "#define TARGET_I386 1" >> $config_h
933 echo "#define TARGET_X86_64 1" >> $config_h
934 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64" ; then
935 echo "#define USE_KQEMU 1" >> $config_h
936 fi
937 elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
938 echo "TARGET_ARCH=mips" >> $config_mak
939 echo "#define TARGET_ARCH \"mips\"" >> $config_h
940 echo "#define TARGET_MIPS 1" >> $config_h
941 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
942 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
943 elif test "$target_cpu" = "sh4" -o "$target_cpu" = "sh4eb" ; then
944 echo "TARGET_ARCH=sh4" >> $config_mak
945 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
946 echo "#define TARGET_SH4 1" >> $config_h
947 bflt="yes"
948 elif test "$target_cpu" = "m68k" ; then
949 echo "TARGET_ARCH=m68k" >> $config_mak
950 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
951 echo "#define TARGET_M68K 1" >> $config_h
952 bflt="yes"
953 else
954 echo "Unsupported target CPU"
955 exit 1
956 fi
957 if test "$target_bigendian" = "yes" ; then
958 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
959 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
960 fi
961 if test "$target_softmmu" = "yes" ; then
962 echo "CONFIG_SOFTMMU=yes" >> $config_mak
963 echo "#define CONFIG_SOFTMMU 1" >> $config_h
964 fi
965 if test "$target_user_only" = "yes" ; then
966 echo "CONFIG_USER_ONLY=yes" >> $config_mak
967 echo "#define CONFIG_USER_ONLY 1" >> $config_h
968 fi
969 if test "$target_linux_user" = "yes" ; then
970 echo "CONFIG_LINUX_USER=yes" >> $config_mak
971 echo "#define CONFIG_LINUX_USER 1" >> $config_h
972 fi
973 if test "$target_darwin_user" = "yes" ; then
974 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
975 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
976 fi
977 if expr $target : '.*-dm' > /dev/null ; then
978 echo "#define CONFIG_DM 1" >> $config_h
979 fi
981 if test "$stubdom" = "yes" ; then
982 echo "CONFIG_STUBDOM=yes" >> $config_mak
983 echo "#define CONFIG_STUBDOM 1" >> $config_h
984 echo "#define NO_UNIX_SOCKETS 1" >> $config_h
985 echo "#define NO_DAEMONIZE 1" >> $config_h
986 echo "#define NO_AIO 1" >> $config_h
987 fi
989 if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" -o "$target_cpu" = "sparc" -o "$target_cpu" = "sparc64" -o "$target_cpu" = "m68k"; then
990 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
991 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
992 fi
993 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
994 echo "TARGET_HAS_BFLT=yes" >> $config_mak
995 echo "#define TARGET_HAS_BFLT 1" >> $config_h
996 fi
997 # sdl defines
999 if test "$target_user_only" = "no"; then
1000 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1001 sdl1=$sdl_static
1002 else
1003 sdl1=$sdl
1004 fi
1005 if test "$sdl1" = "yes" ; then
1006 echo "#define CONFIG_SDL 1" >> $config_h
1007 echo "CONFIG_SDL=yes" >> $config_mak
1008 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1009 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1010 else
1011 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1012 fi
1013 if [ "${aa}" = "yes" ] ; then
1014 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1015 else
1016 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1017 fi
1018 fi
1019 fi
1021 if test $opengl = "yes"
1022 then
1023 echo "#define CONFIG_OPENGL 1" >> $config_h
1024 echo "CONFIG_OPENGL=yes" >> $config_mak
1025 echo "SDL_CFLAGS+=-I/usr/include/GL" >> $config_mak
1026 echo "SDL_LIBS+=-lXext" >> $config_mak
1027 echo "SDL_LIBS+=-lGL" >> $config_mak
1028 fi
1030 if test "$cocoa" = "yes" ; then
1031 echo "#define CONFIG_COCOA 1" >> $config_h
1032 echo "CONFIG_COCOA=yes" >> $config_mak
1033 fi
1035 done # for target in $targets
1037 # build tree in object directory if source path is different from current one
1038 if test "$source_path_used" = "yes" ; then
1039 DIRS="tests"
1040 FILES="Makefile tests/Makefile"
1041 for dir in $DIRS ; do
1042 mkdir -p $dir
1043 done
1044 # remove the link and recreate it, as not all "ln -sf" overwrite the link
1045 for f in $FILES ; do
1046 rm -f $f
1047 ln -s $source_path/$f $f
1048 done
1049 fi
1051 echo "VNC TLS support $vnc_tls"
1052 if test "$vnc_tls" = "yes" ; then
1053 echo " TLS CFLAGS $vnc_tls_cflags"
1054 echo " TLS LIBS $vnc_tls_libs"
1055 fi
1057 rm -f $TMPO $TMPC $TMPE $TMPS