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