#! /bin/sh
# @(#)ptarch	1.22 09/30/97
# shell script to figure out architecture, using C preprocessor
# works on the architectures we support.  This script is based 
# on the gcc config.guess script.  See $PTOLEMY/src/gnu/src/gcc/config.guess 
# for the original script.

# This script attempts to guess a canonical system name.
#   Copyright (C) 1992, 1993 Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# 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.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */

#
# This script attempts to guess a canonical system name similar to
# config.sub.  If it succeeds, it prints the system name on stdout, and
# exits with 0.  Otherwise, it exits with 1.
#
# The plan is that this can be called by configure scripts if you
# don't specify an explicit system type (host/target name).
#
# Only a few systems have been added to this list; please add others
# (but try to keep the structure clean).
#

UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown

# Note: order is significant - the case branches are not exclusive.

case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in

    *:AIX:2:3)
	# Ptolemy under AIX 3.2.*
 	echo aix
    exit 0 ;;

    alpha:OSF1:V4.*:*)
	# DEC Alpha support in Ptolemy might not be complete
	echo alpha4
    exit 0 ;;

    alpha:OSF1:*:*)
	# DEC Alpha  support in Ptolemy might not be complete
	echo alpha
    exit 0 ;;

    sun4*:SunOS:5.4:*)
	#echo sol24
	echo sol2
	exit 0 ;;

    sun4*:SunOS:5.5*:*)
	echo sol2.5
	exit 0 ;;

    sun4*:SunOS:5.*:*)
    echo sol2
    exit 0 ;;

    sun4*:SunOS:*:*)
	echo sun4
	exit 0 ;;

    sun3*:SunOS:*:*)
	# Ptolemy 0.4.1 supported sun3, but we have not tried it since then
	echo sun3
	exit 0 ;;

    RISC*:ULTRIX:*:*)
	echo mips
	exit 0 ;;

    *:IRIX:4.*:*)
	# Untested, but Ptolemy once built under Irix4
	echo irix4
	exit 0 ;;

    *:IRIX:5.*:*)
	echo irix5
	exit 0 ;;

     *:IRIX:6.*:*)
    	echo irix6.cfront
    	exit 0 ;;

    9000/???:HP-UX:A.09.*:*)
	echo hppa9
	exit 0 ;;

    9000/???:HP-UX:*:*)
	echo hppa
	exit 0 ;;

    i[3456789]86:Linux:*:*)
	# Linux support in Ptolemy might not be complete
	echo linux
	exit 0 ;;

    i[3456789]86:NetBSD:1.0:*)
 	# NetBSD 0.8 and 0.9 not supported
 	# Specify architecture since NetBSD runs on multiple architectures
 	echo nbsd.386 
 	exit 0 ;;

    i[3456789]86:FreeBSD:*:*)
 	echo freebsd
 	exit 0 ;;

    i[3456789]86:*NT:4.*:*)
	# The NT4 port does not yet exist
	echo nt4
	exit 0;;

    i[3456789]86:*NT:5.*:*)
	# The NT5 port does not yet exist
	echo nt5
	exit 0;;

esac

#echo '(No uname command or uname output not recognized.)' 1>&2
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2

#echo '(Unable to guess system type)' 1>&2

exit 1
