1e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#! /bin/sh
2e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# Attempt to guess a canonical system name.
3e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
5e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#   Free Software Foundation, Inc.
6e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
7e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevtimestamp='2008-01-23'
8e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
9e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# This file is free software; you can redistribute it and/or modify it
10e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# under the terms of the GNU General Public License as published by
11e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# the Free Software Foundation; either version 2 of the License, or
12e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# (at your option) any later version.
13e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#
14e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# This program is distributed in the hope that it will be useful, but
15e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# WITHOUT ANY WARRANTY; without even the implied warranty of
16e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# General Public License for more details.
18e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#
19e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# You should have received a copy of the GNU General Public License
20e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# along with this program; if not, write to the Free Software
21e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
22e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# 02110-1301, USA.
23e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#
24e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# As a special exception to the GNU General Public License, if you
25e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# distribute this file as part of a program that contains a
26e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# configuration script generated by Autoconf, you may include it under
27e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# the same distribution terms that you use for the rest of that program.
28e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
29e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
30e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# Originally written by Per Bothner <per@bothner.com>.
31e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# Please send patches to <config-patches@gnu.org>.  Submit a context
32e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# diff and a properly formatted ChangeLog entry.
33e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#
34e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# This script attempts to guess a canonical system name similar to
35e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# config.sub.  If it succeeds, it prints the system name on stdout, and
36e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# exits with 0.  Otherwise, it exits with 1.
37e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#
38e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# The plan is that this can be called by configure scripts if you
39e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# don't specify an explicit build system type.
40e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
41e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevme=`echo "$0" | sed -e 's,.*/,,'`
42e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
43e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevusage="\
44e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor GoulishevUsage: $0 [OPTION]
45e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
46e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor GoulishevOutput the configuration name of the system \`$me' is run on.
47e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
48e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor GoulishevOperation modes:
49e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev  -h, --help         print this help, then exit
50e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev  -t, --time-stamp   print date of last modification, then exit
51e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev  -v, --version      print version number, then exit
52e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
53e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor GoulishevReport bugs and patches to <config-patches@gnu.org>."
54e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
55e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevversion="\
56e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor GoulishevGNU config.guess ($timestamp)
57e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
58e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor GoulishevOriginally written by Per Bothner.
59e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor GoulishevCopyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
60e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
61e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
62e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor GoulishevThis is free software; see the source for copying conditions.  There is NO
63e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
64e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
65e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevhelp="
66e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor GoulishevTry \`$me --help' for more information."
67e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
68e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# Parse command line
69e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevwhile test $# -gt 0 ; do
70e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev  case $1 in
71e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    --time-stamp | --time* | -t )
72e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev       echo "$timestamp" ; exit ;;
73e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    --version | -v )
74e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev       echo "$version" ; exit ;;
75e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    --help | --h* | -h )
76e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev       echo "$usage"; exit ;;
77e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    -- )     # Stop option processing
78e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev       shift; break ;;
79e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    - )	# Use stdin as input.
80e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev       break ;;
81e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    -* )
82e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev       echo "$me: invalid option $1$help" >&2
83e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev       exit 1 ;;
84e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    * )
85e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev       break ;;
86e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev  esac
87e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevdone
88e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
89e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevif test $# != 0; then
90e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev  echo "$me: too many arguments$help" >&2
91e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev  exit 1
92e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevfi
93e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
94e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevtrap 'exit 1' 1 2 15
95e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
96e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
97e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# compiler to aid in system detection is discouraged as it requires
98e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# temporary files to be created and, as you can see below, it is a
99e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# headache to deal with in a portable fashion.
100e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
101e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
102e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# use `HOST_CC' if defined, but it is deprecated.
103e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
104e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# Portable tmp directory creation inspired by the Autoconf team.
105e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
106e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevset_cc_for_build='
107e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevtrap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
108e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevtrap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
109e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev: ${TMPDIR=/tmp} ;
110e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
111e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
112e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
113e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
114e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevdummy=$tmp/dummy ;
115e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevtmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
116e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevcase $CC_FOR_BUILD,$HOST_CC,$CC in
117e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev ,,)    echo "int x;" > $dummy.c ;
118e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	for c in cc gcc c89 c99 ; do
119e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
120e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	     CC_FOR_BUILD="$c"; break ;
121e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  fi ;
122e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	done ;
123e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	if test x"$CC_FOR_BUILD" = x ; then
124e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  CC_FOR_BUILD=no_compiler_found ;
125e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	fi
126e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	;;
127e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev ,,*)   CC_FOR_BUILD=$CC ;;
128e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
129e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevesac ; set_cc_for_build= ;'
130e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
131e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
132e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# (ghazi@noc.rutgers.edu 1994-08-24)
133e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevif (test -f /.attbin/uname) >/dev/null 2>&1 ; then
134e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	PATH=$PATH:/.attbin ; export PATH
135e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevfi
136e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
137e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor GoulishevUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
138e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor GoulishevUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
139e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor GoulishevUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
140e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor GoulishevUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
141e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
142e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevif [ "${UNAME_SYSTEM}" = "Linux" ] ; then
143e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	eval $set_cc_for_build
144e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	cat << EOF > $dummy.c
145e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#include <features.h>
146e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#ifdef __UCLIBC__
147e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# ifdef __UCLIBC_CONFIG_VERSION__
148e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	LIBC=uclibc __UCLIBC_CONFIG_VERSION__
149e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# else
150e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	LIBC=uclibc
151e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# endif
152e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#else
153e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	LIBC=gnu
154e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#endif
155e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor GoulishevEOF
156e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep LIBC= | sed -e 's: ::g'`
157e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevfi
158e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
159e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# Note: order is significant - the case branches are not exclusive.
160e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
161e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevcase "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
162e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:NetBSD:*:*)
163e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# NetBSD (nbsd) targets should (where applicable) match one or
164e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
165e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
166e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# switched to ELF, *-*-netbsd* would select the old
167e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# object file format.  This provides both forward
168e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# compatibility and a consistent mechanism for selecting the
169e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# object file format.
170e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#
171e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# Note: NetBSD doesn't particularly care about the vendor
172e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# portion of the name.  We always set it to "unknown".
173e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	sysctl="sysctl -n hw.machine_arch"
174e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
175e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
176e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	case "${UNAME_MACHINE_ARCH}" in
177e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    armeb) machine=armeb-unknown ;;
178e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    arm*) machine=arm-unknown ;;
179e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    sh3el) machine=shl-unknown ;;
180e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    sh3eb) machine=sh-unknown ;;
181e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    sh5el) machine=sh5le-unknown ;;
182e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
183e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	esac
184e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# The Operating System including object format, if it has switched
185e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# to ELF recently, or will in the future.
186e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	case "${UNAME_MACHINE_ARCH}" in
187e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
188e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		eval $set_cc_for_build
189e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
190e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev			| grep __ELF__ >/dev/null
191e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		then
192e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
193e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		    # Return netbsd for either.  FIX?
194e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		    os=netbsd
195e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		else
196e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		    os=netbsdelf
197e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		fi
198e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		;;
199e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    *)
200e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	        os=netbsd
201e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		;;
202e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	esac
203e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# The OS release
204e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# Debian GNU/NetBSD machines have a different userland, and
205e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# thus, need a distinct triplet. However, they do not need
206e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# kernel version information, so it can be replaced with a
207e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# suitable tag, in the style of linux-gnu.
208e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	case "${UNAME_VERSION}" in
209e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    Debian*)
210e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		release='-gnu'
211e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		;;
212e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    *)
213e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
214e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		;;
215e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	esac
216e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
217e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# contains redundant information, the shorter form:
218e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
219e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo "${machine}-${os}${release}"
220e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
221e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:OpenBSD:*:*)
222e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
223e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
224e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
225e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:ekkoBSD:*:*)
226e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
227e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
228e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:SolidBSD:*:*)
229e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
230e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
231e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    macppc:MirBSD:*:*)
232e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
233e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
234e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:MirBSD:*:*)
235e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
236e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
237e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    alpha:OSF1:*:*)
238e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	case $UNAME_RELEASE in
239e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	*4.0)
240e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
241e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		;;
242e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	*5.*)
243e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
244e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		;;
245e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	esac
246e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# According to Compaq, /usr/sbin/psrinfo has been available on
247e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# OSF/1 and Tru64 systems produced since 1995.  I hope that
248e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# covers most systems running today.  This code pipes the CPU
249e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# types through head -n 1, so we only detect the type of CPU 0.
250e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
251e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	case "$ALPHA_CPU_TYPE" in
252e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    "EV4 (21064)")
253e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		UNAME_MACHINE="alpha" ;;
254e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    "EV4.5 (21064)")
255e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		UNAME_MACHINE="alpha" ;;
256e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    "LCA4 (21066/21068)")
257e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		UNAME_MACHINE="alpha" ;;
258e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    "EV5 (21164)")
259e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		UNAME_MACHINE="alphaev5" ;;
260e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    "EV5.6 (21164A)")
261e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		UNAME_MACHINE="alphaev56" ;;
262e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    "EV5.6 (21164PC)")
263e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		UNAME_MACHINE="alphapca56" ;;
264e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    "EV5.7 (21164PC)")
265e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		UNAME_MACHINE="alphapca57" ;;
266e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    "EV6 (21264)")
267e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		UNAME_MACHINE="alphaev6" ;;
268e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    "EV6.7 (21264A)")
269e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		UNAME_MACHINE="alphaev67" ;;
270e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    "EV6.8CB (21264C)")
271e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		UNAME_MACHINE="alphaev68" ;;
272e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    "EV6.8AL (21264B)")
273e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		UNAME_MACHINE="alphaev68" ;;
274e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    "EV6.8CX (21264D)")
275e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		UNAME_MACHINE="alphaev68" ;;
276e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    "EV6.9A (21264/EV69A)")
277e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		UNAME_MACHINE="alphaev69" ;;
278e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    "EV7 (21364)")
279e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		UNAME_MACHINE="alphaev7" ;;
280e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    "EV7.9 (21364A)")
281e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		UNAME_MACHINE="alphaev79" ;;
282e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	esac
283e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# A Pn.n version is a patched version.
284e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# A Vn.n version is a released version.
285e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# A Tn.n version is a released field test version.
286e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# A Xn.n version is an unreleased experimental baselevel.
287e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# 1.2 uses "1.2" for uname -r.
288e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
289e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
290e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    Alpha\ *:Windows_NT*:*)
291e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# How do we know it's Interix rather than the generic POSIX subsystem?
292e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# Should we change UNAME_MACHINE based on the output of uname instead
293e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# of the specific Alpha model?
294e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo alpha-pc-interix
295e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
296e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    21064:Windows_NT:50:3)
297e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo alpha-dec-winnt3.5
298e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
299e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    Amiga*:UNIX_System_V:4.0:*)
300e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo m68k-unknown-sysv4
301e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
302e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:[Aa]miga[Oo][Ss]:*:*)
303e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-unknown-amigaos
304e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
305e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:[Mm]orph[Oo][Ss]:*:*)
306e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-unknown-morphos
307e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
308e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:OS/390:*:*)
309e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo i370-ibm-openedition
310e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
311e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:z/VM:*:*)
312e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo s390-ibm-zvmoe
313e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
314e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:OS400:*:*)
315e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        echo powerpc-ibm-os400
316e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
317e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
318e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo arm-acorn-riscix${UNAME_RELEASE}
319e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
320e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    arm:riscos:*:*|arm:RISCOS:*:*)
321e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo arm-unknown-riscos
322e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
323e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
324e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo hppa1.1-hitachi-hiuxmpp
325e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
326e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
327e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
328e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	if test "`(/bin/universe) 2>/dev/null`" = att ; then
329e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		echo pyramid-pyramid-sysv3
330e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	else
331e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		echo pyramid-pyramid-bsd
332e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	fi
333e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
334e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    NILE*:*:*:dcosx)
335e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo pyramid-pyramid-svr4
336e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
337e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    DRS?6000:unix:4.0:6*)
338e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo sparc-icl-nx6
339e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
340e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
341e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	case `/usr/bin/uname -p` in
342e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    sparc) echo sparc-icl-nx7; exit ;;
343e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	esac ;;
344e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    sun4H:SunOS:5.*:*)
345e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
346e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
347e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
348e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
349e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
350e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
351e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
352e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
353e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    sun4*:SunOS:6*:*)
354e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# According to config.sub, this is the proper way to canonicalize
355e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
356e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# it's likely to be more like Solaris than SunOS4.
357e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
358e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
359e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    sun4*:SunOS:*:*)
360e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	case "`/usr/bin/arch -k`" in
361e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    Series*|S4*)
362e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		UNAME_RELEASE=`uname -v`
363e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		;;
364e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	esac
365e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# Japanese Language versions have a version number like `4.1.3-JL'.
366e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
367e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
368e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    sun3*:SunOS:*:*)
369e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo m68k-sun-sunos${UNAME_RELEASE}
370e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
371e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    sun*:*:4.2BSD:*)
372e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
373e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
374e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	case "`/bin/arch`" in
375e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    sun3)
376e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		echo m68k-sun-sunos${UNAME_RELEASE}
377e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		;;
378e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    sun4)
379e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		echo sparc-sun-sunos${UNAME_RELEASE}
380e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		;;
381e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	esac
382e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
383e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    aushp:SunOS:*:*)
384e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo sparc-auspex-sunos${UNAME_RELEASE}
385e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
386e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    # The situation for MiNT is a little confusing.  The machine name
387e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    # can be virtually everything (everything which is not
388e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    # "atarist" or "atariste" at least should have a processor
389e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
390e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    # to the lowercase version "mint" (or "freemint").  Finally
391e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    # the system name "TOS" denotes a system which is actually not
392e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    # MiNT.  But MiNT is downward compatible to TOS, so this should
393e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    # be no problem.
394e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
395e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        echo m68k-atari-mint${UNAME_RELEASE}
396e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
397e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
398e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo m68k-atari-mint${UNAME_RELEASE}
399e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        exit ;;
400e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
401e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        echo m68k-atari-mint${UNAME_RELEASE}
402e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
403e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
404e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        echo m68k-milan-mint${UNAME_RELEASE}
405e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        exit ;;
406e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
407e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        echo m68k-hades-mint${UNAME_RELEASE}
408e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        exit ;;
409e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
410e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        echo m68k-unknown-mint${UNAME_RELEASE}
411e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        exit ;;
412e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    m68k:machten:*:*)
413e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo m68k-apple-machten${UNAME_RELEASE}
414e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
415e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    powerpc:machten:*:*)
416e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo powerpc-apple-machten${UNAME_RELEASE}
417e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
418e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    RISC*:Mach:*:*)
419e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo mips-dec-mach_bsd4.3
420e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
421e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    RISC*:ULTRIX:*:*)
422e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo mips-dec-ultrix${UNAME_RELEASE}
423e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
424e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    VAX*:ULTRIX*:*:*)
425e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo vax-dec-ultrix${UNAME_RELEASE}
426e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
427e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    2020:CLIX:*:* | 2430:CLIX:*:*)
428e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo clipper-intergraph-clix${UNAME_RELEASE}
429e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
430e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    mips:*:*:UMIPS | mips:*:*:RISCos)
431e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	eval $set_cc_for_build
432e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	sed 's/^	//' << EOF >$dummy.c
433e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#ifdef __cplusplus
434e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#include <stdio.h>  /* for printf() prototype */
435e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	int main (int argc, char *argv[]) {
436e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#else
437e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	int main (argc, argv) int argc; char *argv[]; {
438e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#endif
439e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#if defined (host_mips) && defined (MIPSEB)
440e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#if defined (SYSTYPE_SYSV)
441e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
442e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#endif
443e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#if defined (SYSTYPE_SVR4)
444e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
445e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#endif
446e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
447e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
448e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#endif
449e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#endif
450e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  exit (-1);
451e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	}
452e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor GoulishevEOF
453e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	$CC_FOR_BUILD -o $dummy $dummy.c &&
454e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
455e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  SYSTEM_NAME=`$dummy $dummyarg` &&
456e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    { echo "$SYSTEM_NAME"; exit; }
457e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo mips-mips-riscos${UNAME_RELEASE}
458e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
459e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    Motorola:PowerMAX_OS:*:*)
460e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo powerpc-motorola-powermax
461e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
462e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    Motorola:*:4.3:PL8-*)
463e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo powerpc-harris-powermax
464e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
465e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
466e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo powerpc-harris-powermax
467e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
468e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    Night_Hawk:Power_UNIX:*:*)
469e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo powerpc-harris-powerunix
470e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
471e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    m88k:CX/UX:7*:*)
472e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo m88k-harris-cxux7
473e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
474e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    m88k:*:4*:R4*)
475e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo m88k-motorola-sysv4
476e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
477e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    m88k:*:3*:R3*)
478e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo m88k-motorola-sysv3
479e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
480e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    AViiON:dgux:*:*)
481e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        # DG/UX returns AViiON for all architectures
482e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        UNAME_PROCESSOR=`/usr/bin/uname -p`
483e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
484e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	then
485e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
486e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	       [ ${TARGET_BINARY_INTERFACE}x = x ]
487e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    then
488e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		echo m88k-dg-dgux${UNAME_RELEASE}
489e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    else
490e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		echo m88k-dg-dguxbcs${UNAME_RELEASE}
491e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    fi
492e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	else
493e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    echo i586-dg-dgux${UNAME_RELEASE}
494e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	fi
495e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev 	exit ;;
496e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
497e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo m88k-dolphin-sysv3
498e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
499e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    M88*:*:R3*:*)
500e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# Delta 88k system running SVR3
501e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo m88k-motorola-sysv3
502e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
503e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
504e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo m88k-tektronix-sysv3
505e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
506e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
507e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo m68k-tektronix-bsd
508e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
509e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:IRIX*:*:*)
510e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
511e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
512e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
513e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
514e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
515e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    i*86:AIX:*:*)
516e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo i386-ibm-aix
517e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
518e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    ia64:AIX:*:*)
519e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	if [ -x /usr/bin/oslevel ] ; then
520e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		IBM_REV=`/usr/bin/oslevel`
521e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	else
522e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
523e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	fi
524e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
525e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
526e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:AIX:2:3)
527e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
528e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		eval $set_cc_for_build
529e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		sed 's/^		//' << EOF >$dummy.c
530e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		#include <sys/systemcfg.h>
531e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
532e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		main()
533e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev			{
534e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev			if (!__power_pc())
535e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev				exit(1);
536e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev			puts("powerpc-ibm-aix3.2.5");
537e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev			exit(0);
538e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev			}
539e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor GoulishevEOF
540e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
541e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		then
542e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev			echo "$SYSTEM_NAME"
543e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		else
544e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev			echo rs6000-ibm-aix3.2.5
545e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		fi
546e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
547e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		echo rs6000-ibm-aix3.2.4
548e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	else
549e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		echo rs6000-ibm-aix3.2
550e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	fi
551e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
552e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:AIX:*:[456])
553e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
554e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
555e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		IBM_ARCH=rs6000
556e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	else
557e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		IBM_ARCH=powerpc
558e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	fi
559e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	if [ -x /usr/bin/oslevel ] ; then
560e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		IBM_REV=`/usr/bin/oslevel`
561e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	else
562e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
563e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	fi
564e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
565e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
566e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:AIX:*:*)
567e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo rs6000-ibm-aix
568e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
569e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
570e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo romp-ibm-bsd4.4
571e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
572e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
573e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
574e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;                             # report: romp-ibm BSD 4.3
575e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:BOSX:*:*)
576e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo rs6000-bull-bosx
577e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
578e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    DPX/2?00:B.O.S.:*:*)
579e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo m68k-bull-sysv3
580e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
581e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    9000/[34]??:4.3bsd:1.*:*)
582e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo m68k-hp-bsd
583e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
584e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
585e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo m68k-hp-bsd4.4
586e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
587e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    9000/[34678]??:HP-UX:*:*)
588e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
589e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	case "${UNAME_MACHINE}" in
590e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    9000/31? )            HP_ARCH=m68000 ;;
591e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    9000/[34]?? )         HP_ARCH=m68k ;;
592e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    9000/[678][0-9][0-9])
593e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		if [ -x /usr/bin/getconf ]; then
594e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
595e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
596e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev                    case "${sc_cpu_version}" in
597e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
598e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
599e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev                      532)                      # CPU_PA_RISC2_0
600e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev                        case "${sc_kernel_bits}" in
601e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev                          32) HP_ARCH="hppa2.0n" ;;
602e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev                          64) HP_ARCH="hppa2.0w" ;;
603e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
604e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev                        esac ;;
605e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev                    esac
606e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		fi
607e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		if [ "${HP_ARCH}" = "" ]; then
608e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		    eval $set_cc_for_build
609e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		    sed 's/^              //' << EOF >$dummy.c
610e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
611e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev              #define _HPUX_SOURCE
612e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev              #include <stdlib.h>
613e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev              #include <unistd.h>
614e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
615e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev              int main ()
616e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev              {
617e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev              #if defined(_SC_KERNEL_BITS)
618e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev                  long bits = sysconf(_SC_KERNEL_BITS);
619e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev              #endif
620e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev                  long cpu  = sysconf (_SC_CPU_VERSION);
621e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
622e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev                  switch (cpu)
623e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev              	{
624e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
625e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
626e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev              	case CPU_PA_RISC2_0:
627e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev              #if defined(_SC_KERNEL_BITS)
628e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev              	    switch (bits)
629e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev              		{
630e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev              		case 64: puts ("hppa2.0w"); break;
631e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev              		case 32: puts ("hppa2.0n"); break;
632e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev              		default: puts ("hppa2.0"); break;
633e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev              		} break;
634e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev              #else  /* !defined(_SC_KERNEL_BITS) */
635e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev              	    puts ("hppa2.0"); break;
636e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev              #endif
637e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev              	default: puts ("hppa1.0"); break;
638e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev              	}
639e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev                  exit (0);
640e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev              }
641e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor GoulishevEOF
642e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
643e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		    test -z "$HP_ARCH" && HP_ARCH=hppa
644e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		fi ;;
645e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	esac
646e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	if [ ${HP_ARCH} = "hppa2.0w" ]
647e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	then
648e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    eval $set_cc_for_build
649e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
650e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
651e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
652e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    # generating 64-bit code.  GNU and HP use different nomenclature:
653e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    #
654e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    # $ CC_FOR_BUILD=cc ./config.guess
655e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    # => hppa2.0w-hp-hpux11.23
656e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
657e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    # => hppa64-hp-hpux11.23
658e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
659e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
660e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		grep __LP64__ >/dev/null
661e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    then
662e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		HP_ARCH="hppa2.0w"
663e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    else
664e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		HP_ARCH="hppa64"
665e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    fi
666e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	fi
667e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
668e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
669e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    ia64:HP-UX:*:*)
670e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
671e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ia64-hp-hpux${HPUX_REV}
672e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
673e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    3050*:HI-UX:*:*)
674e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	eval $set_cc_for_build
675e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	sed 's/^	//' << EOF >$dummy.c
676e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#include <unistd.h>
677e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	int
678e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	main ()
679e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	{
680e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  long cpu = sysconf (_SC_CPU_VERSION);
681e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
682e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
683e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	     results, however.  */
684e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  if (CPU_IS_PA_RISC (cpu))
685e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    {
686e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	      switch (cpu)
687e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		{
688e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
689e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
690e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
691e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		  default: puts ("hppa-hitachi-hiuxwe2"); break;
692e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		}
693e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    }
694e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  else if (CPU_IS_HP_MC68K (cpu))
695e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    puts ("m68k-hitachi-hiuxwe2");
696e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  else puts ("unknown-hitachi-hiuxwe2");
697e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  exit (0);
698e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	}
699e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor GoulishevEOF
700e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
701e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		{ echo "$SYSTEM_NAME"; exit; }
702e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo unknown-hitachi-hiuxwe2
703e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
704e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
705e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo hppa1.1-hp-bsd
706e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
707e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    9000/8??:4.3bsd:*:*)
708e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo hppa1.0-hp-bsd
709e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
710e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
711e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo hppa1.0-hp-mpeix
712e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
713e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
714e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo hppa1.1-hp-osf
715e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
716e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    hp8??:OSF1:*:*)
717e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo hppa1.0-hp-osf
718e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
719e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    i*86:OSF1:*:*)
720e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	if [ -x /usr/sbin/sysversion ] ; then
721e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    echo ${UNAME_MACHINE}-unknown-osf1mk
722e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	else
723e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    echo ${UNAME_MACHINE}-unknown-osf1
724e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	fi
725e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
726e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    parisc*:Lites*:*:*)
727e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo hppa1.1-hp-lites
728e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
729e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
730e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo c1-convex-bsd
731e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        exit ;;
732e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
733e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	if getsysinfo -f scalar_acc
734e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	then echo c32-convex-bsd
735e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	else echo c2-convex-bsd
736e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	fi
737e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        exit ;;
738e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
739e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo c34-convex-bsd
740e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        exit ;;
741e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
742e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo c38-convex-bsd
743e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        exit ;;
744e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
745e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo c4-convex-bsd
746e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        exit ;;
747e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    CRAY*Y-MP:*:*:*)
748e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
749e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
750e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    CRAY*[A-Z]90:*:*:*)
751e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
752e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
753e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
754e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	      -e 's/\.[^.]*$/.X/'
755e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
756e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    CRAY*TS:*:*:*)
757e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
758e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
759e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    CRAY*T3E:*:*:*)
760e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
761e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
762e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    CRAY*SV1:*:*:*)
763e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
764e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
765e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:UNICOS/mp:*:*)
766e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
767e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
768e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
769e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
770e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
771e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
772e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
773e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        exit ;;
774e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    5000:UNIX_System_V:4.*:*)
775e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
776e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
777e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
778e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
779e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
780e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
781e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
782e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    sparc*:BSD/OS:*:*)
783e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo sparc-unknown-bsdi${UNAME_RELEASE}
784e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
785e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:BSD/OS:*:*)
786e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
787e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
788e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:FreeBSD:*:*)
789e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	case ${UNAME_MACHINE} in
790e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    pc98)
791e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
792e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    amd64)
793e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
794e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    *)
795e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
796e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	esac
797e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
798e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    i*:CYGWIN*:*)
799e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-pc-cygwin
800e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
801e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:MINGW*:*)
802e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-pc-mingw32
803e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
804e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    i*:windows32*:*)
805e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    	# uname -m includes "-pc" on this system.
806e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    	echo ${UNAME_MACHINE}-mingw32
807e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
808e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    i*:PW*:*)
809e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-pc-pw32
810e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
811e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:Interix*:[3456]*)
812e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    	case ${UNAME_MACHINE} in
813e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    x86)
814e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		echo i586-pc-interix${UNAME_RELEASE}
815e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		exit ;;
816e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    EM64T | authenticamd)
817e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		echo x86_64-unknown-interix${UNAME_RELEASE}
818e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		exit ;;
819e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    IA64)
820e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		echo ia64-unknown-interix${UNAME_RELEASE}
821e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		exit ;;
822e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	esac ;;
823e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
824e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo i${UNAME_MACHINE}-pc-mks
825e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
826e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
827e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# How do we know it's Interix rather than the generic POSIX subsystem?
828e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
829e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# UNAME_MACHINE based on the output of uname instead of i386?
830e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo i586-pc-interix
831e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
832e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    i*:UWIN*:*)
833e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-pc-uwin
834e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
835e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
836e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo x86_64-unknown-cygwin
837e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
838e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    p*:CYGWIN*:*)
839e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo powerpcle-unknown-cygwin
840e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
841e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    prep*:SunOS:5.*:*)
842e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
843e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
844e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:GNU:*:*)
845e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# the GNU system
846e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
847e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
848e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:GNU/*:*:*)
849e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# other systems with GNU libc and userland
850e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
851e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
852e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    i*86:Minix:*:*)
853e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-pc-minix
854e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
855e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    arm*:Linux:*:*)
856e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	eval $set_cc_for_build
857e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
858e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    | grep -q __ARM_EABI__
859e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	then
860e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
861e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	else
862e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
863e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	fi
864e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
865e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    avr32*:Linux:*:*)
866e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
867e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
868e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    cris:Linux:*:*)
869e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo cris-axis-linux-${LIBC}
870e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
871e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    crisv32:Linux:*:*)
872e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo crisv32-axis-linux-${LIBC}
873e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
874e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    frv:Linux:*:*)
875e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    	echo frv-unknown-linux-${LIBC}
876e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
877e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    ia64:Linux:*:*)
878e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
879e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
880e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    m32r*:Linux:*:*)
881e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
882e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
883e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    m68*:Linux:*:*)
884e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
885e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
886e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    mips:Linux:*:*)
887e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	eval $set_cc_for_build
888e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	sed 's/^	//' << EOF >$dummy.c
889e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#undef CPU
890e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#undef mips
891e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#undef mipsel
892e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
893e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	CPU=mipsel
894e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#else
895e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
896e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	CPU=mips
897e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#else
898e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	CPU=
899e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#endif
900e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#endif
901e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor GoulishevEOF
902e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
903e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    /^CPU/{
904e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		s: ::g
905e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		p
906e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    }'`"
907e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
908e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	;;
909e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    mips64:Linux:*:*)
910e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	eval $set_cc_for_build
911e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	sed 's/^	//' << EOF >$dummy.c
912e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#undef CPU
913e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#undef mips64
914e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#undef mips64el
915e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
916e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	CPU=mips64el
917e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#else
918e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
919e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	CPU=mips64
920e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#else
921e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	CPU=
922e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#endif
923e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#endif
924e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor GoulishevEOF
925e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
926e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    /^CPU/{
927e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		s: ::g
928e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		p
929e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    }'`"
930e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
931e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	;;
932e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    or32:Linux:*:*)
933e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo or32-unknown-linux-${LIBC}
934e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
935e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    ppc:Linux:*:*)
936e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo powerpc-unknown-linux-${LIBC}
937e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
938e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    ppc64:Linux:*:*)
939e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo powerpc64-unknown-linux-${LIBC}
940e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
941e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    alpha:Linux:*:*)
942e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
943e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  EV5)   UNAME_MACHINE=alphaev5 ;;
944e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  EV56)  UNAME_MACHINE=alphaev56 ;;
945e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  PCA56) UNAME_MACHINE=alphapca56 ;;
946e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  PCA57) UNAME_MACHINE=alphapca56 ;;
947e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  EV6)   UNAME_MACHINE=alphaev6 ;;
948e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  EV67)  UNAME_MACHINE=alphaev67 ;;
949e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  EV68*) UNAME_MACHINE=alphaev68 ;;
950e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        esac
951e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
952e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
953e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
954e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
955e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    parisc:Linux:*:* | hppa:Linux:*:*)
956e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# Look for CPU level
957e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
958e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
959e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
960e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  *)    echo hppa-unknown-linux-${LIBC} ;;
961e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	esac
962e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
963e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    parisc64:Linux:*:* | hppa64:Linux:*:*)
964e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo hppa64-unknown-linux-${LIBC}
965e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
966e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    s390:Linux:*:* | s390x:Linux:*:*)
967e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-ibm-linux
968e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
969e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    sh64*:Linux:*:*)
970e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
971e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
972e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    sh*:Linux:*:*)
973e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
974e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
975e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    sparc:Linux:*:* | sparc64:Linux:*:*)
976e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
977e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
978e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    vax:Linux:*:*)
979e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
980e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
981e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    x86_64:Linux:*:*)
982e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo x86_64-unknown-linux-${LIBC}
983e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
984e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    xtensa*:Linux:*:*)
985e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
986e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
987e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    i*86:Linux:*:*)
988e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# The BFD linker knows what the default object file format is, so
989e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# first see if it will tell us. cd to the root directory to prevent
990e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# problems with other programs or directories called `ld' in the path.
991e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# Set LC_ALL=C to ensure ld outputs messages in English.
992e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
993e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev			 | sed -ne '/supported targets:/!d
994e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev				    s/[ 	][ 	]*/ /g
995e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev				    s/.*supported targets: *//
996e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev				    s/ .*//
997e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev				    p'`
998e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        case "$ld_supported_targets" in
999e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  elf32-i386)
1000e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		TENTATIVE="${UNAME_MACHINE}-pc-linux-${LIBC}"
1001e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		;;
1002e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  a.out-i386-linux)
1003e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		echo "${UNAME_MACHINE}-pc-linux-${LIBC}aout"
1004e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		exit ;;
1005e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  coff-i386)
1006e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		echo "${UNAME_MACHINE}-pc-linux-${LIBC}coff"
1007e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		exit ;;
1008e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  "")
1009e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		# Either a pre-BFD a.out linker (linux-gnuoldld) or
1010e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		# one that does not give us useful --help.
1011e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		echo "${UNAME_MACHINE}-pc-linux-${LIBC}oldld"
1012e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		exit ;;
1013e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	esac
1014e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# This should get integrated into the C code below, but now we hack
1015e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	if [ "$LIBC" != "gnu" ] ; then echo "$TENTATIVE" && exit 0 ; fi
1016e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# Determine whether the default compiler is a.out or elf
1017e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	eval $set_cc_for_build
1018e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	sed 's/^	//' << EOF >$dummy.c
1019e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#include <features.h>
1020e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#ifdef __ELF__
1021e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# ifdef __GLIBC__
1022e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#  if __GLIBC__ >= 2
1023e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	LIBC=gnu
1024e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#  else
1025e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	LIBC=gnulibc1
1026e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#  endif
1027e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# else
1028e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	LIBC=gnulibc1
1029e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# endif
1030e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#else
1031e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
1032e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	LIBC=gnu
1033e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#else
1034e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	LIBC=gnuaout
1035e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#endif
1036e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#endif
1037e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#ifdef __dietlibc__
1038e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	LIBC=dietlibc
1039e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	#endif
1040e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor GoulishevEOF
1041e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
1042e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    /^LIBC/{
1043e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		s: ::g
1044e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		p
1045e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    }'`"
1046e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	test x"${LIBC}" != x && {
1047e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
1048e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		exit
1049e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	}
1050e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
1051e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	;;
1052e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    i*86:DYNIX/ptx:4*:*)
1053e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1054e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# earlier versions are messed up and put the nodename in both
1055e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# sysname and nodename.
1056e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo i386-sequent-sysv4
1057e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1058e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    i*86:UNIX_SV:4.2MP:2.*)
1059e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        # Unixware is an offshoot of SVR4, but it has its own version
1060e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        # number series starting with 2...
1061e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        # I am not positive that other SVR4 systems won't match this,
1062e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# I just have to hope.  -- rms.
1063e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        # Use sysv4.2uw... so that sysv4* matches it.
1064e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
1065e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1066e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    i*86:OS/2:*:*)
1067e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# If we were able to find `uname', then EMX Unix compatibility
1068e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# is probably installed.
1069e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-pc-os2-emx
1070e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1071e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    i*86:XTS-300:*:STOP)
1072e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-unknown-stop
1073e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1074e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    i*86:atheos:*:*)
1075e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-unknown-atheos
1076e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1077e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    i*86:syllable:*:*)
1078e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-pc-syllable
1079e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1080e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
1081e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo i386-unknown-lynxos${UNAME_RELEASE}
1082e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1083e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    i*86:*DOS:*:*)
1084e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-pc-msdosdjgpp
1085e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1086e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
1087e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
1088e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1089e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
1090e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	else
1091e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
1092e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	fi
1093e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1094e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    i*86:*:5:[678]*)
1095e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
1096e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	case `/bin/uname -X | grep "^Machine"` in
1097e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    *486*)	     UNAME_MACHINE=i486 ;;
1098e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    *Pentium)	     UNAME_MACHINE=i586 ;;
1099e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1100e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	esac
1101e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1102e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1103e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    i*86:*:3.2:*)
1104e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	if test -f /usr/options/cb.name; then
1105e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1106e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
1107e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	elif /bin/uname -X 2>/dev/null >/dev/null ; then
1108e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1109e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1110e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1111e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev			&& UNAME_MACHINE=i586
1112e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1113e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev			&& UNAME_MACHINE=i686
1114e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1115e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev			&& UNAME_MACHINE=i686
1116e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
1117e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	else
1118e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		echo ${UNAME_MACHINE}-pc-sysv32
1119e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	fi
1120e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1121e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    pc:*:*:*)
1122e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# Left here for compatibility:
1123e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        # uname -m prints for DJGPP always 'pc', but it prints nothing about
1124e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        # the processor, so we play safe by assuming i386.
1125e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo i386-pc-msdosdjgpp
1126e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        exit ;;
1127e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    Intel:Mach:3*:*)
1128e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo i386-pc-mach3
1129e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1130e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    paragon:*:*:*)
1131e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo i860-intel-osf1
1132e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1133e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    i860:*:4.*:*) # i860-SVR4
1134e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1135e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
1136e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	else # Add other i860-SVR4 vendors below as they are discovered.
1137e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
1138e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	fi
1139e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1140e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    mini*:CTIX:SYS*5:*)
1141e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# "miniframe"
1142e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo m68010-convergent-sysv
1143e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1144e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    mc68k:UNIX:SYSTEM5:3.51m)
1145e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo m68k-convergent-sysv
1146e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1147e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    M680?0:D-NIX:5.3:*)
1148e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo m68k-diab-dnix
1149e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1150e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    M68*:*:R3V[5678]*:*)
1151e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1152e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
1153e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	OS_REL=''
1154e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	test -r /etc/.relid \
1155e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1156e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1157e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1158e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1159e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1160e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1161e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1162e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev          && { echo i486-ncr-sysv4; exit; } ;;
1163e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1164e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo m68k-unknown-lynxos${UNAME_RELEASE}
1165e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1166e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    mc68030:UNIX_System_V:4.*:*)
1167e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo m68k-atari-sysv4
1168e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1169e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    TSUNAMI:LynxOS:2.*:*)
1170e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo sparc-unknown-lynxos${UNAME_RELEASE}
1171e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1172e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    rs6000:LynxOS:2.*:*)
1173e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo rs6000-unknown-lynxos${UNAME_RELEASE}
1174e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1175e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
1176e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo powerpc-unknown-lynxos${UNAME_RELEASE}
1177e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1178e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    SM[BE]S:UNIX_SV:*:*)
1179e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo mips-dde-sysv${UNAME_RELEASE}
1180e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1181e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    RM*:ReliantUNIX-*:*:*)
1182e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo mips-sni-sysv4
1183e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1184e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    RM*:SINIX-*:*:*)
1185e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo mips-sni-sysv4
1186e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1187e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:SINIX-*:*:*)
1188e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	if uname -p 2>/dev/null >/dev/null ; then
1189e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1190e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		echo ${UNAME_MACHINE}-sni-sysv4
1191e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	else
1192e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		echo ns32k-sni-sysv
1193e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	fi
1194e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1195e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1196e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev                      # says <Richard.M.Bartel@ccMail.Census.GOV>
1197e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        echo i586-unisys-sysv4
1198e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        exit ;;
1199e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:UNIX_System_V:4*:FTX*)
1200e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# From Gerald Hewes <hewes@openmarket.com>.
1201e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# How about differentiating between stratus architectures? -djm
1202e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo hppa1.1-stratus-sysv4
1203e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1204e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:*:*:FTX*)
1205e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# From seanf@swdc.stratus.com.
1206e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo i860-stratus-sysv4
1207e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1208e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    i*86:VOS:*:*)
1209e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# From Paul.Green@stratus.com.
1210e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-stratus-vos
1211e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1212e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:VOS:*:*)
1213e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# From Paul.Green@stratus.com.
1214e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo hppa1.1-stratus-vos
1215e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1216e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    mc68*:A/UX:*:*)
1217e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo m68k-apple-aux${UNAME_RELEASE}
1218e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1219e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    news*:NEWS-OS:6*:*)
1220e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo mips-sony-newsos6
1221e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1222e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1223e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	if [ -d /usr/nec ]; then
1224e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	        echo mips-nec-sysv${UNAME_RELEASE}
1225e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	else
1226e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	        echo mips-unknown-sysv${UNAME_RELEASE}
1227e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	fi
1228e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        exit ;;
1229e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1230e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo powerpc-be-beos
1231e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1232e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1233e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo powerpc-apple-beos
1234e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1235e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1236e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo i586-pc-beos
1237e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1238e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    SX-4:SUPER-UX:*:*)
1239e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo sx4-nec-superux${UNAME_RELEASE}
1240e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1241e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    SX-5:SUPER-UX:*:*)
1242e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo sx5-nec-superux${UNAME_RELEASE}
1243e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1244e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    SX-6:SUPER-UX:*:*)
1245e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo sx6-nec-superux${UNAME_RELEASE}
1246e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1247e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    SX-7:SUPER-UX:*:*)
1248e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo sx7-nec-superux${UNAME_RELEASE}
1249e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1250e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    SX-8:SUPER-UX:*:*)
1251e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo sx8-nec-superux${UNAME_RELEASE}
1252e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1253e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    SX-8R:SUPER-UX:*:*)
1254e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo sx8r-nec-superux${UNAME_RELEASE}
1255e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1256e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    Power*:Rhapsody:*:*)
1257e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo powerpc-apple-rhapsody${UNAME_RELEASE}
1258e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1259e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:Rhapsody:*:*)
1260e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
1261e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1262e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:Darwin:*:*)
1263e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1264e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	case $UNAME_PROCESSOR in
1265e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    unknown) UNAME_PROCESSOR=powerpc ;;
1266e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	esac
1267e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
1268e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1269e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1270e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	UNAME_PROCESSOR=`uname -p`
1271e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	if test "$UNAME_PROCESSOR" = "x86"; then
1272e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		UNAME_PROCESSOR=i386
1273e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev		UNAME_MACHINE=pc
1274e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	fi
1275e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
1276e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1277e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:QNX:*:4*)
1278e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo i386-pc-qnx
1279e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1280e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    NSE-?:NONSTOP_KERNEL:*:*)
1281e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo nse-tandem-nsk${UNAME_RELEASE}
1282e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1283e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    NSR-?:NONSTOP_KERNEL:*:*)
1284e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo nsr-tandem-nsk${UNAME_RELEASE}
1285e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1286e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:NonStop-UX:*:*)
1287e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo mips-compaq-nonstopux
1288e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1289e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    BS2000:POSIX*:*:*)
1290e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo bs2000-siemens-sysv
1291e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1292e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    DS/*:UNIX_System_V:*:*)
1293e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
1294e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1295e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:Plan9:*:*)
1296e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# "uname -m" is not consistent, so use $cputype instead. 386
1297e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# is converted to i386 for consistency with other x86
1298e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	# operating systems.
1299e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	if test "$cputype" = "386"; then
1300e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    UNAME_MACHINE=i386
1301e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	else
1302e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    UNAME_MACHINE="$cputype"
1303e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	fi
1304e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-unknown-plan9
1305e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1306e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:TOPS-10:*:*)
1307e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo pdp10-unknown-tops10
1308e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1309e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:TENEX:*:*)
1310e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo pdp10-unknown-tenex
1311e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1312e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1313e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo pdp10-dec-tops20
1314e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1315e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1316e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo pdp10-xkl-tops20
1317e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1318e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:TOPS-20:*:*)
1319e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo pdp10-unknown-tops20
1320e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1321e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:ITS:*:*)
1322e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo pdp10-unknown-its
1323e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1324e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    SEI:*:*:SEIUX)
1325e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev        echo mips-sei-seiux${UNAME_RELEASE}
1326e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1327e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:DragonFly:*:*)
1328e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
1329e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1330e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:*VMS:*:*)
1331e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1332e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	case "${UNAME_MACHINE}" in
1333e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    A*) echo alpha-dec-vms ; exit ;;
1334e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    I*) echo ia64-dec-vms ; exit ;;
1335e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	    V*) echo vax-dec-vms ; exit ;;
1336e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	esac ;;
1337e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    *:XENIX:*:SysV)
1338e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo i386-pc-xenix
1339e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1340e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    i*86:skyos:*:*)
1341e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
1342e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1343e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    i*86:rdos:*:*)
1344e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo ${UNAME_MACHINE}-pc-rdos
1345e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1346e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevesac
1347e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1348e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#echo '(No uname command or uname output not recognized.)' 1>&2
1349e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
1350e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1351e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulisheveval $set_cc_for_build
1352e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevcat >$dummy.c <<EOF
1353e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#ifdef _SEQUENT_
1354e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# include <sys/types.h>
1355e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# include <sys/utsname.h>
1356e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#endif
1357e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevmain ()
1358e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev{
1359e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#if defined (sony)
1360e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#if defined (MIPSEB)
1361e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1362e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev     I don't know....  */
1363e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev  printf ("mips-sony-bsd\n"); exit (0);
1364e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#else
1365e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#include <sys/param.h>
1366e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev  printf ("m68k-sony-newsos%s\n",
1367e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#ifdef NEWSOS4
1368e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev          "4"
1369e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#else
1370e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	  ""
1371e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#endif
1372e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev         ); exit (0);
1373e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#endif
1374e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#endif
1375e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1376e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#if defined (__arm) && defined (__acorn) && defined (__unix)
1377e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev  printf ("arm-acorn-riscix\n"); exit (0);
1378e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#endif
1379e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1380e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#if defined (hp300) && !defined (hpux)
1381e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev  printf ("m68k-hp-bsd\n"); exit (0);
1382e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#endif
1383e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1384e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#if defined (NeXT)
1385e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#if !defined (__ARCHITECTURE__)
1386e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#define __ARCHITECTURE__ "m68k"
1387e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#endif
1388e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev  int version;
1389e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1390e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev  if (version < 4)
1391e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1392e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev  else
1393e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1394e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev  exit (0);
1395e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#endif
1396e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1397e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#if defined (MULTIMAX) || defined (n16)
1398e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#if defined (UMAXV)
1399e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev  printf ("ns32k-encore-sysv\n"); exit (0);
1400e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#else
1401e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#if defined (CMU)
1402e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev  printf ("ns32k-encore-mach\n"); exit (0);
1403e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#else
1404e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev  printf ("ns32k-encore-bsd\n"); exit (0);
1405e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#endif
1406e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#endif
1407e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#endif
1408e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1409e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#if defined (__386BSD__)
1410e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev  printf ("i386-pc-bsd\n"); exit (0);
1411e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#endif
1412e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1413e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#if defined (sequent)
1414e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#if defined (i386)
1415e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev  printf ("i386-sequent-dynix\n"); exit (0);
1416e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#endif
1417e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#if defined (ns32000)
1418e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev  printf ("ns32k-sequent-dynix\n"); exit (0);
1419e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#endif
1420e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#endif
1421e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1422e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#if defined (_SEQUENT_)
1423e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    struct utsname un;
1424e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1425e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    uname(&un);
1426e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1427e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    if (strncmp(un.version, "V2", 2) == 0) {
1428e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	printf ("i386-sequent-ptx2\n"); exit (0);
1429e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    }
1430e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1431e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	printf ("i386-sequent-ptx1\n"); exit (0);
1432e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    }
1433e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    printf ("i386-sequent-ptx\n"); exit (0);
1434e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1435e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#endif
1436e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1437e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#if defined (vax)
1438e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# if !defined (ultrix)
1439e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#  include <sys/param.h>
1440e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#  if defined (BSD)
1441e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#   if BSD == 43
1442e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev      printf ("vax-dec-bsd4.3\n"); exit (0);
1443e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#   else
1444e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#    if BSD == 199006
1445e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev      printf ("vax-dec-bsd4.3reno\n"); exit (0);
1446e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#    else
1447e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev      printf ("vax-dec-bsd\n"); exit (0);
1448e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#    endif
1449e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#   endif
1450e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#  else
1451e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    printf ("vax-dec-bsd\n"); exit (0);
1452e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#  endif
1453e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# else
1454e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    printf ("vax-dec-ultrix\n"); exit (0);
1455e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# endif
1456e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#endif
1457e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1458e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#if defined (alliant) && defined (i860)
1459e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev  printf ("i860-alliant-bsd\n"); exit (0);
1460e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev#endif
1461e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1462e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev  exit (1);
1463e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev}
1464e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor GoulishevEOF
1465e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1466e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
1467e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	{ echo "$SYSTEM_NAME"; exit; }
1468e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1469e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# Apollos put the system type in the environment.
1470e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1471e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevtest -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
1472e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1473e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# Convex versions that predate uname can use getsysinfo(1)
1474e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1475e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevif [ -x /usr/convex/getsysinfo ]
1476e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevthen
1477e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    case `getsysinfo -f cpu_type` in
1478e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    c1*)
1479e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo c1-convex-bsd
1480e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1481e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    c2*)
1482e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	if getsysinfo -f scalar_acc
1483e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	then echo c32-convex-bsd
1484e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	else echo c2-convex-bsd
1485e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	fi
1486e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1487e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    c34*)
1488e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo c34-convex-bsd
1489e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1490e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    c38*)
1491e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo c38-convex-bsd
1492e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1493e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    c4*)
1494e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	echo c4-convex-bsd
1495e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev	exit ;;
1496e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev    esac
1497e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevfi
1498e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1499e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevcat >&2 <<EOF
1500e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev$0: unable to guess system type
1501e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1502e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor GoulishevThis script, last modified $timestamp, has failed to recognize
1503e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevthe operating system you are using. It is advised that you
1504e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevdownload the most up to date version of the config scripts from
1505e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1506e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
1507e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevand
1508e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
1509e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1510e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor GoulishevIf the version you run ($0) is already up to date, please
1511e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevsend the following data and any information you think might be
1512e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevpertinent to <config-patches@gnu.org> in order to provide the needed
1513e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevinformation to handle your system.
1514e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1515e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevconfig.guess timestamp = $timestamp
1516e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1517e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevuname -m = `(uname -m) 2>/dev/null || echo unknown`
1518e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevuname -r = `(uname -r) 2>/dev/null || echo unknown`
1519e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevuname -s = `(uname -s) 2>/dev/null || echo unknown`
1520e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevuname -v = `(uname -v) 2>/dev/null || echo unknown`
1521e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1522e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1523e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1524e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1525e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevhostinfo               = `(hostinfo) 2>/dev/null`
1526e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev/bin/universe          = `(/bin/universe) 2>/dev/null`
1527e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1528e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev/bin/arch              = `(/bin/arch) 2>/dev/null`
1529e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1530e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1531e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1532e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor GoulishevUNAME_MACHINE = ${UNAME_MACHINE}
1533e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor GoulishevUNAME_RELEASE = ${UNAME_RELEASE}
1534e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor GoulishevUNAME_SYSTEM  = ${UNAME_SYSTEM}
1535e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor GoulishevUNAME_VERSION = ${UNAME_VERSION}
1536e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor GoulishevEOF
1537e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1538e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishevexit 1
1539e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev
1540e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# Local variables:
1541e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# eval: (add-hook 'write-file-hooks 'time-stamp)
1542e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# time-stamp-start: "timestamp='"
1543e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# time-stamp-format: "%:y-%02m-%02d"
1544e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# time-stamp-end: "'"
1545e9a683104ef3f40d38459c0ca62a2d46f20b0714Yavor Goulishev# End:
1546