#!/bin/sh
#
# $Id: binext,v 1.14 1998/09/12 13:09:24 ejb Exp $
# $Source: /mit/qjb/scripts/RCS/binext,v $
# $Author: ejb $
#
# This script prints the name of the architecture type of the
# current machine in a form suitable for use as a component of a
# directory to contain binary files for that machine.
#

arch=`uname`
binext=$arch

if [ $arch = SunOS ]; then
   arch=`uname -m | cut -c1-4`
   if [ "$arch" = "" ]; then
      arch=`arch`
   fi
   rel=`uname -r | cut -c1`
   if [ $rel = 5 ]; then
      binext=$arch.sol2
   else
      binext=$arch.sol1
   fi
fi
if [ $arch = IRIX ]; then
   rel=`uname -r | cut -d. -f1`
   binext=sgi.irix$rel
fi
if [ $arch = HP-UX ]; then
   rel=`uname -r | cut -d. -f2`
   if [ $rel = 09 ]; then
      binext=hp.hpux9
   fi
fi
if [ $arch = ULTRIX ]; then
   rel=`uname -r | cut -d. -f1`
   binext=dec.ultrix$rel
fi
if [ $arch = AIX ]; then
   rel=`uname -r | cut -d. -f1`
   binext=ibm.aix$rel
fi
if [ $arch = Linux ]; then
   cpu=`uname --machine | sed -e s/i.86/ix86/`
   libc=`ldd /bin/ls | grep libc.so. | cut -d. -f3 | cut -d" " -f1`
   binext=$cpu.linux.libc$libc
fi
if [ $arch = BSD/386 ]; then
   binext=bsd386
fi
if [ $arch = OSF1 ]; then
   binext=`uname -m`.osf1
fi
if [ $arch = FreeBSD ]; then
   cpu=`uname -m`
   binext=$cpu.freebsd
fi

echo $binext
