qemu-kvm: Fix GSI handling with in-kernel irqchip
[qemu-kvm.git] / configure
blobe3986970f7539dd3828f863bd43e61ae52786076
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 # NB: do not call "exit" in the trap handler; this is buggy with some shells;
19 # see <1285349658-3122-1-git-send-email-loic.minier@linaro.org>
20 trap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM
21 rm -f config.log
23 # Print a helpful header at the top of config.log
24 echo "# QEMU configure log $(date)" >> config.log
25 echo "# produced by $0 $*" >> config.log
26 echo "#" >> config.log
28 compile_object() {
29 echo $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log
30 $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log 2>&1
33 compile_prog() {
34 local_cflags="$1"
35 local_ldflags="$2"
36 echo $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log
37 $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log 2>&1
40 # symbolically link $1 to $2. Portable version of "ln -sf".
41 symlink() {
42 rm -f $2
43 ln -s $1 $2
46 # check whether a command is available to this shell (may be either an
47 # executable or a builtin)
48 has() {
49 type "$1" >/dev/null 2>&1
52 # search for an executable in PATH
53 path_of() {
54 local_command="$1"
55 local_ifs="$IFS"
56 local_dir=""
58 # pathname has a dir component?
59 if [ "${local_command#*/}" != "$local_command" ]; then
60 if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
61 echo "$local_command"
62 return 0
65 if [ -z "$local_command" ]; then
66 return 1
69 IFS=:
70 for local_dir in $PATH; do
71 if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
72 echo "$local_dir/$local_command"
73 IFS="${local_ifs:-$(printf ' \t\n')}"
74 return 0
76 done
77 # not found
78 IFS="${local_ifs:-$(printf ' \t\n')}"
79 return 1
82 # default parameters
83 source_path=`dirname "$0"`
84 cpu=""
85 interp_prefix="/usr/gnemul/qemu-%M"
86 static="no"
87 sparc_cpu=""
88 cross_prefix=""
89 audio_drv_list=""
90 audio_card_list="ac97 es1370 sb16 hda"
91 audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda"
92 block_drv_whitelist=""
93 host_cc="gcc"
94 helper_cflags=""
95 libs_softmmu=""
96 libs_tools=""
97 audio_pt_int=""
98 audio_win_int=""
99 cc_i386=i386-pc-linux-gnu-gcc
100 libs_qga=""
102 target_list="x86_64-softmmu"
104 kvm_version() {
105 local fname="$(dirname "$0")/KVM_VERSION"
107 if test -f "$fname"; then
108 cat "$fname"
109 else
110 echo "qemu-kvm-devel"
114 # Default value for a variable defining feature "foo".
115 # * foo="no" feature will only be used if --enable-foo arg is given
116 # * foo="" feature will be searched for, and if found, will be used
117 # unless --disable-foo is given
118 # * foo="yes" this value will only be set by --enable-foo flag.
119 # feature will searched for,
120 # if not found, configure exits with error
122 # Always add --enable-foo and --disable-foo command line args.
123 # Distributions want to ensure that several features are compiled in, and it
124 # is impossible without a --enable-foo that exits if a feature is not found.
126 bluez=""
127 brlapi=""
128 curl=""
129 curses=""
130 docs=""
131 fdt=""
132 nptl=""
133 sdl=""
134 vnc="yes"
135 sparse="no"
136 uuid=""
137 vde=""
138 vnc_tls=""
139 vnc_sasl=""
140 vnc_jpeg=""
141 vnc_png=""
142 vnc_thread="no"
143 xen=""
144 xen_ctrl_version=""
145 linux_aio=""
146 attr=""
147 libattr=""
148 xfs=""
150 vhost_net="no"
151 kvm="no"
152 gprof="no"
153 debug_tcg="no"
154 debug_mon="no"
155 debug="no"
156 strip_opt="yes"
157 tcg_interpreter="no"
158 bigendian="no"
159 mingw32="no"
160 EXESUF=""
161 prefix="/usr/local"
162 mandir="\${prefix}/share/man"
163 datadir="\${prefix}/share/qemu"
164 docdir="\${prefix}/share/doc/qemu"
165 bindir="\${prefix}/bin"
166 libdir="\${prefix}/lib"
167 includedir="\${prefix}/include"
168 sysconfdir="\${prefix}/etc"
169 confsuffix="/qemu"
170 slirp="yes"
171 fmod_lib=""
172 fmod_inc=""
173 oss_lib=""
174 bsd="no"
175 linux="no"
176 solaris="no"
177 profiler="no"
178 cocoa="no"
179 softmmu="yes"
180 linux_user="no"
181 darwin_user="no"
182 bsd_user="no"
183 guest_base=""
184 uname_release=""
185 mixemu="no"
186 kvm_cap_pit="yes"
187 kvm_cap_device_assignment="yes"
188 aix="no"
189 blobs="yes"
190 pkgversion=" ($(kvm_version))"
191 cpu_emulation="yes"
192 pie=""
193 zero_malloc=""
194 trace_backend="nop"
195 trace_file="trace"
196 spice=""
197 rbd=""
198 smartcard=""
199 smartcard_nss=""
200 usb_redir=""
201 opengl=""
202 zlib="yes"
203 guest_agent="yes"
204 libiscsi=""
206 # parse CC options first
207 for opt do
208 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
209 case "$opt" in
210 --cross-prefix=*) cross_prefix="$optarg"
212 --cc=*) CC="$optarg"
214 --source-path=*) source_path="$optarg"
216 --cpu=*) cpu="$optarg"
218 --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
220 --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
222 --sparc_cpu=*)
223 sparc_cpu="$optarg"
224 case $sparc_cpu in
225 v7|v8|v8plus|v8plusa)
226 cpu="sparc"
229 cpu="sparc64"
232 echo "undefined SPARC architecture. Exiting";
233 exit 1
235 esac
237 esac
238 done
239 # OS specific
240 # Using uname is really, really broken. Once we have the right set of checks
241 # we can eliminate it's usage altogether
243 cc="${CC-${cross_prefix}gcc}"
244 ar="${AR-${cross_prefix}ar}"
245 objcopy="${OBJCOPY-${cross_prefix}objcopy}"
246 ld="${LD-${cross_prefix}ld}"
247 libtool="${LIBTOOL-${cross_prefix}libtool}"
248 strip="${STRIP-${cross_prefix}strip}"
249 windres="${WINDRES-${cross_prefix}windres}"
250 pkg_config="${PKG_CONFIG-${cross_prefix}pkg-config}"
251 sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
253 # default flags for all hosts
254 QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
255 CFLAGS="-g $CFLAGS"
256 QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
257 QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
258 QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
259 QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
260 QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/fpu"
261 LDFLAGS="-g $LDFLAGS"
263 # make source path absolute
264 source_path=`cd "$source_path"; pwd`
266 check_define() {
267 cat > $TMPC <<EOF
268 #if !defined($1)
269 #error $1 not defined
270 #endif
271 int main(void) { return 0; }
273 compile_object
276 if test ! -z "$cpu" ; then
277 # command line argument
279 elif check_define __i386__ ; then
280 cpu="i386"
281 elif check_define __x86_64__ ; then
282 cpu="x86_64"
283 elif check_define __sparc__ ; then
284 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
285 # They must be specified using --sparc_cpu
286 if check_define __arch64__ ; then
287 cpu="sparc64"
288 else
289 cpu="sparc"
291 elif check_define _ARCH_PPC ; then
292 if check_define _ARCH_PPC64 ; then
293 cpu="ppc64"
294 else
295 cpu="ppc"
297 elif check_define __mips__ ; then
298 cpu="mips"
299 elif check_define __ia64__ ; then
300 cpu="ia64"
301 elif check_define __s390__ ; then
302 if check_define __s390x__ ; then
303 cpu="s390x"
304 else
305 cpu="s390"
307 elif check_define __arm__ ; then
308 cpu="arm"
309 elif check_define __hppa__ ; then
310 cpu="hppa"
311 else
312 cpu=`uname -m`
315 ARCH=
316 # Normalise host CPU name and set ARCH.
317 # Note that this case should only have supported host CPUs, not guests.
318 case "$cpu" in
319 ia64|ppc|ppc64|s390|s390x|sparc64)
320 cpu="$cpu"
322 i386|i486|i586|i686|i86pc|BePC)
323 cpu="i386"
325 x86_64|amd64)
326 cpu="x86_64"
328 armv*b|armv*l|arm)
329 cpu="arm"
331 hppa|parisc|parisc64)
332 cpu="hppa"
334 mips*)
335 cpu="mips"
337 sparc|sun4[cdmuv])
338 cpu="sparc"
341 # This will result in either an error or falling back to TCI later
342 ARCH=unknown
344 esac
345 if test -z "$ARCH"; then
346 ARCH="$cpu"
349 # OS specific
350 if check_define __linux__ ; then
351 targetos="Linux"
352 elif check_define _WIN32 ; then
353 targetos='MINGW32'
354 elif check_define __OpenBSD__ ; then
355 targetos='OpenBSD'
356 elif check_define __sun__ ; then
357 targetos='SunOS'
358 elif check_define __HAIKU__ ; then
359 targetos='Haiku'
360 else
361 targetos=`uname -s`
364 case $targetos in
365 CYGWIN*)
366 mingw32="yes"
367 QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
368 audio_possible_drivers="winwave sdl"
369 audio_drv_list="winwave"
371 MINGW32*)
372 mingw32="yes"
373 audio_possible_drivers="winwave dsound sdl fmod"
374 audio_drv_list="winwave"
376 GNU/kFreeBSD)
377 bsd="yes"
378 audio_drv_list="oss"
379 audio_possible_drivers="oss sdl esd pa"
381 FreeBSD)
382 bsd="yes"
383 make="${MAKE-gmake}"
384 audio_drv_list="oss"
385 audio_possible_drivers="oss sdl esd pa"
386 # needed for kinfo_getvmmap(3) in libutil.h
387 LIBS="-lutil $LIBS"
389 DragonFly)
390 bsd="yes"
391 make="${MAKE-gmake}"
392 audio_drv_list="oss"
393 audio_possible_drivers="oss sdl esd pa"
395 NetBSD)
396 bsd="yes"
397 make="${MAKE-gmake}"
398 audio_drv_list="oss"
399 audio_possible_drivers="oss sdl esd"
400 oss_lib="-lossaudio"
402 OpenBSD)
403 bsd="yes"
404 make="${MAKE-gmake}"
405 audio_drv_list="oss"
406 audio_possible_drivers="oss sdl esd"
407 oss_lib="-lossaudio"
409 Darwin)
410 bsd="yes"
411 darwin="yes"
412 # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can
413 # run 64-bit userspace code
414 if [ "$cpu" = "i386" ] ; then
415 is_x86_64=`sysctl -n hw.optional.x86_64`
416 [ "$is_x86_64" = "1" ] && cpu=x86_64
418 if [ "$cpu" = "x86_64" ] ; then
419 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
420 LDFLAGS="-arch x86_64 $LDFLAGS"
421 else
422 QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
424 darwin_user="yes"
425 cocoa="yes"
426 audio_drv_list="coreaudio"
427 audio_possible_drivers="coreaudio sdl fmod"
428 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
429 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
431 SunOS)
432 solaris="yes"
433 make="${MAKE-gmake}"
434 install="${INSTALL-ginstall}"
435 ld="gld"
436 smbd="${SMBD-/usr/sfw/sbin/smbd}"
437 needs_libsunmath="no"
438 solarisrev=`uname -r | cut -f2 -d.`
439 # have to select again, because `uname -m` returns i86pc
440 # even on an x86_64 box.
441 solariscpu=`isainfo -k`
442 if test "${solariscpu}" = "amd64" ; then
443 cpu="x86_64"
445 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
446 if test "$solarisrev" -le 9 ; then
447 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
448 needs_libsunmath="yes"
449 QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
450 LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
451 LIBS="-lsunmath $LIBS"
452 else
453 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
454 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
455 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
456 echo "Studio 11 can be downloaded from www.sun.com."
457 exit 1
461 if test -f /usr/include/sys/soundcard.h ; then
462 audio_drv_list="oss"
464 audio_possible_drivers="oss sdl"
465 # needed for CMSG_ macros in sys/socket.h
466 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
467 # needed for TIOCWIN* defines in termios.h
468 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
469 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
470 LIBS="-lsocket -lnsl -lresolv $LIBS"
472 AIX)
473 aix="yes"
474 make="${MAKE-gmake}"
476 Haiku)
477 haiku="yes"
478 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
479 LIBS="-lposix_error_mapper -lnetwork $LIBS"
482 audio_drv_list="oss"
483 audio_possible_drivers="oss alsa sdl esd pa"
484 linux="yes"
485 linux_user="yes"
486 usb="linux"
487 kvm="yes"
488 vhost_net="yes"
489 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
490 audio_possible_drivers="$audio_possible_drivers fmod"
493 esac
495 if [ "$bsd" = "yes" ] ; then
496 if [ "$darwin" != "yes" ] ; then
497 usb="bsd"
499 bsd_user="yes"
502 : ${make=${MAKE-make}}
503 : ${install=${INSTALL-install}}
504 : ${python=${PYTHON-python}}
505 : ${smbd=${SMBD-/usr/sbin/smbd}}
507 if test "$mingw32" = "yes" ; then
508 EXESUF=".exe"
509 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
510 # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
511 QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
512 LIBS="-lwinmm -lws2_32 -liberty -liphlpapi $LIBS"
513 prefix="c:/Program Files/Qemu"
514 mandir="\${prefix}"
515 datadir="\${prefix}"
516 docdir="\${prefix}"
517 bindir="\${prefix}"
518 sysconfdir="\${prefix}"
519 confsuffix=""
520 guest_agent="no"
523 werror=""
525 for opt do
526 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
527 case "$opt" in
528 --help|-h) show_help=yes
530 --version|-V) exec cat $source_path/VERSION
532 --prefix=*) prefix="$optarg"
534 --interp-prefix=*) interp_prefix="$optarg"
536 --source-path=*)
538 --cross-prefix=*)
540 --cc=*)
542 --host-cc=*) host_cc="$optarg"
544 --make=*) make="$optarg"
546 --install=*) install="$optarg"
548 --python=*) python="$optarg"
550 --smbd=*) smbd="$optarg"
552 --extra-cflags=*)
554 --extra-ldflags=*)
556 --cpu=*)
558 --target-list=*) target_list="$optarg"
560 --enable-trace-backend=*) trace_backend="$optarg"
562 --with-trace-file=*) trace_file="$optarg"
564 --enable-gprof) gprof="yes"
566 --static)
567 static="yes"
568 LDFLAGS="-static $LDFLAGS"
570 --mandir=*) mandir="$optarg"
572 --bindir=*) bindir="$optarg"
574 --libdir=*) libdir="$optarg"
576 --includedir=*) includedir="$optarg"
578 --datadir=*) datadir="$optarg"
580 --docdir=*) docdir="$optarg"
582 --sysconfdir=*) sysconfdir="$optarg"
584 --sbindir=*|--libexecdir=*|--sharedstatedir=*|--localstatedir=*|\
585 --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
586 --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
587 # These switches are silently ignored, for compatibility with
588 # autoconf-generated configure scripts. This allows QEMU's
589 # configure to be used by RPM and similar macros that set
590 # lots of directory switches by default.
592 --disable-sdl) sdl="no"
594 --enable-sdl) sdl="yes"
596 --disable-vnc) vnc="no"
598 --enable-vnc) vnc="yes"
600 --fmod-lib=*) fmod_lib="$optarg"
602 --fmod-inc=*) fmod_inc="$optarg"
604 --oss-lib=*) oss_lib="$optarg"
606 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
608 --audio-drv-list=*) audio_drv_list="$optarg"
610 --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
612 --enable-debug-tcg) debug_tcg="yes"
614 --disable-debug-tcg) debug_tcg="no"
616 --enable-debug-mon) debug_mon="yes"
618 --disable-debug-mon) debug_mon="no"
620 --enable-debug)
621 # Enable debugging options that aren't excessively noisy
622 debug_tcg="yes"
623 debug_mon="yes"
624 debug="yes"
625 strip_opt="no"
627 --enable-sparse) sparse="yes"
629 --disable-sparse) sparse="no"
631 --disable-strip) strip_opt="no"
633 --disable-vnc-tls) vnc_tls="no"
635 --enable-vnc-tls) vnc_tls="yes"
637 --disable-vnc-sasl) vnc_sasl="no"
639 --enable-vnc-sasl) vnc_sasl="yes"
641 --disable-vnc-jpeg) vnc_jpeg="no"
643 --enable-vnc-jpeg) vnc_jpeg="yes"
645 --disable-vnc-png) vnc_png="no"
647 --enable-vnc-png) vnc_png="yes"
649 --disable-vnc-thread) vnc_thread="no"
651 --enable-vnc-thread) vnc_thread="yes"
653 --disable-slirp) slirp="no"
655 --disable-uuid) uuid="no"
657 --enable-uuid) uuid="yes"
659 --disable-vde) vde="no"
661 --enable-vde) vde="yes"
663 --disable-xen) xen="no"
665 --enable-xen) xen="yes"
667 --disable-brlapi) brlapi="no"
669 --enable-brlapi) brlapi="yes"
671 --disable-bluez) bluez="no"
673 --enable-bluez) bluez="yes"
675 --disable-kvm) kvm="no"
677 --enable-kvm) kvm="yes"
679 --disable-tcg-interpreter) tcg_interpreter="no"
681 --enable-tcg-interpreter) tcg_interpreter="yes"
683 --disable-kvm-pit) kvm_cap_pit="no"
685 --enable-kvm-pit) kvm_cap_pit="yes"
687 --disable-kvm-device-assignment) kvm_cap_device_assignment="no"
689 --enable-kvm-device-assignment) kvm_cap_device_assignment="yes"
691 --disable-spice) spice="no"
693 --enable-spice) spice="yes"
695 --disable-libiscsi) libiscsi="no"
697 --enable-libiscsi) libiscsi="yes"
699 --enable-profiler) profiler="yes"
701 --enable-cocoa)
702 cocoa="yes" ;
703 sdl="no" ;
704 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
706 --disable-system) softmmu="no"
708 --enable-system) softmmu="yes"
710 --disable-user)
711 linux_user="no" ;
712 bsd_user="no" ;
713 darwin_user="no"
715 --enable-user) ;;
716 --disable-linux-user) linux_user="no"
718 --enable-linux-user) linux_user="yes"
720 --disable-darwin-user) darwin_user="no"
722 --enable-darwin-user) darwin_user="yes"
724 --disable-bsd-user) bsd_user="no"
726 --enable-bsd-user) bsd_user="yes"
728 --enable-guest-base) guest_base="yes"
730 --disable-guest-base) guest_base="no"
732 --enable-pie) pie="yes"
734 --disable-pie) pie="no"
736 --enable-uname-release=*) uname_release="$optarg"
738 --sparc_cpu=*)
740 --enable-werror) werror="yes"
742 --disable-werror) werror="no"
744 --disable-curses) curses="no"
746 --enable-curses) curses="yes"
748 --disable-curl) curl="no"
750 --enable-curl) curl="yes"
752 --disable-fdt) fdt="no"
754 --enable-fdt) fdt="yes"
756 --disable-nptl) nptl="no"
758 --enable-nptl) nptl="yes"
760 --enable-mixemu) mixemu="yes"
762 --disable-linux-aio) linux_aio="no"
764 --enable-linux-aio) linux_aio="yes"
766 --disable-attr) attr="no"
768 --enable-attr) attr="yes"
770 --disable-blobs) blobs="no"
772 --with-pkgversion=*) pkgversion=" ($optarg)"
774 --disable-docs) docs="no"
776 --enable-docs) docs="yes"
778 --disable-cpu-emulation) cpu_emulation="no"
780 --disable-vhost-net) vhost_net="no"
782 --enable-vhost-net) vhost_net="yes"
784 --disable-opengl) opengl="no"
786 --enable-opengl) opengl="yes"
788 --disable-rbd) rbd="no"
790 --enable-rbd) rbd="yes"
792 --disable-xfsctl) xfs="no"
794 --enable-xfsctl) xfs="yes"
796 --disable-smartcard) smartcard="no"
798 --enable-smartcard) smartcard="yes"
800 --disable-smartcard-nss) smartcard_nss="no"
802 --enable-smartcard-nss) smartcard_nss="yes"
804 --disable-usb-redir) usb_redir="no"
806 --enable-usb-redir) usb_redir="yes"
808 --disable-zlib-test) zlib="no"
810 --enable-guest-agent) guest_agent="yes"
812 --disable-guest-agent) guest_agent="no"
814 *) echo "ERROR: unknown option $opt"; show_help="yes"
816 esac
817 done
820 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
821 # QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
823 host_guest_base="no"
824 case "$cpu" in
825 sparc) case $sparc_cpu in
826 v7|v8)
827 QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
829 v8plus|v8plusa)
830 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
832 *) # sparc_cpu not defined in the command line
833 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
834 esac
835 LDFLAGS="-m32 $LDFLAGS"
836 QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
837 if test "$solaris" = "no" ; then
838 QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
839 helper_cflags="-ffixed-i0"
842 sparc64)
843 QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
844 LDFLAGS="-m64 $LDFLAGS"
845 QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
846 if test "$solaris" != "no" ; then
847 QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
850 s390)
851 QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS"
852 LDFLAGS="-m31 $LDFLAGS"
853 host_guest_base="yes"
855 s390x)
856 QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS"
857 LDFLAGS="-m64 $LDFLAGS"
858 host_guest_base="yes"
860 i386)
861 QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
862 LDFLAGS="-m32 $LDFLAGS"
863 cc_i386='$(CC) -m32'
864 helper_cflags="-fomit-frame-pointer"
865 host_guest_base="yes"
867 x86_64)
868 QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
869 LDFLAGS="-m64 $LDFLAGS"
870 cc_i386='$(CC) -m32'
871 host_guest_base="yes"
873 arm*)
874 host_guest_base="yes"
876 ppc*)
877 host_guest_base="yes"
879 mips*)
880 host_guest_base="yes"
882 ia64*)
883 host_guest_base="yes"
885 hppa*)
886 host_guest_base="yes"
888 unicore32*)
889 host_guest_base="yes"
891 esac
893 [ -z "$guest_base" ] && guest_base="$host_guest_base"
896 default_target_list=""
898 # these targets are portable
899 if [ "$softmmu" = "yes" ] ; then
900 default_target_list="\
901 i386-softmmu \
902 x86_64-softmmu \
903 alpha-softmmu \
904 arm-softmmu \
905 cris-softmmu \
906 lm32-softmmu \
907 m68k-softmmu \
908 microblaze-softmmu \
909 microblazeel-softmmu \
910 mips-softmmu \
911 mipsel-softmmu \
912 mips64-softmmu \
913 mips64el-softmmu \
914 ppc-softmmu \
915 ppcemb-softmmu \
916 ppc64-softmmu \
917 sh4-softmmu \
918 sh4eb-softmmu \
919 sparc-softmmu \
920 sparc64-softmmu \
921 s390x-softmmu \
922 xtensa-softmmu \
923 xtensaeb-softmmu \
926 # the following are Linux specific
927 if [ "$linux_user" = "yes" ] ; then
928 default_target_list="${default_target_list}\
929 i386-linux-user \
930 x86_64-linux-user \
931 alpha-linux-user \
932 arm-linux-user \
933 armeb-linux-user \
934 cris-linux-user \
935 m68k-linux-user \
936 microblaze-linux-user \
937 microblazeel-linux-user \
938 mips-linux-user \
939 mipsel-linux-user \
940 ppc-linux-user \
941 ppc64-linux-user \
942 ppc64abi32-linux-user \
943 sh4-linux-user \
944 sh4eb-linux-user \
945 sparc-linux-user \
946 sparc64-linux-user \
947 sparc32plus-linux-user \
948 unicore32-linux-user \
949 s390x-linux-user \
952 # the following are Darwin specific
953 if [ "$darwin_user" = "yes" ] ; then
954 default_target_list="$default_target_list i386-darwin-user ppc-darwin-user "
956 # the following are BSD specific
957 if [ "$bsd_user" = "yes" ] ; then
958 default_target_list="${default_target_list}\
959 i386-bsd-user \
960 x86_64-bsd-user \
961 sparc-bsd-user \
962 sparc64-bsd-user \
966 if test x"$show_help" = x"yes" ; then
967 cat << EOF
969 Usage: configure [options]
970 Options: [defaults in brackets after descriptions]
973 echo "Standard options:"
974 echo " --help print this message"
975 echo " --prefix=PREFIX install in PREFIX [$prefix]"
976 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
977 echo " use %M for cpu name [$interp_prefix]"
978 echo " --target-list=LIST set target list (default: build everything)"
979 echo "Available targets: $default_target_list" | \
980 fold -s -w 53 | sed -e 's/^/ /'
981 echo ""
982 echo "Advanced options (experts only):"
983 echo " --source-path=PATH path of source code [$source_path]"
984 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
985 echo " --cc=CC use C compiler CC [$cc]"
986 echo " --host-cc=CC use C compiler CC [$host_cc] for code run at"
987 echo " build time"
988 echo " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS"
989 echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS"
990 echo " --make=MAKE use specified make [$make]"
991 echo " --install=INSTALL use specified install [$install]"
992 echo " --python=PYTHON use specified python [$python]"
993 echo " --smbd=SMBD use specified smbd [$smbd]"
994 echo " --static enable static build [$static]"
995 echo " --mandir=PATH install man pages in PATH"
996 echo " --datadir=PATH install firmware in PATH"
997 echo " --docdir=PATH install documentation in PATH"
998 echo " --bindir=PATH install binaries in PATH"
999 echo " --sysconfdir=PATH install config in PATH/qemu"
1000 echo " --enable-debug-tcg enable TCG debugging"
1001 echo " --disable-debug-tcg disable TCG debugging (default)"
1002 echo " --enable-debug enable common debug build options"
1003 echo " --enable-sparse enable sparse checker"
1004 echo " --disable-sparse disable sparse checker (default)"
1005 echo " --disable-strip disable stripping binaries"
1006 echo " --disable-werror disable compilation abort on warning"
1007 echo " --disable-sdl disable SDL"
1008 echo " --enable-sdl enable SDL"
1009 echo " --disable-vnc disable VNC"
1010 echo " --enable-vnc enable VNC"
1011 echo " --enable-cocoa enable COCOA (Mac OS X only)"
1012 echo " --audio-drv-list=LIST set audio drivers list:"
1013 echo " Available drivers: $audio_possible_drivers"
1014 echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
1015 echo " Available cards: $audio_possible_cards"
1016 echo " --block-drv-whitelist=L set block driver whitelist"
1017 echo " (affects only QEMU, not qemu-img)"
1018 echo " --enable-mixemu enable mixer emulation"
1019 echo " --disable-xen disable xen backend driver support"
1020 echo " --enable-xen enable xen backend driver support"
1021 echo " --disable-brlapi disable BrlAPI"
1022 echo " --enable-brlapi enable BrlAPI"
1023 echo " --disable-vnc-tls disable TLS encryption for VNC server"
1024 echo " --enable-vnc-tls enable TLS encryption for VNC server"
1025 echo " --disable-vnc-sasl disable SASL encryption for VNC server"
1026 echo " --enable-vnc-sasl enable SASL encryption for VNC server"
1027 echo " --disable-vnc-jpeg disable JPEG lossy compression for VNC server"
1028 echo " --enable-vnc-jpeg enable JPEG lossy compression for VNC server"
1029 echo " --disable-vnc-png disable PNG compression for VNC server (default)"
1030 echo " --enable-vnc-png enable PNG compression for VNC server"
1031 echo " --disable-vnc-thread disable threaded VNC server"
1032 echo " --enable-vnc-thread enable threaded VNC server"
1033 echo " --disable-curses disable curses output"
1034 echo " --enable-curses enable curses output"
1035 echo " --disable-curl disable curl connectivity"
1036 echo " --enable-curl enable curl connectivity"
1037 echo " --disable-fdt disable fdt device tree"
1038 echo " --enable-fdt enable fdt device tree"
1039 echo " --disable-bluez disable bluez stack connectivity"
1040 echo " --enable-bluez enable bluez stack connectivity"
1041 echo " --disable-slirp disable SLIRP userspace network connectivity"
1042 echo " --disable-kvm disable KVM acceleration support"
1043 echo " --enable-kvm enable KVM acceleration support"
1044 echo " --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)"
1045 echo " --disable-kvm-pit disable KVM pit support"
1046 echo " --enable-kvm-pit enable KVM pit support"
1047 echo " --disable-kvm-device-assignment disable KVM device assignment support"
1048 echo " --enable-kvm-device-assignment enable KVM device assignment support"
1049 echo " --disable-nptl disable usermode NPTL support"
1050 echo " --enable-nptl enable usermode NPTL support"
1051 echo " --enable-system enable all system emulation targets"
1052 echo " --disable-system disable all system emulation targets"
1053 echo " --enable-user enable supported user emulation targets"
1054 echo " --disable-user disable all user emulation targets"
1055 echo " --enable-linux-user enable all linux usermode emulation targets"
1056 echo " --disable-linux-user disable all linux usermode emulation targets"
1057 echo " --enable-darwin-user enable all darwin usermode emulation targets"
1058 echo " --disable-darwin-user disable all darwin usermode emulation targets"
1059 echo " --enable-bsd-user enable all BSD usermode emulation targets"
1060 echo " --disable-bsd-user disable all BSD usermode emulation targets"
1061 echo " --enable-guest-base enable GUEST_BASE support for usermode"
1062 echo " emulation targets"
1063 echo " --disable-guest-base disable GUEST_BASE support"
1064 echo " --enable-pie build Position Independent Executables"
1065 echo " --disable-pie do not build Position Independent Executables"
1066 echo " --fmod-lib path to FMOD library"
1067 echo " --fmod-inc path to FMOD includes"
1068 echo " --oss-lib path to OSS library"
1069 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
1070 echo " --cpu=CPU Build for host CPU [$cpu]"
1071 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
1072 echo " --disable-uuid disable uuid support"
1073 echo " --enable-uuid enable uuid support"
1074 echo " --disable-vde disable support for vde network"
1075 echo " --enable-vde enable support for vde network"
1076 echo " --disable-linux-aio disable Linux AIO support"
1077 echo " --enable-linux-aio enable Linux AIO support"
1078 echo " --disable-attr disables attr and xattr support"
1079 echo " --enable-attr enable attr and xattr support"
1080 echo " --disable-blobs disable installing provided firmware blobs"
1081 echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
1082 echo " --enable-docs enable documentation build"
1083 echo " --disable-docs disable documentation build"
1084 echo " --disable-vhost-net disable vhost-net acceleration support"
1085 echo " --enable-vhost-net enable vhost-net acceleration support"
1086 echo " --enable-trace-backend=B Set trace backend"
1087 echo " Available backends:" $("$source_path"/scripts/tracetool --list-backends)
1088 echo " --with-trace-file=NAME Full PATH,NAME of file to store traces"
1089 echo " Default:trace-<pid>"
1090 echo " --disable-spice disable spice"
1091 echo " --enable-spice enable spice"
1092 echo " --enable-rbd enable building the rados block device (rbd)"
1093 echo " --disable-libiscsi disable iscsi support"
1094 echo " --enable-libiscsi enable iscsi support"
1095 echo " --disable-smartcard disable smartcard support"
1096 echo " --enable-smartcard enable smartcard support"
1097 echo " --disable-smartcard-nss disable smartcard nss support"
1098 echo " --enable-smartcard-nss enable smartcard nss support"
1099 echo " --disable-usb-redir disable usb network redirection support"
1100 echo " --enable-usb-redir enable usb network redirection support"
1101 echo " --disable-guest-agent disable building of the QEMU Guest Agent"
1102 echo " --enable-guest-agent enable building of the QEMU Guest Agent"
1103 echo ""
1104 echo "NOTE: The object files are built at the place where configure is launched"
1105 exit 1
1108 # Now we have handled --enable-tcg-interpreter and know we're not just
1109 # printing the help message, bail out if the host CPU isn't supported.
1110 if test "$ARCH" = "unknown"; then
1111 if test "$tcg_interpreter" = "yes" ; then
1112 echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
1113 ARCH=tci
1114 else
1115 echo "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
1116 exit 1
1120 # check that the C compiler works.
1121 cat > $TMPC <<EOF
1122 int main(void) { return 0; }
1125 if compile_object ; then
1126 : C compiler works ok
1127 else
1128 echo "ERROR: \"$cc\" either does not exist or does not work"
1129 exit 1
1132 gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
1133 gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
1134 gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
1135 gcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags"
1136 cat > $TMPC << EOF
1137 int main(void) { return 0; }
1139 for flag in $gcc_flags; do
1140 if compile_prog "-Werror $flag" "" ; then
1141 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1143 done
1145 if test "$static" = "yes" ; then
1146 if test "$pie" = "yes" ; then
1147 echo "static and pie are mutually incompatible"
1148 exit 1
1149 else
1150 pie="no"
1154 if test "$pie" = ""; then
1155 case "$cpu-$targetos" in
1156 i386-Linux|x86_64-Linux|i386-OpenBSD|x86_64-OpenBSD)
1159 pie="no"
1161 esac
1164 if test "$pie" != "no" ; then
1165 cat > $TMPC << EOF
1167 #ifdef __linux__
1168 # define THREAD __thread
1169 #else
1170 # define THREAD
1171 #endif
1173 static THREAD int tls_var;
1175 int main(void) { return tls_var; }
1178 if compile_prog "-fPIE -DPIE" "-pie"; then
1179 QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
1180 LDFLAGS="-pie $LDFLAGS"
1181 pie="yes"
1182 if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
1183 LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
1185 else
1186 if test "$pie" = "yes"; then
1187 echo "PIE not available due to missing toolchain support"
1188 exit 1
1189 else
1190 echo "Disabling PIE due to missing toolchain support"
1191 pie="no"
1197 # Solaris specific configure tool chain decisions
1199 if test "$solaris" = "yes" ; then
1200 if has $install; then
1202 else
1203 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
1204 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
1205 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
1206 exit 1
1208 if test "`path_of $install`" = "/usr/sbin/install" ; then
1209 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
1210 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
1211 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
1212 exit 1
1214 if has ar; then
1216 else
1217 echo "Error: No path includes ar"
1218 if test -f /usr/ccs/bin/ar ; then
1219 echo "Add /usr/ccs/bin to your path and rerun configure"
1221 exit 1
1225 if ! has $python; then
1226 echo "Python not found. Use --python=/path/to/python"
1227 exit 1
1230 if test -z "$target_list" ; then
1231 target_list="$default_target_list"
1232 else
1233 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
1235 if test -z "$target_list" ; then
1236 echo "No targets enabled"
1237 exit 1
1239 # see if system emulation was really requested
1240 case " $target_list " in
1241 *"-softmmu "*) softmmu=yes
1243 *) softmmu=no
1245 esac
1247 feature_not_found() {
1248 feature=$1
1250 echo "ERROR"
1251 echo "ERROR: User requested feature $feature"
1252 echo "ERROR: configure was not able to find it"
1253 echo "ERROR"
1254 exit 1;
1257 if test -z "$cross_prefix" ; then
1259 # ---
1260 # big/little endian test
1261 cat > $TMPC << EOF
1262 #include <inttypes.h>
1263 int main(int argc, char ** argv){
1264 volatile uint32_t i=0x01234567;
1265 return (*((uint8_t*)(&i))) == 0x67;
1269 if compile_prog "" "" ; then
1270 $TMPE && bigendian="yes"
1271 else
1272 echo big/little test failed
1275 else
1277 # if cross compiling, cannot launch a program, so make a static guess
1278 case "$cpu" in
1279 arm)
1280 # ARM can be either way; ask the compiler which one we are
1281 if check_define __ARMEB__; then
1282 bigendian=yes
1285 hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
1286 bigendian=yes
1288 esac
1292 # host long bits test, actually a pointer size test
1293 cat > $TMPC << EOF
1294 int sizeof_pointer_is_8[sizeof(void *) == 8 ? 1 : -1];
1296 if compile_object; then
1297 hostlongbits=64
1298 else
1299 hostlongbits=32
1303 ##########################################
1304 # NPTL probe
1306 if test "$nptl" != "no" ; then
1307 cat > $TMPC <<EOF
1308 #include <sched.h>
1309 #include <linux/futex.h>
1310 int main(void) {
1311 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1312 #error bork
1313 #endif
1314 return 0;
1318 if compile_object ; then
1319 nptl=yes
1320 else
1321 if test "$nptl" = "yes" ; then
1322 feature_not_found "nptl"
1324 nptl=no
1328 ##########################################
1329 # zlib check
1331 if test "$zlib" != "no" ; then
1332 cat > $TMPC << EOF
1333 #include <zlib.h>
1334 int main(void) { zlibVersion(); return 0; }
1336 if compile_prog "" "-lz" ; then
1338 else
1339 echo
1340 echo "Error: zlib check failed"
1341 echo "Make sure to have the zlib libs and headers installed."
1342 echo
1343 exit 1
1347 ##########################################
1348 # xen probe
1350 if test "$xen" != "no" ; then
1351 xen_libs="-lxenstore -lxenctrl -lxenguest"
1353 # First we test whether Xen headers and libraries are available.
1354 # If no, we are done and there is no Xen support.
1355 # If yes, more tests are run to detect the Xen version.
1357 # Xen (any)
1358 cat > $TMPC <<EOF
1359 #include <xenctrl.h>
1360 #include <xs.h>
1361 int main(void) {
1362 return 0;
1365 if ! compile_prog "" "$xen_libs" ; then
1366 # Xen not found
1367 if test "$xen" = "yes" ; then
1368 feature_not_found "xen"
1370 xen=no
1372 # Xen unstable
1373 elif (
1374 cat > $TMPC <<EOF
1375 #include <xenctrl.h>
1376 #include <xs.h>
1377 #include <stdint.h>
1378 #include <xen/hvm/hvm_info_table.h>
1379 #if !defined(HVM_MAX_VCPUS)
1380 # error HVM_MAX_VCPUS not defined
1381 #endif
1382 int main(void) {
1383 xc_interface *xc;
1384 xs_daemon_open();
1385 xc = xc_interface_open(0, 0, 0);
1386 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1387 xc_gnttab_open(NULL, 0);
1388 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1389 return 0;
1392 compile_prog "" "$xen_libs"
1393 ) ; then
1394 xen_ctrl_version=410
1395 xen=yes
1397 # Xen 4.0.0
1398 elif (
1399 cat > $TMPC <<EOF
1400 #include <xenctrl.h>
1401 #include <xs.h>
1402 #include <stdint.h>
1403 #include <xen/hvm/hvm_info_table.h>
1404 #if !defined(HVM_MAX_VCPUS)
1405 # error HVM_MAX_VCPUS not defined
1406 #endif
1407 int main(void) {
1408 struct xen_add_to_physmap xatp = {
1409 .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1411 xs_daemon_open();
1412 xc_interface_open();
1413 xc_gnttab_open();
1414 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1415 xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1416 return 0;
1419 compile_prog "" "$xen_libs"
1420 ) ; then
1421 xen_ctrl_version=400
1422 xen=yes
1424 # Xen 3.4.0
1425 elif (
1426 cat > $TMPC <<EOF
1427 #include <xenctrl.h>
1428 #include <xs.h>
1429 int main(void) {
1430 struct xen_add_to_physmap xatp = {
1431 .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1433 xs_daemon_open();
1434 xc_interface_open();
1435 xc_gnttab_open();
1436 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1437 xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1438 return 0;
1441 compile_prog "" "$xen_libs"
1442 ) ; then
1443 xen_ctrl_version=340
1444 xen=yes
1446 # Xen 3.3.0
1447 elif (
1448 cat > $TMPC <<EOF
1449 #include <xenctrl.h>
1450 #include <xs.h>
1451 int main(void) {
1452 xs_daemon_open();
1453 xc_interface_open();
1454 xc_gnttab_open();
1455 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1456 return 0;
1459 compile_prog "" "$xen_libs"
1460 ) ; then
1461 xen_ctrl_version=330
1462 xen=yes
1464 # Xen version unsupported
1465 else
1466 if test "$xen" = "yes" ; then
1467 feature_not_found "xen (unsupported version)"
1469 xen=no
1472 if test "$xen" = yes; then
1473 libs_softmmu="$xen_libs $libs_softmmu"
1477 ##########################################
1478 # pkg-config probe
1480 if ! has $pkg_config; then
1481 echo "Error: pkg-config binary '$pkg_config' not found"
1482 exit 1
1485 ##########################################
1486 # libtool probe
1488 if ! has $libtool; then
1489 libtool=
1492 ##########################################
1493 # Sparse probe
1494 if test "$sparse" != "no" ; then
1495 if has cgcc; then
1496 sparse=yes
1497 else
1498 if test "$sparse" = "yes" ; then
1499 feature_not_found "sparse"
1501 sparse=no
1505 ##########################################
1506 # SDL probe
1508 # Look for sdl configuration program (pkg-config or sdl-config). Try
1509 # sdl-config even without cross prefix, and favour pkg-config over sdl-config.
1510 if test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then
1511 sdl_config=sdl-config
1514 if $pkg_config sdl --modversion >/dev/null 2>&1; then
1515 sdlconfig="$pkg_config sdl"
1516 _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
1517 elif has ${sdl_config}; then
1518 sdlconfig="$sdl_config"
1519 _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1520 else
1521 if test "$sdl" = "yes" ; then
1522 feature_not_found "sdl"
1524 sdl=no
1526 if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
1527 echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
1530 sdl_too_old=no
1531 if test "$sdl" != "no" ; then
1532 cat > $TMPC << EOF
1533 #include <SDL.h>
1534 #undef main /* We don't want SDL to override our main() */
1535 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1537 sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
1538 if test "$static" = "yes" ; then
1539 sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
1540 else
1541 sdl_libs=`$sdlconfig --libs 2> /dev/null`
1543 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1544 if test "$_sdlversion" -lt 121 ; then
1545 sdl_too_old=yes
1546 else
1547 if test "$cocoa" = "no" ; then
1548 sdl=yes
1552 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
1553 if test "$sdl" = "yes" -a "$static" = "yes" ; then
1554 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
1555 sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1556 sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
1558 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1560 else
1561 sdl=no
1563 fi # static link
1564 else # sdl not found
1565 if test "$sdl" = "yes" ; then
1566 feature_not_found "sdl"
1568 sdl=no
1569 fi # sdl compile test
1572 if test "$sdl" = "yes" ; then
1573 cat > $TMPC <<EOF
1574 #include <SDL.h>
1575 #if defined(SDL_VIDEO_DRIVER_X11)
1576 #include <X11/XKBlib.h>
1577 #else
1578 #error No x11 support
1579 #endif
1580 int main(void) { return 0; }
1582 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1583 sdl_libs="$sdl_libs -lX11"
1585 libs_softmmu="$sdl_libs $libs_softmmu"
1588 ##########################################
1589 # VNC TLS detection
1590 if test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then
1591 cat > $TMPC <<EOF
1592 #include <gnutls/gnutls.h>
1593 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1595 vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
1596 vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
1597 if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
1598 vnc_tls=yes
1599 libs_softmmu="$vnc_tls_libs $libs_softmmu"
1600 else
1601 if test "$vnc_tls" = "yes" ; then
1602 feature_not_found "vnc-tls"
1604 vnc_tls=no
1608 ##########################################
1609 # VNC SASL detection
1610 if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
1611 cat > $TMPC <<EOF
1612 #include <sasl/sasl.h>
1613 #include <stdio.h>
1614 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
1616 # Assuming Cyrus-SASL installed in /usr prefix
1617 vnc_sasl_cflags=""
1618 vnc_sasl_libs="-lsasl2"
1619 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1620 vnc_sasl=yes
1621 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
1622 else
1623 if test "$vnc_sasl" = "yes" ; then
1624 feature_not_found "vnc-sasl"
1626 vnc_sasl=no
1630 ##########################################
1631 # VNC JPEG detection
1632 if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
1633 cat > $TMPC <<EOF
1634 #include <stdio.h>
1635 #include <jpeglib.h>
1636 int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
1638 vnc_jpeg_cflags=""
1639 vnc_jpeg_libs="-ljpeg"
1640 if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
1641 vnc_jpeg=yes
1642 libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
1643 else
1644 if test "$vnc_jpeg" = "yes" ; then
1645 feature_not_found "vnc-jpeg"
1647 vnc_jpeg=no
1651 ##########################################
1652 # VNC PNG detection
1653 if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
1654 cat > $TMPC <<EOF
1655 //#include <stdio.h>
1656 #include <png.h>
1657 #include <stddef.h>
1658 int main(void) {
1659 png_structp png_ptr;
1660 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
1661 return 0;
1664 if $pkg_config libpng --modversion >/dev/null 2>&1; then
1665 vnc_png_cflags=`$pkg_config libpng --cflags 2> /dev/null`
1666 vnc_png_libs=`$pkg_config libpng --libs 2> /dev/null`
1667 else
1668 vnc_png_cflags=""
1669 vnc_png_libs="-lpng"
1671 if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
1672 vnc_png=yes
1673 libs_softmmu="$vnc_png_libs $libs_softmmu"
1674 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
1675 else
1676 if test "$vnc_png" = "yes" ; then
1677 feature_not_found "vnc-png"
1679 vnc_png=no
1683 ##########################################
1684 # fnmatch() probe, used for ACL routines
1685 fnmatch="no"
1686 cat > $TMPC << EOF
1687 #include <fnmatch.h>
1688 int main(void)
1690 fnmatch("foo", "foo", 0);
1691 return 0;
1694 if compile_prog "" "" ; then
1695 fnmatch="yes"
1698 ##########################################
1699 # uuid_generate() probe, used for vdi block driver
1700 if test "$uuid" != "no" ; then
1701 uuid_libs="-luuid"
1702 cat > $TMPC << EOF
1703 #include <uuid/uuid.h>
1704 int main(void)
1706 uuid_t my_uuid;
1707 uuid_generate(my_uuid);
1708 return 0;
1711 if compile_prog "" "$uuid_libs" ; then
1712 uuid="yes"
1713 libs_softmmu="$uuid_libs $libs_softmmu"
1714 libs_tools="$uuid_libs $libs_tools"
1715 else
1716 if test "$uuid" = "yes" ; then
1717 feature_not_found "uuid"
1719 uuid=no
1723 ##########################################
1724 # xfsctl() probe, used for raw-posix
1725 if test "$xfs" != "no" ; then
1726 cat > $TMPC << EOF
1727 #include <stddef.h> /* NULL */
1728 #include <xfs/xfs.h>
1729 int main(void)
1731 xfsctl(NULL, 0, 0, NULL);
1732 return 0;
1735 if compile_prog "" "" ; then
1736 xfs="yes"
1737 else
1738 if test "$xfs" = "yes" ; then
1739 feature_not_found "xfs"
1741 xfs=no
1745 ##########################################
1746 # vde libraries probe
1747 if test "$vde" != "no" ; then
1748 vde_libs="-lvdeplug"
1749 cat > $TMPC << EOF
1750 #include <libvdeplug.h>
1751 int main(void)
1753 struct vde_open_args a = {0, 0, 0};
1754 vde_open("", "", &a);
1755 return 0;
1758 if compile_prog "" "$vde_libs" ; then
1759 vde=yes
1760 libs_softmmu="$vde_libs $libs_softmmu"
1761 libs_tools="$vde_libs $libs_tools"
1762 else
1763 if test "$vde" = "yes" ; then
1764 feature_not_found "vde"
1766 vde=no
1770 ##########################################
1771 # Sound support libraries probe
1773 audio_drv_probe()
1775 drv=$1
1776 hdr=$2
1777 lib=$3
1778 exp=$4
1779 cfl=$5
1780 cat > $TMPC << EOF
1781 #include <$hdr>
1782 int main(void) { $exp }
1784 if compile_prog "$cfl" "$lib" ; then
1786 else
1787 echo
1788 echo "Error: $drv check failed"
1789 echo "Make sure to have the $drv libs and headers installed."
1790 echo
1791 exit 1
1795 audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1796 for drv in $audio_drv_list; do
1797 case $drv in
1798 alsa)
1799 audio_drv_probe $drv alsa/asoundlib.h -lasound \
1800 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1801 libs_softmmu="-lasound $libs_softmmu"
1804 fmod)
1805 if test -z $fmod_lib || test -z $fmod_inc; then
1806 echo
1807 echo "Error: You must specify path to FMOD library and headers"
1808 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1809 echo
1810 exit 1
1812 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1813 libs_softmmu="$fmod_lib $libs_softmmu"
1816 esd)
1817 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1818 libs_softmmu="-lesd $libs_softmmu"
1819 audio_pt_int="yes"
1823 audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
1824 "pa_simple *s = 0; pa_simple_free(s); return 0;"
1825 libs_softmmu="-lpulse -lpulse-simple $libs_softmmu"
1826 audio_pt_int="yes"
1829 coreaudio)
1830 libs_softmmu="-framework CoreAudio $libs_softmmu"
1833 dsound)
1834 libs_softmmu="-lole32 -ldxguid $libs_softmmu"
1835 audio_win_int="yes"
1838 oss)
1839 libs_softmmu="$oss_lib $libs_softmmu"
1842 sdl|wav)
1843 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1846 winwave)
1847 libs_softmmu="-lwinmm $libs_softmmu"
1848 audio_win_int="yes"
1852 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
1853 echo
1854 echo "Error: Unknown driver '$drv' selected"
1855 echo "Possible drivers are: $audio_possible_drivers"
1856 echo
1857 exit 1
1860 esac
1861 done
1863 ##########################################
1864 # BrlAPI probe
1866 if test "$brlapi" != "no" ; then
1867 brlapi_libs="-lbrlapi"
1868 cat > $TMPC << EOF
1869 #include <brlapi.h>
1870 #include <stddef.h>
1871 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1873 if compile_prog "" "$brlapi_libs" ; then
1874 brlapi=yes
1875 libs_softmmu="$brlapi_libs $libs_softmmu"
1876 else
1877 if test "$brlapi" = "yes" ; then
1878 feature_not_found "brlapi"
1880 brlapi=no
1884 ##########################################
1885 # curses probe
1886 if test "$mingw32" = "yes" ; then
1887 curses_list="-lpdcurses"
1888 else
1889 curses_list="-lncurses -lcurses"
1892 if test "$curses" != "no" ; then
1893 curses_found=no
1894 cat > $TMPC << EOF
1895 #include <curses.h>
1896 #ifdef __OpenBSD__
1897 #define resize_term resizeterm
1898 #endif
1899 int main(void) {
1900 const char *s = curses_version();
1901 resize_term(0, 0);
1902 return s != 0;
1905 for curses_lib in $curses_list; do
1906 if compile_prog "" "$curses_lib" ; then
1907 curses_found=yes
1908 libs_softmmu="$curses_lib $libs_softmmu"
1909 break
1911 done
1912 if test "$curses_found" = "yes" ; then
1913 curses=yes
1914 else
1915 if test "$curses" = "yes" ; then
1916 feature_not_found "curses"
1918 curses=no
1922 ##########################################
1923 # curl probe
1925 if $pkg_config libcurl --modversion >/dev/null 2>&1; then
1926 curlconfig="$pkg_config libcurl"
1927 else
1928 curlconfig=curl-config
1931 if test "$curl" != "no" ; then
1932 cat > $TMPC << EOF
1933 #include <curl/curl.h>
1934 int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
1936 curl_cflags=`$curlconfig --cflags 2>/dev/null`
1937 curl_libs=`$curlconfig --libs 2>/dev/null`
1938 if compile_prog "$curl_cflags" "$curl_libs" ; then
1939 curl=yes
1940 libs_tools="$curl_libs $libs_tools"
1941 libs_softmmu="$curl_libs $libs_softmmu"
1942 else
1943 if test "$curl" = "yes" ; then
1944 feature_not_found "curl"
1946 curl=no
1948 fi # test "$curl"
1950 ##########################################
1951 # bluez support probe
1952 if test "$bluez" != "no" ; then
1953 cat > $TMPC << EOF
1954 #include <bluetooth/bluetooth.h>
1955 int main(void) { return bt_error(0); }
1957 bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
1958 bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
1959 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
1960 bluez=yes
1961 libs_softmmu="$bluez_libs $libs_softmmu"
1962 else
1963 if test "$bluez" = "yes" ; then
1964 feature_not_found "bluez"
1966 bluez="no"
1970 ##########################################
1971 # glib support probe
1972 if $pkg_config --modversion gthread-2.0 > /dev/null 2>&1 ; then
1973 glib_cflags=`$pkg_config --cflags gthread-2.0 2>/dev/null`
1974 glib_libs=`$pkg_config --libs gthread-2.0 2>/dev/null`
1975 LIBS="$glib_libs $LIBS"
1976 libs_qga="$glib_libs $libs_qga"
1977 else
1978 echo "glib-2.0 required to compile QEMU"
1979 exit 1
1982 ##########################################
1983 # libcap probe
1985 if test "$cap" != "no" ; then
1986 cat > $TMPC <<EOF
1987 #include <stdio.h>
1988 #include <sys/capability.h>
1989 int main(void) { cap_t caps; caps = cap_init(); }
1991 if compile_prog "" "-lcap" ; then
1992 cap=yes
1993 else
1994 cap=no
1998 ##########################################
1999 # pthread probe
2000 PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
2002 pthread=no
2003 cat > $TMPC << EOF
2004 #include <pthread.h>
2005 static void *f(void *p) { return NULL; }
2006 int main(void) {
2007 pthread_t thread;
2008 pthread_create(&thread, 0, f, 0);
2009 return 0;
2012 if compile_prog "" "" ; then
2013 pthread=yes
2014 else
2015 for pthread_lib in $PTHREADLIBS_LIST; do
2016 if compile_prog "" "$pthread_lib" ; then
2017 pthread=yes
2018 LIBS="$pthread_lib $LIBS"
2019 break
2021 done
2024 if test "$mingw32" != yes -a "$pthread" = no; then
2025 echo
2026 echo "Error: pthread check failed"
2027 echo "Make sure to have the pthread libs and headers installed."
2028 echo
2029 exit 1
2032 ##########################################
2033 # rbd probe
2034 if test "$rbd" != "no" ; then
2035 cat > $TMPC <<EOF
2036 #include <stdio.h>
2037 #include <rbd/librbd.h>
2038 int main(void) {
2039 rados_t cluster;
2040 rados_create(&cluster, NULL);
2041 return 0;
2044 rbd_libs="-lrbd -lrados"
2045 if compile_prog "" "$rbd_libs" ; then
2046 rbd=yes
2047 libs_tools="$rbd_libs $libs_tools"
2048 libs_softmmu="$rbd_libs $libs_softmmu"
2049 else
2050 if test "$rbd" = "yes" ; then
2051 feature_not_found "rados block device"
2053 rbd=no
2057 ##########################################
2058 # linux-aio probe
2060 if test "$linux_aio" != "no" ; then
2061 cat > $TMPC <<EOF
2062 #include <libaio.h>
2063 #include <sys/eventfd.h>
2064 #include <stddef.h>
2065 int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
2067 if compile_prog "" "-laio" ; then
2068 linux_aio=yes
2069 libs_softmmu="$libs_softmmu -laio"
2070 libs_tools="$libs_tools -laio"
2071 else
2072 if test "$linux_aio" = "yes" ; then
2073 feature_not_found "linux AIO"
2075 linux_aio=no
2079 ##########################################
2080 # attr probe
2082 if test "$attr" != "no" ; then
2083 cat > $TMPC <<EOF
2084 #include <stdio.h>
2085 #include <sys/types.h>
2086 #ifdef CONFIG_LIBATTR
2087 #include <attr/xattr.h>
2088 #else
2089 #include <sys/xattr.h>
2090 #endif
2091 int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
2093 if compile_prog "" "" ; then
2094 attr=yes
2095 # Older distros have <attr/xattr.h>, and need -lattr:
2096 elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
2097 attr=yes
2098 LIBS="-lattr $LIBS"
2099 libattr=yes
2100 else
2101 if test "$attr" = "yes" ; then
2102 feature_not_found "ATTR"
2104 attr=no
2108 ##########################################
2109 # iovec probe
2110 cat > $TMPC <<EOF
2111 #include <sys/types.h>
2112 #include <sys/uio.h>
2113 #include <unistd.h>
2114 int main(void) { return sizeof(struct iovec); }
2116 iovec=no
2117 if compile_prog "" "" ; then
2118 iovec=yes
2121 ##########################################
2122 # preadv probe
2123 cat > $TMPC <<EOF
2124 #include <sys/types.h>
2125 #include <sys/uio.h>
2126 #include <unistd.h>
2127 int main(void) { return preadv == preadv; }
2129 preadv=no
2130 if compile_prog "" "" ; then
2131 preadv=yes
2134 ##########################################
2135 # fdt probe
2136 if test "$fdt" != "no" ; then
2137 fdt_libs="-lfdt"
2138 cat > $TMPC << EOF
2139 int main(void) { return 0; }
2141 if compile_prog "" "$fdt_libs" ; then
2142 fdt=yes
2143 else
2144 if test "$fdt" = "yes" ; then
2145 feature_not_found "fdt"
2147 fdt_libs=
2148 fdt=no
2152 ##########################################
2153 # opengl probe, used by milkymist-tmu2
2154 if test "$opengl" != "no" ; then
2155 opengl_libs="-lGL"
2156 cat > $TMPC << EOF
2157 #include <X11/Xlib.h>
2158 #include <GL/gl.h>
2159 #include <GL/glx.h>
2160 int main(void) { return GL_VERSION != 0; }
2162 if compile_prog "" "-lGL" ; then
2163 opengl=yes
2164 else
2165 if test "$opengl" = "yes" ; then
2166 feature_not_found "opengl"
2168 opengl_libs=
2169 opengl=no
2174 # Check for xxxat() functions when we are building linux-user
2175 # emulator. This is done because older glibc versions don't
2176 # have syscall stubs for these implemented.
2178 atfile=no
2179 cat > $TMPC << EOF
2180 #define _ATFILE_SOURCE
2181 #include <sys/types.h>
2182 #include <fcntl.h>
2183 #include <unistd.h>
2186 main(void)
2188 /* try to unlink nonexisting file */
2189 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
2192 if compile_prog "" "" ; then
2193 atfile=yes
2196 # Check for inotify functions when we are building linux-user
2197 # emulator. This is done because older glibc versions don't
2198 # have syscall stubs for these implemented. In that case we
2199 # don't provide them even if kernel supports them.
2201 inotify=no
2202 cat > $TMPC << EOF
2203 #include <sys/inotify.h>
2206 main(void)
2208 /* try to start inotify */
2209 return inotify_init();
2212 if compile_prog "" "" ; then
2213 inotify=yes
2216 inotify1=no
2217 cat > $TMPC << EOF
2218 #include <sys/inotify.h>
2221 main(void)
2223 /* try to start inotify */
2224 return inotify_init1(0);
2227 if compile_prog "" "" ; then
2228 inotify1=yes
2231 # check if utimensat and futimens are supported
2232 utimens=no
2233 cat > $TMPC << EOF
2234 #define _ATFILE_SOURCE
2235 #include <stddef.h>
2236 #include <fcntl.h>
2238 int main(void)
2240 utimensat(AT_FDCWD, "foo", NULL, 0);
2241 futimens(0, NULL);
2242 return 0;
2245 if compile_prog "" "" ; then
2246 utimens=yes
2249 # check if pipe2 is there
2250 pipe2=no
2251 cat > $TMPC << EOF
2252 #include <unistd.h>
2253 #include <fcntl.h>
2255 int main(void)
2257 int pipefd[2];
2258 pipe2(pipefd, O_CLOEXEC);
2259 return 0;
2262 if compile_prog "" "" ; then
2263 pipe2=yes
2266 # check if accept4 is there
2267 accept4=no
2268 cat > $TMPC << EOF
2269 #include <sys/socket.h>
2270 #include <stddef.h>
2272 int main(void)
2274 accept4(0, NULL, NULL, SOCK_CLOEXEC);
2275 return 0;
2278 if compile_prog "" "" ; then
2279 accept4=yes
2282 # check if tee/splice is there. vmsplice was added same time.
2283 splice=no
2284 cat > $TMPC << EOF
2285 #include <unistd.h>
2286 #include <fcntl.h>
2287 #include <limits.h>
2289 int main(void)
2291 int len, fd = 0;
2292 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
2293 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
2294 return 0;
2297 if compile_prog "" "" ; then
2298 splice=yes
2301 ##########################################
2302 # signalfd probe
2303 signalfd="no"
2304 cat > $TMPC << EOF
2305 #include <unistd.h>
2306 #include <sys/syscall.h>
2307 #include <signal.h>
2308 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
2311 if compile_prog "" "" ; then
2312 signalfd=yes
2315 # check if eventfd is supported
2316 eventfd=no
2317 cat > $TMPC << EOF
2318 #include <sys/eventfd.h>
2320 int main(void)
2322 return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
2325 if compile_prog "" "" ; then
2326 eventfd=yes
2329 # check for fallocate
2330 fallocate=no
2331 cat > $TMPC << EOF
2332 #include <fcntl.h>
2334 int main(void)
2336 fallocate(0, 0, 0, 0);
2337 return 0;
2340 if compile_prog "$ARCH_CFLAGS" "" ; then
2341 fallocate=yes
2344 # check for sync_file_range
2345 sync_file_range=no
2346 cat > $TMPC << EOF
2347 #include <fcntl.h>
2349 int main(void)
2351 sync_file_range(0, 0, 0, 0);
2352 return 0;
2355 if compile_prog "$ARCH_CFLAGS" "" ; then
2356 sync_file_range=yes
2359 # check for linux/fiemap.h and FS_IOC_FIEMAP
2360 fiemap=no
2361 cat > $TMPC << EOF
2362 #include <sys/ioctl.h>
2363 #include <linux/fs.h>
2364 #include <linux/fiemap.h>
2366 int main(void)
2368 ioctl(0, FS_IOC_FIEMAP, 0);
2369 return 0;
2372 if compile_prog "$ARCH_CFLAGS" "" ; then
2373 fiemap=yes
2376 # check for dup3
2377 dup3=no
2378 cat > $TMPC << EOF
2379 #include <unistd.h>
2381 int main(void)
2383 dup3(0, 0, 0);
2384 return 0;
2387 if compile_prog "" "" ; then
2388 dup3=yes
2391 # check for epoll support
2392 epoll=no
2393 cat > $TMPC << EOF
2394 #include <sys/epoll.h>
2396 int main(void)
2398 epoll_create(0);
2399 return 0;
2402 if compile_prog "$ARCH_CFLAGS" "" ; then
2403 epoll=yes
2406 # epoll_create1 and epoll_pwait are later additions
2407 # so we must check separately for their presence
2408 epoll_create1=no
2409 cat > $TMPC << EOF
2410 #include <sys/epoll.h>
2412 int main(void)
2414 /* Note that we use epoll_create1 as a value, not as
2415 * a function being called. This is necessary so that on
2416 * old SPARC glibc versions where the function was present in
2417 * the library but not declared in the header file we will
2418 * fail the configure check. (Otherwise we will get a compiler
2419 * warning but not an error, and will proceed to fail the
2420 * qemu compile where we compile with -Werror.)
2422 return epoll_create1 == epoll_create1;
2425 if compile_prog "$ARCH_CFLAGS" "" ; then
2426 epoll_create1=yes
2429 epoll_pwait=no
2430 cat > $TMPC << EOF
2431 #include <sys/epoll.h>
2433 int main(void)
2435 epoll_pwait(0, 0, 0, 0, 0);
2436 return 0;
2439 if compile_prog "$ARCH_CFLAGS" "" ; then
2440 epoll_pwait=yes
2443 # Check if tools are available to build documentation.
2444 if test "$docs" != "no" ; then
2445 if has makeinfo && has pod2man; then
2446 docs=yes
2447 else
2448 if test "$docs" = "yes" ; then
2449 feature_not_found "docs"
2451 docs=no
2455 # Search for bswap_32 function
2456 byteswap_h=no
2457 cat > $TMPC << EOF
2458 #include <byteswap.h>
2459 int main(void) { return bswap_32(0); }
2461 if compile_prog "" "" ; then
2462 byteswap_h=yes
2465 # Search for bswap_32 function
2466 bswap_h=no
2467 cat > $TMPC << EOF
2468 #include <sys/endian.h>
2469 #include <sys/types.h>
2470 #include <machine/bswap.h>
2471 int main(void) { return bswap32(0); }
2473 if compile_prog "" "" ; then
2474 bswap_h=yes
2477 ##########################################
2478 # Do we have libiscsi
2479 if test "$libiscsi" != "no" ; then
2480 cat > $TMPC << EOF
2481 #include <iscsi/iscsi.h>
2482 int main(void) { iscsi_create_context(""); return 0; }
2484 if compile_prog "-Werror" "-liscsi" ; then
2485 libiscsi="yes"
2486 LIBS="$LIBS -liscsi"
2487 else
2488 if test "$libiscsi" = "yes" ; then
2489 feature_not_found "libiscsi"
2491 libiscsi="no"
2496 ##########################################
2497 # Do we need librt
2498 cat > $TMPC <<EOF
2499 #include <signal.h>
2500 #include <time.h>
2501 int main(void) { return clock_gettime(CLOCK_REALTIME, NULL); }
2504 if compile_prog "" "" ; then
2506 elif compile_prog "" "-lrt" ; then
2507 LIBS="-lrt $LIBS"
2510 if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
2511 "$aix" != "yes" -a "$haiku" != "yes" ; then
2512 libs_softmmu="-lutil $libs_softmmu"
2515 ##########################################
2516 # check if the compiler defines offsetof
2518 need_offsetof=yes
2519 cat > $TMPC << EOF
2520 #include <stddef.h>
2521 int main(void) { struct s { int f; }; return offsetof(struct s, f); }
2523 if compile_prog "" "" ; then
2524 need_offsetof=no
2527 # spice probe
2528 if test "$spice" != "no" ; then
2529 cat > $TMPC << EOF
2530 #include <spice.h>
2531 int main(void) { spice_server_new(); return 0; }
2533 spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
2534 spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
2535 if $pkg_config --atleast-version=0.6.0 spice-server >/dev/null 2>&1 && \
2536 compile_prog "$spice_cflags" "$spice_libs" ; then
2537 spice="yes"
2538 libs_softmmu="$libs_softmmu $spice_libs"
2539 QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
2540 else
2541 if test "$spice" = "yes" ; then
2542 feature_not_found "spice"
2544 spice="no"
2548 # check for libcacard for smartcard support
2549 if test "$smartcard" != "no" ; then
2550 smartcard="yes"
2551 smartcard_cflags=""
2552 # TODO - what's the minimal nss version we support?
2553 if test "$smartcard_nss" != "no"; then
2554 if $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 ; then
2555 smartcard_nss="yes"
2556 smartcard_cflags="-I\$(SRC_PATH)/libcacard"
2557 libcacard_libs=$($pkg_config --libs nss 2>/dev/null)
2558 libcacard_cflags=$($pkg_config --cflags nss 2>/dev/null)
2559 QEMU_CFLAGS="$QEMU_CFLAGS $smartcard_cflags $libcacard_cflags"
2560 LIBS="$libcacard_libs $LIBS"
2561 else
2562 if test "$smartcard_nss" = "yes"; then
2563 feature_not_found "nss"
2565 smartcard_nss="no"
2569 if test "$smartcard" = "no" ; then
2570 smartcard_nss="no"
2573 # check for usbredirparser for usb network redirection support
2574 if test "$usb_redir" != "no" ; then
2575 if $pkg_config libusbredirparser >/dev/null 2>&1 ; then
2576 usb_redir="yes"
2577 usb_redir_cflags=$($pkg_config --cflags libusbredirparser 2>/dev/null)
2578 usb_redir_libs=$($pkg_config --libs libusbredirparser 2>/dev/null)
2579 QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
2580 LIBS="$LIBS $usb_redir_libs"
2581 else
2582 if test "$usb_redir" = "yes"; then
2583 feature_not_found "usb-redir"
2585 usb_redir="no"
2589 ##########################################
2591 ##########################################
2592 # check if we have fdatasync
2594 fdatasync=no
2595 cat > $TMPC << EOF
2596 #include <unistd.h>
2597 int main(void) {
2598 #if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
2599 return fdatasync(0);
2600 #else
2601 #abort Not supported
2602 #endif
2605 if compile_prog "" "" ; then
2606 fdatasync=yes
2609 ##########################################
2610 # check if we have madvise
2612 madvise=no
2613 cat > $TMPC << EOF
2614 #include <sys/types.h>
2615 #include <sys/mman.h>
2616 #include <stddef.h>
2617 int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
2619 if compile_prog "" "" ; then
2620 madvise=yes
2623 ##########################################
2624 # check if we have posix_madvise
2626 posix_madvise=no
2627 cat > $TMPC << EOF
2628 #include <sys/mman.h>
2629 #include <stddef.h>
2630 int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
2632 if compile_prog "" "" ; then
2633 posix_madvise=yes
2636 ##########################################
2637 # check if trace backend exists
2639 sh "$source_path/scripts/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null
2640 if test "$?" -ne 0 ; then
2641 echo
2642 echo "Error: invalid trace backend"
2643 echo "Please choose a supported trace backend."
2644 echo
2645 exit 1
2648 ##########################################
2649 # For 'ust' backend, test if ust headers are present
2650 if test "$trace_backend" = "ust"; then
2651 cat > $TMPC << EOF
2652 #include <ust/tracepoint.h>
2653 #include <ust/marker.h>
2654 int main(void) { return 0; }
2656 if compile_prog "" "" ; then
2657 LIBS="-lust $LIBS"
2658 else
2659 echo
2660 echo "Error: Trace backend 'ust' missing libust header files"
2661 echo
2662 exit 1
2666 ##########################################
2667 # For 'dtrace' backend, test if 'dtrace' command is present
2668 if test "$trace_backend" = "dtrace"; then
2669 if ! has 'dtrace' ; then
2670 echo
2671 echo "Error: dtrace command is not found in PATH $PATH"
2672 echo
2673 exit 1
2675 trace_backend_stap="no"
2676 if has 'stap' ; then
2677 trace_backend_stap="yes"
2681 ##########################################
2682 # __sync_fetch_and_and requires at least -march=i486. Many toolchains
2683 # use i686 as default anyway, but for those that don't, an explicit
2684 # specification is necessary
2685 if test "$vhost_net" = "yes" && test "$cpu" = "i386"; then
2686 cat > $TMPC << EOF
2687 int sfaa(unsigned *ptr)
2689 return __sync_fetch_and_and(ptr, 0);
2692 int main(int argc, char **argv)
2694 int val = 42;
2695 sfaa(&val);
2696 return val;
2699 if ! compile_prog "" "" ; then
2700 CFLAGS+="-march=i486"
2704 ##########################################
2705 # check if we have makecontext
2707 ucontext_coroutine=no
2708 if test "$darwin" != "yes"; then
2709 cat > $TMPC << EOF
2710 #include <ucontext.h>
2711 int main(void) { makecontext(0, 0, 0); return 0; }
2713 if compile_prog "" "" ; then
2714 ucontext_coroutine=yes
2718 ##########################################
2719 # check if we have open_by_handle_at
2721 open_by_hande_at=no
2722 cat > $TMPC << EOF
2723 #include <fcntl.h>
2724 int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
2726 if compile_prog "" "" ; then
2727 open_by_handle_at=yes
2730 ########################################
2731 # check if we have linux/magic.h
2733 linux_magic_h=no
2734 cat > $TMPC << EOF
2735 #include <linux/magic.h>
2736 int main(void) {
2737 return 0;
2740 if compile_prog "" "" ; then
2741 linux_magic_h=yes
2744 ##########################################
2745 # End of CC checks
2746 # After here, no more $cc or $ld runs
2748 if test "$debug" = "no" ; then
2749 CFLAGS="-O2 $CFLAGS"
2752 # Consult white-list to determine whether to enable werror
2753 # by default. Only enable by default for git builds
2754 z_version=`cut -f3 -d. $source_path/VERSION`
2756 if test -z "$werror" ; then
2757 if test "$z_version" = "50" -a \
2758 "$linux" = "yes" ; then
2759 werror="yes"
2760 else
2761 werror="no"
2765 # Disable zero malloc errors for official releases unless explicitly told to
2766 # enable/disable
2767 if test -z "$zero_malloc" ; then
2768 if test "$z_version" = "50" ; then
2769 zero_malloc="no"
2770 else
2771 zero_malloc="yes"
2775 if test "$werror" = "yes" ; then
2776 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
2779 if test "$solaris" = "no" ; then
2780 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
2781 LDFLAGS="-Wl,--warn-common $LDFLAGS"
2785 # Use ASLR, no-SEH and DEP if available
2786 if test "$mingw32" = "yes" ; then
2787 for flag in --dynamicbase --no-seh --nxcompat; do
2788 if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
2789 LDFLAGS="-Wl,$flag $LDFLAGS"
2791 done
2794 confdir=$sysconfdir$confsuffix
2796 tools=
2797 if test "$softmmu" = yes ; then
2798 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
2799 if [ "$cap" = "yes" -a "$linux" = "yes" ] ; then
2800 tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
2802 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
2803 tools="qemu-nbd\$(EXESUF) $tools"
2804 if [ "$guest_agent" = "yes" ]; then
2805 tools="qemu-ga\$(EXESUF) $tools"
2810 # Mac OS X ships with a broken assembler
2811 roms=
2812 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
2813 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
2814 "$softmmu" = yes ; then
2815 roms="optionrom"
2817 if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
2818 roms="$roms spapr-rtas"
2821 echo "Install prefix $prefix"
2822 echo "BIOS directory `eval echo $datadir`"
2823 echo "binary directory `eval echo $bindir`"
2824 echo "library directory `eval echo $libdir`"
2825 echo "include directory `eval echo $includedir`"
2826 echo "config directory `eval echo $sysconfdir`"
2827 if test "$mingw32" = "no" ; then
2828 echo "Manual directory `eval echo $mandir`"
2829 echo "ELF interp prefix $interp_prefix"
2831 echo "Source path $source_path"
2832 echo "C compiler $cc"
2833 echo "Host C compiler $host_cc"
2834 echo "CFLAGS $CFLAGS"
2835 echo "QEMU_CFLAGS $QEMU_CFLAGS"
2836 echo "LDFLAGS $LDFLAGS"
2837 echo "make $make"
2838 echo "install $install"
2839 echo "python $python"
2840 if test "$slirp" = "yes" ; then
2841 echo "smbd $smbd"
2843 echo "host CPU $cpu"
2844 echo "host big endian $bigendian"
2845 echo "target list $target_list"
2846 echo "tcg debug enabled $debug_tcg"
2847 echo "Mon debug enabled $debug_mon"
2848 echo "gprof enabled $gprof"
2849 echo "sparse enabled $sparse"
2850 echo "strip binaries $strip_opt"
2851 echo "profiler $profiler"
2852 echo "static build $static"
2853 echo "-Werror enabled $werror"
2854 if test "$darwin" = "yes" ; then
2855 echo "Cocoa support $cocoa"
2857 echo "SDL support $sdl"
2858 echo "curses support $curses"
2859 echo "curl support $curl"
2860 echo "mingw32 support $mingw32"
2861 echo "Audio drivers $audio_drv_list"
2862 echo "Extra audio cards $audio_card_list"
2863 echo "Block whitelist $block_drv_whitelist"
2864 echo "Mixer emulation $mixemu"
2865 echo "VNC support $vnc"
2866 if test "$vnc" = "yes" ; then
2867 echo "VNC TLS support $vnc_tls"
2868 echo "VNC SASL support $vnc_sasl"
2869 echo "VNC JPEG support $vnc_jpeg"
2870 echo "VNC PNG support $vnc_png"
2871 echo "VNC thread $vnc_thread"
2873 if test -n "$sparc_cpu"; then
2874 echo "Target Sparc Arch $sparc_cpu"
2876 echo "xen support $xen"
2877 echo "CPU emulation $cpu_emulation"
2878 echo "brlapi support $brlapi"
2879 echo "bluez support $bluez"
2880 echo "Documentation $docs"
2881 [ ! -z "$uname_release" ] && \
2882 echo "uname -r $uname_release"
2883 echo "NPTL support $nptl"
2884 echo "GUEST_BASE $guest_base"
2885 echo "PIE $pie"
2886 echo "vde support $vde"
2887 echo "Linux AIO support $linux_aio"
2888 echo "ATTR/XATTR support $attr"
2889 echo "Install blobs $blobs"
2890 echo "KVM support $kvm"
2891 echo "TCG interpreter $tcg_interpreter"
2892 echo "KVM PIT support $kvm_cap_pit"
2893 echo "KVM device assig. $kvm_cap_device_assignment"
2894 echo "fdt support $fdt"
2895 echo "preadv support $preadv"
2896 echo "fdatasync $fdatasync"
2897 echo "madvise $madvise"
2898 echo "posix_madvise $posix_madvise"
2899 echo "uuid support $uuid"
2900 echo "vhost-net support $vhost_net"
2901 echo "Trace backend $trace_backend"
2902 echo "Trace output file $trace_file-<pid>"
2903 echo "spice support $spice"
2904 echo "rbd support $rbd"
2905 echo "xfsctl support $xfs"
2906 echo "nss used $smartcard_nss"
2907 echo "usb net redir $usb_redir"
2908 echo "OpenGL support $opengl"
2909 echo "libiscsi support $libiscsi"
2910 echo "build guest agent $guest_agent"
2912 if test "$sdl_too_old" = "yes"; then
2913 echo "-> Your SDL version is too old - please upgrade to have SDL support"
2916 config_host_mak="config-host.mak"
2917 config_host_ld="config-host.ld"
2919 echo "# Automatically generated by configure - do not modify" > $config_host_mak
2920 printf "# Configured with:" >> $config_host_mak
2921 printf " '%s'" "$0" "$@" >> $config_host_mak
2922 echo >> $config_host_mak
2924 echo all: >> $config_host_mak
2925 echo "prefix=$prefix" >> $config_host_mak
2926 echo "bindir=$bindir" >> $config_host_mak
2927 echo "libdir=$libdir" >> $config_host_mak
2928 echo "includedir=$includedir" >> $config_host_mak
2929 echo "mandir=$mandir" >> $config_host_mak
2930 echo "datadir=$datadir" >> $config_host_mak
2931 echo "sysconfdir=$sysconfdir" >> $config_host_mak
2932 echo "docdir=$docdir" >> $config_host_mak
2933 echo "confdir=$confdir" >> $config_host_mak
2935 echo "ARCH=$ARCH" >> $config_host_mak
2936 if test "$debug_tcg" = "yes" ; then
2937 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
2939 if test "$debug_mon" = "yes" ; then
2940 echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak
2942 if test "$debug" = "yes" ; then
2943 echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
2945 if test "$strip_opt" = "yes" ; then
2946 echo "STRIP=${strip}" >> $config_host_mak
2948 if test "$bigendian" = "yes" ; then
2949 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
2951 echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
2952 if test "$mingw32" = "yes" ; then
2953 echo "CONFIG_WIN32=y" >> $config_host_mak
2954 rc_version=`cat $source_path/VERSION`
2955 version_major=${rc_version%%.*}
2956 rc_version=${rc_version#*.}
2957 version_minor=${rc_version%%.*}
2958 rc_version=${rc_version#*.}
2959 version_subminor=${rc_version%%.*}
2960 version_micro=0
2961 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
2962 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
2963 else
2964 echo "CONFIG_POSIX=y" >> $config_host_mak
2967 if test "$linux" = "yes" ; then
2968 echo "CONFIG_LINUX=y" >> $config_host_mak
2971 if test "$darwin" = "yes" ; then
2972 echo "CONFIG_DARWIN=y" >> $config_host_mak
2975 if test "$aix" = "yes" ; then
2976 echo "CONFIG_AIX=y" >> $config_host_mak
2979 if test "$solaris" = "yes" ; then
2980 echo "CONFIG_SOLARIS=y" >> $config_host_mak
2981 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
2982 if test "$needs_libsunmath" = "yes" ; then
2983 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
2986 if test "$haiku" = "yes" ; then
2987 echo "CONFIG_HAIKU=y" >> $config_host_mak
2989 if test "$static" = "yes" ; then
2990 echo "CONFIG_STATIC=y" >> $config_host_mak
2992 if test "$profiler" = "yes" ; then
2993 echo "CONFIG_PROFILER=y" >> $config_host_mak
2995 if test "$slirp" = "yes" ; then
2996 echo "CONFIG_SLIRP=y" >> $config_host_mak
2997 echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
2998 QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES"
3000 if test "$vde" = "yes" ; then
3001 echo "CONFIG_VDE=y" >> $config_host_mak
3003 for card in $audio_card_list; do
3004 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
3005 echo "$def=y" >> $config_host_mak
3006 done
3007 echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
3008 for drv in $audio_drv_list; do
3009 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
3010 echo "$def=y" >> $config_host_mak
3011 if test "$drv" = "fmod"; then
3012 echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
3014 done
3015 if test "$audio_pt_int" = "yes" ; then
3016 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
3018 if test "$audio_win_int" = "yes" ; then
3019 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
3021 echo "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
3022 if test "$mixemu" = "yes" ; then
3023 echo "CONFIG_MIXEMU=y" >> $config_host_mak
3025 if test "$vnc" = "yes" ; then
3026 echo "CONFIG_VNC=y" >> $config_host_mak
3028 if test "$vnc_tls" = "yes" ; then
3029 echo "CONFIG_VNC_TLS=y" >> $config_host_mak
3030 echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
3032 if test "$vnc_sasl" = "yes" ; then
3033 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
3034 echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
3036 if test "$vnc_jpeg" = "yes" ; then
3037 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
3038 echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak
3040 if test "$vnc_png" = "yes" ; then
3041 echo "CONFIG_VNC_PNG=y" >> $config_host_mak
3042 echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak
3044 if test "$vnc_thread" = "yes" ; then
3045 echo "CONFIG_VNC_THREAD=y" >> $config_host_mak
3047 if test "$fnmatch" = "yes" ; then
3048 echo "CONFIG_FNMATCH=y" >> $config_host_mak
3050 if test "$uuid" = "yes" ; then
3051 echo "CONFIG_UUID=y" >> $config_host_mak
3053 if test "$xfs" = "yes" ; then
3054 echo "CONFIG_XFS=y" >> $config_host_mak
3056 qemu_version=`head $source_path/VERSION`
3057 echo "VERSION=$qemu_version" >>$config_host_mak
3058 echo "PKGVERSION=$pkgversion" >>$config_host_mak
3059 echo "SRC_PATH=$source_path" >> $config_host_mak
3060 echo "TARGET_DIRS=$target_list" >> $config_host_mak
3061 if [ "$docs" = "yes" ] ; then
3062 echo "BUILD_DOCS=yes" >> $config_host_mak
3064 if test "$sdl" = "yes" ; then
3065 echo "CONFIG_SDL=y" >> $config_host_mak
3066 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
3068 if test "$cocoa" = "yes" ; then
3069 echo "CONFIG_COCOA=y" >> $config_host_mak
3071 if test "$curses" = "yes" ; then
3072 echo "CONFIG_CURSES=y" >> $config_host_mak
3074 if test "$atfile" = "yes" ; then
3075 echo "CONFIG_ATFILE=y" >> $config_host_mak
3077 if test "$utimens" = "yes" ; then
3078 echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
3080 if test "$pipe2" = "yes" ; then
3081 echo "CONFIG_PIPE2=y" >> $config_host_mak
3083 if test "$accept4" = "yes" ; then
3084 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
3086 if test "$splice" = "yes" ; then
3087 echo "CONFIG_SPLICE=y" >> $config_host_mak
3089 if test "$eventfd" = "yes" ; then
3090 echo "CONFIG_EVENTFD=y" >> $config_host_mak
3092 if test "$fallocate" = "yes" ; then
3093 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
3095 if test "$sync_file_range" = "yes" ; then
3096 echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
3098 if test "$fiemap" = "yes" ; then
3099 echo "CONFIG_FIEMAP=y" >> $config_host_mak
3101 if test "$dup3" = "yes" ; then
3102 echo "CONFIG_DUP3=y" >> $config_host_mak
3104 if test "$epoll" = "yes" ; then
3105 echo "CONFIG_EPOLL=y" >> $config_host_mak
3107 if test "$epoll_create1" = "yes" ; then
3108 echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
3110 if test "$epoll_pwait" = "yes" ; then
3111 echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
3113 if test "$inotify" = "yes" ; then
3114 echo "CONFIG_INOTIFY=y" >> $config_host_mak
3116 if test "$inotify1" = "yes" ; then
3117 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
3119 if test "$byteswap_h" = "yes" ; then
3120 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
3122 if test "$bswap_h" = "yes" ; then
3123 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
3125 if test "$curl" = "yes" ; then
3126 echo "CONFIG_CURL=y" >> $config_host_mak
3127 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
3129 if test "$brlapi" = "yes" ; then
3130 echo "CONFIG_BRLAPI=y" >> $config_host_mak
3132 if test "$bluez" = "yes" ; then
3133 echo "CONFIG_BLUEZ=y" >> $config_host_mak
3134 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
3136 echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
3137 if test "$xen" = "yes" ; then
3138 echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
3139 echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
3141 if test "$linux_aio" = "yes" ; then
3142 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
3144 if test "$attr" = "yes" ; then
3145 echo "CONFIG_ATTR=y" >> $config_host_mak
3147 if test "$libattr" = "yes" ; then
3148 echo "CONFIG_LIBATTR=y" >> $config_host_mak
3150 if test "$linux" = "yes" ; then
3151 if test "$attr" = "yes" ; then
3152 echo "CONFIG_VIRTFS=y" >> $config_host_mak
3155 if test "$blobs" = "yes" ; then
3156 echo "INSTALL_BLOBS=yes" >> $config_host_mak
3158 if test "$iovec" = "yes" ; then
3159 echo "CONFIG_IOVEC=y" >> $config_host_mak
3161 if test "$preadv" = "yes" ; then
3162 echo "CONFIG_PREADV=y" >> $config_host_mak
3164 if test "$fdt" = "yes" ; then
3165 echo "CONFIG_FDT=y" >> $config_host_mak
3167 if test "$signalfd" = "yes" ; then
3168 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
3170 if test "$tcg_interpreter" = "yes" ; then
3171 echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
3173 if test "$need_offsetof" = "yes" ; then
3174 echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
3176 if test "$fdatasync" = "yes" ; then
3177 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
3179 if test $cpu_emulation = "yes"; then
3180 echo "CONFIG_CPU_EMULATION=y" >> $config_host_mak
3181 else
3182 echo "CONFIG_NO_CPU_EMULATION=y" >> $config_host_mak
3184 if test "$madvise" = "yes" ; then
3185 echo "CONFIG_MADVISE=y" >> $config_host_mak
3187 if test "$posix_madvise" = "yes" ; then
3188 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
3191 if test "$spice" = "yes" ; then
3192 echo "CONFIG_SPICE=y" >> $config_host_mak
3195 if test "$smartcard" = "yes" ; then
3196 echo "CONFIG_SMARTCARD=y" >> $config_host_mak
3199 if test "$smartcard_nss" = "yes" ; then
3200 echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
3203 if test "$usb_redir" = "yes" ; then
3204 echo "CONFIG_USB_REDIR=y" >> $config_host_mak
3207 if test "$opengl" = "yes" ; then
3208 echo "CONFIG_OPENGL=y" >> $config_host_mak
3211 if test "$libiscsi" = "yes" ; then
3212 echo "CONFIG_LIBISCSI=y" >> $config_host_mak
3215 # XXX: suppress that
3216 if [ "$bsd" = "yes" ] ; then
3217 echo "CONFIG_BSD=y" >> $config_host_mak
3220 echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
3222 if test "$zero_malloc" = "yes" ; then
3223 echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
3225 if test "$rbd" = "yes" ; then
3226 echo "CONFIG_RBD=y" >> $config_host_mak
3229 if test "$ucontext_coroutine" = "yes" ; then
3230 echo "CONFIG_UCONTEXT_COROUTINE=y" >> $config_host_mak
3233 if test "$open_by_handle_at" = "yes" ; then
3234 echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
3237 if test "$linux_magic_h" = "yes" ; then
3238 echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
3241 # USB host support
3242 case "$usb" in
3243 linux)
3244 echo "HOST_USB=linux" >> $config_host_mak
3246 bsd)
3247 echo "HOST_USB=bsd" >> $config_host_mak
3250 echo "HOST_USB=stub" >> $config_host_mak
3252 esac
3254 # use default implementation for tracing backend-specific routines
3255 trace_default=yes
3256 echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
3257 if test "$trace_backend" = "nop"; then
3258 echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
3260 if test "$trace_backend" = "simple"; then
3261 echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
3262 trace_default=no
3263 # Set the appropriate trace file.
3264 trace_file="\"$trace_file-\" FMT_pid"
3266 if test "$trace_backend" = "stderr"; then
3267 echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
3268 trace_default=no
3270 if test "$trace_backend" = "ust"; then
3271 echo "CONFIG_TRACE_UST=y" >> $config_host_mak
3273 if test "$trace_backend" = "dtrace"; then
3274 echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
3275 if test "$trace_backend_stap" = "yes" ; then
3276 echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
3279 echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
3280 if test "$trace_default" = "yes"; then
3281 echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
3284 echo "TOOLS=$tools" >> $config_host_mak
3285 echo "ROMS=$roms" >> $config_host_mak
3286 echo "MAKE=$make" >> $config_host_mak
3287 echo "INSTALL=$install" >> $config_host_mak
3288 echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
3289 echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
3290 echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
3291 echo "PYTHON=$python" >> $config_host_mak
3292 echo "CC=$cc" >> $config_host_mak
3293 echo "CC_I386=$cc_i386" >> $config_host_mak
3294 echo "HOST_CC=$host_cc" >> $config_host_mak
3295 echo "AR=$ar" >> $config_host_mak
3296 echo "OBJCOPY=$objcopy" >> $config_host_mak
3297 echo "LD=$ld" >> $config_host_mak
3298 echo "WINDRES=$windres" >> $config_host_mak
3299 echo "LIBTOOL=$libtool" >> $config_host_mak
3300 echo "CFLAGS=$CFLAGS" >> $config_host_mak
3301 echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
3302 echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
3303 if test "$sparse" = "yes" ; then
3304 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
3305 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
3306 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
3308 echo "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
3309 echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
3310 echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
3311 echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
3312 echo "LIBS+=$LIBS" >> $config_host_mak
3313 echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
3314 echo "EXESUF=$EXESUF" >> $config_host_mak
3315 echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
3317 # generate list of library paths for linker script
3319 $ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
3321 if test -f ${config_host_ld}~ ; then
3322 if cmp -s $config_host_ld ${config_host_ld}~ ; then
3323 mv ${config_host_ld}~ $config_host_ld
3324 else
3325 rm ${config_host_ld}~
3329 for d in libdis libdis-user; do
3330 mkdir -p $d
3331 symlink $source_path/Makefile.dis $d/Makefile
3332 echo > $d/config.mak
3333 done
3335 # use included Linux headers
3336 if test "$linux" = "yes" ; then
3337 mkdir -p linux-headers
3338 case "$cpu" in
3339 i386|x86_64)
3340 symlink $source_path/linux-headers/asm-x86 linux-headers/asm
3342 ppcemb|ppc|ppc64)
3343 symlink $source_path/linux-headers/asm-powerpc linux-headers/asm
3345 s390x)
3346 symlink $source_path/linux-headers/asm-s390 linux-headers/asm
3348 esac
3351 for target in $target_list; do
3352 target_dir="$target"
3353 config_target_mak=$target_dir/config-target.mak
3354 target_arch2=`echo $target | cut -d '-' -f 1`
3355 target_bigendian="no"
3357 case "$target_arch2" in
3358 armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
3359 target_bigendian=yes
3361 esac
3362 target_softmmu="no"
3363 target_user_only="no"
3364 target_linux_user="no"
3365 target_darwin_user="no"
3366 target_bsd_user="no"
3367 case "$target" in
3368 ${target_arch2}-softmmu)
3369 target_softmmu="yes"
3371 ${target_arch2}-linux-user)
3372 if test "$linux" != "yes" ; then
3373 echo "ERROR: Target '$target' is only available on a Linux host"
3374 exit 1
3376 target_user_only="yes"
3377 target_linux_user="yes"
3379 ${target_arch2}-darwin-user)
3380 if test "$darwin" != "yes" ; then
3381 echo "ERROR: Target '$target' is only available on a Darwin host"
3382 exit 1
3384 target_user_only="yes"
3385 target_darwin_user="yes"
3387 ${target_arch2}-bsd-user)
3388 if test "$bsd" != "yes" ; then
3389 echo "ERROR: Target '$target' is only available on a BSD host"
3390 exit 1
3392 target_user_only="yes"
3393 target_bsd_user="yes"
3396 echo "ERROR: Target '$target' not recognised"
3397 exit 1
3399 esac
3401 mkdir -p $target_dir
3402 mkdir -p $target_dir/fpu
3403 mkdir -p $target_dir/tcg
3404 mkdir -p $target_dir/ide
3405 mkdir -p $target_dir/9pfs
3406 mkdir -p $target_dir/kvm
3407 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
3408 mkdir -p $target_dir/nwfpe
3410 symlink $source_path/Makefile.target $target_dir/Makefile
3413 echo "# Automatically generated by configure - do not modify" > $config_target_mak
3415 bflt="no"
3416 target_nptl="no"
3417 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
3418 gdb_xml_files=""
3419 target_short_alignment=2
3420 target_int_alignment=4
3421 target_long_alignment=4
3422 target_llong_alignment=8
3423 target_libs_softmmu=
3425 TARGET_ARCH="$target_arch2"
3426 TARGET_BASE_ARCH=""
3427 TARGET_ABI_DIR=""
3429 case "$target_arch2" in
3430 i386)
3431 target_phys_bits=64
3433 x86_64)
3434 TARGET_BASE_ARCH=i386
3435 target_phys_bits=64
3436 target_long_alignment=8
3438 alpha)
3439 target_phys_bits=64
3440 target_long_alignment=8
3441 target_nptl="yes"
3443 arm|armeb)
3444 TARGET_ARCH=arm
3445 bflt="yes"
3446 target_nptl="yes"
3447 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
3448 target_phys_bits=32
3449 target_llong_alignment=4
3451 cris)
3452 target_nptl="yes"
3453 target_phys_bits=32
3455 lm32)
3456 target_phys_bits=32
3457 target_libs_softmmu="$opengl_libs"
3459 m68k)
3460 bflt="yes"
3461 gdb_xml_files="cf-core.xml cf-fp.xml"
3462 target_phys_bits=32
3463 target_int_alignment=2
3464 target_long_alignment=2
3465 target_llong_alignment=2
3467 microblaze|microblazeel)
3468 TARGET_ARCH=microblaze
3469 bflt="yes"
3470 target_nptl="yes"
3471 target_phys_bits=32
3472 target_libs_softmmu="$fdt_libs"
3474 mips|mipsel)
3475 TARGET_ARCH=mips
3476 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
3477 target_nptl="yes"
3478 target_phys_bits=64
3480 mipsn32|mipsn32el)
3481 TARGET_ARCH=mipsn32
3482 TARGET_BASE_ARCH=mips
3483 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
3484 target_phys_bits=64
3486 mips64|mips64el)
3487 TARGET_ARCH=mips64
3488 TARGET_BASE_ARCH=mips
3489 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
3490 target_phys_bits=64
3491 target_long_alignment=8
3493 ppc)
3494 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
3495 target_phys_bits=64
3496 target_nptl="yes"
3497 target_libs_softmmu="$fdt_libs"
3499 ppcemb)
3500 TARGET_BASE_ARCH=ppc
3501 TARGET_ABI_DIR=ppc
3502 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
3503 target_phys_bits=64
3504 target_nptl="yes"
3505 target_libs_softmmu="$fdt_libs"
3507 ppc64)
3508 TARGET_BASE_ARCH=ppc
3509 TARGET_ABI_DIR=ppc
3510 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
3511 target_phys_bits=64
3512 target_long_alignment=8
3513 target_libs_softmmu="$fdt_libs"
3515 ppc64abi32)
3516 TARGET_ARCH=ppc64
3517 TARGET_BASE_ARCH=ppc
3518 TARGET_ABI_DIR=ppc
3519 echo "TARGET_ABI32=y" >> $config_target_mak
3520 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
3521 target_phys_bits=64
3522 target_libs_softmmu="$fdt_libs"
3524 sh4|sh4eb)
3525 TARGET_ARCH=sh4
3526 bflt="yes"
3527 target_nptl="yes"
3528 target_phys_bits=32
3530 sparc)
3531 target_phys_bits=64
3533 sparc64)
3534 TARGET_BASE_ARCH=sparc
3535 target_phys_bits=64
3536 target_long_alignment=8
3538 sparc32plus)
3539 TARGET_ARCH=sparc64
3540 TARGET_BASE_ARCH=sparc
3541 TARGET_ABI_DIR=sparc
3542 echo "TARGET_ABI32=y" >> $config_target_mak
3543 target_phys_bits=64
3545 s390x)
3546 target_nptl="yes"
3547 target_phys_bits=64
3548 target_long_alignment=8
3550 unicore32)
3551 target_phys_bits=32
3553 xtensa|xtensaeb)
3554 TARGET_ARCH=xtensa
3555 target_phys_bits=32
3558 echo "Unsupported target CPU"
3559 exit 1
3561 esac
3562 echo "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak
3563 echo "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak
3564 echo "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak
3565 echo "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak
3566 echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
3567 target_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
3568 echo "TARGET_$target_arch_name=y" >> $config_target_mak
3569 echo "TARGET_ARCH2=$target_arch2" >> $config_target_mak
3570 # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
3571 if [ "$TARGET_BASE_ARCH" = "" ]; then
3572 TARGET_BASE_ARCH=$TARGET_ARCH
3574 echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
3575 if [ "$TARGET_ABI_DIR" = "" ]; then
3576 TARGET_ABI_DIR=$TARGET_ARCH
3578 echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
3579 case "$target_arch2" in
3580 i386|x86_64)
3581 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
3582 target_phys_bits=64
3583 echo "CONFIG_XEN=y" >> $config_target_mak
3584 else
3585 echo "CONFIG_NO_XEN=y" >> $config_target_mak
3589 echo "CONFIG_NO_XEN=y" >> $config_target_mak
3590 esac
3591 case "$target_arch2" in
3592 i386|x86_64|ppcemb|ppc|ppc64|s390x)
3593 # Make sure the target and host cpus are compatible
3594 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
3595 \( "$target_arch2" = "$cpu" -o \
3596 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
3597 \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \
3598 \( "$target_arch2" = "ppc" -a "$cpu" = "ppc64" \) -o \
3599 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
3600 \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \
3601 \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then
3602 echo "CONFIG_KVM=y" >> $config_target_mak
3603 echo "CONFIG_KVM_OPTIONS=y" >> $config_host_mak
3604 if test "$vhost_net" = "yes" ; then
3605 echo "CONFIG_VHOST_NET=y" >> $config_target_mak
3607 if test $kvm_cap_pit = "yes" ; then
3608 echo "CONFIG_KVM_PIT=y" >> $config_target_mak
3610 if test $kvm_cap_device_assignment = "yes" ; then
3611 echo "CONFIG_KVM_DEVICE_ASSIGNMENT=y" >> $config_target_mak
3614 esac
3615 if test "$target_arch2" = "ppc64" -a "$fdt" = "yes"; then
3616 echo "CONFIG_PSERIES=y" >> $config_target_mak
3618 if test "$target_bigendian" = "yes" ; then
3619 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
3621 if test "$target_softmmu" = "yes" ; then
3622 echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
3623 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
3624 echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak
3625 echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
3626 echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
3628 if test "$target_user_only" = "yes" ; then
3629 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
3630 echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
3632 if test "$target_linux_user" = "yes" ; then
3633 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
3635 if test "$target_darwin_user" = "yes" ; then
3636 echo "CONFIG_DARWIN_USER=y" >> $config_target_mak
3638 if test "$smartcard_nss" = "yes" ; then
3639 echo "subdir-$target: subdir-libcacard" >> $config_host_mak
3640 echo "libcacard_libs=$libcacard_libs" >> $config_host_mak
3641 echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
3643 list=""
3644 if test ! -z "$gdb_xml_files" ; then
3645 for x in $gdb_xml_files; do
3646 list="$list $source_path/gdb-xml/$x"
3647 done
3648 echo "TARGET_XML_FILES=$list" >> $config_target_mak
3651 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
3652 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
3654 if test "$target_user_only" = "yes" \
3655 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
3656 echo "CONFIG_USE_NPTL=y" >> $config_target_mak
3658 if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
3659 echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
3661 if test "$target_bsd_user" = "yes" ; then
3662 echo "CONFIG_BSD_USER=y" >> $config_target_mak
3665 # generate QEMU_CFLAGS/LDFLAGS for targets
3667 cflags=""
3668 includes=""
3669 ldflags=""
3671 if test "$tcg_interpreter" = "yes"; then
3672 includes="-I\$(SRC_PATH)/tcg/tci $includes"
3673 elif test "$ARCH" = "sparc64" ; then
3674 includes="-I\$(SRC_PATH)/tcg/sparc $includes"
3675 elif test "$ARCH" = "s390x" ; then
3676 includes="-I\$(SRC_PATH)/tcg/s390 $includes"
3677 elif test "$ARCH" = "x86_64" ; then
3678 includes="-I\$(SRC_PATH)/tcg/i386 $includes"
3679 else
3680 includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes"
3682 includes="-I\$(SRC_PATH)/tcg $includes"
3684 if test "$linux" = "yes" ; then
3685 includes="-I\$(SRC_PATH)/linux-headers $includes"
3688 if test "$target_user_only" = "yes" ; then
3689 libdis_config_mak=libdis-user/config.mak
3690 else
3691 libdis_config_mak=libdis/config.mak
3694 for i in $ARCH $TARGET_BASE_ARCH ; do
3695 case "$i" in
3696 alpha)
3697 echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
3698 echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak
3700 arm)
3701 echo "CONFIG_ARM_DIS=y" >> $config_target_mak
3702 echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak
3704 cris)
3705 echo "CONFIG_CRIS_DIS=y" >> $config_target_mak
3706 echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak
3708 hppa)
3709 echo "CONFIG_HPPA_DIS=y" >> $config_target_mak
3710 echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak
3712 i386|x86_64)
3713 echo "CONFIG_I386_DIS=y" >> $config_target_mak
3714 echo "CONFIG_I386_DIS=y" >> $libdis_config_mak
3716 ia64*)
3717 echo "CONFIG_IA64_DIS=y" >> $config_target_mak
3718 echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak
3720 m68k)
3721 echo "CONFIG_M68K_DIS=y" >> $config_target_mak
3722 echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak
3724 microblaze*)
3725 echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak
3726 echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak
3728 mips*)
3729 echo "CONFIG_MIPS_DIS=y" >> $config_target_mak
3730 echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak
3732 ppc*)
3733 echo "CONFIG_PPC_DIS=y" >> $config_target_mak
3734 echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak
3736 s390*)
3737 echo "CONFIG_S390_DIS=y" >> $config_target_mak
3738 echo "CONFIG_S390_DIS=y" >> $libdis_config_mak
3740 sh4)
3741 echo "CONFIG_SH4_DIS=y" >> $config_target_mak
3742 echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak
3744 sparc*)
3745 echo "CONFIG_SPARC_DIS=y" >> $config_target_mak
3746 echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak
3748 xtensa*)
3749 echo "CONFIG_XTENSA_DIS=y" >> $config_target_mak
3750 echo "CONFIG_XTENSA_DIS=y" >> $libdis_config_mak
3752 esac
3753 done
3754 if test "$tcg_interpreter" = "yes" ; then
3755 echo "CONFIG_TCI_DIS=y" >> $config_target_mak
3756 echo "CONFIG_TCI_DIS=y" >> $libdis_config_mak
3759 case "$ARCH" in
3760 alpha)
3761 # Ensure there's only a single GP
3762 cflags="-msmall-data $cflags"
3764 esac
3766 if test "$target_softmmu" = "yes" ; then
3767 case "$TARGET_BASE_ARCH" in
3768 arm)
3769 cflags="-DHAS_AUDIO $cflags"
3771 lm32)
3772 cflags="-DHAS_AUDIO $cflags"
3774 i386|mips|ppc)
3775 cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
3777 esac
3780 if test "$target_softmmu" = "yes" -a \( \
3781 "$TARGET_ARCH" = "microblaze" -o \
3782 "$TARGET_ARCH" = "cris" \) ; then
3783 echo "CONFIG_NEED_MMU=y" >> $config_target_mak
3786 if test "$gprof" = "yes" ; then
3787 echo "TARGET_GPROF=yes" >> $config_target_mak
3788 if test "$target_linux_user" = "yes" ; then
3789 cflags="-p $cflags"
3790 ldflags="-p $ldflags"
3792 if test "$target_softmmu" = "yes" ; then
3793 ldflags="-p $ldflags"
3794 echo "GPROF_CFLAGS=-p" >> $config_target_mak
3798 if test "$ARCH" = "tci"; then
3799 linker_script=""
3800 else
3801 linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
3804 if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
3805 case "$ARCH" in
3806 sparc)
3807 # -static is used to avoid g1/g3 usage by the dynamic linker
3808 ldflags="$linker_script -static $ldflags"
3810 alpha | s390x)
3811 # The default placement of the application is fine.
3814 ldflags="$linker_script $ldflags"
3816 esac
3819 echo "LDFLAGS+=$ldflags" >> $config_target_mak
3820 echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
3821 echo "QEMU_INCLUDES+=$includes" >> $config_target_mak
3823 done # for target in $targets
3825 # build tree in object directory in case the source is not in the current directory
3826 DIRS="tests tests/tcg tests/tcg/cris slirp audio block net pc-bios/optionrom"
3827 DIRS="$DIRS pc-bios/spapr-rtas"
3828 DIRS="$DIRS roms/seabios roms/vgabios"
3829 DIRS="$DIRS fsdev ui"
3830 DIRS="$DIRS qapi qapi-generated"
3831 DIRS="$DIRS qga trace qom"
3832 FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
3833 FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
3834 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
3835 FILES="$FILES pc-bios/spapr-rtas/Makefile"
3836 FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
3837 for bios_file in \
3838 $source_path/pc-bios/*.bin \
3839 $source_path/pc-bios/*.rom \
3840 $source_path/pc-bios/*.dtb \
3841 $source_path/pc-bios/openbios-* \
3842 $source_path/pc-bios/palcode-*
3844 FILES="$FILES pc-bios/`basename $bios_file`"
3845 done
3846 mkdir -p $DIRS
3847 for f in $FILES ; do
3848 if [ -e "$source_path/$f" ] && ! [ -e "$f" ]; then
3849 symlink "$source_path/$f" "$f"
3851 done
3853 # temporary config to build submodules
3854 for rom in seabios vgabios ; do
3855 config_mak=roms/$rom/config.mak
3856 echo "# Automatically generated by configure - do not modify" > $config_mak
3857 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
3858 echo "CC=$cc" >> $config_mak
3859 echo "BCC=bcc" >> $config_mak
3860 echo "CPP=${cross_prefix}cpp" >> $config_mak
3861 echo "OBJCOPY=objcopy" >> $config_mak
3862 echo "IASL=iasl" >> $config_mak
3863 echo "LD=$ld" >> $config_mak
3864 done
3866 for hwlib in 32 64; do
3867 d=libhw$hwlib
3868 mkdir -p $d
3869 mkdir -p $d/ide
3870 symlink $source_path/Makefile.hw $d/Makefile
3871 mkdir -p $d/9pfs
3872 echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
3873 done
3875 if [ "$source_path" != `pwd` ]; then
3876 # out of tree build
3877 mkdir -p libcacard
3878 rm -f libcacard/Makefile
3879 symlink "$source_path/libcacard/Makefile" libcacard/Makefile
3882 d=libuser
3883 mkdir -p $d
3884 mkdir -p $d/trace
3885 symlink $source_path/Makefile.user $d/Makefile
3887 if test "$docs" = "yes" ; then
3888 mkdir -p QMP