]> git.proxmox.com Git - mirror_qemu.git/blob - configure
configure: Don't override user's --cpu on MacOS and Solaris
[mirror_qemu.git] / configure
1 #!/bin/sh
2 #
3 # qemu configure script (c) 2003 Fabrice Bellard
4 #
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"
12 fi
13
14 TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
15 TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
16 TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.exe"
17
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
22
23 # Print a helpful header at the top of config.log
24 echo "# QEMU configure log $(date)" >> config.log
25 printf "# Configured with:" >> config.log
26 printf " '%s'" "$0" "$@" >> config.log
27 echo >> config.log
28 echo "#" >> config.log
29
30 do_cc() {
31 # Run the compiler, capturing its output to the log.
32 echo $cc "$@" >> config.log
33 $cc "$@" >> config.log 2>&1 || return $?
34 # Test passed. If this is an --enable-werror build, rerun
35 # the test with -Werror and bail out if it fails. This
36 # makes warning-generating-errors in configure test code
37 # obvious to developers.
38 if test "$werror" != "yes"; then
39 return 0
40 fi
41 # Don't bother rerunning the compile if we were already using -Werror
42 case "$*" in
43 *-Werror*)
44 return 0
45 ;;
46 esac
47 echo $cc -Werror "$@" >> config.log
48 $cc -Werror "$@" >> config.log 2>&1 && return $?
49 echo "ERROR: configure test passed without -Werror but failed with -Werror."
50 echo "This is probably a bug in the configure script. The failing command"
51 echo "will be at the bottom of config.log."
52 echo "You can run configure with --disable-werror to bypass this check."
53 exit 1
54 }
55
56 compile_object() {
57 do_cc $QEMU_CFLAGS -c -o $TMPO $TMPC
58 }
59
60 compile_prog() {
61 local_cflags="$1"
62 local_ldflags="$2"
63 do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
64 }
65
66 # symbolically link $1 to $2. Portable version of "ln -sf".
67 symlink() {
68 rm -rf "$2"
69 mkdir -p "$(dirname "$2")"
70 ln -s "$1" "$2"
71 }
72
73 # check whether a command is available to this shell (may be either an
74 # executable or a builtin)
75 has() {
76 type "$1" >/dev/null 2>&1
77 }
78
79 # search for an executable in PATH
80 path_of() {
81 local_command="$1"
82 local_ifs="$IFS"
83 local_dir=""
84
85 # pathname has a dir component?
86 if [ "${local_command#*/}" != "$local_command" ]; then
87 if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
88 echo "$local_command"
89 return 0
90 fi
91 fi
92 if [ -z "$local_command" ]; then
93 return 1
94 fi
95
96 IFS=:
97 for local_dir in $PATH; do
98 if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
99 echo "$local_dir/$local_command"
100 IFS="${local_ifs:-$(printf ' \t\n')}"
101 return 0
102 fi
103 done
104 # not found
105 IFS="${local_ifs:-$(printf ' \t\n')}"
106 return 1
107 }
108
109 # default parameters
110 source_path=`dirname "$0"`
111 cpu=""
112 interp_prefix="/usr/gnemul/qemu-%M"
113 static="no"
114 sparc_cpu=""
115 cross_prefix=""
116 audio_drv_list=""
117 audio_card_list="ac97 es1370 sb16 hda"
118 audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda"
119 block_drv_whitelist=""
120 host_cc="gcc"
121 helper_cflags=""
122 libs_softmmu=""
123 libs_tools=""
124 audio_pt_int=""
125 audio_win_int=""
126 cc_i386=i386-pc-linux-gnu-gcc
127 libs_qga=""
128 debug_info="yes"
129
130 target_list=""
131
132 # Default value for a variable defining feature "foo".
133 # * foo="no" feature will only be used if --enable-foo arg is given
134 # * foo="" feature will be searched for, and if found, will be used
135 # unless --disable-foo is given
136 # * foo="yes" this value will only be set by --enable-foo flag.
137 # feature will searched for,
138 # if not found, configure exits with error
139 #
140 # Always add --enable-foo and --disable-foo command line args.
141 # Distributions want to ensure that several features are compiled in, and it
142 # is impossible without a --enable-foo that exits if a feature is not found.
143
144 bluez=""
145 brlapi=""
146 curl=""
147 curses=""
148 docs=""
149 fdt=""
150 nptl=""
151 sdl=""
152 virtfs=""
153 vnc="yes"
154 sparse="no"
155 uuid=""
156 vde=""
157 vnc_tls=""
158 vnc_sasl=""
159 vnc_jpeg=""
160 vnc_png=""
161 xen=""
162 xen_ctrl_version=""
163 xen_pci_passthrough=""
164 linux_aio=""
165 cap_ng=""
166 attr=""
167 libattr=""
168 xfs=""
169
170 vhost_net="no"
171 kvm="no"
172 gprof="no"
173 debug_tcg="no"
174 debug="no"
175 strip_opt="yes"
176 tcg_interpreter="no"
177 bigendian="no"
178 mingw32="no"
179 EXESUF=""
180 prefix="/usr/local"
181 mandir="\${prefix}/share/man"
182 datadir="\${prefix}/share"
183 qemu_docdir="\${prefix}/share/doc/qemu"
184 bindir="\${prefix}/bin"
185 libdir="\${prefix}/lib"
186 includedir="\${prefix}/include"
187 sysconfdir="\${prefix}/etc"
188 confsuffix="/qemu"
189 slirp="yes"
190 fmod_lib=""
191 fmod_inc=""
192 oss_lib=""
193 bsd="no"
194 linux="no"
195 solaris="no"
196 profiler="no"
197 cocoa="no"
198 softmmu="yes"
199 linux_user="no"
200 bsd_user="no"
201 guest_base=""
202 uname_release=""
203 mixemu="no"
204 aix="no"
205 blobs="yes"
206 pkgversion=""
207 pie=""
208 zero_malloc=""
209 trace_backend="nop"
210 trace_file="trace"
211 spice=""
212 rbd=""
213 smartcard=""
214 smartcard_nss=""
215 usb_redir=""
216 opengl=""
217 zlib="yes"
218 guest_agent="yes"
219 libiscsi=""
220 coroutine=""
221
222 # parse CC options first
223 for opt do
224 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
225 case "$opt" in
226 --cross-prefix=*) cross_prefix="$optarg"
227 ;;
228 --cc=*) CC="$optarg"
229 ;;
230 --source-path=*) source_path="$optarg"
231 ;;
232 --cpu=*) cpu="$optarg"
233 ;;
234 --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
235 ;;
236 --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
237 ;;
238 --enable-debug-info) debug_info="yes"
239 ;;
240 --disable-debug-info) debug_info="no"
241 ;;
242 --sparc_cpu=*)
243 sparc_cpu="$optarg"
244 case $sparc_cpu in
245 v7|v8|v8plus|v8plusa)
246 cpu="sparc"
247 ;;
248 v9)
249 cpu="sparc64"
250 ;;
251 *)
252 echo "undefined SPARC architecture. Exiting";
253 exit 1
254 ;;
255 esac
256 ;;
257 esac
258 done
259 # OS specific
260 # Using uname is really, really broken. Once we have the right set of checks
261 # we can eliminate its usage altogether.
262
263 cc="${CC-${cross_prefix}gcc}"
264 ar="${AR-${cross_prefix}ar}"
265 objcopy="${OBJCOPY-${cross_prefix}objcopy}"
266 ld="${LD-${cross_prefix}ld}"
267 libtool="${LIBTOOL-${cross_prefix}libtool}"
268 strip="${STRIP-${cross_prefix}strip}"
269 windres="${WINDRES-${cross_prefix}windres}"
270 pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
271 query_pkg_config() {
272 "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
273 }
274 pkg_config=query_pkg_config
275 sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
276
277 # default flags for all hosts
278 QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
279 QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
280 QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
281 QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
282 QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/fpu"
283 if test "$debug_info" = "yes"; then
284 CFLAGS="-g $CFLAGS"
285 LDFLAGS="-g $LDFLAGS"
286 fi
287
288 # make source path absolute
289 source_path=`cd "$source_path"; pwd`
290
291 check_define() {
292 cat > $TMPC <<EOF
293 #if !defined($1)
294 #error $1 not defined
295 #endif
296 int main(void) { return 0; }
297 EOF
298 compile_object
299 }
300
301 if check_define __linux__ ; then
302 targetos="Linux"
303 elif check_define _WIN32 ; then
304 targetos='MINGW32'
305 elif check_define __OpenBSD__ ; then
306 targetos='OpenBSD'
307 elif check_define __sun__ ; then
308 targetos='SunOS'
309 elif check_define __HAIKU__ ; then
310 targetos='Haiku'
311 else
312 targetos=`uname -s`
313 fi
314
315 # Some host OSes need non-standard checks for which CPU to use.
316 # Note that these checks are broken for cross-compilation: if you're
317 # cross-compiling to one of these OSes then you'll need to specify
318 # the correct CPU with the --cpu option.
319 case $targetos in
320 Darwin)
321 # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
322 # run 64-bit userspace code.
323 # If the user didn't specify a CPU explicitly and the kernel says this is
324 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
325 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
326 cpu="x86_64"
327 fi
328 ;;
329 SunOS)
330 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
331 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
332 cpu="x86_64"
333 fi
334 esac
335
336 if test ! -z "$cpu" ; then
337 # command line argument
338 :
339 elif check_define __i386__ ; then
340 cpu="i386"
341 elif check_define __x86_64__ ; then
342 cpu="x86_64"
343 elif check_define __sparc__ ; then
344 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
345 # They must be specified using --sparc_cpu
346 if check_define __arch64__ ; then
347 cpu="sparc64"
348 else
349 cpu="sparc"
350 fi
351 elif check_define _ARCH_PPC ; then
352 if check_define _ARCH_PPC64 ; then
353 cpu="ppc64"
354 else
355 cpu="ppc"
356 fi
357 elif check_define __mips__ ; then
358 cpu="mips"
359 elif check_define __ia64__ ; then
360 cpu="ia64"
361 elif check_define __s390__ ; then
362 if check_define __s390x__ ; then
363 cpu="s390x"
364 else
365 cpu="s390"
366 fi
367 elif check_define __arm__ ; then
368 cpu="arm"
369 elif check_define __hppa__ ; then
370 cpu="hppa"
371 else
372 cpu=`uname -m`
373 fi
374
375 ARCH=
376 # Normalise host CPU name and set ARCH.
377 # Note that this case should only have supported host CPUs, not guests.
378 case "$cpu" in
379 ia64|ppc|ppc64|s390|s390x|sparc64)
380 cpu="$cpu"
381 ;;
382 i386|i486|i586|i686|i86pc|BePC)
383 cpu="i386"
384 ;;
385 x86_64|amd64)
386 cpu="x86_64"
387 ;;
388 armv*b|armv*l|arm)
389 cpu="arm"
390 ;;
391 hppa|parisc|parisc64)
392 cpu="hppa"
393 ;;
394 mips*)
395 cpu="mips"
396 ;;
397 sparc|sun4[cdmuv])
398 cpu="sparc"
399 ;;
400 *)
401 # This will result in either an error or falling back to TCI later
402 ARCH=unknown
403 ;;
404 esac
405 if test -z "$ARCH"; then
406 ARCH="$cpu"
407 fi
408
409 # OS specific
410
411 case $targetos in
412 CYGWIN*)
413 mingw32="yes"
414 QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
415 audio_possible_drivers="winwave sdl"
416 audio_drv_list="winwave"
417 ;;
418 MINGW32*)
419 mingw32="yes"
420 audio_possible_drivers="winwave dsound sdl fmod"
421 audio_drv_list="winwave"
422 ;;
423 GNU/kFreeBSD)
424 bsd="yes"
425 audio_drv_list="oss"
426 audio_possible_drivers="oss sdl esd pa"
427 ;;
428 FreeBSD)
429 bsd="yes"
430 make="${MAKE-gmake}"
431 audio_drv_list="oss"
432 audio_possible_drivers="oss sdl esd pa"
433 # needed for kinfo_getvmmap(3) in libutil.h
434 LIBS="-lutil $LIBS"
435 ;;
436 DragonFly)
437 bsd="yes"
438 make="${MAKE-gmake}"
439 audio_drv_list="oss"
440 audio_possible_drivers="oss sdl esd pa"
441 ;;
442 NetBSD)
443 bsd="yes"
444 make="${MAKE-gmake}"
445 audio_drv_list="oss"
446 audio_possible_drivers="oss sdl esd"
447 oss_lib="-lossaudio"
448 ;;
449 OpenBSD)
450 bsd="yes"
451 make="${MAKE-gmake}"
452 audio_drv_list="oss"
453 audio_possible_drivers="oss sdl esd"
454 oss_lib="-lossaudio"
455 ;;
456 Darwin)
457 bsd="yes"
458 darwin="yes"
459 if [ "$cpu" = "x86_64" ] ; then
460 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
461 LDFLAGS="-arch x86_64 $LDFLAGS"
462 else
463 QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
464 fi
465 cocoa="yes"
466 audio_drv_list="coreaudio"
467 audio_possible_drivers="coreaudio sdl fmod"
468 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
469 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
470 ;;
471 SunOS)
472 solaris="yes"
473 make="${MAKE-gmake}"
474 install="${INSTALL-ginstall}"
475 ld="gld"
476 smbd="${SMBD-/usr/sfw/sbin/smbd}"
477 needs_libsunmath="no"
478 solarisrev=`uname -r | cut -f2 -d.`
479 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
480 if test "$solarisrev" -le 9 ; then
481 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
482 needs_libsunmath="yes"
483 QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
484 LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
485 LIBS="-lsunmath $LIBS"
486 else
487 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
488 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
489 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
490 echo "Studio 11 can be downloaded from www.sun.com."
491 exit 1
492 fi
493 fi
494 fi
495 if test -f /usr/include/sys/soundcard.h ; then
496 audio_drv_list="oss"
497 fi
498 audio_possible_drivers="oss sdl"
499 # needed for CMSG_ macros in sys/socket.h
500 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
501 # needed for TIOCWIN* defines in termios.h
502 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
503 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
504 solarisnetlibs="-lsocket -lnsl -lresolv"
505 LIBS="$solarisnetlibs $LIBS"
506 libs_qga="$solarisnetlibs $libs_qga"
507 ;;
508 AIX)
509 aix="yes"
510 make="${MAKE-gmake}"
511 ;;
512 Haiku)
513 haiku="yes"
514 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
515 LIBS="-lposix_error_mapper -lnetwork $LIBS"
516 ;;
517 *)
518 audio_drv_list="oss"
519 audio_possible_drivers="oss alsa sdl esd pa"
520 linux="yes"
521 linux_user="yes"
522 usb="linux"
523 kvm="yes"
524 vhost_net="yes"
525 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
526 audio_possible_drivers="$audio_possible_drivers fmod"
527 fi
528 ;;
529 esac
530
531 if [ "$bsd" = "yes" ] ; then
532 if [ "$darwin" != "yes" ] ; then
533 usb="bsd"
534 bsd_user="yes"
535 fi
536 fi
537
538 : ${make=${MAKE-make}}
539 : ${install=${INSTALL-install}}
540 : ${python=${PYTHON-python}}
541 : ${smbd=${SMBD-/usr/sbin/smbd}}
542
543 if test "$mingw32" = "yes" ; then
544 EXESUF=".exe"
545 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
546 # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
547 QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
548 LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
549 cat > $TMPC << EOF
550 int main(void) { return 0; }
551 EOF
552 if compile_prog "" "-liberty" ; then
553 LIBS="-liberty $LIBS"
554 fi
555 prefix="c:/Program Files/QEMU"
556 mandir="\${prefix}"
557 datadir="\${prefix}"
558 qemu_docdir="\${prefix}"
559 bindir="\${prefix}"
560 sysconfdir="\${prefix}"
561 confsuffix=""
562 libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga"
563 fi
564
565 werror=""
566
567 for opt do
568 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
569 case "$opt" in
570 --help|-h) show_help=yes
571 ;;
572 --version|-V) exec cat $source_path/VERSION
573 ;;
574 --prefix=*) prefix="$optarg"
575 ;;
576 --interp-prefix=*) interp_prefix="$optarg"
577 ;;
578 --source-path=*)
579 ;;
580 --cross-prefix=*)
581 ;;
582 --cc=*)
583 ;;
584 --host-cc=*) host_cc="$optarg"
585 ;;
586 --make=*) make="$optarg"
587 ;;
588 --install=*) install="$optarg"
589 ;;
590 --python=*) python="$optarg"
591 ;;
592 --smbd=*) smbd="$optarg"
593 ;;
594 --extra-cflags=*)
595 ;;
596 --extra-ldflags=*)
597 ;;
598 --enable-debug-info)
599 ;;
600 --disable-debug-info)
601 ;;
602 --cpu=*)
603 ;;
604 --target-list=*) target_list="$optarg"
605 ;;
606 --enable-trace-backend=*) trace_backend="$optarg"
607 ;;
608 --with-trace-file=*) trace_file="$optarg"
609 ;;
610 --enable-gprof) gprof="yes"
611 ;;
612 --static)
613 static="yes"
614 LDFLAGS="-static $LDFLAGS"
615 QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
616 ;;
617 --mandir=*) mandir="$optarg"
618 ;;
619 --bindir=*) bindir="$optarg"
620 ;;
621 --libdir=*) libdir="$optarg"
622 ;;
623 --includedir=*) includedir="$optarg"
624 ;;
625 --datadir=*) datadir="$optarg"
626 ;;
627 --with-confsuffix=*) confsuffix="$optarg"
628 ;;
629 --docdir=*) qemu_docdir="$optarg"
630 ;;
631 --sysconfdir=*) sysconfdir="$optarg"
632 ;;
633 --sbindir=*|--libexecdir=*|--sharedstatedir=*|--localstatedir=*|\
634 --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
635 --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
636 # These switches are silently ignored, for compatibility with
637 # autoconf-generated configure scripts. This allows QEMU's
638 # configure to be used by RPM and similar macros that set
639 # lots of directory switches by default.
640 ;;
641 --disable-sdl) sdl="no"
642 ;;
643 --enable-sdl) sdl="yes"
644 ;;
645 --disable-virtfs) virtfs="no"
646 ;;
647 --enable-virtfs) virtfs="yes"
648 ;;
649 --disable-vnc) vnc="no"
650 ;;
651 --enable-vnc) vnc="yes"
652 ;;
653 --fmod-lib=*) fmod_lib="$optarg"
654 ;;
655 --fmod-inc=*) fmod_inc="$optarg"
656 ;;
657 --oss-lib=*) oss_lib="$optarg"
658 ;;
659 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
660 ;;
661 --audio-drv-list=*) audio_drv_list="$optarg"
662 ;;
663 --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
664 ;;
665 --enable-debug-tcg) debug_tcg="yes"
666 ;;
667 --disable-debug-tcg) debug_tcg="no"
668 ;;
669 --enable-debug)
670 # Enable debugging options that aren't excessively noisy
671 debug_tcg="yes"
672 debug="yes"
673 strip_opt="no"
674 ;;
675 --enable-sparse) sparse="yes"
676 ;;
677 --disable-sparse) sparse="no"
678 ;;
679 --disable-strip) strip_opt="no"
680 ;;
681 --disable-vnc-tls) vnc_tls="no"
682 ;;
683 --enable-vnc-tls) vnc_tls="yes"
684 ;;
685 --disable-vnc-sasl) vnc_sasl="no"
686 ;;
687 --enable-vnc-sasl) vnc_sasl="yes"
688 ;;
689 --disable-vnc-jpeg) vnc_jpeg="no"
690 ;;
691 --enable-vnc-jpeg) vnc_jpeg="yes"
692 ;;
693 --disable-vnc-png) vnc_png="no"
694 ;;
695 --enable-vnc-png) vnc_png="yes"
696 ;;
697 --disable-slirp) slirp="no"
698 ;;
699 --disable-uuid) uuid="no"
700 ;;
701 --enable-uuid) uuid="yes"
702 ;;
703 --disable-vde) vde="no"
704 ;;
705 --enable-vde) vde="yes"
706 ;;
707 --disable-xen) xen="no"
708 ;;
709 --enable-xen) xen="yes"
710 ;;
711 --disable-xen-pci-passthrough) xen_pci_passthrough="no"
712 ;;
713 --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
714 ;;
715 --disable-brlapi) brlapi="no"
716 ;;
717 --enable-brlapi) brlapi="yes"
718 ;;
719 --disable-bluez) bluez="no"
720 ;;
721 --enable-bluez) bluez="yes"
722 ;;
723 --disable-kvm) kvm="no"
724 ;;
725 --enable-kvm) kvm="yes"
726 ;;
727 --disable-tcg-interpreter) tcg_interpreter="no"
728 ;;
729 --enable-tcg-interpreter) tcg_interpreter="yes"
730 ;;
731 --disable-cap-ng) cap_ng="no"
732 ;;
733 --enable-cap-ng) cap_ng="yes"
734 ;;
735 --disable-spice) spice="no"
736 ;;
737 --enable-spice) spice="yes"
738 ;;
739 --disable-libiscsi) libiscsi="no"
740 ;;
741 --enable-libiscsi) libiscsi="yes"
742 ;;
743 --enable-profiler) profiler="yes"
744 ;;
745 --disable-cocoa) cocoa="no"
746 ;;
747 --enable-cocoa)
748 cocoa="yes" ;
749 sdl="no" ;
750 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
751 ;;
752 --disable-system) softmmu="no"
753 ;;
754 --enable-system) softmmu="yes"
755 ;;
756 --disable-user)
757 linux_user="no" ;
758 bsd_user="no" ;
759 ;;
760 --enable-user) ;;
761 --disable-linux-user) linux_user="no"
762 ;;
763 --enable-linux-user) linux_user="yes"
764 ;;
765 --disable-bsd-user) bsd_user="no"
766 ;;
767 --enable-bsd-user) bsd_user="yes"
768 ;;
769 --enable-guest-base) guest_base="yes"
770 ;;
771 --disable-guest-base) guest_base="no"
772 ;;
773 --enable-pie) pie="yes"
774 ;;
775 --disable-pie) pie="no"
776 ;;
777 --enable-uname-release=*) uname_release="$optarg"
778 ;;
779 --sparc_cpu=*)
780 ;;
781 --enable-werror) werror="yes"
782 ;;
783 --disable-werror) werror="no"
784 ;;
785 --disable-curses) curses="no"
786 ;;
787 --enable-curses) curses="yes"
788 ;;
789 --disable-curl) curl="no"
790 ;;
791 --enable-curl) curl="yes"
792 ;;
793 --disable-fdt) fdt="no"
794 ;;
795 --enable-fdt) fdt="yes"
796 ;;
797 --disable-nptl) nptl="no"
798 ;;
799 --enable-nptl) nptl="yes"
800 ;;
801 --enable-mixemu) mixemu="yes"
802 ;;
803 --disable-linux-aio) linux_aio="no"
804 ;;
805 --enable-linux-aio) linux_aio="yes"
806 ;;
807 --disable-attr) attr="no"
808 ;;
809 --enable-attr) attr="yes"
810 ;;
811 --disable-blobs) blobs="no"
812 ;;
813 --with-pkgversion=*) pkgversion=" ($optarg)"
814 ;;
815 --with-coroutine=*) coroutine="$optarg"
816 ;;
817 --disable-docs) docs="no"
818 ;;
819 --enable-docs) docs="yes"
820 ;;
821 --disable-vhost-net) vhost_net="no"
822 ;;
823 --enable-vhost-net) vhost_net="yes"
824 ;;
825 --disable-opengl) opengl="no"
826 ;;
827 --enable-opengl) opengl="yes"
828 ;;
829 --disable-rbd) rbd="no"
830 ;;
831 --enable-rbd) rbd="yes"
832 ;;
833 --disable-xfsctl) xfs="no"
834 ;;
835 --enable-xfsctl) xfs="yes"
836 ;;
837 --disable-smartcard) smartcard="no"
838 ;;
839 --enable-smartcard) smartcard="yes"
840 ;;
841 --disable-smartcard-nss) smartcard_nss="no"
842 ;;
843 --enable-smartcard-nss) smartcard_nss="yes"
844 ;;
845 --disable-usb-redir) usb_redir="no"
846 ;;
847 --enable-usb-redir) usb_redir="yes"
848 ;;
849 --disable-zlib-test) zlib="no"
850 ;;
851 --enable-guest-agent) guest_agent="yes"
852 ;;
853 --disable-guest-agent) guest_agent="no"
854 ;;
855 *) echo "ERROR: unknown option $opt"; show_help="yes"
856 ;;
857 esac
858 done
859
860 #
861 # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
862 # QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
863 #
864 host_guest_base="no"
865 case "$cpu" in
866 sparc) case $sparc_cpu in
867 v7|v8)
868 QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
869 ;;
870 v8plus|v8plusa)
871 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
872 ;;
873 *) # sparc_cpu not defined in the command line
874 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
875 esac
876 LDFLAGS="-m32 $LDFLAGS"
877 QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
878 if test "$solaris" = "no" ; then
879 QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
880 helper_cflags="-ffixed-i0"
881 fi
882 ;;
883 sparc64)
884 QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
885 LDFLAGS="-m64 $LDFLAGS"
886 QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
887 if test "$solaris" != "no" ; then
888 QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
889 fi
890 ;;
891 s390)
892 QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS"
893 LDFLAGS="-m31 $LDFLAGS"
894 host_guest_base="yes"
895 ;;
896 s390x)
897 QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS"
898 LDFLAGS="-m64 $LDFLAGS"
899 host_guest_base="yes"
900 ;;
901 i386)
902 QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
903 LDFLAGS="-m32 $LDFLAGS"
904 cc_i386='$(CC) -m32'
905 helper_cflags="-fomit-frame-pointer"
906 host_guest_base="yes"
907 ;;
908 x86_64)
909 QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
910 LDFLAGS="-m64 $LDFLAGS"
911 cc_i386='$(CC) -m32'
912 host_guest_base="yes"
913 ;;
914 arm*)
915 host_guest_base="yes"
916 ;;
917 ppc*)
918 host_guest_base="yes"
919 ;;
920 mips*)
921 host_guest_base="yes"
922 ;;
923 ia64*)
924 host_guest_base="yes"
925 ;;
926 hppa*)
927 host_guest_base="yes"
928 ;;
929 unicore32*)
930 host_guest_base="yes"
931 ;;
932 esac
933
934 [ -z "$guest_base" ] && guest_base="$host_guest_base"
935
936
937 default_target_list=""
938
939 # these targets are portable
940 if [ "$softmmu" = "yes" ] ; then
941 default_target_list="\
942 i386-softmmu \
943 x86_64-softmmu \
944 alpha-softmmu \
945 arm-softmmu \
946 cris-softmmu \
947 lm32-softmmu \
948 m68k-softmmu \
949 microblaze-softmmu \
950 microblazeel-softmmu \
951 mips-softmmu \
952 mipsel-softmmu \
953 mips64-softmmu \
954 mips64el-softmmu \
955 or32-softmmu \
956 ppc-softmmu \
957 ppcemb-softmmu \
958 ppc64-softmmu \
959 sh4-softmmu \
960 sh4eb-softmmu \
961 sparc-softmmu \
962 sparc64-softmmu \
963 s390x-softmmu \
964 xtensa-softmmu \
965 xtensaeb-softmmu \
966 unicore32-softmmu \
967 "
968 fi
969 # the following are Linux specific
970 if [ "$linux_user" = "yes" ] ; then
971 default_target_list="${default_target_list}\
972 i386-linux-user \
973 x86_64-linux-user \
974 alpha-linux-user \
975 arm-linux-user \
976 armeb-linux-user \
977 cris-linux-user \
978 m68k-linux-user \
979 microblaze-linux-user \
980 microblazeel-linux-user \
981 mips-linux-user \
982 mipsel-linux-user \
983 or32-linux-user \
984 ppc-linux-user \
985 ppc64-linux-user \
986 ppc64abi32-linux-user \
987 sh4-linux-user \
988 sh4eb-linux-user \
989 sparc-linux-user \
990 sparc64-linux-user \
991 sparc32plus-linux-user \
992 unicore32-linux-user \
993 s390x-linux-user \
994 "
995 fi
996 # the following are BSD specific
997 if [ "$bsd_user" = "yes" ] ; then
998 default_target_list="${default_target_list}\
999 i386-bsd-user \
1000 x86_64-bsd-user \
1001 sparc-bsd-user \
1002 sparc64-bsd-user \
1003 "
1004 fi
1005
1006 if test x"$show_help" = x"yes" ; then
1007 cat << EOF
1008
1009 Usage: configure [options]
1010 Options: [defaults in brackets after descriptions]
1011
1012 EOF
1013 echo "Standard options:"
1014 echo " --help print this message"
1015 echo " --prefix=PREFIX install in PREFIX [$prefix]"
1016 echo " --interp-prefix=PREFIX where to find shared libraries, etc."
1017 echo " use %M for cpu name [$interp_prefix]"
1018 echo " --target-list=LIST set target list (default: build everything)"
1019 echo "Available targets: $default_target_list" | \
1020 fold -s -w 53 | sed -e 's/^/ /'
1021 echo ""
1022 echo "Advanced options (experts only):"
1023 echo " --source-path=PATH path of source code [$source_path]"
1024 echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
1025 echo " --cc=CC use C compiler CC [$cc]"
1026 echo " --host-cc=CC use C compiler CC [$host_cc] for code run at"
1027 echo " build time"
1028 echo " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS"
1029 echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS"
1030 echo " --make=MAKE use specified make [$make]"
1031 echo " --install=INSTALL use specified install [$install]"
1032 echo " --python=PYTHON use specified python [$python]"
1033 echo " --smbd=SMBD use specified smbd [$smbd]"
1034 echo " --static enable static build [$static]"
1035 echo " --mandir=PATH install man pages in PATH"
1036 echo " --datadir=PATH install firmware in PATH$confsuffix"
1037 echo " --docdir=PATH install documentation in PATH$confsuffix"
1038 echo " --bindir=PATH install binaries in PATH"
1039 echo " --sysconfdir=PATH install config in PATH$confsuffix"
1040 echo " --with-confsuffix=SUFFIX suffix for QEMU data inside datadir and sysconfdir [$confsuffix]"
1041 echo " --enable-debug-tcg enable TCG debugging"
1042 echo " --disable-debug-tcg disable TCG debugging (default)"
1043 echo " --enable-debug enable common debug build options"
1044 echo " --enable-sparse enable sparse checker"
1045 echo " --disable-sparse disable sparse checker (default)"
1046 echo " --disable-strip disable stripping binaries"
1047 echo " --disable-werror disable compilation abort on warning"
1048 echo " --disable-sdl disable SDL"
1049 echo " --enable-sdl enable SDL"
1050 echo " --disable-virtfs disable VirtFS"
1051 echo " --enable-virtfs enable VirtFS"
1052 echo " --disable-vnc disable VNC"
1053 echo " --enable-vnc enable VNC"
1054 echo " --disable-cocoa disable Cocoa (Mac OS X only)"
1055 echo " --enable-cocoa enable Cocoa (default on Mac OS X)"
1056 echo " --audio-drv-list=LIST set audio drivers list:"
1057 echo " Available drivers: $audio_possible_drivers"
1058 echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
1059 echo " Available cards: $audio_possible_cards"
1060 echo " --block-drv-whitelist=L set block driver whitelist"
1061 echo " (affects only QEMU, not qemu-img)"
1062 echo " --enable-mixemu enable mixer emulation"
1063 echo " --disable-xen disable xen backend driver support"
1064 echo " --enable-xen enable xen backend driver support"
1065 echo " --disable-xen-pci-passthrough"
1066 echo " --enable-xen-pci-passthrough"
1067 echo " --disable-brlapi disable BrlAPI"
1068 echo " --enable-brlapi enable BrlAPI"
1069 echo " --disable-vnc-tls disable TLS encryption for VNC server"
1070 echo " --enable-vnc-tls enable TLS encryption for VNC server"
1071 echo " --disable-vnc-sasl disable SASL encryption for VNC server"
1072 echo " --enable-vnc-sasl enable SASL encryption for VNC server"
1073 echo " --disable-vnc-jpeg disable JPEG lossy compression for VNC server"
1074 echo " --enable-vnc-jpeg enable JPEG lossy compression for VNC server"
1075 echo " --disable-vnc-png disable PNG compression for VNC server (default)"
1076 echo " --enable-vnc-png enable PNG compression for VNC server"
1077 echo " --disable-curses disable curses output"
1078 echo " --enable-curses enable curses output"
1079 echo " --disable-curl disable curl connectivity"
1080 echo " --enable-curl enable curl connectivity"
1081 echo " --disable-fdt disable fdt device tree"
1082 echo " --enable-fdt enable fdt device tree"
1083 echo " --disable-bluez disable bluez stack connectivity"
1084 echo " --enable-bluez enable bluez stack connectivity"
1085 echo " --disable-slirp disable SLIRP userspace network connectivity"
1086 echo " --disable-kvm disable KVM acceleration support"
1087 echo " --enable-kvm enable KVM acceleration support"
1088 echo " --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)"
1089 echo " --disable-nptl disable usermode NPTL support"
1090 echo " --enable-nptl enable usermode NPTL support"
1091 echo " --enable-system enable all system emulation targets"
1092 echo " --disable-system disable all system emulation targets"
1093 echo " --enable-user enable supported user emulation targets"
1094 echo " --disable-user disable all user emulation targets"
1095 echo " --enable-linux-user enable all linux usermode emulation targets"
1096 echo " --disable-linux-user disable all linux usermode emulation targets"
1097 echo " --enable-bsd-user enable all BSD usermode emulation targets"
1098 echo " --disable-bsd-user disable all BSD usermode emulation targets"
1099 echo " --enable-guest-base enable GUEST_BASE support for usermode"
1100 echo " emulation targets"
1101 echo " --disable-guest-base disable GUEST_BASE support"
1102 echo " --enable-pie build Position Independent Executables"
1103 echo " --disable-pie do not build Position Independent Executables"
1104 echo " --fmod-lib path to FMOD library"
1105 echo " --fmod-inc path to FMOD includes"
1106 echo " --oss-lib path to OSS library"
1107 echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
1108 echo " --cpu=CPU Build for host CPU [$cpu]"
1109 echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
1110 echo " --disable-uuid disable uuid support"
1111 echo " --enable-uuid enable uuid support"
1112 echo " --disable-vde disable support for vde network"
1113 echo " --enable-vde enable support for vde network"
1114 echo " --disable-linux-aio disable Linux AIO support"
1115 echo " --enable-linux-aio enable Linux AIO support"
1116 echo " --disable-cap-ng disable libcap-ng support"
1117 echo " --enable-cap-ng enable libcap-ng support"
1118 echo " --disable-attr disables attr and xattr support"
1119 echo " --enable-attr enable attr and xattr support"
1120 echo " --disable-blobs disable installing provided firmware blobs"
1121 echo " --enable-docs enable documentation build"
1122 echo " --disable-docs disable documentation build"
1123 echo " --disable-vhost-net disable vhost-net acceleration support"
1124 echo " --enable-vhost-net enable vhost-net acceleration support"
1125 echo " --enable-trace-backend=B Set trace backend"
1126 echo " Available backends:" $($python "$source_path"/scripts/tracetool.py --list-backends)
1127 echo " --with-trace-file=NAME Full PATH,NAME of file to store traces"
1128 echo " Default:trace-<pid>"
1129 echo " --disable-spice disable spice"
1130 echo " --enable-spice enable spice"
1131 echo " --enable-rbd enable building the rados block device (rbd)"
1132 echo " --disable-libiscsi disable iscsi support"
1133 echo " --enable-libiscsi enable iscsi support"
1134 echo " --disable-smartcard disable smartcard support"
1135 echo " --enable-smartcard enable smartcard support"
1136 echo " --disable-smartcard-nss disable smartcard nss support"
1137 echo " --enable-smartcard-nss enable smartcard nss support"
1138 echo " --disable-usb-redir disable usb network redirection support"
1139 echo " --enable-usb-redir enable usb network redirection support"
1140 echo " --disable-guest-agent disable building of the QEMU Guest Agent"
1141 echo " --enable-guest-agent enable building of the QEMU Guest Agent"
1142 echo " --with-coroutine=BACKEND coroutine backend. Supported options:"
1143 echo " gthread, ucontext, sigaltstack, windows"
1144 echo ""
1145 echo "NOTE: The object files are built at the place where configure is launched"
1146 exit 1
1147 fi
1148
1149 # Now we have handled --enable-tcg-interpreter and know we're not just
1150 # printing the help message, bail out if the host CPU isn't supported.
1151 if test "$ARCH" = "unknown"; then
1152 if test "$tcg_interpreter" = "yes" ; then
1153 echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
1154 ARCH=tci
1155 else
1156 echo "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
1157 exit 1
1158 fi
1159 fi
1160
1161 # check that the C compiler works.
1162 cat > $TMPC <<EOF
1163 int main(void) { return 0; }
1164 EOF
1165
1166 if compile_object ; then
1167 : C compiler works ok
1168 else
1169 echo "ERROR: \"$cc\" either does not exist or does not work"
1170 exit 1
1171 fi
1172
1173 # Consult white-list to determine whether to enable werror
1174 # by default. Only enable by default for git builds
1175 z_version=`cut -f3 -d. $source_path/VERSION`
1176
1177 if test -z "$werror" ; then
1178 if test "$z_version" = "50" -a \
1179 "$linux" = "yes" ; then
1180 werror="yes"
1181 else
1182 werror="no"
1183 fi
1184 fi
1185
1186 gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
1187 gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
1188 gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
1189 gcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags"
1190 # Note that we do not add -Werror to gcc_flags here, because that would
1191 # enable it for all configure tests. If a configure test failed due
1192 # to -Werror this would just silently disable some features,
1193 # so it's too error prone.
1194 cat > $TMPC << EOF
1195 int main(void) { return 0; }
1196 EOF
1197 for flag in $gcc_flags; do
1198 if compile_prog "-Werror $flag" "" ; then
1199 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1200 fi
1201 done
1202
1203 if test "$static" = "yes" ; then
1204 if test "$pie" = "yes" ; then
1205 echo "static and pie are mutually incompatible"
1206 exit 1
1207 else
1208 pie="no"
1209 fi
1210 fi
1211
1212 if test "$pie" = ""; then
1213 case "$cpu-$targetos" in
1214 i386-Linux|x86_64-Linux|i386-OpenBSD|x86_64-OpenBSD)
1215 ;;
1216 *)
1217 pie="no"
1218 ;;
1219 esac
1220 fi
1221
1222 if test "$pie" != "no" ; then
1223 cat > $TMPC << EOF
1224
1225 #ifdef __linux__
1226 # define THREAD __thread
1227 #else
1228 # define THREAD
1229 #endif
1230
1231 static THREAD int tls_var;
1232
1233 int main(void) { return tls_var; }
1234
1235 EOF
1236 if compile_prog "-fPIE -DPIE" "-pie"; then
1237 QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
1238 LDFLAGS="-pie $LDFLAGS"
1239 pie="yes"
1240 if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
1241 LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
1242 fi
1243 else
1244 if test "$pie" = "yes"; then
1245 echo "PIE not available due to missing toolchain support"
1246 exit 1
1247 else
1248 echo "Disabling PIE due to missing toolchain support"
1249 pie="no"
1250 fi
1251 fi
1252 fi
1253
1254 #
1255 # Solaris specific configure tool chain decisions
1256 #
1257 if test "$solaris" = "yes" ; then
1258 if has $install; then
1259 :
1260 else
1261 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
1262 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
1263 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
1264 exit 1
1265 fi
1266 if test "`path_of $install`" = "/usr/sbin/install" ; then
1267 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
1268 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
1269 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
1270 exit 1
1271 fi
1272 if has ar; then
1273 :
1274 else
1275 echo "Error: No path includes ar"
1276 if test -f /usr/ccs/bin/ar ; then
1277 echo "Add /usr/ccs/bin to your path and rerun configure"
1278 fi
1279 exit 1
1280 fi
1281 fi
1282
1283 if ! has $python; then
1284 echo "Python not found. Use --python=/path/to/python"
1285 exit 1
1286 fi
1287
1288 # Note that if the Python conditional here evaluates True we will exit
1289 # with status 1 which is a shell 'false' value.
1290 if ! "$python" -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))'; then
1291 echo "Cannot use '$python', Python 2.4 or later is required."
1292 echo "Note that Python 3 or later is not yet supported."
1293 echo "Use --python=/path/to/python to specify a supported Python."
1294 exit 1
1295 fi
1296
1297 if test -z "$target_list" ; then
1298 target_list="$default_target_list"
1299 else
1300 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
1301 fi
1302 if test -z "$target_list" ; then
1303 echo "No targets enabled"
1304 exit 1
1305 fi
1306 # see if system emulation was really requested
1307 case " $target_list " in
1308 *"-softmmu "*) softmmu=yes
1309 ;;
1310 *) softmmu=no
1311 ;;
1312 esac
1313
1314 feature_not_found() {
1315 feature=$1
1316
1317 echo "ERROR"
1318 echo "ERROR: User requested feature $feature"
1319 echo "ERROR: configure was not able to find it"
1320 echo "ERROR"
1321 exit 1;
1322 }
1323
1324 if test -z "$cross_prefix" ; then
1325
1326 # ---
1327 # big/little endian test
1328 cat > $TMPC << EOF
1329 #include <inttypes.h>
1330 int main(int argc, char ** argv){
1331 volatile uint32_t i=0x01234567;
1332 return (*((uint8_t*)(&i))) == 0x67;
1333 }
1334 EOF
1335
1336 if compile_prog "" "" ; then
1337 $TMPE && bigendian="yes"
1338 else
1339 echo big/little test failed
1340 fi
1341
1342 else
1343
1344 # if cross compiling, cannot launch a program, so make a static guess
1345 case "$cpu" in
1346 arm)
1347 # ARM can be either way; ask the compiler which one we are
1348 if check_define __ARMEB__; then
1349 bigendian=yes
1350 fi
1351 ;;
1352 hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
1353 bigendian=yes
1354 ;;
1355 esac
1356
1357 fi
1358
1359 ##########################################
1360 # NPTL probe
1361
1362 if test "$nptl" != "no" ; then
1363 cat > $TMPC <<EOF
1364 #include <sched.h>
1365 #include <linux/futex.h>
1366 int main(void) {
1367 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1368 #error bork
1369 #endif
1370 return 0;
1371 }
1372 EOF
1373
1374 if compile_object ; then
1375 nptl=yes
1376 else
1377 if test "$nptl" = "yes" ; then
1378 feature_not_found "nptl"
1379 fi
1380 nptl=no
1381 fi
1382 fi
1383
1384 ##########################################
1385 # zlib check
1386
1387 if test "$zlib" != "no" ; then
1388 cat > $TMPC << EOF
1389 #include <zlib.h>
1390 int main(void) { zlibVersion(); return 0; }
1391 EOF
1392 if compile_prog "" "-lz" ; then
1393 :
1394 else
1395 echo
1396 echo "Error: zlib check failed"
1397 echo "Make sure to have the zlib libs and headers installed."
1398 echo
1399 exit 1
1400 fi
1401 fi
1402
1403 ##########################################
1404 # xen probe
1405
1406 if test "$xen" != "no" ; then
1407 xen_libs="-lxenstore -lxenctrl -lxenguest"
1408
1409 # First we test whether Xen headers and libraries are available.
1410 # If no, we are done and there is no Xen support.
1411 # If yes, more tests are run to detect the Xen version.
1412
1413 # Xen (any)
1414 cat > $TMPC <<EOF
1415 #include <xenctrl.h>
1416 int main(void) {
1417 return 0;
1418 }
1419 EOF
1420 if ! compile_prog "" "$xen_libs" ; then
1421 # Xen not found
1422 if test "$xen" = "yes" ; then
1423 feature_not_found "xen"
1424 fi
1425 xen=no
1426
1427 # Xen unstable
1428 elif
1429 cat > $TMPC <<EOF &&
1430 #include <xenctrl.h>
1431 #include <xenstore.h>
1432 #include <stdint.h>
1433 #include <xen/hvm/hvm_info_table.h>
1434 #if !defined(HVM_MAX_VCPUS)
1435 # error HVM_MAX_VCPUS not defined
1436 #endif
1437 int main(void) {
1438 xc_interface *xc;
1439 xs_daemon_open();
1440 xc = xc_interface_open(0, 0, 0);
1441 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1442 xc_gnttab_open(NULL, 0);
1443 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1444 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
1445 return 0;
1446 }
1447 EOF
1448 compile_prog "" "$xen_libs"
1449 then
1450 xen_ctrl_version=420
1451 xen=yes
1452
1453 elif
1454 cat > $TMPC <<EOF &&
1455 #include <xenctrl.h>
1456 #include <xs.h>
1457 #include <stdint.h>
1458 #include <xen/hvm/hvm_info_table.h>
1459 #if !defined(HVM_MAX_VCPUS)
1460 # error HVM_MAX_VCPUS not defined
1461 #endif
1462 int main(void) {
1463 xs_daemon_open();
1464 xc_interface_open(0, 0, 0);
1465 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1466 xc_gnttab_open(NULL, 0);
1467 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1468 return 0;
1469 }
1470 EOF
1471 compile_prog "" "$xen_libs"
1472 then
1473 xen_ctrl_version=410
1474 xen=yes
1475
1476 # Xen 4.0.0
1477 elif
1478 cat > $TMPC <<EOF &&
1479 #include <xenctrl.h>
1480 #include <xs.h>
1481 #include <stdint.h>
1482 #include <xen/hvm/hvm_info_table.h>
1483 #if !defined(HVM_MAX_VCPUS)
1484 # error HVM_MAX_VCPUS not defined
1485 #endif
1486 int main(void) {
1487 struct xen_add_to_physmap xatp = {
1488 .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1489 };
1490 xs_daemon_open();
1491 xc_interface_open();
1492 xc_gnttab_open();
1493 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1494 xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1495 return 0;
1496 }
1497 EOF
1498 compile_prog "" "$xen_libs"
1499 then
1500 xen_ctrl_version=400
1501 xen=yes
1502
1503 # Xen 3.4.0
1504 elif
1505 cat > $TMPC <<EOF &&
1506 #include <xenctrl.h>
1507 #include <xs.h>
1508 int main(void) {
1509 struct xen_add_to_physmap xatp = {
1510 .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1511 };
1512 xs_daemon_open();
1513 xc_interface_open();
1514 xc_gnttab_open();
1515 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1516 xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1517 return 0;
1518 }
1519 EOF
1520 compile_prog "" "$xen_libs"
1521 then
1522 xen_ctrl_version=340
1523 xen=yes
1524
1525 # Xen 3.3.0
1526 elif
1527 cat > $TMPC <<EOF &&
1528 #include <xenctrl.h>
1529 #include <xs.h>
1530 int main(void) {
1531 xs_daemon_open();
1532 xc_interface_open();
1533 xc_gnttab_open();
1534 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1535 return 0;
1536 }
1537 EOF
1538 compile_prog "" "$xen_libs"
1539 then
1540 xen_ctrl_version=330
1541 xen=yes
1542
1543 # Xen version unsupported
1544 else
1545 if test "$xen" = "yes" ; then
1546 feature_not_found "xen (unsupported version)"
1547 fi
1548 xen=no
1549 fi
1550
1551 if test "$xen" = yes; then
1552 libs_softmmu="$xen_libs $libs_softmmu"
1553 fi
1554 fi
1555
1556 if test "$xen_pci_passthrough" != "no"; then
1557 if test "$xen" = "yes" && test "$linux" = "yes" &&
1558 test "$xen_ctrl_version" -ge 340; then
1559 xen_pci_passthrough=yes
1560 else
1561 if test "$xen_pci_passthrough" = "yes"; then
1562 echo "ERROR"
1563 echo "ERROR: User requested feature Xen PCI Passthrough"
1564 echo "ERROR: but this feature require /sys from Linux"
1565 if test "$xen_ctrl_version" -lt 340; then
1566 echo "ERROR: This feature does not work with Xen 3.3"
1567 fi
1568 echo "ERROR"
1569 exit 1;
1570 fi
1571 xen_pci_passthrough=no
1572 fi
1573 fi
1574
1575 ##########################################
1576 # pkg-config probe
1577
1578 if ! has "$pkg_config_exe"; then
1579 echo "Error: pkg-config binary '$pkg_config_exe' not found"
1580 exit 1
1581 fi
1582
1583 ##########################################
1584 # libtool probe
1585
1586 if ! has $libtool; then
1587 libtool=
1588 fi
1589
1590 ##########################################
1591 # Sparse probe
1592 if test "$sparse" != "no" ; then
1593 if has cgcc; then
1594 sparse=yes
1595 else
1596 if test "$sparse" = "yes" ; then
1597 feature_not_found "sparse"
1598 fi
1599 sparse=no
1600 fi
1601 fi
1602
1603 ##########################################
1604 # SDL probe
1605
1606 # Look for sdl configuration program (pkg-config or sdl-config). Try
1607 # sdl-config even without cross prefix, and favour pkg-config over sdl-config.
1608 if test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then
1609 sdl_config=sdl-config
1610 fi
1611
1612 if $pkg_config sdl --modversion >/dev/null 2>&1; then
1613 sdlconfig="$pkg_config sdl"
1614 _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
1615 elif has ${sdl_config}; then
1616 sdlconfig="$sdl_config"
1617 _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1618 else
1619 if test "$sdl" = "yes" ; then
1620 feature_not_found "sdl"
1621 fi
1622 sdl=no
1623 fi
1624 if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
1625 echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
1626 fi
1627
1628 sdl_too_old=no
1629 if test "$sdl" != "no" ; then
1630 cat > $TMPC << EOF
1631 #include <SDL.h>
1632 #undef main /* We don't want SDL to override our main() */
1633 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1634 EOF
1635 sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
1636 if test "$static" = "yes" ; then
1637 sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
1638 else
1639 sdl_libs=`$sdlconfig --libs 2> /dev/null`
1640 fi
1641 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1642 if test "$_sdlversion" -lt 121 ; then
1643 sdl_too_old=yes
1644 else
1645 if test "$cocoa" = "no" ; then
1646 sdl=yes
1647 fi
1648 fi
1649
1650 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
1651 if test "$sdl" = "yes" -a "$static" = "yes" ; then
1652 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
1653 sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1654 sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
1655 fi
1656 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1657 :
1658 else
1659 sdl=no
1660 fi
1661 fi # static link
1662 else # sdl not found
1663 if test "$sdl" = "yes" ; then
1664 feature_not_found "sdl"
1665 fi
1666 sdl=no
1667 fi # sdl compile test
1668 fi
1669
1670 if test "$sdl" = "yes" ; then
1671 cat > $TMPC <<EOF
1672 #include <SDL.h>
1673 #if defined(SDL_VIDEO_DRIVER_X11)
1674 #include <X11/XKBlib.h>
1675 #else
1676 #error No x11 support
1677 #endif
1678 int main(void) { return 0; }
1679 EOF
1680 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1681 sdl_libs="$sdl_libs -lX11"
1682 fi
1683 libs_softmmu="$sdl_libs $libs_softmmu"
1684 fi
1685
1686 ##########################################
1687 # VNC TLS detection
1688 if test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then
1689 cat > $TMPC <<EOF
1690 #include <gnutls/gnutls.h>
1691 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1692 EOF
1693 vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
1694 vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
1695 if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
1696 vnc_tls=yes
1697 libs_softmmu="$vnc_tls_libs $libs_softmmu"
1698 else
1699 if test "$vnc_tls" = "yes" ; then
1700 feature_not_found "vnc-tls"
1701 fi
1702 vnc_tls=no
1703 fi
1704 fi
1705
1706 ##########################################
1707 # VNC SASL detection
1708 if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
1709 cat > $TMPC <<EOF
1710 #include <sasl/sasl.h>
1711 #include <stdio.h>
1712 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
1713 EOF
1714 # Assuming Cyrus-SASL installed in /usr prefix
1715 vnc_sasl_cflags=""
1716 vnc_sasl_libs="-lsasl2"
1717 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1718 vnc_sasl=yes
1719 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
1720 else
1721 if test "$vnc_sasl" = "yes" ; then
1722 feature_not_found "vnc-sasl"
1723 fi
1724 vnc_sasl=no
1725 fi
1726 fi
1727
1728 ##########################################
1729 # VNC JPEG detection
1730 if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
1731 cat > $TMPC <<EOF
1732 #include <stdio.h>
1733 #include <jpeglib.h>
1734 int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
1735 EOF
1736 vnc_jpeg_cflags=""
1737 vnc_jpeg_libs="-ljpeg"
1738 if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
1739 vnc_jpeg=yes
1740 libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
1741 else
1742 if test "$vnc_jpeg" = "yes" ; then
1743 feature_not_found "vnc-jpeg"
1744 fi
1745 vnc_jpeg=no
1746 fi
1747 fi
1748
1749 ##########################################
1750 # VNC PNG detection
1751 if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
1752 cat > $TMPC <<EOF
1753 //#include <stdio.h>
1754 #include <png.h>
1755 #include <stddef.h>
1756 int main(void) {
1757 png_structp png_ptr;
1758 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
1759 return png_ptr != 0;
1760 }
1761 EOF
1762 if $pkg_config libpng --modversion >/dev/null 2>&1; then
1763 vnc_png_cflags=`$pkg_config libpng --cflags 2> /dev/null`
1764 vnc_png_libs=`$pkg_config libpng --libs 2> /dev/null`
1765 else
1766 vnc_png_cflags=""
1767 vnc_png_libs="-lpng"
1768 fi
1769 if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
1770 vnc_png=yes
1771 libs_softmmu="$vnc_png_libs $libs_softmmu"
1772 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
1773 else
1774 if test "$vnc_png" = "yes" ; then
1775 feature_not_found "vnc-png"
1776 fi
1777 vnc_png=no
1778 fi
1779 fi
1780
1781 ##########################################
1782 # fnmatch() probe, used for ACL routines
1783 fnmatch="no"
1784 cat > $TMPC << EOF
1785 #include <fnmatch.h>
1786 int main(void)
1787 {
1788 fnmatch("foo", "foo", 0);
1789 return 0;
1790 }
1791 EOF
1792 if compile_prog "" "" ; then
1793 fnmatch="yes"
1794 fi
1795
1796 ##########################################
1797 # uuid_generate() probe, used for vdi block driver
1798 if test "$uuid" != "no" ; then
1799 uuid_libs="-luuid"
1800 cat > $TMPC << EOF
1801 #include <uuid/uuid.h>
1802 int main(void)
1803 {
1804 uuid_t my_uuid;
1805 uuid_generate(my_uuid);
1806 return 0;
1807 }
1808 EOF
1809 if compile_prog "" "$uuid_libs" ; then
1810 uuid="yes"
1811 libs_softmmu="$uuid_libs $libs_softmmu"
1812 libs_tools="$uuid_libs $libs_tools"
1813 else
1814 if test "$uuid" = "yes" ; then
1815 feature_not_found "uuid"
1816 fi
1817 uuid=no
1818 fi
1819 fi
1820
1821 ##########################################
1822 # xfsctl() probe, used for raw-posix
1823 if test "$xfs" != "no" ; then
1824 cat > $TMPC << EOF
1825 #include <stddef.h> /* NULL */
1826 #include <xfs/xfs.h>
1827 int main(void)
1828 {
1829 xfsctl(NULL, 0, 0, NULL);
1830 return 0;
1831 }
1832 EOF
1833 if compile_prog "" "" ; then
1834 xfs="yes"
1835 else
1836 if test "$xfs" = "yes" ; then
1837 feature_not_found "xfs"
1838 fi
1839 xfs=no
1840 fi
1841 fi
1842
1843 ##########################################
1844 # vde libraries probe
1845 if test "$vde" != "no" ; then
1846 vde_libs="-lvdeplug"
1847 cat > $TMPC << EOF
1848 #include <libvdeplug.h>
1849 int main(void)
1850 {
1851 struct vde_open_args a = {0, 0, 0};
1852 char s[] = "";
1853 vde_open(s, s, &a);
1854 return 0;
1855 }
1856 EOF
1857 if compile_prog "" "$vde_libs" ; then
1858 vde=yes
1859 libs_softmmu="$vde_libs $libs_softmmu"
1860 libs_tools="$vde_libs $libs_tools"
1861 else
1862 if test "$vde" = "yes" ; then
1863 feature_not_found "vde"
1864 fi
1865 vde=no
1866 fi
1867 fi
1868
1869 ##########################################
1870 # libcap-ng library probe
1871 if test "$cap_ng" != "no" ; then
1872 cap_libs="-lcap-ng"
1873 cat > $TMPC << EOF
1874 #include <cap-ng.h>
1875 int main(void)
1876 {
1877 capng_capability_to_name(CAPNG_EFFECTIVE);
1878 return 0;
1879 }
1880 EOF
1881 if compile_prog "" "$cap_libs" ; then
1882 cap_ng=yes
1883 libs_tools="$cap_libs $libs_tools"
1884 else
1885 if test "$cap_ng" = "yes" ; then
1886 feature_not_found "cap_ng"
1887 fi
1888 cap_ng=no
1889 fi
1890 fi
1891
1892 ##########################################
1893 # Sound support libraries probe
1894
1895 audio_drv_probe()
1896 {
1897 drv=$1
1898 hdr=$2
1899 lib=$3
1900 exp=$4
1901 cfl=$5
1902 cat > $TMPC << EOF
1903 #include <$hdr>
1904 int main(void) { $exp }
1905 EOF
1906 if compile_prog "$cfl" "$lib" ; then
1907 :
1908 else
1909 echo
1910 echo "Error: $drv check failed"
1911 echo "Make sure to have the $drv libs and headers installed."
1912 echo
1913 exit 1
1914 fi
1915 }
1916
1917 audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1918 for drv in $audio_drv_list; do
1919 case $drv in
1920 alsa)
1921 audio_drv_probe $drv alsa/asoundlib.h -lasound \
1922 "return snd_pcm_close((snd_pcm_t *)0);"
1923 libs_softmmu="-lasound $libs_softmmu"
1924 ;;
1925
1926 fmod)
1927 if test -z $fmod_lib || test -z $fmod_inc; then
1928 echo
1929 echo "Error: You must specify path to FMOD library and headers"
1930 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1931 echo
1932 exit 1
1933 fi
1934 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1935 libs_softmmu="$fmod_lib $libs_softmmu"
1936 ;;
1937
1938 esd)
1939 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1940 libs_softmmu="-lesd $libs_softmmu"
1941 audio_pt_int="yes"
1942 ;;
1943
1944 pa)
1945 audio_drv_probe $drv pulse/mainloop.h "-lpulse" \
1946 "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;"
1947 libs_softmmu="-lpulse $libs_softmmu"
1948 audio_pt_int="yes"
1949 ;;
1950
1951 coreaudio)
1952 libs_softmmu="-framework CoreAudio $libs_softmmu"
1953 ;;
1954
1955 dsound)
1956 libs_softmmu="-lole32 -ldxguid $libs_softmmu"
1957 audio_win_int="yes"
1958 ;;
1959
1960 oss)
1961 libs_softmmu="$oss_lib $libs_softmmu"
1962 ;;
1963
1964 sdl|wav)
1965 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1966 ;;
1967
1968 winwave)
1969 libs_softmmu="-lwinmm $libs_softmmu"
1970 audio_win_int="yes"
1971 ;;
1972
1973 *)
1974 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
1975 echo
1976 echo "Error: Unknown driver '$drv' selected"
1977 echo "Possible drivers are: $audio_possible_drivers"
1978 echo
1979 exit 1
1980 }
1981 ;;
1982 esac
1983 done
1984
1985 ##########################################
1986 # BrlAPI probe
1987
1988 if test "$brlapi" != "no" ; then
1989 brlapi_libs="-lbrlapi"
1990 cat > $TMPC << EOF
1991 #include <brlapi.h>
1992 #include <stddef.h>
1993 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1994 EOF
1995 if compile_prog "" "$brlapi_libs" ; then
1996 brlapi=yes
1997 libs_softmmu="$brlapi_libs $libs_softmmu"
1998 else
1999 if test "$brlapi" = "yes" ; then
2000 feature_not_found "brlapi"
2001 fi
2002 brlapi=no
2003 fi
2004 fi
2005
2006 ##########################################
2007 # curses probe
2008 if test "$mingw32" = "yes" ; then
2009 curses_list="-lpdcurses"
2010 else
2011 curses_list="-lncurses -lcurses"
2012 fi
2013
2014 if test "$curses" != "no" ; then
2015 curses_found=no
2016 cat > $TMPC << EOF
2017 #include <curses.h>
2018 int main(void) {
2019 const char *s = curses_version();
2020 resize_term(0, 0);
2021 return s != 0;
2022 }
2023 EOF
2024 for curses_lib in $curses_list; do
2025 if compile_prog "" "$curses_lib" ; then
2026 curses_found=yes
2027 libs_softmmu="$curses_lib $libs_softmmu"
2028 break
2029 fi
2030 done
2031 if test "$curses_found" = "yes" ; then
2032 curses=yes
2033 else
2034 if test "$curses" = "yes" ; then
2035 feature_not_found "curses"
2036 fi
2037 curses=no
2038 fi
2039 fi
2040
2041 ##########################################
2042 # curl probe
2043
2044 if $pkg_config libcurl --modversion >/dev/null 2>&1; then
2045 curlconfig="$pkg_config libcurl"
2046 else
2047 curlconfig=curl-config
2048 fi
2049
2050 if test "$curl" != "no" ; then
2051 cat > $TMPC << EOF
2052 #include <curl/curl.h>
2053 int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
2054 EOF
2055 curl_cflags=`$curlconfig --cflags 2>/dev/null`
2056 curl_libs=`$curlconfig --libs 2>/dev/null`
2057 if compile_prog "$curl_cflags" "$curl_libs" ; then
2058 curl=yes
2059 libs_tools="$curl_libs $libs_tools"
2060 libs_softmmu="$curl_libs $libs_softmmu"
2061 else
2062 if test "$curl" = "yes" ; then
2063 feature_not_found "curl"
2064 fi
2065 curl=no
2066 fi
2067 fi # test "$curl"
2068
2069 ##########################################
2070 # bluez support probe
2071 if test "$bluez" != "no" ; then
2072 cat > $TMPC << EOF
2073 #include <bluetooth/bluetooth.h>
2074 int main(void) { return bt_error(0); }
2075 EOF
2076 bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
2077 bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
2078 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
2079 bluez=yes
2080 libs_softmmu="$bluez_libs $libs_softmmu"
2081 else
2082 if test "$bluez" = "yes" ; then
2083 feature_not_found "bluez"
2084 fi
2085 bluez="no"
2086 fi
2087 fi
2088
2089 ##########################################
2090 # glib support probe
2091
2092 if test "$mingw32" = yes; then
2093 # g_poll is required in order to integrate with the glib main loop.
2094 glib_req_ver=2.20
2095 else
2096 glib_req_ver=2.12
2097 fi
2098 if $pkg_config --atleast-version=$glib_req_ver gthread-2.0 > /dev/null 2>&1
2099 then
2100 glib_cflags=`$pkg_config --cflags gthread-2.0 2>/dev/null`
2101 glib_libs=`$pkg_config --libs gthread-2.0 2>/dev/null`
2102 LIBS="$glib_libs $LIBS"
2103 libs_qga="$glib_libs $libs_qga"
2104 else
2105 echo "glib-$glib_req_ver required to compile QEMU"
2106 exit 1
2107 fi
2108
2109 ##########################################
2110 # libcap probe
2111
2112 if test "$cap" != "no" ; then
2113 cat > $TMPC <<EOF
2114 #include <stdio.h>
2115 #include <sys/capability.h>
2116 int main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
2117 EOF
2118 if compile_prog "" "-lcap" ; then
2119 cap=yes
2120 else
2121 cap=no
2122 fi
2123 fi
2124
2125 ##########################################
2126 # pthread probe
2127 PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
2128
2129 pthread=no
2130 cat > $TMPC << EOF
2131 #include <pthread.h>
2132 static void *f(void *p) { return NULL; }
2133 int main(void) {
2134 pthread_t thread;
2135 pthread_create(&thread, 0, f, 0);
2136 return 0;
2137 }
2138 EOF
2139 if compile_prog "" "" ; then
2140 pthread=yes
2141 else
2142 for pthread_lib in $PTHREADLIBS_LIST; do
2143 if compile_prog "" "$pthread_lib" ; then
2144 pthread=yes
2145 found=no
2146 for lib_entry in $LIBS; do
2147 if test "$lib_entry" = "$pthread_lib"; then
2148 found=yes
2149 break
2150 fi
2151 done
2152 if test "$found" = "no"; then
2153 LIBS="$pthread_lib $LIBS"
2154 fi
2155 break
2156 fi
2157 done
2158 fi
2159
2160 if test "$mingw32" != yes -a "$pthread" = no; then
2161 echo
2162 echo "Error: pthread check failed"
2163 echo "Make sure to have the pthread libs and headers installed."
2164 echo
2165 exit 1
2166 fi
2167
2168 ##########################################
2169 # rbd probe
2170 if test "$rbd" != "no" ; then
2171 cat > $TMPC <<EOF
2172 #include <stdio.h>
2173 #include <rbd/librbd.h>
2174 int main(void) {
2175 rados_t cluster;
2176 rados_create(&cluster, NULL);
2177 return 0;
2178 }
2179 EOF
2180 rbd_libs="-lrbd -lrados"
2181 if compile_prog "" "$rbd_libs" ; then
2182 rbd=yes
2183 libs_tools="$rbd_libs $libs_tools"
2184 libs_softmmu="$rbd_libs $libs_softmmu"
2185 else
2186 if test "$rbd" = "yes" ; then
2187 feature_not_found "rados block device"
2188 fi
2189 rbd=no
2190 fi
2191 fi
2192
2193 ##########################################
2194 # linux-aio probe
2195
2196 if test "$linux_aio" != "no" ; then
2197 cat > $TMPC <<EOF
2198 #include <libaio.h>
2199 #include <sys/eventfd.h>
2200 #include <stddef.h>
2201 int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
2202 EOF
2203 if compile_prog "" "-laio" ; then
2204 linux_aio=yes
2205 libs_softmmu="$libs_softmmu -laio"
2206 libs_tools="$libs_tools -laio"
2207 else
2208 if test "$linux_aio" = "yes" ; then
2209 feature_not_found "linux AIO"
2210 fi
2211 linux_aio=no
2212 fi
2213 fi
2214
2215 ##########################################
2216 # attr probe
2217
2218 if test "$attr" != "no" ; then
2219 cat > $TMPC <<EOF
2220 #include <stdio.h>
2221 #include <sys/types.h>
2222 #ifdef CONFIG_LIBATTR
2223 #include <attr/xattr.h>
2224 #else
2225 #include <sys/xattr.h>
2226 #endif
2227 int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
2228 EOF
2229 if compile_prog "" "" ; then
2230 attr=yes
2231 # Older distros have <attr/xattr.h>, and need -lattr:
2232 elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
2233 attr=yes
2234 LIBS="-lattr $LIBS"
2235 libattr=yes
2236 else
2237 if test "$attr" = "yes" ; then
2238 feature_not_found "ATTR"
2239 fi
2240 attr=no
2241 fi
2242 fi
2243
2244 ##########################################
2245 # iovec probe
2246 cat > $TMPC <<EOF
2247 #include <sys/types.h>
2248 #include <sys/uio.h>
2249 #include <unistd.h>
2250 int main(void) { return sizeof(struct iovec); }
2251 EOF
2252 iovec=no
2253 if compile_prog "" "" ; then
2254 iovec=yes
2255 fi
2256
2257 ##########################################
2258 # preadv probe
2259 cat > $TMPC <<EOF
2260 #include <sys/types.h>
2261 #include <sys/uio.h>
2262 #include <unistd.h>
2263 int main(void) { return preadv(0, 0, 0, 0); }
2264 EOF
2265 preadv=no
2266 if compile_prog "" "" ; then
2267 preadv=yes
2268 fi
2269
2270 ##########################################
2271 # fdt probe
2272 if test "$fdt" != "no" ; then
2273 fdt_libs="-lfdt"
2274 cat > $TMPC << EOF
2275 int main(void) { return 0; }
2276 EOF
2277 if compile_prog "" "$fdt_libs" ; then
2278 fdt=yes
2279 else
2280 if test "$fdt" = "yes" ; then
2281 feature_not_found "fdt"
2282 fi
2283 fdt_libs=
2284 fdt=no
2285 fi
2286 fi
2287
2288 ##########################################
2289 # opengl probe, used by milkymist-tmu2
2290 if test "$opengl" != "no" ; then
2291 opengl_libs="-lGL"
2292 cat > $TMPC << EOF
2293 #include <X11/Xlib.h>
2294 #include <GL/gl.h>
2295 #include <GL/glx.h>
2296 int main(void) { return GL_VERSION != 0; }
2297 EOF
2298 if compile_prog "" "-lGL" ; then
2299 opengl=yes
2300 else
2301 if test "$opengl" = "yes" ; then
2302 feature_not_found "opengl"
2303 fi
2304 opengl_libs=
2305 opengl=no
2306 fi
2307 fi
2308
2309 #
2310 # Check for xxxat() functions when we are building linux-user
2311 # emulator. This is done because older glibc versions don't
2312 # have syscall stubs for these implemented.
2313 #
2314 atfile=no
2315 cat > $TMPC << EOF
2316 #define _ATFILE_SOURCE
2317 #include <sys/types.h>
2318 #include <fcntl.h>
2319 #include <unistd.h>
2320
2321 int
2322 main(void)
2323 {
2324 /* try to unlink nonexisting file */
2325 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
2326 }
2327 EOF
2328 if compile_prog "" "" ; then
2329 atfile=yes
2330 fi
2331
2332 # Check for inotify functions when we are building linux-user
2333 # emulator. This is done because older glibc versions don't
2334 # have syscall stubs for these implemented. In that case we
2335 # don't provide them even if kernel supports them.
2336 #
2337 inotify=no
2338 cat > $TMPC << EOF
2339 #include <sys/inotify.h>
2340
2341 int
2342 main(void)
2343 {
2344 /* try to start inotify */
2345 return inotify_init();
2346 }
2347 EOF
2348 if compile_prog "" "" ; then
2349 inotify=yes
2350 fi
2351
2352 inotify1=no
2353 cat > $TMPC << EOF
2354 #include <sys/inotify.h>
2355
2356 int
2357 main(void)
2358 {
2359 /* try to start inotify */
2360 return inotify_init1(0);
2361 }
2362 EOF
2363 if compile_prog "" "" ; then
2364 inotify1=yes
2365 fi
2366
2367 # check if utimensat and futimens are supported
2368 utimens=no
2369 cat > $TMPC << EOF
2370 #define _ATFILE_SOURCE
2371 #include <stddef.h>
2372 #include <fcntl.h>
2373 #include <sys/stat.h>
2374
2375 int main(void)
2376 {
2377 utimensat(AT_FDCWD, "foo", NULL, 0);
2378 futimens(0, NULL);
2379 return 0;
2380 }
2381 EOF
2382 if compile_prog "" "" ; then
2383 utimens=yes
2384 fi
2385
2386 # check if pipe2 is there
2387 pipe2=no
2388 cat > $TMPC << EOF
2389 #include <unistd.h>
2390 #include <fcntl.h>
2391
2392 int main(void)
2393 {
2394 int pipefd[2];
2395 pipe2(pipefd, O_CLOEXEC);
2396 return 0;
2397 }
2398 EOF
2399 if compile_prog "" "" ; then
2400 pipe2=yes
2401 fi
2402
2403 # check if accept4 is there
2404 accept4=no
2405 cat > $TMPC << EOF
2406 #include <sys/socket.h>
2407 #include <stddef.h>
2408
2409 int main(void)
2410 {
2411 accept4(0, NULL, NULL, SOCK_CLOEXEC);
2412 return 0;
2413 }
2414 EOF
2415 if compile_prog "" "" ; then
2416 accept4=yes
2417 fi
2418
2419 # check if tee/splice is there. vmsplice was added same time.
2420 splice=no
2421 cat > $TMPC << EOF
2422 #include <unistd.h>
2423 #include <fcntl.h>
2424 #include <limits.h>
2425
2426 int main(void)
2427 {
2428 int len, fd = 0;
2429 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
2430 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
2431 return 0;
2432 }
2433 EOF
2434 if compile_prog "" "" ; then
2435 splice=yes
2436 fi
2437
2438 ##########################################
2439 # signalfd probe
2440 signalfd="no"
2441 cat > $TMPC << EOF
2442 #include <unistd.h>
2443 #include <sys/syscall.h>
2444 #include <signal.h>
2445 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
2446 EOF
2447
2448 if compile_prog "" "" ; then
2449 signalfd=yes
2450 fi
2451
2452 # check if eventfd is supported
2453 eventfd=no
2454 cat > $TMPC << EOF
2455 #include <sys/eventfd.h>
2456
2457 int main(void)
2458 {
2459 return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
2460 }
2461 EOF
2462 if compile_prog "" "" ; then
2463 eventfd=yes
2464 fi
2465
2466 # check for fallocate
2467 fallocate=no
2468 cat > $TMPC << EOF
2469 #include <fcntl.h>
2470
2471 int main(void)
2472 {
2473 fallocate(0, 0, 0, 0);
2474 return 0;
2475 }
2476 EOF
2477 if compile_prog "" "" ; then
2478 fallocate=yes
2479 fi
2480
2481 # check for sync_file_range
2482 sync_file_range=no
2483 cat > $TMPC << EOF
2484 #include <fcntl.h>
2485
2486 int main(void)
2487 {
2488 sync_file_range(0, 0, 0, 0);
2489 return 0;
2490 }
2491 EOF
2492 if compile_prog "" "" ; then
2493 sync_file_range=yes
2494 fi
2495
2496 # check for linux/fiemap.h and FS_IOC_FIEMAP
2497 fiemap=no
2498 cat > $TMPC << EOF
2499 #include <sys/ioctl.h>
2500 #include <linux/fs.h>
2501 #include <linux/fiemap.h>
2502
2503 int main(void)
2504 {
2505 ioctl(0, FS_IOC_FIEMAP, 0);
2506 return 0;
2507 }
2508 EOF
2509 if compile_prog "" "" ; then
2510 fiemap=yes
2511 fi
2512
2513 # check for dup3
2514 dup3=no
2515 cat > $TMPC << EOF
2516 #include <unistd.h>
2517
2518 int main(void)
2519 {
2520 dup3(0, 0, 0);
2521 return 0;
2522 }
2523 EOF
2524 if compile_prog "" "" ; then
2525 dup3=yes
2526 fi
2527
2528 # check for epoll support
2529 epoll=no
2530 cat > $TMPC << EOF
2531 #include <sys/epoll.h>
2532
2533 int main(void)
2534 {
2535 epoll_create(0);
2536 return 0;
2537 }
2538 EOF
2539 if compile_prog "" "" ; then
2540 epoll=yes
2541 fi
2542
2543 # epoll_create1 and epoll_pwait are later additions
2544 # so we must check separately for their presence
2545 epoll_create1=no
2546 cat > $TMPC << EOF
2547 #include <sys/epoll.h>
2548
2549 int main(void)
2550 {
2551 /* Note that we use epoll_create1 as a value, not as
2552 * a function being called. This is necessary so that on
2553 * old SPARC glibc versions where the function was present in
2554 * the library but not declared in the header file we will
2555 * fail the configure check. (Otherwise we will get a compiler
2556 * warning but not an error, and will proceed to fail the
2557 * qemu compile where we compile with -Werror.)
2558 */
2559 return (int)(uintptr_t)&epoll_create1;
2560 }
2561 EOF
2562 if compile_prog "" "" ; then
2563 epoll_create1=yes
2564 fi
2565
2566 epoll_pwait=no
2567 cat > $TMPC << EOF
2568 #include <sys/epoll.h>
2569
2570 int main(void)
2571 {
2572 epoll_pwait(0, 0, 0, 0, 0);
2573 return 0;
2574 }
2575 EOF
2576 if compile_prog "" "" ; then
2577 epoll_pwait=yes
2578 fi
2579
2580 # Check if tools are available to build documentation.
2581 if test "$docs" != "no" ; then
2582 if has makeinfo && has pod2man; then
2583 docs=yes
2584 else
2585 if test "$docs" = "yes" ; then
2586 feature_not_found "docs"
2587 fi
2588 docs=no
2589 fi
2590 fi
2591
2592 # Search for bswap_32 function
2593 byteswap_h=no
2594 cat > $TMPC << EOF
2595 #include <byteswap.h>
2596 int main(void) { return bswap_32(0); }
2597 EOF
2598 if compile_prog "" "" ; then
2599 byteswap_h=yes
2600 fi
2601
2602 # Search for bswap_32 function
2603 bswap_h=no
2604 cat > $TMPC << EOF
2605 #include <sys/endian.h>
2606 #include <sys/types.h>
2607 #include <machine/bswap.h>
2608 int main(void) { return bswap32(0); }
2609 EOF
2610 if compile_prog "" "" ; then
2611 bswap_h=yes
2612 fi
2613
2614 ##########################################
2615 # Do we have libiscsi
2616 # We check for iscsi_unmap_sync() to make sure we have a
2617 # recent enough version of libiscsi.
2618 if test "$libiscsi" != "no" ; then
2619 cat > $TMPC << EOF
2620 #include <stdio.h>
2621 #include <iscsi/iscsi.h>
2622 int main(void) { iscsi_unmap_sync(NULL,0,0,0,NULL,0); return 0; }
2623 EOF
2624 if compile_prog "" "-liscsi" ; then
2625 libiscsi="yes"
2626 LIBS="$LIBS -liscsi"
2627 else
2628 if test "$libiscsi" = "yes" ; then
2629 feature_not_found "libiscsi"
2630 fi
2631 libiscsi="no"
2632 fi
2633 fi
2634
2635
2636 ##########################################
2637 # Do we need librt
2638 cat > $TMPC <<EOF
2639 #include <signal.h>
2640 #include <time.h>
2641 int main(void) { return clock_gettime(CLOCK_REALTIME, NULL); }
2642 EOF
2643
2644 if compile_prog "" "" ; then
2645 :
2646 elif compile_prog "" "-lrt" ; then
2647 LIBS="-lrt $LIBS"
2648 fi
2649
2650 if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
2651 "$aix" != "yes" -a "$haiku" != "yes" ; then
2652 libs_softmmu="-lutil $libs_softmmu"
2653 fi
2654
2655 ##########################################
2656 # spice probe
2657 if test "$spice" != "no" ; then
2658 cat > $TMPC << EOF
2659 #include <spice.h>
2660 int main(void) { spice_server_new(); return 0; }
2661 EOF
2662 spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
2663 spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
2664 if $pkg_config --atleast-version=0.8.2 spice-server >/dev/null 2>&1 && \
2665 $pkg_config --atleast-version=0.8.1 spice-protocol > /dev/null 2>&1 && \
2666 compile_prog "$spice_cflags" "$spice_libs" ; then
2667 spice="yes"
2668 libs_softmmu="$libs_softmmu $spice_libs"
2669 QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
2670 else
2671 if test "$spice" = "yes" ; then
2672 feature_not_found "spice"
2673 fi
2674 spice="no"
2675 fi
2676 fi
2677
2678 # check for libcacard for smartcard support
2679 if test "$smartcard" != "no" ; then
2680 smartcard="yes"
2681 smartcard_cflags=""
2682 # TODO - what's the minimal nss version we support?
2683 if test "$smartcard_nss" != "no"; then
2684 cat > $TMPC << EOF
2685 #include <pk11pub.h>
2686 int main(void) { PK11_FreeSlot(0); return 0; }
2687 EOF
2688 smartcard_includes="-I\$(SRC_PATH)/libcacard"
2689 libcacard_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs"
2690 libcacard_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags"
2691 test_cflags="$libcacard_cflags"
2692 # The header files in nss < 3.13.3 have a bug which causes them to
2693 # emit a warning. If we're going to compile QEMU with -Werror, then
2694 # test that the headers don't have this bug. Otherwise we would pass
2695 # the configure test but fail to compile QEMU later.
2696 if test "$werror" = "yes"; then
2697 test_cflags="-Werror $test_cflags"
2698 fi
2699 if $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 && \
2700 compile_prog "$test_cflags" "$libcacard_libs"; then
2701 smartcard_nss="yes"
2702 QEMU_CFLAGS="$QEMU_CFLAGS $libcacard_cflags"
2703 QEMU_INCLUDES="$QEMU_INCLUDES $smartcard_includes"
2704 libs_softmmu="$libcacard_libs $libs_softmmu"
2705 else
2706 if test "$smartcard_nss" = "yes"; then
2707 feature_not_found "nss"
2708 fi
2709 smartcard_nss="no"
2710 fi
2711 fi
2712 fi
2713 if test "$smartcard" = "no" ; then
2714 smartcard_nss="no"
2715 fi
2716
2717 # check for usbredirparser for usb network redirection support
2718 if test "$usb_redir" != "no" ; then
2719 if $pkg_config --atleast-version=0.3.4 libusbredirparser >/dev/null 2>&1 ; then
2720 usb_redir="yes"
2721 usb_redir_cflags=$($pkg_config --cflags libusbredirparser 2>/dev/null)
2722 usb_redir_libs=$($pkg_config --libs libusbredirparser 2>/dev/null)
2723 QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
2724 LIBS="$LIBS $usb_redir_libs"
2725 else
2726 if test "$usb_redir" = "yes"; then
2727 feature_not_found "usb-redir"
2728 fi
2729 usb_redir="no"
2730 fi
2731 fi
2732
2733 ##########################################
2734
2735 ##########################################
2736 # check if we have fdatasync
2737
2738 fdatasync=no
2739 cat > $TMPC << EOF
2740 #include <unistd.h>
2741 int main(void) {
2742 #if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
2743 return fdatasync(0);
2744 #else
2745 #error Not supported
2746 #endif
2747 }
2748 EOF
2749 if compile_prog "" "" ; then
2750 fdatasync=yes
2751 fi
2752
2753 ##########################################
2754 # check if we have madvise
2755
2756 madvise=no
2757 cat > $TMPC << EOF
2758 #include <sys/types.h>
2759 #include <sys/mman.h>
2760 #include <stddef.h>
2761 int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
2762 EOF
2763 if compile_prog "" "" ; then
2764 madvise=yes
2765 fi
2766
2767 ##########################################
2768 # check if we have posix_madvise
2769
2770 posix_madvise=no
2771 cat > $TMPC << EOF
2772 #include <sys/mman.h>
2773 #include <stddef.h>
2774 int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
2775 EOF
2776 if compile_prog "" "" ; then
2777 posix_madvise=yes
2778 fi
2779
2780 ##########################################
2781 # check if trace backend exists
2782
2783 $python "$source_path/scripts/tracetool.py" "--backend=$trace_backend" --check-backend > /dev/null 2> /dev/null
2784 if test "$?" -ne 0 ; then
2785 echo
2786 echo "Error: invalid trace backend"
2787 echo "Please choose a supported trace backend."
2788 echo
2789 exit 1
2790 fi
2791
2792 ##########################################
2793 # For 'ust' backend, test if ust headers are present
2794 if test "$trace_backend" = "ust"; then
2795 cat > $TMPC << EOF
2796 #include <ust/tracepoint.h>
2797 #include <ust/marker.h>
2798 int main(void) { return 0; }
2799 EOF
2800 if compile_prog "" "" ; then
2801 LIBS="-lust -lurcu-bp $LIBS"
2802 libs_qga="-lust -lurcu-bp $libs_qga"
2803 else
2804 echo
2805 echo "Error: Trace backend 'ust' missing libust header files"
2806 echo
2807 exit 1
2808 fi
2809 fi
2810
2811 ##########################################
2812 # For 'dtrace' backend, test if 'dtrace' command is present
2813 if test "$trace_backend" = "dtrace"; then
2814 if ! has 'dtrace' ; then
2815 echo
2816 echo "Error: dtrace command is not found in PATH $PATH"
2817 echo
2818 exit 1
2819 fi
2820 trace_backend_stap="no"
2821 if has 'stap' ; then
2822 trace_backend_stap="yes"
2823 fi
2824 fi
2825
2826 ##########################################
2827 # __sync_fetch_and_and requires at least -march=i486. Many toolchains
2828 # use i686 as default anyway, but for those that don't, an explicit
2829 # specification is necessary
2830 if test "$vhost_net" = "yes" && test "$cpu" = "i386"; then
2831 cat > $TMPC << EOF
2832 static int sfaa(int *ptr)
2833 {
2834 return __sync_fetch_and_and(ptr, 0);
2835 }
2836
2837 int main(int argc, char **argv)
2838 {
2839 int val = 42;
2840 sfaa(&val);
2841 return val;
2842 }
2843 EOF
2844 if ! compile_prog "" "" ; then
2845 QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS"
2846 fi
2847 fi
2848
2849 ##########################################
2850 # check and set a backend for coroutine
2851
2852 # default is ucontext, but always fallback to gthread
2853 # windows autodetected by make
2854 if test "$coroutine" = "" -o "$coroutine" = "ucontext"; then
2855 if test "$darwin" != "yes"; then
2856 cat > $TMPC << EOF
2857 #include <ucontext.h>
2858 #ifdef __stub_makecontext
2859 #error Ignoring glibc stub makecontext which will always fail
2860 #endif
2861 int main(void) { makecontext(0, 0, 0); return 0; }
2862 EOF
2863 if compile_prog "" "" ; then
2864 coroutine_backend=ucontext
2865 else
2866 coroutine_backend=gthread
2867 fi
2868 else
2869 echo "Silently falling back into gthread backend under darwin"
2870 fi
2871 elif test "$coroutine" = "gthread" ; then
2872 coroutine_backend=gthread
2873 elif test "$coroutine" = "windows" ; then
2874 coroutine_backend=windows
2875 elif test "$coroutine" = "sigaltstack" ; then
2876 coroutine_backend=sigaltstack
2877 else
2878 echo
2879 echo "Error: unknown coroutine backend $coroutine"
2880 echo
2881 exit 1
2882 fi
2883
2884 ##########################################
2885 # check if we have open_by_handle_at
2886
2887 open_by_handle_at=no
2888 cat > $TMPC << EOF
2889 #include <fcntl.h>
2890 #if !defined(AT_EMPTY_PATH)
2891 # error missing definition
2892 #else
2893 int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
2894 #endif
2895 EOF
2896 if compile_prog "" "" ; then
2897 open_by_handle_at=yes
2898 fi
2899
2900 ########################################
2901 # check if we have linux/magic.h
2902
2903 linux_magic_h=no
2904 cat > $TMPC << EOF
2905 #include <linux/magic.h>
2906 int main(void) {
2907 return 0;
2908 }
2909 EOF
2910 if compile_prog "" "" ; then
2911 linux_magic_h=yes
2912 fi
2913
2914 ########################################
2915 # check whether we can disable the -Wunused-but-set-variable
2916 # option with a pragma (this is needed to silence a warning in
2917 # some versions of the valgrind VALGRIND_STACK_DEREGISTER macro.)
2918 # This test has to be compiled with -Werror as otherwise an
2919 # unknown pragma is only a warning.
2920 pragma_disable_unused_but_set=no
2921 cat > $TMPC << EOF
2922 #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
2923 int main(void) {
2924 return 0;
2925 }
2926 EOF
2927 if compile_prog "-Werror" "" ; then
2928 pragma_disable_unused_but_set=yes
2929 fi
2930
2931 ########################################
2932 # check if we have valgrind/valgrind.h
2933
2934 valgrind_h=no
2935 cat > $TMPC << EOF
2936 #include <valgrind/valgrind.h>
2937 int main(void) {
2938 return 0;
2939 }
2940 EOF
2941 if compile_prog "" "" ; then
2942 valgrind_h=yes
2943 fi
2944
2945 ########################################
2946 # check if environ is declared
2947
2948 has_environ=no
2949 cat > $TMPC << EOF
2950 #include <unistd.h>
2951 int main(void) {
2952 environ = 0;
2953 return 0;
2954 }
2955 EOF
2956 if compile_prog "" "" ; then
2957 has_environ=yes
2958 fi
2959
2960 ##########################################
2961 # End of CC checks
2962 # After here, no more $cc or $ld runs
2963
2964 if test "$debug" = "no" ; then
2965 CFLAGS="-O2 -D_FORTIFY_SOURCE=2 $CFLAGS"
2966 fi
2967
2968 # Disable zero malloc errors for official releases unless explicitly told to
2969 # enable/disable
2970 if test -z "$zero_malloc" ; then
2971 if test "$z_version" = "50" ; then
2972 zero_malloc="no"
2973 else
2974 zero_malloc="yes"
2975 fi
2976 fi
2977
2978 # Now we've finished running tests it's OK to add -Werror to the compiler flags
2979 if test "$werror" = "yes"; then
2980 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
2981 fi
2982
2983 if test "$solaris" = "no" ; then
2984 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
2985 LDFLAGS="-Wl,--warn-common $LDFLAGS"
2986 fi
2987 fi
2988
2989 # test if pod2man has --utf8 option
2990 if pod2man --help | grep -q utf8; then
2991 POD2MAN="pod2man --utf8"
2992 else
2993 POD2MAN="pod2man"
2994 fi
2995
2996 # Use ASLR, no-SEH and DEP if available
2997 if test "$mingw32" = "yes" ; then
2998 for flag in --dynamicbase --no-seh --nxcompat; do
2999 if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
3000 LDFLAGS="-Wl,$flag $LDFLAGS"
3001 fi
3002 done
3003 fi
3004
3005 qemu_confdir=$sysconfdir$confsuffix
3006 qemu_datadir=$datadir$confsuffix
3007
3008 tools=
3009 if test "$softmmu" = yes ; then
3010 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
3011 if test "$virtfs" != no ; then
3012 if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then
3013 virtfs=yes
3014 tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
3015 else
3016 if test "$virtfs" = yes; then
3017 echo "VirtFS is supported only on Linux and requires libcap-devel and libattr-devel"
3018 exit 1
3019 fi
3020 virtfs=no
3021 fi
3022 fi
3023 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
3024 tools="qemu-nbd\$(EXESUF) $tools"
3025 if [ "$guest_agent" = "yes" ]; then
3026 tools="qemu-ga\$(EXESUF) $tools"
3027 fi
3028 fi
3029 fi
3030 if test "$smartcard_nss" = "yes" ; then
3031 tools="vscclient\$(EXESUF) $tools"
3032 fi
3033
3034 # Mac OS X ships with a broken assembler
3035 roms=
3036 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
3037 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
3038 "$softmmu" = yes ; then
3039 roms="optionrom"
3040 fi
3041 if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
3042 roms="$roms spapr-rtas"
3043 fi
3044
3045 echo "Install prefix $prefix"
3046 echo "BIOS directory `eval echo $qemu_datadir`"
3047 echo "binary directory `eval echo $bindir`"
3048 echo "library directory `eval echo $libdir`"
3049 echo "include directory `eval echo $includedir`"
3050 echo "config directory `eval echo $sysconfdir`"
3051 if test "$mingw32" = "no" ; then
3052 echo "Manual directory `eval echo $mandir`"
3053 echo "ELF interp prefix $interp_prefix"
3054 fi
3055 echo "Source path $source_path"
3056 echo "C compiler $cc"
3057 echo "Host C compiler $host_cc"
3058 echo "CFLAGS $CFLAGS"
3059 echo "QEMU_CFLAGS $QEMU_CFLAGS"
3060 echo "LDFLAGS $LDFLAGS"
3061 echo "make $make"
3062 echo "install $install"
3063 echo "python $python"
3064 if test "$slirp" = "yes" ; then
3065 echo "smbd $smbd"
3066 fi
3067 echo "host CPU $cpu"
3068 echo "host big endian $bigendian"
3069 echo "target list $target_list"
3070 echo "tcg debug enabled $debug_tcg"
3071 echo "gprof enabled $gprof"
3072 echo "sparse enabled $sparse"
3073 echo "strip binaries $strip_opt"
3074 echo "profiler $profiler"
3075 echo "static build $static"
3076 echo "-Werror enabled $werror"
3077 if test "$darwin" = "yes" ; then
3078 echo "Cocoa support $cocoa"
3079 fi
3080 echo "SDL support $sdl"
3081 echo "curses support $curses"
3082 echo "curl support $curl"
3083 echo "mingw32 support $mingw32"
3084 echo "Audio drivers $audio_drv_list"
3085 echo "Extra audio cards $audio_card_list"
3086 echo "Block whitelist $block_drv_whitelist"
3087 echo "Mixer emulation $mixemu"
3088 echo "VirtFS support $virtfs"
3089 echo "VNC support $vnc"
3090 if test "$vnc" = "yes" ; then
3091 echo "VNC TLS support $vnc_tls"
3092 echo "VNC SASL support $vnc_sasl"
3093 echo "VNC JPEG support $vnc_jpeg"
3094 echo "VNC PNG support $vnc_png"
3095 fi
3096 if test -n "$sparc_cpu"; then
3097 echo "Target Sparc Arch $sparc_cpu"
3098 fi
3099 echo "xen support $xen"
3100 echo "brlapi support $brlapi"
3101 echo "bluez support $bluez"
3102 echo "Documentation $docs"
3103 [ ! -z "$uname_release" ] && \
3104 echo "uname -r $uname_release"
3105 echo "NPTL support $nptl"
3106 echo "GUEST_BASE $guest_base"
3107 echo "PIE $pie"
3108 echo "vde support $vde"
3109 echo "Linux AIO support $linux_aio"
3110 echo "ATTR/XATTR support $attr"
3111 echo "Install blobs $blobs"
3112 echo "KVM support $kvm"
3113 echo "TCG interpreter $tcg_interpreter"
3114 echo "fdt support $fdt"
3115 echo "preadv support $preadv"
3116 echo "fdatasync $fdatasync"
3117 echo "madvise $madvise"
3118 echo "posix_madvise $posix_madvise"
3119 echo "uuid support $uuid"
3120 echo "libcap-ng support $cap_ng"
3121 echo "vhost-net support $vhost_net"
3122 echo "Trace backend $trace_backend"
3123 echo "Trace output file $trace_file-<pid>"
3124 echo "spice support $spice"
3125 echo "rbd support $rbd"
3126 echo "xfsctl support $xfs"
3127 echo "nss used $smartcard_nss"
3128 echo "usb net redir $usb_redir"
3129 echo "OpenGL support $opengl"
3130 echo "libiscsi support $libiscsi"
3131 echo "build guest agent $guest_agent"
3132 echo "coroutine backend $coroutine_backend"
3133
3134 if test "$sdl_too_old" = "yes"; then
3135 echo "-> Your SDL version is too old - please upgrade to have SDL support"
3136 fi
3137
3138 config_host_mak="config-host.mak"
3139 config_host_ld="config-host.ld"
3140
3141 echo "# Automatically generated by configure - do not modify" > $config_host_mak
3142 printf "# Configured with:" >> $config_host_mak
3143 printf " '%s'" "$0" "$@" >> $config_host_mak
3144 echo >> $config_host_mak
3145
3146 echo all: >> $config_host_mak
3147 echo "prefix=$prefix" >> $config_host_mak
3148 echo "bindir=$bindir" >> $config_host_mak
3149 echo "libdir=$libdir" >> $config_host_mak
3150 echo "includedir=$includedir" >> $config_host_mak
3151 echo "mandir=$mandir" >> $config_host_mak
3152 echo "sysconfdir=$sysconfdir" >> $config_host_mak
3153 echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
3154 echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
3155 echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
3156 echo "libexecdir=\${prefix}/libexec" >> $config_host_mak
3157 echo "CONFIG_QEMU_HELPERDIR=\"$prefix/libexec\"" >> $config_host_mak
3158
3159 echo "ARCH=$ARCH" >> $config_host_mak
3160 if test "$debug_tcg" = "yes" ; then
3161 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
3162 fi
3163 if test "$debug" = "yes" ; then
3164 echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
3165 fi
3166 if test "$strip_opt" = "yes" ; then
3167 echo "STRIP=${strip}" >> $config_host_mak
3168 fi
3169 if test "$bigendian" = "yes" ; then
3170 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
3171 fi
3172 if test "$mingw32" = "yes" ; then
3173 echo "CONFIG_WIN32=y" >> $config_host_mak
3174 rc_version=`cat $source_path/VERSION`
3175 version_major=${rc_version%%.*}
3176 rc_version=${rc_version#*.}
3177 version_minor=${rc_version%%.*}
3178 rc_version=${rc_version#*.}
3179 version_subminor=${rc_version%%.*}
3180 version_micro=0
3181 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
3182 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
3183 else
3184 echo "CONFIG_POSIX=y" >> $config_host_mak
3185 fi
3186
3187 if test "$linux" = "yes" ; then
3188 echo "CONFIG_LINUX=y" >> $config_host_mak
3189 fi
3190
3191 if test "$darwin" = "yes" ; then
3192 echo "CONFIG_DARWIN=y" >> $config_host_mak
3193 fi
3194
3195 if test "$aix" = "yes" ; then
3196 echo "CONFIG_AIX=y" >> $config_host_mak
3197 fi
3198
3199 if test "$solaris" = "yes" ; then
3200 echo "CONFIG_SOLARIS=y" >> $config_host_mak
3201 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
3202 if test "$needs_libsunmath" = "yes" ; then
3203 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
3204 fi
3205 fi
3206 if test "$haiku" = "yes" ; then
3207 echo "CONFIG_HAIKU=y" >> $config_host_mak
3208 fi
3209 if test "$static" = "yes" ; then
3210 echo "CONFIG_STATIC=y" >> $config_host_mak
3211 fi
3212 if test "$profiler" = "yes" ; then
3213 echo "CONFIG_PROFILER=y" >> $config_host_mak
3214 fi
3215 if test "$slirp" = "yes" ; then
3216 echo "CONFIG_SLIRP=y" >> $config_host_mak
3217 echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
3218 QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES"
3219 fi
3220 if test "$vde" = "yes" ; then
3221 echo "CONFIG_VDE=y" >> $config_host_mak
3222 fi
3223 if test "$cap_ng" = "yes" ; then
3224 echo "CONFIG_LIBCAP=y" >> $config_host_mak
3225 fi
3226 for card in $audio_card_list; do
3227 def=CONFIG_`echo $card | LC_ALL=C tr '[a-z]' '[A-Z]'`
3228 echo "$def=y" >> $config_host_mak
3229 done
3230 echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
3231 for drv in $audio_drv_list; do
3232 def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'`
3233 echo "$def=y" >> $config_host_mak
3234 if test "$drv" = "fmod"; then
3235 echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
3236 fi
3237 done
3238 if test "$audio_pt_int" = "yes" ; then
3239 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
3240 fi
3241 if test "$audio_win_int" = "yes" ; then
3242 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
3243 fi
3244 echo "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
3245 if test "$mixemu" = "yes" ; then
3246 echo "CONFIG_MIXEMU=y" >> $config_host_mak
3247 fi
3248 if test "$vnc" = "yes" ; then
3249 echo "CONFIG_VNC=y" >> $config_host_mak
3250 fi
3251 if test "$vnc_tls" = "yes" ; then
3252 echo "CONFIG_VNC_TLS=y" >> $config_host_mak
3253 echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
3254 fi
3255 if test "$vnc_sasl" = "yes" ; then
3256 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
3257 echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
3258 fi
3259 if test "$vnc_jpeg" = "yes" ; then
3260 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
3261 echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak
3262 fi
3263 if test "$vnc_png" = "yes" ; then
3264 echo "CONFIG_VNC_PNG=y" >> $config_host_mak
3265 echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak
3266 fi
3267 if test "$fnmatch" = "yes" ; then
3268 echo "CONFIG_FNMATCH=y" >> $config_host_mak
3269 fi
3270 if test "$uuid" = "yes" ; then
3271 echo "CONFIG_UUID=y" >> $config_host_mak
3272 fi
3273 if test "$xfs" = "yes" ; then
3274 echo "CONFIG_XFS=y" >> $config_host_mak
3275 fi
3276 qemu_version=`head $source_path/VERSION`
3277 echo "VERSION=$qemu_version" >>$config_host_mak
3278 echo "PKGVERSION=$pkgversion" >>$config_host_mak
3279 echo "SRC_PATH=$source_path" >> $config_host_mak
3280 echo "TARGET_DIRS=$target_list" >> $config_host_mak
3281 if [ "$docs" = "yes" ] ; then
3282 echo "BUILD_DOCS=yes" >> $config_host_mak
3283 fi
3284 if test "$sdl" = "yes" ; then
3285 echo "CONFIG_SDL=y" >> $config_host_mak
3286 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
3287 fi
3288 if test "$cocoa" = "yes" ; then
3289 echo "CONFIG_COCOA=y" >> $config_host_mak
3290 fi
3291 if test "$curses" = "yes" ; then
3292 echo "CONFIG_CURSES=y" >> $config_host_mak
3293 fi
3294 if test "$atfile" = "yes" ; then
3295 echo "CONFIG_ATFILE=y" >> $config_host_mak
3296 fi
3297 if test "$utimens" = "yes" ; then
3298 echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
3299 fi
3300 if test "$pipe2" = "yes" ; then
3301 echo "CONFIG_PIPE2=y" >> $config_host_mak
3302 fi
3303 if test "$accept4" = "yes" ; then
3304 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
3305 fi
3306 if test "$splice" = "yes" ; then
3307 echo "CONFIG_SPLICE=y" >> $config_host_mak
3308 fi
3309 if test "$eventfd" = "yes" ; then
3310 echo "CONFIG_EVENTFD=y" >> $config_host_mak
3311 fi
3312 if test "$fallocate" = "yes" ; then
3313 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
3314 fi
3315 if test "$sync_file_range" = "yes" ; then
3316 echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
3317 fi
3318 if test "$fiemap" = "yes" ; then
3319 echo "CONFIG_FIEMAP=y" >> $config_host_mak
3320 fi
3321 if test "$dup3" = "yes" ; then
3322 echo "CONFIG_DUP3=y" >> $config_host_mak
3323 fi
3324 if test "$epoll" = "yes" ; then
3325 echo "CONFIG_EPOLL=y" >> $config_host_mak
3326 fi
3327 if test "$epoll_create1" = "yes" ; then
3328 echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
3329 fi
3330 if test "$epoll_pwait" = "yes" ; then
3331 echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
3332 fi
3333 if test "$inotify" = "yes" ; then
3334 echo "CONFIG_INOTIFY=y" >> $config_host_mak
3335 fi
3336 if test "$inotify1" = "yes" ; then
3337 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
3338 fi
3339 if test "$byteswap_h" = "yes" ; then
3340 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
3341 fi
3342 if test "$bswap_h" = "yes" ; then
3343 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
3344 fi
3345 if test "$curl" = "yes" ; then
3346 echo "CONFIG_CURL=y" >> $config_host_mak
3347 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
3348 fi
3349 if test "$brlapi" = "yes" ; then
3350 echo "CONFIG_BRLAPI=y" >> $config_host_mak
3351 fi
3352 if test "$bluez" = "yes" ; then
3353 echo "CONFIG_BLUEZ=y" >> $config_host_mak
3354 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
3355 fi
3356 echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
3357 if test "$xen" = "yes" ; then
3358 echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
3359 echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
3360 fi
3361 if test "$linux_aio" = "yes" ; then
3362 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
3363 fi
3364 if test "$attr" = "yes" ; then
3365 echo "CONFIG_ATTR=y" >> $config_host_mak
3366 fi
3367 if test "$libattr" = "yes" ; then
3368 echo "CONFIG_LIBATTR=y" >> $config_host_mak
3369 fi
3370 if test "$virtfs" = "yes" ; then
3371 echo "CONFIG_VIRTFS=y" >> $config_host_mak
3372 fi
3373 if test "$blobs" = "yes" ; then
3374 echo "INSTALL_BLOBS=yes" >> $config_host_mak
3375 fi
3376 if test "$iovec" = "yes" ; then
3377 echo "CONFIG_IOVEC=y" >> $config_host_mak
3378 fi
3379 if test "$preadv" = "yes" ; then
3380 echo "CONFIG_PREADV=y" >> $config_host_mak
3381 fi
3382 if test "$fdt" = "yes" ; then
3383 echo "CONFIG_FDT=y" >> $config_host_mak
3384 fi
3385 if test "$signalfd" = "yes" ; then
3386 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
3387 fi
3388 if test "$tcg_interpreter" = "yes" ; then
3389 echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
3390 fi
3391 if test "$fdatasync" = "yes" ; then
3392 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
3393 fi
3394 if test "$madvise" = "yes" ; then
3395 echo "CONFIG_MADVISE=y" >> $config_host_mak
3396 fi
3397 if test "$posix_madvise" = "yes" ; then
3398 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
3399 fi
3400
3401 if test "$spice" = "yes" ; then
3402 echo "CONFIG_SPICE=y" >> $config_host_mak
3403 fi
3404
3405 if test "$smartcard" = "yes" ; then
3406 echo "CONFIG_SMARTCARD=y" >> $config_host_mak
3407 fi
3408
3409 if test "$smartcard_nss" = "yes" ; then
3410 echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
3411 echo "libcacard_libs=$libcacard_libs" >> $config_host_mak
3412 echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
3413 fi
3414
3415 if test "$usb_redir" = "yes" ; then
3416 echo "CONFIG_USB_REDIR=y" >> $config_host_mak
3417 fi
3418
3419 if test "$opengl" = "yes" ; then
3420 echo "CONFIG_OPENGL=y" >> $config_host_mak
3421 fi
3422
3423 if test "$libiscsi" = "yes" ; then
3424 echo "CONFIG_LIBISCSI=y" >> $config_host_mak
3425 fi
3426
3427 # XXX: suppress that
3428 if [ "$bsd" = "yes" ] ; then
3429 echo "CONFIG_BSD=y" >> $config_host_mak
3430 fi
3431
3432 echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
3433
3434 if test "$zero_malloc" = "yes" ; then
3435 echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
3436 fi
3437 if test "$rbd" = "yes" ; then
3438 echo "CONFIG_RBD=y" >> $config_host_mak
3439 fi
3440
3441 if test "$coroutine_backend" = "ucontext" ; then
3442 echo "CONFIG_UCONTEXT_COROUTINE=y" >> $config_host_mak
3443 elif test "$coroutine_backend" = "sigaltstack" ; then
3444 echo "CONFIG_SIGALTSTACK_COROUTINE=y" >> $config_host_mak
3445 fi
3446
3447 if test "$open_by_handle_at" = "yes" ; then
3448 echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
3449 fi
3450
3451 if test "$linux_magic_h" = "yes" ; then
3452 echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
3453 fi
3454
3455 if test "$pragma_disable_unused_but_set" = "yes" ; then
3456 echo "CONFIG_PRAGMA_DISABLE_UNUSED_BUT_SET=y" >> $config_host_mak
3457 fi
3458
3459 if test "$valgrind_h" = "yes" ; then
3460 echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
3461 fi
3462
3463 if test "$has_environ" = "yes" ; then
3464 echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
3465 fi
3466
3467 # USB host support
3468 case "$usb" in
3469 linux)
3470 echo "HOST_USB=linux" >> $config_host_mak
3471 ;;
3472 bsd)
3473 echo "HOST_USB=bsd" >> $config_host_mak
3474 ;;
3475 *)
3476 echo "HOST_USB=stub" >> $config_host_mak
3477 ;;
3478 esac
3479
3480 # use default implementation for tracing backend-specific routines
3481 trace_default=yes
3482 echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
3483 if test "$trace_backend" = "nop"; then
3484 echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
3485 fi
3486 if test "$trace_backend" = "simple"; then
3487 echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
3488 trace_default=no
3489 # Set the appropriate trace file.
3490 trace_file="\"$trace_file-\" FMT_pid"
3491 fi
3492 if test "$trace_backend" = "stderr"; then
3493 echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
3494 trace_default=no
3495 fi
3496 if test "$trace_backend" = "ust"; then
3497 echo "CONFIG_TRACE_UST=y" >> $config_host_mak
3498 fi
3499 if test "$trace_backend" = "dtrace"; then
3500 echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
3501 if test "$trace_backend_stap" = "yes" ; then
3502 echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
3503 fi
3504 fi
3505 echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
3506 if test "$trace_default" = "yes"; then
3507 echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
3508 fi
3509
3510 echo "TOOLS=$tools" >> $config_host_mak
3511 echo "ROMS=$roms" >> $config_host_mak
3512 echo "MAKE=$make" >> $config_host_mak
3513 echo "INSTALL=$install" >> $config_host_mak
3514 echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
3515 echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
3516 echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
3517 echo "PYTHON=$python" >> $config_host_mak
3518 echo "CC=$cc" >> $config_host_mak
3519 echo "CC_I386=$cc_i386" >> $config_host_mak
3520 echo "HOST_CC=$host_cc" >> $config_host_mak
3521 echo "AR=$ar" >> $config_host_mak
3522 echo "OBJCOPY=$objcopy" >> $config_host_mak
3523 echo "LD=$ld" >> $config_host_mak
3524 echo "WINDRES=$windres" >> $config_host_mak
3525 echo "LIBTOOL=$libtool" >> $config_host_mak
3526 echo "CFLAGS=$CFLAGS" >> $config_host_mak
3527 echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
3528 echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
3529 if test "$sparse" = "yes" ; then
3530 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
3531 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
3532 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
3533 fi
3534 echo "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
3535 echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
3536 echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
3537 echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
3538 echo "LIBS+=$LIBS" >> $config_host_mak
3539 echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
3540 echo "EXESUF=$EXESUF" >> $config_host_mak
3541 echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
3542 echo "POD2MAN=$POD2MAN" >> $config_host_mak
3543
3544 # generate list of library paths for linker script
3545
3546 $ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
3547
3548 if test -f ${config_host_ld}~ ; then
3549 if cmp -s $config_host_ld ${config_host_ld}~ ; then
3550 mv ${config_host_ld}~ $config_host_ld
3551 else
3552 rm ${config_host_ld}~
3553 fi
3554 fi
3555
3556 for d in libdis libdis-user; do
3557 symlink "$source_path/Makefile.dis" "$d/Makefile"
3558 echo > $d/config.mak
3559 done
3560
3561 # use included Linux headers
3562 if test "$linux" = "yes" ; then
3563 mkdir -p linux-headers
3564 case "$cpu" in
3565 i386|x86_64)
3566 linux_arch=x86
3567 ;;
3568 ppcemb|ppc|ppc64)
3569 linux_arch=powerpc
3570 ;;
3571 s390x)
3572 linux_arch=s390
3573 ;;
3574 *)
3575 # For most CPUs the kernel architecture name and QEMU CPU name match.
3576 linux_arch="$cpu"
3577 ;;
3578 esac
3579 # For non-KVM architectures we will not have asm headers
3580 if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
3581 symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
3582 fi
3583 fi
3584
3585 for target in $target_list; do
3586 target_dir="$target"
3587 config_target_mak=$target_dir/config-target.mak
3588 target_arch2=`echo $target | cut -d '-' -f 1`
3589 target_bigendian="no"
3590
3591 case "$target_arch2" in
3592 armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|or32|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
3593 target_bigendian=yes
3594 ;;
3595 esac
3596 target_softmmu="no"
3597 target_user_only="no"
3598 target_linux_user="no"
3599 target_bsd_user="no"
3600 case "$target" in
3601 ${target_arch2}-softmmu)
3602 target_softmmu="yes"
3603 ;;
3604 ${target_arch2}-linux-user)
3605 if test "$linux" != "yes" ; then
3606 echo "ERROR: Target '$target' is only available on a Linux host"
3607 exit 1
3608 fi
3609 target_user_only="yes"
3610 target_linux_user="yes"
3611 ;;
3612 ${target_arch2}-bsd-user)
3613 if test "$bsd" != "yes" ; then
3614 echo "ERROR: Target '$target' is only available on a BSD host"
3615 exit 1
3616 fi
3617 target_user_only="yes"
3618 target_bsd_user="yes"
3619 ;;
3620 *)
3621 echo "ERROR: Target '$target' not recognised"
3622 exit 1
3623 ;;
3624 esac
3625
3626 mkdir -p $target_dir
3627 echo "# Automatically generated by configure - do not modify" > $config_target_mak
3628
3629 bflt="no"
3630 target_nptl="no"
3631 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
3632 gdb_xml_files=""
3633 target_short_alignment=2
3634 target_int_alignment=4
3635 target_long_alignment=4
3636 target_llong_alignment=8
3637 target_libs_softmmu=
3638
3639 TARGET_ARCH="$target_arch2"
3640 TARGET_BASE_ARCH=""
3641 TARGET_ABI_DIR=""
3642
3643 case "$target_arch2" in
3644 i386)
3645 target_phys_bits=64
3646 ;;
3647 x86_64)
3648 TARGET_BASE_ARCH=i386
3649 target_phys_bits=64
3650 target_long_alignment=8
3651 ;;
3652 alpha)
3653 target_phys_bits=64
3654 target_long_alignment=8
3655 target_nptl="yes"
3656 ;;
3657 arm|armeb)
3658 TARGET_ARCH=arm
3659 bflt="yes"
3660 target_nptl="yes"
3661 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
3662 target_phys_bits=64
3663 target_llong_alignment=4
3664 target_libs_softmmu="$fdt_libs"
3665 ;;
3666 cris)
3667 target_nptl="yes"
3668 target_phys_bits=32
3669 ;;
3670 lm32)
3671 target_phys_bits=32
3672 target_libs_softmmu="$opengl_libs"
3673 ;;
3674 m68k)
3675 bflt="yes"
3676 gdb_xml_files="cf-core.xml cf-fp.xml"
3677 target_phys_bits=32
3678 target_int_alignment=2
3679 target_long_alignment=2
3680 target_llong_alignment=2
3681 ;;
3682 microblaze|microblazeel)
3683 TARGET_ARCH=microblaze
3684 bflt="yes"
3685 target_nptl="yes"
3686 target_phys_bits=32
3687 target_libs_softmmu="$fdt_libs"
3688 ;;
3689 mips|mipsel)
3690 TARGET_ARCH=mips
3691 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
3692 target_nptl="yes"
3693 target_phys_bits=64
3694 ;;
3695 mipsn32|mipsn32el)
3696 TARGET_ARCH=mipsn32
3697 TARGET_BASE_ARCH=mips
3698 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
3699 target_phys_bits=64
3700 ;;
3701 mips64|mips64el)
3702 TARGET_ARCH=mips64
3703 TARGET_BASE_ARCH=mips
3704 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
3705 target_phys_bits=64
3706 target_long_alignment=8
3707 ;;
3708 or32)
3709 TARGET_ARCH=openrisc
3710 TARGET_BASE_ARCH=openrisc
3711 target_phys_bits=32
3712 ;;
3713 ppc)
3714 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
3715 target_phys_bits=64
3716 target_nptl="yes"
3717 target_libs_softmmu="$fdt_libs"
3718 ;;
3719 ppcemb)
3720 TARGET_BASE_ARCH=ppc
3721 TARGET_ABI_DIR=ppc
3722 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
3723 target_phys_bits=64
3724 target_nptl="yes"
3725 target_libs_softmmu="$fdt_libs"
3726 ;;
3727 ppc64)
3728 TARGET_BASE_ARCH=ppc
3729 TARGET_ABI_DIR=ppc
3730 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
3731 target_phys_bits=64
3732 target_long_alignment=8
3733 target_libs_softmmu="$fdt_libs"
3734 ;;
3735 ppc64abi32)
3736 TARGET_ARCH=ppc64
3737 TARGET_BASE_ARCH=ppc
3738 TARGET_ABI_DIR=ppc
3739 echo "TARGET_ABI32=y" >> $config_target_mak
3740 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
3741 target_phys_bits=64
3742 target_libs_softmmu="$fdt_libs"
3743 ;;
3744 sh4|sh4eb)
3745 TARGET_ARCH=sh4
3746 bflt="yes"
3747 target_nptl="yes"
3748 target_phys_bits=32
3749 ;;
3750 sparc)
3751 target_phys_bits=64
3752 ;;
3753 sparc64)
3754 TARGET_BASE_ARCH=sparc
3755 target_phys_bits=64
3756 target_long_alignment=8
3757 ;;
3758 sparc32plus)
3759 TARGET_ARCH=sparc64
3760 TARGET_BASE_ARCH=sparc
3761 TARGET_ABI_DIR=sparc
3762 echo "TARGET_ABI32=y" >> $config_target_mak
3763 target_phys_bits=64
3764 ;;
3765 s390x)
3766 target_nptl="yes"
3767 target_phys_bits=64
3768 target_long_alignment=8
3769 ;;
3770 unicore32)
3771 target_phys_bits=32
3772 ;;
3773 xtensa|xtensaeb)
3774 TARGET_ARCH=xtensa
3775 target_phys_bits=32
3776 ;;
3777 *)
3778 echo "Unsupported target CPU"
3779 exit 1
3780 ;;
3781 esac
3782 # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
3783 if [ "$TARGET_BASE_ARCH" = "" ]; then
3784 TARGET_BASE_ARCH=$TARGET_ARCH
3785 fi
3786
3787 symlink "$source_path/Makefile.target" "$target_dir/Makefile"
3788
3789
3790 case "$target_arch2" in
3791 alpha | i386 | or32 | sparc* | x86_64 | xtensa* | ppc*)
3792 echo "CONFIG_TCG_PASS_AREG0=y" >> $config_target_mak
3793 ;;
3794 esac
3795
3796 echo "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak
3797 echo "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak
3798 echo "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak
3799 echo "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak
3800 echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
3801 target_arch_name="`echo $TARGET_ARCH | LC_ALL=C tr '[a-z]' '[A-Z]'`"
3802 echo "TARGET_$target_arch_name=y" >> $config_target_mak
3803 echo "TARGET_ARCH2=$target_arch2" >> $config_target_mak
3804 echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
3805 if [ "$TARGET_ABI_DIR" = "" ]; then
3806 TARGET_ABI_DIR=$TARGET_ARCH
3807 fi
3808 echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
3809 case "$target_arch2" in
3810 i386|x86_64)
3811 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
3812 target_phys_bits=64
3813 echo "CONFIG_XEN=y" >> $config_target_mak
3814 if test "$xen_pci_passthrough" = yes; then
3815 echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
3816 fi
3817 else
3818 echo "CONFIG_NO_XEN=y" >> $config_target_mak
3819 fi
3820 ;;
3821 *)
3822 echo "CONFIG_NO_XEN=y" >> $config_target_mak
3823 esac
3824 case "$target_arch2" in
3825 i386|x86_64|ppcemb|ppc|ppc64|s390x)
3826 # Make sure the target and host cpus are compatible
3827 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
3828 \( "$target_arch2" = "$cpu" -o \
3829 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
3830 \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \
3831 \( "$target_arch2" = "ppc" -a "$cpu" = "ppc64" \) -o \
3832 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
3833 \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \
3834 \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then
3835 echo "CONFIG_KVM=y" >> $config_target_mak
3836 if test "$vhost_net" = "yes" ; then
3837 echo "CONFIG_VHOST_NET=y" >> $config_target_mak
3838 fi
3839 fi
3840 esac
3841 case "$target_arch2" in
3842 i386|x86_64)
3843 echo "CONFIG_HAVE_GET_MEMORY_MAPPING=y" >> $config_target_mak
3844 esac
3845 if test "$target_arch2" = "ppc64" -a "$fdt" = "yes"; then
3846 echo "CONFIG_PSERIES=y" >> $config_target_mak
3847 fi
3848 if test "$target_bigendian" = "yes" ; then
3849 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
3850 fi
3851 if test "$target_softmmu" = "yes" ; then
3852 echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
3853 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
3854 echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak
3855 echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
3856 echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
3857 if test "$smartcard_nss" = "yes" ; then
3858 echo "subdir-$target: subdir-libcacard" >> $config_host_mak
3859 fi
3860 case "$target_arch2" in
3861 i386|x86_64)
3862 echo "CONFIG_HAVE_CORE_DUMP=y" >> $config_target_mak
3863 esac
3864 fi
3865 if test "$target_user_only" = "yes" ; then
3866 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
3867 echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
3868 fi
3869 if test "$target_linux_user" = "yes" ; then
3870 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
3871 fi
3872 list=""
3873 if test ! -z "$gdb_xml_files" ; then
3874 for x in $gdb_xml_files; do
3875 list="$list $source_path/gdb-xml/$x"
3876 done
3877 echo "TARGET_XML_FILES=$list" >> $config_target_mak
3878 fi
3879
3880 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
3881 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
3882 fi
3883 if test "$target_user_only" = "yes" \
3884 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
3885 echo "CONFIG_USE_NPTL=y" >> $config_target_mak
3886 fi
3887 if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
3888 echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
3889 fi
3890 if test "$target_bsd_user" = "yes" ; then
3891 echo "CONFIG_BSD_USER=y" >> $config_target_mak
3892 fi
3893
3894 # the static way of configuring available audio cards requires this workaround
3895 if test "$target_user_only" != "yes" && grep -q CONFIG_PCSPK $source_path/default-configs/$target.mak; then
3896 echo "CONFIG_PCSPK=y" >> $config_target_mak
3897 fi
3898
3899 # generate QEMU_CFLAGS/LDFLAGS for targets
3900
3901 cflags=""
3902 includes=""
3903 ldflags=""
3904
3905 if test "$tcg_interpreter" = "yes"; then
3906 includes="-I\$(SRC_PATH)/tcg/tci $includes"
3907 elif test "$ARCH" = "sparc64" ; then
3908 includes="-I\$(SRC_PATH)/tcg/sparc $includes"
3909 elif test "$ARCH" = "s390x" ; then
3910 includes="-I\$(SRC_PATH)/tcg/s390 $includes"
3911 elif test "$ARCH" = "x86_64" ; then
3912 includes="-I\$(SRC_PATH)/tcg/i386 $includes"
3913 else
3914 includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes"
3915 fi
3916 includes="-I\$(SRC_PATH)/tcg $includes"
3917
3918 if test "$linux" = "yes" ; then
3919 includes="-I\$(SRC_PATH)/linux-headers $includes"
3920 fi
3921
3922 if test "$target_user_only" = "yes" ; then
3923 libdis_config_mak=libdis-user/config.mak
3924 else
3925 libdis_config_mak=libdis/config.mak
3926 fi
3927
3928 for i in $ARCH $TARGET_BASE_ARCH ; do
3929 case "$i" in
3930 alpha)
3931 echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
3932 echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak
3933 ;;
3934 arm)
3935 echo "CONFIG_ARM_DIS=y" >> $config_target_mak
3936 echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak
3937 ;;
3938 cris)
3939 echo "CONFIG_CRIS_DIS=y" >> $config_target_mak
3940 echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak
3941 ;;
3942 hppa)
3943 echo "CONFIG_HPPA_DIS=y" >> $config_target_mak
3944 echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak
3945 ;;
3946 i386|x86_64)
3947 echo "CONFIG_I386_DIS=y" >> $config_target_mak
3948 echo "CONFIG_I386_DIS=y" >> $libdis_config_mak
3949 ;;
3950 ia64*)
3951 echo "CONFIG_IA64_DIS=y" >> $config_target_mak
3952 echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak
3953 ;;
3954 lm32)
3955 echo "CONFIG_LM32_DIS=y" >> $config_target_mak
3956 echo "CONFIG_LM32_DIS=y" >> $libdis_config_mak
3957 ;;
3958 m68k)
3959 echo "CONFIG_M68K_DIS=y" >> $config_target_mak
3960 echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak
3961 ;;
3962 microblaze*)
3963 echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak
3964 echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak
3965 ;;
3966 mips*)
3967 echo "CONFIG_MIPS_DIS=y" >> $config_target_mak
3968 echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak
3969 ;;
3970 or32)
3971 echo "CONFIG_OPENRISC_DIS=y" >> $config_target_mak
3972 echo "CONFIG_OPENRISC_DIS=y" >> $libdis_config_mak
3973 ;;
3974 ppc*)
3975 echo "CONFIG_PPC_DIS=y" >> $config_target_mak
3976 echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak
3977 ;;
3978 s390*)
3979 echo "CONFIG_S390_DIS=y" >> $config_target_mak
3980 echo "CONFIG_S390_DIS=y" >> $libdis_config_mak
3981 ;;
3982 sh4)
3983 echo "CONFIG_SH4_DIS=y" >> $config_target_mak
3984 echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak
3985 ;;
3986 sparc*)
3987 echo "CONFIG_SPARC_DIS=y" >> $config_target_mak
3988 echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak
3989 ;;
3990 xtensa*)
3991 echo "CONFIG_XTENSA_DIS=y" >> $config_target_mak
3992 echo "CONFIG_XTENSA_DIS=y" >> $libdis_config_mak
3993 ;;
3994 esac
3995 done
3996 if test "$tcg_interpreter" = "yes" ; then
3997 echo "CONFIG_TCI_DIS=y" >> $config_target_mak
3998 echo "CONFIG_TCI_DIS=y" >> $libdis_config_mak
3999 fi
4000
4001 case "$ARCH" in
4002 alpha)
4003 # Ensure there's only a single GP
4004 cflags="-msmall-data $cflags"
4005 ;;
4006 esac
4007
4008 if test "$target_softmmu" = "yes" ; then
4009 case "$TARGET_BASE_ARCH" in
4010 arm)
4011 cflags="-DHAS_AUDIO $cflags"
4012 ;;
4013 lm32)
4014 cflags="-DHAS_AUDIO $cflags"
4015 ;;
4016 i386|mips|ppc)
4017 cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
4018 ;;
4019 esac
4020 fi
4021
4022 if test "$gprof" = "yes" ; then
4023 echo "TARGET_GPROF=yes" >> $config_target_mak
4024 if test "$target_linux_user" = "yes" ; then
4025 cflags="-p $cflags"
4026 ldflags="-p $ldflags"
4027 fi
4028 if test "$target_softmmu" = "yes" ; then
4029 ldflags="-p $ldflags"
4030 echo "GPROF_CFLAGS=-p" >> $config_target_mak
4031 fi
4032 fi
4033
4034 if test "$ARCH" = "tci"; then
4035 linker_script=""
4036 else
4037 linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
4038 fi
4039
4040 if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
4041 case "$ARCH" in
4042 sparc)
4043 # -static is used to avoid g1/g3 usage by the dynamic linker
4044 ldflags="$linker_script -static $ldflags"
4045 ;;
4046 alpha | s390x)
4047 # The default placement of the application is fine.
4048 ;;
4049 *)
4050 ldflags="$linker_script $ldflags"
4051 ;;
4052 esac
4053 fi
4054
4055 echo "LDFLAGS+=$ldflags" >> $config_target_mak
4056 echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
4057 echo "QEMU_INCLUDES+=$includes" >> $config_target_mak
4058
4059 done # for target in $targets
4060
4061 # build tree in object directory in case the source is not in the current directory
4062 DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32"
4063 DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas"
4064 DIRS="$DIRS roms/seabios roms/vgabios"
4065 DIRS="$DIRS qapi-generated"
4066 DIRS="$DIRS libcacard libcacard/libcacard libcacard/trace"
4067 FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
4068 FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
4069 FILES="$FILES tests/tcg/lm32/Makefile libcacard/Makefile"
4070 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
4071 FILES="$FILES pc-bios/spapr-rtas/Makefile"
4072 FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
4073 for bios_file in \
4074 $source_path/pc-bios/*.bin \
4075 $source_path/pc-bios/*.rom \
4076 $source_path/pc-bios/*.dtb \
4077 $source_path/pc-bios/openbios-* \
4078 $source_path/pc-bios/palcode-*
4079 do
4080 FILES="$FILES pc-bios/`basename $bios_file`"
4081 done
4082 mkdir -p $DIRS
4083 for f in $FILES ; do
4084 if [ -e "$source_path/$f" ] && [ "$source_path" != `pwd` ]; then
4085 symlink "$source_path/$f" "$f"
4086 fi
4087 done
4088
4089 # temporary config to build submodules
4090 for rom in seabios vgabios ; do
4091 config_mak=roms/$rom/config.mak
4092 echo "# Automatically generated by configure - do not modify" > $config_mak
4093 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
4094 echo "CC=$cc" >> $config_mak
4095 echo "BCC=bcc" >> $config_mak
4096 echo "CPP=${cross_prefix}cpp" >> $config_mak
4097 echo "OBJCOPY=objcopy" >> $config_mak
4098 echo "IASL=iasl" >> $config_mak
4099 echo "LD=$ld" >> $config_mak
4100 done
4101
4102 for hwlib in 32 64; do
4103 d=libhw$hwlib
4104 symlink "$source_path/Makefile.hw" "$d/Makefile"
4105 echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
4106 done
4107
4108 d=libuser
4109 symlink "$source_path/Makefile.user" "$d/Makefile"
4110
4111 if test "$docs" = "yes" ; then
4112 mkdir -p QMP
4113 fi