qemu-kvm: Refactor exit_request processing in kvm_run
[qemu/qemu-dev-zwu.git] / configure
blobb3a8c68cb02afcecaa15da8cfbcf2f965b3496f0
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 compile_object() {
24 echo $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log
25 $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log 2>&1
28 compile_prog() {
29 local_cflags="$1"
30 local_ldflags="$2"
31 echo $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log
32 $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log 2>&1
35 # symbolically link $1 to $2. Portable version of "ln -sf".
36 symlink() {
37 rm -f $2
38 ln -s $1 $2
41 # check whether a command is available to this shell (may be either an
42 # executable or a builtin)
43 has() {
44 type "$1" >/dev/null 2>&1
47 # search for an executable in PATH
48 path_of() {
49 local_command="$1"
50 local_ifs="$IFS"
51 local_dir=""
53 # pathname has a dir component?
54 if [ "${local_command#*/}" != "$local_command" ]; then
55 if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
56 echo "$local_command"
57 return 0
60 if [ -z "$local_command" ]; then
61 return 1
64 IFS=:
65 for local_dir in $PATH; do
66 if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
67 echo "$local_dir/$local_command"
68 IFS="${local_ifs:-$(printf ' \t\n')}"
69 return 0
71 done
72 # not found
73 IFS="${local_ifs:-$(printf ' \t\n')}"
74 return 1
77 # default parameters
78 source_path=`dirname "$0"`
79 cpu=""
80 interp_prefix="/usr/gnemul/qemu-%M"
81 static="no"
82 sparc_cpu=""
83 cross_prefix=""
84 audio_drv_list=""
85 audio_card_list="ac97 es1370 sb16 hda"
86 audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda"
87 block_drv_whitelist=""
88 host_cc="gcc"
89 helper_cflags=""
90 libs_softmmu=""
91 libs_tools=""
92 audio_pt_int=""
93 audio_win_int=""
94 cc_i386=i386-pc-linux-gnu-gcc
96 target_list="x86_64-softmmu"
98 kvm_version() {
99 local fname="$(dirname "$0")/KVM_VERSION"
101 if test -f "$fname"; then
102 cat "$fname"
103 else
104 echo "qemu-kvm-devel"
108 # Default value for a variable defining feature "foo".
109 # * foo="no" feature will only be used if --enable-foo arg is given
110 # * foo="" feature will be searched for, and if found, will be used
111 # unless --disable-foo is given
112 # * foo="yes" this value will only be set by --enable-foo flag.
113 # feature will searched for,
114 # if not found, configure exits with error
116 # Always add --enable-foo and --disable-foo command line args.
117 # Distributions want to ensure that several features are compiled in, and it
118 # is impossible without a --enable-foo that exits if a feature is not found.
120 bluez=""
121 brlapi=""
122 curl=""
123 curses=""
124 docs=""
125 fdt=""
126 kvm=""
127 kvm_para=""
128 nptl=""
129 sdl=""
130 vnc="yes"
131 sparse="no"
132 uuid=""
133 vde=""
134 vnc_tls=""
135 vnc_sasl=""
136 vnc_jpeg=""
137 vnc_png=""
138 vnc_thread="no"
139 xen=""
140 xen_ctrl_version=""
141 linux_aio=""
142 attr=""
143 vhost_net=""
144 xfs=""
146 gprof="no"
147 debug_tcg="no"
148 debug_mon="no"
149 debug="no"
150 strip_opt="yes"
151 bigendian="no"
152 mingw32="no"
153 EXESUF=""
154 prefix="/usr/local"
155 mandir="\${prefix}/share/man"
156 datadir="\${prefix}/share/qemu"
157 docdir="\${prefix}/share/doc/qemu"
158 bindir="\${prefix}/bin"
159 sysconfdir="\${prefix}/etc"
160 confsuffix="/qemu"
161 slirp="yes"
162 fmod_lib=""
163 fmod_inc=""
164 oss_lib=""
165 bsd="no"
166 linux="no"
167 solaris="no"
168 profiler="no"
169 cocoa="no"
170 softmmu="yes"
171 linux_user="no"
172 darwin_user="no"
173 bsd_user="no"
174 guest_base=""
175 uname_release=""
176 io_thread="no"
177 mixemu="no"
178 kvm_cap_pit=""
179 kvm_cap_device_assignment=""
180 kerneldir=""
181 aix="no"
182 blobs="yes"
183 pkgversion=" ($(kvm_version))"
184 cpu_emulation="yes"
185 check_utests="no"
186 user_pie="no"
187 zero_malloc=""
188 trace_backend="nop"
189 trace_file="trace"
190 spice=""
191 rbd=""
192 smartcard=""
193 smartcard_nss=""
194 opengl=""
196 # parse CC options first
197 for opt do
198 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
199 case "$opt" in
200 --cross-prefix=*) cross_prefix="$optarg"
202 --cc=*) CC="$optarg"
204 --source-path=*) source_path="$optarg"
206 --cpu=*) cpu="$optarg"
208 --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
210 --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
212 --sparc_cpu=*)
213 sparc_cpu="$optarg"
214 case $sparc_cpu in
215 v7|v8|v8plus|v8plusa)
216 cpu="sparc"
219 cpu="sparc64"
222 echo "undefined SPARC architecture. Exiting";
223 exit 1
225 esac
227 esac
228 done
229 # OS specific
230 # Using uname is really, really broken. Once we have the right set of checks
231 # we can eliminate it's usage altogether
233 cc="${cross_prefix}${CC-gcc}"
234 ar="${cross_prefix}${AR-ar}"
235 objcopy="${cross_prefix}${OBJCOPY-objcopy}"
236 ld="${cross_prefix}${LD-ld}"
237 strip="${cross_prefix}${STRIP-strip}"
238 windres="${cross_prefix}${WINDRES-windres}"
239 pkg_config="${cross_prefix}${PKG_CONFIG-pkg-config}"
240 sdl_config="${cross_prefix}${SDL_CONFIG-sdl-config}"
242 # default flags for all hosts
243 QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
244 CFLAGS="-g $CFLAGS"
245 QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
246 QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
247 QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
248 QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
249 QEMU_INCLUDES="-I. -I\$(SRC_PATH)"
250 LDFLAGS="-g $LDFLAGS"
252 # make source path absolute
253 source_path=`cd "$source_path"; pwd`
255 check_define() {
256 cat > $TMPC <<EOF
257 #if !defined($1)
258 #error Not defined
259 #endif
260 int main(void) { return 0; }
262 compile_object
265 if test ! -z "$cpu" ; then
266 # command line argument
268 elif check_define __i386__ ; then
269 cpu="i386"
270 elif check_define __x86_64__ ; then
271 cpu="x86_64"
272 elif check_define __sparc__ ; then
273 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
274 # They must be specified using --sparc_cpu
275 if check_define __arch64__ ; then
276 cpu="sparc64"
277 else
278 cpu="sparc"
280 elif check_define _ARCH_PPC ; then
281 if check_define _ARCH_PPC64 ; then
282 cpu="ppc64"
283 else
284 cpu="ppc"
286 elif check_define __mips__ ; then
287 cpu="mips"
288 elif check_define __ia64__ ; then
289 cpu="ia64"
290 elif check_define __s390__ ; then
291 if check_define __s390x__ ; then
292 cpu="s390x"
293 else
294 cpu="s390"
296 else
297 cpu=`uname -m`
300 case "$cpu" in
301 alpha|cris|ia64|lm32|m68k|microblaze|ppc|ppc64|sparc64|unicore32)
302 cpu="$cpu"
304 i386|i486|i586|i686|i86pc|BePC)
305 cpu="i386"
307 x86_64|amd64)
308 cpu="x86_64"
310 armv*b)
311 cpu="armv4b"
313 armv*l)
314 cpu="armv4l"
316 parisc|parisc64)
317 cpu="hppa"
319 mips*)
320 cpu="mips"
322 s390)
323 cpu="s390"
325 s390x)
326 cpu="s390x"
328 sparc|sun4[cdmuv])
329 cpu="sparc"
332 echo "Unsupported CPU = $cpu"
333 exit 1
335 esac
337 # OS specific
338 if check_define __linux__ ; then
339 targetos="Linux"
340 elif check_define _WIN32 ; then
341 targetos='MINGW32'
342 elif check_define __OpenBSD__ ; then
343 targetos='OpenBSD'
344 elif check_define __sun__ ; then
345 targetos='SunOS'
346 elif check_define __HAIKU__ ; then
347 targetos='Haiku'
348 else
349 targetos=`uname -s`
352 case $targetos in
353 CYGWIN*)
354 mingw32="yes"
355 QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
356 audio_possible_drivers="winwave sdl"
357 audio_drv_list="winwave"
359 MINGW32*)
360 mingw32="yes"
361 audio_possible_drivers="winwave dsound sdl fmod"
362 audio_drv_list="winwave"
364 GNU/kFreeBSD)
365 bsd="yes"
366 audio_drv_list="oss"
367 audio_possible_drivers="oss sdl esd pa"
369 FreeBSD)
370 bsd="yes"
371 make="${MAKE-gmake}"
372 audio_drv_list="oss"
373 audio_possible_drivers="oss sdl esd pa"
374 # needed for kinfo_getvmmap(3) in libutil.h
375 LIBS="-lutil $LIBS"
377 DragonFly)
378 bsd="yes"
379 make="${MAKE-gmake}"
380 audio_drv_list="oss"
381 audio_possible_drivers="oss sdl esd pa"
383 NetBSD)
384 bsd="yes"
385 make="${MAKE-gmake}"
386 audio_drv_list="oss"
387 audio_possible_drivers="oss sdl esd"
388 oss_lib="-lossaudio"
390 OpenBSD)
391 bsd="yes"
392 make="${MAKE-gmake}"
393 audio_drv_list="oss"
394 audio_possible_drivers="oss sdl esd"
395 oss_lib="-lossaudio"
397 Darwin)
398 bsd="yes"
399 darwin="yes"
400 # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can
401 # run 64-bit userspace code
402 if [ "$cpu" = "i386" ] ; then
403 is_x86_64=`sysctl -n hw.optional.x86_64`
404 [ "$is_x86_64" = "1" ] && cpu=x86_64
406 if [ "$cpu" = "x86_64" ] ; then
407 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
408 LDFLAGS="-arch x86_64 $LDFLAGS"
409 else
410 QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
412 darwin_user="yes"
413 cocoa="yes"
414 audio_drv_list="coreaudio"
415 audio_possible_drivers="coreaudio sdl fmod"
416 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
417 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
419 SunOS)
420 solaris="yes"
421 make="${MAKE-gmake}"
422 install="${INSTALL-ginstall}"
423 ld="gld"
424 needs_libsunmath="no"
425 solarisrev=`uname -r | cut -f2 -d.`
426 # have to select again, because `uname -m` returns i86pc
427 # even on an x86_64 box.
428 solariscpu=`isainfo -k`
429 if test "${solariscpu}" = "amd64" ; then
430 cpu="x86_64"
432 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
433 if test "$solarisrev" -le 9 ; then
434 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
435 needs_libsunmath="yes"
436 QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
437 LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
438 LIBS="-lsunmath $LIBS"
439 else
440 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
441 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
442 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
443 echo "Studio 11 can be downloaded from www.sun.com."
444 exit 1
448 if test -f /usr/include/sys/soundcard.h ; then
449 audio_drv_list="oss"
451 audio_possible_drivers="oss sdl"
452 # needed for CMSG_ macros in sys/socket.h
453 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
454 # needed for TIOCWIN* defines in termios.h
455 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
456 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
457 LIBS="-lsocket -lnsl -lresolv $LIBS"
459 AIX)
460 aix="yes"
461 make="${MAKE-gmake}"
463 Haiku)
464 haiku="yes"
465 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
466 LIBS="-lposix_error_mapper -lnetwork $LIBS"
469 audio_drv_list="oss"
470 audio_possible_drivers="oss alsa sdl esd pa"
471 linux="yes"
472 linux_user="yes"
473 usb="linux"
474 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
475 audio_possible_drivers="$audio_possible_drivers fmod"
477 if [ "$cpu" = "ia64" ] ; then
478 xen="no"
479 target_list="ia64-softmmu"
480 cpu_emulation="no"
481 gdbstub="no"
482 slirp="no"
485 esac
487 if [ "$bsd" = "yes" ] ; then
488 if [ "$darwin" != "yes" ] ; then
489 usb="bsd"
491 bsd_user="yes"
494 : ${make=${MAKE-make}}
495 : ${install=${INSTALL-install}}
497 if test "$mingw32" = "yes" ; then
498 EXESUF=".exe"
499 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
500 # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
501 QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
502 LIBS="-lwinmm -lws2_32 -liberty -liphlpapi $LIBS"
503 prefix="c:/Program Files/Qemu"
504 mandir="\${prefix}"
505 datadir="\${prefix}"
506 docdir="\${prefix}"
507 bindir="\${prefix}"
508 sysconfdir="\${prefix}"
509 confsuffix=""
512 werror=""
514 for opt do
515 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
516 case "$opt" in
517 --help|-h) show_help=yes
519 --version|-V) exec cat $source_path/VERSION
521 --prefix=*) prefix="$optarg"
523 --interp-prefix=*) interp_prefix="$optarg"
525 --source-path=*)
527 --cross-prefix=*)
529 --cc=*)
531 --host-cc=*) host_cc="$optarg"
533 --make=*) make="$optarg"
535 --install=*) install="$optarg"
537 --extra-cflags=*)
539 --extra-ldflags=*)
541 --cpu=*)
543 --target-list=*) target_list="$optarg"
545 --enable-trace-backend=*) trace_backend="$optarg"
547 --with-trace-file=*) trace_file="$optarg"
549 --enable-gprof) gprof="yes"
551 --static)
552 static="yes"
553 LDFLAGS="-static $LDFLAGS"
555 --mandir=*) mandir="$optarg"
557 --bindir=*) bindir="$optarg"
559 --datadir=*) datadir="$optarg"
561 --docdir=*) docdir="$optarg"
563 --sysconfdir=*) sysconfdir="$optarg"
565 --disable-sdl) sdl="no"
567 --enable-sdl) sdl="yes"
569 --disable-vnc) vnc="no"
571 --enable-vnc) vnc="yes"
573 --fmod-lib=*) fmod_lib="$optarg"
575 --fmod-inc=*) fmod_inc="$optarg"
577 --oss-lib=*) oss_lib="$optarg"
579 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
581 --audio-drv-list=*) audio_drv_list="$optarg"
583 --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
585 --enable-debug-tcg) debug_tcg="yes"
587 --disable-debug-tcg) debug_tcg="no"
589 --enable-debug-mon) debug_mon="yes"
591 --disable-debug-mon) debug_mon="no"
593 --enable-debug)
594 # Enable debugging options that aren't excessively noisy
595 debug_tcg="yes"
596 debug_mon="yes"
597 debug="yes"
598 strip_opt="no"
600 --enable-sparse) sparse="yes"
602 --disable-sparse) sparse="no"
604 --disable-strip) strip_opt="no"
606 --disable-vnc-tls) vnc_tls="no"
608 --enable-vnc-tls) vnc_tls="yes"
610 --disable-vnc-sasl) vnc_sasl="no"
612 --enable-vnc-sasl) vnc_sasl="yes"
614 --disable-vnc-jpeg) vnc_jpeg="no"
616 --enable-vnc-jpeg) vnc_jpeg="yes"
618 --disable-vnc-png) vnc_png="no"
620 --enable-vnc-png) vnc_png="yes"
622 --disable-vnc-thread) vnc_thread="no"
624 --enable-vnc-thread) vnc_thread="yes"
626 --disable-slirp) slirp="no"
628 --disable-uuid) uuid="no"
630 --enable-uuid) uuid="yes"
632 --disable-vde) vde="no"
634 --enable-vde) vde="yes"
636 --disable-xen) xen="no"
638 --enable-xen) xen="yes"
640 --disable-brlapi) brlapi="no"
642 --enable-brlapi) brlapi="yes"
644 --disable-bluez) bluez="no"
646 --enable-bluez) bluez="yes"
648 --disable-kvm) kvm="no"
650 --enable-kvm) kvm="yes"
652 --disable-kvm-pit) kvm_cap_pit="no"
654 --enable-kvm-pit) kvm_cap_pit="yes"
656 --disable-kvm-device-assignment) kvm_cap_device_assignment="no"
658 --enable-kvm-device-assignment) kvm_cap_device_assignment="yes"
660 --disable-spice) spice="no"
662 --enable-spice) spice="yes"
664 --enable-profiler) profiler="yes"
666 --enable-cocoa)
667 cocoa="yes" ;
668 sdl="no" ;
669 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
671 --disable-system) softmmu="no"
673 --enable-system) softmmu="yes"
675 --disable-user)
676 linux_user="no" ;
677 bsd_user="no" ;
678 darwin_user="no"
680 --enable-user) ;;
681 --disable-linux-user) linux_user="no"
683 --enable-linux-user) linux_user="yes"
685 --disable-darwin-user) darwin_user="no"
687 --enable-darwin-user) darwin_user="yes"
689 --disable-bsd-user) bsd_user="no"
691 --enable-bsd-user) bsd_user="yes"
693 --enable-guest-base) guest_base="yes"
695 --disable-guest-base) guest_base="no"
697 --enable-user-pie) user_pie="yes"
699 --disable-user-pie) user_pie="no"
701 --enable-uname-release=*) uname_release="$optarg"
703 --sparc_cpu=*)
705 --enable-werror) werror="yes"
707 --disable-werror) werror="no"
709 --disable-curses) curses="no"
711 --enable-curses) curses="yes"
713 --disable-curl) curl="no"
715 --enable-curl) curl="yes"
717 --disable-fdt) fdt="no"
719 --enable-fdt) fdt="yes"
721 --disable-check-utests) check_utests="no"
723 --enable-check-utests) check_utests="yes"
725 --disable-nptl) nptl="no"
727 --enable-nptl) nptl="yes"
729 --enable-mixemu) mixemu="yes"
731 --disable-linux-aio) linux_aio="no"
733 --enable-linux-aio) linux_aio="yes"
735 --disable-attr) attr="no"
737 --enable-attr) attr="yes"
739 --enable-io-thread) io_thread="yes"
741 --disable-blobs) blobs="no"
743 --kerneldir=*) kerneldir="$optarg"
745 --with-pkgversion=*) pkgversion=" ($optarg)"
747 --disable-docs) docs="no"
749 --enable-docs) docs="yes"
751 --disable-cpu-emulation) cpu_emulation="no"
753 --disable-vhost-net) vhost_net="no"
755 --enable-vhost-net) vhost_net="yes"
757 --disable-opengl) opengl="no"
759 --enable-opengl) opengl="yes"
761 --*dir)
763 --disable-rbd) rbd="no"
765 --enable-rbd) rbd="yes"
767 --disable-smartcard) smartcard="no"
769 --enable-smartcard) smartcard="yes"
771 --disable-smartcard-nss) smartcard_nss="no"
773 --enable-smartcard-nss) smartcard_nss="yes"
775 *) echo "ERROR: unknown option $opt"; show_help="yes"
777 esac
778 done
781 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
782 # QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
784 host_guest_base="no"
785 case "$cpu" in
786 sparc) case $sparc_cpu in
787 v7|v8)
788 QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
790 v8plus|v8plusa)
791 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
793 *) # sparc_cpu not defined in the command line
794 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
795 esac
796 LDFLAGS="-m32 $LDFLAGS"
797 QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
798 if test "$solaris" = "no" ; then
799 QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
800 helper_cflags="-ffixed-i0"
803 sparc64)
804 QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
805 LDFLAGS="-m64 $LDFLAGS"
806 QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
807 if test "$solaris" != "no" ; then
808 QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
811 s390)
812 QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS"
813 LDFLAGS="-m31 $LDFLAGS"
814 host_guest_base="yes"
816 s390x)
817 QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS"
818 LDFLAGS="-m64 $LDFLAGS"
819 host_guest_base="yes"
821 i386)
822 QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
823 LDFLAGS="-m32 $LDFLAGS"
824 cc_i386='$(CC) -m32'
825 helper_cflags="-fomit-frame-pointer"
826 host_guest_base="yes"
828 x86_64)
829 QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
830 LDFLAGS="-m64 $LDFLAGS"
831 cc_i386='$(CC) -m32'
832 host_guest_base="yes"
834 arm*)
835 host_guest_base="yes"
837 ppc*)
838 host_guest_base="yes"
840 mips*)
841 host_guest_base="yes"
843 ia64*)
844 host_guest_base="yes"
846 hppa*)
847 host_guest_base="yes"
849 unicore32*)
850 host_guest_base="yes"
852 esac
854 [ -z "$guest_base" ] && guest_base="$host_guest_base"
857 default_target_list=""
859 # these targets are portable
860 if [ "$softmmu" = "yes" ] ; then
861 default_target_list="\
862 i386-softmmu \
863 x86_64-softmmu \
864 arm-softmmu \
865 cris-softmmu \
866 lm32-softmmu \
867 m68k-softmmu \
868 microblaze-softmmu \
869 microblazeel-softmmu \
870 mips-softmmu \
871 mipsel-softmmu \
872 mips64-softmmu \
873 mips64el-softmmu \
874 ppc-softmmu \
875 ppcemb-softmmu \
876 ppc64-softmmu \
877 sh4-softmmu \
878 sh4eb-softmmu \
879 sparc-softmmu \
880 sparc64-softmmu \
883 # the following are Linux specific
884 if [ "$linux_user" = "yes" ] ; then
885 default_target_list="${default_target_list}\
886 i386-linux-user \
887 x86_64-linux-user \
888 alpha-linux-user \
889 arm-linux-user \
890 armeb-linux-user \
891 cris-linux-user \
892 m68k-linux-user \
893 microblaze-linux-user \
894 microblazeel-linux-user \
895 mips-linux-user \
896 mipsel-linux-user \
897 ppc-linux-user \
898 ppc64-linux-user \
899 ppc64abi32-linux-user \
900 sh4-linux-user \
901 sh4eb-linux-user \
902 sparc-linux-user \
903 sparc64-linux-user \
904 sparc32plus-linux-user \
905 unicore32-linux-user \
908 # the following are Darwin specific
909 if [ "$darwin_user" = "yes" ] ; then
910 default_target_list="$default_target_list i386-darwin-user ppc-darwin-user "
912 # the following are BSD specific
913 if [ "$bsd_user" = "yes" ] ; then
914 default_target_list="${default_target_list}\
915 i386-bsd-user \
916 x86_64-bsd-user \
917 sparc-bsd-user \
918 sparc64-bsd-user \
922 if test x"$show_help" = x"yes" ; then
923 cat << EOF
925 Usage: configure [options]
926 Options: [defaults in brackets after descriptions]
929 echo "Standard options:"
930 echo " --help print this message"
931 echo " --prefix=PREFIX install in PREFIX [$prefix]"
932 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
933 echo " use %M for cpu name [$interp_prefix]"
934 echo " --target-list=LIST set target list (default: build everything)"
935 echo "Available targets: $default_target_list" | \
936 fold -s -w 53 | sed -e 's/^/ /'
937 echo ""
938 echo "Advanced options (experts only):"
939 echo " --source-path=PATH path of source code [$source_path]"
940 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
941 echo " --cc=CC use C compiler CC [$cc]"
942 echo " --host-cc=CC use C compiler CC [$host_cc] for code run at"
943 echo " build time"
944 echo " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS"
945 echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS"
946 echo " --make=MAKE use specified make [$make]"
947 echo " --install=INSTALL use specified install [$install]"
948 echo " --static enable static build [$static]"
949 echo " --mandir=PATH install man pages in PATH"
950 echo " --datadir=PATH install firmware in PATH"
951 echo " --docdir=PATH install documentation in PATH"
952 echo " --bindir=PATH install binaries in PATH"
953 echo " --sysconfdir=PATH install config in PATH/qemu"
954 echo " --enable-debug-tcg enable TCG debugging"
955 echo " --disable-debug-tcg disable TCG debugging (default)"
956 echo " --enable-debug enable common debug build options"
957 echo " --enable-sparse enable sparse checker"
958 echo " --disable-sparse disable sparse checker (default)"
959 echo " --disable-strip disable stripping binaries"
960 echo " --disable-werror disable compilation abort on warning"
961 echo " --disable-sdl disable SDL"
962 echo " --enable-sdl enable SDL"
963 echo " --disable-vnc disable VNC"
964 echo " --enable-vnc enable VNC"
965 echo " --enable-cocoa enable COCOA (Mac OS X only)"
966 echo " --audio-drv-list=LIST set audio drivers list:"
967 echo " Available drivers: $audio_possible_drivers"
968 echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
969 echo " Available cards: $audio_possible_cards"
970 echo " --block-drv-whitelist=L set block driver whitelist"
971 echo " (affects only QEMU, not qemu-img)"
972 echo " --enable-mixemu enable mixer emulation"
973 echo " --disable-xen disable xen backend driver support"
974 echo " --enable-xen enable xen backend driver support"
975 echo " --disable-brlapi disable BrlAPI"
976 echo " --enable-brlapi enable BrlAPI"
977 echo " --disable-vnc-tls disable TLS encryption for VNC server"
978 echo " --enable-vnc-tls enable TLS encryption for VNC server"
979 echo " --disable-vnc-sasl disable SASL encryption for VNC server"
980 echo " --enable-vnc-sasl enable SASL encryption for VNC server"
981 echo " --disable-vnc-jpeg disable JPEG lossy compression for VNC server"
982 echo " --enable-vnc-jpeg enable JPEG lossy compression for VNC server"
983 echo " --disable-vnc-png disable PNG compression for VNC server (default)"
984 echo " --enable-vnc-png enable PNG compression for VNC server"
985 echo " --disable-vnc-thread disable threaded VNC server"
986 echo " --enable-vnc-thread enable threaded VNC server"
987 echo " --disable-curses disable curses output"
988 echo " --enable-curses enable curses output"
989 echo " --disable-curl disable curl connectivity"
990 echo " --enable-curl enable curl connectivity"
991 echo " --disable-fdt disable fdt device tree"
992 echo " --enable-fdt enable fdt device tree"
993 echo " --disable-check-utests disable check unit-tests"
994 echo " --enable-check-utests enable check unit-tests"
995 echo " --disable-bluez disable bluez stack connectivity"
996 echo " --enable-bluez enable bluez stack connectivity"
997 echo " --disable-kvm disable KVM acceleration support"
998 echo " --enable-kvm enable KVM acceleration support"
999 echo " --disable-kvm-pit disable KVM pit support"
1000 echo " --enable-kvm-pit enable KVM pit support"
1001 echo " --disable-kvm-device-assignment disable KVM device assignment support"
1002 echo " --enable-kvm-device-assignment enable KVM device assignment support"
1003 echo " --disable-nptl disable usermode NPTL support"
1004 echo " --enable-nptl enable usermode NPTL support"
1005 echo " --enable-system enable all system emulation targets"
1006 echo " --disable-system disable all system emulation targets"
1007 echo " --enable-user enable supported user emulation targets"
1008 echo " --disable-user disable all user emulation targets"
1009 echo " --enable-linux-user enable all linux usermode emulation targets"
1010 echo " --disable-linux-user disable all linux usermode emulation targets"
1011 echo " --enable-darwin-user enable all darwin usermode emulation targets"
1012 echo " --disable-darwin-user disable all darwin usermode emulation targets"
1013 echo " --enable-bsd-user enable all BSD usermode emulation targets"
1014 echo " --disable-bsd-user disable all BSD usermode emulation targets"
1015 echo " --enable-guest-base enable GUEST_BASE support for usermode"
1016 echo " emulation targets"
1017 echo " --disable-guest-base disable GUEST_BASE support"
1018 echo " --enable-user-pie build usermode emulation targets as PIE"
1019 echo " --disable-user-pie do not build usermode emulation targets as PIE"
1020 echo " --fmod-lib path to FMOD library"
1021 echo " --fmod-inc path to FMOD includes"
1022 echo " --oss-lib path to OSS library"
1023 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
1024 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
1025 echo " --disable-uuid disable uuid support"
1026 echo " --enable-uuid enable uuid support"
1027 echo " --disable-vde disable support for vde network"
1028 echo " --enable-vde enable support for vde network"
1029 echo " --disable-linux-aio disable Linux AIO support"
1030 echo " --enable-linux-aio enable Linux AIO support"
1031 echo " --disable-attr disables attr and xattr support"
1032 echo " --enable-attr enable attr and xattr support"
1033 echo " --enable-io-thread enable IO thread"
1034 echo " --disable-blobs disable installing provided firmware blobs"
1035 echo " --kerneldir=PATH look for kernel includes in PATH"
1036 echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
1037 echo " --enable-docs enable documentation build"
1038 echo " --disable-docs disable documentation build"
1039 echo " --disable-vhost-net disable vhost-net acceleration support"
1040 echo " --enable-vhost-net enable vhost-net acceleration support"
1041 echo " --enable-trace-backend=B Set trace backend"
1042 echo " Available backends:" $("$source_path"/scripts/tracetool --list-backends)
1043 echo " --with-trace-file=NAME Full PATH,NAME of file to store traces"
1044 echo " Default:trace-<pid>"
1045 echo " --disable-spice disable spice"
1046 echo " --enable-spice enable spice"
1047 echo " --enable-rbd enable building the rados block device (rbd)"
1048 echo " --disable-smartcard disable smartcard support"
1049 echo " --enable-smartcard enable smartcard support"
1050 echo " --disable-smartcard-nss disable smartcard nss support"
1051 echo " --enable-smartcard-nss enable smartcard nss support"
1052 echo ""
1053 echo "NOTE: The object files are built at the place where configure is launched"
1054 exit 1
1057 # check that the C compiler works.
1058 cat > $TMPC <<EOF
1059 int main(void) {}
1062 if compile_object ; then
1063 : C compiler works ok
1064 else
1065 echo "ERROR: \"$cc\" either does not exist or does not work"
1066 exit 1
1069 gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
1070 gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
1071 gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
1072 gcc_flags="-fstack-protector-all $gcc_flags"
1073 cat > $TMPC << EOF
1074 int main(void) { return 0; }
1076 for flag in $gcc_flags; do
1077 if compile_prog "-Werror $QEMU_CFLAGS" "-Werror $flag" ; then
1078 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1080 done
1083 # Solaris specific configure tool chain decisions
1085 if test "$solaris" = "yes" ; then
1086 if has $install; then
1088 else
1089 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
1090 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
1091 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
1092 exit 1
1094 if test "`path_of $install`" = "/usr/sbin/install" ; then
1095 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
1096 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
1097 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
1098 exit 1
1100 if has ar; then
1102 else
1103 echo "Error: No path includes ar"
1104 if test -f /usr/ccs/bin/ar ; then
1105 echo "Add /usr/ccs/bin to your path and rerun configure"
1107 exit 1
1111 if test -z "$target_list" ; then
1112 target_list="$default_target_list"
1113 else
1114 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
1116 if test -z "$target_list" ; then
1117 echo "No targets enabled"
1118 exit 1
1120 # see if system emulation was really requested
1121 case " $target_list " in
1122 *"-softmmu "*) softmmu=yes
1124 *) softmmu=no
1126 esac
1128 feature_not_found() {
1129 feature=$1
1131 echo "ERROR"
1132 echo "ERROR: User requested feature $feature"
1133 echo "ERROR: configure was not able to find it"
1134 echo "ERROR"
1135 exit 1;
1138 if test -z "$cross_prefix" ; then
1140 # ---
1141 # big/little endian test
1142 cat > $TMPC << EOF
1143 #include <inttypes.h>
1144 int main(int argc, char ** argv){
1145 volatile uint32_t i=0x01234567;
1146 return (*((uint8_t*)(&i))) == 0x67;
1150 if compile_prog "" "" ; then
1151 $TMPE && bigendian="yes"
1152 else
1153 echo big/little test failed
1156 else
1158 # if cross compiling, cannot launch a program, so make a static guess
1159 case "$cpu" in
1160 armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
1161 bigendian=yes
1163 esac
1167 # host long bits test, actually a pointer size test
1168 cat > $TMPC << EOF
1169 int sizeof_pointer_is_8[sizeof(void *) == 8 ? 1 : -1];
1171 if compile_object; then
1172 hostlongbits=64
1173 else
1174 hostlongbits=32
1178 ##########################################
1179 # NPTL probe
1181 if test "$nptl" != "no" ; then
1182 cat > $TMPC <<EOF
1183 #include <sched.h>
1184 #include <linux/futex.h>
1185 void foo()
1187 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1188 #error bork
1189 #endif
1193 if compile_object ; then
1194 nptl=yes
1195 else
1196 if test "$nptl" = "yes" ; then
1197 feature_not_found "nptl"
1199 nptl=no
1203 ##########################################
1204 # zlib check
1206 cat > $TMPC << EOF
1207 #include <zlib.h>
1208 int main(void) { zlibVersion(); return 0; }
1210 if compile_prog "" "-lz" ; then
1212 else
1213 echo
1214 echo "Error: zlib check failed"
1215 echo "Make sure to have the zlib libs and headers installed."
1216 echo
1217 exit 1
1220 ##########################################
1221 # xen probe
1223 if test "$xen" != "no" ; then
1224 xen_libs="-lxenstore -lxenctrl -lxenguest"
1226 # Xen unstable
1227 cat > $TMPC <<EOF
1228 #include <xenctrl.h>
1229 #include <xs.h>
1230 #include <stdint.h>
1231 #include <xen/hvm/hvm_info_table.h>
1232 #if !defined(HVM_MAX_VCPUS)
1233 # error HVM_MAX_VCPUS not defined
1234 #endif
1235 int main(void) {
1236 xc_interface *xc;
1237 xs_daemon_open();
1238 xc = xc_interface_open(0, 0, 0);
1239 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1240 xc_gnttab_open(NULL, 0);
1241 return 0;
1244 if compile_prog "" "$xen_libs" ; then
1245 xen_ctrl_version=410
1246 xen=yes
1248 # Xen 4.0.0
1249 elif (
1250 cat > $TMPC <<EOF
1251 #include <xenctrl.h>
1252 #include <xs.h>
1253 #include <stdint.h>
1254 #include <xen/hvm/hvm_info_table.h>
1255 #if !defined(HVM_MAX_VCPUS)
1256 # error HVM_MAX_VCPUS not defined
1257 #endif
1258 int main(void) {
1259 xs_daemon_open();
1260 xc_interface_open();
1261 xc_gnttab_open();
1262 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1263 return 0;
1266 compile_prog "" "$xen_libs"
1267 ) ; then
1268 xen_ctrl_version=400
1269 xen=yes
1271 # Xen 3.3.0, 3.4.0
1272 elif (
1273 cat > $TMPC <<EOF
1274 #include <xenctrl.h>
1275 #include <xs.h>
1276 int main(void) {
1277 xs_daemon_open();
1278 xc_interface_open();
1279 xc_gnttab_open();
1280 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1281 return 0;
1284 compile_prog "" "$xen_libs"
1285 ) ; then
1286 xen_ctrl_version=330
1287 xen=yes
1289 # Xen not found or unsupported
1290 else
1291 if test "$xen" = "yes" ; then
1292 feature_not_found "xen"
1294 xen=no
1297 if test "$xen" = yes; then
1298 libs_softmmu="$xen_libs $libs_softmmu"
1302 ##########################################
1303 # pkg-config probe
1305 if ! has $pkg_config; then
1306 echo warning: proceeding without "$pkg_config" >&2
1307 pkg_config=/bin/false
1310 ##########################################
1311 # Sparse probe
1312 if test "$sparse" != "no" ; then
1313 if has cgcc; then
1314 sparse=yes
1315 else
1316 if test "$sparse" = "yes" ; then
1317 feature_not_found "sparse"
1319 sparse=no
1323 ##########################################
1324 # SDL probe
1326 # Look for sdl configuration program (pkg-config or sdl-config). Try
1327 # sdl-config even without cross prefix, and favour pkg-config over sdl-config.
1328 if test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then
1329 sdl_config=sdl-config
1332 if $pkg_config sdl --modversion >/dev/null 2>&1; then
1333 sdlconfig="$pkg_config sdl"
1334 _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
1335 elif has ${sdl_config}; then
1336 sdlconfig="$sdl_config"
1337 _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1338 else
1339 if test "$sdl" = "yes" ; then
1340 feature_not_found "sdl"
1342 sdl=no
1344 if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
1345 echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
1348 sdl_too_old=no
1349 if test "$sdl" != "no" ; then
1350 cat > $TMPC << EOF
1351 #include <SDL.h>
1352 #undef main /* We don't want SDL to override our main() */
1353 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1355 sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
1356 if test "$static" = "yes" ; then
1357 sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
1358 else
1359 sdl_libs=`$sdlconfig --libs 2> /dev/null`
1361 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1362 if test "$_sdlversion" -lt 121 ; then
1363 sdl_too_old=yes
1364 else
1365 if test "$cocoa" = "no" ; then
1366 sdl=yes
1370 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
1371 if test "$sdl" = "yes" -a "$static" = "yes" ; then
1372 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
1373 sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1374 sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
1376 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1378 else
1379 sdl=no
1381 fi # static link
1382 else # sdl not found
1383 if test "$sdl" = "yes" ; then
1384 feature_not_found "sdl"
1386 sdl=no
1387 fi # sdl compile test
1390 if test "$sdl" = "yes" ; then
1391 cat > $TMPC <<EOF
1392 #include <SDL.h>
1393 #if defined(SDL_VIDEO_DRIVER_X11)
1394 #include <X11/XKBlib.h>
1395 #else
1396 #error No x11 support
1397 #endif
1398 int main(void) { return 0; }
1400 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1401 sdl_libs="$sdl_libs -lX11"
1403 if test "$mingw32" = "yes" ; then
1404 sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole"
1406 libs_softmmu="$sdl_libs $libs_softmmu"
1409 ##########################################
1410 # VNC TLS detection
1411 if test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then
1412 cat > $TMPC <<EOF
1413 #include <gnutls/gnutls.h>
1414 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1416 vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
1417 vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
1418 if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
1419 vnc_tls=yes
1420 libs_softmmu="$vnc_tls_libs $libs_softmmu"
1421 else
1422 if test "$vnc_tls" = "yes" ; then
1423 feature_not_found "vnc-tls"
1425 vnc_tls=no
1429 ##########################################
1430 # VNC SASL detection
1431 if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
1432 cat > $TMPC <<EOF
1433 #include <sasl/sasl.h>
1434 #include <stdio.h>
1435 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
1437 # Assuming Cyrus-SASL installed in /usr prefix
1438 vnc_sasl_cflags=""
1439 vnc_sasl_libs="-lsasl2"
1440 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1441 vnc_sasl=yes
1442 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
1443 else
1444 if test "$vnc_sasl" = "yes" ; then
1445 feature_not_found "vnc-sasl"
1447 vnc_sasl=no
1451 ##########################################
1452 # VNC JPEG detection
1453 if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
1454 cat > $TMPC <<EOF
1455 #include <stdio.h>
1456 #include <jpeglib.h>
1457 int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
1459 vnc_jpeg_cflags=""
1460 vnc_jpeg_libs="-ljpeg"
1461 if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
1462 vnc_jpeg=yes
1463 libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
1464 else
1465 if test "$vnc_jpeg" = "yes" ; then
1466 feature_not_found "vnc-jpeg"
1468 vnc_jpeg=no
1472 ##########################################
1473 # VNC PNG detection
1474 if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
1475 cat > $TMPC <<EOF
1476 //#include <stdio.h>
1477 #include <png.h>
1478 #include <stddef.h>
1479 int main(void) {
1480 png_structp png_ptr;
1481 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
1482 return 0;
1485 vnc_png_cflags=""
1486 vnc_png_libs="-lpng"
1487 if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
1488 vnc_png=yes
1489 libs_softmmu="$vnc_png_libs $libs_softmmu"
1490 else
1491 if test "$vnc_png" = "yes" ; then
1492 feature_not_found "vnc-png"
1494 vnc_png=no
1498 ##########################################
1499 # fnmatch() probe, used for ACL routines
1500 fnmatch="no"
1501 cat > $TMPC << EOF
1502 #include <fnmatch.h>
1503 int main(void)
1505 fnmatch("foo", "foo", 0);
1506 return 0;
1509 if compile_prog "" "" ; then
1510 fnmatch="yes"
1513 ##########################################
1514 # uuid_generate() probe, used for vdi block driver
1515 if test "$uuid" != "no" ; then
1516 uuid_libs="-luuid"
1517 cat > $TMPC << EOF
1518 #include <uuid/uuid.h>
1519 int main(void)
1521 uuid_t my_uuid;
1522 uuid_generate(my_uuid);
1523 return 0;
1526 if compile_prog "" "$uuid_libs" ; then
1527 uuid="yes"
1528 libs_softmmu="$uuid_libs $libs_softmmu"
1529 libs_tools="$uuid_libs $libs_tools"
1530 else
1531 if test "$uuid" = "yes" ; then
1532 feature_not_found "uuid"
1534 uuid=no
1538 ##########################################
1539 # xfsctl() probe, used for raw-posix
1540 if test "$xfs" != "no" ; then
1541 cat > $TMPC << EOF
1542 #include <xfs/xfs.h>
1543 int main(void)
1545 xfsctl(NULL, 0, 0, NULL);
1546 return 0;
1549 if compile_prog "" "" ; then
1550 xfs="yes"
1551 else
1552 if test "$xfs" = "yes" ; then
1553 feature_not_found "xfs"
1555 xfs=no
1559 ##########################################
1560 # vde libraries probe
1561 if test "$vde" != "no" ; then
1562 vde_libs="-lvdeplug"
1563 cat > $TMPC << EOF
1564 #include <libvdeplug.h>
1565 int main(void)
1567 struct vde_open_args a = {0, 0, 0};
1568 vde_open("", "", &a);
1569 return 0;
1572 if compile_prog "" "$vde_libs" ; then
1573 vde=yes
1574 libs_softmmu="$vde_libs $libs_softmmu"
1575 libs_tools="$vde_libs $libs_tools"
1576 else
1577 if test "$vde" = "yes" ; then
1578 feature_not_found "vde"
1580 vde=no
1584 ##########################################
1585 # Sound support libraries probe
1587 audio_drv_probe()
1589 drv=$1
1590 hdr=$2
1591 lib=$3
1592 exp=$4
1593 cfl=$5
1594 cat > $TMPC << EOF
1595 #include <$hdr>
1596 int main(void) { $exp }
1598 if compile_prog "$cfl" "$lib" ; then
1600 else
1601 echo
1602 echo "Error: $drv check failed"
1603 echo "Make sure to have the $drv libs and headers installed."
1604 echo
1605 exit 1
1609 audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1610 for drv in $audio_drv_list; do
1611 case $drv in
1612 alsa)
1613 audio_drv_probe $drv alsa/asoundlib.h -lasound \
1614 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1615 libs_softmmu="-lasound $libs_softmmu"
1618 fmod)
1619 if test -z $fmod_lib || test -z $fmod_inc; then
1620 echo
1621 echo "Error: You must specify path to FMOD library and headers"
1622 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1623 echo
1624 exit 1
1626 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1627 libs_softmmu="$fmod_lib $libs_softmmu"
1630 esd)
1631 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1632 libs_softmmu="-lesd $libs_softmmu"
1633 audio_pt_int="yes"
1637 audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
1638 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1639 libs_softmmu="-lpulse -lpulse-simple $libs_softmmu"
1640 audio_pt_int="yes"
1643 coreaudio)
1644 libs_softmmu="-framework CoreAudio $libs_softmmu"
1647 dsound)
1648 libs_softmmu="-lole32 -ldxguid $libs_softmmu"
1649 audio_win_int="yes"
1652 oss)
1653 libs_softmmu="$oss_lib $libs_softmmu"
1656 sdl|wav)
1657 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1660 winwave)
1661 libs_softmmu="-lwinmm $libs_softmmu"
1662 audio_win_int="yes"
1666 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
1667 echo
1668 echo "Error: Unknown driver '$drv' selected"
1669 echo "Possible drivers are: $audio_possible_drivers"
1670 echo
1671 exit 1
1674 esac
1675 done
1677 ##########################################
1678 # BrlAPI probe
1680 if test "$brlapi" != "no" ; then
1681 brlapi_libs="-lbrlapi"
1682 cat > $TMPC << EOF
1683 #include <brlapi.h>
1684 #include <stddef.h>
1685 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1687 if compile_prog "" "$brlapi_libs" ; then
1688 brlapi=yes
1689 libs_softmmu="$brlapi_libs $libs_softmmu"
1690 else
1691 if test "$brlapi" = "yes" ; then
1692 feature_not_found "brlapi"
1694 brlapi=no
1698 ##########################################
1699 # curses probe
1700 if test "$mingw32" = "yes" ; then
1701 curses_list="-lpdcurses"
1702 else
1703 curses_list="-lncurses -lcurses"
1706 if test "$curses" != "no" ; then
1707 curses_found=no
1708 cat > $TMPC << EOF
1709 #include <curses.h>
1710 #ifdef __OpenBSD__
1711 #define resize_term resizeterm
1712 #endif
1713 int main(void) { resize_term(0, 0); return curses_version(); }
1715 for curses_lib in $curses_list; do
1716 if compile_prog "" "$curses_lib" ; then
1717 curses_found=yes
1718 libs_softmmu="$curses_lib $libs_softmmu"
1719 break
1721 done
1722 if test "$curses_found" = "yes" ; then
1723 curses=yes
1724 else
1725 if test "$curses" = "yes" ; then
1726 feature_not_found "curses"
1728 curses=no
1732 ##########################################
1733 # curl probe
1735 if $pkg_config libcurl --modversion >/dev/null 2>&1; then
1736 curlconfig="$pkg_config libcurl"
1737 else
1738 curlconfig=curl-config
1741 if test "$curl" != "no" ; then
1742 cat > $TMPC << EOF
1743 #include <curl/curl.h>
1744 int main(void) { return curl_easy_init(); }
1746 curl_cflags=`$curlconfig --cflags 2>/dev/null`
1747 curl_libs=`$curlconfig --libs 2>/dev/null`
1748 if compile_prog "$curl_cflags" "$curl_libs" ; then
1749 curl=yes
1750 libs_tools="$curl_libs $libs_tools"
1751 libs_softmmu="$curl_libs $libs_softmmu"
1752 else
1753 if test "$curl" = "yes" ; then
1754 feature_not_found "curl"
1756 curl=no
1758 fi # test "$curl"
1760 ##########################################
1761 # check framework probe
1763 if test "$check_utests" != "no" ; then
1764 cat > $TMPC << EOF
1765 #include <check.h>
1766 int main(void) { suite_create("qemu test"); return 0; }
1768 check_libs=`$pkg_config --libs check`
1769 if compile_prog "" $check_libs ; then
1770 check_utests=yes
1771 libs_tools="$check_libs $libs_tools"
1772 else
1773 if test "$check_utests" = "yes" ; then
1774 feature_not_found "check"
1776 check_utests=no
1778 fi # test "$check_utests"
1780 ##########################################
1781 # bluez support probe
1782 if test "$bluez" != "no" ; then
1783 cat > $TMPC << EOF
1784 #include <bluetooth/bluetooth.h>
1785 int main(void) { return bt_error(0); }
1787 bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
1788 bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
1789 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
1790 bluez=yes
1791 libs_softmmu="$bluez_libs $libs_softmmu"
1792 else
1793 if test "$bluez" = "yes" ; then
1794 feature_not_found "bluez"
1796 bluez="no"
1800 ##########################################
1801 # kvm probe
1802 if test "$kvm" != "no" ; then
1803 cat > $TMPC <<EOF
1804 #include <linux/kvm.h>
1805 #if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
1806 #error Invalid KVM version
1807 #endif
1809 must_have_caps="KVM_CAP_USER_MEMORY \
1810 KVM_CAP_DESTROY_MEMORY_REGION_WORKS \
1811 KVM_CAP_COALESCED_MMIO \
1812 KVM_CAP_SYNC_MMU \
1814 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) ; then
1815 must_have_caps="$caps \
1816 KVM_CAP_SET_TSS_ADDR \
1817 KVM_CAP_EXT_CPUID \
1818 KVM_CAP_CLOCKSOURCE \
1819 KVM_CAP_NOP_IO_DELAY \
1820 KVM_CAP_PV_MMU \
1821 KVM_CAP_MP_STATE \
1822 KVM_CAP_USER_NMI \
1825 for c in $must_have_caps ; do
1826 cat >> $TMPC <<EOF
1827 #if !defined($c)
1828 #error Missing KVM capability $c
1829 #endif
1831 done
1832 cat >> $TMPC <<EOF
1833 int main(void) { return 0; }
1835 if test "$kerneldir" != "" ; then
1836 kvm_cflags=-I"$kerneldir"/include
1837 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1838 -a -d "$kerneldir/arch/x86/include" ; then
1839 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
1840 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1841 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
1842 elif test "$cpu" = "s390x" -a -d "$kerneldir/arch/s390/include" ; then
1843 kvm_cflags="$kvm_cflags -I$kerneldir/arch/s390/include"
1844 elif test -d "$kerneldir/arch/$cpu/include" ; then
1845 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1847 else
1848 kvm_cflags=`$pkg_config --cflags kvm-kmod 2>/dev/null`
1849 if test "$kvm_cflags" = ""; then
1850 case "$cpu" in
1851 i386 | x86_64)
1852 kvm_arch="x86"
1854 ppc)
1855 kvm_arch="powerpc"
1858 kvm_arch="$cpu"
1860 esac
1861 kvm_cflags="-I$source_path/kvm/include"
1862 kvm_cflags="$kvm_cflags -include $source_path/kvm/include/linux/config.h"
1863 kvm_cflags="$kvm_cflags -I$source_path/kvm/include/$kvm_arch"
1866 kvm_cflags="$kvm_cflags -idirafter $source_path/compat"
1867 if compile_prog "$kvm_cflags" "" ; then
1868 kvm=yes
1869 cat > $TMPC <<EOF
1870 #include <linux/kvm_para.h>
1871 int main(void) { return 0; }
1873 if compile_prog "$kvm_cflags" "" ; then
1874 kvm_para=yes
1876 else
1877 if test "$kvm" = "yes" ; then
1878 if has awk && has grep; then
1879 kvmerr=`LANG=C $cc $QEMU_CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \
1880 | grep "error: " \
1881 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1882 if test "$kvmerr" != "" ; then
1883 echo -e "${kvmerr}\n\
1884 NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \
1885 recent kvm-kmod from http://sourceforge.net/projects/kvm."
1888 feature_not_found "kvm"
1890 kvm=no
1894 ##########################################
1895 # test for ppc kvm pvr setting
1897 if test "$kvm" = "yes" && test "$cpu" = "ppc" -o "$cpu" = "ppc64"; then
1898 cat > $TMPC <<EOF
1899 #include <asm/kvm.h>
1900 int main(void) { struct kvm_sregs s; s.pvr = 0; return 0; }
1902 if compile_prog "$kvm_cflags" "" ; then
1903 kvm_ppc_pvr=yes
1904 else
1905 kvm_ppc_pvr=no
1909 ##########################################
1910 # test for KVM_CAP_PIT
1912 if test "$kvm_cap_pit" != "no" ; then
1913 if test "$kvm" = "no" -a "$kvm_cap_pit" = "yes" ; then
1914 feature_not_found "kvm_cap_pit (kvm is not enabled)"
1916 cat > $TMPC <<EOF
1917 #include <linux/kvm.h>
1918 #ifndef KVM_CAP_PIT
1919 #error "kvm no pit capability"
1920 #endif
1921 int main(void) { return 0; }
1923 if compile_prog "$kvm_cflags" ""; then
1924 kvm_cap_pit=yes
1925 else
1926 if test "$kvm_cap_pit" = "yes" ; then
1927 feature_not_found "kvm_cap_pit"
1929 kvm_cap_pit=no
1933 ##########################################
1934 # test for KVM_CAP_DEVICE_ASSIGNMENT
1936 if test "$kvm_cap_device_assignment" != "no" ; then
1937 if test "$kvm" = "no" -a "$kvm_cap_device_assignment" = "yes" ; then
1938 feature_not_found "kvm_cap_device_assignment (kvm is not enabled)"
1940 cat > $TMPC <<EOF
1941 #include <linux/kvm.h>
1942 #ifndef KVM_CAP_DEVICE_ASSIGNMENT
1943 #error "kvm no device assignment capability"
1944 #endif
1945 int main(void) { return 0; }
1947 if compile_prog "$kvm_cflags" "" ; then
1948 kvm_cap_device_assignment=yes
1949 else
1950 if test "$kvm_cap_device_assignment" = "yes" ; then
1951 feature_not_found "kvm_cap_device_assigment"
1953 kvm_cap_device_assignment=no
1957 ##########################################
1958 # libpci header probe for kvm_cap_device_assignment
1959 if test $kvm_cap_device_assignment = "yes" ; then
1960 cat > $TMPC << EOF
1961 #include <pci/header.h>
1962 #ifndef PCI_VENDOR_ID
1963 #error NO LIBPCI HEADER
1964 #endif
1965 int main(void) { return 0; }
1967 if compile_prog "" "" ; then
1968 kvm_cap_device_assignment=yes
1969 else
1970 echo
1971 echo "Error: libpci header check failed"
1972 echo "Disable KVM Device Assignment capability."
1973 echo
1974 kvm_cap_device_assignment=no
1978 ##########################################
1979 # test for vhost net
1981 if test "$vhost_net" != "no"; then
1982 if test "$kvm" != "no"; then
1983 cat > $TMPC <<EOF
1984 #include <linux/vhost.h>
1985 int main(void) { return 0; }
1987 if compile_prog "$kvm_cflags" "" ; then
1988 vhost_net=yes
1989 else
1990 if test "$vhost_net" = "yes" ; then
1991 feature_not_found "vhost-net"
1993 vhost_net=no
1995 else
1996 if test "$vhost_net" = "yes" ; then
1997 echo "NOTE: vhost-net feature requires KVM (--enable-kvm)."
1998 feature_not_found "vhost-net"
2000 vhost_net=no
2004 ##########################################
2005 # pthread probe
2006 PTHREADLIBS_LIST="-lpthread -lpthreadGC2"
2008 pthread=no
2009 cat > $TMPC << EOF
2010 #include <pthread.h>
2011 int main(void) { pthread_create(0,0,0,0); return 0; }
2013 if compile_prog "" "" ; then
2014 pthread=yes
2015 else
2016 for pthread_lib in $PTHREADLIBS_LIST; do
2017 if compile_prog "" "$pthread_lib" ; then
2018 pthread=yes
2019 LIBS="$pthread_lib $LIBS"
2020 break
2022 done
2025 if test "$mingw32" != yes -a "$pthread" = no; then
2026 echo
2027 echo "Error: pthread check failed"
2028 echo "Make sure to have the pthread libs and headers installed."
2029 echo
2030 exit 1
2033 ##########################################
2034 # rbd probe
2035 if test "$rbd" != "no" ; then
2036 cat > $TMPC <<EOF
2037 #include <stdio.h>
2038 #include <rados/librados.h>
2039 int main(void) { rados_initialize(0, NULL); return 0; }
2041 rbd_libs="-lrados"
2042 if compile_prog "" "$rbd_libs" ; then
2043 librados_too_old=no
2044 cat > $TMPC <<EOF
2045 #include <stdio.h>
2046 #include <rados/librados.h>
2047 #ifndef CEPH_OSD_TMAP_SET
2048 #error missing CEPH_OSD_TMAP_SET
2049 #endif
2050 int main(void) {
2051 int (*func)(const rados_pool_t pool, uint64_t *snapid) = rados_selfmanaged_snap_create;
2052 rados_initialize(0, NULL);
2053 return 0;
2056 if compile_prog "" "$rbd_libs" ; then
2057 rbd=yes
2058 libs_tools="$rbd_libs $libs_tools"
2059 libs_softmmu="$rbd_libs $libs_softmmu"
2060 else
2061 rbd=no
2062 librados_too_old=yes
2064 else
2065 if test "$rbd" = "yes" ; then
2066 feature_not_found "rados block device"
2068 rbd=no
2070 if test "$librados_too_old" = "yes" ; then
2071 echo "-> Your librados version is too old - upgrade needed to have rbd support"
2075 ##########################################
2076 # linux-aio probe
2078 if test "$linux_aio" != "no" ; then
2079 cat > $TMPC <<EOF
2080 #include <libaio.h>
2081 #include <sys/eventfd.h>
2082 #include <stddef.h>
2083 int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
2085 if compile_prog "" "-laio" ; then
2086 linux_aio=yes
2087 libs_softmmu="$libs_softmmu -laio"
2088 libs_tools="$libs_tools -laio"
2089 else
2090 if test "$linux_aio" = "yes" ; then
2091 feature_not_found "linux AIO"
2093 linux_aio=no
2097 ##########################################
2098 # attr probe
2100 if test "$attr" != "no" ; then
2101 cat > $TMPC <<EOF
2102 #include <stdio.h>
2103 #include <sys/types.h>
2104 #include <attr/xattr.h>
2105 int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
2107 if compile_prog "" "-lattr" ; then
2108 attr=yes
2109 LIBS="-lattr $LIBS"
2110 else
2111 if test "$attr" = "yes" ; then
2112 feature_not_found "ATTR"
2114 attr=no
2118 ##########################################
2119 # iovec probe
2120 cat > $TMPC <<EOF
2121 #include <sys/types.h>
2122 #include <sys/uio.h>
2123 #include <unistd.h>
2124 int main(void) { struct iovec iov; return 0; }
2126 iovec=no
2127 if compile_prog "" "" ; then
2128 iovec=yes
2131 ##########################################
2132 # preadv probe
2133 cat > $TMPC <<EOF
2134 #include <sys/types.h>
2135 #include <sys/uio.h>
2136 #include <unistd.h>
2137 int main(void) { preadv; }
2139 preadv=no
2140 if compile_prog "" "" ; then
2141 preadv=yes
2144 ##########################################
2145 # fdt probe
2146 if test "$fdt" != "no" ; then
2147 fdt_libs="-lfdt"
2148 cat > $TMPC << EOF
2149 int main(void) { return 0; }
2151 if compile_prog "" "$fdt_libs" ; then
2152 fdt=yes
2153 else
2154 if test "$fdt" = "yes" ; then
2155 feature_not_found "fdt"
2157 fdt_libs=
2158 fdt=no
2162 ##########################################
2163 # opengl probe, used by milkymist-tmu2
2164 if test "$opengl" != "no" ; then
2165 opengl_libs="-lGL"
2166 cat > $TMPC << EOF
2167 #include <X11/Xlib.h>
2168 #include <GL/gl.h>
2169 #include <GL/glx.h>
2170 int main(void) { GL_VERSION; return 0; }
2172 if compile_prog "" "-lGL" ; then
2173 opengl=yes
2174 else
2175 if test "$opengl" = "yes" ; then
2176 feature_not_found "opengl"
2178 opengl_libs=
2179 opengl=no
2184 # Check for xxxat() functions when we are building linux-user
2185 # emulator. This is done because older glibc versions don't
2186 # have syscall stubs for these implemented.
2188 atfile=no
2189 cat > $TMPC << EOF
2190 #define _ATFILE_SOURCE
2191 #include <sys/types.h>
2192 #include <fcntl.h>
2193 #include <unistd.h>
2196 main(void)
2198 /* try to unlink nonexisting file */
2199 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
2202 if compile_prog "" "" ; then
2203 atfile=yes
2206 # Check for inotify functions when we are building linux-user
2207 # emulator. This is done because older glibc versions don't
2208 # have syscall stubs for these implemented. In that case we
2209 # don't provide them even if kernel supports them.
2211 inotify=no
2212 cat > $TMPC << EOF
2213 #include <sys/inotify.h>
2216 main(void)
2218 /* try to start inotify */
2219 return inotify_init();
2222 if compile_prog "" "" ; then
2223 inotify=yes
2226 inotify1=no
2227 cat > $TMPC << EOF
2228 #include <sys/inotify.h>
2231 main(void)
2233 /* try to start inotify */
2234 return inotify_init1(0);
2237 if compile_prog "" "" ; then
2238 inotify1=yes
2241 # check if utimensat and futimens are supported
2242 utimens=no
2243 cat > $TMPC << EOF
2244 #define _ATFILE_SOURCE
2245 #include <stddef.h>
2246 #include <fcntl.h>
2248 int main(void)
2250 utimensat(AT_FDCWD, "foo", NULL, 0);
2251 futimens(0, NULL);
2252 return 0;
2255 if compile_prog "" "" ; then
2256 utimens=yes
2259 # check if pipe2 is there
2260 pipe2=no
2261 cat > $TMPC << EOF
2262 #include <unistd.h>
2263 #include <fcntl.h>
2265 int main(void)
2267 int pipefd[2];
2268 pipe2(pipefd, O_CLOEXEC);
2269 return 0;
2272 if compile_prog "" "" ; then
2273 pipe2=yes
2276 # check if accept4 is there
2277 accept4=no
2278 cat > $TMPC << EOF
2279 #include <sys/socket.h>
2280 #include <stddef.h>
2282 int main(void)
2284 accept4(0, NULL, NULL, SOCK_CLOEXEC);
2285 return 0;
2288 if compile_prog "" "" ; then
2289 accept4=yes
2292 # check if tee/splice is there. vmsplice was added same time.
2293 splice=no
2294 cat > $TMPC << EOF
2295 #include <unistd.h>
2296 #include <fcntl.h>
2297 #include <limits.h>
2299 int main(void)
2301 int len, fd;
2302 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
2303 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
2304 return 0;
2307 if compile_prog "" "" ; then
2308 splice=yes
2311 ##########################################
2312 # signalfd probe
2313 signalfd="no"
2314 cat > $TMPC << EOF
2315 #define _GNU_SOURCE
2316 #include <unistd.h>
2317 #include <sys/syscall.h>
2318 #include <signal.h>
2319 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
2322 if compile_prog "" "" ; then
2323 signalfd=yes
2324 elif test "$kvm" = "yes" -a "$io_thread" != "yes"; then
2325 echo
2326 echo "ERROR: Host kernel lacks signalfd() support,"
2327 echo "but KVM depends on it when the IO thread is disabled."
2328 echo
2329 exit 1
2332 # check if eventfd is supported
2333 eventfd=no
2334 cat > $TMPC << EOF
2335 #include <sys/eventfd.h>
2337 int main(void)
2339 int efd = eventfd(0, 0);
2340 return 0;
2343 if compile_prog "" "" ; then
2344 eventfd=yes
2347 # check for fallocate
2348 fallocate=no
2349 cat > $TMPC << EOF
2350 #include <fcntl.h>
2352 int main(void)
2354 fallocate(0, 0, 0, 0);
2355 return 0;
2358 if compile_prog "$ARCH_CFLAGS" "" ; then
2359 fallocate=yes
2362 # check for sync_file_range
2363 sync_file_range=no
2364 cat > $TMPC << EOF
2365 #include <fcntl.h>
2367 int main(void)
2369 sync_file_range(0, 0, 0, 0);
2370 return 0;
2373 if compile_prog "$ARCH_CFLAGS" "" ; then
2374 sync_file_range=yes
2377 # check for linux/fiemap.h and FS_IOC_FIEMAP
2378 fiemap=no
2379 cat > $TMPC << EOF
2380 #include <sys/ioctl.h>
2381 #include <linux/fs.h>
2382 #include <linux/fiemap.h>
2384 int main(void)
2386 ioctl(0, FS_IOC_FIEMAP, 0);
2387 return 0;
2390 if compile_prog "$ARCH_CFLAGS" "" ; then
2391 fiemap=yes
2394 # check for dup3
2395 dup3=no
2396 cat > $TMPC << EOF
2397 #include <unistd.h>
2399 int main(void)
2401 dup3(0, 0, 0);
2402 return 0;
2405 if compile_prog "" "" ; then
2406 dup3=yes
2409 # check for epoll support
2410 epoll=no
2411 cat > $TMPC << EOF
2412 #include <sys/epoll.h>
2414 int main(void)
2416 epoll_create(0);
2417 return 0;
2420 if compile_prog "$ARCH_CFLAGS" "" ; then
2421 epoll=yes
2424 # epoll_create1 and epoll_pwait are later additions
2425 # so we must check separately for their presence
2426 epoll_create1=no
2427 cat > $TMPC << EOF
2428 #include <sys/epoll.h>
2430 int main(void)
2432 /* Note that we use epoll_create1 as a value, not as
2433 * a function being called. This is necessary so that on
2434 * old SPARC glibc versions where the function was present in
2435 * the library but not declared in the header file we will
2436 * fail the configure check. (Otherwise we will get a compiler
2437 * warning but not an error, and will proceed to fail the
2438 * qemu compile where we compile with -Werror.)
2440 epoll_create1;
2441 return 0;
2444 if compile_prog "$ARCH_CFLAGS" "" ; then
2445 epoll_create1=yes
2448 epoll_pwait=no
2449 cat > $TMPC << EOF
2450 #include <sys/epoll.h>
2452 int main(void)
2454 epoll_pwait(0, 0, 0, 0, 0);
2455 return 0;
2458 if compile_prog "$ARCH_CFLAGS" "" ; then
2459 epoll_pwait=yes
2462 # Check if tools are available to build documentation.
2463 if test "$docs" != "no" ; then
2464 if has makeinfo && has pod2man; then
2465 docs=yes
2466 else
2467 if test "$docs" = "yes" ; then
2468 feature_not_found "docs"
2470 docs=no
2474 # Search for bswap_32 function
2475 byteswap_h=no
2476 cat > $TMPC << EOF
2477 #include <byteswap.h>
2478 int main(void) { return bswap_32(0); }
2480 if compile_prog "" "" ; then
2481 byteswap_h=yes
2484 # Search for bswap_32 function
2485 bswap_h=no
2486 cat > $TMPC << EOF
2487 #include <sys/endian.h>
2488 #include <sys/types.h>
2489 #include <machine/bswap.h>
2490 int main(void) { return bswap32(0); }
2492 if compile_prog "" "" ; then
2493 bswap_h=yes
2496 ##########################################
2497 # Do we need librt
2498 cat > $TMPC <<EOF
2499 #include <signal.h>
2500 #include <time.h>
2501 int main(void) { clockid_t id; return clock_gettime(id, 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 ##########################################
2528 # check if the compiler understands attribute warn_unused_result
2530 # This could be smarter, but gcc -Werror does not error out even when warning
2531 # about attribute warn_unused_result
2533 gcc_attribute_warn_unused_result=no
2534 cat > $TMPC << EOF
2535 #if defined(__GNUC__) && (__GNUC__ < 4) && defined(__GNUC_MINOR__) && (__GNUC__ < 4)
2536 #error gcc 3.3 or older
2537 #endif
2538 int main(void) { return 0;}
2540 if compile_prog "" ""; then
2541 gcc_attribute_warn_unused_result=yes
2544 # spice probe
2545 if test "$spice" != "no" ; then
2546 cat > $TMPC << EOF
2547 #include <spice.h>
2548 int main(void) { spice_server_new(); return 0; }
2550 spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
2551 spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
2552 if $pkg_config --atleast-version=0.5.3 spice-server >/dev/null 2>&1 && \
2553 compile_prog "$spice_cflags" "$spice_libs" ; then
2554 spice="yes"
2555 libs_softmmu="$libs_softmmu $spice_libs"
2556 QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
2557 else
2558 if test "$spice" = "yes" ; then
2559 feature_not_found "spice"
2561 spice="no"
2565 # check for libcacard for smartcard support
2566 if test "$smartcard" != "no" ; then
2567 smartcard="yes"
2568 smartcard_cflags=""
2569 # TODO - what's the minimal nss version we support?
2570 if test "$smartcard_nss" != "no"; then
2571 if $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 ; then
2572 smartcard_nss="yes"
2573 smartcard_cflags="-I\$(SRC_PATH)/libcacard"
2574 libcacard_libs=$($pkg_config --libs nss 2>/dev/null)
2575 libcacard_cflags=$($pkg_config --cflags nss 2>/dev/null)
2576 QEMU_CFLAGS="$QEMU_CFLAGS $smartcard_cflags $libcacard_cflags"
2577 LIBS="$libcacard_libs $LIBS"
2578 else
2579 if test "$smartcard_nss" = "yes"; then
2580 feature_not_found "nss"
2582 smartcard_nss="no"
2586 if test "$smartcard" = "no" ; then
2587 smartcard_nss="no"
2590 ##########################################
2592 ##########################################
2593 # check if we have fdatasync
2595 fdatasync=no
2596 cat > $TMPC << EOF
2597 #include <unistd.h>
2598 int main(void) { return fdatasync(0); }
2600 if compile_prog "" "" ; then
2601 fdatasync=yes
2604 ##########################################
2605 # check if we have madvise
2607 madvise=no
2608 cat > $TMPC << EOF
2609 #include <sys/types.h>
2610 #include <sys/mman.h>
2611 #include <stddef.h>
2612 int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
2614 if compile_prog "" "" ; then
2615 madvise=yes
2618 ##########################################
2619 # check if we have posix_madvise
2621 posix_madvise=no
2622 cat > $TMPC << EOF
2623 #include <sys/mman.h>
2624 #include <stddef.h>
2625 int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
2627 if compile_prog "" "" ; then
2628 posix_madvise=yes
2631 ##########################################
2632 # check if trace backend exists
2634 sh "$source_path/scripts/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null
2635 if test "$?" -ne 0 ; then
2636 echo
2637 echo "Error: invalid trace backend"
2638 echo "Please choose a supported trace backend."
2639 echo
2640 exit 1
2643 ##########################################
2644 # For 'ust' backend, test if ust headers are present
2645 if test "$trace_backend" = "ust"; then
2646 cat > $TMPC << EOF
2647 #include <ust/tracepoint.h>
2648 #include <ust/marker.h>
2649 int main(void) { return 0; }
2651 if compile_prog "" "" ; then
2652 LIBS="-lust $LIBS"
2653 else
2654 echo
2655 echo "Error: Trace backend 'ust' missing libust header files"
2656 echo
2657 exit 1
2661 ##########################################
2662 # For 'dtrace' backend, test if 'dtrace' command is present
2663 if test "$trace_backend" = "dtrace"; then
2664 if ! has 'dtrace' ; then
2665 echo
2666 echo "Error: dtrace command is not found in PATH $PATH"
2667 echo
2668 exit 1
2670 trace_backend_stap="no"
2671 if has 'stap' ; then
2672 trace_backend_stap="yes"
2676 ##########################################
2677 # End of CC checks
2678 # After here, no more $cc or $ld runs
2680 if test "$debug" = "no" ; then
2681 CFLAGS="-O2 $CFLAGS"
2684 # Consult white-list to determine whether to enable werror
2685 # by default. Only enable by default for git builds
2686 z_version=`cut -f3 -d. $source_path/VERSION`
2688 if test -z "$werror" ; then
2689 if test "$z_version" = "50" -a \
2690 "$linux" = "yes" ; then
2691 werror="yes"
2692 else
2693 werror="no"
2697 # Disable zero malloc errors for official releases unless explicitly told to
2698 # enable/disable
2699 if test -z "$zero_malloc" ; then
2700 if test "$z_version" = "50" ; then
2701 zero_malloc="no"
2702 else
2703 zero_malloc="yes"
2707 if test "$werror" = "yes" ; then
2708 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
2711 if test "$solaris" = "no" ; then
2712 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
2713 LDFLAGS="-Wl,--warn-common $LDFLAGS"
2717 # Use ASLR, no-SEH and DEP if available
2718 if test "$mingw32" = "yes" ; then
2719 for flag in --dynamicbase --no-seh --nxcompat; do
2720 if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
2721 LDFLAGS="-Wl,$flag $LDFLAGS"
2723 done
2726 confdir=$sysconfdir$confsuffix
2728 tools=
2729 if test "$softmmu" = yes ; then
2730 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
2731 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
2732 tools="qemu-nbd\$(EXESUF) $tools"
2733 if [ "$check_utests" = "yes" ]; then
2734 tools="check-qint check-qstring check-qdict check-qlist $tools"
2735 tools="check-qfloat check-qjson $tools"
2740 # Mac OS X ships with a broken assembler
2741 roms=
2742 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
2743 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
2744 "$softmmu" = yes ; then
2745 roms="optionrom"
2747 if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
2748 roms="$roms spapr-rtas"
2751 echo "Install prefix $prefix"
2752 echo "BIOS directory `eval echo $datadir`"
2753 echo "binary directory `eval echo $bindir`"
2754 echo "config directory `eval echo $sysconfdir`"
2755 if test "$mingw32" = "no" ; then
2756 echo "Manual directory `eval echo $mandir`"
2757 echo "ELF interp prefix $interp_prefix"
2759 echo "Source path $source_path"
2760 echo "C compiler $cc"
2761 echo "Host C compiler $host_cc"
2762 echo "CFLAGS $CFLAGS"
2763 echo "QEMU_CFLAGS $QEMU_CFLAGS"
2764 echo "LDFLAGS $LDFLAGS"
2765 echo "make $make"
2766 echo "install $install"
2767 echo "host CPU $cpu"
2768 echo "host big endian $bigendian"
2769 echo "target list $target_list"
2770 echo "tcg debug enabled $debug_tcg"
2771 echo "Mon debug enabled $debug_mon"
2772 echo "gprof enabled $gprof"
2773 echo "sparse enabled $sparse"
2774 echo "strip binaries $strip_opt"
2775 echo "profiler $profiler"
2776 echo "static build $static"
2777 echo "-Werror enabled $werror"
2778 if test "$darwin" = "yes" ; then
2779 echo "Cocoa support $cocoa"
2781 echo "SDL support $sdl"
2782 echo "curses support $curses"
2783 echo "curl support $curl"
2784 echo "check support $check_utests"
2785 echo "mingw32 support $mingw32"
2786 echo "Audio drivers $audio_drv_list"
2787 echo "Extra audio cards $audio_card_list"
2788 echo "Block whitelist $block_drv_whitelist"
2789 echo "Mixer emulation $mixemu"
2790 echo "VNC support $vnc"
2791 if test "$vnc" = "yes" ; then
2792 echo "VNC TLS support $vnc_tls"
2793 echo "VNC SASL support $vnc_sasl"
2794 echo "VNC JPEG support $vnc_jpeg"
2795 echo "VNC PNG support $vnc_png"
2796 echo "VNC thread $vnc_thread"
2798 if test -n "$sparc_cpu"; then
2799 echo "Target Sparc Arch $sparc_cpu"
2801 echo "xen support $xen"
2802 echo "CPU emulation $cpu_emulation"
2803 echo "brlapi support $brlapi"
2804 echo "bluez support $bluez"
2805 echo "Documentation $docs"
2806 [ ! -z "$uname_release" ] && \
2807 echo "uname -r $uname_release"
2808 echo "NPTL support $nptl"
2809 echo "GUEST_BASE $guest_base"
2810 echo "PIE user targets $user_pie"
2811 echo "vde support $vde"
2812 echo "IO thread $io_thread"
2813 echo "Linux AIO support $linux_aio"
2814 echo "ATTR/XATTR support $attr"
2815 echo "Install blobs $blobs"
2816 echo "KVM support $kvm"
2817 echo "KVM PIT support $kvm_cap_pit"
2818 echo "KVM device assig. $kvm_cap_device_assignment"
2819 echo "fdt support $fdt"
2820 echo "preadv support $preadv"
2821 echo "fdatasync $fdatasync"
2822 echo "madvise $madvise"
2823 echo "posix_madvise $posix_madvise"
2824 echo "uuid support $uuid"
2825 echo "vhost-net support $vhost_net"
2826 echo "Trace backend $trace_backend"
2827 echo "Trace output file $trace_file-<pid>"
2828 echo "spice support $spice"
2829 echo "rbd support $rbd"
2830 echo "xfsctl support $xfs"
2831 echo "nss used $smartcard_nss"
2832 echo "OpenGL support $opengl"
2834 if test $sdl_too_old = "yes"; then
2835 echo "-> Your SDL version is too old - please upgrade to have SDL support"
2838 config_host_mak="config-host.mak"
2839 config_host_ld="config-host.ld"
2841 echo "# Automatically generated by configure - do not modify" > $config_host_mak
2842 printf "# Configured with:" >> $config_host_mak
2843 printf " '%s'" "$0" "$@" >> $config_host_mak
2844 echo >> $config_host_mak
2846 echo all: >> $config_host_mak
2847 echo "prefix=$prefix" >> $config_host_mak
2848 echo "bindir=$bindir" >> $config_host_mak
2849 echo "mandir=$mandir" >> $config_host_mak
2850 echo "datadir=$datadir" >> $config_host_mak
2851 echo "sysconfdir=$sysconfdir" >> $config_host_mak
2852 echo "docdir=$docdir" >> $config_host_mak
2853 echo "confdir=$confdir" >> $config_host_mak
2855 case "$cpu" in
2856 i386|x86_64|alpha|cris|hppa|ia64|lm32|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64|unicore32)
2857 ARCH=$cpu
2859 armv4b|armv4l)
2860 ARCH=arm
2862 esac
2863 echo "ARCH=$ARCH" >> $config_host_mak
2864 if test "$debug_tcg" = "yes" ; then
2865 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
2867 if test "$debug_mon" = "yes" ; then
2868 echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak
2870 if test "$debug" = "yes" ; then
2871 echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
2873 if test "$strip_opt" = "yes" ; then
2874 echo "STRIP=${strip}" >> $config_host_mak
2876 if test "$bigendian" = "yes" ; then
2877 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
2879 echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
2880 if test "$mingw32" = "yes" ; then
2881 echo "CONFIG_WIN32=y" >> $config_host_mak
2882 rc_version=`cat $source_path/VERSION`
2883 version_major=${rc_version%%.*}
2884 rc_version=${rc_version#*.}
2885 version_minor=${rc_version%%.*}
2886 rc_version=${rc_version#*.}
2887 version_subminor=${rc_version%%.*}
2888 version_micro=0
2889 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
2890 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
2891 else
2892 echo "CONFIG_POSIX=y" >> $config_host_mak
2895 if test "$linux" = "yes" ; then
2896 echo "CONFIG_LINUX=y" >> $config_host_mak
2899 if test "$darwin" = "yes" ; then
2900 echo "CONFIG_DARWIN=y" >> $config_host_mak
2903 if test "$aix" = "yes" ; then
2904 echo "CONFIG_AIX=y" >> $config_host_mak
2907 if test "$solaris" = "yes" ; then
2908 echo "CONFIG_SOLARIS=y" >> $config_host_mak
2909 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
2910 if test "$needs_libsunmath" = "yes" ; then
2911 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
2914 if test "$haiku" = "yes" ; then
2915 echo "CONFIG_HAIKU=y" >> $config_host_mak
2917 if test "$static" = "yes" ; then
2918 echo "CONFIG_STATIC=y" >> $config_host_mak
2920 if test $profiler = "yes" ; then
2921 echo "CONFIG_PROFILER=y" >> $config_host_mak
2923 if test "$slirp" = "yes" ; then
2924 echo "CONFIG_SLIRP=y" >> $config_host_mak
2925 QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES"
2927 if test "$vde" = "yes" ; then
2928 echo "CONFIG_VDE=y" >> $config_host_mak
2930 for card in $audio_card_list; do
2931 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
2932 echo "$def=y" >> $config_host_mak
2933 done
2934 echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
2935 for drv in $audio_drv_list; do
2936 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
2937 echo "$def=y" >> $config_host_mak
2938 if test "$drv" = "fmod"; then
2939 echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
2941 done
2942 if test "$audio_pt_int" = "yes" ; then
2943 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
2945 if test "$audio_win_int" = "yes" ; then
2946 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
2948 echo "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
2949 if test "$mixemu" = "yes" ; then
2950 echo "CONFIG_MIXEMU=y" >> $config_host_mak
2952 if test "$vnc" = "yes" ; then
2953 echo "CONFIG_VNC=y" >> $config_host_mak
2955 if test "$vnc_tls" = "yes" ; then
2956 echo "CONFIG_VNC_TLS=y" >> $config_host_mak
2957 echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
2959 if test "$vnc_sasl" = "yes" ; then
2960 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
2961 echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
2963 if test "$vnc_jpeg" = "yes" ; then
2964 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
2965 echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak
2967 if test "$vnc_png" = "yes" ; then
2968 echo "CONFIG_VNC_PNG=y" >> $config_host_mak
2969 echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak
2971 if test "$vnc_thread" = "yes" ; then
2972 echo "CONFIG_VNC_THREAD=y" >> $config_host_mak
2974 if test "$fnmatch" = "yes" ; then
2975 echo "CONFIG_FNMATCH=y" >> $config_host_mak
2977 if test "$uuid" = "yes" ; then
2978 echo "CONFIG_UUID=y" >> $config_host_mak
2980 if test "$xfs" = "yes" ; then
2981 echo "CONFIG_XFS=y" >> $config_host_mak
2983 qemu_version=`head $source_path/VERSION`
2984 echo "VERSION=$qemu_version" >>$config_host_mak
2985 echo "PKGVERSION=$pkgversion" >>$config_host_mak
2986 echo "SRC_PATH=$source_path" >> $config_host_mak
2987 echo "TARGET_DIRS=$target_list" >> $config_host_mak
2988 if [ "$docs" = "yes" ] ; then
2989 echo "BUILD_DOCS=yes" >> $config_host_mak
2991 if test "$sdl" = "yes" ; then
2992 echo "CONFIG_SDL=y" >> $config_host_mak
2993 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
2995 if test "$cocoa" = "yes" ; then
2996 echo "CONFIG_COCOA=y" >> $config_host_mak
2998 if test "$curses" = "yes" ; then
2999 echo "CONFIG_CURSES=y" >> $config_host_mak
3001 if test "$atfile" = "yes" ; then
3002 echo "CONFIG_ATFILE=y" >> $config_host_mak
3004 if test "$utimens" = "yes" ; then
3005 echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
3007 if test "$pipe2" = "yes" ; then
3008 echo "CONFIG_PIPE2=y" >> $config_host_mak
3010 if test "$accept4" = "yes" ; then
3011 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
3013 if test "$splice" = "yes" ; then
3014 echo "CONFIG_SPLICE=y" >> $config_host_mak
3016 if test "$eventfd" = "yes" ; then
3017 echo "CONFIG_EVENTFD=y" >> $config_host_mak
3019 if test "$fallocate" = "yes" ; then
3020 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
3022 if test "$sync_file_range" = "yes" ; then
3023 echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
3025 if test "$fiemap" = "yes" ; then
3026 echo "CONFIG_FIEMAP=y" >> $config_host_mak
3028 if test "$dup3" = "yes" ; then
3029 echo "CONFIG_DUP3=y" >> $config_host_mak
3031 if test "$epoll" = "yes" ; then
3032 echo "CONFIG_EPOLL=y" >> $config_host_mak
3034 if test "$epoll_create1" = "yes" ; then
3035 echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
3037 if test "$epoll_pwait" = "yes" ; then
3038 echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
3040 if test "$inotify" = "yes" ; then
3041 echo "CONFIG_INOTIFY=y" >> $config_host_mak
3043 if test "$inotify1" = "yes" ; then
3044 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
3046 if test "$byteswap_h" = "yes" ; then
3047 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
3049 if test "$bswap_h" = "yes" ; then
3050 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
3052 if test "$curl" = "yes" ; then
3053 echo "CONFIG_CURL=y" >> $config_host_mak
3054 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
3056 if test "$brlapi" = "yes" ; then
3057 echo "CONFIG_BRLAPI=y" >> $config_host_mak
3059 if test "$bluez" = "yes" ; then
3060 echo "CONFIG_BLUEZ=y" >> $config_host_mak
3061 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
3063 if test "$xen" = "yes" ; then
3064 echo "CONFIG_XEN=y" >> $config_host_mak
3065 echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
3067 if test "$io_thread" = "yes" ; then
3068 echo "CONFIG_IOTHREAD=y" >> $config_host_mak
3070 if test "$linux_aio" = "yes" ; then
3071 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
3073 if test "$attr" = "yes" ; then
3074 echo "CONFIG_ATTR=y" >> $config_host_mak
3076 if test "$linux" = "yes" ; then
3077 if test "$attr" = "yes" ; then
3078 echo "CONFIG_VIRTFS=y" >> $config_host_mak
3081 if test "$blobs" = "yes" ; then
3082 echo "INSTALL_BLOBS=yes" >> $config_host_mak
3084 if test "$iovec" = "yes" ; then
3085 echo "CONFIG_IOVEC=y" >> $config_host_mak
3087 if test "$preadv" = "yes" ; then
3088 echo "CONFIG_PREADV=y" >> $config_host_mak
3090 if test "$fdt" = "yes" ; then
3091 echo "CONFIG_FDT=y" >> $config_host_mak
3093 if test "$signalfd" = "yes" ; then
3094 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
3096 if test "$need_offsetof" = "yes" ; then
3097 echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
3099 if test "$gcc_attribute_warn_unused_result" = "yes" ; then
3100 echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak
3102 if test "$fdatasync" = "yes" ; then
3103 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
3105 if test $cpu_emulation = "yes"; then
3106 echo "CONFIG_CPU_EMULATION=y" >> $config_host_mak
3107 else
3108 echo "CONFIG_NO_CPU_EMULATION=y" >> $config_host_mak
3110 if test "$madvise" = "yes" ; then
3111 echo "CONFIG_MADVISE=y" >> $config_host_mak
3113 if test "$posix_madvise" = "yes" ; then
3114 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
3117 if test "$spice" = "yes" ; then
3118 echo "CONFIG_SPICE=y" >> $config_host_mak
3121 if test "$smartcard" = "yes" ; then
3122 echo "CONFIG_SMARTCARD=y" >> $config_host_mak
3125 if test "$smartcard_nss" = "yes" ; then
3126 echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
3129 if test "$opengl" = "yes" ; then
3130 echo "CONFIG_OPENGL=y" >> $config_host_mak
3133 # XXX: suppress that
3134 if [ "$bsd" = "yes" ] ; then
3135 echo "CONFIG_BSD=y" >> $config_host_mak
3138 echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
3140 if test "$zero_malloc" = "yes" ; then
3141 echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
3143 if test "$rbd" = "yes" ; then
3144 echo "CONFIG_RBD=y" >> $config_host_mak
3147 # USB host support
3148 case "$usb" in
3149 linux)
3150 echo "HOST_USB=linux" >> $config_host_mak
3152 bsd)
3153 echo "HOST_USB=bsd" >> $config_host_mak
3156 echo "HOST_USB=stub" >> $config_host_mak
3158 esac
3160 echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
3161 if test "$trace_backend" = "simple"; then
3162 echo "CONFIG_SIMPLE_TRACE=y" >> $config_host_mak
3164 # Set the appropriate trace file.
3165 if test "$trace_backend" = "simple"; then
3166 trace_file="\"$trace_file-%u\""
3168 if test "$trace_backend" = "dtrace" -a "$trace_backend_stap" = "yes" ; then
3169 echo "CONFIG_SYSTEMTAP_TRACE=y" >> $config_host_mak
3171 echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
3173 echo "TOOLS=$tools" >> $config_host_mak
3174 echo "ROMS=$roms" >> $config_host_mak
3175 echo "MAKE=$make" >> $config_host_mak
3176 echo "INSTALL=$install" >> $config_host_mak
3177 echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak
3178 echo "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak
3179 echo "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak
3180 echo "CC=$cc" >> $config_host_mak
3181 echo "CC_I386=$cc_i386" >> $config_host_mak
3182 echo "HOST_CC=$host_cc" >> $config_host_mak
3183 echo "AR=$ar" >> $config_host_mak
3184 echo "OBJCOPY=$objcopy" >> $config_host_mak
3185 echo "LD=$ld" >> $config_host_mak
3186 echo "WINDRES=$windres" >> $config_host_mak
3187 echo "CFLAGS=$CFLAGS" >> $config_host_mak
3188 echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
3189 echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
3190 if test "$sparse" = "yes" ; then
3191 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
3192 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
3193 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
3195 echo "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
3196 echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
3197 echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
3198 echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
3199 echo "LIBS+=$LIBS" >> $config_host_mak
3200 echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
3201 echo "EXESUF=$EXESUF" >> $config_host_mak
3203 # generate list of library paths for linker script
3205 $ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
3207 if test -f ${config_host_ld}~ ; then
3208 if cmp -s $config_host_ld ${config_host_ld}~ ; then
3209 mv ${config_host_ld}~ $config_host_ld
3210 else
3211 rm ${config_host_ld}~
3215 for d in libdis libdis-user; do
3216 mkdir -p $d
3217 symlink $source_path/Makefile.dis $d/Makefile
3218 echo > $d/config.mak
3219 done
3220 if test "$static" = "no" -a "$user_pie" = "yes" ; then
3221 echo "QEMU_CFLAGS+=-fpie" > libdis-user/config.mak
3224 for target in $target_list; do
3225 target_dir="$target"
3226 config_target_mak=$target_dir/config-target.mak
3227 target_arch2=`echo $target | cut -d '-' -f 1`
3228 target_bigendian="no"
3230 case "$target_arch2" in
3231 armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus)
3232 target_bigendian=yes
3234 esac
3235 target_softmmu="no"
3236 target_user_only="no"
3237 target_linux_user="no"
3238 target_darwin_user="no"
3239 target_bsd_user="no"
3240 case "$target" in
3241 ${target_arch2}-softmmu)
3242 target_softmmu="yes"
3244 ${target_arch2}-linux-user)
3245 if test "$linux" != "yes" ; then
3246 echo "ERROR: Target '$target' is only available on a Linux host"
3247 exit 1
3249 target_user_only="yes"
3250 target_linux_user="yes"
3252 ${target_arch2}-darwin-user)
3253 if test "$darwin" != "yes" ; then
3254 echo "ERROR: Target '$target' is only available on a Darwin host"
3255 exit 1
3257 target_user_only="yes"
3258 target_darwin_user="yes"
3260 ${target_arch2}-bsd-user)
3261 if test "$bsd" != "yes" ; then
3262 echo "ERROR: Target '$target' is only available on a BSD host"
3263 exit 1
3265 target_user_only="yes"
3266 target_bsd_user="yes"
3269 echo "ERROR: Target '$target' not recognised"
3270 exit 1
3272 esac
3274 mkdir -p $target_dir
3275 mkdir -p $target_dir/fpu
3276 mkdir -p $target_dir/tcg
3277 mkdir -p $target_dir/ide
3278 mkdir -p $target_dir/9pfs
3279 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
3280 mkdir -p $target_dir/nwfpe
3282 symlink $source_path/Makefile.target $target_dir/Makefile
3285 echo "# Automatically generated by configure - do not modify" > $config_target_mak
3287 bflt="no"
3288 target_nptl="no"
3289 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
3290 echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
3291 gdb_xml_files=""
3292 target_short_alignment=2
3293 target_int_alignment=4
3294 target_long_alignment=4
3295 target_llong_alignment=8
3296 target_libs_softmmu=
3298 TARGET_ARCH="$target_arch2"
3299 TARGET_BASE_ARCH=""
3300 TARGET_ABI_DIR=""
3302 case "$target_arch2" in
3303 i386)
3304 target_phys_bits=64
3306 x86_64)
3307 TARGET_BASE_ARCH=i386
3308 target_phys_bits=64
3309 target_long_alignment=8
3311 ia64)
3312 target_phys_bits=64
3314 alpha)
3315 target_phys_bits=64
3316 target_long_alignment=8
3317 target_nptl="yes"
3319 arm|armeb)
3320 TARGET_ARCH=arm
3321 bflt="yes"
3322 target_nptl="yes"
3323 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
3324 target_phys_bits=32
3325 target_llong_alignment=4
3327 cris)
3328 target_nptl="yes"
3329 target_phys_bits=32
3331 lm32)
3332 target_phys_bits=32
3333 target_libs_softmmu="$opengl_libs"
3335 m68k)
3336 bflt="yes"
3337 gdb_xml_files="cf-core.xml cf-fp.xml"
3338 target_phys_bits=32
3339 target_int_alignment=2
3340 target_long_alignment=2
3341 target_llong_alignment=2
3343 microblaze|microblazeel)
3344 TARGET_ARCH=microblaze
3345 bflt="yes"
3346 target_nptl="yes"
3347 target_phys_bits=32
3348 target_libs_softmmu="$fdt_libs"
3350 mips|mipsel)
3351 TARGET_ARCH=mips
3352 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
3353 target_nptl="yes"
3354 target_phys_bits=64
3356 mipsn32|mipsn32el)
3357 TARGET_ARCH=mipsn32
3358 TARGET_BASE_ARCH=mips
3359 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
3360 target_phys_bits=64
3362 mips64|mips64el)
3363 TARGET_ARCH=mips64
3364 TARGET_BASE_ARCH=mips
3365 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
3366 target_phys_bits=64
3367 target_long_alignment=8
3369 ppc)
3370 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
3371 target_phys_bits=32
3372 target_nptl="yes"
3373 target_libs_softmmu="$fdt_libs"
3375 ppcemb)
3376 TARGET_BASE_ARCH=ppc
3377 TARGET_ABI_DIR=ppc
3378 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
3379 target_phys_bits=64
3380 target_nptl="yes"
3381 target_libs_softmmu="$fdt_libs"
3383 ppc64)
3384 TARGET_BASE_ARCH=ppc
3385 TARGET_ABI_DIR=ppc
3386 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
3387 target_phys_bits=64
3388 target_long_alignment=8
3389 target_libs_softmmu="$fdt_libs"
3391 ppc64abi32)
3392 TARGET_ARCH=ppc64
3393 TARGET_BASE_ARCH=ppc
3394 TARGET_ABI_DIR=ppc
3395 echo "TARGET_ABI32=y" >> $config_target_mak
3396 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
3397 target_phys_bits=64
3398 target_libs_softmmu="$fdt_libs"
3400 sh4|sh4eb)
3401 TARGET_ARCH=sh4
3402 bflt="yes"
3403 target_nptl="yes"
3404 target_phys_bits=32
3406 sparc)
3407 target_phys_bits=64
3409 sparc64)
3410 TARGET_BASE_ARCH=sparc
3411 target_phys_bits=64
3412 target_long_alignment=8
3414 sparc32plus)
3415 TARGET_ARCH=sparc64
3416 TARGET_BASE_ARCH=sparc
3417 TARGET_ABI_DIR=sparc
3418 echo "TARGET_ABI32=y" >> $config_target_mak
3419 target_phys_bits=64
3421 s390x)
3422 target_nptl="yes"
3423 target_phys_bits=64
3424 target_long_alignment=8
3426 unicore32)
3427 target_phys_bits=32
3430 echo "Unsupported target CPU"
3431 exit 1
3433 esac
3434 echo "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak
3435 echo "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak
3436 echo "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak
3437 echo "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak
3438 echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
3439 target_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
3440 echo "TARGET_$target_arch_name=y" >> $config_target_mak
3441 echo "TARGET_ARCH2=$target_arch2" >> $config_target_mak
3442 # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
3443 if [ "$TARGET_BASE_ARCH" = "" ]; then
3444 TARGET_BASE_ARCH=$TARGET_ARCH
3446 echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
3447 if [ "$TARGET_ABI_DIR" = "" ]; then
3448 TARGET_ABI_DIR=$TARGET_ARCH
3450 echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
3451 case "$target_arch2" in
3452 i386|x86_64)
3453 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
3454 target_phys_bits=64
3455 echo "CONFIG_XEN=y" >> $config_target_mak
3456 if test "$cpu" = "i386" -o "$cpu" = "x86_64"; then
3457 echo "CONFIG_XEN_MAPCACHE=y" >> $config_target_mak
3460 esac
3461 case "$target_arch2" in
3462 i386|x86_64|ppcemb|ppc|ppc64|s390x)
3463 # Make sure the target and host cpus are compatible
3464 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
3465 \( "$target_arch2" = "$cpu" -o \
3466 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
3467 \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \
3468 \( "$target_arch2" = "ppc" -a "$cpu" = "ppc64" \) -o \
3469 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
3470 \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \
3471 \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then
3472 echo "CONFIG_KVM=y" >> $config_target_mak
3473 echo "CONFIG_THREAD=y" >> $config_host_mak
3474 echo "KVM_CFLAGS=$kvm_cflags" >> $config_target_mak
3475 if test "$kvm_para" = "yes"; then
3476 echo "CONFIG_KVM_PARA=y" >> $config_target_mak
3478 if test $kvm_cap_pit = "yes" ; then
3479 echo "CONFIG_KVM_PIT=y" >> $config_target_mak
3481 if test $kvm_cap_device_assignment = "yes" ; then
3482 echo "CONFIG_KVM_DEVICE_ASSIGNMENT=y" >> $config_target_mak
3484 if test $vhost_net = "yes" ; then
3485 echo "CONFIG_VHOST_NET=y" >> $config_target_mak
3487 if test "$kvm_ppc_pvr" = "yes" ; then
3488 echo "CONFIG_KVM_PPC_PVR=y" >> $config_target_mak
3491 esac
3492 if test "$target_bigendian" = "yes" ; then
3493 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
3495 if test "$target_softmmu" = "yes" ; then
3496 echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
3497 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
3498 echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak
3499 echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
3500 echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
3502 if test "$target_user_only" = "yes" ; then
3503 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
3505 if test "$target_linux_user" = "yes" ; then
3506 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
3508 if test "$target_darwin_user" = "yes" ; then
3509 echo "CONFIG_DARWIN_USER=y" >> $config_target_mak
3511 if test "$smartcard_nss" = "yes" ; then
3512 echo "subdir-$target: subdir-libcacard" >> $config_host_mak
3513 echo "libcacard_libs=$libcacard_libs" >> $config_host_mak
3514 echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
3516 list=""
3517 if test ! -z "$gdb_xml_files" ; then
3518 for x in $gdb_xml_files; do
3519 list="$list $source_path/gdb-xml/$x"
3520 done
3521 echo "TARGET_XML_FILES=$list" >> $config_target_mak
3524 echo "CONFIG_SOFTFLOAT=y" >> $config_target_mak
3526 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
3527 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
3529 if test "$target_user_only" = "yes" \
3530 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
3531 echo "CONFIG_USE_NPTL=y" >> $config_target_mak
3533 if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
3534 echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
3536 if test "$target_bsd_user" = "yes" ; then
3537 echo "CONFIG_BSD_USER=y" >> $config_target_mak
3540 # generate QEMU_CFLAGS/LDFLAGS for targets
3542 cflags=""
3543 includes=""
3544 ldflags=""
3546 if test "$ARCH" = "sparc64" ; then
3547 includes="-I\$(SRC_PATH)/tcg/sparc $includes"
3548 elif test "$ARCH" = "s390x" ; then
3549 includes="-I\$(SRC_PATH)/tcg/s390 $includes"
3550 elif test "$ARCH" = "x86_64" ; then
3551 includes="-I\$(SRC_PATH)/tcg/i386 $includes"
3552 else
3553 includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes"
3555 includes="-I\$(SRC_PATH)/tcg $includes"
3556 includes="-I\$(SRC_PATH)/fpu $includes"
3558 if test "$target_user_only" = "yes" ; then
3559 libdis_config_mak=libdis-user/config.mak
3560 else
3561 libdis_config_mak=libdis/config.mak
3564 for i in $ARCH $TARGET_BASE_ARCH ; do
3565 case "$i" in
3566 alpha)
3567 echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
3568 echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak
3570 arm)
3571 echo "CONFIG_ARM_DIS=y" >> $config_target_mak
3572 echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak
3574 cris)
3575 echo "CONFIG_CRIS_DIS=y" >> $config_target_mak
3576 echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak
3578 hppa)
3579 echo "CONFIG_HPPA_DIS=y" >> $config_target_mak
3580 echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak
3582 i386|x86_64)
3583 echo "CONFIG_I386_DIS=y" >> $config_target_mak
3584 echo "CONFIG_I386_DIS=y" >> $libdis_config_mak
3586 ia64*)
3587 echo "CONFIG_IA64_DIS=y" >> $config_target_mak
3588 echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak
3590 m68k)
3591 echo "CONFIG_M68K_DIS=y" >> $config_target_mak
3592 echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak
3594 microblaze*)
3595 echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak
3596 echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak
3598 mips*)
3599 echo "CONFIG_MIPS_DIS=y" >> $config_target_mak
3600 echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak
3602 ppc*)
3603 echo "CONFIG_PPC_DIS=y" >> $config_target_mak
3604 echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak
3606 s390*)
3607 echo "CONFIG_S390_DIS=y" >> $config_target_mak
3608 echo "CONFIG_S390_DIS=y" >> $libdis_config_mak
3610 sh4)
3611 echo "CONFIG_SH4_DIS=y" >> $config_target_mak
3612 echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak
3614 sparc*)
3615 echo "CONFIG_SPARC_DIS=y" >> $config_target_mak
3616 echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak
3618 esac
3619 done
3621 case "$ARCH" in
3622 alpha)
3623 # Ensure there's only a single GP
3624 cflags="-msmall-data $cflags"
3626 esac
3628 if test "$target_softmmu" = "yes" ; then
3629 case "$TARGET_BASE_ARCH" in
3630 arm)
3631 cflags="-DHAS_AUDIO $cflags"
3633 lm32)
3634 cflags="-DHAS_AUDIO $cflags"
3636 i386|mips|ppc)
3637 cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
3639 esac
3642 if test "$target_user_only" = "yes" -a "$static" = "no" -a \
3643 "$user_pie" = "yes" ; then
3644 cflags="-fpie $cflags"
3645 ldflags="-pie $ldflags"
3648 if test "$target_softmmu" = "yes" -a \( \
3649 "$TARGET_ARCH" = "microblaze" -o \
3650 "$TARGET_ARCH" = "cris" \) ; then
3651 echo "CONFIG_NEED_MMU=y" >> $config_target_mak
3654 if test "$gprof" = "yes" ; then
3655 echo "TARGET_GPROF=yes" >> $config_target_mak
3656 if test "$target_linux_user" = "yes" ; then
3657 cflags="-p $cflags"
3658 ldflags="-p $ldflags"
3660 if test "$target_softmmu" = "yes" ; then
3661 ldflags="-p $ldflags"
3662 echo "GPROF_CFLAGS=-p" >> $config_target_mak
3666 linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
3667 if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
3668 case "$ARCH" in
3669 sparc)
3670 # -static is used to avoid g1/g3 usage by the dynamic linker
3671 ldflags="$linker_script -static $ldflags"
3673 alpha | s390x)
3674 # The default placement of the application is fine.
3677 ldflags="$linker_script $ldflags"
3679 esac
3682 echo "LDFLAGS+=$ldflags" >> $config_target_mak
3683 echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
3684 echo "QEMU_INCLUDES+=$includes" >> $config_target_mak
3686 done # for target in $targets
3688 # build tree in object directory in case the source is not in the current directory
3689 DIRS="tests tests/cris slirp audio block net pc-bios/optionrom"
3690 DIRS="$DIRS pc-bios/spapr-rtas"
3691 DIRS="$DIRS roms/seabios roms/vgabios"
3692 DIRS="$DIRS fsdev ui"
3693 FILES="Makefile tests/Makefile"
3694 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
3695 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
3696 FILES="$FILES pc-bios/spapr-rtas/Makefile"
3697 FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
3698 for bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.rom $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do
3699 FILES="$FILES pc-bios/`basename $bios_file`"
3700 done
3701 mkdir -p $DIRS
3702 for f in $FILES ; do
3703 test -e $f || symlink $source_path/$f $f
3704 done
3706 # temporary config to build submodules
3707 for rom in seabios vgabios; do
3708 config_mak=roms/$rom/config.mak
3709 echo "# Automatically generated by configure - do not modify" > $config_mak
3710 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
3711 echo "CC=$cc" >> $config_mak
3712 echo "BCC=bcc" >> $config_mak
3713 echo "CPP=${cross_prefix}cpp" >> $config_mak
3714 echo "OBJCOPY=objcopy" >> $config_mak
3715 echo "IASL=iasl" >> $config_mak
3716 echo "LD=$ld" >> $config_mak
3717 done
3719 for hwlib in 32 64; do
3720 d=libhw$hwlib
3721 mkdir -p $d
3722 mkdir -p $d/ide
3723 symlink $source_path/Makefile.hw $d/Makefile
3724 mkdir -p $d/9pfs
3725 echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
3726 done
3728 if [ "$source_path" != `pwd` ]; then
3729 # out of tree build
3730 mkdir -p libcacard
3731 rm -f libcacard/Makefile
3732 ln -s "$source_path/libcacard/Makefile" libcacard/Makefile
3735 d=libuser
3736 mkdir -p $d
3737 symlink $source_path/Makefile.user $d/Makefile
3738 if test "$static" = "no" -a "$user_pie" = "yes" ; then
3739 echo "QEMU_CFLAGS+=-fpie" > $d/config.mak
3742 if test "$docs" = "yes" ; then
3743 mkdir -p QMP