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