test: Run tests only if supported on the current hardware
[qemu-kvm/stefanha.git] / configure
blobaf50607897888f75832cdc24a57550e883039661
1 #!/bin/sh
3 # qemu configure script (c) 2003 Fabrice Bellard
5 # set temporary file name
6 if test ! -z "$TMPDIR" ; then
7 TMPDIR1="${TMPDIR}"
8 elif test ! -z "$TEMPDIR" ; then
9 TMPDIR1="${TEMPDIR}"
10 else
11 TMPDIR1="/tmp"
14 TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
15 TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
16 TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.exe"
18 trap "rm -f $TMPC $TMPO $TMPE ; exit" EXIT INT QUIT TERM
20 compile_object() {
21 $cc $QEMU_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
24 compile_prog() {
25 local_cflags="$1"
26 local_ldflags="$2"
27 $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags > /dev/null 2> /dev/null
30 # check whether a command is available to this shell (may be either an
31 # executable or a builtin)
32 has() {
33 type "$1" >/dev/null 2>&1
36 # search for an executable in PATH
37 path_of() {
38 local_command="$1"
39 local_ifs="$IFS"
40 local_dir=""
42 # pathname has a dir component?
43 if [ "${local_command#*/}" != "$local_command" ]; then
44 if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
45 echo "$local_command"
46 return 0
49 if [ -z "$local_command" ]; then
50 return 1
53 IFS=:
54 for local_dir in $PATH; do
55 if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
56 echo "$local_dir/$local_command"
57 IFS="${local_ifs:-$(printf ' \t\n')}"
58 return 0
60 done
61 # not found
62 IFS="${local_ifs:-$(printf ' \t\n')}"
63 return 1
66 # default parameters
67 cpu=""
68 interp_prefix="/usr/gnemul/qemu-%M"
69 static="no"
70 sparc_cpu=""
71 cross_prefix=""
72 cc="gcc"
73 audio_drv_list=""
74 audio_card_list="ac97 es1370 sb16"
75 audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus"
76 block_drv_whitelist=""
77 host_cc="gcc"
78 ar="ar"
79 make="make"
80 install="install"
81 objcopy="objcopy"
82 ld="ld"
83 helper_cflags=""
84 libs_softmmu=""
85 libs_tools=""
86 audio_pt_int=""
87 audio_win_int=""
89 # parse CC options first
90 for opt do
91 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
92 case "$opt" in
93 --cross-prefix=*) cross_prefix="$optarg"
95 --cc=*) cc="$optarg"
97 --cpu=*) cpu="$optarg"
99 --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
101 --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
103 --sparc_cpu=*)
104 sparc_cpu="$optarg"
105 case $sparc_cpu in
106 v7|v8|v8plus|v8plusa)
107 cpu="sparc"
110 cpu="sparc64"
113 echo "undefined SPARC architecture. Exiting";
114 exit 1
116 esac
118 esac
119 done
120 # OS specific
121 # Using uname is really, really broken. Once we have the right set of checks
122 # we can eliminate it's usage altogether
124 cc="${cross_prefix}${cc}"
125 ar="${cross_prefix}${ar}"
126 objcopy="${cross_prefix}${objcopy}"
127 ld="${cross_prefix}${ld}"
129 # default flags for all hosts
130 QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
131 CFLAGS="-g $CFLAGS"
132 QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
133 QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
134 QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
135 QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
136 QEMU_CFLAGS="-I. -I\$(SRC_PATH) $QEMU_CFLAGS"
137 LDFLAGS="-g $LDFLAGS"
139 gcc_flags="-Wold-style-declaration -Wold-style-definition -fstack-protector-all"
140 cat > $TMPC << EOF
141 int main(void) { return 0; }
143 for flag in $gcc_flags; do
144 if compile_prog "-Werror $QEMU_CFLAGS" "-Werror $flag" ; then
145 QEMU_CFLAGS="$flag $QEMU_CFLAGS"
147 done
149 # check that the C compiler works.
150 cat > $TMPC <<EOF
151 int main(void) {}
154 if compile_object ; then
155 : C compiler works ok
156 else
157 echo "ERROR: \"$cc\" either does not exist or does not work"
158 exit 1
161 check_define() {
162 cat > $TMPC <<EOF
163 #if !defined($1)
164 #error Not defined
165 #endif
166 int main(void) { return 0; }
168 compile_object
171 if test ! -z "$cpu" ; then
172 # command line argument
174 elif check_define __i386__ ; then
175 cpu="i386"
176 elif check_define __x86_64__ ; then
177 cpu="x86_64"
178 elif check_define __sparc__ ; then
179 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
180 # They must be specified using --sparc_cpu
181 if check_define __arch64__ ; then
182 cpu="sparc64"
183 else
184 cpu="sparc"
186 elif check_define _ARCH_PPC ; then
187 if check_define _ARCH_PPC64 ; then
188 cpu="ppc64"
189 else
190 cpu="ppc"
192 elif check_define __mips__ ; then
193 cpu="mips"
194 elif check_define __ia64__ ; then
195 cpu="ia64"
196 elif check_define __s390__ ; then
197 if check_define __s390x__ ; then
198 cpu="s390x"
199 else
200 cpu="s390"
202 else
203 cpu=`uname -m`
206 target_list="x86_64-softmmu"
207 case "$cpu" in
208 alpha|cris|ia64|m68k|microblaze|ppc|ppc64|sparc64)
209 cpu="$cpu"
211 i386|i486|i586|i686|i86pc|BePC)
212 cpu="i386"
214 x86_64|amd64)
215 cpu="x86_64"
217 armv*b)
218 cpu="armv4b"
220 armv*l)
221 cpu="armv4l"
223 parisc|parisc64)
224 cpu="hppa"
226 mips*)
227 cpu="mips"
229 s390)
230 cpu="s390"
232 s390x)
233 cpu="s390x"
235 sparc|sun4[cdmuv])
236 cpu="sparc"
239 echo "Unsupported CPU = $cpu"
240 exit 1
242 esac
244 kvm_version() {
245 local fname="$(dirname "$0")/KVM_VERSION"
247 if test -f "$fname"; then
248 cat "$fname"
249 else
250 echo "qemu-kvm-devel"
254 # Default value for a variable defining feature "foo".
255 # * foo="no" feature will only be used if --enable-foo arg is given
256 # * foo="" feature will be searched for, and if found, will be used
257 # unless --disable-foo is given
258 # * foo="yes" this value will only be set by --enable-foo flag.
259 # feature will searched for,
260 # if not found, configure exits with error
262 # Always add --enable-foo and --disable-foo command line args.
263 # Distributions want to ensure that several features are compiled in, and it
264 # is impossible without a --enable-foo that exits if a feature is not found.
266 bluez=""
267 brlapi=""
268 curl=""
269 curses=""
270 docs=""
271 fdt=""
272 kvm=""
273 kvm_para=""
274 nptl=""
275 sdl=""
276 sparse="no"
277 uuid=""
278 vde=""
279 vnc_tls=""
280 vnc_sasl=""
281 xen=""
282 linux_aio=""
283 attr=""
284 vhost_net=""
286 gprof="no"
287 debug_tcg="no"
288 debug_mon="no"
289 debug="no"
290 strip_opt="yes"
291 bigendian="no"
292 mingw32="no"
293 EXESUF=""
294 prefix="/usr/local"
295 mandir="\${prefix}/share/man"
296 datadir="\${prefix}/share/qemu"
297 docdir="\${prefix}/share/doc/qemu"
298 bindir="\${prefix}/bin"
299 sysconfdir="\${prefix}/etc"
300 confsuffix="/qemu"
301 slirp="yes"
302 fmod_lib=""
303 fmod_inc=""
304 oss_lib=""
305 bsd="no"
306 linux="no"
307 solaris="no"
308 profiler="no"
309 cocoa="no"
310 softmmu="yes"
311 linux_user="no"
312 darwin_user="no"
313 bsd_user="no"
314 guest_base=""
315 uname_release=""
316 io_thread="no"
317 mixemu="no"
318 kvm_cap_pit=""
319 kvm_cap_device_assignment=""
320 kerneldir=""
321 aix="no"
322 blobs="yes"
323 pkgversion=" ($(kvm_version))"
324 cpu_emulation="yes"
325 check_utests="no"
326 user_pie="no"
327 zero_malloc=""
329 # OS specific
330 if check_define __linux__ ; then
331 targetos="Linux"
332 elif check_define _WIN32 ; then
333 targetos='MINGW32'
334 elif check_define __OpenBSD__ ; then
335 targetos='OpenBSD'
336 elif check_define __sun__ ; then
337 targetos='SunOS'
338 else
339 targetos=`uname -s`
342 case $targetos in
343 CYGWIN*)
344 mingw32="yes"
345 QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
346 audio_possible_drivers="winwave sdl"
347 audio_drv_list="winwave"
349 MINGW32*)
350 mingw32="yes"
351 audio_possible_drivers="winwave dsound sdl fmod"
352 audio_drv_list="winwave"
354 GNU/kFreeBSD)
355 bsd="yes"
356 audio_drv_list="oss"
357 audio_possible_drivers="oss sdl esd pa"
359 FreeBSD)
360 bsd="yes"
361 make="gmake"
362 audio_drv_list="oss"
363 audio_possible_drivers="oss sdl esd pa"
364 # needed for kinfo_getvmmap(3) in libutil.h
365 LIBS="-lutil $LIBS"
367 DragonFly)
368 bsd="yes"
369 make="gmake"
370 audio_drv_list="oss"
371 audio_possible_drivers="oss sdl esd pa"
373 NetBSD)
374 bsd="yes"
375 make="gmake"
376 audio_drv_list="oss"
377 audio_possible_drivers="oss sdl esd"
378 oss_lib="-lossaudio"
380 OpenBSD)
381 bsd="yes"
382 make="gmake"
383 audio_drv_list="oss"
384 audio_possible_drivers="oss sdl esd"
385 oss_lib="-lossaudio"
387 Darwin)
388 bsd="yes"
389 darwin="yes"
390 # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can
391 # run 64-bit userspace code
392 if [ "$cpu" = "i386" ] ; then
393 is_x86_64=`sysctl -n hw.optional.x86_64`
394 [ "$is_x86_64" = "1" ] && cpu=x86_64
396 if [ "$cpu" = "x86_64" ] ; then
397 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
398 LDFLAGS="-arch x86_64 $LDFLAGS"
399 else
400 QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
402 darwin_user="yes"
403 cocoa="yes"
404 audio_drv_list="coreaudio"
405 audio_possible_drivers="coreaudio sdl fmod"
406 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
407 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
409 SunOS)
410 solaris="yes"
411 make="gmake"
412 install="ginstall"
413 ld="gld"
414 needs_libsunmath="no"
415 solarisrev=`uname -r | cut -f2 -d.`
416 # have to select again, because `uname -m` returns i86pc
417 # even on an x86_64 box.
418 solariscpu=`isainfo -k`
419 if test "${solariscpu}" = "amd64" ; then
420 cpu="x86_64"
422 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
423 if test "$solarisrev" -le 9 ; then
424 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
425 needs_libsunmath="yes"
426 QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
427 LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
428 LIBS="-lsunmath $LIBS"
429 else
430 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
431 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
432 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
433 echo "Studio 11 can be downloaded from www.sun.com."
434 exit 1
438 if test -f /usr/include/sys/soundcard.h ; then
439 audio_drv_list="oss"
441 audio_possible_drivers="oss sdl"
442 # needed for CMSG_ macros in sys/socket.h
443 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
444 # needed for TIOCWIN* defines in termios.h
445 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
446 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
447 LIBS="-lsocket -lnsl -lresolv $LIBS"
449 AIX)
450 aix="yes"
451 make="gmake"
454 audio_drv_list="oss"
455 audio_possible_drivers="oss alsa sdl esd pa"
456 linux="yes"
457 linux_user="yes"
458 usb="linux"
459 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
460 audio_possible_drivers="$audio_possible_drivers fmod"
462 if [ "$cpu" = "ia64" ] ; then
463 xen="no"
464 target_list="ia64-softmmu"
465 cpu_emulation="no"
466 gdbstub="no"
467 slirp="no"
470 esac
472 if [ "$bsd" = "yes" ] ; then
473 if [ "$darwin" != "yes" ] ; then
474 usb="bsd"
476 bsd_user="yes"
479 if test "$mingw32" = "yes" ; then
480 EXESUF=".exe"
481 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
482 # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
483 QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
484 LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
485 prefix="c:/Program Files/Qemu"
486 mandir="\${prefix}"
487 datadir="\${prefix}"
488 docdir="\${prefix}"
489 bindir="\${prefix}"
490 sysconfdir="\${prefix}"
491 confsuffix=""
494 # find source path
495 source_path=`dirname "$0"`
496 source_path_used="no"
497 workdir=`pwd`
498 if [ -z "$source_path" ]; then
499 source_path=$workdir
500 else
501 source_path=`cd "$source_path"; pwd`
503 [ -f "$workdir/vl.c" ] || source_path_used="yes"
505 werror=""
507 for opt do
508 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
509 case "$opt" in
510 --help|-h) show_help=yes
512 --prefix=*) prefix="$optarg"
514 --interp-prefix=*) interp_prefix="$optarg"
516 --source-path=*) source_path="$optarg"
517 source_path_used="yes"
519 --cross-prefix=*)
521 --cc=*)
523 --host-cc=*) host_cc="$optarg"
525 --make=*) make="$optarg"
527 --install=*) install="$optarg"
529 --extra-cflags=*)
531 --extra-ldflags=*)
533 --cpu=*)
535 --target-list=*) target_list="$optarg"
537 --enable-gprof) gprof="yes"
539 --static)
540 static="yes"
541 LDFLAGS="-static $LDFLAGS"
543 --mandir=*) mandir="$optarg"
545 --bindir=*) bindir="$optarg"
547 --datadir=*) datadir="$optarg"
549 --docdir=*) docdir="$optarg"
551 --sysconfdir=*) sysconfdir="$optarg"
553 --disable-sdl) sdl="no"
555 --enable-sdl) sdl="yes"
557 --fmod-lib=*) fmod_lib="$optarg"
559 --fmod-inc=*) fmod_inc="$optarg"
561 --oss-lib=*) oss_lib="$optarg"
563 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
565 --audio-drv-list=*) audio_drv_list="$optarg"
567 --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
569 --enable-debug-tcg) debug_tcg="yes"
571 --disable-debug-tcg) debug_tcg="no"
573 --enable-debug-mon) debug_mon="yes"
575 --disable-debug-mon) debug_mon="no"
577 --enable-debug)
578 # Enable debugging options that aren't excessively noisy
579 debug_tcg="yes"
580 debug_mon="yes"
581 debug="yes"
582 strip_opt="no"
584 --enable-sparse) sparse="yes"
586 --disable-sparse) sparse="no"
588 --disable-strip) strip_opt="no"
590 --disable-vnc-tls) vnc_tls="no"
592 --enable-vnc-tls) vnc_tls="yes"
594 --disable-vnc-sasl) vnc_sasl="no"
596 --enable-vnc-sasl) vnc_sasl="yes"
598 --disable-slirp) slirp="no"
600 --disable-uuid) uuid="no"
602 --enable-uuid) uuid="yes"
604 --disable-vde) vde="no"
606 --enable-vde) vde="yes"
608 --disable-xen) xen="no"
610 --enable-xen) xen="yes"
612 --disable-brlapi) brlapi="no"
614 --enable-brlapi) brlapi="yes"
616 --disable-bluez) bluez="no"
618 --enable-bluez) bluez="yes"
620 --disable-kvm) kvm="no"
622 --enable-kvm) kvm="yes"
624 --disable-kvm-pit) kvm_cap_pit="no"
626 --enable-kvm-pit) kvm_cap_pit="yes"
628 --disable-kvm-device-assignment) kvm_cap_device_assignment="no"
630 --enable-kvm-device-assignment) kvm_cap_device_assignment="yes"
632 --enable-profiler) profiler="yes"
634 --enable-cocoa)
635 cocoa="yes" ;
636 sdl="no" ;
637 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
639 --disable-system) softmmu="no"
641 --enable-system) softmmu="yes"
643 --disable-user)
644 linux_user="no" ;
645 bsd_user="no" ;
646 darwin_user="no"
648 --enable-user) ;;
649 --disable-linux-user) linux_user="no"
651 --enable-linux-user) linux_user="yes"
653 --disable-darwin-user) darwin_user="no"
655 --enable-darwin-user) darwin_user="yes"
657 --disable-bsd-user) bsd_user="no"
659 --enable-bsd-user) bsd_user="yes"
661 --enable-guest-base) guest_base="yes"
663 --disable-guest-base) guest_base="no"
665 --enable-user-pie) user_pie="yes"
667 --disable-user-pie) user_pie="no"
669 --enable-uname-release=*) uname_release="$optarg"
671 --sparc_cpu=*)
673 --enable-werror) werror="yes"
675 --disable-werror) werror="no"
677 --disable-curses) curses="no"
679 --enable-curses) curses="yes"
681 --disable-curl) curl="no"
683 --enable-curl) curl="yes"
685 --disable-fdt) fdt="no"
687 --enable-fdt) fdt="yes"
689 --disable-check-utests) check_utests="no"
691 --enable-check-utests) check_utests="yes"
693 --disable-nptl) nptl="no"
695 --enable-nptl) nptl="yes"
697 --enable-mixemu) mixemu="yes"
699 --disable-linux-aio) linux_aio="no"
701 --enable-linux-aio) linux_aio="yes"
703 --disable-attr) attr="no"
705 --enable-attr) attr="yes"
707 --enable-io-thread) io_thread="yes"
709 --disable-blobs) blobs="no"
711 --kerneldir=*) kerneldir="$optarg"
713 --with-pkgversion=*) pkgversion=" ($optarg)"
715 --disable-docs) docs="no"
717 --enable-docs) docs="yes"
719 --disable-cpu-emulation) cpu_emulation="no"
721 --disable-vhost-net) vhost_net="no"
723 --enable-vhost-net) vhost_net="yes"
725 --*dir)
727 *) echo "ERROR: unknown option $opt"; show_help="yes"
729 esac
730 done
733 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
734 # QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
736 host_guest_base="no"
737 case "$cpu" in
738 sparc) case $sparc_cpu in
739 v7|v8)
740 QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
742 v8plus|v8plusa)
743 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
745 *) # sparc_cpu not defined in the command line
746 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
747 esac
748 LDFLAGS="-m32 $LDFLAGS"
749 QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
750 if test "$solaris" = "no" ; then
751 QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
752 helper_cflags="-ffixed-i0"
755 sparc64)
756 QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
757 LDFLAGS="-m64 $LDFLAGS"
758 QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
759 if test "$solaris" != "no" ; then
760 QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
763 s390)
764 QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS"
765 LDFLAGS="-m31 $LDFLAGS"
766 host_guest_base="yes"
768 s390x)
769 QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS"
770 LDFLAGS="-m64 $LDFLAGS"
771 host_guest_base="yes"
773 i386)
774 QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
775 LDFLAGS="-m32 $LDFLAGS"
776 helper_cflags="-fomit-frame-pointer"
777 host_guest_base="yes"
779 x86_64)
780 QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
781 LDFLAGS="-m64 $LDFLAGS"
782 host_guest_base="yes"
784 arm*)
785 host_guest_base="yes"
787 ppc*)
788 host_guest_base="yes"
790 mips*)
791 host_guest_base="yes"
793 ia64*)
794 host_guest_base="yes"
796 hppa*)
797 host_guest_base="yes"
799 esac
801 [ -z "$guest_base" ] && guest_base="$host_guest_base"
803 if test x"$show_help" = x"yes" ; then
804 cat << EOF
806 Usage: configure [options]
807 Options: [defaults in brackets after descriptions]
810 echo "Standard options:"
811 echo " --help print this message"
812 echo " --prefix=PREFIX install in PREFIX [$prefix]"
813 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
814 echo " use %M for cpu name [$interp_prefix]"
815 echo " --target-list=LIST set target list [$target_list]"
816 echo ""
817 echo "Advanced options (experts only):"
818 echo " --source-path=PATH path of source code [$source_path]"
819 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
820 echo " --cc=CC use C compiler CC [$cc]"
821 echo " --host-cc=CC use C compiler CC [$host_cc] for code run at"
822 echo " build time"
823 echo " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS"
824 echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS"
825 echo " --make=MAKE use specified make [$make]"
826 echo " --install=INSTALL use specified install [$install]"
827 echo " --static enable static build [$static]"
828 echo " --mandir=PATH install man pages in PATH"
829 echo " --datadir=PATH install firmware in PATH"
830 echo " --docdir=PATH install documentation in PATH"
831 echo " --bindir=PATH install binaries in PATH"
832 echo " --sysconfdir=PATH install config in PATH/qemu"
833 echo " --enable-debug-tcg enable TCG debugging"
834 echo " --disable-debug-tcg disable TCG debugging (default)"
835 echo " --enable-debug enable common debug build options"
836 echo " --enable-sparse enable sparse checker"
837 echo " --disable-sparse disable sparse checker (default)"
838 echo " --disable-strip disable stripping binaries"
839 echo " --disable-werror disable compilation abort on warning"
840 echo " --disable-sdl disable SDL"
841 echo " --enable-sdl enable SDL"
842 echo " --enable-cocoa enable COCOA (Mac OS X only)"
843 echo " --audio-drv-list=LIST set audio drivers list:"
844 echo " Available drivers: $audio_possible_drivers"
845 echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
846 echo " Available cards: $audio_possible_cards"
847 echo " --block-drv-whitelist=L set block driver whitelist"
848 echo " (affects only QEMU, not qemu-img)"
849 echo " --enable-mixemu enable mixer emulation"
850 echo " --disable-xen disable xen backend driver support"
851 echo " --enable-xen enable xen backend driver support"
852 echo " --disable-brlapi disable BrlAPI"
853 echo " --enable-brlapi enable BrlAPI"
854 echo " --disable-vnc-tls disable TLS encryption for VNC server"
855 echo " --enable-vnc-tls enable TLS encryption for VNC server"
856 echo " --disable-vnc-sasl disable SASL encryption for VNC server"
857 echo " --enable-vnc-sasl enable SASL encryption for VNC server"
858 echo " --disable-curses disable curses output"
859 echo " --enable-curses enable curses output"
860 echo " --disable-curl disable curl connectivity"
861 echo " --enable-curl enable curl connectivity"
862 echo " --disable-fdt disable fdt device tree"
863 echo " --enable-fdt enable fdt device tree"
864 echo " --disable-check-utests disable check unit-tests"
865 echo " --enable-check-utests enable check unit-tests"
866 echo " --disable-bluez disable bluez stack connectivity"
867 echo " --enable-bluez enable bluez stack connectivity"
868 echo " --disable-kvm disable KVM acceleration support"
869 echo " --enable-kvm enable KVM acceleration support"
870 echo " --disable-kvm-pit disable KVM pit support"
871 echo " --enable-kvm-pit enable KVM pit support"
872 echo " --disable-kvm-device-assignment disable KVM device assignment support"
873 echo " --enable-kvm-device-assignment enable KVM device assignment support"
874 echo " --disable-nptl disable usermode NPTL support"
875 echo " --enable-nptl enable usermode NPTL support"
876 echo " --enable-system enable all system emulation targets"
877 echo " --disable-system disable all system emulation targets"
878 echo " --enable-user enable supported user emulation targets"
879 echo " --disable-user disable all user emulation targets"
880 echo " --enable-linux-user enable all linux usermode emulation targets"
881 echo " --disable-linux-user disable all linux usermode emulation targets"
882 echo " --enable-darwin-user enable all darwin usermode emulation targets"
883 echo " --disable-darwin-user disable all darwin usermode emulation targets"
884 echo " --enable-bsd-user enable all BSD usermode emulation targets"
885 echo " --disable-bsd-user disable all BSD usermode emulation targets"
886 echo " --enable-guest-base enable GUEST_BASE support for usermode"
887 echo " emulation targets"
888 echo " --disable-guest-base disable GUEST_BASE support"
889 echo " --enable-user-pie build usermode emulation targets as PIE"
890 echo " --disable-user-pie do not build usermode emulation targets as PIE"
891 echo " --fmod-lib path to FMOD library"
892 echo " --fmod-inc path to FMOD includes"
893 echo " --oss-lib path to OSS library"
894 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
895 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
896 echo " --disable-uuid disable uuid support"
897 echo " --enable-uuid enable uuid support"
898 echo " --disable-vde disable support for vde network"
899 echo " --enable-vde enable support for vde network"
900 echo " --disable-linux-aio disable Linux AIO support"
901 echo " --enable-linux-aio enable Linux AIO support"
902 echo " --disable-attr disables attr and xattr support"
903 echo " --enable-attr enable attr and xattr support"
904 echo " --enable-io-thread enable IO thread"
905 echo " --disable-blobs disable installing provided firmware blobs"
906 echo " --kerneldir=PATH look for kernel includes in PATH"
907 echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
908 echo " --enable-docs enable documentation build"
909 echo " --disable-docs disable documentation build"
910 echo " --disable-vhost-net disable vhost-net acceleration support"
911 echo " --enable-vhost-net enable vhost-net acceleration support"
912 echo ""
913 echo "NOTE: The object files are built at the place where configure is launched"
914 exit 1
918 # Solaris specific configure tool chain decisions
920 if test "$solaris" = "yes" ; then
921 if has $install; then
923 else
924 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
925 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
926 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
927 exit 1
929 if test "`path_of $install`" = "/usr/sbin/install" ; then
930 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
931 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
932 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
933 exit 1
935 if has ar; then
937 else
938 echo "Error: No path includes ar"
939 if test -f /usr/ccs/bin/ar ; then
940 echo "Add /usr/ccs/bin to your path and rerun configure"
942 exit 1
947 if test -z "$target_list" ; then
948 # these targets are portable
949 if [ "$softmmu" = "yes" ] ; then
950 target_list="\
951 i386-softmmu \
952 x86_64-softmmu \
953 arm-softmmu \
954 cris-softmmu \
955 m68k-softmmu \
956 microblaze-softmmu \
957 mips-softmmu \
958 mipsel-softmmu \
959 mips64-softmmu \
960 mips64el-softmmu \
961 ppc-softmmu \
962 ppcemb-softmmu \
963 ppc64-softmmu \
964 sh4-softmmu \
965 sh4eb-softmmu \
966 sparc-softmmu \
967 sparc64-softmmu \
970 # the following are Linux specific
971 if [ "$linux_user" = "yes" ] ; then
972 target_list="${target_list}\
973 i386-linux-user \
974 x86_64-linux-user \
975 alpha-linux-user \
976 arm-linux-user \
977 armeb-linux-user \
978 cris-linux-user \
979 m68k-linux-user \
980 microblaze-linux-user \
981 mips-linux-user \
982 mipsel-linux-user \
983 ppc-linux-user \
984 ppc64-linux-user \
985 ppc64abi32-linux-user \
986 sh4-linux-user \
987 sh4eb-linux-user \
988 sparc-linux-user \
989 sparc64-linux-user \
990 sparc32plus-linux-user \
993 # the following are Darwin specific
994 if [ "$darwin_user" = "yes" ] ; then
995 target_list="$target_list i386-darwin-user ppc-darwin-user "
997 # the following are BSD specific
998 if [ "$bsd_user" = "yes" ] ; then
999 target_list="${target_list}\
1000 i386-bsd-user \
1001 x86_64-bsd-user \
1002 sparc-bsd-user \
1003 sparc64-bsd-user \
1006 else
1007 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
1009 if test -z "$target_list" ; then
1010 echo "No targets enabled"
1011 exit 1
1013 # see if system emulation was really requested
1014 case " $target_list " in
1015 *"-softmmu "*) softmmu=yes
1017 *) softmmu=no
1019 esac
1021 feature_not_found() {
1022 feature=$1
1024 echo "ERROR"
1025 echo "ERROR: User requested feature $feature"
1026 echo "ERROR: configure was not able to find it"
1027 echo "ERROR"
1028 exit 1;
1031 if test -z "$cross_prefix" ; then
1033 # ---
1034 # big/little endian test
1035 cat > $TMPC << EOF
1036 #include <inttypes.h>
1037 int main(int argc, char ** argv){
1038 volatile uint32_t i=0x01234567;
1039 return (*((uint8_t*)(&i))) == 0x67;
1043 if compile_prog "" "" ; then
1044 $TMPE && bigendian="yes"
1045 else
1046 echo big/little test failed
1049 else
1051 # if cross compiling, cannot launch a program, so make a static guess
1052 case "$cpu" in
1053 armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
1054 bigendian=yes
1056 esac
1060 # host long bits test
1061 hostlongbits="32"
1062 case "$cpu" in
1063 x86_64|alpha|ia64|sparc64|ppc64|s390x)
1064 hostlongbits=64
1066 esac
1069 ##########################################
1070 # NPTL probe
1072 if test "$nptl" != "no" ; then
1073 cat > $TMPC <<EOF
1074 #include <sched.h>
1075 #include <linux/futex.h>
1076 void foo()
1078 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1079 #error bork
1080 #endif
1084 if compile_object ; then
1085 nptl=yes
1086 else
1087 if test "$nptl" = "yes" ; then
1088 feature_not_found "nptl"
1090 nptl=no
1094 ##########################################
1095 # zlib check
1097 cat > $TMPC << EOF
1098 #include <zlib.h>
1099 int main(void) { zlibVersion(); return 0; }
1101 if compile_prog "" "-lz" ; then
1103 else
1104 echo
1105 echo "Error: zlib check failed"
1106 echo "Make sure to have the zlib libs and headers installed."
1107 echo
1108 exit 1
1111 ##########################################
1112 # xen probe
1114 if test "$xen" != "no" ; then
1115 xen_libs="-lxenstore -lxenctrl -lxenguest"
1116 cat > $TMPC <<EOF
1117 #include <xenctrl.h>
1118 #include <xs.h>
1119 int main(void) { xs_daemon_open(); xc_interface_open(); return 0; }
1121 if compile_prog "" "$xen_libs" ; then
1122 xen=yes
1123 libs_softmmu="$xen_libs $libs_softmmu"
1124 else
1125 if test "$xen" = "yes" ; then
1126 feature_not_found "xen"
1128 xen=no
1132 ##########################################
1133 # pkgconfig probe
1135 pkgconfig="${cross_prefix}pkg-config"
1136 if ! has $pkgconfig; then
1137 # likely not cross compiling, or hope for the best
1138 pkgconfig=pkg-config
1141 ##########################################
1142 # Sparse probe
1143 if test "$sparse" != "no" ; then
1144 if has cgcc; then
1145 sparse=yes
1146 else
1147 if test "$sparse" = "yes" ; then
1148 feature_not_found "sparse"
1150 sparse=no
1154 ##########################################
1155 # SDL probe
1157 # Look for sdl configuration program (pkg-config or sdl-config).
1158 # Prefer variant with cross prefix if cross compiling,
1159 # and favour pkg-config with sdl over sdl-config.
1160 if test -n "$cross_prefix" -a $pkgconfig != pkg-config && \
1161 $pkgconfig sdl --modversion >/dev/null 2>&1; then
1162 sdlconfig="$pkgconfig sdl"
1163 _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
1164 elif test -n "$cross_prefix" && has ${cross_prefix}sdl-config; then
1165 sdlconfig="${cross_prefix}sdl-config"
1166 _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1167 elif $pkgconfig sdl --modversion >/dev/null 2>&1; then
1168 sdlconfig="$pkgconfig sdl"
1169 _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
1170 elif has sdl-config; then
1171 sdlconfig='sdl-config'
1172 _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1173 else
1174 if test "$sdl" = "yes" ; then
1175 feature_not_found "sdl"
1177 sdl=no
1180 sdl_too_old=no
1181 if test "$sdl" != "no" ; then
1182 cat > $TMPC << EOF
1183 #include <SDL.h>
1184 #undef main /* We don't want SDL to override our main() */
1185 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1187 sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
1188 if test "$static" = "yes" ; then
1189 sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
1190 else
1191 sdl_libs=`$sdlconfig --libs 2> /dev/null`
1193 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1194 if test "$_sdlversion" -lt 121 ; then
1195 sdl_too_old=yes
1196 else
1197 if test "$cocoa" = "no" ; then
1198 sdl=yes
1202 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
1203 if test "$sdl" = "yes" -a "$static" = "yes" ; then
1204 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
1205 sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1206 sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
1208 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1210 else
1211 sdl=no
1213 fi # static link
1214 else # sdl not found
1215 if test "$sdl" = "yes" ; then
1216 feature_not_found "sdl"
1218 sdl=no
1219 fi # sdl compile test
1222 if test "$sdl" = "yes" ; then
1223 cat > $TMPC <<EOF
1224 #include <SDL.h>
1225 #if defined(SDL_VIDEO_DRIVER_X11)
1226 #include <X11/XKBlib.h>
1227 #else
1228 #error No x11 support
1229 #endif
1230 int main(void) { return 0; }
1232 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1233 sdl_libs="$sdl_libs -lX11"
1235 if test "$mingw32" = "yes" ; then
1236 sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole"
1238 libs_softmmu="$sdl_libs $libs_softmmu"
1241 ##########################################
1242 # VNC TLS detection
1243 if test "$vnc_tls" != "no" ; then
1244 cat > $TMPC <<EOF
1245 #include <gnutls/gnutls.h>
1246 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1248 vnc_tls_cflags=`$pkgconfig --cflags gnutls 2> /dev/null`
1249 vnc_tls_libs=`$pkgconfig --libs gnutls 2> /dev/null`
1250 if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
1251 vnc_tls=yes
1252 libs_softmmu="$vnc_tls_libs $libs_softmmu"
1253 else
1254 if test "$vnc_tls" = "yes" ; then
1255 feature_not_found "vnc-tls"
1257 vnc_tls=no
1261 ##########################################
1262 # VNC SASL detection
1263 if test "$vnc_sasl" != "no" ; then
1264 cat > $TMPC <<EOF
1265 #include <sasl/sasl.h>
1266 #include <stdio.h>
1267 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
1269 # Assuming Cyrus-SASL installed in /usr prefix
1270 vnc_sasl_cflags=""
1271 vnc_sasl_libs="-lsasl2"
1272 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1273 vnc_sasl=yes
1274 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
1275 else
1276 if test "$vnc_sasl" = "yes" ; then
1277 feature_not_found "vnc-sasl"
1279 vnc_sasl=no
1283 ##########################################
1284 # fnmatch() probe, used for ACL routines
1285 fnmatch="no"
1286 cat > $TMPC << EOF
1287 #include <fnmatch.h>
1288 int main(void)
1290 fnmatch("foo", "foo", 0);
1291 return 0;
1294 if compile_prog "" "" ; then
1295 fnmatch="yes"
1298 ##########################################
1299 # uuid_generate() probe, used for vdi block driver
1300 if test "$uuid" != "no" ; then
1301 uuid_libs="-luuid"
1302 cat > $TMPC << EOF
1303 #include <uuid/uuid.h>
1304 int main(void)
1306 uuid_t my_uuid;
1307 uuid_generate(my_uuid);
1308 return 0;
1311 if compile_prog "" "$uuid_libs" ; then
1312 uuid="yes"
1313 libs_softmmu="$uuid_libs $libs_softmmu"
1314 libs_tools="$uuid_libs $libs_tools"
1315 else
1316 if test "$uuid" = "yes" ; then
1317 feature_not_found "uuid"
1319 uuid=no
1323 ##########################################
1324 # vde libraries probe
1325 if test "$vde" != "no" ; then
1326 vde_libs="-lvdeplug"
1327 cat > $TMPC << EOF
1328 #include <libvdeplug.h>
1329 int main(void)
1331 struct vde_open_args a = {0, 0, 0};
1332 vde_open("", "", &a);
1333 return 0;
1336 if compile_prog "" "$vde_libs" ; then
1337 vde=yes
1338 libs_softmmu="$vde_libs $libs_softmmu"
1339 libs_tools="$vde_libs $libs_tools"
1340 else
1341 if test "$vde" = "yes" ; then
1342 feature_not_found "vde"
1344 vde=no
1348 ##########################################
1349 # Sound support libraries probe
1351 audio_drv_probe()
1353 drv=$1
1354 hdr=$2
1355 lib=$3
1356 exp=$4
1357 cfl=$5
1358 cat > $TMPC << EOF
1359 #include <$hdr>
1360 int main(void) { $exp }
1362 if compile_prog "$cfl" "$lib" ; then
1364 else
1365 echo
1366 echo "Error: $drv check failed"
1367 echo "Make sure to have the $drv libs and headers installed."
1368 echo
1369 exit 1
1373 audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1374 for drv in $audio_drv_list; do
1375 case $drv in
1376 alsa)
1377 audio_drv_probe $drv alsa/asoundlib.h -lasound \
1378 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1379 libs_softmmu="-lasound $libs_softmmu"
1382 fmod)
1383 if test -z $fmod_lib || test -z $fmod_inc; then
1384 echo
1385 echo "Error: You must specify path to FMOD library and headers"
1386 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1387 echo
1388 exit 1
1390 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1391 libs_softmmu="$fmod_lib $libs_softmmu"
1394 esd)
1395 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1396 libs_softmmu="-lesd $libs_softmmu"
1397 audio_pt_int="yes"
1401 audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
1402 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1403 libs_softmmu="-lpulse -lpulse-simple $libs_softmmu"
1404 audio_pt_int="yes"
1407 coreaudio)
1408 libs_softmmu="-framework CoreAudio $libs_softmmu"
1411 dsound)
1412 libs_softmmu="-lole32 -ldxguid $libs_softmmu"
1413 audio_win_int="yes"
1416 oss)
1417 libs_softmmu="$oss_lib $libs_softmmu"
1420 sdl|wav)
1421 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1424 winwave)
1425 libs_softmmu="-lwinmm $libs_softmmu"
1426 audio_win_int="yes"
1430 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
1431 echo
1432 echo "Error: Unknown driver '$drv' selected"
1433 echo "Possible drivers are: $audio_possible_drivers"
1434 echo
1435 exit 1
1438 esac
1439 done
1441 ##########################################
1442 # BrlAPI probe
1444 if test "$brlapi" != "no" ; then
1445 brlapi_libs="-lbrlapi"
1446 cat > $TMPC << EOF
1447 #include <brlapi.h>
1448 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1450 if compile_prog "" "$brlapi_libs" ; then
1451 brlapi=yes
1452 libs_softmmu="$brlapi_libs $libs_softmmu"
1453 else
1454 if test "$brlapi" = "yes" ; then
1455 feature_not_found "brlapi"
1457 brlapi=no
1461 ##########################################
1462 # curses probe
1463 curses_list="-lncurses -lcurses"
1465 if test "$curses" != "no" ; then
1466 curses_found=no
1467 cat > $TMPC << EOF
1468 #include <curses.h>
1469 #ifdef __OpenBSD__
1470 #define resize_term resizeterm
1471 #endif
1472 int main(void) { resize_term(0, 0); return curses_version(); }
1474 for curses_lib in $curses_list; do
1475 if compile_prog "" "$curses_lib" ; then
1476 curses_found=yes
1477 libs_softmmu="$curses_lib $libs_softmmu"
1478 break
1480 done
1481 if test "$curses_found" = "yes" ; then
1482 curses=yes
1483 else
1484 if test "$curses" = "yes" ; then
1485 feature_not_found "curses"
1487 curses=no
1491 ##########################################
1492 # curl probe
1494 if $pkgconfig libcurl --modversion >/dev/null 2>&1; then
1495 curlconfig="$pkgconfig libcurl"
1496 else
1497 curlconfig=curl-config
1500 if test "$curl" != "no" ; then
1501 cat > $TMPC << EOF
1502 #include <curl/curl.h>
1503 int main(void) { return curl_easy_init(); }
1505 curl_cflags=`$curlconfig --cflags 2>/dev/null`
1506 curl_libs=`$curlconfig --libs 2>/dev/null`
1507 if compile_prog "$curl_cflags" "$curl_libs" ; then
1508 curl=yes
1509 libs_tools="$curl_libs $libs_tools"
1510 libs_softmmu="$curl_libs $libs_softmmu"
1511 else
1512 if test "$curl" = "yes" ; then
1513 feature_not_found "curl"
1515 curl=no
1517 fi # test "$curl"
1519 ##########################################
1520 # check framework probe
1522 if test "$check_utests" != "no" ; then
1523 cat > $TMPC << EOF
1524 #include <check.h>
1525 int main(void) { suite_create("qemu test"); return 0; }
1527 check_libs=`$pkgconfig --libs check`
1528 if compile_prog "" $check_libs ; then
1529 check_utests=yes
1530 libs_tools="$check_libs $libs_tools"
1531 else
1532 if test "$check_utests" = "yes" ; then
1533 feature_not_found "check"
1535 check_utests=no
1537 fi # test "$check_utests"
1539 ##########################################
1540 # bluez support probe
1541 if test "$bluez" != "no" ; then
1542 cat > $TMPC << EOF
1543 #include <bluetooth/bluetooth.h>
1544 int main(void) { return bt_error(0); }
1546 bluez_cflags=`$pkgconfig --cflags bluez 2> /dev/null`
1547 bluez_libs=`$pkgconfig --libs bluez 2> /dev/null`
1548 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
1549 bluez=yes
1550 libs_softmmu="$bluez_libs $libs_softmmu"
1551 else
1552 if test "$bluez" = "yes" ; then
1553 feature_not_found "bluez"
1555 bluez="no"
1559 ##########################################
1560 # kvm probe
1561 if test "$kvm" != "no" ; then
1562 cat > $TMPC <<EOF
1563 #include <linux/kvm.h>
1564 #if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
1565 #error Invalid KVM version
1566 #endif
1567 #if !defined(KVM_CAP_USER_MEMORY)
1568 #error Missing KVM capability KVM_CAP_USER_MEMORY
1569 #endif
1570 #if !defined(KVM_CAP_SET_TSS_ADDR)
1571 #error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1572 #endif
1573 #if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1574 #error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1575 #endif
1576 int main(void) { return 0; }
1578 if test "$kerneldir" != "" ; then
1579 kvm_cflags=-I"$kerneldir"/include
1580 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1581 -a -d "$kerneldir/arch/x86/include" ; then
1582 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
1583 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1584 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
1585 elif test "$cpu" = "s390x" -a -d "$kerneldir/arch/s390/include" ; then
1586 kvm_cflags="$kvm_cflags -I$kerneldir/arch/s390/include"
1587 elif test -d "$kerneldir/arch/$cpu/include" ; then
1588 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1590 else
1591 kvm_cflags=`$pkgconfig --cflags kvm-kmod 2>/dev/null`
1592 if test "$kvm_cflags" = ""; then
1593 case "$cpu" in
1594 i386 | x86_64)
1595 kvm_arch="x86"
1597 ppc)
1598 kvm_arch="powerpc"
1601 kvm_arch="$cpu"
1603 esac
1604 kvm_cflags="-I$source_path/kvm/include"
1605 kvm_cflags="$kvm_cflags -include $source_path/kvm/include/linux/config.h"
1606 kvm_cflags="$kvm_cflags -I$source_path/kvm/include/$kvm_arch"
1609 kvm_cflags="$kvm_cflags -idirafter $source_path/compat"
1610 if compile_prog "$kvm_cflags" "" ; then
1611 kvm=yes
1612 cat > $TMPC <<EOF
1613 #include <linux/kvm_para.h>
1614 int main(void) { return 0; }
1616 if compile_prog "$kvm_cflags" "" ; then
1617 kvm_para=yes
1619 else
1620 if test "$kvm" = "yes" ; then
1621 if has awk && has grep; then
1622 kvmerr=`LANG=C $cc $QEMU_CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \
1623 | grep "error: " \
1624 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1625 if test "$kvmerr" != "" ; then
1626 echo -e "${kvmerr}\n\
1627 NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \
1628 recent kvm-kmod from http://sourceforge.net/projects/kvm."
1631 feature_not_found "kvm"
1633 kvm=no
1637 ##########################################
1638 # test for KVM_CAP_PIT
1640 if test "$kvm_cap_pit" != "no" ; then
1641 if test "$kvm" = "no" -a "$kvm_cap_pit" = "yes" ; then
1642 feature_not_found "kvm_cap_pit (kvm is not enabled)"
1644 cat > $TMPC <<EOF
1645 #include <linux/kvm.h>
1646 #ifndef KVM_CAP_PIT
1647 #error "kvm no pit capability"
1648 #endif
1649 int main(void) { return 0; }
1651 if compile_prog "$kvm_cflags" ""; then
1652 kvm_cap_pit=yes
1653 else
1654 if test "$kvm_cap_pit" = "yes" ; then
1655 feature_not_found "kvm_cap_pit"
1657 kvm_cap_pit=no
1661 ##########################################
1662 # test for KVM_CAP_DEVICE_ASSIGNMENT
1664 if test "$kvm_cap_device_assignment" != "no" ; then
1665 if test "$kvm" = "no" -a "$kvm_cap_device_assignment" = "yes" ; then
1666 feature_not_found "kvm_cap_device_assignment (kvm is not enabled)"
1668 cat > $TMPC <<EOF
1669 #include <linux/kvm.h>
1670 #ifndef KVM_CAP_DEVICE_ASSIGNMENT
1671 #error "kvm no device assignment capability"
1672 #endif
1673 int main(void) { return 0; }
1675 if compile_prog "$kvm_cflags" "" ; then
1676 kvm_cap_device_assignment=yes
1677 else
1678 if test "$kvm_cap_device_assignment" = "yes" ; then
1679 feature_not_found "kvm_cap_device_assigment"
1681 kvm_cap_device_assignment=no
1685 ##########################################
1686 # libpci header probe for kvm_cap_device_assignment
1687 if test $kvm_cap_device_assignment = "yes" ; then
1688 cat > $TMPC << EOF
1689 #include <pci/header.h>
1690 #ifndef PCI_VENDOR_ID
1691 #error NO LIBPCI HEADER
1692 #endif
1693 int main(void) { return 0; }
1695 if compile_prog "" "" ; then
1696 kvm_cap_device_assignment=yes
1697 else
1698 echo
1699 echo "Error: libpci header check failed"
1700 echo "Disable KVM Device Assignment capability."
1701 echo
1702 kvm_cap_device_assignment=no
1706 ##########################################
1707 # test for vhost net
1709 if test "$vhost_net" != "no"; then
1710 if test "$kvm" != "no"; then
1711 cat > $TMPC <<EOF
1712 #include <linux/vhost.h>
1713 int main(void) { return 0; }
1715 if compile_prog "$kvm_cflags" "" ; then
1716 vhost_net=yes
1717 else
1718 if test "$vhost_net" = "yes" ; then
1719 feature_not_found "vhost-net"
1721 vhost_net=no
1723 else
1724 if test "$vhost_net" = "yes" ; then
1725 echo "NOTE: vhost-net feature requires KVM (--enable-kvm)."
1726 feature_not_found "vhost-net"
1728 vhost_net=no
1732 ##########################################
1733 # pthread probe
1734 PTHREADLIBS_LIST="-lpthread -lpthreadGC2"
1736 pthread=no
1737 cat > $TMPC << EOF
1738 #include <pthread.h>
1739 int main(void) { pthread_create(0,0,0,0); return 0; }
1741 for pthread_lib in $PTHREADLIBS_LIST; do
1742 if compile_prog "" "$pthread_lib" ; then
1743 pthread=yes
1744 LIBS="$pthread_lib $LIBS"
1745 break
1747 done
1749 if test "$mingw32" != yes -a "$pthread" = no; then
1750 echo
1751 echo "Error: pthread check failed"
1752 echo "Make sure to have the pthread libs and headers installed."
1753 echo
1754 exit 1
1757 ##########################################
1758 # linux-aio probe
1760 if test "$linux_aio" != "no" ; then
1761 cat > $TMPC <<EOF
1762 #include <libaio.h>
1763 #include <sys/eventfd.h>
1764 int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
1766 if compile_prog "" "-laio" ; then
1767 linux_aio=yes
1768 libs_softmmu="$libs_softmmu -laio"
1769 libs_tools="$libs_tools -laio"
1770 else
1771 if test "$linux_aio" = "yes" ; then
1772 feature_not_found "linux AIO"
1774 linux_aio=no
1778 ##########################################
1779 # attr probe
1781 if test "$attr" != "no" ; then
1782 cat > $TMPC <<EOF
1783 #include <stdio.h>
1784 #include <sys/types.h>
1785 #include <attr/xattr.h>
1786 int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
1788 if compile_prog "" "-lattr" ; then
1789 attr=yes
1790 LIBS="-lattr $LIBS"
1791 else
1792 if test "$attr" = "yes" ; then
1793 feature_not_found "ATTR"
1795 attr=no
1799 ##########################################
1800 # iovec probe
1801 cat > $TMPC <<EOF
1802 #include <sys/types.h>
1803 #include <sys/uio.h>
1804 #include <unistd.h>
1805 int main(void) { struct iovec iov; return 0; }
1807 iovec=no
1808 if compile_prog "" "" ; then
1809 iovec=yes
1812 ##########################################
1813 # preadv probe
1814 cat > $TMPC <<EOF
1815 #include <sys/types.h>
1816 #include <sys/uio.h>
1817 #include <unistd.h>
1818 int main(void) { preadv; }
1820 preadv=no
1821 if compile_prog "" "" ; then
1822 preadv=yes
1825 ##########################################
1826 # fdt probe
1827 if test "$fdt" != "no" ; then
1828 fdt_libs="-lfdt"
1829 cat > $TMPC << EOF
1830 int main(void) { return 0; }
1832 if compile_prog "" "$fdt_libs" ; then
1833 fdt=yes
1834 libs_softmmu="$fdt_libs $libs_softmmu"
1835 else
1836 if test "$fdt" = "yes" ; then
1837 feature_not_found "fdt"
1839 fdt=no
1844 # Check for xxxat() functions when we are building linux-user
1845 # emulator. This is done because older glibc versions don't
1846 # have syscall stubs for these implemented.
1848 atfile=no
1849 cat > $TMPC << EOF
1850 #define _ATFILE_SOURCE
1851 #include <sys/types.h>
1852 #include <fcntl.h>
1853 #include <unistd.h>
1856 main(void)
1858 /* try to unlink nonexisting file */
1859 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1862 if compile_prog "" "" ; then
1863 atfile=yes
1866 # Check for inotify functions when we are building linux-user
1867 # emulator. This is done because older glibc versions don't
1868 # have syscall stubs for these implemented. In that case we
1869 # don't provide them even if kernel supports them.
1871 inotify=no
1872 cat > $TMPC << EOF
1873 #include <sys/inotify.h>
1876 main(void)
1878 /* try to start inotify */
1879 return inotify_init();
1882 if compile_prog "" "" ; then
1883 inotify=yes
1886 inotify1=no
1887 cat > $TMPC << EOF
1888 #include <sys/inotify.h>
1891 main(void)
1893 /* try to start inotify */
1894 return inotify_init1(0);
1897 if compile_prog "" "" ; then
1898 inotify1=yes
1901 # check if utimensat and futimens are supported
1902 utimens=no
1903 cat > $TMPC << EOF
1904 #define _ATFILE_SOURCE
1905 #define _GNU_SOURCE
1906 #include <stddef.h>
1907 #include <fcntl.h>
1909 int main(void)
1911 utimensat(AT_FDCWD, "foo", NULL, 0);
1912 futimens(0, NULL);
1913 return 0;
1916 if compile_prog "" "" ; then
1917 utimens=yes
1920 # check if pipe2 is there
1921 pipe2=no
1922 cat > $TMPC << EOF
1923 #define _GNU_SOURCE
1924 #include <unistd.h>
1925 #include <fcntl.h>
1927 int main(void)
1929 int pipefd[2];
1930 pipe2(pipefd, O_CLOEXEC);
1931 return 0;
1934 if compile_prog "" "" ; then
1935 pipe2=yes
1938 # check if accept4 is there
1939 accept4=no
1940 cat > $TMPC << EOF
1941 #define _GNU_SOURCE
1942 #include <sys/socket.h>
1943 #include <stddef.h>
1945 int main(void)
1947 accept4(0, NULL, NULL, SOCK_CLOEXEC);
1948 return 0;
1951 if compile_prog "" "" ; then
1952 accept4=yes
1955 # check if tee/splice is there. vmsplice was added same time.
1956 splice=no
1957 cat > $TMPC << EOF
1958 #define _GNU_SOURCE
1959 #include <unistd.h>
1960 #include <fcntl.h>
1961 #include <limits.h>
1963 int main(void)
1965 int len, fd;
1966 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
1967 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
1968 return 0;
1971 if compile_prog "" "" ; then
1972 splice=yes
1975 ##########################################
1976 # signalfd probe
1977 signalfd="no"
1978 cat > $TMPC << EOF
1979 #define _GNU_SOURCE
1980 #include <unistd.h>
1981 #include <sys/syscall.h>
1982 #include <signal.h>
1983 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
1986 if compile_prog "" "" ; then
1987 signalfd=yes
1990 # check if eventfd is supported
1991 eventfd=no
1992 cat > $TMPC << EOF
1993 #include <sys/eventfd.h>
1995 int main(void)
1997 int efd = eventfd(0, 0);
1998 return 0;
2001 if compile_prog "" "" ; then
2002 eventfd=yes
2005 # check for fallocate
2006 fallocate=no
2007 cat > $TMPC << EOF
2008 #include <fcntl.h>
2010 int main(void)
2012 fallocate(0, 0, 0, 0);
2013 return 0;
2016 if compile_prog "$ARCH_CFLAGS" "" ; then
2017 fallocate=yes
2020 # check for dup3
2021 dup3=no
2022 cat > $TMPC << EOF
2023 #include <unistd.h>
2025 int main(void)
2027 dup3(0, 0, 0);
2028 return 0;
2031 if compile_prog "" "" ; then
2032 dup3=yes
2035 # Check if tools are available to build documentation.
2036 if test "$docs" != "no" ; then
2037 if has makeinfo && has pod2man; then
2038 docs=yes
2039 else
2040 if test "$docs" = "yes" ; then
2041 feature_not_found "docs"
2043 docs=no
2047 # Search for bswap_32 function
2048 byteswap_h=no
2049 cat > $TMPC << EOF
2050 #include <byteswap.h>
2051 int main(void) { return bswap_32(0); }
2053 if compile_prog "" "" ; then
2054 byteswap_h=yes
2057 # Search for bswap_32 function
2058 bswap_h=no
2059 cat > $TMPC << EOF
2060 #include <sys/endian.h>
2061 #include <sys/types.h>
2062 #include <machine/bswap.h>
2063 int main(void) { return bswap32(0); }
2065 if compile_prog "" "" ; then
2066 bswap_h=yes
2069 ##########################################
2070 # Do we need librt
2071 cat > $TMPC <<EOF
2072 #include <signal.h>
2073 #include <time.h>
2074 int main(void) { clockid_t id; return clock_gettime(id, NULL); }
2077 if compile_prog "" "" ; then
2079 elif compile_prog "" "-lrt" ; then
2080 LIBS="-lrt $LIBS"
2083 if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
2084 "$aix" != "yes" ; then
2085 libs_softmmu="-lutil $libs_softmmu"
2088 ##########################################
2089 # check if the compiler defines offsetof
2091 need_offsetof=yes
2092 cat > $TMPC << EOF
2093 #include <stddef.h>
2094 int main(void) { struct s { int f; }; return offsetof(struct s, f); }
2096 if compile_prog "" "" ; then
2097 need_offsetof=no
2100 ##########################################
2101 # check if the compiler understands attribute warn_unused_result
2103 # This could be smarter, but gcc -Werror does not error out even when warning
2104 # about attribute warn_unused_result
2106 gcc_attribute_warn_unused_result=no
2107 cat > $TMPC << EOF
2108 #if defined(__GNUC__) && (__GNUC__ < 4) && defined(__GNUC_MINOR__) && (__GNUC__ < 4)
2109 #error gcc 3.3 or older
2110 #endif
2111 int main(void) { return 0;}
2113 if compile_prog "" ""; then
2114 gcc_attribute_warn_unused_result=yes
2117 ##########################################
2118 # check if we have fdatasync
2120 fdatasync=no
2121 cat > $TMPC << EOF
2122 #include <unistd.h>
2123 int main(void) { return fdatasync(0); }
2125 if compile_prog "" "" ; then
2126 fdatasync=yes
2129 # End of CC checks
2130 # After here, no more $cc or $ld runs
2132 if test "$debug" = "no" ; then
2133 CFLAGS="-O2 $CFLAGS"
2136 # Consult white-list to determine whether to enable werror
2137 # by default. Only enable by default for git builds
2138 z_version=`cut -f3 -d. $source_path/VERSION`
2140 if test -z "$werror" ; then
2141 if test "$z_version" = "50" -a \
2142 "$linux" = "yes" ; then
2143 werror="yes"
2144 else
2145 werror="no"
2149 # Disable zero malloc errors for official releases unless explicitly told to
2150 # enable/disable
2151 if test -z "$zero_malloc" ; then
2152 if test "$z_version" = "50" ; then
2153 zero_malloc="no"
2154 else
2155 zero_malloc="yes"
2159 if test "$werror" = "yes" ; then
2160 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
2163 if test "$solaris" = "no" ; then
2164 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
2165 LDFLAGS="-Wl,--warn-common $LDFLAGS"
2169 confdir=$sysconfdir$confsuffix
2171 tools=
2172 if test "$softmmu" = yes ; then
2173 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
2174 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
2175 tools="qemu-nbd\$(EXESUF) $tools"
2176 if [ "$check_utests" = "yes" ]; then
2177 tools="check-qint check-qstring check-qdict check-qlist $tools"
2178 tools="check-qfloat check-qjson $tools"
2183 # Mac OS X ships with a broken assembler
2184 roms=
2185 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
2186 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
2187 "$softmmu" = yes ; then
2188 roms="optionrom"
2192 echo "Install prefix $prefix"
2193 echo "BIOS directory `eval echo $datadir`"
2194 echo "binary directory `eval echo $bindir`"
2195 echo "config directory `eval echo $sysconfdir`"
2196 if test "$mingw32" = "no" ; then
2197 echo "Manual directory `eval echo $mandir`"
2198 echo "ELF interp prefix $interp_prefix"
2200 echo "Source path $source_path"
2201 echo "C compiler $cc"
2202 echo "Host C compiler $host_cc"
2203 echo "CFLAGS $CFLAGS"
2204 echo "QEMU_CFLAGS $QEMU_CFLAGS"
2205 echo "LDFLAGS $LDFLAGS"
2206 echo "make $make"
2207 echo "install $install"
2208 echo "host CPU $cpu"
2209 echo "host big endian $bigendian"
2210 echo "target list $target_list"
2211 echo "tcg debug enabled $debug_tcg"
2212 echo "Mon debug enabled $debug_mon"
2213 echo "gprof enabled $gprof"
2214 echo "sparse enabled $sparse"
2215 echo "strip binaries $strip_opt"
2216 echo "profiler $profiler"
2217 echo "static build $static"
2218 echo "-Werror enabled $werror"
2219 if test "$darwin" = "yes" ; then
2220 echo "Cocoa support $cocoa"
2222 echo "SDL support $sdl"
2223 echo "curses support $curses"
2224 echo "curl support $curl"
2225 echo "check support $check_utests"
2226 echo "mingw32 support $mingw32"
2227 echo "Audio drivers $audio_drv_list"
2228 echo "Extra audio cards $audio_card_list"
2229 echo "Block whitelist $block_drv_whitelist"
2230 echo "Mixer emulation $mixemu"
2231 echo "VNC TLS support $vnc_tls"
2232 echo "VNC SASL support $vnc_sasl"
2233 if test -n "$sparc_cpu"; then
2234 echo "Target Sparc Arch $sparc_cpu"
2236 echo "xen support $xen"
2237 echo "CPU emulation $cpu_emulation"
2238 echo "brlapi support $brlapi"
2239 echo "bluez support $bluez"
2240 echo "Documentation $docs"
2241 [ ! -z "$uname_release" ] && \
2242 echo "uname -r $uname_release"
2243 echo "NPTL support $nptl"
2244 echo "GUEST_BASE $guest_base"
2245 echo "PIE user targets $user_pie"
2246 echo "vde support $vde"
2247 echo "IO thread $io_thread"
2248 echo "Linux AIO support $linux_aio"
2249 echo "ATTR/XATTR support $attr"
2250 echo "Install blobs $blobs"
2251 echo "KVM support $kvm"
2252 echo "KVM PIT support $kvm_cap_pit"
2253 echo "KVM device assig. $kvm_cap_device_assignment"
2254 echo "fdt support $fdt"
2255 echo "preadv support $preadv"
2256 echo "fdatasync $fdatasync"
2257 echo "uuid support $uuid"
2258 echo "vhost-net support $vhost_net"
2260 if test $sdl_too_old = "yes"; then
2261 echo "-> Your SDL version is too old - please upgrade to have SDL support"
2264 config_host_mak="config-host.mak"
2265 config_host_ld="config-host.ld"
2267 echo "# Automatically generated by configure - do not modify" > $config_host_mak
2268 printf "# Configured with:" >> $config_host_mak
2269 printf " '%s'" "$0" "$@" >> $config_host_mak
2270 echo >> $config_host_mak
2272 echo "prefix=$prefix" >> $config_host_mak
2273 echo "bindir=$bindir" >> $config_host_mak
2274 echo "mandir=$mandir" >> $config_host_mak
2275 echo "datadir=$datadir" >> $config_host_mak
2276 echo "sysconfdir=$sysconfdir" >> $config_host_mak
2277 echo "docdir=$docdir" >> $config_host_mak
2278 echo "confdir=$confdir" >> $config_host_mak
2280 case "$cpu" in
2281 i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
2282 ARCH=$cpu
2284 armv4b|armv4l)
2285 ARCH=arm
2287 esac
2288 echo "ARCH=$ARCH" >> $config_host_mak
2289 if test "$debug_tcg" = "yes" ; then
2290 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
2292 if test "$debug_mon" = "yes" ; then
2293 echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak
2295 if test "$debug" = "yes" ; then
2296 echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
2298 if test "$strip_opt" = "yes" ; then
2299 echo "STRIP_OPT=-s" >> $config_host_mak
2301 if test "$bigendian" = "yes" ; then
2302 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
2304 echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
2305 if test "$mingw32" = "yes" ; then
2306 echo "CONFIG_WIN32=y" >> $config_host_mak
2307 else
2308 echo "CONFIG_POSIX=y" >> $config_host_mak
2311 if test "$linux" = "yes" ; then
2312 echo "CONFIG_LINUX=y" >> $config_host_mak
2315 if test "$darwin" = "yes" ; then
2316 echo "CONFIG_DARWIN=y" >> $config_host_mak
2319 if test "$aix" = "yes" ; then
2320 echo "CONFIG_AIX=y" >> $config_host_mak
2323 if test "$solaris" = "yes" ; then
2324 echo "CONFIG_SOLARIS=y" >> $config_host_mak
2325 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
2326 if test "$needs_libsunmath" = "yes" ; then
2327 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
2330 if test "$static" = "yes" ; then
2331 echo "CONFIG_STATIC=y" >> $config_host_mak
2333 if test $profiler = "yes" ; then
2334 echo "CONFIG_PROFILER=y" >> $config_host_mak
2336 if test "$slirp" = "yes" ; then
2337 echo "CONFIG_SLIRP=y" >> $config_host_mak
2338 QEMU_CFLAGS="-I\$(SRC_PATH)/slirp $QEMU_CFLAGS"
2340 if test "$vde" = "yes" ; then
2341 echo "CONFIG_VDE=y" >> $config_host_mak
2343 for card in $audio_card_list; do
2344 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
2345 echo "$def=y" >> $config_host_mak
2346 done
2347 echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
2348 for drv in $audio_drv_list; do
2349 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
2350 echo "$def=y" >> $config_host_mak
2351 if test "$drv" = "fmod"; then
2352 echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
2354 done
2355 if test "$audio_pt_int" = "yes" ; then
2356 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
2358 if test "$audio_win_int" = "yes" ; then
2359 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
2361 echo "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
2362 if test "$mixemu" = "yes" ; then
2363 echo "CONFIG_MIXEMU=y" >> $config_host_mak
2365 if test "$vnc_tls" = "yes" ; then
2366 echo "CONFIG_VNC_TLS=y" >> $config_host_mak
2367 echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
2369 if test "$vnc_sasl" = "yes" ; then
2370 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
2371 echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
2373 if test "$fnmatch" = "yes" ; then
2374 echo "CONFIG_FNMATCH=y" >> $config_host_mak
2376 if test "$uuid" = "yes" ; then
2377 echo "CONFIG_UUID=y" >> $config_host_mak
2379 qemu_version=`head $source_path/VERSION`
2380 echo "VERSION=$qemu_version" >>$config_host_mak
2381 echo "PKGVERSION=$pkgversion" >>$config_host_mak
2382 echo "SRC_PATH=$source_path" >> $config_host_mak
2383 echo "TARGET_DIRS=$target_list" >> $config_host_mak
2384 if [ "$docs" = "yes" ] ; then
2385 echo "BUILD_DOCS=yes" >> $config_host_mak
2387 if test "$sdl" = "yes" ; then
2388 echo "CONFIG_SDL=y" >> $config_host_mak
2389 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
2391 if test "$cocoa" = "yes" ; then
2392 echo "CONFIG_COCOA=y" >> $config_host_mak
2394 if test "$curses" = "yes" ; then
2395 echo "CONFIG_CURSES=y" >> $config_host_mak
2397 if test "$atfile" = "yes" ; then
2398 echo "CONFIG_ATFILE=y" >> $config_host_mak
2400 if test "$utimens" = "yes" ; then
2401 echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
2403 if test "$pipe2" = "yes" ; then
2404 echo "CONFIG_PIPE2=y" >> $config_host_mak
2406 if test "$accept4" = "yes" ; then
2407 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
2409 if test "$splice" = "yes" ; then
2410 echo "CONFIG_SPLICE=y" >> $config_host_mak
2412 if test "$eventfd" = "yes" ; then
2413 echo "CONFIG_EVENTFD=y" >> $config_host_mak
2415 if test "$fallocate" = "yes" ; then
2416 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
2418 if test "$dup3" = "yes" ; then
2419 echo "CONFIG_DUP3=y" >> $config_host_mak
2421 if test "$inotify" = "yes" ; then
2422 echo "CONFIG_INOTIFY=y" >> $config_host_mak
2424 if test "$inotify1" = "yes" ; then
2425 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
2427 if test "$byteswap_h" = "yes" ; then
2428 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
2430 if test "$bswap_h" = "yes" ; then
2431 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
2433 if test "$curl" = "yes" ; then
2434 echo "CONFIG_CURL=y" >> $config_host_mak
2435 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
2437 if test "$brlapi" = "yes" ; then
2438 echo "CONFIG_BRLAPI=y" >> $config_host_mak
2440 if test "$bluez" = "yes" ; then
2441 echo "CONFIG_BLUEZ=y" >> $config_host_mak
2442 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
2444 if test "$xen" = "yes" ; then
2445 echo "CONFIG_XEN=y" >> $config_host_mak
2447 if test "$io_thread" = "yes" ; then
2448 echo "CONFIG_IOTHREAD=y" >> $config_host_mak
2450 if test "$linux_aio" = "yes" ; then
2451 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
2453 if test "$attr" = "yes" ; then
2454 echo "CONFIG_ATTR=y" >> $config_host_mak
2456 if test "$linux" = "yes" ; then
2457 if test "$attr" = "yes" ; then
2458 echo "CONFIG_VIRTFS=y" >> $config_host_mak
2461 if test "$blobs" = "yes" ; then
2462 echo "INSTALL_BLOBS=yes" >> $config_host_mak
2464 if test "$iovec" = "yes" ; then
2465 echo "CONFIG_IOVEC=y" >> $config_host_mak
2467 if test "$preadv" = "yes" ; then
2468 echo "CONFIG_PREADV=y" >> $config_host_mak
2470 if test "$fdt" = "yes" ; then
2471 echo "CONFIG_FDT=y" >> $config_host_mak
2473 if test "$signalfd" = "yes" ; then
2474 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
2476 if test "$need_offsetof" = "yes" ; then
2477 echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
2479 if test "$gcc_attribute_warn_unused_result" = "yes" ; then
2480 echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak
2482 if test "$fdatasync" = "yes" ; then
2483 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
2485 if test $cpu_emulation = "yes"; then
2486 echo "CONFIG_CPU_EMULATION=y" >> $config_host_mak
2487 else
2488 echo "CONFIG_NO_CPU_EMULATION=y" >> $config_host_mak
2491 # XXX: suppress that
2492 if [ "$bsd" = "yes" ] ; then
2493 echo "CONFIG_BSD=y" >> $config_host_mak
2496 echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
2498 if test "$zero_malloc" = "yes" ; then
2499 echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
2502 # USB host support
2503 case "$usb" in
2504 linux)
2505 echo "HOST_USB=linux" >> $config_host_mak
2507 bsd)
2508 echo "HOST_USB=bsd" >> $config_host_mak
2511 echo "HOST_USB=stub" >> $config_host_mak
2513 esac
2515 echo "TOOLS=$tools" >> $config_host_mak
2516 echo "ROMS=$roms" >> $config_host_mak
2517 echo "MAKE=$make" >> $config_host_mak
2518 echo "INSTALL=$install" >> $config_host_mak
2519 echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak
2520 echo "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak
2521 echo "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak
2522 echo "CC=$cc" >> $config_host_mak
2523 echo "HOST_CC=$host_cc" >> $config_host_mak
2524 if test "$sparse" = "yes" ; then
2525 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
2526 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
2527 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
2529 echo "AR=$ar" >> $config_host_mak
2530 echo "OBJCOPY=$objcopy" >> $config_host_mak
2531 echo "LD=$ld" >> $config_host_mak
2532 echo "CFLAGS=$CFLAGS" >> $config_host_mak
2533 echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
2534 echo "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
2535 echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
2536 echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
2537 echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
2538 echo "LIBS+=$LIBS" >> $config_host_mak
2539 echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
2540 echo "EXESUF=$EXESUF" >> $config_host_mak
2542 # generate list of library paths for linker script
2544 $ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
2546 if test -f ${config_host_ld}~ ; then
2547 if cmp -s $config_host_ld ${config_host_ld}~ ; then
2548 mv ${config_host_ld}~ $config_host_ld
2549 else
2550 rm ${config_host_ld}~
2554 for d in libdis libdis-user; do
2555 mkdir -p $d
2556 rm -f $d/Makefile
2557 ln -s $source_path/Makefile.dis $d/Makefile
2558 echo > $d/config.mak
2559 done
2560 if test "$static" = "no" -a "$user_pie" = "yes" ; then
2561 echo "QEMU_CFLAGS+=-fpie" > libdis-user/config.mak
2564 for target in $target_list; do
2565 target_dir="$target"
2566 config_target_mak=$target_dir/config-target.mak
2567 target_arch2=`echo $target | cut -d '-' -f 1`
2568 target_bigendian="no"
2570 case "$target_arch2" in
2571 armeb|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus)
2572 target_bigendian=yes
2574 esac
2575 target_softmmu="no"
2576 target_user_only="no"
2577 target_linux_user="no"
2578 target_darwin_user="no"
2579 target_bsd_user="no"
2580 case "$target" in
2581 ${target_arch2}-softmmu)
2582 target_softmmu="yes"
2584 ${target_arch2}-linux-user)
2585 if test "$linux" != "yes" ; then
2586 echo "ERROR: Target '$target' is only available on a Linux host"
2587 exit 1
2589 target_user_only="yes"
2590 target_linux_user="yes"
2592 ${target_arch2}-darwin-user)
2593 if test "$darwin" != "yes" ; then
2594 echo "ERROR: Target '$target' is only available on a Darwin host"
2595 exit 1
2597 target_user_only="yes"
2598 target_darwin_user="yes"
2600 ${target_arch2}-bsd-user)
2601 if test "$bsd" != "yes" ; then
2602 echo "ERROR: Target '$target' is only available on a BSD host"
2603 exit 1
2605 target_user_only="yes"
2606 target_bsd_user="yes"
2609 echo "ERROR: Target '$target' not recognised"
2610 exit 1
2612 esac
2614 mkdir -p $target_dir
2615 mkdir -p $target_dir/fpu
2616 mkdir -p $target_dir/tcg
2617 mkdir -p $target_dir/ide
2618 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
2619 mkdir -p $target_dir/nwfpe
2623 # don't use ln -sf as not all "ln -sf" over write the file/link
2625 rm -f $target_dir/Makefile
2626 ln -s $source_path/Makefile.target $target_dir/Makefile
2629 echo "# Automatically generated by configure - do not modify" > $config_target_mak
2631 bflt="no"
2632 target_nptl="no"
2633 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
2634 echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
2635 gdb_xml_files=""
2637 TARGET_ARCH="$target_arch2"
2638 TARGET_BASE_ARCH=""
2639 TARGET_ABI_DIR=""
2641 case "$target_arch2" in
2642 i386)
2643 target_phys_bits=32
2645 x86_64)
2646 TARGET_BASE_ARCH=i386
2647 target_phys_bits=64
2649 ia64)
2650 target_phys_bits=64
2652 alpha)
2653 target_phys_bits=64
2654 target_nptl="yes"
2656 arm|armeb)
2657 TARGET_ARCH=arm
2658 bflt="yes"
2659 target_nptl="yes"
2660 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
2661 target_phys_bits=32
2663 cris)
2664 target_nptl="yes"
2665 target_phys_bits=32
2667 m68k)
2668 bflt="yes"
2669 gdb_xml_files="cf-core.xml cf-fp.xml"
2670 target_phys_bits=32
2672 microblaze)
2673 bflt="yes"
2674 target_nptl="yes"
2675 target_phys_bits=32
2677 mips|mipsel)
2678 TARGET_ARCH=mips
2679 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
2680 target_nptl="yes"
2681 target_phys_bits=64
2683 mipsn32|mipsn32el)
2684 TARGET_ARCH=mipsn32
2685 TARGET_BASE_ARCH=mips
2686 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
2687 target_phys_bits=64
2689 mips64|mips64el)
2690 TARGET_ARCH=mips64
2691 TARGET_BASE_ARCH=mips
2692 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
2693 target_phys_bits=64
2695 ppc)
2696 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2697 target_phys_bits=32
2698 target_nptl="yes"
2700 ppcemb)
2701 TARGET_BASE_ARCH=ppc
2702 TARGET_ABI_DIR=ppc
2703 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2704 target_phys_bits=64
2705 target_nptl="yes"
2707 ppc64)
2708 TARGET_BASE_ARCH=ppc
2709 TARGET_ABI_DIR=ppc
2710 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2711 target_phys_bits=64
2713 ppc64abi32)
2714 TARGET_ARCH=ppc64
2715 TARGET_BASE_ARCH=ppc
2716 TARGET_ABI_DIR=ppc
2717 echo "TARGET_ABI32=y" >> $config_target_mak
2718 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2719 target_phys_bits=64
2721 sh4|sh4eb)
2722 TARGET_ARCH=sh4
2723 bflt="yes"
2724 target_nptl="yes"
2725 target_phys_bits=32
2727 sparc)
2728 target_phys_bits=64
2730 sparc64)
2731 TARGET_BASE_ARCH=sparc
2732 target_phys_bits=64
2734 sparc32plus)
2735 TARGET_ARCH=sparc64
2736 TARGET_BASE_ARCH=sparc
2737 TARGET_ABI_DIR=sparc
2738 echo "TARGET_ABI32=y" >> $config_target_mak
2739 target_phys_bits=64
2741 s390x)
2742 target_phys_bits=64
2745 echo "Unsupported target CPU"
2746 exit 1
2748 esac
2749 echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
2750 target_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
2751 echo "TARGET_$target_arch_name=y" >> $config_target_mak
2752 echo "TARGET_ARCH2=$target_arch2" >> $config_target_mak
2753 # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
2754 if [ "$TARGET_BASE_ARCH" = "" ]; then
2755 TARGET_BASE_ARCH=$TARGET_ARCH
2757 echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
2758 if [ "$TARGET_ABI_DIR" = "" ]; then
2759 TARGET_ABI_DIR=$TARGET_ARCH
2761 echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
2762 case "$target_arch2" in
2763 i386|x86_64)
2764 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
2765 echo "CONFIG_XEN=y" >> $config_target_mak
2767 esac
2768 case "$target_arch2" in
2769 i386|x86_64|ppcemb|ppc|ppc64|s390x)
2770 # Make sure the target and host cpus are compatible
2771 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
2772 \( "$target_arch2" = "$cpu" -o \
2773 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
2774 \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \
2775 \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \
2776 \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then
2777 echo "CONFIG_KVM=y" >> $config_target_mak
2778 echo "KVM_CFLAGS=$kvm_cflags" >> $config_target_mak
2779 if test "$kvm_para" = "yes"; then
2780 echo "CONFIG_KVM_PARA=y" >> $config_target_mak
2782 if test $kvm_cap_pit = "yes" ; then
2783 echo "CONFIG_KVM_PIT=y" >> $config_target_mak
2785 if test $kvm_cap_device_assignment = "yes" ; then
2786 echo "CONFIG_KVM_DEVICE_ASSIGNMENT=y" >> $config_target_mak
2788 if test $vhost_net = "yes" ; then
2789 echo "CONFIG_VHOST_NET=y" >> $config_target_mak
2792 esac
2793 if test "$target_bigendian" = "yes" ; then
2794 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
2796 if test "$target_softmmu" = "yes" ; then
2797 echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
2798 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
2799 echo "LIBS+=$libs_softmmu" >> $config_target_mak
2800 echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
2801 echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
2803 if test "$target_user_only" = "yes" ; then
2804 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
2806 if test "$target_linux_user" = "yes" ; then
2807 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
2809 if test "$target_darwin_user" = "yes" ; then
2810 echo "CONFIG_DARWIN_USER=y" >> $config_target_mak
2812 list=""
2813 if test ! -z "$gdb_xml_files" ; then
2814 for x in $gdb_xml_files; do
2815 list="$list $source_path/gdb-xml/$x"
2816 done
2817 echo "TARGET_XML_FILES=$list" >> $config_target_mak
2820 case "$target_arch2" in
2821 alpha|arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|s390x|sparc|sparc64|sparc32plus)
2822 echo "CONFIG_SOFTFLOAT=y" >> $config_target_mak
2825 echo "CONFIG_NOSOFTFLOAT=y" >> $config_target_mak
2827 esac
2829 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
2830 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
2832 if test "$target_user_only" = "yes" \
2833 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
2834 echo "CONFIG_USE_NPTL=y" >> $config_target_mak
2836 if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
2837 echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
2839 if test "$target_bsd_user" = "yes" ; then
2840 echo "CONFIG_BSD_USER=y" >> $config_target_mak
2843 # generate QEMU_CFLAGS/LDFLAGS for targets
2845 cflags=""
2846 ldflags=""
2848 if test "$ARCH" = "sparc64" ; then
2849 cflags="-I\$(SRC_PATH)/tcg/sparc $cflags"
2850 elif test "$ARCH" = "s390x" ; then
2851 cflags="-I\$(SRC_PATH)/tcg/s390 $cflags"
2852 elif test "$ARCH" = "x86_64" ; then
2853 cflags="-I\$(SRC_PATH)/tcg/i386 $cflags"
2854 else
2855 cflags="-I\$(SRC_PATH)/tcg/\$(ARCH) $cflags"
2857 cflags="-I\$(SRC_PATH)/tcg $cflags"
2858 cflags="-I\$(SRC_PATH)/fpu $cflags"
2860 if test "$target_user_only" = "yes" ; then
2861 libdis_config_mak=libdis-user/config.mak
2862 else
2863 libdis_config_mak=libdis/config.mak
2866 for i in $ARCH $TARGET_BASE_ARCH ; do
2867 case "$i" in
2868 alpha)
2869 echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
2870 echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak
2872 arm)
2873 echo "CONFIG_ARM_DIS=y" >> $config_target_mak
2874 echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak
2876 cris)
2877 echo "CONFIG_CRIS_DIS=y" >> $config_target_mak
2878 echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak
2880 hppa)
2881 echo "CONFIG_HPPA_DIS=y" >> $config_target_mak
2882 echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak
2884 i386|x86_64)
2885 echo "CONFIG_I386_DIS=y" >> $config_target_mak
2886 echo "CONFIG_I386_DIS=y" >> $libdis_config_mak
2888 ia64*)
2889 echo "CONFIG_IA64_DIS=y" >> $config_target_mak
2890 echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak
2892 m68k)
2893 echo "CONFIG_M68K_DIS=y" >> $config_target_mak
2894 echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak
2896 microblaze)
2897 echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak
2898 echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak
2900 mips*)
2901 echo "CONFIG_MIPS_DIS=y" >> $config_target_mak
2902 echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak
2904 ppc*)
2905 echo "CONFIG_PPC_DIS=y" >> $config_target_mak
2906 echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak
2908 s390*)
2909 echo "CONFIG_S390_DIS=y" >> $config_target_mak
2910 echo "CONFIG_S390_DIS=y" >> $libdis_config_mak
2912 sh4)
2913 echo "CONFIG_SH4_DIS=y" >> $config_target_mak
2914 echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak
2916 sparc*)
2917 echo "CONFIG_SPARC_DIS=y" >> $config_target_mak
2918 echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak
2920 esac
2921 done
2923 case "$ARCH" in
2924 alpha)
2925 # Ensure there's only a single GP
2926 cflags="-msmall-data $cflags"
2928 esac
2930 if test "$target_softmmu" = "yes" ; then
2931 case "$TARGET_BASE_ARCH" in
2932 arm)
2933 cflags="-DHAS_AUDIO $cflags"
2935 i386|mips|ppc)
2936 cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
2938 esac
2941 if test "$target_user_only" = "yes" -a "$static" = "no" -a \
2942 "$user_pie" = "yes" ; then
2943 cflags="-fpie $cflags"
2944 ldflags="-pie $ldflags"
2947 if test "$target_softmmu" = "yes" -a \( \
2948 "$TARGET_ARCH" = "microblaze" -o \
2949 "$TARGET_ARCH" = "cris" \) ; then
2950 echo "CONFIG_NEED_MMU=y" >> $config_target_mak
2953 if test "$gprof" = "yes" ; then
2954 echo "TARGET_GPROF=yes" >> $config_target_mak
2955 if test "$target_linux_user" = "yes" ; then
2956 cflags="-p $cflags"
2957 ldflags="-p $ldflags"
2959 if test "$target_softmmu" = "yes" ; then
2960 ldflags="-p $ldflags"
2961 echo "GPROF_CFLAGS=-p" >> $config_target_mak
2965 linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
2966 if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
2967 case "$ARCH" in
2968 sparc)
2969 # -static is used to avoid g1/g3 usage by the dynamic linker
2970 ldflags="$linker_script -static $ldflags"
2972 alpha | s390x)
2973 # The default placement of the application is fine.
2976 ldflags="$linker_script $ldflags"
2978 esac
2981 echo "LDFLAGS+=$ldflags" >> $config_target_mak
2982 echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
2984 done # for target in $targets
2986 # build tree in object directory if source path is different from current one
2987 if test "$source_path_used" = "yes" ; then
2988 DIRS="tests tests/cris slirp audio block net pc-bios/optionrom"
2989 DIRS="$DIRS roms/seabios roms/vgabios"
2990 DIRS="$DIRS fsdev"
2991 FILES="Makefile tests/Makefile"
2992 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
2993 FILES="$FILES tests/test-mmap.c"
2994 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps pc-bios/video.x"
2995 FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
2996 for bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do
2997 FILES="$FILES pc-bios/`basename $bios_file`"
2998 done
2999 for dir in $DIRS ; do
3000 mkdir -p $dir
3001 done
3002 # remove the link and recreate it, as not all "ln -sf" overwrite the link
3003 for f in $FILES ; do
3004 rm -f $f
3005 ln -s $source_path/$f $f
3006 done
3009 # temporary config to build submodules
3010 for rom in seabios vgabios; do
3011 config_mak=roms/$rom/config.mak
3012 echo "# Automatically generated by configure - do not modify" > $config_mak
3013 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
3014 echo "CC=$cc" >> $config_mak
3015 echo "BCC=bcc" >> $config_mak
3016 echo "CPP=${cross_prefix}cpp" >> $config_mak
3017 echo "OBJCOPY=objcopy" >> $config_mak
3018 echo "IASL=iasl" >> $config_mak
3019 echo "HOST_CC=$host_cc" >> $config_mak
3020 echo "LD=$ld" >> $config_mak
3021 done
3023 for hwlib in 32 64; do
3024 d=libhw$hwlib
3025 mkdir -p $d
3026 mkdir -p $d/ide
3027 rm -f $d/Makefile
3028 ln -s $source_path/Makefile.hw $d/Makefile
3029 echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
3030 done
3032 d=libuser
3033 mkdir -p $d
3034 rm -f $d/Makefile
3035 ln -s $source_path/Makefile.user $d/Makefile
3036 if test "$static" = "no" -a "$user_pie" = "yes" ; then
3037 echo "QEMU_CFLAGS+=-fpie" > $d/config.mak
3040 if test "$docs" = "yes" ; then
3041 mkdir -p QMP