ui/sdl2 : initial port to SDL 2.0 (v2.0)
[sdk/emulator/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 TMPB="qemu-conf-${RANDOM}-$$-${RANDOM}"
16 TMPO="${TMPDIR1}/${TMPB}.o"
17 TMPL="${TMPDIR1}/${TMPB}.lo"
18 TMPA="${TMPDIR1}/lib${TMPB}.la"
19 TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.exe"
20
21 # NB: do not call "exit" in the trap handler; this is buggy with some shells;
22 # see <1285349658-3122-1-git-send-email-loic.minier@linaro.org>
23 trap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM
24 rm -f config.log
25
26 # Print a helpful header at the top of config.log
27 echo "# QEMU configure log $(date)" >> config.log
28 printf "# Configured with:" >> config.log
29 printf " '%s'" "$0" "$@" >> config.log
30 echo >> config.log
31 echo "#" >> config.log
32
33 # Save the configure command line for later reuse.
34 cat <<EOD >config.status
35 #!/bin/sh
36 # Generated by configure.
37 # Run this file to recreate the current configuration.
38 # Compiler output produced by configure, useful for debugging
39 # configure, is in config.log if it exists.
40 EOD
41 printf "exec" >>config.status
42 printf " '%s'" "$0" "$@" >>config.status
43 echo >>config.status
44 chmod +x config.status
45
46 error_exit() {
47     echo
48     echo "ERROR: $1"
49     while test -n "$2"; do
50         echo "       $2"
51         shift
52     done
53     echo
54     exit 1
55 }
56
57 do_cc() {
58     # Run the compiler, capturing its output to the log.
59     echo $cc "$@" >> config.log
60     $cc "$@" >> config.log 2>&1 || return $?
61     # Test passed. If this is an --enable-werror build, rerun
62     # the test with -Werror and bail out if it fails. This
63     # makes warning-generating-errors in configure test code
64     # obvious to developers.
65     if test "$werror" != "yes"; then
66         return 0
67     fi
68     # Don't bother rerunning the compile if we were already using -Werror
69     case "$*" in
70         *-Werror*)
71            return 0
72         ;;
73     esac
74     echo $cc -Werror "$@" >> config.log
75     $cc -Werror "$@" >> config.log 2>&1 && return $?
76     error_exit "configure test passed without -Werror but failed with -Werror." \
77         "This is probably a bug in the configure script. The failing command" \
78         "will be at the bottom of config.log." \
79         "You can run configure with --disable-werror to bypass this check."
80 }
81
82 compile_object() {
83   do_cc $QEMU_CFLAGS -c -o $TMPO $TMPC
84 }
85
86 compile_prog() {
87   local_cflags="$1"
88   local_ldflags="$2"
89   do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
90 }
91
92 do_libtool() {
93     local mode=$1
94     shift
95     # Run the compiler, capturing its output to the log.
96     echo $libtool $mode --tag=CC $cc "$@" >> config.log
97     $libtool $mode --tag=CC $cc "$@" >> config.log 2>&1 || return $?
98     # Test passed. If this is an --enable-werror build, rerun
99     # the test with -Werror and bail out if it fails. This
100     # makes warning-generating-errors in configure test code
101     # obvious to developers.
102     if test "$werror" != "yes"; then
103         return 0
104     fi
105     # Don't bother rerunning the compile if we were already using -Werror
106     case "$*" in
107         *-Werror*)
108            return 0
109         ;;
110     esac
111     echo $libtool $mode --tag=CC $cc -Werror "$@" >> config.log
112     $libtool $mode --tag=CC $cc -Werror "$@" >> config.log 2>&1 && return $?
113     error_exit "configure test passed without -Werror but failed with -Werror." \
114         "This is probably a bug in the configure script. The failing command" \
115         "will be at the bottom of config.log." \
116         "You can run configure with --disable-werror to bypass this check."
117 }
118
119 libtool_prog() {
120     do_libtool --mode=compile $QEMU_CFLAGS -c -fPIE -DPIE -o $TMPO $TMPC || return $?
121     do_libtool --mode=link $LDFLAGS -o $TMPA $TMPL -rpath /usr/local/lib
122 }
123
124 # symbolically link $1 to $2.  Portable version of "ln -sf".
125 symlink() {
126   rm -rf "$2"
127   mkdir -p "$(dirname "$2")"
128   ln -s "$1" "$2"
129 }
130
131 # check whether a command is available to this shell (may be either an
132 # executable or a builtin)
133 has() {
134     type "$1" >/dev/null 2>&1
135 }
136
137 # search for an executable in PATH
138 path_of() {
139     local_command="$1"
140     local_ifs="$IFS"
141     local_dir=""
142
143     # pathname has a dir component?
144     if [ "${local_command#*/}" != "$local_command" ]; then
145         if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
146             echo "$local_command"
147             return 0
148         fi
149     fi
150     if [ -z "$local_command" ]; then
151         return 1
152     fi
153
154     IFS=:
155     for local_dir in $PATH; do
156         if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
157             echo "$local_dir/$local_command"
158             IFS="${local_ifs:-$(printf ' \t\n')}"
159             return 0
160         fi
161     done
162     # not found
163     IFS="${local_ifs:-$(printf ' \t\n')}"
164     return 1
165 }
166
167 # default parameters
168 source_path=`dirname "$0"`
169 cpu=""
170 iasl="iasl"
171 interp_prefix="/usr/gnemul/qemu-%M"
172 static="no"
173 cross_prefix=""
174 audio_drv_list=""
175 block_drv_rw_whitelist=""
176 block_drv_ro_whitelist=""
177 host_cc="cc"
178 libs_softmmu=""
179 libs_tools=""
180 audio_pt_int=""
181 audio_win_int=""
182 cc_i386=i386-pc-linux-gnu-gcc
183 libs_qga=""
184 debug_info="yes"
185
186 # Don't accept a target_list environment variable.
187 unset target_list
188
189 # Default value for a variable defining feature "foo".
190 #  * foo="no"  feature will only be used if --enable-foo arg is given
191 #  * foo=""    feature will be searched for, and if found, will be used
192 #              unless --disable-foo is given
193 #  * foo="yes" this value will only be set by --enable-foo flag.
194 #              feature will searched for,
195 #              if not found, configure exits with error
196 #
197 # Always add --enable-foo and --disable-foo command line args.
198 # Distributions want to ensure that several features are compiled in, and it
199 # is impossible without a --enable-foo that exits if a feature is not found.
200
201 bluez=""
202 brlapi=""
203 curl=""
204 curses=""
205 docs=""
206 fdt=""
207 netmap="no"
208 pixman=""
209 sdl=""
210 sdlabi="1.2"
211 virtfs=""
212 vnc="yes"
213 sparse="no"
214 uuid=""
215 vde=""
216 vnc_tls=""
217 vnc_sasl=""
218 vnc_jpeg=""
219 vnc_png=""
220 vnc_ws=""
221 xen=""
222 xen_ctrl_version=""
223 xen_pci_passthrough=""
224 linux_aio=""
225 cap_ng=""
226 attr=""
227 libattr=""
228 xfs=""
229
230 vhost_net="no"
231 vhost_scsi="no"
232 kvm="no"
233 rdma=""
234 gprof="no"
235 debug_tcg="no"
236 debug="no"
237 strip_opt="yes"
238 tcg_interpreter="no"
239 bigendian="no"
240 mingw32="no"
241 gcov="no"
242 gcov_tool="gcov"
243 EXESUF=""
244 DSOSUF=".so"
245 LDFLAGS_SHARED="-shared"
246 modules="no"
247 prefix="/usr/local"
248 mandir="\${prefix}/share/man"
249 datadir="\${prefix}/share"
250 qemu_docdir="\${prefix}/share/doc/qemu"
251 bindir="\${prefix}/bin"
252 libdir="\${prefix}/lib"
253 libexecdir="\${prefix}/libexec"
254 includedir="\${prefix}/include"
255 sysconfdir="\${prefix}/etc"
256 local_statedir="\${prefix}/var"
257 confsuffix="/qemu"
258 slirp="yes"
259 fmod_lib=""
260 fmod_inc=""
261 oss_lib=""
262 bsd="no"
263 linux="no"
264 solaris="no"
265 profiler="no"
266 cocoa="no"
267 softmmu="yes"
268 linux_user="no"
269 bsd_user="no"
270 guest_base="yes"
271 uname_release=""
272 aix="no"
273 blobs="yes"
274 pkgversion=""
275 pie=""
276 zero_malloc=""
277 qom_cast_debug="yes"
278 trace_backend="nop"
279 trace_file="trace"
280 spice=""
281 rbd=""
282 smartcard_nss=""
283 libusb=""
284 usb_redir=""
285 glx=""
286 zlib="yes"
287 lzo="no"
288 snappy="no"
289 guest_agent=""
290 guest_agent_with_vss="no"
291 vss_win32_sdk=""
292 win_sdk="no"
293 want_tools="yes"
294 libiscsi=""
295 libnfs=""
296 coroutine=""
297 coroutine_pool=""
298 seccomp=""
299 glusterfs=""
300 glusterfs_discard="no"
301 glusterfs_zerofill="no"
302 virtio_blk_data_plane=""
303 gtk=""
304 gtkabi="2.0"
305 tpm="no"
306 libssh2=""
307 vhdx=""
308 quorum="no"
309
310 # parse CC options first
311 for opt do
312   optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
313   case "$opt" in
314   --cross-prefix=*) cross_prefix="$optarg"
315   ;;
316   --cc=*) CC="$optarg"
317   ;;
318   --cxx=*) CXX="$optarg"
319   ;;
320   --source-path=*) source_path="$optarg"
321   ;;
322   --cpu=*) cpu="$optarg"
323   ;;
324   --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
325                     EXTRA_CFLAGS="$optarg"
326   ;;
327   --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
328                      EXTRA_LDFLAGS="$optarg"
329   ;;
330   --enable-debug-info) debug_info="yes"
331   ;;
332   --disable-debug-info) debug_info="no"
333   ;;
334   esac
335 done
336 # OS specific
337 # Using uname is really, really broken.  Once we have the right set of checks
338 # we can eliminate its usage altogether.
339
340 # Preferred compiler:
341 #  ${CC} (if set)
342 #  ${cross_prefix}gcc (if cross-prefix specified)
343 #  system compiler
344 if test -z "${CC}${cross_prefix}"; then
345   cc="$host_cc"
346 else
347   cc="${CC-${cross_prefix}gcc}"
348 fi
349
350 if test -z "${CXX}${cross_prefix}"; then
351   cxx="c++"
352 else
353   cxx="${CXX-${cross_prefix}g++}"
354 fi
355
356 ar="${AR-${cross_prefix}ar}"
357 as="${AS-${cross_prefix}as}"
358 cpp="${CPP-$cc -E}"
359 objcopy="${OBJCOPY-${cross_prefix}objcopy}"
360 ld="${LD-${cross_prefix}ld}"
361 libtool="${LIBTOOL-${cross_prefix}libtool}"
362 strip="${STRIP-${cross_prefix}strip}"
363 windres="${WINDRES-${cross_prefix}windres}"
364 pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
365 query_pkg_config() {
366     "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
367 }
368 pkg_config=query_pkg_config
369 sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
370 sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}"
371
372 # If the user hasn't specified ARFLAGS, default to 'rv', just as make does.
373 ARFLAGS="${ARFLAGS-rv}"
374
375 # default flags for all hosts
376 QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
377 QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
378 QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
379 QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
380 QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/include"
381 if test "$debug_info" = "yes"; then
382     CFLAGS="-g $CFLAGS"
383     LDFLAGS="-g $LDFLAGS"
384 fi
385
386 # make source path absolute
387 source_path=`cd "$source_path"; pwd`
388
389 check_define() {
390 cat > $TMPC <<EOF
391 #if !defined($1)
392 #error $1 not defined
393 #endif
394 int main(void) { return 0; }
395 EOF
396   compile_object
397 }
398
399 if check_define __linux__ ; then
400   targetos="Linux"
401 elif check_define _WIN32 ; then
402   targetos='MINGW32'
403 elif check_define __OpenBSD__ ; then
404   targetos='OpenBSD'
405 elif check_define __sun__ ; then
406   targetos='SunOS'
407 elif check_define __HAIKU__ ; then
408   targetos='Haiku'
409 else
410   targetos=`uname -s`
411 fi
412
413 # Some host OSes need non-standard checks for which CPU to use.
414 # Note that these checks are broken for cross-compilation: if you're
415 # cross-compiling to one of these OSes then you'll need to specify
416 # the correct CPU with the --cpu option.
417 case $targetos in
418 Darwin)
419   # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
420   # run 64-bit userspace code.
421   # If the user didn't specify a CPU explicitly and the kernel says this is
422   # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
423   if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
424     cpu="x86_64"
425   fi
426   ;;
427 SunOS)
428   # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
429   if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
430     cpu="x86_64"
431   fi
432 esac
433
434 if test ! -z "$cpu" ; then
435   # command line argument
436   :
437 elif check_define __i386__ ; then
438   cpu="i386"
439 elif check_define __x86_64__ ; then
440   if check_define __ILP32__ ; then
441     cpu="x32"
442   else
443     cpu="x86_64"
444   fi
445 elif check_define __sparc__ ; then
446   if check_define __arch64__ ; then
447     cpu="sparc64"
448   else
449     cpu="sparc"
450   fi
451 elif check_define _ARCH_PPC ; then
452   if check_define _ARCH_PPC64 ; then
453     cpu="ppc64"
454   else
455     cpu="ppc"
456   fi
457 elif check_define __mips__ ; then
458   cpu="mips"
459 elif check_define __ia64__ ; then
460   cpu="ia64"
461 elif check_define __s390__ ; then
462   if check_define __s390x__ ; then
463     cpu="s390x"
464   else
465     cpu="s390"
466   fi
467 elif check_define __arm__ ; then
468   cpu="arm"
469 elif check_define __aarch64__ ; then
470   cpu="aarch64"
471 elif check_define __hppa__ ; then
472   cpu="hppa"
473 else
474   cpu=`uname -m`
475 fi
476
477 ARCH=
478 # Normalise host CPU name and set ARCH.
479 # Note that this case should only have supported host CPUs, not guests.
480 case "$cpu" in
481   ia64|ppc|ppc64|s390|s390x|sparc64|x32)
482     cpu="$cpu"
483   ;;
484   i386|i486|i586|i686|i86pc|BePC)
485     cpu="i386"
486   ;;
487   x86_64|amd64)
488     cpu="x86_64"
489   ;;
490   armv*b|armv*l|arm)
491     cpu="arm"
492   ;;
493   aarch64)
494     cpu="aarch64"
495   ;;
496   mips*)
497     cpu="mips"
498   ;;
499   sparc|sun4[cdmuv])
500     cpu="sparc"
501   ;;
502   *)
503     # This will result in either an error or falling back to TCI later
504     ARCH=unknown
505   ;;
506 esac
507 if test -z "$ARCH"; then
508   ARCH="$cpu"
509 fi
510
511 # OS specific
512
513 case $targetos in
514 CYGWIN*)
515   mingw32="yes"
516   QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
517   audio_possible_drivers="winwave sdl"
518   audio_drv_list="winwave"
519 ;;
520 MINGW32*)
521   mingw32="yes"
522   audio_possible_drivers="winwave dsound sdl fmod"
523   audio_drv_list="winwave"
524 ;;
525 GNU/kFreeBSD)
526   bsd="yes"
527   audio_drv_list="oss"
528   audio_possible_drivers="oss sdl esd pa"
529 ;;
530 FreeBSD)
531   bsd="yes"
532   make="${MAKE-gmake}"
533   audio_drv_list="oss"
534   audio_possible_drivers="oss sdl esd pa"
535   # needed for kinfo_getvmmap(3) in libutil.h
536   LIBS="-lutil $LIBS"
537   netmap=""  # enable netmap autodetect
538 ;;
539 DragonFly)
540   bsd="yes"
541   make="${MAKE-gmake}"
542   audio_drv_list="oss"
543   audio_possible_drivers="oss sdl esd pa"
544 ;;
545 NetBSD)
546   bsd="yes"
547   make="${MAKE-gmake}"
548   audio_drv_list="oss"
549   audio_possible_drivers="oss sdl esd"
550   oss_lib="-lossaudio"
551 ;;
552 OpenBSD)
553   bsd="yes"
554   make="${MAKE-gmake}"
555   audio_drv_list="sdl"
556   audio_possible_drivers="sdl esd"
557 ;;
558 Darwin)
559   bsd="yes"
560   darwin="yes"
561   LDFLAGS_SHARED="-bundle -undefined dynamic_lookup"
562   if [ "$cpu" = "x86_64" ] ; then
563     QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
564     LDFLAGS="-arch x86_64 $LDFLAGS"
565   fi
566   cocoa="yes"
567   audio_drv_list="coreaudio"
568   audio_possible_drivers="coreaudio sdl fmod"
569   LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
570   libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
571   # Disable attempts to use ObjectiveC features in os/object.h since they
572   # won't work when we're compiling with gcc as a C compiler.
573   QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
574 ;;
575 SunOS)
576   solaris="yes"
577   make="${MAKE-gmake}"
578   install="${INSTALL-ginstall}"
579   ld="gld"
580   smbd="${SMBD-/usr/sfw/sbin/smbd}"
581   needs_libsunmath="no"
582   solarisrev=`uname -r | cut -f2 -d.`
583   if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
584     if test "$solarisrev" -le 9 ; then
585       if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
586         needs_libsunmath="yes"
587         QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
588         LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
589         LIBS="-lsunmath $LIBS"
590       else
591         error_exit "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" \
592             "libsunmath from the Sun Studio compilers tools, due to a lack of" \
593             "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" \
594             "Studio 11 can be downloaded from www.sun.com."
595       fi
596     fi
597   fi
598   if test -f /usr/include/sys/soundcard.h ; then
599     audio_drv_list="oss"
600   fi
601   audio_possible_drivers="oss sdl"
602 # needed for CMSG_ macros in sys/socket.h
603   QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
604 # needed for TIOCWIN* defines in termios.h
605   QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
606   QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
607   solarisnetlibs="-lsocket -lnsl -lresolv"
608   LIBS="$solarisnetlibs $LIBS"
609   libs_qga="$solarisnetlibs $libs_qga"
610 ;;
611 AIX)
612   aix="yes"
613   make="${MAKE-gmake}"
614 ;;
615 Haiku)
616   haiku="yes"
617   QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
618   LIBS="-lposix_error_mapper -lnetwork $LIBS"
619 ;;
620 *)
621   audio_drv_list="oss"
622   audio_possible_drivers="oss alsa sdl esd pa"
623   linux="yes"
624   linux_user="yes"
625   kvm="yes"
626   vhost_net="yes"
627   vhost_scsi="yes"
628   if [ "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "x32" ] ; then
629     audio_possible_drivers="$audio_possible_drivers fmod"
630   fi
631   QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES"
632 ;;
633 esac
634
635 if [ "$bsd" = "yes" ] ; then
636   if [ "$darwin" != "yes" ] ; then
637     bsd_user="yes"
638   fi
639 fi
640
641 : ${make=${MAKE-make}}
642 : ${install=${INSTALL-install}}
643 : ${python=${PYTHON-python}}
644 : ${smbd=${SMBD-/usr/sbin/smbd}}
645
646 # Default objcc to clang if available, otherwise use CC
647 if has clang; then
648   objcc=clang
649 else
650   objcc="$cc"
651 fi
652
653 if test "$mingw32" = "yes" ; then
654   EXESUF=".exe"
655   DSOSUF=".dll"
656   QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
657   # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
658   QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
659   LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
660 cat > $TMPC << EOF
661 int main(void) { return 0; }
662 EOF
663   if compile_prog "" "-liberty" ; then
664     LIBS="-liberty $LIBS"
665   fi
666   prefix="c:/Program Files/QEMU"
667   mandir="\${prefix}"
668   datadir="\${prefix}"
669   qemu_docdir="\${prefix}"
670   bindir="\${prefix}"
671   sysconfdir="\${prefix}"
672   local_statedir=
673   confsuffix=""
674   libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga"
675 fi
676
677 werror=""
678
679 for opt do
680   optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
681   case "$opt" in
682   --help|-h) show_help=yes
683   ;;
684   --version|-V) exec cat $source_path/VERSION
685   ;;
686   --prefix=*) prefix="$optarg"
687   ;;
688   --interp-prefix=*) interp_prefix="$optarg"
689   ;;
690   --source-path=*)
691   ;;
692   --cross-prefix=*)
693   ;;
694   --cc=*)
695   ;;
696   --host-cc=*) host_cc="$optarg"
697   ;;
698   --cxx=*)
699   ;;
700   --iasl=*) iasl="$optarg"
701   ;;
702   --objcc=*) objcc="$optarg"
703   ;;
704   --make=*) make="$optarg"
705   ;;
706   --install=*) install="$optarg"
707   ;;
708   --python=*) python="$optarg"
709   ;;
710   --gcov=*) gcov_tool="$optarg"
711   ;;
712   --smbd=*) smbd="$optarg"
713   ;;
714   --extra-cflags=*)
715   ;;
716   --extra-ldflags=*)
717   ;;
718   --enable-debug-info)
719   ;;
720   --disable-debug-info)
721   ;;
722   --enable-modules)
723       modules="yes"
724   ;;
725   --cpu=*)
726   ;;
727   --target-list=*) target_list="$optarg"
728   ;;
729   --enable-trace-backend=*) trace_backend="$optarg"
730   ;;
731   --with-trace-file=*) trace_file="$optarg"
732   ;;
733   --enable-gprof) gprof="yes"
734   ;;
735   --enable-gcov) gcov="yes"
736   ;;
737   --static)
738     static="yes"
739     LDFLAGS="-static $LDFLAGS"
740     QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
741   ;;
742   --mandir=*) mandir="$optarg"
743   ;;
744   --bindir=*) bindir="$optarg"
745   ;;
746   --libdir=*) libdir="$optarg"
747   ;;
748   --libexecdir=*) libexecdir="$optarg"
749   ;;
750   --includedir=*) includedir="$optarg"
751   ;;
752   --datadir=*) datadir="$optarg"
753   ;;
754   --with-confsuffix=*) confsuffix="$optarg"
755   ;;
756   --docdir=*) qemu_docdir="$optarg"
757   ;;
758   --sysconfdir=*) sysconfdir="$optarg"
759   ;;
760   --localstatedir=*) local_statedir="$optarg"
761   ;;
762   --sbindir=*|--sharedstatedir=*|\
763   --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
764   --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
765     # These switches are silently ignored, for compatibility with
766     # autoconf-generated configure scripts. This allows QEMU's
767     # configure to be used by RPM and similar macros that set
768     # lots of directory switches by default.
769   ;;
770   --with-system-pixman) pixman="system"
771   ;;
772   --without-system-pixman) pixman="internal"
773   ;;
774   --without-pixman) pixman="none"
775   ;;
776   --disable-sdl) sdl="no"
777   ;;
778   --enable-sdl) sdl="yes"
779   ;;
780   --with-sdlabi=*) sdlabi="$optarg"
781   ;;
782   --disable-qom-cast-debug) qom_cast_debug="no"
783   ;;
784   --enable-qom-cast-debug) qom_cast_debug="yes"
785   ;;
786   --disable-virtfs) virtfs="no"
787   ;;
788   --enable-virtfs) virtfs="yes"
789   ;;
790   --disable-vnc) vnc="no"
791   ;;
792   --enable-vnc) vnc="yes"
793   ;;
794   --fmod-lib=*) fmod_lib="$optarg"
795   ;;
796   --fmod-inc=*) fmod_inc="$optarg"
797   ;;
798   --oss-lib=*) oss_lib="$optarg"
799   ;;
800   --audio-drv-list=*) audio_drv_list="$optarg"
801   ;;
802   --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
803   ;;
804   --block-drv-ro-whitelist=*) block_drv_ro_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
805   ;;
806   --enable-debug-tcg) debug_tcg="yes"
807   ;;
808   --disable-debug-tcg) debug_tcg="no"
809   ;;
810   --enable-debug)
811       # Enable debugging options that aren't excessively noisy
812       debug_tcg="yes"
813       debug="yes"
814       strip_opt="no"
815   ;;
816   --enable-sparse) sparse="yes"
817   ;;
818   --disable-sparse) sparse="no"
819   ;;
820   --disable-strip) strip_opt="no"
821   ;;
822   --disable-vnc-tls) vnc_tls="no"
823   ;;
824   --enable-vnc-tls) vnc_tls="yes"
825   ;;
826   --disable-vnc-sasl) vnc_sasl="no"
827   ;;
828   --enable-vnc-sasl) vnc_sasl="yes"
829   ;;
830   --disable-vnc-jpeg) vnc_jpeg="no"
831   ;;
832   --enable-vnc-jpeg) vnc_jpeg="yes"
833   ;;
834   --disable-vnc-png) vnc_png="no"
835   ;;
836   --enable-vnc-png) vnc_png="yes"
837   ;;
838   --disable-vnc-ws) vnc_ws="no"
839   ;;
840   --enable-vnc-ws) vnc_ws="yes"
841   ;;
842   --disable-slirp) slirp="no"
843   ;;
844   --disable-uuid) uuid="no"
845   ;;
846   --enable-uuid) uuid="yes"
847   ;;
848   --disable-vde) vde="no"
849   ;;
850   --enable-vde) vde="yes"
851   ;;
852   --disable-netmap) netmap="no"
853   ;;
854   --enable-netmap) netmap="yes"
855   ;;
856   --disable-xen) xen="no"
857   ;;
858   --enable-xen) xen="yes"
859   ;;
860   --disable-xen-pci-passthrough) xen_pci_passthrough="no"
861   ;;
862   --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
863   ;;
864   --disable-brlapi) brlapi="no"
865   ;;
866   --enable-brlapi) brlapi="yes"
867   ;;
868   --disable-bluez) bluez="no"
869   ;;
870   --enable-bluez) bluez="yes"
871   ;;
872   --disable-kvm) kvm="no"
873   ;;
874   --enable-kvm) kvm="yes"
875   ;;
876   --disable-tcg-interpreter) tcg_interpreter="no"
877   ;;
878   --enable-tcg-interpreter) tcg_interpreter="yes"
879   ;;
880   --disable-cap-ng)  cap_ng="no"
881   ;;
882   --enable-cap-ng) cap_ng="yes"
883   ;;
884   --disable-spice) spice="no"
885   ;;
886   --enable-spice) spice="yes"
887   ;;
888   --disable-libiscsi) libiscsi="no"
889   ;;
890   --enable-libiscsi) libiscsi="yes"
891   ;;
892   --disable-libnfs) libnfs="no"
893   ;;
894   --enable-libnfs) libnfs="yes"
895   ;;
896   --enable-profiler) profiler="yes"
897   ;;
898   --disable-cocoa) cocoa="no"
899   ;;
900   --enable-cocoa)
901       cocoa="yes" ;
902       sdl="no" ;
903       audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
904   ;;
905   --disable-system) softmmu="no"
906   ;;
907   --enable-system) softmmu="yes"
908   ;;
909   --disable-user)
910       linux_user="no" ;
911       bsd_user="no" ;
912   ;;
913   --enable-user) ;;
914   --disable-linux-user) linux_user="no"
915   ;;
916   --enable-linux-user) linux_user="yes"
917   ;;
918   --disable-bsd-user) bsd_user="no"
919   ;;
920   --enable-bsd-user) bsd_user="yes"
921   ;;
922   --enable-guest-base) guest_base="yes"
923   ;;
924   --disable-guest-base) guest_base="no"
925   ;;
926   --enable-pie) pie="yes"
927   ;;
928   --disable-pie) pie="no"
929   ;;
930   --enable-uname-release=*) uname_release="$optarg"
931   ;;
932   --enable-werror) werror="yes"
933   ;;
934   --disable-werror) werror="no"
935   ;;
936   --disable-curses) curses="no"
937   ;;
938   --enable-curses) curses="yes"
939   ;;
940   --disable-curl) curl="no"
941   ;;
942   --enable-curl) curl="yes"
943   ;;
944   --disable-fdt) fdt="no"
945   ;;
946   --enable-fdt) fdt="yes"
947   ;;
948   --disable-linux-aio) linux_aio="no"
949   ;;
950   --enable-linux-aio) linux_aio="yes"
951   ;;
952   --disable-attr) attr="no"
953   ;;
954   --enable-attr) attr="yes"
955   ;;
956   --disable-blobs) blobs="no"
957   ;;
958   --with-pkgversion=*) pkgversion=" ($optarg)"
959   ;;
960   --with-coroutine=*) coroutine="$optarg"
961   ;;
962   --disable-coroutine-pool) coroutine_pool="no"
963   ;;
964   --enable-coroutine-pool) coroutine_pool="yes"
965   ;;
966   --disable-docs) docs="no"
967   ;;
968   --enable-docs) docs="yes"
969   ;;
970   --disable-vhost-net) vhost_net="no"
971   ;;
972   --enable-vhost-net) vhost_net="yes"
973   ;;
974   --disable-vhost-scsi) vhost_scsi="no"
975   ;;
976   --enable-vhost-scsi) vhost_scsi="yes"
977   ;;
978   --disable-glx) glx="no"
979   ;;
980   --enable-glx) glx="yes"
981   ;;
982   --disable-rbd) rbd="no"
983   ;;
984   --enable-rbd) rbd="yes"
985   ;;
986   --disable-xfsctl) xfs="no"
987   ;;
988   --enable-xfsctl) xfs="yes"
989   ;;
990   --disable-smartcard-nss) smartcard_nss="no"
991   ;;
992   --enable-smartcard-nss) smartcard_nss="yes"
993   ;;
994   --disable-libusb) libusb="no"
995   ;;
996   --enable-libusb) libusb="yes"
997   ;;
998   --disable-usb-redir) usb_redir="no"
999   ;;
1000   --enable-usb-redir) usb_redir="yes"
1001   ;;
1002   --disable-zlib-test) zlib="no"
1003   ;;
1004   --enable-lzo) lzo="yes"
1005   ;;
1006   --enable-snappy) snappy="yes"
1007   ;;
1008   --enable-guest-agent) guest_agent="yes"
1009   ;;
1010   --disable-guest-agent) guest_agent="no"
1011   ;;
1012   --with-vss-sdk) vss_win32_sdk=""
1013   ;;
1014   --with-vss-sdk=*) vss_win32_sdk="$optarg"
1015   ;;
1016   --without-vss-sdk) vss_win32_sdk="no"
1017   ;;
1018   --with-win-sdk) win_sdk=""
1019   ;;
1020   --with-win-sdk=*) win_sdk="$optarg"
1021   ;;
1022   --without-win-sdk) win_sdk="no"
1023   ;;
1024   --enable-tools) want_tools="yes"
1025   ;;
1026   --disable-tools) want_tools="no"
1027   ;;
1028   --enable-seccomp) seccomp="yes"
1029   ;;
1030   --disable-seccomp) seccomp="no"
1031   ;;
1032   --disable-glusterfs) glusterfs="no"
1033   ;;
1034   --enable-glusterfs) glusterfs="yes"
1035   ;;
1036   --disable-virtio-blk-data-plane) virtio_blk_data_plane="no"
1037   ;;
1038   --enable-virtio-blk-data-plane) virtio_blk_data_plane="yes"
1039   ;;
1040   --disable-gtk) gtk="no"
1041   ;;
1042   --enable-gtk) gtk="yes"
1043   ;;
1044   --enable-rdma) rdma="yes"
1045   ;;
1046   --disable-rdma) rdma="no"
1047   ;;
1048   --with-gtkabi=*) gtkabi="$optarg"
1049   ;;
1050   --enable-tpm) tpm="yes"
1051   ;;
1052   --disable-libssh2) libssh2="no"
1053   ;;
1054   --enable-libssh2) libssh2="yes"
1055   ;;
1056   --enable-vhdx) vhdx="yes"
1057   ;;
1058   --disable-vhdx) vhdx="no"
1059   ;;
1060   --disable-quorum) quorum="no"
1061   ;;
1062   --enable-quorum) quorum="yes"
1063   ;;
1064   *) echo "ERROR: unknown option $opt"; show_help="yes"
1065   ;;
1066   esac
1067 done
1068
1069 if ! has $python; then
1070   error_exit "Python not found. Use --python=/path/to/python"
1071 fi
1072
1073 # Note that if the Python conditional here evaluates True we will exit
1074 # with status 1 which is a shell 'false' value.
1075 if ! $python -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))'; then
1076   error_exit "Cannot use '$python', Python 2.4 or later is required." \
1077       "Note that Python 3 or later is not yet supported." \
1078       "Use --python=/path/to/python to specify a supported Python."
1079 fi
1080
1081 # The -B switch was added in Python 2.6.
1082 # If it is supplied, compiled files are not written.
1083 # Use it for Python versions which support it.
1084 if $python -B -c 'import sys; sys.exit(0)' 2>/dev/null; then
1085   python="$python -B"
1086 fi
1087
1088 case "$cpu" in
1089     ppc)
1090            CPU_CFLAGS="-m32"
1091            LDFLAGS="-m32 $LDFLAGS"
1092            ;;
1093     ppc64)
1094            CPU_CFLAGS="-m64"
1095            LDFLAGS="-m64 $LDFLAGS"
1096            ;;
1097     sparc)
1098            LDFLAGS="-m32 $LDFLAGS"
1099            CPU_CFLAGS="-m32 -mcpu=ultrasparc"
1100            ;;
1101     sparc64)
1102            LDFLAGS="-m64 $LDFLAGS"
1103            CPU_CFLAGS="-m64 -mcpu=ultrasparc"
1104            ;;
1105     s390)
1106            CPU_CFLAGS="-m31 -march=z990"
1107            LDFLAGS="-m31 $LDFLAGS"
1108            ;;
1109     s390x)
1110            CPU_CFLAGS="-m64 -march=z990"
1111            LDFLAGS="-m64 $LDFLAGS"
1112            ;;
1113     i386)
1114            CPU_CFLAGS="-m32"
1115            LDFLAGS="-m32 $LDFLAGS"
1116            cc_i386='$(CC) -m32'
1117            ;;
1118     x86_64)
1119            CPU_CFLAGS="-m64"
1120            LDFLAGS="-m64 $LDFLAGS"
1121            cc_i386='$(CC) -m32'
1122            ;;
1123     x32)
1124            CPU_CFLAGS="-mx32"
1125            LDFLAGS="-mx32 $LDFLAGS"
1126            cc_i386='$(CC) -m32'
1127            ;;
1128     # No special flags required for other host CPUs
1129 esac
1130
1131 QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
1132 EXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS"
1133
1134 default_target_list=""
1135
1136 mak_wilds=""
1137
1138 if [ "$softmmu" = "yes" ]; then
1139     mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak"
1140 fi
1141 if [ "$linux_user" = "yes" ]; then
1142     mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak"
1143 fi
1144 if [ "$bsd_user" = "yes" ]; then
1145     mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
1146 fi
1147
1148 for config in $mak_wilds; do
1149     default_target_list="${default_target_list} $(basename "$config" .mak)"
1150 done
1151
1152 if test x"$show_help" = x"yes" ; then
1153 cat << EOF
1154
1155 Usage: configure [options]
1156 Options: [defaults in brackets after descriptions]
1157
1158 Standard options:
1159   --help                   print this message
1160   --prefix=PREFIX          install in PREFIX [$prefix]
1161   --interp-prefix=PREFIX   where to find shared libraries, etc.
1162                            use %M for cpu name [$interp_prefix]
1163   --target-list=LIST       set target list (default: build everything)
1164 $(echo Available targets: $default_target_list | \
1165   fold -s -w 53 | sed -e 's/^/                           /')
1166
1167 Advanced options (experts only):
1168   --source-path=PATH       path of source code [$source_path]
1169   --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]
1170   --cc=CC                  use C compiler CC [$cc]
1171   --iasl=IASL              use ACPI compiler IASL [$iasl]
1172   --host-cc=CC             use C compiler CC [$host_cc] for code run at
1173                            build time
1174   --cxx=CXX                use C++ compiler CXX [$cxx]
1175   --objcc=OBJCC            use Objective-C compiler OBJCC [$objcc]
1176   --extra-cflags=CFLAGS    append extra C compiler flags QEMU_CFLAGS
1177   --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS
1178   --make=MAKE              use specified make [$make]
1179   --install=INSTALL        use specified install [$install]
1180   --python=PYTHON          use specified python [$python]
1181   --smbd=SMBD              use specified smbd [$smbd]
1182   --static                 enable static build [$static]
1183   --mandir=PATH            install man pages in PATH
1184   --datadir=PATH           install firmware in PATH$confsuffix
1185   --docdir=PATH            install documentation in PATH$confsuffix
1186   --bindir=PATH            install binaries in PATH
1187   --libdir=PATH            install libraries in PATH
1188   --sysconfdir=PATH        install config in PATH$confsuffix
1189   --localstatedir=PATH     install local state in PATH (set at runtime on win32)
1190   --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix]
1191   --enable-modules         enable modules support
1192   --enable-debug-tcg       enable TCG debugging
1193   --disable-debug-tcg      disable TCG debugging (default)
1194   --enable-debug-info       enable debugging information (default)
1195   --disable-debug-info      disable debugging information
1196   --enable-debug           enable common debug build options
1197   --enable-sparse          enable sparse checker
1198   --disable-sparse         disable sparse checker (default)
1199   --disable-strip          disable stripping binaries
1200   --disable-werror         disable compilation abort on warning
1201   --disable-sdl            disable SDL
1202   --enable-sdl             enable SDL
1203   --with-sdlabi            select preferred SDL ABI 1.2 or 2.0
1204   --disable-gtk            disable gtk UI
1205   --enable-gtk             enable gtk UI
1206   --disable-virtfs         disable VirtFS
1207   --enable-virtfs          enable VirtFS
1208   --disable-vnc            disable VNC
1209   --enable-vnc             enable VNC
1210   --disable-cocoa          disable Cocoa (Mac OS X only)
1211   --enable-cocoa           enable Cocoa (default on Mac OS X)
1212   --audio-drv-list=LIST    set audio drivers list:
1213                            Available drivers: $audio_possible_drivers
1214   --block-drv-whitelist=L  Same as --block-drv-rw-whitelist=L
1215   --block-drv-rw-whitelist=L
1216                            set block driver read-write whitelist
1217                            (affects only QEMU, not qemu-img)
1218   --block-drv-ro-whitelist=L
1219                            set block driver read-only whitelist
1220                            (affects only QEMU, not qemu-img)
1221   --disable-xen            disable xen backend driver support
1222   --enable-xen             enable xen backend driver support
1223   --disable-xen-pci-passthrough
1224   --enable-xen-pci-passthrough
1225   --disable-brlapi         disable BrlAPI
1226   --enable-brlapi          enable BrlAPI
1227   --disable-vnc-tls        disable TLS encryption for VNC server
1228   --enable-vnc-tls         enable TLS encryption for VNC server
1229   --disable-vnc-sasl       disable SASL encryption for VNC server
1230   --enable-vnc-sasl        enable SASL encryption for VNC server
1231   --disable-vnc-jpeg       disable JPEG lossy compression for VNC server
1232   --enable-vnc-jpeg        enable JPEG lossy compression for VNC server
1233   --disable-vnc-png        disable PNG compression for VNC server (default)
1234   --enable-vnc-png         enable PNG compression for VNC server
1235   --disable-vnc-ws         disable Websockets support for VNC server
1236   --enable-vnc-ws          enable Websockets support for VNC server
1237   --disable-curses         disable curses output
1238   --enable-curses          enable curses output
1239   --disable-curl           disable curl connectivity
1240   --enable-curl            enable curl connectivity
1241   --disable-fdt            disable fdt device tree
1242   --enable-fdt             enable fdt device tree
1243   --disable-bluez          disable bluez stack connectivity
1244   --enable-bluez           enable bluez stack connectivity
1245   --disable-slirp          disable SLIRP userspace network connectivity
1246   --disable-kvm            disable KVM acceleration support
1247   --enable-kvm             enable KVM acceleration support
1248   --disable-rdma           disable RDMA-based migration support
1249   --enable-rdma            enable RDMA-based migration support
1250   --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
1251   --enable-system          enable all system emulation targets
1252   --disable-system         disable all system emulation targets
1253   --enable-user            enable supported user emulation targets
1254   --disable-user           disable all user emulation targets
1255   --enable-linux-user      enable all linux usermode emulation targets
1256   --disable-linux-user     disable all linux usermode emulation targets
1257   --enable-bsd-user        enable all BSD usermode emulation targets
1258   --disable-bsd-user       disable all BSD usermode emulation targets
1259   --enable-guest-base      enable GUEST_BASE support for usermode
1260                            emulation targets
1261   --disable-guest-base     disable GUEST_BASE support
1262   --enable-pie             build Position Independent Executables
1263   --disable-pie            do not build Position Independent Executables
1264   --fmod-lib               path to FMOD library
1265   --fmod-inc               path to FMOD includes
1266   --oss-lib                path to OSS library
1267   --enable-uname-release=R Return R for uname -r in usermode emulation
1268   --cpu=CPU                Build for host CPU [$cpu]
1269   --disable-uuid           disable uuid support
1270   --enable-uuid            enable uuid support
1271   --disable-vde            disable support for vde network
1272   --enable-vde             enable support for vde network
1273   --disable-netmap         disable support for netmap network
1274   --enable-netmap          enable support for netmap network
1275   --disable-linux-aio      disable Linux AIO support
1276   --enable-linux-aio       enable Linux AIO support
1277   --disable-cap-ng         disable libcap-ng support
1278   --enable-cap-ng          enable libcap-ng support
1279   --disable-attr           disables attr and xattr support
1280   --enable-attr            enable attr and xattr support
1281   --disable-blobs          disable installing provided firmware blobs
1282   --enable-docs            enable documentation build
1283   --disable-docs           disable documentation build
1284   --disable-vhost-net      disable vhost-net acceleration support
1285   --enable-vhost-net       enable vhost-net acceleration support
1286   --enable-trace-backend=B Set trace backend
1287                            Available backends: $($python $source_path/scripts/tracetool.py --list-backends)
1288   --with-trace-file=NAME   Full PATH,NAME of file to store traces
1289                            Default:trace-<pid>
1290   --disable-spice          disable spice
1291   --enable-spice           enable spice
1292   --enable-rbd             enable building the rados block device (rbd)
1293   --disable-libiscsi       disable iscsi support
1294   --enable-libiscsi        enable iscsi support
1295   --disable-libnfs         disable nfs support
1296   --enable-libnfs          enable nfs support
1297   --disable-smartcard-nss  disable smartcard nss support
1298   --enable-smartcard-nss   enable smartcard nss support
1299   --disable-libusb         disable libusb (for usb passthrough)
1300   --enable-libusb          enable libusb (for usb passthrough)
1301   --disable-usb-redir      disable usb network redirection support
1302   --enable-usb-redir       enable usb network redirection support
1303   --enable-lzo             enable the support of lzo compression library
1304   --enable-snappy          enable the support of snappy compression library
1305   --disable-guest-agent    disable building of the QEMU Guest Agent
1306   --enable-guest-agent     enable building of the QEMU Guest Agent
1307   --with-vss-sdk=SDK-path  enable Windows VSS support in QEMU Guest Agent
1308   --with-win-sdk=SDK-path  path to Windows Platform SDK (to build VSS .tlb)
1309   --disable-seccomp        disable seccomp support
1310   --enable-seccomp         enables seccomp support
1311   --with-coroutine=BACKEND coroutine backend. Supported options:
1312                            gthread, ucontext, sigaltstack, windows
1313   --disable-coroutine-pool disable coroutine freelist (worse performance)
1314   --enable-coroutine-pool  enable coroutine freelist (better performance)
1315   --enable-glusterfs       enable GlusterFS backend
1316   --disable-glusterfs      disable GlusterFS backend
1317   --enable-gcov            enable test coverage analysis with gcov
1318   --gcov=GCOV              use specified gcov [$gcov_tool]
1319   --enable-tpm             enable TPM support
1320   --disable-libssh2        disable ssh block device support
1321   --enable-libssh2         enable ssh block device support
1322   --disable-vhdx           disables support for the Microsoft VHDX image format
1323   --enable-vhdx            enable support for the Microsoft VHDX image format
1324   --disable-quorum         disable quorum block filter support
1325   --enable-quorum          enable quorum block filter support
1326
1327 NOTE: The object files are built at the place where configure is launched
1328 EOF
1329 exit 1
1330 fi
1331
1332 # Now we have handled --enable-tcg-interpreter and know we're not just
1333 # printing the help message, bail out if the host CPU isn't supported.
1334 if test "$ARCH" = "unknown"; then
1335     if test "$tcg_interpreter" = "yes" ; then
1336         echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
1337         ARCH=tci
1338     else
1339         error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
1340     fi
1341 fi
1342
1343 # check that the C compiler works.
1344 cat > $TMPC <<EOF
1345 int main(void) { return 0; }
1346 EOF
1347
1348 if compile_object ; then
1349   : C compiler works ok
1350 else
1351     error_exit "\"$cc\" either does not exist or does not work"
1352 fi
1353
1354 # Check that the C++ compiler exists and works with the C compiler
1355 if has $cxx; then
1356     cat > $TMPC <<EOF
1357 int c_function(void);
1358 int main(void) { return c_function(); }
1359 EOF
1360
1361     compile_object
1362
1363     cat > $TMPC <<EOF
1364 extern "C" {
1365    int c_function(void);
1366 }
1367 int c_function(void) { return 42; }
1368 EOF
1369
1370     if (cc=$cxx do_cc $QEMU_CFLAGS -o $TMPE $TMPC $TMPO $LDFLAGS); then
1371         # C++ compiler $cxx works ok with C compiler $cc
1372         :
1373     else
1374         echo "C++ compiler $cxx does not work with C compiler $cc"
1375         echo "Disabling C++ specific optional code"
1376         cxx=
1377     fi
1378 else
1379     echo "No C++ compiler available; disabling C++ specific optional code"
1380     cxx=
1381 fi
1382
1383 # Consult white-list to determine whether to enable werror
1384 # by default.  Only enable by default for git builds
1385 z_version=`cut -f3 -d. $source_path/VERSION`
1386
1387 if test -z "$werror" ; then
1388     if test -d "$source_path/.git" -a \
1389         "$linux" = "yes" ; then
1390         werror="yes"
1391     else
1392         werror="no"
1393     fi
1394 fi
1395
1396 gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
1397 gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
1398 gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
1399 gcc_flags="-Wendif-labels $gcc_flags"
1400 gcc_flags="-Wno-initializer-overrides $gcc_flags"
1401 gcc_flags="-Wno-string-plus-int $gcc_flags"
1402 # Note that we do not add -Werror to gcc_flags here, because that would
1403 # enable it for all configure tests. If a configure test failed due
1404 # to -Werror this would just silently disable some features,
1405 # so it's too error prone.
1406 cat > $TMPC << EOF
1407 int main(void) { return 0; }
1408 EOF
1409 for flag in $gcc_flags; do
1410     # Use the positive sense of the flag when testing for -Wno-wombat
1411     # support (gcc will happily accept the -Wno- form of unknown
1412     # warning options).
1413     optflag="$(echo $flag | sed -e 's/^-Wno-/-W/')"
1414     if compile_prog "-Werror $optflag" "" ; then
1415         QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1416     fi
1417 done
1418
1419 if compile_prog "-Werror -fstack-protector-all" "" ; then
1420     QEMU_CFLAGS="$QEMU_CFLAGS -fstack-protector-all"
1421     LIBTOOLFLAGS="$LIBTOOLFLAGS -Wc,-fstack-protector-all"
1422 fi
1423
1424 # Workaround for http://gcc.gnu.org/PR55489.  Happens with -fPIE/-fPIC and
1425 # large functions that use global variables.  The bug is in all releases of
1426 # GCC, but it became particularly acute in 4.6.x and 4.7.x.  It is fixed in
1427 # 4.7.3 and 4.8.0.  We should be able to delete this at the end of 2013.
1428 cat > $TMPC << EOF
1429 #if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2))
1430 int main(void) { return 0; }
1431 #else
1432 #error No bug in this compiler.
1433 #endif
1434 EOF
1435 if compile_prog "-Werror -fno-gcse" "" ; then
1436   TRANSLATE_OPT_CFLAGS=-fno-gcse
1437 fi
1438
1439 if test "$static" = "yes" ; then
1440   if test "$modules" = "yes" ; then
1441     error_exit "static and modules are mutually incompatible"
1442   fi
1443   if test "$pie" = "yes" ; then
1444     error_exit "static and pie are mutually incompatible"
1445   else
1446     pie="no"
1447   fi
1448 fi
1449
1450 if test "$pie" = ""; then
1451   case "$cpu-$targetos" in
1452     i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD)
1453       ;;
1454     *)
1455       pie="no"
1456       ;;
1457   esac
1458 fi
1459
1460 if test "$pie" != "no" ; then
1461   cat > $TMPC << EOF
1462
1463 #ifdef __linux__
1464 #  define THREAD __thread
1465 #else
1466 #  define THREAD
1467 #endif
1468
1469 static THREAD int tls_var;
1470
1471 int main(void) { return tls_var; }
1472
1473 EOF
1474   if compile_prog "-fPIE -DPIE" "-pie"; then
1475     QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
1476     LDFLAGS="-pie $LDFLAGS"
1477     pie="yes"
1478     if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
1479       LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
1480     fi
1481   else
1482     if test "$pie" = "yes"; then
1483       error_exit "PIE not available due to missing toolchain support"
1484     else
1485       echo "Disabling PIE due to missing toolchain support"
1486       pie="no"
1487     fi
1488   fi
1489
1490   if compile_prog "-fno-pie" "-nopie"; then
1491     CFLAGS_NOPIE="-fno-pie"
1492     LDFLAGS_NOPIE="-nopie"
1493   fi
1494 fi
1495
1496 # check for broken gcc and libtool in RHEL5
1497 if test -n "$libtool" -a "$pie" != "no" ; then
1498   cat > $TMPC <<EOF
1499
1500 void *f(unsigned char *buf, int len);
1501 void *g(unsigned char *buf, int len);
1502
1503 void *
1504 f(unsigned char *buf, int len)
1505 {
1506     return (void*)0L;
1507 }
1508
1509 void *
1510 g(unsigned char *buf, int len)
1511 {
1512     return f(buf, len);
1513 }
1514
1515 EOF
1516   if ! libtool_prog; then
1517     echo "Disabling libtool due to broken toolchain support"
1518     libtool=
1519   fi
1520 fi
1521
1522 ##########################################
1523 # __sync_fetch_and_and requires at least -march=i486. Many toolchains
1524 # use i686 as default anyway, but for those that don't, an explicit
1525 # specification is necessary
1526
1527 if test "$cpu" = "i386"; then
1528   cat > $TMPC << EOF
1529 static int sfaa(int *ptr)
1530 {
1531   return __sync_fetch_and_and(ptr, 0);
1532 }
1533
1534 int main(void)
1535 {
1536   int val = 42;
1537   val = __sync_val_compare_and_swap(&val, 0, 1);
1538   sfaa(&val);
1539   return val;
1540 }
1541 EOF
1542   if ! compile_prog "" "" ; then
1543     QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS"
1544   fi
1545 fi
1546
1547 #########################################
1548 # Solaris specific configure tool chain decisions
1549
1550 if test "$solaris" = "yes" ; then
1551   if has $install; then
1552     :
1553   else
1554     error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \
1555         "install fileutils from www.blastwave.org using pkg-get -i fileutils" \
1556         "to get ginstall which is used by default (which lives in /opt/csw/bin)"
1557   fi
1558   if test "`path_of $install`" = "/usr/sbin/install" ; then
1559     error_exit "Solaris /usr/sbin/install is not an appropriate install program." \
1560         "try ginstall from the GNU fileutils available from www.blastwave.org" \
1561         "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
1562   fi
1563   if has ar; then
1564     :
1565   else
1566     if test -f /usr/ccs/bin/ar ; then
1567       error_exit "No path includes ar" \
1568           "Add /usr/ccs/bin to your path and rerun configure"
1569     fi
1570     error_exit "No path includes ar"
1571   fi
1572 fi
1573
1574 if test -z "${target_list+xxx}" ; then
1575     target_list="$default_target_list"
1576 else
1577     target_list=`echo "$target_list" | sed -e 's/,/ /g'`
1578 fi
1579
1580 # Check that we recognised the target name; this allows a more
1581 # friendly error message than if we let it fall through.
1582 for target in $target_list; do
1583     case " $default_target_list " in
1584         *" $target "*)
1585             ;;
1586         *)
1587             error_exit "Unknown target name '$target'"
1588             ;;
1589     esac
1590 done
1591
1592 # see if system emulation was really requested
1593 case " $target_list " in
1594   *"-softmmu "*) softmmu=yes
1595   ;;
1596   *) softmmu=no
1597   ;;
1598 esac
1599
1600 feature_not_found() {
1601   feature=$1
1602   remedy=$2
1603
1604   error_exit "User requested feature $feature" \
1605       "configure was not able to find it." \
1606       "$remedy"
1607 }
1608
1609 # ---
1610 # big/little endian test
1611 cat > $TMPC << EOF
1612 short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
1613 short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
1614 extern int foo(short *, short *);
1615 int main(int argc, char *argv[]) {
1616     return foo(big_endian, little_endian);
1617 }
1618 EOF
1619
1620 if compile_object ; then
1621     if grep -q BiGeNdIaN $TMPO ; then
1622         bigendian="yes"
1623     elif grep -q LiTtLeEnDiAn $TMPO ; then
1624         bigendian="no"
1625     else
1626         echo big/little test failed
1627     fi
1628 else
1629     echo big/little test failed
1630 fi
1631
1632 ##########################################
1633 # pkg-config probe
1634
1635 if ! has "$pkg_config_exe"; then
1636   error_exit "pkg-config binary '$pkg_config_exe' not found"
1637 fi
1638
1639 ##########################################
1640 # NPTL probe
1641
1642 if test "$linux_user" = "yes"; then
1643   cat > $TMPC <<EOF
1644 #include <sched.h>
1645 #include <linux/futex.h>
1646 int main(void) {
1647 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1648 #error bork
1649 #endif
1650   return 0;
1651 }
1652 EOF
1653   if ! compile_object ; then
1654     feature_not_found "nptl" "Install glibc and linux kernel headers."
1655   fi
1656 fi
1657
1658 ##########################################
1659 # zlib check
1660
1661 if test "$zlib" != "no" ; then
1662     cat > $TMPC << EOF
1663 #include <zlib.h>
1664 int main(void) { zlibVersion(); return 0; }
1665 EOF
1666     if compile_prog "" "-lz" ; then
1667         :
1668     else
1669         error_exit "zlib check failed" \
1670             "Make sure to have the zlib libs and headers installed."
1671     fi
1672 fi
1673 LIBS="$LIBS -lz"
1674
1675 ##########################################
1676 # lzo check
1677
1678 if test "$lzo" != "no" ; then
1679     cat > $TMPC << EOF
1680 #include <lzo/lzo1x.h>
1681 int main(void) { lzo_version(); return 0; }
1682 EOF
1683     if compile_prog "" "-llzo2" ; then
1684         :
1685     else
1686         error_exit "lzo check failed" \
1687             "Make sure to have the lzo libs and headers installed."
1688     fi
1689
1690     libs_softmmu="$libs_softmmu -llzo2"
1691 fi
1692
1693 ##########################################
1694 # snappy check
1695
1696 if test "$snappy" != "no" ; then
1697     cat > $TMPC << EOF
1698 #include <snappy-c.h>
1699 int main(void) { snappy_max_compressed_length(4096); return 0; }
1700 EOF
1701     if compile_prog "" "-lsnappy" ; then
1702         :
1703     else
1704         error_exit "snappy check failed" \
1705             "Make sure to have the snappy libs and headers installed."
1706     fi
1707
1708     libs_softmmu="$libs_softmmu -lsnappy"
1709 fi
1710
1711 ##########################################
1712 # libseccomp check
1713
1714 if test "$seccomp" != "no" ; then
1715     if $pkg_config --atleast-version=2.1.0 libseccomp; then
1716         libs_softmmu="$libs_softmmu `$pkg_config --libs libseccomp`"
1717         QEMU_CFLAGS="$QEMU_CFLAGS `$pkg_config --cflags libseccomp`"
1718         seccomp="yes"
1719     else
1720         if test "$seccomp" = "yes"; then
1721             feature_not_found "libseccomp" "Install libseccomp devel >= 2.1.0"
1722         fi
1723         seccomp="no"
1724     fi
1725 fi
1726 ##########################################
1727 # xen probe
1728
1729 if test "$xen" != "no" ; then
1730   xen_libs="-lxenstore -lxenctrl -lxenguest"
1731
1732   # First we test whether Xen headers and libraries are available.
1733   # If no, we are done and there is no Xen support.
1734   # If yes, more tests are run to detect the Xen version.
1735
1736   # Xen (any)
1737   cat > $TMPC <<EOF
1738 #include <xenctrl.h>
1739 int main(void) {
1740   return 0;
1741 }
1742 EOF
1743   if ! compile_prog "" "$xen_libs" ; then
1744     # Xen not found
1745     if test "$xen" = "yes" ; then
1746       feature_not_found "xen" "Install xen devel"
1747     fi
1748     xen=no
1749
1750   # Xen unstable
1751   elif
1752       cat > $TMPC <<EOF &&
1753 #include <xenctrl.h>
1754 #include <xenstore.h>
1755 #include <stdint.h>
1756 #include <xen/hvm/hvm_info_table.h>
1757 #if !defined(HVM_MAX_VCPUS)
1758 # error HVM_MAX_VCPUS not defined
1759 #endif
1760 int main(void) {
1761   xc_interface *xc;
1762   xs_daemon_open();
1763   xc = xc_interface_open(0, 0, 0);
1764   xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1765   xc_gnttab_open(NULL, 0);
1766   xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1767   xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
1768   return 0;
1769 }
1770 EOF
1771       compile_prog "" "$xen_libs"
1772     then
1773     xen_ctrl_version=420
1774     xen=yes
1775
1776   elif
1777       cat > $TMPC <<EOF &&
1778 #include <xenctrl.h>
1779 #include <xs.h>
1780 #include <stdint.h>
1781 #include <xen/hvm/hvm_info_table.h>
1782 #if !defined(HVM_MAX_VCPUS)
1783 # error HVM_MAX_VCPUS not defined
1784 #endif
1785 int main(void) {
1786   xs_daemon_open();
1787   xc_interface_open(0, 0, 0);
1788   xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1789   xc_gnttab_open(NULL, 0);
1790   xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1791   return 0;
1792 }
1793 EOF
1794       compile_prog "" "$xen_libs"
1795     then
1796     xen_ctrl_version=410
1797     xen=yes
1798
1799   # Xen 4.0.0
1800   elif
1801       cat > $TMPC <<EOF &&
1802 #include <xenctrl.h>
1803 #include <xs.h>
1804 #include <stdint.h>
1805 #include <xen/hvm/hvm_info_table.h>
1806 #if !defined(HVM_MAX_VCPUS)
1807 # error HVM_MAX_VCPUS not defined
1808 #endif
1809 int main(void) {
1810   struct xen_add_to_physmap xatp = {
1811     .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1812   };
1813   xs_daemon_open();
1814   xc_interface_open();
1815   xc_gnttab_open();
1816   xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1817   xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1818   return 0;
1819 }
1820 EOF
1821       compile_prog "" "$xen_libs"
1822     then
1823     xen_ctrl_version=400
1824     xen=yes
1825
1826   # Xen 3.4.0
1827   elif
1828       cat > $TMPC <<EOF &&
1829 #include <xenctrl.h>
1830 #include <xs.h>
1831 int main(void) {
1832   struct xen_add_to_physmap xatp = {
1833     .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1834   };
1835   xs_daemon_open();
1836   xc_interface_open();
1837   xc_gnttab_open();
1838   xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1839   xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1840   return 0;
1841 }
1842 EOF
1843       compile_prog "" "$xen_libs"
1844     then
1845     xen_ctrl_version=340
1846     xen=yes
1847
1848   # Xen 3.3.0
1849   elif
1850       cat > $TMPC <<EOF &&
1851 #include <xenctrl.h>
1852 #include <xs.h>
1853 int main(void) {
1854   xs_daemon_open();
1855   xc_interface_open();
1856   xc_gnttab_open();
1857   xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1858   return 0;
1859 }
1860 EOF
1861       compile_prog "" "$xen_libs"
1862     then
1863     xen_ctrl_version=330
1864     xen=yes
1865
1866   # Xen version unsupported
1867   else
1868     if test "$xen" = "yes" ; then
1869       feature_not_found "xen (unsupported version)" "Install supported xen (e.g. 4.0, 3.4, 3.3)"
1870     fi
1871     xen=no
1872   fi
1873
1874   if test "$xen" = yes; then
1875     libs_softmmu="$xen_libs $libs_softmmu"
1876   fi
1877 fi
1878
1879 if test "$xen_pci_passthrough" != "no"; then
1880   if test "$xen" = "yes" && test "$linux" = "yes" &&
1881     test "$xen_ctrl_version" -ge 340; then
1882     xen_pci_passthrough=yes
1883   else
1884     if test "$xen_pci_passthrough" = "yes"; then
1885       if test "$xen_ctrl_version" -lt 340; then
1886         error_exit "User requested feature Xen PCI Passthrough" \
1887             "This feature does not work with Xen 3.3"
1888       fi
1889       error_exit "User requested feature Xen PCI Passthrough" \
1890           " but this feature requires /sys from Linux"
1891     fi
1892     xen_pci_passthrough=no
1893   fi
1894 fi
1895
1896 ##########################################
1897 # libtool probe
1898
1899 if ! has $libtool; then
1900     libtool=
1901 fi
1902
1903 # MacOSX ships with a libtool which isn't the GNU one; weed this
1904 # out by checking whether libtool supports the --version switch
1905 if test -n "$libtool"; then
1906   if ! "$libtool" --version >/dev/null 2>&1; then
1907     libtool=
1908   fi
1909 fi
1910
1911 ##########################################
1912 # Sparse probe
1913 if test "$sparse" != "no" ; then
1914   if has cgcc; then
1915     sparse=yes
1916   else
1917     if test "$sparse" = "yes" ; then
1918       feature_not_found "sparse" "Install sparse binary"
1919     fi
1920     sparse=no
1921   fi
1922 fi
1923
1924 ##########################################
1925 # GTK probe
1926
1927 if test "$gtk" != "no"; then
1928     gtkpackage="gtk+-$gtkabi"
1929     if test "$gtkabi" = "3.0" ; then
1930       gtkversion="3.0.0"
1931       vtepackage="vte-2.90"
1932       vteversion="0.32.0"
1933     else
1934       gtkversion="2.18.0"
1935       vtepackage="vte"
1936       vteversion="0.24.0"
1937     fi
1938     if ! $pkg_config --exists "$gtkpackage >= $gtkversion"; then
1939         if test "$gtk" = "yes" ; then
1940             feature_not_found "gtk" "Install gtk2 or gtk3 (requires --with-gtkabi=3.0 option to configure) devel"
1941         fi
1942         gtk="no"
1943     elif ! $pkg_config --exists "$vtepackage >= $vteversion"; then
1944         if test "$gtk" = "yes" ; then
1945             error_exit "libvte not found (required for gtk support)"
1946         fi
1947         gtk="no"
1948     else
1949         gtk_cflags=`$pkg_config --cflags $gtkpackage`
1950         gtk_libs=`$pkg_config --libs $gtkpackage`
1951         vte_cflags=`$pkg_config --cflags $vtepackage`
1952         vte_libs=`$pkg_config --libs $vtepackage`
1953         libs_softmmu="$gtk_libs $vte_libs $libs_softmmu"
1954         gtk="yes"
1955     fi
1956 fi
1957
1958 ##########################################
1959 # SDL probe
1960
1961 # Look for sdl configuration program (pkg-config or sdl-config).  Try
1962 # sdl-config even without cross prefix, and favour pkg-config over sdl-config.
1963
1964 if test $sdlabi = "2.0"; then
1965     sdl_config=$sdl2_config
1966     sdlname=sdl2
1967     sdlconfigname=sdl2_config
1968 else
1969     sdlname=sdl
1970     sdlconfigname=sdl_config
1971 fi
1972
1973 if test "`basename $sdl_config`" != $sdlconfigname && ! has ${sdl_config}; then
1974   sdl_config=$sdlconfigname
1975 fi
1976
1977 if $pkg_config $sdlname --exists; then
1978   sdlconfig="$pkg_config $sdlname"
1979   _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
1980 elif has ${sdl_config}; then
1981   sdlconfig="$sdl_config"
1982   _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1983 else
1984   if test "$sdl" = "yes" ; then
1985     feature_not_found "sdl" "Install SDL devel"
1986   fi
1987   sdl=no
1988 fi
1989 if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
1990   echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
1991 fi
1992
1993 sdl_too_old=no
1994 if test "$sdl" != "no" ; then
1995   cat > $TMPC << EOF
1996 #include <SDL.h>
1997 #undef main /* We don't want SDL to override our main() */
1998 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1999 EOF
2000   sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
2001   if test "$static" = "yes" ; then
2002     sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
2003   else
2004     sdl_libs=`$sdlconfig --libs 2> /dev/null`
2005   fi
2006   if compile_prog "$sdl_cflags" "$sdl_libs" ; then
2007     if test "$_sdlversion" -lt 121 ; then
2008       sdl_too_old=yes
2009     else
2010       if test "$cocoa" = "no" ; then
2011         sdl=yes
2012       fi
2013     fi
2014
2015     # static link with sdl ? (note: sdl.pc's --static --libs is broken)
2016     if test "$sdl" = "yes" -a "$static" = "yes" ; then
2017       if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
2018          sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
2019          sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
2020       fi
2021       if compile_prog "$sdl_cflags" "$sdl_libs" ; then
2022         :
2023       else
2024         sdl=no
2025       fi
2026     fi # static link
2027   else # sdl not found
2028     if test "$sdl" = "yes" ; then
2029       feature_not_found "sdl" "Install SDL devel"
2030     fi
2031     sdl=no
2032   fi # sdl compile test
2033 fi
2034
2035 if test "$sdl" = "yes" ; then
2036   cat > $TMPC <<EOF
2037 #include <SDL.h>
2038 #if defined(SDL_VIDEO_DRIVER_X11)
2039 #include <X11/XKBlib.h>
2040 #else
2041 #error No x11 support
2042 #endif
2043 int main(void) { return 0; }
2044 EOF
2045   if compile_prog "$sdl_cflags" "$sdl_libs" ; then
2046     sdl_libs="$sdl_libs -lX11"
2047   fi
2048   libs_softmmu="$sdl_libs $libs_softmmu"
2049 fi
2050
2051 ##########################################
2052 # RDMA needs OpenFabrics libraries
2053 if test "$rdma" != "no" ; then
2054   cat > $TMPC <<EOF
2055 #include <rdma/rdma_cma.h>
2056 int main(void) { return 0; }
2057 EOF
2058   rdma_libs="-lrdmacm -libverbs"
2059   if compile_prog "" "$rdma_libs" ; then
2060     rdma="yes"
2061     libs_softmmu="$libs_softmmu $rdma_libs"
2062   else
2063     if test "$rdma" = "yes" ; then
2064         error_exit \
2065             " OpenFabrics librdmacm/libibverbs not present." \
2066             " Your options:" \
2067             "  (1) Fast: Install infiniband packages from your distro." \
2068             "  (2) Cleanest: Install libraries from www.openfabrics.org" \
2069             "  (3) Also: Install softiwarp if you don't have RDMA hardware"
2070     fi
2071     rdma="no"
2072   fi
2073 fi
2074
2075 ##########################################
2076 # VNC TLS/WS detection
2077 if test "$vnc" = "yes" -a \( "$vnc_tls" != "no" -o "$vnc_ws" != "no" \) ; then
2078   cat > $TMPC <<EOF
2079 #include <gnutls/gnutls.h>
2080 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
2081 EOF
2082   vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
2083   vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
2084   if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
2085     if test "$vnc_tls" != "no" ; then
2086       vnc_tls=yes
2087     fi
2088     if test "$vnc_ws" != "no" ; then
2089       vnc_ws=yes
2090     fi
2091     libs_softmmu="$vnc_tls_libs $libs_softmmu"
2092     QEMU_CFLAGS="$QEMU_CFLAGS $vnc_tls_cflags"
2093   else
2094     if test "$vnc_tls" = "yes" ; then
2095       feature_not_found "vnc-tls" "Install gnutls devel"
2096     fi
2097     if test "$vnc_ws" = "yes" ; then
2098       feature_not_found "vnc-ws" "Install gnutls devel"
2099     fi
2100     vnc_tls=no
2101     vnc_ws=no
2102   fi
2103 fi
2104
2105 ##########################################
2106 # Quorum probe (check for gnutls)
2107 if test "$quorum" != "no" ; then
2108 cat > $TMPC <<EOF
2109 #include <gnutls/gnutls.h>
2110 #include <gnutls/crypto.h>
2111 int main(void) {char data[4096], digest[32];
2112 gnutls_hash_fast(GNUTLS_DIG_SHA256, data, 4096, digest);
2113 return 0;
2114 }
2115 EOF
2116 quorum_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
2117 quorum_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
2118 if compile_prog "$quorum_tls_cflags" "$quorum_tls_libs" ; then
2119   qcow_tls=yes
2120   libs_softmmu="$quorum_tls_libs $libs_softmmu"
2121   libs_tools="$quorum_tls_libs $libs_softmmu"
2122   QEMU_CFLAGS="$QEMU_CFLAGS $quorum_tls_cflags"
2123 else
2124   echo "gnutls > 2.10.0 required to compile Quorum"
2125   exit 1
2126 fi
2127 fi
2128
2129 ##########################################
2130 # VNC SASL detection
2131 if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
2132   cat > $TMPC <<EOF
2133 #include <sasl/sasl.h>
2134 #include <stdio.h>
2135 int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
2136 EOF
2137   # Assuming Cyrus-SASL installed in /usr prefix
2138   vnc_sasl_cflags=""
2139   vnc_sasl_libs="-lsasl2"
2140   if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
2141     vnc_sasl=yes
2142     libs_softmmu="$vnc_sasl_libs $libs_softmmu"
2143     QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
2144   else
2145     if test "$vnc_sasl" = "yes" ; then
2146       feature_not_found "vnc-sasl" "Install Cyrus SASL devel"
2147     fi
2148     vnc_sasl=no
2149   fi
2150 fi
2151
2152 ##########################################
2153 # VNC JPEG detection
2154 if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
2155 cat > $TMPC <<EOF
2156 #include <stdio.h>
2157 #include <jpeglib.h>
2158 int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
2159 EOF
2160     vnc_jpeg_cflags=""
2161     vnc_jpeg_libs="-ljpeg"
2162   if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
2163     vnc_jpeg=yes
2164     libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
2165     QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
2166   else
2167     if test "$vnc_jpeg" = "yes" ; then
2168       feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel"
2169     fi
2170     vnc_jpeg=no
2171   fi
2172 fi
2173
2174 ##########################################
2175 # VNC PNG detection
2176 if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
2177 cat > $TMPC <<EOF
2178 //#include <stdio.h>
2179 #include <png.h>
2180 #include <stddef.h>
2181 int main(void) {
2182     png_structp png_ptr;
2183     png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
2184     return png_ptr != 0;
2185 }
2186 EOF
2187   if $pkg_config libpng --exists; then
2188     vnc_png_cflags=`$pkg_config libpng --cflags`
2189     vnc_png_libs=`$pkg_config libpng --libs`
2190   else
2191     vnc_png_cflags=""
2192     vnc_png_libs="-lpng"
2193   fi
2194   if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
2195     vnc_png=yes
2196     libs_softmmu="$vnc_png_libs $libs_softmmu"
2197     QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
2198   else
2199     if test "$vnc_png" = "yes" ; then
2200       feature_not_found "vnc-png" "Install libpng devel"
2201     fi
2202     vnc_png=no
2203   fi
2204 fi
2205
2206 ##########################################
2207 # fnmatch() probe, used for ACL routines
2208 fnmatch="no"
2209 cat > $TMPC << EOF
2210 #include <fnmatch.h>
2211 int main(void)
2212 {
2213     fnmatch("foo", "foo", 0);
2214     return 0;
2215 }
2216 EOF
2217 if compile_prog "" "" ; then
2218    fnmatch="yes"
2219 fi
2220
2221 ##########################################
2222 # uuid_generate() probe, used for vdi block driver
2223 # Note that on some systems (notably MacOSX) no extra library
2224 # need be linked to get the uuid functions.
2225 if test "$uuid" != "no" ; then
2226   uuid_libs="-luuid"
2227   cat > $TMPC << EOF
2228 #include <uuid/uuid.h>
2229 int main(void)
2230 {
2231     uuid_t my_uuid;
2232     uuid_generate(my_uuid);
2233     return 0;
2234 }
2235 EOF
2236   if compile_prog "" "" ; then
2237     uuid="yes"
2238   elif compile_prog "" "$uuid_libs" ; then
2239     uuid="yes"
2240     libs_softmmu="$uuid_libs $libs_softmmu"
2241     libs_tools="$uuid_libs $libs_tools"
2242   else
2243     if test "$uuid" = "yes" ; then
2244       feature_not_found "uuid" "Install libuuid devel"
2245     fi
2246     uuid=no
2247   fi
2248 fi
2249
2250 if test "$vhdx" = "yes" ; then
2251     if test "$uuid" = "no" ; then
2252         error_exit "uuid required for VHDX support"
2253     fi
2254 elif test "$vhdx" != "no" ; then
2255     if test "$uuid" = "yes" ; then
2256         vhdx=yes
2257     else
2258         vhdx=no
2259     fi
2260 fi
2261
2262 ##########################################
2263 # xfsctl() probe, used for raw-posix
2264 if test "$xfs" != "no" ; then
2265   cat > $TMPC << EOF
2266 #include <stddef.h>  /* NULL */
2267 #include <xfs/xfs.h>
2268 int main(void)
2269 {
2270     xfsctl(NULL, 0, 0, NULL);
2271     return 0;
2272 }
2273 EOF
2274   if compile_prog "" "" ; then
2275     xfs="yes"
2276   else
2277     if test "$xfs" = "yes" ; then
2278       feature_not_found "xfs" "Instal xfsprogs/xfslibs devel"
2279     fi
2280     xfs=no
2281   fi
2282 fi
2283
2284 ##########################################
2285 # vde libraries probe
2286 if test "$vde" != "no" ; then
2287   vde_libs="-lvdeplug"
2288   cat > $TMPC << EOF
2289 #include <libvdeplug.h>
2290 int main(void)
2291 {
2292     struct vde_open_args a = {0, 0, 0};
2293     char s[] = "";
2294     vde_open(s, s, &a);
2295     return 0;
2296 }
2297 EOF
2298   if compile_prog "" "$vde_libs" ; then
2299     vde=yes
2300     libs_softmmu="$vde_libs $libs_softmmu"
2301     libs_tools="$vde_libs $libs_tools"
2302   else
2303     if test "$vde" = "yes" ; then
2304       feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel"
2305     fi
2306     vde=no
2307   fi
2308 fi
2309
2310 ##########################################
2311 # netmap support probe
2312 # Apart from looking for netmap headers, we make sure that the host API version
2313 # supports the netmap backend (>=11). The upper bound (15) is meant to simulate
2314 # a minor/major version number. Minor new features will be marked with values up
2315 # to 15, and if something happens that requires a change to the backend we will
2316 # move above 15, submit the backend fixes and modify this two bounds.
2317 if test "$netmap" != "no" ; then
2318   cat > $TMPC << EOF
2319 #include <inttypes.h>
2320 #include <net/if.h>
2321 #include <net/netmap.h>
2322 #include <net/netmap_user.h>
2323 #if (NETMAP_API < 11) || (NETMAP_API > 15)
2324 #error
2325 #endif
2326 int main(void) { return 0; }
2327 EOF
2328   if compile_prog "" "" ; then
2329     netmap=yes
2330   else
2331     if test "$netmap" = "yes" ; then
2332       feature_not_found "netmap"
2333     fi
2334     netmap=no
2335   fi
2336 fi
2337
2338 ##########################################
2339 # libcap-ng library probe
2340 if test "$cap_ng" != "no" ; then
2341   cap_libs="-lcap-ng"
2342   cat > $TMPC << EOF
2343 #include <cap-ng.h>
2344 int main(void)
2345 {
2346     capng_capability_to_name(CAPNG_EFFECTIVE);
2347     return 0;
2348 }
2349 EOF
2350   if compile_prog "" "$cap_libs" ; then
2351     cap_ng=yes
2352     libs_tools="$cap_libs $libs_tools"
2353   else
2354     if test "$cap_ng" = "yes" ; then
2355       feature_not_found "cap_ng" "Install libcap-ng devel"
2356     fi
2357     cap_ng=no
2358   fi
2359 fi
2360
2361 ##########################################
2362 # Sound support libraries probe
2363
2364 audio_drv_probe()
2365 {
2366     drv=$1
2367     hdr=$2
2368     lib=$3
2369     exp=$4
2370     cfl=$5
2371         cat > $TMPC << EOF
2372 #include <$hdr>
2373 int main(void) { $exp }
2374 EOF
2375     if compile_prog "$cfl" "$lib" ; then
2376         :
2377     else
2378         error_exit "$drv check failed" \
2379             "Make sure to have the $drv libs and headers installed."
2380     fi
2381 }
2382
2383 audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
2384 for drv in $audio_drv_list; do
2385     case $drv in
2386     alsa)
2387     audio_drv_probe $drv alsa/asoundlib.h -lasound \
2388         "return snd_pcm_close((snd_pcm_t *)0);"
2389     libs_softmmu="-lasound $libs_softmmu"
2390     ;;
2391
2392     fmod)
2393     if test -z $fmod_lib || test -z $fmod_inc; then
2394         error_exit "You must specify path to FMOD library and headers" \
2395             "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
2396     fi
2397     audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
2398     libs_softmmu="$fmod_lib $libs_softmmu"
2399     ;;
2400
2401     esd)
2402     audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
2403     libs_softmmu="-lesd $libs_softmmu"
2404     audio_pt_int="yes"
2405     ;;
2406
2407     pa)
2408     audio_drv_probe $drv pulse/mainloop.h "-lpulse" \
2409         "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;"
2410     libs_softmmu="-lpulse $libs_softmmu"
2411     audio_pt_int="yes"
2412     ;;
2413
2414     coreaudio)
2415       libs_softmmu="-framework CoreAudio $libs_softmmu"
2416     ;;
2417
2418     dsound)
2419       libs_softmmu="-lole32 -ldxguid $libs_softmmu"
2420       audio_win_int="yes"
2421     ;;
2422
2423     oss)
2424       libs_softmmu="$oss_lib $libs_softmmu"
2425     ;;
2426
2427     sdl|wav)
2428     # XXX: Probes for CoreAudio, DirectSound, SDL(?)
2429     ;;
2430
2431     winwave)
2432       libs_softmmu="-lwinmm $libs_softmmu"
2433       audio_win_int="yes"
2434     ;;
2435
2436     *)
2437     echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
2438         error_exit "Unknown driver '$drv' selected" \
2439             "Possible drivers are: $audio_possible_drivers"
2440     }
2441     ;;
2442     esac
2443 done
2444
2445 ##########################################
2446 # BrlAPI probe
2447
2448 if test "$brlapi" != "no" ; then
2449   brlapi_libs="-lbrlapi"
2450   cat > $TMPC << EOF
2451 #include <brlapi.h>
2452 #include <stddef.h>
2453 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
2454 EOF
2455   if compile_prog "" "$brlapi_libs" ; then
2456     brlapi=yes
2457     libs_softmmu="$brlapi_libs $libs_softmmu"
2458   else
2459     if test "$brlapi" = "yes" ; then
2460       feature_not_found "brlapi" "Install brlapi devel"
2461     fi
2462     brlapi=no
2463   fi
2464 fi
2465
2466 ##########################################
2467 # curses probe
2468 if test "$curses" != "no" ; then
2469   if test "$mingw32" = "yes" ; then
2470     curses_list="-lpdcurses"
2471   else
2472     curses_list="$($pkg_config --libs ncurses 2>/dev/null):-lncurses:-lcurses"
2473   fi
2474   curses_found=no
2475   cat > $TMPC << EOF
2476 #include <curses.h>
2477 int main(void) {
2478   const char *s = curses_version();
2479   resize_term(0, 0);
2480   return s != 0;
2481 }
2482 EOF
2483   IFS=:
2484   for curses_lib in $curses_list; do
2485     unset IFS
2486     if compile_prog "" "$curses_lib" ; then
2487       curses_found=yes
2488       libs_softmmu="$curses_lib $libs_softmmu"
2489       break
2490     fi
2491   done
2492   unset IFS
2493   if test "$curses_found" = "yes" ; then
2494     curses=yes
2495   else
2496     if test "$curses" = "yes" ; then
2497       feature_not_found "curses" "Install ncurses devel"
2498     fi
2499     curses=no
2500   fi
2501 fi
2502
2503 ##########################################
2504 # curl probe
2505 if test "$curl" != "no" ; then
2506   if $pkg_config libcurl --exists; then
2507     curlconfig="$pkg_config libcurl"
2508   else
2509     curlconfig=curl-config
2510   fi
2511   cat > $TMPC << EOF
2512 #include <curl/curl.h>
2513 int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
2514 EOF
2515   curl_cflags=`$curlconfig --cflags 2>/dev/null`
2516   curl_libs=`$curlconfig --libs 2>/dev/null`
2517   if compile_prog "$curl_cflags" "$curl_libs" ; then
2518     curl=yes
2519   else
2520     if test "$curl" = "yes" ; then
2521       feature_not_found "curl" "Install libcurl devel"
2522     fi
2523     curl=no
2524   fi
2525 fi # test "$curl"
2526
2527 ##########################################
2528 # bluez support probe
2529 if test "$bluez" != "no" ; then
2530   cat > $TMPC << EOF
2531 #include <bluetooth/bluetooth.h>
2532 int main(void) { return bt_error(0); }
2533 EOF
2534   bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
2535   bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
2536   if compile_prog "$bluez_cflags" "$bluez_libs" ; then
2537     bluez=yes
2538     libs_softmmu="$bluez_libs $libs_softmmu"
2539   else
2540     if test "$bluez" = "yes" ; then
2541       feature_not_found "bluez" "Install bluez-libs/libbluetooth devel"
2542     fi
2543     bluez="no"
2544   fi
2545 fi
2546
2547 ##########################################
2548 # glib support probe
2549
2550 if test "$mingw32" = yes; then
2551     # g_poll is required in order to integrate with the glib main loop.
2552     glib_req_ver=2.20
2553 else
2554     glib_req_ver=2.12
2555 fi
2556 glib_modules=gthread-2.0
2557 if test "$modules" = yes; then
2558     glib_modules="$glib_modules gmodule-2.0"
2559 fi
2560
2561 for i in $glib_modules; do
2562     if $pkg_config --atleast-version=$glib_req_ver $i; then
2563         glib_cflags=`$pkg_config --cflags $i`
2564         glib_libs=`$pkg_config --libs $i`
2565         CFLAGS="$glib_cflags $CFLAGS"
2566         LIBS="$glib_libs $LIBS"
2567         libs_qga="$glib_libs $libs_qga"
2568     else
2569         error_exit "glib-$glib_req_ver $i is required to compile QEMU"
2570     fi
2571 done
2572
2573 ##########################################
2574 # SHA command probe for modules
2575 if test "$modules" = yes; then
2576     shacmd_probe="sha1sum sha1 shasum"
2577     for c in $shacmd_probe; do
2578         if which $c &>/dev/null; then
2579             shacmd="$c"
2580             break
2581         fi
2582     done
2583     if test "$shacmd" = ""; then
2584         error_exit "one of the checksum commands is required to enable modules: $shacmd_probe"
2585     fi
2586 fi
2587
2588 ##########################################
2589 # pixman support probe
2590
2591 if test "$pixman" = ""; then
2592   if test "$want_tools" = "no" -a "$softmmu" = "no"; then
2593     pixman="none"
2594   elif $pkg_config pixman-1 > /dev/null 2>&1; then
2595     pixman="system"
2596   else
2597     pixman="internal"
2598   fi
2599 fi
2600 if test "$pixman" = "none"; then
2601   if test "$want_tools" != "no" -o "$softmmu" != "no"; then
2602     error_exit "pixman disabled but system emulation or tools build" \
2603         "enabled.  You can turn off pixman only if you also" \
2604         "disable all system emulation targets and the tools" \
2605         "build with '--disable-tools --disable-system'."
2606   fi
2607   pixman_cflags=
2608   pixman_libs=
2609 elif test "$pixman" = "system"; then
2610   pixman_cflags=`$pkg_config --cflags pixman-1`
2611   pixman_libs=`$pkg_config --libs pixman-1`
2612 else
2613   if test ! -d ${source_path}/pixman/pixman; then
2614     error_exit "pixman not present. Your options:" \
2615         "  (1) Preferred: Install the pixman devel package (any recent" \
2616         "      distro should have packages as Xorg needs pixman too)." \
2617         "  (2) Fetch the pixman submodule, using:" \
2618         "      git submodule update --init pixman"
2619   fi
2620   mkdir -p pixman/pixman
2621   pixman_cflags="-I\$(SRC_PATH)/pixman/pixman -I\$(BUILD_DIR)/pixman/pixman"
2622   pixman_libs="-L\$(BUILD_DIR)/pixman/pixman/.libs -lpixman-1"
2623 fi
2624
2625 ##########################################
2626 # libcap probe
2627
2628 if test "$cap" != "no" ; then
2629   cat > $TMPC <<EOF
2630 #include <stdio.h>
2631 #include <sys/capability.h>
2632 int main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
2633 EOF
2634   if compile_prog "" "-lcap" ; then
2635     cap=yes
2636   else
2637     cap=no
2638   fi
2639 fi
2640
2641 ##########################################
2642 # pthread probe
2643 PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
2644
2645 pthread=no
2646 cat > $TMPC << EOF
2647 #include <pthread.h>
2648 static void *f(void *p) { return NULL; }
2649 int main(void) {
2650   pthread_t thread;
2651   pthread_create(&thread, 0, f, 0);
2652   return 0;
2653 }
2654 EOF
2655 if compile_prog "" "" ; then
2656   pthread=yes
2657 else
2658   for pthread_lib in $PTHREADLIBS_LIST; do
2659     if compile_prog "" "$pthread_lib" ; then
2660       pthread=yes
2661       found=no
2662       for lib_entry in $LIBS; do
2663         if test "$lib_entry" = "$pthread_lib"; then
2664           found=yes
2665           break
2666         fi
2667       done
2668       if test "$found" = "no"; then
2669         LIBS="$pthread_lib $LIBS"
2670       fi
2671       break
2672     fi
2673   done
2674 fi
2675
2676 if test "$mingw32" != yes -a "$pthread" = no; then
2677   error_exit "pthread check failed" \
2678       "Make sure to have the pthread libs and headers installed."
2679 fi
2680
2681 ##########################################
2682 # rbd probe
2683 if test "$rbd" != "no" ; then
2684   cat > $TMPC <<EOF
2685 #include <stdio.h>
2686 #include <rbd/librbd.h>
2687 int main(void) {
2688     rados_t cluster;
2689     rados_create(&cluster, NULL);
2690     return 0;
2691 }
2692 EOF
2693   rbd_libs="-lrbd -lrados"
2694   if compile_prog "" "$rbd_libs" ; then
2695     rbd=yes
2696   else
2697     if test "$rbd" = "yes" ; then
2698       feature_not_found "rados block device" "Install librbd/ceph devel"
2699     fi
2700     rbd=no
2701   fi
2702 fi
2703
2704 ##########################################
2705 # libssh2 probe
2706 min_libssh2_version=1.2.8
2707 if test "$libssh2" != "no" ; then
2708   if $pkg_config --atleast-version=$min_libssh2_version libssh2; then
2709     libssh2_cflags=`$pkg_config libssh2 --cflags`
2710     libssh2_libs=`$pkg_config libssh2 --libs`
2711     libssh2=yes
2712   else
2713     if test "$libssh2" = "yes" ; then
2714       error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2"
2715     fi
2716     libssh2=no
2717   fi
2718 fi
2719
2720 ##########################################
2721 # libssh2_sftp_fsync probe
2722
2723 if test "$libssh2" = "yes"; then
2724   cat > $TMPC <<EOF
2725 #include <stdio.h>
2726 #include <libssh2.h>
2727 #include <libssh2_sftp.h>
2728 int main(void) {
2729     LIBSSH2_SESSION *session;
2730     LIBSSH2_SFTP *sftp;
2731     LIBSSH2_SFTP_HANDLE *sftp_handle;
2732     session = libssh2_session_init ();
2733     sftp = libssh2_sftp_init (session);
2734     sftp_handle = libssh2_sftp_open (sftp, "/", 0, 0);
2735     libssh2_sftp_fsync (sftp_handle);
2736     return 0;
2737 }
2738 EOF
2739   # libssh2_cflags/libssh2_libs defined in previous test.
2740   if compile_prog "$libssh2_cflags" "$libssh2_libs" ; then
2741     QEMU_CFLAGS="-DHAS_LIBSSH2_SFTP_FSYNC $QEMU_CFLAGS"
2742   fi
2743 fi
2744
2745 ##########################################
2746 # linux-aio probe
2747
2748 if test "$linux_aio" != "no" ; then
2749   cat > $TMPC <<EOF
2750 #include <libaio.h>
2751 #include <sys/eventfd.h>
2752 #include <stddef.h>
2753 int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
2754 EOF
2755   if compile_prog "" "-laio" ; then
2756     linux_aio=yes
2757   else
2758     if test "$linux_aio" = "yes" ; then
2759       feature_not_found "linux AIO" "Install libaio devel"
2760     fi
2761     linux_aio=no
2762   fi
2763 fi
2764
2765 ##########################################
2766 # TPM passthrough is only on x86 Linux
2767
2768 if test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64; then
2769   tpm_passthrough=$tpm
2770 else
2771   tpm_passthrough=no
2772 fi
2773
2774 ##########################################
2775 # adjust virtio-blk-data-plane based on linux-aio
2776
2777 if test "$virtio_blk_data_plane" = "yes" -a \
2778         "$linux_aio" != "yes" ; then
2779   error_exit "virtio-blk-data-plane requires Linux AIO, please try --enable-linux-aio"
2780 elif test -z "$virtio_blk_data_plane" ; then
2781   virtio_blk_data_plane=$linux_aio
2782 fi
2783
2784 ##########################################
2785 # attr probe
2786
2787 if test "$attr" != "no" ; then
2788   cat > $TMPC <<EOF
2789 #include <stdio.h>
2790 #include <sys/types.h>
2791 #ifdef CONFIG_LIBATTR
2792 #include <attr/xattr.h>
2793 #else
2794 #include <sys/xattr.h>
2795 #endif
2796 int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
2797 EOF
2798   if compile_prog "" "" ; then
2799     attr=yes
2800   # Older distros have <attr/xattr.h>, and need -lattr:
2801   elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
2802     attr=yes
2803     LIBS="-lattr $LIBS"
2804     libattr=yes
2805   else
2806     if test "$attr" = "yes" ; then
2807       feature_not_found "ATTR" "Install libc6 or libattr devel"
2808     fi
2809     attr=no
2810   fi
2811 fi
2812
2813 ##########################################
2814 # iovec probe
2815 cat > $TMPC <<EOF
2816 #include <sys/types.h>
2817 #include <sys/uio.h>
2818 #include <unistd.h>
2819 int main(void) { return sizeof(struct iovec); }
2820 EOF
2821 iovec=no
2822 if compile_prog "" "" ; then
2823   iovec=yes
2824 fi
2825
2826 ##########################################
2827 # preadv probe
2828 cat > $TMPC <<EOF
2829 #include <sys/types.h>
2830 #include <sys/uio.h>
2831 #include <unistd.h>
2832 int main(void) { return preadv(0, 0, 0, 0); }
2833 EOF
2834 preadv=no
2835 if compile_prog "" "" ; then
2836   preadv=yes
2837 fi
2838
2839 ##########################################
2840 # fdt probe
2841 # fdt support is mandatory for at least some target architectures,
2842 # so insist on it if we're building those system emulators.
2843 fdt_required=no
2844 for target in $target_list; do
2845   case $target in
2846     aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu)
2847       fdt_required=yes
2848     ;;
2849   esac
2850 done
2851
2852 if test "$fdt_required" = "yes"; then
2853   if test "$fdt" = "no"; then
2854     error_exit "fdt disabled but some requested targets require it." \
2855       "You can turn off fdt only if you also disable all the system emulation" \
2856       "targets which need it (by specifying a cut down --target-list)."
2857   fi
2858   fdt=yes
2859 fi
2860
2861 if test "$fdt" != "no" ; then
2862   fdt_libs="-lfdt"
2863   # explicitly check for libfdt_env.h as it is missing in some stable installs
2864   cat > $TMPC << EOF
2865 #include <libfdt_env.h>
2866 int main(void) { return 0; }
2867 EOF
2868   if compile_prog "" "$fdt_libs" ; then
2869     # system DTC is good - use it
2870     fdt=yes
2871   elif test -d ${source_path}/dtc/libfdt ; then
2872     # have submodule DTC - use it
2873     fdt=yes
2874     dtc_internal="yes"
2875     mkdir -p dtc
2876     if [ "$source_path" != `pwd` ] ; then
2877        symlink "$source_path/dtc/Makefile" "dtc/Makefile"
2878        symlink "$source_path/dtc/scripts" "dtc/scripts"
2879     fi
2880     fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
2881     fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs"
2882   elif test "$fdt" = "yes" ; then
2883     # have neither and want - prompt for system/submodule install
2884     error_exit "DTC (libfdt) not present. Your options:" \
2885         "  (1) Preferred: Install the DTC (libfdt) devel package" \
2886         "  (2) Fetch the DTC submodule, using:" \
2887         "      git submodule update --init dtc"
2888   else
2889     # don't have and don't want
2890     fdt_libs=
2891     fdt=no
2892   fi
2893 fi
2894
2895 libs_softmmu="$libs_softmmu $fdt_libs"
2896
2897 ##########################################
2898 # GLX probe, used by milkymist-tmu2
2899 if test "$glx" != "no" ; then
2900   glx_libs="-lGL -lX11"
2901   cat > $TMPC << EOF
2902 #include <X11/Xlib.h>
2903 #include <GL/gl.h>
2904 #include <GL/glx.h>
2905 int main(void) { glBegin(0); glXQueryVersion(0,0,0); return 0; }
2906 EOF
2907   if compile_prog "" "-lGL -lX11" ; then
2908     glx=yes
2909   else
2910     if test "$glx" = "yes" ; then
2911       feature_not_found "glx" "Install GL devel (e.g. MESA)"
2912     fi
2913     glx_libs=
2914     glx=no
2915   fi
2916 fi
2917
2918 ##########################################
2919 # glusterfs probe
2920 if test "$glusterfs" != "no" ; then
2921   if $pkg_config --atleast-version=3 glusterfs-api; then
2922     glusterfs="yes"
2923     glusterfs_cflags=`$pkg_config --cflags glusterfs-api`
2924     glusterfs_libs=`$pkg_config --libs glusterfs-api`
2925     if $pkg_config --atleast-version=5 glusterfs-api; then
2926       glusterfs_discard="yes"
2927     fi
2928     if $pkg_config --atleast-version=6 glusterfs-api; then
2929       glusterfs_zerofill="yes"
2930     fi
2931   else
2932     if test "$glusterfs" = "yes" ; then
2933       feature_not_found "GlusterFS backend support" "Install glusterfs-api devel"
2934     fi
2935     glusterfs="no"
2936   fi
2937 fi
2938
2939 # Check for inotify functions when we are building linux-user
2940 # emulator.  This is done because older glibc versions don't
2941 # have syscall stubs for these implemented.  In that case we
2942 # don't provide them even if kernel supports them.
2943 #
2944 inotify=no
2945 cat > $TMPC << EOF
2946 #include <sys/inotify.h>
2947
2948 int
2949 main(void)
2950 {
2951         /* try to start inotify */
2952         return inotify_init();
2953 }
2954 EOF
2955 if compile_prog "" "" ; then
2956   inotify=yes
2957 fi
2958
2959 inotify1=no
2960 cat > $TMPC << EOF
2961 #include <sys/inotify.h>
2962
2963 int
2964 main(void)
2965 {
2966     /* try to start inotify */
2967     return inotify_init1(0);
2968 }
2969 EOF
2970 if compile_prog "" "" ; then
2971   inotify1=yes
2972 fi
2973
2974 # check if utimensat and futimens are supported
2975 utimens=no
2976 cat > $TMPC << EOF
2977 #define _ATFILE_SOURCE
2978 #include <stddef.h>
2979 #include <fcntl.h>
2980 #include <sys/stat.h>
2981
2982 int main(void)
2983 {
2984     utimensat(AT_FDCWD, "foo", NULL, 0);
2985     futimens(0, NULL);
2986     return 0;
2987 }
2988 EOF
2989 if compile_prog "" "" ; then
2990   utimens=yes
2991 fi
2992
2993 # check if pipe2 is there
2994 pipe2=no
2995 cat > $TMPC << EOF
2996 #include <unistd.h>
2997 #include <fcntl.h>
2998
2999 int main(void)
3000 {
3001     int pipefd[2];
3002     return pipe2(pipefd, O_CLOEXEC);
3003 }
3004 EOF
3005 if compile_prog "" "" ; then
3006   pipe2=yes
3007 fi
3008
3009 # check if accept4 is there
3010 accept4=no
3011 cat > $TMPC << EOF
3012 #include <sys/socket.h>
3013 #include <stddef.h>
3014
3015 int main(void)
3016 {
3017     accept4(0, NULL, NULL, SOCK_CLOEXEC);
3018     return 0;
3019 }
3020 EOF
3021 if compile_prog "" "" ; then
3022   accept4=yes
3023 fi
3024
3025 # check if tee/splice is there. vmsplice was added same time.
3026 splice=no
3027 cat > $TMPC << EOF
3028 #include <unistd.h>
3029 #include <fcntl.h>
3030 #include <limits.h>
3031
3032 int main(void)
3033 {
3034     int len, fd = 0;
3035     len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
3036     splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
3037     return 0;
3038 }
3039 EOF
3040 if compile_prog "" "" ; then
3041   splice=yes
3042 fi
3043
3044 ##########################################
3045 # signalfd probe
3046 signalfd="no"
3047 cat > $TMPC << EOF
3048 #include <unistd.h>
3049 #include <sys/syscall.h>
3050 #include <signal.h>
3051 int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
3052 EOF
3053
3054 if compile_prog "" "" ; then
3055   signalfd=yes
3056 fi
3057
3058 # check if eventfd is supported
3059 eventfd=no
3060 cat > $TMPC << EOF
3061 #include <sys/eventfd.h>
3062
3063 int main(void)
3064 {
3065     return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
3066 }
3067 EOF
3068 if compile_prog "" "" ; then
3069   eventfd=yes
3070 fi
3071
3072 # check for fallocate
3073 fallocate=no
3074 cat > $TMPC << EOF
3075 #include <fcntl.h>
3076
3077 int main(void)
3078 {
3079     fallocate(0, 0, 0, 0);
3080     return 0;
3081 }
3082 EOF
3083 if compile_prog "" "" ; then
3084   fallocate=yes
3085 fi
3086
3087 # check for fallocate hole punching
3088 fallocate_punch_hole=no
3089 cat > $TMPC << EOF
3090 #include <fcntl.h>
3091 #include <linux/falloc.h>
3092
3093 int main(void)
3094 {
3095     fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
3096     return 0;
3097 }
3098 EOF
3099 if compile_prog "" "" ; then
3100   fallocate_punch_hole=yes
3101 fi
3102
3103 # check for sync_file_range
3104 sync_file_range=no
3105 cat > $TMPC << EOF
3106 #include <fcntl.h>
3107
3108 int main(void)
3109 {
3110     sync_file_range(0, 0, 0, 0);
3111     return 0;
3112 }
3113 EOF
3114 if compile_prog "" "" ; then
3115   sync_file_range=yes
3116 fi
3117
3118 # check for linux/fiemap.h and FS_IOC_FIEMAP
3119 fiemap=no
3120 cat > $TMPC << EOF
3121 #include <sys/ioctl.h>
3122 #include <linux/fs.h>
3123 #include <linux/fiemap.h>
3124
3125 int main(void)
3126 {
3127     ioctl(0, FS_IOC_FIEMAP, 0);
3128     return 0;
3129 }
3130 EOF
3131 if compile_prog "" "" ; then
3132   fiemap=yes
3133 fi
3134
3135 # check for dup3
3136 dup3=no
3137 cat > $TMPC << EOF
3138 #include <unistd.h>
3139
3140 int main(void)
3141 {
3142     dup3(0, 0, 0);
3143     return 0;
3144 }
3145 EOF
3146 if compile_prog "" "" ; then
3147   dup3=yes
3148 fi
3149
3150 # check for ppoll support
3151 ppoll=no
3152 cat > $TMPC << EOF
3153 #include <poll.h>
3154
3155 int main(void)
3156 {
3157     struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 };
3158     ppoll(&pfd, 1, 0, 0);
3159     return 0;
3160 }
3161 EOF
3162 if compile_prog "" "" ; then
3163   ppoll=yes
3164 fi
3165
3166 # check for prctl(PR_SET_TIMERSLACK , ... ) support
3167 prctl_pr_set_timerslack=no
3168 cat > $TMPC << EOF
3169 #include <sys/prctl.h>
3170
3171 int main(void)
3172 {
3173     prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0);
3174     return 0;
3175 }
3176 EOF
3177 if compile_prog "" "" ; then
3178   prctl_pr_set_timerslack=yes
3179 fi
3180
3181 # check for epoll support
3182 epoll=no
3183 cat > $TMPC << EOF
3184 #include <sys/epoll.h>
3185
3186 int main(void)
3187 {
3188     epoll_create(0);
3189     return 0;
3190 }
3191 EOF
3192 if compile_prog "" "" ; then
3193   epoll=yes
3194 fi
3195
3196 # epoll_create1 and epoll_pwait are later additions
3197 # so we must check separately for their presence
3198 epoll_create1=no
3199 cat > $TMPC << EOF
3200 #include <sys/epoll.h>
3201
3202 int main(void)
3203 {
3204     /* Note that we use epoll_create1 as a value, not as
3205      * a function being called. This is necessary so that on
3206      * old SPARC glibc versions where the function was present in
3207      * the library but not declared in the header file we will
3208      * fail the configure check. (Otherwise we will get a compiler
3209      * warning but not an error, and will proceed to fail the
3210      * qemu compile where we compile with -Werror.)
3211      */
3212     return (int)(uintptr_t)&epoll_create1;
3213 }
3214 EOF
3215 if compile_prog "" "" ; then
3216   epoll_create1=yes
3217 fi
3218
3219 epoll_pwait=no
3220 cat > $TMPC << EOF
3221 #include <sys/epoll.h>
3222
3223 int main(void)
3224 {
3225     epoll_pwait(0, 0, 0, 0, 0);
3226     return 0;
3227 }
3228 EOF
3229 if compile_prog "" "" ; then
3230   epoll_pwait=yes
3231 fi
3232
3233 # check for sendfile support
3234 sendfile=no
3235 cat > $TMPC << EOF
3236 #include <sys/sendfile.h>
3237
3238 int main(void)
3239 {
3240     return sendfile(0, 0, 0, 0);
3241 }
3242 EOF
3243 if compile_prog "" "" ; then
3244   sendfile=yes
3245 fi
3246
3247 # Check if tools are available to build documentation.
3248 if test "$docs" != "no" ; then
3249   if has makeinfo && has pod2man; then
3250     docs=yes
3251   else
3252     if test "$docs" = "yes" ; then
3253       feature_not_found "docs" "Install texinfo and Perl/perl-podlators"
3254     fi
3255     docs=no
3256   fi
3257 fi
3258
3259 # Search for bswap_32 function
3260 byteswap_h=no
3261 cat > $TMPC << EOF
3262 #include <byteswap.h>
3263 int main(void) { return bswap_32(0); }
3264 EOF
3265 if compile_prog "" "" ; then
3266   byteswap_h=yes
3267 fi
3268
3269 # Search for bswap32 function
3270 bswap_h=no
3271 cat > $TMPC << EOF
3272 #include <sys/endian.h>
3273 #include <sys/types.h>
3274 #include <machine/bswap.h>
3275 int main(void) { return bswap32(0); }
3276 EOF
3277 if compile_prog "" "" ; then
3278   bswap_h=yes
3279 fi
3280
3281 ##########################################
3282 # Do we have libiscsi
3283 # We check for iscsi_write16_sync() to make sure we have a
3284 # at least version 1.4.0 of libiscsi.
3285 if test "$libiscsi" != "no" ; then
3286   cat > $TMPC << EOF
3287 #include <stdio.h>
3288 #include <iscsi/iscsi.h>
3289 int main(void) { iscsi_write16_sync(NULL,0,0,NULL,0,0,0,0,0,0,0); return 0; }
3290 EOF
3291   if $pkg_config --atleast-version=1.7.0 libiscsi; then
3292     libiscsi="yes"
3293     libiscsi_cflags=$($pkg_config --cflags libiscsi)
3294     libiscsi_libs=$($pkg_config --libs libiscsi)
3295   elif compile_prog "" "-liscsi" ; then
3296     libiscsi="yes"
3297     libiscsi_libs="-liscsi"
3298   else
3299     if test "$libiscsi" = "yes" ; then
3300       feature_not_found "libiscsi" "Install libiscsi devel"
3301     fi
3302     libiscsi="no"
3303   fi
3304 fi
3305
3306 # We also need to know the API version because there was an
3307 # API change from 1.4.0 to 1.5.0.
3308 if test "$libiscsi" = "yes"; then
3309   cat >$TMPC <<EOF
3310 #include <iscsi/iscsi.h>
3311 int main(void)
3312 {
3313   iscsi_read10_task(0, 0, 0, 0, 0, 0, 0);
3314   return 0;
3315 }
3316 EOF
3317   if compile_prog "" "-liscsi"; then
3318     libiscsi_version="1.4.0"
3319   fi
3320 fi
3321
3322 ##########################################
3323 # Do we need libm
3324 cat > $TMPC << EOF
3325 #include <math.h>
3326 int main(void) { return isnan(sin(0.0)); }
3327 EOF
3328 if compile_prog "" "" ; then
3329   :
3330 elif compile_prog "" "-lm" ; then
3331   LIBS="-lm $LIBS"
3332   libs_qga="-lm $libs_qga"
3333 else
3334   error_exit "libm check failed"
3335 fi
3336
3337 ##########################################
3338 # Do we need librt
3339 # uClibc provides 2 versions of clock_gettime(), one with realtime
3340 # support and one without. This means that the clock_gettime() don't
3341 # need -lrt. We still need it for timer_create() so we check for this
3342 # function in addition.
3343 cat > $TMPC <<EOF
3344 #include <signal.h>
3345 #include <time.h>
3346 int main(void) {
3347   timer_create(CLOCK_REALTIME, NULL, NULL);
3348   return clock_gettime(CLOCK_REALTIME, NULL);
3349 }
3350 EOF
3351
3352 if compile_prog "" "" ; then
3353   :
3354 # we need pthread for static linking. use previous pthread test result
3355 elif compile_prog "" "-lrt $pthread_lib" ; then
3356   LIBS="-lrt $LIBS"
3357   libs_qga="-lrt $libs_qga"
3358 fi
3359
3360 if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
3361         "$aix" != "yes" -a "$haiku" != "yes" ; then
3362     libs_softmmu="-lutil $libs_softmmu"
3363 fi
3364
3365 ##########################################
3366 # spice probe
3367 if test "$spice" != "no" ; then
3368   cat > $TMPC << EOF
3369 #include <spice.h>
3370 int main(void) { spice_server_new(); return 0; }
3371 EOF
3372   spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
3373   spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
3374   if $pkg_config --atleast-version=0.12.0 spice-server && \
3375      $pkg_config --atleast-version=0.12.3 spice-protocol && \
3376      compile_prog "$spice_cflags" "$spice_libs" ; then
3377     spice="yes"
3378     libs_softmmu="$libs_softmmu $spice_libs"
3379     QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
3380     spice_protocol_version=$($pkg_config --modversion spice-protocol)
3381     spice_server_version=$($pkg_config --modversion spice-server)
3382   else
3383     if test "$spice" = "yes" ; then
3384       feature_not_found "spice" "Install spice-server and spice-protocol devel"
3385     fi
3386     spice="no"
3387   fi
3388 fi
3389
3390 # check for libcacard for smartcard support
3391 smartcard_cflags=""
3392 # TODO - what's the minimal nss version we support?
3393 if test "$smartcard_nss" != "no"; then
3394   cat > $TMPC << EOF
3395 #include <pk11pub.h>
3396 int main(void) { PK11_FreeSlot(0); return 0; }
3397 EOF
3398     smartcard_includes="-I\$(SRC_PATH)/libcacard"
3399     libcacard_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs"
3400     libcacard_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags"
3401     test_cflags="$libcacard_cflags"
3402     # The header files in nss < 3.13.3 have a bug which causes them to
3403     # emit a warning. If we're going to compile QEMU with -Werror, then
3404     # test that the headers don't have this bug. Otherwise we would pass
3405     # the configure test but fail to compile QEMU later.
3406     if test "$werror" = "yes"; then
3407         test_cflags="-Werror $test_cflags"
3408     fi
3409     if test -n "$libtool" &&
3410        $pkg_config --atleast-version=3.12.8 nss && \
3411       compile_prog "$test_cflags" "$libcacard_libs"; then
3412         smartcard_nss="yes"
3413         QEMU_CFLAGS="$QEMU_CFLAGS $libcacard_cflags"
3414         QEMU_INCLUDES="$QEMU_INCLUDES $smartcard_includes"
3415         libs_softmmu="$libcacard_libs $libs_softmmu"
3416     else
3417         if test "$smartcard_nss" = "yes"; then
3418             feature_not_found "nss"
3419         fi
3420         smartcard_nss="no"
3421     fi
3422 fi
3423
3424 # check for libusb
3425 if test "$libusb" != "no" ; then
3426     if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
3427         libusb="yes"
3428         libusb_cflags=$($pkg_config --cflags libusb-1.0)
3429         libusb_libs=$($pkg_config --libs libusb-1.0)
3430         QEMU_CFLAGS="$QEMU_CFLAGS $libusb_cflags"
3431         libs_softmmu="$libs_softmmu $libusb_libs"
3432     else
3433         if test "$libusb" = "yes"; then
3434             feature_not_found "libusb" "Install libusb devel"
3435         fi
3436         libusb="no"
3437     fi
3438 fi
3439
3440 # check for usbredirparser for usb network redirection support
3441 if test "$usb_redir" != "no" ; then
3442     if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then
3443         usb_redir="yes"
3444         usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
3445         usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
3446         QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
3447         libs_softmmu="$libs_softmmu $usb_redir_libs"
3448     else
3449         if test "$usb_redir" = "yes"; then
3450             feature_not_found "usb-redir" "Install usbredir devel"
3451         fi
3452         usb_redir="no"
3453     fi
3454 fi
3455
3456 ##########################################
3457 # check if we have VSS SDK headers for win
3458
3459 if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$vss_win32_sdk" != "no" ; then
3460   case "$vss_win32_sdk" in
3461     "")   vss_win32_include="-I$source_path" ;;
3462     *\ *) # The SDK is installed in "Program Files" by default, but we cannot
3463           # handle path with spaces. So we symlink the headers into ".sdk/vss".
3464           vss_win32_include="-I$source_path/.sdk/vss"
3465           symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
3466           ;;
3467     *)    vss_win32_include="-I$vss_win32_sdk"
3468   esac
3469   cat > $TMPC << EOF
3470 #define __MIDL_user_allocate_free_DEFINED__
3471 #include <inc/win2003/vss.h>
3472 int main(void) { return VSS_CTX_BACKUP; }
3473 EOF
3474   if compile_prog "$vss_win32_include" "" ; then
3475     guest_agent_with_vss="yes"
3476     QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
3477     libs_qga="-lole32 -loleaut32 -lshlwapi -luuid -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga"
3478   else
3479     if test "$vss_win32_sdk" != "" ; then
3480       echo "ERROR: Please download and install Microsoft VSS SDK:"
3481       echo "ERROR:   http://www.microsoft.com/en-us/download/details.aspx?id=23490"
3482       echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
3483       echo "ERROR:   scripts/extract-vsssdk-headers setup.exe"
3484       echo "ERROR: The headers are extracted in the directory \`inc'."
3485       feature_not_found "VSS support"
3486     fi
3487     guest_agent_with_vss="no"
3488   fi
3489 fi
3490
3491 ##########################################
3492 # lookup Windows platform SDK (if not specified)
3493 # The SDK is needed only to build .tlb (type library) file of guest agent
3494 # VSS provider from the source. It is usually unnecessary because the
3495 # pre-compiled .tlb file is included.
3496
3497 if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$guest_agent_with_vss" = "yes" ; then
3498   if test -z "$win_sdk"; then
3499     programfiles="$PROGRAMFILES"
3500     test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432"
3501     if test -n "$programfiles"; then
3502       win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null
3503     else
3504       feature_not_found "Windows SDK"
3505     fi
3506   elif test "$win_sdk" = "no"; then
3507     win_sdk=""
3508   fi
3509 fi
3510
3511 ##########################################
3512
3513 ##########################################
3514 # check if we have fdatasync
3515
3516 fdatasync=no
3517 cat > $TMPC << EOF
3518 #include <unistd.h>
3519 int main(void) {
3520 #if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
3521 return fdatasync(0);
3522 #else
3523 #error Not supported
3524 #endif
3525 }
3526 EOF
3527 if compile_prog "" "" ; then
3528     fdatasync=yes
3529 fi
3530
3531 ##########################################
3532 # check if we have madvise
3533
3534 madvise=no
3535 cat > $TMPC << EOF
3536 #include <sys/types.h>
3537 #include <sys/mman.h>
3538 #include <stddef.h>
3539 int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
3540 EOF
3541 if compile_prog "" "" ; then
3542     madvise=yes
3543 fi
3544
3545 ##########################################
3546 # check if we have posix_madvise
3547
3548 posix_madvise=no
3549 cat > $TMPC << EOF
3550 #include <sys/mman.h>
3551 #include <stddef.h>
3552 int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
3553 EOF
3554 if compile_prog "" "" ; then
3555     posix_madvise=yes
3556 fi
3557
3558 ##########################################
3559 # check if we have usable SIGEV_THREAD_ID
3560
3561 sigev_thread_id=no
3562 cat > $TMPC << EOF
3563 #include <signal.h>
3564 int main(void) {
3565   struct sigevent ev;
3566   ev.sigev_notify = SIGEV_THREAD_ID;
3567   ev._sigev_un._tid = 0;
3568   asm volatile("" : : "g"(&ev));
3569   return 0;
3570 }
3571 EOF
3572 if compile_prog "" "" ; then
3573     sigev_thread_id=yes
3574 fi
3575
3576 ##########################################
3577 # check if trace backend exists
3578
3579 $python "$source_path/scripts/tracetool.py" "--backend=$trace_backend" --check-backend  > /dev/null 2> /dev/null
3580 if test "$?" -ne 0 ; then
3581   error_exit "invalid trace backend" \
3582       "Please choose a supported trace backend."
3583 fi
3584
3585 ##########################################
3586 # For 'ust' backend, test if ust headers are present
3587 if test "$trace_backend" = "ust"; then
3588   cat > $TMPC << EOF
3589 #include <lttng/tracepoint.h>
3590 int main(void) { return 0; }
3591 EOF
3592   if compile_prog "" "" ; then
3593     if $pkg_config lttng-ust --exists; then
3594       lttng_ust_libs=`$pkg_config --libs lttng-ust`
3595     else
3596       lttng_ust_libs="-llttng-ust"
3597     fi
3598     if $pkg_config liburcu-bp --exists; then
3599       urcu_bp_libs=`$pkg_config --libs liburcu-bp`
3600     else
3601       urcu_bp_libs="-lurcu-bp"
3602     fi
3603
3604     LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS"
3605     libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga"
3606   else
3607     error_exit "Trace backend 'ust' missing lttng-ust header files"
3608   fi
3609 fi
3610
3611 ##########################################
3612 # For 'dtrace' backend, test if 'dtrace' command is present
3613 if test "$trace_backend" = "dtrace"; then
3614   if ! has 'dtrace' ; then
3615     error_exit "dtrace command is not found in PATH $PATH"
3616   fi
3617   trace_backend_stap="no"
3618   if has 'stap' ; then
3619     trace_backend_stap="yes"
3620   fi
3621 fi
3622
3623 ##########################################
3624 # check and set a backend for coroutine
3625
3626 # We prefer ucontext, but it's not always possible. The fallback
3627 # is sigcontext. gthread is not selectable except explicitly, because
3628 # it is not functional enough to run QEMU proper. (It is occasionally
3629 # useful for debugging purposes.)  On Windows the only valid backend
3630 # is the Windows-specific one.
3631
3632 ucontext_works=no
3633 if test "$darwin" != "yes"; then
3634   cat > $TMPC << EOF
3635 #include <ucontext.h>
3636 #ifdef __stub_makecontext
3637 #error Ignoring glibc stub makecontext which will always fail
3638 #endif
3639 int main(void) { makecontext(0, 0, 0); return 0; }
3640 EOF
3641   if compile_prog "" "" ; then
3642     ucontext_works=yes
3643   fi
3644 fi
3645
3646 if test "$coroutine" = ""; then
3647   if test "$mingw32" = "yes"; then
3648     coroutine=win32
3649   elif test "$ucontext_works" = "yes"; then
3650     coroutine=ucontext
3651   else
3652     coroutine=sigaltstack
3653   fi
3654 else
3655   case $coroutine in
3656   windows)
3657     if test "$mingw32" != "yes"; then
3658       error_exit "'windows' coroutine backend only valid for Windows"
3659     fi
3660     # Unfortunately the user visible backend name doesn't match the
3661     # coroutine-*.c filename for this case, so we have to adjust it here.
3662     coroutine=win32
3663     ;;
3664   ucontext)
3665     if test "$ucontext_works" != "yes"; then
3666       feature_not_found "ucontext"
3667     fi
3668     ;;
3669   gthread|sigaltstack)
3670     if test "$mingw32" = "yes"; then
3671       error_exit "only the 'windows' coroutine backend is valid for Windows"
3672     fi
3673     ;;
3674   *)
3675     error_exit "unknown coroutine backend $coroutine"
3676     ;;
3677   esac
3678 fi
3679
3680 if test "$coroutine_pool" = ""; then
3681   if test "$coroutine" = "gthread"; then
3682     coroutine_pool=no
3683   else
3684     coroutine_pool=yes
3685   fi
3686 fi
3687 if test "$coroutine" = "gthread" -a "$coroutine_pool" = "yes"; then
3688   error_exit "'gthread' coroutine backend does not support pool (use --disable-coroutine-pool)"
3689 fi
3690
3691 ##########################################
3692 # check if we have open_by_handle_at
3693
3694 open_by_handle_at=no
3695 cat > $TMPC << EOF
3696 #include <fcntl.h>
3697 #if !defined(AT_EMPTY_PATH)
3698 # error missing definition
3699 #else
3700 int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
3701 #endif
3702 EOF
3703 if compile_prog "" "" ; then
3704     open_by_handle_at=yes
3705 fi
3706
3707 ########################################
3708 # check if we have linux/magic.h
3709
3710 linux_magic_h=no
3711 cat > $TMPC << EOF
3712 #include <linux/magic.h>
3713 int main(void) {
3714   return 0;
3715 }
3716 EOF
3717 if compile_prog "" "" ; then
3718     linux_magic_h=yes
3719 fi
3720
3721 ########################################
3722 # check whether we can disable warning option with a pragma (this is needed
3723 # to silence warnings in the headers of some versions of external libraries).
3724 # This test has to be compiled with -Werror as otherwise an unknown pragma is
3725 # only a warning.
3726 #
3727 # If we can't selectively disable warning in the code, disable -Werror so that
3728 # the build doesn't fail anyway.
3729
3730 pragma_disable_unused_but_set=no
3731 cat > $TMPC << EOF
3732 #pragma GCC diagnostic push
3733 #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
3734 #pragma GCC diagnostic ignored "-Wstrict-prototypes"
3735 #pragma GCC diagnostic pop
3736
3737 int main(void) {
3738     return 0;
3739 }
3740 EOF
3741 if compile_prog "-Werror" "" ; then
3742     pragma_diagnostic_available=yes
3743 else
3744     werror=no
3745 fi
3746
3747 ########################################
3748 # check if we have valgrind/valgrind.h and valgrind/memcheck.h
3749
3750 valgrind_h=no
3751 cat > $TMPC << EOF
3752 #include <valgrind/valgrind.h>
3753 #include <valgrind/memcheck.h>
3754 int main(void) {
3755   return 0;
3756 }
3757 EOF
3758 if compile_prog "" "" ; then
3759     valgrind_h=yes
3760 fi
3761
3762 ########################################
3763 # check if environ is declared
3764
3765 has_environ=no
3766 cat > $TMPC << EOF
3767 #include <unistd.h>
3768 int main(void) {
3769     environ = 0;
3770     return 0;
3771 }
3772 EOF
3773 if compile_prog "" "" ; then
3774     has_environ=yes
3775 fi
3776
3777 ########################################
3778 # check if cpuid.h is usable.
3779
3780 cpuid_h=no
3781 cat > $TMPC << EOF
3782 #include <cpuid.h>
3783 int main(void) {
3784     unsigned a, b, c, d;
3785     int max = __get_cpuid_max(0, 0);
3786
3787     if (max >= 1) {
3788         __cpuid(1, a, b, c, d);
3789     }
3790
3791     if (max >= 7) {
3792         __cpuid_count(7, 0, a, b, c, d);
3793     }
3794
3795     return 0;
3796 }
3797 EOF
3798 if compile_prog "" "" ; then
3799     cpuid_h=yes
3800 fi
3801
3802 ########################################
3803 # check if __[u]int128_t is usable.
3804
3805 int128=no
3806 cat > $TMPC << EOF
3807 __int128_t a;
3808 __uint128_t b;
3809 int main (void) {
3810   a = a + b;
3811   b = a * b;
3812   a = a * a;
3813   return 0;
3814 }
3815 EOF
3816 if compile_prog "" "" ; then
3817     int128=yes
3818 fi
3819
3820 ########################################
3821 # check if getauxval is available.
3822
3823 getauxval=no
3824 cat > $TMPC << EOF
3825 #include <sys/auxv.h>
3826 int main(void) {
3827   return getauxval(AT_HWCAP) == 0;
3828 }
3829 EOF
3830 if compile_prog "" "" ; then
3831     getauxval=yes
3832 fi
3833
3834 ##########################################
3835 # End of CC checks
3836 # After here, no more $cc or $ld runs
3837
3838 if test "$gcov" = "yes" ; then
3839   CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
3840   LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
3841 elif test "$debug" = "no" ; then
3842   CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
3843 fi
3844
3845 ##########################################
3846 # Do we have libnfs
3847 if test "$libnfs" != "no" ; then
3848   if $pkg_config --atleast-version=1.9.2 libnfs; then
3849     libnfs="yes"
3850     libnfs_libs=$($pkg_config --libs libnfs)
3851     LIBS="$LIBS $libnfs_libs"
3852   else
3853     if test "$libnfs" = "yes" ; then
3854       feature_not_found "libnfs"
3855     fi
3856     libnfs="no"
3857   fi
3858 fi
3859
3860 # Disable zero malloc errors for official releases unless explicitly told to
3861 # enable/disable
3862 if test -z "$zero_malloc" ; then
3863     if test "$z_version" = "50" ; then
3864         zero_malloc="no"
3865     else
3866         zero_malloc="yes"
3867     fi
3868 fi
3869
3870 # Now we've finished running tests it's OK to add -Werror to the compiler flags
3871 if test "$werror" = "yes"; then
3872     QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
3873 fi
3874
3875 if test "$solaris" = "no" ; then
3876     if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
3877         LDFLAGS="-Wl,--warn-common $LDFLAGS"
3878     fi
3879 fi
3880
3881 # test if pod2man has --utf8 option
3882 if pod2man --help | grep -q utf8; then
3883     POD2MAN="pod2man --utf8"
3884 else
3885     POD2MAN="pod2man"
3886 fi
3887
3888 # Use ASLR, no-SEH and DEP if available
3889 if test "$mingw32" = "yes" ; then
3890     for flag in --dynamicbase --no-seh --nxcompat; do
3891         if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
3892             LDFLAGS="-Wl,$flag $LDFLAGS"
3893         fi
3894     done
3895 fi
3896
3897 qemu_confdir=$sysconfdir$confsuffix
3898 qemu_moddir=$libdir$confsuffix
3899 qemu_datadir=$datadir$confsuffix
3900 qemu_localedir="$datadir/locale"
3901
3902 tools=""
3903 if test "$want_tools" = "yes" ; then
3904   tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
3905   if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
3906     tools="qemu-nbd\$(EXESUF) $tools"
3907   fi
3908 fi
3909 if test "$softmmu" = yes ; then
3910   if test "$virtfs" != no ; then
3911     if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then
3912       virtfs=yes
3913       tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
3914     else
3915       if test "$virtfs" = yes; then
3916         error_exit "VirtFS is supported only on Linux and requires libcap-devel and libattr-devel"
3917       fi
3918       virtfs=no
3919     fi
3920   fi
3921 fi
3922 if [ "$guest_agent" != "no" ]; then
3923   if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
3924       tools="qemu-ga\$(EXESUF) $tools"
3925       if [ "$mingw32" = "yes" -a "$guest_agent_with_vss" = "yes" ]; then
3926         tools="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb $tools"
3927       fi
3928       guest_agent=yes
3929   elif [ "$guest_agent" != yes ]; then
3930       guest_agent=no
3931   else
3932       error_exit "Guest agent is not supported on this platform"
3933   fi
3934 fi
3935
3936 # Mac OS X ships with a broken assembler
3937 roms=
3938 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
3939         "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
3940         "$softmmu" = yes ; then
3941   roms="optionrom"
3942 fi
3943 if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
3944   roms="$roms spapr-rtas"
3945 fi
3946
3947 if test "$cpu" = "s390x" ; then
3948   roms="$roms s390-ccw"
3949 fi
3950
3951 # Probe for the need for relocating the user-only binary.
3952 if test "$pie" = "no" ; then
3953   textseg_addr=
3954   case "$cpu" in
3955     arm | hppa | i386 | m68k | ppc | ppc64 | s390* | sparc | sparc64 | x86_64 | x32)
3956       textseg_addr=0x60000000
3957       ;;
3958     mips)
3959       textseg_addr=0x400000
3960       ;;
3961   esac
3962   if [ -n "$textseg_addr" ]; then
3963     cat > $TMPC <<EOF
3964     int main(void) { return 0; }
3965 EOF
3966     textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
3967     if ! compile_prog "" "$textseg_ldflags"; then
3968       # In case ld does not support -Ttext-segment, edit the default linker
3969       # script via sed to set the .text start addr.  This is needed on FreeBSD
3970       # at least.
3971       $ld --verbose | sed \
3972         -e '1,/==================================================/d' \
3973         -e '/==================================================/,$d' \
3974         -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
3975         -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
3976       textseg_ldflags="-Wl,-T../config-host.ld"
3977     fi
3978   fi
3979 fi
3980
3981 # add pixman flags after all config tests are done
3982 QEMU_CFLAGS="$QEMU_CFLAGS $pixman_cflags $fdt_cflags"
3983 libs_softmmu="$libs_softmmu $pixman_libs"
3984
3985 echo "Install prefix    $prefix"
3986 echo "BIOS directory    `eval echo $qemu_datadir`"
3987 echo "binary directory  `eval echo $bindir`"
3988 echo "library directory `eval echo $libdir`"
3989 echo "module directory  `eval echo $qemu_moddir`"
3990 echo "libexec directory `eval echo $libexecdir`"
3991 echo "include directory `eval echo $includedir`"
3992 echo "config directory  `eval echo $sysconfdir`"
3993 if test "$mingw32" = "no" ; then
3994 echo "local state directory   `eval echo $local_statedir`"
3995 echo "Manual directory  `eval echo $mandir`"
3996 echo "ELF interp prefix $interp_prefix"
3997 else
3998 echo "local state directory   queried at runtime"
3999 echo "Windows SDK       $win_sdk"
4000 fi
4001 echo "Source path       $source_path"
4002 echo "C compiler        $cc"
4003 echo "Host C compiler   $host_cc"
4004 echo "C++ compiler      $cxx"
4005 echo "Objective-C compiler $objcc"
4006 echo "ARFLAGS           $ARFLAGS"
4007 echo "CFLAGS            $CFLAGS"
4008 echo "QEMU_CFLAGS       $QEMU_CFLAGS"
4009 echo "LDFLAGS           $LDFLAGS"
4010 echo "make              $make"
4011 echo "install           $install"
4012 echo "python            $python"
4013 if test "$slirp" = "yes" ; then
4014     echo "smbd              $smbd"
4015 fi
4016 echo "module support    $modules"
4017 echo "host CPU          $cpu"
4018 echo "host big endian   $bigendian"
4019 echo "target list       $target_list"
4020 echo "tcg debug enabled $debug_tcg"
4021 echo "gprof enabled     $gprof"
4022 echo "sparse enabled    $sparse"
4023 echo "strip binaries    $strip_opt"
4024 echo "profiler          $profiler"
4025 echo "static build      $static"
4026 echo "-Werror enabled   $werror"
4027 if test "$darwin" = "yes" ; then
4028     echo "Cocoa support     $cocoa"
4029 fi
4030 echo "pixman            $pixman"
4031 echo "SDL support       $sdl"
4032 echo "GTK support       $gtk"
4033 echo "curses support    $curses"
4034 echo "curl support      $curl"
4035 echo "mingw32 support   $mingw32"
4036 echo "Audio drivers     $audio_drv_list"
4037 echo "Block whitelist (rw) $block_drv_rw_whitelist"
4038 echo "Block whitelist (ro) $block_drv_ro_whitelist"
4039 echo "VirtFS support    $virtfs"
4040 echo "VNC support       $vnc"
4041 if test "$vnc" = "yes" ; then
4042     echo "VNC TLS support   $vnc_tls"
4043     echo "VNC SASL support  $vnc_sasl"
4044     echo "VNC JPEG support  $vnc_jpeg"
4045     echo "VNC PNG support   $vnc_png"
4046     echo "VNC WS support    $vnc_ws"
4047 fi
4048 if test -n "$sparc_cpu"; then
4049     echo "Target Sparc Arch $sparc_cpu"
4050 fi
4051 echo "xen support       $xen"
4052 echo "brlapi support    $brlapi"
4053 echo "bluez  support    $bluez"
4054 echo "Documentation     $docs"
4055 [ ! -z "$uname_release" ] && \
4056 echo "uname -r          $uname_release"
4057 echo "GUEST_BASE        $guest_base"
4058 echo "PIE               $pie"
4059 echo "vde support       $vde"
4060 echo "netmap support    $netmap"
4061 echo "Linux AIO support $linux_aio"
4062 echo "ATTR/XATTR support $attr"
4063 echo "Install blobs     $blobs"
4064 echo "KVM support       $kvm"
4065 echo "RDMA support      $rdma"
4066 echo "TCG interpreter   $tcg_interpreter"
4067 echo "fdt support       $fdt"
4068 echo "preadv support    $preadv"
4069 echo "fdatasync         $fdatasync"
4070 echo "madvise           $madvise"
4071 echo "posix_madvise     $posix_madvise"
4072 echo "sigev_thread_id   $sigev_thread_id"
4073 echo "uuid support      $uuid"
4074 echo "libcap-ng support $cap_ng"
4075 echo "vhost-net support $vhost_net"
4076 echo "vhost-scsi support $vhost_scsi"
4077 echo "Trace backend     $trace_backend"
4078 echo "Trace output file $trace_file-<pid>"
4079 echo "spice support     $spice ($spice_protocol_version/$spice_server_version)"
4080 echo "rbd support       $rbd"
4081 echo "xfsctl support    $xfs"
4082 echo "nss used          $smartcard_nss"
4083 echo "libusb            $libusb"
4084 echo "usb net redir     $usb_redir"
4085 echo "GLX support       $glx"
4086 if test "$libiscsi_version" = "1.4.0"; then
4087 echo "libiscsi support  $libiscsi (1.4.0)"
4088 else
4089 echo "libiscsi support  $libiscsi"
4090 fi
4091 echo "libnfs support    $libnfs"
4092 echo "build guest agent $guest_agent"
4093 echo "QGA VSS support   $guest_agent_with_vss"
4094 echo "seccomp support   $seccomp"
4095 echo "coroutine backend $coroutine"
4096 echo "coroutine pool    $coroutine_pool"
4097 echo "GlusterFS support $glusterfs"
4098 echo "virtio-blk-data-plane $virtio_blk_data_plane"
4099 echo "gcov              $gcov_tool"
4100 echo "gcov enabled      $gcov"
4101 echo "TPM support       $tpm"
4102 echo "libssh2 support   $libssh2"
4103 echo "TPM passthrough   $tpm_passthrough"
4104 echo "QOM debugging     $qom_cast_debug"
4105 echo "vhdx              $vhdx"
4106 echo "Quorum            $quorum"
4107 echo "lzo support       $lzo"
4108 echo "snappy support    $snappy"
4109
4110 if test "$sdl_too_old" = "yes"; then
4111 echo "-> Your SDL version is too old - please upgrade to have SDL support"
4112 fi
4113
4114 config_host_mak="config-host.mak"
4115
4116 echo "# Automatically generated by configure - do not modify" >config-all-disas.mak
4117
4118 echo "# Automatically generated by configure - do not modify" > $config_host_mak
4119 echo >> $config_host_mak
4120
4121 echo all: >> $config_host_mak
4122 echo "prefix=$prefix" >> $config_host_mak
4123 echo "bindir=$bindir" >> $config_host_mak
4124 echo "libdir=$libdir" >> $config_host_mak
4125 echo "libexecdir=$libexecdir" >> $config_host_mak
4126 echo "includedir=$includedir" >> $config_host_mak
4127 echo "mandir=$mandir" >> $config_host_mak
4128 echo "sysconfdir=$sysconfdir" >> $config_host_mak
4129 echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
4130 echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
4131 echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
4132 echo "qemu_moddir=$qemu_moddir" >> $config_host_mak
4133 if test "$mingw32" = "no" ; then
4134   echo "qemu_localstatedir=$local_statedir" >> $config_host_mak
4135 fi
4136 echo "qemu_helperdir=$libexecdir" >> $config_host_mak
4137 echo "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak
4138 echo "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak
4139 echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
4140 echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
4141
4142 echo "ARCH=$ARCH" >> $config_host_mak
4143
4144 if test "$debug_tcg" = "yes" ; then
4145   echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
4146 fi
4147 if test "$strip_opt" = "yes" ; then
4148   echo "STRIP=${strip}" >> $config_host_mak
4149 fi
4150 if test "$bigendian" = "yes" ; then
4151   echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
4152 fi
4153 if test "$mingw32" = "yes" ; then
4154   echo "CONFIG_WIN32=y" >> $config_host_mak
4155   rc_version=`cat $source_path/VERSION`
4156   version_major=${rc_version%%.*}
4157   rc_version=${rc_version#*.}
4158   version_minor=${rc_version%%.*}
4159   rc_version=${rc_version#*.}
4160   version_subminor=${rc_version%%.*}
4161   version_micro=0
4162   echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
4163   echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
4164   if test "$guest_agent_with_vss" = "yes" ; then
4165     echo "CONFIG_QGA_VSS=y" >> $config_host_mak
4166     echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak
4167   fi
4168 else
4169   echo "CONFIG_POSIX=y" >> $config_host_mak
4170 fi
4171
4172 if test "$linux" = "yes" ; then
4173   echo "CONFIG_LINUX=y" >> $config_host_mak
4174 fi
4175
4176 if test "$darwin" = "yes" ; then
4177   echo "CONFIG_DARWIN=y" >> $config_host_mak
4178 fi
4179
4180 if test "$aix" = "yes" ; then
4181   echo "CONFIG_AIX=y" >> $config_host_mak
4182 fi
4183
4184 if test "$solaris" = "yes" ; then
4185   echo "CONFIG_SOLARIS=y" >> $config_host_mak
4186   echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
4187   if test "$needs_libsunmath" = "yes" ; then
4188     echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
4189   fi
4190 fi
4191 if test "$haiku" = "yes" ; then
4192   echo "CONFIG_HAIKU=y" >> $config_host_mak
4193 fi
4194 if test "$static" = "yes" ; then
4195   echo "CONFIG_STATIC=y" >> $config_host_mak
4196 fi
4197 if test "$profiler" = "yes" ; then
4198   echo "CONFIG_PROFILER=y" >> $config_host_mak
4199 fi
4200 if test "$slirp" = "yes" ; then
4201   echo "CONFIG_SLIRP=y" >> $config_host_mak
4202   echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
4203 fi
4204 if test "$vde" = "yes" ; then
4205   echo "CONFIG_VDE=y" >> $config_host_mak
4206 fi
4207 if test "$netmap" = "yes" ; then
4208   echo "CONFIG_NETMAP=y" >> $config_host_mak
4209 fi
4210 if test "$cap_ng" = "yes" ; then
4211   echo "CONFIG_LIBCAP=y" >> $config_host_mak
4212 fi
4213 echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
4214 for drv in $audio_drv_list; do
4215     def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'`
4216     echo "$def=y" >> $config_host_mak
4217     if test "$drv" = "fmod"; then
4218         echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
4219     fi
4220 done
4221 if test "$audio_pt_int" = "yes" ; then
4222   echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
4223 fi
4224 if test "$audio_win_int" = "yes" ; then
4225   echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
4226 fi
4227 echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
4228 echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
4229 if test "$vnc" = "yes" ; then
4230   echo "CONFIG_VNC=y" >> $config_host_mak
4231 fi
4232 if test "$vnc_tls" = "yes" ; then
4233   echo "CONFIG_VNC_TLS=y" >> $config_host_mak
4234 fi
4235 if test "$vnc_sasl" = "yes" ; then
4236   echo "CONFIG_VNC_SASL=y" >> $config_host_mak
4237 fi
4238 if test "$vnc_jpeg" = "yes" ; then
4239   echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
4240 fi
4241 if test "$vnc_png" = "yes" ; then
4242   echo "CONFIG_VNC_PNG=y" >> $config_host_mak
4243 fi
4244 if test "$vnc_ws" = "yes" ; then
4245   echo "CONFIG_VNC_WS=y" >> $config_host_mak
4246   echo "VNC_WS_CFLAGS=$vnc_ws_cflags" >> $config_host_mak
4247 fi
4248 if test "$fnmatch" = "yes" ; then
4249   echo "CONFIG_FNMATCH=y" >> $config_host_mak
4250 fi
4251 if test "$uuid" = "yes" ; then
4252   echo "CONFIG_UUID=y" >> $config_host_mak
4253 fi
4254 if test "$xfs" = "yes" ; then
4255   echo "CONFIG_XFS=y" >> $config_host_mak
4256 fi
4257 qemu_version=`head $source_path/VERSION`
4258 echo "VERSION=$qemu_version" >>$config_host_mak
4259 echo "PKGVERSION=$pkgversion" >>$config_host_mak
4260 echo "SRC_PATH=$source_path" >> $config_host_mak
4261 echo "TARGET_DIRS=$target_list" >> $config_host_mak
4262 if [ "$docs" = "yes" ] ; then
4263   echo "BUILD_DOCS=yes" >> $config_host_mak
4264 fi
4265 if test "$modules" = "yes"; then
4266   # $shacmd can generate a hash started with digit, which the compiler doesn't
4267   # like as an symbol. So prefix it with an underscore
4268   echo "CONFIG_STAMP=_`(echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ `" >> $config_host_mak
4269   echo "CONFIG_MODULES=y" >> $config_host_mak
4270 fi
4271 if test "$sdl" = "yes" ; then
4272   echo "CONFIG_SDL=y" >> $config_host_mak
4273   echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
4274 fi
4275 if test "$cocoa" = "yes" ; then
4276   echo "CONFIG_COCOA=y" >> $config_host_mak
4277 fi
4278 if test "$curses" = "yes" ; then
4279   echo "CONFIG_CURSES=y" >> $config_host_mak
4280 fi
4281 if test "$utimens" = "yes" ; then
4282   echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
4283 fi
4284 if test "$pipe2" = "yes" ; then
4285   echo "CONFIG_PIPE2=y" >> $config_host_mak
4286 fi
4287 if test "$accept4" = "yes" ; then
4288   echo "CONFIG_ACCEPT4=y" >> $config_host_mak
4289 fi
4290 if test "$splice" = "yes" ; then
4291   echo "CONFIG_SPLICE=y" >> $config_host_mak
4292 fi
4293 if test "$eventfd" = "yes" ; then
4294   echo "CONFIG_EVENTFD=y" >> $config_host_mak
4295 fi
4296 if test "$fallocate" = "yes" ; then
4297   echo "CONFIG_FALLOCATE=y" >> $config_host_mak
4298 fi
4299 if test "$fallocate_punch_hole" = "yes" ; then
4300   echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak
4301 fi
4302 if test "$sync_file_range" = "yes" ; then
4303   echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
4304 fi
4305 if test "$fiemap" = "yes" ; then
4306   echo "CONFIG_FIEMAP=y" >> $config_host_mak
4307 fi
4308 if test "$dup3" = "yes" ; then
4309   echo "CONFIG_DUP3=y" >> $config_host_mak
4310 fi
4311 if test "$ppoll" = "yes" ; then
4312   echo "CONFIG_PPOLL=y" >> $config_host_mak
4313 fi
4314 if test "$prctl_pr_set_timerslack" = "yes" ; then
4315   echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak
4316 fi
4317 if test "$epoll" = "yes" ; then
4318   echo "CONFIG_EPOLL=y" >> $config_host_mak
4319 fi
4320 if test "$epoll_create1" = "yes" ; then
4321   echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
4322 fi
4323 if test "$epoll_pwait" = "yes" ; then
4324   echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
4325 fi
4326 if test "$sendfile" = "yes" ; then
4327   echo "CONFIG_SENDFILE=y" >> $config_host_mak
4328 fi
4329 if test "$inotify" = "yes" ; then
4330   echo "CONFIG_INOTIFY=y" >> $config_host_mak
4331 fi
4332 if test "$inotify1" = "yes" ; then
4333   echo "CONFIG_INOTIFY1=y" >> $config_host_mak
4334 fi
4335 if test "$byteswap_h" = "yes" ; then
4336   echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
4337 fi
4338 if test "$bswap_h" = "yes" ; then
4339   echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
4340 fi
4341 if test "$curl" = "yes" ; then
4342   echo "CONFIG_CURL=m" >> $config_host_mak
4343   echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
4344   echo "CURL_LIBS=$curl_libs" >> $config_host_mak
4345 fi
4346 if test "$brlapi" = "yes" ; then
4347   echo "CONFIG_BRLAPI=y" >> $config_host_mak
4348 fi
4349 if test "$bluez" = "yes" ; then
4350   echo "CONFIG_BLUEZ=y" >> $config_host_mak
4351   echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
4352 fi
4353 echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
4354 if test "$gtk" = "yes" ; then
4355   echo "CONFIG_GTK=y" >> $config_host_mak
4356   echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
4357   echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
4358 fi
4359 if test "$xen" = "yes" ; then
4360   echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
4361   echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
4362 fi
4363 if test "$linux_aio" = "yes" ; then
4364   echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
4365 fi
4366 if test "$attr" = "yes" ; then
4367   echo "CONFIG_ATTR=y" >> $config_host_mak
4368 fi
4369 if test "$libattr" = "yes" ; then
4370   echo "CONFIG_LIBATTR=y" >> $config_host_mak
4371 fi
4372 if test "$virtfs" = "yes" ; then
4373   echo "CONFIG_VIRTFS=y" >> $config_host_mak
4374 fi
4375 if test "$vhost_scsi" = "yes" ; then
4376   echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
4377 fi
4378 if test "$blobs" = "yes" ; then
4379   echo "INSTALL_BLOBS=yes" >> $config_host_mak
4380 fi
4381 if test "$iovec" = "yes" ; then
4382   echo "CONFIG_IOVEC=y" >> $config_host_mak
4383 fi
4384 if test "$preadv" = "yes" ; then
4385   echo "CONFIG_PREADV=y" >> $config_host_mak
4386 fi
4387 if test "$fdt" = "yes" ; then
4388   echo "CONFIG_FDT=y" >> $config_host_mak
4389 fi
4390 if test "$signalfd" = "yes" ; then
4391   echo "CONFIG_SIGNALFD=y" >> $config_host_mak
4392 fi
4393 if test "$tcg_interpreter" = "yes" ; then
4394   echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
4395 fi
4396 if test "$fdatasync" = "yes" ; then
4397   echo "CONFIG_FDATASYNC=y" >> $config_host_mak
4398 fi
4399 if test "$madvise" = "yes" ; then
4400   echo "CONFIG_MADVISE=y" >> $config_host_mak
4401 fi
4402 if test "$posix_madvise" = "yes" ; then
4403   echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
4404 fi
4405 if test "$sigev_thread_id" = "yes" ; then
4406   echo "CONFIG_SIGEV_THREAD_ID=y" >> $config_host_mak
4407 fi
4408
4409 if test "$spice" = "yes" ; then
4410   echo "CONFIG_SPICE=y" >> $config_host_mak
4411 fi
4412
4413 if test "$smartcard_nss" = "yes" ; then
4414   echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
4415   echo "libcacard_libs=$libcacard_libs" >> $config_host_mak
4416   echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
4417 fi
4418
4419 if test "$libusb" = "yes" ; then
4420   echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak
4421 fi
4422
4423 if test "$usb_redir" = "yes" ; then
4424   echo "CONFIG_USB_REDIR=y" >> $config_host_mak
4425 fi
4426
4427 if test "$glx" = "yes" ; then
4428   echo "CONFIG_GLX=y" >> $config_host_mak
4429   echo "GLX_LIBS=$glx_libs" >> $config_host_mak
4430 fi
4431
4432 if test "$lzo" = "yes" ; then
4433   echo "CONFIG_LZO=y" >> $config_host_mak
4434 fi
4435
4436 if test "$snappy" = "yes" ; then
4437   echo "CONFIG_SNAPPY=y" >> $config_host_mak
4438 fi
4439
4440 if test "$libiscsi" = "yes" ; then
4441   echo "CONFIG_LIBISCSI=m" >> $config_host_mak
4442   if test "$libiscsi_version" = "1.4.0"; then
4443     echo "CONFIG_LIBISCSI_1_4=y" >> $config_host_mak
4444   fi
4445   echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
4446   echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
4447 fi
4448
4449 if test "$libnfs" = "yes" ; then
4450   echo "CONFIG_LIBNFS=y" >> $config_host_mak
4451 fi
4452
4453 if test "$seccomp" = "yes"; then
4454   echo "CONFIG_SECCOMP=y" >> $config_host_mak
4455 fi
4456
4457 # XXX: suppress that
4458 if [ "$bsd" = "yes" ] ; then
4459   echo "CONFIG_BSD=y" >> $config_host_mak
4460 fi
4461
4462 echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
4463
4464 if test "$zero_malloc" = "yes" ; then
4465   echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
4466 fi
4467 if test "$qom_cast_debug" = "yes" ; then
4468   echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
4469 fi
4470 if test "$rbd" = "yes" ; then
4471   echo "CONFIG_RBD=m" >> $config_host_mak
4472   echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak
4473   echo "RBD_LIBS=$rbd_libs" >> $config_host_mak
4474 fi
4475
4476 echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
4477 if test "$coroutine_pool" = "yes" ; then
4478   echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
4479 else
4480   echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak
4481 fi
4482
4483 if test "$open_by_handle_at" = "yes" ; then
4484   echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
4485 fi
4486
4487 if test "$linux_magic_h" = "yes" ; then
4488   echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
4489 fi
4490
4491 if test "$pragma_diagnostic_available" = "yes" ; then
4492   echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
4493 fi
4494
4495 if test "$valgrind_h" = "yes" ; then
4496   echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
4497 fi
4498
4499 if test "$has_environ" = "yes" ; then
4500   echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
4501 fi
4502
4503 if test "$cpuid_h" = "yes" ; then
4504   echo "CONFIG_CPUID_H=y" >> $config_host_mak
4505 fi
4506
4507 if test "$int128" = "yes" ; then
4508   echo "CONFIG_INT128=y" >> $config_host_mak
4509 fi
4510
4511 if test "$getauxval" = "yes" ; then
4512   echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
4513 fi
4514
4515 if test "$glusterfs" = "yes" ; then
4516   echo "CONFIG_GLUSTERFS=m" >> $config_host_mak
4517   echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak
4518   echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak
4519 fi
4520
4521 if test "$glusterfs_discard" = "yes" ; then
4522   echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
4523 fi
4524
4525 if test "$glusterfs_zerofill" = "yes" ; then
4526   echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak
4527 fi
4528
4529 if test "$libssh2" = "yes" ; then
4530   echo "CONFIG_LIBSSH2=m" >> $config_host_mak
4531   echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak
4532   echo "LIBSSH2_LIBS=$libssh2_libs" >> $config_host_mak
4533 fi
4534
4535 if test "$quorum" = "yes" ; then
4536   echo "CONFIG_QUORUM=y" >> $config_host_mak
4537 fi
4538
4539 if test "$virtio_blk_data_plane" = "yes" ; then
4540   echo 'CONFIG_VIRTIO_BLK_DATA_PLANE=$(CONFIG_VIRTIO)' >> $config_host_mak
4541 fi
4542
4543 if test "$vhdx" = "yes" ; then
4544   echo "CONFIG_VHDX=y" >> $config_host_mak
4545 fi
4546
4547 # USB host support
4548 if test "$libusb" = "yes"; then
4549   echo "HOST_USB=libusb legacy" >> $config_host_mak
4550 else
4551   echo "HOST_USB=stub" >> $config_host_mak
4552 fi
4553
4554 # TPM passthrough support?
4555 if test "$tpm" = "yes"; then
4556   echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak
4557   if test "$tpm_passthrough" = "yes"; then
4558     echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak
4559   fi
4560 fi
4561
4562 # use default implementation for tracing backend-specific routines
4563 trace_default=yes
4564 echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
4565 if test "$trace_backend" = "nop"; then
4566   echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
4567 fi
4568 if test "$trace_backend" = "simple"; then
4569   echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
4570   trace_default=no
4571   # Set the appropriate trace file.
4572   trace_file="\"$trace_file-\" FMT_pid"
4573 fi
4574 if test "$trace_backend" = "stderr"; then
4575   echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
4576   trace_default=no
4577 fi
4578 if test "$trace_backend" = "ust"; then
4579   echo "CONFIG_TRACE_UST=y" >> $config_host_mak
4580 fi
4581 if test "$trace_backend" = "dtrace"; then
4582   echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
4583   if test "$trace_backend_stap" = "yes" ; then
4584     echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
4585   fi
4586 fi
4587 if test "$trace_backend" = "ftrace"; then
4588   if test "$linux" = "yes" ; then
4589     echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak
4590     trace_default=no
4591   else
4592     feature_not_found "ftrace(trace backend)" "ftrace requires Linux"
4593   fi
4594 fi
4595 echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
4596 if test "$trace_default" = "yes"; then
4597   echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
4598 fi
4599
4600 if test "$rdma" = "yes" ; then
4601   echo "CONFIG_RDMA=y" >> $config_host_mak
4602 fi
4603
4604 if test "$tcg_interpreter" = "yes"; then
4605   QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
4606 elif test "$ARCH" = "sparc64" ; then
4607   QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES"
4608 elif test "$ARCH" = "s390x" ; then
4609   QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES"
4610 elif test "$ARCH" = "x86_64" -o "$ARCH" = "x32" ; then
4611   QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES"
4612 else
4613   QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES"
4614 fi
4615 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg $QEMU_INCLUDES"
4616
4617 echo "TOOLS=$tools" >> $config_host_mak
4618 echo "ROMS=$roms" >> $config_host_mak
4619 echo "MAKE=$make" >> $config_host_mak
4620 echo "INSTALL=$install" >> $config_host_mak
4621 echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
4622 echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
4623 if test -n "$libtool"; then
4624   echo "INSTALL_PROG=\$(LIBTOOL) --mode=install $install -c -m 0755" >> $config_host_mak
4625   echo "INSTALL_LIB=\$(LIBTOOL) --mode=install $install -c -m 0644" >> $config_host_mak
4626 else
4627   echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
4628   echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
4629 fi
4630 echo "PYTHON=$python" >> $config_host_mak
4631 echo "CC=$cc" >> $config_host_mak
4632 if $iasl -h > /dev/null 2>&1; then
4633   echo "IASL=$iasl" >> $config_host_mak
4634 fi
4635 echo "CC_I386=$cc_i386" >> $config_host_mak
4636 echo "HOST_CC=$host_cc" >> $config_host_mak
4637 echo "CXX=$cxx" >> $config_host_mak
4638 echo "OBJCC=$objcc" >> $config_host_mak
4639 echo "AR=$ar" >> $config_host_mak
4640 echo "ARFLAGS=$ARFLAGS" >> $config_host_mak
4641 echo "AS=$as" >> $config_host_mak
4642 echo "CPP=$cpp" >> $config_host_mak
4643 echo "OBJCOPY=$objcopy" >> $config_host_mak
4644 echo "LD=$ld" >> $config_host_mak
4645 echo "WINDRES=$windres" >> $config_host_mak
4646 echo "LIBTOOL=$libtool" >> $config_host_mak
4647 echo "CFLAGS=$CFLAGS" >> $config_host_mak
4648 echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
4649 echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
4650 echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
4651 if test "$sparse" = "yes" ; then
4652   echo "CC           := REAL_CC=\"\$(CC)\" cgcc"       >> $config_host_mak
4653   echo "HOST_CC      := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_host_mak
4654   echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
4655 fi
4656 if test "$cross_prefix" != ""; then
4657   echo "AUTOCONF_HOST := --host=${cross_prefix%-}"     >> $config_host_mak
4658 else
4659   echo "AUTOCONF_HOST := "                             >> $config_host_mak
4660 fi
4661 echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
4662 echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
4663 echo "LIBTOOLFLAGS=$LIBTOOLFLAGS" >> $config_host_mak
4664 echo "LIBS+=$LIBS" >> $config_host_mak
4665 echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
4666 echo "EXESUF=$EXESUF" >> $config_host_mak
4667 echo "DSOSUF=$DSOSUF" >> $config_host_mak
4668 echo "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak
4669 echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
4670 echo "POD2MAN=$POD2MAN" >> $config_host_mak
4671 echo "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak
4672 if test "$gcov" = "yes" ; then
4673   echo "CONFIG_GCOV=y" >> $config_host_mak
4674   echo "GCOV=$gcov_tool" >> $config_host_mak
4675 fi
4676
4677 # use included Linux headers
4678 if test "$linux" = "yes" ; then
4679   mkdir -p linux-headers
4680   case "$cpu" in
4681   i386|x86_64|x32)
4682     linux_arch=x86
4683     ;;
4684   ppcemb|ppc|ppc64)
4685     linux_arch=powerpc
4686     ;;
4687   s390x)
4688     linux_arch=s390
4689     ;;
4690   aarch64)
4691     linux_arch=arm64
4692     ;;
4693   *)
4694     # For most CPUs the kernel architecture name and QEMU CPU name match.
4695     linux_arch="$cpu"
4696     ;;
4697   esac
4698     # For non-KVM architectures we will not have asm headers
4699     if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
4700       symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
4701     fi
4702 fi
4703
4704 for target in $target_list; do
4705 target_dir="$target"
4706 config_target_mak=$target_dir/config-target.mak
4707 target_name=`echo $target | cut -d '-' -f 1`
4708 target_bigendian="no"
4709
4710 case "$target_name" in
4711   armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or32|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
4712   target_bigendian=yes
4713   ;;
4714 esac
4715 target_softmmu="no"
4716 target_user_only="no"
4717 target_linux_user="no"
4718 target_bsd_user="no"
4719 case "$target" in
4720   ${target_name}-softmmu)
4721     target_softmmu="yes"
4722     ;;
4723   ${target_name}-linux-user)
4724     if test "$linux" != "yes" ; then
4725       error_exit "Target '$target' is only available on a Linux host"
4726     fi
4727     target_user_only="yes"
4728     target_linux_user="yes"
4729     ;;
4730   ${target_name}-bsd-user)
4731     if test "$bsd" != "yes" ; then
4732       error_exit "Target '$target' is only available on a BSD host"
4733     fi
4734     target_user_only="yes"
4735     target_bsd_user="yes"
4736     ;;
4737   *)
4738     error_exit "Target '$target' not recognised"
4739     exit 1
4740     ;;
4741 esac
4742
4743 mkdir -p $target_dir
4744 echo "# Automatically generated by configure - do not modify" > $config_target_mak
4745
4746 bflt="no"
4747 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_name/g"`
4748 gdb_xml_files=""
4749
4750 TARGET_ARCH="$target_name"
4751 TARGET_BASE_ARCH=""
4752 TARGET_ABI_DIR=""
4753
4754 case "$target_name" in
4755   i386)
4756   ;;
4757   x86_64)
4758     TARGET_BASE_ARCH=i386
4759   ;;
4760   alpha)
4761   ;;
4762   arm|armeb)
4763     TARGET_ARCH=arm
4764     bflt="yes"
4765     gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
4766   ;;
4767   aarch64)
4768     TARGET_BASE_ARCH=arm
4769     bflt="yes"
4770     gdb_xml_files="aarch64-core.xml aarch64-fpu.xml"
4771   ;;
4772   cris)
4773   ;;
4774   lm32)
4775   ;;
4776   m68k)
4777     bflt="yes"
4778     gdb_xml_files="cf-core.xml cf-fp.xml"
4779   ;;
4780   microblaze|microblazeel)
4781     TARGET_ARCH=microblaze
4782     bflt="yes"
4783   ;;
4784   mips|mipsel)
4785     TARGET_ARCH=mips
4786     echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
4787   ;;
4788   mipsn32|mipsn32el)
4789     TARGET_ARCH=mips64
4790     TARGET_BASE_ARCH=mips
4791     echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
4792     echo "TARGET_ABI32=y" >> $config_target_mak
4793   ;;
4794   mips64|mips64el)
4795     TARGET_ARCH=mips64
4796     TARGET_BASE_ARCH=mips
4797     echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
4798   ;;
4799   moxie)
4800   ;;
4801   or32)
4802     TARGET_ARCH=openrisc
4803     TARGET_BASE_ARCH=openrisc
4804   ;;
4805   ppc)
4806     gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
4807   ;;
4808   ppcemb)
4809     TARGET_BASE_ARCH=ppc
4810     TARGET_ABI_DIR=ppc
4811     gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
4812   ;;
4813   ppc64)
4814     TARGET_BASE_ARCH=ppc
4815     TARGET_ABI_DIR=ppc
4816     gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
4817   ;;
4818   ppc64abi32)
4819     TARGET_ARCH=ppc64
4820     TARGET_BASE_ARCH=ppc
4821     TARGET_ABI_DIR=ppc
4822     echo "TARGET_ABI32=y" >> $config_target_mak
4823     gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
4824   ;;
4825   sh4|sh4eb)
4826     TARGET_ARCH=sh4
4827     bflt="yes"
4828   ;;
4829   sparc)
4830   ;;
4831   sparc64)
4832     TARGET_BASE_ARCH=sparc
4833   ;;
4834   sparc32plus)
4835     TARGET_ARCH=sparc64
4836     TARGET_BASE_ARCH=sparc
4837     TARGET_ABI_DIR=sparc
4838     echo "TARGET_ABI32=y" >> $config_target_mak
4839   ;;
4840   s390x)
4841   ;;
4842   unicore32)
4843   ;;
4844   xtensa|xtensaeb)
4845     TARGET_ARCH=xtensa
4846   ;;
4847   *)
4848     error_exit "Unsupported target CPU"
4849   ;;
4850 esac
4851 # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
4852 if [ "$TARGET_BASE_ARCH" = "" ]; then
4853   TARGET_BASE_ARCH=$TARGET_ARCH
4854 fi
4855
4856 symlink "$source_path/Makefile.target" "$target_dir/Makefile"
4857
4858 upper() {
4859     echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
4860 }
4861
4862 target_arch_name="`upper $TARGET_ARCH`"
4863 echo "TARGET_$target_arch_name=y" >> $config_target_mak
4864 echo "TARGET_NAME=$target_name" >> $config_target_mak
4865 echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
4866 if [ "$TARGET_ABI_DIR" = "" ]; then
4867   TARGET_ABI_DIR=$TARGET_ARCH
4868 fi
4869 echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
4870 case "$target_name" in
4871   i386|x86_64)
4872     if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
4873       echo "CONFIG_XEN=y" >> $config_target_mak
4874       if test "$xen_pci_passthrough" = yes; then
4875         echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
4876       fi
4877     fi
4878     ;;
4879   *)
4880 esac
4881 case "$target_name" in
4882   aarch64|arm|i386|x86_64|ppcemb|ppc|ppc64|s390x)
4883     # Make sure the target and host cpus are compatible
4884     if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
4885       \( "$target_name" = "$cpu" -o \
4886       \( "$target_name" = "ppcemb" -a "$cpu" = "ppc" \) -o \
4887       \( "$target_name" = "ppc64"  -a "$cpu" = "ppc" \) -o \
4888       \( "$target_name" = "ppc"    -a "$cpu" = "ppc64" \) -o \
4889       \( "$target_name" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
4890       \( "$target_name" = "x86_64" -a "$cpu" = "i386"   \) -o \
4891       \( "$target_name" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
4892       echo "CONFIG_KVM=y" >> $config_target_mak
4893       if test "$vhost_net" = "yes" ; then
4894         echo "CONFIG_VHOST_NET=y" >> $config_target_mak
4895       fi
4896     fi
4897 esac
4898 if test "$target_bigendian" = "yes" ; then
4899   echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
4900 fi
4901 if test "$target_softmmu" = "yes" ; then
4902   echo "CONFIG_SOFTMMU=y" >> $config_target_mak
4903 fi
4904 if test "$target_user_only" = "yes" ; then
4905   echo "CONFIG_USER_ONLY=y" >> $config_target_mak
4906   echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
4907 fi
4908 if test "$target_linux_user" = "yes" ; then
4909   echo "CONFIG_LINUX_USER=y" >> $config_target_mak
4910 fi
4911 list=""
4912 if test ! -z "$gdb_xml_files" ; then
4913   for x in $gdb_xml_files; do
4914     list="$list $source_path/gdb-xml/$x"
4915   done
4916   echo "TARGET_XML_FILES=$list" >> $config_target_mak
4917 fi
4918
4919 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
4920   echo "TARGET_HAS_BFLT=y" >> $config_target_mak
4921 fi
4922 if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
4923   echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
4924 fi
4925 if test "$target_bsd_user" = "yes" ; then
4926   echo "CONFIG_BSD_USER=y" >> $config_target_mak
4927 fi
4928
4929 # generate QEMU_CFLAGS/LDFLAGS for targets
4930
4931 cflags=""
4932 ldflags=""
4933
4934 for i in $ARCH $TARGET_BASE_ARCH ; do
4935   case "$i" in
4936   alpha)
4937     echo "CONFIG_ALPHA_DIS=y"  >> $config_target_mak
4938     echo "CONFIG_ALPHA_DIS=y"  >> config-all-disas.mak
4939   ;;
4940   arm)
4941     echo "CONFIG_ARM_DIS=y"  >> $config_target_mak
4942     echo "CONFIG_ARM_DIS=y"  >> config-all-disas.mak
4943     if test -n "${cxx}"; then
4944       echo "CONFIG_ARM_A64_DIS=y"  >> $config_target_mak
4945       echo "CONFIG_ARM_A64_DIS=y"  >> config-all-disas.mak
4946     fi
4947   ;;
4948   cris)
4949     echo "CONFIG_CRIS_DIS=y"  >> $config_target_mak
4950     echo "CONFIG_CRIS_DIS=y"  >> config-all-disas.mak
4951   ;;
4952   hppa)
4953     echo "CONFIG_HPPA_DIS=y"  >> $config_target_mak
4954     echo "CONFIG_HPPA_DIS=y"  >> config-all-disas.mak
4955   ;;
4956   i386|x86_64|x32)
4957     echo "CONFIG_I386_DIS=y"  >> $config_target_mak
4958     echo "CONFIG_I386_DIS=y"  >> config-all-disas.mak
4959   ;;
4960   ia64*)
4961     echo "CONFIG_IA64_DIS=y"  >> $config_target_mak
4962     echo "CONFIG_IA64_DIS=y"  >> config-all-disas.mak
4963   ;;
4964   lm32)
4965     echo "CONFIG_LM32_DIS=y"  >> $config_target_mak
4966     echo "CONFIG_LM32_DIS=y"  >> config-all-disas.mak
4967   ;;
4968   m68k)
4969     echo "CONFIG_M68K_DIS=y"  >> $config_target_mak
4970     echo "CONFIG_M68K_DIS=y"  >> config-all-disas.mak
4971   ;;
4972   microblaze*)
4973     echo "CONFIG_MICROBLAZE_DIS=y"  >> $config_target_mak
4974     echo "CONFIG_MICROBLAZE_DIS=y"  >> config-all-disas.mak
4975   ;;
4976   mips*)
4977     echo "CONFIG_MIPS_DIS=y"  >> $config_target_mak
4978     echo "CONFIG_MIPS_DIS=y"  >> config-all-disas.mak
4979   ;;
4980   moxie*)
4981     echo "CONFIG_MOXIE_DIS=y"  >> $config_target_mak
4982     echo "CONFIG_MOXIE_DIS=y"  >> config-all-disas.mak
4983   ;;
4984   or32)
4985     echo "CONFIG_OPENRISC_DIS=y"  >> $config_target_mak
4986     echo "CONFIG_OPENRISC_DIS=y"  >> config-all-disas.mak
4987   ;;
4988   ppc*)
4989     echo "CONFIG_PPC_DIS=y"  >> $config_target_mak
4990     echo "CONFIG_PPC_DIS=y"  >> config-all-disas.mak
4991   ;;
4992   s390*)
4993     echo "CONFIG_S390_DIS=y"  >> $config_target_mak
4994     echo "CONFIG_S390_DIS=y"  >> config-all-disas.mak
4995   ;;
4996   sh4)
4997     echo "CONFIG_SH4_DIS=y"  >> $config_target_mak
4998     echo "CONFIG_SH4_DIS=y"  >> config-all-disas.mak
4999   ;;
5000   sparc*)
5001     echo "CONFIG_SPARC_DIS=y"  >> $config_target_mak
5002     echo "CONFIG_SPARC_DIS=y"  >> config-all-disas.mak
5003   ;;
5004   xtensa*)
5005     echo "CONFIG_XTENSA_DIS=y"  >> $config_target_mak
5006     echo "CONFIG_XTENSA_DIS=y"  >> config-all-disas.mak
5007   ;;
5008   esac
5009 done
5010 if test "$tcg_interpreter" = "yes" ; then
5011   echo "CONFIG_TCI_DIS=y"  >> $config_target_mak
5012   echo "CONFIG_TCI_DIS=y"  >> config-all-disas.mak
5013 fi
5014
5015 case "$ARCH" in
5016 alpha)
5017   # Ensure there's only a single GP
5018   cflags="-msmall-data $cflags"
5019 ;;
5020 esac
5021
5022 if test "$gprof" = "yes" ; then
5023   echo "TARGET_GPROF=yes" >> $config_target_mak
5024   if test "$target_linux_user" = "yes" ; then
5025     cflags="-p $cflags"
5026     ldflags="-p $ldflags"
5027   fi
5028   if test "$target_softmmu" = "yes" ; then
5029     ldflags="-p $ldflags"
5030     echo "GPROF_CFLAGS=-p" >> $config_target_mak
5031   fi
5032 fi
5033
5034 if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
5035   ldflags="$ldflags $textseg_ldflags"
5036 fi
5037
5038 echo "LDFLAGS+=$ldflags" >> $config_target_mak
5039 echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
5040
5041 done # for target in $targets
5042
5043 if [ "$pixman" = "internal" ]; then
5044   echo "config-host.h: subdir-pixman" >> $config_host_mak
5045 fi
5046
5047 if test "$rdma" = "yes" ; then
5048 echo "CONFIG_RDMA=y" >> $config_host_mak
5049 fi
5050
5051 if [ "$dtc_internal" = "yes" ]; then
5052   echo "config-host.h: subdir-dtc" >> $config_host_mak
5053 fi
5054
5055 # build tree in object directory in case the source is not in the current directory
5056 DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests"
5057 DIRS="$DIRS fsdev"
5058 DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
5059 DIRS="$DIRS roms/seabios roms/vgabios"
5060 DIRS="$DIRS qapi-generated"
5061 FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
5062 FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
5063 FILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile"
5064 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
5065 FILES="$FILES pc-bios/spapr-rtas/Makefile"
5066 FILES="$FILES pc-bios/s390-ccw/Makefile"
5067 FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
5068 FILES="$FILES pc-bios/qemu-icon.bmp"
5069 for bios_file in \
5070     $source_path/pc-bios/*.bin \
5071     $source_path/pc-bios/*.aml \
5072     $source_path/pc-bios/*.rom \
5073     $source_path/pc-bios/*.dtb \
5074     $source_path/pc-bios/*.img \
5075     $source_path/pc-bios/openbios-* \
5076     $source_path/pc-bios/palcode-*
5077 do
5078     FILES="$FILES pc-bios/`basename $bios_file`"
5079 done
5080 for test_file in `find $source_path/tests/acpi-test-data -type f`
5081 do
5082     FILES="$FILES tests/acpi-test-data`echo $test_file | sed -e 's/.*acpi-test-data//'`"
5083 done
5084 mkdir -p $DIRS
5085 for f in $FILES ; do
5086     if [ -e "$source_path/$f" ] && [ "$source_path" != `pwd` ]; then
5087         symlink "$source_path/$f" "$f"
5088     fi
5089 done
5090
5091 # temporary config to build submodules
5092 for rom in seabios vgabios ; do
5093     config_mak=roms/$rom/config.mak
5094     echo "# Automatically generated by configure - do not modify" > $config_mak
5095     echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
5096     echo "AS=$as" >> $config_mak
5097     echo "CC=$cc" >> $config_mak
5098     echo "BCC=bcc" >> $config_mak
5099     echo "CPP=$cpp" >> $config_mak
5100     echo "OBJCOPY=objcopy" >> $config_mak
5101     echo "IASL=$iasl" >> $config_mak
5102     echo "LD=$ld" >> $config_mak
5103 done
5104
5105 if test "$docs" = "yes" ; then
5106   mkdir -p QMP
5107 fi