diff mbox

configure: do not modify config.log with --help

Message ID 1403194507-24815-1-git-send-email-gscrivan@redhat.com
State New
Headers show

Commit Message

Giuseppe Scrivano June 19, 2014, 4:15 p.m. UTC
Reorder the code so that the existing config.log file is not modified
by configure when --help is used.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
---
 configure | 782 +++++++++++++++++++++++++++++++-------------------------------
 1 file changed, 391 insertions(+), 391 deletions(-)
diff mbox

Patch

diff --git a/configure b/configure
index 27d84d9..5cee71b 100755
--- a/configure
+++ b/configure
@@ -29,15 +29,6 @@  TMPL="${TMPDIR1}/${TMPB}.lo"
 TMPA="${TMPDIR1}/lib${TMPB}.la"
 TMPE="${TMPDIR1}/${TMPB}.exe"
 
-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
-
 error_exit() {
     echo
     echo "ERROR: $1"
@@ -432,314 +423,28 @@  EOF
   compile_object
 }
 
-if check_define __linux__ ; then
-  targetos="Linux"
-elif check_define _WIN32 ; then
-  targetos='MINGW32'
-elif check_define __OpenBSD__ ; then
-  targetos='OpenBSD'
-elif check_define __sun__ ; then
-  targetos='SunOS'
-elif check_define __HAIKU__ ; then
-  targetos='Haiku'
-else
-  targetos=`uname -s`
-fi
+werror=""
 
-# Some host OSes need non-standard checks for which CPU to use.
-# Note that these checks are broken for cross-compilation: if you're
-# cross-compiling to one of these OSes then you'll need to specify
-# the correct CPU with the --cpu option.
-case $targetos in
-Darwin)
-  # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
-  # run 64-bit userspace code.
-  # If the user didn't specify a CPU explicitly and the kernel says this is
-  # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
-  if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
-    cpu="x86_64"
-  fi
+for opt do
+  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
+  case "$opt" in
+  --help|-h) show_help=yes
   ;;
-SunOS)
-  # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
-  if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
-    cpu="x86_64"
-  fi
-esac
-
-if test ! -z "$cpu" ; then
-  # command line argument
-  :
-elif check_define __i386__ ; then
-  cpu="i386"
-elif check_define __x86_64__ ; then
-  if check_define __ILP32__ ; then
-    cpu="x32"
-  else
-    cpu="x86_64"
-  fi
-elif check_define __sparc__ ; then
-  if check_define __arch64__ ; then
-    cpu="sparc64"
-  else
-    cpu="sparc"
-  fi
-elif check_define _ARCH_PPC ; then
-  if check_define _ARCH_PPC64 ; then
-    cpu="ppc64"
-  else
-    cpu="ppc"
-  fi
-elif check_define __mips__ ; then
-  cpu="mips"
-elif check_define __ia64__ ; then
-  cpu="ia64"
-elif check_define __s390__ ; then
-  if check_define __s390x__ ; then
-    cpu="s390x"
-  else
-    cpu="s390"
-  fi
-elif check_define __arm__ ; then
-  cpu="arm"
-elif check_define __aarch64__ ; then
-  cpu="aarch64"
-elif check_define __hppa__ ; then
-  cpu="hppa"
-else
-  cpu=`uname -m`
-fi
-
-ARCH=
-# Normalise host CPU name and set ARCH.
-# Note that this case should only have supported host CPUs, not guests.
-case "$cpu" in
-  ia64|ppc|ppc64|s390|s390x|sparc64|x32)
-    cpu="$cpu"
+  --version|-V) exec cat $source_path/VERSION
   ;;
-  i386|i486|i586|i686|i86pc|BePC)
-    cpu="i386"
+  --prefix=*) prefix="$optarg"
   ;;
-  x86_64|amd64)
-    cpu="x86_64"
+  --interp-prefix=*) interp_prefix="$optarg"
   ;;
-  armv*b|armv*l|arm)
-    cpu="arm"
+  --source-path=*)
   ;;
-  aarch64)
-    cpu="aarch64"
+  --cross-prefix=*)
   ;;
-  mips*)
-    cpu="mips"
+  --cc=*)
   ;;
-  sparc|sun4[cdmuv])
-    cpu="sparc"
+  --host-cc=*) host_cc="$optarg"
   ;;
-  *)
-    # This will result in either an error or falling back to TCI later
-    ARCH=unknown
-  ;;
-esac
-if test -z "$ARCH"; then
-  ARCH="$cpu"
-fi
-
-# OS specific
-
-# host *BSD for user mode
-HOST_VARIANT_DIR=""
-
-case $targetos in
-CYGWIN*)
-  mingw32="yes"
-  QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
-  audio_possible_drivers="winwave sdl"
-  audio_drv_list="winwave"
-;;
-MINGW32*)
-  mingw32="yes"
-  audio_possible_drivers="winwave dsound sdl fmod"
-  audio_drv_list="winwave"
-;;
-GNU/kFreeBSD)
-  bsd="yes"
-  audio_drv_list="oss"
-  audio_possible_drivers="oss sdl esd pa"
-;;
-FreeBSD)
-  bsd="yes"
-  make="${MAKE-gmake}"
-  audio_drv_list="oss"
-  audio_possible_drivers="oss sdl esd pa"
-  # needed for kinfo_getvmmap(3) in libutil.h
-  LIBS="-lutil $LIBS"
-  netmap=""  # enable netmap autodetect
-  HOST_VARIANT_DIR="freebsd"
-;;
-DragonFly)
-  bsd="yes"
-  make="${MAKE-gmake}"
-  audio_drv_list="oss"
-  audio_possible_drivers="oss sdl esd pa"
-  HOST_VARIANT_DIR="dragonfly"
-;;
-NetBSD)
-  bsd="yes"
-  make="${MAKE-gmake}"
-  audio_drv_list="oss"
-  audio_possible_drivers="oss sdl esd"
-  oss_lib="-lossaudio"
-  HOST_VARIANT_DIR="netbsd"
-;;
-OpenBSD)
-  bsd="yes"
-  make="${MAKE-gmake}"
-  audio_drv_list="sdl"
-  audio_possible_drivers="sdl esd"
-  HOST_VARIANT_DIR="openbsd"
-;;
-Darwin)
-  bsd="yes"
-  darwin="yes"
-  LDFLAGS_SHARED="-bundle -undefined dynamic_lookup"
-  if [ "$cpu" = "x86_64" ] ; then
-    QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
-    LDFLAGS="-arch x86_64 $LDFLAGS"
-  fi
-  cocoa="yes"
-  audio_drv_list="coreaudio"
-  audio_possible_drivers="coreaudio sdl fmod"
-  LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
-  libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
-  # Disable attempts to use ObjectiveC features in os/object.h since they
-  # won't work when we're compiling with gcc as a C compiler.
-  QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
-  HOST_VARIANT_DIR="darwin"
-;;
-SunOS)
-  solaris="yes"
-  make="${MAKE-gmake}"
-  install="${INSTALL-ginstall}"
-  ld="gld"
-  smbd="${SMBD-/usr/sfw/sbin/smbd}"
-  needs_libsunmath="no"
-  solarisrev=`uname -r | cut -f2 -d.`
-  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
-    if test "$solarisrev" -le 9 ; then
-      if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
-        needs_libsunmath="yes"
-        QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
-        LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
-        LIBS="-lsunmath $LIBS"
-      else
-        error_exit "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" \
-            "libsunmath from the Sun Studio compilers tools, due to a lack of" \
-            "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" \
-            "Studio 11 can be downloaded from www.sun.com."
-      fi
-    fi
-  fi
-  if test -f /usr/include/sys/soundcard.h ; then
-    audio_drv_list="oss"
-  fi
-  audio_possible_drivers="oss sdl"
-# needed for CMSG_ macros in sys/socket.h
-  QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
-# needed for TIOCWIN* defines in termios.h
-  QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
-  QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
-  solarisnetlibs="-lsocket -lnsl -lresolv"
-  LIBS="$solarisnetlibs $LIBS"
-  libs_qga="$solarisnetlibs $libs_qga"
-;;
-AIX)
-  aix="yes"
-  make="${MAKE-gmake}"
-;;
-Haiku)
-  haiku="yes"
-  QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
-  LIBS="-lposix_error_mapper -lnetwork $LIBS"
-;;
-*)
-  audio_drv_list="oss"
-  audio_possible_drivers="oss alsa sdl esd pa"
-  linux="yes"
-  linux_user="yes"
-  kvm="yes"
-  vhost_net="yes"
-  vhost_scsi="yes"
-  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "x32" ] ; then
-    audio_possible_drivers="$audio_possible_drivers fmod"
-  fi
-  QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES"
-;;
-esac
-
-if [ "$bsd" = "yes" ] ; then
-  if [ "$darwin" != "yes" ] ; then
-    bsd_user="yes"
-  fi
-fi
-
-: ${make=${MAKE-make}}
-: ${install=${INSTALL-install}}
-: ${python=${PYTHON-python}}
-: ${smbd=${SMBD-/usr/sbin/smbd}}
-
-# Default objcc to clang if available, otherwise use CC
-if has clang; then
-  objcc=clang
-else
-  objcc="$cc"
-fi
-
-if test "$mingw32" = "yes" ; then
-  EXESUF=".exe"
-  DSOSUF=".dll"
-  QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
-  # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
-  QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
-  LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
-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}"
-  datadir="\${prefix}"
-  qemu_docdir="\${prefix}"
-  bindir="\${prefix}"
-  sysconfdir="\${prefix}"
-  local_statedir=
-  confsuffix=""
-  libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga"
-fi
-
-werror=""
-
-for opt do
-  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
-  case "$opt" in
-  --help|-h) show_help=yes
-  ;;
-  --version|-V) exec cat $source_path/VERSION
-  ;;
-  --prefix=*) prefix="$optarg"
-  ;;
-  --interp-prefix=*) interp_prefix="$optarg"
-  ;;
-  --source-path=*)
-  ;;
-  --cross-prefix=*)
-  ;;
-  --cc=*)
-  ;;
-  --host-cc=*) host_cc="$optarg"
-  ;;
-  --cxx=*)
+  --cxx=*)
   ;;
   --iasl=*) iasl="$optarg"
   ;;
@@ -1126,89 +831,6 @@  for opt do
   esac
 done
 
-if ! has $python; then
-  error_exit "Python not found. Use --python=/path/to/python"
-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
-  error_exit "Cannot use '$python', Python 2.4 or later is required." \
-      "Note that Python 3 or later is not yet supported." \
-      "Use --python=/path/to/python to specify a supported Python."
-fi
-
-# The -B switch was added in Python 2.6.
-# If it is supplied, compiled files are not written.
-# Use it for Python versions which support it.
-if $python -B -c 'import sys; sys.exit(0)' 2>/dev/null; then
-  python="$python -B"
-fi
-
-case "$cpu" in
-    ppc)
-           CPU_CFLAGS="-m32"
-           LDFLAGS="-m32 $LDFLAGS"
-           ;;
-    ppc64)
-           CPU_CFLAGS="-m64"
-           LDFLAGS="-m64 $LDFLAGS"
-           ;;
-    sparc)
-           LDFLAGS="-m32 $LDFLAGS"
-           CPU_CFLAGS="-m32 -mcpu=ultrasparc"
-           ;;
-    sparc64)
-           LDFLAGS="-m64 $LDFLAGS"
-           CPU_CFLAGS="-m64 -mcpu=ultrasparc"
-           ;;
-    s390)
-           CPU_CFLAGS="-m31"
-           LDFLAGS="-m31 $LDFLAGS"
-           ;;
-    s390x)
-           CPU_CFLAGS="-m64"
-           LDFLAGS="-m64 $LDFLAGS"
-           ;;
-    i386)
-           CPU_CFLAGS="-m32"
-           LDFLAGS="-m32 $LDFLAGS"
-           cc_i386='$(CC) -m32'
-           ;;
-    x86_64)
-           CPU_CFLAGS="-m64"
-           LDFLAGS="-m64 $LDFLAGS"
-           cc_i386='$(CC) -m32'
-           ;;
-    x32)
-           CPU_CFLAGS="-mx32"
-           LDFLAGS="-mx32 $LDFLAGS"
-           cc_i386='$(CC) -m32'
-           ;;
-    # No special flags required for other host CPUs
-esac
-
-QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
-EXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS"
-
-default_target_list=""
-
-mak_wilds=""
-
-if [ "$softmmu" = "yes" ]; then
-    mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak"
-fi
-if [ "$linux_user" = "yes" ]; then
-    mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak"
-fi
-if [ "$bsd_user" = "yes" ]; then
-    mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
-fi
-
-for config in $mak_wilds; do
-    default_target_list="${default_target_list} $(basename "$config" .mak)"
-done
-
 if test x"$show_help" = x"yes" ; then
 cat << EOF
 
@@ -1390,6 +1012,384 @@  EOF
 exit 0
 fi
 
+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
+
+if check_define __linux__ ; then
+  targetos="Linux"
+elif check_define _WIN32 ; then
+  targetos='MINGW32'
+elif check_define __OpenBSD__ ; then
+  targetos='OpenBSD'
+elif check_define __sun__ ; then
+  targetos='SunOS'
+elif check_define __HAIKU__ ; then
+  targetos='Haiku'
+else
+  targetos=`uname -s`
+fi
+
+# Some host OSes need non-standard checks for which CPU to use.
+# Note that these checks are broken for cross-compilation: if you're
+# cross-compiling to one of these OSes then you'll need to specify
+# the correct CPU with the --cpu option.
+case $targetos in
+Darwin)
+  # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
+  # run 64-bit userspace code.
+  # If the user didn't specify a CPU explicitly and the kernel says this is
+  # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
+  if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
+    cpu="x86_64"
+  fi
+  ;;
+SunOS)
+  # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
+  if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
+    cpu="x86_64"
+  fi
+esac
+
+if test ! -z "$cpu" ; then
+  # command line argument
+  :
+elif check_define __i386__ ; then
+  cpu="i386"
+elif check_define __x86_64__ ; then
+  if check_define __ILP32__ ; then
+    cpu="x32"
+  else
+    cpu="x86_64"
+  fi
+elif check_define __sparc__ ; then
+  if check_define __arch64__ ; then
+    cpu="sparc64"
+  else
+    cpu="sparc"
+  fi
+elif check_define _ARCH_PPC ; then
+  if check_define _ARCH_PPC64 ; then
+    cpu="ppc64"
+  else
+    cpu="ppc"
+  fi
+elif check_define __mips__ ; then
+  cpu="mips"
+elif check_define __ia64__ ; then
+  cpu="ia64"
+elif check_define __s390__ ; then
+  if check_define __s390x__ ; then
+    cpu="s390x"
+  else
+    cpu="s390"
+  fi
+elif check_define __arm__ ; then
+  cpu="arm"
+elif check_define __aarch64__ ; then
+  cpu="aarch64"
+elif check_define __hppa__ ; then
+  cpu="hppa"
+else
+  cpu=`uname -m`
+fi
+
+ARCH=
+# Normalise host CPU name and set ARCH.
+# Note that this case should only have supported host CPUs, not guests.
+case "$cpu" in
+  ia64|ppc|ppc64|s390|s390x|sparc64|x32)
+    cpu="$cpu"
+  ;;
+  i386|i486|i586|i686|i86pc|BePC)
+    cpu="i386"
+  ;;
+  x86_64|amd64)
+    cpu="x86_64"
+  ;;
+  armv*b|armv*l|arm)
+    cpu="arm"
+  ;;
+  aarch64)
+    cpu="aarch64"
+  ;;
+  mips*)
+    cpu="mips"
+  ;;
+  sparc|sun4[cdmuv])
+    cpu="sparc"
+  ;;
+  *)
+    # This will result in either an error or falling back to TCI later
+    ARCH=unknown
+  ;;
+esac
+if test -z "$ARCH"; then
+  ARCH="$cpu"
+fi
+
+# OS specific
+
+# host *BSD for user mode
+HOST_VARIANT_DIR=""
+
+case $targetos in
+CYGWIN*)
+  mingw32="yes"
+  QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
+  audio_possible_drivers="winwave sdl"
+  audio_drv_list="winwave"
+;;
+MINGW32*)
+  mingw32="yes"
+  audio_possible_drivers="winwave dsound sdl fmod"
+  audio_drv_list="winwave"
+;;
+GNU/kFreeBSD)
+  bsd="yes"
+  audio_drv_list="oss"
+  audio_possible_drivers="oss sdl esd pa"
+;;
+FreeBSD)
+  bsd="yes"
+  make="${MAKE-gmake}"
+  audio_drv_list="oss"
+  audio_possible_drivers="oss sdl esd pa"
+  # needed for kinfo_getvmmap(3) in libutil.h
+  LIBS="-lutil $LIBS"
+  netmap=""  # enable netmap autodetect
+  HOST_VARIANT_DIR="freebsd"
+;;
+DragonFly)
+  bsd="yes"
+  make="${MAKE-gmake}"
+  audio_drv_list="oss"
+  audio_possible_drivers="oss sdl esd pa"
+  HOST_VARIANT_DIR="dragonfly"
+;;
+NetBSD)
+  bsd="yes"
+  make="${MAKE-gmake}"
+  audio_drv_list="oss"
+  audio_possible_drivers="oss sdl esd"
+  oss_lib="-lossaudio"
+  HOST_VARIANT_DIR="netbsd"
+;;
+OpenBSD)
+  bsd="yes"
+  make="${MAKE-gmake}"
+  audio_drv_list="sdl"
+  audio_possible_drivers="sdl esd"
+  HOST_VARIANT_DIR="openbsd"
+;;
+Darwin)
+  bsd="yes"
+  darwin="yes"
+  LDFLAGS_SHARED="-bundle -undefined dynamic_lookup"
+  if [ "$cpu" = "x86_64" ] ; then
+    QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
+    LDFLAGS="-arch x86_64 $LDFLAGS"
+  fi
+  cocoa="yes"
+  audio_drv_list="coreaudio"
+  audio_possible_drivers="coreaudio sdl fmod"
+  LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
+  libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
+  # Disable attempts to use ObjectiveC features in os/object.h since they
+  # won't work when we're compiling with gcc as a C compiler.
+  QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
+  HOST_VARIANT_DIR="darwin"
+;;
+SunOS)
+  solaris="yes"
+  make="${MAKE-gmake}"
+  install="${INSTALL-ginstall}"
+  ld="gld"
+  smbd="${SMBD-/usr/sfw/sbin/smbd}"
+  needs_libsunmath="no"
+  solarisrev=`uname -r | cut -f2 -d.`
+  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
+    if test "$solarisrev" -le 9 ; then
+      if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
+        needs_libsunmath="yes"
+        QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
+        LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
+        LIBS="-lsunmath $LIBS"
+      else
+        error_exit "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" \
+            "libsunmath from the Sun Studio compilers tools, due to a lack of" \
+            "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" \
+            "Studio 11 can be downloaded from www.sun.com."
+      fi
+    fi
+  fi
+  if test -f /usr/include/sys/soundcard.h ; then
+    audio_drv_list="oss"
+  fi
+  audio_possible_drivers="oss sdl"
+# needed for CMSG_ macros in sys/socket.h
+  QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
+# needed for TIOCWIN* defines in termios.h
+  QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
+  QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
+  solarisnetlibs="-lsocket -lnsl -lresolv"
+  LIBS="$solarisnetlibs $LIBS"
+  libs_qga="$solarisnetlibs $libs_qga"
+;;
+AIX)
+  aix="yes"
+  make="${MAKE-gmake}"
+;;
+Haiku)
+  haiku="yes"
+  QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
+  LIBS="-lposix_error_mapper -lnetwork $LIBS"
+;;
+*)
+  audio_drv_list="oss"
+  audio_possible_drivers="oss alsa sdl esd pa"
+  linux="yes"
+  linux_user="yes"
+  kvm="yes"
+  vhost_net="yes"
+  vhost_scsi="yes"
+  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "x32" ] ; then
+    audio_possible_drivers="$audio_possible_drivers fmod"
+  fi
+  QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES"
+;;
+esac
+
+if [ "$bsd" = "yes" ] ; then
+  if [ "$darwin" != "yes" ] ; then
+    bsd_user="yes"
+  fi
+fi
+
+: ${make=${MAKE-make}}
+: ${install=${INSTALL-install}}
+: ${python=${PYTHON-python}}
+: ${smbd=${SMBD-/usr/sbin/smbd}}
+
+# Default objcc to clang if available, otherwise use CC
+if has clang; then
+  objcc=clang
+else
+  objcc="$cc"
+fi
+
+if test "$mingw32" = "yes" ; then
+  EXESUF=".exe"
+  DSOSUF=".dll"
+  QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
+  # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
+  QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
+  LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
+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}"
+  datadir="\${prefix}"
+  qemu_docdir="\${prefix}"
+  bindir="\${prefix}"
+  sysconfdir="\${prefix}"
+  local_statedir=
+  confsuffix=""
+  libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga"
+fi
+
+if ! has $python; then
+  error_exit "Python not found. Use --python=/path/to/python"
+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
+  error_exit "Cannot use '$python', Python 2.4 or later is required." \
+      "Note that Python 3 or later is not yet supported." \
+      "Use --python=/path/to/python to specify a supported Python."
+fi
+
+# The -B switch was added in Python 2.6.
+# If it is supplied, compiled files are not written.
+# Use it for Python versions which support it.
+if $python -B -c 'import sys; sys.exit(0)' 2>/dev/null; then
+  python="$python -B"
+fi
+
+case "$cpu" in
+    ppc)
+           CPU_CFLAGS="-m32"
+           LDFLAGS="-m32 $LDFLAGS"
+           ;;
+    ppc64)
+           CPU_CFLAGS="-m64"
+           LDFLAGS="-m64 $LDFLAGS"
+           ;;
+    sparc)
+           LDFLAGS="-m32 $LDFLAGS"
+           CPU_CFLAGS="-m32 -mcpu=ultrasparc"
+           ;;
+    sparc64)
+           LDFLAGS="-m64 $LDFLAGS"
+           CPU_CFLAGS="-m64 -mcpu=ultrasparc"
+           ;;
+    s390)
+           CPU_CFLAGS="-m31"
+           LDFLAGS="-m31 $LDFLAGS"
+           ;;
+    s390x)
+           CPU_CFLAGS="-m64"
+           LDFLAGS="-m64 $LDFLAGS"
+           ;;
+    i386)
+           CPU_CFLAGS="-m32"
+           LDFLAGS="-m32 $LDFLAGS"
+           cc_i386='$(CC) -m32'
+           ;;
+    x86_64)
+           CPU_CFLAGS="-m64"
+           LDFLAGS="-m64 $LDFLAGS"
+           cc_i386='$(CC) -m32'
+           ;;
+    x32)
+           CPU_CFLAGS="-mx32"
+           LDFLAGS="-mx32 $LDFLAGS"
+           cc_i386='$(CC) -m32'
+           ;;
+    # No special flags required for other host CPUs
+esac
+
+QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
+EXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS"
+
+default_target_list=""
+
+mak_wilds=""
+
+if [ "$softmmu" = "yes" ]; then
+    mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak"
+fi
+if [ "$linux_user" = "yes" ]; then
+    mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak"
+fi
+if [ "$bsd_user" = "yes" ]; then
+    mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
+fi
+
+for config in $mak_wilds; do
+    default_target_list="${default_target_list} $(basename "$config" .mak)"
+done
+
 # 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