]> git.proxmox.com Git - mirror_qemu.git/blob - configure
Fix OpenSolaris softfloat warnings
[mirror_qemu.git] / configure
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
13
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"
18 TMPI="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.i"
19 TMPSDLLOG="${TMPDIR1}/qemu-conf-sdl-$$-${RANDOM}.log"
20
21 trap "rm -f $TMPC $TMPO $TMPE $TMPS $TMPI $TMPSDLLOG; exit" 0 2 3 15
22
23 # default parameters
24 prefix=""
25 interp_prefix="/usr/gnemul/qemu-%M"
26 static="no"
27 cross_prefix=""
28 cc="gcc"
29 audio_drv_list=""
30 audio_card_list="ac97 es1370 sb16"
31 audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus"
32 host_cc="gcc"
33 ar="ar"
34 make="make"
35 install="install"
36 strip="strip"
37
38 # parse CC options first
39 for opt do
40 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
41 case "$opt" in
42 --cross-prefix=*) cross_prefix="$optarg"
43 ;;
44 --cc=*) cc="$optarg"
45 ;;
46 esac
47 done
48
49 # OS specific
50 # Using uname is really, really broken. Once we have the right set of checks
51 # we can eliminate it's usage altogether
52
53 cc="${cross_prefix}${cc}"
54 ar="${cross_prefix}${ar}"
55 strip="${cross_prefix}${strip}"
56
57 # check that the C compiler works.
58 cat > $TMPC <<EOF
59 int main(void) {}
60 EOF
61
62 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
63 : C compiler works ok
64 else
65 echo "ERROR: \"$cc\" either does not exist or does not work"
66 exit 1
67 fi
68
69 check_define() {
70 cat > $TMPC <<EOF
71 #if !defined($1)
72 #error Not defined
73 #endif
74 int main(void) { return 0; }
75 EOF
76 $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
77 }
78
79 if check_define __i386__ ; then
80 cpu="i386"
81 elif check_define __x86_64__ ; then
82 cpu="x86_64"
83 elif check_define __sparc__ ; then
84 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
85 # They must be specified using --sparc_cpu
86 if check_define __arch64__ ; then
87 cpu="sparc64"
88 else
89 cpu="sparc"
90 fi
91 elif check_define _ARCH_PPC ; then
92 if check_define _ARCH_PPC64 ; then
93 cpu="ppc64"
94 else
95 cpu="ppc"
96 fi
97 else
98 cpu=`uname -m`
99 fi
100
101 target_list=""
102 case "$cpu" in
103 i386|i486|i586|i686|i86pc|BePC)
104 cpu="i386"
105 ;;
106 x86_64|amd64)
107 cpu="x86_64"
108 ;;
109 alpha)
110 cpu="alpha"
111 ;;
112 armv*b)
113 cpu="armv4b"
114 ;;
115 armv*l)
116 cpu="armv4l"
117 ;;
118 cris)
119 cpu="cris"
120 ;;
121 parisc|parisc64)
122 cpu="hppa"
123 ;;
124 ia64)
125 cpu="ia64"
126 ;;
127 m68k)
128 cpu="m68k"
129 ;;
130 mips)
131 cpu="mips"
132 ;;
133 mips64)
134 cpu="mips64"
135 ;;
136 ppc)
137 cpu="ppc"
138 ;;
139 ppc64)
140 cpu="ppc64"
141 ;;
142 s390*)
143 cpu="s390"
144 ;;
145 sparc|sun4[cdmuv])
146 cpu="sparc"
147 ;;
148 sparc64)
149 cpu="sparc64"
150 ;;
151 *)
152 cpu="unknown"
153 ;;
154 esac
155 gprof="no"
156 sparse="no"
157 strip_opt="yes"
158 bigendian="no"
159 mingw32="no"
160 EXESUF=""
161 gdbstub="yes"
162 slirp="yes"
163 vde="yes"
164 fmod_lib=""
165 fmod_inc=""
166 oss_lib=""
167 vnc_tls="yes"
168 vnc_sasl="yes"
169 bsd="no"
170 linux="no"
171 solaris="no"
172 kqemu="no"
173 profiler="no"
174 cocoa="no"
175 check_gfx="yes"
176 softmmu="yes"
177 linux_user="no"
178 darwin_user="no"
179 bsd_user="no"
180 build_docs="no"
181 uname_release=""
182 curses="yes"
183 aio="yes"
184 nptl="yes"
185 mixemu="no"
186 bluez="yes"
187 kvm="yes"
188 kerneldir=""
189 aix="no"
190 blobs="yes"
191 fdt="yes"
192 sdl_x11="no"
193 pkgversion=""
194
195 # OS specific
196 if check_define __linux__ ; then
197 targetos="Linux"
198 elif check_define _WIN32 ; then
199 targetos='MINGW32'
200 else
201 targetos=`uname -s`
202 fi
203 case $targetos in
204 CYGWIN*)
205 mingw32="yes"
206 OS_CFLAGS="-mno-cygwin"
207 if [ "$cpu" = "i386" ] ; then
208 kqemu="yes"
209 fi
210 audio_possible_drivers="sdl"
211 ;;
212 MINGW32*)
213 mingw32="yes"
214 if [ "$cpu" = "i386" ] ; then
215 kqemu="yes"
216 fi
217 audio_possible_drivers="dsound sdl fmod"
218 ;;
219 GNU/kFreeBSD)
220 audio_drv_list="oss"
221 audio_possible_drivers="oss sdl esd pa"
222 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
223 kqemu="yes"
224 fi
225 ;;
226 FreeBSD)
227 bsd="yes"
228 audio_drv_list="oss"
229 audio_possible_drivers="oss sdl esd pa"
230 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
231 kqemu="yes"
232 fi
233 ;;
234 DragonFly)
235 bsd="yes"
236 audio_drv_list="oss"
237 audio_possible_drivers="oss sdl esd pa"
238 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
239 kqemu="yes"
240 fi
241 aio="no"
242 ;;
243 NetBSD)
244 bsd="yes"
245 audio_drv_list="oss"
246 audio_possible_drivers="oss sdl esd"
247 oss_lib="-lossaudio"
248 ;;
249 OpenBSD)
250 bsd="yes"
251 openbsd="yes"
252 audio_drv_list="oss"
253 audio_possible_drivers="oss sdl esd"
254 oss_lib="-lossaudio"
255 ;;
256 Darwin)
257 bsd="yes"
258 darwin="yes"
259 # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can run 64-bit userspace code
260 if [ "$cpu" = "i386" ] ; then
261 is_x86_64=`sysctl -n hw.optional.x86_64`
262 [ "$is_x86_64" = "1" ] && cpu=x86_64
263 fi
264 if [ "$cpu" = "x86_64" ] ; then
265 OS_CFLAGS="-arch x86_64"
266 LDFLAGS="-arch x86_64"
267 else
268 OS_CFLAGS="-mdynamic-no-pic"
269 fi
270 darwin_user="yes"
271 cocoa="yes"
272 audio_drv_list="coreaudio"
273 audio_possible_drivers="coreaudio sdl fmod"
274 OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
275 ;;
276 SunOS)
277 solaris="yes"
278 make="gmake"
279 install="ginstall"
280 needs_libsunmath="no"
281 kvm="no"
282 solarisrev=`uname -r | cut -f2 -d.`
283 # have to select again, because `uname -m` returns i86pc
284 # even on an x86_64 box.
285 solariscpu=`isainfo -k`
286 if test "${solariscpu}" = "amd64" ; then
287 cpu="x86_64"
288 fi
289 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
290 if test "$solarisrev" -le 9 ; then
291 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
292 needs_libsunmath="yes"
293 else
294 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
295 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
296 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
297 echo "Studio 11 can be downloaded from www.sun.com."
298 exit 1
299 fi
300 fi
301 if test "$solarisrev" -ge 9 ; then
302 kqemu="yes"
303 fi
304 fi
305 if test -f /usr/include/sys/soundcard.h ; then
306 audio_drv_list="oss"
307 fi
308 audio_possible_drivers="oss sdl"
309 OS_CFLAGS=-std=gnu99
310 ;;
311 AIX)
312 aix="yes"
313 make="gmake"
314 ;;
315 *)
316 audio_drv_list="oss"
317 audio_possible_drivers="oss alsa sdl esd pa"
318 linux="yes"
319 linux_user="yes"
320 usb="linux"
321 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
322 kqemu="yes"
323 audio_possible_drivers="$audio_possible_drivers fmod"
324 fi
325 ;;
326 esac
327
328 if [ "$bsd" = "yes" ] ; then
329 if [ "$darwin" != "yes" ] ; then
330 make="gmake"
331 usb="bsd"
332 fi
333 bsd_user="yes"
334 fi
335
336 # find source path
337 source_path=`dirname "$0"`
338 source_path_used="no"
339 workdir=`pwd`
340 if [ -z "$source_path" ]; then
341 source_path=$workdir
342 else
343 source_path=`cd "$source_path"; pwd`
344 fi
345 [ -f "$workdir/vl.c" ] || source_path_used="yes"
346
347 werror="no"
348 # generate compile errors on warnings for development builds
349 #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
350 #werror="yes";
351 #fi
352
353 for opt do
354 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
355 case "$opt" in
356 --help|-h) show_help=yes
357 ;;
358 --prefix=*) prefix="$optarg"
359 ;;
360 --interp-prefix=*) interp_prefix="$optarg"
361 ;;
362 --source-path=*) source_path="$optarg"
363 source_path_used="yes"
364 ;;
365 --cross-prefix=*)
366 ;;
367 --cc=*)
368 ;;
369 --host-cc=*) host_cc="$optarg"
370 ;;
371 --make=*) make="$optarg"
372 ;;
373 --install=*) install="$optarg"
374 ;;
375 --extra-cflags=*) CFLAGS="$optarg"
376 ;;
377 --extra-ldflags=*) LDFLAGS="$optarg"
378 ;;
379 --cpu=*) cpu="$optarg"
380 ;;
381 --target-list=*) target_list="$optarg"
382 ;;
383 --enable-gprof) gprof="yes"
384 ;;
385 --static) static="yes"
386 ;;
387 --disable-sdl) sdl="no"
388 ;;
389 --fmod-lib=*) fmod_lib="$optarg"
390 ;;
391 --fmod-inc=*) fmod_inc="$optarg"
392 ;;
393 --oss-lib=*) oss_lib="$optarg"
394 ;;
395 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
396 ;;
397 --audio-drv-list=*) audio_drv_list="$optarg"
398 ;;
399 --enable-sparse) sparse="yes"
400 ;;
401 --disable-sparse) sparse="no"
402 ;;
403 --disable-strip) strip_opt="no"
404 ;;
405 --disable-vnc-tls) vnc_tls="no"
406 ;;
407 --disable-vnc-sasl) vnc_sasl="no"
408 ;;
409 --disable-slirp) slirp="no"
410 ;;
411 --disable-vde) vde="no"
412 ;;
413 --disable-kqemu) kqemu="no"
414 ;;
415 --disable-brlapi) brlapi="no"
416 ;;
417 --disable-bluez) bluez="no"
418 ;;
419 --disable-kvm) kvm="no"
420 ;;
421 --enable-profiler) profiler="yes"
422 ;;
423 --enable-cocoa)
424 cocoa="yes" ;
425 sdl="no" ;
426 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
427 ;;
428 --disable-gfx-check) check_gfx="no"
429 ;;
430 --disable-system) softmmu="no"
431 ;;
432 --enable-system) softmmu="yes"
433 ;;
434 --disable-linux-user) linux_user="no"
435 ;;
436 --enable-linux-user) linux_user="yes"
437 ;;
438 --disable-darwin-user) darwin_user="no"
439 ;;
440 --enable-darwin-user) darwin_user="yes"
441 ;;
442 --disable-bsd-user) bsd_user="no"
443 ;;
444 --enable-bsd-user) bsd_user="yes"
445 ;;
446 --enable-uname-release=*) uname_release="$optarg"
447 ;;
448 --sparc_cpu=*)
449 sparc_cpu="$optarg"
450 case $sparc_cpu in
451 v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
452 target_cpu="sparc"; cpu="sparc" ;;
453 v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
454 target_cpu="sparc"; cpu="sparc" ;;
455 v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
456 target_cpu="sparc64"; cpu="sparc64" ;;
457 *) echo "undefined SPARC architecture. Exiting";exit 1;;
458 esac
459 ;;
460 --enable-werror) werror="yes"
461 ;;
462 --disable-werror) werror="no"
463 ;;
464 --disable-curses) curses="no"
465 ;;
466 --disable-nptl) nptl="no"
467 ;;
468 --enable-mixemu) mixemu="yes"
469 ;;
470 --disable-aio) aio="no"
471 ;;
472 --disable-blobs) blobs="no"
473 ;;
474 --kerneldir=*) kerneldir="$optarg"
475 ;;
476 --with-pkgversion=*) pkgversion=" ($optarg)"
477 ;;
478 *) echo "ERROR: unknown option $opt"; show_help="yes"
479 ;;
480 esac
481 done
482
483 # default flags for all hosts
484 CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
485 CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
486 LDFLAGS="$LDFLAGS -g"
487 if test "$werror" = "yes" ; then
488 CFLAGS="$CFLAGS -Werror"
489 fi
490
491 if test "$solaris" = "no" ; then
492 if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
493 LDFLAGS="$LDFLAGS -Wl,--warn-common"
494 fi
495 fi
496
497 #
498 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
499 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
500 #
501 case "$cpu" in
502 sparc) if test -z "$sparc_cpu" ; then
503 ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
504 ARCH_LDFLAGS="-m32"
505 else
506 ARCH_CFLAGS="${SP_CFLAGS}"
507 ARCH_LDFLAGS="${SP_LDFLAGS}"
508 fi
509 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g2 -ffixed-g3"
510 if test "$solaris" = "no" ; then
511 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g6"
512 fi
513 ;;
514 sparc64) if test -z "$sparc_cpu" ; then
515 ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
516 ARCH_LDFLAGS="-m64"
517 else
518 ARCH_CFLAGS="${SP_CFLAGS}"
519 ARCH_LDFLAGS="${SP_LDFLAGS}"
520 fi
521 if test "$solaris" = "no" ; then
522 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g5 -ffixed-g6 -ffixed-g7"
523 else
524 ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7"
525 fi
526 ;;
527 s390)
528 ARCH_CFLAGS="-march=z900"
529 ;;
530 i386)
531 ARCH_CFLAGS="-m32"
532 ARCH_LDFLAGS="-m32"
533 ;;
534 x86_64)
535 ARCH_CFLAGS="-m64"
536 ARCH_LDFLAGS="-m64"
537 ;;
538 esac
539
540 if test x"$show_help" = x"yes" ; then
541 cat << EOF
542
543 Usage: configure [options]
544 Options: [defaults in brackets after descriptions]
545
546 EOF
547 echo "Standard options:"
548 echo " --help print this message"
549 echo " --prefix=PREFIX install in PREFIX [$prefix]"
550 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
551 echo " use %M for cpu name [$interp_prefix]"
552 echo " --target-list=LIST set target list [$target_list]"
553 echo ""
554 echo "kqemu kernel acceleration support:"
555 echo " --disable-kqemu disable kqemu support"
556 echo ""
557 echo "Advanced options (experts only):"
558 echo " --source-path=PATH path of source code [$source_path]"
559 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
560 echo " --cc=CC use C compiler CC [$cc]"
561 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
562 echo " --extra-cflags=CFLAGS add C compiler flags CFLAGS"
563 echo " --extra-ldflags=LDFLAGS add linker flags LDFLAGS"
564 echo " --make=MAKE use specified make [$make]"
565 echo " --install=INSTALL use specified install [$install]"
566 echo " --static enable static build [$static]"
567 echo " --enable-sparse enable sparse checker"
568 echo " --disable-sparse disable sparse checker (default)"
569 echo " --disable-strip disable stripping binaries"
570 echo " --disable-werror disable compilation abort on warning"
571 echo " --disable-sdl disable SDL"
572 echo " --enable-cocoa enable COCOA (Mac OS X only)"
573 echo " --audio-drv-list=LIST set audio drivers list:"
574 echo " Available drivers: $audio_possible_drivers"
575 echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
576 echo " Available cards: $audio_possible_cards"
577 echo " --enable-mixemu enable mixer emulation"
578 echo " --disable-brlapi disable BrlAPI"
579 echo " --disable-vnc-tls disable TLS encryption for VNC server"
580 echo " --disable-vnc-sasl disable SASL encryption for VNC server"
581 echo " --disable-curses disable curses output"
582 echo " --disable-bluez disable bluez stack connectivity"
583 echo " --disable-kvm disable KVM acceleration support"
584 echo " --disable-nptl disable usermode NPTL support"
585 echo " --enable-system enable all system emulation targets"
586 echo " --disable-system disable all system emulation targets"
587 echo " --enable-linux-user enable all linux usermode emulation targets"
588 echo " --disable-linux-user disable all linux usermode emulation targets"
589 echo " --enable-darwin-user enable all darwin usermode emulation targets"
590 echo " --disable-darwin-user disable all darwin usermode emulation targets"
591 echo " --enable-bsd-user enable all BSD usermode emulation targets"
592 echo " --disable-bsd-user disable all BSD usermode emulation targets"
593 echo " --fmod-lib path to FMOD library"
594 echo " --fmod-inc path to FMOD includes"
595 echo " --oss-lib path to OSS library"
596 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
597 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
598 echo " --disable-vde disable support for vde network"
599 echo " --disable-aio disable AIO support"
600 echo " --disable-blobs disable installing provided firmware blobs"
601 echo " --kerneldir=PATH look for kernel includes in PATH"
602 echo ""
603 echo "NOTE: The object files are built at the place where configure is launched"
604 exit 1
605 fi
606
607 if test "$mingw32" = "yes" ; then
608 linux="no"
609 EXESUF=".exe"
610 oss="no"
611 linux_user="no"
612 bsd_user="no"
613 OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
614 fi
615
616 if test ! -x "$(which cgcc 2>/dev/null)"; then
617 sparse="no"
618 fi
619
620 #
621 # Solaris specific configure tool chain decisions
622 #
623 if test "$solaris" = "yes" ; then
624 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
625 if test -z "$solinst" ; then
626 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
627 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
628 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
629 exit 1
630 fi
631 if test "$solinst" = "/usr/sbin/install" ; then
632 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
633 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
634 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
635 exit 1
636 fi
637 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
638 if test -z "$sol_ar" ; then
639 echo "Error: No path includes ar"
640 if test -f /usr/ccs/bin/ar ; then
641 echo "Add /usr/ccs/bin to your path and rerun configure"
642 fi
643 exit 1
644 fi
645 fi
646
647
648 if test -z "$target_list" ; then
649 # these targets are portable
650 if [ "$softmmu" = "yes" ] ; then
651 target_list="\
652 i386-softmmu \
653 x86_64-softmmu \
654 arm-softmmu \
655 cris-softmmu \
656 m68k-softmmu \
657 mips-softmmu \
658 mipsel-softmmu \
659 mips64-softmmu \
660 mips64el-softmmu \
661 ppc-softmmu \
662 ppcemb-softmmu \
663 ppc64-softmmu \
664 sh4-softmmu \
665 sh4eb-softmmu \
666 sparc-softmmu \
667 "
668 fi
669 # the following are Linux specific
670 if [ "$linux_user" = "yes" ] ; then
671 target_list="${target_list}\
672 i386-linux-user \
673 x86_64-linux-user \
674 alpha-linux-user \
675 arm-linux-user \
676 armeb-linux-user \
677 cris-linux-user \
678 m68k-linux-user \
679 mips-linux-user \
680 mipsel-linux-user \
681 ppc-linux-user \
682 ppc64-linux-user \
683 ppc64abi32-linux-user \
684 sh4-linux-user \
685 sh4eb-linux-user \
686 sparc-linux-user \
687 sparc64-linux-user \
688 sparc32plus-linux-user \
689 "
690 fi
691 # the following are Darwin specific
692 if [ "$darwin_user" = "yes" ] ; then
693 target_list="$target_list i386-darwin-user ppc-darwin-user "
694 fi
695 # the following are BSD specific
696 if [ "$bsd_user" = "yes" ] ; then
697 target_list="${target_list}\
698 i386-bsd-user \
699 x86_64-bsd-user \
700 sparc-bsd-user \
701 sparc64-bsd-user \
702 "
703 fi
704 else
705 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
706 fi
707 if test -z "$target_list" ; then
708 echo "No targets enabled"
709 exit 1
710 fi
711
712 if test -z "$cross_prefix" ; then
713
714 # ---
715 # big/little endian test
716 cat > $TMPC << EOF
717 #include <inttypes.h>
718 int main(int argc, char ** argv){
719 volatile uint32_t i=0x01234567;
720 return (*((uint8_t*)(&i))) == 0x67;
721 }
722 EOF
723
724 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
725 $TMPE && bigendian="yes"
726 else
727 echo big/little test failed
728 fi
729
730 else
731
732 # if cross compiling, cannot launch a program, so make a static guess
733 if test "$cpu" = "armv4b" \
734 -o "$cpu" = "hppa" \
735 -o "$cpu" = "m68k" \
736 -o "$cpu" = "mips" \
737 -o "$cpu" = "mips64" \
738 -o "$cpu" = "ppc" \
739 -o "$cpu" = "ppc64" \
740 -o "$cpu" = "s390" \
741 -o "$cpu" = "sparc" \
742 -o "$cpu" = "sparc64"; then
743 bigendian="yes"
744 fi
745
746 fi
747
748 # host long bits test
749 hostlongbits="32"
750 if test "$cpu" = "x86_64" \
751 -o "$cpu" = "alpha" \
752 -o "$cpu" = "ia64" \
753 -o "$cpu" = "sparc64" \
754 -o "$cpu" = "ppc64"; then
755 hostlongbits="64"
756 fi
757
758 # Check host NPTL support
759 cat > $TMPC <<EOF
760 #include <sched.h>
761 #include <linux/futex.h>
762 void foo()
763 {
764 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
765 #error bork
766 #endif
767 }
768 EOF
769
770 if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
771 :
772 else
773 nptl="no"
774 fi
775
776 ##########################################
777 # zlib check
778
779 cat > $TMPC << EOF
780 #include <zlib.h>
781 int main(void) { zlibVersion(); return 0; }
782 EOF
783 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
784 :
785 else
786 echo
787 echo "Error: zlib check failed"
788 echo "Make sure to have the zlib libs and headers installed."
789 echo
790 exit 1
791 fi
792
793 ##########################################
794 # SDL probe
795
796 sdl_too_old=no
797
798 if test -z "$sdl" ; then
799 sdl_config="sdl-config"
800 sdl=no
801 sdl_static=no
802
803 cat > $TMPC << EOF
804 #include <SDL.h>
805 #undef main /* We don't want SDL to override our main() */
806 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
807 EOF
808 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` > $TMPSDLLOG 2>&1 ; then
809 _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
810 if test "$_sdlversion" -lt 121 ; then
811 sdl_too_old=yes
812 else
813 if test "$cocoa" = "no" ; then
814 sdl=yes
815 fi
816 fi
817
818 # static link with sdl ?
819 if test "$sdl" = "yes" ; then
820 aa="no"
821 `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
822 sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
823 if [ "$aa" = "yes" ] ; then
824 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
825 fi
826
827 if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then
828 sdl_static=yes
829 fi
830 fi # static link
831 fi # sdl compile test
832 else
833 # Make sure to disable cocoa if sdl was set
834 if test "$sdl" = "yes" ; then
835 cocoa="no"
836 audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
837 fi
838 fi # -z $sdl
839
840 if test "$sdl" = "yes" ; then
841 cat > $TMPC <<EOF
842 #include <SDL.h>
843 #if defined(SDL_VIDEO_DRIVER_X11)
844 #include <X11/XKBlib.h>
845 #else
846 #error No x11 support
847 #endif
848 int main(void) { return 0; }
849 EOF
850 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` > /dev/null 2>&1 ; then
851 sdl_x11="yes"
852 fi
853 fi
854
855 ##########################################
856 # VNC TLS detection
857 if test "$vnc_tls" = "yes" ; then
858 cat > $TMPC <<EOF
859 #include <gnutls/gnutls.h>
860 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
861 EOF
862 vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
863 vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
864 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
865 $vnc_tls_libs > /dev/null 2> /dev/null ; then
866 :
867 else
868 vnc_tls="no"
869 fi
870 fi
871
872 ##########################################
873 # VNC SASL detection
874 if test "$vnc_sasl" = "yes" ; then
875 cat > $TMPC <<EOF
876 #include <sasl/sasl.h>
877 #include <stdio.h>
878 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
879 EOF
880 # Assuming Cyrus-SASL installed in /usr prefix
881 vnc_sasl_cflags=""
882 vnc_sasl_libs="-lsasl2"
883 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
884 $vnc_sasl_libs 2> /dev/null ; then
885 :
886 else
887 vnc_sasl="no"
888 fi
889 fi
890
891 ##########################################
892 # fnmatch() probe, used for ACL routines
893 fnmatch="no"
894 cat > $TMPC << EOF
895 #include <fnmatch.h>
896 int main(void)
897 {
898 fnmatch("foo", "foo", 0);
899 return 0;
900 }
901 EOF
902 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
903 fnmatch="yes"
904 fi
905
906 ##########################################
907 # vde libraries probe
908 if test "$vde" = "yes" ; then
909 cat > $TMPC << EOF
910 #include <libvdeplug.h>
911 int main(void)
912 {
913 struct vde_open_args a = {0, 0, 0};
914 vde_open("", "", &a);
915 return 0;
916 }
917 EOF
918 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
919 :
920 else
921 vde="no"
922 fi
923 fi
924
925 ##########################################
926 # Sound support libraries probe
927
928 audio_drv_probe()
929 {
930 drv=$1
931 hdr=$2
932 lib=$3
933 exp=$4
934 cfl=$5
935 cat > $TMPC << EOF
936 #include <$hdr>
937 int main(void) { $exp }
938 EOF
939 if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
940 :
941 else
942 echo
943 echo "Error: $drv check failed"
944 echo "Make sure to have the $drv libs and headers installed."
945 echo
946 exit 1
947 fi
948 }
949
950 audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
951 for drv in $audio_drv_list; do
952 case $drv in
953 alsa)
954 audio_drv_probe $drv alsa/asoundlib.h -lasound \
955 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
956 ;;
957
958 fmod)
959 if test -z $fmod_lib || test -z $fmod_inc; then
960 echo
961 echo "Error: You must specify path to FMOD library and headers"
962 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
963 echo
964 exit 1
965 fi
966 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
967 ;;
968
969 esd)
970 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
971 ;;
972
973 pa)
974 audio_drv_probe $drv pulse/simple.h -lpulse-simple \
975 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
976 ;;
977
978 oss|sdl|core|wav|dsound)
979 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
980 ;;
981
982 *)
983 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
984 echo
985 echo "Error: Unknown driver '$drv' selected"
986 echo "Possible drivers are: $audio_possible_drivers"
987 echo
988 exit 1
989 }
990 ;;
991 esac
992 done
993
994 ##########################################
995 # BrlAPI probe
996
997 if test -z "$brlapi" ; then
998 brlapi=no
999 cat > $TMPC << EOF
1000 #include <brlapi.h>
1001 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1002 EOF
1003 if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
1004 brlapi=yes
1005 fi # brlapi compile test
1006 fi # -z $brlapi
1007
1008 ##########################################
1009 # curses probe
1010
1011 if test "$curses" = "yes" ; then
1012 curses=no
1013 cat > $TMPC << EOF
1014 #include <curses.h>
1015 #ifdef __OpenBSD__
1016 #define resize_term resizeterm
1017 #endif
1018 int main(void) { resize_term(0, 0); return curses_version(); }
1019 EOF
1020 if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
1021 curses=yes
1022 fi
1023 fi # test "$curses"
1024
1025 ##########################################
1026 # bluez support probe
1027 if test "$bluez" = "yes" ; then
1028 `pkg-config bluez` || bluez="no"
1029 fi
1030 if test "$bluez" = "yes" ; then
1031 cat > $TMPC << EOF
1032 #include <bluetooth/bluetooth.h>
1033 int main(void) { return bt_error(0); }
1034 EOF
1035 bluez_cflags=`pkg-config --cflags bluez`
1036 bluez_libs=`pkg-config --libs bluez`
1037 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
1038 $bluez_libs > /dev/null 2> /dev/null ; then
1039 :
1040 else
1041 bluez="no"
1042 fi
1043 fi
1044
1045 ##########################################
1046 # kvm probe
1047 if test "$kvm" = "yes" ; then
1048 cat > $TMPC <<EOF
1049 #include <linux/kvm.h>
1050 #if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
1051 #error Invalid KVM version
1052 #endif
1053 #if !defined(KVM_CAP_USER_MEMORY)
1054 #error Missing KVM capability KVM_CAP_USER_MEMORY
1055 #endif
1056 #if !defined(KVM_CAP_SET_TSS_ADDR)
1057 #error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1058 #endif
1059 #if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1060 #error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1061 #endif
1062 int main(void) { return 0; }
1063 EOF
1064 if test "$kerneldir" != "" ; then
1065 kvm_cflags=-I"$kerneldir"/include
1066 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1067 -a -d "$kerneldir/arch/x86/include" ; then
1068 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
1069 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1070 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
1071 elif test -d "$kerneldir/arch/$cpu/include" ; then
1072 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1073 fi
1074 else
1075 kvm_cflags=""
1076 fi
1077 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
1078 > /dev/null 2>/dev/null ; then
1079 :
1080 else
1081 kvm="no";
1082 if [ -x "`which awk 2>/dev/null`" ] && \
1083 [ -x "`which grep 2>/dev/null`" ]; then
1084 kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
1085 | grep "error: " \
1086 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1087 if test "$kvmerr" != "" ; then
1088 kvm="no - (${kvmerr})"
1089 fi
1090 fi
1091 fi
1092 fi
1093
1094 ##########################################
1095 # AIO probe
1096 AIOLIBS=""
1097
1098 if test "$aio" = "yes" ; then
1099 aio=no
1100 cat > $TMPC << EOF
1101 #include <pthread.h>
1102 int main(void) { pthread_mutex_t lock; return 0; }
1103 EOF
1104 if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
1105 aio=yes
1106 AIOLIBS="-lpthread"
1107 fi
1108 fi
1109
1110 ##########################################
1111 # iovec probe
1112 cat > $TMPC <<EOF
1113 #include <sys/types.h>
1114 #include <sys/uio.h>
1115 #include <unistd.h>
1116 int main(void) { struct iovec iov; return 0; }
1117 EOF
1118 iovec=no
1119 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1120 iovec=yes
1121 fi
1122
1123 ##########################################
1124 # preadv probe
1125 cat > $TMPC <<EOF
1126 #include <sys/types.h>
1127 #include <sys/uio.h>
1128 #include <unistd.h>
1129 int main(void) { preadv; }
1130 EOF
1131 preadv=no
1132 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1133 preadv=yes
1134 fi
1135
1136 ##########################################
1137 # fdt probe
1138 if test "$fdt" = "yes" ; then
1139 fdt=no
1140 cat > $TMPC << EOF
1141 int main(void) { return 0; }
1142 EOF
1143 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null ; then
1144 fdt=yes
1145 fi
1146 fi
1147
1148 # Check if tools are available to build documentation.
1149 if [ -x "`which texi2html 2>/dev/null`" ] && \
1150 [ -x "`which pod2man 2>/dev/null`" ]; then
1151 build_docs="yes"
1152 fi
1153
1154 ##########################################
1155 # Do we need librt
1156 cat > $TMPC <<EOF
1157 #include <signal.h>
1158 #include <time.h>
1159 int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1160 EOF
1161
1162 rt=no
1163 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1164 :
1165 elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
1166 rt=yes
1167 fi
1168
1169 if test "$rt" = "yes" ; then
1170 # Hack, we should have a general purpose LIBS for this sort of thing
1171 AIOLIBS="$AIOLIBS -lrt"
1172 fi
1173
1174 if test "$mingw32" = "yes" ; then
1175 if test -z "$prefix" ; then
1176 prefix="c:\\\\Program Files\\\\Qemu"
1177 fi
1178 mansuffix=""
1179 datasuffix=""
1180 docsuffix=""
1181 binsuffix=""
1182 else
1183 if test -z "$prefix" ; then
1184 prefix="/usr/local"
1185 fi
1186 mansuffix="/share/man"
1187 datasuffix="/share/qemu"
1188 docsuffix="/share/doc/qemu"
1189 binsuffix="/bin"
1190 fi
1191
1192 echo "Install prefix $prefix"
1193 echo "BIOS directory $prefix$datasuffix"
1194 echo "binary directory $prefix$binsuffix"
1195 if test "$mingw32" = "no" ; then
1196 echo "Manual directory $prefix$mansuffix"
1197 echo "ELF interp prefix $interp_prefix"
1198 fi
1199 echo "Source path $source_path"
1200 echo "C compiler $cc"
1201 echo "Host C compiler $host_cc"
1202 echo "ARCH_CFLAGS $ARCH_CFLAGS"
1203 echo "make $make"
1204 echo "install $install"
1205 echo "host CPU $cpu"
1206 echo "host big endian $bigendian"
1207 echo "target list $target_list"
1208 echo "gprof enabled $gprof"
1209 echo "sparse enabled $sparse"
1210 echo "strip binaries $strip_opt"
1211 echo "profiler $profiler"
1212 echo "static build $static"
1213 echo "-Werror enabled $werror"
1214 if test "$darwin" = "yes" ; then
1215 echo "Cocoa support $cocoa"
1216 fi
1217 echo "SDL support $sdl"
1218 if test "$sdl" != "no" ; then
1219 echo "SDL static link $sdl_static"
1220 fi
1221 echo "curses support $curses"
1222 echo "mingw32 support $mingw32"
1223 echo "Audio drivers $audio_drv_list"
1224 echo "Extra audio cards $audio_card_list"
1225 echo "Mixer emulation $mixemu"
1226 echo "VNC TLS support $vnc_tls"
1227 if test "$vnc_tls" = "yes" ; then
1228 echo " TLS CFLAGS $vnc_tls_cflags"
1229 echo " TLS LIBS $vnc_tls_libs"
1230 fi
1231 echo "VNC SASL support $vnc_sasl"
1232 if test "$vnc_sasl" = "yes" ; then
1233 echo " SASL CFLAGS $vnc_sasl_cflags"
1234 echo " SASL LIBS $vnc_sasl_libs"
1235 fi
1236 if test -n "$sparc_cpu"; then
1237 echo "Target Sparc Arch $sparc_cpu"
1238 fi
1239 echo "kqemu support $kqemu"
1240 echo "brlapi support $brlapi"
1241 echo "Documentation $build_docs"
1242 [ ! -z "$uname_release" ] && \
1243 echo "uname -r $uname_release"
1244 echo "NPTL support $nptl"
1245 echo "vde support $vde"
1246 echo "AIO support $aio"
1247 echo "Install blobs $blobs"
1248 echo "KVM support $kvm"
1249 echo "fdt support $fdt"
1250 echo "preadv support $preadv"
1251
1252 if test $sdl_too_old = "yes"; then
1253 echo "-> Your SDL version is too old - please upgrade to have SDL support"
1254 fi
1255 if [ -s $TMPSDLLOG ]; then
1256 echo "The error log from compiling the libSDL test is: "
1257 cat $TMPSDLLOG
1258 fi
1259 #if test "$sdl_static" = "no"; then
1260 # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1261 #fi
1262 config_mak="config-host.mak"
1263 config_h="config-host.h"
1264
1265 #echo "Creating $config_mak and $config_h"
1266
1267 test -f $config_h && mv $config_h ${config_h}~
1268
1269 echo "# Automatically generated by configure - do not modify" > $config_mak
1270 printf "# Configured with:" >> $config_mak
1271 printf " '%s'" "$0" "$@" >> $config_mak
1272 echo >> $config_mak
1273 echo "/* Automatically generated by configure - do not modify */" > $config_h
1274
1275 echo "prefix=$prefix" >> $config_mak
1276 echo "bindir=\${prefix}$binsuffix" >> $config_mak
1277 echo "mandir=\${prefix}$mansuffix" >> $config_mak
1278 echo "datadir=\${prefix}$datasuffix" >> $config_mak
1279 echo "docdir=\${prefix}$docsuffix" >> $config_mak
1280 echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
1281 echo "MAKE=$make" >> $config_mak
1282 echo "INSTALL=$install" >> $config_mak
1283 echo "CC=$cc" >> $config_mak
1284 echo "HOST_CC=$host_cc" >> $config_mak
1285 echo "AR=$ar" >> $config_mak
1286 # XXX: only use CFLAGS and LDFLAGS ?
1287 # XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1288 # compilation of dyngen tool (useful for win32 build on Linux host)
1289 echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
1290 echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1291 echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1292 echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
1293 echo "CFLAGS=$CFLAGS" >> $config_mak
1294 echo "LDFLAGS=$LDFLAGS" >> $config_mak
1295 echo "EXESUF=$EXESUF" >> $config_mak
1296 echo "AIOLIBS=$AIOLIBS" >> $config_mak
1297 case "$cpu" in
1298 i386)
1299 echo "ARCH=i386" >> $config_mak
1300 echo "#define HOST_I386 1" >> $config_h
1301 ;;
1302 x86_64)
1303 echo "ARCH=x86_64" >> $config_mak
1304 echo "#define HOST_X86_64 1" >> $config_h
1305 ;;
1306 alpha)
1307 echo "ARCH=alpha" >> $config_mak
1308 echo "#define HOST_ALPHA 1" >> $config_h
1309 ;;
1310 armv4b)
1311 echo "ARCH=arm" >> $config_mak
1312 echo "#define HOST_ARM 1" >> $config_h
1313 ;;
1314 armv4l)
1315 echo "ARCH=arm" >> $config_mak
1316 echo "#define HOST_ARM 1" >> $config_h
1317 ;;
1318 cris)
1319 echo "ARCH=cris" >> $config_mak
1320 echo "#define HOST_CRIS 1" >> $config_h
1321 ;;
1322 hppa)
1323 echo "ARCH=hppa" >> $config_mak
1324 echo "#define HOST_HPPA 1" >> $config_h
1325 ;;
1326 ia64)
1327 echo "ARCH=ia64" >> $config_mak
1328 echo "#define HOST_IA64 1" >> $config_h
1329 ;;
1330 m68k)
1331 echo "ARCH=m68k" >> $config_mak
1332 echo "#define HOST_M68K 1" >> $config_h
1333 ;;
1334 mips)
1335 echo "ARCH=mips" >> $config_mak
1336 echo "#define HOST_MIPS 1" >> $config_h
1337 ;;
1338 mips64)
1339 echo "ARCH=mips64" >> $config_mak
1340 echo "#define HOST_MIPS64 1" >> $config_h
1341 ;;
1342 ppc)
1343 echo "ARCH=ppc" >> $config_mak
1344 echo "#define HOST_PPC 1" >> $config_h
1345 ;;
1346 ppc64)
1347 echo "ARCH=ppc64" >> $config_mak
1348 echo "#define HOST_PPC64 1" >> $config_h
1349 ;;
1350 s390)
1351 echo "ARCH=s390" >> $config_mak
1352 echo "#define HOST_S390 1" >> $config_h
1353 ;;
1354 sparc)
1355 echo "ARCH=sparc" >> $config_mak
1356 echo "#define HOST_SPARC 1" >> $config_h
1357 ;;
1358 sparc64)
1359 echo "ARCH=sparc64" >> $config_mak
1360 echo "#define HOST_SPARC64 1" >> $config_h
1361 ;;
1362 *)
1363 echo "Unsupported CPU = $cpu"
1364 exit 1
1365 ;;
1366 esac
1367 if test "$sparse" = "yes" ; then
1368 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
1369 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
1370 echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1371 fi
1372 if test "$strip_opt" = "yes" ; then
1373 echo "STRIP_OPT=-s" >> $config_mak
1374 fi
1375 if test "$bigendian" = "yes" ; then
1376 echo "WORDS_BIGENDIAN=yes" >> $config_mak
1377 echo "#define WORDS_BIGENDIAN 1" >> $config_h
1378 fi
1379 echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
1380 if test "$mingw32" = "yes" ; then
1381 echo "CONFIG_WIN32=yes" >> $config_mak
1382 echo "#define CONFIG_WIN32 1" >> $config_h
1383 else
1384 cat > $TMPC << EOF
1385 #include <byteswap.h>
1386 int main(void) { return bswap_32(0); }
1387 EOF
1388 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
1389 echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1390 fi
1391 cat > $TMPC << EOF
1392 #include <sys/endian.h>
1393 #include <sys/types.h>
1394 #include <machine/bswap.h>
1395 int main(void) { return bswap32(0); }
1396 EOF
1397 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
1398 echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1399 fi
1400 fi
1401
1402 if [ "$openbsd" = "yes" ] ; then
1403 echo "#define ENOTSUP 4096" >> $config_h
1404 fi
1405
1406 if test "$darwin" = "yes" ; then
1407 echo "CONFIG_DARWIN=yes" >> $config_mak
1408 echo "#define CONFIG_DARWIN 1" >> $config_h
1409 fi
1410
1411 if test "$aix" = "yes" ; then
1412 echo "CONFIG_AIX=yes" >> $config_mak
1413 echo "#define CONFIG_AIX 1" >> $config_h
1414 fi
1415
1416 if test "$solaris" = "yes" ; then
1417 echo "CONFIG_SOLARIS=yes" >> $config_mak
1418 echo "#define HOST_SOLARIS $solarisrev" >> $config_h
1419 if test "$needs_libsunmath" = "yes" ; then
1420 echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1421 echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1422 fi
1423 fi
1424 if test -n "$sparc_cpu"; then
1425 echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1426 echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1427 fi
1428 if test "$gdbstub" = "yes" ; then
1429 echo "CONFIG_GDBSTUB=yes" >> $config_mak
1430 echo "#define CONFIG_GDBSTUB 1" >> $config_h
1431 fi
1432 if test "$gprof" = "yes" ; then
1433 echo "TARGET_GPROF=yes" >> $config_mak
1434 echo "#define HAVE_GPROF 1" >> $config_h
1435 fi
1436 if test "$static" = "yes" ; then
1437 echo "CONFIG_STATIC=yes" >> $config_mak
1438 echo "#define CONFIG_STATIC 1" >> $config_h
1439 fi
1440 if test $profiler = "yes" ; then
1441 echo "#define CONFIG_PROFILER 1" >> $config_h
1442 fi
1443 if test "$slirp" = "yes" ; then
1444 echo "CONFIG_SLIRP=yes" >> $config_mak
1445 echo "#define CONFIG_SLIRP 1" >> $config_h
1446 fi
1447 if test "$vde" = "yes" ; then
1448 echo "CONFIG_VDE=yes" >> $config_mak
1449 echo "#define CONFIG_VDE 1" >> $config_h
1450 echo "VDE_LIBS=-lvdeplug" >> $config_mak
1451 fi
1452 for card in $audio_card_list; do
1453 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
1454 echo "$def=yes" >> $config_mak
1455 echo "#define $def 1" >> $config_h
1456 done
1457 echo "#define AUDIO_DRIVERS \\" >> $config_h
1458 for drv in $audio_drv_list; do
1459 echo " &${drv}_audio_driver, \\" >>$config_h
1460 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
1461 echo "$def=yes" >> $config_mak
1462 if test "$drv" = "fmod"; then
1463 echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1464 echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1465 elif test "$drv" = "oss"; then
1466 echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
1467 fi
1468 done
1469 echo "" >>$config_h
1470 if test "$mixemu" = "yes" ; then
1471 echo "CONFIG_MIXEMU=yes" >> $config_mak
1472 echo "#define CONFIG_MIXEMU 1" >> $config_h
1473 fi
1474 if test "$vnc_tls" = "yes" ; then
1475 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1476 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1477 echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1478 echo "#define CONFIG_VNC_TLS 1" >> $config_h
1479 fi
1480 if test "$vnc_sasl" = "yes" ; then
1481 echo "CONFIG_VNC_SASL=yes" >> $config_mak
1482 echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1483 echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1484 echo "#define CONFIG_VNC_SASL 1" >> $config_h
1485 fi
1486 if test "$fnmatch" = "yes" ; then
1487 echo "#define HAVE_FNMATCH_H 1" >> $config_h
1488 fi
1489 qemu_version=`head $source_path/VERSION`
1490 echo "VERSION=$qemu_version" >>$config_mak
1491 echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1492
1493 echo "#define QEMU_PKGVERSION \"$pkgversion\"" >> $config_h
1494
1495 echo "SRC_PATH=$source_path" >> $config_mak
1496 if [ "$source_path_used" = "yes" ]; then
1497 echo "VPATH=$source_path" >> $config_mak
1498 fi
1499 echo "TARGET_DIRS=$target_list" >> $config_mak
1500 if [ "$build_docs" = "yes" ] ; then
1501 echo "BUILD_DOCS=yes" >> $config_mak
1502 fi
1503 if test "$static" = "yes"; then
1504 sdl1=$sdl_static
1505 else
1506 sdl1=$sdl
1507 fi
1508 if test "$sdl1" = "yes" ; then
1509 echo "#define CONFIG_SDL 1" >> $config_h
1510 echo "CONFIG_SDL=yes" >> $config_mak
1511 if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1512 echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1513 elif test "$sdl_x11" = "yes" ; then
1514 echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
1515 else
1516 echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1517 fi
1518 if [ "${aa}" = "yes" ] ; then
1519 echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1520 else
1521 echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1522 fi
1523 fi
1524 if test "$cocoa" = "yes" ; then
1525 echo "#define CONFIG_COCOA 1" >> $config_h
1526 echo "CONFIG_COCOA=yes" >> $config_mak
1527 fi
1528 if test "$curses" = "yes" ; then
1529 echo "#define CONFIG_CURSES 1" >> $config_h
1530 echo "CONFIG_CURSES=yes" >> $config_mak
1531 echo "CURSES_LIBS=-lcurses" >> $config_mak
1532 fi
1533 if test "$brlapi" = "yes" ; then
1534 echo "CONFIG_BRLAPI=yes" >> $config_mak
1535 echo "#define CONFIG_BRLAPI 1" >> $config_h
1536 echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1537 fi
1538 if test "$bluez" = "yes" ; then
1539 echo "CONFIG_BLUEZ=yes" >> $config_mak
1540 echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1541 echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1542 echo "#define CONFIG_BLUEZ 1" >> $config_h
1543 fi
1544 if test "$aio" = "yes" ; then
1545 echo "#define CONFIG_AIO 1" >> $config_h
1546 echo "CONFIG_AIO=yes" >> $config_mak
1547 fi
1548 if test "$blobs" = "yes" ; then
1549 echo "INSTALL_BLOBS=yes" >> $config_mak
1550 fi
1551 if test "$iovec" = "yes" ; then
1552 echo "#define HAVE_IOVEC 1" >> $config_h
1553 fi
1554 if test "$preadv" = "yes" ; then
1555 echo "#define HAVE_PREADV 1" >> $config_h
1556 fi
1557 if test "$fdt" = "yes" ; then
1558 echo "#define HAVE_FDT 1" >> $config_h
1559 echo "FDT_LIBS=-lfdt" >> $config_mak
1560 fi
1561
1562 # XXX: suppress that
1563 if [ "$bsd" = "yes" ] ; then
1564 echo "#define O_LARGEFILE 0" >> $config_h
1565 echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1566 echo "#define HOST_BSD 1" >> $config_h
1567 fi
1568
1569 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1570
1571 # USB host support
1572 case "$usb" in
1573 linux)
1574 echo "HOST_USB=linux" >> $config_mak
1575 ;;
1576 bsd)
1577 echo "HOST_USB=bsd" >> $config_mak
1578 ;;
1579 *)
1580 echo "HOST_USB=stub" >> $config_mak
1581 ;;
1582 esac
1583
1584 tools=
1585 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1586 tools="qemu-img\$(EXESUF) $tools"
1587 if [ "$linux" = "yes" ] ; then
1588 tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
1589 fi
1590 fi
1591 echo "TOOLS=$tools" >> $config_mak
1592
1593 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1594
1595 for target in $target_list; do
1596 target_dir="$target"
1597 config_mak=$target_dir/config.mak
1598 config_h=$target_dir/config.h
1599 target_cpu=`echo $target | cut -d '-' -f 1`
1600 target_bigendian="no"
1601 [ "$target_cpu" = "armeb" ] && target_bigendian=yes
1602 [ "$target_cpu" = "m68k" ] && target_bigendian=yes
1603 [ "$target_cpu" = "mips" ] && target_bigendian=yes
1604 [ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1605 [ "$target_cpu" = "mips64" ] && target_bigendian=yes
1606 [ "$target_cpu" = "ppc" ] && target_bigendian=yes
1607 [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
1608 [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
1609 [ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
1610 [ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
1611 [ "$target_cpu" = "sparc" ] && target_bigendian=yes
1612 [ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1613 [ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
1614 target_softmmu="no"
1615 target_user_only="no"
1616 target_linux_user="no"
1617 target_darwin_user="no"
1618 target_bsd_user="no"
1619 case "$target" in
1620 ${target_cpu}-softmmu)
1621 target_softmmu="yes"
1622 ;;
1623 ${target_cpu}-linux-user)
1624 target_user_only="yes"
1625 target_linux_user="yes"
1626 ;;
1627 ${target_cpu}-darwin-user)
1628 target_user_only="yes"
1629 target_darwin_user="yes"
1630 ;;
1631 ${target_cpu}-bsd-user)
1632 target_user_only="yes"
1633 target_bsd_user="yes"
1634 ;;
1635 *)
1636 echo "ERROR: Target '$target' not recognised"
1637 exit 1
1638 ;;
1639 esac
1640
1641 if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1642 -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1643 echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1644 echo "To build QEMU without graphical output configure with --disable-gfx-check"
1645 echo "Note that this will disable all output from the virtual graphics card"
1646 echo "except through VNC or curses."
1647 exit 1;
1648 fi
1649
1650 #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1651
1652 test -f $config_h && mv $config_h ${config_h}~
1653
1654 mkdir -p $target_dir
1655 mkdir -p $target_dir/fpu
1656 mkdir -p $target_dir/tcg
1657 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
1658 mkdir -p $target_dir/nwfpe
1659 fi
1660
1661 #
1662 # don't use ln -sf as not all "ln -sf" over write the file/link
1663 #
1664 rm -f $target_dir/Makefile
1665 ln -s $source_path/Makefile.target $target_dir/Makefile
1666
1667
1668 echo "# Automatically generated by configure - do not modify" > $config_mak
1669 echo "/* Automatically generated by configure - do not modify */" > $config_h
1670
1671
1672 echo "include ../config-host.mak" >> $config_mak
1673 echo "#include \"../config-host.h\"" >> $config_h
1674
1675 bflt="no"
1676 elfload32="no"
1677 target_nptl="no"
1678 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1679 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1680 gdb_xml_files=""
1681
1682 # Make sure the target and host cpus are compatible
1683 if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
1684 \( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \) -o \
1685 \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
1686 \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
1687 kvm="no"
1688 fi
1689 # Disable KVM for linux-user
1690 if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1691 kvm="no"
1692 fi
1693
1694 case "$target_cpu" in
1695 i386)
1696 echo "TARGET_ARCH=i386" >> $config_mak
1697 echo "#define TARGET_ARCH \"i386\"" >> $config_h
1698 echo "#define TARGET_I386 1" >> $config_h
1699 if test $kqemu = "yes" -a "$target_softmmu" = "yes"
1700 then
1701 echo "#define USE_KQEMU 1" >> $config_h
1702 fi
1703 if test "$kvm" = "yes" ; then
1704 echo "CONFIG_KVM=yes" >> $config_mak
1705 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1706 echo "#define CONFIG_KVM 1" >> $config_h
1707 fi
1708 ;;
1709 x86_64)
1710 echo "TARGET_ARCH=x86_64" >> $config_mak
1711 echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1712 echo "#define TARGET_I386 1" >> $config_h
1713 echo "#define TARGET_X86_64 1" >> $config_h
1714 if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1715 then
1716 echo "#define USE_KQEMU 1" >> $config_h
1717 fi
1718 if test "$kvm" = "yes" ; then
1719 echo "CONFIG_KVM=yes" >> $config_mak
1720 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1721 echo "#define CONFIG_KVM 1" >> $config_h
1722 fi
1723 ;;
1724 alpha)
1725 echo "TARGET_ARCH=alpha" >> $config_mak
1726 echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1727 echo "#define TARGET_ALPHA 1" >> $config_h
1728 ;;
1729 arm|armeb)
1730 echo "TARGET_ARCH=arm" >> $config_mak
1731 echo "#define TARGET_ARCH \"arm\"" >> $config_h
1732 echo "#define TARGET_ARM 1" >> $config_h
1733 bflt="yes"
1734 target_nptl="yes"
1735 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
1736 ;;
1737 cris)
1738 echo "TARGET_ARCH=cris" >> $config_mak
1739 echo "#define TARGET_ARCH \"cris\"" >> $config_h
1740 echo "#define TARGET_CRIS 1" >> $config_h
1741 target_nptl="yes"
1742 ;;
1743 m68k)
1744 echo "TARGET_ARCH=m68k" >> $config_mak
1745 echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1746 echo "#define TARGET_M68K 1" >> $config_h
1747 bflt="yes"
1748 gdb_xml_files="cf-core.xml cf-fp.xml"
1749 ;;
1750 mips|mipsel)
1751 echo "TARGET_ARCH=mips" >> $config_mak
1752 echo "#define TARGET_ARCH \"mips\"" >> $config_h
1753 echo "#define TARGET_MIPS 1" >> $config_h
1754 echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1755 ;;
1756 mipsn32|mipsn32el)
1757 echo "TARGET_ARCH=mipsn32" >> $config_mak
1758 echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1759 echo "#define TARGET_MIPS 1" >> $config_h
1760 echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1761 ;;
1762 mips64|mips64el)
1763 echo "TARGET_ARCH=mips64" >> $config_mak
1764 echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1765 echo "#define TARGET_MIPS 1" >> $config_h
1766 echo "#define TARGET_MIPS64 1" >> $config_h
1767 echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1768 ;;
1769 ppc)
1770 echo "TARGET_ARCH=ppc" >> $config_mak
1771 echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1772 echo "#define TARGET_PPC 1" >> $config_h
1773 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1774 ;;
1775 ppcemb)
1776 echo "TARGET_ARCH=ppcemb" >> $config_mak
1777 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1778 echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1779 echo "#define TARGET_PPC 1" >> $config_h
1780 echo "#define TARGET_PPCEMB 1" >> $config_h
1781 if test "$kvm" = "yes" ; then
1782 echo "CONFIG_KVM=yes" >> $config_mak
1783 echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1784 echo "#define CONFIG_KVM 1" >> $config_h
1785 fi
1786 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1787 ;;
1788 ppc64)
1789 echo "TARGET_ARCH=ppc64" >> $config_mak
1790 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1791 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1792 echo "#define TARGET_PPC 1" >> $config_h
1793 echo "#define TARGET_PPC64 1" >> $config_h
1794 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1795 ;;
1796 ppc64abi32)
1797 echo "TARGET_ARCH=ppc64" >> $config_mak
1798 echo "TARGET_ABI_DIR=ppc" >> $config_mak
1799 echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1800 echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1801 echo "#define TARGET_PPC 1" >> $config_h
1802 echo "#define TARGET_PPC64 1" >> $config_h
1803 echo "#define TARGET_ABI32 1" >> $config_h
1804 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1805 ;;
1806 sh4|sh4eb)
1807 echo "TARGET_ARCH=sh4" >> $config_mak
1808 echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1809 echo "#define TARGET_SH4 1" >> $config_h
1810 bflt="yes"
1811 target_nptl="yes"
1812 ;;
1813 sparc)
1814 echo "TARGET_ARCH=sparc" >> $config_mak
1815 echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1816 echo "#define TARGET_SPARC 1" >> $config_h
1817 ;;
1818 sparc64)
1819 echo "TARGET_ARCH=sparc64" >> $config_mak
1820 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1821 echo "#define TARGET_SPARC 1" >> $config_h
1822 echo "#define TARGET_SPARC64 1" >> $config_h
1823 elfload32="yes"
1824 ;;
1825 sparc32plus)
1826 echo "TARGET_ARCH=sparc64" >> $config_mak
1827 echo "TARGET_ABI_DIR=sparc" >> $config_mak
1828 echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1829 echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1830 echo "#define TARGET_SPARC 1" >> $config_h
1831 echo "#define TARGET_SPARC64 1" >> $config_h
1832 echo "#define TARGET_ABI32 1" >> $config_h
1833 ;;
1834 *)
1835 echo "Unsupported target CPU"
1836 exit 1
1837 ;;
1838 esac
1839 if test "$target_bigendian" = "yes" ; then
1840 echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1841 echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1842 fi
1843 if test "$target_softmmu" = "yes" ; then
1844 echo "CONFIG_SOFTMMU=yes" >> $config_mak
1845 echo "#define CONFIG_SOFTMMU 1" >> $config_h
1846 fi
1847 if test "$target_user_only" = "yes" ; then
1848 echo "CONFIG_USER_ONLY=yes" >> $config_mak
1849 echo "#define CONFIG_USER_ONLY 1" >> $config_h
1850 fi
1851 if test "$target_linux_user" = "yes" ; then
1852 echo "CONFIG_LINUX_USER=yes" >> $config_mak
1853 echo "#define CONFIG_LINUX_USER 1" >> $config_h
1854 fi
1855 if test "$target_darwin_user" = "yes" ; then
1856 echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1857 echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1858 fi
1859 list=""
1860 if test ! -z "$gdb_xml_files" ; then
1861 for x in $gdb_xml_files; do
1862 list="$list $source_path/gdb-xml/$x"
1863 done
1864 fi
1865 echo "TARGET_XML_FILES=$list" >> $config_mak
1866
1867 if test "$target_cpu" = "arm" \
1868 -o "$target_cpu" = "armeb" \
1869 -o "$target_cpu" = "m68k" \
1870 -o "$target_cpu" = "mips" \
1871 -o "$target_cpu" = "mipsel" \
1872 -o "$target_cpu" = "mipsn32" \
1873 -o "$target_cpu" = "mipsn32el" \
1874 -o "$target_cpu" = "mips64" \
1875 -o "$target_cpu" = "mips64el" \
1876 -o "$target_cpu" = "ppc" \
1877 -o "$target_cpu" = "ppc64" \
1878 -o "$target_cpu" = "ppc64abi32" \
1879 -o "$target_cpu" = "ppcemb" \
1880 -o "$target_cpu" = "sparc" \
1881 -o "$target_cpu" = "sparc64" \
1882 -o "$target_cpu" = "sparc32plus"; then
1883 echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1884 echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1885 fi
1886 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1887 echo "TARGET_HAS_BFLT=yes" >> $config_mak
1888 echo "#define TARGET_HAS_BFLT 1" >> $config_h
1889 fi
1890 if test "$target_user_only" = "yes" \
1891 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1892 echo "#define USE_NPTL 1" >> $config_h
1893 fi
1894 # 32 bit ELF loader in addition to native 64 bit loader?
1895 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1896 echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1897 echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1898 fi
1899 if test "$target_bsd_user" = "yes" ; then
1900 echo "CONFIG_BSD_USER=yes" >> $config_mak
1901 echo "#define CONFIG_BSD_USER 1" >> $config_h
1902 fi
1903
1904 test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1905
1906 done # for target in $targets
1907
1908 # build tree in object directory if source path is different from current one
1909 if test "$source_path_used" = "yes" ; then
1910 DIRS="tests tests/cris slirp audio"
1911 FILES="Makefile tests/Makefile"
1912 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
1913 FILES="$FILES tests/test-mmap.c"
1914 for dir in $DIRS ; do
1915 mkdir -p $dir
1916 done
1917 # remove the link and recreate it, as not all "ln -sf" overwrite the link
1918 for f in $FILES ; do
1919 rm -f $f
1920 ln -s $source_path/$f $f
1921 done
1922 fi