KVM: Request setting of nmi_pending and sipi_vector
[qemu-kvm/amd-iommu.git] / configure
blob6a57814526ef101d335ca0823a179777fef0c90d
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" 0 2 3 15
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 # default parameters
31 cpu=""
32 prefix=""
33 interp_prefix="/usr/gnemul/qemu-%M"
34 static="no"
35 sparc_cpu=""
36 cross_prefix=""
37 cc="gcc"
38 audio_drv_list=""
39 audio_card_list="ac97 es1370 sb16"
40 audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus"
41 block_drv_whitelist=""
42 host_cc="gcc"
43 ar="ar"
44 make="make"
45 install="install"
46 objcopy="objcopy"
47 ld="ld"
48 helper_cflags=""
49 libs_softmmu=""
50 libs_tools=""
51 audio_pt_int=""
52 audio_win_int=""
54 # parse CC options first
55 for opt do
56 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
57 case "$opt" in
58 --cross-prefix=*) cross_prefix="$optarg"
60 --cc=*) cc="$optarg"
62 --cpu=*) cpu="$optarg"
64 --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
66 --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
68 --sparc_cpu=*)
69 sparc_cpu="$optarg"
70 case $sparc_cpu in
71 v7|v8|v8plus|v8plusa)
72 cpu="sparc"
74 v9)
75 cpu="sparc64"
78 echo "undefined SPARC architecture. Exiting";
79 exit 1
81 esac
83 esac
84 done
85 # OS specific
86 # Using uname is really, really broken. Once we have the right set of checks
87 # we can eliminate it's usage altogether
89 cc="${cross_prefix}${cc}"
90 ar="${cross_prefix}${ar}"
91 objcopy="${cross_prefix}${objcopy}"
92 ld="${cross_prefix}${ld}"
94 # default flags for all hosts
95 QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
96 CFLAGS="-g $CFLAGS"
97 QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
98 QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
99 QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
100 QEMU_CFLAGS="-U_FORTIFY_SOURCE $QEMU_CFLAGS"
101 QEMU_CFLAGS="-I. -I\$(SRC_PATH) $QEMU_CFLAGS"
102 LDFLAGS="-g $LDFLAGS"
104 gcc_flags="-Wold-style-declaration -Wold-style-definition"
105 cat > $TMPC << EOF
106 int main(void) { }
108 for flag in $gcc_flags; do
109 if compile_prog "$QEMU_CFLAGS" "$flag" ; then
110 QEMU_CFLAGS="$flag $QEMU_CFLAGS"
112 done
114 # check that the C compiler works.
115 cat > $TMPC <<EOF
116 int main(void) {}
119 if compile_object ; then
120 : C compiler works ok
121 else
122 echo "ERROR: \"$cc\" either does not exist or does not work"
123 exit 1
126 check_define() {
127 cat > $TMPC <<EOF
128 #if !defined($1)
129 #error Not defined
130 #endif
131 int main(void) { return 0; }
133 compile_object
136 if test ! -z "$cpu" ; then
137 # command line argument
139 elif check_define __i386__ ; then
140 cpu="i386"
141 elif check_define __x86_64__ ; then
142 cpu="x86_64"
143 elif check_define __sparc__ ; then
144 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
145 # They must be specified using --sparc_cpu
146 if check_define __arch64__ ; then
147 cpu="sparc64"
148 else
149 cpu="sparc"
151 elif check_define _ARCH_PPC ; then
152 if check_define _ARCH_PPC64 ; then
153 cpu="ppc64"
154 else
155 cpu="ppc"
157 elif check_define __mips__ ; then
158 cpu="mips"
159 else
160 cpu=`uname -m`
163 target_list="x86_64-softmmu"
164 case "$cpu" in
165 alpha|cris|ia64|m68k|microblaze|ppc|ppc64|sparc64)
166 cpu="$cpu"
168 i386|i486|i586|i686|i86pc|BePC)
169 cpu="i386"
171 x86_64|amd64)
172 cpu="x86_64"
174 armv*b)
175 cpu="armv4b"
177 armv*l)
178 cpu="armv4l"
180 parisc|parisc64)
181 cpu="hppa"
183 mips*)
184 cpu="mips"
186 s390)
187 cpu="s390"
189 s390x)
190 cpu="s390x"
192 sparc|sun4[cdmuv])
193 cpu="sparc"
196 cpu="unknown"
198 esac
200 kvm_version() {
201 local fname="$(dirname "$0")/KVM_VERSION"
203 if test -f "$fname"; then
204 cat "$fname"
205 else
206 echo "qemu-kvm-devel"
210 # Default value for a variable defining feature "foo".
211 # * foo="no" feature will only be used if --enable-foo arg is given
212 # * foo="" feature will be searched for, and if found, will be used
213 # unless --disable-foo is given
214 # * foo="yes" this value will only be set by --enable-foo flag.
215 # feature will searched for,
216 # if not found, configure exits with error
218 # Always add --enable-foo and --disable-foo command line args.
219 # Distributions want to ensure that several features are compiled in, and it
220 # is impossible without a --enable-foo that exits if a feature is not found.
222 bluez=""
223 brlapi=""
224 curl=""
225 curses=""
226 docs=""
227 fdt=""
228 kvm=""
229 kvm_para=""
230 nptl=""
231 sdl=""
232 sparse="no"
233 uuid=""
234 vde=""
235 vnc_tls=""
236 vnc_sasl=""
237 xen=""
238 linux_aio=""
240 gprof="no"
241 debug_tcg="no"
242 debug="no"
243 strip_opt="yes"
244 bigendian="no"
245 mingw32="no"
246 EXESUF=""
247 slirp="yes"
248 fmod_lib=""
249 fmod_inc=""
250 oss_lib=""
251 bsd="no"
252 linux="no"
253 solaris="no"
254 profiler="no"
255 cocoa="no"
256 softmmu="yes"
257 linux_user="no"
258 darwin_user="no"
259 bsd_user="no"
260 guest_base=""
261 uname_release=""
262 io_thread="no"
263 mixemu="no"
264 kvm_trace="no"
265 kvm_cap_pit=""
266 kvm_cap_device_assignment=""
267 kerneldir=""
268 aix="no"
269 blobs="yes"
270 pkgversion=" ($(kvm_version))"
271 cpu_emulation="yes"
272 kvm_kmod="no"
273 check_utests="no"
274 user_pie="no"
275 zero_malloc=""
277 # OS specific
278 if check_define __linux__ ; then
279 targetos="Linux"
280 elif check_define _WIN32 ; then
281 targetos='MINGW32'
282 elif check_define __OpenBSD__ ; then
283 targetos='OpenBSD'
284 elif check_define __sun__ ; then
285 targetos='SunOS'
286 else
287 targetos=`uname -s`
290 case $targetos in
291 CYGWIN*)
292 mingw32="yes"
293 QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
294 audio_possible_drivers="winwave sdl"
295 audio_drv_list="winwave"
297 MINGW32*)
298 mingw32="yes"
299 audio_possible_drivers="winwave dsound sdl fmod"
300 audio_drv_list="winwave"
302 GNU/kFreeBSD)
303 bsd="yes"
304 audio_drv_list="oss"
305 audio_possible_drivers="oss sdl esd pa"
307 FreeBSD)
308 bsd="yes"
309 make="gmake"
310 audio_drv_list="oss"
311 audio_possible_drivers="oss sdl esd pa"
313 DragonFly)
314 bsd="yes"
315 make="gmake"
316 audio_drv_list="oss"
317 audio_possible_drivers="oss sdl esd pa"
319 NetBSD)
320 bsd="yes"
321 make="gmake"
322 audio_drv_list="oss"
323 audio_possible_drivers="oss sdl esd"
324 oss_lib="-lossaudio"
326 OpenBSD)
327 bsd="yes"
328 make="gmake"
329 audio_drv_list="oss"
330 audio_possible_drivers="oss sdl esd"
331 oss_lib="-lossaudio"
333 Darwin)
334 bsd="yes"
335 darwin="yes"
336 # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can
337 # run 64-bit userspace code
338 if [ "$cpu" = "i386" ] ; then
339 is_x86_64=`sysctl -n hw.optional.x86_64`
340 [ "$is_x86_64" = "1" ] && cpu=x86_64
342 if [ "$cpu" = "x86_64" ] ; then
343 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
344 LDFLAGS="-arch x86_64 $LDFLAGS"
345 else
346 QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
348 darwin_user="yes"
349 cocoa="yes"
350 audio_drv_list="coreaudio"
351 audio_possible_drivers="coreaudio sdl fmod"
352 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
353 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
355 SunOS)
356 solaris="yes"
357 make="gmake"
358 install="ginstall"
359 ld="gld"
360 needs_libsunmath="no"
361 solarisrev=`uname -r | cut -f2 -d.`
362 # have to select again, because `uname -m` returns i86pc
363 # even on an x86_64 box.
364 solariscpu=`isainfo -k`
365 if test "${solariscpu}" = "amd64" ; then
366 cpu="x86_64"
368 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
369 if test "$solarisrev" -le 9 ; then
370 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
371 needs_libsunmath="yes"
372 QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
373 LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
374 LIBS="-lsunmath $LIBS"
375 else
376 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
377 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
378 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
379 echo "Studio 11 can be downloaded from www.sun.com."
380 exit 1
384 if test -f /usr/include/sys/soundcard.h ; then
385 audio_drv_list="oss"
387 audio_possible_drivers="oss sdl"
388 # needed for CMSG_ macros in sys/socket.h
389 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
390 # needed for TIOCWIN* defines in termios.h
391 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
392 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
393 LIBS="-lsocket -lnsl -lresolv $LIBS"
395 AIX)
396 aix="yes"
397 make="gmake"
400 audio_drv_list="oss"
401 audio_possible_drivers="oss alsa sdl esd pa"
402 linux="yes"
403 linux_user="yes"
404 usb="linux"
405 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
406 audio_possible_drivers="$audio_possible_drivers fmod"
408 if [ "$cpu" = "ia64" ] ; then
409 xen="no"
410 target_list="ia64-softmmu"
411 cpu_emulation="no"
412 gdbstub="no"
413 slirp="no"
416 esac
418 if [ "$bsd" = "yes" ] ; then
419 if [ "$darwin" != "yes" ] ; then
420 usb="bsd"
422 bsd_user="yes"
425 if test "$mingw32" = "yes" ; then
426 EXESUF=".exe"
427 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
428 LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
431 # find source path
432 source_path=`dirname "$0"`
433 source_path_used="no"
434 workdir=`pwd`
435 if [ -z "$source_path" ]; then
436 source_path=$workdir
437 else
438 source_path=`cd "$source_path"; pwd`
440 [ -f "$workdir/vl.c" ] || source_path_used="yes"
442 werror=""
444 for opt do
445 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
446 case "$opt" in
447 --help|-h) show_help=yes
449 --prefix=*) prefix="$optarg"
451 --interp-prefix=*) interp_prefix="$optarg"
453 --source-path=*) source_path="$optarg"
454 source_path_used="yes"
456 --cross-prefix=*)
458 --cc=*)
460 --host-cc=*) host_cc="$optarg"
462 --make=*) make="$optarg"
464 --install=*) install="$optarg"
466 --extra-cflags=*)
468 --extra-ldflags=*)
470 --cpu=*)
472 --target-list=*) target_list="$optarg"
474 --enable-gprof) gprof="yes"
476 --static) static="yes"
478 --disable-sdl) sdl="no"
480 --enable-sdl) sdl="yes"
482 --fmod-lib=*) fmod_lib="$optarg"
484 --fmod-inc=*) fmod_inc="$optarg"
486 --oss-lib=*) oss_lib="$optarg"
488 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
490 --audio-drv-list=*) audio_drv_list="$optarg"
492 --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
494 --enable-debug-tcg) debug_tcg="yes"
496 --disable-debug-tcg) debug_tcg="no"
498 --enable-debug)
499 # Enable debugging options that aren't excessively noisy
500 debug_tcg="yes"
501 debug="yes"
502 strip_opt="no"
504 --enable-sparse) sparse="yes"
506 --disable-sparse) sparse="no"
508 --disable-strip) strip_opt="no"
510 --disable-vnc-tls) vnc_tls="no"
512 --enable-vnc-tls) vnc_tls="yes"
514 --disable-vnc-sasl) vnc_sasl="no"
516 --enable-vnc-sasl) vnc_sasl="yes"
518 --disable-slirp) slirp="no"
520 --disable-uuid) uuid="no"
522 --enable-uuid) uuid="yes"
524 --disable-vde) vde="no"
526 --enable-vde) vde="yes"
528 --disable-xen) xen="no"
530 --enable-xen) xen="yes"
532 --disable-brlapi) brlapi="no"
534 --enable-brlapi) brlapi="yes"
536 --disable-bluez) bluez="no"
538 --enable-bluez) bluez="yes"
540 --disable-kvm) kvm="no"
542 --enable-kvm) kvm="yes"
544 --disable-kvm-pit) kvm_cap_pit="no"
546 --enable-kvm-pit) kvm_cap_pit="yes"
548 --disable-kvm-device-assignment) kvm_cap_device_assignment="no"
550 --enable-kvm-device-assignment) kvm_cap_device_assignment="yes"
552 --enable-profiler) profiler="yes"
554 --enable-cocoa)
555 cocoa="yes" ;
556 sdl="no" ;
557 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
559 --disable-system) softmmu="no"
561 --enable-system) softmmu="yes"
563 --disable-user)
564 linux_user="no" ;
565 bsd_user="no" ;
566 darwin_user="no"
568 --enable-user) ;;
569 --disable-linux-user) linux_user="no"
571 --enable-linux-user) linux_user="yes"
573 --disable-darwin-user) darwin_user="no"
575 --enable-darwin-user) darwin_user="yes"
577 --disable-bsd-user) bsd_user="no"
579 --enable-bsd-user) bsd_user="yes"
581 --enable-guest-base) guest_base="yes"
583 --disable-guest-base) guest_base="no"
585 --enable-user-pie) user_pie="yes"
587 --disable-user-pie) user_pie="no"
589 --enable-uname-release=*) uname_release="$optarg"
591 --sparc_cpu=*)
593 --enable-werror) werror="yes"
595 --disable-werror) werror="no"
597 --disable-curses) curses="no"
599 --enable-curses) curses="yes"
601 --disable-curl) curl="no"
603 --enable-curl) curl="yes"
605 --disable-fdt) fdt="no"
607 --enable-fdt) fdt="yes"
609 --disable-check-utests) check_utests="no"
611 --enable-check-utests) check_utests="yes"
613 --disable-nptl) nptl="no"
615 --enable-nptl) nptl="yes"
617 --enable-mixemu) mixemu="yes"
619 --disable-linux-aio) linux_aio="no"
621 --enable-linux-aio) linux_aio="yes"
623 --enable-io-thread) io_thread="yes"
625 --disable-blobs) blobs="no"
627 --kerneldir=*) kerneldir="$optarg"
629 --with-kvm-trace) kvm_trace="yes"
631 --with-pkgversion=*) pkgversion=" ($optarg)"
633 --disable-docs) docs="no"
635 --enable-docs) docs="yes"
637 --disable-cpu-emulation) cpu_emulation="no"
639 *) echo "ERROR: unknown option $opt"; show_help="yes"
641 esac
642 done
645 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
646 # QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
648 host_guest_base="no"
649 case "$cpu" in
650 sparc) case $sparc_cpu in
651 v7|v8)
652 QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
654 v8plus|v8plusa)
655 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
657 *) # sparc_cpu not defined in the command line
658 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
659 esac
660 LDFLAGS="-m32 $LDFLAGS"
661 QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
662 if test "$solaris" = "no" ; then
663 QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
664 helper_cflags="-ffixed-i0"
667 sparc64)
668 QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
669 LDFLAGS="-m64 $LDFLAGS"
670 QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
671 if test "$solaris" != "no" ; then
672 QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
675 s390)
676 QEMU_CFLAGS="-march=z900 $QEMU_CFLAGS"
678 i386)
679 QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
680 LDFLAGS="-m32 $LDFLAGS"
681 helper_cflags="-fomit-frame-pointer"
682 host_guest_base="yes"
684 x86_64)
685 QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
686 LDFLAGS="-m64 $LDFLAGS"
687 host_guest_base="yes"
689 arm*)
690 host_guest_base="yes"
692 ppc*)
693 host_guest_base="yes"
695 esac
697 [ -z "$guest_base" ] && guest_base="$host_guest_base"
699 if test x"$show_help" = x"yes" ; then
700 cat << EOF
702 Usage: configure [options]
703 Options: [defaults in brackets after descriptions]
706 echo "Standard options:"
707 echo " --help print this message"
708 echo " --prefix=PREFIX install in PREFIX [$prefix]"
709 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
710 echo " use %M for cpu name [$interp_prefix]"
711 echo " --target-list=LIST set target list [$target_list]"
712 echo ""
713 echo "Advanced options (experts only):"
714 echo " --source-path=PATH path of source code [$source_path]"
715 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
716 echo " --cc=CC use C compiler CC [$cc]"
717 echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
718 echo " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS"
719 echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS"
720 echo " --make=MAKE use specified make [$make]"
721 echo " --install=INSTALL use specified install [$install]"
722 echo " --static enable static build [$static]"
723 echo " --enable-debug-tcg enable TCG debugging"
724 echo " --disable-debug-tcg disable TCG debugging (default)"
725 echo " --enable-debug enable common debug build options"
726 echo " --enable-sparse enable sparse checker"
727 echo " --disable-sparse disable sparse checker (default)"
728 echo " --disable-strip disable stripping binaries"
729 echo " --disable-werror disable compilation abort on warning"
730 echo " --disable-sdl disable SDL"
731 echo " --enable-sdl enable SDL"
732 echo " --enable-cocoa enable COCOA (Mac OS X only)"
733 echo " --audio-drv-list=LIST set audio drivers list:"
734 echo " Available drivers: $audio_possible_drivers"
735 echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
736 echo " Available cards: $audio_possible_cards"
737 echo " --block-drv-whitelist=L set block driver whitelist"
738 echo " (affects only QEMU, not qemu-img)"
739 echo " --enable-mixemu enable mixer emulation"
740 echo " --disable-xen disable xen backend driver support"
741 echo " --enable-xen enable xen backend driver support"
742 echo " --disable-brlapi disable BrlAPI"
743 echo " --enable-brlapi enable BrlAPI"
744 echo " --disable-vnc-tls disable TLS encryption for VNC server"
745 echo " --enable-vnc-tls enable TLS encryption for VNC server"
746 echo " --disable-vnc-sasl disable SASL encryption for VNC server"
747 echo " --enable-vnc-sasl enable SASL encryption for VNC server"
748 echo " --disable-curses disable curses output"
749 echo " --enable-curses enable curses output"
750 echo " --disable-curl disable curl connectivity"
751 echo " --enable-curl enable curl connectivity"
752 echo " --disable-fdt disable fdt device tree"
753 echo " --enable-fdt enable fdt device tree"
754 echo " --disable-check-utests disable check unit-tests"
755 echo " --enable-check-utests enable check unit-tests"
756 echo " --disable-bluez disable bluez stack connectivity"
757 echo " --enable-bluez enable bluez stack connectivity"
758 echo " --disable-kvm disable KVM acceleration support"
759 echo " --enable-kvm enable KVM acceleration support"
760 echo " --disable-kvm-pit disable KVM pit support"
761 echo " --enable-kvm-pit enable KVM pit support"
762 echo " --disable-kvm-device-assignment disable KVM device assignment support"
763 echo " --enable-kvm-device-assignment enable KVM device assignment support"
764 echo " --disable-nptl disable usermode NPTL support"
765 echo " --enable-nptl enable usermode NPTL support"
766 echo " --enable-system enable all system emulation targets"
767 echo " --disable-system disable all system emulation targets"
768 echo " --enable-user enable supported user emulation targets"
769 echo " --disable-user disable all user emulation targets"
770 echo " --enable-linux-user enable all linux usermode emulation targets"
771 echo " --disable-linux-user disable all linux usermode emulation targets"
772 echo " --enable-darwin-user enable all darwin usermode emulation targets"
773 echo " --disable-darwin-user disable all darwin usermode emulation targets"
774 echo " --enable-bsd-user enable all BSD usermode emulation targets"
775 echo " --disable-bsd-user disable all BSD usermode emulation targets"
776 echo " --enable-guest-base enable GUEST_BASE support for usermode"
777 echo " emulation targets"
778 echo " --disable-guest-base disable GUEST_BASE support"
779 echo " --enable-user-pie build usermode emulation targets as PIE"
780 echo " --disable-user-pie do not build usermode emulation targets as PIE"
781 echo " --fmod-lib path to FMOD library"
782 echo " --fmod-inc path to FMOD includes"
783 echo " --oss-lib path to OSS library"
784 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
785 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
786 echo " --disable-uuid disable uuid support"
787 echo " --enable-uuid enable uuid support"
788 echo " --disable-vde disable support for vde network"
789 echo " --enable-vde enable support for vde network"
790 echo " --disable-linux-aio disable Linux AIO support"
791 echo " --enable-linux-aio enable Linux AIO support"
792 echo " --enable-io-thread enable IO thread"
793 echo " --disable-blobs disable installing provided firmware blobs"
794 echo " --kerneldir=PATH look for kernel includes in PATH"
795 echo " --with-kvm-trace enable building the KVM module with the kvm trace option"
796 echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
797 echo ""
798 echo "NOTE: The object files are built at the place where configure is launched"
799 exit 1
803 # Solaris specific configure tool chain decisions
805 if test "$solaris" = "yes" ; then
806 solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
807 if test -z "$solinst" ; then
808 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
809 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
810 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
811 exit 1
813 if test "$solinst" = "/usr/sbin/install" ; then
814 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
815 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
816 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
817 exit 1
819 sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
820 if test -z "$sol_ar" ; then
821 echo "Error: No path includes ar"
822 if test -f /usr/ccs/bin/ar ; then
823 echo "Add /usr/ccs/bin to your path and rerun configure"
825 exit 1
830 if test -z "$target_list" ; then
831 # these targets are portable
832 if [ "$softmmu" = "yes" ] ; then
833 target_list="\
834 i386-softmmu \
835 x86_64-softmmu \
836 arm-softmmu \
837 cris-softmmu \
838 m68k-softmmu \
839 microblaze-softmmu \
840 mips-softmmu \
841 mipsel-softmmu \
842 mips64-softmmu \
843 mips64el-softmmu \
844 ppc-softmmu \
845 ppcemb-softmmu \
846 ppc64-softmmu \
847 sh4-softmmu \
848 sh4eb-softmmu \
849 sparc-softmmu \
850 sparc64-softmmu \
853 # the following are Linux specific
854 if [ "$linux_user" = "yes" ] ; then
855 target_list="${target_list}\
856 i386-linux-user \
857 x86_64-linux-user \
858 alpha-linux-user \
859 arm-linux-user \
860 armeb-linux-user \
861 cris-linux-user \
862 m68k-linux-user \
863 microblaze-linux-user \
864 mips-linux-user \
865 mipsel-linux-user \
866 ppc-linux-user \
867 ppc64-linux-user \
868 ppc64abi32-linux-user \
869 sh4-linux-user \
870 sh4eb-linux-user \
871 sparc-linux-user \
872 sparc64-linux-user \
873 sparc32plus-linux-user \
876 # the following are Darwin specific
877 if [ "$darwin_user" = "yes" ] ; then
878 target_list="$target_list i386-darwin-user ppc-darwin-user "
880 # the following are BSD specific
881 if [ "$bsd_user" = "yes" ] ; then
882 target_list="${target_list}\
883 i386-bsd-user \
884 x86_64-bsd-user \
885 sparc-bsd-user \
886 sparc64-bsd-user \
889 else
890 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
892 if test -z "$target_list" ; then
893 echo "No targets enabled"
894 exit 1
897 feature_not_found() {
898 feature=$1
900 echo "ERROR"
901 echo "ERROR: User requested feature $feature"
902 echo "ERROR: configure was not able to find it"
903 echo "ERROR"
904 exit 1;
907 if test -z "$cross_prefix" ; then
909 # ---
910 # big/little endian test
911 cat > $TMPC << EOF
912 #include <inttypes.h>
913 int main(int argc, char ** argv){
914 volatile uint32_t i=0x01234567;
915 return (*((uint8_t*)(&i))) == 0x67;
919 if compile_prog "" "" ; then
920 $TMPE && bigendian="yes"
921 else
922 echo big/little test failed
925 else
927 # if cross compiling, cannot launch a program, so make a static guess
928 case "$cpu" in
929 armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
930 bigendian=yes
932 esac
936 # host long bits test
937 hostlongbits="32"
938 case "$cpu" in
939 x86_64|alpha|ia64|sparc64|ppc64|s390x)
940 hostlongbits=64
942 esac
945 ##########################################
946 # NPTL probe
948 if test "$nptl" != "no" ; then
949 cat > $TMPC <<EOF
950 #include <sched.h>
951 #include <linux/futex.h>
952 void foo()
954 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
955 #error bork
956 #endif
960 if compile_object ; then
961 nptl=yes
962 else
963 if test "$nptl" = "yes" ; then
964 feature_not_found "nptl"
966 nptl=no
970 ##########################################
971 # zlib check
973 cat > $TMPC << EOF
974 #include <zlib.h>
975 int main(void) { zlibVersion(); return 0; }
977 if compile_prog "" "-lz" ; then
979 else
980 echo
981 echo "Error: zlib check failed"
982 echo "Make sure to have the zlib libs and headers installed."
983 echo
984 exit 1
987 ##########################################
988 # xen probe
990 if test "$xen" != "no" ; then
991 xen_libs="-lxenstore -lxenctrl -lxenguest"
992 cat > $TMPC <<EOF
993 #include <xenctrl.h>
994 #include <xs.h>
995 int main(void) { xs_daemon_open(); xc_interface_open(); return 0; }
997 if compile_prog "" "$xen_libs" ; then
998 xen=yes
999 libs_softmmu="$xen_libs $libs_softmmu"
1000 else
1001 if test "$xen" = "yes" ; then
1002 feature_not_found "xen"
1004 xen=no
1008 ##########################################
1009 # pkgconfig probe
1011 pkgconfig="${cross_prefix}pkg-config"
1012 if ! test -x "$(which $pkgconfig 2>/dev/null)"; then
1013 # likely not cross compiling, or hope for the best
1014 pkgconfig=pkg-config
1017 ##########################################
1018 # Sparse probe
1019 if test "$sparse" != "no" ; then
1020 if test -x "$(which cgcc 2>/dev/null)"; then
1021 sparse=yes
1022 else
1023 if test "$sparse" = "yes" ; then
1024 feature_not_found "sparse"
1026 sparse=no
1030 ##########################################
1031 # SDL probe
1033 if $pkgconfig sdl --modversion >/dev/null 2>&1; then
1034 sdlconfig="$pkgconfig sdl"
1035 _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
1036 else
1037 sdlconfig='sdl-config'
1038 _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1041 sdl_too_old=no
1042 if test "$sdl" != "no" ; then
1043 cat > $TMPC << EOF
1044 #include <SDL.h>
1045 #undef main /* We don't want SDL to override our main() */
1046 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1048 sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
1049 sdl_libs=`$sdlconfig --libs 2> /dev/null`
1050 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1051 if test "$_sdlversion" -lt 121 ; then
1052 sdl_too_old=yes
1053 else
1054 if test "$cocoa" = "no" ; then
1055 sdl=yes
1059 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
1060 if test "$sdl" = "yes" -a "$static" = "yes" ; then
1061 sdl_libs=`sdl-config --static-libs 2>/dev/null`
1062 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
1063 sdl_libs="$sdl_libs `aalib-config --static-libs >2 /dev/null`"
1064 sdl_cflags="$sdl_cflags `aalib-config --cflags >2 /dev/null`"
1066 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1068 else
1069 sdl=no
1071 fi # static link
1072 else # sdl not found
1073 if test "$sdl" = "yes" ; then
1074 feature_not_found "sdl"
1076 sdl=no
1077 fi # sdl compile test
1080 if test "$sdl" = "yes" ; then
1081 cat > $TMPC <<EOF
1082 #include <SDL.h>
1083 #if defined(SDL_VIDEO_DRIVER_X11)
1084 #include <X11/XKBlib.h>
1085 #else
1086 #error No x11 support
1087 #endif
1088 int main(void) { return 0; }
1090 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1091 sdl_libs="$sdl_libs -lX11"
1093 if test "$mingw32" = "yes" ; then
1094 sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole"
1096 libs_softmmu="$sdl_libs $libs_softmmu"
1099 ##########################################
1100 # VNC TLS detection
1101 if test "$vnc_tls" != "no" ; then
1102 cat > $TMPC <<EOF
1103 #include <gnutls/gnutls.h>
1104 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1106 vnc_tls_cflags=`$pkgconfig --cflags gnutls 2> /dev/null`
1107 vnc_tls_libs=`$pkgconfig --libs gnutls 2> /dev/null`
1108 if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
1109 vnc_tls=yes
1110 libs_softmmu="$vnc_tls_libs $libs_softmmu"
1111 else
1112 if test "$vnc_tls" = "yes" ; then
1113 feature_not_found "vnc-tls"
1115 vnc_tls=no
1119 ##########################################
1120 # VNC SASL detection
1121 if test "$vnc_sasl" != "no" ; then
1122 cat > $TMPC <<EOF
1123 #include <sasl/sasl.h>
1124 #include <stdio.h>
1125 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
1127 # Assuming Cyrus-SASL installed in /usr prefix
1128 vnc_sasl_cflags=""
1129 vnc_sasl_libs="-lsasl2"
1130 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1131 vnc_sasl=yes
1132 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
1133 else
1134 if test "$vnc_sasl" = "yes" ; then
1135 feature_not_found "vnc-sasl"
1137 vnc_sasl=no
1141 ##########################################
1142 # fnmatch() probe, used for ACL routines
1143 fnmatch="no"
1144 cat > $TMPC << EOF
1145 #include <fnmatch.h>
1146 int main(void)
1148 fnmatch("foo", "foo", 0);
1149 return 0;
1152 if compile_prog "" "" ; then
1153 fnmatch="yes"
1156 ##########################################
1157 # uuid_generate() probe, used for vdi block driver
1158 if test "$uuid" != "no" ; then
1159 uuid_libs="-luuid"
1160 cat > $TMPC << EOF
1161 #include <uuid/uuid.h>
1162 int main(void)
1164 uuid_t my_uuid;
1165 uuid_generate(my_uuid);
1166 return 0;
1169 if compile_prog "" "$uuid_libs" ; then
1170 uuid="yes"
1171 libs_softmmu="$uuid_libs $libs_softmmu"
1172 libs_tools="$uuid_libs $libs_tools"
1173 else
1174 if test "$uuid" = "yes" ; then
1175 feature_not_found "uuid"
1177 uuid=no
1181 ##########################################
1182 # vde libraries probe
1183 if test "$vde" != "no" ; then
1184 vde_libs="-lvdeplug"
1185 cat > $TMPC << EOF
1186 #include <libvdeplug.h>
1187 int main(void)
1189 struct vde_open_args a = {0, 0, 0};
1190 vde_open("", "", &a);
1191 return 0;
1194 if compile_prog "" "$vde_libs" ; then
1195 vde=yes
1196 libs_softmmu="$vde_libs $libs_softmmu"
1197 libs_tools="$vde_libs $libs_tools"
1198 else
1199 if test "$vde" = "yes" ; then
1200 feature_not_found "vde"
1202 vde=no
1206 ##########################################
1207 # Sound support libraries probe
1209 audio_drv_probe()
1211 drv=$1
1212 hdr=$2
1213 lib=$3
1214 exp=$4
1215 cfl=$5
1216 cat > $TMPC << EOF
1217 #include <$hdr>
1218 int main(void) { $exp }
1220 if compile_prog "$cfl" "$lib" ; then
1222 else
1223 echo
1224 echo "Error: $drv check failed"
1225 echo "Make sure to have the $drv libs and headers installed."
1226 echo
1227 exit 1
1231 audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1232 for drv in $audio_drv_list; do
1233 case $drv in
1234 alsa)
1235 audio_drv_probe $drv alsa/asoundlib.h -lasound \
1236 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1237 libs_softmmu="-lasound $libs_softmmu"
1240 fmod)
1241 if test -z $fmod_lib || test -z $fmod_inc; then
1242 echo
1243 echo "Error: You must specify path to FMOD library and headers"
1244 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1245 echo
1246 exit 1
1248 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1249 libs_softmmu="$fmod_lib $libs_softmmu"
1252 esd)
1253 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1254 libs_softmmu="-lesd $libs_softmmu"
1255 audio_pt_int="yes"
1259 audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
1260 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1261 libs_softmmu="-lpulse -lpulse-simple $libs_softmmu"
1262 audio_pt_int="yes"
1265 coreaudio)
1266 libs_softmmu="-framework CoreAudio $libs_softmmu"
1269 dsound)
1270 libs_softmmu="-lole32 -ldxguid $libs_softmmu"
1271 audio_win_int="yes"
1274 oss)
1275 libs_softmmu="$oss_lib $libs_softmmu"
1278 sdl|wav)
1279 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1282 winwave)
1283 libs_softmmu="-lwinmm $libs_softmmu"
1284 audio_win_int="yes"
1288 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
1289 echo
1290 echo "Error: Unknown driver '$drv' selected"
1291 echo "Possible drivers are: $audio_possible_drivers"
1292 echo
1293 exit 1
1296 esac
1297 done
1299 ##########################################
1300 # BrlAPI probe
1302 if test "$brlapi" != "no" ; then
1303 brlapi_libs="-lbrlapi"
1304 cat > $TMPC << EOF
1305 #include <brlapi.h>
1306 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1308 if compile_prog "" "$brlapi_libs" ; then
1309 brlapi=yes
1310 libs_softmmu="$brlapi_libs $libs_softmmu"
1311 else
1312 if test "$brlapi" = "yes" ; then
1313 feature_not_found "brlapi"
1315 brlapi=no
1319 ##########################################
1320 # curses probe
1321 curses_list="-lncurses -lcurses"
1323 if test "$curses" != "no" ; then
1324 curses_found=no
1325 cat > $TMPC << EOF
1326 #include <curses.h>
1327 #ifdef __OpenBSD__
1328 #define resize_term resizeterm
1329 #endif
1330 int main(void) { resize_term(0, 0); return curses_version(); }
1332 for curses_lib in $curses_list; do
1333 if compile_prog "" "$curses_lib" ; then
1334 curses_found=yes
1335 libs_softmmu="$curses_lib $libs_softmmu"
1336 break
1338 done
1339 if test "$curses_found" = "yes" ; then
1340 curses=yes
1341 else
1342 if test "$curses" = "yes" ; then
1343 feature_not_found "curses"
1345 curses=no
1349 ##########################################
1350 # curl probe
1352 if $pkgconfig libcurl --modversion >/dev/null 2>&1; then
1353 curlconfig="$pkgconfig libcurl"
1354 else
1355 curlconfig=curl-config
1358 if test "$curl" != "no" ; then
1359 cat > $TMPC << EOF
1360 #include <curl/curl.h>
1361 int main(void) { return curl_easy_init(); }
1363 curl_cflags=`$curlconfig --cflags 2>/dev/null`
1364 curl_libs=`$curlconfig --libs 2>/dev/null`
1365 if compile_prog "$curl_cflags" "$curl_libs" ; then
1366 curl=yes
1367 libs_tools="$curl_libs $libs_tools"
1368 libs_softmmu="$curl_libs $libs_softmmu"
1369 else
1370 if test "$curl" = "yes" ; then
1371 feature_not_found "curl"
1373 curl=no
1375 fi # test "$curl"
1377 ##########################################
1378 # check framework probe
1380 if test "$check_utests" != "no" ; then
1381 cat > $TMPC << EOF
1382 #include <check.h>
1383 int main(void) { suite_create("qemu test"); return 0; }
1385 check_libs=`$pkgconfig --libs check`
1386 if compile_prog "" $check_libs ; then
1387 check_utests=yes
1388 libs_tools="$check_libs $libs_tools"
1389 else
1390 if test "$check_utests" = "yes" ; then
1391 feature_not_found "check"
1393 check_utests=no
1395 fi # test "$check_utests"
1397 ##########################################
1398 # bluez support probe
1399 if test "$bluez" != "no" ; then
1400 cat > $TMPC << EOF
1401 #include <bluetooth/bluetooth.h>
1402 int main(void) { return bt_error(0); }
1404 bluez_cflags=`$pkgconfig --cflags bluez 2> /dev/null`
1405 bluez_libs=`$pkgconfig --libs bluez 2> /dev/null`
1406 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
1407 bluez=yes
1408 libs_softmmu="$bluez_libs $libs_softmmu"
1409 else
1410 if test "$bluez" = "yes" ; then
1411 feature_not_found "bluez"
1413 bluez="no"
1417 ##########################################
1418 # kvm probe
1419 if test "$kvm" != "no" ; then
1420 cat > $TMPC <<EOF
1421 #include <linux/kvm.h>
1422 #if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
1423 #error Invalid KVM version
1424 #endif
1425 #if !defined(KVM_CAP_USER_MEMORY)
1426 #error Missing KVM capability KVM_CAP_USER_MEMORY
1427 #endif
1428 #if !defined(KVM_CAP_SET_TSS_ADDR)
1429 #error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1430 #endif
1431 #if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1432 #error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1433 #endif
1434 int main(void) { return 0; }
1436 if test "$kerneldir" != "" ; then
1437 kvm_cflags=-I"$kerneldir"/include
1438 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1439 -a -d "$kerneldir/arch/x86/include" ; then
1440 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
1441 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1442 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
1443 elif test "$cpu" = "s390x" -a -d "$kerneldir/arch/s390/include" ; then
1444 kvm_cflags="$kvm_cflags -I$kerneldir/arch/s390/include"
1445 elif test -d "$kerneldir/arch/$cpu/include" ; then
1446 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1448 else
1449 kvm_cflags=`pkg-config --cflags kvm-kmod 2> /dev/null`
1450 if test "$kvm_cflags" = ""; then
1451 case "$cpu" in
1452 i386 | x86_64)
1453 kvm_arch="x86"
1455 ppc)
1456 kvm_arch="powerpc"
1459 kvm_arch="$cpu"
1461 esac
1462 kvm_cflags="-I$source_path/kvm/include"
1463 kvm_cflags="$kvm_cflags -include $source_path/kvm/include/linux/config.h"
1464 kvm_cflags="$kvm_cflags -I$source_path/kvm/include/$kvm_arch"
1467 kvm_cflags="$kvm_cflags -idirafter $source_path/compat"
1468 if compile_prog "$kvm_cflags" "" ; then
1469 kvm=yes
1470 cat > $TMPC <<EOF
1471 #include <linux/kvm_para.h>
1472 int main(void) { return 0; }
1474 if compile_prog "$kvm_cflags" "" ; then
1475 kvm_para=yes
1477 else
1478 if test "$kvm" = "yes" ; then
1479 if [ -x "`which awk 2>/dev/null`" ] && \
1480 [ -x "`which grep 2>/dev/null`" ]; then
1481 kvmerr=`LANG=C $cc $QEMU_CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \
1482 | grep "error: " \
1483 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1484 if test "$kvmerr" != "" ; then
1485 echo -e "${kvmerr}\n\
1486 NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \
1487 recent kvm-kmod from http://sourceforge.net/projects/kvm."
1490 feature_not_found "kvm"
1492 kvm=no
1496 ##########################################
1497 # test for KVM_CAP_PIT
1499 if test "$kvm_cap_pit" != "no" ; then
1500 if test "$kvm" = "no" -a "$kvm_cap_pit" = "yes" ; then
1501 feature_not_found "kvm_cap_pit (kvm is not enabled)"
1503 cat > $TMPC <<EOF
1504 #include <linux/kvm.h>
1505 #ifndef KVM_CAP_PIT
1506 #error "kvm no pit capability"
1507 #endif
1508 int main(void) { return 0; }
1510 if compile_prog "$kvm_cflags" ""; then
1511 kvm_cap_pit=yes
1512 else
1513 if test "$kvm_cap_pit" = "yes" ; then
1514 feature_not_found "kvm_cap_pit"
1516 kvm_cap_pit=no
1520 ##########################################
1521 # test for KVM_CAP_DEVICE_ASSIGNMENT
1523 if test "$kvm_cap_device_assignment" != "no" ; then
1524 if test "$kvm" = "no" -a "$kvm_cap_device_assignment" = "yes" ; then
1525 feature_not_found "kvm_cap_device_assignment (kvm is not enabled)"
1527 cat > $TMPC <<EOF
1528 #include <linux/kvm.h>
1529 #ifndef KVM_CAP_DEVICE_ASSIGNMENT
1530 #error "kvm no device assignment capability"
1531 #endif
1532 int main(void) { return 0; }
1534 if compile_prog "$kvm_cflags" "" ; then
1535 kvm_cap_device_assignment=yes
1536 else
1537 if test "$kvm_cap_device_assignment" = "yes" ; then
1538 feature_not_found "kvm_cap_device_assigment"
1540 kvm_cap_device_assignment=no
1544 ##########################################
1545 # libpci probe for kvm_cap_device_assignment
1546 if test $kvm_cap_device_assignment = "yes" ; then
1547 cat > $TMPC << EOF
1548 #include <pci/pci.h>
1549 #ifndef PCI_VENDOR_ID
1550 #error NO LIBPCI
1551 #endif
1552 int main(void) { struct pci_access a; pci_init(&a); return 0; }
1554 if compile_prog "" "-lpci -lz" ; then
1555 libs_softmmu="-lpci -lz $libs_softmmu"
1556 else
1557 echo
1558 echo "Error: libpci check failed"
1559 echo "Disable KVM Device Assignment capability."
1560 echo
1561 kvm_cap_device_assignment=no
1565 ##########################################
1566 # pthread probe
1567 PTHREADLIBS_LIST="-lpthread -lpthreadGC2"
1569 pthread=no
1570 cat > $TMPC << EOF
1571 #include <pthread.h>
1572 int main(void) { pthread_create(0,0,0,0); return 0; }
1574 for pthread_lib in $PTHREADLIBS_LIST; do
1575 if compile_prog "" "$pthread_lib" ; then
1576 pthread=yes
1577 LIBS="$pthread_lib $LIBS"
1578 break
1580 done
1582 if test "$mingw32" != yes -a "$pthread" = no; then
1583 echo
1584 echo "Error: pthread check failed"
1585 echo "Make sure to have the pthread libs and headers installed."
1586 echo
1587 exit 1
1590 ##########################################
1591 # linux-aio probe
1593 if test "$linux_aio" != "no" ; then
1594 cat > $TMPC <<EOF
1595 #include <libaio.h>
1596 #include <sys/eventfd.h>
1597 int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
1599 if compile_prog "" "-laio" ; then
1600 linux_aio=yes
1601 LIBS="$LIBS -laio"
1602 else
1603 if test "$linux_aio" = "yes" ; then
1604 feature_not_found "linux AIO"
1606 linux_aio=no
1610 ##########################################
1611 # iovec probe
1612 cat > $TMPC <<EOF
1613 #include <sys/types.h>
1614 #include <sys/uio.h>
1615 #include <unistd.h>
1616 int main(void) { struct iovec iov; return 0; }
1618 iovec=no
1619 if compile_prog "" "" ; then
1620 iovec=yes
1623 ##########################################
1624 # preadv probe
1625 cat > $TMPC <<EOF
1626 #include <sys/types.h>
1627 #include <sys/uio.h>
1628 #include <unistd.h>
1629 int main(void) { preadv; }
1631 preadv=no
1632 if compile_prog "" "" ; then
1633 preadv=yes
1636 ##########################################
1637 # fdt probe
1638 if test "$fdt" != "no" ; then
1639 fdt_libs="-lfdt"
1640 cat > $TMPC << EOF
1641 int main(void) { return 0; }
1643 if compile_prog "" "$fdt_libs" ; then
1644 fdt=yes
1645 libs_softmmu="$fdt_libs $libs_softmmu"
1646 else
1647 if test "$fdt" = "yes" ; then
1648 feature_not_found "fdt"
1650 fdt=no
1655 # Check for xxxat() functions when we are building linux-user
1656 # emulator. This is done because older glibc versions don't
1657 # have syscall stubs for these implemented.
1659 atfile=no
1660 cat > $TMPC << EOF
1661 #define _ATFILE_SOURCE
1662 #include <sys/types.h>
1663 #include <fcntl.h>
1664 #include <unistd.h>
1667 main(void)
1669 /* try to unlink nonexisting file */
1670 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1673 if compile_prog "" "" ; then
1674 atfile=yes
1677 # Check for inotify functions when we are building linux-user
1678 # emulator. This is done because older glibc versions don't
1679 # have syscall stubs for these implemented. In that case we
1680 # don't provide them even if kernel supports them.
1682 inotify=no
1683 cat > $TMPC << EOF
1684 #include <sys/inotify.h>
1687 main(void)
1689 /* try to start inotify */
1690 return inotify_init();
1693 if compile_prog "" "" ; then
1694 inotify=yes
1697 # check if utimensat and futimens are supported
1698 utimens=no
1699 cat > $TMPC << EOF
1700 #define _ATFILE_SOURCE
1701 #define _GNU_SOURCE
1702 #include <stddef.h>
1703 #include <fcntl.h>
1705 int main(void)
1707 utimensat(AT_FDCWD, "foo", NULL, 0);
1708 futimens(0, NULL);
1709 return 0;
1712 if compile_prog "" "" ; then
1713 utimens=yes
1716 # check if pipe2 is there
1717 pipe2=no
1718 cat > $TMPC << EOF
1719 #define _GNU_SOURCE
1720 #include <unistd.h>
1721 #include <fcntl.h>
1723 int main(void)
1725 int pipefd[2];
1726 pipe2(pipefd, O_CLOEXEC);
1727 return 0;
1730 if compile_prog "" "" ; then
1731 pipe2=yes
1734 # check if accept4 is there
1735 accept4=no
1736 cat > $TMPC << EOF
1737 #define _GNU_SOURCE
1738 #include <sys/socket.h>
1739 #include <stddef.h>
1741 int main(void)
1743 accept4(0, NULL, NULL, SOCK_CLOEXEC);
1744 return 0;
1747 if compile_prog "" "" ; then
1748 accept4=yes
1751 # check if tee/splice is there. vmsplice was added same time.
1752 splice=no
1753 cat > $TMPC << EOF
1754 #define _GNU_SOURCE
1755 #include <unistd.h>
1756 #include <fcntl.h>
1757 #include <limits.h>
1759 int main(void)
1761 int len, fd;
1762 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
1763 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
1764 return 0;
1767 if compile_prog "" "" ; then
1768 splice=yes
1771 ##########################################
1772 # signalfd probe
1773 signalfd="no"
1774 cat > $TMPC << EOF
1775 #define _GNU_SOURCE
1776 #include <unistd.h>
1777 #include <sys/syscall.h>
1778 #include <signal.h>
1779 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
1782 if compile_prog "" "" ; then
1783 signalfd=yes
1786 # check if eventfd is supported
1787 eventfd=no
1788 cat > $TMPC << EOF
1789 #include <sys/eventfd.h>
1791 int main(void)
1793 int efd = eventfd(0, 0);
1794 return 0;
1797 if compile_prog "" "" ; then
1798 eventfd=yes
1801 # check for fallocate
1802 fallocate=no
1803 cat > $TMPC << EOF
1804 #include <fcntl.h>
1806 int main(void)
1808 fallocate(0, 0, 0, 0);
1809 return 0;
1812 if compile_prog "$ARCH_CFLAGS" "" ; then
1813 fallocate=yes
1816 # check for dup3
1817 dup3=no
1818 cat > $TMPC << EOF
1819 #include <unistd.h>
1821 int main(void)
1823 dup3(0, 0, 0);
1824 return 0;
1827 if compile_prog "" "" ; then
1828 dup3=yes
1831 # Check if tools are available to build documentation.
1832 if test "$docs" != "no" ; then
1833 if test -x "`which texi2html 2>/dev/null`" -a \
1834 -x "`which pod2man 2>/dev/null`" ; then
1835 docs=yes
1836 else
1837 if test "$docs" = "yes" ; then
1838 feature_not_found "docs"
1840 docs=no
1844 # Search for bswap_32 function
1845 byteswap_h=no
1846 cat > $TMPC << EOF
1847 #include <byteswap.h>
1848 int main(void) { return bswap_32(0); }
1850 if compile_prog "" "" ; then
1851 byteswap_h=yes
1854 # Search for bswap_32 function
1855 bswap_h=no
1856 cat > $TMPC << EOF
1857 #include <sys/endian.h>
1858 #include <sys/types.h>
1859 #include <machine/bswap.h>
1860 int main(void) { return bswap32(0); }
1862 if compile_prog "" "" ; then
1863 bswap_h=yes
1866 ##########################################
1867 # Do we need librt
1868 cat > $TMPC <<EOF
1869 #include <signal.h>
1870 #include <time.h>
1871 int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1874 if compile_prog "" "" ; then
1876 elif compile_prog "" "-lrt" ; then
1877 LIBS="-lrt $LIBS"
1880 if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
1881 "$aix" != "yes" ; then
1882 libs_softmmu="-lutil $libs_softmmu"
1885 ##########################################
1886 # check if the compiler defines offsetof
1888 need_offsetof=yes
1889 cat > $TMPC << EOF
1890 #include <stddef.h>
1891 int main(void) { struct s { int f; }; return offsetof(struct s, f); }
1893 if compile_prog "" "" ; then
1894 need_offsetof=no
1897 ##########################################
1898 # check if the compiler understands attribute warn_unused_result
1900 # This could be smarter, but gcc -Werror does not error out even when warning
1901 # about attribute warn_unused_result
1903 gcc_attribute_warn_unused_result=no
1904 cat > $TMPC << EOF
1905 #if defined(__GNUC__) && (__GNUC__ < 4) && defined(__GNUC_MINOR__) && (__GNUC__ < 4)
1906 #error gcc 3.3 or older
1907 #endif
1908 int main(void) { return 0;}
1910 if compile_prog "" ""; then
1911 gcc_attribute_warn_unused_result=yes
1914 ##########################################
1915 # check if we have fdatasync
1917 fdatasync=no
1918 cat > $TMPC << EOF
1919 #include <unistd.h>
1920 int main(void) { return fdatasync(0); }
1922 if compile_prog "" "" ; then
1923 fdatasync=yes
1926 # End of CC checks
1927 # After here, no more $cc or $ld runs
1929 if test "$debug" = "no" ; then
1930 CFLAGS="-O2 $CFLAGS"
1933 # Consult white-list to determine whether to enable werror
1934 # by default. Only enable by default for git builds
1935 z_version=`cut -f3 -d. $source_path/VERSION`
1937 if test -z "$werror" ; then
1938 if test "$z_version" = "50" -a \
1939 "$linux" = "yes" ; then
1940 werror="yes"
1941 else
1942 werror="no"
1946 # Disable zero malloc errors for official releases unless explicitly told to
1947 # enable/disable
1948 if test -z "$zero_malloc" ; then
1949 if test "$z_version" = "50" ; then
1950 zero_malloc="no"
1951 else
1952 zero_malloc="yes"
1956 if test "$werror" = "yes" ; then
1957 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
1960 if test "$solaris" = "no" ; then
1961 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
1962 LDFLAGS="-Wl,--warn-common $LDFLAGS"
1966 if test "$mingw32" = "yes" ; then
1967 if test -z "$prefix" ; then
1968 prefix="c:/Program Files/Qemu"
1970 mansuffix=""
1971 datasuffix=""
1972 docsuffix=""
1973 binsuffix=""
1974 else
1975 if test -z "$prefix" ; then
1976 prefix="/usr/local"
1978 mansuffix="/share/man"
1979 datasuffix="/share/qemu"
1980 docsuffix="/share/doc/qemu"
1981 binsuffix="/bin"
1984 if test -f kvm/kernel/configure; then
1985 kvm_kmod="yes"
1986 kmod_args=""
1987 if test -n "$kerneldir"; then
1988 kmod_args="--kerneldir=$kerneldir"
1990 if test "$kvm_trace" = "yes"; then
1991 kmod_args="$kmod_args --with-kvm-trace"
1993 # hope there are no spaces in kmod_args; can't use arrays because of
1994 # dash.
1995 (cd kvm/kernel; ./configure $kmod_args)
1998 echo "Install prefix $prefix"
1999 echo "BIOS directory $prefix$datasuffix"
2000 echo "binary directory $prefix$binsuffix"
2001 if test "$mingw32" = "no" ; then
2002 echo "Manual directory $prefix$mansuffix"
2003 echo "ELF interp prefix $interp_prefix"
2005 echo "Source path $source_path"
2006 echo "C compiler $cc"
2007 echo "Host C compiler $host_cc"
2008 echo "CFLAGS $CFLAGS"
2009 echo "QEMU_CFLAGS $QEMU_CFLAGS"
2010 echo "LDFLAGS $LDFLAGS"
2011 echo "make $make"
2012 echo "install $install"
2013 echo "host CPU $cpu"
2014 echo "host big endian $bigendian"
2015 echo "target list $target_list"
2016 echo "tcg debug enabled $debug_tcg"
2017 echo "gprof enabled $gprof"
2018 echo "sparse enabled $sparse"
2019 echo "strip binaries $strip_opt"
2020 echo "profiler $profiler"
2021 echo "static build $static"
2022 echo "-Werror enabled $werror"
2023 if test "$darwin" = "yes" ; then
2024 echo "Cocoa support $cocoa"
2026 echo "SDL support $sdl"
2027 echo "curses support $curses"
2028 echo "curl support $curl"
2029 echo "check support $check_utests"
2030 echo "mingw32 support $mingw32"
2031 echo "Audio drivers $audio_drv_list"
2032 echo "Extra audio cards $audio_card_list"
2033 echo "Block whitelist $block_drv_whitelist"
2034 echo "Mixer emulation $mixemu"
2035 echo "VNC TLS support $vnc_tls"
2036 echo "VNC SASL support $vnc_sasl"
2037 if test -n "$sparc_cpu"; then
2038 echo "Target Sparc Arch $sparc_cpu"
2040 echo "xen support $xen"
2041 echo "CPU emulation $cpu_emulation"
2042 echo "brlapi support $brlapi"
2043 echo "bluez support $bluez"
2044 echo "Documentation $docs"
2045 [ ! -z "$uname_release" ] && \
2046 echo "uname -r $uname_release"
2047 echo "NPTL support $nptl"
2048 echo "GUEST_BASE $guest_base"
2049 echo "PIE user targets $user_pie"
2050 echo "vde support $vde"
2051 echo "IO thread $io_thread"
2052 echo "Linux AIO support $linux_aio"
2053 echo "Install blobs $blobs"
2054 echo "KVM support $kvm"
2055 echo "KVM PIT support $kvm_cap_pit"
2056 echo "KVM device assig. $kvm_cap_device_assignment"
2057 echo "KVM trace support $kvm_trace"
2058 echo "fdt support $fdt"
2059 echo "preadv support $preadv"
2060 echo "fdatasync $fdatasync"
2061 echo "uuid support $uuid"
2063 if test $sdl_too_old = "yes"; then
2064 echo "-> Your SDL version is too old - please upgrade to have SDL support"
2067 config_host_mak="config-host.mak"
2068 config_host_ld="config-host.ld"
2070 echo "# Automatically generated by configure - do not modify" > $config_host_mak
2071 printf "# Configured with:" >> $config_host_mak
2072 printf " '%s'" "$0" "$@" >> $config_host_mak
2073 echo >> $config_host_mak
2075 echo "CONFIG_QEMU_SHAREDIR=\"$prefix$datasuffix\"" >> $config_host_mak
2077 case "$cpu" in
2078 i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
2079 ARCH=$cpu
2081 armv4b|armv4l)
2082 ARCH=arm
2085 echo "Unsupported CPU = $cpu"
2086 exit 1
2088 esac
2089 echo "ARCH=$ARCH" >> $config_host_mak
2090 if test "$debug_tcg" = "yes" ; then
2091 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
2093 if test "$debug" = "yes" ; then
2094 echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
2096 if test "$strip_opt" = "yes" ; then
2097 echo "STRIP_OPT=-s" >> $config_host_mak
2099 if test "$bigendian" = "yes" ; then
2100 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
2102 echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
2103 if test "$mingw32" = "yes" ; then
2104 echo "CONFIG_WIN32=y" >> $config_host_mak
2105 else
2106 echo "CONFIG_POSIX=y" >> $config_host_mak
2109 if test "$linux" = "yes" ; then
2110 echo "CONFIG_LINUX=y" >> $config_host_mak
2113 if test "$darwin" = "yes" ; then
2114 echo "CONFIG_DARWIN=y" >> $config_host_mak
2117 if test "$aix" = "yes" ; then
2118 echo "CONFIG_AIX=y" >> $config_host_mak
2121 if test "$solaris" = "yes" ; then
2122 echo "CONFIG_SOLARIS=y" >> $config_host_mak
2123 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
2124 if test "$needs_libsunmath" = "yes" ; then
2125 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
2128 if test "$static" = "yes" ; then
2129 echo "CONFIG_STATIC=y" >> $config_host_mak
2130 LDFLAGS="-static $LDFLAGS"
2132 if test $profiler = "yes" ; then
2133 echo "CONFIG_PROFILER=y" >> $config_host_mak
2135 if test "$slirp" = "yes" ; then
2136 echo "CONFIG_SLIRP=y" >> $config_host_mak
2137 QEMU_CFLAGS="-I\$(SRC_PATH)/slirp $QEMU_CFLAGS"
2139 if test "$vde" = "yes" ; then
2140 echo "CONFIG_VDE=y" >> $config_host_mak
2142 for card in $audio_card_list; do
2143 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
2144 echo "$def=y" >> $config_host_mak
2145 done
2146 echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
2147 for drv in $audio_drv_list; do
2148 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
2149 echo "$def=y" >> $config_host_mak
2150 if test "$drv" = "fmod"; then
2151 echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
2153 done
2154 if test "$audio_pt_int" = "yes" ; then
2155 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
2157 if test "$audio_win_int" = "yes" ; then
2158 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
2160 echo "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
2161 if test "$mixemu" = "yes" ; then
2162 echo "CONFIG_MIXEMU=y" >> $config_host_mak
2164 if test "$vnc_tls" = "yes" ; then
2165 echo "CONFIG_VNC_TLS=y" >> $config_host_mak
2166 echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
2168 if test "$vnc_sasl" = "yes" ; then
2169 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
2170 echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
2172 if test "$fnmatch" = "yes" ; then
2173 echo "CONFIG_FNMATCH=y" >> $config_host_mak
2175 if test "$uuid" = "yes" ; then
2176 echo "CONFIG_UUID=y" >> $config_host_mak
2178 qemu_version=`head $source_path/VERSION`
2179 echo "VERSION=$qemu_version" >>$config_host_mak
2180 echo "PKGVERSION=$pkgversion" >>$config_host_mak
2181 echo "SRC_PATH=$source_path" >> $config_host_mak
2182 echo "TARGET_DIRS=$target_list" >> $config_host_mak
2183 if [ "$docs" = "yes" ] ; then
2184 echo "BUILD_DOCS=yes" >> $config_host_mak
2186 if test "$sdl" = "yes" ; then
2187 echo "CONFIG_SDL=y" >> $config_host_mak
2188 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
2190 if test "$cocoa" = "yes" ; then
2191 echo "CONFIG_COCOA=y" >> $config_host_mak
2193 if test "$curses" = "yes" ; then
2194 echo "CONFIG_CURSES=y" >> $config_host_mak
2196 if test "$atfile" = "yes" ; then
2197 echo "CONFIG_ATFILE=y" >> $config_host_mak
2199 if test "$utimens" = "yes" ; then
2200 echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
2202 if test "$pipe2" = "yes" ; then
2203 echo "CONFIG_PIPE2=y" >> $config_host_mak
2205 if test "$accept4" = "yes" ; then
2206 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
2208 if test "$splice" = "yes" ; then
2209 echo "CONFIG_SPLICE=y" >> $config_host_mak
2211 if test "$eventfd" = "yes" ; then
2212 echo "CONFIG_EVENTFD=y" >> $config_host_mak
2214 if test "$fallocate" = "yes" ; then
2215 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
2217 if test "$dup3" = "yes" ; then
2218 echo "CONFIG_DUP3=y" >> $config_host_mak
2220 if test "$inotify" = "yes" ; then
2221 echo "CONFIG_INOTIFY=y" >> $config_host_mak
2223 if test "$byteswap_h" = "yes" ; then
2224 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
2226 if test "$bswap_h" = "yes" ; then
2227 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
2229 if test "$curl" = "yes" ; then
2230 echo "CONFIG_CURL=y" >> $config_host_mak
2231 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
2233 if test "$brlapi" = "yes" ; then
2234 echo "CONFIG_BRLAPI=y" >> $config_host_mak
2236 if test "$bluez" = "yes" ; then
2237 echo "CONFIG_BLUEZ=y" >> $config_host_mak
2238 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
2240 if test "$xen" = "yes" ; then
2241 echo "CONFIG_XEN=y" >> $config_host_mak
2243 if test "$io_thread" = "yes" ; then
2244 echo "CONFIG_IOTHREAD=y" >> $config_host_mak
2246 if test "$linux_aio" = "yes" ; then
2247 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
2249 if test "$blobs" = "yes" ; then
2250 echo "INSTALL_BLOBS=yes" >> $config_host_mak
2252 if test "$iovec" = "yes" ; then
2253 echo "CONFIG_IOVEC=y" >> $config_host_mak
2255 if test "$preadv" = "yes" ; then
2256 echo "CONFIG_PREADV=y" >> $config_host_mak
2258 if test "$fdt" = "yes" ; then
2259 echo "CONFIG_FDT=y" >> $config_host_mak
2261 if test "$signalfd" = "yes" ; then
2262 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
2264 if test "$need_offsetof" = "yes" ; then
2265 echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
2267 if test "$gcc_attribute_warn_unused_result" = "yes" ; then
2268 echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak
2270 if test "$fdatasync" = "yes" ; then
2271 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
2273 if test $cpu_emulation = "yes"; then
2274 echo "CONFIG_CPU_EMULATION=y" >> $config_host_mak
2275 else
2276 echo "CONFIG_NO_CPU_EMULATION=y" >> $config_host_mak
2279 # XXX: suppress that
2280 if [ "$bsd" = "yes" ] ; then
2281 echo "CONFIG_BSD=y" >> $config_host_mak
2284 echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
2286 if test "$zero_malloc" = "yes" ; then
2287 echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
2290 # USB host support
2291 case "$usb" in
2292 linux)
2293 echo "HOST_USB=linux" >> $config_host_mak
2295 bsd)
2296 echo "HOST_USB=bsd" >> $config_host_mak
2299 echo "HOST_USB=stub" >> $config_host_mak
2301 esac
2303 echo "KVM_KMOD=$kvm_kmod" >> $config_host_mak
2305 tools=
2306 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
2307 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
2308 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
2309 tools="qemu-nbd\$(EXESUF) $tools"
2310 if [ "$check_utests" = "yes" ]; then
2311 tools="check-qint check-qstring check-qdict check-qlist $tools"
2312 tools="check-qfloat check-qjson $tools"
2316 echo "TOOLS=$tools" >> $config_host_mak
2318 # Mac OS X ships with a broken assembler
2319 roms=
2320 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
2321 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
2322 `expr "$target_list" : ".*softmmu.*"` != 0 ; then
2323 roms="optionrom"
2325 echo "ROMS=$roms" >> $config_host_mak
2327 echo "prefix=$prefix" >> $config_host_mak
2328 echo "bindir=\${prefix}$binsuffix" >> $config_host_mak
2329 echo "mandir=\${prefix}$mansuffix" >> $config_host_mak
2330 echo "datadir=\${prefix}$datasuffix" >> $config_host_mak
2331 echo "docdir=\${prefix}$docsuffix" >> $config_host_mak
2332 echo "MAKE=$make" >> $config_host_mak
2333 echo "INSTALL=$install" >> $config_host_mak
2334 echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak
2335 echo "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak
2336 echo "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak
2337 echo "CC=$cc" >> $config_host_mak
2338 echo "HOST_CC=$host_cc" >> $config_host_mak
2339 if test "$sparse" = "yes" ; then
2340 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
2341 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
2342 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
2344 echo "AR=$ar" >> $config_host_mak
2345 echo "OBJCOPY=$objcopy" >> $config_host_mak
2346 echo "LD=$ld" >> $config_host_mak
2347 echo "CFLAGS=$CFLAGS" >> $config_host_mak
2348 echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
2349 echo "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
2350 echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
2351 echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
2352 echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
2353 echo "LIBS+=$LIBS" >> $config_host_mak
2354 echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
2355 echo "EXESUF=$EXESUF" >> $config_host_mak
2357 # generate list of library paths for linker script
2359 $ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
2361 if test -f ${config_host_ld}~ ; then
2362 if cmp -s $config_host_ld ${config_host_ld}~ ; then
2363 mv ${config_host_ld}~ $config_host_ld
2364 else
2365 rm ${config_host_ld}~
2369 for target in $target_list; do
2370 target_dir="$target"
2371 config_target_mak=$target_dir/config-target.mak
2372 target_arch2=`echo $target | cut -d '-' -f 1`
2373 target_bigendian="no"
2375 case "$target_arch2" in
2376 armeb|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus)
2377 target_bigendian=yes
2379 esac
2380 target_softmmu="no"
2381 target_user_only="no"
2382 target_linux_user="no"
2383 target_darwin_user="no"
2384 target_bsd_user="no"
2385 case "$target" in
2386 ${target_arch2}-softmmu)
2387 target_softmmu="yes"
2389 ${target_arch2}-linux-user)
2390 if test "$linux" != "yes" ; then
2391 echo "ERROR: Target '$target' is only available on a Linux host"
2392 exit 1
2394 target_user_only="yes"
2395 target_linux_user="yes"
2397 ${target_arch2}-darwin-user)
2398 if test "$darwin" != "yes" ; then
2399 echo "ERROR: Target '$target' is only available on a Darwin host"
2400 exit 1
2402 target_user_only="yes"
2403 target_darwin_user="yes"
2405 ${target_arch2}-bsd-user)
2406 if test "$bsd" != "yes" ; then
2407 echo "ERROR: Target '$target' is only available on a BSD host"
2408 exit 1
2410 target_user_only="yes"
2411 target_bsd_user="yes"
2414 echo "ERROR: Target '$target' not recognised"
2415 exit 1
2417 esac
2419 mkdir -p $target_dir
2420 mkdir -p $target_dir/fpu
2421 mkdir -p $target_dir/tcg
2422 mkdir -p $target_dir/ide
2423 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
2424 mkdir -p $target_dir/nwfpe
2428 # don't use ln -sf as not all "ln -sf" over write the file/link
2430 rm -f $target_dir/Makefile
2431 ln -s $source_path/Makefile.target $target_dir/Makefile
2434 echo "# Automatically generated by configure - do not modify" > $config_target_mak
2436 bflt="no"
2437 elfload32="no"
2438 target_nptl="no"
2439 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
2440 echo "CONFIG_QEMU_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
2441 gdb_xml_files=""
2443 TARGET_ARCH="$target_arch2"
2444 TARGET_BASE_ARCH=""
2445 TARGET_ABI_DIR=""
2447 case "$target_arch2" in
2448 i386)
2449 target_phys_bits=32
2451 x86_64)
2452 TARGET_BASE_ARCH=i386
2453 target_phys_bits=64
2455 ia64)
2456 target_phys_bits=64
2458 alpha)
2459 target_phys_bits=64
2461 arm|armeb)
2462 TARGET_ARCH=arm
2463 bflt="yes"
2464 target_nptl="yes"
2465 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
2466 target_phys_bits=32
2468 cris)
2469 target_nptl="yes"
2470 target_phys_bits=32
2472 m68k)
2473 bflt="yes"
2474 gdb_xml_files="cf-core.xml cf-fp.xml"
2475 target_phys_bits=32
2477 microblaze)
2478 bflt="yes"
2479 target_nptl="yes"
2480 target_phys_bits=32
2482 mips|mipsel)
2483 TARGET_ARCH=mips
2484 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
2485 target_nptl="yes"
2486 target_phys_bits=64
2488 mipsn32|mipsn32el)
2489 TARGET_ARCH=mipsn32
2490 TARGET_BASE_ARCH=mips
2491 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
2492 target_phys_bits=64
2494 mips64|mips64el)
2495 TARGET_ARCH=mips64
2496 TARGET_BASE_ARCH=mips
2497 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
2498 target_phys_bits=64
2500 ppc)
2501 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2502 target_phys_bits=32
2503 target_nptl="yes"
2505 ppcemb)
2506 TARGET_BASE_ARCH=ppc
2507 TARGET_ABI_DIR=ppc
2508 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2509 target_phys_bits=64
2510 target_nptl="yes"
2512 ppc64)
2513 TARGET_BASE_ARCH=ppc
2514 TARGET_ABI_DIR=ppc
2515 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2516 target_phys_bits=64
2518 ppc64abi32)
2519 TARGET_ARCH=ppc64
2520 TARGET_BASE_ARCH=ppc
2521 TARGET_ABI_DIR=ppc
2522 echo "TARGET_ABI32=y" >> $config_target_mak
2523 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2524 target_phys_bits=64
2526 sh4|sh4eb)
2527 TARGET_ARCH=sh4
2528 bflt="yes"
2529 target_nptl="yes"
2530 target_phys_bits=32
2532 sparc)
2533 target_phys_bits=64
2535 sparc64)
2536 TARGET_BASE_ARCH=sparc
2537 elfload32="yes"
2538 target_phys_bits=64
2540 sparc32plus)
2541 TARGET_ARCH=sparc64
2542 TARGET_BASE_ARCH=sparc
2543 TARGET_ABI_DIR=sparc
2544 echo "TARGET_ABI32=y" >> $config_target_mak
2545 target_phys_bits=64
2547 s390x)
2548 target_phys_bits=64
2551 echo "Unsupported target CPU"
2552 exit 1
2554 esac
2555 echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
2556 target_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
2557 echo "TARGET_$target_arch_name=y" >> $config_target_mak
2558 echo "TARGET_ARCH2=$target_arch2" >> $config_target_mak
2559 # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
2560 if [ "$TARGET_BASE_ARCH" = "" ]; then
2561 TARGET_BASE_ARCH=$TARGET_ARCH
2563 echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
2564 if [ "$TARGET_ABI_DIR" = "" ]; then
2565 TARGET_ABI_DIR=$TARGET_ARCH
2567 echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
2568 if [ $target_phys_bits -lt $hostlongbits ] ; then
2569 target_phys_bits=$hostlongbits
2571 case "$target_arch2" in
2572 i386|x86_64)
2573 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
2574 echo "CONFIG_XEN=y" >> $config_target_mak
2576 esac
2577 case "$target_arch2" in
2578 i386|x86_64|ppcemb|ppc|ppc64|s390x)
2579 # Make sure the target and host cpus are compatible
2580 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
2581 \( "$target_arch2" = "$cpu" -o \
2582 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
2583 \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \
2584 \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \
2585 \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then
2586 echo "CONFIG_KVM=y" >> $config_target_mak
2587 echo "KVM_CFLAGS=$kvm_cflags" >> $config_target_mak
2588 if test "$kvm_para" = "yes"; then
2589 echo "CONFIG_KVM_PARA=y" >> $config_target_mak
2591 if test $kvm_cap_pit = "yes" ; then
2592 echo "CONFIG_KVM_PIT=y" >> $config_target_mak
2594 if test $kvm_cap_device_assignment = "yes" ; then
2595 echo "CONFIG_KVM_DEVICE_ASSIGNMENT=y" >> $config_target_mak
2598 esac
2599 echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
2600 if test "$target_bigendian" = "yes" ; then
2601 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
2603 if test "$target_softmmu" = "yes" ; then
2604 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
2605 echo "LIBS+=$libs_softmmu" >> $config_target_mak
2606 echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
2607 echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
2609 if test "$target_user_only" = "yes" ; then
2610 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
2612 if test "$target_linux_user" = "yes" ; then
2613 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
2615 if test "$target_darwin_user" = "yes" ; then
2616 echo "CONFIG_DARWIN_USER=y" >> $config_target_mak
2618 list=""
2619 if test ! -z "$gdb_xml_files" ; then
2620 for x in $gdb_xml_files; do
2621 list="$list $source_path/gdb-xml/$x"
2622 done
2623 echo "TARGET_XML_FILES=$list" >> $config_target_mak
2626 case "$target_arch2" in
2627 alpha|arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|s390x|sparc|sparc64|sparc32plus)
2628 echo "CONFIG_SOFTFLOAT=y" >> $config_target_mak
2631 echo "CONFIG_NOSOFTFLOAT=y" >> $config_target_mak
2633 esac
2635 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
2636 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
2638 if test "$target_user_only" = "yes" \
2639 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
2640 echo "CONFIG_USE_NPTL=y" >> $config_target_mak
2642 # 32 bit ELF loader in addition to native 64 bit loader?
2643 if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
2644 echo "TARGET_HAS_ELFLOAD32=y" >> $config_target_mak
2646 if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
2647 echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
2649 if test "$target_bsd_user" = "yes" ; then
2650 echo "CONFIG_BSD_USER=y" >> $config_target_mak
2653 # generate QEMU_CFLAGS/LDFLAGS for targets
2655 cflags=""
2656 ldflags=""
2658 if test "$ARCH" = "sparc64" ; then
2659 cflags="-I\$(SRC_PATH)/tcg/sparc $cflags"
2660 elif test "$ARCH" = "s390x" ; then
2661 cflags="-I\$(SRC_PATH)/tcg/s390 $cflags"
2662 else
2663 cflags="-I\$(SRC_PATH)/tcg/\$(ARCH) $cflags"
2665 cflags="-I\$(SRC_PATH)/tcg $cflags"
2666 cflags="-I\$(SRC_PATH)/fpu $cflags"
2668 for i in $ARCH $TARGET_BASE_ARCH ; do
2669 case "$i" in
2670 alpha)
2671 echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
2673 arm)
2674 echo "CONFIG_ARM_DIS=y" >> $config_target_mak
2676 cris)
2677 echo "CONFIG_CRIS_DIS=y" >> $config_target_mak
2679 hppa)
2680 echo "CONFIG_HPPA_DIS=y" >> $config_target_mak
2682 i386|x86_64)
2683 echo "CONFIG_I386_DIS=y" >> $config_target_mak
2685 m68k)
2686 echo "CONFIG_M68K_DIS=y" >> $config_target_mak
2688 microblaze)
2689 echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak
2691 mips*)
2692 echo "CONFIG_MIPS_DIS=y" >> $config_target_mak
2694 ppc*)
2695 echo "CONFIG_PPC_DIS=y" >> $config_target_mak
2697 s390*)
2698 echo "CONFIG_S390_DIS=y" >> $config_target_mak
2700 sh4)
2701 echo "CONFIG_SH4_DIS=y" >> $config_target_mak
2703 sparc*)
2704 echo "CONFIG_SPARC_DIS=y" >> $config_target_mak
2706 esac
2707 done
2709 case "$ARCH" in
2710 alpha)
2711 # Ensure there's only a single GP
2712 cflags="-msmall-data $cflags"
2714 ia64)
2715 cflags="-mno-sdata $cflags"
2717 esac
2719 if test "$target_softmmu" = "yes" ; then
2720 case "$TARGET_BASE_ARCH" in
2721 arm)
2722 cflags="-DHAS_AUDIO $cflags"
2724 i386|mips|ppc)
2725 cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
2727 esac
2730 if test "$target_user_only" = "yes" -a "$static" = "no" -a \
2731 "$user_pie" = "yes" ; then
2732 cflags="-fpie $cflags"
2733 ldflags="-pie $ldflags"
2736 if test "$target_softmmu" = "yes" -a \( \
2737 "$TARGET_ARCH" = "microblaze" -o \
2738 "$TARGET_ARCH" = "cris" \) ; then
2739 echo "CONFIG_NEED_MMU=y" >> $config_target_mak
2742 if test "$gprof" = "yes" ; then
2743 echo "TARGET_GPROF=yes" >> $config_target_mak
2744 if test "$target_linux_user" = "yes" ; then
2745 cflags="-p $cflags"
2746 ldflags="-p $ldflags"
2748 if test "$target_softmmu" = "yes" ; then
2749 ldflags="-p $ldflags"
2750 echo "GPROF_CFLAGS=-p" >> $config_target_mak
2754 linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
2755 if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
2756 case "$ARCH" in
2757 sparc)
2758 # -static is used to avoid g1/g3 usage by the dynamic linker
2759 ldflags="$linker_script -static $ldflags"
2761 ia64)
2762 ldflags="-Wl,-G0 $linker_script -static $ldflags"
2764 i386|x86_64|ppc|ppc64|s390|sparc64|alpha|arm|m68k|mips|mips64)
2765 ldflags="$linker_script $ldflags"
2767 esac
2769 if test "$target_softmmu" = "yes" ; then
2770 case "$ARCH" in
2771 ia64)
2772 ldflags="-Wl,-G0 $linker_script -static $ldflags"
2774 esac
2777 echo "LDFLAGS+=$ldflags" >> $config_target_mak
2778 echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
2780 done # for target in $targets
2782 # build tree in object directory if source path is different from current one
2783 if test "$source_path_used" = "yes" ; then
2784 DIRS="tests tests/cris slirp audio block net pc-bios/optionrom"
2785 DIRS="$DIRS roms/seabios roms/vgabios"
2786 FILES="Makefile tests/Makefile"
2787 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
2788 FILES="$FILES tests/test-mmap.c"
2789 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps pc-bios/video.x"
2790 FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
2791 for bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do
2792 FILES="$FILES pc-bios/`basename $bios_file`"
2793 done
2794 for dir in $DIRS ; do
2795 mkdir -p $dir
2796 done
2797 # remove the link and recreate it, as not all "ln -sf" overwrite the link
2798 for f in $FILES ; do
2799 rm -f $f
2800 ln -s $source_path/$f $f
2801 done
2804 # temporary config to build submodules
2805 for rom in seabios vgabios; do
2806 config_mak=roms/$rom/config.mak
2807 echo "# Automatically generated by configure - do not modify" >> $config_mak
2808 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
2809 echo "CC=$cc" >> $config_mak
2810 echo "BCC=bcc" >> $config_mak
2811 echo "CPP=${cross_prefix}cpp" >> $config_mak
2812 echo "OBJCOPY=objcopy" >> $config_mak
2813 echo "IASL=iasl" >> $config_mak
2814 echo "HOST_CC=$host_cc" >> $config_mak
2815 echo "LD=$ld" >> $config_mak
2816 done
2818 for hwlib in 32 64; do
2819 d=libhw$hwlib
2820 mkdir -p $d
2821 rm -f $d/Makefile
2822 ln -s $source_path/Makefile.hw $d/Makefile
2823 echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" >> $d/config.mak
2824 done
2826 d=libuser
2827 mkdir -p $d
2828 rm -f $d/Makefile
2829 ln -s $source_path/Makefile.user $d/Makefile
2830 if test "$static" = "no" -a "$user_pie" = "yes" ; then
2831 echo "QEMU_CFLAGS+=-fpie" > $d/config.mak