Diff for /qemu/configure between versions 1.1.1.15 and 1.1.1.18

version 1.1.1.15, 2018/04/24 18:43:35 version 1.1.1.18, 2018/04/24 19:34:28
Line 20  TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$- Line 20  TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-
 trap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM  trap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM
 rm -f config.log  rm -f config.log
   
   # Print a helpful header at the top of config.log
   echo "# QEMU configure log $(date)" >> config.log
   printf "# Configured with:" >> config.log
   printf " '%s'" "$0" "$@" >> config.log
   echo >> config.log
   echo "#" >> config.log
   
 compile_object() {  compile_object() {
   echo $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log    echo $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log
   $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log 2>&1    $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log 2>&1
Line 34  compile_prog() { Line 41  compile_prog() {
   
 # symbolically link $1 to $2.  Portable version of "ln -sf".  # symbolically link $1 to $2.  Portable version of "ln -sf".
 symlink() {  symlink() {
   rm -f $2    rm -rf "$2"
   ln -s $1 $2    ln -s "$1" "$2"
 }  }
   
 # check whether a command is available to this shell (may be either an  # check whether a command is available to this shell (may be either an
Line 92  libs_tools="" Line 99  libs_tools=""
 audio_pt_int=""  audio_pt_int=""
 audio_win_int=""  audio_win_int=""
 cc_i386=i386-pc-linux-gnu-gcc  cc_i386=i386-pc-linux-gnu-gcc
   libs_qga=""
   debug_info="yes"
   
 target_list=""  target_list=""
   
Line 113  curl="" Line 122  curl=""
 curses=""  curses=""
 docs=""  docs=""
 fdt=""  fdt=""
 kvm=""  
 kvm_para=""  
 nptl=""  nptl=""
 sdl=""  sdl=""
   virtfs=""
   vnc="yes"
 sparse="no"  sparse="no"
 uuid=""  uuid=""
 vde=""  vde=""
Line 126  vnc_jpeg="" Line 135  vnc_jpeg=""
 vnc_png=""  vnc_png=""
 vnc_thread="no"  vnc_thread="no"
 xen=""  xen=""
   xen_ctrl_version=""
 linux_aio=""  linux_aio=""
   cap_ng=""
 attr=""  attr=""
 vhost_net=""  libattr=""
 xfs=""  xfs=""
   
   vhost_net="no"
   kvm="no"
 gprof="no"  gprof="no"
 debug_tcg="no"  debug_tcg="no"
 debug_mon="no"  debug_mon="no"
 debug="no"  debug="no"
 strip_opt="yes"  strip_opt="yes"
   tcg_interpreter="no"
 bigendian="no"  bigendian="no"
 mingw32="no"  mingw32="no"
 EXESUF=""  EXESUF=""
 prefix="/usr/local"  prefix="/usr/local"
 mandir="\${prefix}/share/man"  mandir="\${prefix}/share/man"
 datadir="\${prefix}/share/qemu"  datadir="\${prefix}/share"
 docdir="\${prefix}/share/doc/qemu"  qemu_docdir="\${prefix}/share/doc/qemu"
 bindir="\${prefix}/bin"  bindir="\${prefix}/bin"
   libdir="\${prefix}/lib"
   includedir="\${prefix}/include"
 sysconfdir="\${prefix}/etc"  sysconfdir="\${prefix}/etc"
 confsuffix="/qemu"  confsuffix="/qemu"
 slirp="yes"  slirp="yes"
Line 157  profiler="no" Line 173  profiler="no"
 cocoa="no"  cocoa="no"
 softmmu="yes"  softmmu="yes"
 linux_user="no"  linux_user="no"
 darwin_user="no"  
 bsd_user="no"  bsd_user="no"
 guest_base=""  guest_base=""
 uname_release=""  uname_release=""
 io_thread="no"  
 mixemu="no"  mixemu="no"
 kerneldir=""  
 aix="no"  aix="no"
 blobs="yes"  blobs="yes"
 pkgversion=""  pkgversion=""
 check_utests="no"  pie=""
 user_pie="no"  
 zero_malloc=""  zero_malloc=""
 trace_backend="nop"  trace_backend="nop"
 trace_file="trace"  trace_file="trace"
 spice=""  spice=""
 rbd=""  rbd=""
   smartcard=""
   smartcard_nss=""
   usb_redir=""
   opengl=""
   zlib="yes"
   guest_agent="yes"
   libiscsi=""
   coroutine=""
   
 # parse CC options first  # parse CC options first
 for opt do  for opt do
Line 191  for opt do Line 211  for opt do
   ;;    ;;
   --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"    --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
   ;;    ;;
     --enable-debug-info) debug_info="yes"
     ;;
     --disable-debug-info) debug_info="no"
     ;;
   --sparc_cpu=*)    --sparc_cpu=*)
     sparc_cpu="$optarg"      sparc_cpu="$optarg"
     case $sparc_cpu in      case $sparc_cpu in
Line 210  for opt do Line 234  for opt do
 done  done
 # OS specific  # OS specific
 # Using uname is really, really broken.  Once we have the right set of checks  # Using uname is really, really broken.  Once we have the right set of checks
 # we can eliminate it's usage altogether  # we can eliminate its usage altogether.
   
 cc="${cross_prefix}${CC-gcc}"  cc="${CC-${cross_prefix}gcc}"
 ar="${cross_prefix}${AR-ar}"  ar="${AR-${cross_prefix}ar}"
 objcopy="${cross_prefix}${OBJCOPY-objcopy}"  objcopy="${OBJCOPY-${cross_prefix}objcopy}"
 ld="${cross_prefix}${LD-ld}"  ld="${LD-${cross_prefix}ld}"
 strip="${cross_prefix}${STRIP-strip}"  libtool="${LIBTOOL-${cross_prefix}libtool}"
 windres="${cross_prefix}${WINDRES-windres}"  strip="${STRIP-${cross_prefix}strip}"
 pkg_config="${cross_prefix}${PKG_CONFIG-pkg-config}"  windres="${WINDRES-${cross_prefix}windres}"
 sdl_config="${cross_prefix}${SDL_CONFIG-sdl-config}"  pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
   query_pkg_config() {
       "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
   }
   pkg_config=query_pkg_config
   sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
   
 # default flags for all hosts  # default flags for all hosts
 QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"  QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
 CFLAGS="-g $CFLAGS"  QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
 QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"  
 QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"  QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
 QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"  QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
 QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"  QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
 QEMU_INCLUDES="-I. -I\$(SRC_PATH)"  QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/fpu"
 LDFLAGS="-g $LDFLAGS"  if test "$debug_info" = "yes"; then
       CFLAGS="-g $CFLAGS"
       LDFLAGS="-g $LDFLAGS"
   fi
   
 # make source path absolute  # make source path absolute
 source_path=`cd "$source_path"; pwd`  source_path=`cd "$source_path"; pwd`
Line 237  source_path=`cd "$source_path"; pwd` Line 268  source_path=`cd "$source_path"; pwd`
 check_define() {  check_define() {
 cat > $TMPC <<EOF  cat > $TMPC <<EOF
 #if !defined($1)  #if !defined($1)
 #error Not defined  #error $1 not defined
 #endif  #endif
 int main(void) { return 0; }  int main(void) { return 0; }
 EOF  EOF
Line 275  elif check_define __s390__ ; then Line 306  elif check_define __s390__ ; then
   else    else
     cpu="s390"      cpu="s390"
   fi    fi
   elif check_define __arm__ ; then
     cpu="arm"
   elif check_define __hppa__ ; then
     cpu="hppa"
 else  else
   cpu=`uname -m`    cpu=`uname -m`
 fi  fi
   
   ARCH=
   # Normalise host CPU name and set ARCH.
   # Note that this case should only have supported host CPUs, not guests.
 case "$cpu" in  case "$cpu" in
   alpha|cris|ia64|m68k|microblaze|ppc|ppc64|sparc64)    ia64|ppc|ppc64|s390|s390x|sparc64)
     cpu="$cpu"      cpu="$cpu"
   ;;    ;;
   i386|i486|i586|i686|i86pc|BePC)    i386|i486|i586|i686|i86pc|BePC)
Line 289  case "$cpu" in Line 327  case "$cpu" in
   x86_64|amd64)    x86_64|amd64)
     cpu="x86_64"      cpu="x86_64"
   ;;    ;;
   armv*b)    armv*b|armv*l|arm)
     cpu="armv4b"      cpu="arm"
   ;;  
   armv*l)  
     cpu="armv4l"  
   ;;    ;;
   parisc|parisc64)    hppa|parisc|parisc64)
     cpu="hppa"      cpu="hppa"
   ;;    ;;
   mips*)    mips*)
     cpu="mips"      cpu="mips"
   ;;    ;;
   s390)  
     cpu="s390"  
   ;;  
   s390x)  
     cpu="s390x"  
   ;;  
   sparc|sun4[cdmuv])    sparc|sun4[cdmuv])
     cpu="sparc"      cpu="sparc"
   ;;    ;;
   *)    *)
     echo "Unsupported CPU = $cpu"      # This will result in either an error or falling back to TCI later
     exit 1      ARCH=unknown
   ;;    ;;
 esac  esac
   if test -z "$ARCH"; then
     ARCH="$cpu"
   fi
   
 # OS specific  # OS specific
 if check_define __linux__ ; then  if check_define __linux__ ; then
Line 391  Darwin) Line 423  Darwin)
   else    else
     QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"      QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
   fi    fi
   darwin_user="yes"  
   cocoa="yes"    cocoa="yes"
   audio_drv_list="coreaudio"    audio_drv_list="coreaudio"
   audio_possible_drivers="coreaudio sdl fmod"    audio_possible_drivers="coreaudio sdl fmod"
Line 403  SunOS) Line 434  SunOS)
   make="${MAKE-gmake}"    make="${MAKE-gmake}"
   install="${INSTALL-ginstall}"    install="${INSTALL-ginstall}"
   ld="gld"    ld="gld"
     smbd="${SMBD-/usr/sfw/sbin/smbd}"
   needs_libsunmath="no"    needs_libsunmath="no"
   solarisrev=`uname -r | cut -f2 -d.`    solarisrev=`uname -r | cut -f2 -d.`
   # have to select again, because `uname -m` returns i86pc    # have to select again, because `uname -m` returns i86pc
Line 436  SunOS) Line 468  SunOS)
 # needed for TIOCWIN* defines in termios.h  # needed for TIOCWIN* defines in termios.h
   QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"    QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
   QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"    QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
   LIBS="-lsocket -lnsl -lresolv $LIBS"    solarisnetlibs="-lsocket -lnsl -lresolv"
     LIBS="$solarisnetlibs $LIBS"
     libs_qga="$solarisnetlibs $libs_qga"
 ;;  ;;
 AIX)  AIX)
   aix="yes"    aix="yes"
Line 453  Haiku) Line 487  Haiku)
   linux="yes"    linux="yes"
   linux_user="yes"    linux_user="yes"
   usb="linux"    usb="linux"
     kvm="yes"
     vhost_net="yes"
   if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then    if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
     audio_possible_drivers="$audio_possible_drivers fmod"      audio_possible_drivers="$audio_possible_drivers fmod"
   fi    fi
Line 462  esac Line 498  esac
 if [ "$bsd" = "yes" ] ; then  if [ "$bsd" = "yes" ] ; then
   if [ "$darwin" != "yes" ] ; then    if [ "$darwin" != "yes" ] ; then
     usb="bsd"      usb="bsd"
       bsd_user="yes"
   fi    fi
   bsd_user="yes"  
 fi  fi
   
 : ${make=${MAKE-make}}  : ${make=${MAKE-make}}
 : ${install=${INSTALL-install}}  : ${install=${INSTALL-install}}
   : ${python=${PYTHON-python}}
   : ${smbd=${SMBD-/usr/sbin/smbd}}
   
 if test "$mingw32" = "yes" ; then  if test "$mingw32" = "yes" ; then
   EXESUF=".exe"    EXESUF=".exe"
Line 475  if test "$mingw32" = "yes" ; then Line 513  if test "$mingw32" = "yes" ; then
   # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)    # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
   QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"    QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
   LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"    LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
   prefix="c:/Program Files/Qemu"  cat > $TMPC << EOF
   int main(void) { return 0; }
   EOF
     if compile_prog "" "-liberty" ; then
       LIBS="-liberty $LIBS"
     fi
     prefix="c:/Program Files/QEMU"
   mandir="\${prefix}"    mandir="\${prefix}"
   datadir="\${prefix}"    datadir="\${prefix}"
   docdir="\${prefix}"    qemu_docdir="\${prefix}"
   bindir="\${prefix}"    bindir="\${prefix}"
   sysconfdir="\${prefix}"    sysconfdir="\${prefix}"
   confsuffix=""    confsuffix=""
     libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga"
 fi  fi
   
 werror=""  werror=""
Line 491  for opt do Line 536  for opt do
   case "$opt" in    case "$opt" in
   --help|-h) show_help=yes    --help|-h) show_help=yes
   ;;    ;;
     --version|-V) exec cat $source_path/VERSION
     ;;
   --prefix=*) prefix="$optarg"    --prefix=*) prefix="$optarg"
   ;;    ;;
   --interp-prefix=*) interp_prefix="$optarg"    --interp-prefix=*) interp_prefix="$optarg"
Line 507  for opt do Line 554  for opt do
   ;;    ;;
   --install=*) install="$optarg"    --install=*) install="$optarg"
   ;;    ;;
     --python=*) python="$optarg"
     ;;
     --smbd=*) smbd="$optarg"
     ;;
   --extra-cflags=*)    --extra-cflags=*)
   ;;    ;;
   --extra-ldflags=*)    --extra-ldflags=*)
   ;;    ;;
     --enable-debug-info)
     ;;
     --disable-debug-info)
     ;;
   --cpu=*)    --cpu=*)
   ;;    ;;
   --target-list=*) target_list="$optarg"    --target-list=*) target_list="$optarg"
Line 524  for opt do Line 579  for opt do
   --static)    --static)
     static="yes"      static="yes"
     LDFLAGS="-static $LDFLAGS"      LDFLAGS="-static $LDFLAGS"
       QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
   ;;    ;;
   --mandir=*) mandir="$optarg"    --mandir=*) mandir="$optarg"
   ;;    ;;
   --bindir=*) bindir="$optarg"    --bindir=*) bindir="$optarg"
   ;;    ;;
     --libdir=*) libdir="$optarg"
     ;;
     --includedir=*) includedir="$optarg"
     ;;
   --datadir=*) datadir="$optarg"    --datadir=*) datadir="$optarg"
   ;;    ;;
   --docdir=*) docdir="$optarg"    --with-confsuffix=*) confsuffix="$optarg"
     ;;
     --docdir=*) qemu_docdir="$optarg"
   ;;    ;;
   --sysconfdir=*) sysconfdir="$optarg"    --sysconfdir=*) sysconfdir="$optarg"
   ;;    ;;
     --sbindir=*|--libexecdir=*|--sharedstatedir=*|--localstatedir=*|\
     --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
     --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
       # These switches are silently ignored, for compatibility with
       # autoconf-generated configure scripts. This allows QEMU's
       # configure to be used by RPM and similar macros that set
       # lots of directory switches by default.
     ;;
   --disable-sdl) sdl="no"    --disable-sdl) sdl="no"
   ;;    ;;
   --enable-sdl) sdl="yes"    --enable-sdl) sdl="yes"
   ;;    ;;
     --disable-virtfs) virtfs="no"
     ;;
     --enable-virtfs) virtfs="yes"
     ;;
     --disable-vnc) vnc="no"
     ;;
     --enable-vnc) vnc="yes"
     ;;
   --fmod-lib=*) fmod_lib="$optarg"    --fmod-lib=*) fmod_lib="$optarg"
   ;;    ;;
   --fmod-inc=*) fmod_inc="$optarg"    --fmod-inc=*) fmod_inc="$optarg"
Line 618  for opt do Line 696  for opt do
   ;;    ;;
   --enable-kvm) kvm="yes"    --enable-kvm) kvm="yes"
   ;;    ;;
     --disable-tcg-interpreter) tcg_interpreter="no"
     ;;
     --enable-tcg-interpreter) tcg_interpreter="yes"
     ;;
     --disable-cap-ng)  cap_ng="no"
     ;;
     --enable-cap-ng) cap_ng="yes"
     ;;
   --disable-spice) spice="no"    --disable-spice) spice="no"
   ;;    ;;
   --enable-spice) spice="yes"    --enable-spice) spice="yes"
   ;;    ;;
     --disable-libiscsi) libiscsi="no"
     ;;
     --enable-libiscsi) libiscsi="yes"
     ;;
   --enable-profiler) profiler="yes"    --enable-profiler) profiler="yes"
   ;;    ;;
     --disable-cocoa) cocoa="no"
     ;;
   --enable-cocoa)    --enable-cocoa)
       cocoa="yes" ;        cocoa="yes" ;
       sdl="no" ;        sdl="no" ;
Line 636  for opt do Line 728  for opt do
   --disable-user)    --disable-user)
       linux_user="no" ;        linux_user="no" ;
       bsd_user="no" ;        bsd_user="no" ;
       darwin_user="no"  
   ;;    ;;
   --enable-user) ;;    --enable-user) ;;
   --disable-linux-user) linux_user="no"    --disable-linux-user) linux_user="no"
   ;;    ;;
   --enable-linux-user) linux_user="yes"    --enable-linux-user) linux_user="yes"
   ;;    ;;
   --disable-darwin-user) darwin_user="no"  
   ;;  
   --enable-darwin-user) darwin_user="yes"  
   ;;  
   --disable-bsd-user) bsd_user="no"    --disable-bsd-user) bsd_user="no"
   ;;    ;;
   --enable-bsd-user) bsd_user="yes"    --enable-bsd-user) bsd_user="yes"
Line 655  for opt do Line 742  for opt do
   ;;    ;;
   --disable-guest-base) guest_base="no"    --disable-guest-base) guest_base="no"
   ;;    ;;
   --enable-user-pie) user_pie="yes"    --enable-pie) pie="yes"
   ;;    ;;
   --disable-user-pie) user_pie="no"    --disable-pie) pie="no"
   ;;    ;;
   --enable-uname-release=*) uname_release="$optarg"    --enable-uname-release=*) uname_release="$optarg"
   ;;    ;;
Line 679  for opt do Line 766  for opt do
   ;;    ;;
   --enable-fdt) fdt="yes"    --enable-fdt) fdt="yes"
   ;;    ;;
   --disable-check-utests) check_utests="no"  
   ;;  
   --enable-check-utests) check_utests="yes"  
   ;;  
   --disable-nptl) nptl="no"    --disable-nptl) nptl="no"
   ;;    ;;
   --enable-nptl) nptl="yes"    --enable-nptl) nptl="yes"
Line 697  for opt do Line 780  for opt do
   ;;    ;;
   --enable-attr) attr="yes"    --enable-attr) attr="yes"
   ;;    ;;
   --enable-io-thread) io_thread="yes"  
   ;;  
   --disable-blobs) blobs="no"    --disable-blobs) blobs="no"
   ;;    ;;
   --kerneldir=*) kerneldir="$optarg"  
   ;;  
   --with-pkgversion=*) pkgversion=" ($optarg)"    --with-pkgversion=*) pkgversion=" ($optarg)"
   ;;    ;;
     --with-coroutine=*) coroutine="$optarg"
     ;;
   --disable-docs) docs="no"    --disable-docs) docs="no"
   ;;    ;;
   --enable-docs) docs="yes"    --enable-docs) docs="yes"
Line 713  for opt do Line 794  for opt do
   ;;    ;;
   --enable-vhost-net) vhost_net="yes"    --enable-vhost-net) vhost_net="yes"
   ;;    ;;
   --*dir)    --disable-opengl) opengl="no"
     ;;
     --enable-opengl) opengl="yes"
   ;;    ;;
   --disable-rbd) rbd="no"    --disable-rbd) rbd="no"
   ;;    ;;
   --enable-rbd) rbd="yes"    --enable-rbd) rbd="yes"
   ;;    ;;
     --disable-xfsctl) xfs="no"
     ;;
     --enable-xfsctl) xfs="yes"
     ;;
     --disable-smartcard) smartcard="no"
     ;;
     --enable-smartcard) smartcard="yes"
     ;;
     --disable-smartcard-nss) smartcard_nss="no"
     ;;
     --enable-smartcard-nss) smartcard_nss="yes"
     ;;
     --disable-usb-redir) usb_redir="no"
     ;;
     --enable-usb-redir) usb_redir="yes"
     ;;
     --disable-zlib-test) zlib="no"
     ;;
     --enable-guest-agent) guest_agent="yes"
     ;;
     --disable-guest-agent) guest_agent="no"
     ;;
   *) echo "ERROR: unknown option $opt"; show_help="yes"    *) echo "ERROR: unknown option $opt"; show_help="yes"
   ;;    ;;
   esac    esac
Line 793  case "$cpu" in Line 898  case "$cpu" in
     hppa*)      hppa*)
            host_guest_base="yes"             host_guest_base="yes"
            ;;             ;;
       unicore32*)
              host_guest_base="yes"
              ;;
 esac  esac
   
 [ -z "$guest_base" ] && guest_base="$host_guest_base"  [ -z "$guest_base" ] && guest_base="$host_guest_base"
   
   
   default_target_list=""
   
   # these targets are portable
   if [ "$softmmu" = "yes" ] ; then
       default_target_list="\
   i386-softmmu \
   x86_64-softmmu \
   alpha-softmmu \
   arm-softmmu \
   cris-softmmu \
   lm32-softmmu \
   m68k-softmmu \
   microblaze-softmmu \
   microblazeel-softmmu \
   mips-softmmu \
   mipsel-softmmu \
   mips64-softmmu \
   mips64el-softmmu \
   ppc-softmmu \
   ppcemb-softmmu \
   ppc64-softmmu \
   sh4-softmmu \
   sh4eb-softmmu \
   sparc-softmmu \
   sparc64-softmmu \
   s390x-softmmu \
   xtensa-softmmu \
   xtensaeb-softmmu \
   "
   fi
   # the following are Linux specific
   if [ "$linux_user" = "yes" ] ; then
       default_target_list="${default_target_list}\
   i386-linux-user \
   x86_64-linux-user \
   alpha-linux-user \
   arm-linux-user \
   armeb-linux-user \
   cris-linux-user \
   m68k-linux-user \
   microblaze-linux-user \
   microblazeel-linux-user \
   mips-linux-user \
   mipsel-linux-user \
   ppc-linux-user \
   ppc64-linux-user \
   ppc64abi32-linux-user \
   sh4-linux-user \
   sh4eb-linux-user \
   sparc-linux-user \
   sparc64-linux-user \
   sparc32plus-linux-user \
   unicore32-linux-user \
   s390x-linux-user \
   "
   fi
   # the following are BSD specific
   if [ "$bsd_user" = "yes" ] ; then
       default_target_list="${default_target_list}\
   i386-bsd-user \
   x86_64-bsd-user \
   sparc-bsd-user \
   sparc64-bsd-user \
   "
   fi
   
 if test x"$show_help" = x"yes" ; then  if test x"$show_help" = x"yes" ; then
 cat << EOF  cat << EOF
   
Line 809  echo "  --help                   print t Line 984  echo "  --help                   print t
 echo "  --prefix=PREFIX          install in PREFIX [$prefix]"  echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
 echo "  --interp-prefix=PREFIX   where to find shared libraries, etc."  echo "  --interp-prefix=PREFIX   where to find shared libraries, etc."
 echo "                           use %M for cpu name [$interp_prefix]"  echo "                           use %M for cpu name [$interp_prefix]"
 echo "  --target-list=LIST       set target list [$target_list]"  echo "  --target-list=LIST       set target list (default: build everything)"
   echo "Available targets: $default_target_list" | \
       fold -s -w 53 | sed -e 's/^/                           /'
 echo ""  echo ""
 echo "Advanced options (experts only):"  echo "Advanced options (experts only):"
 echo "  --source-path=PATH       path of source code [$source_path]"  echo "  --source-path=PATH       path of source code [$source_path]"
Line 821  echo "  --extra-cflags=CFLAGS    append  Line 998  echo "  --extra-cflags=CFLAGS    append 
 echo "  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS"  echo "  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS"
 echo "  --make=MAKE              use specified make [$make]"  echo "  --make=MAKE              use specified make [$make]"
 echo "  --install=INSTALL        use specified install [$install]"  echo "  --install=INSTALL        use specified install [$install]"
   echo "  --python=PYTHON          use specified python [$python]"
   echo "  --smbd=SMBD              use specified smbd [$smbd]"
 echo "  --static                 enable static build [$static]"  echo "  --static                 enable static build [$static]"
 echo "  --mandir=PATH            install man pages in PATH"  echo "  --mandir=PATH            install man pages in PATH"
 echo "  --datadir=PATH           install firmware in PATH"  echo "  --datadir=PATH           install firmware in PATH$confsuffix"
 echo "  --docdir=PATH            install documentation in PATH"  echo "  --docdir=PATH            install documentation in PATH$confsuffix"
 echo "  --bindir=PATH            install binaries in PATH"  echo "  --bindir=PATH            install binaries in PATH"
 echo "  --sysconfdir=PATH        install config in PATH/qemu"  echo "  --sysconfdir=PATH        install config in PATH$confsuffix"
   echo "  --with-confsuffix=SUFFIX suffix for QEMU data inside datadir and sysconfdir [$confsuffix]"
 echo "  --enable-debug-tcg       enable TCG debugging"  echo "  --enable-debug-tcg       enable TCG debugging"
 echo "  --disable-debug-tcg      disable TCG debugging (default)"  echo "  --disable-debug-tcg      disable TCG debugging (default)"
 echo "  --enable-debug           enable common debug build options"  echo "  --enable-debug           enable common debug build options"
Line 836  echo "  --disable-strip          disable Line 1016  echo "  --disable-strip          disable
 echo "  --disable-werror         disable compilation abort on warning"  echo "  --disable-werror         disable compilation abort on warning"
 echo "  --disable-sdl            disable SDL"  echo "  --disable-sdl            disable SDL"
 echo "  --enable-sdl             enable SDL"  echo "  --enable-sdl             enable SDL"
 echo "  --enable-cocoa           enable COCOA (Mac OS X only)"  echo "  --disable-virtfs         disable VirtFS"
   echo "  --enable-virtfs          enable VirtFS"
   echo "  --disable-vnc            disable VNC"
   echo "  --enable-vnc             enable VNC"
   echo "  --disable-cocoa          disable Cocoa (Mac OS X only)"
   echo "  --enable-cocoa           enable Cocoa (default on Mac OS X)"
 echo "  --audio-drv-list=LIST    set audio drivers list:"  echo "  --audio-drv-list=LIST    set audio drivers list:"
 echo "                           Available drivers: $audio_possible_drivers"  echo "                           Available drivers: $audio_possible_drivers"
 echo "  --audio-card-list=LIST   set list of emulated audio cards [$audio_card_list]"  echo "  --audio-card-list=LIST   set list of emulated audio cards [$audio_card_list]"
Line 864  echo "  --disable-curl           disable Line 1049  echo "  --disable-curl           disable
 echo "  --enable-curl            enable curl connectivity"  echo "  --enable-curl            enable curl connectivity"
 echo "  --disable-fdt            disable fdt device tree"  echo "  --disable-fdt            disable fdt device tree"
 echo "  --enable-fdt             enable fdt device tree"  echo "  --enable-fdt             enable fdt device tree"
 echo "  --disable-check-utests   disable check unit-tests"  
 echo "  --enable-check-utests    enable check unit-tests"  
 echo "  --disable-bluez          disable bluez stack connectivity"  echo "  --disable-bluez          disable bluez stack connectivity"
 echo "  --enable-bluez           enable bluez stack connectivity"  echo "  --enable-bluez           enable bluez stack connectivity"
   echo "  --disable-slirp          disable SLIRP userspace network connectivity"
 echo "  --disable-kvm            disable KVM acceleration support"  echo "  --disable-kvm            disable KVM acceleration support"
 echo "  --enable-kvm             enable KVM acceleration support"  echo "  --enable-kvm             enable KVM acceleration support"
   echo "  --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)"
 echo "  --disable-nptl           disable usermode NPTL support"  echo "  --disable-nptl           disable usermode NPTL support"
 echo "  --enable-nptl            enable usermode NPTL support"  echo "  --enable-nptl            enable usermode NPTL support"
 echo "  --enable-system          enable all system emulation targets"  echo "  --enable-system          enable all system emulation targets"
Line 878  echo "  --enable-user            enable  Line 1063  echo "  --enable-user            enable 
 echo "  --disable-user           disable all user emulation targets"  echo "  --disable-user           disable all user emulation targets"
 echo "  --enable-linux-user      enable all linux usermode emulation targets"  echo "  --enable-linux-user      enable all linux usermode emulation targets"
 echo "  --disable-linux-user     disable all linux usermode emulation targets"  echo "  --disable-linux-user     disable all linux usermode emulation targets"
 echo "  --enable-darwin-user     enable all darwin usermode emulation targets"  
 echo "  --disable-darwin-user    disable all darwin usermode emulation targets"  
 echo "  --enable-bsd-user        enable all BSD usermode emulation targets"  echo "  --enable-bsd-user        enable all BSD usermode emulation targets"
 echo "  --disable-bsd-user       disable all BSD usermode emulation targets"  echo "  --disable-bsd-user       disable all BSD usermode emulation targets"
 echo "  --enable-guest-base      enable GUEST_BASE support for usermode"  echo "  --enable-guest-base      enable GUEST_BASE support for usermode"
 echo "                           emulation targets"  echo "                           emulation targets"
 echo "  --disable-guest-base     disable GUEST_BASE support"  echo "  --disable-guest-base     disable GUEST_BASE support"
 echo "  --enable-user-pie        build usermode emulation targets as PIE"  echo "  --enable-pie             build Position Independent Executables"
 echo "  --disable-user-pie       do not build usermode emulation targets as PIE"  echo "  --disable-pie            do not build Position Independent Executables"
 echo "  --fmod-lib               path to FMOD library"  echo "  --fmod-lib               path to FMOD library"
 echo "  --fmod-inc               path to FMOD includes"  echo "  --fmod-inc               path to FMOD includes"
 echo "  --oss-lib                path to OSS library"  echo "  --oss-lib                path to OSS library"
 echo "  --enable-uname-release=R Return R for uname -r in usermode emulation"  echo "  --enable-uname-release=R Return R for uname -r in usermode emulation"
   echo "  --cpu=CPU                Build for host CPU [$cpu]"
 echo "  --sparc_cpu=V            Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"  echo "  --sparc_cpu=V            Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
 echo "  --disable-uuid           disable uuid support"  echo "  --disable-uuid           disable uuid support"
 echo "  --enable-uuid            enable uuid support"  echo "  --enable-uuid            enable uuid support"
Line 898  echo "  --disable-vde            disable Line 1082  echo "  --disable-vde            disable
 echo "  --enable-vde             enable support for vde network"  echo "  --enable-vde             enable support for vde network"
 echo "  --disable-linux-aio      disable Linux AIO support"  echo "  --disable-linux-aio      disable Linux AIO support"
 echo "  --enable-linux-aio       enable Linux AIO support"  echo "  --enable-linux-aio       enable Linux AIO support"
   echo "  --disable-cap-ng         disable libcap-ng support"
   echo "  --enable-cap-ng          enable libcap-ng support"
 echo "  --disable-attr           disables attr and xattr support"  echo "  --disable-attr           disables attr and xattr support"
 echo "  --enable-attr            enable attr and xattr support"  echo "  --enable-attr            enable attr and xattr support"
 echo "  --enable-io-thread       enable IO thread"  
 echo "  --disable-blobs          disable installing provided firmware blobs"  echo "  --disable-blobs          disable installing provided firmware blobs"
 echo "  --kerneldir=PATH         look for kernel includes in PATH"  
 echo "  --enable-docs            enable documentation build"  echo "  --enable-docs            enable documentation build"
 echo "  --disable-docs           disable documentation build"  echo "  --disable-docs           disable documentation build"
 echo "  --disable-vhost-net      disable vhost-net acceleration support"  echo "  --disable-vhost-net      disable vhost-net acceleration support"
 echo "  --enable-vhost-net       enable vhost-net acceleration support"  echo "  --enable-vhost-net       enable vhost-net acceleration support"
 echo "  --enable-trace-backend=B Set trace backend"  echo "  --enable-trace-backend=B Set trace backend"
 echo "                           Available backends:" $("$source_path"/scripts/tracetool --list-backends)  echo "                           Available backends:" $($python "$source_path"/scripts/tracetool.py --list-backends)
 echo "  --with-trace-file=NAME   Full PATH,NAME of file to store traces"  echo "  --with-trace-file=NAME   Full PATH,NAME of file to store traces"
 echo "                           Default:trace-<pid>"  echo "                           Default:trace-<pid>"
 echo "  --disable-spice          disable spice"  echo "  --disable-spice          disable spice"
 echo "  --enable-spice           enable spice"  echo "  --enable-spice           enable spice"
 echo "  --enable-rbd             enable building the rados block device (rbd)"  echo "  --enable-rbd             enable building the rados block device (rbd)"
   echo "  --disable-libiscsi       disable iscsi support"
   echo "  --enable-libiscsi        enable iscsi support"
   echo "  --disable-smartcard      disable smartcard support"
   echo "  --enable-smartcard       enable smartcard support"
   echo "  --disable-smartcard-nss  disable smartcard nss support"
   echo "  --enable-smartcard-nss   enable smartcard nss support"
   echo "  --disable-usb-redir      disable usb network redirection support"
   echo "  --enable-usb-redir       enable usb network redirection support"
   echo "  --disable-guest-agent    disable building of the QEMU Guest Agent"
   echo "  --enable-guest-agent     enable building of the QEMU Guest Agent"
   echo "  --with-coroutine=BACKEND coroutine backend. Supported options:"
   echo "                           gthread, ucontext, sigaltstack, windows"
 echo ""  echo ""
 echo "NOTE: The object files are built at the place where configure is launched"  echo "NOTE: The object files are built at the place where configure is launched"
 exit 1  exit 1
 fi  fi
   
   # Now we have handled --enable-tcg-interpreter and know we're not just
   # printing the help message, bail out if the host CPU isn't supported.
   if test "$ARCH" = "unknown"; then
       if test "$tcg_interpreter" = "yes" ; then
           echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
           ARCH=tci
       else
           echo "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
           exit 1
       fi
   fi
   
 # check that the C compiler works.  # check that the C compiler works.
 cat > $TMPC <<EOF  cat > $TMPC <<EOF
 int main(void) {}  int main(void) { return 0; }
 EOF  EOF
   
 if compile_object ; then  if compile_object ; then
Line 934  fi Line 1142  fi
 gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"  gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
 gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"  gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
 gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"  gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
 gcc_flags="-fstack-protector-all $gcc_flags"  gcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags"
 cat > $TMPC << EOF  cat > $TMPC << EOF
 int main(void) { return 0; }  int main(void) { return 0; }
 EOF  EOF
 for flag in $gcc_flags; do  for flag in $gcc_flags; do
     if compile_prog "-Werror $QEMU_CFLAGS" "-Werror $flag" ; then      if compile_prog "-Werror $flag" "" ; then
         QEMU_CFLAGS="$QEMU_CFLAGS $flag"          QEMU_CFLAGS="$QEMU_CFLAGS $flag"
     fi      fi
 done  done
   
   if test "$static" = "yes" ; then
     if test "$pie" = "yes" ; then
       echo "static and pie are mutually incompatible"
       exit 1
     else
       pie="no"
     fi
   fi
   
   if test "$pie" = ""; then
     case "$cpu-$targetos" in
       i386-Linux|x86_64-Linux|i386-OpenBSD|x86_64-OpenBSD)
         ;;
       *)
         pie="no"
         ;;
     esac
   fi
   
   if test "$pie" != "no" ; then
     cat > $TMPC << EOF
   
   #ifdef __linux__
   #  define THREAD __thread
   #else
   #  define THREAD
   #endif
   
   static THREAD int tls_var;
   
   int main(void) { return tls_var; }
   
   EOF
     if compile_prog "-fPIE -DPIE" "-pie"; then
       QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
       LDFLAGS="-pie $LDFLAGS"
       pie="yes"
       if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
         LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
       fi
     else
       if test "$pie" = "yes"; then
         echo "PIE not available due to missing toolchain support"
         exit 1
       else
         echo "Disabling PIE due to missing toolchain support"
         pie="no"
       fi
     fi
   fi
   
 #  #
 # Solaris specific configure tool chain decisions  # Solaris specific configure tool chain decisions
 #  #
Line 973  if test "$solaris" = "yes" ; then Line 1232  if test "$solaris" = "yes" ; then
   fi    fi
 fi  fi
   
   if ! has $python; then
     echo "Python not found. Use --python=/path/to/python"
     exit 1
   fi
   
   # Note that if the Python conditional here evaluates True we will exit
   # with status 1 which is a shell 'false' value.
   if ! "$python" -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))'; then
     echo "Cannot use '$python', Python 2.4 or later is required."
     echo "Note that Python 3 or later is not yet supported."
     echo "Use --python=/path/to/python to specify a supported Python."
     exit 1
   fi
   
 if test -z "$target_list" ; then  if test -z "$target_list" ; then
 # these targets are portable      target_list="$default_target_list"
     if [ "$softmmu" = "yes" ] ; then  
         target_list="\  
 i386-softmmu \  
 x86_64-softmmu \  
 arm-softmmu \  
 cris-softmmu \  
 m68k-softmmu \  
 microblaze-softmmu \  
 mips-softmmu \  
 mipsel-softmmu \  
 mips64-softmmu \  
 mips64el-softmmu \  
 ppc-softmmu \  
 ppcemb-softmmu \  
 ppc64-softmmu \  
 sh4-softmmu \  
 sh4eb-softmmu \  
 sparc-softmmu \  
 sparc64-softmmu \  
 "  
     fi  
 # the following are Linux specific  
     if [ "$linux_user" = "yes" ] ; then  
         target_list="${target_list}\  
 i386-linux-user \  
 x86_64-linux-user \  
 alpha-linux-user \  
 arm-linux-user \  
 armeb-linux-user \  
 cris-linux-user \  
 m68k-linux-user \  
 microblaze-linux-user \  
 mips-linux-user \  
 mipsel-linux-user \  
 ppc-linux-user \  
 ppc64-linux-user \  
 ppc64abi32-linux-user \  
 sh4-linux-user \  
 sh4eb-linux-user \  
 sparc-linux-user \  
 sparc64-linux-user \  
 sparc32plus-linux-user \  
 "  
     fi  
 # the following are Darwin specific  
     if [ "$darwin_user" = "yes" ] ; then  
         target_list="$target_list i386-darwin-user ppc-darwin-user "  
     fi  
 # the following are BSD specific  
     if [ "$bsd_user" = "yes" ] ; then  
         target_list="${target_list}\  
 i386-bsd-user \  
 x86_64-bsd-user \  
 sparc-bsd-user \  
 sparc64-bsd-user \  
 "  
     fi  
 else  else
     target_list=`echo "$target_list" | sed -e 's/,/ /g'`      target_list=`echo "$target_list" | sed -e 's/,/ /g'`
 fi  fi
Line 1080  else Line 1295  else
   
 # if cross compiling, cannot launch a program, so make a static guess  # if cross compiling, cannot launch a program, so make a static guess
 case "$cpu" in  case "$cpu" in
   armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)    arm)
       # ARM can be either way; ask the compiler which one we are
       if check_define __ARMEB__; then
         bigendian=yes
       fi
     ;;
     hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
     bigendian=yes      bigendian=yes
   ;;    ;;
 esac  esac
   
 fi  fi
   
 # host long bits test, actually a pointer size test  
 cat > $TMPC << EOF  
 int sizeof_pointer_is_8[sizeof(void *) == 8 ? 1 : -1];  
 EOF  
 if compile_object; then  
 hostlongbits=64  
 else  
 hostlongbits=32  
 fi  
   
   
 ##########################################  ##########################################
 # NPTL probe  # NPTL probe
   
Line 1105  if test "$nptl" != "no" ; then Line 1315  if test "$nptl" != "no" ; then
   cat > $TMPC <<EOF    cat > $TMPC <<EOF
 #include <sched.h>  #include <sched.h>
 #include <linux/futex.h>  #include <linux/futex.h>
 void foo()  int main(void) {
 {  
 #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)  #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
 #error bork  #error bork
 #endif  #endif
     return 0;
 }  }
 EOF  EOF
   
Line 1126  fi Line 1336  fi
 ##########################################  ##########################################
 # zlib check  # zlib check
   
 cat > $TMPC << EOF  if test "$zlib" != "no" ; then
       cat > $TMPC << EOF
 #include <zlib.h>  #include <zlib.h>
 int main(void) { zlibVersion(); return 0; }  int main(void) { zlibVersion(); return 0; }
 EOF  EOF
 if compile_prog "" "-lz" ; then      if compile_prog "" "-lz" ; then
     :          :
 else      else
     echo          echo
     echo "Error: zlib check failed"          echo "Error: zlib check failed"
     echo "Make sure to have the zlib libs and headers installed."          echo "Make sure to have the zlib libs and headers installed."
     echo          echo
     exit 1          exit 1
       fi
 fi  fi
   
 ##########################################  ##########################################
Line 1145  fi Line 1357  fi
   
 if test "$xen" != "no" ; then  if test "$xen" != "no" ; then
   xen_libs="-lxenstore -lxenctrl -lxenguest"    xen_libs="-lxenstore -lxenctrl -lxenguest"
   
     # First we test whether Xen headers and libraries are available.
     # If no, we are done and there is no Xen support.
     # If yes, more tests are run to detect the Xen version.
   
     # Xen (any)
   cat > $TMPC <<EOF    cat > $TMPC <<EOF
 #include <xenctrl.h>  #include <xenctrl.h>
 #include <xs.h>  #include <xs.h>
 int main(void) { xs_daemon_open(); xc_interface_open(); return 0; }  int main(void) {
     return 0;
   }
   EOF
     if ! compile_prog "" "$xen_libs" ; then
       # Xen not found
       if test "$xen" = "yes" ; then
         feature_not_found "xen"
       fi
       xen=no
   
     # Xen unstable
     elif (
         cat > $TMPC <<EOF
   #include <xenctrl.h>
   #include <xs.h>
   #include <stdint.h>
   #include <xen/hvm/hvm_info_table.h>
   #if !defined(HVM_MAX_VCPUS)
   # error HVM_MAX_VCPUS not defined
   #endif
   int main(void) {
     xc_interface *xc;
     xs_daemon_open();
     xc = xc_interface_open(0, 0, 0);
     xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
     xc_gnttab_open(NULL, 0);
     xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
     xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
     return 0;
   }
   EOF
         compile_prog "" "$xen_libs"
       ) ; then
       xen_ctrl_version=420
       xen=yes
   
     elif (
         cat > $TMPC <<EOF
   #include <xenctrl.h>
   #include <xs.h>
   #include <stdint.h>
   #include <xen/hvm/hvm_info_table.h>
   #if !defined(HVM_MAX_VCPUS)
   # error HVM_MAX_VCPUS not defined
   #endif
   int main(void) {
     xc_interface *xc;
     xs_daemon_open();
     xc = xc_interface_open(0, 0, 0);
     xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
     xc_gnttab_open(NULL, 0);
     xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
     return 0;
   }
 EOF  EOF
   if compile_prog "" "$xen_libs" ; then        compile_prog "" "$xen_libs"
       ) ; then
       xen_ctrl_version=410
     xen=yes      xen=yes
     libs_softmmu="$xen_libs $libs_softmmu"  
     # Xen 4.0.0
     elif (
         cat > $TMPC <<EOF
   #include <xenctrl.h>
   #include <xs.h>
   #include <stdint.h>
   #include <xen/hvm/hvm_info_table.h>
   #if !defined(HVM_MAX_VCPUS)
   # error HVM_MAX_VCPUS not defined
   #endif
   int main(void) {
     struct xen_add_to_physmap xatp = {
       .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
     };
     xs_daemon_open();
     xc_interface_open();
     xc_gnttab_open();
     xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
     xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
     return 0;
   }
   EOF
         compile_prog "" "$xen_libs"
       ) ; then
       xen_ctrl_version=400
       xen=yes
   
     # Xen 3.4.0
     elif (
         cat > $TMPC <<EOF
   #include <xenctrl.h>
   #include <xs.h>
   int main(void) {
     struct xen_add_to_physmap xatp = {
       .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
     };
     xs_daemon_open();
     xc_interface_open();
     xc_gnttab_open();
     xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
     xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
     return 0;
   }
   EOF
         compile_prog "" "$xen_libs"
       ) ; then
       xen_ctrl_version=340
       xen=yes
   
     # Xen 3.3.0
     elif (
         cat > $TMPC <<EOF
   #include <xenctrl.h>
   #include <xs.h>
   int main(void) {
     xs_daemon_open();
     xc_interface_open();
     xc_gnttab_open();
     xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
     return 0;
   }
   EOF
         compile_prog "" "$xen_libs"
       ) ; then
       xen_ctrl_version=330
       xen=yes
   
     # Xen version unsupported
   else    else
     if test "$xen" = "yes" ; then      if test "$xen" = "yes" ; then
       feature_not_found "xen"        feature_not_found "xen (unsupported version)"
     fi      fi
     xen=no      xen=no
   fi    fi
   
     if test "$xen" = yes; then
       libs_softmmu="$xen_libs $libs_softmmu"
     fi
 fi  fi
   
 ##########################################  ##########################################
 # pkg-config probe  # pkg-config probe
   
 if ! has $pkg_config; then  if ! has "$pkg_config_exe"; then
   echo warning: proceeding without "$pkg_config" >&2    echo "Error: pkg-config binary '$pkg_config_exe' not found"
   pkg_config=/bin/false    exit 1
   fi
   
   ##########################################
   # libtool probe
   
   if ! has $libtool; then
       libtool=
 fi  fi
   
 ##########################################  ##########################################
Line 1203  else Line 1556  else
   fi    fi
   sdl=no    sdl=no
 fi  fi
 if test -n "$cross_prefix" && test "`basename $sdlconfig`" = sdl-config; then  if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
   echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2    echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
 fi  fi
   
Line 1262  EOF Line 1615  EOF
   if compile_prog "$sdl_cflags" "$sdl_libs" ; then    if compile_prog "$sdl_cflags" "$sdl_libs" ; then
     sdl_libs="$sdl_libs -lX11"      sdl_libs="$sdl_libs -lX11"
   fi    fi
   if test "$mingw32" = "yes" ; then  
     sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole"  
   fi  
   libs_softmmu="$sdl_libs $libs_softmmu"    libs_softmmu="$sdl_libs $libs_softmmu"
 fi  fi
   
 ##########################################  ##########################################
 # VNC TLS detection  # VNC TLS detection
 if test "$vnc_tls" != "no" ; then  if test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then
   cat > $TMPC <<EOF    cat > $TMPC <<EOF
 #include <gnutls/gnutls.h>  #include <gnutls/gnutls.h>
 int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }  int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
Line 1290  fi Line 1640  fi
   
 ##########################################  ##########################################
 # VNC SASL detection  # VNC SASL detection
 if test "$vnc_sasl" != "no" ; then  if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
   cat > $TMPC <<EOF    cat > $TMPC <<EOF
 #include <sasl/sasl.h>  #include <sasl/sasl.h>
 #include <stdio.h>  #include <stdio.h>
Line 1312  fi Line 1662  fi
   
 ##########################################  ##########################################
 # VNC JPEG detection  # VNC JPEG detection
 if test "$vnc_jpeg" != "no" ; then  if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
 cat > $TMPC <<EOF  cat > $TMPC <<EOF
 #include <stdio.h>  #include <stdio.h>
 #include <jpeglib.h>  #include <jpeglib.h>
Line 1333  fi Line 1683  fi
   
 ##########################################  ##########################################
 # VNC PNG detection  # VNC PNG detection
 if test "$vnc_png" != "no" ; then  if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
 cat > $TMPC <<EOF  cat > $TMPC <<EOF
 //#include <stdio.h>  //#include <stdio.h>
 #include <png.h>  #include <png.h>
Line 1344  int main(void) { Line 1694  int main(void) {
     return 0;      return 0;
 }  }
 EOF  EOF
     if $pkg_config libpng --modversion >/dev/null 2>&1; then
       vnc_png_cflags=`$pkg_config libpng --cflags 2> /dev/null`
       vnc_png_libs=`$pkg_config libpng --libs 2> /dev/null`
     else
     vnc_png_cflags=""      vnc_png_cflags=""
     vnc_png_libs="-lpng"      vnc_png_libs="-lpng"
     fi
   if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then    if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
     vnc_png=yes      vnc_png=yes
     libs_softmmu="$vnc_png_libs $libs_softmmu"      libs_softmmu="$vnc_png_libs $libs_softmmu"
       QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
   else    else
     if test "$vnc_png" = "yes" ; then      if test "$vnc_png" = "yes" ; then
       feature_not_found "vnc-png"        feature_not_found "vnc-png"
Line 1401  fi Line 1757  fi
 # xfsctl() probe, used for raw-posix  # xfsctl() probe, used for raw-posix
 if test "$xfs" != "no" ; then  if test "$xfs" != "no" ; then
   cat > $TMPC << EOF    cat > $TMPC << EOF
   #include <stddef.h>  /* NULL */
 #include <xfs/xfs.h>  #include <xfs/xfs.h>
 int main(void)  int main(void)
 {  {
Line 1444  EOF Line 1801  EOF
 fi  fi
   
 ##########################################  ##########################################
   # libcap-ng library probe
   if test "$cap_ng" != "no" ; then
     cap_libs="-lcap-ng"
     cat > $TMPC << EOF
   #include <cap-ng.h>
   int main(void)
   {
       capng_capability_to_name(CAPNG_EFFECTIVE);
       return 0;
   }
   EOF
     if compile_prog "" "$cap_libs" ; then
       cap_ng=yes
       libs_tools="$cap_libs $libs_tools"
     else
       if test "$cap_ng" = "yes" ; then
         feature_not_found "cap_ng"
       fi
       cap_ng=no
     fi
   fi
   
   ##########################################
 # Sound support libraries probe  # Sound support libraries probe
   
 audio_drv_probe()  audio_drv_probe()
Line 1496  for drv in $audio_drv_list; do Line 1876  for drv in $audio_drv_list; do
     ;;      ;;
   
     pa)      pa)
     audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \      audio_drv_probe $drv pulse/mainloop.h "-lpulse" \
         "pa_simple *s = NULL; pa_simple_free(s); return 0;"          "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;"
     libs_softmmu="-lpulse -lpulse-simple $libs_softmmu"      libs_softmmu="-lpulse $libs_softmmu"
     audio_pt_int="yes"      audio_pt_int="yes"
     ;;      ;;
   
Line 1559  fi Line 1939  fi
   
 ##########################################  ##########################################
 # curses probe  # curses probe
 curses_list="-lncurses -lcurses"  if test "$mingw32" = "yes" ; then
       curses_list="-lpdcurses"
   else
       curses_list="-lncurses -lcurses"
   fi
   
 if test "$curses" != "no" ; then  if test "$curses" != "no" ; then
   curses_found=no    curses_found=no
   cat > $TMPC << EOF    cat > $TMPC << EOF
 #include <curses.h>  #include <curses.h>
 #ifdef __OpenBSD__  int main(void) {
 #define resize_term resizeterm    const char *s = curses_version();
 #endif    resize_term(0, 0);
 int main(void) { resize_term(0, 0); return curses_version(); }    return s != 0;
   }
 EOF  EOF
   for curses_lib in $curses_list; do    for curses_lib in $curses_list; do
     if compile_prog "" "$curses_lib" ; then      if compile_prog "" "$curses_lib" ; then
Line 1599  fi Line 1984  fi
 if test "$curl" != "no" ; then  if test "$curl" != "no" ; then
   cat > $TMPC << EOF    cat > $TMPC << EOF
 #include <curl/curl.h>  #include <curl/curl.h>
 int main(void) { return curl_easy_init(); }  int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
 EOF  EOF
   curl_cflags=`$curlconfig --cflags 2>/dev/null`    curl_cflags=`$curlconfig --cflags 2>/dev/null`
   curl_libs=`$curlconfig --libs 2>/dev/null`    curl_libs=`$curlconfig --libs 2>/dev/null`
Line 1616  EOF Line 2001  EOF
 fi # test "$curl"  fi # test "$curl"
   
 ##########################################  ##########################################
 # check framework probe  
   
 if test "$check_utests" != "no" ; then  
   cat > $TMPC << EOF  
 #include <check.h>  
 int main(void) { suite_create("qemu test"); return 0; }  
 EOF  
   check_libs=`$pkg_config --libs check`  
   if compile_prog "" $check_libs ; then  
     check_utests=yes  
     libs_tools="$check_libs $libs_tools"  
   else  
     if test "$check_utests" = "yes" ; then  
       feature_not_found "check"  
     fi  
     check_utests=no  
   fi  
 fi # test "$check_utests"  
   
 ##########################################  
 # bluez support probe  # bluez support probe
 if test "$bluez" != "no" ; then  if test "$bluez" != "no" ; then
   cat > $TMPC << EOF    cat > $TMPC << EOF
Line 1656  EOF Line 2021  EOF
 fi  fi
   
 ##########################################  ##########################################
 # kvm probe  # glib support probe
 if test "$kvm" != "no" ; then  
     cat > $TMPC <<EOF  if test "$mingw32" = yes; then
 #include <linux/kvm.h>      # g_poll is required in order to integrate with the glib main loop.
 #if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12      glib_req_ver=2.20
 #error Invalid KVM version  else
 #endif      glib_req_ver=2.12
 EOF  fi
     must_have_caps="KVM_CAP_USER_MEMORY \  if $pkg_config --atleast-version=$glib_req_ver gthread-2.0 > /dev/null 2>&1
                     KVM_CAP_DESTROY_MEMORY_REGION_WORKS \  then
                     KVM_CAP_COALESCED_MMIO \      glib_cflags=`$pkg_config --cflags gthread-2.0 2>/dev/null`
                     KVM_CAP_SYNC_MMU \      glib_libs=`$pkg_config --libs gthread-2.0 2>/dev/null`
                    "      LIBS="$glib_libs $LIBS"
     if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) ; then      libs_qga="$glib_libs $libs_qga"
       must_have_caps="$caps \  else
                       KVM_CAP_SET_TSS_ADDR \      echo "glib-$glib_req_ver required to compile QEMU"
                       KVM_CAP_EXT_CPUID \      exit 1
                       KVM_CAP_CLOCKSOURCE \  
                       KVM_CAP_NOP_IO_DELAY \  
                       KVM_CAP_PV_MMU \  
                       KVM_CAP_MP_STATE \  
                       KVM_CAP_USER_NMI \  
                      "  
     fi  
     for c in $must_have_caps ; do  
       cat >> $TMPC <<EOF  
 #if !defined($c)  
 #error Missing KVM capability $c  
 #endif  
 EOF  
     done  
     cat >> $TMPC <<EOF  
 int main(void) { return 0; }  
 EOF  
   if test "$kerneldir" != "" ; then  
       kvm_cflags=-I"$kerneldir"/include  
       if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \  
          -a -d "$kerneldir/arch/x86/include" ; then  
             kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"  
         elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then  
             kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"  
         elif test "$cpu" = "s390x" -a -d "$kerneldir/arch/s390/include" ; then  
             kvm_cflags="$kvm_cflags -I$kerneldir/arch/s390/include"  
         elif test -d "$kerneldir/arch/$cpu/include" ; then  
             kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"  
       fi  
   else  
     kvm_cflags=`$pkg_config --cflags kvm-kmod 2>/dev/null`  
   fi  
   if compile_prog "$kvm_cflags" "" ; then  
     kvm=yes  
     cat > $TMPC <<EOF  
 #include <linux/kvm_para.h>  
 int main(void) { return 0; }  
 EOF  
     if compile_prog "$kvm_cflags" "" ; then  
       kvm_para=yes  
     fi  
   else  
     if test "$kvm" = "yes" ; then  
       if has awk && has grep; then  
         kvmerr=`LANG=C $cc $QEMU_CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \  
         | grep "error: " \  
         | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`  
         if test "$kvmerr" != "" ; then  
           echo -e "${kvmerr}\n\  
 NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \  
 recent kvm-kmod from http://sourceforge.net/projects/kvm."  
         fi  
       fi  
       feature_not_found "kvm"  
     fi  
     kvm=no  
   fi  
 fi  fi
   
 ##########################################  ##########################################
 # test for vhost net  # libcap probe
   
 if test "$vhost_net" != "no"; then  if test "$cap" != "no" ; then
     if test "$kvm" != "no"; then    cat > $TMPC <<EOF
             cat > $TMPC <<EOF  #include <stdio.h>
     #include <linux/vhost.h>  #include <sys/capability.h>
     int main(void) { return 0; }  int main(void) { cap_t caps; caps = cap_init(); }
 EOF  EOF
             if compile_prog "$kvm_cflags" "" ; then    if compile_prog "" "-lcap" ; then
                 vhost_net=yes      cap=yes
             else    else
                 if test "$vhost_net" = "yes" ; then      cap=no
                     feature_not_found "vhost-net"    fi
                 fi  
                 vhost_net=no  
             fi  
     else  
             if test "$vhost_net" = "yes" ; then  
                 echo "NOTE: vhost-net feature requires KVM (--enable-kvm)."  
                 feature_not_found "vhost-net"  
             fi  
             vhost_net=no  
     fi  
 fi  fi
   
 ##########################################  ##########################################
 # pthread probe  # pthread probe
 PTHREADLIBS_LIST="-lpthread -lpthreadGC2"  PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
   
 pthread=no  pthread=no
 cat > $TMPC << EOF  cat > $TMPC << EOF
 #include <pthread.h>  #include <pthread.h>
 int main(void) { pthread_create(0,0,0,0); return 0; }  static void *f(void *p) { return NULL; }
   int main(void) {
     pthread_t thread;
     pthread_create(&thread, 0, f, 0);
     return 0;
   }
 EOF  EOF
 if compile_prog "" "" ; then  if compile_prog "" "" ; then
   pthread=yes    pthread=yes
Line 1773  else Line 2076  else
   for pthread_lib in $PTHREADLIBS_LIST; do    for pthread_lib in $PTHREADLIBS_LIST; do
     if compile_prog "" "$pthread_lib" ; then      if compile_prog "" "$pthread_lib" ; then
       pthread=yes        pthread=yes
       LIBS="$pthread_lib $LIBS"        found=no
         for lib_entry in $LIBS; do
           if test "$lib_entry" = "$pthread_lib"; then
             found=yes
             break
           fi
         done
         if test "$found" = "no"; then
           LIBS="$pthread_lib $LIBS"
         fi
       break        break
     fi      fi
   done    done
Line 1792  fi Line 2104  fi
 if test "$rbd" != "no" ; then  if test "$rbd" != "no" ; then
   cat > $TMPC <<EOF    cat > $TMPC <<EOF
 #include <stdio.h>  #include <stdio.h>
 #include <rados/librados.h>  #include <rbd/librbd.h>
 int main(void) { rados_initialize(0, NULL); return 0; }  
 EOF  
   rbd_libs="-lrados"  
   if compile_prog "" "$rbd_libs" ; then  
     librados_too_old=no  
     cat > $TMPC <<EOF  
 #include <stdio.h>  
 #include <rados/librados.h>  
 #ifndef CEPH_OSD_TMAP_SET  
 #error missing CEPH_OSD_TMAP_SET  
 #endif  
 int main(void) {  int main(void) {
     int (*func)(const rados_pool_t pool, uint64_t *snapid) = rados_selfmanaged_snap_create;      rados_t cluster;
     rados_initialize(0, NULL);      rados_create(&cluster, NULL);
     return 0;      return 0;
 }  }
 EOF  EOF
     if compile_prog "" "$rbd_libs" ; then    rbd_libs="-lrbd -lrados"
       rbd=yes    if compile_prog "" "$rbd_libs" ; then
       libs_tools="$rbd_libs $libs_tools"      rbd=yes
       libs_softmmu="$rbd_libs $libs_softmmu"      libs_tools="$rbd_libs $libs_tools"
     else      libs_softmmu="$rbd_libs $libs_softmmu"
       rbd=no  
       librados_too_old=yes  
     fi  
   else    else
     if test "$rbd" = "yes" ; then      if test "$rbd" = "yes" ; then
       feature_not_found "rados block device"        feature_not_found "rados block device"
     fi      fi
     rbd=no      rbd=no
   fi    fi
   if test "$librados_too_old" = "yes" ; then  
     echo "-> Your librados version is too old - upgrade needed to have rbd support"  
   fi  
 fi  fi
   
 ##########################################  ##########################################
Line 1858  if test "$attr" != "no" ; then Line 2153  if test "$attr" != "no" ; then
   cat > $TMPC <<EOF    cat > $TMPC <<EOF
 #include <stdio.h>  #include <stdio.h>
 #include <sys/types.h>  #include <sys/types.h>
   #ifdef CONFIG_LIBATTR
 #include <attr/xattr.h>  #include <attr/xattr.h>
   #else
   #include <sys/xattr.h>
   #endif
 int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }  int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
 EOF  EOF
   if compile_prog "" "-lattr" ; then    if compile_prog "" "" ; then
       attr=yes
     # Older distros have <attr/xattr.h>, and need -lattr:
     elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
     attr=yes      attr=yes
     LIBS="-lattr $LIBS"      LIBS="-lattr $LIBS"
       libattr=yes
   else    else
     if test "$attr" = "yes" ; then      if test "$attr" = "yes" ; then
       feature_not_found "ATTR"        feature_not_found "ATTR"
Line 1878  cat > $TMPC <<EOF Line 2181  cat > $TMPC <<EOF
 #include <sys/types.h>  #include <sys/types.h>
 #include <sys/uio.h>  #include <sys/uio.h>
 #include <unistd.h>  #include <unistd.h>
 int main(void) { struct iovec iov; return 0; }  int main(void) { return sizeof(struct iovec); }
 EOF  EOF
 iovec=no  iovec=no
 if compile_prog "" "" ; then  if compile_prog "" "" ; then
Line 1891  cat > $TMPC <<EOF Line 2194  cat > $TMPC <<EOF
 #include <sys/types.h>  #include <sys/types.h>
 #include <sys/uio.h>  #include <sys/uio.h>
 #include <unistd.h>  #include <unistd.h>
 int main(void) { preadv; }  int main(void) { return preadv == preadv; }
 EOF  EOF
 preadv=no  preadv=no
 if compile_prog "" "" ; then  if compile_prog "" "" ; then
Line 1907  int main(void) { return 0; } Line 2210  int main(void) { return 0; }
 EOF  EOF
   if compile_prog "" "$fdt_libs" ; then    if compile_prog "" "$fdt_libs" ; then
     fdt=yes      fdt=yes
     libs_softmmu="$fdt_libs $libs_softmmu"  
   else    else
     if test "$fdt" = "yes" ; then      if test "$fdt" = "yes" ; then
       feature_not_found "fdt"        feature_not_found "fdt"
     fi      fi
       fdt_libs=
     fdt=no      fdt=no
   fi    fi
 fi  fi
   
   ##########################################
   # opengl probe, used by milkymist-tmu2
   if test "$opengl" != "no" ; then
     opengl_libs="-lGL"
     cat > $TMPC << EOF
   #include <X11/Xlib.h>
   #include <GL/gl.h>
   #include <GL/glx.h>
   int main(void) { return GL_VERSION != 0; }
   EOF
     if compile_prog "" "-lGL" ; then
       opengl=yes
     else
       if test "$opengl" = "yes" ; then
         feature_not_found "opengl"
       fi
       opengl_libs=
       opengl=no
     fi
   fi
   
 #  #
 # Check for xxxat() functions when we are building linux-user  # Check for xxxat() functions when we are building linux-user
 # emulator.  This is done because older glibc versions don't  # emulator.  This is done because older glibc versions don't
Line 2034  cat > $TMPC << EOF Line 2358  cat > $TMPC << EOF
   
 int main(void)  int main(void)
 {  {
     int len, fd;      int len, fd = 0;
     len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);      len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
     splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);      splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
     return 0;      return 0;
Line 2048  fi Line 2372  fi
 # signalfd probe  # signalfd probe
 signalfd="no"  signalfd="no"
 cat > $TMPC << EOF  cat > $TMPC << EOF
 #define _GNU_SOURCE  
 #include <unistd.h>  #include <unistd.h>
 #include <sys/syscall.h>  #include <sys/syscall.h>
 #include <signal.h>  #include <signal.h>
Line 2066  cat > $TMPC << EOF Line 2389  cat > $TMPC << EOF
   
 int main(void)  int main(void)
 {  {
     int efd = eventfd(0, 0);      return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
     return 0;  
 }  }
 EOF  EOF
 if compile_prog "" "" ; then  if compile_prog "" "" ; then
Line 2085  int main(void) Line 2407  int main(void)
     return 0;      return 0;
 }  }
 EOF  EOF
 if compile_prog "$ARCH_CFLAGS" "" ; then  if compile_prog "" "" ; then
   fallocate=yes    fallocate=yes
 fi  fi
   
Line 2100  int main(void) Line 2422  int main(void)
     return 0;      return 0;
 }  }
 EOF  EOF
 if compile_prog "$ARCH_CFLAGS" "" ; then  if compile_prog "" "" ; then
   sync_file_range=yes    sync_file_range=yes
 fi  fi
   
Line 2117  int main(void) Line 2439  int main(void)
     return 0;      return 0;
 }  }
 EOF  EOF
 if compile_prog "$ARCH_CFLAGS" "" ; then  if compile_prog "" "" ; then
   fiemap=yes    fiemap=yes
 fi  fi
   
Line 2136  if compile_prog "" "" ; then Line 2458  if compile_prog "" "" ; then
   dup3=yes    dup3=yes
 fi  fi
   
   # check for epoll support
   epoll=no
   cat > $TMPC << EOF
   #include <sys/epoll.h>
   
   int main(void)
   {
       epoll_create(0);
       return 0;
   }
   EOF
   if compile_prog "" "" ; then
     epoll=yes
   fi
   
   # epoll_create1 and epoll_pwait are later additions
   # so we must check separately for their presence
   epoll_create1=no
   cat > $TMPC << EOF
   #include <sys/epoll.h>
   
   int main(void)
   {
       /* Note that we use epoll_create1 as a value, not as
        * a function being called. This is necessary so that on
        * old SPARC glibc versions where the function was present in
        * the library but not declared in the header file we will
        * fail the configure check. (Otherwise we will get a compiler
        * warning but not an error, and will proceed to fail the
        * qemu compile where we compile with -Werror.)
        */
       return epoll_create1 == epoll_create1;
   }
   EOF
   if compile_prog "" "" ; then
     epoll_create1=yes
   fi
   
   epoll_pwait=no
   cat > $TMPC << EOF
   #include <sys/epoll.h>
   
   int main(void)
   {
       epoll_pwait(0, 0, 0, 0, 0);
       return 0;
   }
   EOF
   if compile_prog "" "" ; then
     epoll_pwait=yes
   fi
   
 # Check if tools are available to build documentation.  # Check if tools are available to build documentation.
 if test "$docs" != "no" ; then  if test "$docs" != "no" ; then
   if has makeinfo && has pod2man; then    if has makeinfo && has pod2man; then
Line 2171  if compile_prog "" "" ; then Line 2545  if compile_prog "" "" ; then
 fi  fi
   
 ##########################################  ##########################################
   # Do we have libiscsi
   # We check for iscsi_unmap_sync() to make sure we have a
   # recent enough version of libiscsi.
   if test "$libiscsi" != "no" ; then
     cat > $TMPC << EOF
   #include <stdio.h>
   #include <iscsi/iscsi.h>
   int main(void) { iscsi_unmap_sync(NULL,0,0,0,NULL,0); return 0; }
   EOF
     if compile_prog "-Werror" "-liscsi" ; then
       libiscsi="yes"
       LIBS="$LIBS -liscsi"
     else
       if test "$libiscsi" = "yes" ; then
         feature_not_found "libiscsi"
       fi
       libiscsi="no"
     fi
   fi
   
   
   ##########################################
 # Do we need librt  # Do we need librt
 cat > $TMPC <<EOF  cat > $TMPC <<EOF
 #include <signal.h>  #include <signal.h>
 #include <time.h>  #include <time.h>
 int main(void) { clockid_t id; return clock_gettime(id, NULL); }  int main(void) { return clock_gettime(CLOCK_REALTIME, NULL); }
 EOF  EOF
   
 if compile_prog "" "" ; then  if compile_prog "" "" ; then
Line 2190  if test "$darwin" != "yes" -a "$mingw32" Line 2586  if test "$darwin" != "yes" -a "$mingw32"
 fi  fi
   
 ##########################################  ##########################################
 # check if the compiler defines offsetof  
   
 need_offsetof=yes  
 cat > $TMPC << EOF  
 #include <stddef.h>  
 int main(void) { struct s { int f; }; return offsetof(struct s, f); }  
 EOF  
 if compile_prog "" "" ; then  
     need_offsetof=no  
 fi  
   
 ##########################################  
 # check if the compiler understands attribute warn_unused_result  
 #  
 # This could be smarter, but gcc -Werror does not error out even when warning  
 # about attribute warn_unused_result  
   
 gcc_attribute_warn_unused_result=no  
 cat > $TMPC << EOF  
 #if defined(__GNUC__) && (__GNUC__ < 4) && defined(__GNUC_MINOR__) && (__GNUC__ < 4)  
 #error gcc 3.3 or older  
 #endif  
 int main(void) { return 0;}  
 EOF  
 if compile_prog "" ""; then  
     gcc_attribute_warn_unused_result=yes  
 fi  
   
 # spice probe  # spice probe
 if test "$spice" != "no" ; then  if test "$spice" != "no" ; then
   cat > $TMPC << EOF    cat > $TMPC << EOF
Line 2226  int main(void) { spice_server_new(); ret Line 2594  int main(void) { spice_server_new(); ret
 EOF  EOF
   spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)    spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
   spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)    spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
   if $pkg_config --atleast-version=0.5.3 spice-server >/dev/null 2>&1 && \    if $pkg_config --atleast-version=0.8.2 spice-server >/dev/null 2>&1 && \
        $pkg_config --atleast-version=0.8.1 spice-protocol > /dev/null 2>&1 && \
      compile_prog "$spice_cflags" "$spice_libs" ; then       compile_prog "$spice_cflags" "$spice_libs" ; then
     spice="yes"      spice="yes"
     libs_softmmu="$libs_softmmu $spice_libs"      libs_softmmu="$libs_softmmu $spice_libs"
Line 2239  EOF Line 2608  EOF
   fi    fi
 fi  fi
   
   # check for libcacard for smartcard support
   if test "$smartcard" != "no" ; then
       smartcard="yes"
       smartcard_cflags=""
       # TODO - what's the minimal nss version we support?
       if test "$smartcard_nss" != "no"; then
         cat > $TMPC << EOF
   #include <pk11pub.h>
   int main(void) { PK11_FreeSlot(0); return 0; }
   EOF
           smartcard_cflags="-I\$(SRC_PATH)/libcacard"
           libcacard_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs"
           libcacard_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags"
           if $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 && \
             compile_prog "$smartcard_cflags $libcacard_cflags" "$libcacard_libs"; then
               smartcard_nss="yes"
               QEMU_CFLAGS="$QEMU_CFLAGS $smartcard_cflags $libcacard_cflags"
               libs_softmmu="$libcacard_libs $libs_softmmu"
           else
               if test "$smartcard_nss" = "yes"; then
                   feature_not_found "nss"
               fi
               smartcard_nss="no"
           fi
       fi
   fi
   if test "$smartcard" = "no" ; then
       smartcard_nss="no"
   fi
   
   # check for usbredirparser for usb network redirection support
   if test "$usb_redir" != "no" ; then
       if $pkg_config --atleast-version=0.3.4 libusbredirparser >/dev/null 2>&1 ; then
           usb_redir="yes"
           usb_redir_cflags=$($pkg_config --cflags libusbredirparser 2>/dev/null)
           usb_redir_libs=$($pkg_config --libs libusbredirparser 2>/dev/null)
           QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
           LIBS="$LIBS $usb_redir_libs"
       else
           if test "$usb_redir" = "yes"; then
               feature_not_found "usb-redir"
           fi
           usb_redir="no"
       fi
   fi
   
 ##########################################  ##########################################
   
 ##########################################  ##########################################
Line 2247  fi Line 2662  fi
 fdatasync=no  fdatasync=no
 cat > $TMPC << EOF  cat > $TMPC << EOF
 #include <unistd.h>  #include <unistd.h>
 int main(void) { return fdatasync(0); }  int main(void) {
   #if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
   return fdatasync(0);
   #else
   #error Not supported
   #endif
   }
 EOF  EOF
 if compile_prog "" "" ; then  if compile_prog "" "" ; then
     fdatasync=yes      fdatasync=yes
Line 2283  fi Line 2704  fi
 ##########################################  ##########################################
 # check if trace backend exists  # check if trace backend exists
   
 sh "$source_path/scripts/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null  $python "$source_path/scripts/tracetool.py" "--backend=$trace_backend" --check-backend  > /dev/null 2> /dev/null
 if test "$?" -ne 0 ; then  if test "$?" -ne 0 ; then
   echo    echo
   echo "Error: invalid trace backend"    echo "Error: invalid trace backend"
Line 2301  if test "$trace_backend" = "ust"; then Line 2722  if test "$trace_backend" = "ust"; then
 int main(void) { return 0; }  int main(void) { return 0; }
 EOF  EOF
   if compile_prog "" "" ; then    if compile_prog "" "" ; then
     LIBS="-lust $LIBS"      LIBS="-lust -lurcu-bp $LIBS"
       libs_qga="-lust -lurcu-bp $libs_qga"
   else    else
     echo      echo
     echo "Error: Trace backend 'ust' missing libust header files"      echo "Error: Trace backend 'ust' missing libust header files"
Line 2326  if test "$trace_backend" = "dtrace"; the Line 2748  if test "$trace_backend" = "dtrace"; the
 fi  fi
   
 ##########################################  ##########################################
   # __sync_fetch_and_and requires at least -march=i486. Many toolchains
   # use i686 as default anyway, but for those that don't, an explicit
   # specification is necessary
   if test "$vhost_net" = "yes" && test "$cpu" = "i386"; then
     cat > $TMPC << EOF
   int sfaa(unsigned *ptr)
   {
     return __sync_fetch_and_and(ptr, 0);
   }
   
   int main(int argc, char **argv)
   {
     int val = 42;
     sfaa(&val);
     return val;
   }
   EOF
     if ! compile_prog "" "" ; then
       CFLAGS+="-march=i486"
     fi
   fi
   
   ##########################################
   # check and set a backend for coroutine
   
   # default is ucontext, but always fallback to gthread
   # windows autodetected by make
   if test "$coroutine" = "" -o "$coroutine" = "ucontext"; then
     if test "$darwin" != "yes"; then
       cat > $TMPC << EOF
   #include <ucontext.h>
   #ifdef __stub_makecontext
   #error Ignoring glibc stub makecontext which will always fail
   #endif
   int main(void) { makecontext(0, 0, 0); return 0; }
   EOF
       if compile_prog "" "" ; then
           coroutine_backend=ucontext
       else
           coroutine_backend=gthread
       fi
     else
       echo "Silently falling back into gthread backend under darwin"
     fi
   elif test "$coroutine" = "gthread" ; then
     coroutine_backend=gthread
   elif test "$coroutine" = "windows" ; then
     coroutine_backend=windows
   elif test "$coroutine" = "sigaltstack" ; then
     coroutine_backend=sigaltstack
   else
     echo
     echo "Error: unknown coroutine backend $coroutine"
     echo
     exit 1
   fi
   
   ##########################################
   # check if we have open_by_handle_at
   
   open_by_hande_at=no
   cat > $TMPC << EOF
   #include <fcntl.h>
   #if !defined(AT_EMPTY_PATH)
   # error missing definition
   #else
   int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
   #endif
   EOF
   if compile_prog "" "" ; then
       open_by_handle_at=yes
   fi
   
   ########################################
   # check if we have linux/magic.h
   
   linux_magic_h=no
   cat > $TMPC << EOF
   #include <linux/magic.h>
   int main(void) {
     return 0;
   }
   EOF
   if compile_prog "" "" ; then
       linux_magic_h=yes
   fi
   
   ########################################
   # check if environ is declared
   
   has_environ=no
   cat > $TMPC << EOF
   #include <unistd.h>
   int main(void) {
       environ = environ;
       return 0;
   }
   EOF
   if compile_prog "" "" ; then
       has_environ=yes
   fi
   
   ##########################################
 # End of CC checks  # End of CC checks
 # After here, no more $cc or $ld runs  # After here, no more $cc or $ld runs
   
Line 2366  if test "$solaris" = "no" ; then Line 2891  if test "$solaris" = "no" ; then
     fi      fi
 fi  fi
   
   # test if pod2man has --utf8 option
   if pod2man --help | grep -q utf8; then
       POD2MAN="pod2man --utf8"
   else
       POD2MAN="pod2man"
   fi
   
 # Use ASLR, no-SEH and DEP if available  # Use ASLR, no-SEH and DEP if available
 if test "$mingw32" = "yes" ; then  if test "$mingw32" = "yes" ; then
     for flag in --dynamicbase --no-seh --nxcompat; do      for flag in --dynamicbase --no-seh --nxcompat; do
Line 2375  if test "$mingw32" = "yes" ; then Line 2907  if test "$mingw32" = "yes" ; then
     done      done
 fi  fi
   
 confdir=$sysconfdir$confsuffix  qemu_confdir=$sysconfdir$confsuffix
   qemu_datadir=$datadir$confsuffix
   
 tools=  tools=
 if test "$softmmu" = yes ; then  if test "$softmmu" = yes ; then
   tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"    tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
     if test "$virtfs" != no ; then
       if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then
         virtfs=yes
         tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
       else
         if test "$virtfs" = yes; then
           echo "VirtFS is supported only on Linux and requires libcap-devel and libattr-devel"
           exit 1
         fi
         virtfs=no
       fi
     fi
   if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then    if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
       tools="qemu-nbd\$(EXESUF) $tools"        tools="qemu-nbd\$(EXESUF) $tools"
     if [ "$check_utests" = "yes" ]; then      if [ "$guest_agent" = "yes" ]; then
       tools="check-qint check-qstring check-qdict check-qlist $tools"        tools="qemu-ga\$(EXESUF) $tools"
       tools="check-qfloat check-qjson $tools"  
     fi      fi
   fi    fi
 fi  fi
Line 2396  if test \( "$cpu" = "i386" -o "$cpu" = " Line 2940  if test \( "$cpu" = "i386" -o "$cpu" = "
         "$softmmu" = yes ; then          "$softmmu" = yes ; then
   roms="optionrom"    roms="optionrom"
 fi  fi
   if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
     roms="$roms spapr-rtas"
   fi
   
 echo "Install prefix    $prefix"  echo "Install prefix    $prefix"
 echo "BIOS directory    `eval echo $datadir`"  echo "BIOS directory    `eval echo $qemu_datadir`"
 echo "binary directory  `eval echo $bindir`"  echo "binary directory  `eval echo $bindir`"
   echo "library directory `eval echo $libdir`"
   echo "include directory `eval echo $includedir`"
 echo "config directory  `eval echo $sysconfdir`"  echo "config directory  `eval echo $sysconfdir`"
 if test "$mingw32" = "no" ; then  if test "$mingw32" = "no" ; then
 echo "Manual directory  `eval echo $mandir`"  echo "Manual directory  `eval echo $mandir`"
Line 2414  echo "QEMU_CFLAGS       $QEMU_CFLAGS" Line 2962  echo "QEMU_CFLAGS       $QEMU_CFLAGS"
 echo "LDFLAGS           $LDFLAGS"  echo "LDFLAGS           $LDFLAGS"
 echo "make              $make"  echo "make              $make"
 echo "install           $install"  echo "install           $install"
   echo "python            $python"
   if test "$slirp" = "yes" ; then
       echo "smbd              $smbd"
   fi
 echo "host CPU          $cpu"  echo "host CPU          $cpu"
 echo "host big endian   $bigendian"  echo "host big endian   $bigendian"
 echo "target list       $target_list"  echo "target list       $target_list"
Line 2431  fi Line 2983  fi
 echo "SDL support       $sdl"  echo "SDL support       $sdl"
 echo "curses support    $curses"  echo "curses support    $curses"
 echo "curl support      $curl"  echo "curl support      $curl"
 echo "check support     $check_utests"  
 echo "mingw32 support   $mingw32"  echo "mingw32 support   $mingw32"
 echo "Audio drivers     $audio_drv_list"  echo "Audio drivers     $audio_drv_list"
 echo "Extra audio cards $audio_card_list"  echo "Extra audio cards $audio_card_list"
 echo "Block whitelist   $block_drv_whitelist"  echo "Block whitelist   $block_drv_whitelist"
 echo "Mixer emulation   $mixemu"  echo "Mixer emulation   $mixemu"
 echo "VNC TLS support   $vnc_tls"  echo "VirtFS support    $virtfs"
 echo "VNC SASL support  $vnc_sasl"  echo "VNC support       $vnc"
 echo "VNC JPEG support  $vnc_jpeg"  if test "$vnc" = "yes" ; then
 echo "VNC PNG support   $vnc_png"      echo "VNC TLS support   $vnc_tls"
 echo "VNC thread        $vnc_thread"      echo "VNC SASL support  $vnc_sasl"
       echo "VNC JPEG support  $vnc_jpeg"
       echo "VNC PNG support   $vnc_png"
       echo "VNC thread        $vnc_thread"
   fi
 if test -n "$sparc_cpu"; then  if test -n "$sparc_cpu"; then
     echo "Target Sparc Arch $sparc_cpu"      echo "Target Sparc Arch $sparc_cpu"
 fi  fi
Line 2453  echo "Documentation     $docs" Line 3008  echo "Documentation     $docs"
 echo "uname -r          $uname_release"  echo "uname -r          $uname_release"
 echo "NPTL support      $nptl"  echo "NPTL support      $nptl"
 echo "GUEST_BASE        $guest_base"  echo "GUEST_BASE        $guest_base"
 echo "PIE user targets  $user_pie"  echo "PIE               $pie"
 echo "vde support       $vde"  echo "vde support       $vde"
 echo "IO thread         $io_thread"  
 echo "Linux AIO support $linux_aio"  echo "Linux AIO support $linux_aio"
 echo "ATTR/XATTR support $attr"  echo "ATTR/XATTR support $attr"
 echo "Install blobs     $blobs"  echo "Install blobs     $blobs"
 echo "KVM support       $kvm"  echo "KVM support       $kvm"
   echo "TCG interpreter   $tcg_interpreter"
 echo "fdt support       $fdt"  echo "fdt support       $fdt"
 echo "preadv support    $preadv"  echo "preadv support    $preadv"
 echo "fdatasync         $fdatasync"  echo "fdatasync         $fdatasync"
 echo "madvise           $madvise"  echo "madvise           $madvise"
 echo "posix_madvise     $posix_madvise"  echo "posix_madvise     $posix_madvise"
 echo "uuid support      $uuid"  echo "uuid support      $uuid"
   echo "libcap-ng support $cap_ng"
 echo "vhost-net support $vhost_net"  echo "vhost-net support $vhost_net"
 echo "Trace backend     $trace_backend"  echo "Trace backend     $trace_backend"
 echo "Trace output file $trace_file-<pid>"  echo "Trace output file $trace_file-<pid>"
 echo "spice support     $spice"  echo "spice support     $spice"
 echo "rbd support       $rbd"  echo "rbd support       $rbd"
 echo "xfsctl support    $xfs"  echo "xfsctl support    $xfs"
   echo "nss used          $smartcard_nss"
   echo "usb net redir     $usb_redir"
   echo "OpenGL support    $opengl"
   echo "libiscsi support  $libiscsi"
   echo "build guest agent $guest_agent"
   echo "coroutine backend $coroutine_backend"
   
 if test $sdl_too_old = "yes"; then  if test "$sdl_too_old" = "yes"; then
 echo "-> Your SDL version is too old - please upgrade to have SDL support"  echo "-> Your SDL version is too old - please upgrade to have SDL support"
 fi  fi
   
Line 2488  echo >> $config_host_mak Line 3050  echo >> $config_host_mak
 echo all: >> $config_host_mak  echo all: >> $config_host_mak
 echo "prefix=$prefix" >> $config_host_mak  echo "prefix=$prefix" >> $config_host_mak
 echo "bindir=$bindir" >> $config_host_mak  echo "bindir=$bindir" >> $config_host_mak
   echo "libdir=$libdir" >> $config_host_mak
   echo "includedir=$includedir" >> $config_host_mak
 echo "mandir=$mandir" >> $config_host_mak  echo "mandir=$mandir" >> $config_host_mak
 echo "datadir=$datadir" >> $config_host_mak  
 echo "sysconfdir=$sysconfdir" >> $config_host_mak  echo "sysconfdir=$sysconfdir" >> $config_host_mak
 echo "docdir=$docdir" >> $config_host_mak  echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
 echo "confdir=$confdir" >> $config_host_mak  echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
   echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
   echo "libexecdir=\${prefix}/libexec" >> $config_host_mak
   echo "CONFIG_QEMU_HELPERDIR=\"$prefix/libexec\"" >> $config_host_mak
   
 case "$cpu" in  
   i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)  
     ARCH=$cpu  
   ;;  
   armv4b|armv4l)  
     ARCH=arm  
   ;;  
 esac  
 echo "ARCH=$ARCH" >> $config_host_mak  echo "ARCH=$ARCH" >> $config_host_mak
 if test "$debug_tcg" = "yes" ; then  if test "$debug_tcg" = "yes" ; then
   echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak    echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
Line 2518  fi Line 3076  fi
 if test "$bigendian" = "yes" ; then  if test "$bigendian" = "yes" ; then
   echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak    echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
 fi  fi
 echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak  
 if test "$mingw32" = "yes" ; then  if test "$mingw32" = "yes" ; then
   echo "CONFIG_WIN32=y" >> $config_host_mak    echo "CONFIG_WIN32=y" >> $config_host_mak
   rc_version=`cat $source_path/VERSION`    rc_version=`cat $source_path/VERSION`
Line 2559  fi Line 3116  fi
 if test "$static" = "yes" ; then  if test "$static" = "yes" ; then
   echo "CONFIG_STATIC=y" >> $config_host_mak    echo "CONFIG_STATIC=y" >> $config_host_mak
 fi  fi
 if test $profiler = "yes" ; then  if test "$profiler" = "yes" ; then
   echo "CONFIG_PROFILER=y" >> $config_host_mak    echo "CONFIG_PROFILER=y" >> $config_host_mak
 fi  fi
 if test "$slirp" = "yes" ; then  if test "$slirp" = "yes" ; then
   echo "CONFIG_SLIRP=y" >> $config_host_mak    echo "CONFIG_SLIRP=y" >> $config_host_mak
     echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
   QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES"    QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES"
 fi  fi
 if test "$vde" = "yes" ; then  if test "$vde" = "yes" ; then
   echo "CONFIG_VDE=y" >> $config_host_mak    echo "CONFIG_VDE=y" >> $config_host_mak
 fi  fi
   if test "$cap_ng" = "yes" ; then
     echo "CONFIG_LIBCAP=y" >> $config_host_mak
   fi
 for card in $audio_card_list; do  for card in $audio_card_list; do
     def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`      def=CONFIG_`echo $card | LC_ALL=C tr '[a-z]' '[A-Z]'`
     echo "$def=y" >> $config_host_mak      echo "$def=y" >> $config_host_mak
 done  done
 echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak  echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
 for drv in $audio_drv_list; do  for drv in $audio_drv_list; do
     def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`      def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'`
     echo "$def=y" >> $config_host_mak      echo "$def=y" >> $config_host_mak
     if test "$drv" = "fmod"; then      if test "$drv" = "fmod"; then
         echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak          echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
Line 2591  echo "CONFIG_BDRV_WHITELIST=$block_drv_w Line 3152  echo "CONFIG_BDRV_WHITELIST=$block_drv_w
 if test "$mixemu" = "yes" ; then  if test "$mixemu" = "yes" ; then
   echo "CONFIG_MIXEMU=y" >> $config_host_mak    echo "CONFIG_MIXEMU=y" >> $config_host_mak
 fi  fi
   if test "$vnc" = "yes" ; then
     echo "CONFIG_VNC=y" >> $config_host_mak
   fi
 if test "$vnc_tls" = "yes" ; then  if test "$vnc_tls" = "yes" ; then
   echo "CONFIG_VNC_TLS=y" >> $config_host_mak    echo "CONFIG_VNC_TLS=y" >> $config_host_mak
   echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak    echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
Line 2599  if test "$vnc_sasl" = "yes" ; then Line 3163  if test "$vnc_sasl" = "yes" ; then
   echo "CONFIG_VNC_SASL=y" >> $config_host_mak    echo "CONFIG_VNC_SASL=y" >> $config_host_mak
   echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak    echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
 fi  fi
 if test "$vnc_jpeg" != "no" ; then  if test "$vnc_jpeg" = "yes" ; then
   echo "CONFIG_VNC_JPEG=y" >> $config_host_mak    echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
   echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak    echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak
 fi  fi
 if test "$vnc_png" != "no" ; then  if test "$vnc_png" = "yes" ; then
   echo "CONFIG_VNC_PNG=y" >> $config_host_mak    echo "CONFIG_VNC_PNG=y" >> $config_host_mak
   echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak    echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak
 fi  fi
 if test "$vnc_thread" != "no" ; then  if test "$vnc_thread" = "yes" ; then
   echo "CONFIG_VNC_THREAD=y" >> $config_host_mak    echo "CONFIG_VNC_THREAD=y" >> $config_host_mak
   echo "CONFIG_THREAD=y" >> $config_host_mak  
 fi  fi
 if test "$fnmatch" = "yes" ; then  if test "$fnmatch" = "yes" ; then
   echo "CONFIG_FNMATCH=y" >> $config_host_mak    echo "CONFIG_FNMATCH=y" >> $config_host_mak
Line 2668  fi Line 3231  fi
 if test "$dup3" = "yes" ; then  if test "$dup3" = "yes" ; then
   echo "CONFIG_DUP3=y" >> $config_host_mak    echo "CONFIG_DUP3=y" >> $config_host_mak
 fi  fi
   if test "$epoll" = "yes" ; then
     echo "CONFIG_EPOLL=y" >> $config_host_mak
   fi
   if test "$epoll_create1" = "yes" ; then
     echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
   fi
   if test "$epoll_pwait" = "yes" ; then
     echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
   fi
 if test "$inotify" = "yes" ; then  if test "$inotify" = "yes" ; then
   echo "CONFIG_INOTIFY=y" >> $config_host_mak    echo "CONFIG_INOTIFY=y" >> $config_host_mak
 fi  fi
Line 2691  if test "$bluez" = "yes" ; then Line 3263  if test "$bluez" = "yes" ; then
   echo "CONFIG_BLUEZ=y" >> $config_host_mak    echo "CONFIG_BLUEZ=y" >> $config_host_mak
   echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak    echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
 fi  fi
   echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
 if test "$xen" = "yes" ; then  if test "$xen" = "yes" ; then
   echo "CONFIG_XEN=y" >> $config_host_mak    echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
 fi    echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
 if test "$io_thread" = "yes" ; then  
   echo "CONFIG_IOTHREAD=y" >> $config_host_mak  
   echo "CONFIG_THREAD=y" >> $config_host_mak  
 fi  fi
 if test "$linux_aio" = "yes" ; then  if test "$linux_aio" = "yes" ; then
   echo "CONFIG_LINUX_AIO=y" >> $config_host_mak    echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
Line 2704  fi Line 3274  fi
 if test "$attr" = "yes" ; then  if test "$attr" = "yes" ; then
   echo "CONFIG_ATTR=y" >> $config_host_mak    echo "CONFIG_ATTR=y" >> $config_host_mak
 fi  fi
 if test "$linux" = "yes" ; then  if test "$libattr" = "yes" ; then
   if test "$attr" = "yes" ; then    echo "CONFIG_LIBATTR=y" >> $config_host_mak
     echo "CONFIG_VIRTFS=y" >> $config_host_mak  fi
   fi  if test "$virtfs" = "yes" ; then
     echo "CONFIG_VIRTFS=y" >> $config_host_mak
 fi  fi
 if test "$blobs" = "yes" ; then  if test "$blobs" = "yes" ; then
   echo "INSTALL_BLOBS=yes" >> $config_host_mak    echo "INSTALL_BLOBS=yes" >> $config_host_mak
Line 2724  fi Line 3295  fi
 if test "$signalfd" = "yes" ; then  if test "$signalfd" = "yes" ; then
   echo "CONFIG_SIGNALFD=y" >> $config_host_mak    echo "CONFIG_SIGNALFD=y" >> $config_host_mak
 fi  fi
 if test "$need_offsetof" = "yes" ; then  if test "$tcg_interpreter" = "yes" ; then
   echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak    echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
 fi  
 if test "$gcc_attribute_warn_unused_result" = "yes" ; then  
   echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak  
 fi  fi
 if test "$fdatasync" = "yes" ; then  if test "$fdatasync" = "yes" ; then
   echo "CONFIG_FDATASYNC=y" >> $config_host_mak    echo "CONFIG_FDATASYNC=y" >> $config_host_mak
Line 2744  if test "$spice" = "yes" ; then Line 3312  if test "$spice" = "yes" ; then
   echo "CONFIG_SPICE=y" >> $config_host_mak    echo "CONFIG_SPICE=y" >> $config_host_mak
 fi  fi
   
   if test "$smartcard" = "yes" ; then
     echo "CONFIG_SMARTCARD=y" >> $config_host_mak
   fi
   
   if test "$smartcard_nss" = "yes" ; then
     echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
     echo "libcacard_libs=$libcacard_libs" >> $config_host_mak
     echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
   fi
   
   if test "$usb_redir" = "yes" ; then
     echo "CONFIG_USB_REDIR=y" >> $config_host_mak
   fi
   
   if test "$opengl" = "yes" ; then
     echo "CONFIG_OPENGL=y" >> $config_host_mak
   fi
   
   if test "$libiscsi" = "yes" ; then
     echo "CONFIG_LIBISCSI=y" >> $config_host_mak
   fi
   
 # XXX: suppress that  # XXX: suppress that
 if [ "$bsd" = "yes" ] ; then  if [ "$bsd" = "yes" ] ; then
   echo "CONFIG_BSD=y" >> $config_host_mak    echo "CONFIG_BSD=y" >> $config_host_mak
Line 2758  if test "$rbd" = "yes" ; then Line 3348  if test "$rbd" = "yes" ; then
   echo "CONFIG_RBD=y" >> $config_host_mak    echo "CONFIG_RBD=y" >> $config_host_mak
 fi  fi
   
   if test "$coroutine_backend" = "ucontext" ; then
     echo "CONFIG_UCONTEXT_COROUTINE=y" >> $config_host_mak
   elif test "$coroutine_backend" = "sigaltstack" ; then
     echo "CONFIG_SIGALTSTACK_COROUTINE=y" >> $config_host_mak
   fi
   
   if test "$open_by_handle_at" = "yes" ; then
     echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
   fi
   
   if test "$linux_magic_h" = "yes" ; then
     echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
   fi
   
   if test "$has_environ" = "yes" ; then
     echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
   fi
   
 # USB host support  # USB host support
 case "$usb" in  case "$usb" in
 linux)  linux)
Line 2771  bsd) Line 3379  bsd)
 ;;  ;;
 esac  esac
   
   # use default implementation for tracing backend-specific routines
   trace_default=yes
 echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak  echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
 if test "$trace_backend" = "simple"; then  if test "$trace_backend" = "nop"; then
   echo "CONFIG_SIMPLE_TRACE=y" >> $config_host_mak    echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
 fi  fi
 # Set the appropriate trace file.  
 if test "$trace_backend" = "simple"; then  if test "$trace_backend" = "simple"; then
   trace_file="\"$trace_file-%u\""    echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
     trace_default=no
     # Set the appropriate trace file.
     trace_file="\"$trace_file-\" FMT_pid"
   fi
   if test "$trace_backend" = "stderr"; then
     echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
     trace_default=no
 fi  fi
 if test "$trace_backend" = "dtrace" -a "$trace_backend_stap" = "yes" ; then  if test "$trace_backend" = "ust"; then
   echo "CONFIG_SYSTEMTAP_TRACE=y" >> $config_host_mak    echo "CONFIG_TRACE_UST=y" >> $config_host_mak
   fi
   if test "$trace_backend" = "dtrace"; then
     echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
     if test "$trace_backend_stap" = "yes" ; then
       echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
     fi
 fi  fi
 echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak  echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
   if test "$trace_default" = "yes"; then
     echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
   fi
   
 echo "TOOLS=$tools" >> $config_host_mak  echo "TOOLS=$tools" >> $config_host_mak
 echo "ROMS=$roms" >> $config_host_mak  echo "ROMS=$roms" >> $config_host_mak
 echo "MAKE=$make" >> $config_host_mak  echo "MAKE=$make" >> $config_host_mak
 echo "INSTALL=$install" >> $config_host_mak  echo "INSTALL=$install" >> $config_host_mak
 echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak  echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
 echo "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak  echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
 echo "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak  echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
   echo "PYTHON=$python" >> $config_host_mak
 echo "CC=$cc" >> $config_host_mak  echo "CC=$cc" >> $config_host_mak
 echo "CC_I386=$cc_i386" >> $config_host_mak  echo "CC_I386=$cc_i386" >> $config_host_mak
 echo "HOST_CC=$host_cc" >> $config_host_mak  echo "HOST_CC=$host_cc" >> $config_host_mak
Line 2798  echo "AR=$ar" >> $config_host_mak Line 3424  echo "AR=$ar" >> $config_host_mak
 echo "OBJCOPY=$objcopy" >> $config_host_mak  echo "OBJCOPY=$objcopy" >> $config_host_mak
 echo "LD=$ld" >> $config_host_mak  echo "LD=$ld" >> $config_host_mak
 echo "WINDRES=$windres" >> $config_host_mak  echo "WINDRES=$windres" >> $config_host_mak
   echo "LIBTOOL=$libtool" >> $config_host_mak
 echo "CFLAGS=$CFLAGS" >> $config_host_mak  echo "CFLAGS=$CFLAGS" >> $config_host_mak
 echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak  echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
 echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak  echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
Line 2813  echo "ARLIBS_END=$arlibs_end" >> $config Line 3440  echo "ARLIBS_END=$arlibs_end" >> $config
 echo "LIBS+=$LIBS" >> $config_host_mak  echo "LIBS+=$LIBS" >> $config_host_mak
 echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak  echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
 echo "EXESUF=$EXESUF" >> $config_host_mak  echo "EXESUF=$EXESUF" >> $config_host_mak
   echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
   echo "POD2MAN=$POD2MAN" >> $config_host_mak
   
 # generate list of library paths for linker script  # generate list of library paths for linker script
   
Line 2828  fi Line 3457  fi
   
 for d in libdis libdis-user; do  for d in libdis libdis-user; do
     mkdir -p $d      mkdir -p $d
     symlink $source_path/Makefile.dis $d/Makefile      symlink "$source_path/Makefile.dis" "$d/Makefile"
     echo > $d/config.mak      echo > $d/config.mak
 done  done
 if test "$static" = "no" -a "$user_pie" = "yes" ; then  
   echo "QEMU_CFLAGS+=-fpie" > libdis-user/config.mak  # use included Linux headers
   if test "$linux" = "yes" ; then
     mkdir -p linux-headers
     case "$cpu" in
     i386|x86_64)
       symlink "$source_path/linux-headers/asm-x86" linux-headers/asm
       ;;
     ppcemb|ppc|ppc64)
       symlink "$source_path/linux-headers/asm-powerpc" linux-headers/asm
       ;;
     s390x)
       symlink "$source_path/linux-headers/asm-s390" linux-headers/asm
       ;;
     esac
 fi  fi
   
 for target in $target_list; do  for target in $target_list; do
Line 2842  target_arch2=`echo $target | cut -d '-'  Line 3484  target_arch2=`echo $target | cut -d '-' 
 target_bigendian="no"  target_bigendian="no"
   
 case "$target_arch2" in  case "$target_arch2" in
   armeb|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus)    armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
   target_bigendian=yes    target_bigendian=yes
   ;;    ;;
 esac  esac
 target_softmmu="no"  target_softmmu="no"
 target_user_only="no"  target_user_only="no"
 target_linux_user="no"  target_linux_user="no"
 target_darwin_user="no"  
 target_bsd_user="no"  target_bsd_user="no"
 case "$target" in  case "$target" in
   ${target_arch2}-softmmu)    ${target_arch2}-softmmu)
Line 2863  case "$target" in Line 3504  case "$target" in
     target_user_only="yes"      target_user_only="yes"
     target_linux_user="yes"      target_linux_user="yes"
     ;;      ;;
   ${target_arch2}-darwin-user)  
     if test "$darwin" != "yes" ; then  
       echo "ERROR: Target '$target' is only available on a Darwin host"  
       exit 1  
     fi  
     target_user_only="yes"  
     target_darwin_user="yes"  
     ;;  
   ${target_arch2}-bsd-user)    ${target_arch2}-bsd-user)
     if test "$bsd" != "yes" ; then      if test "$bsd" != "yes" ; then
       echo "ERROR: Target '$target' is only available on a BSD host"        echo "ERROR: Target '$target' is only available on a BSD host"
Line 2889  mkdir -p $target_dir Line 3522  mkdir -p $target_dir
 mkdir -p $target_dir/fpu  mkdir -p $target_dir/fpu
 mkdir -p $target_dir/tcg  mkdir -p $target_dir/tcg
 mkdir -p $target_dir/ide  mkdir -p $target_dir/ide
   mkdir -p $target_dir/usb
   mkdir -p $target_dir/9pfs
   mkdir -p $target_dir/kvm
 if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then  if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
   mkdir -p $target_dir/nwfpe    mkdir -p $target_dir/nwfpe
 fi  fi
 symlink $source_path/Makefile.target $target_dir/Makefile  symlink "$source_path/Makefile.target" "$target_dir/Makefile"
   
   
 echo "# Automatically generated by configure - do not modify" > $config_target_mak  echo "# Automatically generated by configure - do not modify" > $config_target_mak
Line 2900  echo "# Automatically generated by confi Line 3536  echo "# Automatically generated by confi
 bflt="no"  bflt="no"
 target_nptl="no"  target_nptl="no"
 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`  interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
 echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak  
 gdb_xml_files=""  gdb_xml_files=""
   target_short_alignment=2
   target_int_alignment=4
   target_long_alignment=4
   target_llong_alignment=8
   target_libs_softmmu=
   
 TARGET_ARCH="$target_arch2"  TARGET_ARCH="$target_arch2"
 TARGET_BASE_ARCH=""  TARGET_BASE_ARCH=""
Line 2909  TARGET_ABI_DIR="" Line 3549  TARGET_ABI_DIR=""
   
 case "$target_arch2" in  case "$target_arch2" in
   i386)    i386)
     target_phys_bits=32      target_phys_bits=64
   ;;    ;;
   x86_64)    x86_64)
     TARGET_BASE_ARCH=i386      TARGET_BASE_ARCH=i386
     target_phys_bits=64      target_phys_bits=64
       target_long_alignment=8
   ;;    ;;
   alpha)    alpha)
     target_phys_bits=64      target_phys_bits=64
       target_long_alignment=8
     target_nptl="yes"      target_nptl="yes"
   ;;    ;;
   arm|armeb)    arm|armeb)
Line 2925  case "$target_arch2" in Line 3567  case "$target_arch2" in
     target_nptl="yes"      target_nptl="yes"
     gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"      gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
     target_phys_bits=32      target_phys_bits=32
       target_llong_alignment=4
       target_libs_softmmu="$fdt_libs"
   ;;    ;;
   cris)    cris)
     target_nptl="yes"      target_nptl="yes"
     target_phys_bits=32      target_phys_bits=32
   ;;    ;;
     lm32)
       target_phys_bits=32
       target_libs_softmmu="$opengl_libs"
     ;;
   m68k)    m68k)
     bflt="yes"      bflt="yes"
     gdb_xml_files="cf-core.xml cf-fp.xml"      gdb_xml_files="cf-core.xml cf-fp.xml"
     target_phys_bits=32      target_phys_bits=32
       target_int_alignment=2
       target_long_alignment=2
       target_llong_alignment=2
   ;;    ;;
   microblaze)    microblaze|microblazeel)
       TARGET_ARCH=microblaze
     bflt="yes"      bflt="yes"
     target_nptl="yes"      target_nptl="yes"
     target_phys_bits=32      target_phys_bits=32
       target_libs_softmmu="$fdt_libs"
   ;;    ;;
   mips|mipsel)    mips|mipsel)
     TARGET_ARCH=mips      TARGET_ARCH=mips
Line 2957  case "$target_arch2" in Line 3610  case "$target_arch2" in
     TARGET_BASE_ARCH=mips      TARGET_BASE_ARCH=mips
     echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak      echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
     target_phys_bits=64      target_phys_bits=64
       target_long_alignment=8
   ;;    ;;
   ppc)    ppc)
     gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"      gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
     target_phys_bits=32      target_phys_bits=64
     target_nptl="yes"      target_nptl="yes"
       target_libs_softmmu="$fdt_libs"
   ;;    ;;
   ppcemb)    ppcemb)
     TARGET_BASE_ARCH=ppc      TARGET_BASE_ARCH=ppc
Line 2969  case "$target_arch2" in Line 3624  case "$target_arch2" in
     gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"      gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
     target_phys_bits=64      target_phys_bits=64
     target_nptl="yes"      target_nptl="yes"
       target_libs_softmmu="$fdt_libs"
   ;;    ;;
   ppc64)    ppc64)
     TARGET_BASE_ARCH=ppc      TARGET_BASE_ARCH=ppc
     TARGET_ABI_DIR=ppc      TARGET_ABI_DIR=ppc
     gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"      gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
     target_phys_bits=64      target_phys_bits=64
       target_long_alignment=8
       target_libs_softmmu="$fdt_libs"
   ;;    ;;
   ppc64abi32)    ppc64abi32)
     TARGET_ARCH=ppc64      TARGET_ARCH=ppc64
Line 2983  case "$target_arch2" in Line 3641  case "$target_arch2" in
     echo "TARGET_ABI32=y" >> $config_target_mak      echo "TARGET_ABI32=y" >> $config_target_mak
     gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"      gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
     target_phys_bits=64      target_phys_bits=64
       target_libs_softmmu="$fdt_libs"
   ;;    ;;
   sh4|sh4eb)    sh4|sh4eb)
     TARGET_ARCH=sh4      TARGET_ARCH=sh4
Line 2996  case "$target_arch2" in Line 3655  case "$target_arch2" in
   sparc64)    sparc64)
     TARGET_BASE_ARCH=sparc      TARGET_BASE_ARCH=sparc
     target_phys_bits=64      target_phys_bits=64
       target_long_alignment=8
   ;;    ;;
   sparc32plus)    sparc32plus)
     TARGET_ARCH=sparc64      TARGET_ARCH=sparc64
Line 3005  case "$target_arch2" in Line 3665  case "$target_arch2" in
     target_phys_bits=64      target_phys_bits=64
   ;;    ;;
   s390x)    s390x)
       target_nptl="yes"
     target_phys_bits=64      target_phys_bits=64
       target_long_alignment=8
     ;;
     unicore32)
       target_phys_bits=32
     ;;
     xtensa|xtensaeb)
       TARGET_ARCH=xtensa
       target_phys_bits=32
   ;;    ;;
   *)    *)
     echo "Unsupported target CPU"      echo "Unsupported target CPU"
     exit 1      exit 1
   ;;    ;;
 esac  esac
   
   case "$target_arch2" in
     alpha | sparc*)
       echo "CONFIG_TCG_PASS_AREG0=y" >> $config_target_mak
     ;;
   esac
   
   echo "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak
   echo "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak
   echo "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak
   echo "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak
 echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak  echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
 target_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"  target_arch_name="`echo $TARGET_ARCH | LC_ALL=C tr '[a-z]' '[A-Z]'`"
 echo "TARGET_$target_arch_name=y" >> $config_target_mak  echo "TARGET_$target_arch_name=y" >> $config_target_mak
 echo "TARGET_ARCH2=$target_arch2" >> $config_target_mak  echo "TARGET_ARCH2=$target_arch2" >> $config_target_mak
 # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH  # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
Line 3028  echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> Line 3708  echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >>
 case "$target_arch2" in  case "$target_arch2" in
   i386|x86_64)    i386|x86_64)
     if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then      if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
         target_phys_bits=64
       echo "CONFIG_XEN=y" >> $config_target_mak        echo "CONFIG_XEN=y" >> $config_target_mak
       else
         echo "CONFIG_NO_XEN=y" >> $config_target_mak
     fi      fi
       ;;
     *)
       echo "CONFIG_NO_XEN=y" >> $config_target_mak
 esac  esac
 case "$target_arch2" in  case "$target_arch2" in
   i386|x86_64|ppcemb|ppc|ppc64|s390x)    i386|x86_64|ppcemb|ppc|ppc64|s390x)
Line 3038  case "$target_arch2" in Line 3724  case "$target_arch2" in
       \( "$target_arch2" = "$cpu" -o \        \( "$target_arch2" = "$cpu" -o \
       \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \        \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
       \( "$target_arch2" = "ppc64"  -a "$cpu" = "ppc" \) -o \        \( "$target_arch2" = "ppc64"  -a "$cpu" = "ppc" \) -o \
         \( "$target_arch2" = "ppc"    -a "$cpu" = "ppc64" \) -o \
         \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
       \( "$target_arch2" = "x86_64" -a "$cpu" = "i386"   \) -o \        \( "$target_arch2" = "x86_64" -a "$cpu" = "i386"   \) -o \
       \( "$target_arch2" = "i386"   -a "$cpu" = "x86_64" \) \) ; then        \( "$target_arch2" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
       echo "CONFIG_KVM=y" >> $config_target_mak        echo "CONFIG_KVM=y" >> $config_target_mak
       echo "KVM_CFLAGS=$kvm_cflags" >> $config_target_mak        if test "$vhost_net" = "yes" ; then
       if test "$kvm_para" = "yes"; then  
         echo "CONFIG_KVM_PARA=y" >> $config_target_mak  
       fi  
       if test $vhost_net = "yes" ; then  
         echo "CONFIG_VHOST_NET=y" >> $config_target_mak          echo "CONFIG_VHOST_NET=y" >> $config_target_mak
       fi        fi
     fi      fi
 esac  esac
   if test "$target_arch2" = "ppc64" -a "$fdt" = "yes"; then
     echo "CONFIG_PSERIES=y" >> $config_target_mak
   fi
 if test "$target_bigendian" = "yes" ; then  if test "$target_bigendian" = "yes" ; then
   echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak    echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
 fi  fi
 if test "$target_softmmu" = "yes" ; then  if test "$target_softmmu" = "yes" ; then
   echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak    echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
   echo "CONFIG_SOFTMMU=y" >> $config_target_mak    echo "CONFIG_SOFTMMU=y" >> $config_target_mak
   echo "LIBS+=$libs_softmmu" >> $config_target_mak    echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak
   echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak    echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
   echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak    echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
     if test "$smartcard_nss" = "yes" ; then
       echo "subdir-$target: subdir-libcacard" >> $config_host_mak
     fi
 fi  fi
 if test "$target_user_only" = "yes" ; then  if test "$target_user_only" = "yes" ; then
   echo "CONFIG_USER_ONLY=y" >> $config_target_mak    echo "CONFIG_USER_ONLY=y" >> $config_target_mak
     echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
 fi  fi
 if test "$target_linux_user" = "yes" ; then  if test "$target_linux_user" = "yes" ; then
   echo "CONFIG_LINUX_USER=y" >> $config_target_mak    echo "CONFIG_LINUX_USER=y" >> $config_target_mak
 fi  fi
 if test "$target_darwin_user" = "yes" ; then  
   echo "CONFIG_DARWIN_USER=y" >> $config_target_mak  
 fi  
 list=""  list=""
 if test ! -z "$gdb_xml_files" ; then  if test ! -z "$gdb_xml_files" ; then
   for x in $gdb_xml_files; do    for x in $gdb_xml_files; do
Line 3077  if test ! -z "$gdb_xml_files" ; then Line 3765  if test ! -z "$gdb_xml_files" ; then
   echo "TARGET_XML_FILES=$list" >> $config_target_mak    echo "TARGET_XML_FILES=$list" >> $config_target_mak
 fi  fi
   
 case "$target_arch2" in  
   i386|x86_64)  
     echo "CONFIG_NOSOFTFLOAT=y" >> $config_target_mak  
     ;;  
   *)  
     echo "CONFIG_SOFTFLOAT=y" >> $config_target_mak  
     ;;  
 esac  
   
 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then  if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
   echo "TARGET_HAS_BFLT=y" >> $config_target_mak    echo "TARGET_HAS_BFLT=y" >> $config_target_mak
 fi  fi
Line 3106  cflags="" Line 3785  cflags=""
 includes=""  includes=""
 ldflags=""  ldflags=""
   
 if test "$ARCH" = "sparc64" ; then  if test "$tcg_interpreter" = "yes"; then
     includes="-I\$(SRC_PATH)/tcg/tci $includes"
   elif test "$ARCH" = "sparc64" ; then
   includes="-I\$(SRC_PATH)/tcg/sparc $includes"    includes="-I\$(SRC_PATH)/tcg/sparc $includes"
 elif test "$ARCH" = "s390x" ; then  elif test "$ARCH" = "s390x" ; then
   includes="-I\$(SRC_PATH)/tcg/s390 $includes"    includes="-I\$(SRC_PATH)/tcg/s390 $includes"
Line 3116  else Line 3797  else
   includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes"    includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes"
 fi  fi
 includes="-I\$(SRC_PATH)/tcg $includes"  includes="-I\$(SRC_PATH)/tcg $includes"
 includes="-I\$(SRC_PATH)/fpu $includes"  
   if test "$linux" = "yes" ; then
     includes="-I\$(SRC_PATH)/linux-headers $includes"
   fi
   
 if test "$target_user_only" = "yes" ; then  if test "$target_user_only" = "yes" ; then
     libdis_config_mak=libdis-user/config.mak      libdis_config_mak=libdis-user/config.mak
Line 3150  for i in $ARCH $TARGET_BASE_ARCH ; do Line 3834  for i in $ARCH $TARGET_BASE_ARCH ; do
     echo "CONFIG_IA64_DIS=y"  >> $config_target_mak      echo "CONFIG_IA64_DIS=y"  >> $config_target_mak
     echo "CONFIG_IA64_DIS=y"  >> $libdis_config_mak      echo "CONFIG_IA64_DIS=y"  >> $libdis_config_mak
   ;;    ;;
     lm32)
       echo "CONFIG_LM32_DIS=y"  >> $config_target_mak
       echo "CONFIG_LM32_DIS=y"  >> $libdis_config_mak
     ;;
   m68k)    m68k)
     echo "CONFIG_M68K_DIS=y"  >> $config_target_mak      echo "CONFIG_M68K_DIS=y"  >> $config_target_mak
     echo "CONFIG_M68K_DIS=y"  >> $libdis_config_mak      echo "CONFIG_M68K_DIS=y"  >> $libdis_config_mak
   ;;    ;;
   microblaze)    microblaze*)
     echo "CONFIG_MICROBLAZE_DIS=y"  >> $config_target_mak      echo "CONFIG_MICROBLAZE_DIS=y"  >> $config_target_mak
     echo "CONFIG_MICROBLAZE_DIS=y"  >> $libdis_config_mak      echo "CONFIG_MICROBLAZE_DIS=y"  >> $libdis_config_mak
   ;;    ;;
Line 3178  for i in $ARCH $TARGET_BASE_ARCH ; do Line 3866  for i in $ARCH $TARGET_BASE_ARCH ; do
     echo "CONFIG_SPARC_DIS=y"  >> $config_target_mak      echo "CONFIG_SPARC_DIS=y"  >> $config_target_mak
     echo "CONFIG_SPARC_DIS=y"  >> $libdis_config_mak      echo "CONFIG_SPARC_DIS=y"  >> $libdis_config_mak
   ;;    ;;
     xtensa*)
       echo "CONFIG_XTENSA_DIS=y"  >> $config_target_mak
       echo "CONFIG_XTENSA_DIS=y"  >> $libdis_config_mak
     ;;
   esac    esac
 done  done
   if test "$tcg_interpreter" = "yes" ; then
     echo "CONFIG_TCI_DIS=y"  >> $config_target_mak
     echo "CONFIG_TCI_DIS=y"  >> $libdis_config_mak
   fi
   
 case "$ARCH" in  case "$ARCH" in
 alpha)  alpha)
Line 3193  if test "$target_softmmu" = "yes" ; then Line 3889  if test "$target_softmmu" = "yes" ; then
   arm)    arm)
     cflags="-DHAS_AUDIO $cflags"      cflags="-DHAS_AUDIO $cflags"
   ;;    ;;
     lm32)
       cflags="-DHAS_AUDIO $cflags"
     ;;
   i386|mips|ppc)    i386|mips|ppc)
     cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"      cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
   ;;    ;;
   esac    esac
 fi  fi
   
 if test "$target_user_only" = "yes" -a "$static" = "no" -a \  
         "$user_pie" = "yes" ; then  
   cflags="-fpie $cflags"  
   ldflags="-pie $ldflags"  
 fi  
   
 if test "$target_softmmu" = "yes" -a \( \  if test "$target_softmmu" = "yes" -a \( \
         "$TARGET_ARCH" = "microblaze" -o \          "$TARGET_ARCH" = "microblaze" -o \
         "$TARGET_ARCH" = "cris" \) ; then          "$TARGET_ARCH" = "cris" \) ; then
Line 3223  if test "$gprof" = "yes" ; then Line 3916  if test "$gprof" = "yes" ; then
   fi    fi
 fi  fi
   
 linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"  if test "$ARCH" = "tci"; then
     linker_script=""
   else
     linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
   fi
   
 if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then  if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
   case "$ARCH" in    case "$ARCH" in
   sparc)    sparc)
Line 3246  echo "QEMU_INCLUDES+=$includes" >> $conf Line 3944  echo "QEMU_INCLUDES+=$includes" >> $conf
 done # for target in $targets  done # for target in $targets
   
 # build tree in object directory in case the source is not in the current directory  # build tree in object directory in case the source is not in the current directory
 DIRS="tests tests/cris slirp audio block net pc-bios/optionrom"  DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32"
   DIRS="$DIRS slirp audio block net pc-bios/optionrom"
   DIRS="$DIRS pc-bios/spapr-rtas"
 DIRS="$DIRS roms/seabios roms/vgabios"  DIRS="$DIRS roms/seabios roms/vgabios"
 DIRS="$DIRS fsdev ui"  DIRS="$DIRS fsdev ui usb"
 FILES="Makefile tests/Makefile"  DIRS="$DIRS qapi qapi-generated"
 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"  DIRS="$DIRS qga trace qom"
   FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
   FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
   FILES="$FILES tests/tcg/lm32/Makefile"
 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"  FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
   FILES="$FILES pc-bios/spapr-rtas/Makefile"
 FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"  FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
 for bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do  for bios_file in \
       $source_path/pc-bios/*.bin \
       $source_path/pc-bios/*.rom \
       $source_path/pc-bios/*.dtb \
       $source_path/pc-bios/openbios-* \
       $source_path/pc-bios/palcode-*
   do
     FILES="$FILES pc-bios/`basename $bios_file`"      FILES="$FILES pc-bios/`basename $bios_file`"
 done  done
 mkdir -p $DIRS  mkdir -p $DIRS
 for f in $FILES ; do  for f in $FILES ; do
     test -e $f || symlink $source_path/$f $f      if [ -e "$source_path/$f" ] && [ "$source_path" != `pwd` ]; then
           symlink "$source_path/$f" "$f"
       fi
 done  done
   
 # temporary config to build submodules  # temporary config to build submodules
Line 3278  for hwlib in 32 64; do Line 3990  for hwlib in 32 64; do
   d=libhw$hwlib    d=libhw$hwlib
   mkdir -p $d    mkdir -p $d
   mkdir -p $d/ide    mkdir -p $d/ide
   symlink $source_path/Makefile.hw $d/Makefile    mkdir -p $d/usb
     symlink "$source_path/Makefile.hw" "$d/Makefile"
     mkdir -p $d/9pfs
   echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak    echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
 done  done
   
   if [ "$source_path" != `pwd` ]; then
       # out of tree build
       mkdir -p libcacard
       symlink "$source_path/libcacard/Makefile" libcacard/Makefile
   fi
   
 d=libuser  d=libuser
 mkdir -p $d  mkdir -p $d
 symlink $source_path/Makefile.user $d/Makefile  mkdir -p $d/trace
 if test "$static" = "no" -a "$user_pie" = "yes" ; then  mkdir -p $d/qom
   echo "QEMU_CFLAGS+=-fpie" > $d/config.mak  symlink "$source_path/Makefile.user" "$d/Makefile"
 fi  
   
 if test "$docs" = "yes" ; then  if test "$docs" = "yes" ; then
   mkdir -p QMP    mkdir -p QMP

Removed from v.1.1.1.15  
changed lines
  Added in v.1.1.1.18


unix.superglobalmegacorp.com