#!/bin/sh
# determine the directory name for the object code of this machine
#
# Jan Wielemaker, September 1991

# 1: it is specified

if [ -f $PCEHOME/arch ]; then
   cat $PCEHOME/arch
   exit 0
fi

arch=""
os=""
osversion=""

progarch=none
progmach=none
proguname=none

dirs="`echo $PATH | tr : ' '`"
progs="arch mach uname machine"

for d in $dirs; do
   if [ $d != . ]; then
      for p in $progs; do
         if [ -x $d/$p ]; then
	     case $p in
	         arch)  progarch=$d/$p;;
	         mach*) progmach=$d/$p;;
		 uname) proguname=$d/$p;;
	     esac
	 fi
      done
   fi
done

if [ $progmach != none ]; then arch=`$progmach`; fi
if [ "$arch" = "" -a $progarch != none ]; then arch=`$progarch`; fi
if [ $proguname != none ]; then
    if [ "$arch" = "" ]; then arch=`$proguname -p`; fi
    os=`$proguname -s`
    osversion=`$proguname -r`
fi

id=`echo $arch-$os-$osversion | tr A-Z a-z`

echo $id

