qemu-kvm: Fix save/restore of in-kernel i8259
[qemu-kvm.git] / configure
blob656ff2b5bc24ce6aae88a3f3976a1a3553493866
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 io_thread="yes"
186 mixemu="no"
187 kvm_cap_pit="yes"
188 kvm_cap_device_assignment="yes"
189 aix="no"
190 blobs="yes"
191 pkgversion=" ($(kvm_version))"
192 cpu_emulation="yes"
193 check_utests=""
194 pie=""
195 zero_malloc=""
196 trace_backend="nop"
197 trace_file="trace"
198 spice=""
199 rbd=""
200 smartcard=""
201 smartcard_nss=""
202 usb_redir=""
203 opengl=""
204 zlib="yes"
205 guest_agent="yes"
206 libiscsi=""
208 # parse CC options first
209 for opt do
210 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
211 case "$opt" in
212 --cross-prefix=*) cross_prefix="$optarg"
214 --cc=*) CC="$optarg"
216 --source-path=*) source_path="$optarg"
218 --cpu=*) cpu="$optarg"
220 --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
222 --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
224 --sparc_cpu=*)
225 sparc_cpu="$optarg"
226 case $sparc_cpu in
227 v7|v8|v8plus|v8plusa)
228 cpu="sparc"
231 cpu="sparc64"
234 echo "undefined SPARC architecture. Exiting";
235 exit 1
237 esac
239 esac
240 done
241 # OS specific
242 # Using uname is really, really broken. Once we have the right set of checks
243 # we can eliminate it's usage altogether
245 cc="${CC-${cross_prefix}gcc}"
246 ar="${AR-${cross_prefix}ar}"
247 objcopy="${OBJCOPY-${cross_prefix}objcopy}"
248 ld="${LD-${cross_prefix}ld}"
249 libtool="${LIBTOOL-${cross_prefix}libtool}"
250 strip="${STRIP-${cross_prefix}strip}"
251 windres="${WINDRES-${cross_prefix}windres}"
252 pkg_config="${PKG_CONFIG-${cross_prefix}pkg-config}"
253 sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
255 # default flags for all hosts
256 QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
257 CFLAGS="-g $CFLAGS"
258 QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
259 QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
260 QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
261 QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
262 QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/fpu"
263 LDFLAGS="-g $LDFLAGS"
265 # make source path absolute
266 source_path=`cd "$source_path"; pwd`
268 check_define() {
269 cat > $TMPC <<EOF
270 #if !defined($1)
271 #error $1 not defined
272 #endif
273 int main(void) { return 0; }
275 compile_object
278 if test ! -z "$cpu" ; then
279 # command line argument
281 elif check_define __i386__ ; then
282 cpu="i386"
283 elif check_define __x86_64__ ; then
284 cpu="x86_64"
285 elif check_define __sparc__ ; then
286 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
287 # They must be specified using --sparc_cpu
288 if check_define __arch64__ ; then
289 cpu="sparc64"
290 else
291 cpu="sparc"
293 elif check_define _ARCH_PPC ; then
294 if check_define _ARCH_PPC64 ; then
295 cpu="ppc64"
296 else
297 cpu="ppc"
299 elif check_define __mips__ ; then
300 cpu="mips"
301 elif check_define __ia64__ ; then
302 cpu="ia64"
303 elif check_define __s390__ ; then
304 if check_define __s390x__ ; then
305 cpu="s390x"
306 else
307 cpu="s390"
309 elif check_define __arm__ ; then
310 cpu="arm"
311 elif check_define __hppa__ ; then
312 cpu="hppa"
313 else
314 cpu=`uname -m`
317 case "$cpu" in
318 alpha|cris|ia64|lm32|m68k|microblaze|ppc|ppc64|sparc64|unicore32)
319 cpu="$cpu"
321 i386|i486|i586|i686|i86pc|BePC)
322 cpu="i386"
324 x86_64|amd64)
325 cpu="x86_64"
327 armv*b|armv*l|arm)
328 cpu="arm"
330 hppa|parisc|parisc64)
331 cpu="hppa"
333 mips*)
334 cpu="mips"
336 s390)
337 cpu="s390"
339 s390x)
340 cpu="s390x"
342 sparc|sun4[cdmuv])
343 cpu="sparc"
346 echo "Unsupported CPU = $cpu"
347 exit 1
349 esac
351 # OS specific
352 if check_define __linux__ ; then
353 targetos="Linux"
354 elif check_define _WIN32 ; then
355 targetos='MINGW32'
356 elif check_define __OpenBSD__ ; then
357 targetos='OpenBSD'
358 elif check_define __sun__ ; then
359 targetos='SunOS'
360 elif check_define __HAIKU__ ; then
361 targetos='Haiku'
362 else
363 targetos=`uname -s`
366 case $targetos in
367 CYGWIN*)
368 mingw32="yes"
369 QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
370 audio_possible_drivers="winwave sdl"
371 audio_drv_list="winwave"
373 MINGW32*)
374 mingw32="yes"
375 audio_possible_drivers="winwave dsound sdl fmod"
376 audio_drv_list="winwave"
378 GNU/kFreeBSD)
379 bsd="yes"
380 audio_drv_list="oss"
381 audio_possible_drivers="oss sdl esd pa"
383 FreeBSD)
384 bsd="yes"
385 make="${MAKE-gmake}"
386 audio_drv_list="oss"
387 audio_possible_drivers="oss sdl esd pa"
388 # needed for kinfo_getvmmap(3) in libutil.h
389 LIBS="-lutil $LIBS"
391 DragonFly)
392 bsd="yes"
393 make="${MAKE-gmake}"
394 audio_drv_list="oss"
395 audio_possible_drivers="oss sdl esd pa"
397 NetBSD)
398 bsd="yes"
399 make="${MAKE-gmake}"
400 audio_drv_list="oss"
401 audio_possible_drivers="oss sdl esd"
402 oss_lib="-lossaudio"
404 OpenBSD)
405 bsd="yes"
406 make="${MAKE-gmake}"
407 audio_drv_list="oss"
408 audio_possible_drivers="oss sdl esd"
409 oss_lib="-lossaudio"
411 Darwin)
412 bsd="yes"
413 darwin="yes"
414 # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can
415 # run 64-bit userspace code
416 if [ "$cpu" = "i386" ] ; then
417 is_x86_64=`sysctl -n hw.optional.x86_64`
418 [ "$is_x86_64" = "1" ] && cpu=x86_64
420 if [ "$cpu" = "x86_64" ] ; then
421 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
422 LDFLAGS="-arch x86_64 $LDFLAGS"
423 else
424 QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
426 darwin_user="yes"
427 cocoa="yes"
428 audio_drv_list="coreaudio"
429 audio_possible_drivers="coreaudio sdl fmod"
430 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
431 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
433 SunOS)
434 solaris="yes"
435 make="${MAKE-gmake}"
436 install="${INSTALL-ginstall}"
437 ld="gld"
438 smbd="${SMBD-/usr/sfw/sbin/smbd}"
439 needs_libsunmath="no"
440 solarisrev=`uname -r | cut -f2 -d.`
441 # have to select again, because `uname -m` returns i86pc
442 # even on an x86_64 box.
443 solariscpu=`isainfo -k`
444 if test "${solariscpu}" = "amd64" ; then
445 cpu="x86_64"
447 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
448 if test "$solarisrev" -le 9 ; then
449 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
450 needs_libsunmath="yes"
451 QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
452 LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
453 LIBS="-lsunmath $LIBS"
454 else
455 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
456 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
457 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
458 echo "Studio 11 can be downloaded from www.sun.com."
459 exit 1
463 if test -f /usr/include/sys/soundcard.h ; then
464 audio_drv_list="oss"
466 audio_possible_drivers="oss sdl"
467 # needed for CMSG_ macros in sys/socket.h
468 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
469 # needed for TIOCWIN* defines in termios.h
470 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
471 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
472 LIBS="-lsocket -lnsl -lresolv $LIBS"
474 AIX)
475 aix="yes"
476 make="${MAKE-gmake}"
478 Haiku)
479 haiku="yes"
480 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
481 LIBS="-lposix_error_mapper -lnetwork $LIBS"
484 audio_drv_list="oss"
485 audio_possible_drivers="oss alsa sdl esd pa"
486 linux="yes"
487 linux_user="yes"
488 usb="linux"
489 kvm="yes"
490 vhost_net="yes"
491 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
492 audio_possible_drivers="$audio_possible_drivers fmod"
495 esac
497 if [ "$bsd" = "yes" ] ; then
498 if [ "$darwin" != "yes" ] ; then
499 usb="bsd"
501 bsd_user="yes"
504 : ${make=${MAKE-make}}
505 : ${install=${INSTALL-install}}
506 : ${python=${PYTHON-python}}
507 : ${smbd=${SMBD-/usr/sbin/smbd}}
509 if test "$mingw32" = "yes" ; then
510 EXESUF=".exe"
511 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
512 # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
513 QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
514 LIBS="-lwinmm -lws2_32 -liberty -liphlpapi $LIBS"
515 prefix="c:/Program Files/Qemu"
516 mandir="\${prefix}"
517 datadir="\${prefix}"
518 docdir="\${prefix}"
519 bindir="\${prefix}"
520 sysconfdir="\${prefix}"
521 confsuffix=""
522 guest_agent="no"
525 werror=""
527 for opt do
528 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
529 case "$opt" in
530 --help|-h) show_help=yes
532 --version|-V) exec cat $source_path/VERSION
534 --prefix=*) prefix="$optarg"
536 --interp-prefix=*) interp_prefix="$optarg"
538 --source-path=*)
540 --cross-prefix=*)
542 --cc=*)
544 --host-cc=*) host_cc="$optarg"
546 --make=*) make="$optarg"
548 --install=*) install="$optarg"
550 --python=*) python="$optarg"
552 --smbd=*) smbd="$optarg"
554 --extra-cflags=*)
556 --extra-ldflags=*)
558 --cpu=*)
560 --target-list=*) target_list="$optarg"
562 --enable-trace-backend=*) trace_backend="$optarg"
564 --with-trace-file=*) trace_file="$optarg"
566 --enable-gprof) gprof="yes"
568 --static)
569 static="yes"
570 LDFLAGS="-static $LDFLAGS"
572 --mandir=*) mandir="$optarg"
574 --bindir=*) bindir="$optarg"
576 --libdir=*) libdir="$optarg"
578 --includedir=*) includedir="$optarg"
580 --datadir=*) datadir="$optarg"
582 --docdir=*) docdir="$optarg"
584 --sysconfdir=*) sysconfdir="$optarg"
586 --sbindir=*|--libexecdir=*|--sharedstatedir=*|--localstatedir=*|\
587 --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
588 --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
589 # These switches are silently ignored, for compatibility with
590 # autoconf-generated configure scripts. This allows QEMU's
591 # configure to be used by RPM and similar macros that set
592 # lots of directory switches by default.
594 --disable-sdl) sdl="no"
596 --enable-sdl) sdl="yes"
598 --disable-vnc) vnc="no"
600 --enable-vnc) vnc="yes"
602 --fmod-lib=*) fmod_lib="$optarg"
604 --fmod-inc=*) fmod_inc="$optarg"
606 --oss-lib=*) oss_lib="$optarg"
608 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
610 --audio-drv-list=*) audio_drv_list="$optarg"
612 --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
614 --enable-debug-tcg) debug_tcg="yes"
616 --disable-debug-tcg) debug_tcg="no"
618 --enable-debug-mon) debug_mon="yes"
620 --disable-debug-mon) debug_mon="no"
622 --enable-debug)
623 # Enable debugging options that aren't excessively noisy
624 debug_tcg="yes"
625 debug_mon="yes"
626 debug="yes"
627 strip_opt="no"
629 --enable-sparse) sparse="yes"
631 --disable-sparse) sparse="no"
633 --disable-strip) strip_opt="no"
635 --disable-vnc-tls) vnc_tls="no"
637 --enable-vnc-tls) vnc_tls="yes"
639 --disable-vnc-sasl) vnc_sasl="no"
641 --enable-vnc-sasl) vnc_sasl="yes"
643 --disable-vnc-jpeg) vnc_jpeg="no"
645 --enable-vnc-jpeg) vnc_jpeg="yes"
647 --disable-vnc-png) vnc_png="no"
649 --enable-vnc-png) vnc_png="yes"
651 --disable-vnc-thread) vnc_thread="no"
653 --enable-vnc-thread) vnc_thread="yes"
655 --disable-slirp) slirp="no"
657 --disable-uuid) uuid="no"
659 --enable-uuid) uuid="yes"
661 --disable-vde) vde="no"
663 --enable-vde) vde="yes"
665 --disable-xen) xen="no"
667 --enable-xen) xen="yes"
669 --disable-brlapi) brlapi="no"
671 --enable-brlapi) brlapi="yes"
673 --disable-bluez) bluez="no"
675 --enable-bluez) bluez="yes"
677 --disable-kvm) kvm="no"
679 --enable-kvm) kvm="yes"
681 --disable-tcg-interpreter) tcg_interpreter="no"
683 --enable-tcg-interpreter) tcg_interpreter="yes"
685 --disable-kvm-pit) kvm_cap_pit="no"
687 --enable-kvm-pit) kvm_cap_pit="yes"
689 --disable-kvm-device-assignment) kvm_cap_device_assignment="no"
691 --enable-kvm-device-assignment) kvm_cap_device_assignment="yes"
693 --disable-spice) spice="no"
695 --enable-spice) spice="yes"
697 --disable-libiscsi) libiscsi="no"
699 --enable-libiscsi) libiscsi="yes"
701 --enable-profiler) profiler="yes"
703 --enable-cocoa)
704 cocoa="yes" ;
705 sdl="no" ;
706 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
708 --disable-system) softmmu="no"
710 --enable-system) softmmu="yes"
712 --disable-user)
713 linux_user="no" ;
714 bsd_user="no" ;
715 darwin_user="no"
717 --enable-user) ;;
718 --disable-linux-user) linux_user="no"
720 --enable-linux-user) linux_user="yes"
722 --disable-darwin-user) darwin_user="no"
724 --enable-darwin-user) darwin_user="yes"
726 --disable-bsd-user) bsd_user="no"
728 --enable-bsd-user) bsd_user="yes"
730 --enable-guest-base) guest_base="yes"
732 --disable-guest-base) guest_base="no"
734 --enable-pie) pie="yes"
736 --disable-pie) pie="no"
738 --enable-uname-release=*) uname_release="$optarg"
740 --sparc_cpu=*)
742 --enable-werror) werror="yes"
744 --disable-werror) werror="no"
746 --disable-curses) curses="no"
748 --enable-curses) curses="yes"
750 --disable-curl) curl="no"
752 --enable-curl) curl="yes"
754 --disable-fdt) fdt="no"
756 --enable-fdt) fdt="yes"
758 --disable-check-utests) check_utests="no"
760 --enable-check-utests) check_utests="yes"
762 --disable-nptl) nptl="no"
764 --enable-nptl) nptl="yes"
766 --enable-mixemu) mixemu="yes"
768 --disable-linux-aio) linux_aio="no"
770 --enable-linux-aio) linux_aio="yes"
772 --disable-attr) attr="no"
774 --enable-attr) attr="yes"
776 --disable-blobs) blobs="no"
778 --with-pkgversion=*) pkgversion=" ($optarg)"
780 --disable-docs) docs="no"
782 --enable-docs) docs="yes"
784 --disable-cpu-emulation) cpu_emulation="no"
786 --disable-vhost-net) vhost_net="no"
788 --enable-vhost-net) vhost_net="yes"
790 --disable-opengl) opengl="no"
792 --enable-opengl) opengl="yes"
794 --disable-rbd) rbd="no"
796 --enable-rbd) rbd="yes"
798 --disable-smartcard) smartcard="no"
800 --enable-smartcard) smartcard="yes"
802 --disable-smartcard-nss) smartcard_nss="no"
804 --enable-smartcard-nss) smartcard_nss="yes"
806 --disable-usb-redir) usb_redir="no"
808 --enable-usb-redir) usb_redir="yes"
810 --disable-zlib-test) zlib="no"
812 --enable-guest-agent) guest_agent="yes"
814 --disable-guest-agent) guest_agent="no"
816 *) echo "ERROR: unknown option $opt"; show_help="yes"
818 esac
819 done
822 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
823 # QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
825 host_guest_base="no"
826 case "$cpu" in
827 sparc) case $sparc_cpu in
828 v7|v8)
829 QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
831 v8plus|v8plusa)
832 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
834 *) # sparc_cpu not defined in the command line
835 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
836 esac
837 LDFLAGS="-m32 $LDFLAGS"
838 QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
839 if test "$solaris" = "no" ; then
840 QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
841 helper_cflags="-ffixed-i0"
844 sparc64)
845 QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
846 LDFLAGS="-m64 $LDFLAGS"
847 QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
848 if test "$solaris" != "no" ; then
849 QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
852 s390)
853 QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS"
854 LDFLAGS="-m31 $LDFLAGS"
855 host_guest_base="yes"
857 s390x)
858 QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS"
859 LDFLAGS="-m64 $LDFLAGS"
860 host_guest_base="yes"
862 i386)
863 QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
864 LDFLAGS="-m32 $LDFLAGS"
865 cc_i386='$(CC) -m32'
866 helper_cflags="-fomit-frame-pointer"
867 host_guest_base="yes"
869 x86_64)
870 QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
871 LDFLAGS="-m64 $LDFLAGS"
872 cc_i386='$(CC) -m32'
873 host_guest_base="yes"
875 arm*)
876 host_guest_base="yes"
878 ppc*)
879 host_guest_base="yes"
881 mips*)
882 host_guest_base="yes"
884 ia64*)
885 host_guest_base="yes"
887 hppa*)
888 host_guest_base="yes"
890 unicore32*)
891 host_guest_base="yes"
893 esac
895 [ -z "$guest_base" ] && guest_base="$host_guest_base"
898 default_target_list=""
900 # these targets are portable
901 if [ "$softmmu" = "yes" ] ; then
902 default_target_list="\
903 i386-softmmu \
904 x86_64-softmmu \
905 alpha-softmmu \
906 arm-softmmu \
907 cris-softmmu \
908 lm32-softmmu \
909 m68k-softmmu \
910 microblaze-softmmu \
911 microblazeel-softmmu \
912 mips-softmmu \
913 mipsel-softmmu \
914 mips64-softmmu \
915 mips64el-softmmu \
916 ppc-softmmu \
917 ppcemb-softmmu \
918 ppc64-softmmu \
919 sh4-softmmu \
920 sh4eb-softmmu \
921 sparc-softmmu \
922 sparc64-softmmu \
923 s390x-softmmu \
924 xtensa-softmmu \
925 xtensaeb-softmmu \
928 # the following are Linux specific
929 if [ "$linux_user" = "yes" ] ; then
930 default_target_list="${default_target_list}\
931 i386-linux-user \
932 x86_64-linux-user \
933 alpha-linux-user \
934 arm-linux-user \
935 armeb-linux-user \
936 cris-linux-user \
937 m68k-linux-user \
938 microblaze-linux-user \
939 microblazeel-linux-user \
940 mips-linux-user \
941 mipsel-linux-user \
942 ppc-linux-user \
943 ppc64-linux-user \
944 ppc64abi32-linux-user \
945 sh4-linux-user \
946 sh4eb-linux-user \
947 sparc-linux-user \
948 sparc64-linux-user \
949 sparc32plus-linux-user \
950 unicore32-linux-user \
951 s390x-linux-user \
954 # the following are Darwin specific
955 if [ "$darwin_user" = "yes" ] ; then
956 default_target_list="$default_target_list i386-darwin-user ppc-darwin-user "
958 # the following are BSD specific
959 if [ "$bsd_user" = "yes" ] ; then
960 default_target_list="${default_target_list}\
961 i386-bsd-user \
962 x86_64-bsd-user \
963 sparc-bsd-user \
964 sparc64-bsd-user \
968 if test x"$show_help" = x"yes" ; then
969 cat << EOF
971 Usage: configure [options]
972 Options: [defaults in brackets after descriptions]
975 echo "Standard options:"
976 echo " --help print this message"
977 echo " --prefix=PREFIX install in PREFIX [$prefix]"
978 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
979 echo " use %M for cpu name [$interp_prefix]"
980 echo " --target-list=LIST set target list (default: build everything)"
981 echo "Available targets: $default_target_list" | \
982 fold -s -w 53 | sed -e 's/^/ /'
983 echo ""
984 echo "Advanced options (experts only):"
985 echo " --source-path=PATH path of source code [$source_path]"
986 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
987 echo " --cc=CC use C compiler CC [$cc]"
988 echo " --host-cc=CC use C compiler CC [$host_cc] for code run at"
989 echo " build time"
990 echo " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS"
991 echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS"
992 echo " --make=MAKE use specified make [$make]"
993 echo " --install=INSTALL use specified install [$install]"
994 echo " --python=PYTHON use specified python [$python]"
995 echo " --smbd=SMBD use specified smbd [$smbd]"
996 echo " --static enable static build [$static]"
997 echo " --mandir=PATH install man pages in PATH"
998 echo " --datadir=PATH install firmware in PATH"
999 echo " --docdir=PATH install documentation in PATH"
1000 echo " --bindir=PATH install binaries in PATH"
1001 echo " --sysconfdir=PATH install config in PATH/qemu"
1002 echo " --enable-debug-tcg enable TCG debugging"
1003 echo " --disable-debug-tcg disable TCG debugging (default)"
1004 echo " --enable-debug enable common debug build options"
1005 echo " --enable-sparse enable sparse checker"
1006 echo " --disable-sparse disable sparse checker (default)"
1007 echo " --disable-strip disable stripping binaries"
1008 echo " --disable-werror disable compilation abort on warning"
1009 echo " --disable-sdl disable SDL"
1010 echo " --enable-sdl enable SDL"
1011 echo " --disable-vnc disable VNC"
1012 echo " --enable-vnc enable VNC"
1013 echo " --enable-cocoa enable COCOA (Mac OS X only)"
1014 echo " --audio-drv-list=LIST set audio drivers list:"
1015 echo " Available drivers: $audio_possible_drivers"
1016 echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
1017 echo " Available cards: $audio_possible_cards"
1018 echo " --block-drv-whitelist=L set block driver whitelist"
1019 echo " (affects only QEMU, not qemu-img)"
1020 echo " --enable-mixemu enable mixer emulation"
1021 echo " --disable-xen disable xen backend driver support"
1022 echo " --enable-xen enable xen backend driver support"
1023 echo " --disable-brlapi disable BrlAPI"
1024 echo " --enable-brlapi enable BrlAPI"
1025 echo " --disable-vnc-tls disable TLS encryption for VNC server"
1026 echo " --enable-vnc-tls enable TLS encryption for VNC server"
1027 echo " --disable-vnc-sasl disable SASL encryption for VNC server"
1028 echo " --enable-vnc-sasl enable SASL encryption for VNC server"
1029 echo " --disable-vnc-jpeg disable JPEG lossy compression for VNC server"
1030 echo " --enable-vnc-jpeg enable JPEG lossy compression for VNC server"
1031 echo " --disable-vnc-png disable PNG compression for VNC server (default)"
1032 echo " --enable-vnc-png enable PNG compression for VNC server"
1033 echo " --disable-vnc-thread disable threaded VNC server"
1034 echo " --enable-vnc-thread enable threaded VNC server"
1035 echo " --disable-curses disable curses output"
1036 echo " --enable-curses enable curses output"
1037 echo " --disable-curl disable curl connectivity"
1038 echo " --enable-curl enable curl connectivity"
1039 echo " --disable-fdt disable fdt device tree"
1040 echo " --enable-fdt enable fdt device tree"
1041 echo " --disable-check-utests disable check unit-tests"
1042 echo " --enable-check-utests enable check unit-tests"
1043 echo " --disable-bluez disable bluez stack connectivity"
1044 echo " --enable-bluez enable bluez stack connectivity"
1045 echo " --disable-slirp disable SLIRP userspace network connectivity"
1046 echo " --disable-kvm disable KVM acceleration support"
1047 echo " --enable-kvm enable KVM acceleration support"
1048 echo " --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)"
1049 echo " --disable-kvm-pit disable KVM pit support"
1050 echo " --enable-kvm-pit enable KVM pit support"
1051 echo " --disable-kvm-device-assignment disable KVM device assignment support"
1052 echo " --enable-kvm-device-assignment enable KVM device assignment support"
1053 echo " --disable-nptl disable usermode NPTL support"
1054 echo " --enable-nptl enable usermode NPTL support"
1055 echo " --enable-system enable all system emulation targets"
1056 echo " --disable-system disable all system emulation targets"
1057 echo " --enable-user enable supported user emulation targets"
1058 echo " --disable-user disable all user emulation targets"
1059 echo " --enable-linux-user enable all linux usermode emulation targets"
1060 echo " --disable-linux-user disable all linux usermode emulation targets"
1061 echo " --enable-darwin-user enable all darwin usermode emulation targets"
1062 echo " --disable-darwin-user disable all darwin usermode emulation targets"
1063 echo " --enable-bsd-user enable all BSD usermode emulation targets"
1064 echo " --disable-bsd-user disable all BSD usermode emulation targets"
1065 echo " --enable-guest-base enable GUEST_BASE support for usermode"
1066 echo " emulation targets"
1067 echo " --disable-guest-base disable GUEST_BASE support"
1068 echo " --enable-pie build Position Independent Executables"
1069 echo " --disable-pie do not build Position Independent Executables"
1070 echo " --fmod-lib path to FMOD library"
1071 echo " --fmod-inc path to FMOD includes"
1072 echo " --oss-lib path to OSS library"
1073 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
1074 echo " --cpu=CPU Build for host CPU [$cpu]"
1075 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
1076 echo " --disable-uuid disable uuid support"
1077 echo " --enable-uuid enable uuid support"
1078 echo " --disable-vde disable support for vde network"
1079 echo " --enable-vde enable support for vde network"
1080 echo " --disable-linux-aio disable Linux AIO support"
1081 echo " --enable-linux-aio enable Linux AIO support"
1082 echo " --disable-attr disables attr and xattr support"
1083 echo " --enable-attr enable attr and xattr support"
1084 echo " --disable-blobs disable installing provided firmware blobs"
1085 echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
1086 echo " --enable-docs enable documentation build"
1087 echo " --disable-docs disable documentation build"
1088 echo " --disable-vhost-net disable vhost-net acceleration support"
1089 echo " --enable-vhost-net enable vhost-net acceleration support"
1090 echo " --enable-trace-backend=B Set trace backend"
1091 echo " Available backends:" $("$source_path"/scripts/tracetool --list-backends)
1092 echo " --with-trace-file=NAME Full PATH,NAME of file to store traces"
1093 echo " Default:trace-<pid>"
1094 echo " --disable-spice disable spice"
1095 echo " --enable-spice enable spice"
1096 echo " --enable-rbd enable building the rados block device (rbd)"
1097 echo " --disable-libiscsi disable iscsi support"
1098 echo " --enable-libiscsi enable iscsi support"
1099 echo " --disable-smartcard disable smartcard support"
1100 echo " --enable-smartcard enable smartcard support"
1101 echo " --disable-smartcard-nss disable smartcard nss support"
1102 echo " --enable-smartcard-nss enable smartcard nss support"
1103 echo " --disable-usb-redir disable usb network redirection support"
1104 echo " --enable-usb-redir enable usb network redirection support"
1105 echo " --disable-guest-agent disable building of the QEMU Guest Agent"
1106 echo " --enable-guest-agent enable building of the QEMU Guest Agent"
1107 echo ""
1108 echo "NOTE: The object files are built at the place where configure is launched"
1109 exit 1
1112 # check that the C compiler works.
1113 cat > $TMPC <<EOF
1114 int main(void) { return 0; }
1117 if compile_object ; then
1118 : C compiler works ok
1119 else
1120 echo "ERROR: \"$cc\" either does not exist or does not work"
1121 exit 1
1124 gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
1125 gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
1126 gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
1127 gcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags"
1128 cat > $TMPC << EOF
1129 int main(void) { return 0; }
1131 for flag in $gcc_flags; do
1132 if compile_prog "$flag -Werror" "" ; then
1133 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1135 done
1137 if test "$static" = "yes" ; then
1138 if test "$pie" = "yes" ; then
1139 echo "static and pie are mutually incompatible"
1140 exit 1
1141 else
1142 pie="no"
1146 if test "$pie" = ""; then
1147 case "$cpu-$targetos" in
1148 i386-Linux|x86_64-Linux|i386-OpenBSD|x86_64-OpenBSD)
1151 pie="no"
1153 esac
1156 if test "$pie" != "no" ; then
1157 cat > $TMPC << EOF
1159 #ifdef __linux__
1160 # define THREAD __thread
1161 #else
1162 # define THREAD
1163 #endif
1165 static THREAD int tls_var;
1167 int main(void) { return tls_var; }
1170 if compile_prog "-fPIE -DPIE" "-pie"; then
1171 QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
1172 LDFLAGS="-pie $LDFLAGS"
1173 pie="yes"
1174 if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
1175 LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
1177 else
1178 if test "$pie" = "yes"; then
1179 echo "PIE not available due to missing toolchain support"
1180 exit 1
1181 else
1182 echo "Disabling PIE due to missing toolchain support"
1183 pie="no"
1189 # Solaris specific configure tool chain decisions
1191 if test "$solaris" = "yes" ; then
1192 if has $install; then
1194 else
1195 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
1196 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
1197 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
1198 exit 1
1200 if test "`path_of $install`" = "/usr/sbin/install" ; then
1201 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
1202 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
1203 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
1204 exit 1
1206 if has ar; then
1208 else
1209 echo "Error: No path includes ar"
1210 if test -f /usr/ccs/bin/ar ; then
1211 echo "Add /usr/ccs/bin to your path and rerun configure"
1213 exit 1
1217 if test "$guest_agent" != "no" ; then
1218 if has $python; then
1220 else
1221 echo "Python not found. Use --python=/path/to/python"
1222 exit 1
1226 if test -z "$target_list" ; then
1227 target_list="$default_target_list"
1228 else
1229 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
1231 if test -z "$target_list" ; then
1232 echo "No targets enabled"
1233 exit 1
1235 # see if system emulation was really requested
1236 case " $target_list " in
1237 *"-softmmu "*) softmmu=yes
1239 *) softmmu=no
1241 esac
1243 feature_not_found() {
1244 feature=$1
1246 echo "ERROR"
1247 echo "ERROR: User requested feature $feature"
1248 echo "ERROR: configure was not able to find it"
1249 echo "ERROR"
1250 exit 1;
1253 if test -z "$cross_prefix" ; then
1255 # ---
1256 # big/little endian test
1257 cat > $TMPC << EOF
1258 #include <inttypes.h>
1259 int main(int argc, char ** argv){
1260 volatile uint32_t i=0x01234567;
1261 return (*((uint8_t*)(&i))) == 0x67;
1265 if compile_prog "" "" ; then
1266 $TMPE && bigendian="yes"
1267 else
1268 echo big/little test failed
1271 else
1273 # if cross compiling, cannot launch a program, so make a static guess
1274 case "$cpu" in
1275 arm)
1276 # ARM can be either way; ask the compiler which one we are
1277 if check_define __ARMEB__; then
1278 bigendian=yes
1281 hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
1282 bigendian=yes
1284 esac
1288 # host long bits test, actually a pointer size test
1289 cat > $TMPC << EOF
1290 int sizeof_pointer_is_8[sizeof(void *) == 8 ? 1 : -1];
1292 if compile_object; then
1293 hostlongbits=64
1294 else
1295 hostlongbits=32
1299 ##########################################
1300 # NPTL probe
1302 if test "$nptl" != "no" ; then
1303 cat > $TMPC <<EOF
1304 #include <sched.h>
1305 #include <linux/futex.h>
1306 int main(void) {
1307 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1308 #error bork
1309 #endif
1310 return 0;
1314 if compile_object ; then
1315 nptl=yes
1316 else
1317 if test "$nptl" = "yes" ; then
1318 feature_not_found "nptl"
1320 nptl=no
1324 ##########################################
1325 # zlib check
1327 if test "$zlib" != "no" ; then
1328 cat > $TMPC << EOF
1329 #include <zlib.h>
1330 int main(void) { zlibVersion(); return 0; }
1332 if compile_prog "" "-lz" ; then
1334 else
1335 echo
1336 echo "Error: zlib check failed"
1337 echo "Make sure to have the zlib libs and headers installed."
1338 echo
1339 exit 1
1343 ##########################################
1344 # xen probe
1346 if test "$xen" != "no" ; then
1347 xen_libs="-lxenstore -lxenctrl -lxenguest"
1349 # First we test whether Xen headers and libraries are available.
1350 # If no, we are done and there is no Xen support.
1351 # If yes, more tests are run to detect the Xen version.
1353 # Xen (any)
1354 cat > $TMPC <<EOF
1355 #include <xenctrl.h>
1356 #include <xs.h>
1357 int main(void) {
1358 return 0;
1361 if ! compile_prog "" "$xen_libs" ; then
1362 # Xen not found
1363 if test "$xen" = "yes" ; then
1364 feature_not_found "xen"
1366 xen=no
1368 # Xen unstable
1369 elif (
1370 cat > $TMPC <<EOF
1371 #include <xenctrl.h>
1372 #include <xs.h>
1373 #include <stdint.h>
1374 #include <xen/hvm/hvm_info_table.h>
1375 #if !defined(HVM_MAX_VCPUS)
1376 # error HVM_MAX_VCPUS not defined
1377 #endif
1378 int main(void) {
1379 xc_interface *xc;
1380 xs_daemon_open();
1381 xc = xc_interface_open(0, 0, 0);
1382 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1383 xc_gnttab_open(NULL, 0);
1384 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1385 return 0;
1388 compile_prog "" "$xen_libs"
1389 ) ; then
1390 xen_ctrl_version=410
1391 xen=yes
1393 # Xen 4.0.0
1394 elif (
1395 cat > $TMPC <<EOF
1396 #include <xenctrl.h>
1397 #include <xs.h>
1398 #include <stdint.h>
1399 #include <xen/hvm/hvm_info_table.h>
1400 #if !defined(HVM_MAX_VCPUS)
1401 # error HVM_MAX_VCPUS not defined
1402 #endif
1403 int main(void) {
1404 struct xen_add_to_physmap xatp = {
1405 .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1407 xs_daemon_open();
1408 xc_interface_open();
1409 xc_gnttab_open();
1410 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1411 xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1412 return 0;
1415 compile_prog "" "$xen_libs"
1416 ) ; then
1417 xen_ctrl_version=400
1418 xen=yes
1420 # Xen 3.4.0
1421 elif (
1422 cat > $TMPC <<EOF
1423 #include <xenctrl.h>
1424 #include <xs.h>
1425 int main(void) {
1426 struct xen_add_to_physmap xatp = {
1427 .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1429 xs_daemon_open();
1430 xc_interface_open();
1431 xc_gnttab_open();
1432 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1433 xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1434 return 0;
1437 compile_prog "" "$xen_libs"
1438 ) ; then
1439 xen_ctrl_version=340
1440 xen=yes
1442 # Xen 3.3.0
1443 elif (
1444 cat > $TMPC <<EOF
1445 #include <xenctrl.h>
1446 #include <xs.h>
1447 int main(void) {
1448 xs_daemon_open();
1449 xc_interface_open();
1450 xc_gnttab_open();
1451 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1452 return 0;
1455 compile_prog "" "$xen_libs"
1456 ) ; then
1457 xen_ctrl_version=330
1458 xen=yes
1460 # Xen version unsupported
1461 else
1462 if test "$xen" = "yes" ; then
1463 feature_not_found "xen (unsupported version)"
1465 xen=no
1468 if test "$xen" = yes; then
1469 libs_softmmu="$xen_libs $libs_softmmu"
1473 ##########################################
1474 # pkg-config probe
1476 if ! has $pkg_config; then
1477 echo "Error: pkg-config binary '$pkg_config' not found"
1478 exit 1
1481 ##########################################
1482 # libtool probe
1484 if ! has $libtool; then
1485 libtool=
1488 ##########################################
1489 # Sparse probe
1490 if test "$sparse" != "no" ; then
1491 if has cgcc; then
1492 sparse=yes
1493 else
1494 if test "$sparse" = "yes" ; then
1495 feature_not_found "sparse"
1497 sparse=no
1501 ##########################################
1502 # SDL probe
1504 # Look for sdl configuration program (pkg-config or sdl-config). Try
1505 # sdl-config even without cross prefix, and favour pkg-config over sdl-config.
1506 if test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then
1507 sdl_config=sdl-config
1510 if $pkg_config sdl --modversion >/dev/null 2>&1; then
1511 sdlconfig="$pkg_config sdl"
1512 _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
1513 elif has ${sdl_config}; then
1514 sdlconfig="$sdl_config"
1515 _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1516 else
1517 if test "$sdl" = "yes" ; then
1518 feature_not_found "sdl"
1520 sdl=no
1522 if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
1523 echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
1526 sdl_too_old=no
1527 if test "$sdl" != "no" ; then
1528 cat > $TMPC << EOF
1529 #include <SDL.h>
1530 #undef main /* We don't want SDL to override our main() */
1531 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1533 sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
1534 if test "$static" = "yes" ; then
1535 sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
1536 else
1537 sdl_libs=`$sdlconfig --libs 2> /dev/null`
1539 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1540 if test "$_sdlversion" -lt 121 ; then
1541 sdl_too_old=yes
1542 else
1543 if test "$cocoa" = "no" ; then
1544 sdl=yes
1548 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
1549 if test "$sdl" = "yes" -a "$static" = "yes" ; then
1550 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
1551 sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1552 sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
1554 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1556 else
1557 sdl=no
1559 fi # static link
1560 else # sdl not found
1561 if test "$sdl" = "yes" ; then
1562 feature_not_found "sdl"
1564 sdl=no
1565 fi # sdl compile test
1568 if test "$sdl" = "yes" ; then
1569 cat > $TMPC <<EOF
1570 #include <SDL.h>
1571 #if defined(SDL_VIDEO_DRIVER_X11)
1572 #include <X11/XKBlib.h>
1573 #else
1574 #error No x11 support
1575 #endif
1576 int main(void) { return 0; }
1578 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1579 sdl_libs="$sdl_libs -lX11"
1581 libs_softmmu="$sdl_libs $libs_softmmu"
1584 ##########################################
1585 # VNC TLS detection
1586 if test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then
1587 cat > $TMPC <<EOF
1588 #include <gnutls/gnutls.h>
1589 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1591 vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
1592 vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
1593 if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
1594 vnc_tls=yes
1595 libs_softmmu="$vnc_tls_libs $libs_softmmu"
1596 else
1597 if test "$vnc_tls" = "yes" ; then
1598 feature_not_found "vnc-tls"
1600 vnc_tls=no
1604 ##########################################
1605 # VNC SASL detection
1606 if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
1607 cat > $TMPC <<EOF
1608 #include <sasl/sasl.h>
1609 #include <stdio.h>
1610 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
1612 # Assuming Cyrus-SASL installed in /usr prefix
1613 vnc_sasl_cflags=""
1614 vnc_sasl_libs="-lsasl2"
1615 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1616 vnc_sasl=yes
1617 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
1618 else
1619 if test "$vnc_sasl" = "yes" ; then
1620 feature_not_found "vnc-sasl"
1622 vnc_sasl=no
1626 ##########################################
1627 # VNC JPEG detection
1628 if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
1629 cat > $TMPC <<EOF
1630 #include <stdio.h>
1631 #include <jpeglib.h>
1632 int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
1634 vnc_jpeg_cflags=""
1635 vnc_jpeg_libs="-ljpeg"
1636 if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
1637 vnc_jpeg=yes
1638 libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
1639 else
1640 if test "$vnc_jpeg" = "yes" ; then
1641 feature_not_found "vnc-jpeg"
1643 vnc_jpeg=no
1647 ##########################################
1648 # VNC PNG detection
1649 if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
1650 cat > $TMPC <<EOF
1651 //#include <stdio.h>
1652 #include <png.h>
1653 #include <stddef.h>
1654 int main(void) {
1655 png_structp png_ptr;
1656 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
1657 return 0;
1660 if $pkg_config libpng --modversion >/dev/null 2>&1; then
1661 vnc_png_cflags=`$pkg_config libpng --cflags 2> /dev/null`
1662 vnc_png_libs=`$pkg_config libpng --libs 2> /dev/null`
1663 else
1664 vnc_png_cflags=""
1665 vnc_png_libs="-lpng"
1667 if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
1668 vnc_png=yes
1669 libs_softmmu="$vnc_png_libs $libs_softmmu"
1670 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
1671 else
1672 if test "$vnc_png" = "yes" ; then
1673 feature_not_found "vnc-png"
1675 vnc_png=no
1679 ##########################################
1680 # fnmatch() probe, used for ACL routines
1681 fnmatch="no"
1682 cat > $TMPC << EOF
1683 #include <fnmatch.h>
1684 int main(void)
1686 fnmatch("foo", "foo", 0);
1687 return 0;
1690 if compile_prog "" "" ; then
1691 fnmatch="yes"
1694 ##########################################
1695 # uuid_generate() probe, used for vdi block driver
1696 if test "$uuid" != "no" ; then
1697 uuid_libs="-luuid"
1698 cat > $TMPC << EOF
1699 #include <uuid/uuid.h>
1700 int main(void)
1702 uuid_t my_uuid;
1703 uuid_generate(my_uuid);
1704 return 0;
1707 if compile_prog "" "$uuid_libs" ; then
1708 uuid="yes"
1709 libs_softmmu="$uuid_libs $libs_softmmu"
1710 libs_tools="$uuid_libs $libs_tools"
1711 else
1712 if test "$uuid" = "yes" ; then
1713 feature_not_found "uuid"
1715 uuid=no
1719 ##########################################
1720 # xfsctl() probe, used for raw-posix
1721 if test "$xfs" != "no" ; then
1722 cat > $TMPC << EOF
1723 #include <stddef.h> /* NULL */
1724 #include <xfs/xfs.h>
1725 int main(void)
1727 xfsctl(NULL, 0, 0, NULL);
1728 return 0;
1731 if compile_prog "" "" ; then
1732 xfs="yes"
1733 else
1734 if test "$xfs" = "yes" ; then
1735 feature_not_found "xfs"
1737 xfs=no
1741 ##########################################
1742 # vde libraries probe
1743 if test "$vde" != "no" ; then
1744 vde_libs="-lvdeplug"
1745 cat > $TMPC << EOF
1746 #include <libvdeplug.h>
1747 int main(void)
1749 struct vde_open_args a = {0, 0, 0};
1750 vde_open("", "", &a);
1751 return 0;
1754 if compile_prog "" "$vde_libs" ; then
1755 vde=yes
1756 libs_softmmu="$vde_libs $libs_softmmu"
1757 libs_tools="$vde_libs $libs_tools"
1758 else
1759 if test "$vde" = "yes" ; then
1760 feature_not_found "vde"
1762 vde=no
1766 ##########################################
1767 # Sound support libraries probe
1769 audio_drv_probe()
1771 drv=$1
1772 hdr=$2
1773 lib=$3
1774 exp=$4
1775 cfl=$5
1776 cat > $TMPC << EOF
1777 #include <$hdr>
1778 int main(void) { $exp }
1780 if compile_prog "$cfl" "$lib" ; then
1782 else
1783 echo
1784 echo "Error: $drv check failed"
1785 echo "Make sure to have the $drv libs and headers installed."
1786 echo
1787 exit 1
1791 audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1792 for drv in $audio_drv_list; do
1793 case $drv in
1794 alsa)
1795 audio_drv_probe $drv alsa/asoundlib.h -lasound \
1796 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1797 libs_softmmu="-lasound $libs_softmmu"
1800 fmod)
1801 if test -z $fmod_lib || test -z $fmod_inc; then
1802 echo
1803 echo "Error: You must specify path to FMOD library and headers"
1804 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1805 echo
1806 exit 1
1808 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1809 libs_softmmu="$fmod_lib $libs_softmmu"
1812 esd)
1813 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1814 libs_softmmu="-lesd $libs_softmmu"
1815 audio_pt_int="yes"
1819 audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
1820 "pa_simple *s = 0; pa_simple_free(s); return 0;"
1821 libs_softmmu="-lpulse -lpulse-simple $libs_softmmu"
1822 audio_pt_int="yes"
1825 coreaudio)
1826 libs_softmmu="-framework CoreAudio $libs_softmmu"
1829 dsound)
1830 libs_softmmu="-lole32 -ldxguid $libs_softmmu"
1831 audio_win_int="yes"
1834 oss)
1835 libs_softmmu="$oss_lib $libs_softmmu"
1838 sdl|wav)
1839 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1842 winwave)
1843 libs_softmmu="-lwinmm $libs_softmmu"
1844 audio_win_int="yes"
1848 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
1849 echo
1850 echo "Error: Unknown driver '$drv' selected"
1851 echo "Possible drivers are: $audio_possible_drivers"
1852 echo
1853 exit 1
1856 esac
1857 done
1859 ##########################################
1860 # BrlAPI probe
1862 if test "$brlapi" != "no" ; then
1863 brlapi_libs="-lbrlapi"
1864 cat > $TMPC << EOF
1865 #include <brlapi.h>
1866 #include <stddef.h>
1867 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1869 if compile_prog "" "$brlapi_libs" ; then
1870 brlapi=yes
1871 libs_softmmu="$brlapi_libs $libs_softmmu"
1872 else
1873 if test "$brlapi" = "yes" ; then
1874 feature_not_found "brlapi"
1876 brlapi=no
1880 ##########################################
1881 # curses probe
1882 if test "$mingw32" = "yes" ; then
1883 curses_list="-lpdcurses"
1884 else
1885 curses_list="-lncurses -lcurses"
1888 if test "$curses" != "no" ; then
1889 curses_found=no
1890 cat > $TMPC << EOF
1891 #include <curses.h>
1892 #ifdef __OpenBSD__
1893 #define resize_term resizeterm
1894 #endif
1895 int main(void) {
1896 const char *s = curses_version();
1897 resize_term(0, 0);
1898 return s != 0;
1901 for curses_lib in $curses_list; do
1902 if compile_prog "" "$curses_lib" ; then
1903 curses_found=yes
1904 libs_softmmu="$curses_lib $libs_softmmu"
1905 break
1907 done
1908 if test "$curses_found" = "yes" ; then
1909 curses=yes
1910 else
1911 if test "$curses" = "yes" ; then
1912 feature_not_found "curses"
1914 curses=no
1918 ##########################################
1919 # curl probe
1921 if $pkg_config libcurl --modversion >/dev/null 2>&1; then
1922 curlconfig="$pkg_config libcurl"
1923 else
1924 curlconfig=curl-config
1927 if test "$curl" != "no" ; then
1928 cat > $TMPC << EOF
1929 #include <curl/curl.h>
1930 int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
1932 curl_cflags=`$curlconfig --cflags 2>/dev/null`
1933 curl_libs=`$curlconfig --libs 2>/dev/null`
1934 if compile_prog "$curl_cflags" "$curl_libs" ; then
1935 curl=yes
1936 libs_tools="$curl_libs $libs_tools"
1937 libs_softmmu="$curl_libs $libs_softmmu"
1938 else
1939 if test "$curl" = "yes" ; then
1940 feature_not_found "curl"
1942 curl=no
1944 fi # test "$curl"
1946 ##########################################
1947 # check framework probe
1949 if test "$check_utests" != "no" ; then
1950 cat > $TMPC << EOF
1951 #include <check.h>
1952 int main(void) { suite_create("qemu test"); return 0; }
1954 check_libs=`$pkg_config --libs check 2>/dev/null`
1955 if compile_prog "" $check_libs ; then
1956 check_utests=yes
1957 libs_tools="$check_libs $libs_tools"
1958 else
1959 if test "$check_utests" = "yes" ; then
1960 feature_not_found "check"
1962 check_utests=no
1964 fi # test "$check_utests"
1966 ##########################################
1967 # bluez support probe
1968 if test "$bluez" != "no" ; then
1969 cat > $TMPC << EOF
1970 #include <bluetooth/bluetooth.h>
1971 int main(void) { return bt_error(0); }
1973 bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
1974 bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
1975 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
1976 bluez=yes
1977 libs_softmmu="$bluez_libs $libs_softmmu"
1978 else
1979 if test "$bluez" = "yes" ; then
1980 feature_not_found "bluez"
1982 bluez="no"
1986 ##########################################
1987 # glib support probe
1988 if $pkg_config --modversion gthread-2.0 > /dev/null 2>&1 ; then
1989 glib_cflags=`$pkg_config --cflags gthread-2.0 2>/dev/null`
1990 glib_libs=`$pkg_config --libs gthread-2.0 2>/dev/null`
1991 LIBS="$glib_libs $LIBS"
1992 libs_qga="$glib_libs $libs_qga"
1993 else
1994 echo "glib-2.0 required to compile QEMU"
1995 exit 1
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 [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
2800 tools="qemu-nbd\$(EXESUF) $tools"
2801 if [ "$guest_agent" = "yes" ]; then
2802 tools="qemu-ga\$(EXESUF) $tools"
2804 if [ "$check_utests" = "yes" ]; then
2805 checks="check-qint check-qstring check-qdict check-qlist"
2806 checks="check-qfloat check-qjson $checks"
2808 test_progs="$checks test-coroutine test-qmp-output-visitor test-qmp-input-visitor"
2812 # Mac OS X ships with a broken assembler
2813 roms=
2814 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
2815 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
2816 "$softmmu" = yes ; then
2817 roms="optionrom"
2819 if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
2820 roms="$roms spapr-rtas"
2823 echo "Install prefix $prefix"
2824 echo "BIOS directory `eval echo $datadir`"
2825 echo "binary directory `eval echo $bindir`"
2826 echo "library directory `eval echo $libdir`"
2827 echo "include directory `eval echo $includedir`"
2828 echo "config directory `eval echo $sysconfdir`"
2829 if test "$mingw32" = "no" ; then
2830 echo "Manual directory `eval echo $mandir`"
2831 echo "ELF interp prefix $interp_prefix"
2833 echo "Source path $source_path"
2834 echo "C compiler $cc"
2835 echo "Host C compiler $host_cc"
2836 echo "CFLAGS $CFLAGS"
2837 echo "QEMU_CFLAGS $QEMU_CFLAGS"
2838 echo "LDFLAGS $LDFLAGS"
2839 echo "make $make"
2840 echo "install $install"
2841 echo "python $python"
2842 if test "$slirp" = "yes" ; then
2843 echo "smbd $smbd"
2845 echo "host CPU $cpu"
2846 echo "host big endian $bigendian"
2847 echo "target list $target_list"
2848 echo "tcg debug enabled $debug_tcg"
2849 echo "Mon debug enabled $debug_mon"
2850 echo "gprof enabled $gprof"
2851 echo "sparse enabled $sparse"
2852 echo "strip binaries $strip_opt"
2853 echo "profiler $profiler"
2854 echo "static build $static"
2855 echo "-Werror enabled $werror"
2856 if test "$darwin" = "yes" ; then
2857 echo "Cocoa support $cocoa"
2859 echo "SDL support $sdl"
2860 echo "curses support $curses"
2861 echo "curl support $curl"
2862 echo "check support $check_utests"
2863 echo "mingw32 support $mingw32"
2864 echo "Audio drivers $audio_drv_list"
2865 echo "Extra audio cards $audio_card_list"
2866 echo "Block whitelist $block_drv_whitelist"
2867 echo "Mixer emulation $mixemu"
2868 echo "VNC support $vnc"
2869 if test "$vnc" = "yes" ; then
2870 echo "VNC TLS support $vnc_tls"
2871 echo "VNC SASL support $vnc_sasl"
2872 echo "VNC JPEG support $vnc_jpeg"
2873 echo "VNC PNG support $vnc_png"
2874 echo "VNC thread $vnc_thread"
2876 if test -n "$sparc_cpu"; then
2877 echo "Target Sparc Arch $sparc_cpu"
2879 echo "xen support $xen"
2880 echo "CPU emulation $cpu_emulation"
2881 echo "brlapi support $brlapi"
2882 echo "bluez support $bluez"
2883 echo "Documentation $docs"
2884 [ ! -z "$uname_release" ] && \
2885 echo "uname -r $uname_release"
2886 echo "NPTL support $nptl"
2887 echo "GUEST_BASE $guest_base"
2888 echo "PIE $pie"
2889 echo "vde support $vde"
2890 echo "Linux AIO support $linux_aio"
2891 echo "ATTR/XATTR support $attr"
2892 echo "Install blobs $blobs"
2893 echo "KVM support $kvm"
2894 echo "TCG interpreter $tcg_interpreter"
2895 echo "KVM PIT support $kvm_cap_pit"
2896 echo "KVM device assig. $kvm_cap_device_assignment"
2897 echo "fdt support $fdt"
2898 echo "preadv support $preadv"
2899 echo "fdatasync $fdatasync"
2900 echo "madvise $madvise"
2901 echo "posix_madvise $posix_madvise"
2902 echo "uuid support $uuid"
2903 echo "vhost-net support $vhost_net"
2904 echo "Trace backend $trace_backend"
2905 echo "Trace output file $trace_file-<pid>"
2906 echo "spice support $spice"
2907 echo "rbd support $rbd"
2908 echo "xfsctl support $xfs"
2909 echo "nss used $smartcard_nss"
2910 echo "usb net redir $usb_redir"
2911 echo "OpenGL support $opengl"
2912 echo "libiscsi support $libiscsi"
2913 echo "build guest agent $guest_agent"
2915 if test "$sdl_too_old" = "yes"; then
2916 echo "-> Your SDL version is too old - please upgrade to have SDL support"
2919 config_host_mak="config-host.mak"
2920 config_host_ld="config-host.ld"
2922 echo "# Automatically generated by configure - do not modify" > $config_host_mak
2923 printf "# Configured with:" >> $config_host_mak
2924 printf " '%s'" "$0" "$@" >> $config_host_mak
2925 echo >> $config_host_mak
2927 echo all: >> $config_host_mak
2928 echo "prefix=$prefix" >> $config_host_mak
2929 echo "bindir=$bindir" >> $config_host_mak
2930 echo "libdir=$libdir" >> $config_host_mak
2931 echo "includedir=$includedir" >> $config_host_mak
2932 echo "mandir=$mandir" >> $config_host_mak
2933 echo "datadir=$datadir" >> $config_host_mak
2934 echo "sysconfdir=$sysconfdir" >> $config_host_mak
2935 echo "docdir=$docdir" >> $config_host_mak
2936 echo "confdir=$confdir" >> $config_host_mak
2938 case "$cpu" in
2939 i386|x86_64|alpha|arm|cris|hppa|ia64|lm32|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64|unicore32)
2940 ARCH=$cpu
2943 if test "$tcg_interpreter" = "yes" ; then
2944 echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
2945 ARCH=tci
2946 else
2947 echo "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
2948 exit 1
2951 esac
2952 echo "ARCH=$ARCH" >> $config_host_mak
2953 if test "$debug_tcg" = "yes" ; then
2954 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
2956 if test "$debug_mon" = "yes" ; then
2957 echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak
2959 if test "$debug" = "yes" ; then
2960 echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
2962 if test "$strip_opt" = "yes" ; then
2963 echo "STRIP=${strip}" >> $config_host_mak
2965 if test "$bigendian" = "yes" ; then
2966 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
2968 echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
2969 if test "$mingw32" = "yes" ; then
2970 echo "CONFIG_WIN32=y" >> $config_host_mak
2971 rc_version=`cat $source_path/VERSION`
2972 version_major=${rc_version%%.*}
2973 rc_version=${rc_version#*.}
2974 version_minor=${rc_version%%.*}
2975 rc_version=${rc_version#*.}
2976 version_subminor=${rc_version%%.*}
2977 version_micro=0
2978 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
2979 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
2980 else
2981 echo "CONFIG_POSIX=y" >> $config_host_mak
2984 if test "$linux" = "yes" ; then
2985 echo "CONFIG_LINUX=y" >> $config_host_mak
2988 if test "$darwin" = "yes" ; then
2989 echo "CONFIG_DARWIN=y" >> $config_host_mak
2992 if test "$aix" = "yes" ; then
2993 echo "CONFIG_AIX=y" >> $config_host_mak
2996 if test "$solaris" = "yes" ; then
2997 echo "CONFIG_SOLARIS=y" >> $config_host_mak
2998 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
2999 if test "$needs_libsunmath" = "yes" ; then
3000 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
3003 if test "$haiku" = "yes" ; then
3004 echo "CONFIG_HAIKU=y" >> $config_host_mak
3006 if test "$static" = "yes" ; then
3007 echo "CONFIG_STATIC=y" >> $config_host_mak
3009 if test "$profiler" = "yes" ; then
3010 echo "CONFIG_PROFILER=y" >> $config_host_mak
3012 if test "$slirp" = "yes" ; then
3013 echo "CONFIG_SLIRP=y" >> $config_host_mak
3014 echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
3015 QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES"
3017 if test "$vde" = "yes" ; then
3018 echo "CONFIG_VDE=y" >> $config_host_mak
3020 for card in $audio_card_list; do
3021 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
3022 echo "$def=y" >> $config_host_mak
3023 done
3024 echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
3025 for drv in $audio_drv_list; do
3026 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
3027 echo "$def=y" >> $config_host_mak
3028 if test "$drv" = "fmod"; then
3029 echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
3031 done
3032 if test "$audio_pt_int" = "yes" ; then
3033 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
3035 if test "$audio_win_int" = "yes" ; then
3036 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
3038 echo "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
3039 if test "$mixemu" = "yes" ; then
3040 echo "CONFIG_MIXEMU=y" >> $config_host_mak
3042 if test "$vnc" = "yes" ; then
3043 echo "CONFIG_VNC=y" >> $config_host_mak
3045 if test "$vnc_tls" = "yes" ; then
3046 echo "CONFIG_VNC_TLS=y" >> $config_host_mak
3047 echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
3049 if test "$vnc_sasl" = "yes" ; then
3050 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
3051 echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
3053 if test "$vnc_jpeg" = "yes" ; then
3054 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
3055 echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak
3057 if test "$vnc_png" = "yes" ; then
3058 echo "CONFIG_VNC_PNG=y" >> $config_host_mak
3059 echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak
3061 if test "$vnc_thread" = "yes" ; then
3062 echo "CONFIG_VNC_THREAD=y" >> $config_host_mak
3064 if test "$fnmatch" = "yes" ; then
3065 echo "CONFIG_FNMATCH=y" >> $config_host_mak
3067 if test "$uuid" = "yes" ; then
3068 echo "CONFIG_UUID=y" >> $config_host_mak
3070 if test "$xfs" = "yes" ; then
3071 echo "CONFIG_XFS=y" >> $config_host_mak
3073 qemu_version=`head $source_path/VERSION`
3074 echo "VERSION=$qemu_version" >>$config_host_mak
3075 echo "PKGVERSION=$pkgversion" >>$config_host_mak
3076 echo "SRC_PATH=$source_path" >> $config_host_mak
3077 echo "TARGET_DIRS=$target_list" >> $config_host_mak
3078 if [ "$docs" = "yes" ] ; then
3079 echo "BUILD_DOCS=yes" >> $config_host_mak
3081 if test "$sdl" = "yes" ; then
3082 echo "CONFIG_SDL=y" >> $config_host_mak
3083 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
3085 if test "$cocoa" = "yes" ; then
3086 echo "CONFIG_COCOA=y" >> $config_host_mak
3088 if test "$curses" = "yes" ; then
3089 echo "CONFIG_CURSES=y" >> $config_host_mak
3091 if test "$atfile" = "yes" ; then
3092 echo "CONFIG_ATFILE=y" >> $config_host_mak
3094 if test "$utimens" = "yes" ; then
3095 echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
3097 if test "$pipe2" = "yes" ; then
3098 echo "CONFIG_PIPE2=y" >> $config_host_mak
3100 if test "$accept4" = "yes" ; then
3101 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
3103 if test "$splice" = "yes" ; then
3104 echo "CONFIG_SPLICE=y" >> $config_host_mak
3106 if test "$eventfd" = "yes" ; then
3107 echo "CONFIG_EVENTFD=y" >> $config_host_mak
3109 if test "$fallocate" = "yes" ; then
3110 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
3112 if test "$sync_file_range" = "yes" ; then
3113 echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
3115 if test "$fiemap" = "yes" ; then
3116 echo "CONFIG_FIEMAP=y" >> $config_host_mak
3118 if test "$dup3" = "yes" ; then
3119 echo "CONFIG_DUP3=y" >> $config_host_mak
3121 if test "$epoll" = "yes" ; then
3122 echo "CONFIG_EPOLL=y" >> $config_host_mak
3124 if test "$epoll_create1" = "yes" ; then
3125 echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
3127 if test "$epoll_pwait" = "yes" ; then
3128 echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
3130 if test "$inotify" = "yes" ; then
3131 echo "CONFIG_INOTIFY=y" >> $config_host_mak
3133 if test "$inotify1" = "yes" ; then
3134 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
3136 if test "$byteswap_h" = "yes" ; then
3137 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
3139 if test "$bswap_h" = "yes" ; then
3140 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
3142 if test "$curl" = "yes" ; then
3143 echo "CONFIG_CURL=y" >> $config_host_mak
3144 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
3146 if test "$brlapi" = "yes" ; then
3147 echo "CONFIG_BRLAPI=y" >> $config_host_mak
3149 if test "$bluez" = "yes" ; then
3150 echo "CONFIG_BLUEZ=y" >> $config_host_mak
3151 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
3153 echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
3154 if test "$xen" = "yes" ; then
3155 echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
3156 echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
3158 if test "$linux_aio" = "yes" ; then
3159 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
3161 if test "$attr" = "yes" ; then
3162 echo "CONFIG_ATTR=y" >> $config_host_mak
3164 if test "$libattr" = "yes" ; then
3165 echo "CONFIG_LIBATTR=y" >> $config_host_mak
3167 if test "$linux" = "yes" ; then
3168 if test "$attr" = "yes" ; then
3169 echo "CONFIG_VIRTFS=y" >> $config_host_mak
3172 if test "$blobs" = "yes" ; then
3173 echo "INSTALL_BLOBS=yes" >> $config_host_mak
3175 if test "$iovec" = "yes" ; then
3176 echo "CONFIG_IOVEC=y" >> $config_host_mak
3178 if test "$preadv" = "yes" ; then
3179 echo "CONFIG_PREADV=y" >> $config_host_mak
3181 if test "$fdt" = "yes" ; then
3182 echo "CONFIG_FDT=y" >> $config_host_mak
3184 if test "$signalfd" = "yes" ; then
3185 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
3187 if test "$tcg_interpreter" = "yes" ; then
3188 echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
3190 if test "$need_offsetof" = "yes" ; then
3191 echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
3193 if test "$fdatasync" = "yes" ; then
3194 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
3196 if test $cpu_emulation = "yes"; then
3197 echo "CONFIG_CPU_EMULATION=y" >> $config_host_mak
3198 else
3199 echo "CONFIG_NO_CPU_EMULATION=y" >> $config_host_mak
3201 if test "$madvise" = "yes" ; then
3202 echo "CONFIG_MADVISE=y" >> $config_host_mak
3204 if test "$posix_madvise" = "yes" ; then
3205 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
3208 if test "$spice" = "yes" ; then
3209 echo "CONFIG_SPICE=y" >> $config_host_mak
3212 if test "$smartcard" = "yes" ; then
3213 echo "CONFIG_SMARTCARD=y" >> $config_host_mak
3216 if test "$smartcard_nss" = "yes" ; then
3217 echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
3220 if test "$usb_redir" = "yes" ; then
3221 echo "CONFIG_USB_REDIR=y" >> $config_host_mak
3224 if test "$opengl" = "yes" ; then
3225 echo "CONFIG_OPENGL=y" >> $config_host_mak
3228 if test "$libiscsi" = "yes" ; then
3229 echo "CONFIG_LIBISCSI=y" >> $config_host_mak
3232 # XXX: suppress that
3233 if [ "$bsd" = "yes" ] ; then
3234 echo "CONFIG_BSD=y" >> $config_host_mak
3237 echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
3239 if test "$zero_malloc" = "yes" ; then
3240 echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
3242 if test "$rbd" = "yes" ; then
3243 echo "CONFIG_RBD=y" >> $config_host_mak
3246 if test "$ucontext_coroutine" = "yes" ; then
3247 echo "CONFIG_UCONTEXT_COROUTINE=y" >> $config_host_mak
3250 if test "$open_by_handle_at" = "yes" ; then
3251 echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
3254 if test "$linux_magic_h" = "yes" ; then
3255 echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
3258 # USB host support
3259 case "$usb" in
3260 linux)
3261 echo "HOST_USB=linux" >> $config_host_mak
3263 bsd)
3264 echo "HOST_USB=bsd" >> $config_host_mak
3267 echo "HOST_USB=stub" >> $config_host_mak
3269 esac
3271 # use default implementation for tracing backend-specific routines
3272 trace_default=yes
3273 echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
3274 if test "$trace_backend" = "nop"; then
3275 echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
3277 if test "$trace_backend" = "simple"; then
3278 echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
3279 trace_default=no
3280 # Set the appropriate trace file.
3281 trace_file="\"$trace_file-\" FMT_pid"
3283 if test "$trace_backend" = "stderr"; then
3284 echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
3285 trace_default=no
3287 if test "$trace_backend" = "ust"; then
3288 echo "CONFIG_TRACE_UST=y" >> $config_host_mak
3290 if test "$trace_backend" = "dtrace"; then
3291 echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
3292 if test "$trace_backend_stap" = "yes" ; then
3293 echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
3296 echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
3297 if test "$trace_default" = "yes"; then
3298 echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
3301 echo "TOOLS=$tools" >> $config_host_mak
3302 echo "CHECKS=$test_progs" >> $config_host_mak
3303 echo "ROMS=$roms" >> $config_host_mak
3304 echo "MAKE=$make" >> $config_host_mak
3305 echo "INSTALL=$install" >> $config_host_mak
3306 echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
3307 echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
3308 echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
3309 echo "PYTHON=$python" >> $config_host_mak
3310 echo "CC=$cc" >> $config_host_mak
3311 echo "CC_I386=$cc_i386" >> $config_host_mak
3312 echo "HOST_CC=$host_cc" >> $config_host_mak
3313 echo "AR=$ar" >> $config_host_mak
3314 echo "OBJCOPY=$objcopy" >> $config_host_mak
3315 echo "LD=$ld" >> $config_host_mak
3316 echo "WINDRES=$windres" >> $config_host_mak
3317 echo "LIBTOOL=$libtool" >> $config_host_mak
3318 echo "CFLAGS=$CFLAGS" >> $config_host_mak
3319 echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
3320 echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
3321 if test "$sparse" = "yes" ; then
3322 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
3323 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
3324 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
3326 echo "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
3327 echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
3328 echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
3329 echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
3330 echo "LIBS+=$LIBS" >> $config_host_mak
3331 echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
3332 echo "EXESUF=$EXESUF" >> $config_host_mak
3333 echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
3335 # generate list of library paths for linker script
3337 $ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
3339 if test -f ${config_host_ld}~ ; then
3340 if cmp -s $config_host_ld ${config_host_ld}~ ; then
3341 mv ${config_host_ld}~ $config_host_ld
3342 else
3343 rm ${config_host_ld}~
3347 for d in libdis libdis-user; do
3348 mkdir -p $d
3349 symlink $source_path/Makefile.dis $d/Makefile
3350 echo > $d/config.mak
3351 done
3353 # use included Linux headers
3354 if test "$linux" = "yes" ; then
3355 mkdir -p linux-headers
3356 case "$cpu" in
3357 i386|x86_64)
3358 symlink $source_path/linux-headers/asm-x86 linux-headers/asm
3360 ppcemb|ppc|ppc64)
3361 symlink $source_path/linux-headers/asm-powerpc linux-headers/asm
3363 s390x)
3364 symlink $source_path/linux-headers/asm-s390 linux-headers/asm
3366 esac
3369 for target in $target_list; do
3370 target_dir="$target"
3371 config_target_mak=$target_dir/config-target.mak
3372 target_arch2=`echo $target | cut -d '-' -f 1`
3373 target_bigendian="no"
3375 case "$target_arch2" in
3376 armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
3377 target_bigendian=yes
3379 esac
3380 target_softmmu="no"
3381 target_user_only="no"
3382 target_linux_user="no"
3383 target_darwin_user="no"
3384 target_bsd_user="no"
3385 case "$target" in
3386 ${target_arch2}-softmmu)
3387 target_softmmu="yes"
3389 ${target_arch2}-linux-user)
3390 if test "$linux" != "yes" ; then
3391 echo "ERROR: Target '$target' is only available on a Linux host"
3392 exit 1
3394 target_user_only="yes"
3395 target_linux_user="yes"
3397 ${target_arch2}-darwin-user)
3398 if test "$darwin" != "yes" ; then
3399 echo "ERROR: Target '$target' is only available on a Darwin host"
3400 exit 1
3402 target_user_only="yes"
3403 target_darwin_user="yes"
3405 ${target_arch2}-bsd-user)
3406 if test "$bsd" != "yes" ; then
3407 echo "ERROR: Target '$target' is only available on a BSD host"
3408 exit 1
3410 target_user_only="yes"
3411 target_bsd_user="yes"
3414 echo "ERROR: Target '$target' not recognised"
3415 exit 1
3417 esac
3419 mkdir -p $target_dir
3420 mkdir -p $target_dir/fpu
3421 mkdir -p $target_dir/tcg
3422 mkdir -p $target_dir/ide
3423 mkdir -p $target_dir/9pfs
3424 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
3425 mkdir -p $target_dir/nwfpe
3427 symlink $source_path/Makefile.target $target_dir/Makefile
3430 echo "# Automatically generated by configure - do not modify" > $config_target_mak
3432 bflt="no"
3433 target_nptl="no"
3434 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
3435 echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
3436 gdb_xml_files=""
3437 target_short_alignment=2
3438 target_int_alignment=4
3439 target_long_alignment=4
3440 target_llong_alignment=8
3441 target_libs_softmmu=
3443 TARGET_ARCH="$target_arch2"
3444 TARGET_BASE_ARCH=""
3445 TARGET_ABI_DIR=""
3447 case "$target_arch2" in
3448 i386)
3449 target_phys_bits=64
3451 x86_64)
3452 TARGET_BASE_ARCH=i386
3453 target_phys_bits=64
3454 target_long_alignment=8
3456 alpha)
3457 target_phys_bits=64
3458 target_long_alignment=8
3459 target_nptl="yes"
3461 arm|armeb)
3462 TARGET_ARCH=arm
3463 bflt="yes"
3464 target_nptl="yes"
3465 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
3466 target_phys_bits=32
3467 target_llong_alignment=4
3469 cris)
3470 target_nptl="yes"
3471 target_phys_bits=32
3473 lm32)
3474 target_phys_bits=32
3475 target_libs_softmmu="$opengl_libs"
3477 m68k)
3478 bflt="yes"
3479 gdb_xml_files="cf-core.xml cf-fp.xml"
3480 target_phys_bits=32
3481 target_int_alignment=2
3482 target_long_alignment=2
3483 target_llong_alignment=2
3485 microblaze|microblazeel)
3486 TARGET_ARCH=microblaze
3487 bflt="yes"
3488 target_nptl="yes"
3489 target_phys_bits=32
3490 target_libs_softmmu="$fdt_libs"
3492 mips|mipsel)
3493 TARGET_ARCH=mips
3494 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
3495 target_nptl="yes"
3496 target_phys_bits=64
3498 mipsn32|mipsn32el)
3499 TARGET_ARCH=mipsn32
3500 TARGET_BASE_ARCH=mips
3501 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
3502 target_phys_bits=64
3504 mips64|mips64el)
3505 TARGET_ARCH=mips64
3506 TARGET_BASE_ARCH=mips
3507 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
3508 target_phys_bits=64
3509 target_long_alignment=8
3511 ppc)
3512 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
3513 target_phys_bits=64
3514 target_nptl="yes"
3515 target_libs_softmmu="$fdt_libs"
3517 ppcemb)
3518 TARGET_BASE_ARCH=ppc
3519 TARGET_ABI_DIR=ppc
3520 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
3521 target_phys_bits=64
3522 target_nptl="yes"
3523 target_libs_softmmu="$fdt_libs"
3525 ppc64)
3526 TARGET_BASE_ARCH=ppc
3527 TARGET_ABI_DIR=ppc
3528 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
3529 target_phys_bits=64
3530 target_long_alignment=8
3531 target_libs_softmmu="$fdt_libs"
3533 ppc64abi32)
3534 TARGET_ARCH=ppc64
3535 TARGET_BASE_ARCH=ppc
3536 TARGET_ABI_DIR=ppc
3537 echo "TARGET_ABI32=y" >> $config_target_mak
3538 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
3539 target_phys_bits=64
3540 target_libs_softmmu="$fdt_libs"
3542 sh4|sh4eb)
3543 TARGET_ARCH=sh4
3544 bflt="yes"
3545 target_nptl="yes"
3546 target_phys_bits=32
3548 sparc)
3549 target_phys_bits=64
3551 sparc64)
3552 TARGET_BASE_ARCH=sparc
3553 target_phys_bits=64
3554 target_long_alignment=8
3556 sparc32plus)
3557 TARGET_ARCH=sparc64
3558 TARGET_BASE_ARCH=sparc
3559 TARGET_ABI_DIR=sparc
3560 echo "TARGET_ABI32=y" >> $config_target_mak
3561 target_phys_bits=64
3563 s390x)
3564 target_nptl="yes"
3565 target_phys_bits=64
3566 target_long_alignment=8
3568 unicore32)
3569 target_phys_bits=32
3571 xtensa|xtensaeb)
3572 TARGET_ARCH=xtensa
3573 target_phys_bits=32
3576 echo "Unsupported target CPU"
3577 exit 1
3579 esac
3580 echo "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak
3581 echo "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak
3582 echo "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak
3583 echo "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak
3584 echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
3585 target_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
3586 echo "TARGET_$target_arch_name=y" >> $config_target_mak
3587 echo "TARGET_ARCH2=$target_arch2" >> $config_target_mak
3588 # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
3589 if [ "$TARGET_BASE_ARCH" = "" ]; then
3590 TARGET_BASE_ARCH=$TARGET_ARCH
3592 echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
3593 if [ "$TARGET_ABI_DIR" = "" ]; then
3594 TARGET_ABI_DIR=$TARGET_ARCH
3596 echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
3597 case "$target_arch2" in
3598 i386|x86_64)
3599 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
3600 target_phys_bits=64
3601 echo "CONFIG_XEN=y" >> $config_target_mak
3602 else
3603 echo "CONFIG_NO_XEN=y" >> $config_target_mak
3607 echo "CONFIG_NO_XEN=y" >> $config_target_mak
3608 esac
3609 case "$target_arch2" in
3610 i386|x86_64|ppcemb|ppc|ppc64|s390x)
3611 # Make sure the target and host cpus are compatible
3612 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
3613 \( "$target_arch2" = "$cpu" -o \
3614 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
3615 \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \
3616 \( "$target_arch2" = "ppc" -a "$cpu" = "ppc64" \) -o \
3617 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
3618 \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \
3619 \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then
3620 echo "CONFIG_KVM=y" >> $config_target_mak
3621 echo "CONFIG_KVM_OPTIONS=y" >> $config_host_mak
3622 if test "$vhost_net" = "yes" ; then
3623 echo "CONFIG_VHOST_NET=y" >> $config_target_mak
3625 if test $kvm_cap_pit = "yes" ; then
3626 echo "CONFIG_KVM_PIT=y" >> $config_target_mak
3628 if test $kvm_cap_device_assignment = "yes" ; then
3629 echo "CONFIG_KVM_DEVICE_ASSIGNMENT=y" >> $config_target_mak
3632 esac
3633 if test "$target_arch2" = "ppc64" -a "$fdt" = "yes"; then
3634 echo "CONFIG_PSERIES=y" >> $config_target_mak
3636 if test "$target_bigendian" = "yes" ; then
3637 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
3639 if test "$target_softmmu" = "yes" ; then
3640 echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
3641 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
3642 echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak
3643 echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
3644 echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
3646 if test "$target_user_only" = "yes" ; then
3647 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
3649 if test "$target_linux_user" = "yes" ; then
3650 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
3652 if test "$target_darwin_user" = "yes" ; then
3653 echo "CONFIG_DARWIN_USER=y" >> $config_target_mak
3655 if test "$smartcard_nss" = "yes" ; then
3656 echo "subdir-$target: subdir-libcacard" >> $config_host_mak
3657 echo "libcacard_libs=$libcacard_libs" >> $config_host_mak
3658 echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
3660 list=""
3661 if test ! -z "$gdb_xml_files" ; then
3662 for x in $gdb_xml_files; do
3663 list="$list $source_path/gdb-xml/$x"
3664 done
3665 echo "TARGET_XML_FILES=$list" >> $config_target_mak
3668 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
3669 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
3671 if test "$target_user_only" = "yes" \
3672 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
3673 echo "CONFIG_USE_NPTL=y" >> $config_target_mak
3675 if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
3676 echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
3678 if test "$target_bsd_user" = "yes" ; then
3679 echo "CONFIG_BSD_USER=y" >> $config_target_mak
3682 # generate QEMU_CFLAGS/LDFLAGS for targets
3684 cflags=""
3685 includes=""
3686 ldflags=""
3688 if test "$tcg_interpreter" = "yes"; then
3689 includes="-I\$(SRC_PATH)/tcg/tci $includes"
3690 elif test "$ARCH" = "sparc64" ; then
3691 includes="-I\$(SRC_PATH)/tcg/sparc $includes"
3692 elif test "$ARCH" = "s390x" ; then
3693 includes="-I\$(SRC_PATH)/tcg/s390 $includes"
3694 elif test "$ARCH" = "x86_64" ; then
3695 includes="-I\$(SRC_PATH)/tcg/i386 $includes"
3696 else
3697 includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes"
3699 includes="-I\$(SRC_PATH)/tcg $includes"
3701 if test "$linux" = "yes" ; then
3702 includes="-I\$(SRC_PATH)/linux-headers $includes"
3705 if test "$target_user_only" = "yes" ; then
3706 libdis_config_mak=libdis-user/config.mak
3707 else
3708 libdis_config_mak=libdis/config.mak
3711 for i in $ARCH $TARGET_BASE_ARCH ; do
3712 case "$i" in
3713 alpha)
3714 echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
3715 echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak
3717 arm)
3718 echo "CONFIG_ARM_DIS=y" >> $config_target_mak
3719 echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak
3721 cris)
3722 echo "CONFIG_CRIS_DIS=y" >> $config_target_mak
3723 echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak
3725 hppa)
3726 echo "CONFIG_HPPA_DIS=y" >> $config_target_mak
3727 echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak
3729 i386|x86_64)
3730 echo "CONFIG_I386_DIS=y" >> $config_target_mak
3731 echo "CONFIG_I386_DIS=y" >> $libdis_config_mak
3733 ia64*)
3734 echo "CONFIG_IA64_DIS=y" >> $config_target_mak
3735 echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak
3737 m68k)
3738 echo "CONFIG_M68K_DIS=y" >> $config_target_mak
3739 echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak
3741 microblaze*)
3742 echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak
3743 echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak
3745 mips*)
3746 echo "CONFIG_MIPS_DIS=y" >> $config_target_mak
3747 echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak
3749 ppc*)
3750 echo "CONFIG_PPC_DIS=y" >> $config_target_mak
3751 echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak
3753 s390*)
3754 echo "CONFIG_S390_DIS=y" >> $config_target_mak
3755 echo "CONFIG_S390_DIS=y" >> $libdis_config_mak
3757 sh4)
3758 echo "CONFIG_SH4_DIS=y" >> $config_target_mak
3759 echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak
3761 sparc*)
3762 echo "CONFIG_SPARC_DIS=y" >> $config_target_mak
3763 echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak
3765 xtensa*)
3766 echo "CONFIG_XTENSA_DIS=y" >> $config_target_mak
3767 echo "CONFIG_XTENSA_DIS=y" >> $libdis_config_mak
3769 esac
3770 done
3771 if test "$tcg_interpreter" = "yes" ; then
3772 echo "CONFIG_TCI_DIS=y" >> $config_target_mak
3773 echo "CONFIG_TCI_DIS=y" >> $libdis_config_mak
3776 case "$ARCH" in
3777 alpha)
3778 # Ensure there's only a single GP
3779 cflags="-msmall-data $cflags"
3781 esac
3783 if test "$target_softmmu" = "yes" ; then
3784 case "$TARGET_BASE_ARCH" in
3785 arm)
3786 cflags="-DHAS_AUDIO $cflags"
3788 lm32)
3789 cflags="-DHAS_AUDIO $cflags"
3791 i386|mips|ppc)
3792 cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
3794 esac
3797 if test "$target_softmmu" = "yes" -a \( \
3798 "$TARGET_ARCH" = "microblaze" -o \
3799 "$TARGET_ARCH" = "cris" \) ; then
3800 echo "CONFIG_NEED_MMU=y" >> $config_target_mak
3803 if test "$gprof" = "yes" ; then
3804 echo "TARGET_GPROF=yes" >> $config_target_mak
3805 if test "$target_linux_user" = "yes" ; then
3806 cflags="-p $cflags"
3807 ldflags="-p $ldflags"
3809 if test "$target_softmmu" = "yes" ; then
3810 ldflags="-p $ldflags"
3811 echo "GPROF_CFLAGS=-p" >> $config_target_mak
3815 if test "$ARCH" = "tci"; then
3816 linker_script=""
3817 else
3818 linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
3821 if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
3822 case "$ARCH" in
3823 sparc)
3824 # -static is used to avoid g1/g3 usage by the dynamic linker
3825 ldflags="$linker_script -static $ldflags"
3827 alpha | s390x)
3828 # The default placement of the application is fine.
3831 ldflags="$linker_script $ldflags"
3833 esac
3836 echo "LDFLAGS+=$ldflags" >> $config_target_mak
3837 echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
3838 echo "QEMU_INCLUDES+=$includes" >> $config_target_mak
3840 done # for target in $targets
3842 # build tree in object directory in case the source is not in the current directory
3843 DIRS="tests tests/cris slirp audio block net pc-bios/optionrom"
3844 DIRS="$DIRS pc-bios/spapr-rtas"
3845 DIRS="$DIRS roms/seabios roms/vgabios"
3846 DIRS="$DIRS fsdev ui"
3847 DIRS="$DIRS qapi qapi-generated"
3848 DIRS="$DIRS qga trace"
3849 FILES="Makefile tests/Makefile qdict-test-data.txt"
3850 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
3851 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
3852 FILES="$FILES pc-bios/spapr-rtas/Makefile"
3853 FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
3854 for bios_file in \
3855 $source_path/pc-bios/*.bin \
3856 $source_path/pc-bios/*.rom \
3857 $source_path/pc-bios/*.dtb \
3858 $source_path/pc-bios/openbios-* \
3859 $source_path/pc-bios/palcode-*
3861 FILES="$FILES pc-bios/`basename $bios_file`"
3862 done
3863 mkdir -p $DIRS
3864 for f in $FILES ; do
3865 if [ -e "$source_path/$f" ] && ! [ -e "$f" ]; then
3866 symlink "$source_path/$f" "$f"
3868 done
3870 # temporary config to build submodules
3871 for rom in seabios vgabios ; do
3872 config_mak=roms/$rom/config.mak
3873 echo "# Automatically generated by configure - do not modify" > $config_mak
3874 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
3875 echo "CC=$cc" >> $config_mak
3876 echo "BCC=bcc" >> $config_mak
3877 echo "CPP=${cross_prefix}cpp" >> $config_mak
3878 echo "OBJCOPY=objcopy" >> $config_mak
3879 echo "IASL=iasl" >> $config_mak
3880 echo "LD=$ld" >> $config_mak
3881 done
3883 for hwlib in 32 64; do
3884 d=libhw$hwlib
3885 mkdir -p $d
3886 mkdir -p $d/ide
3887 symlink $source_path/Makefile.hw $d/Makefile
3888 mkdir -p $d/9pfs
3889 echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
3890 done
3892 if [ "$source_path" != `pwd` ]; then
3893 # out of tree build
3894 mkdir -p libcacard
3895 rm -f libcacard/Makefile
3896 symlink "$source_path/libcacard/Makefile" libcacard/Makefile
3899 d=libuser
3900 mkdir -p $d
3901 mkdir -p $d/trace
3902 symlink $source_path/Makefile.user $d/Makefile
3904 if test "$docs" = "yes" ; then
3905 mkdir -p QMP