1382ff0afSmrg#! /bin/sh
2382ff0afSmrg# Attempt to guess a canonical system name.
3382ff0afSmrg#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4382ff0afSmrg#   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
5382ff0afSmrg
6382ff0afSmrgtimestamp='2003-06-17'
7382ff0afSmrg
8382ff0afSmrg# This file is free software; you can redistribute it and/or modify it
9382ff0afSmrg# under the terms of the GNU General Public License as published by
10382ff0afSmrg# the Free Software Foundation; either version 2 of the License, or
11382ff0afSmrg# (at your option) any later version.
12382ff0afSmrg#
13382ff0afSmrg# This program is distributed in the hope that it will be useful, but
14382ff0afSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
15382ff0afSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16382ff0afSmrg# General Public License for more details.
17382ff0afSmrg#
18382ff0afSmrg# You should have received a copy of the GNU General Public License
19382ff0afSmrg# along with this program; if not, write to the Free Software
20382ff0afSmrg# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21382ff0afSmrg#
22382ff0afSmrg# As a special exception to the GNU General Public License, if you
23382ff0afSmrg# distribute this file as part of a program that contains a
24382ff0afSmrg# configuration script generated by Autoconf, you may include it under
25382ff0afSmrg# the same distribution terms that you use for the rest of that program.
26382ff0afSmrg
27382ff0afSmrg# Originally written by Per Bothner <per@bothner.com>.
28382ff0afSmrg# Please send patches to <config-patches@gnu.org>.  Submit a context
29382ff0afSmrg# diff and a properly formatted ChangeLog entry.
30382ff0afSmrg#
31382ff0afSmrg# This script attempts to guess a canonical system name similar to
32382ff0afSmrg# config.sub.  If it succeeds, it prints the system name on stdout, and
33382ff0afSmrg# exits with 0.  Otherwise, it exits with 1.
34382ff0afSmrg#
35382ff0afSmrg# The plan is that this can be called by configure scripts if you
36382ff0afSmrg# don't specify an explicit build system type.
37382ff0afSmrg
38382ff0afSmrgme=`echo "$0" | sed -e 's,.*/,,'`
39382ff0afSmrg
40382ff0afSmrgusage="\
41382ff0afSmrgUsage: $0 [OPTION]
42382ff0afSmrg
43382ff0afSmrgOutput the configuration name of the system \`$me' is run on.
44382ff0afSmrg
45382ff0afSmrgOperation modes:
46382ff0afSmrg  -h, --help         print this help, then exit
47382ff0afSmrg  -t, --time-stamp   print date of last modification, then exit
48382ff0afSmrg  -v, --version      print version number, then exit
49382ff0afSmrg
50382ff0afSmrgReport bugs and patches to <config-patches@gnu.org>."
51382ff0afSmrg
52382ff0afSmrgversion="\
53382ff0afSmrgGNU config.guess ($timestamp)
54382ff0afSmrg
55382ff0afSmrgOriginally written by Per Bothner.
56382ff0afSmrgCopyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
57382ff0afSmrgFree Software Foundation, Inc.
58382ff0afSmrg
59382ff0afSmrgThis is free software; see the source for copying conditions.  There is NO
60382ff0afSmrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
61382ff0afSmrg
62382ff0afSmrghelp="
63382ff0afSmrgTry \`$me --help' for more information."
64382ff0afSmrg
65382ff0afSmrg# Parse command line
66382ff0afSmrgwhile test $# -gt 0 ; do
67382ff0afSmrg  case $1 in
68382ff0afSmrg    --time-stamp | --time* | -t )
69382ff0afSmrg       echo "$timestamp" ; exit 0 ;;
70382ff0afSmrg    --version | -v )
71382ff0afSmrg       echo "$version" ; exit 0 ;;
72382ff0afSmrg    --help | --h* | -h )
73382ff0afSmrg       echo "$usage"; exit 0 ;;
74382ff0afSmrg    -- )     # Stop option processing
75382ff0afSmrg       shift; break ;;
76382ff0afSmrg    - )	# Use stdin as input.
77382ff0afSmrg       break ;;
78382ff0afSmrg    -* )
79382ff0afSmrg       echo "$me: invalid option $1$help" >&2
80382ff0afSmrg       exit 1 ;;
81382ff0afSmrg    * )
82382ff0afSmrg       break ;;
83382ff0afSmrg  esac
84382ff0afSmrgdone
85382ff0afSmrg
86382ff0afSmrgif test $# != 0; then
87382ff0afSmrg  echo "$me: too many arguments$help" >&2
88382ff0afSmrg  exit 1
89382ff0afSmrgfi
90382ff0afSmrg
91382ff0afSmrgtrap 'exit 1' 1 2 15
92382ff0afSmrg
93382ff0afSmrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
94382ff0afSmrg# compiler to aid in system detection is discouraged as it requires
95382ff0afSmrg# temporary files to be created and, as you can see below, it is a
96382ff0afSmrg# headache to deal with in a portable fashion.
97382ff0afSmrg
98382ff0afSmrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
99382ff0afSmrg# use `HOST_CC' if defined, but it is deprecated.
100382ff0afSmrg
101382ff0afSmrg# Portable tmp directory creation inspired by the Autoconf team.
102382ff0afSmrg
103382ff0afSmrgset_cc_for_build='
104382ff0afSmrgtrap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
105382ff0afSmrgtrap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
106382ff0afSmrg: ${TMPDIR=/tmp} ;
107382ff0afSmrg { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
108382ff0afSmrg { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
109382ff0afSmrg { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
110382ff0afSmrg { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
111382ff0afSmrgdummy=$tmp/dummy ;
112382ff0afSmrgtmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
113382ff0afSmrgcase $CC_FOR_BUILD,$HOST_CC,$CC in
114382ff0afSmrg ,,)    echo "int x;" > $dummy.c ;
115382ff0afSmrg	for c in cc gcc c89 c99 ; do
116382ff0afSmrg	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
117382ff0afSmrg	     CC_FOR_BUILD="$c"; break ;
118382ff0afSmrg	  fi ;
119382ff0afSmrg	done ;
120382ff0afSmrg	if test x"$CC_FOR_BUILD" = x ; then
121382ff0afSmrg	  CC_FOR_BUILD=no_compiler_found ;
122382ff0afSmrg	fi
123382ff0afSmrg	;;
124382ff0afSmrg ,,*)   CC_FOR_BUILD=$CC ;;
125382ff0afSmrg ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
126382ff0afSmrgesac ;'
127382ff0afSmrg
128382ff0afSmrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
129382ff0afSmrg# (ghazi@noc.rutgers.edu 1994-08-24)
130382ff0afSmrgif (test -f /.attbin/uname) >/dev/null 2>&1 ; then
131382ff0afSmrg	PATH=$PATH:/.attbin ; export PATH
132382ff0afSmrgfi
133382ff0afSmrg
134382ff0afSmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
135382ff0afSmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
136382ff0afSmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
137382ff0afSmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
138382ff0afSmrg
139382ff0afSmrg## for Red Hat Linux
140382ff0afSmrgif test -f /etc/redhat-release ; then
141382ff0afSmrg    VENDOR=redhat ;
142382ff0afSmrgelse
143382ff0afSmrg    VENDOR= ;
144382ff0afSmrgfi
145382ff0afSmrg
146382ff0afSmrg# Note: order is significant - the case branches are not exclusive.
147382ff0afSmrg
148382ff0afSmrgcase "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
149382ff0afSmrg    *:NetBSD:*:*)
150382ff0afSmrg	# NetBSD (nbsd) targets should (where applicable) match one or
151382ff0afSmrg	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
152382ff0afSmrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
153382ff0afSmrg	# switched to ELF, *-*-netbsd* would select the old
154382ff0afSmrg	# object file format.  This provides both forward
155382ff0afSmrg	# compatibility and a consistent mechanism for selecting the
156382ff0afSmrg	# object file format.
157382ff0afSmrg	#
158382ff0afSmrg	# Note: NetBSD doesn't particularly care about the vendor
159382ff0afSmrg	# portion of the name.  We always set it to "unknown".
160382ff0afSmrg	sysctl="sysctl -n hw.machine_arch"
161382ff0afSmrg	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
162382ff0afSmrg	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
163382ff0afSmrg	case "${UNAME_MACHINE_ARCH}" in
164382ff0afSmrg	    armeb) machine=armeb-unknown ;;
165382ff0afSmrg	    arm*) machine=arm-unknown ;;
166382ff0afSmrg	    sh3el) machine=shl-unknown ;;
167382ff0afSmrg	    sh3eb) machine=sh-unknown ;;
168382ff0afSmrg	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
169382ff0afSmrg	esac
170382ff0afSmrg	# The Operating System including object format, if it has switched
171382ff0afSmrg	# to ELF recently, or will in the future.
172382ff0afSmrg	case "${UNAME_MACHINE_ARCH}" in
173382ff0afSmrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
174382ff0afSmrg		eval $set_cc_for_build
175382ff0afSmrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
176382ff0afSmrg			| grep __ELF__ >/dev/null
177382ff0afSmrg		then
178382ff0afSmrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
179382ff0afSmrg		    # Return netbsd for either.  FIX?
180382ff0afSmrg		    os=netbsd
181382ff0afSmrg		else
182382ff0afSmrg		    os=netbsdelf
183382ff0afSmrg		fi
184382ff0afSmrg		;;
185382ff0afSmrg	    *)
186382ff0afSmrg	        os=netbsd
187382ff0afSmrg		;;
188382ff0afSmrg	esac
189382ff0afSmrg	# The OS release
190382ff0afSmrg	# Debian GNU/NetBSD machines have a different userland, and
191382ff0afSmrg	# thus, need a distinct triplet. However, they do not need
192382ff0afSmrg	# kernel version information, so it can be replaced with a
193382ff0afSmrg	# suitable tag, in the style of linux-gnu.
194382ff0afSmrg	case "${UNAME_VERSION}" in
195382ff0afSmrg	    Debian*)
196382ff0afSmrg		release='-gnu'
197382ff0afSmrg		;;
198382ff0afSmrg	    *)
199382ff0afSmrg		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
200382ff0afSmrg		;;
201382ff0afSmrg	esac
202382ff0afSmrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
203382ff0afSmrg	# contains redundant information, the shorter form:
204382ff0afSmrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
205382ff0afSmrg	echo "${machine}-${os}${release}"
206382ff0afSmrg	exit 0 ;;
207382ff0afSmrg    amiga:OpenBSD:*:*)
208382ff0afSmrg	echo m68k-unknown-openbsd${UNAME_RELEASE}
209382ff0afSmrg	exit 0 ;;
210382ff0afSmrg    arc:OpenBSD:*:*)
211382ff0afSmrg	echo mipsel-unknown-openbsd${UNAME_RELEASE}
212382ff0afSmrg	exit 0 ;;
213382ff0afSmrg    hp300:OpenBSD:*:*)
214382ff0afSmrg	echo m68k-unknown-openbsd${UNAME_RELEASE}
215382ff0afSmrg	exit 0 ;;
216382ff0afSmrg    mac68k:OpenBSD:*:*)
217382ff0afSmrg	echo m68k-unknown-openbsd${UNAME_RELEASE}
218382ff0afSmrg	exit 0 ;;
219382ff0afSmrg    macppc:OpenBSD:*:*)
220382ff0afSmrg	echo powerpc-unknown-openbsd${UNAME_RELEASE}
221382ff0afSmrg	exit 0 ;;
222382ff0afSmrg    mvme68k:OpenBSD:*:*)
223382ff0afSmrg	echo m68k-unknown-openbsd${UNAME_RELEASE}
224382ff0afSmrg	exit 0 ;;
225382ff0afSmrg    mvme88k:OpenBSD:*:*)
226382ff0afSmrg	echo m88k-unknown-openbsd${UNAME_RELEASE}
227382ff0afSmrg	exit 0 ;;
228382ff0afSmrg    mvmeppc:OpenBSD:*:*)
229382ff0afSmrg	echo powerpc-unknown-openbsd${UNAME_RELEASE}
230382ff0afSmrg	exit 0 ;;
231382ff0afSmrg    pmax:OpenBSD:*:*)
232382ff0afSmrg	echo mipsel-unknown-openbsd${UNAME_RELEASE}
233382ff0afSmrg	exit 0 ;;
234382ff0afSmrg    sgi:OpenBSD:*:*)
235382ff0afSmrg	echo mipseb-unknown-openbsd${UNAME_RELEASE}
236382ff0afSmrg	exit 0 ;;
237382ff0afSmrg    sun3:OpenBSD:*:*)
238382ff0afSmrg	echo m68k-unknown-openbsd${UNAME_RELEASE}
239382ff0afSmrg	exit 0 ;;
240382ff0afSmrg    wgrisc:OpenBSD:*:*)
241382ff0afSmrg	echo mipsel-unknown-openbsd${UNAME_RELEASE}
242382ff0afSmrg	exit 0 ;;
243382ff0afSmrg    *:OpenBSD:*:*)
244382ff0afSmrg	echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
245382ff0afSmrg	exit 0 ;;
246382ff0afSmrg    alpha:OSF1:*:*)
247382ff0afSmrg	if test $UNAME_RELEASE = "V4.0"; then
248382ff0afSmrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
249382ff0afSmrg	fi
250382ff0afSmrg	# According to Compaq, /usr/sbin/psrinfo has been available on
251382ff0afSmrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
252382ff0afSmrg	# covers most systems running today.  This code pipes the CPU
253382ff0afSmrg	# types through head -n 1, so we only detect the type of CPU 0.
254382ff0afSmrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
255382ff0afSmrg	case "$ALPHA_CPU_TYPE" in
256382ff0afSmrg	    "EV4 (21064)")
257382ff0afSmrg		UNAME_MACHINE="alpha" ;;
258382ff0afSmrg	    "EV4.5 (21064)")
259382ff0afSmrg		UNAME_MACHINE="alpha" ;;
260382ff0afSmrg	    "LCA4 (21066/21068)")
261382ff0afSmrg		UNAME_MACHINE="alpha" ;;
262382ff0afSmrg	    "EV5 (21164)")
263382ff0afSmrg		UNAME_MACHINE="alphaev5" ;;
264382ff0afSmrg	    "EV5.6 (21164A)")
265382ff0afSmrg		UNAME_MACHINE="alphaev56" ;;
266382ff0afSmrg	    "EV5.6 (21164PC)")
267382ff0afSmrg		UNAME_MACHINE="alphapca56" ;;
268382ff0afSmrg	    "EV5.7 (21164PC)")
269382ff0afSmrg		UNAME_MACHINE="alphapca57" ;;
270382ff0afSmrg	    "EV6 (21264)")
271382ff0afSmrg		UNAME_MACHINE="alphaev6" ;;
272382ff0afSmrg	    "EV6.7 (21264A)")
273382ff0afSmrg		UNAME_MACHINE="alphaev67" ;;
274382ff0afSmrg	    "EV6.8CB (21264C)")
275382ff0afSmrg		UNAME_MACHINE="alphaev68" ;;
276382ff0afSmrg	    "EV6.8AL (21264B)")
277382ff0afSmrg		UNAME_MACHINE="alphaev68" ;;
278382ff0afSmrg	    "EV6.8CX (21264D)")
279382ff0afSmrg		UNAME_MACHINE="alphaev68" ;;
280382ff0afSmrg	    "EV6.9A (21264/EV69A)")
281382ff0afSmrg		UNAME_MACHINE="alphaev69" ;;
282382ff0afSmrg	    "EV7 (21364)")
283382ff0afSmrg		UNAME_MACHINE="alphaev7" ;;
284382ff0afSmrg	    "EV7.9 (21364A)")
285382ff0afSmrg		UNAME_MACHINE="alphaev79" ;;
286382ff0afSmrg	esac
287382ff0afSmrg	# A Vn.n version is a released version.
288382ff0afSmrg	# A Tn.n version is a released field test version.
289382ff0afSmrg	# A Xn.n version is an unreleased experimental baselevel.
290382ff0afSmrg	# 1.2 uses "1.2" for uname -r.
291382ff0afSmrg	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
292382ff0afSmrg	exit 0 ;;
293382ff0afSmrg    Alpha*:OpenVMS:*:*)
294382ff0afSmrg	echo alpha-hp-vms
295382ff0afSmrg	exit 0 ;;
296382ff0afSmrg    Alpha\ *:Windows_NT*:*)
297382ff0afSmrg	# How do we know it's Interix rather than the generic POSIX subsystem?
298382ff0afSmrg	# Should we change UNAME_MACHINE based on the output of uname instead
299382ff0afSmrg	# of the specific Alpha model?
300382ff0afSmrg	echo alpha-pc-interix
301382ff0afSmrg	exit 0 ;;
302382ff0afSmrg    21064:Windows_NT:50:3)
303382ff0afSmrg	echo alpha-dec-winnt3.5
304382ff0afSmrg	exit 0 ;;
305382ff0afSmrg    Amiga*:UNIX_System_V:4.0:*)
306382ff0afSmrg	echo m68k-unknown-sysv4
307382ff0afSmrg	exit 0;;
308382ff0afSmrg    *:[Aa]miga[Oo][Ss]:*:*)
309382ff0afSmrg	echo ${UNAME_MACHINE}-unknown-amigaos
310382ff0afSmrg	exit 0 ;;
311382ff0afSmrg    *:[Mm]orph[Oo][Ss]:*:*)
312382ff0afSmrg	echo ${UNAME_MACHINE}-unknown-morphos
313382ff0afSmrg	exit 0 ;;
314382ff0afSmrg    *:OS/390:*:*)
315382ff0afSmrg	echo i370-ibm-openedition
316382ff0afSmrg	exit 0 ;;
317382ff0afSmrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
318382ff0afSmrg	echo arm-acorn-riscix${UNAME_RELEASE}
319382ff0afSmrg	exit 0;;
320382ff0afSmrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
321382ff0afSmrg	echo hppa1.1-hitachi-hiuxmpp
322382ff0afSmrg	exit 0;;
323382ff0afSmrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
324382ff0afSmrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
325382ff0afSmrg	if test "`(/bin/universe) 2>/dev/null`" = att ; then
326382ff0afSmrg		echo pyramid-pyramid-sysv3
327382ff0afSmrg	else
328382ff0afSmrg		echo pyramid-pyramid-bsd
329382ff0afSmrg	fi
330382ff0afSmrg	exit 0 ;;
331382ff0afSmrg    NILE*:*:*:dcosx)
332382ff0afSmrg	echo pyramid-pyramid-svr4
333382ff0afSmrg	exit 0 ;;
334382ff0afSmrg    DRS?6000:unix:4.0:6*)
335382ff0afSmrg	echo sparc-icl-nx6
336382ff0afSmrg	exit 0 ;;
337382ff0afSmrg    DRS?6000:UNIX_SV:4.2*:7*)
338382ff0afSmrg	case `/usr/bin/uname -p` in
339382ff0afSmrg	    sparc) echo sparc-icl-nx7 && exit 0 ;;
340382ff0afSmrg	esac ;;
341382ff0afSmrg    sun4H:SunOS:5.*:*)
342382ff0afSmrg	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
343382ff0afSmrg	exit 0 ;;
344382ff0afSmrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
345382ff0afSmrg	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
346382ff0afSmrg	exit 0 ;;
347382ff0afSmrg    i86pc:SunOS:5.*:*)
348382ff0afSmrg	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
349382ff0afSmrg	exit 0 ;;
350382ff0afSmrg    sun4*:SunOS:6*:*)
351382ff0afSmrg	# According to config.sub, this is the proper way to canonicalize
352382ff0afSmrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
353382ff0afSmrg	# it's likely to be more like Solaris than SunOS4.
354382ff0afSmrg	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
355382ff0afSmrg	exit 0 ;;
356382ff0afSmrg    sun4*:SunOS:*:*)
357382ff0afSmrg	case "`/usr/bin/arch -k`" in
358382ff0afSmrg	    Series*|S4*)
359382ff0afSmrg		UNAME_RELEASE=`uname -v`
360382ff0afSmrg		;;
361382ff0afSmrg	esac
362382ff0afSmrg	# Japanese Language versions have a version number like `4.1.3-JL'.
363382ff0afSmrg	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
364382ff0afSmrg	exit 0 ;;
365382ff0afSmrg    sun3*:SunOS:*:*)
366382ff0afSmrg	echo m68k-sun-sunos${UNAME_RELEASE}
367382ff0afSmrg	exit 0 ;;
368382ff0afSmrg    sun*:*:4.2BSD:*)
369382ff0afSmrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
370382ff0afSmrg	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
371382ff0afSmrg	case "`/bin/arch`" in
372382ff0afSmrg	    sun3)
373382ff0afSmrg		echo m68k-sun-sunos${UNAME_RELEASE}
374382ff0afSmrg		;;
375382ff0afSmrg	    sun4)
376382ff0afSmrg		echo sparc-sun-sunos${UNAME_RELEASE}
377382ff0afSmrg		;;
378382ff0afSmrg	esac
379382ff0afSmrg	exit 0 ;;
380382ff0afSmrg    aushp:SunOS:*:*)
381382ff0afSmrg	echo sparc-auspex-sunos${UNAME_RELEASE}
382382ff0afSmrg	exit 0 ;;
383382ff0afSmrg    # The situation for MiNT is a little confusing.  The machine name
384382ff0afSmrg    # can be virtually everything (everything which is not
385382ff0afSmrg    # "atarist" or "atariste" at least should have a processor
386382ff0afSmrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
387382ff0afSmrg    # to the lowercase version "mint" (or "freemint").  Finally
388382ff0afSmrg    # the system name "TOS" denotes a system which is actually not
389382ff0afSmrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
390382ff0afSmrg    # be no problem.
391382ff0afSmrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
392382ff0afSmrg        echo m68k-atari-mint${UNAME_RELEASE}
393382ff0afSmrg	exit 0 ;;
394382ff0afSmrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
395382ff0afSmrg	echo m68k-atari-mint${UNAME_RELEASE}
396382ff0afSmrg        exit 0 ;;
397382ff0afSmrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
398382ff0afSmrg        echo m68k-atari-mint${UNAME_RELEASE}
399382ff0afSmrg	exit 0 ;;
400382ff0afSmrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
401382ff0afSmrg        echo m68k-milan-mint${UNAME_RELEASE}
402382ff0afSmrg        exit 0 ;;
403382ff0afSmrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
404382ff0afSmrg        echo m68k-hades-mint${UNAME_RELEASE}
405382ff0afSmrg        exit 0 ;;
406382ff0afSmrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
407382ff0afSmrg        echo m68k-unknown-mint${UNAME_RELEASE}
408382ff0afSmrg        exit 0 ;;
409382ff0afSmrg    powerpc:machten:*:*)
410382ff0afSmrg	echo powerpc-apple-machten${UNAME_RELEASE}
411382ff0afSmrg	exit 0 ;;
412382ff0afSmrg    RISC*:Mach:*:*)
413382ff0afSmrg	echo mips-dec-mach_bsd4.3
414382ff0afSmrg	exit 0 ;;
415382ff0afSmrg    RISC*:ULTRIX:*:*)
416382ff0afSmrg	echo mips-dec-ultrix${UNAME_RELEASE}
417382ff0afSmrg	exit 0 ;;
418382ff0afSmrg    VAX*:ULTRIX*:*:*)
419382ff0afSmrg	echo vax-dec-ultrix${UNAME_RELEASE}
420382ff0afSmrg	exit 0 ;;
421382ff0afSmrg    2020:CLIX:*:* | 2430:CLIX:*:*)
422382ff0afSmrg	echo clipper-intergraph-clix${UNAME_RELEASE}
423382ff0afSmrg	exit 0 ;;
424382ff0afSmrg    mips:*:*:UMIPS | mips:*:*:RISCos)
425382ff0afSmrg	eval $set_cc_for_build
426382ff0afSmrg	sed 's/^	//' << EOF >$dummy.c
427382ff0afSmrg#ifdef __cplusplus
428382ff0afSmrg#include <stdio.h>  /* for printf() prototype */
429382ff0afSmrg	int main (int argc, char *argv[]) {
430382ff0afSmrg#else
431382ff0afSmrg	int main (argc, argv) int argc; char *argv[]; {
432382ff0afSmrg#endif
433382ff0afSmrg	#if defined (host_mips) && defined (MIPSEB)
434382ff0afSmrg	#if defined (SYSTYPE_SYSV)
435382ff0afSmrg	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
436382ff0afSmrg	#endif
437382ff0afSmrg	#if defined (SYSTYPE_SVR4)
438382ff0afSmrg	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
439382ff0afSmrg	#endif
440382ff0afSmrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
441382ff0afSmrg	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
442382ff0afSmrg	#endif
443382ff0afSmrg	#endif
444382ff0afSmrg	  exit (-1);
445382ff0afSmrg	}
446382ff0afSmrgEOF
447382ff0afSmrg	$CC_FOR_BUILD -o $dummy $dummy.c \
448382ff0afSmrg	  && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
449382ff0afSmrg	  && exit 0
450382ff0afSmrg	echo mips-mips-riscos${UNAME_RELEASE}
451382ff0afSmrg	exit 0 ;;
452382ff0afSmrg    Motorola:PowerMAX_OS:*:*)
453382ff0afSmrg	echo powerpc-motorola-powermax
454382ff0afSmrg	exit 0 ;;
455382ff0afSmrg    Motorola:*:4.3:PL8-*)
456382ff0afSmrg	echo powerpc-harris-powermax
457382ff0afSmrg	exit 0 ;;
458382ff0afSmrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
459382ff0afSmrg	echo powerpc-harris-powermax
460382ff0afSmrg	exit 0 ;;
461382ff0afSmrg    Night_Hawk:Power_UNIX:*:*)
462382ff0afSmrg	echo powerpc-harris-powerunix
463382ff0afSmrg	exit 0 ;;
464382ff0afSmrg    m88k:CX/UX:7*:*)
465382ff0afSmrg	echo m88k-harris-cxux7
466382ff0afSmrg	exit 0 ;;
467382ff0afSmrg    m88k:*:4*:R4*)
468382ff0afSmrg	echo m88k-motorola-sysv4
469382ff0afSmrg	exit 0 ;;
470382ff0afSmrg    m88k:*:3*:R3*)
471382ff0afSmrg	echo m88k-motorola-sysv3
472382ff0afSmrg	exit 0 ;;
473382ff0afSmrg    AViiON:dgux:*:*)
474382ff0afSmrg        # DG/UX returns AViiON for all architectures
475382ff0afSmrg        UNAME_PROCESSOR=`/usr/bin/uname -p`
476382ff0afSmrg	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
477382ff0afSmrg	then
478382ff0afSmrg	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
479382ff0afSmrg	       [ ${TARGET_BINARY_INTERFACE}x = x ]
480382ff0afSmrg	    then
481382ff0afSmrg		echo m88k-dg-dgux${UNAME_RELEASE}
482382ff0afSmrg	    else
483382ff0afSmrg		echo m88k-dg-dguxbcs${UNAME_RELEASE}
484382ff0afSmrg	    fi
485382ff0afSmrg	else
486382ff0afSmrg	    echo i586-dg-dgux${UNAME_RELEASE}
487382ff0afSmrg	fi
488382ff0afSmrg 	exit 0 ;;
489382ff0afSmrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
490382ff0afSmrg	echo m88k-dolphin-sysv3
491382ff0afSmrg	exit 0 ;;
492382ff0afSmrg    M88*:*:R3*:*)
493382ff0afSmrg	# Delta 88k system running SVR3
494382ff0afSmrg	echo m88k-motorola-sysv3
495382ff0afSmrg	exit 0 ;;
496382ff0afSmrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
497382ff0afSmrg	echo m88k-tektronix-sysv3
498382ff0afSmrg	exit 0 ;;
499382ff0afSmrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
500382ff0afSmrg	echo m68k-tektronix-bsd
501382ff0afSmrg	exit 0 ;;
502382ff0afSmrg    *:IRIX*:*:*)
503382ff0afSmrg	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
504382ff0afSmrg	exit 0 ;;
505382ff0afSmrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
506382ff0afSmrg	echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
507382ff0afSmrg	exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
508382ff0afSmrg    i*86:AIX:*:*)
509382ff0afSmrg	echo i386-ibm-aix
510382ff0afSmrg	exit 0 ;;
511382ff0afSmrg    ia64:AIX:*:*)
512382ff0afSmrg	if [ -x /usr/bin/oslevel ] ; then
513382ff0afSmrg		IBM_REV=`/usr/bin/oslevel`
514382ff0afSmrg	else
515382ff0afSmrg		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
516382ff0afSmrg	fi
517382ff0afSmrg	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
518382ff0afSmrg	exit 0 ;;
519382ff0afSmrg    *:AIX:2:3)
520382ff0afSmrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
521382ff0afSmrg		eval $set_cc_for_build
522382ff0afSmrg		sed 's/^		//' << EOF >$dummy.c
523382ff0afSmrg		#include <sys/systemcfg.h>
524382ff0afSmrg
525382ff0afSmrg		main()
526382ff0afSmrg			{
527382ff0afSmrg			if (!__power_pc())
528382ff0afSmrg				exit(1);
529382ff0afSmrg			puts("powerpc-ibm-aix3.2.5");
530382ff0afSmrg			exit(0);
531382ff0afSmrg			}
532382ff0afSmrgEOF
533382ff0afSmrg		$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
534382ff0afSmrg		echo rs6000-ibm-aix3.2.5
535382ff0afSmrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
536382ff0afSmrg		echo rs6000-ibm-aix3.2.4
537382ff0afSmrg	else
538382ff0afSmrg		echo rs6000-ibm-aix3.2
539382ff0afSmrg	fi
540382ff0afSmrg	exit 0 ;;
541382ff0afSmrg    *:AIX:*:[45])
542382ff0afSmrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
543382ff0afSmrg	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
544382ff0afSmrg		IBM_ARCH=rs6000
545382ff0afSmrg	else
546382ff0afSmrg		IBM_ARCH=powerpc
547382ff0afSmrg	fi
548382ff0afSmrg	if [ -x /usr/bin/oslevel ] ; then
549382ff0afSmrg		IBM_REV=`/usr/bin/oslevel`
550382ff0afSmrg	else
551382ff0afSmrg		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
552382ff0afSmrg	fi
553382ff0afSmrg	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
554382ff0afSmrg	exit 0 ;;
555382ff0afSmrg    *:AIX:*:*)
556382ff0afSmrg	echo rs6000-ibm-aix
557382ff0afSmrg	exit 0 ;;
558382ff0afSmrg    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
559382ff0afSmrg	echo romp-ibm-bsd4.4
560382ff0afSmrg	exit 0 ;;
561382ff0afSmrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
562382ff0afSmrg	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
563382ff0afSmrg	exit 0 ;;                           # report: romp-ibm BSD 4.3
564382ff0afSmrg    *:BOSX:*:*)
565382ff0afSmrg	echo rs6000-bull-bosx
566382ff0afSmrg	exit 0 ;;
567382ff0afSmrg    DPX/2?00:B.O.S.:*:*)
568382ff0afSmrg	echo m68k-bull-sysv3
569382ff0afSmrg	exit 0 ;;
570382ff0afSmrg    9000/[34]??:4.3bsd:1.*:*)
571382ff0afSmrg	echo m68k-hp-bsd
572382ff0afSmrg	exit 0 ;;
573382ff0afSmrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
574382ff0afSmrg	echo m68k-hp-bsd4.4
575382ff0afSmrg	exit 0 ;;
576382ff0afSmrg    9000/[34678]??:HP-UX:*:*)
577382ff0afSmrg	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
578382ff0afSmrg	case "${UNAME_MACHINE}" in
579382ff0afSmrg	    9000/31? )            HP_ARCH=m68000 ;;
580382ff0afSmrg	    9000/[34]?? )         HP_ARCH=m68k ;;
581382ff0afSmrg	    9000/[678][0-9][0-9])
582382ff0afSmrg		if [ -x /usr/bin/getconf ]; then
583382ff0afSmrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
584382ff0afSmrg                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
585382ff0afSmrg                    case "${sc_cpu_version}" in
586382ff0afSmrg                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
587382ff0afSmrg                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
588382ff0afSmrg                      532)                      # CPU_PA_RISC2_0
589382ff0afSmrg                        case "${sc_kernel_bits}" in
590382ff0afSmrg                          32) HP_ARCH="hppa2.0n" ;;
591382ff0afSmrg                          64) HP_ARCH="hppa2.0w" ;;
592382ff0afSmrg			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
593382ff0afSmrg                        esac ;;
594382ff0afSmrg                    esac
595382ff0afSmrg		fi
596382ff0afSmrg		if [ "${HP_ARCH}" = "" ]; then
597382ff0afSmrg		    eval $set_cc_for_build
598382ff0afSmrg		    sed 's/^              //' << EOF >$dummy.c
599382ff0afSmrg
600382ff0afSmrg              #define _HPUX_SOURCE
601382ff0afSmrg              #include <stdlib.h>
602382ff0afSmrg              #include <unistd.h>
603382ff0afSmrg
604382ff0afSmrg              int main ()
605382ff0afSmrg              {
606382ff0afSmrg              #if defined(_SC_KERNEL_BITS)
607382ff0afSmrg                  long bits = sysconf(_SC_KERNEL_BITS);
608382ff0afSmrg              #endif
609382ff0afSmrg                  long cpu  = sysconf (_SC_CPU_VERSION);
610382ff0afSmrg
611382ff0afSmrg                  switch (cpu)
612382ff0afSmrg              	{
613382ff0afSmrg              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
614382ff0afSmrg              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
615382ff0afSmrg              	case CPU_PA_RISC2_0:
616382ff0afSmrg              #if defined(_SC_KERNEL_BITS)
617382ff0afSmrg              	    switch (bits)
618382ff0afSmrg              		{
619382ff0afSmrg              		case 64: puts ("hppa2.0w"); break;
620382ff0afSmrg              		case 32: puts ("hppa2.0n"); break;
621382ff0afSmrg              		default: puts ("hppa2.0"); break;
622382ff0afSmrg              		} break;
623382ff0afSmrg              #else  /* !defined(_SC_KERNEL_BITS) */
624382ff0afSmrg              	    puts ("hppa2.0"); break;
625382ff0afSmrg              #endif
626382ff0afSmrg              	default: puts ("hppa1.0"); break;
627382ff0afSmrg              	}
628382ff0afSmrg                  exit (0);
629382ff0afSmrg              }
630382ff0afSmrgEOF
631382ff0afSmrg		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
632382ff0afSmrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
633382ff0afSmrg		fi ;;
634382ff0afSmrg	esac
635382ff0afSmrg	if [ ${HP_ARCH} = "hppa2.0w" ]
636382ff0afSmrg	then
637382ff0afSmrg	    # avoid double evaluation of $set_cc_for_build
638382ff0afSmrg	    test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
639382ff0afSmrg	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
640382ff0afSmrg	    then
641382ff0afSmrg		HP_ARCH="hppa2.0w"
642382ff0afSmrg	    else
643382ff0afSmrg		HP_ARCH="hppa64"
644382ff0afSmrg	    fi
645382ff0afSmrg	fi
646382ff0afSmrg	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
647382ff0afSmrg	exit 0 ;;
648382ff0afSmrg    ia64:HP-UX:*:*)
649382ff0afSmrg	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
650382ff0afSmrg	echo ia64-hp-hpux${HPUX_REV}
651382ff0afSmrg	exit 0 ;;
652382ff0afSmrg    3050*:HI-UX:*:*)
653382ff0afSmrg	eval $set_cc_for_build
654382ff0afSmrg	sed 's/^	//' << EOF >$dummy.c
655382ff0afSmrg	#include <unistd.h>
656382ff0afSmrg	int
657382ff0afSmrg	main ()
658382ff0afSmrg	{
659382ff0afSmrg	  long cpu = sysconf (_SC_CPU_VERSION);
660382ff0afSmrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
661382ff0afSmrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
662382ff0afSmrg	     results, however.  */
663382ff0afSmrg	  if (CPU_IS_PA_RISC (cpu))
664382ff0afSmrg	    {
665382ff0afSmrg	      switch (cpu)
666382ff0afSmrg		{
667382ff0afSmrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
668382ff0afSmrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
669382ff0afSmrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
670382ff0afSmrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
671382ff0afSmrg		}
672382ff0afSmrg	    }
673382ff0afSmrg	  else if (CPU_IS_HP_MC68K (cpu))
674382ff0afSmrg	    puts ("m68k-hitachi-hiuxwe2");
675382ff0afSmrg	  else puts ("unknown-hitachi-hiuxwe2");
676382ff0afSmrg	  exit (0);
677382ff0afSmrg	}
678382ff0afSmrgEOF
679382ff0afSmrg	$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
680382ff0afSmrg	echo unknown-hitachi-hiuxwe2
681382ff0afSmrg	exit 0 ;;
682382ff0afSmrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
683382ff0afSmrg	echo hppa1.1-hp-bsd
684382ff0afSmrg	exit 0 ;;
685382ff0afSmrg    9000/8??:4.3bsd:*:*)
686382ff0afSmrg	echo hppa1.0-hp-bsd
687382ff0afSmrg	exit 0 ;;
688382ff0afSmrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
689382ff0afSmrg	echo hppa1.0-hp-mpeix
690382ff0afSmrg	exit 0 ;;
691382ff0afSmrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
692382ff0afSmrg	echo hppa1.1-hp-osf
693382ff0afSmrg	exit 0 ;;
694382ff0afSmrg    hp8??:OSF1:*:*)
695382ff0afSmrg	echo hppa1.0-hp-osf
696382ff0afSmrg	exit 0 ;;
697382ff0afSmrg    i*86:OSF1:*:*)
698382ff0afSmrg	if [ -x /usr/sbin/sysversion ] ; then
699382ff0afSmrg	    echo ${UNAME_MACHINE}-unknown-osf1mk
700382ff0afSmrg	else
701382ff0afSmrg	    echo ${UNAME_MACHINE}-unknown-osf1
702382ff0afSmrg	fi
703382ff0afSmrg	exit 0 ;;
704382ff0afSmrg    parisc*:Lites*:*:*)
705382ff0afSmrg	echo hppa1.1-hp-lites
706382ff0afSmrg	exit 0 ;;
707382ff0afSmrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
708382ff0afSmrg	echo c1-convex-bsd
709382ff0afSmrg        exit 0 ;;
710382ff0afSmrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
711382ff0afSmrg	if getsysinfo -f scalar_acc
712382ff0afSmrg	then echo c32-convex-bsd
713382ff0afSmrg	else echo c2-convex-bsd
714382ff0afSmrg	fi
715382ff0afSmrg        exit 0 ;;
716382ff0afSmrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
717382ff0afSmrg	echo c34-convex-bsd
718382ff0afSmrg        exit 0 ;;
719382ff0afSmrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
720382ff0afSmrg	echo c38-convex-bsd
721382ff0afSmrg        exit 0 ;;
722382ff0afSmrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
723382ff0afSmrg	echo c4-convex-bsd
724382ff0afSmrg        exit 0 ;;
725382ff0afSmrg    CRAY*Y-MP:*:*:*)
726382ff0afSmrg	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
727382ff0afSmrg	exit 0 ;;
728382ff0afSmrg    CRAY*[A-Z]90:*:*:*)
729382ff0afSmrg	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
730382ff0afSmrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
731382ff0afSmrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
732382ff0afSmrg	      -e 's/\.[^.]*$/.X/'
733382ff0afSmrg	exit 0 ;;
734382ff0afSmrg    CRAY*TS:*:*:*)
735382ff0afSmrg	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
736382ff0afSmrg	exit 0 ;;
737382ff0afSmrg    CRAY*T3E:*:*:*)
738382ff0afSmrg	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
739382ff0afSmrg	exit 0 ;;
740382ff0afSmrg    CRAY*SV1:*:*:*)
741382ff0afSmrg	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
742382ff0afSmrg	exit 0 ;;
743382ff0afSmrg    *:UNICOS/mp:*:*)
744382ff0afSmrg	echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 
745382ff0afSmrg	exit 0 ;;
746382ff0afSmrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
747382ff0afSmrg	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
748382ff0afSmrg        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
749382ff0afSmrg        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
750382ff0afSmrg        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
751382ff0afSmrg        exit 0 ;;
752382ff0afSmrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
753382ff0afSmrg	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
754382ff0afSmrg	exit 0 ;;
755382ff0afSmrg    sparc*:BSD/OS:*:*)
756382ff0afSmrg	echo sparc-unknown-bsdi${UNAME_RELEASE}
757382ff0afSmrg	exit 0 ;;
758382ff0afSmrg    *:BSD/OS:*:*)
759382ff0afSmrg	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
760382ff0afSmrg	exit 0 ;;
761382ff0afSmrg    *:FreeBSD:*:*|*:GNU/FreeBSD:*:*)
762382ff0afSmrg	# Determine whether the default compiler uses glibc.
763382ff0afSmrg	eval $set_cc_for_build
764382ff0afSmrg	sed 's/^	//' << EOF >$dummy.c
765382ff0afSmrg	#include <features.h>
766382ff0afSmrg	#if __GLIBC__ >= 2
767382ff0afSmrg	LIBC=gnu
768382ff0afSmrg	#else
769382ff0afSmrg	LIBC=
770382ff0afSmrg	#endif
771382ff0afSmrgEOF
772382ff0afSmrg	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
773382ff0afSmrg	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
774382ff0afSmrg	exit 0 ;;
775382ff0afSmrg    i*:CYGWIN*:*)
776382ff0afSmrg	echo ${UNAME_MACHINE}-pc-cygwin
777382ff0afSmrg	exit 0 ;;
778382ff0afSmrg    i*:MINGW*:*)
779382ff0afSmrg	echo ${UNAME_MACHINE}-pc-mingw32
780382ff0afSmrg	exit 0 ;;
781382ff0afSmrg    i*:PW*:*)
782382ff0afSmrg	echo ${UNAME_MACHINE}-pc-pw32
783382ff0afSmrg	exit 0 ;;
784382ff0afSmrg    x86:Interix*:[34]*)
785382ff0afSmrg	echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
786382ff0afSmrg	exit 0 ;;
787382ff0afSmrg    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
788382ff0afSmrg	echo i${UNAME_MACHINE}-pc-mks
789382ff0afSmrg	exit 0 ;;
790382ff0afSmrg    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
791382ff0afSmrg	# How do we know it's Interix rather than the generic POSIX subsystem?
792382ff0afSmrg	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
793382ff0afSmrg	# UNAME_MACHINE based on the output of uname instead of i386?
794382ff0afSmrg	echo i586-pc-interix
795382ff0afSmrg	exit 0 ;;
796382ff0afSmrg    i*:UWIN*:*)
797382ff0afSmrg	echo ${UNAME_MACHINE}-pc-uwin
798382ff0afSmrg	exit 0 ;;
799382ff0afSmrg    p*:CYGWIN*:*)
800382ff0afSmrg	echo powerpcle-unknown-cygwin
801382ff0afSmrg	exit 0 ;;
802382ff0afSmrg    prep*:SunOS:5.*:*)
803382ff0afSmrg	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
804382ff0afSmrg	exit 0 ;;
805382ff0afSmrg    *:GNU:*:*)
806382ff0afSmrg	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
807382ff0afSmrg	exit 0 ;;
808382ff0afSmrg    i*86:Minix:*:*)
809382ff0afSmrg	echo ${UNAME_MACHINE}-pc-minix
810382ff0afSmrg	exit 0 ;;
811382ff0afSmrg    arm*:Linux:*:*)
812382ff0afSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
813382ff0afSmrg	exit 0 ;;
814382ff0afSmrg    cris:Linux:*:*)
815382ff0afSmrg	echo cris-axis-linux-gnu
816382ff0afSmrg	exit 0 ;;
817382ff0afSmrg    ia64:Linux:*:*)
818382ff0afSmrg	echo ${UNAME_MACHINE}-${VENDOR:-unknown}-linux-gnu
819382ff0afSmrg	exit 0 ;;
820382ff0afSmrg    m68*:Linux:*:*)
821382ff0afSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
822382ff0afSmrg	exit 0 ;;
823382ff0afSmrg    mips:Linux:*:*)
824382ff0afSmrg	eval $set_cc_for_build
825382ff0afSmrg	sed 's/^	//' << EOF >$dummy.c
826382ff0afSmrg	#undef CPU
827382ff0afSmrg	#undef mips
828382ff0afSmrg	#undef mipsel
829382ff0afSmrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
830382ff0afSmrg	CPU=mipsel
831382ff0afSmrg	#else
832382ff0afSmrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
833382ff0afSmrg	CPU=mips
834382ff0afSmrg	#else
835382ff0afSmrg	CPU=
836382ff0afSmrg	#endif
837382ff0afSmrg	#endif
838382ff0afSmrgEOF
839382ff0afSmrg	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
840382ff0afSmrg	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
841382ff0afSmrg	;;
842382ff0afSmrg    mips64:Linux:*:*)
843382ff0afSmrg	eval $set_cc_for_build
844382ff0afSmrg	sed 's/^	//' << EOF >$dummy.c
845382ff0afSmrg	#undef CPU
846382ff0afSmrg	#undef mips64
847382ff0afSmrg	#undef mips64el
848382ff0afSmrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
849382ff0afSmrg	CPU=mips64el
850382ff0afSmrg	#else
851382ff0afSmrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
852382ff0afSmrg	CPU=mips64
853382ff0afSmrg	#else
854382ff0afSmrg	CPU=
855382ff0afSmrg	#endif
856382ff0afSmrg	#endif
857382ff0afSmrgEOF
858382ff0afSmrg	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
859382ff0afSmrg	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
860382ff0afSmrg	;;
861382ff0afSmrg    ppc:Linux:*:*)
862382ff0afSmrg	echo powerpc-${VENDOR:-unknown}-linux-gnu
863382ff0afSmrg	exit 0 ;;
864382ff0afSmrg    ppc64:Linux:*:*)
865382ff0afSmrg	echo powerpc64-${VENDOR:-unknown}-linux-gnu
866382ff0afSmrg	exit 0 ;;
867382ff0afSmrg    alpha:Linux:*:*)
868382ff0afSmrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
869382ff0afSmrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
870382ff0afSmrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
871382ff0afSmrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
872382ff0afSmrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
873382ff0afSmrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
874382ff0afSmrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
875382ff0afSmrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
876382ff0afSmrg        esac
877382ff0afSmrg	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
878382ff0afSmrg	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
879382ff0afSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
880382ff0afSmrg	exit 0 ;;
881382ff0afSmrg    parisc:Linux:*:* | hppa:Linux:*:*)
882382ff0afSmrg	# Look for CPU level
883382ff0afSmrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
884382ff0afSmrg	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
885382ff0afSmrg	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
886382ff0afSmrg	  *)    echo hppa-unknown-linux-gnu ;;
887382ff0afSmrg	esac
888382ff0afSmrg	exit 0 ;;
889382ff0afSmrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
890382ff0afSmrg	echo hppa64-unknown-linux-gnu
891382ff0afSmrg	exit 0 ;;
892382ff0afSmrg    s390:Linux:*:* | s390x:Linux:*:*)
893382ff0afSmrg	echo ${UNAME_MACHINE}-${VENDOR:-ibm}-linux-gnu
894382ff0afSmrg	exit 0 ;;
895382ff0afSmrg    sh64*:Linux:*:*)
896382ff0afSmrg    	echo ${UNAME_MACHINE}-unknown-linux-gnu
897382ff0afSmrg	exit 0 ;;
898382ff0afSmrg    sh*:Linux:*:*)
899382ff0afSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
900382ff0afSmrg	exit 0 ;;
901382ff0afSmrg    sparc:Linux:*:* | sparc64:Linux:*:*)
902382ff0afSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
903382ff0afSmrg	exit 0 ;;
904382ff0afSmrg    x86_64:Linux:*:*)
905382ff0afSmrg	echo x86_64-${VENDOR:-unknown}-linux-gnu
906382ff0afSmrg	exit 0 ;;
907382ff0afSmrg    i*86:Linux:*:*)
908382ff0afSmrg	# The BFD linker knows what the default object file format is, so
909382ff0afSmrg	# first see if it will tell us. cd to the root directory to prevent
910382ff0afSmrg	# problems with other programs or directories called `ld' in the path.
911382ff0afSmrg	# Set LC_ALL=C to ensure ld outputs messages in English.
912382ff0afSmrg	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
913382ff0afSmrg			 | sed -ne '/supported targets:/!d
914382ff0afSmrg				    s/[ 	][ 	]*/ /g
915382ff0afSmrg				    s/.*supported targets: *//
916382ff0afSmrg				    s/ .*//
917382ff0afSmrg				    p'`
918382ff0afSmrg        case "$ld_supported_targets" in
919382ff0afSmrg	  elf32-i386)
920382ff0afSmrg		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
921382ff0afSmrg		;;
922382ff0afSmrg	  a.out-i386-linux)
923382ff0afSmrg		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
924382ff0afSmrg		exit 0 ;;
925382ff0afSmrg	  coff-i386)
926382ff0afSmrg		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
927382ff0afSmrg		exit 0 ;;
928382ff0afSmrg	  "")
929382ff0afSmrg		# Either a pre-BFD a.out linker (linux-gnuoldld) or
930382ff0afSmrg		# one that does not give us useful --help.
931382ff0afSmrg		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
932382ff0afSmrg		exit 0 ;;
933382ff0afSmrg	esac
934382ff0afSmrg	# Determine whether the default compiler is a.out or elf
935382ff0afSmrg	eval $set_cc_for_build
936382ff0afSmrg	sed 's/^	//' << EOF >$dummy.c
937382ff0afSmrg	#include <features.h>
938382ff0afSmrg	#ifdef __ELF__
939382ff0afSmrg	# ifdef __GLIBC__
940382ff0afSmrg	#  if __GLIBC__ >= 2
941382ff0afSmrg	LIBC=gnu
942382ff0afSmrg	#  else
943382ff0afSmrg	LIBC=gnulibc1
944382ff0afSmrg	#  endif
945382ff0afSmrg	# else
946382ff0afSmrg	LIBC=gnulibc1
947382ff0afSmrg	# endif
948382ff0afSmrg	#else
949382ff0afSmrg	#ifdef __INTEL_COMPILER
950382ff0afSmrg	LIBC=gnu
951382ff0afSmrg	#else
952382ff0afSmrg	LIBC=gnuaout
953382ff0afSmrg	#endif
954382ff0afSmrg	#endif
955382ff0afSmrgEOF
956382ff0afSmrg	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
957382ff0afSmrg	test x"${LIBC}" != x && echo "${UNAME_MACHINE}-${VENDOR:-pc}-linux-${LIBC}" && exit 0
958382ff0afSmrg	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
959382ff0afSmrg	;;
960382ff0afSmrg    i*86:DYNIX/ptx:4*:*)
961382ff0afSmrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
962382ff0afSmrg	# earlier versions are messed up and put the nodename in both
963382ff0afSmrg	# sysname and nodename.
964382ff0afSmrg	echo i386-sequent-sysv4
965382ff0afSmrg	exit 0 ;;
966382ff0afSmrg    i*86:UNIX_SV:4.2MP:2.*)
967382ff0afSmrg        # Unixware is an offshoot of SVR4, but it has its own version
968382ff0afSmrg        # number series starting with 2...
969382ff0afSmrg        # I am not positive that other SVR4 systems won't match this,
970382ff0afSmrg	# I just have to hope.  -- rms.
971382ff0afSmrg        # Use sysv4.2uw... so that sysv4* matches it.
972382ff0afSmrg	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
973382ff0afSmrg	exit 0 ;;
974382ff0afSmrg    i*86:OS/2:*:*)
975382ff0afSmrg	# If we were able to find `uname', then EMX Unix compatibility
976382ff0afSmrg	# is probably installed.
977382ff0afSmrg	echo ${UNAME_MACHINE}-pc-os2-emx
978382ff0afSmrg	exit 0 ;;
979382ff0afSmrg    i*86:XTS-300:*:STOP)
980382ff0afSmrg	echo ${UNAME_MACHINE}-unknown-stop
981382ff0afSmrg	exit 0 ;;
982382ff0afSmrg    i*86:atheos:*:*)
983382ff0afSmrg	echo ${UNAME_MACHINE}-unknown-atheos
984382ff0afSmrg	exit 0 ;;
985382ff0afSmrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
986382ff0afSmrg	echo i386-unknown-lynxos${UNAME_RELEASE}
987382ff0afSmrg	exit 0 ;;
988382ff0afSmrg    i*86:*DOS:*:*)
989382ff0afSmrg	echo ${UNAME_MACHINE}-pc-msdosdjgpp
990382ff0afSmrg	exit 0 ;;
991382ff0afSmrg    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
992382ff0afSmrg	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
993382ff0afSmrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
994382ff0afSmrg		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
995382ff0afSmrg	else
996382ff0afSmrg		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
997382ff0afSmrg	fi
998382ff0afSmrg	exit 0 ;;
999382ff0afSmrg    i*86:*:5:[78]*)
1000382ff0afSmrg	case `/bin/uname -X | grep "^Machine"` in
1001382ff0afSmrg	    *486*)	     UNAME_MACHINE=i486 ;;
1002382ff0afSmrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
1003382ff0afSmrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1004382ff0afSmrg	esac
1005382ff0afSmrg	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1006382ff0afSmrg	exit 0 ;;
1007382ff0afSmrg    i*86:*:3.2:*)
1008382ff0afSmrg	if test -f /usr/options/cb.name; then
1009382ff0afSmrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1010382ff0afSmrg		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
1011382ff0afSmrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
1012382ff0afSmrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1013382ff0afSmrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1014382ff0afSmrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1015382ff0afSmrg			&& UNAME_MACHINE=i586
1016382ff0afSmrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1017382ff0afSmrg			&& UNAME_MACHINE=i686
1018382ff0afSmrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1019382ff0afSmrg			&& UNAME_MACHINE=i686
1020382ff0afSmrg		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
1021382ff0afSmrg	else
1022382ff0afSmrg		echo ${UNAME_MACHINE}-pc-sysv32
1023382ff0afSmrg	fi
1024382ff0afSmrg	exit 0 ;;
1025382ff0afSmrg    pc:*:*:*)
1026382ff0afSmrg	# Left here for compatibility:
1027382ff0afSmrg        # uname -m prints for DJGPP always 'pc', but it prints nothing about
1028382ff0afSmrg        # the processor, so we play safe by assuming i386.
1029382ff0afSmrg	echo i386-pc-msdosdjgpp
1030382ff0afSmrg        exit 0 ;;
1031382ff0afSmrg    Intel:Mach:3*:*)
1032382ff0afSmrg	echo i386-pc-mach3
1033382ff0afSmrg	exit 0 ;;
1034382ff0afSmrg    paragon:*:*:*)
1035382ff0afSmrg	echo i860-intel-osf1
1036382ff0afSmrg	exit 0 ;;
1037382ff0afSmrg    i860:*:4.*:*) # i860-SVR4
1038382ff0afSmrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1039382ff0afSmrg	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
1040382ff0afSmrg	else # Add other i860-SVR4 vendors below as they are discovered.
1041382ff0afSmrg	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
1042382ff0afSmrg	fi
1043382ff0afSmrg	exit 0 ;;
1044382ff0afSmrg    mini*:CTIX:SYS*5:*)
1045382ff0afSmrg	# "miniframe"
1046382ff0afSmrg	echo m68010-convergent-sysv
1047382ff0afSmrg	exit 0 ;;
1048382ff0afSmrg    mc68k:UNIX:SYSTEM5:3.51m)
1049382ff0afSmrg	echo m68k-convergent-sysv
1050382ff0afSmrg	exit 0 ;;
1051382ff0afSmrg    M680?0:D-NIX:5.3:*)
1052382ff0afSmrg	echo m68k-diab-dnix
1053382ff0afSmrg	exit 0 ;;
1054382ff0afSmrg    M68*:*:R3V[567]*:*)
1055382ff0afSmrg	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
1056382ff0afSmrg    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)
1057382ff0afSmrg	OS_REL=''
1058382ff0afSmrg	test -r /etc/.relid \
1059382ff0afSmrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1060382ff0afSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1061382ff0afSmrg	  && echo i486-ncr-sysv4.3${OS_REL} && exit 0
1062382ff0afSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1063382ff0afSmrg	  && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
1064382ff0afSmrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1065382ff0afSmrg        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1066382ff0afSmrg          && echo i486-ncr-sysv4 && exit 0 ;;
1067382ff0afSmrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1068382ff0afSmrg	echo m68k-unknown-lynxos${UNAME_RELEASE}
1069382ff0afSmrg	exit 0 ;;
1070382ff0afSmrg    mc68030:UNIX_System_V:4.*:*)
1071382ff0afSmrg	echo m68k-atari-sysv4
1072382ff0afSmrg	exit 0 ;;
1073382ff0afSmrg    TSUNAMI:LynxOS:2.*:*)
1074382ff0afSmrg	echo sparc-unknown-lynxos${UNAME_RELEASE}
1075382ff0afSmrg	exit 0 ;;
1076382ff0afSmrg    rs6000:LynxOS:2.*:*)
1077382ff0afSmrg	echo rs6000-unknown-lynxos${UNAME_RELEASE}
1078382ff0afSmrg	exit 0 ;;
1079382ff0afSmrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
1080382ff0afSmrg	echo powerpc-unknown-lynxos${UNAME_RELEASE}
1081382ff0afSmrg	exit 0 ;;
1082382ff0afSmrg    SM[BE]S:UNIX_SV:*:*)
1083382ff0afSmrg	echo mips-dde-sysv${UNAME_RELEASE}
1084382ff0afSmrg	exit 0 ;;
1085382ff0afSmrg    RM*:ReliantUNIX-*:*:*)
1086382ff0afSmrg	echo mips-sni-sysv4
1087382ff0afSmrg	exit 0 ;;
1088382ff0afSmrg    RM*:SINIX-*:*:*)
1089382ff0afSmrg	echo mips-sni-sysv4
1090382ff0afSmrg	exit 0 ;;
1091382ff0afSmrg    *:SINIX-*:*:*)
1092382ff0afSmrg	if uname -p 2>/dev/null >/dev/null ; then
1093382ff0afSmrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1094382ff0afSmrg		echo ${UNAME_MACHINE}-sni-sysv4
1095382ff0afSmrg	else
1096382ff0afSmrg		echo ns32k-sni-sysv
1097382ff0afSmrg	fi
1098382ff0afSmrg	exit 0 ;;
1099382ff0afSmrg    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1100382ff0afSmrg                      # says <Richard.M.Bartel@ccMail.Census.GOV>
1101382ff0afSmrg        echo i586-unisys-sysv4
1102382ff0afSmrg        exit 0 ;;
1103382ff0afSmrg    *:UNIX_System_V:4*:FTX*)
1104382ff0afSmrg	# From Gerald Hewes <hewes@openmarket.com>.
1105382ff0afSmrg	# How about differentiating between stratus architectures? -djm
1106382ff0afSmrg	echo hppa1.1-stratus-sysv4
1107382ff0afSmrg	exit 0 ;;
1108382ff0afSmrg    *:*:*:FTX*)
1109382ff0afSmrg	# From seanf@swdc.stratus.com.
1110382ff0afSmrg	echo i860-stratus-sysv4
1111382ff0afSmrg	exit 0 ;;
1112382ff0afSmrg    *:VOS:*:*)
1113382ff0afSmrg	# From Paul.Green@stratus.com.
1114382ff0afSmrg	echo hppa1.1-stratus-vos
1115382ff0afSmrg	exit 0 ;;
1116382ff0afSmrg    mc68*:A/UX:*:*)
1117382ff0afSmrg	echo m68k-apple-aux${UNAME_RELEASE}
1118382ff0afSmrg	exit 0 ;;
1119382ff0afSmrg    news*:NEWS-OS:6*:*)
1120382ff0afSmrg	echo mips-sony-newsos6
1121382ff0afSmrg	exit 0 ;;
1122382ff0afSmrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1123382ff0afSmrg	if [ -d /usr/nec ]; then
1124382ff0afSmrg	        echo mips-nec-sysv${UNAME_RELEASE}
1125382ff0afSmrg	else
1126382ff0afSmrg	        echo mips-unknown-sysv${UNAME_RELEASE}
1127382ff0afSmrg	fi
1128382ff0afSmrg        exit 0 ;;
1129382ff0afSmrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1130382ff0afSmrg	echo powerpc-be-beos
1131382ff0afSmrg	exit 0 ;;
1132382ff0afSmrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1133382ff0afSmrg	echo powerpc-apple-beos
1134382ff0afSmrg	exit 0 ;;
1135382ff0afSmrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1136382ff0afSmrg	echo i586-pc-beos
1137382ff0afSmrg	exit 0 ;;
1138382ff0afSmrg    SX-4:SUPER-UX:*:*)
1139382ff0afSmrg	echo sx4-nec-superux${UNAME_RELEASE}
1140382ff0afSmrg	exit 0 ;;
1141382ff0afSmrg    SX-5:SUPER-UX:*:*)
1142382ff0afSmrg	echo sx5-nec-superux${UNAME_RELEASE}
1143382ff0afSmrg	exit 0 ;;
1144382ff0afSmrg    SX-6:SUPER-UX:*:*)
1145382ff0afSmrg	echo sx6-nec-superux${UNAME_RELEASE}
1146382ff0afSmrg	exit 0 ;;
1147382ff0afSmrg    Power*:Rhapsody:*:*)
1148382ff0afSmrg	echo powerpc-apple-rhapsody${UNAME_RELEASE}
1149382ff0afSmrg	exit 0 ;;
1150382ff0afSmrg    *:Rhapsody:*:*)
1151382ff0afSmrg	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
1152382ff0afSmrg	exit 0 ;;
1153382ff0afSmrg    *:Darwin:*:*)
1154382ff0afSmrg	case `uname -p` in
1155382ff0afSmrg	    *86) UNAME_PROCESSOR=i686 ;;
1156382ff0afSmrg	    powerpc) UNAME_PROCESSOR=powerpc ;;
1157382ff0afSmrg	esac
1158382ff0afSmrg	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
1159382ff0afSmrg	exit 0 ;;
1160382ff0afSmrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1161382ff0afSmrg	UNAME_PROCESSOR=`uname -p`
1162382ff0afSmrg	if test "$UNAME_PROCESSOR" = "x86"; then
1163382ff0afSmrg		UNAME_PROCESSOR=i386
1164382ff0afSmrg		UNAME_MACHINE=pc
1165382ff0afSmrg	fi
1166382ff0afSmrg	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
1167382ff0afSmrg	exit 0 ;;
1168382ff0afSmrg    *:QNX:*:4*)
1169382ff0afSmrg	echo i386-pc-qnx
1170382ff0afSmrg	exit 0 ;;
1171382ff0afSmrg    NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
1172382ff0afSmrg	echo nsr-tandem-nsk${UNAME_RELEASE}
1173382ff0afSmrg	exit 0 ;;
1174382ff0afSmrg    *:NonStop-UX:*:*)
1175382ff0afSmrg	echo mips-compaq-nonstopux
1176382ff0afSmrg	exit 0 ;;
1177382ff0afSmrg    BS2000:POSIX*:*:*)
1178382ff0afSmrg	echo bs2000-siemens-sysv
1179382ff0afSmrg	exit 0 ;;
1180382ff0afSmrg    DS/*:UNIX_System_V:*:*)
1181382ff0afSmrg	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
1182382ff0afSmrg	exit 0 ;;
1183382ff0afSmrg    *:Plan9:*:*)
1184382ff0afSmrg	# "uname -m" is not consistent, so use $cputype instead. 386
1185382ff0afSmrg	# is converted to i386 for consistency with other x86
1186382ff0afSmrg	# operating systems.
1187382ff0afSmrg	if test "$cputype" = "386"; then
1188382ff0afSmrg	    UNAME_MACHINE=i386
1189382ff0afSmrg	else
1190382ff0afSmrg	    UNAME_MACHINE="$cputype"
1191382ff0afSmrg	fi
1192382ff0afSmrg	echo ${UNAME_MACHINE}-unknown-plan9
1193382ff0afSmrg	exit 0 ;;
1194382ff0afSmrg    *:TOPS-10:*:*)
1195382ff0afSmrg	echo pdp10-unknown-tops10
1196382ff0afSmrg	exit 0 ;;
1197382ff0afSmrg    *:TENEX:*:*)
1198382ff0afSmrg	echo pdp10-unknown-tenex
1199382ff0afSmrg	exit 0 ;;
1200382ff0afSmrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1201382ff0afSmrg	echo pdp10-dec-tops20
1202382ff0afSmrg	exit 0 ;;
1203382ff0afSmrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1204382ff0afSmrg	echo pdp10-xkl-tops20
1205382ff0afSmrg	exit 0 ;;
1206382ff0afSmrg    *:TOPS-20:*:*)
1207382ff0afSmrg	echo pdp10-unknown-tops20
1208382ff0afSmrg	exit 0 ;;
1209382ff0afSmrg    *:ITS:*:*)
1210382ff0afSmrg	echo pdp10-unknown-its
1211382ff0afSmrg	exit 0 ;;
1212382ff0afSmrg    SEI:*:*:SEIUX)
1213382ff0afSmrg        echo mips-sei-seiux${UNAME_RELEASE}
1214382ff0afSmrg	exit 0 ;;
1215382ff0afSmrgesac
1216382ff0afSmrg
1217382ff0afSmrg#echo '(No uname command or uname output not recognized.)' 1>&2
1218382ff0afSmrg#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
1219382ff0afSmrg
1220382ff0afSmrgeval $set_cc_for_build
1221382ff0afSmrgcat >$dummy.c <<EOF
1222382ff0afSmrg#ifdef _SEQUENT_
1223382ff0afSmrg# include <sys/types.h>
1224382ff0afSmrg# include <sys/utsname.h>
1225382ff0afSmrg#endif
1226382ff0afSmrgmain ()
1227382ff0afSmrg{
1228382ff0afSmrg#if defined (sony)
1229382ff0afSmrg#if defined (MIPSEB)
1230382ff0afSmrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1231382ff0afSmrg     I don't know....  */
1232382ff0afSmrg  printf ("mips-sony-bsd\n"); exit (0);
1233382ff0afSmrg#else
1234382ff0afSmrg#include <sys/param.h>
1235382ff0afSmrg  printf ("m68k-sony-newsos%s\n",
1236382ff0afSmrg#ifdef NEWSOS4
1237382ff0afSmrg          "4"
1238382ff0afSmrg#else
1239382ff0afSmrg	  ""
1240382ff0afSmrg#endif
1241382ff0afSmrg         ); exit (0);
1242382ff0afSmrg#endif
1243382ff0afSmrg#endif
1244382ff0afSmrg
1245382ff0afSmrg#if defined (__arm) && defined (__acorn) && defined (__unix)
1246382ff0afSmrg  printf ("arm-acorn-riscix"); exit (0);
1247382ff0afSmrg#endif
1248382ff0afSmrg
1249382ff0afSmrg#if defined (hp300) && !defined (hpux)
1250382ff0afSmrg  printf ("m68k-hp-bsd\n"); exit (0);
1251382ff0afSmrg#endif
1252382ff0afSmrg
1253382ff0afSmrg#if defined (NeXT)
1254382ff0afSmrg#if !defined (__ARCHITECTURE__)
1255382ff0afSmrg#define __ARCHITECTURE__ "m68k"
1256382ff0afSmrg#endif
1257382ff0afSmrg  int version;
1258382ff0afSmrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1259382ff0afSmrg  if (version < 4)
1260382ff0afSmrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1261382ff0afSmrg  else
1262382ff0afSmrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1263382ff0afSmrg  exit (0);
1264382ff0afSmrg#endif
1265382ff0afSmrg
1266382ff0afSmrg#if defined (MULTIMAX) || defined (n16)
1267382ff0afSmrg#if defined (UMAXV)
1268382ff0afSmrg  printf ("ns32k-encore-sysv\n"); exit (0);
1269382ff0afSmrg#else
1270382ff0afSmrg#if defined (CMU)
1271382ff0afSmrg  printf ("ns32k-encore-mach\n"); exit (0);
1272382ff0afSmrg#else
1273382ff0afSmrg  printf ("ns32k-encore-bsd\n"); exit (0);
1274382ff0afSmrg#endif
1275382ff0afSmrg#endif
1276382ff0afSmrg#endif
1277382ff0afSmrg
1278382ff0afSmrg#if defined (__386BSD__)
1279382ff0afSmrg  printf ("i386-pc-bsd\n"); exit (0);
1280382ff0afSmrg#endif
1281382ff0afSmrg
1282382ff0afSmrg#if defined (sequent)
1283382ff0afSmrg#if defined (i386)
1284382ff0afSmrg  printf ("i386-sequent-dynix\n"); exit (0);
1285382ff0afSmrg#endif
1286382ff0afSmrg#if defined (ns32000)
1287382ff0afSmrg  printf ("ns32k-sequent-dynix\n"); exit (0);
1288382ff0afSmrg#endif
1289382ff0afSmrg#endif
1290382ff0afSmrg
1291382ff0afSmrg#if defined (_SEQUENT_)
1292382ff0afSmrg    struct utsname un;
1293382ff0afSmrg
1294382ff0afSmrg    uname(&un);
1295382ff0afSmrg
1296382ff0afSmrg    if (strncmp(un.version, "V2", 2) == 0) {
1297382ff0afSmrg	printf ("i386-sequent-ptx2\n"); exit (0);
1298382ff0afSmrg    }
1299382ff0afSmrg    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1300382ff0afSmrg	printf ("i386-sequent-ptx1\n"); exit (0);
1301382ff0afSmrg    }
1302382ff0afSmrg    printf ("i386-sequent-ptx\n"); exit (0);
1303382ff0afSmrg
1304382ff0afSmrg#endif
1305382ff0afSmrg
1306382ff0afSmrg#if defined (vax)
1307382ff0afSmrg# if !defined (ultrix)
1308382ff0afSmrg#  include <sys/param.h>
1309382ff0afSmrg#  if defined (BSD)
1310382ff0afSmrg#   if BSD == 43
1311382ff0afSmrg      printf ("vax-dec-bsd4.3\n"); exit (0);
1312382ff0afSmrg#   else
1313382ff0afSmrg#    if BSD == 199006
1314382ff0afSmrg      printf ("vax-dec-bsd4.3reno\n"); exit (0);
1315382ff0afSmrg#    else
1316382ff0afSmrg      printf ("vax-dec-bsd\n"); exit (0);
1317382ff0afSmrg#    endif
1318382ff0afSmrg#   endif
1319382ff0afSmrg#  else
1320382ff0afSmrg    printf ("vax-dec-bsd\n"); exit (0);
1321382ff0afSmrg#  endif
1322382ff0afSmrg# else
1323382ff0afSmrg    printf ("vax-dec-ultrix\n"); exit (0);
1324382ff0afSmrg# endif
1325382ff0afSmrg#endif
1326382ff0afSmrg
1327382ff0afSmrg#if defined (alliant) && defined (i860)
1328382ff0afSmrg  printf ("i860-alliant-bsd\n"); exit (0);
1329382ff0afSmrg#endif
1330382ff0afSmrg
1331382ff0afSmrg  exit (1);
1332382ff0afSmrg}
1333382ff0afSmrgEOF
1334382ff0afSmrg
1335382ff0afSmrg$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
1336382ff0afSmrg
1337382ff0afSmrg# Apollos put the system type in the environment.
1338382ff0afSmrg
1339382ff0afSmrgtest -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
1340382ff0afSmrg
1341382ff0afSmrg# Convex versions that predate uname can use getsysinfo(1)
1342382ff0afSmrg
1343382ff0afSmrgif [ -x /usr/convex/getsysinfo ]
1344382ff0afSmrgthen
1345382ff0afSmrg    case `getsysinfo -f cpu_type` in
1346382ff0afSmrg    c1*)
1347382ff0afSmrg	echo c1-convex-bsd
1348382ff0afSmrg	exit 0 ;;
1349382ff0afSmrg    c2*)
1350382ff0afSmrg	if getsysinfo -f scalar_acc
1351382ff0afSmrg	then echo c32-convex-bsd
1352382ff0afSmrg	else echo c2-convex-bsd
1353382ff0afSmrg	fi
1354382ff0afSmrg	exit 0 ;;
1355382ff0afSmrg    c34*)
1356382ff0afSmrg	echo c34-convex-bsd
1357382ff0afSmrg	exit 0 ;;
1358382ff0afSmrg    c38*)
1359382ff0afSmrg	echo c38-convex-bsd
1360382ff0afSmrg	exit 0 ;;
1361382ff0afSmrg    c4*)
1362382ff0afSmrg	echo c4-convex-bsd
1363382ff0afSmrg	exit 0 ;;
1364382ff0afSmrg    esac
1365382ff0afSmrgfi
1366382ff0afSmrg
1367382ff0afSmrgcat >&2 <<EOF
1368382ff0afSmrg$0: unable to guess system type
1369382ff0afSmrg
1370382ff0afSmrgThis script, last modified $timestamp, has failed to recognize
1371382ff0afSmrgthe operating system you are using. It is advised that you
1372382ff0afSmrgdownload the most up to date version of the config scripts from
1373382ff0afSmrg
1374382ff0afSmrg    ftp://ftp.gnu.org/pub/gnu/config/
1375382ff0afSmrg
1376382ff0afSmrgIf the version you run ($0) is already up to date, please
1377382ff0afSmrgsend the following data and any information you think might be
1378382ff0afSmrgpertinent to <config-patches@gnu.org> in order to provide the needed
1379382ff0afSmrginformation to handle your system.
1380382ff0afSmrg
1381382ff0afSmrgconfig.guess timestamp = $timestamp
1382382ff0afSmrg
1383382ff0afSmrguname -m = `(uname -m) 2>/dev/null || echo unknown`
1384382ff0afSmrguname -r = `(uname -r) 2>/dev/null || echo unknown`
1385382ff0afSmrguname -s = `(uname -s) 2>/dev/null || echo unknown`
1386382ff0afSmrguname -v = `(uname -v) 2>/dev/null || echo unknown`
1387382ff0afSmrg
1388382ff0afSmrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1389382ff0afSmrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1390382ff0afSmrg
1391382ff0afSmrghostinfo               = `(hostinfo) 2>/dev/null`
1392382ff0afSmrg/bin/universe          = `(/bin/universe) 2>/dev/null`
1393382ff0afSmrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1394382ff0afSmrg/bin/arch              = `(/bin/arch) 2>/dev/null`
1395382ff0afSmrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1396382ff0afSmrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1397382ff0afSmrg
1398382ff0afSmrgUNAME_MACHINE = ${UNAME_MACHINE}
1399382ff0afSmrgUNAME_RELEASE = ${UNAME_RELEASE}
1400382ff0afSmrgUNAME_SYSTEM  = ${UNAME_SYSTEM}
1401382ff0afSmrgUNAME_VERSION = ${UNAME_VERSION}
1402382ff0afSmrgEOF
1403382ff0afSmrg
1404382ff0afSmrgexit 1
1405382ff0afSmrg
1406382ff0afSmrg# Local variables:
1407382ff0afSmrg# eval: (add-hook 'write-file-hooks 'time-stamp)
1408382ff0afSmrg# time-stamp-start: "timestamp='"
1409382ff0afSmrg# time-stamp-format: "%:y-%02m-%02d"
1410382ff0afSmrg# time-stamp-end: "'"
1411382ff0afSmrg# End:
1412