Patchwork [39/39] use host triplets for feature detection

login
register
mail settings
Submitter Paolo Bonzini
Date Oct. 12, 2010, 1 p.m.
Message ID <1286888457-5033-40-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/67591/
State New
Headers show

Comments

Paolo Bonzini - Oct. 12, 2010, 1 p.m.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure |   64 ++++++++++++++++++++-----------------------------------------
 1 files changed, 21 insertions(+), 43 deletions(-)

Patch

diff --git a/configure b/configure
index 0340cfe..69b3406 100755
--- a/configure
+++ b/configure
@@ -290,49 +290,25 @@  case "$cpu" in
   ;;
 esac
 
-check_define() {
-cat > $TMPC <<EOF
-#if !defined($1)
-#error Not defined
-#endif
-int main(void) { return 0; }
-EOF
-  compile_object
-}
-
 # OS specific
-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
-
-case $targetos in
-CYGWIN*)
+case $host in
+*-*-cygwin*)
   mingw32="yes"
   QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
   audio_possible_drivers="winwave sdl"
   audio_drv_list="winwave"
 ;;
-MINGW32*)
+*-*-mingw32)
   mingw32="yes"
   audio_possible_drivers="winwave dsound sdl fmod"
   audio_drv_list="winwave"
 ;;
-GNU/kFreeBSD)
+*-*-kfreebsd*-gnu)
   bsd="yes"
   audio_drv_list="oss"
   audio_possible_drivers="oss sdl esd pa"
 ;;
-FreeBSD)
+*-*-freebsd*)
   bsd="yes"
   make="${MAKE-gmake}"
   audio_drv_list="oss"
@@ -340,27 +316,27 @@  FreeBSD)
   # needed for kinfo_getvmmap(3) in libutil.h
   LIBS="-lutil $LIBS"
 ;;
-DragonFly)
+*-*-dragonfly*)
   bsd="yes"
   make="${MAKE-gmake}"
   audio_drv_list="oss"
   audio_possible_drivers="oss sdl esd pa"
 ;;
-NetBSD)
+*-*-netbsd*)
   bsd="yes"
   make="${MAKE-gmake}"
   audio_drv_list="oss"
   audio_possible_drivers="oss sdl esd"
   oss_lib="-lossaudio"
 ;;
-OpenBSD)
+*-*-openbsd*)
   bsd="yes"
   make="${MAKE-gmake}"
   audio_drv_list="oss"
   audio_possible_drivers="oss sdl esd"
   oss_lib="-lossaudio"
 ;;
-Darwin)
+*-*-darwin*)
   bsd="yes"
   darwin="yes"
   # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can
@@ -382,7 +358,7 @@  Darwin)
   LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
   libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
 ;;
-SunOS)
+*-*-solaris*)
   solaris="yes"
   make="${MAKE-gmake}"
   install="${INSTALL-ginstall}"
@@ -418,11 +394,11 @@  SunOS)
   QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
   LIBS="-lsocket -lnsl -lresolv $LIBS"
 ;;
-AIX)
+*-*-aix*)
   aix="yes"
   make="${MAKE-gmake}"
 ;;
-Haiku)
+*-*-haiku)
   haiku="yes"
   QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
   LIBS="-lposix_error_mapper -lnetwork $LIBS"
@@ -2289,13 +2265,15 @@  if test "$softmmu" = yes ; then
   fi
 fi
 
-# Mac OS X ships with a broken assembler
-roms=
-if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
-        "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
-        "$softmmu" = yes ; then
-  roms="optionrom"
-fi
+case "$softmmu:$host" in
+  # Mac OS X ships with a broken assembler
+  no:* | \
+  yes:*-*-darwin* | \
+  yes:*-*-solaris*) roms= ;;
+
+  yes:i[3456]86-* | yes:x86_64-* ) roms=optionrom;;
+  *) roms= ;;
+esac
 
 
 echo "Install prefix    $prefix"