#!/bin/sh
# ----------------------------------------------------------------------------
# - aguess                                                                   -
# - aleph platform guess program                                             -
# ----------------------------------------------------------------------------
# - This program is  free software;  you can  redistribute it and/or  modify -
# - it provided that this copyright notice is kept intact.                   -
# -                                                                          -
# - This  program  is  distributed in the hope  that it  will be useful, but -
# - without  any   warranty;  without  even   the   implied    warranty   of -
# - merchantability  or fitness for a particular purpose. In not event shall -
# - the copyright holder be  liable for  any direct, indirect, incidental or -
# - special damages arising in any way out of the use of this software.      -
# ----------------------------------------------------------------------------
# - copyright (c) 1999-2000 amaury darsch                                    -
# ----------------------------------------------------------------------------

get_os_name ()
{
    OSNAME=unknown
    name=`uname -s`
    case $name in
    Linux)   OSNAME=linux;;
    SunOS)   OSNAME=solaris;;
    HP-UX)   OSNAME=hpux;;
    FreeBSD) OSNAME=freebsd;;
    esac
}

get_machine ()
{
    MACHINE=unknown
    name=`uname -m`
    case $name in
    i386)  MACHINE=x86;;
    i486)  MACHINE=x86;;
    i586)  MACHINE=x86;;
    i686)  MACHINE=x86;;
    alpha) MACHINE=alpha;;
    sun4u) MACHINE=sparc;;
    sparc) MACHINE=sparc;;
    9000*) MACHINE=hppa;;
    m68k)  MACHINE=m68k;;
    arm*)  MACHINE=arm;;
    esac
}

# ----------------------------------------------------------------------------
# - main starts here                                                         -
# ----------------------------------------------------------------------------

# get system info
get_os_name
get_machine

# build build variable
if [ "$OSNAME" = "unknown" ]; then
    echo "aguess: cannot determine the os name"
    exit 1
fi
if [ "$MACHINE" = "unknown" ]; then
    echo "aguess: cannot determine the machine type"
    exit 1
fi

PLATFORM=${OSNAME}-${MACHINE}


# check for platform
if [ "$PLATFORM" = "" ]; then
    echo "aguess: invalid platform $1"
    exit 1
fi

echo $PLATFORM
