qemu-kvm: Use upstream VCPU reset services
[qemu-kvm.git] / configure
blob75071adef73391f9c54d2caba3b12032c064d3a0
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 linux_aio=""
141 attr=""
142 vhost_net=""
143 xfs=""
145 gprof="no"
146 debug_tcg="no"
147 debug_mon="no"
148 debug="no"
149 strip_opt="yes"
150 bigendian="no"
151 mingw32="no"
152 EXESUF=""
153 prefix="/usr/local"
154 mandir="\${prefix}/share/man"
155 datadir="\${prefix}/share/qemu"
156 docdir="\${prefix}/share/doc/qemu"
157 bindir="\${prefix}/bin"
158 sysconfdir="\${prefix}/etc"
159 confsuffix="/qemu"
160 slirp="yes"
161 fmod_lib=""
162 fmod_inc=""
163 oss_lib=""
164 bsd="no"
165 linux="no"
166 solaris="no"
167 profiler="no"
168 cocoa="no"
169 softmmu="yes"
170 linux_user="no"
171 darwin_user="no"
172 bsd_user="no"
173 guest_base=""
174 uname_release=""
175 io_thread="no"
176 mixemu="no"
177 kvm_cap_pit=""
178 kvm_cap_device_assignment=""
179 kerneldir=""
180 aix="no"
181 blobs="yes"
182 pkgversion=" ($(kvm_version))"
183 cpu_emulation="yes"
184 check_utests="no"
185 user_pie="no"
186 zero_malloc=""
187 trace_backend="nop"
188 trace_file="trace"
189 spice=""
190 rbd=""
191 smartcard=""
192 smartcard_nss=""
193 opengl=""
195 # parse CC options first
196 for opt do
197 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
198 case "$opt" in
199 --cross-prefix=*) cross_prefix="$optarg"
201 --cc=*) CC="$optarg"
203 --source-path=*) source_path="$optarg"
205 --cpu=*) cpu="$optarg"
207 --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
209 --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
211 --sparc_cpu=*)
212 sparc_cpu="$optarg"
213 case $sparc_cpu in
214 v7|v8|v8plus|v8plusa)
215 cpu="sparc"
218 cpu="sparc64"
221 echo "undefined SPARC architecture. Exiting";
222 exit 1
224 esac
226 esac
227 done
228 # OS specific
229 # Using uname is really, really broken. Once we have the right set of checks
230 # we can eliminate it's usage altogether
232 cc="${cross_prefix}${CC-gcc}"
233 ar="${cross_prefix}${AR-ar}"
234 objcopy="${cross_prefix}${OBJCOPY-objcopy}"
235 ld="${cross_prefix}${LD-ld}"
236 strip="${cross_prefix}${STRIP-strip}"
237 windres="${cross_prefix}${WINDRES-windres}"
238 pkg_config="${cross_prefix}${PKG_CONFIG-pkg-config}"
239 sdl_config="${cross_prefix}${SDL_CONFIG-sdl-config}"
241 # default flags for all hosts
242 QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
243 CFLAGS="-g $CFLAGS"
244 QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
245 QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
246 QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
247 QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
248 QEMU_INCLUDES="-I. -I\$(SRC_PATH)"
249 LDFLAGS="-g $LDFLAGS"
251 # make source path absolute
252 source_path=`cd "$source_path"; pwd`
254 check_define() {
255 cat > $TMPC <<EOF
256 #if !defined($1)
257 #error Not defined
258 #endif
259 int main(void) { return 0; }
261 compile_object
264 if test ! -z "$cpu" ; then
265 # command line argument
267 elif check_define __i386__ ; then
268 cpu="i386"
269 elif check_define __x86_64__ ; then
270 cpu="x86_64"
271 elif check_define __sparc__ ; then
272 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
273 # They must be specified using --sparc_cpu
274 if check_define __arch64__ ; then
275 cpu="sparc64"
276 else
277 cpu="sparc"
279 elif check_define _ARCH_PPC ; then
280 if check_define _ARCH_PPC64 ; then
281 cpu="ppc64"
282 else
283 cpu="ppc"
285 elif check_define __mips__ ; then
286 cpu="mips"
287 elif check_define __ia64__ ; then
288 cpu="ia64"
289 elif check_define __s390__ ; then
290 if check_define __s390x__ ; then
291 cpu="s390x"
292 else
293 cpu="s390"
295 else
296 cpu=`uname -m`
299 case "$cpu" in
300 alpha|cris|ia64|lm32|m68k|microblaze|ppc|ppc64|sparc64|unicore32)
301 cpu="$cpu"
303 i386|i486|i586|i686|i86pc|BePC)
304 cpu="i386"
306 x86_64|amd64)
307 cpu="x86_64"
309 armv*b)
310 cpu="armv4b"
312 armv*l)
313 cpu="armv4l"
315 parisc|parisc64)
316 cpu="hppa"
318 mips*)
319 cpu="mips"
321 s390)
322 cpu="s390"
324 s390x)
325 cpu="s390x"
327 sparc|sun4[cdmuv])
328 cpu="sparc"
331 echo "Unsupported CPU = $cpu"
332 exit 1
334 esac
336 # OS specific
337 if check_define __linux__ ; then
338 targetos="Linux"
339 elif check_define _WIN32 ; then
340 targetos='MINGW32'
341 elif check_define __OpenBSD__ ; then
342 targetos='OpenBSD'
343 elif check_define __sun__ ; then
344 targetos='SunOS'
345 elif check_define __HAIKU__ ; then
346 targetos='Haiku'
347 else
348 targetos=`uname -s`
351 case $targetos in
352 CYGWIN*)
353 mingw32="yes"
354 QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
355 audio_possible_drivers="winwave sdl"
356 audio_drv_list="winwave"
358 MINGW32*)
359 mingw32="yes"
360 audio_possible_drivers="winwave dsound sdl fmod"
361 audio_drv_list="winwave"
363 GNU/kFreeBSD)
364 bsd="yes"
365 audio_drv_list="oss"
366 audio_possible_drivers="oss sdl esd pa"
368 FreeBSD)
369 bsd="yes"
370 make="${MAKE-gmake}"
371 audio_drv_list="oss"
372 audio_possible_drivers="oss sdl esd pa"
373 # needed for kinfo_getvmmap(3) in libutil.h
374 LIBS="-lutil $LIBS"
376 DragonFly)
377 bsd="yes"
378 make="${MAKE-gmake}"
379 audio_drv_list="oss"
380 audio_possible_drivers="oss sdl esd pa"
382 NetBSD)
383 bsd="yes"
384 make="${MAKE-gmake}"
385 audio_drv_list="oss"
386 audio_possible_drivers="oss sdl esd"
387 oss_lib="-lossaudio"
389 OpenBSD)
390 bsd="yes"
391 make="${MAKE-gmake}"
392 audio_drv_list="oss"
393 audio_possible_drivers="oss sdl esd"
394 oss_lib="-lossaudio"
396 Darwin)
397 bsd="yes"
398 darwin="yes"
399 # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can
400 # run 64-bit userspace code
401 if [ "$cpu" = "i386" ] ; then
402 is_x86_64=`sysctl -n hw.optional.x86_64`
403 [ "$is_x86_64" = "1" ] && cpu=x86_64
405 if [ "$cpu" = "x86_64" ] ; then
406 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
407 LDFLAGS="-arch x86_64 $LDFLAGS"
408 else
409 QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
411 darwin_user="yes"
412 cocoa="yes"
413 audio_drv_list="coreaudio"
414 audio_possible_drivers="coreaudio sdl fmod"
415 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
416 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
418 SunOS)
419 solaris="yes"
420 make="${MAKE-gmake}"
421 install="${INSTALL-ginstall}"
422 ld="gld"
423 needs_libsunmath="no"
424 solarisrev=`uname -r | cut -f2 -d.`
425 # have to select again, because `uname -m` returns i86pc
426 # even on an x86_64 box.
427 solariscpu=`isainfo -k`
428 if test "${solariscpu}" = "amd64" ; then
429 cpu="x86_64"
431 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
432 if test "$solarisrev" -le 9 ; then
433 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
434 needs_libsunmath="yes"
435 QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
436 LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
437 LIBS="-lsunmath $LIBS"
438 else
439 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
440 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
441 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
442 echo "Studio 11 can be downloaded from www.sun.com."
443 exit 1
447 if test -f /usr/include/sys/soundcard.h ; then
448 audio_drv_list="oss"
450 audio_possible_drivers="oss sdl"
451 # needed for CMSG_ macros in sys/socket.h
452 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
453 # needed for TIOCWIN* defines in termios.h
454 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
455 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
456 LIBS="-lsocket -lnsl -lresolv $LIBS"
458 AIX)
459 aix="yes"
460 make="${MAKE-gmake}"
462 Haiku)
463 haiku="yes"
464 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
465 LIBS="-lposix_error_mapper -lnetwork $LIBS"
468 audio_drv_list="oss"
469 audio_possible_drivers="oss alsa sdl esd pa"
470 linux="yes"
471 linux_user="yes"
472 usb="linux"
473 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
474 audio_possible_drivers="$audio_possible_drivers fmod"
476 if [ "$cpu" = "ia64" ] ; then
477 xen="no"
478 target_list="ia64-softmmu"
479 cpu_emulation="no"
480 gdbstub="no"
481 slirp="no"
484 esac
486 if [ "$bsd" = "yes" ] ; then
487 if [ "$darwin" != "yes" ] ; then
488 usb="bsd"
490 bsd_user="yes"
493 : ${make=${MAKE-make}}
494 : ${install=${INSTALL-install}}
496 if test "$mingw32" = "yes" ; then
497 EXESUF=".exe"
498 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
499 # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
500 QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
501 LIBS="-lwinmm -lws2_32 -liberty -liphlpapi $LIBS"
502 prefix="c:/Program Files/Qemu"
503 mandir="\${prefix}"
504 datadir="\${prefix}"
505 docdir="\${prefix}"
506 bindir="\${prefix}"
507 sysconfdir="\${prefix}"
508 confsuffix=""
511 werror=""
513 for opt do
514 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
515 case "$opt" in
516 --help|-h) show_help=yes
518 --version|-V) exec cat $source_path/VERSION
520 --prefix=*) prefix="$optarg"
522 --interp-prefix=*) interp_prefix="$optarg"
524 --source-path=*)
526 --cross-prefix=*)
528 --cc=*)
530 --host-cc=*) host_cc="$optarg"
532 --make=*) make="$optarg"
534 --install=*) install="$optarg"
536 --extra-cflags=*)
538 --extra-ldflags=*)
540 --cpu=*)
542 --target-list=*) target_list="$optarg"
544 --enable-trace-backend=*) trace_backend="$optarg"
546 --with-trace-file=*) trace_file="$optarg"
548 --enable-gprof) gprof="yes"
550 --static)
551 static="yes"
552 LDFLAGS="-static $LDFLAGS"
554 --mandir=*) mandir="$optarg"
556 --bindir=*) bindir="$optarg"
558 --datadir=*) datadir="$optarg"
560 --docdir=*) docdir="$optarg"
562 --sysconfdir=*) sysconfdir="$optarg"
564 --disable-sdl) sdl="no"
566 --enable-sdl) sdl="yes"
568 --disable-vnc) vnc="no"
570 --enable-vnc) vnc="yes"
572 --fmod-lib=*) fmod_lib="$optarg"
574 --fmod-inc=*) fmod_inc="$optarg"
576 --oss-lib=*) oss_lib="$optarg"
578 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
580 --audio-drv-list=*) audio_drv_list="$optarg"
582 --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
584 --enable-debug-tcg) debug_tcg="yes"
586 --disable-debug-tcg) debug_tcg="no"
588 --enable-debug-mon) debug_mon="yes"
590 --disable-debug-mon) debug_mon="no"
592 --enable-debug)
593 # Enable debugging options that aren't excessively noisy
594 debug_tcg="yes"
595 debug_mon="yes"
596 debug="yes"
597 strip_opt="no"
599 --enable-sparse) sparse="yes"
601 --disable-sparse) sparse="no"
603 --disable-strip) strip_opt="no"
605 --disable-vnc-tls) vnc_tls="no"
607 --enable-vnc-tls) vnc_tls="yes"
609 --disable-vnc-sasl) vnc_sasl="no"
611 --enable-vnc-sasl) vnc_sasl="yes"
613 --disable-vnc-jpeg) vnc_jpeg="no"
615 --enable-vnc-jpeg) vnc_jpeg="yes"
617 --disable-vnc-png) vnc_png="no"
619 --enable-vnc-png) vnc_png="yes"
621 --disable-vnc-thread) vnc_thread="no"
623 --enable-vnc-thread) vnc_thread="yes"
625 --disable-slirp) slirp="no"
627 --disable-uuid) uuid="no"
629 --enable-uuid) uuid="yes"
631 --disable-vde) vde="no"
633 --enable-vde) vde="yes"
635 --disable-xen) xen="no"
637 --enable-xen) xen="yes"
639 --disable-brlapi) brlapi="no"
641 --enable-brlapi) brlapi="yes"
643 --disable-bluez) bluez="no"
645 --enable-bluez) bluez="yes"
647 --disable-kvm) kvm="no"
649 --enable-kvm) kvm="yes"
651 --disable-kvm-pit) kvm_cap_pit="no"
653 --enable-kvm-pit) kvm_cap_pit="yes"
655 --disable-kvm-device-assignment) kvm_cap_device_assignment="no"
657 --enable-kvm-device-assignment) kvm_cap_device_assignment="yes"
659 --disable-spice) spice="no"
661 --enable-spice) spice="yes"
663 --enable-profiler) profiler="yes"
665 --enable-cocoa)
666 cocoa="yes" ;
667 sdl="no" ;
668 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
670 --disable-system) softmmu="no"
672 --enable-system) softmmu="yes"
674 --disable-user)
675 linux_user="no" ;
676 bsd_user="no" ;
677 darwin_user="no"
679 --enable-user) ;;
680 --disable-linux-user) linux_user="no"
682 --enable-linux-user) linux_user="yes"
684 --disable-darwin-user) darwin_user="no"
686 --enable-darwin-user) darwin_user="yes"
688 --disable-bsd-user) bsd_user="no"
690 --enable-bsd-user) bsd_user="yes"
692 --enable-guest-base) guest_base="yes"
694 --disable-guest-base) guest_base="no"
696 --enable-user-pie) user_pie="yes"
698 --disable-user-pie) user_pie="no"
700 --enable-uname-release=*) uname_release="$optarg"
702 --sparc_cpu=*)
704 --enable-werror) werror="yes"
706 --disable-werror) werror="no"
708 --disable-curses) curses="no"
710 --enable-curses) curses="yes"
712 --disable-curl) curl="no"
714 --enable-curl) curl="yes"
716 --disable-fdt) fdt="no"
718 --enable-fdt) fdt="yes"
720 --disable-check-utests) check_utests="no"
722 --enable-check-utests) check_utests="yes"
724 --disable-nptl) nptl="no"
726 --enable-nptl) nptl="yes"
728 --enable-mixemu) mixemu="yes"
730 --disable-linux-aio) linux_aio="no"
732 --enable-linux-aio) linux_aio="yes"
734 --disable-attr) attr="no"
736 --enable-attr) attr="yes"
738 --enable-io-thread) io_thread="yes"
740 --disable-blobs) blobs="no"
742 --kerneldir=*) kerneldir="$optarg"
744 --with-pkgversion=*) pkgversion=" ($optarg)"
746 --disable-docs) docs="no"
748 --enable-docs) docs="yes"
750 --disable-cpu-emulation) cpu_emulation="no"
752 --disable-vhost-net) vhost_net="no"
754 --enable-vhost-net) vhost_net="yes"
756 --disable-opengl) opengl="no"
758 --enable-opengl) opengl="yes"
760 --*dir)
762 --disable-rbd) rbd="no"
764 --enable-rbd) rbd="yes"
766 --disable-smartcard) smartcard="no"
768 --enable-smartcard) smartcard="yes"
770 --disable-smartcard-nss) smartcard_nss="no"
772 --enable-smartcard-nss) smartcard_nss="yes"
774 *) echo "ERROR: unknown option $opt"; show_help="yes"
776 esac
777 done
780 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
781 # QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
783 host_guest_base="no"
784 case "$cpu" in
785 sparc) case $sparc_cpu in
786 v7|v8)
787 QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
789 v8plus|v8plusa)
790 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
792 *) # sparc_cpu not defined in the command line
793 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
794 esac
795 LDFLAGS="-m32 $LDFLAGS"
796 QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
797 if test "$solaris" = "no" ; then
798 QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
799 helper_cflags="-ffixed-i0"
802 sparc64)
803 QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
804 LDFLAGS="-m64 $LDFLAGS"
805 QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
806 if test "$solaris" != "no" ; then
807 QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
810 s390)
811 QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS"
812 LDFLAGS="-m31 $LDFLAGS"
813 host_guest_base="yes"
815 s390x)
816 QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS"
817 LDFLAGS="-m64 $LDFLAGS"
818 host_guest_base="yes"
820 i386)
821 QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
822 LDFLAGS="-m32 $LDFLAGS"
823 cc_i386='$(CC) -m32'
824 helper_cflags="-fomit-frame-pointer"
825 host_guest_base="yes"
827 x86_64)
828 QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
829 LDFLAGS="-m64 $LDFLAGS"
830 cc_i386='$(CC) -m32'
831 host_guest_base="yes"
833 arm*)
834 host_guest_base="yes"
836 ppc*)
837 host_guest_base="yes"
839 mips*)
840 host_guest_base="yes"
842 ia64*)
843 host_guest_base="yes"
845 hppa*)
846 host_guest_base="yes"
848 unicore32*)
849 host_guest_base="yes"
851 esac
853 [ -z "$guest_base" ] && guest_base="$host_guest_base"
855 if test x"$show_help" = x"yes" ; then
856 cat << EOF
858 Usage: configure [options]
859 Options: [defaults in brackets after descriptions]
862 echo "Standard options:"
863 echo " --help print this message"
864 echo " --prefix=PREFIX install in PREFIX [$prefix]"
865 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
866 echo " use %M for cpu name [$interp_prefix]"
867 echo " --target-list=LIST set target list [$target_list]"
868 echo ""
869 echo "Advanced options (experts only):"
870 echo " --source-path=PATH path of source code [$source_path]"
871 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
872 echo " --cc=CC use C compiler CC [$cc]"
873 echo " --host-cc=CC use C compiler CC [$host_cc] for code run at"
874 echo " build time"
875 echo " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS"
876 echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS"
877 echo " --make=MAKE use specified make [$make]"
878 echo " --install=INSTALL use specified install [$install]"
879 echo " --static enable static build [$static]"
880 echo " --mandir=PATH install man pages in PATH"
881 echo " --datadir=PATH install firmware in PATH"
882 echo " --docdir=PATH install documentation in PATH"
883 echo " --bindir=PATH install binaries in PATH"
884 echo " --sysconfdir=PATH install config in PATH/qemu"
885 echo " --enable-debug-tcg enable TCG debugging"
886 echo " --disable-debug-tcg disable TCG debugging (default)"
887 echo " --enable-debug enable common debug build options"
888 echo " --enable-sparse enable sparse checker"
889 echo " --disable-sparse disable sparse checker (default)"
890 echo " --disable-strip disable stripping binaries"
891 echo " --disable-werror disable compilation abort on warning"
892 echo " --disable-sdl disable SDL"
893 echo " --enable-sdl enable SDL"
894 echo " --disable-vnc disable VNC"
895 echo " --enable-vnc enable VNC"
896 echo " --enable-cocoa enable COCOA (Mac OS X only)"
897 echo " --audio-drv-list=LIST set audio drivers list:"
898 echo " Available drivers: $audio_possible_drivers"
899 echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
900 echo " Available cards: $audio_possible_cards"
901 echo " --block-drv-whitelist=L set block driver whitelist"
902 echo " (affects only QEMU, not qemu-img)"
903 echo " --enable-mixemu enable mixer emulation"
904 echo " --disable-xen disable xen backend driver support"
905 echo " --enable-xen enable xen backend driver support"
906 echo " --disable-brlapi disable BrlAPI"
907 echo " --enable-brlapi enable BrlAPI"
908 echo " --disable-vnc-tls disable TLS encryption for VNC server"
909 echo " --enable-vnc-tls enable TLS encryption for VNC server"
910 echo " --disable-vnc-sasl disable SASL encryption for VNC server"
911 echo " --enable-vnc-sasl enable SASL encryption for VNC server"
912 echo " --disable-vnc-jpeg disable JPEG lossy compression for VNC server"
913 echo " --enable-vnc-jpeg enable JPEG lossy compression for VNC server"
914 echo " --disable-vnc-png disable PNG compression for VNC server (default)"
915 echo " --enable-vnc-png enable PNG compression for VNC server"
916 echo " --disable-vnc-thread disable threaded VNC server"
917 echo " --enable-vnc-thread enable threaded VNC server"
918 echo " --disable-curses disable curses output"
919 echo " --enable-curses enable curses output"
920 echo " --disable-curl disable curl connectivity"
921 echo " --enable-curl enable curl connectivity"
922 echo " --disable-fdt disable fdt device tree"
923 echo " --enable-fdt enable fdt device tree"
924 echo " --disable-check-utests disable check unit-tests"
925 echo " --enable-check-utests enable check unit-tests"
926 echo " --disable-bluez disable bluez stack connectivity"
927 echo " --enable-bluez enable bluez stack connectivity"
928 echo " --disable-kvm disable KVM acceleration support"
929 echo " --enable-kvm enable KVM acceleration support"
930 echo " --disable-kvm-pit disable KVM pit support"
931 echo " --enable-kvm-pit enable KVM pit support"
932 echo " --disable-kvm-device-assignment disable KVM device assignment support"
933 echo " --enable-kvm-device-assignment enable KVM device assignment support"
934 echo " --disable-nptl disable usermode NPTL support"
935 echo " --enable-nptl enable usermode NPTL support"
936 echo " --enable-system enable all system emulation targets"
937 echo " --disable-system disable all system emulation targets"
938 echo " --enable-user enable supported user emulation targets"
939 echo " --disable-user disable all user emulation targets"
940 echo " --enable-linux-user enable all linux usermode emulation targets"
941 echo " --disable-linux-user disable all linux usermode emulation targets"
942 echo " --enable-darwin-user enable all darwin usermode emulation targets"
943 echo " --disable-darwin-user disable all darwin usermode emulation targets"
944 echo " --enable-bsd-user enable all BSD usermode emulation targets"
945 echo " --disable-bsd-user disable all BSD usermode emulation targets"
946 echo " --enable-guest-base enable GUEST_BASE support for usermode"
947 echo " emulation targets"
948 echo " --disable-guest-base disable GUEST_BASE support"
949 echo " --enable-user-pie build usermode emulation targets as PIE"
950 echo " --disable-user-pie do not build usermode emulation targets as PIE"
951 echo " --fmod-lib path to FMOD library"
952 echo " --fmod-inc path to FMOD includes"
953 echo " --oss-lib path to OSS library"
954 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
955 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
956 echo " --disable-uuid disable uuid support"
957 echo " --enable-uuid enable uuid support"
958 echo " --disable-vde disable support for vde network"
959 echo " --enable-vde enable support for vde network"
960 echo " --disable-linux-aio disable Linux AIO support"
961 echo " --enable-linux-aio enable Linux AIO support"
962 echo " --disable-attr disables attr and xattr support"
963 echo " --enable-attr enable attr and xattr support"
964 echo " --enable-io-thread enable IO thread"
965 echo " --disable-blobs disable installing provided firmware blobs"
966 echo " --kerneldir=PATH look for kernel includes in PATH"
967 echo " --disable-cpu-emulation disables use of qemu cpu emulation code"
968 echo " --enable-docs enable documentation build"
969 echo " --disable-docs disable documentation build"
970 echo " --disable-vhost-net disable vhost-net acceleration support"
971 echo " --enable-vhost-net enable vhost-net acceleration support"
972 echo " --enable-trace-backend=B Set trace backend"
973 echo " Available backends:" $("$source_path"/scripts/tracetool --list-backends)
974 echo " --with-trace-file=NAME Full PATH,NAME of file to store traces"
975 echo " Default:trace-<pid>"
976 echo " --disable-spice disable spice"
977 echo " --enable-spice enable spice"
978 echo " --enable-rbd enable building the rados block device (rbd)"
979 echo " --disable-smartcard disable smartcard support"
980 echo " --enable-smartcard enable smartcard support"
981 echo " --disable-smartcard-nss disable smartcard nss support"
982 echo " --enable-smartcard-nss enable smartcard nss support"
983 echo ""
984 echo "NOTE: The object files are built at the place where configure is launched"
985 exit 1
988 # check that the C compiler works.
989 cat > $TMPC <<EOF
990 int main(void) {}
993 if compile_object ; then
994 : C compiler works ok
995 else
996 echo "ERROR: \"$cc\" either does not exist or does not work"
997 exit 1
1000 gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
1001 gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
1002 gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
1003 gcc_flags="-fstack-protector-all $gcc_flags"
1004 cat > $TMPC << EOF
1005 int main(void) { return 0; }
1007 for flag in $gcc_flags; do
1008 if compile_prog "-Werror $QEMU_CFLAGS" "-Werror $flag" ; then
1009 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1011 done
1014 # Solaris specific configure tool chain decisions
1016 if test "$solaris" = "yes" ; then
1017 if has $install; then
1019 else
1020 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
1021 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
1022 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
1023 exit 1
1025 if test "`path_of $install`" = "/usr/sbin/install" ; then
1026 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
1027 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
1028 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
1029 exit 1
1031 if has ar; then
1033 else
1034 echo "Error: No path includes ar"
1035 if test -f /usr/ccs/bin/ar ; then
1036 echo "Add /usr/ccs/bin to your path and rerun configure"
1038 exit 1
1043 if test -z "$target_list" ; then
1044 # these targets are portable
1045 if [ "$softmmu" = "yes" ] ; then
1046 target_list="\
1047 i386-softmmu \
1048 x86_64-softmmu \
1049 arm-softmmu \
1050 cris-softmmu \
1051 lm32-softmmu \
1052 m68k-softmmu \
1053 microblaze-softmmu \
1054 microblazeel-softmmu \
1055 mips-softmmu \
1056 mipsel-softmmu \
1057 mips64-softmmu \
1058 mips64el-softmmu \
1059 ppc-softmmu \
1060 ppcemb-softmmu \
1061 ppc64-softmmu \
1062 sh4-softmmu \
1063 sh4eb-softmmu \
1064 sparc-softmmu \
1065 sparc64-softmmu \
1068 # the following are Linux specific
1069 if [ "$linux_user" = "yes" ] ; then
1070 target_list="${target_list}\
1071 i386-linux-user \
1072 x86_64-linux-user \
1073 alpha-linux-user \
1074 arm-linux-user \
1075 armeb-linux-user \
1076 cris-linux-user \
1077 m68k-linux-user \
1078 microblaze-linux-user \
1079 microblazeel-linux-user \
1080 mips-linux-user \
1081 mipsel-linux-user \
1082 ppc-linux-user \
1083 ppc64-linux-user \
1084 ppc64abi32-linux-user \
1085 sh4-linux-user \
1086 sh4eb-linux-user \
1087 sparc-linux-user \
1088 sparc64-linux-user \
1089 sparc32plus-linux-user \
1090 unicore32-linux-user \
1093 # the following are Darwin specific
1094 if [ "$darwin_user" = "yes" ] ; then
1095 target_list="$target_list i386-darwin-user ppc-darwin-user "
1097 # the following are BSD specific
1098 if [ "$bsd_user" = "yes" ] ; then
1099 target_list="${target_list}\
1100 i386-bsd-user \
1101 x86_64-bsd-user \
1102 sparc-bsd-user \
1103 sparc64-bsd-user \
1106 else
1107 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
1109 if test -z "$target_list" ; then
1110 echo "No targets enabled"
1111 exit 1
1113 # see if system emulation was really requested
1114 case " $target_list " in
1115 *"-softmmu "*) softmmu=yes
1117 *) softmmu=no
1119 esac
1121 feature_not_found() {
1122 feature=$1
1124 echo "ERROR"
1125 echo "ERROR: User requested feature $feature"
1126 echo "ERROR: configure was not able to find it"
1127 echo "ERROR"
1128 exit 1;
1131 if test -z "$cross_prefix" ; then
1133 # ---
1134 # big/little endian test
1135 cat > $TMPC << EOF
1136 #include <inttypes.h>
1137 int main(int argc, char ** argv){
1138 volatile uint32_t i=0x01234567;
1139 return (*((uint8_t*)(&i))) == 0x67;
1143 if compile_prog "" "" ; then
1144 $TMPE && bigendian="yes"
1145 else
1146 echo big/little test failed
1149 else
1151 # if cross compiling, cannot launch a program, so make a static guess
1152 case "$cpu" in
1153 armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
1154 bigendian=yes
1156 esac
1160 # host long bits test, actually a pointer size test
1161 cat > $TMPC << EOF
1162 int sizeof_pointer_is_8[sizeof(void *) == 8 ? 1 : -1];
1164 if compile_object; then
1165 hostlongbits=64
1166 else
1167 hostlongbits=32
1171 ##########################################
1172 # NPTL probe
1174 if test "$nptl" != "no" ; then
1175 cat > $TMPC <<EOF
1176 #include <sched.h>
1177 #include <linux/futex.h>
1178 void foo()
1180 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1181 #error bork
1182 #endif
1186 if compile_object ; then
1187 nptl=yes
1188 else
1189 if test "$nptl" = "yes" ; then
1190 feature_not_found "nptl"
1192 nptl=no
1196 ##########################################
1197 # zlib check
1199 cat > $TMPC << EOF
1200 #include <zlib.h>
1201 int main(void) { zlibVersion(); return 0; }
1203 if compile_prog "" "-lz" ; then
1205 else
1206 echo
1207 echo "Error: zlib check failed"
1208 echo "Make sure to have the zlib libs and headers installed."
1209 echo
1210 exit 1
1213 ##########################################
1214 # xen probe
1216 if test "$xen" != "no" ; then
1217 xen_libs="-lxenstore -lxenctrl -lxenguest"
1218 cat > $TMPC <<EOF
1219 #include <xenctrl.h>
1220 #include <xs.h>
1221 int main(void) { xs_daemon_open(); xc_interface_open(); return 0; }
1223 if compile_prog "" "$xen_libs" ; then
1224 xen=yes
1225 libs_softmmu="$xen_libs $libs_softmmu"
1226 else
1227 if test "$xen" = "yes" ; then
1228 feature_not_found "xen"
1230 xen=no
1234 ##########################################
1235 # pkg-config probe
1237 if ! has $pkg_config; then
1238 echo warning: proceeding without "$pkg_config" >&2
1239 pkg_config=/bin/false
1242 ##########################################
1243 # Sparse probe
1244 if test "$sparse" != "no" ; then
1245 if has cgcc; then
1246 sparse=yes
1247 else
1248 if test "$sparse" = "yes" ; then
1249 feature_not_found "sparse"
1251 sparse=no
1255 ##########################################
1256 # SDL probe
1258 # Look for sdl configuration program (pkg-config or sdl-config). Try
1259 # sdl-config even without cross prefix, and favour pkg-config over sdl-config.
1260 if test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then
1261 sdl_config=sdl-config
1264 if $pkg_config sdl --modversion >/dev/null 2>&1; then
1265 sdlconfig="$pkg_config sdl"
1266 _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
1267 elif has ${sdl_config}; then
1268 sdlconfig="$sdl_config"
1269 _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1270 else
1271 if test "$sdl" = "yes" ; then
1272 feature_not_found "sdl"
1274 sdl=no
1276 if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
1277 echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
1280 sdl_too_old=no
1281 if test "$sdl" != "no" ; then
1282 cat > $TMPC << EOF
1283 #include <SDL.h>
1284 #undef main /* We don't want SDL to override our main() */
1285 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1287 sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
1288 if test "$static" = "yes" ; then
1289 sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
1290 else
1291 sdl_libs=`$sdlconfig --libs 2> /dev/null`
1293 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1294 if test "$_sdlversion" -lt 121 ; then
1295 sdl_too_old=yes
1296 else
1297 if test "$cocoa" = "no" ; then
1298 sdl=yes
1302 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
1303 if test "$sdl" = "yes" -a "$static" = "yes" ; then
1304 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
1305 sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1306 sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
1308 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1310 else
1311 sdl=no
1313 fi # static link
1314 else # sdl not found
1315 if test "$sdl" = "yes" ; then
1316 feature_not_found "sdl"
1318 sdl=no
1319 fi # sdl compile test
1322 if test "$sdl" = "yes" ; then
1323 cat > $TMPC <<EOF
1324 #include <SDL.h>
1325 #if defined(SDL_VIDEO_DRIVER_X11)
1326 #include <X11/XKBlib.h>
1327 #else
1328 #error No x11 support
1329 #endif
1330 int main(void) { return 0; }
1332 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1333 sdl_libs="$sdl_libs -lX11"
1335 if test "$mingw32" = "yes" ; then
1336 sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole"
1338 libs_softmmu="$sdl_libs $libs_softmmu"
1341 ##########################################
1342 # VNC TLS detection
1343 if test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then
1344 cat > $TMPC <<EOF
1345 #include <gnutls/gnutls.h>
1346 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1348 vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
1349 vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
1350 if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
1351 vnc_tls=yes
1352 libs_softmmu="$vnc_tls_libs $libs_softmmu"
1353 else
1354 if test "$vnc_tls" = "yes" ; then
1355 feature_not_found "vnc-tls"
1357 vnc_tls=no
1361 ##########################################
1362 # VNC SASL detection
1363 if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
1364 cat > $TMPC <<EOF
1365 #include <sasl/sasl.h>
1366 #include <stdio.h>
1367 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
1369 # Assuming Cyrus-SASL installed in /usr prefix
1370 vnc_sasl_cflags=""
1371 vnc_sasl_libs="-lsasl2"
1372 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1373 vnc_sasl=yes
1374 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
1375 else
1376 if test "$vnc_sasl" = "yes" ; then
1377 feature_not_found "vnc-sasl"
1379 vnc_sasl=no
1383 ##########################################
1384 # VNC JPEG detection
1385 if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
1386 cat > $TMPC <<EOF
1387 #include <stdio.h>
1388 #include <jpeglib.h>
1389 int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
1391 vnc_jpeg_cflags=""
1392 vnc_jpeg_libs="-ljpeg"
1393 if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
1394 vnc_jpeg=yes
1395 libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
1396 else
1397 if test "$vnc_jpeg" = "yes" ; then
1398 feature_not_found "vnc-jpeg"
1400 vnc_jpeg=no
1404 ##########################################
1405 # VNC PNG detection
1406 if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
1407 cat > $TMPC <<EOF
1408 //#include <stdio.h>
1409 #include <png.h>
1410 #include <stddef.h>
1411 int main(void) {
1412 png_structp png_ptr;
1413 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
1414 return 0;
1417 vnc_png_cflags=""
1418 vnc_png_libs="-lpng"
1419 if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
1420 vnc_png=yes
1421 libs_softmmu="$vnc_png_libs $libs_softmmu"
1422 else
1423 if test "$vnc_png" = "yes" ; then
1424 feature_not_found "vnc-png"
1426 vnc_png=no
1430 ##########################################
1431 # fnmatch() probe, used for ACL routines
1432 fnmatch="no"
1433 cat > $TMPC << EOF
1434 #include <fnmatch.h>
1435 int main(void)
1437 fnmatch("foo", "foo", 0);
1438 return 0;
1441 if compile_prog "" "" ; then
1442 fnmatch="yes"
1445 ##########################################
1446 # uuid_generate() probe, used for vdi block driver
1447 if test "$uuid" != "no" ; then
1448 uuid_libs="-luuid"
1449 cat > $TMPC << EOF
1450 #include <uuid/uuid.h>
1451 int main(void)
1453 uuid_t my_uuid;
1454 uuid_generate(my_uuid);
1455 return 0;
1458 if compile_prog "" "$uuid_libs" ; then
1459 uuid="yes"
1460 libs_softmmu="$uuid_libs $libs_softmmu"
1461 libs_tools="$uuid_libs $libs_tools"
1462 else
1463 if test "$uuid" = "yes" ; then
1464 feature_not_found "uuid"
1466 uuid=no
1470 ##########################################
1471 # xfsctl() probe, used for raw-posix
1472 if test "$xfs" != "no" ; then
1473 cat > $TMPC << EOF
1474 #include <xfs/xfs.h>
1475 int main(void)
1477 xfsctl(NULL, 0, 0, NULL);
1478 return 0;
1481 if compile_prog "" "" ; then
1482 xfs="yes"
1483 else
1484 if test "$xfs" = "yes" ; then
1485 feature_not_found "xfs"
1487 xfs=no
1491 ##########################################
1492 # vde libraries probe
1493 if test "$vde" != "no" ; then
1494 vde_libs="-lvdeplug"
1495 cat > $TMPC << EOF
1496 #include <libvdeplug.h>
1497 int main(void)
1499 struct vde_open_args a = {0, 0, 0};
1500 vde_open("", "", &a);
1501 return 0;
1504 if compile_prog "" "$vde_libs" ; then
1505 vde=yes
1506 libs_softmmu="$vde_libs $libs_softmmu"
1507 libs_tools="$vde_libs $libs_tools"
1508 else
1509 if test "$vde" = "yes" ; then
1510 feature_not_found "vde"
1512 vde=no
1516 ##########################################
1517 # Sound support libraries probe
1519 audio_drv_probe()
1521 drv=$1
1522 hdr=$2
1523 lib=$3
1524 exp=$4
1525 cfl=$5
1526 cat > $TMPC << EOF
1527 #include <$hdr>
1528 int main(void) { $exp }
1530 if compile_prog "$cfl" "$lib" ; then
1532 else
1533 echo
1534 echo "Error: $drv check failed"
1535 echo "Make sure to have the $drv libs and headers installed."
1536 echo
1537 exit 1
1541 audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1542 for drv in $audio_drv_list; do
1543 case $drv in
1544 alsa)
1545 audio_drv_probe $drv alsa/asoundlib.h -lasound \
1546 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1547 libs_softmmu="-lasound $libs_softmmu"
1550 fmod)
1551 if test -z $fmod_lib || test -z $fmod_inc; then
1552 echo
1553 echo "Error: You must specify path to FMOD library and headers"
1554 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1555 echo
1556 exit 1
1558 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1559 libs_softmmu="$fmod_lib $libs_softmmu"
1562 esd)
1563 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1564 libs_softmmu="-lesd $libs_softmmu"
1565 audio_pt_int="yes"
1569 audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
1570 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1571 libs_softmmu="-lpulse -lpulse-simple $libs_softmmu"
1572 audio_pt_int="yes"
1575 coreaudio)
1576 libs_softmmu="-framework CoreAudio $libs_softmmu"
1579 dsound)
1580 libs_softmmu="-lole32 -ldxguid $libs_softmmu"
1581 audio_win_int="yes"
1584 oss)
1585 libs_softmmu="$oss_lib $libs_softmmu"
1588 sdl|wav)
1589 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1592 winwave)
1593 libs_softmmu="-lwinmm $libs_softmmu"
1594 audio_win_int="yes"
1598 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
1599 echo
1600 echo "Error: Unknown driver '$drv' selected"
1601 echo "Possible drivers are: $audio_possible_drivers"
1602 echo
1603 exit 1
1606 esac
1607 done
1609 ##########################################
1610 # BrlAPI probe
1612 if test "$brlapi" != "no" ; then
1613 brlapi_libs="-lbrlapi"
1614 cat > $TMPC << EOF
1615 #include <brlapi.h>
1616 #include <stddef.h>
1617 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1619 if compile_prog "" "$brlapi_libs" ; then
1620 brlapi=yes
1621 libs_softmmu="$brlapi_libs $libs_softmmu"
1622 else
1623 if test "$brlapi" = "yes" ; then
1624 feature_not_found "brlapi"
1626 brlapi=no
1630 ##########################################
1631 # curses probe
1632 if test "$mingw32" = "yes" ; then
1633 curses_list="-lpdcurses"
1634 else
1635 curses_list="-lncurses -lcurses"
1638 if test "$curses" != "no" ; then
1639 curses_found=no
1640 cat > $TMPC << EOF
1641 #include <curses.h>
1642 #ifdef __OpenBSD__
1643 #define resize_term resizeterm
1644 #endif
1645 int main(void) { resize_term(0, 0); return curses_version(); }
1647 for curses_lib in $curses_list; do
1648 if compile_prog "" "$curses_lib" ; then
1649 curses_found=yes
1650 libs_softmmu="$curses_lib $libs_softmmu"
1651 break
1653 done
1654 if test "$curses_found" = "yes" ; then
1655 curses=yes
1656 else
1657 if test "$curses" = "yes" ; then
1658 feature_not_found "curses"
1660 curses=no
1664 ##########################################
1665 # curl probe
1667 if $pkg_config libcurl --modversion >/dev/null 2>&1; then
1668 curlconfig="$pkg_config libcurl"
1669 else
1670 curlconfig=curl-config
1673 if test "$curl" != "no" ; then
1674 cat > $TMPC << EOF
1675 #include <curl/curl.h>
1676 int main(void) { return curl_easy_init(); }
1678 curl_cflags=`$curlconfig --cflags 2>/dev/null`
1679 curl_libs=`$curlconfig --libs 2>/dev/null`
1680 if compile_prog "$curl_cflags" "$curl_libs" ; then
1681 curl=yes
1682 libs_tools="$curl_libs $libs_tools"
1683 libs_softmmu="$curl_libs $libs_softmmu"
1684 else
1685 if test "$curl" = "yes" ; then
1686 feature_not_found "curl"
1688 curl=no
1690 fi # test "$curl"
1692 ##########################################
1693 # check framework probe
1695 if test "$check_utests" != "no" ; then
1696 cat > $TMPC << EOF
1697 #include <check.h>
1698 int main(void) { suite_create("qemu test"); return 0; }
1700 check_libs=`$pkg_config --libs check`
1701 if compile_prog "" $check_libs ; then
1702 check_utests=yes
1703 libs_tools="$check_libs $libs_tools"
1704 else
1705 if test "$check_utests" = "yes" ; then
1706 feature_not_found "check"
1708 check_utests=no
1710 fi # test "$check_utests"
1712 ##########################################
1713 # bluez support probe
1714 if test "$bluez" != "no" ; then
1715 cat > $TMPC << EOF
1716 #include <bluetooth/bluetooth.h>
1717 int main(void) { return bt_error(0); }
1719 bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
1720 bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
1721 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
1722 bluez=yes
1723 libs_softmmu="$bluez_libs $libs_softmmu"
1724 else
1725 if test "$bluez" = "yes" ; then
1726 feature_not_found "bluez"
1728 bluez="no"
1732 ##########################################
1733 # kvm probe
1734 if test "$kvm" != "no" ; then
1735 cat > $TMPC <<EOF
1736 #include <linux/kvm.h>
1737 #if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
1738 #error Invalid KVM version
1739 #endif
1741 must_have_caps="KVM_CAP_USER_MEMORY \
1742 KVM_CAP_DESTROY_MEMORY_REGION_WORKS \
1743 KVM_CAP_COALESCED_MMIO \
1744 KVM_CAP_SYNC_MMU \
1746 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) ; then
1747 must_have_caps="$caps \
1748 KVM_CAP_SET_TSS_ADDR \
1749 KVM_CAP_EXT_CPUID \
1750 KVM_CAP_CLOCKSOURCE \
1751 KVM_CAP_NOP_IO_DELAY \
1752 KVM_CAP_PV_MMU \
1753 KVM_CAP_MP_STATE \
1754 KVM_CAP_USER_NMI \
1757 for c in $must_have_caps ; do
1758 cat >> $TMPC <<EOF
1759 #if !defined($c)
1760 #error Missing KVM capability $c
1761 #endif
1763 done
1764 cat >> $TMPC <<EOF
1765 int main(void) { return 0; }
1767 if test "$kerneldir" != "" ; then
1768 kvm_cflags=-I"$kerneldir"/include
1769 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1770 -a -d "$kerneldir/arch/x86/include" ; then
1771 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
1772 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1773 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
1774 elif test "$cpu" = "s390x" -a -d "$kerneldir/arch/s390/include" ; then
1775 kvm_cflags="$kvm_cflags -I$kerneldir/arch/s390/include"
1776 elif test -d "$kerneldir/arch/$cpu/include" ; then
1777 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1779 else
1780 kvm_cflags=`$pkg_config --cflags kvm-kmod 2>/dev/null`
1781 if test "$kvm_cflags" = ""; then
1782 case "$cpu" in
1783 i386 | x86_64)
1784 kvm_arch="x86"
1786 ppc)
1787 kvm_arch="powerpc"
1790 kvm_arch="$cpu"
1792 esac
1793 kvm_cflags="-I$source_path/kvm/include"
1794 kvm_cflags="$kvm_cflags -include $source_path/kvm/include/linux/config.h"
1795 kvm_cflags="$kvm_cflags -I$source_path/kvm/include/$kvm_arch"
1798 kvm_cflags="$kvm_cflags -idirafter $source_path/compat"
1799 if compile_prog "$kvm_cflags" "" ; then
1800 kvm=yes
1801 cat > $TMPC <<EOF
1802 #include <linux/kvm_para.h>
1803 int main(void) { return 0; }
1805 if compile_prog "$kvm_cflags" "" ; then
1806 kvm_para=yes
1808 else
1809 if test "$kvm" = "yes" ; then
1810 if has awk && has grep; then
1811 kvmerr=`LANG=C $cc $QEMU_CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \
1812 | grep "error: " \
1813 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1814 if test "$kvmerr" != "" ; then
1815 echo -e "${kvmerr}\n\
1816 NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \
1817 recent kvm-kmod from http://sourceforge.net/projects/kvm."
1820 feature_not_found "kvm"
1822 kvm=no
1826 ##########################################
1827 # test for KVM_CAP_PIT
1829 if test "$kvm_cap_pit" != "no" ; then
1830 if test "$kvm" = "no" -a "$kvm_cap_pit" = "yes" ; then
1831 feature_not_found "kvm_cap_pit (kvm is not enabled)"
1833 cat > $TMPC <<EOF
1834 #include <linux/kvm.h>
1835 #ifndef KVM_CAP_PIT
1836 #error "kvm no pit capability"
1837 #endif
1838 int main(void) { return 0; }
1840 if compile_prog "$kvm_cflags" ""; then
1841 kvm_cap_pit=yes
1842 else
1843 if test "$kvm_cap_pit" = "yes" ; then
1844 feature_not_found "kvm_cap_pit"
1846 kvm_cap_pit=no
1850 ##########################################
1851 # test for KVM_CAP_DEVICE_ASSIGNMENT
1853 if test "$kvm_cap_device_assignment" != "no" ; then
1854 if test "$kvm" = "no" -a "$kvm_cap_device_assignment" = "yes" ; then
1855 feature_not_found "kvm_cap_device_assignment (kvm is not enabled)"
1857 cat > $TMPC <<EOF
1858 #include <linux/kvm.h>
1859 #ifndef KVM_CAP_DEVICE_ASSIGNMENT
1860 #error "kvm no device assignment capability"
1861 #endif
1862 int main(void) { return 0; }
1864 if compile_prog "$kvm_cflags" "" ; then
1865 kvm_cap_device_assignment=yes
1866 else
1867 if test "$kvm_cap_device_assignment" = "yes" ; then
1868 feature_not_found "kvm_cap_device_assigment"
1870 kvm_cap_device_assignment=no
1874 ##########################################
1875 # libpci header probe for kvm_cap_device_assignment
1876 if test $kvm_cap_device_assignment = "yes" ; then
1877 cat > $TMPC << EOF
1878 #include <pci/header.h>
1879 #ifndef PCI_VENDOR_ID
1880 #error NO LIBPCI HEADER
1881 #endif
1882 int main(void) { return 0; }
1884 if compile_prog "" "" ; then
1885 kvm_cap_device_assignment=yes
1886 else
1887 echo
1888 echo "Error: libpci header check failed"
1889 echo "Disable KVM Device Assignment capability."
1890 echo
1891 kvm_cap_device_assignment=no
1895 ##########################################
1896 # test for vhost net
1898 if test "$vhost_net" != "no"; then
1899 if test "$kvm" != "no"; then
1900 cat > $TMPC <<EOF
1901 #include <linux/vhost.h>
1902 int main(void) { return 0; }
1904 if compile_prog "$kvm_cflags" "" ; then
1905 vhost_net=yes
1906 else
1907 if test "$vhost_net" = "yes" ; then
1908 feature_not_found "vhost-net"
1910 vhost_net=no
1912 else
1913 if test "$vhost_net" = "yes" ; then
1914 echo "NOTE: vhost-net feature requires KVM (--enable-kvm)."
1915 feature_not_found "vhost-net"
1917 vhost_net=no
1921 ##########################################
1922 # pthread probe
1923 PTHREADLIBS_LIST="-lpthread -lpthreadGC2"
1925 pthread=no
1926 cat > $TMPC << EOF
1927 #include <pthread.h>
1928 int main(void) { pthread_create(0,0,0,0); return 0; }
1930 if compile_prog "" "" ; then
1931 pthread=yes
1932 else
1933 for pthread_lib in $PTHREADLIBS_LIST; do
1934 if compile_prog "" "$pthread_lib" ; then
1935 pthread=yes
1936 LIBS="$pthread_lib $LIBS"
1937 break
1939 done
1942 if test "$mingw32" != yes -a "$pthread" = no; then
1943 echo
1944 echo "Error: pthread check failed"
1945 echo "Make sure to have the pthread libs and headers installed."
1946 echo
1947 exit 1
1950 ##########################################
1951 # rbd probe
1952 if test "$rbd" != "no" ; then
1953 cat > $TMPC <<EOF
1954 #include <stdio.h>
1955 #include <rados/librados.h>
1956 int main(void) { rados_initialize(0, NULL); return 0; }
1958 rbd_libs="-lrados"
1959 if compile_prog "" "$rbd_libs" ; then
1960 librados_too_old=no
1961 cat > $TMPC <<EOF
1962 #include <stdio.h>
1963 #include <rados/librados.h>
1964 #ifndef CEPH_OSD_TMAP_SET
1965 #error missing CEPH_OSD_TMAP_SET
1966 #endif
1967 int main(void) {
1968 int (*func)(const rados_pool_t pool, uint64_t *snapid) = rados_selfmanaged_snap_create;
1969 rados_initialize(0, NULL);
1970 return 0;
1973 if compile_prog "" "$rbd_libs" ; then
1974 rbd=yes
1975 libs_tools="$rbd_libs $libs_tools"
1976 libs_softmmu="$rbd_libs $libs_softmmu"
1977 else
1978 rbd=no
1979 librados_too_old=yes
1981 else
1982 if test "$rbd" = "yes" ; then
1983 feature_not_found "rados block device"
1985 rbd=no
1987 if test "$librados_too_old" = "yes" ; then
1988 echo "-> Your librados version is too old - upgrade needed to have rbd support"
1992 ##########################################
1993 # linux-aio probe
1995 if test "$linux_aio" != "no" ; then
1996 cat > $TMPC <<EOF
1997 #include <libaio.h>
1998 #include <sys/eventfd.h>
1999 #include <stddef.h>
2000 int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
2002 if compile_prog "" "-laio" ; then
2003 linux_aio=yes
2004 libs_softmmu="$libs_softmmu -laio"
2005 libs_tools="$libs_tools -laio"
2006 else
2007 if test "$linux_aio" = "yes" ; then
2008 feature_not_found "linux AIO"
2010 linux_aio=no
2014 ##########################################
2015 # attr probe
2017 if test "$attr" != "no" ; then
2018 cat > $TMPC <<EOF
2019 #include <stdio.h>
2020 #include <sys/types.h>
2021 #include <attr/xattr.h>
2022 int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
2024 if compile_prog "" "-lattr" ; then
2025 attr=yes
2026 LIBS="-lattr $LIBS"
2027 else
2028 if test "$attr" = "yes" ; then
2029 feature_not_found "ATTR"
2031 attr=no
2035 ##########################################
2036 # iovec probe
2037 cat > $TMPC <<EOF
2038 #include <sys/types.h>
2039 #include <sys/uio.h>
2040 #include <unistd.h>
2041 int main(void) { struct iovec iov; return 0; }
2043 iovec=no
2044 if compile_prog "" "" ; then
2045 iovec=yes
2048 ##########################################
2049 # preadv probe
2050 cat > $TMPC <<EOF
2051 #include <sys/types.h>
2052 #include <sys/uio.h>
2053 #include <unistd.h>
2054 int main(void) { preadv; }
2056 preadv=no
2057 if compile_prog "" "" ; then
2058 preadv=yes
2061 ##########################################
2062 # fdt probe
2063 if test "$fdt" != "no" ; then
2064 fdt_libs="-lfdt"
2065 cat > $TMPC << EOF
2066 int main(void) { return 0; }
2068 if compile_prog "" "$fdt_libs" ; then
2069 fdt=yes
2070 else
2071 if test "$fdt" = "yes" ; then
2072 feature_not_found "fdt"
2074 fdt_libs=
2075 fdt=no
2079 ##########################################
2080 # opengl probe, used by milkymist-tmu2
2081 if test "$opengl" != "no" ; then
2082 opengl_libs="-lGL"
2083 cat > $TMPC << EOF
2084 #include <X11/Xlib.h>
2085 #include <GL/gl.h>
2086 #include <GL/glx.h>
2087 int main(void) { GL_VERSION; return 0; }
2089 if compile_prog "" "-lGL" ; then
2090 opengl=yes
2091 else
2092 if test "$opengl" = "yes" ; then
2093 feature_not_found "opengl"
2095 opengl_libs=
2096 opengl=no
2101 # Check for xxxat() functions when we are building linux-user
2102 # emulator. This is done because older glibc versions don't
2103 # have syscall stubs for these implemented.
2105 atfile=no
2106 cat > $TMPC << EOF
2107 #define _ATFILE_SOURCE
2108 #include <sys/types.h>
2109 #include <fcntl.h>
2110 #include <unistd.h>
2113 main(void)
2115 /* try to unlink nonexisting file */
2116 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
2119 if compile_prog "" "" ; then
2120 atfile=yes
2123 # Check for inotify functions when we are building linux-user
2124 # emulator. This is done because older glibc versions don't
2125 # have syscall stubs for these implemented. In that case we
2126 # don't provide them even if kernel supports them.
2128 inotify=no
2129 cat > $TMPC << EOF
2130 #include <sys/inotify.h>
2133 main(void)
2135 /* try to start inotify */
2136 return inotify_init();
2139 if compile_prog "" "" ; then
2140 inotify=yes
2143 inotify1=no
2144 cat > $TMPC << EOF
2145 #include <sys/inotify.h>
2148 main(void)
2150 /* try to start inotify */
2151 return inotify_init1(0);
2154 if compile_prog "" "" ; then
2155 inotify1=yes
2158 # check if utimensat and futimens are supported
2159 utimens=no
2160 cat > $TMPC << EOF
2161 #define _ATFILE_SOURCE
2162 #include <stddef.h>
2163 #include <fcntl.h>
2165 int main(void)
2167 utimensat(AT_FDCWD, "foo", NULL, 0);
2168 futimens(0, NULL);
2169 return 0;
2172 if compile_prog "" "" ; then
2173 utimens=yes
2176 # check if pipe2 is there
2177 pipe2=no
2178 cat > $TMPC << EOF
2179 #include <unistd.h>
2180 #include <fcntl.h>
2182 int main(void)
2184 int pipefd[2];
2185 pipe2(pipefd, O_CLOEXEC);
2186 return 0;
2189 if compile_prog "" "" ; then
2190 pipe2=yes
2193 # check if accept4 is there
2194 accept4=no
2195 cat > $TMPC << EOF
2196 #include <sys/socket.h>
2197 #include <stddef.h>
2199 int main(void)
2201 accept4(0, NULL, NULL, SOCK_CLOEXEC);
2202 return 0;
2205 if compile_prog "" "" ; then
2206 accept4=yes
2209 # check if tee/splice is there. vmsplice was added same time.
2210 splice=no
2211 cat > $TMPC << EOF
2212 #include <unistd.h>
2213 #include <fcntl.h>
2214 #include <limits.h>
2216 int main(void)
2218 int len, fd;
2219 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
2220 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
2221 return 0;
2224 if compile_prog "" "" ; then
2225 splice=yes
2228 ##########################################
2229 # signalfd probe
2230 signalfd="no"
2231 cat > $TMPC << EOF
2232 #define _GNU_SOURCE
2233 #include <unistd.h>
2234 #include <sys/syscall.h>
2235 #include <signal.h>
2236 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
2239 if compile_prog "" "" ; then
2240 signalfd=yes
2241 elif test "$kvm" = "yes" -a "$io_thread" != "yes"; then
2242 echo
2243 echo "ERROR: Host kernel lacks signalfd() support,"
2244 echo "but KVM depends on it when the IO thread is disabled."
2245 echo
2246 exit 1
2249 # check if eventfd is supported
2250 eventfd=no
2251 cat > $TMPC << EOF
2252 #include <sys/eventfd.h>
2254 int main(void)
2256 int efd = eventfd(0, 0);
2257 return 0;
2260 if compile_prog "" "" ; then
2261 eventfd=yes
2264 # check for fallocate
2265 fallocate=no
2266 cat > $TMPC << EOF
2267 #include <fcntl.h>
2269 int main(void)
2271 fallocate(0, 0, 0, 0);
2272 return 0;
2275 if compile_prog "$ARCH_CFLAGS" "" ; then
2276 fallocate=yes
2279 # check for sync_file_range
2280 sync_file_range=no
2281 cat > $TMPC << EOF
2282 #include <fcntl.h>
2284 int main(void)
2286 sync_file_range(0, 0, 0, 0);
2287 return 0;
2290 if compile_prog "$ARCH_CFLAGS" "" ; then
2291 sync_file_range=yes
2294 # check for linux/fiemap.h and FS_IOC_FIEMAP
2295 fiemap=no
2296 cat > $TMPC << EOF
2297 #include <sys/ioctl.h>
2298 #include <linux/fs.h>
2299 #include <linux/fiemap.h>
2301 int main(void)
2303 ioctl(0, FS_IOC_FIEMAP, 0);
2304 return 0;
2307 if compile_prog "$ARCH_CFLAGS" "" ; then
2308 fiemap=yes
2311 # check for dup3
2312 dup3=no
2313 cat > $TMPC << EOF
2314 #include <unistd.h>
2316 int main(void)
2318 dup3(0, 0, 0);
2319 return 0;
2322 if compile_prog "" "" ; then
2323 dup3=yes
2326 # check for epoll support
2327 epoll=no
2328 cat > $TMPC << EOF
2329 #include <sys/epoll.h>
2331 int main(void)
2333 epoll_create(0);
2334 return 0;
2337 if compile_prog "$ARCH_CFLAGS" "" ; then
2338 epoll=yes
2341 # epoll_create1 and epoll_pwait are later additions
2342 # so we must check separately for their presence
2343 epoll_create1=no
2344 cat > $TMPC << EOF
2345 #include <sys/epoll.h>
2347 int main(void)
2349 /* Note that we use epoll_create1 as a value, not as
2350 * a function being called. This is necessary so that on
2351 * old SPARC glibc versions where the function was present in
2352 * the library but not declared in the header file we will
2353 * fail the configure check. (Otherwise we will get a compiler
2354 * warning but not an error, and will proceed to fail the
2355 * qemu compile where we compile with -Werror.)
2357 epoll_create1;
2358 return 0;
2361 if compile_prog "$ARCH_CFLAGS" "" ; then
2362 epoll_create1=yes
2365 epoll_pwait=no
2366 cat > $TMPC << EOF
2367 #include <sys/epoll.h>
2369 int main(void)
2371 epoll_pwait(0, 0, 0, 0, 0);
2372 return 0;
2375 if compile_prog "$ARCH_CFLAGS" "" ; then
2376 epoll_pwait=yes
2379 # Check if tools are available to build documentation.
2380 if test "$docs" != "no" ; then
2381 if has makeinfo && has pod2man; then
2382 docs=yes
2383 else
2384 if test "$docs" = "yes" ; then
2385 feature_not_found "docs"
2387 docs=no
2391 # Search for bswap_32 function
2392 byteswap_h=no
2393 cat > $TMPC << EOF
2394 #include <byteswap.h>
2395 int main(void) { return bswap_32(0); }
2397 if compile_prog "" "" ; then
2398 byteswap_h=yes
2401 # Search for bswap_32 function
2402 bswap_h=no
2403 cat > $TMPC << EOF
2404 #include <sys/endian.h>
2405 #include <sys/types.h>
2406 #include <machine/bswap.h>
2407 int main(void) { return bswap32(0); }
2409 if compile_prog "" "" ; then
2410 bswap_h=yes
2413 ##########################################
2414 # Do we need librt
2415 cat > $TMPC <<EOF
2416 #include <signal.h>
2417 #include <time.h>
2418 int main(void) { clockid_t id; return clock_gettime(id, NULL); }
2421 if compile_prog "" "" ; then
2423 elif compile_prog "" "-lrt" ; then
2424 LIBS="-lrt $LIBS"
2427 if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
2428 "$aix" != "yes" -a "$haiku" != "yes" ; then
2429 libs_softmmu="-lutil $libs_softmmu"
2432 ##########################################
2433 # check if the compiler defines offsetof
2435 need_offsetof=yes
2436 cat > $TMPC << EOF
2437 #include <stddef.h>
2438 int main(void) { struct s { int f; }; return offsetof(struct s, f); }
2440 if compile_prog "" "" ; then
2441 need_offsetof=no
2444 ##########################################
2445 # check if the compiler understands attribute warn_unused_result
2447 # This could be smarter, but gcc -Werror does not error out even when warning
2448 # about attribute warn_unused_result
2450 gcc_attribute_warn_unused_result=no
2451 cat > $TMPC << EOF
2452 #if defined(__GNUC__) && (__GNUC__ < 4) && defined(__GNUC_MINOR__) && (__GNUC__ < 4)
2453 #error gcc 3.3 or older
2454 #endif
2455 int main(void) { return 0;}
2457 if compile_prog "" ""; then
2458 gcc_attribute_warn_unused_result=yes
2461 # spice probe
2462 if test "$spice" != "no" ; then
2463 cat > $TMPC << EOF
2464 #include <spice.h>
2465 int main(void) { spice_server_new(); return 0; }
2467 spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
2468 spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
2469 if $pkg_config --atleast-version=0.5.3 spice-server >/dev/null 2>&1 && \
2470 compile_prog "$spice_cflags" "$spice_libs" ; then
2471 spice="yes"
2472 libs_softmmu="$libs_softmmu $spice_libs"
2473 QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
2474 else
2475 if test "$spice" = "yes" ; then
2476 feature_not_found "spice"
2478 spice="no"
2482 # check for libcacard for smartcard support
2483 if test "$smartcard" != "no" ; then
2484 smartcard="yes"
2485 smartcard_cflags=""
2486 # TODO - what's the minimal nss version we support?
2487 if test "$smartcard_nss" != "no"; then
2488 if $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 ; then
2489 smartcard_nss="yes"
2490 smartcard_cflags="-I\$(SRC_PATH)/libcacard"
2491 libcacard_libs=$($pkg_config --libs nss 2>/dev/null)
2492 libcacard_cflags=$($pkg_config --cflags nss 2>/dev/null)
2493 QEMU_CFLAGS="$QEMU_CFLAGS $smartcard_cflags $libcacard_cflags"
2494 LIBS="$libcacard_libs $LIBS"
2495 else
2496 if test "$smartcard_nss" = "yes"; then
2497 feature_not_found "nss"
2499 smartcard_nss="no"
2503 if test "$smartcard" = "no" ; then
2504 smartcard_nss="no"
2507 ##########################################
2509 ##########################################
2510 # check if we have fdatasync
2512 fdatasync=no
2513 cat > $TMPC << EOF
2514 #include <unistd.h>
2515 int main(void) { return fdatasync(0); }
2517 if compile_prog "" "" ; then
2518 fdatasync=yes
2521 ##########################################
2522 # check if we have madvise
2524 madvise=no
2525 cat > $TMPC << EOF
2526 #include <sys/types.h>
2527 #include <sys/mman.h>
2528 #include <stddef.h>
2529 int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
2531 if compile_prog "" "" ; then
2532 madvise=yes
2535 ##########################################
2536 # check if we have posix_madvise
2538 posix_madvise=no
2539 cat > $TMPC << EOF
2540 #include <sys/mman.h>
2541 #include <stddef.h>
2542 int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
2544 if compile_prog "" "" ; then
2545 posix_madvise=yes
2548 ##########################################
2549 # check if trace backend exists
2551 sh "$source_path/scripts/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null
2552 if test "$?" -ne 0 ; then
2553 echo
2554 echo "Error: invalid trace backend"
2555 echo "Please choose a supported trace backend."
2556 echo
2557 exit 1
2560 ##########################################
2561 # For 'ust' backend, test if ust headers are present
2562 if test "$trace_backend" = "ust"; then
2563 cat > $TMPC << EOF
2564 #include <ust/tracepoint.h>
2565 #include <ust/marker.h>
2566 int main(void) { return 0; }
2568 if compile_prog "" "" ; then
2569 LIBS="-lust $LIBS"
2570 else
2571 echo
2572 echo "Error: Trace backend 'ust' missing libust header files"
2573 echo
2574 exit 1
2578 ##########################################
2579 # For 'dtrace' backend, test if 'dtrace' command is present
2580 if test "$trace_backend" = "dtrace"; then
2581 if ! has 'dtrace' ; then
2582 echo
2583 echo "Error: dtrace command is not found in PATH $PATH"
2584 echo
2585 exit 1
2587 trace_backend_stap="no"
2588 if has 'stap' ; then
2589 trace_backend_stap="yes"
2593 ##########################################
2594 # End of CC checks
2595 # After here, no more $cc or $ld runs
2597 if test "$debug" = "no" ; then
2598 CFLAGS="-O2 $CFLAGS"
2601 # Consult white-list to determine whether to enable werror
2602 # by default. Only enable by default for git builds
2603 z_version=`cut -f3 -d. $source_path/VERSION`
2605 if test -z "$werror" ; then
2606 if test "$z_version" = "50" -a \
2607 "$linux" = "yes" ; then
2608 werror="yes"
2609 else
2610 werror="no"
2614 # Disable zero malloc errors for official releases unless explicitly told to
2615 # enable/disable
2616 if test -z "$zero_malloc" ; then
2617 if test "$z_version" = "50" ; then
2618 zero_malloc="no"
2619 else
2620 zero_malloc="yes"
2624 if test "$werror" = "yes" ; then
2625 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
2628 if test "$solaris" = "no" ; then
2629 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
2630 LDFLAGS="-Wl,--warn-common $LDFLAGS"
2634 # Use ASLR, no-SEH and DEP if available
2635 if test "$mingw32" = "yes" ; then
2636 for flag in --dynamicbase --no-seh --nxcompat; do
2637 if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
2638 LDFLAGS="-Wl,$flag $LDFLAGS"
2640 done
2643 confdir=$sysconfdir$confsuffix
2645 tools=
2646 if test "$softmmu" = yes ; then
2647 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
2648 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
2649 tools="qemu-nbd\$(EXESUF) $tools"
2650 if [ "$check_utests" = "yes" ]; then
2651 tools="check-qint check-qstring check-qdict check-qlist $tools"
2652 tools="check-qfloat check-qjson $tools"
2657 # Mac OS X ships with a broken assembler
2658 roms=
2659 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
2660 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
2661 "$softmmu" = yes ; then
2662 roms="optionrom"
2664 if test "$cpu" = "ppc64" ; then
2665 roms="$roms spapr-rtas"
2668 echo "Install prefix $prefix"
2669 echo "BIOS directory `eval echo $datadir`"
2670 echo "binary directory `eval echo $bindir`"
2671 echo "config directory `eval echo $sysconfdir`"
2672 if test "$mingw32" = "no" ; then
2673 echo "Manual directory `eval echo $mandir`"
2674 echo "ELF interp prefix $interp_prefix"
2676 echo "Source path $source_path"
2677 echo "C compiler $cc"
2678 echo "Host C compiler $host_cc"
2679 echo "CFLAGS $CFLAGS"
2680 echo "QEMU_CFLAGS $QEMU_CFLAGS"
2681 echo "LDFLAGS $LDFLAGS"
2682 echo "make $make"
2683 echo "install $install"
2684 echo "host CPU $cpu"
2685 echo "host big endian $bigendian"
2686 echo "target list $target_list"
2687 echo "tcg debug enabled $debug_tcg"
2688 echo "Mon debug enabled $debug_mon"
2689 echo "gprof enabled $gprof"
2690 echo "sparse enabled $sparse"
2691 echo "strip binaries $strip_opt"
2692 echo "profiler $profiler"
2693 echo "static build $static"
2694 echo "-Werror enabled $werror"
2695 if test "$darwin" = "yes" ; then
2696 echo "Cocoa support $cocoa"
2698 echo "SDL support $sdl"
2699 echo "curses support $curses"
2700 echo "curl support $curl"
2701 echo "check support $check_utests"
2702 echo "mingw32 support $mingw32"
2703 echo "Audio drivers $audio_drv_list"
2704 echo "Extra audio cards $audio_card_list"
2705 echo "Block whitelist $block_drv_whitelist"
2706 echo "Mixer emulation $mixemu"
2707 echo "VNC support $vnc"
2708 if test "$vnc" = "yes" ; then
2709 echo "VNC TLS support $vnc_tls"
2710 echo "VNC SASL support $vnc_sasl"
2711 echo "VNC JPEG support $vnc_jpeg"
2712 echo "VNC PNG support $vnc_png"
2713 echo "VNC thread $vnc_thread"
2715 if test -n "$sparc_cpu"; then
2716 echo "Target Sparc Arch $sparc_cpu"
2718 echo "xen support $xen"
2719 echo "CPU emulation $cpu_emulation"
2720 echo "brlapi support $brlapi"
2721 echo "bluez support $bluez"
2722 echo "Documentation $docs"
2723 [ ! -z "$uname_release" ] && \
2724 echo "uname -r $uname_release"
2725 echo "NPTL support $nptl"
2726 echo "GUEST_BASE $guest_base"
2727 echo "PIE user targets $user_pie"
2728 echo "vde support $vde"
2729 echo "IO thread $io_thread"
2730 echo "Linux AIO support $linux_aio"
2731 echo "ATTR/XATTR support $attr"
2732 echo "Install blobs $blobs"
2733 echo "KVM support $kvm"
2734 echo "KVM PIT support $kvm_cap_pit"
2735 echo "KVM device assig. $kvm_cap_device_assignment"
2736 echo "fdt support $fdt"
2737 echo "preadv support $preadv"
2738 echo "fdatasync $fdatasync"
2739 echo "madvise $madvise"
2740 echo "posix_madvise $posix_madvise"
2741 echo "uuid support $uuid"
2742 echo "vhost-net support $vhost_net"
2743 echo "Trace backend $trace_backend"
2744 echo "Trace output file $trace_file-<pid>"
2745 echo "spice support $spice"
2746 echo "rbd support $rbd"
2747 echo "xfsctl support $xfs"
2748 echo "nss used $smartcard_nss"
2749 echo "OpenGL support $opengl"
2751 if test $sdl_too_old = "yes"; then
2752 echo "-> Your SDL version is too old - please upgrade to have SDL support"
2755 config_host_mak="config-host.mak"
2756 config_host_ld="config-host.ld"
2758 echo "# Automatically generated by configure - do not modify" > $config_host_mak
2759 printf "# Configured with:" >> $config_host_mak
2760 printf " '%s'" "$0" "$@" >> $config_host_mak
2761 echo >> $config_host_mak
2763 echo all: >> $config_host_mak
2764 echo "prefix=$prefix" >> $config_host_mak
2765 echo "bindir=$bindir" >> $config_host_mak
2766 echo "mandir=$mandir" >> $config_host_mak
2767 echo "datadir=$datadir" >> $config_host_mak
2768 echo "sysconfdir=$sysconfdir" >> $config_host_mak
2769 echo "docdir=$docdir" >> $config_host_mak
2770 echo "confdir=$confdir" >> $config_host_mak
2772 case "$cpu" in
2773 i386|x86_64|alpha|cris|hppa|ia64|lm32|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64|unicore32)
2774 ARCH=$cpu
2776 armv4b|armv4l)
2777 ARCH=arm
2779 esac
2780 echo "ARCH=$ARCH" >> $config_host_mak
2781 if test "$debug_tcg" = "yes" ; then
2782 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
2784 if test "$debug_mon" = "yes" ; then
2785 echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak
2787 if test "$debug" = "yes" ; then
2788 echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
2790 if test "$strip_opt" = "yes" ; then
2791 echo "STRIP=${strip}" >> $config_host_mak
2793 if test "$bigendian" = "yes" ; then
2794 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
2796 echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
2797 if test "$mingw32" = "yes" ; then
2798 echo "CONFIG_WIN32=y" >> $config_host_mak
2799 rc_version=`cat $source_path/VERSION`
2800 version_major=${rc_version%%.*}
2801 rc_version=${rc_version#*.}
2802 version_minor=${rc_version%%.*}
2803 rc_version=${rc_version#*.}
2804 version_subminor=${rc_version%%.*}
2805 version_micro=0
2806 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
2807 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
2808 else
2809 echo "CONFIG_POSIX=y" >> $config_host_mak
2812 if test "$linux" = "yes" ; then
2813 echo "CONFIG_LINUX=y" >> $config_host_mak
2816 if test "$darwin" = "yes" ; then
2817 echo "CONFIG_DARWIN=y" >> $config_host_mak
2820 if test "$aix" = "yes" ; then
2821 echo "CONFIG_AIX=y" >> $config_host_mak
2824 if test "$solaris" = "yes" ; then
2825 echo "CONFIG_SOLARIS=y" >> $config_host_mak
2826 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
2827 if test "$needs_libsunmath" = "yes" ; then
2828 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
2831 if test "$haiku" = "yes" ; then
2832 echo "CONFIG_HAIKU=y" >> $config_host_mak
2834 if test "$static" = "yes" ; then
2835 echo "CONFIG_STATIC=y" >> $config_host_mak
2837 if test $profiler = "yes" ; then
2838 echo "CONFIG_PROFILER=y" >> $config_host_mak
2840 if test "$slirp" = "yes" ; then
2841 echo "CONFIG_SLIRP=y" >> $config_host_mak
2842 QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES"
2844 if test "$vde" = "yes" ; then
2845 echo "CONFIG_VDE=y" >> $config_host_mak
2847 for card in $audio_card_list; do
2848 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
2849 echo "$def=y" >> $config_host_mak
2850 done
2851 echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
2852 for drv in $audio_drv_list; do
2853 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
2854 echo "$def=y" >> $config_host_mak
2855 if test "$drv" = "fmod"; then
2856 echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
2858 done
2859 if test "$audio_pt_int" = "yes" ; then
2860 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
2862 if test "$audio_win_int" = "yes" ; then
2863 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
2865 echo "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
2866 if test "$mixemu" = "yes" ; then
2867 echo "CONFIG_MIXEMU=y" >> $config_host_mak
2869 if test "$vnc" = "yes" ; then
2870 echo "CONFIG_VNC=y" >> $config_host_mak
2872 if test "$vnc_tls" = "yes" ; then
2873 echo "CONFIG_VNC_TLS=y" >> $config_host_mak
2874 echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
2876 if test "$vnc_sasl" = "yes" ; then
2877 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
2878 echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
2880 if test "$vnc_jpeg" = "yes" ; then
2881 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
2882 echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak
2884 if test "$vnc_png" = "yes" ; then
2885 echo "CONFIG_VNC_PNG=y" >> $config_host_mak
2886 echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak
2888 if test "$vnc_thread" = "yes" ; then
2889 echo "CONFIG_VNC_THREAD=y" >> $config_host_mak
2891 if test "$fnmatch" = "yes" ; then
2892 echo "CONFIG_FNMATCH=y" >> $config_host_mak
2894 if test "$uuid" = "yes" ; then
2895 echo "CONFIG_UUID=y" >> $config_host_mak
2897 if test "$xfs" = "yes" ; then
2898 echo "CONFIG_XFS=y" >> $config_host_mak
2900 qemu_version=`head $source_path/VERSION`
2901 echo "VERSION=$qemu_version" >>$config_host_mak
2902 echo "PKGVERSION=$pkgversion" >>$config_host_mak
2903 echo "SRC_PATH=$source_path" >> $config_host_mak
2904 echo "TARGET_DIRS=$target_list" >> $config_host_mak
2905 if [ "$docs" = "yes" ] ; then
2906 echo "BUILD_DOCS=yes" >> $config_host_mak
2908 if test "$sdl" = "yes" ; then
2909 echo "CONFIG_SDL=y" >> $config_host_mak
2910 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
2912 if test "$cocoa" = "yes" ; then
2913 echo "CONFIG_COCOA=y" >> $config_host_mak
2915 if test "$curses" = "yes" ; then
2916 echo "CONFIG_CURSES=y" >> $config_host_mak
2918 if test "$atfile" = "yes" ; then
2919 echo "CONFIG_ATFILE=y" >> $config_host_mak
2921 if test "$utimens" = "yes" ; then
2922 echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
2924 if test "$pipe2" = "yes" ; then
2925 echo "CONFIG_PIPE2=y" >> $config_host_mak
2927 if test "$accept4" = "yes" ; then
2928 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
2930 if test "$splice" = "yes" ; then
2931 echo "CONFIG_SPLICE=y" >> $config_host_mak
2933 if test "$eventfd" = "yes" ; then
2934 echo "CONFIG_EVENTFD=y" >> $config_host_mak
2936 if test "$fallocate" = "yes" ; then
2937 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
2939 if test "$sync_file_range" = "yes" ; then
2940 echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
2942 if test "$fiemap" = "yes" ; then
2943 echo "CONFIG_FIEMAP=y" >> $config_host_mak
2945 if test "$dup3" = "yes" ; then
2946 echo "CONFIG_DUP3=y" >> $config_host_mak
2948 if test "$epoll" = "yes" ; then
2949 echo "CONFIG_EPOLL=y" >> $config_host_mak
2951 if test "$epoll_create1" = "yes" ; then
2952 echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
2954 if test "$epoll_pwait" = "yes" ; then
2955 echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
2957 if test "$inotify" = "yes" ; then
2958 echo "CONFIG_INOTIFY=y" >> $config_host_mak
2960 if test "$inotify1" = "yes" ; then
2961 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
2963 if test "$byteswap_h" = "yes" ; then
2964 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
2966 if test "$bswap_h" = "yes" ; then
2967 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
2969 if test "$curl" = "yes" ; then
2970 echo "CONFIG_CURL=y" >> $config_host_mak
2971 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
2973 if test "$brlapi" = "yes" ; then
2974 echo "CONFIG_BRLAPI=y" >> $config_host_mak
2976 if test "$bluez" = "yes" ; then
2977 echo "CONFIG_BLUEZ=y" >> $config_host_mak
2978 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
2980 if test "$xen" = "yes" ; then
2981 echo "CONFIG_XEN=y" >> $config_host_mak
2983 if test "$io_thread" = "yes" ; then
2984 echo "CONFIG_IOTHREAD=y" >> $config_host_mak
2986 if test "$linux_aio" = "yes" ; then
2987 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
2989 if test "$attr" = "yes" ; then
2990 echo "CONFIG_ATTR=y" >> $config_host_mak
2992 if test "$linux" = "yes" ; then
2993 if test "$attr" = "yes" ; then
2994 echo "CONFIG_VIRTFS=y" >> $config_host_mak
2997 if test "$blobs" = "yes" ; then
2998 echo "INSTALL_BLOBS=yes" >> $config_host_mak
3000 if test "$iovec" = "yes" ; then
3001 echo "CONFIG_IOVEC=y" >> $config_host_mak
3003 if test "$preadv" = "yes" ; then
3004 echo "CONFIG_PREADV=y" >> $config_host_mak
3006 if test "$fdt" = "yes" ; then
3007 echo "CONFIG_FDT=y" >> $config_host_mak
3009 if test "$signalfd" = "yes" ; then
3010 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
3012 if test "$need_offsetof" = "yes" ; then
3013 echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
3015 if test "$gcc_attribute_warn_unused_result" = "yes" ; then
3016 echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak
3018 if test "$fdatasync" = "yes" ; then
3019 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
3021 if test $cpu_emulation = "yes"; then
3022 echo "CONFIG_CPU_EMULATION=y" >> $config_host_mak
3023 else
3024 echo "CONFIG_NO_CPU_EMULATION=y" >> $config_host_mak
3026 if test "$madvise" = "yes" ; then
3027 echo "CONFIG_MADVISE=y" >> $config_host_mak
3029 if test "$posix_madvise" = "yes" ; then
3030 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
3033 if test "$spice" = "yes" ; then
3034 echo "CONFIG_SPICE=y" >> $config_host_mak
3037 if test "$smartcard" = "yes" ; then
3038 echo "CONFIG_SMARTCARD=y" >> $config_host_mak
3041 if test "$smartcard_nss" = "yes" ; then
3042 echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
3045 if test "$opengl" = "yes" ; then
3046 echo "CONFIG_OPENGL=y" >> $config_host_mak
3049 # XXX: suppress that
3050 if [ "$bsd" = "yes" ] ; then
3051 echo "CONFIG_BSD=y" >> $config_host_mak
3054 echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
3056 if test "$zero_malloc" = "yes" ; then
3057 echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
3059 if test "$rbd" = "yes" ; then
3060 echo "CONFIG_RBD=y" >> $config_host_mak
3063 # USB host support
3064 case "$usb" in
3065 linux)
3066 echo "HOST_USB=linux" >> $config_host_mak
3068 bsd)
3069 echo "HOST_USB=bsd" >> $config_host_mak
3072 echo "HOST_USB=stub" >> $config_host_mak
3074 esac
3076 echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
3077 if test "$trace_backend" = "simple"; then
3078 echo "CONFIG_SIMPLE_TRACE=y" >> $config_host_mak
3080 # Set the appropriate trace file.
3081 if test "$trace_backend" = "simple"; then
3082 trace_file="\"$trace_file-%u\""
3084 if test "$trace_backend" = "dtrace" -a "$trace_backend_stap" = "yes" ; then
3085 echo "CONFIG_SYSTEMTAP_TRACE=y" >> $config_host_mak
3087 echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
3089 echo "TOOLS=$tools" >> $config_host_mak
3090 echo "ROMS=$roms" >> $config_host_mak
3091 echo "MAKE=$make" >> $config_host_mak
3092 echo "INSTALL=$install" >> $config_host_mak
3093 echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak
3094 echo "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak
3095 echo "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak
3096 echo "CC=$cc" >> $config_host_mak
3097 echo "CC_I386=$cc_i386" >> $config_host_mak
3098 echo "HOST_CC=$host_cc" >> $config_host_mak
3099 echo "AR=$ar" >> $config_host_mak
3100 echo "OBJCOPY=$objcopy" >> $config_host_mak
3101 echo "LD=$ld" >> $config_host_mak
3102 echo "WINDRES=$windres" >> $config_host_mak
3103 echo "CFLAGS=$CFLAGS" >> $config_host_mak
3104 echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
3105 echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
3106 if test "$sparse" = "yes" ; then
3107 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
3108 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
3109 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
3111 echo "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
3112 echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
3113 echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
3114 echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
3115 echo "LIBS+=$LIBS" >> $config_host_mak
3116 echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
3117 echo "EXESUF=$EXESUF" >> $config_host_mak
3119 # generate list of library paths for linker script
3121 $ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
3123 if test -f ${config_host_ld}~ ; then
3124 if cmp -s $config_host_ld ${config_host_ld}~ ; then
3125 mv ${config_host_ld}~ $config_host_ld
3126 else
3127 rm ${config_host_ld}~
3131 for d in libdis libdis-user; do
3132 mkdir -p $d
3133 symlink $source_path/Makefile.dis $d/Makefile
3134 echo > $d/config.mak
3135 done
3136 if test "$static" = "no" -a "$user_pie" = "yes" ; then
3137 echo "QEMU_CFLAGS+=-fpie" > libdis-user/config.mak
3140 for target in $target_list; do
3141 target_dir="$target"
3142 config_target_mak=$target_dir/config-target.mak
3143 target_arch2=`echo $target | cut -d '-' -f 1`
3144 target_bigendian="no"
3146 case "$target_arch2" in
3147 armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus)
3148 target_bigendian=yes
3150 esac
3151 target_softmmu="no"
3152 target_user_only="no"
3153 target_linux_user="no"
3154 target_darwin_user="no"
3155 target_bsd_user="no"
3156 case "$target" in
3157 ${target_arch2}-softmmu)
3158 target_softmmu="yes"
3160 ${target_arch2}-linux-user)
3161 if test "$linux" != "yes" ; then
3162 echo "ERROR: Target '$target' is only available on a Linux host"
3163 exit 1
3165 target_user_only="yes"
3166 target_linux_user="yes"
3168 ${target_arch2}-darwin-user)
3169 if test "$darwin" != "yes" ; then
3170 echo "ERROR: Target '$target' is only available on a Darwin host"
3171 exit 1
3173 target_user_only="yes"
3174 target_darwin_user="yes"
3176 ${target_arch2}-bsd-user)
3177 if test "$bsd" != "yes" ; then
3178 echo "ERROR: Target '$target' is only available on a BSD host"
3179 exit 1
3181 target_user_only="yes"
3182 target_bsd_user="yes"
3185 echo "ERROR: Target '$target' not recognised"
3186 exit 1
3188 esac
3190 mkdir -p $target_dir
3191 mkdir -p $target_dir/fpu
3192 mkdir -p $target_dir/tcg
3193 mkdir -p $target_dir/ide
3194 mkdir -p $target_dir/9pfs
3195 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
3196 mkdir -p $target_dir/nwfpe
3198 symlink $source_path/Makefile.target $target_dir/Makefile
3201 echo "# Automatically generated by configure - do not modify" > $config_target_mak
3203 bflt="no"
3204 target_nptl="no"
3205 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
3206 echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
3207 gdb_xml_files=""
3208 target_short_alignment=2
3209 target_int_alignment=4
3210 target_long_alignment=4
3211 target_llong_alignment=8
3212 target_libs_softmmu=
3214 TARGET_ARCH="$target_arch2"
3215 TARGET_BASE_ARCH=""
3216 TARGET_ABI_DIR=""
3218 case "$target_arch2" in
3219 i386)
3220 target_phys_bits=64
3222 x86_64)
3223 TARGET_BASE_ARCH=i386
3224 target_phys_bits=64
3225 target_long_alignment=8
3227 ia64)
3228 target_phys_bits=64
3230 alpha)
3231 target_phys_bits=64
3232 target_long_alignment=8
3233 target_nptl="yes"
3235 arm|armeb)
3236 TARGET_ARCH=arm
3237 bflt="yes"
3238 target_nptl="yes"
3239 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
3240 target_phys_bits=32
3241 target_llong_alignment=4
3243 cris)
3244 target_nptl="yes"
3245 target_phys_bits=32
3247 lm32)
3248 target_phys_bits=32
3249 target_libs_softmmu="$opengl_libs"
3251 m68k)
3252 bflt="yes"
3253 gdb_xml_files="cf-core.xml cf-fp.xml"
3254 target_phys_bits=32
3255 target_int_alignment=2
3256 target_long_alignment=2
3257 target_llong_alignment=2
3259 microblaze|microblazeel)
3260 TARGET_ARCH=microblaze
3261 bflt="yes"
3262 target_nptl="yes"
3263 target_phys_bits=32
3264 target_libs_softmmu="$fdt_libs"
3266 mips|mipsel)
3267 TARGET_ARCH=mips
3268 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
3269 target_nptl="yes"
3270 target_phys_bits=64
3272 mipsn32|mipsn32el)
3273 TARGET_ARCH=mipsn32
3274 TARGET_BASE_ARCH=mips
3275 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
3276 target_phys_bits=64
3278 mips64|mips64el)
3279 TARGET_ARCH=mips64
3280 TARGET_BASE_ARCH=mips
3281 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
3282 target_phys_bits=64
3283 target_long_alignment=8
3285 ppc)
3286 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
3287 target_phys_bits=32
3288 target_nptl="yes"
3289 target_libs_softmmu="$fdt_libs"
3291 ppcemb)
3292 TARGET_BASE_ARCH=ppc
3293 TARGET_ABI_DIR=ppc
3294 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
3295 target_phys_bits=64
3296 target_nptl="yes"
3297 target_libs_softmmu="$fdt_libs"
3299 ppc64)
3300 TARGET_BASE_ARCH=ppc
3301 TARGET_ABI_DIR=ppc
3302 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
3303 target_phys_bits=64
3304 target_long_alignment=8
3305 target_libs_softmmu="$fdt_libs"
3307 ppc64abi32)
3308 TARGET_ARCH=ppc64
3309 TARGET_BASE_ARCH=ppc
3310 TARGET_ABI_DIR=ppc
3311 echo "TARGET_ABI32=y" >> $config_target_mak
3312 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
3313 target_phys_bits=64
3314 target_libs_softmmu="$fdt_libs"
3316 sh4|sh4eb)
3317 TARGET_ARCH=sh4
3318 bflt="yes"
3319 target_nptl="yes"
3320 target_phys_bits=32
3322 sparc)
3323 target_phys_bits=64
3325 sparc64)
3326 TARGET_BASE_ARCH=sparc
3327 target_phys_bits=64
3328 target_long_alignment=8
3330 sparc32plus)
3331 TARGET_ARCH=sparc64
3332 TARGET_BASE_ARCH=sparc
3333 TARGET_ABI_DIR=sparc
3334 echo "TARGET_ABI32=y" >> $config_target_mak
3335 target_phys_bits=64
3337 s390x)
3338 target_nptl="yes"
3339 target_phys_bits=64
3340 target_long_alignment=8
3342 unicore32)
3343 target_phys_bits=32
3346 echo "Unsupported target CPU"
3347 exit 1
3349 esac
3350 echo "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak
3351 echo "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak
3352 echo "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak
3353 echo "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak
3354 echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
3355 target_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
3356 echo "TARGET_$target_arch_name=y" >> $config_target_mak
3357 echo "TARGET_ARCH2=$target_arch2" >> $config_target_mak
3358 # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
3359 if [ "$TARGET_BASE_ARCH" = "" ]; then
3360 TARGET_BASE_ARCH=$TARGET_ARCH
3362 echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
3363 if [ "$TARGET_ABI_DIR" = "" ]; then
3364 TARGET_ABI_DIR=$TARGET_ARCH
3366 echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
3367 case "$target_arch2" in
3368 i386|x86_64)
3369 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
3370 echo "CONFIG_XEN=y" >> $config_target_mak
3372 esac
3373 case "$target_arch2" in
3374 i386|x86_64|ppcemb|ppc|ppc64|s390x)
3375 # Make sure the target and host cpus are compatible
3376 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
3377 \( "$target_arch2" = "$cpu" -o \
3378 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
3379 \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \
3380 \( "$target_arch2" = "ppc" -a "$cpu" = "ppc64" \) -o \
3381 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
3382 \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \
3383 \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then
3384 echo "CONFIG_KVM=y" >> $config_target_mak
3385 echo "KVM_CFLAGS=$kvm_cflags" >> $config_target_mak
3386 if test "$kvm_para" = "yes"; then
3387 echo "CONFIG_KVM_PARA=y" >> $config_target_mak
3389 if test $kvm_cap_pit = "yes" ; then
3390 echo "CONFIG_KVM_PIT=y" >> $config_target_mak
3392 if test $kvm_cap_device_assignment = "yes" ; then
3393 echo "CONFIG_KVM_DEVICE_ASSIGNMENT=y" >> $config_target_mak
3395 if test $vhost_net = "yes" ; then
3396 echo "CONFIG_VHOST_NET=y" >> $config_target_mak
3399 esac
3400 if test "$target_bigendian" = "yes" ; then
3401 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
3403 if test "$target_softmmu" = "yes" ; then
3404 echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
3405 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
3406 echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak
3407 echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
3408 echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
3410 if test "$target_user_only" = "yes" ; then
3411 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
3413 if test "$target_linux_user" = "yes" ; then
3414 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
3416 if test "$target_darwin_user" = "yes" ; then
3417 echo "CONFIG_DARWIN_USER=y" >> $config_target_mak
3419 if test "$smartcard_nss" = "yes" ; then
3420 echo "subdir-$target: subdir-libcacard" >> $config_host_mak
3421 echo "libcacard_libs=$libcacard_libs" >> $config_host_mak
3422 echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
3424 list=""
3425 if test ! -z "$gdb_xml_files" ; then
3426 for x in $gdb_xml_files; do
3427 list="$list $source_path/gdb-xml/$x"
3428 done
3429 echo "TARGET_XML_FILES=$list" >> $config_target_mak
3432 echo "CONFIG_SOFTFLOAT=y" >> $config_target_mak
3434 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
3435 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
3437 if test "$target_user_only" = "yes" \
3438 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
3439 echo "CONFIG_USE_NPTL=y" >> $config_target_mak
3441 if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
3442 echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
3444 if test "$target_bsd_user" = "yes" ; then
3445 echo "CONFIG_BSD_USER=y" >> $config_target_mak
3448 # generate QEMU_CFLAGS/LDFLAGS for targets
3450 cflags=""
3451 includes=""
3452 ldflags=""
3454 if test "$ARCH" = "sparc64" ; then
3455 includes="-I\$(SRC_PATH)/tcg/sparc $includes"
3456 elif test "$ARCH" = "s390x" ; then
3457 includes="-I\$(SRC_PATH)/tcg/s390 $includes"
3458 elif test "$ARCH" = "x86_64" ; then
3459 includes="-I\$(SRC_PATH)/tcg/i386 $includes"
3460 else
3461 includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes"
3463 includes="-I\$(SRC_PATH)/tcg $includes"
3464 includes="-I\$(SRC_PATH)/fpu $includes"
3466 if test "$target_user_only" = "yes" ; then
3467 libdis_config_mak=libdis-user/config.mak
3468 else
3469 libdis_config_mak=libdis/config.mak
3472 for i in $ARCH $TARGET_BASE_ARCH ; do
3473 case "$i" in
3474 alpha)
3475 echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
3476 echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak
3478 arm)
3479 echo "CONFIG_ARM_DIS=y" >> $config_target_mak
3480 echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak
3482 cris)
3483 echo "CONFIG_CRIS_DIS=y" >> $config_target_mak
3484 echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak
3486 hppa)
3487 echo "CONFIG_HPPA_DIS=y" >> $config_target_mak
3488 echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak
3490 i386|x86_64)
3491 echo "CONFIG_I386_DIS=y" >> $config_target_mak
3492 echo "CONFIG_I386_DIS=y" >> $libdis_config_mak
3494 ia64*)
3495 echo "CONFIG_IA64_DIS=y" >> $config_target_mak
3496 echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak
3498 m68k)
3499 echo "CONFIG_M68K_DIS=y" >> $config_target_mak
3500 echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak
3502 microblaze*)
3503 echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak
3504 echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak
3506 mips*)
3507 echo "CONFIG_MIPS_DIS=y" >> $config_target_mak
3508 echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak
3510 ppc*)
3511 echo "CONFIG_PPC_DIS=y" >> $config_target_mak
3512 echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak
3514 s390*)
3515 echo "CONFIG_S390_DIS=y" >> $config_target_mak
3516 echo "CONFIG_S390_DIS=y" >> $libdis_config_mak
3518 sh4)
3519 echo "CONFIG_SH4_DIS=y" >> $config_target_mak
3520 echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak
3522 sparc*)
3523 echo "CONFIG_SPARC_DIS=y" >> $config_target_mak
3524 echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak
3526 esac
3527 done
3529 case "$ARCH" in
3530 alpha)
3531 # Ensure there's only a single GP
3532 cflags="-msmall-data $cflags"
3534 esac
3536 if test "$target_softmmu" = "yes" ; then
3537 case "$TARGET_BASE_ARCH" in
3538 arm)
3539 cflags="-DHAS_AUDIO $cflags"
3541 lm32)
3542 cflags="-DHAS_AUDIO $cflags"
3544 i386|mips|ppc)
3545 cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
3547 esac
3550 if test "$target_user_only" = "yes" -a "$static" = "no" -a \
3551 "$user_pie" = "yes" ; then
3552 cflags="-fpie $cflags"
3553 ldflags="-pie $ldflags"
3556 if test "$target_softmmu" = "yes" -a \( \
3557 "$TARGET_ARCH" = "microblaze" -o \
3558 "$TARGET_ARCH" = "cris" \) ; then
3559 echo "CONFIG_NEED_MMU=y" >> $config_target_mak
3562 if test "$gprof" = "yes" ; then
3563 echo "TARGET_GPROF=yes" >> $config_target_mak
3564 if test "$target_linux_user" = "yes" ; then
3565 cflags="-p $cflags"
3566 ldflags="-p $ldflags"
3568 if test "$target_softmmu" = "yes" ; then
3569 ldflags="-p $ldflags"
3570 echo "GPROF_CFLAGS=-p" >> $config_target_mak
3574 linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
3575 if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
3576 case "$ARCH" in
3577 sparc)
3578 # -static is used to avoid g1/g3 usage by the dynamic linker
3579 ldflags="$linker_script -static $ldflags"
3581 alpha | s390x)
3582 # The default placement of the application is fine.
3585 ldflags="$linker_script $ldflags"
3587 esac
3590 echo "LDFLAGS+=$ldflags" >> $config_target_mak
3591 echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
3592 echo "QEMU_INCLUDES+=$includes" >> $config_target_mak
3594 done # for target in $targets
3596 # build tree in object directory in case the source is not in the current directory
3597 DIRS="tests tests/cris slirp audio block net pc-bios/optionrom"
3598 DIRS="$DIRS roms/seabios roms/vgabios"
3599 DIRS="$DIRS fsdev ui"
3600 FILES="Makefile tests/Makefile"
3601 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
3602 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
3603 FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
3604 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
3605 FILES="$FILES pc-bios/`basename $bios_file`"
3606 done
3607 mkdir -p $DIRS
3608 for f in $FILES ; do
3609 test -e $f || symlink $source_path/$f $f
3610 done
3612 # temporary config to build submodules
3613 for rom in seabios vgabios; do
3614 config_mak=roms/$rom/config.mak
3615 echo "# Automatically generated by configure - do not modify" > $config_mak
3616 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
3617 echo "CC=$cc" >> $config_mak
3618 echo "BCC=bcc" >> $config_mak
3619 echo "CPP=${cross_prefix}cpp" >> $config_mak
3620 echo "OBJCOPY=objcopy" >> $config_mak
3621 echo "IASL=iasl" >> $config_mak
3622 echo "LD=$ld" >> $config_mak
3623 done
3625 for hwlib in 32 64; do
3626 d=libhw$hwlib
3627 mkdir -p $d
3628 mkdir -p $d/ide
3629 symlink $source_path/Makefile.hw $d/Makefile
3630 mkdir -p $d/9pfs
3631 echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
3632 done
3634 if [ "$source_path" != `pwd` ]; then
3635 # out of tree build
3636 mkdir -p libcacard
3637 rm -f libcacard/Makefile
3638 ln -s "$source_path/libcacard/Makefile" libcacard/Makefile
3641 d=libuser
3642 mkdir -p $d
3643 symlink $source_path/Makefile.user $d/Makefile
3644 if test "$static" = "no" -a "$user_pie" = "yes" ; then
3645 echo "QEMU_CFLAGS+=-fpie" > $d/config.mak
3648 if test "$docs" = "yes" ; then
3649 mkdir -p QMP