add sgabios blob and submodule
[qemu.git] / configure
blob9e5da449c5f4b15f2638eb83ea0ad7d6ffe9c9dc
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
95 libs_qga=""
97 target_list=""
99 # Default value for a variable defining feature "foo".
100 # * foo="no" feature will only be used if --enable-foo arg is given
101 # * foo="" feature will be searched for, and if found, will be used
102 # unless --disable-foo is given
103 # * foo="yes" this value will only be set by --enable-foo flag.
104 # feature will searched for,
105 # if not found, configure exits with error
107 # Always add --enable-foo and --disable-foo command line args.
108 # Distributions want to ensure that several features are compiled in, and it
109 # is impossible without a --enable-foo that exits if a feature is not found.
111 bluez=""
112 brlapi=""
113 curl=""
114 curses=""
115 docs=""
116 fdt=""
117 nptl=""
118 sdl=""
119 vnc="yes"
120 sparse="no"
121 uuid=""
122 vde=""
123 vnc_tls=""
124 vnc_sasl=""
125 vnc_jpeg=""
126 vnc_png=""
127 vnc_thread="no"
128 xen=""
129 xen_ctrl_version=""
130 linux_aio=""
131 attr=""
132 xfs=""
134 vhost_net="no"
135 kvm="no"
136 gprof="no"
137 debug_tcg="no"
138 debug_mon="no"
139 debug="no"
140 strip_opt="yes"
141 tcg_interpreter="no"
142 bigendian="no"
143 mingw32="no"
144 EXESUF=""
145 prefix="/usr/local"
146 mandir="\${prefix}/share/man"
147 datadir="\${prefix}/share/qemu"
148 docdir="\${prefix}/share/doc/qemu"
149 bindir="\${prefix}/bin"
150 libdir="\${prefix}/lib"
151 includedir="\${prefix}/include"
152 sysconfdir="\${prefix}/etc"
153 confsuffix="/qemu"
154 slirp="yes"
155 fmod_lib=""
156 fmod_inc=""
157 oss_lib=""
158 bsd="no"
159 linux="no"
160 solaris="no"
161 profiler="no"
162 cocoa="no"
163 softmmu="yes"
164 linux_user="no"
165 darwin_user="no"
166 bsd_user="no"
167 guest_base=""
168 uname_release=""
169 mixemu="no"
170 aix="no"
171 blobs="yes"
172 pkgversion=""
173 check_utests=""
174 user_pie="no"
175 zero_malloc=""
176 trace_backend="nop"
177 trace_file="trace"
178 spice=""
179 rbd=""
180 smartcard=""
181 smartcard_nss=""
182 usb_redir=""
183 opengl=""
184 zlib="yes"
185 guest_agent="yes"
186 libiscsi=""
188 # parse CC options first
189 for opt do
190 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
191 case "$opt" in
192 --cross-prefix=*) cross_prefix="$optarg"
194 --cc=*) CC="$optarg"
196 --source-path=*) source_path="$optarg"
198 --cpu=*) cpu="$optarg"
200 --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
202 --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
204 --sparc_cpu=*)
205 sparc_cpu="$optarg"
206 case $sparc_cpu in
207 v7|v8|v8plus|v8plusa)
208 cpu="sparc"
211 cpu="sparc64"
214 echo "undefined SPARC architecture. Exiting";
215 exit 1
217 esac
219 esac
220 done
221 # OS specific
222 # Using uname is really, really broken. Once we have the right set of checks
223 # we can eliminate it's usage altogether
225 cc="${CC-${cross_prefix}gcc}"
226 ar="${AR-${cross_prefix}ar}"
227 objcopy="${OBJCOPY-${cross_prefix}objcopy}"
228 ld="${LD-${cross_prefix}ld}"
229 libtool="${LIBTOOL-${cross_prefix}libtool}"
230 strip="${STRIP-${cross_prefix}strip}"
231 windres="${WINDRES-${cross_prefix}windres}"
232 pkg_config="${PKG_CONFIG-${cross_prefix}pkg-config}"
233 sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
235 # default flags for all hosts
236 QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
237 CFLAGS="-g $CFLAGS"
238 QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
239 QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
240 QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
241 QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
242 QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/fpu"
243 LDFLAGS="-g $LDFLAGS"
245 # make source path absolute
246 source_path=`cd "$source_path"; pwd`
248 check_define() {
249 cat > $TMPC <<EOF
250 #if !defined($1)
251 #error Not defined
252 #endif
253 int main(void) { return 0; }
255 compile_object
258 if test ! -z "$cpu" ; then
259 # command line argument
261 elif check_define __i386__ ; then
262 cpu="i386"
263 elif check_define __x86_64__ ; then
264 cpu="x86_64"
265 elif check_define __sparc__ ; then
266 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
267 # They must be specified using --sparc_cpu
268 if check_define __arch64__ ; then
269 cpu="sparc64"
270 else
271 cpu="sparc"
273 elif check_define _ARCH_PPC ; then
274 if check_define _ARCH_PPC64 ; then
275 cpu="ppc64"
276 else
277 cpu="ppc"
279 elif check_define __mips__ ; then
280 cpu="mips"
281 elif check_define __ia64__ ; then
282 cpu="ia64"
283 elif check_define __s390__ ; then
284 if check_define __s390x__ ; then
285 cpu="s390x"
286 else
287 cpu="s390"
289 elif check_define __ARMEB__ ; then
290 cpu="armv4b"
291 elif check_define __ARMEL__ ; then
292 cpu="armv4l"
293 elif check_define __hppa__ ; then
294 cpu="hppa"
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 hppa|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 smbd="${SMBD-/usr/sfw/sbin/smbd}"
424 needs_libsunmath="no"
425 solarisrev=`uname -r | cut -f2 -d.`
426 # have to select again, because `uname -m` returns i86pc
427 # even on an x86_64 box.
428 solariscpu=`isainfo -k`
429 if test "${solariscpu}" = "amd64" ; then
430 cpu="x86_64"
432 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
433 if test "$solarisrev" -le 9 ; then
434 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
435 needs_libsunmath="yes"
436 QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
437 LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
438 LIBS="-lsunmath $LIBS"
439 else
440 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
441 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
442 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
443 echo "Studio 11 can be downloaded from www.sun.com."
444 exit 1
448 if test -f /usr/include/sys/soundcard.h ; then
449 audio_drv_list="oss"
451 audio_possible_drivers="oss sdl"
452 # needed for CMSG_ macros in sys/socket.h
453 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
454 # needed for TIOCWIN* defines in termios.h
455 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
456 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
457 LIBS="-lsocket -lnsl -lresolv $LIBS"
459 AIX)
460 aix="yes"
461 make="${MAKE-gmake}"
463 Haiku)
464 haiku="yes"
465 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
466 LIBS="-lposix_error_mapper -lnetwork $LIBS"
469 audio_drv_list="oss"
470 audio_possible_drivers="oss alsa sdl esd pa"
471 linux="yes"
472 linux_user="yes"
473 usb="linux"
474 kvm="yes"
475 vhost_net="yes"
476 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
477 audio_possible_drivers="$audio_possible_drivers fmod"
480 esac
482 if [ "$bsd" = "yes" ] ; then
483 if [ "$darwin" != "yes" ] ; then
484 usb="bsd"
486 bsd_user="yes"
489 : ${make=${MAKE-make}}
490 : ${install=${INSTALL-install}}
491 : ${python=${PYTHON-python}}
492 : ${smbd=${SMBD-/usr/sbin/smbd}}
494 if test "$mingw32" = "yes" ; then
495 EXESUF=".exe"
496 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
497 # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
498 QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
499 LIBS="-lwinmm -lws2_32 -liberty -liphlpapi $LIBS"
500 prefix="c:/Program Files/Qemu"
501 mandir="\${prefix}"
502 datadir="\${prefix}"
503 docdir="\${prefix}"
504 bindir="\${prefix}"
505 sysconfdir="\${prefix}"
506 confsuffix=""
507 guest_agent="no"
510 werror=""
512 for opt do
513 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
514 case "$opt" in
515 --help|-h) show_help=yes
517 --version|-V) exec cat $source_path/VERSION
519 --prefix=*) prefix="$optarg"
521 --interp-prefix=*) interp_prefix="$optarg"
523 --source-path=*)
525 --cross-prefix=*)
527 --cc=*)
529 --host-cc=*) host_cc="$optarg"
531 --make=*) make="$optarg"
533 --install=*) install="$optarg"
535 --python=*) python="$optarg"
537 --smbd=*) smbd="$optarg"
539 --extra-cflags=*)
541 --extra-ldflags=*)
543 --cpu=*)
545 --target-list=*) target_list="$optarg"
547 --enable-trace-backend=*) trace_backend="$optarg"
549 --with-trace-file=*) trace_file="$optarg"
551 --enable-gprof) gprof="yes"
553 --static)
554 static="yes"
555 LDFLAGS="-static $LDFLAGS"
557 --mandir=*) mandir="$optarg"
559 --bindir=*) bindir="$optarg"
561 --libdir=*) libdir="$optarg"
563 --includedir=*) includedir="$optarg"
565 --datadir=*) datadir="$optarg"
567 --docdir=*) docdir="$optarg"
569 --sysconfdir=*) sysconfdir="$optarg"
571 --disable-sdl) sdl="no"
573 --enable-sdl) sdl="yes"
575 --disable-vnc) vnc="no"
577 --enable-vnc) vnc="yes"
579 --fmod-lib=*) fmod_lib="$optarg"
581 --fmod-inc=*) fmod_inc="$optarg"
583 --oss-lib=*) oss_lib="$optarg"
585 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
587 --audio-drv-list=*) audio_drv_list="$optarg"
589 --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
591 --enable-debug-tcg) debug_tcg="yes"
593 --disable-debug-tcg) debug_tcg="no"
595 --enable-debug-mon) debug_mon="yes"
597 --disable-debug-mon) debug_mon="no"
599 --enable-debug)
600 # Enable debugging options that aren't excessively noisy
601 debug_tcg="yes"
602 debug_mon="yes"
603 debug="yes"
604 strip_opt="no"
606 --enable-sparse) sparse="yes"
608 --disable-sparse) sparse="no"
610 --disable-strip) strip_opt="no"
612 --disable-vnc-tls) vnc_tls="no"
614 --enable-vnc-tls) vnc_tls="yes"
616 --disable-vnc-sasl) vnc_sasl="no"
618 --enable-vnc-sasl) vnc_sasl="yes"
620 --disable-vnc-jpeg) vnc_jpeg="no"
622 --enable-vnc-jpeg) vnc_jpeg="yes"
624 --disable-vnc-png) vnc_png="no"
626 --enable-vnc-png) vnc_png="yes"
628 --disable-vnc-thread) vnc_thread="no"
630 --enable-vnc-thread) vnc_thread="yes"
632 --disable-slirp) slirp="no"
634 --disable-uuid) uuid="no"
636 --enable-uuid) uuid="yes"
638 --disable-vde) vde="no"
640 --enable-vde) vde="yes"
642 --disable-xen) xen="no"
644 --enable-xen) xen="yes"
646 --disable-brlapi) brlapi="no"
648 --enable-brlapi) brlapi="yes"
650 --disable-bluez) bluez="no"
652 --enable-bluez) bluez="yes"
654 --disable-kvm) kvm="no"
656 --enable-kvm) kvm="yes"
658 --disable-tcg-interpreter) tcg_interpreter="no"
660 --enable-tcg-interpreter) tcg_interpreter="yes"
662 --disable-spice) spice="no"
664 --enable-spice) spice="yes"
666 --disable-libiscsi) libiscsi="no"
668 --enable-libiscsi) libiscsi="yes"
670 --enable-profiler) profiler="yes"
672 --enable-cocoa)
673 cocoa="yes" ;
674 sdl="no" ;
675 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
677 --disable-system) softmmu="no"
679 --enable-system) softmmu="yes"
681 --disable-user)
682 linux_user="no" ;
683 bsd_user="no" ;
684 darwin_user="no"
686 --enable-user) ;;
687 --disable-linux-user) linux_user="no"
689 --enable-linux-user) linux_user="yes"
691 --disable-darwin-user) darwin_user="no"
693 --enable-darwin-user) darwin_user="yes"
695 --disable-bsd-user) bsd_user="no"
697 --enable-bsd-user) bsd_user="yes"
699 --enable-guest-base) guest_base="yes"
701 --disable-guest-base) guest_base="no"
703 --enable-user-pie) user_pie="yes"
705 --disable-user-pie) user_pie="no"
707 --enable-uname-release=*) uname_release="$optarg"
709 --sparc_cpu=*)
711 --enable-werror) werror="yes"
713 --disable-werror) werror="no"
715 --disable-curses) curses="no"
717 --enable-curses) curses="yes"
719 --disable-curl) curl="no"
721 --enable-curl) curl="yes"
723 --disable-fdt) fdt="no"
725 --enable-fdt) fdt="yes"
727 --disable-check-utests) check_utests="no"
729 --enable-check-utests) check_utests="yes"
731 --disable-nptl) nptl="no"
733 --enable-nptl) nptl="yes"
735 --enable-mixemu) mixemu="yes"
737 --disable-linux-aio) linux_aio="no"
739 --enable-linux-aio) linux_aio="yes"
741 --disable-attr) attr="no"
743 --enable-attr) attr="yes"
745 --disable-blobs) blobs="no"
747 --with-pkgversion=*) pkgversion=" ($optarg)"
749 --disable-docs) docs="no"
751 --enable-docs) docs="yes"
753 --disable-vhost-net) vhost_net="no"
755 --enable-vhost-net) vhost_net="yes"
757 --disable-opengl) opengl="no"
759 --enable-opengl) opengl="yes"
761 --*dir)
763 --disable-rbd) rbd="no"
765 --enable-rbd) rbd="yes"
767 --disable-smartcard) smartcard="no"
769 --enable-smartcard) smartcard="yes"
771 --disable-smartcard-nss) smartcard_nss="no"
773 --enable-smartcard-nss) smartcard_nss="yes"
775 --disable-usb-redir) usb_redir="no"
777 --enable-usb-redir) usb_redir="yes"
779 --disable-zlib-test) zlib="no"
781 --enable-guest-agent) guest_agent="yes"
783 --disable-guest-agent) guest_agent="no"
785 *) echo "ERROR: unknown option $opt"; show_help="yes"
787 esac
788 done
791 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
792 # QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
794 host_guest_base="no"
795 case "$cpu" in
796 sparc) case $sparc_cpu in
797 v7|v8)
798 QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
800 v8plus|v8plusa)
801 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
803 *) # sparc_cpu not defined in the command line
804 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
805 esac
806 LDFLAGS="-m32 $LDFLAGS"
807 QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
808 if test "$solaris" = "no" ; then
809 QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
810 helper_cflags="-ffixed-i0"
813 sparc64)
814 QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
815 LDFLAGS="-m64 $LDFLAGS"
816 QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
817 if test "$solaris" != "no" ; then
818 QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
821 s390)
822 QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS"
823 LDFLAGS="-m31 $LDFLAGS"
824 host_guest_base="yes"
826 s390x)
827 QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS"
828 LDFLAGS="-m64 $LDFLAGS"
829 host_guest_base="yes"
831 i386)
832 QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
833 LDFLAGS="-m32 $LDFLAGS"
834 cc_i386='$(CC) -m32'
835 helper_cflags="-fomit-frame-pointer"
836 host_guest_base="yes"
838 x86_64)
839 QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
840 LDFLAGS="-m64 $LDFLAGS"
841 cc_i386='$(CC) -m32'
842 host_guest_base="yes"
844 arm*)
845 host_guest_base="yes"
847 ppc*)
848 host_guest_base="yes"
850 mips*)
851 host_guest_base="yes"
853 ia64*)
854 host_guest_base="yes"
856 hppa*)
857 host_guest_base="yes"
859 unicore32*)
860 host_guest_base="yes"
862 esac
864 [ -z "$guest_base" ] && guest_base="$host_guest_base"
867 default_target_list=""
869 # these targets are portable
870 if [ "$softmmu" = "yes" ] ; then
871 default_target_list="\
872 i386-softmmu \
873 x86_64-softmmu \
874 alpha-softmmu \
875 arm-softmmu \
876 cris-softmmu \
877 lm32-softmmu \
878 m68k-softmmu \
879 microblaze-softmmu \
880 microblazeel-softmmu \
881 mips-softmmu \
882 mipsel-softmmu \
883 mips64-softmmu \
884 mips64el-softmmu \
885 ppc-softmmu \
886 ppcemb-softmmu \
887 ppc64-softmmu \
888 sh4-softmmu \
889 sh4eb-softmmu \
890 sparc-softmmu \
891 sparc64-softmmu \
892 s390x-softmmu \
893 xtensa-softmmu \
894 xtensaeb-softmmu \
897 # the following are Linux specific
898 if [ "$linux_user" = "yes" ] ; then
899 default_target_list="${default_target_list}\
900 i386-linux-user \
901 x86_64-linux-user \
902 alpha-linux-user \
903 arm-linux-user \
904 armeb-linux-user \
905 cris-linux-user \
906 m68k-linux-user \
907 microblaze-linux-user \
908 microblazeel-linux-user \
909 mips-linux-user \
910 mipsel-linux-user \
911 ppc-linux-user \
912 ppc64-linux-user \
913 ppc64abi32-linux-user \
914 sh4-linux-user \
915 sh4eb-linux-user \
916 sparc-linux-user \
917 sparc64-linux-user \
918 sparc32plus-linux-user \
919 unicore32-linux-user \
920 s390x-linux-user \
923 # the following are Darwin specific
924 if [ "$darwin_user" = "yes" ] ; then
925 default_target_list="$default_target_list i386-darwin-user ppc-darwin-user "
927 # the following are BSD specific
928 if [ "$bsd_user" = "yes" ] ; then
929 default_target_list="${default_target_list}\
930 i386-bsd-user \
931 x86_64-bsd-user \
932 sparc-bsd-user \
933 sparc64-bsd-user \
937 if test x"$show_help" = x"yes" ; then
938 cat << EOF
940 Usage: configure [options]
941 Options: [defaults in brackets after descriptions]
944 echo "Standard options:"
945 echo " --help print this message"
946 echo " --prefix=PREFIX install in PREFIX [$prefix]"
947 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
948 echo " use %M for cpu name [$interp_prefix]"
949 echo " --target-list=LIST set target list (default: build everything)"
950 echo "Available targets: $default_target_list" | \
951 fold -s -w 53 | sed -e 's/^/ /'
952 echo ""
953 echo "Advanced options (experts only):"
954 echo " --source-path=PATH path of source code [$source_path]"
955 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
956 echo " --cc=CC use C compiler CC [$cc]"
957 echo " --host-cc=CC use C compiler CC [$host_cc] for code run at"
958 echo " build time"
959 echo " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS"
960 echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS"
961 echo " --make=MAKE use specified make [$make]"
962 echo " --install=INSTALL use specified install [$install]"
963 echo " --python=PYTHON use specified python [$python]"
964 echo " --smbd=SMBD use specified smbd [$smbd]"
965 echo " --static enable static build [$static]"
966 echo " --mandir=PATH install man pages in PATH"
967 echo " --datadir=PATH install firmware in PATH"
968 echo " --docdir=PATH install documentation in PATH"
969 echo " --bindir=PATH install binaries in PATH"
970 echo " --sysconfdir=PATH install config in PATH/qemu"
971 echo " --enable-debug-tcg enable TCG debugging"
972 echo " --disable-debug-tcg disable TCG debugging (default)"
973 echo " --enable-debug enable common debug build options"
974 echo " --enable-sparse enable sparse checker"
975 echo " --disable-sparse disable sparse checker (default)"
976 echo " --disable-strip disable stripping binaries"
977 echo " --disable-werror disable compilation abort on warning"
978 echo " --disable-sdl disable SDL"
979 echo " --enable-sdl enable SDL"
980 echo " --disable-vnc disable VNC"
981 echo " --enable-vnc enable VNC"
982 echo " --enable-cocoa enable COCOA (Mac OS X only)"
983 echo " --audio-drv-list=LIST set audio drivers list:"
984 echo " Available drivers: $audio_possible_drivers"
985 echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
986 echo " Available cards: $audio_possible_cards"
987 echo " --block-drv-whitelist=L set block driver whitelist"
988 echo " (affects only QEMU, not qemu-img)"
989 echo " --enable-mixemu enable mixer emulation"
990 echo " --disable-xen disable xen backend driver support"
991 echo " --enable-xen enable xen backend driver support"
992 echo " --disable-brlapi disable BrlAPI"
993 echo " --enable-brlapi enable BrlAPI"
994 echo " --disable-vnc-tls disable TLS encryption for VNC server"
995 echo " --enable-vnc-tls enable TLS encryption for VNC server"
996 echo " --disable-vnc-sasl disable SASL encryption for VNC server"
997 echo " --enable-vnc-sasl enable SASL encryption for VNC server"
998 echo " --disable-vnc-jpeg disable JPEG lossy compression for VNC server"
999 echo " --enable-vnc-jpeg enable JPEG lossy compression for VNC server"
1000 echo " --disable-vnc-png disable PNG compression for VNC server (default)"
1001 echo " --enable-vnc-png enable PNG compression for VNC server"
1002 echo " --disable-vnc-thread disable threaded VNC server"
1003 echo " --enable-vnc-thread enable threaded VNC server"
1004 echo " --disable-curses disable curses output"
1005 echo " --enable-curses enable curses output"
1006 echo " --disable-curl disable curl connectivity"
1007 echo " --enable-curl enable curl connectivity"
1008 echo " --disable-fdt disable fdt device tree"
1009 echo " --enable-fdt enable fdt device tree"
1010 echo " --disable-check-utests disable check unit-tests"
1011 echo " --enable-check-utests enable check unit-tests"
1012 echo " --disable-bluez disable bluez stack connectivity"
1013 echo " --enable-bluez enable bluez stack connectivity"
1014 echo " --disable-slirp disable SLIRP userspace network connectivity"
1015 echo " --disable-kvm disable KVM acceleration support"
1016 echo " --enable-kvm enable KVM acceleration support"
1017 echo " --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)"
1018 echo " --disable-nptl disable usermode NPTL support"
1019 echo " --enable-nptl enable usermode NPTL support"
1020 echo " --enable-system enable all system emulation targets"
1021 echo " --disable-system disable all system emulation targets"
1022 echo " --enable-user enable supported user emulation targets"
1023 echo " --disable-user disable all user emulation targets"
1024 echo " --enable-linux-user enable all linux usermode emulation targets"
1025 echo " --disable-linux-user disable all linux usermode emulation targets"
1026 echo " --enable-darwin-user enable all darwin usermode emulation targets"
1027 echo " --disable-darwin-user disable all darwin usermode emulation targets"
1028 echo " --enable-bsd-user enable all BSD usermode emulation targets"
1029 echo " --disable-bsd-user disable all BSD usermode emulation targets"
1030 echo " --enable-guest-base enable GUEST_BASE support for usermode"
1031 echo " emulation targets"
1032 echo " --disable-guest-base disable GUEST_BASE support"
1033 echo " --enable-user-pie build usermode emulation targets as PIE"
1034 echo " --disable-user-pie do not build usermode emulation targets as PIE"
1035 echo " --fmod-lib path to FMOD library"
1036 echo " --fmod-inc path to FMOD includes"
1037 echo " --oss-lib path to OSS library"
1038 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
1039 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
1040 echo " --disable-uuid disable uuid support"
1041 echo " --enable-uuid enable uuid support"
1042 echo " --disable-vde disable support for vde network"
1043 echo " --enable-vde enable support for vde network"
1044 echo " --disable-linux-aio disable Linux AIO support"
1045 echo " --enable-linux-aio enable Linux AIO support"
1046 echo " --disable-attr disables attr and xattr support"
1047 echo " --enable-attr enable attr and xattr support"
1048 echo " --disable-blobs disable installing provided firmware blobs"
1049 echo " --enable-docs enable documentation build"
1050 echo " --disable-docs disable documentation build"
1051 echo " --disable-vhost-net disable vhost-net acceleration support"
1052 echo " --enable-vhost-net enable vhost-net acceleration support"
1053 echo " --enable-trace-backend=B Set trace backend"
1054 echo " Available backends:" $("$source_path"/scripts/tracetool --list-backends)
1055 echo " --with-trace-file=NAME Full PATH,NAME of file to store traces"
1056 echo " Default:trace-<pid>"
1057 echo " --disable-spice disable spice"
1058 echo " --enable-spice enable spice"
1059 echo " --enable-rbd enable building the rados block device (rbd)"
1060 echo " --disable-libiscsi disable iscsi support"
1061 echo " --enable-libiscsi enable iscsi support"
1062 echo " --disable-smartcard disable smartcard support"
1063 echo " --enable-smartcard enable smartcard support"
1064 echo " --disable-smartcard-nss disable smartcard nss support"
1065 echo " --enable-smartcard-nss enable smartcard nss support"
1066 echo " --disable-usb-redir disable usb network redirection support"
1067 echo " --enable-usb-redir enable usb network redirection support"
1068 echo " --disable-guest-agent disable building of the QEMU Guest Agent"
1069 echo " --enable-guest-agent enable building of the QEMU Guest Agent"
1070 echo ""
1071 echo "NOTE: The object files are built at the place where configure is launched"
1072 exit 1
1075 # check that the C compiler works.
1076 cat > $TMPC <<EOF
1077 int main(void) {}
1080 if compile_object ; then
1081 : C compiler works ok
1082 else
1083 echo "ERROR: \"$cc\" either does not exist or does not work"
1084 exit 1
1087 gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
1088 gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
1089 gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
1090 gcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags"
1091 cat > $TMPC << EOF
1092 int main(void) { return 0; }
1094 for flag in $gcc_flags; do
1095 if compile_prog "$flag -Werror" "" ; then
1096 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1098 done
1101 # Solaris specific configure tool chain decisions
1103 if test "$solaris" = "yes" ; then
1104 if has $install; then
1106 else
1107 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
1108 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
1109 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
1110 exit 1
1112 if test "`path_of $install`" = "/usr/sbin/install" ; then
1113 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
1114 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
1115 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
1116 exit 1
1118 if has ar; then
1120 else
1121 echo "Error: No path includes ar"
1122 if test -f /usr/ccs/bin/ar ; then
1123 echo "Add /usr/ccs/bin to your path and rerun configure"
1125 exit 1
1129 if test "$guest_agent" != "no" ; then
1130 if has $python; then
1132 else
1133 echo "Python not found. Use --python=/path/to/python"
1134 exit 1
1138 if test -z "$target_list" ; then
1139 target_list="$default_target_list"
1140 else
1141 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
1143 if test -z "$target_list" ; then
1144 echo "No targets enabled"
1145 exit 1
1147 # see if system emulation was really requested
1148 case " $target_list " in
1149 *"-softmmu "*) softmmu=yes
1151 *) softmmu=no
1153 esac
1155 feature_not_found() {
1156 feature=$1
1158 echo "ERROR"
1159 echo "ERROR: User requested feature $feature"
1160 echo "ERROR: configure was not able to find it"
1161 echo "ERROR"
1162 exit 1;
1165 if test -z "$cross_prefix" ; then
1167 # ---
1168 # big/little endian test
1169 cat > $TMPC << EOF
1170 #include <inttypes.h>
1171 int main(int argc, char ** argv){
1172 volatile uint32_t i=0x01234567;
1173 return (*((uint8_t*)(&i))) == 0x67;
1177 if compile_prog "" "" ; then
1178 $TMPE && bigendian="yes"
1179 else
1180 echo big/little test failed
1183 else
1185 # if cross compiling, cannot launch a program, so make a static guess
1186 case "$cpu" in
1187 armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
1188 bigendian=yes
1190 esac
1194 # host long bits test, actually a pointer size test
1195 cat > $TMPC << EOF
1196 int sizeof_pointer_is_8[sizeof(void *) == 8 ? 1 : -1];
1198 if compile_object; then
1199 hostlongbits=64
1200 else
1201 hostlongbits=32
1205 ##########################################
1206 # NPTL probe
1208 if test "$nptl" != "no" ; then
1209 cat > $TMPC <<EOF
1210 #include <sched.h>
1211 #include <linux/futex.h>
1212 void foo()
1214 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1215 #error bork
1216 #endif
1220 if compile_object ; then
1221 nptl=yes
1222 else
1223 if test "$nptl" = "yes" ; then
1224 feature_not_found "nptl"
1226 nptl=no
1230 ##########################################
1231 # zlib check
1233 if test "$zlib" != "no" ; then
1234 cat > $TMPC << EOF
1235 #include <zlib.h>
1236 int main(void) { zlibVersion(); return 0; }
1238 if compile_prog "" "-lz" ; then
1240 else
1241 echo
1242 echo "Error: zlib check failed"
1243 echo "Make sure to have the zlib libs and headers installed."
1244 echo
1245 exit 1
1249 ##########################################
1250 # xen probe
1252 if test "$xen" != "no" ; then
1253 xen_libs="-lxenstore -lxenctrl -lxenguest"
1255 # Xen unstable
1256 cat > $TMPC <<EOF
1257 #include <xenctrl.h>
1258 #include <xs.h>
1259 #include <stdint.h>
1260 #include <xen/hvm/hvm_info_table.h>
1261 #if !defined(HVM_MAX_VCPUS)
1262 # error HVM_MAX_VCPUS not defined
1263 #endif
1264 int main(void) {
1265 xc_interface *xc;
1266 xs_daemon_open();
1267 xc = xc_interface_open(0, 0, 0);
1268 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1269 xc_gnttab_open(NULL, 0);
1270 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1271 return 0;
1274 if compile_prog "" "$xen_libs" ; then
1275 xen_ctrl_version=410
1276 xen=yes
1278 # Xen 4.0.0
1279 elif (
1280 cat > $TMPC <<EOF
1281 #include <xenctrl.h>
1282 #include <xs.h>
1283 #include <stdint.h>
1284 #include <xen/hvm/hvm_info_table.h>
1285 #if !defined(HVM_MAX_VCPUS)
1286 # error HVM_MAX_VCPUS not defined
1287 #endif
1288 int main(void) {
1289 struct xen_add_to_physmap xatp = {
1290 .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1292 xs_daemon_open();
1293 xc_interface_open();
1294 xc_gnttab_open();
1295 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1296 xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1297 return 0;
1300 compile_prog "" "$xen_libs"
1301 ) ; then
1302 xen_ctrl_version=400
1303 xen=yes
1305 # Xen 3.4.0
1306 elif (
1307 cat > $TMPC <<EOF
1308 #include <xenctrl.h>
1309 #include <xs.h>
1310 int main(void) {
1311 struct xen_add_to_physmap xatp = {
1312 .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1314 xs_daemon_open();
1315 xc_interface_open();
1316 xc_gnttab_open();
1317 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1318 xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1319 return 0;
1322 compile_prog "" "$xen_libs"
1323 ) ; then
1324 xen_ctrl_version=340
1325 xen=yes
1327 # Xen 3.3.0
1328 elif (
1329 cat > $TMPC <<EOF
1330 #include <xenctrl.h>
1331 #include <xs.h>
1332 int main(void) {
1333 xs_daemon_open();
1334 xc_interface_open();
1335 xc_gnttab_open();
1336 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1337 return 0;
1340 compile_prog "" "$xen_libs"
1341 ) ; then
1342 xen_ctrl_version=330
1343 xen=yes
1345 # Xen not found or unsupported
1346 else
1347 if test "$xen" = "yes" ; then
1348 feature_not_found "xen"
1350 xen=no
1353 if test "$xen" = yes; then
1354 libs_softmmu="$xen_libs $libs_softmmu"
1358 ##########################################
1359 # pkg-config probe
1361 if ! has $pkg_config; then
1362 echo "Error: pkg-config binary '$pkg_config' not found"
1363 exit 1
1366 ##########################################
1367 # libtool probe
1369 if ! has $libtool; then
1370 libtool=
1373 ##########################################
1374 # Sparse probe
1375 if test "$sparse" != "no" ; then
1376 if has cgcc; then
1377 sparse=yes
1378 else
1379 if test "$sparse" = "yes" ; then
1380 feature_not_found "sparse"
1382 sparse=no
1386 ##########################################
1387 # SDL probe
1389 # Look for sdl configuration program (pkg-config or sdl-config). Try
1390 # sdl-config even without cross prefix, and favour pkg-config over sdl-config.
1391 if test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then
1392 sdl_config=sdl-config
1395 if $pkg_config sdl --modversion >/dev/null 2>&1; then
1396 sdlconfig="$pkg_config sdl"
1397 _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
1398 elif has ${sdl_config}; then
1399 sdlconfig="$sdl_config"
1400 _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1401 else
1402 if test "$sdl" = "yes" ; then
1403 feature_not_found "sdl"
1405 sdl=no
1407 if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
1408 echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
1411 sdl_too_old=no
1412 if test "$sdl" != "no" ; then
1413 cat > $TMPC << EOF
1414 #include <SDL.h>
1415 #undef main /* We don't want SDL to override our main() */
1416 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1418 sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
1419 if test "$static" = "yes" ; then
1420 sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
1421 else
1422 sdl_libs=`$sdlconfig --libs 2> /dev/null`
1424 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1425 if test "$_sdlversion" -lt 121 ; then
1426 sdl_too_old=yes
1427 else
1428 if test "$cocoa" = "no" ; then
1429 sdl=yes
1433 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
1434 if test "$sdl" = "yes" -a "$static" = "yes" ; then
1435 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
1436 sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1437 sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
1439 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1441 else
1442 sdl=no
1444 fi # static link
1445 else # sdl not found
1446 if test "$sdl" = "yes" ; then
1447 feature_not_found "sdl"
1449 sdl=no
1450 fi # sdl compile test
1453 if test "$sdl" = "yes" ; then
1454 cat > $TMPC <<EOF
1455 #include <SDL.h>
1456 #if defined(SDL_VIDEO_DRIVER_X11)
1457 #include <X11/XKBlib.h>
1458 #else
1459 #error No x11 support
1460 #endif
1461 int main(void) { return 0; }
1463 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1464 sdl_libs="$sdl_libs -lX11"
1466 if test "$mingw32" = "yes" ; then
1467 sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole"
1469 libs_softmmu="$sdl_libs $libs_softmmu"
1472 ##########################################
1473 # VNC TLS detection
1474 if test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then
1475 cat > $TMPC <<EOF
1476 #include <gnutls/gnutls.h>
1477 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1479 vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
1480 vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
1481 if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
1482 vnc_tls=yes
1483 libs_softmmu="$vnc_tls_libs $libs_softmmu"
1484 else
1485 if test "$vnc_tls" = "yes" ; then
1486 feature_not_found "vnc-tls"
1488 vnc_tls=no
1492 ##########################################
1493 # VNC SASL detection
1494 if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
1495 cat > $TMPC <<EOF
1496 #include <sasl/sasl.h>
1497 #include <stdio.h>
1498 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
1500 # Assuming Cyrus-SASL installed in /usr prefix
1501 vnc_sasl_cflags=""
1502 vnc_sasl_libs="-lsasl2"
1503 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1504 vnc_sasl=yes
1505 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
1506 else
1507 if test "$vnc_sasl" = "yes" ; then
1508 feature_not_found "vnc-sasl"
1510 vnc_sasl=no
1514 ##########################################
1515 # VNC JPEG detection
1516 if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
1517 cat > $TMPC <<EOF
1518 #include <stdio.h>
1519 #include <jpeglib.h>
1520 int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
1522 vnc_jpeg_cflags=""
1523 vnc_jpeg_libs="-ljpeg"
1524 if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
1525 vnc_jpeg=yes
1526 libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
1527 else
1528 if test "$vnc_jpeg" = "yes" ; then
1529 feature_not_found "vnc-jpeg"
1531 vnc_jpeg=no
1535 ##########################################
1536 # VNC PNG detection
1537 if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
1538 cat > $TMPC <<EOF
1539 //#include <stdio.h>
1540 #include <png.h>
1541 #include <stddef.h>
1542 int main(void) {
1543 png_structp png_ptr;
1544 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
1545 return 0;
1548 if $pkg_config libpng --modversion >/dev/null 2>&1; then
1549 vnc_png_cflags=`$pkg_config libpng --cflags 2> /dev/null`
1550 vnc_png_libs=`$pkg_config libpng --libs 2> /dev/null`
1551 else
1552 vnc_png_cflags=""
1553 vnc_png_libs="-lpng"
1555 if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
1556 vnc_png=yes
1557 libs_softmmu="$vnc_png_libs $libs_softmmu"
1558 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
1559 else
1560 if test "$vnc_png" = "yes" ; then
1561 feature_not_found "vnc-png"
1563 vnc_png=no
1567 ##########################################
1568 # fnmatch() probe, used for ACL routines
1569 fnmatch="no"
1570 cat > $TMPC << EOF
1571 #include <fnmatch.h>
1572 int main(void)
1574 fnmatch("foo", "foo", 0);
1575 return 0;
1578 if compile_prog "" "" ; then
1579 fnmatch="yes"
1582 ##########################################
1583 # uuid_generate() probe, used for vdi block driver
1584 if test "$uuid" != "no" ; then
1585 uuid_libs="-luuid"
1586 cat > $TMPC << EOF
1587 #include <uuid/uuid.h>
1588 int main(void)
1590 uuid_t my_uuid;
1591 uuid_generate(my_uuid);
1592 return 0;
1595 if compile_prog "" "$uuid_libs" ; then
1596 uuid="yes"
1597 libs_softmmu="$uuid_libs $libs_softmmu"
1598 libs_tools="$uuid_libs $libs_tools"
1599 else
1600 if test "$uuid" = "yes" ; then
1601 feature_not_found "uuid"
1603 uuid=no
1607 ##########################################
1608 # xfsctl() probe, used for raw-posix
1609 if test "$xfs" != "no" ; then
1610 cat > $TMPC << EOF
1611 #include <xfs/xfs.h>
1612 int main(void)
1614 xfsctl(NULL, 0, 0, NULL);
1615 return 0;
1618 if compile_prog "" "" ; then
1619 xfs="yes"
1620 else
1621 if test "$xfs" = "yes" ; then
1622 feature_not_found "xfs"
1624 xfs=no
1628 ##########################################
1629 # vde libraries probe
1630 if test "$vde" != "no" ; then
1631 vde_libs="-lvdeplug"
1632 cat > $TMPC << EOF
1633 #include <libvdeplug.h>
1634 int main(void)
1636 struct vde_open_args a = {0, 0, 0};
1637 vde_open("", "", &a);
1638 return 0;
1641 if compile_prog "" "$vde_libs" ; then
1642 vde=yes
1643 libs_softmmu="$vde_libs $libs_softmmu"
1644 libs_tools="$vde_libs $libs_tools"
1645 else
1646 if test "$vde" = "yes" ; then
1647 feature_not_found "vde"
1649 vde=no
1653 ##########################################
1654 # Sound support libraries probe
1656 audio_drv_probe()
1658 drv=$1
1659 hdr=$2
1660 lib=$3
1661 exp=$4
1662 cfl=$5
1663 cat > $TMPC << EOF
1664 #include <$hdr>
1665 int main(void) { $exp }
1667 if compile_prog "$cfl" "$lib" ; then
1669 else
1670 echo
1671 echo "Error: $drv check failed"
1672 echo "Make sure to have the $drv libs and headers installed."
1673 echo
1674 exit 1
1678 audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1679 for drv in $audio_drv_list; do
1680 case $drv in
1681 alsa)
1682 audio_drv_probe $drv alsa/asoundlib.h -lasound \
1683 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1684 libs_softmmu="-lasound $libs_softmmu"
1687 fmod)
1688 if test -z $fmod_lib || test -z $fmod_inc; then
1689 echo
1690 echo "Error: You must specify path to FMOD library and headers"
1691 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1692 echo
1693 exit 1
1695 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1696 libs_softmmu="$fmod_lib $libs_softmmu"
1699 esd)
1700 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1701 libs_softmmu="-lesd $libs_softmmu"
1702 audio_pt_int="yes"
1706 audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
1707 "pa_simple *s = 0; pa_simple_free(s); return 0;"
1708 libs_softmmu="-lpulse -lpulse-simple $libs_softmmu"
1709 audio_pt_int="yes"
1712 coreaudio)
1713 libs_softmmu="-framework CoreAudio $libs_softmmu"
1716 dsound)
1717 libs_softmmu="-lole32 -ldxguid $libs_softmmu"
1718 audio_win_int="yes"
1721 oss)
1722 libs_softmmu="$oss_lib $libs_softmmu"
1725 sdl|wav)
1726 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1729 winwave)
1730 libs_softmmu="-lwinmm $libs_softmmu"
1731 audio_win_int="yes"
1735 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
1736 echo
1737 echo "Error: Unknown driver '$drv' selected"
1738 echo "Possible drivers are: $audio_possible_drivers"
1739 echo
1740 exit 1
1743 esac
1744 done
1746 ##########################################
1747 # BrlAPI probe
1749 if test "$brlapi" != "no" ; then
1750 brlapi_libs="-lbrlapi"
1751 cat > $TMPC << EOF
1752 #include <brlapi.h>
1753 #include <stddef.h>
1754 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1756 if compile_prog "" "$brlapi_libs" ; then
1757 brlapi=yes
1758 libs_softmmu="$brlapi_libs $libs_softmmu"
1759 else
1760 if test "$brlapi" = "yes" ; then
1761 feature_not_found "brlapi"
1763 brlapi=no
1767 ##########################################
1768 # curses probe
1769 if test "$mingw32" = "yes" ; then
1770 curses_list="-lpdcurses"
1771 else
1772 curses_list="-lncurses -lcurses"
1775 if test "$curses" != "no" ; then
1776 curses_found=no
1777 cat > $TMPC << EOF
1778 #include <curses.h>
1779 #ifdef __OpenBSD__
1780 #define resize_term resizeterm
1781 #endif
1782 int main(void) { resize_term(0, 0); return curses_version(); }
1784 for curses_lib in $curses_list; do
1785 if compile_prog "" "$curses_lib" ; then
1786 curses_found=yes
1787 libs_softmmu="$curses_lib $libs_softmmu"
1788 break
1790 done
1791 if test "$curses_found" = "yes" ; then
1792 curses=yes
1793 else
1794 if test "$curses" = "yes" ; then
1795 feature_not_found "curses"
1797 curses=no
1801 ##########################################
1802 # curl probe
1804 if $pkg_config libcurl --modversion >/dev/null 2>&1; then
1805 curlconfig="$pkg_config libcurl"
1806 else
1807 curlconfig=curl-config
1810 if test "$curl" != "no" ; then
1811 cat > $TMPC << EOF
1812 #include <curl/curl.h>
1813 int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
1815 curl_cflags=`$curlconfig --cflags 2>/dev/null`
1816 curl_libs=`$curlconfig --libs 2>/dev/null`
1817 if compile_prog "$curl_cflags" "$curl_libs" ; then
1818 curl=yes
1819 libs_tools="$curl_libs $libs_tools"
1820 libs_softmmu="$curl_libs $libs_softmmu"
1821 else
1822 if test "$curl" = "yes" ; then
1823 feature_not_found "curl"
1825 curl=no
1827 fi # test "$curl"
1829 ##########################################
1830 # check framework probe
1832 if test "$check_utests" != "no" ; then
1833 cat > $TMPC << EOF
1834 #include <check.h>
1835 int main(void) { suite_create("qemu test"); return 0; }
1837 check_libs=`$pkg_config --libs check 2>/dev/null`
1838 if compile_prog "" $check_libs ; then
1839 check_utests=yes
1840 libs_tools="$check_libs $libs_tools"
1841 else
1842 if test "$check_utests" = "yes" ; then
1843 feature_not_found "check"
1845 check_utests=no
1847 fi # test "$check_utests"
1849 ##########################################
1850 # bluez support probe
1851 if test "$bluez" != "no" ; then
1852 cat > $TMPC << EOF
1853 #include <bluetooth/bluetooth.h>
1854 int main(void) { return bt_error(0); }
1856 bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
1857 bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
1858 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
1859 bluez=yes
1860 libs_softmmu="$bluez_libs $libs_softmmu"
1861 else
1862 if test "$bluez" = "yes" ; then
1863 feature_not_found "bluez"
1865 bluez="no"
1869 ##########################################
1870 # glib support probe
1871 if $pkg_config --modversion gthread-2.0 > /dev/null 2>&1 ; then
1872 glib_cflags=`$pkg_config --cflags gthread-2.0 2>/dev/null`
1873 glib_libs=`$pkg_config --libs gthread-2.0 2>/dev/null`
1874 LIBS="$glib_libs $LIBS"
1875 libs_qga="$glib_libs $libs_qga"
1876 else
1877 echo "glib-2.0 required to compile QEMU"
1878 exit 1
1881 ##########################################
1882 # pthread probe
1883 PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
1885 pthread=no
1886 cat > $TMPC << EOF
1887 #include <pthread.h>
1888 int main(void) { pthread_create(0,0,0,0); return 0; }
1890 if compile_prog "" "" ; then
1891 pthread=yes
1892 else
1893 for pthread_lib in $PTHREADLIBS_LIST; do
1894 if compile_prog "" "$pthread_lib" ; then
1895 pthread=yes
1896 LIBS="$pthread_lib $LIBS"
1897 break
1899 done
1902 if test "$mingw32" != yes -a "$pthread" = no; then
1903 echo
1904 echo "Error: pthread check failed"
1905 echo "Make sure to have the pthread libs and headers installed."
1906 echo
1907 exit 1
1910 ##########################################
1911 # rbd probe
1912 if test "$rbd" != "no" ; then
1913 cat > $TMPC <<EOF
1914 #include <stdio.h>
1915 #include <rbd/librbd.h>
1916 int main(void) {
1917 rados_t cluster;
1918 rados_create(&cluster, NULL);
1919 return 0;
1922 rbd_libs="-lrbd -lrados"
1923 if compile_prog "" "$rbd_libs" ; then
1924 rbd=yes
1925 libs_tools="$rbd_libs $libs_tools"
1926 libs_softmmu="$rbd_libs $libs_softmmu"
1927 else
1928 if test "$rbd" = "yes" ; then
1929 feature_not_found "rados block device"
1931 rbd=no
1935 ##########################################
1936 # linux-aio probe
1938 if test "$linux_aio" != "no" ; then
1939 cat > $TMPC <<EOF
1940 #include <libaio.h>
1941 #include <sys/eventfd.h>
1942 #include <stddef.h>
1943 int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
1945 if compile_prog "" "-laio" ; then
1946 linux_aio=yes
1947 libs_softmmu="$libs_softmmu -laio"
1948 libs_tools="$libs_tools -laio"
1949 else
1950 if test "$linux_aio" = "yes" ; then
1951 feature_not_found "linux AIO"
1953 linux_aio=no
1957 ##########################################
1958 # attr probe
1960 if test "$attr" != "no" ; then
1961 cat > $TMPC <<EOF
1962 #include <stdio.h>
1963 #include <sys/types.h>
1964 #include <attr/xattr.h>
1965 int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
1967 if compile_prog "" "-lattr" ; then
1968 attr=yes
1969 LIBS="-lattr $LIBS"
1970 else
1971 if test "$attr" = "yes" ; then
1972 feature_not_found "ATTR"
1974 attr=no
1978 ##########################################
1979 # iovec probe
1980 cat > $TMPC <<EOF
1981 #include <sys/types.h>
1982 #include <sys/uio.h>
1983 #include <unistd.h>
1984 int main(void) { struct iovec iov; return 0; }
1986 iovec=no
1987 if compile_prog "" "" ; then
1988 iovec=yes
1991 ##########################################
1992 # preadv probe
1993 cat > $TMPC <<EOF
1994 #include <sys/types.h>
1995 #include <sys/uio.h>
1996 #include <unistd.h>
1997 int main(void) { preadv; }
1999 preadv=no
2000 if compile_prog "" "" ; then
2001 preadv=yes
2004 ##########################################
2005 # fdt probe
2006 if test "$fdt" != "no" ; then
2007 fdt_libs="-lfdt"
2008 cat > $TMPC << EOF
2009 int main(void) { return 0; }
2011 if compile_prog "" "$fdt_libs" ; then
2012 fdt=yes
2013 else
2014 if test "$fdt" = "yes" ; then
2015 feature_not_found "fdt"
2017 fdt_libs=
2018 fdt=no
2022 ##########################################
2023 # opengl probe, used by milkymist-tmu2
2024 if test "$opengl" != "no" ; then
2025 opengl_libs="-lGL"
2026 cat > $TMPC << EOF
2027 #include <X11/Xlib.h>
2028 #include <GL/gl.h>
2029 #include <GL/glx.h>
2030 int main(void) { GL_VERSION; return 0; }
2032 if compile_prog "" "-lGL" ; then
2033 opengl=yes
2034 else
2035 if test "$opengl" = "yes" ; then
2036 feature_not_found "opengl"
2038 opengl_libs=
2039 opengl=no
2044 # Check for xxxat() functions when we are building linux-user
2045 # emulator. This is done because older glibc versions don't
2046 # have syscall stubs for these implemented.
2048 atfile=no
2049 cat > $TMPC << EOF
2050 #define _ATFILE_SOURCE
2051 #include <sys/types.h>
2052 #include <fcntl.h>
2053 #include <unistd.h>
2056 main(void)
2058 /* try to unlink nonexisting file */
2059 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
2062 if compile_prog "" "" ; then
2063 atfile=yes
2066 # Check for inotify functions when we are building linux-user
2067 # emulator. This is done because older glibc versions don't
2068 # have syscall stubs for these implemented. In that case we
2069 # don't provide them even if kernel supports them.
2071 inotify=no
2072 cat > $TMPC << EOF
2073 #include <sys/inotify.h>
2076 main(void)
2078 /* try to start inotify */
2079 return inotify_init();
2082 if compile_prog "" "" ; then
2083 inotify=yes
2086 inotify1=no
2087 cat > $TMPC << EOF
2088 #include <sys/inotify.h>
2091 main(void)
2093 /* try to start inotify */
2094 return inotify_init1(0);
2097 if compile_prog "" "" ; then
2098 inotify1=yes
2101 # check if utimensat and futimens are supported
2102 utimens=no
2103 cat > $TMPC << EOF
2104 #define _ATFILE_SOURCE
2105 #include <stddef.h>
2106 #include <fcntl.h>
2108 int main(void)
2110 utimensat(AT_FDCWD, "foo", NULL, 0);
2111 futimens(0, NULL);
2112 return 0;
2115 if compile_prog "" "" ; then
2116 utimens=yes
2119 # check if pipe2 is there
2120 pipe2=no
2121 cat > $TMPC << EOF
2122 #include <unistd.h>
2123 #include <fcntl.h>
2125 int main(void)
2127 int pipefd[2];
2128 pipe2(pipefd, O_CLOEXEC);
2129 return 0;
2132 if compile_prog "" "" ; then
2133 pipe2=yes
2136 # check if accept4 is there
2137 accept4=no
2138 cat > $TMPC << EOF
2139 #include <sys/socket.h>
2140 #include <stddef.h>
2142 int main(void)
2144 accept4(0, NULL, NULL, SOCK_CLOEXEC);
2145 return 0;
2148 if compile_prog "" "" ; then
2149 accept4=yes
2152 # check if tee/splice is there. vmsplice was added same time.
2153 splice=no
2154 cat > $TMPC << EOF
2155 #include <unistd.h>
2156 #include <fcntl.h>
2157 #include <limits.h>
2159 int main(void)
2161 int len, fd;
2162 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
2163 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
2164 return 0;
2167 if compile_prog "" "" ; then
2168 splice=yes
2171 ##########################################
2172 # signalfd probe
2173 signalfd="no"
2174 cat > $TMPC << EOF
2175 #define _GNU_SOURCE
2176 #include <unistd.h>
2177 #include <sys/syscall.h>
2178 #include <signal.h>
2179 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
2182 if compile_prog "" "" ; then
2183 signalfd=yes
2186 # check if eventfd is supported
2187 eventfd=no
2188 cat > $TMPC << EOF
2189 #include <sys/eventfd.h>
2191 int main(void)
2193 int efd = eventfd(0, 0);
2194 return 0;
2197 if compile_prog "" "" ; then
2198 eventfd=yes
2201 # check for fallocate
2202 fallocate=no
2203 cat > $TMPC << EOF
2204 #include <fcntl.h>
2206 int main(void)
2208 fallocate(0, 0, 0, 0);
2209 return 0;
2212 if compile_prog "$ARCH_CFLAGS" "" ; then
2213 fallocate=yes
2216 # check for sync_file_range
2217 sync_file_range=no
2218 cat > $TMPC << EOF
2219 #include <fcntl.h>
2221 int main(void)
2223 sync_file_range(0, 0, 0, 0);
2224 return 0;
2227 if compile_prog "$ARCH_CFLAGS" "" ; then
2228 sync_file_range=yes
2231 # check for linux/fiemap.h and FS_IOC_FIEMAP
2232 fiemap=no
2233 cat > $TMPC << EOF
2234 #include <sys/ioctl.h>
2235 #include <linux/fs.h>
2236 #include <linux/fiemap.h>
2238 int main(void)
2240 ioctl(0, FS_IOC_FIEMAP, 0);
2241 return 0;
2244 if compile_prog "$ARCH_CFLAGS" "" ; then
2245 fiemap=yes
2248 # check for dup3
2249 dup3=no
2250 cat > $TMPC << EOF
2251 #include <unistd.h>
2253 int main(void)
2255 dup3(0, 0, 0);
2256 return 0;
2259 if compile_prog "" "" ; then
2260 dup3=yes
2263 # check for epoll support
2264 epoll=no
2265 cat > $TMPC << EOF
2266 #include <sys/epoll.h>
2268 int main(void)
2270 epoll_create(0);
2271 return 0;
2274 if compile_prog "$ARCH_CFLAGS" "" ; then
2275 epoll=yes
2278 # epoll_create1 and epoll_pwait are later additions
2279 # so we must check separately for their presence
2280 epoll_create1=no
2281 cat > $TMPC << EOF
2282 #include <sys/epoll.h>
2284 int main(void)
2286 /* Note that we use epoll_create1 as a value, not as
2287 * a function being called. This is necessary so that on
2288 * old SPARC glibc versions where the function was present in
2289 * the library but not declared in the header file we will
2290 * fail the configure check. (Otherwise we will get a compiler
2291 * warning but not an error, and will proceed to fail the
2292 * qemu compile where we compile with -Werror.)
2294 epoll_create1;
2295 return 0;
2298 if compile_prog "$ARCH_CFLAGS" "" ; then
2299 epoll_create1=yes
2302 epoll_pwait=no
2303 cat > $TMPC << EOF
2304 #include <sys/epoll.h>
2306 int main(void)
2308 epoll_pwait(0, 0, 0, 0, 0);
2309 return 0;
2312 if compile_prog "$ARCH_CFLAGS" "" ; then
2313 epoll_pwait=yes
2316 # Check if tools are available to build documentation.
2317 if test "$docs" != "no" ; then
2318 if has makeinfo && has pod2man; then
2319 docs=yes
2320 else
2321 if test "$docs" = "yes" ; then
2322 feature_not_found "docs"
2324 docs=no
2328 # Search for bswap_32 function
2329 byteswap_h=no
2330 cat > $TMPC << EOF
2331 #include <byteswap.h>
2332 int main(void) { return bswap_32(0); }
2334 if compile_prog "" "" ; then
2335 byteswap_h=yes
2338 # Search for bswap_32 function
2339 bswap_h=no
2340 cat > $TMPC << EOF
2341 #include <sys/endian.h>
2342 #include <sys/types.h>
2343 #include <machine/bswap.h>
2344 int main(void) { return bswap32(0); }
2346 if compile_prog "" "" ; then
2347 bswap_h=yes
2350 ##########################################
2351 # Do we have libiscsi
2352 if test "$libiscsi" != "no" ; then
2353 cat > $TMPC << EOF
2354 #include <iscsi/iscsi.h>
2355 int main(void) { iscsi_create_context(""); return 0; }
2357 if compile_prog "-Werror" "-liscsi" ; then
2358 libiscsi="yes"
2359 LIBS="$LIBS -liscsi"
2360 else
2361 if test "$libiscsi" = "yes" ; then
2362 feature_not_found "libiscsi"
2364 libiscsi="no"
2369 ##########################################
2370 # Do we need librt
2371 cat > $TMPC <<EOF
2372 #include <signal.h>
2373 #include <time.h>
2374 int main(void) { clockid_t id; return clock_gettime(id, NULL); }
2377 if compile_prog "" "" ; then
2379 elif compile_prog "" "-lrt" ; then
2380 LIBS="-lrt $LIBS"
2383 if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
2384 "$aix" != "yes" -a "$haiku" != "yes" ; then
2385 libs_softmmu="-lutil $libs_softmmu"
2388 ##########################################
2389 # check if the compiler defines offsetof
2391 need_offsetof=yes
2392 cat > $TMPC << EOF
2393 #include <stddef.h>
2394 int main(void) { struct s { int f; }; return offsetof(struct s, f); }
2396 if compile_prog "" "" ; then
2397 need_offsetof=no
2400 # spice probe
2401 if test "$spice" != "no" ; then
2402 cat > $TMPC << EOF
2403 #include <spice.h>
2404 int main(void) { spice_server_new(); return 0; }
2406 spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
2407 spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
2408 if $pkg_config --atleast-version=0.6.0 spice-server >/dev/null 2>&1 && \
2409 compile_prog "$spice_cflags" "$spice_libs" ; then
2410 spice="yes"
2411 libs_softmmu="$libs_softmmu $spice_libs"
2412 QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
2413 else
2414 if test "$spice" = "yes" ; then
2415 feature_not_found "spice"
2417 spice="no"
2421 # check for libcacard for smartcard support
2422 if test "$smartcard" != "no" ; then
2423 smartcard="yes"
2424 smartcard_cflags=""
2425 # TODO - what's the minimal nss version we support?
2426 if test "$smartcard_nss" != "no"; then
2427 if $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 ; then
2428 smartcard_nss="yes"
2429 smartcard_cflags="-I\$(SRC_PATH)/libcacard"
2430 libcacard_libs=$($pkg_config --libs nss 2>/dev/null)
2431 libcacard_cflags=$($pkg_config --cflags nss 2>/dev/null)
2432 QEMU_CFLAGS="$QEMU_CFLAGS $smartcard_cflags $libcacard_cflags"
2433 LIBS="$libcacard_libs $LIBS"
2434 else
2435 if test "$smartcard_nss" = "yes"; then
2436 feature_not_found "nss"
2438 smartcard_nss="no"
2442 if test "$smartcard" = "no" ; then
2443 smartcard_nss="no"
2446 # check for usbredirparser for usb network redirection support
2447 if test "$usb_redir" != "no" ; then
2448 if $pkg_config libusbredirparser >/dev/null 2>&1 ; then
2449 usb_redir="yes"
2450 usb_redir_cflags=$($pkg_config --cflags libusbredirparser 2>/dev/null)
2451 usb_redir_libs=$($pkg_config --libs libusbredirparser 2>/dev/null)
2452 QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
2453 LIBS="$LIBS $usb_redir_libs"
2454 else
2455 if test "$usb_redir" = "yes"; then
2456 feature_not_found "usb-redir"
2458 usb_redir="no"
2462 ##########################################
2464 ##########################################
2465 # check if we have fdatasync
2467 fdatasync=no
2468 cat > $TMPC << EOF
2469 #include <unistd.h>
2470 int main(void) {
2471 #if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
2472 return fdatasync(0);
2473 #else
2474 #abort Not supported
2475 #endif
2478 if compile_prog "" "" ; then
2479 fdatasync=yes
2482 ##########################################
2483 # check if we have madvise
2485 madvise=no
2486 cat > $TMPC << EOF
2487 #include <sys/types.h>
2488 #include <sys/mman.h>
2489 #include <stddef.h>
2490 int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
2492 if compile_prog "" "" ; then
2493 madvise=yes
2496 ##########################################
2497 # check if we have posix_madvise
2499 posix_madvise=no
2500 cat > $TMPC << EOF
2501 #include <sys/mman.h>
2502 #include <stddef.h>
2503 int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
2505 if compile_prog "" "" ; then
2506 posix_madvise=yes
2509 ##########################################
2510 # check if trace backend exists
2512 sh "$source_path/scripts/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null
2513 if test "$?" -ne 0 ; then
2514 echo
2515 echo "Error: invalid trace backend"
2516 echo "Please choose a supported trace backend."
2517 echo
2518 exit 1
2521 ##########################################
2522 # For 'ust' backend, test if ust headers are present
2523 if test "$trace_backend" = "ust"; then
2524 cat > $TMPC << EOF
2525 #include <ust/tracepoint.h>
2526 #include <ust/marker.h>
2527 int main(void) { return 0; }
2529 if compile_prog "" "" ; then
2530 LIBS="-lust $LIBS"
2531 else
2532 echo
2533 echo "Error: Trace backend 'ust' missing libust header files"
2534 echo
2535 exit 1
2539 ##########################################
2540 # For 'dtrace' backend, test if 'dtrace' command is present
2541 if test "$trace_backend" = "dtrace"; then
2542 if ! has 'dtrace' ; then
2543 echo
2544 echo "Error: dtrace command is not found in PATH $PATH"
2545 echo
2546 exit 1
2548 trace_backend_stap="no"
2549 if has 'stap' ; then
2550 trace_backend_stap="yes"
2554 ##########################################
2555 # __sync_fetch_and_and requires at least -march=i486. Many toolchains
2556 # use i686 as default anyway, but for those that don't, an explicit
2557 # specification is necessary
2558 if test "$vhost_net" = "yes" && test "$cpu" = "i386"; then
2559 cat > $TMPC << EOF
2560 int sfaa(unsigned *ptr)
2562 return __sync_fetch_and_and(ptr, 0);
2565 int main(int argc, char **argv)
2567 int val = 42;
2568 sfaa(&val);
2569 return val;
2572 if ! compile_prog "" "" ; then
2573 CFLAGS+="-march=i486"
2577 ##########################################
2578 # check if we have makecontext
2580 ucontext_coroutine=no
2581 if test "$darwin" != "yes"; then
2582 cat > $TMPC << EOF
2583 #include <ucontext.h>
2584 int main(void) { makecontext(0, 0, 0); }
2586 if compile_prog "" "" ; then
2587 ucontext_coroutine=yes
2591 ##########################################
2592 # check if we have open_by_handle_at
2594 open_by_hande_at=no
2595 cat > $TMPC << EOF
2596 #include <fcntl.h>
2597 int main(void) { struct file_handle fh; open_by_handle_at(0, &fh, 0); }
2599 if compile_prog "" "" ; then
2600 open_by_handle_at=yes
2603 ########################################
2604 # check if we have linux/magic.h
2606 linux_magic_h=no
2607 cat > $TMPC << EOF
2608 #include <linux/magic.h>
2609 int main(void) {
2612 if compile_prog "" "" ; then
2613 linux_magic_h=yes
2616 ##########################################
2617 # End of CC checks
2618 # After here, no more $cc or $ld runs
2620 if test "$debug" = "no" ; then
2621 CFLAGS="-O2 $CFLAGS"
2624 # Consult white-list to determine whether to enable werror
2625 # by default. Only enable by default for git builds
2626 z_version=`cut -f3 -d. $source_path/VERSION`
2628 if test -z "$werror" ; then
2629 if test "$z_version" = "50" -a \
2630 "$linux" = "yes" ; then
2631 werror="yes"
2632 else
2633 werror="no"
2637 # Disable zero malloc errors for official releases unless explicitly told to
2638 # enable/disable
2639 if test -z "$zero_malloc" ; then
2640 if test "$z_version" = "50" ; then
2641 zero_malloc="no"
2642 else
2643 zero_malloc="yes"
2647 if test "$werror" = "yes" ; then
2648 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
2651 if test "$solaris" = "no" ; then
2652 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
2653 LDFLAGS="-Wl,--warn-common $LDFLAGS"
2657 # Use ASLR, no-SEH and DEP if available
2658 if test "$mingw32" = "yes" ; then
2659 for flag in --dynamicbase --no-seh --nxcompat; do
2660 if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
2661 LDFLAGS="-Wl,$flag $LDFLAGS"
2663 done
2666 confdir=$sysconfdir$confsuffix
2668 tools=
2669 if test "$softmmu" = yes ; then
2670 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
2671 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
2672 tools="qemu-nbd\$(EXESUF) $tools"
2673 if [ "$guest_agent" = "yes" ]; then
2674 tools="qemu-ga\$(EXESUF) $tools"
2676 if [ "$check_utests" = "yes" ]; then
2677 checks="check-qint check-qstring check-qdict check-qlist"
2678 checks="check-qfloat check-qjson test-coroutine $checks"
2683 # Mac OS X ships with a broken assembler
2684 roms=
2685 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
2686 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
2687 "$softmmu" = yes ; then
2688 roms="optionrom"
2690 if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
2691 roms="$roms spapr-rtas"
2694 echo "Install prefix $prefix"
2695 echo "BIOS directory `eval echo $datadir`"
2696 echo "binary directory `eval echo $bindir`"
2697 echo "library directory `eval echo $libdir`"
2698 echo "include directory `eval echo $includedir`"
2699 echo "config directory `eval echo $sysconfdir`"
2700 if test "$mingw32" = "no" ; then
2701 echo "Manual directory `eval echo $mandir`"
2702 echo "ELF interp prefix $interp_prefix"
2704 echo "Source path $source_path"
2705 echo "C compiler $cc"
2706 echo "Host C compiler $host_cc"
2707 echo "CFLAGS $CFLAGS"
2708 echo "QEMU_CFLAGS $QEMU_CFLAGS"
2709 echo "LDFLAGS $LDFLAGS"
2710 echo "make $make"
2711 echo "install $install"
2712 echo "python $python"
2713 if test "$slirp" = "yes" ; then
2714 echo "smbd $smbd"
2716 echo "host CPU $cpu"
2717 echo "host big endian $bigendian"
2718 echo "target list $target_list"
2719 echo "tcg debug enabled $debug_tcg"
2720 echo "Mon debug enabled $debug_mon"
2721 echo "gprof enabled $gprof"
2722 echo "sparse enabled $sparse"
2723 echo "strip binaries $strip_opt"
2724 echo "profiler $profiler"
2725 echo "static build $static"
2726 echo "-Werror enabled $werror"
2727 if test "$darwin" = "yes" ; then
2728 echo "Cocoa support $cocoa"
2730 echo "SDL support $sdl"
2731 echo "curses support $curses"
2732 echo "curl support $curl"
2733 echo "check support $check_utests"
2734 echo "mingw32 support $mingw32"
2735 echo "Audio drivers $audio_drv_list"
2736 echo "Extra audio cards $audio_card_list"
2737 echo "Block whitelist $block_drv_whitelist"
2738 echo "Mixer emulation $mixemu"
2739 echo "VNC support $vnc"
2740 if test "$vnc" = "yes" ; then
2741 echo "VNC TLS support $vnc_tls"
2742 echo "VNC SASL support $vnc_sasl"
2743 echo "VNC JPEG support $vnc_jpeg"
2744 echo "VNC PNG support $vnc_png"
2745 echo "VNC thread $vnc_thread"
2747 if test -n "$sparc_cpu"; then
2748 echo "Target Sparc Arch $sparc_cpu"
2750 echo "xen support $xen"
2751 echo "brlapi support $brlapi"
2752 echo "bluez support $bluez"
2753 echo "Documentation $docs"
2754 [ ! -z "$uname_release" ] && \
2755 echo "uname -r $uname_release"
2756 echo "NPTL support $nptl"
2757 echo "GUEST_BASE $guest_base"
2758 echo "PIE user targets $user_pie"
2759 echo "vde support $vde"
2760 echo "Linux AIO support $linux_aio"
2761 echo "ATTR/XATTR support $attr"
2762 echo "Install blobs $blobs"
2763 echo "KVM support $kvm"
2764 echo "TCG interpreter $tcg_interpreter"
2765 echo "fdt support $fdt"
2766 echo "preadv support $preadv"
2767 echo "fdatasync $fdatasync"
2768 echo "madvise $madvise"
2769 echo "posix_madvise $posix_madvise"
2770 echo "uuid support $uuid"
2771 echo "vhost-net support $vhost_net"
2772 echo "Trace backend $trace_backend"
2773 echo "Trace output file $trace_file-<pid>"
2774 echo "spice support $spice"
2775 echo "rbd support $rbd"
2776 echo "xfsctl support $xfs"
2777 echo "nss used $smartcard_nss"
2778 echo "usb net redir $usb_redir"
2779 echo "OpenGL support $opengl"
2780 echo "libiscsi support $libiscsi"
2781 echo "build guest agent $guest_agent"
2783 if test "$sdl_too_old" = "yes"; then
2784 echo "-> Your SDL version is too old - please upgrade to have SDL support"
2787 config_host_mak="config-host.mak"
2788 config_host_ld="config-host.ld"
2790 echo "# Automatically generated by configure - do not modify" > $config_host_mak
2791 printf "# Configured with:" >> $config_host_mak
2792 printf " '%s'" "$0" "$@" >> $config_host_mak
2793 echo >> $config_host_mak
2795 echo all: >> $config_host_mak
2796 echo "prefix=$prefix" >> $config_host_mak
2797 echo "bindir=$bindir" >> $config_host_mak
2798 echo "libdir=$libdir" >> $config_host_mak
2799 echo "includedir=$includedir" >> $config_host_mak
2800 echo "mandir=$mandir" >> $config_host_mak
2801 echo "datadir=$datadir" >> $config_host_mak
2802 echo "sysconfdir=$sysconfdir" >> $config_host_mak
2803 echo "docdir=$docdir" >> $config_host_mak
2804 echo "confdir=$confdir" >> $config_host_mak
2806 case "$cpu" in
2807 i386|x86_64|alpha|cris|hppa|ia64|lm32|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64|unicore32)
2808 ARCH=$cpu
2810 armv4b|armv4l)
2811 ARCH=arm
2814 if test "$tcg_interpreter" = "yes" ; then
2815 echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
2816 ARCH=tci
2817 else
2818 echo "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
2819 exit 1
2822 esac
2823 echo "ARCH=$ARCH" >> $config_host_mak
2824 if test "$debug_tcg" = "yes" ; then
2825 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
2827 if test "$debug_mon" = "yes" ; then
2828 echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak
2830 if test "$debug" = "yes" ; then
2831 echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
2833 if test "$strip_opt" = "yes" ; then
2834 echo "STRIP=${strip}" >> $config_host_mak
2836 if test "$bigendian" = "yes" ; then
2837 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
2839 echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
2840 if test "$mingw32" = "yes" ; then
2841 echo "CONFIG_WIN32=y" >> $config_host_mak
2842 rc_version=`cat $source_path/VERSION`
2843 version_major=${rc_version%%.*}
2844 rc_version=${rc_version#*.}
2845 version_minor=${rc_version%%.*}
2846 rc_version=${rc_version#*.}
2847 version_subminor=${rc_version%%.*}
2848 version_micro=0
2849 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
2850 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
2851 else
2852 echo "CONFIG_POSIX=y" >> $config_host_mak
2855 if test "$linux" = "yes" ; then
2856 echo "CONFIG_LINUX=y" >> $config_host_mak
2859 if test "$darwin" = "yes" ; then
2860 echo "CONFIG_DARWIN=y" >> $config_host_mak
2863 if test "$aix" = "yes" ; then
2864 echo "CONFIG_AIX=y" >> $config_host_mak
2867 if test "$solaris" = "yes" ; then
2868 echo "CONFIG_SOLARIS=y" >> $config_host_mak
2869 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
2870 if test "$needs_libsunmath" = "yes" ; then
2871 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
2874 if test "$haiku" = "yes" ; then
2875 echo "CONFIG_HAIKU=y" >> $config_host_mak
2877 if test "$static" = "yes" ; then
2878 echo "CONFIG_STATIC=y" >> $config_host_mak
2880 if test "$profiler" = "yes" ; then
2881 echo "CONFIG_PROFILER=y" >> $config_host_mak
2883 if test "$slirp" = "yes" ; then
2884 echo "CONFIG_SLIRP=y" >> $config_host_mak
2885 echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
2886 QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES"
2888 if test "$vde" = "yes" ; then
2889 echo "CONFIG_VDE=y" >> $config_host_mak
2891 for card in $audio_card_list; do
2892 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
2893 echo "$def=y" >> $config_host_mak
2894 done
2895 echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
2896 for drv in $audio_drv_list; do
2897 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
2898 echo "$def=y" >> $config_host_mak
2899 if test "$drv" = "fmod"; then
2900 echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
2902 done
2903 if test "$audio_pt_int" = "yes" ; then
2904 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
2906 if test "$audio_win_int" = "yes" ; then
2907 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
2909 echo "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
2910 if test "$mixemu" = "yes" ; then
2911 echo "CONFIG_MIXEMU=y" >> $config_host_mak
2913 if test "$vnc" = "yes" ; then
2914 echo "CONFIG_VNC=y" >> $config_host_mak
2916 if test "$vnc_tls" = "yes" ; then
2917 echo "CONFIG_VNC_TLS=y" >> $config_host_mak
2918 echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
2920 if test "$vnc_sasl" = "yes" ; then
2921 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
2922 echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
2924 if test "$vnc_jpeg" = "yes" ; then
2925 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
2926 echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak
2928 if test "$vnc_png" = "yes" ; then
2929 echo "CONFIG_VNC_PNG=y" >> $config_host_mak
2930 echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak
2932 if test "$vnc_thread" = "yes" ; then
2933 echo "CONFIG_VNC_THREAD=y" >> $config_host_mak
2935 if test "$fnmatch" = "yes" ; then
2936 echo "CONFIG_FNMATCH=y" >> $config_host_mak
2938 if test "$uuid" = "yes" ; then
2939 echo "CONFIG_UUID=y" >> $config_host_mak
2941 if test "$xfs" = "yes" ; then
2942 echo "CONFIG_XFS=y" >> $config_host_mak
2944 qemu_version=`head $source_path/VERSION`
2945 echo "VERSION=$qemu_version" >>$config_host_mak
2946 echo "PKGVERSION=$pkgversion" >>$config_host_mak
2947 echo "SRC_PATH=$source_path" >> $config_host_mak
2948 echo "TARGET_DIRS=$target_list" >> $config_host_mak
2949 if [ "$docs" = "yes" ] ; then
2950 echo "BUILD_DOCS=yes" >> $config_host_mak
2952 if test "$sdl" = "yes" ; then
2953 echo "CONFIG_SDL=y" >> $config_host_mak
2954 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
2956 if test "$cocoa" = "yes" ; then
2957 echo "CONFIG_COCOA=y" >> $config_host_mak
2959 if test "$curses" = "yes" ; then
2960 echo "CONFIG_CURSES=y" >> $config_host_mak
2962 if test "$atfile" = "yes" ; then
2963 echo "CONFIG_ATFILE=y" >> $config_host_mak
2965 if test "$utimens" = "yes" ; then
2966 echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
2968 if test "$pipe2" = "yes" ; then
2969 echo "CONFIG_PIPE2=y" >> $config_host_mak
2971 if test "$accept4" = "yes" ; then
2972 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
2974 if test "$splice" = "yes" ; then
2975 echo "CONFIG_SPLICE=y" >> $config_host_mak
2977 if test "$eventfd" = "yes" ; then
2978 echo "CONFIG_EVENTFD=y" >> $config_host_mak
2980 if test "$fallocate" = "yes" ; then
2981 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
2983 if test "$sync_file_range" = "yes" ; then
2984 echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
2986 if test "$fiemap" = "yes" ; then
2987 echo "CONFIG_FIEMAP=y" >> $config_host_mak
2989 if test "$dup3" = "yes" ; then
2990 echo "CONFIG_DUP3=y" >> $config_host_mak
2992 if test "$epoll" = "yes" ; then
2993 echo "CONFIG_EPOLL=y" >> $config_host_mak
2995 if test "$epoll_create1" = "yes" ; then
2996 echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
2998 if test "$epoll_pwait" = "yes" ; then
2999 echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
3001 if test "$inotify" = "yes" ; then
3002 echo "CONFIG_INOTIFY=y" >> $config_host_mak
3004 if test "$inotify1" = "yes" ; then
3005 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
3007 if test "$byteswap_h" = "yes" ; then
3008 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
3010 if test "$bswap_h" = "yes" ; then
3011 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
3013 if test "$curl" = "yes" ; then
3014 echo "CONFIG_CURL=y" >> $config_host_mak
3015 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
3017 if test "$brlapi" = "yes" ; then
3018 echo "CONFIG_BRLAPI=y" >> $config_host_mak
3020 if test "$bluez" = "yes" ; then
3021 echo "CONFIG_BLUEZ=y" >> $config_host_mak
3022 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
3024 echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
3025 if test "$xen" = "yes" ; then
3026 echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
3027 echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
3029 if test "$linux_aio" = "yes" ; then
3030 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
3032 if test "$attr" = "yes" ; then
3033 echo "CONFIG_ATTR=y" >> $config_host_mak
3035 if test "$linux" = "yes" ; then
3036 if test "$attr" = "yes" ; then
3037 echo "CONFIG_VIRTFS=y" >> $config_host_mak
3040 if test "$blobs" = "yes" ; then
3041 echo "INSTALL_BLOBS=yes" >> $config_host_mak
3043 if test "$iovec" = "yes" ; then
3044 echo "CONFIG_IOVEC=y" >> $config_host_mak
3046 if test "$preadv" = "yes" ; then
3047 echo "CONFIG_PREADV=y" >> $config_host_mak
3049 if test "$fdt" = "yes" ; then
3050 echo "CONFIG_FDT=y" >> $config_host_mak
3052 if test "$signalfd" = "yes" ; then
3053 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
3055 if test "$tcg_interpreter" = "yes" ; then
3056 echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
3058 if test "$need_offsetof" = "yes" ; then
3059 echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
3061 if test "$fdatasync" = "yes" ; then
3062 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
3064 if test "$madvise" = "yes" ; then
3065 echo "CONFIG_MADVISE=y" >> $config_host_mak
3067 if test "$posix_madvise" = "yes" ; then
3068 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
3071 if test "$spice" = "yes" ; then
3072 echo "CONFIG_SPICE=y" >> $config_host_mak
3075 if test "$smartcard" = "yes" ; then
3076 echo "CONFIG_SMARTCARD=y" >> $config_host_mak
3079 if test "$smartcard_nss" = "yes" ; then
3080 echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
3083 if test "$usb_redir" = "yes" ; then
3084 echo "CONFIG_USB_REDIR=y" >> $config_host_mak
3087 if test "$opengl" = "yes" ; then
3088 echo "CONFIG_OPENGL=y" >> $config_host_mak
3091 if test "$libiscsi" = "yes" ; then
3092 echo "CONFIG_LIBISCSI=y" >> $config_host_mak
3095 # XXX: suppress that
3096 if [ "$bsd" = "yes" ] ; then
3097 echo "CONFIG_BSD=y" >> $config_host_mak
3100 echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
3102 if test "$zero_malloc" = "yes" ; then
3103 echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
3105 if test "$rbd" = "yes" ; then
3106 echo "CONFIG_RBD=y" >> $config_host_mak
3109 if test "$ucontext_coroutine" = "yes" ; then
3110 echo "CONFIG_UCONTEXT_COROUTINE=y" >> $config_host_mak
3113 if test "$open_by_handle_at" = "yes" ; then
3114 echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
3117 if test "$linux_magic_h" = "yes" ; then
3118 echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
3121 # USB host support
3122 case "$usb" in
3123 linux)
3124 echo "HOST_USB=linux" >> $config_host_mak
3126 bsd)
3127 echo "HOST_USB=bsd" >> $config_host_mak
3130 echo "HOST_USB=stub" >> $config_host_mak
3132 esac
3134 # use default implementation for tracing backend-specific routines
3135 trace_default=yes
3136 echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
3137 if test "$trace_backend" = "nop"; then
3138 echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
3140 if test "$trace_backend" = "simple"; then
3141 echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
3142 trace_default=no
3143 # Set the appropriate trace file.
3144 trace_file="\"$trace_file-\" FMT_pid"
3146 if test "$trace_backend" = "stderr"; then
3147 echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
3148 trace_default=no
3150 if test "$trace_backend" = "ust"; then
3151 echo "CONFIG_TRACE_UST=y" >> $config_host_mak
3153 if test "$trace_backend" = "dtrace"; then
3154 echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
3155 if test "$trace_backend_stap" = "yes" ; then
3156 echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
3159 echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
3160 if test "$trace_default" = "yes"; then
3161 echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
3164 echo "TOOLS=$tools" >> $config_host_mak
3165 echo "CHECKS=$checks" >> $config_host_mak
3166 echo "ROMS=$roms" >> $config_host_mak
3167 echo "MAKE=$make" >> $config_host_mak
3168 echo "INSTALL=$install" >> $config_host_mak
3169 echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
3170 echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
3171 echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
3172 echo "PYTHON=$python" >> $config_host_mak
3173 echo "CC=$cc" >> $config_host_mak
3174 echo "CC_I386=$cc_i386" >> $config_host_mak
3175 echo "HOST_CC=$host_cc" >> $config_host_mak
3176 echo "AR=$ar" >> $config_host_mak
3177 echo "OBJCOPY=$objcopy" >> $config_host_mak
3178 echo "LD=$ld" >> $config_host_mak
3179 echo "WINDRES=$windres" >> $config_host_mak
3180 echo "LIBTOOL=$libtool" >> $config_host_mak
3181 echo "CFLAGS=$CFLAGS" >> $config_host_mak
3182 echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
3183 echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
3184 if test "$sparse" = "yes" ; then
3185 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
3186 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
3187 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
3189 echo "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
3190 echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
3191 echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
3192 echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
3193 echo "LIBS+=$LIBS" >> $config_host_mak
3194 echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
3195 echo "EXESUF=$EXESUF" >> $config_host_mak
3196 echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
3198 # generate list of library paths for linker script
3200 $ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
3202 if test -f ${config_host_ld}~ ; then
3203 if cmp -s $config_host_ld ${config_host_ld}~ ; then
3204 mv ${config_host_ld}~ $config_host_ld
3205 else
3206 rm ${config_host_ld}~
3210 for d in libdis libdis-user; do
3211 mkdir -p $d
3212 symlink $source_path/Makefile.dis $d/Makefile
3213 echo > $d/config.mak
3214 done
3215 if test "$static" = "no" -a "$user_pie" = "yes" ; then
3216 echo "QEMU_CFLAGS+=-fpie" > libdis-user/config.mak
3219 for target in $target_list; do
3220 target_dir="$target"
3221 config_target_mak=$target_dir/config-target.mak
3222 target_arch2=`echo $target | cut -d '-' -f 1`
3223 target_bigendian="no"
3225 case "$target_arch2" in
3226 armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
3227 target_bigendian=yes
3229 esac
3230 target_softmmu="no"
3231 target_user_only="no"
3232 target_linux_user="no"
3233 target_darwin_user="no"
3234 target_bsd_user="no"
3235 case "$target" in
3236 ${target_arch2}-softmmu)
3237 target_softmmu="yes"
3239 ${target_arch2}-linux-user)
3240 if test "$linux" != "yes" ; then
3241 echo "ERROR: Target '$target' is only available on a Linux host"
3242 exit 1
3244 target_user_only="yes"
3245 target_linux_user="yes"
3247 ${target_arch2}-darwin-user)
3248 if test "$darwin" != "yes" ; then
3249 echo "ERROR: Target '$target' is only available on a Darwin host"
3250 exit 1
3252 target_user_only="yes"
3253 target_darwin_user="yes"
3255 ${target_arch2}-bsd-user)
3256 if test "$bsd" != "yes" ; then
3257 echo "ERROR: Target '$target' is only available on a BSD host"
3258 exit 1
3260 target_user_only="yes"
3261 target_bsd_user="yes"
3264 echo "ERROR: Target '$target' not recognised"
3265 exit 1
3267 esac
3269 mkdir -p $target_dir
3270 mkdir -p $target_dir/fpu
3271 mkdir -p $target_dir/tcg
3272 mkdir -p $target_dir/ide
3273 mkdir -p $target_dir/9pfs
3274 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
3275 mkdir -p $target_dir/nwfpe
3277 symlink $source_path/Makefile.target $target_dir/Makefile
3280 echo "# Automatically generated by configure - do not modify" > $config_target_mak
3282 bflt="no"
3283 target_nptl="no"
3284 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
3285 echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
3286 gdb_xml_files=""
3287 target_short_alignment=2
3288 target_int_alignment=4
3289 target_long_alignment=4
3290 target_llong_alignment=8
3291 target_libs_softmmu=
3293 TARGET_ARCH="$target_arch2"
3294 TARGET_BASE_ARCH=""
3295 TARGET_ABI_DIR=""
3297 case "$target_arch2" in
3298 i386)
3299 target_phys_bits=64
3301 x86_64)
3302 TARGET_BASE_ARCH=i386
3303 target_phys_bits=64
3304 target_long_alignment=8
3306 alpha)
3307 target_phys_bits=64
3308 target_long_alignment=8
3309 target_nptl="yes"
3311 arm|armeb)
3312 TARGET_ARCH=arm
3313 bflt="yes"
3314 target_nptl="yes"
3315 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
3316 target_phys_bits=32
3317 target_llong_alignment=4
3319 cris)
3320 target_nptl="yes"
3321 target_phys_bits=32
3323 lm32)
3324 target_phys_bits=32
3325 target_libs_softmmu="$opengl_libs"
3327 m68k)
3328 bflt="yes"
3329 gdb_xml_files="cf-core.xml cf-fp.xml"
3330 target_phys_bits=32
3331 target_int_alignment=2
3332 target_long_alignment=2
3333 target_llong_alignment=2
3335 microblaze|microblazeel)
3336 TARGET_ARCH=microblaze
3337 bflt="yes"
3338 target_nptl="yes"
3339 target_phys_bits=32
3340 target_libs_softmmu="$fdt_libs"
3342 mips|mipsel)
3343 TARGET_ARCH=mips
3344 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
3345 target_nptl="yes"
3346 target_phys_bits=64
3348 mipsn32|mipsn32el)
3349 TARGET_ARCH=mipsn32
3350 TARGET_BASE_ARCH=mips
3351 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
3352 target_phys_bits=64
3354 mips64|mips64el)
3355 TARGET_ARCH=mips64
3356 TARGET_BASE_ARCH=mips
3357 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
3358 target_phys_bits=64
3359 target_long_alignment=8
3361 ppc)
3362 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
3363 target_phys_bits=64
3364 target_nptl="yes"
3365 target_libs_softmmu="$fdt_libs"
3367 ppcemb)
3368 TARGET_BASE_ARCH=ppc
3369 TARGET_ABI_DIR=ppc
3370 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
3371 target_phys_bits=64
3372 target_nptl="yes"
3373 target_libs_softmmu="$fdt_libs"
3375 ppc64)
3376 TARGET_BASE_ARCH=ppc
3377 TARGET_ABI_DIR=ppc
3378 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
3379 target_phys_bits=64
3380 target_long_alignment=8
3381 target_libs_softmmu="$fdt_libs"
3383 ppc64abi32)
3384 TARGET_ARCH=ppc64
3385 TARGET_BASE_ARCH=ppc
3386 TARGET_ABI_DIR=ppc
3387 echo "TARGET_ABI32=y" >> $config_target_mak
3388 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
3389 target_phys_bits=64
3390 target_libs_softmmu="$fdt_libs"
3392 sh4|sh4eb)
3393 TARGET_ARCH=sh4
3394 bflt="yes"
3395 target_nptl="yes"
3396 target_phys_bits=32
3398 sparc)
3399 target_phys_bits=64
3401 sparc64)
3402 TARGET_BASE_ARCH=sparc
3403 target_phys_bits=64
3404 target_long_alignment=8
3406 sparc32plus)
3407 TARGET_ARCH=sparc64
3408 TARGET_BASE_ARCH=sparc
3409 TARGET_ABI_DIR=sparc
3410 echo "TARGET_ABI32=y" >> $config_target_mak
3411 target_phys_bits=64
3413 s390x)
3414 target_nptl="yes"
3415 target_phys_bits=64
3416 target_long_alignment=8
3418 unicore32)
3419 target_phys_bits=32
3421 xtensa|xtensaeb)
3422 TARGET_ARCH=xtensa
3423 target_phys_bits=32
3426 echo "Unsupported target CPU"
3427 exit 1
3429 esac
3430 echo "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak
3431 echo "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak
3432 echo "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak
3433 echo "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak
3434 echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
3435 target_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
3436 echo "TARGET_$target_arch_name=y" >> $config_target_mak
3437 echo "TARGET_ARCH2=$target_arch2" >> $config_target_mak
3438 # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
3439 if [ "$TARGET_BASE_ARCH" = "" ]; then
3440 TARGET_BASE_ARCH=$TARGET_ARCH
3442 echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
3443 if [ "$TARGET_ABI_DIR" = "" ]; then
3444 TARGET_ABI_DIR=$TARGET_ARCH
3446 echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
3447 case "$target_arch2" in
3448 i386|x86_64)
3449 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
3450 target_phys_bits=64
3451 echo "CONFIG_XEN=y" >> $config_target_mak
3452 else
3453 echo "CONFIG_NO_XEN=y" >> $config_target_mak
3457 echo "CONFIG_NO_XEN=y" >> $config_target_mak
3458 esac
3459 case "$target_arch2" in
3460 i386|x86_64|ppcemb|ppc|ppc64|s390x)
3461 # Make sure the target and host cpus are compatible
3462 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
3463 \( "$target_arch2" = "$cpu" -o \
3464 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
3465 \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \
3466 \( "$target_arch2" = "ppc" -a "$cpu" = "ppc64" \) -o \
3467 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
3468 \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \
3469 \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then
3470 echo "CONFIG_KVM=y" >> $config_target_mak
3471 if test "$vhost_net" = "yes" ; then
3472 echo "CONFIG_VHOST_NET=y" >> $config_target_mak
3475 esac
3476 if test "$target_arch2" = "ppc64" -a "$fdt" = "yes"; then
3477 echo "CONFIG_PSERIES=y" >> $config_target_mak
3479 if test "$target_bigendian" = "yes" ; then
3480 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
3482 if test "$target_softmmu" = "yes" ; then
3483 echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
3484 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
3485 echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak
3486 echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
3487 echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
3489 if test "$target_user_only" = "yes" ; then
3490 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
3492 if test "$target_linux_user" = "yes" ; then
3493 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
3495 if test "$target_darwin_user" = "yes" ; then
3496 echo "CONFIG_DARWIN_USER=y" >> $config_target_mak
3498 if test "$smartcard_nss" = "yes" ; then
3499 echo "subdir-$target: subdir-libcacard" >> $config_host_mak
3500 echo "libcacard_libs=$libcacard_libs" >> $config_host_mak
3501 echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
3503 list=""
3504 if test ! -z "$gdb_xml_files" ; then
3505 for x in $gdb_xml_files; do
3506 list="$list $source_path/gdb-xml/$x"
3507 done
3508 echo "TARGET_XML_FILES=$list" >> $config_target_mak
3511 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
3512 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
3514 if test "$target_user_only" = "yes" \
3515 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
3516 echo "CONFIG_USE_NPTL=y" >> $config_target_mak
3518 if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
3519 echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
3521 if test "$target_bsd_user" = "yes" ; then
3522 echo "CONFIG_BSD_USER=y" >> $config_target_mak
3525 # generate QEMU_CFLAGS/LDFLAGS for targets
3527 cflags=""
3528 includes=""
3529 ldflags=""
3531 if test "$tcg_interpreter" = "yes"; then
3532 includes="-I\$(SRC_PATH)/tcg/tci $includes"
3533 elif test "$ARCH" = "sparc64" ; then
3534 includes="-I\$(SRC_PATH)/tcg/sparc $includes"
3535 elif test "$ARCH" = "s390x" ; then
3536 includes="-I\$(SRC_PATH)/tcg/s390 $includes"
3537 elif test "$ARCH" = "x86_64" ; then
3538 includes="-I\$(SRC_PATH)/tcg/i386 $includes"
3539 else
3540 includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes"
3542 includes="-I\$(SRC_PATH)/tcg $includes"
3544 if test "$target_user_only" = "yes" ; then
3545 libdis_config_mak=libdis-user/config.mak
3546 else
3547 libdis_config_mak=libdis/config.mak
3550 for i in $ARCH $TARGET_BASE_ARCH ; do
3551 case "$i" in
3552 alpha)
3553 echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
3554 echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak
3556 arm)
3557 echo "CONFIG_ARM_DIS=y" >> $config_target_mak
3558 echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak
3560 cris)
3561 echo "CONFIG_CRIS_DIS=y" >> $config_target_mak
3562 echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak
3564 hppa)
3565 echo "CONFIG_HPPA_DIS=y" >> $config_target_mak
3566 echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak
3568 i386|x86_64)
3569 echo "CONFIG_I386_DIS=y" >> $config_target_mak
3570 echo "CONFIG_I386_DIS=y" >> $libdis_config_mak
3572 ia64*)
3573 echo "CONFIG_IA64_DIS=y" >> $config_target_mak
3574 echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak
3576 m68k)
3577 echo "CONFIG_M68K_DIS=y" >> $config_target_mak
3578 echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak
3580 microblaze*)
3581 echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak
3582 echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak
3584 mips*)
3585 echo "CONFIG_MIPS_DIS=y" >> $config_target_mak
3586 echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak
3588 ppc*)
3589 echo "CONFIG_PPC_DIS=y" >> $config_target_mak
3590 echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak
3592 s390*)
3593 echo "CONFIG_S390_DIS=y" >> $config_target_mak
3594 echo "CONFIG_S390_DIS=y" >> $libdis_config_mak
3596 sh4)
3597 echo "CONFIG_SH4_DIS=y" >> $config_target_mak
3598 echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak
3600 sparc*)
3601 echo "CONFIG_SPARC_DIS=y" >> $config_target_mak
3602 echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak
3604 xtensa*)
3605 echo "CONFIG_XTENSA_DIS=y" >> $config_target_mak
3606 echo "CONFIG_XTENSA_DIS=y" >> $libdis_config_mak
3608 esac
3609 done
3610 if test "$tcg_interpreter" = "yes" ; then
3611 echo "CONFIG_TCI_DIS=y" >> $config_target_mak
3612 echo "CONFIG_TCI_DIS=y" >> $libdis_config_mak
3615 case "$ARCH" in
3616 alpha)
3617 # Ensure there's only a single GP
3618 cflags="-msmall-data $cflags"
3620 esac
3622 if test "$target_softmmu" = "yes" ; then
3623 case "$TARGET_BASE_ARCH" in
3624 arm)
3625 cflags="-DHAS_AUDIO $cflags"
3627 lm32)
3628 cflags="-DHAS_AUDIO $cflags"
3630 i386|mips|ppc)
3631 cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
3633 esac
3636 if test "$target_user_only" = "yes" -a "$static" = "no" -a \
3637 "$user_pie" = "yes" ; then
3638 cflags="-fpie $cflags"
3639 ldflags="-pie $ldflags"
3642 if test "$target_softmmu" = "yes" -a \( \
3643 "$TARGET_ARCH" = "microblaze" -o \
3644 "$TARGET_ARCH" = "cris" \) ; then
3645 echo "CONFIG_NEED_MMU=y" >> $config_target_mak
3648 if test "$gprof" = "yes" ; then
3649 echo "TARGET_GPROF=yes" >> $config_target_mak
3650 if test "$target_linux_user" = "yes" ; then
3651 cflags="-p $cflags"
3652 ldflags="-p $ldflags"
3654 if test "$target_softmmu" = "yes" ; then
3655 ldflags="-p $ldflags"
3656 echo "GPROF_CFLAGS=-p" >> $config_target_mak
3660 if test "$ARCH" = "tci"; then
3661 linker_script=""
3662 else
3663 linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
3666 if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
3667 case "$ARCH" in
3668 sparc)
3669 # -static is used to avoid g1/g3 usage by the dynamic linker
3670 ldflags="$linker_script -static $ldflags"
3672 alpha | s390x)
3673 # The default placement of the application is fine.
3676 ldflags="$linker_script $ldflags"
3678 esac
3681 # use included Linux headers
3682 if test "$linux" = "yes" ; then
3683 includes="-I\$(SRC_PATH)/linux-headers $includes"
3684 mkdir -p linux-headers
3685 case "$cpu" in
3686 i386|x86_64)
3687 symlink $source_path/linux-headers/asm-x86 linux-headers/asm
3689 ppcemb|ppc|ppc64)
3690 symlink $source_path/linux-headers/asm-powerpc linux-headers/asm
3692 s390x)
3693 symlink $source_path/linux-headers/asm-s390 linux-headers/asm
3695 esac
3698 echo "LDFLAGS+=$ldflags" >> $config_target_mak
3699 echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
3700 echo "QEMU_INCLUDES+=$includes" >> $config_target_mak
3702 done # for target in $targets
3704 # build tree in object directory in case the source is not in the current directory
3705 DIRS="tests tests/cris slirp audio block net pc-bios/optionrom"
3706 DIRS="$DIRS pc-bios/spapr-rtas"
3707 DIRS="$DIRS roms/seabios roms/vgabios"
3708 DIRS="$DIRS fsdev ui"
3709 DIRS="$DIRS qapi qapi-generated"
3710 DIRS="$DIRS qga trace"
3711 FILES="Makefile tests/Makefile qdict-test-data.txt"
3712 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
3713 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
3714 FILES="$FILES pc-bios/spapr-rtas/Makefile"
3715 FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
3716 for bios_file in \
3717 $source_path/pc-bios/*.bin \
3718 $source_path/pc-bios/*.rom \
3719 $source_path/pc-bios/*.dtb \
3720 $source_path/pc-bios/openbios-* \
3721 $source_path/pc-bios/palcode-*
3723 FILES="$FILES pc-bios/`basename $bios_file`"
3724 done
3725 mkdir -p $DIRS
3726 for f in $FILES ; do
3727 if [ -e "$source_path/$f" ] && ! [ -e "$f" ]; then
3728 symlink "$source_path/$f" "$f"
3730 done
3732 # temporary config to build submodules
3733 for rom in seabios vgabios ; do
3734 config_mak=roms/$rom/config.mak
3735 echo "# Automatically generated by configure - do not modify" > $config_mak
3736 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
3737 echo "CC=$cc" >> $config_mak
3738 echo "BCC=bcc" >> $config_mak
3739 echo "CPP=${cross_prefix}cpp" >> $config_mak
3740 echo "OBJCOPY=objcopy" >> $config_mak
3741 echo "IASL=iasl" >> $config_mak
3742 echo "LD=$ld" >> $config_mak
3743 done
3745 for hwlib in 32 64; do
3746 d=libhw$hwlib
3747 mkdir -p $d
3748 mkdir -p $d/ide
3749 symlink $source_path/Makefile.hw $d/Makefile
3750 mkdir -p $d/9pfs
3751 echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
3752 done
3754 if [ "$source_path" != `pwd` ]; then
3755 # out of tree build
3756 mkdir -p libcacard
3757 rm -f libcacard/Makefile
3758 symlink "$source_path/libcacard/Makefile" libcacard/Makefile
3761 d=libuser
3762 mkdir -p $d
3763 mkdir -p $d/trace
3764 symlink $source_path/Makefile.user $d/Makefile
3765 if test "$static" = "no" -a "$user_pie" = "yes" ; then
3766 echo "QEMU_CFLAGS+=-fpie" > $d/config.mak
3769 if test "$docs" = "yes" ; then
3770 mkdir -p QMP