Import newest os detection from dhcpcd openresolv-3.5.7
authorRoy Marples <roy@marples.name>
Wed, 30 Apr 2014 08:58:55 +0000 (08:58 +0000)
committerRoy Marples <roy@marples.name>
Wed, 30 Apr 2014 08:58:55 +0000 (08:58 +0000)
configure

index daf818abb851b56b06e0f20b1bee92e795ee4ae8..a32cc1c653ee7d893be2d36875cbadb869756c2a 100755 (executable)
--- a/configure
+++ b/configure
@@ -80,49 +80,37 @@ eval MANDIR="$MANDIR"
 CONFIG_MK=config.mk
 
 if [ -z "$BUILD" ]; then
 CONFIG_MK=config.mk
 
 if [ -z "$BUILD" ]; then
-       BUILD=`uname -m`-`uname -s | tr '[:upper:]' '[:lower:]'`
-fi
-if [ -z "$HOST" ]; then
-       [ -z "$TARGET" ] && TARGET=$BUILD
-       HOST=$TARGET
-fi
-if [ -z "$TARGET" ]; then
-       [ -z "$HOST" ] && HOST=$BUILD
-       TARGET=$HOST
+       # autoconf target triplet: cpu-vendor-os
+       BUILD=$(uname -m)-unknown-$(uname -s | tr '[:upper:]' '[:lower:]')
 fi
 fi
+: ${HOST:=$BUILD}
 
 
-# Debian and Slackware have linux in different places when dealing with
-# autoconf, so we deal with that here.
 if [ -z "$OS" ]; then
 if [ -z "$OS" ]; then
-       case "$TARGET" in
-       *-linux-*|linux-*|*-linux|linux) OS=linux;;
-       esac
-fi
-
-if [ -z "$OS" ]; then
-       # Derive OS from cpu-manufacturer-os-kernel
-       CPU=${TARGET%%-*}
-       REST=${TARGET#*-}
+       echo "Deriving operating system from ... $HOST"
+       # Derive OS from cpu-vendor-[kernel-]os
+       CPU=${HOST%%-*}
+       REST=${HOST#*-}
        if [ "$CPU" != "$REST" ]; then
        if [ "$CPU" != "$REST" ]; then
-               MANU=${REST%%-*}
+               VENDOR=${REST%%-*}
                REST=${REST#*-}
                REST=${REST#*-}
-               if [ "$MANU" != "$REST" ]; then
+               if [ "$VENDOR" != "$REST" ]; then
+                       # Use kernel if given, otherwise os
                        OS=${REST%%-*}
                        OS=${REST%%-*}
-                       REST=${REST#*-}
-                       if [ "$OS" != "$REST" ]; then
-                               KERNEL=${REST%%-*}
-                       else
-                               # 3 tupple
-                               KERNEL=$OS
-                               OS=$MANU
-                               MANU=
-                       fi
                else
                        # 2 tupple
                else
                        # 2 tupple
-                       OS=$MANU
-                       MANU=
+                       OS=$VENDOR
+                       VENDOR=
                fi
        fi
                fi
        fi
+
+        # Work with cpu-kernel-os, ie Debian
+       case "$VENDOR" in
+       linux*|kfreebsd*) OS=$VENDOR; VENDOR= ;;
+       esac
+       # Special case
+       case "$OS" in
+       gnu*) OS=hurd;; # No HURD support as yet
+       esac
 fi
 
 echo "Configuring openresolv for ... $OS"
 fi
 
 echo "Configuring openresolv for ... $OS"