1290001Sglebius#! /bin/sh
2290001Sglebius# Attempt to guess a canonical system name.
3290001Sglebius#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4290001Sglebius#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
5290001Sglebius#   2011 Free Software Foundation, Inc.
6290001Sglebius
7290001Sglebiustimestamp='2011-06-03'
8290001Sglebius
9290001Sglebius# This file is free software; you can redistribute it and/or modify it
10290001Sglebius# under the terms of the GNU General Public License as published by
11290001Sglebius# the Free Software Foundation; either version 2 of the License, or
12290001Sglebius# (at your option) any later version.
13290001Sglebius#
14290001Sglebius# This program is distributed in the hope that it will be useful, but
15290001Sglebius# WITHOUT ANY WARRANTY; without even the implied warranty of
16290001Sglebius# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17290001Sglebius# General Public License for more details.
18290001Sglebius#
19290001Sglebius# You should have received a copy of the GNU General Public License
20290001Sglebius# along with this program; if not, write to the Free Software
21290001Sglebius# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
22290001Sglebius# 02110-1301, USA.
23290001Sglebius#
24290001Sglebius# As a special exception to the GNU General Public License, if you
25290001Sglebius# distribute this file as part of a program that contains a
26290001Sglebius# configuration script generated by Autoconf, you may include it under
27290001Sglebius# the same distribution terms that you use for the rest of that program.
28290001Sglebius
29290001Sglebius
30290001Sglebius# Originally written by Per Bothner.  Please send patches (context
31290001Sglebius# diff format) to <config-patches@gnu.org> and include a ChangeLog
32290001Sglebius# entry.
33290001Sglebius#
34290001Sglebius# This script attempts to guess a canonical system name similar to
35290001Sglebius# config.sub.  If it succeeds, it prints the system name on stdout, and
36290001Sglebius# exits with 0.  Otherwise, it exits with 1.
37290001Sglebius#
38290001Sglebius# You can get the latest version of this script from:
39290001Sglebius# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
40290001Sglebius
41290001Sglebiusme=`echo "$0" | sed -e 's,.*/,,'`
42290001Sglebius
43290001Sglebiususage="\
44290001SglebiusUsage: $0 [OPTION]
45290001Sglebius
46290001SglebiusOutput the configuration name of the system \`$me' is run on.
47290001Sglebius
48290001SglebiusOperation modes:
49290001Sglebius  -h, --help         print this help, then exit
50290001Sglebius  -t, --time-stamp   print date of last modification, then exit
51290001Sglebius  -v, --version      print version number, then exit
52290001Sglebius
53290001SglebiusReport bugs and patches to <config-patches@gnu.org>."
54290001Sglebius
55290001Sglebiusversion="\
56290001SglebiusGNU config.guess ($timestamp)
57290001Sglebius
58290001SglebiusOriginally written by Per Bothner.
59290001SglebiusCopyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
60290001Sglebius2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
61290001SglebiusSoftware Foundation, Inc.
62290001Sglebius
63290001SglebiusThis is free software; see the source for copying conditions.  There is NO
64290001Sglebiuswarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
65290001Sglebius
66290001Sglebiushelp="
67290001SglebiusTry \`$me --help' for more information."
68290001Sglebius
69290001Sglebius# Parse command line
70290001Sglebiuswhile test $# -gt 0 ; do
71290001Sglebius  case $1 in
72290001Sglebius    --time-stamp | --time* | -t )
73290001Sglebius       echo "$timestamp" ; exit ;;
74290001Sglebius    --version | -v )
75290001Sglebius       echo "$version" ; exit ;;
76290001Sglebius    --help | --h* | -h )
77290001Sglebius       echo "$usage"; exit ;;
78290001Sglebius    -- )     # Stop option processing
79290001Sglebius       shift; break ;;
80290001Sglebius    - )	# Use stdin as input.
81290001Sglebius       break ;;
82290001Sglebius    -* )
83290001Sglebius       echo "$me: invalid option $1$help" >&2
84290001Sglebius       exit 1 ;;
85290001Sglebius    * )
86290001Sglebius       break ;;
87290001Sglebius  esac
88290001Sglebiusdone
89290001Sglebius
90290001Sglebiusif test $# != 0; then
91290001Sglebius  echo "$me: too many arguments$help" >&2
92290001Sglebius  exit 1
93290001Sglebiusfi
94290001Sglebius
95290001Sglebiustrap 'exit 1' 1 2 15
96290001Sglebius
97290001Sglebius# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
98290001Sglebius# compiler to aid in system detection is discouraged as it requires
99290001Sglebius# temporary files to be created and, as you can see below, it is a
100290001Sglebius# headache to deal with in a portable fashion.
101290001Sglebius
102290001Sglebius# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
103290001Sglebius# use `HOST_CC' if defined, but it is deprecated.
104290001Sglebius
105290001Sglebius# Portable tmp directory creation inspired by the Autoconf team.
106290001Sglebius
107290001Sglebiusset_cc_for_build='
108290001Sglebiustrap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
109290001Sglebiustrap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
110290001Sglebius: ${TMPDIR=/tmp} ;
111290001Sglebius { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
112290001Sglebius { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
113290001Sglebius { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
114290001Sglebius { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
115290001Sglebiusdummy=$tmp/dummy ;
116290001Sglebiustmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
117290001Sglebiuscase $CC_FOR_BUILD,$HOST_CC,$CC in
118290001Sglebius ,,)    echo "int x;" > $dummy.c ;
119290001Sglebius	for c in cc gcc c89 c99 ; do
120290001Sglebius	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
121290001Sglebius	     CC_FOR_BUILD="$c"; break ;
122290001Sglebius	  fi ;
123290001Sglebius	done ;
124290001Sglebius	if test x"$CC_FOR_BUILD" = x ; then
125290001Sglebius	  CC_FOR_BUILD=no_compiler_found ;
126290001Sglebius	fi
127290001Sglebius	;;
128290001Sglebius ,,*)   CC_FOR_BUILD=$CC ;;
129290001Sglebius ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
130290001Sglebiusesac ; set_cc_for_build= ;'
131290001Sglebius
132290001Sglebius# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
133290001Sglebius# (ghazi@noc.rutgers.edu 1994-08-24)
134290001Sglebiusif (test -f /.attbin/uname) >/dev/null 2>&1 ; then
135290001Sglebius	PATH=$PATH:/.attbin ; export PATH
136290001Sglebiusfi
137290001Sglebius
138290001SglebiusUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
139290001SglebiusUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
140290001SglebiusUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
141290001SglebiusUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
142290001Sglebius
143290001Sglebius# Note: order is significant - the case branches are not exclusive.
144290001Sglebius
145290001Sglebiuscase "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
146290001Sglebius    *:NetBSD:*:*)
147290001Sglebius	# NetBSD (nbsd) targets should (where applicable) match one or
148290001Sglebius	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
149290001Sglebius	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
150290001Sglebius	# switched to ELF, *-*-netbsd* would select the old
151290001Sglebius	# object file format.  This provides both forward
152290001Sglebius	# compatibility and a consistent mechanism for selecting the
153290001Sglebius	# object file format.
154290001Sglebius	#
155290001Sglebius	# Note: NetBSD doesn't particularly care about the vendor
156290001Sglebius	# portion of the name.  We always set it to "unknown".
157290001Sglebius	sysctl="sysctl -n hw.machine_arch"
158290001Sglebius	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
159290001Sglebius	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
160290001Sglebius	case "${UNAME_MACHINE_ARCH}" in
161290001Sglebius	    armeb) machine=armeb-unknown ;;
162290001Sglebius	    arm*) machine=arm-unknown ;;
163290001Sglebius	    sh3el) machine=shl-unknown ;;
164290001Sglebius	    sh3eb) machine=sh-unknown ;;
165290001Sglebius	    sh5el) machine=sh5le-unknown ;;
166290001Sglebius	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
167290001Sglebius	esac
168290001Sglebius	# The Operating System including object format, if it has switched
169290001Sglebius	# to ELF recently, or will in the future.
170290001Sglebius	case "${UNAME_MACHINE_ARCH}" in
171290001Sglebius	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
172290001Sglebius		eval $set_cc_for_build
173290001Sglebius		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
174290001Sglebius			| grep -q __ELF__
175290001Sglebius		then
176290001Sglebius		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
177290001Sglebius		    # Return netbsd for either.  FIX?
178290001Sglebius		    os=netbsd
179290001Sglebius		else
180290001Sglebius		    os=netbsdelf
181290001Sglebius		fi
182290001Sglebius		;;
183290001Sglebius	    *)
184290001Sglebius		os=netbsd
185290001Sglebius		;;
186290001Sglebius	esac
187290001Sglebius	# The OS release
188290001Sglebius	# Debian GNU/NetBSD machines have a different userland, and
189290001Sglebius	# thus, need a distinct triplet. However, they do not need
190290001Sglebius	# kernel version information, so it can be replaced with a
191290001Sglebius	# suitable tag, in the style of linux-gnu.
192290001Sglebius	case "${UNAME_VERSION}" in
193290001Sglebius	    Debian*)
194290001Sglebius		release='-gnu'
195290001Sglebius		;;
196290001Sglebius	    *)
197290001Sglebius		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
198290001Sglebius		;;
199290001Sglebius	esac
200290001Sglebius	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
201290001Sglebius	# contains redundant information, the shorter form:
202290001Sglebius	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
203290001Sglebius	echo "${machine}-${os}${release}"
204290001Sglebius	exit ;;
205290001Sglebius    *:OpenBSD:*:*)
206290001Sglebius	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
207290001Sglebius	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
208290001Sglebius	exit ;;
209290001Sglebius    *:ekkoBSD:*:*)
210290001Sglebius	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
211290001Sglebius	exit ;;
212290001Sglebius    *:SolidBSD:*:*)
213290001Sglebius	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
214290001Sglebius	exit ;;
215290001Sglebius    macppc:MirBSD:*:*)
216290001Sglebius	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
217290001Sglebius	exit ;;
218290001Sglebius    *:MirBSD:*:*)
219290001Sglebius	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
220290001Sglebius	exit ;;
221290001Sglebius    alpha:OSF1:*:*)
222290001Sglebius	case $UNAME_RELEASE in
223290001Sglebius	*4.0)
224290001Sglebius		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
225290001Sglebius		;;
226290001Sglebius	*5.*)
227290001Sglebius		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
228290001Sglebius		;;
229290001Sglebius	esac
230290001Sglebius	# According to Compaq, /usr/sbin/psrinfo has been available on
231290001Sglebius	# OSF/1 and Tru64 systems produced since 1995.  I hope that
232290001Sglebius	# covers most systems running today.  This code pipes the CPU
233290001Sglebius	# types through head -n 1, so we only detect the type of CPU 0.
234290001Sglebius	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
235290001Sglebius	case "$ALPHA_CPU_TYPE" in
236290001Sglebius	    "EV4 (21064)")
237290001Sglebius		UNAME_MACHINE="alpha" ;;
238290001Sglebius	    "EV4.5 (21064)")
239290001Sglebius		UNAME_MACHINE="alpha" ;;
240290001Sglebius	    "LCA4 (21066/21068)")
241290001Sglebius		UNAME_MACHINE="alpha" ;;
242290001Sglebius	    "EV5 (21164)")
243290001Sglebius		UNAME_MACHINE="alphaev5" ;;
244290001Sglebius	    "EV5.6 (21164A)")
245290001Sglebius		UNAME_MACHINE="alphaev56" ;;
246290001Sglebius	    "EV5.6 (21164PC)")
247290001Sglebius		UNAME_MACHINE="alphapca56" ;;
248290001Sglebius	    "EV5.7 (21164PC)")
249290001Sglebius		UNAME_MACHINE="alphapca57" ;;
250290001Sglebius	    "EV6 (21264)")
251290001Sglebius		UNAME_MACHINE="alphaev6" ;;
252290001Sglebius	    "EV6.7 (21264A)")
253290001Sglebius		UNAME_MACHINE="alphaev67" ;;
254290001Sglebius	    "EV6.8CB (21264C)")
255290001Sglebius		UNAME_MACHINE="alphaev68" ;;
256290001Sglebius	    "EV6.8AL (21264B)")
257290001Sglebius		UNAME_MACHINE="alphaev68" ;;
258290001Sglebius	    "EV6.8CX (21264D)")
259290001Sglebius		UNAME_MACHINE="alphaev68" ;;
260290001Sglebius	    "EV6.9A (21264/EV69A)")
261290001Sglebius		UNAME_MACHINE="alphaev69" ;;
262290001Sglebius	    "EV7 (21364)")
263290001Sglebius		UNAME_MACHINE="alphaev7" ;;
264290001Sglebius	    "EV7.9 (21364A)")
265290001Sglebius		UNAME_MACHINE="alphaev79" ;;
266290001Sglebius	esac
267290001Sglebius	# A Pn.n version is a patched version.
268290001Sglebius	# A Vn.n version is a released version.
269290001Sglebius	# A Tn.n version is a released field test version.
270290001Sglebius	# A Xn.n version is an unreleased experimental baselevel.
271290001Sglebius	# 1.2 uses "1.2" for uname -r.
272290001Sglebius	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
273290001Sglebius	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
274290001Sglebius	exitcode=$?
275290001Sglebius	trap '' 0
276290001Sglebius	exit $exitcode ;;
277290001Sglebius    Alpha\ *:Windows_NT*:*)
278290001Sglebius	# How do we know it's Interix rather than the generic POSIX subsystem?
279290001Sglebius	# Should we change UNAME_MACHINE based on the output of uname instead
280290001Sglebius	# of the specific Alpha model?
281290001Sglebius	echo alpha-pc-interix
282290001Sglebius	exit ;;
283290001Sglebius    21064:Windows_NT:50:3)
284290001Sglebius	echo alpha-dec-winnt3.5
285290001Sglebius	exit ;;
286290001Sglebius    Amiga*:UNIX_System_V:4.0:*)
287290001Sglebius	echo m68k-unknown-sysv4
288290001Sglebius	exit ;;
289290001Sglebius    *:[Aa]miga[Oo][Ss]:*:*)
290290001Sglebius	echo ${UNAME_MACHINE}-unknown-amigaos
291290001Sglebius	exit ;;
292290001Sglebius    *:[Mm]orph[Oo][Ss]:*:*)
293290001Sglebius	echo ${UNAME_MACHINE}-unknown-morphos
294290001Sglebius	exit ;;
295290001Sglebius    *:OS/390:*:*)
296290001Sglebius	echo i370-ibm-openedition
297290001Sglebius	exit ;;
298290001Sglebius    *:z/VM:*:*)
299290001Sglebius	echo s390-ibm-zvmoe
300290001Sglebius	exit ;;
301290001Sglebius    *:OS400:*:*)
302290001Sglebius	echo powerpc-ibm-os400
303290001Sglebius	exit ;;
304290001Sglebius    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
305290001Sglebius	echo arm-acorn-riscix${UNAME_RELEASE}
306290001Sglebius	exit ;;
307290001Sglebius    arm:riscos:*:*|arm:RISCOS:*:*)
308290001Sglebius	echo arm-unknown-riscos
309290001Sglebius	exit ;;
310290001Sglebius    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
311290001Sglebius	echo hppa1.1-hitachi-hiuxmpp
312290001Sglebius	exit ;;
313290001Sglebius    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
314290001Sglebius	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
315290001Sglebius	if test "`(/bin/universe) 2>/dev/null`" = att ; then
316290001Sglebius		echo pyramid-pyramid-sysv3
317290001Sglebius	else
318290001Sglebius		echo pyramid-pyramid-bsd
319290001Sglebius	fi
320290001Sglebius	exit ;;
321290001Sglebius    NILE*:*:*:dcosx)
322290001Sglebius	echo pyramid-pyramid-svr4
323290001Sglebius	exit ;;
324290001Sglebius    DRS?6000:unix:4.0:6*)
325290001Sglebius	echo sparc-icl-nx6
326290001Sglebius	exit ;;
327290001Sglebius    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
328290001Sglebius	case `/usr/bin/uname -p` in
329290001Sglebius	    sparc) echo sparc-icl-nx7; exit ;;
330290001Sglebius	esac ;;
331290001Sglebius    s390x:SunOS:*:*)
332290001Sglebius	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
333290001Sglebius	exit ;;
334290001Sglebius    sun4H:SunOS:5.*:*)
335290001Sglebius	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
336290001Sglebius	exit ;;
337290001Sglebius    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
338290001Sglebius	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
339290001Sglebius	exit ;;
340290001Sglebius    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
341290001Sglebius	echo i386-pc-auroraux${UNAME_RELEASE}
342290001Sglebius	exit ;;
343290001Sglebius    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
344290001Sglebius	eval $set_cc_for_build
345290001Sglebius	SUN_ARCH="i386"
346290001Sglebius	# If there is a compiler, see if it is configured for 64-bit objects.
347290001Sglebius	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
348290001Sglebius	# This test works for both compilers.
349290001Sglebius	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
350290001Sglebius	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
351290001Sglebius		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
352290001Sglebius		grep IS_64BIT_ARCH >/dev/null
353290001Sglebius	    then
354290001Sglebius		SUN_ARCH="x86_64"
355290001Sglebius	    fi
356290001Sglebius	fi
357290001Sglebius	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
358290001Sglebius	exit ;;
359290001Sglebius    sun4*:SunOS:6*:*)
360290001Sglebius	# According to config.sub, this is the proper way to canonicalize
361290001Sglebius	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
362290001Sglebius	# it's likely to be more like Solaris than SunOS4.
363290001Sglebius	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
364290001Sglebius	exit ;;
365290001Sglebius    sun4*:SunOS:*:*)
366290001Sglebius	case "`/usr/bin/arch -k`" in
367290001Sglebius	    Series*|S4*)
368290001Sglebius		UNAME_RELEASE=`uname -v`
369290001Sglebius		;;
370290001Sglebius	esac
371290001Sglebius	# Japanese Language versions have a version number like `4.1.3-JL'.
372290001Sglebius	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
373290001Sglebius	exit ;;
374290001Sglebius    sun3*:SunOS:*:*)
375290001Sglebius	echo m68k-sun-sunos${UNAME_RELEASE}
376290001Sglebius	exit ;;
377290001Sglebius    sun*:*:4.2BSD:*)
378290001Sglebius	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
379290001Sglebius	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
380290001Sglebius	case "`/bin/arch`" in
381290001Sglebius	    sun3)
382290001Sglebius		echo m68k-sun-sunos${UNAME_RELEASE}
383290001Sglebius		;;
384290001Sglebius	    sun4)
385290001Sglebius		echo sparc-sun-sunos${UNAME_RELEASE}
386290001Sglebius		;;
387290001Sglebius	esac
388290001Sglebius	exit ;;
389290001Sglebius    aushp:SunOS:*:*)
390290001Sglebius	echo sparc-auspex-sunos${UNAME_RELEASE}
391290001Sglebius	exit ;;
392290001Sglebius    # The situation for MiNT is a little confusing.  The machine name
393290001Sglebius    # can be virtually everything (everything which is not
394290001Sglebius    # "atarist" or "atariste" at least should have a processor
395290001Sglebius    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
396290001Sglebius    # to the lowercase version "mint" (or "freemint").  Finally
397290001Sglebius    # the system name "TOS" denotes a system which is actually not
398290001Sglebius    # MiNT.  But MiNT is downward compatible to TOS, so this should
399290001Sglebius    # be no problem.
400290001Sglebius    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
401290001Sglebius	echo m68k-atari-mint${UNAME_RELEASE}
402290001Sglebius	exit ;;
403290001Sglebius    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
404290001Sglebius	echo m68k-atari-mint${UNAME_RELEASE}
405290001Sglebius	exit ;;
406290001Sglebius    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
407290001Sglebius	echo m68k-atari-mint${UNAME_RELEASE}
408290001Sglebius	exit ;;
409290001Sglebius    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
410290001Sglebius	echo m68k-milan-mint${UNAME_RELEASE}
411290001Sglebius	exit ;;
412290001Sglebius    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
413290001Sglebius	echo m68k-hades-mint${UNAME_RELEASE}
414290001Sglebius	exit ;;
415290001Sglebius    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
416290001Sglebius	echo m68k-unknown-mint${UNAME_RELEASE}
417290001Sglebius	exit ;;
418290001Sglebius    m68k:machten:*:*)
419290001Sglebius	echo m68k-apple-machten${UNAME_RELEASE}
420290001Sglebius	exit ;;
421290001Sglebius    powerpc:machten:*:*)
422290001Sglebius	echo powerpc-apple-machten${UNAME_RELEASE}
423290001Sglebius	exit ;;
424290001Sglebius    RISC*:Mach:*:*)
425290001Sglebius	echo mips-dec-mach_bsd4.3
426290001Sglebius	exit ;;
427290001Sglebius    RISC*:ULTRIX:*:*)
428290001Sglebius	echo mips-dec-ultrix${UNAME_RELEASE}
429290001Sglebius	exit ;;
430290001Sglebius    VAX*:ULTRIX*:*:*)
431290001Sglebius	echo vax-dec-ultrix${UNAME_RELEASE}
432290001Sglebius	exit ;;
433290001Sglebius    2020:CLIX:*:* | 2430:CLIX:*:*)
434290001Sglebius	echo clipper-intergraph-clix${UNAME_RELEASE}
435290001Sglebius	exit ;;
436290001Sglebius    mips:*:*:UMIPS | mips:*:*:RISCos)
437290001Sglebius	eval $set_cc_for_build
438290001Sglebius	sed 's/^	//' << EOF >$dummy.c
439290001Sglebius#ifdef __cplusplus
440290001Sglebius#include <stdio.h>  /* for printf() prototype */
441290001Sglebius	int main (int argc, char *argv[]) {
442290001Sglebius#else
443290001Sglebius	int main (argc, argv) int argc; char *argv[]; {
444290001Sglebius#endif
445290001Sglebius	#if defined (host_mips) && defined (MIPSEB)
446290001Sglebius	#if defined (SYSTYPE_SYSV)
447290001Sglebius	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
448290001Sglebius	#endif
449290001Sglebius	#if defined (SYSTYPE_SVR4)
450290001Sglebius	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
451290001Sglebius	#endif
452290001Sglebius	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
453290001Sglebius	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
454290001Sglebius	#endif
455290001Sglebius	#endif
456290001Sglebius	  exit (-1);
457290001Sglebius	}
458290001SglebiusEOF
459290001Sglebius	$CC_FOR_BUILD -o $dummy $dummy.c &&
460290001Sglebius	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
461290001Sglebius	  SYSTEM_NAME=`$dummy $dummyarg` &&
462290001Sglebius	    { echo "$SYSTEM_NAME"; exit; }
463290001Sglebius	echo mips-mips-riscos${UNAME_RELEASE}
464290001Sglebius	exit ;;
465290001Sglebius    Motorola:PowerMAX_OS:*:*)
466290001Sglebius	echo powerpc-motorola-powermax
467290001Sglebius	exit ;;
468290001Sglebius    Motorola:*:4.3:PL8-*)
469290001Sglebius	echo powerpc-harris-powermax
470290001Sglebius	exit ;;
471290001Sglebius    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
472290001Sglebius	echo powerpc-harris-powermax
473290001Sglebius	exit ;;
474290001Sglebius    Night_Hawk:Power_UNIX:*:*)
475290001Sglebius	echo powerpc-harris-powerunix
476290001Sglebius	exit ;;
477290001Sglebius    m88k:CX/UX:7*:*)
478290001Sglebius	echo m88k-harris-cxux7
479290001Sglebius	exit ;;
480290001Sglebius    m88k:*:4*:R4*)
481290001Sglebius	echo m88k-motorola-sysv4
482290001Sglebius	exit ;;
483290001Sglebius    m88k:*:3*:R3*)
484290001Sglebius	echo m88k-motorola-sysv3
485290001Sglebius	exit ;;
486290001Sglebius    AViiON:dgux:*:*)
487290001Sglebius	# DG/UX returns AViiON for all architectures
488290001Sglebius	UNAME_PROCESSOR=`/usr/bin/uname -p`
489290001Sglebius	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
490290001Sglebius	then
491290001Sglebius	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
492290001Sglebius	       [ ${TARGET_BINARY_INTERFACE}x = x ]
493290001Sglebius	    then
494290001Sglebius		echo m88k-dg-dgux${UNAME_RELEASE}
495290001Sglebius	    else
496290001Sglebius		echo m88k-dg-dguxbcs${UNAME_RELEASE}
497290001Sglebius	    fi
498290001Sglebius	else
499290001Sglebius	    echo i586-dg-dgux${UNAME_RELEASE}
500290001Sglebius	fi
501290001Sglebius	exit ;;
502290001Sglebius    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
503290001Sglebius	echo m88k-dolphin-sysv3
504290001Sglebius	exit ;;
505290001Sglebius    M88*:*:R3*:*)
506290001Sglebius	# Delta 88k system running SVR3
507290001Sglebius	echo m88k-motorola-sysv3
508290001Sglebius	exit ;;
509290001Sglebius    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
510290001Sglebius	echo m88k-tektronix-sysv3
511290001Sglebius	exit ;;
512290001Sglebius    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
513290001Sglebius	echo m68k-tektronix-bsd
514290001Sglebius	exit ;;
515290001Sglebius    *:IRIX*:*:*)
516290001Sglebius	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
517290001Sglebius	exit ;;
518290001Sglebius    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
519290001Sglebius	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
520290001Sglebius	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
521290001Sglebius    i*86:AIX:*:*)
522290001Sglebius	echo i386-ibm-aix
523290001Sglebius	exit ;;
524290001Sglebius    ia64:AIX:*:*)
525290001Sglebius	if [ -x /usr/bin/oslevel ] ; then
526290001Sglebius		IBM_REV=`/usr/bin/oslevel`
527290001Sglebius	else
528290001Sglebius		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
529290001Sglebius	fi
530290001Sglebius	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
531290001Sglebius	exit ;;
532290001Sglebius    *:AIX:2:3)
533290001Sglebius	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
534290001Sglebius		eval $set_cc_for_build
535290001Sglebius		sed 's/^		//' << EOF >$dummy.c
536290001Sglebius		#include <sys/systemcfg.h>
537290001Sglebius
538290001Sglebius		main()
539290001Sglebius			{
540290001Sglebius			if (!__power_pc())
541290001Sglebius				exit(1);
542290001Sglebius			puts("powerpc-ibm-aix3.2.5");
543290001Sglebius			exit(0);
544290001Sglebius			}
545290001SglebiusEOF
546290001Sglebius		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
547290001Sglebius		then
548290001Sglebius			echo "$SYSTEM_NAME"
549290001Sglebius		else
550290001Sglebius			echo rs6000-ibm-aix3.2.5
551290001Sglebius		fi
552290001Sglebius	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
553290001Sglebius		echo rs6000-ibm-aix3.2.4
554290001Sglebius	else
555290001Sglebius		echo rs6000-ibm-aix3.2
556290001Sglebius	fi
557290001Sglebius	exit ;;
558290001Sglebius    *:AIX:*:[4567])
559290001Sglebius	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
560290001Sglebius	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
561290001Sglebius		IBM_ARCH=rs6000
562290001Sglebius	else
563290001Sglebius		IBM_ARCH=powerpc
564290001Sglebius	fi
565290001Sglebius	if [ -x /usr/bin/oslevel ] ; then
566290001Sglebius		IBM_REV=`/usr/bin/oslevel`
567290001Sglebius	else
568290001Sglebius		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
569290001Sglebius	fi
570290001Sglebius	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
571290001Sglebius	exit ;;
572290001Sglebius    *:AIX:*:*)
573290001Sglebius	echo rs6000-ibm-aix
574290001Sglebius	exit ;;
575290001Sglebius    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
576290001Sglebius	echo romp-ibm-bsd4.4
577290001Sglebius	exit ;;
578290001Sglebius    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
579290001Sglebius	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
580290001Sglebius	exit ;;                             # report: romp-ibm BSD 4.3
581290001Sglebius    *:BOSX:*:*)
582290001Sglebius	echo rs6000-bull-bosx
583290001Sglebius	exit ;;
584290001Sglebius    DPX/2?00:B.O.S.:*:*)
585290001Sglebius	echo m68k-bull-sysv3
586290001Sglebius	exit ;;
587290001Sglebius    9000/[34]??:4.3bsd:1.*:*)
588290001Sglebius	echo m68k-hp-bsd
589290001Sglebius	exit ;;
590290001Sglebius    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
591290001Sglebius	echo m68k-hp-bsd4.4
592290001Sglebius	exit ;;
593290001Sglebius    9000/[34678]??:HP-UX:*:*)
594290001Sglebius	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
595290001Sglebius	case "${UNAME_MACHINE}" in
596290001Sglebius	    9000/31? )            HP_ARCH=m68000 ;;
597290001Sglebius	    9000/[34]?? )         HP_ARCH=m68k ;;
598290001Sglebius	    9000/[678][0-9][0-9])
599290001Sglebius		if [ -x /usr/bin/getconf ]; then
600290001Sglebius		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
601290001Sglebius		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
602290001Sglebius		    case "${sc_cpu_version}" in
603290001Sglebius		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
604290001Sglebius		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
605290001Sglebius		      532)                      # CPU_PA_RISC2_0
606290001Sglebius			case "${sc_kernel_bits}" in
607290001Sglebius			  32) HP_ARCH="hppa2.0n" ;;
608290001Sglebius			  64) HP_ARCH="hppa2.0w" ;;
609290001Sglebius			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
610290001Sglebius			esac ;;
611290001Sglebius		    esac
612290001Sglebius		fi
613290001Sglebius		if [ "${HP_ARCH}" = "" ]; then
614290001Sglebius		    eval $set_cc_for_build
615290001Sglebius		    sed 's/^		//' << EOF >$dummy.c
616290001Sglebius
617290001Sglebius		#define _HPUX_SOURCE
618290001Sglebius		#include <stdlib.h>
619290001Sglebius		#include <unistd.h>
620290001Sglebius
621290001Sglebius		int main ()
622290001Sglebius		{
623290001Sglebius		#if defined(_SC_KERNEL_BITS)
624290001Sglebius		    long bits = sysconf(_SC_KERNEL_BITS);
625290001Sglebius		#endif
626290001Sglebius		    long cpu  = sysconf (_SC_CPU_VERSION);
627290001Sglebius
628290001Sglebius		    switch (cpu)
629290001Sglebius			{
630290001Sglebius			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
631290001Sglebius			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
632290001Sglebius			case CPU_PA_RISC2_0:
633290001Sglebius		#if defined(_SC_KERNEL_BITS)
634290001Sglebius			    switch (bits)
635290001Sglebius				{
636290001Sglebius				case 64: puts ("hppa2.0w"); break;
637290001Sglebius				case 32: puts ("hppa2.0n"); break;
638290001Sglebius				default: puts ("hppa2.0"); break;
639290001Sglebius				} break;
640290001Sglebius		#else  /* !defined(_SC_KERNEL_BITS) */
641290001Sglebius			    puts ("hppa2.0"); break;
642290001Sglebius		#endif
643290001Sglebius			default: puts ("hppa1.0"); break;
644290001Sglebius			}
645290001Sglebius		    exit (0);
646290001Sglebius		}
647290001SglebiusEOF
648290001Sglebius		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
649290001Sglebius		    test -z "$HP_ARCH" && HP_ARCH=hppa
650290001Sglebius		fi ;;
651290001Sglebius	esac
652290001Sglebius	if [ ${HP_ARCH} = "hppa2.0w" ]
653290001Sglebius	then
654290001Sglebius	    eval $set_cc_for_build
655290001Sglebius
656290001Sglebius	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
657290001Sglebius	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
658290001Sglebius	    # generating 64-bit code.  GNU and HP use different nomenclature:
659290001Sglebius	    #
660290001Sglebius	    # $ CC_FOR_BUILD=cc ./config.guess
661290001Sglebius	    # => hppa2.0w-hp-hpux11.23
662290001Sglebius	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
663290001Sglebius	    # => hppa64-hp-hpux11.23
664290001Sglebius
665290001Sglebius	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
666290001Sglebius		grep -q __LP64__
667290001Sglebius	    then
668290001Sglebius		HP_ARCH="hppa2.0w"
669290001Sglebius	    else
670290001Sglebius		HP_ARCH="hppa64"
671290001Sglebius	    fi
672290001Sglebius	fi
673290001Sglebius	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
674290001Sglebius	exit ;;
675290001Sglebius    ia64:HP-UX:*:*)
676290001Sglebius	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
677290001Sglebius	echo ia64-hp-hpux${HPUX_REV}
678290001Sglebius	exit ;;
679290001Sglebius    3050*:HI-UX:*:*)
680290001Sglebius	eval $set_cc_for_build
681290001Sglebius	sed 's/^	//' << EOF >$dummy.c
682290001Sglebius	#include <unistd.h>
683290001Sglebius	int
684290001Sglebius	main ()
685290001Sglebius	{
686290001Sglebius	  long cpu = sysconf (_SC_CPU_VERSION);
687290001Sglebius	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
688290001Sglebius	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
689290001Sglebius	     results, however.  */
690290001Sglebius	  if (CPU_IS_PA_RISC (cpu))
691290001Sglebius	    {
692290001Sglebius	      switch (cpu)
693290001Sglebius		{
694290001Sglebius		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
695290001Sglebius		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
696290001Sglebius		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
697290001Sglebius		  default: puts ("hppa-hitachi-hiuxwe2"); break;
698290001Sglebius		}
699290001Sglebius	    }
700290001Sglebius	  else if (CPU_IS_HP_MC68K (cpu))
701290001Sglebius	    puts ("m68k-hitachi-hiuxwe2");
702290001Sglebius	  else puts ("unknown-hitachi-hiuxwe2");
703290001Sglebius	  exit (0);
704290001Sglebius	}
705290001SglebiusEOF
706290001Sglebius	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
707290001Sglebius		{ echo "$SYSTEM_NAME"; exit; }
708290001Sglebius	echo unknown-hitachi-hiuxwe2
709290001Sglebius	exit ;;
710290001Sglebius    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
711290001Sglebius	echo hppa1.1-hp-bsd
712290001Sglebius	exit ;;
713290001Sglebius    9000/8??:4.3bsd:*:*)
714290001Sglebius	echo hppa1.0-hp-bsd
715290001Sglebius	exit ;;
716290001Sglebius    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
717290001Sglebius	echo hppa1.0-hp-mpeix
718290001Sglebius	exit ;;
719290001Sglebius    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
720290001Sglebius	echo hppa1.1-hp-osf
721290001Sglebius	exit ;;
722290001Sglebius    hp8??:OSF1:*:*)
723290001Sglebius	echo hppa1.0-hp-osf
724290001Sglebius	exit ;;
725290001Sglebius    i*86:OSF1:*:*)
726290001Sglebius	if [ -x /usr/sbin/sysversion ] ; then
727290001Sglebius	    echo ${UNAME_MACHINE}-unknown-osf1mk
728290001Sglebius	else
729290001Sglebius	    echo ${UNAME_MACHINE}-unknown-osf1
730290001Sglebius	fi
731290001Sglebius	exit ;;
732290001Sglebius    parisc*:Lites*:*:*)
733290001Sglebius	echo hppa1.1-hp-lites
734290001Sglebius	exit ;;
735290001Sglebius    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
736290001Sglebius	echo c1-convex-bsd
737290001Sglebius	exit ;;
738290001Sglebius    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
739290001Sglebius	if getsysinfo -f scalar_acc
740290001Sglebius	then echo c32-convex-bsd
741290001Sglebius	else echo c2-convex-bsd
742290001Sglebius	fi
743290001Sglebius	exit ;;
744290001Sglebius    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
745290001Sglebius	echo c34-convex-bsd
746290001Sglebius	exit ;;
747290001Sglebius    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
748290001Sglebius	echo c38-convex-bsd
749290001Sglebius	exit ;;
750290001Sglebius    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
751290001Sglebius	echo c4-convex-bsd
752290001Sglebius	exit ;;
753290001Sglebius    CRAY*Y-MP:*:*:*)
754290001Sglebius	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
755290001Sglebius	exit ;;
756290001Sglebius    CRAY*[A-Z]90:*:*:*)
757290001Sglebius	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
758290001Sglebius	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
759290001Sglebius	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
760290001Sglebius	      -e 's/\.[^.]*$/.X/'
761290001Sglebius	exit ;;
762290001Sglebius    CRAY*TS:*:*:*)
763290001Sglebius	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
764290001Sglebius	exit ;;
765290001Sglebius    CRAY*T3E:*:*:*)
766290001Sglebius	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
767290001Sglebius	exit ;;
768290001Sglebius    CRAY*SV1:*:*:*)
769290001Sglebius	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
770290001Sglebius	exit ;;
771290001Sglebius    *:UNICOS/mp:*:*)
772290001Sglebius	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
773290001Sglebius	exit ;;
774290001Sglebius    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
775290001Sglebius	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
776290001Sglebius	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
777290001Sglebius	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
778290001Sglebius	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
779290001Sglebius	exit ;;
780290001Sglebius    5000:UNIX_System_V:4.*:*)
781290001Sglebius	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
782290001Sglebius	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
783290001Sglebius	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
784290001Sglebius	exit ;;
785290001Sglebius    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
786290001Sglebius	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
787290001Sglebius	exit ;;
788290001Sglebius    sparc*:BSD/OS:*:*)
789290001Sglebius	echo sparc-unknown-bsdi${UNAME_RELEASE}
790290001Sglebius	exit ;;
791290001Sglebius    *:BSD/OS:*:*)
792290001Sglebius	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
793290001Sglebius	exit ;;
794290001Sglebius    *:FreeBSD:*:*)
795290001Sglebius	case ${UNAME_MACHINE} in
796290001Sglebius	    pc98)
797290001Sglebius		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
798290001Sglebius	    amd64)
799290001Sglebius		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
800290001Sglebius	    *)
801290001Sglebius		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
802290001Sglebius	esac
803290001Sglebius	exit ;;
804290001Sglebius    i*:CYGWIN*:*)
805290001Sglebius	echo ${UNAME_MACHINE}-pc-cygwin
806290001Sglebius	exit ;;
807290001Sglebius    *:MINGW*:*)
808290001Sglebius	echo ${UNAME_MACHINE}-pc-mingw32
809290001Sglebius	exit ;;
810290001Sglebius    i*:windows32*:*)
811290001Sglebius	# uname -m includes "-pc" on this system.
812290001Sglebius	echo ${UNAME_MACHINE}-mingw32
813290001Sglebius	exit ;;
814290001Sglebius    i*:PW*:*)
815290001Sglebius	echo ${UNAME_MACHINE}-pc-pw32
816290001Sglebius	exit ;;
817290001Sglebius    *:Interix*:*)
818290001Sglebius	case ${UNAME_MACHINE} in
819290001Sglebius	    x86)
820290001Sglebius		echo i586-pc-interix${UNAME_RELEASE}
821290001Sglebius		exit ;;
822290001Sglebius	    authenticamd | genuineintel | EM64T)
823290001Sglebius		echo x86_64-unknown-interix${UNAME_RELEASE}
824290001Sglebius		exit ;;
825290001Sglebius	    IA64)
826290001Sglebius		echo ia64-unknown-interix${UNAME_RELEASE}
827290001Sglebius		exit ;;
828290001Sglebius	esac ;;
829290001Sglebius    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
830290001Sglebius	echo i${UNAME_MACHINE}-pc-mks
831290001Sglebius	exit ;;
832290001Sglebius    8664:Windows_NT:*)
833290001Sglebius	echo x86_64-pc-mks
834290001Sglebius	exit ;;
835290001Sglebius    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
836290001Sglebius	# How do we know it's Interix rather than the generic POSIX subsystem?
837290001Sglebius	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
838290001Sglebius	# UNAME_MACHINE based on the output of uname instead of i386?
839290001Sglebius	echo i586-pc-interix
840290001Sglebius	exit ;;
841290001Sglebius    i*:UWIN*:*)
842290001Sglebius	echo ${UNAME_MACHINE}-pc-uwin
843290001Sglebius	exit ;;
844290001Sglebius    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
845290001Sglebius	echo x86_64-unknown-cygwin
846290001Sglebius	exit ;;
847290001Sglebius    p*:CYGWIN*:*)
848290001Sglebius	echo powerpcle-unknown-cygwin
849290001Sglebius	exit ;;
850290001Sglebius    prep*:SunOS:5.*:*)
851290001Sglebius	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
852290001Sglebius	exit ;;
853290001Sglebius    *:GNU:*:*)
854290001Sglebius	# the GNU system
855290001Sglebius	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
856290001Sglebius	exit ;;
857290001Sglebius    *:GNU/*:*:*)
858290001Sglebius	# other systems with GNU libc and userland
859290001Sglebius	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
860290001Sglebius	exit ;;
861290001Sglebius    i*86:Minix:*:*)
862290001Sglebius	echo ${UNAME_MACHINE}-pc-minix
863290001Sglebius	exit ;;
864290001Sglebius    alpha:Linux:*:*)
865290001Sglebius	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
866290001Sglebius	  EV5)   UNAME_MACHINE=alphaev5 ;;
867290001Sglebius	  EV56)  UNAME_MACHINE=alphaev56 ;;
868290001Sglebius	  PCA56) UNAME_MACHINE=alphapca56 ;;
869290001Sglebius	  PCA57) UNAME_MACHINE=alphapca56 ;;
870290001Sglebius	  EV6)   UNAME_MACHINE=alphaev6 ;;
871290001Sglebius	  EV67)  UNAME_MACHINE=alphaev67 ;;
872290001Sglebius	  EV68*) UNAME_MACHINE=alphaev68 ;;
873290001Sglebius	esac
874290001Sglebius	objdump --private-headers /bin/sh | grep -q ld.so.1
875290001Sglebius	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
876290001Sglebius	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
877290001Sglebius	exit ;;
878290001Sglebius    arm*:Linux:*:*)
879290001Sglebius	eval $set_cc_for_build
880290001Sglebius	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
881290001Sglebius	    | grep -q __ARM_EABI__
882290001Sglebius	then
883290001Sglebius	    echo ${UNAME_MACHINE}-unknown-linux-gnu
884290001Sglebius	else
885290001Sglebius	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
886290001Sglebius		| grep -q __ARM_PCS_VFP
887290001Sglebius	    then
888290001Sglebius		echo ${UNAME_MACHINE}-unknown-linux-gnueabi
889290001Sglebius	    else
890290001Sglebius		echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
891290001Sglebius	    fi
892290001Sglebius	fi
893290001Sglebius	exit ;;
894290001Sglebius    avr32*:Linux:*:*)
895290001Sglebius	echo ${UNAME_MACHINE}-unknown-linux-gnu
896290001Sglebius	exit ;;
897290001Sglebius    cris:Linux:*:*)
898290001Sglebius	echo cris-axis-linux-gnu
899290001Sglebius	exit ;;
900290001Sglebius    crisv32:Linux:*:*)
901290001Sglebius	echo crisv32-axis-linux-gnu
902290001Sglebius	exit ;;
903290001Sglebius    frv:Linux:*:*)
904290001Sglebius	echo frv-unknown-linux-gnu
905290001Sglebius	exit ;;
906290001Sglebius    i*86:Linux:*:*)
907290001Sglebius	LIBC=gnu
908290001Sglebius	eval $set_cc_for_build
909290001Sglebius	sed 's/^	//' << EOF >$dummy.c
910290001Sglebius	#ifdef __dietlibc__
911290001Sglebius	LIBC=dietlibc
912290001Sglebius	#endif
913290001SglebiusEOF
914290001Sglebius	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
915290001Sglebius	echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
916290001Sglebius	exit ;;
917290001Sglebius    ia64:Linux:*:*)
918290001Sglebius	echo ${UNAME_MACHINE}-unknown-linux-gnu
919290001Sglebius	exit ;;
920290001Sglebius    m32r*:Linux:*:*)
921290001Sglebius	echo ${UNAME_MACHINE}-unknown-linux-gnu
922290001Sglebius	exit ;;
923290001Sglebius    m68*:Linux:*:*)
924290001Sglebius	echo ${UNAME_MACHINE}-unknown-linux-gnu
925290001Sglebius	exit ;;
926290001Sglebius    mips:Linux:*:* | mips64:Linux:*:*)
927290001Sglebius	eval $set_cc_for_build
928290001Sglebius	sed 's/^	//' << EOF >$dummy.c
929290001Sglebius	#undef CPU
930290001Sglebius	#undef ${UNAME_MACHINE}
931290001Sglebius	#undef ${UNAME_MACHINE}el
932290001Sglebius	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
933290001Sglebius	CPU=${UNAME_MACHINE}el
934290001Sglebius	#else
935290001Sglebius	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
936290001Sglebius	CPU=${UNAME_MACHINE}
937290001Sglebius	#else
938290001Sglebius	CPU=
939290001Sglebius	#endif
940290001Sglebius	#endif
941290001SglebiusEOF
942290001Sglebius	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
943290001Sglebius	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
944290001Sglebius	;;
945290001Sglebius    or32:Linux:*:*)
946290001Sglebius	echo or32-unknown-linux-gnu
947290001Sglebius	exit ;;
948290001Sglebius    padre:Linux:*:*)
949290001Sglebius	echo sparc-unknown-linux-gnu
950290001Sglebius	exit ;;
951290001Sglebius    parisc64:Linux:*:* | hppa64:Linux:*:*)
952290001Sglebius	echo hppa64-unknown-linux-gnu
953290001Sglebius	exit ;;
954290001Sglebius    parisc:Linux:*:* | hppa:Linux:*:*)
955290001Sglebius	# Look for CPU level
956290001Sglebius	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
957290001Sglebius	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
958290001Sglebius	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
959290001Sglebius	  *)    echo hppa-unknown-linux-gnu ;;
960290001Sglebius	esac
961290001Sglebius	exit ;;
962290001Sglebius    ppc64:Linux:*:*)
963290001Sglebius	echo powerpc64-unknown-linux-gnu
964290001Sglebius	exit ;;
965290001Sglebius    ppc:Linux:*:*)
966290001Sglebius	echo powerpc-unknown-linux-gnu
967290001Sglebius	exit ;;
968290001Sglebius    s390:Linux:*:* | s390x:Linux:*:*)
969290001Sglebius	echo ${UNAME_MACHINE}-ibm-linux
970290001Sglebius	exit ;;
971290001Sglebius    sh64*:Linux:*:*)
972290001Sglebius	echo ${UNAME_MACHINE}-unknown-linux-gnu
973290001Sglebius	exit ;;
974290001Sglebius    sh*:Linux:*:*)
975290001Sglebius	echo ${UNAME_MACHINE}-unknown-linux-gnu
976290001Sglebius	exit ;;
977290001Sglebius    sparc:Linux:*:* | sparc64:Linux:*:*)
978290001Sglebius	echo ${UNAME_MACHINE}-unknown-linux-gnu
979290001Sglebius	exit ;;
980290001Sglebius    tile*:Linux:*:*)
981290001Sglebius	echo ${UNAME_MACHINE}-unknown-linux-gnu
982290001Sglebius	exit ;;
983290001Sglebius    vax:Linux:*:*)
984290001Sglebius	echo ${UNAME_MACHINE}-dec-linux-gnu
985290001Sglebius	exit ;;
986290001Sglebius    x86_64:Linux:*:*)
987290001Sglebius	echo x86_64-unknown-linux-gnu
988290001Sglebius	exit ;;
989290001Sglebius    xtensa*:Linux:*:*)
990290001Sglebius	echo ${UNAME_MACHINE}-unknown-linux-gnu
991290001Sglebius	exit ;;
992290001Sglebius    i*86:DYNIX/ptx:4*:*)
993290001Sglebius	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
994290001Sglebius	# earlier versions are messed up and put the nodename in both
995290001Sglebius	# sysname and nodename.
996290001Sglebius	echo i386-sequent-sysv4
997290001Sglebius	exit ;;
998290001Sglebius    i*86:UNIX_SV:4.2MP:2.*)
999290001Sglebius	# Unixware is an offshoot of SVR4, but it has its own version
1000290001Sglebius	# number series starting with 2...
1001290001Sglebius	# I am not positive that other SVR4 systems won't match this,
1002290001Sglebius	# I just have to hope.  -- rms.
1003290001Sglebius	# Use sysv4.2uw... so that sysv4* matches it.
1004290001Sglebius	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
1005290001Sglebius	exit ;;
1006290001Sglebius    i*86:OS/2:*:*)
1007290001Sglebius	# If we were able to find `uname', then EMX Unix compatibility
1008290001Sglebius	# is probably installed.
1009290001Sglebius	echo ${UNAME_MACHINE}-pc-os2-emx
1010290001Sglebius	exit ;;
1011290001Sglebius    i*86:XTS-300:*:STOP)
1012290001Sglebius	echo ${UNAME_MACHINE}-unknown-stop
1013290001Sglebius	exit ;;
1014290001Sglebius    i*86:atheos:*:*)
1015290001Sglebius	echo ${UNAME_MACHINE}-unknown-atheos
1016290001Sglebius	exit ;;
1017290001Sglebius    i*86:syllable:*:*)
1018290001Sglebius	echo ${UNAME_MACHINE}-pc-syllable
1019290001Sglebius	exit ;;
1020290001Sglebius    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1021290001Sglebius	echo i386-unknown-lynxos${UNAME_RELEASE}
1022290001Sglebius	exit ;;
1023290001Sglebius    i*86:*DOS:*:*)
1024290001Sglebius	echo ${UNAME_MACHINE}-pc-msdosdjgpp
1025290001Sglebius	exit ;;
1026290001Sglebius    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
1027290001Sglebius	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
1028290001Sglebius	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1029290001Sglebius		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
1030290001Sglebius	else
1031290001Sglebius		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
1032290001Sglebius	fi
1033290001Sglebius	exit ;;
1034290001Sglebius    i*86:*:5:[678]*)
1035290001Sglebius	# UnixWare 7.x, OpenUNIX and OpenServer 6.
1036290001Sglebius	case `/bin/uname -X | grep "^Machine"` in
1037290001Sglebius	    *486*)	     UNAME_MACHINE=i486 ;;
1038290001Sglebius	    *Pentium)	     UNAME_MACHINE=i586 ;;
1039290001Sglebius	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1040290001Sglebius	esac
1041290001Sglebius	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1042290001Sglebius	exit ;;
1043290001Sglebius    i*86:*:3.2:*)
1044290001Sglebius	if test -f /usr/options/cb.name; then
1045290001Sglebius		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1046290001Sglebius		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
1047290001Sglebius	elif /bin/uname -X 2>/dev/null >/dev/null ; then
1048290001Sglebius		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1049290001Sglebius		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1050290001Sglebius		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1051290001Sglebius			&& UNAME_MACHINE=i586
1052290001Sglebius		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1053290001Sglebius			&& UNAME_MACHINE=i686
1054290001Sglebius		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1055290001Sglebius			&& UNAME_MACHINE=i686
1056290001Sglebius		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
1057290001Sglebius	else
1058290001Sglebius		echo ${UNAME_MACHINE}-pc-sysv32
1059290001Sglebius	fi
1060290001Sglebius	exit ;;
1061290001Sglebius    pc:*:*:*)
1062290001Sglebius	# Left here for compatibility:
1063290001Sglebius	# uname -m prints for DJGPP always 'pc', but it prints nothing about
1064290001Sglebius	# the processor, so we play safe by assuming i586.
1065290001Sglebius	# Note: whatever this is, it MUST be the same as what config.sub
1066290001Sglebius	# prints for the "djgpp" host, or else GDB configury will decide that
1067290001Sglebius	# this is a cross-build.
1068290001Sglebius	echo i586-pc-msdosdjgpp
1069290001Sglebius	exit ;;
1070290001Sglebius    Intel:Mach:3*:*)
1071290001Sglebius	echo i386-pc-mach3
1072290001Sglebius	exit ;;
1073290001Sglebius    paragon:*:*:*)
1074290001Sglebius	echo i860-intel-osf1
1075290001Sglebius	exit ;;
1076290001Sglebius    i860:*:4.*:*) # i860-SVR4
1077290001Sglebius	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1078290001Sglebius	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
1079290001Sglebius	else # Add other i860-SVR4 vendors below as they are discovered.
1080290001Sglebius	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
1081290001Sglebius	fi
1082290001Sglebius	exit ;;
1083290001Sglebius    mini*:CTIX:SYS*5:*)
1084290001Sglebius	# "miniframe"
1085290001Sglebius	echo m68010-convergent-sysv
1086290001Sglebius	exit ;;
1087290001Sglebius    mc68k:UNIX:SYSTEM5:3.51m)
1088290001Sglebius	echo m68k-convergent-sysv
1089290001Sglebius	exit ;;
1090290001Sglebius    M680?0:D-NIX:5.3:*)
1091290001Sglebius	echo m68k-diab-dnix
1092290001Sglebius	exit ;;
1093290001Sglebius    M68*:*:R3V[5678]*:*)
1094290001Sglebius	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1095290001Sglebius    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
1096290001Sglebius	OS_REL=''
1097290001Sglebius	test -r /etc/.relid \
1098290001Sglebius	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1099290001Sglebius	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1100290001Sglebius	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1101290001Sglebius	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1102290001Sglebius	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1103290001Sglebius    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1104290001Sglebius	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1105290001Sglebius	  && { echo i486-ncr-sysv4; exit; } ;;
1106290001Sglebius    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1107290001Sglebius	OS_REL='.3'
1108290001Sglebius	test -r /etc/.relid \
1109290001Sglebius	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1110290001Sglebius	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1111290001Sglebius	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1112290001Sglebius	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1113290001Sglebius	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
1114290001Sglebius	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1115290001Sglebius	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1116290001Sglebius    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1117290001Sglebius	echo m68k-unknown-lynxos${UNAME_RELEASE}
1118290001Sglebius	exit ;;
1119290001Sglebius    mc68030:UNIX_System_V:4.*:*)
1120290001Sglebius	echo m68k-atari-sysv4
1121290001Sglebius	exit ;;
1122290001Sglebius    TSUNAMI:LynxOS:2.*:*)
1123290001Sglebius	echo sparc-unknown-lynxos${UNAME_RELEASE}
1124290001Sglebius	exit ;;
1125290001Sglebius    rs6000:LynxOS:2.*:*)
1126290001Sglebius	echo rs6000-unknown-lynxos${UNAME_RELEASE}
1127290001Sglebius	exit ;;
1128290001Sglebius    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1129290001Sglebius	echo powerpc-unknown-lynxos${UNAME_RELEASE}
1130290001Sglebius	exit ;;
1131290001Sglebius    SM[BE]S:UNIX_SV:*:*)
1132290001Sglebius	echo mips-dde-sysv${UNAME_RELEASE}
1133290001Sglebius	exit ;;
1134290001Sglebius    RM*:ReliantUNIX-*:*:*)
1135290001Sglebius	echo mips-sni-sysv4
1136290001Sglebius	exit ;;
1137290001Sglebius    RM*:SINIX-*:*:*)
1138290001Sglebius	echo mips-sni-sysv4
1139290001Sglebius	exit ;;
1140290001Sglebius    *:SINIX-*:*:*)
1141290001Sglebius	if uname -p 2>/dev/null >/dev/null ; then
1142290001Sglebius		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1143290001Sglebius		echo ${UNAME_MACHINE}-sni-sysv4
1144290001Sglebius	else
1145290001Sglebius		echo ns32k-sni-sysv
1146290001Sglebius	fi
1147290001Sglebius	exit ;;
1148290001Sglebius    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1149290001Sglebius			# says <Richard.M.Bartel@ccMail.Census.GOV>
1150290001Sglebius	echo i586-unisys-sysv4
1151290001Sglebius	exit ;;
1152290001Sglebius    *:UNIX_System_V:4*:FTX*)
1153290001Sglebius	# From Gerald Hewes <hewes@openmarket.com>.
1154290001Sglebius	# How about differentiating between stratus architectures? -djm
1155290001Sglebius	echo hppa1.1-stratus-sysv4
1156290001Sglebius	exit ;;
1157290001Sglebius    *:*:*:FTX*)
1158290001Sglebius	# From seanf@swdc.stratus.com.
1159290001Sglebius	echo i860-stratus-sysv4
1160290001Sglebius	exit ;;
1161290001Sglebius    i*86:VOS:*:*)
1162290001Sglebius	# From Paul.Green@stratus.com.
1163290001Sglebius	echo ${UNAME_MACHINE}-stratus-vos
1164290001Sglebius	exit ;;
1165290001Sglebius    *:VOS:*:*)
1166290001Sglebius	# From Paul.Green@stratus.com.
1167290001Sglebius	echo hppa1.1-stratus-vos
1168290001Sglebius	exit ;;
1169290001Sglebius    mc68*:A/UX:*:*)
1170290001Sglebius	echo m68k-apple-aux${UNAME_RELEASE}
1171290001Sglebius	exit ;;
1172290001Sglebius    news*:NEWS-OS:6*:*)
1173290001Sglebius	echo mips-sony-newsos6
1174290001Sglebius	exit ;;
1175290001Sglebius    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1176290001Sglebius	if [ -d /usr/nec ]; then
1177290001Sglebius		echo mips-nec-sysv${UNAME_RELEASE}
1178290001Sglebius	else
1179290001Sglebius		echo mips-unknown-sysv${UNAME_RELEASE}
1180290001Sglebius	fi
1181290001Sglebius	exit ;;
1182290001Sglebius    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1183290001Sglebius	echo powerpc-be-beos
1184290001Sglebius	exit ;;
1185290001Sglebius    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1186290001Sglebius	echo powerpc-apple-beos
1187290001Sglebius	exit ;;
1188290001Sglebius    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1189290001Sglebius	echo i586-pc-beos
1190290001Sglebius	exit ;;
1191290001Sglebius    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
1192290001Sglebius	echo i586-pc-haiku
1193290001Sglebius	exit ;;
1194290001Sglebius    SX-4:SUPER-UX:*:*)
1195290001Sglebius	echo sx4-nec-superux${UNAME_RELEASE}
1196290001Sglebius	exit ;;
1197290001Sglebius    SX-5:SUPER-UX:*:*)
1198290001Sglebius	echo sx5-nec-superux${UNAME_RELEASE}
1199290001Sglebius	exit ;;
1200290001Sglebius    SX-6:SUPER-UX:*:*)
1201290001Sglebius	echo sx6-nec-superux${UNAME_RELEASE}
1202290001Sglebius	exit ;;
1203290001Sglebius    SX-7:SUPER-UX:*:*)
1204290001Sglebius	echo sx7-nec-superux${UNAME_RELEASE}
1205290001Sglebius	exit ;;
1206290001Sglebius    SX-8:SUPER-UX:*:*)
1207290001Sglebius	echo sx8-nec-superux${UNAME_RELEASE}
1208290001Sglebius	exit ;;
1209290001Sglebius    SX-8R:SUPER-UX:*:*)
1210290001Sglebius	echo sx8r-nec-superux${UNAME_RELEASE}
1211290001Sglebius	exit ;;
1212290001Sglebius    Power*:Rhapsody:*:*)
1213290001Sglebius	echo powerpc-apple-rhapsody${UNAME_RELEASE}
1214290001Sglebius	exit ;;
1215290001Sglebius    *:Rhapsody:*:*)
1216290001Sglebius	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
1217290001Sglebius	exit ;;
1218290001Sglebius    *:Darwin:*:*)
1219290001Sglebius	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1220290001Sglebius	case $UNAME_PROCESSOR in
1221290001Sglebius	    i386)
1222290001Sglebius		eval $set_cc_for_build
1223290001Sglebius		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
1224290001Sglebius		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1225290001Sglebius		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
1226290001Sglebius		      grep IS_64BIT_ARCH >/dev/null
1227290001Sglebius		  then
1228290001Sglebius		      UNAME_PROCESSOR="x86_64"
1229290001Sglebius		  fi
1230290001Sglebius		fi ;;
1231290001Sglebius	    unknown) UNAME_PROCESSOR=powerpc ;;
1232290001Sglebius	esac
1233290001Sglebius	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
1234290001Sglebius	exit ;;
1235290001Sglebius    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1236290001Sglebius	UNAME_PROCESSOR=`uname -p`
1237290001Sglebius	if test "$UNAME_PROCESSOR" = "x86"; then
1238290001Sglebius		UNAME_PROCESSOR=i386
1239290001Sglebius		UNAME_MACHINE=pc
1240290001Sglebius	fi
1241290001Sglebius	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
1242290001Sglebius	exit ;;
1243290001Sglebius    *:QNX:*:4*)
1244290001Sglebius	echo i386-pc-qnx
1245290001Sglebius	exit ;;
1246290001Sglebius    NEO-?:NONSTOP_KERNEL:*:*)
1247290001Sglebius	echo neo-tandem-nsk${UNAME_RELEASE}
1248290001Sglebius	exit ;;
1249290001Sglebius    NSE-?:NONSTOP_KERNEL:*:*)
1250290001Sglebius	echo nse-tandem-nsk${UNAME_RELEASE}
1251290001Sglebius	exit ;;
1252290001Sglebius    NSR-?:NONSTOP_KERNEL:*:*)
1253290001Sglebius	echo nsr-tandem-nsk${UNAME_RELEASE}
1254290001Sglebius	exit ;;
1255290001Sglebius    *:NonStop-UX:*:*)
1256290001Sglebius	echo mips-compaq-nonstopux
1257290001Sglebius	exit ;;
1258290001Sglebius    BS2000:POSIX*:*:*)
1259290001Sglebius	echo bs2000-siemens-sysv
1260290001Sglebius	exit ;;
1261290001Sglebius    DS/*:UNIX_System_V:*:*)
1262290001Sglebius	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
1263290001Sglebius	exit ;;
1264290001Sglebius    *:Plan9:*:*)
1265290001Sglebius	# "uname -m" is not consistent, so use $cputype instead. 386
1266290001Sglebius	# is converted to i386 for consistency with other x86
1267290001Sglebius	# operating systems.
1268290001Sglebius	if test "$cputype" = "386"; then
1269290001Sglebius	    UNAME_MACHINE=i386
1270290001Sglebius	else
1271290001Sglebius	    UNAME_MACHINE="$cputype"
1272290001Sglebius	fi
1273290001Sglebius	echo ${UNAME_MACHINE}-unknown-plan9
1274290001Sglebius	exit ;;
1275290001Sglebius    *:TOPS-10:*:*)
1276290001Sglebius	echo pdp10-unknown-tops10
1277290001Sglebius	exit ;;
1278290001Sglebius    *:TENEX:*:*)
1279290001Sglebius	echo pdp10-unknown-tenex
1280290001Sglebius	exit ;;
1281290001Sglebius    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1282290001Sglebius	echo pdp10-dec-tops20
1283290001Sglebius	exit ;;
1284290001Sglebius    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1285290001Sglebius	echo pdp10-xkl-tops20
1286290001Sglebius	exit ;;
1287290001Sglebius    *:TOPS-20:*:*)
1288290001Sglebius	echo pdp10-unknown-tops20
1289290001Sglebius	exit ;;
1290290001Sglebius    *:ITS:*:*)
1291290001Sglebius	echo pdp10-unknown-its
1292290001Sglebius	exit ;;
1293290001Sglebius    SEI:*:*:SEIUX)
1294290001Sglebius	echo mips-sei-seiux${UNAME_RELEASE}
1295290001Sglebius	exit ;;
1296290001Sglebius    *:DragonFly:*:*)
1297290001Sglebius	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
1298290001Sglebius	exit ;;
1299290001Sglebius    *:*VMS:*:*)
1300290001Sglebius	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1301290001Sglebius	case "${UNAME_MACHINE}" in
1302290001Sglebius	    A*) echo alpha-dec-vms ; exit ;;
1303290001Sglebius	    I*) echo ia64-dec-vms ; exit ;;
1304290001Sglebius	    V*) echo vax-dec-vms ; exit ;;
1305290001Sglebius	esac ;;
1306290001Sglebius    *:XENIX:*:SysV)
1307290001Sglebius	echo i386-pc-xenix
1308290001Sglebius	exit ;;
1309290001Sglebius    i*86:skyos:*:*)
1310290001Sglebius	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
1311290001Sglebius	exit ;;
1312290001Sglebius    i*86:rdos:*:*)
1313290001Sglebius	echo ${UNAME_MACHINE}-pc-rdos
1314290001Sglebius	exit ;;
1315290001Sglebius    i*86:AROS:*:*)
1316290001Sglebius	echo ${UNAME_MACHINE}-pc-aros
1317290001Sglebius	exit ;;
1318290001Sglebiusesac
1319290001Sglebius
1320290001Sglebius#echo '(No uname command or uname output not recognized.)' 1>&2
1321290001Sglebius#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
1322290001Sglebius
1323290001Sglebiuseval $set_cc_for_build
1324290001Sglebiuscat >$dummy.c <<EOF
1325290001Sglebius#ifdef _SEQUENT_
1326290001Sglebius# include <sys/types.h>
1327290001Sglebius# include <sys/utsname.h>
1328290001Sglebius#endif
1329290001Sglebiusmain ()
1330290001Sglebius{
1331290001Sglebius#if defined (sony)
1332290001Sglebius#if defined (MIPSEB)
1333290001Sglebius  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1334290001Sglebius     I don't know....  */
1335290001Sglebius  printf ("mips-sony-bsd\n"); exit (0);
1336290001Sglebius#else
1337290001Sglebius#include <sys/param.h>
1338290001Sglebius  printf ("m68k-sony-newsos%s\n",
1339290001Sglebius#ifdef NEWSOS4
1340290001Sglebius	"4"
1341290001Sglebius#else
1342290001Sglebius	""
1343290001Sglebius#endif
1344290001Sglebius	); exit (0);
1345290001Sglebius#endif
1346290001Sglebius#endif
1347290001Sglebius
1348290001Sglebius#if defined (__arm) && defined (__acorn) && defined (__unix)
1349290001Sglebius  printf ("arm-acorn-riscix\n"); exit (0);
1350290001Sglebius#endif
1351290001Sglebius
1352290001Sglebius#if defined (hp300) && !defined (hpux)
1353290001Sglebius  printf ("m68k-hp-bsd\n"); exit (0);
1354290001Sglebius#endif
1355290001Sglebius
1356290001Sglebius#if defined (NeXT)
1357290001Sglebius#if !defined (__ARCHITECTURE__)
1358290001Sglebius#define __ARCHITECTURE__ "m68k"
1359290001Sglebius#endif
1360290001Sglebius  int version;
1361290001Sglebius  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1362290001Sglebius  if (version < 4)
1363290001Sglebius    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1364290001Sglebius  else
1365290001Sglebius    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1366290001Sglebius  exit (0);
1367290001Sglebius#endif
1368290001Sglebius
1369290001Sglebius#if defined (MULTIMAX) || defined (n16)
1370290001Sglebius#if defined (UMAXV)
1371290001Sglebius  printf ("ns32k-encore-sysv\n"); exit (0);
1372290001Sglebius#else
1373290001Sglebius#if defined (CMU)
1374290001Sglebius  printf ("ns32k-encore-mach\n"); exit (0);
1375290001Sglebius#else
1376290001Sglebius  printf ("ns32k-encore-bsd\n"); exit (0);
1377290001Sglebius#endif
1378290001Sglebius#endif
1379290001Sglebius#endif
1380290001Sglebius
1381290001Sglebius#if defined (__386BSD__)
1382290001Sglebius  printf ("i386-pc-bsd\n"); exit (0);
1383290001Sglebius#endif
1384290001Sglebius
1385290001Sglebius#if defined (sequent)
1386290001Sglebius#if defined (i386)
1387290001Sglebius  printf ("i386-sequent-dynix\n"); exit (0);
1388290001Sglebius#endif
1389290001Sglebius#if defined (ns32000)
1390290001Sglebius  printf ("ns32k-sequent-dynix\n"); exit (0);
1391290001Sglebius#endif
1392290001Sglebius#endif
1393290001Sglebius
1394290001Sglebius#if defined (_SEQUENT_)
1395290001Sglebius    struct utsname un;
1396290001Sglebius
1397290001Sglebius    uname(&un);
1398290001Sglebius
1399290001Sglebius    if (strncmp(un.version, "V2", 2) == 0) {
1400290001Sglebius	printf ("i386-sequent-ptx2\n"); exit (0);
1401290001Sglebius    }
1402290001Sglebius    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1403290001Sglebius	printf ("i386-sequent-ptx1\n"); exit (0);
1404290001Sglebius    }
1405290001Sglebius    printf ("i386-sequent-ptx\n"); exit (0);
1406290001Sglebius
1407290001Sglebius#endif
1408290001Sglebius
1409290001Sglebius#if defined (vax)
1410290001Sglebius# if !defined (ultrix)
1411290001Sglebius#  include <sys/param.h>
1412290001Sglebius#  if defined (BSD)
1413290001Sglebius#   if BSD == 43
1414290001Sglebius      printf ("vax-dec-bsd4.3\n"); exit (0);
1415290001Sglebius#   else
1416290001Sglebius#    if BSD == 199006
1417290001Sglebius      printf ("vax-dec-bsd4.3reno\n"); exit (0);
1418290001Sglebius#    else
1419290001Sglebius      printf ("vax-dec-bsd\n"); exit (0);
1420290001Sglebius#    endif
1421290001Sglebius#   endif
1422290001Sglebius#  else
1423290001Sglebius    printf ("vax-dec-bsd\n"); exit (0);
1424290001Sglebius#  endif
1425290001Sglebius# else
1426290001Sglebius    printf ("vax-dec-ultrix\n"); exit (0);
1427290001Sglebius# endif
1428290001Sglebius#endif
1429290001Sglebius
1430290001Sglebius#if defined (alliant) && defined (i860)
1431290001Sglebius  printf ("i860-alliant-bsd\n"); exit (0);
1432290001Sglebius#endif
1433290001Sglebius
1434290001Sglebius  exit (1);
1435290001Sglebius}
1436290001SglebiusEOF
1437290001Sglebius
1438290001Sglebius$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
1439290001Sglebius	{ echo "$SYSTEM_NAME"; exit; }
1440290001Sglebius
1441290001Sglebius# Apollos put the system type in the environment.
1442290001Sglebius
1443290001Sglebiustest -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
1444290001Sglebius
1445290001Sglebius# Convex versions that predate uname can use getsysinfo(1)
1446290001Sglebius
1447290001Sglebiusif [ -x /usr/convex/getsysinfo ]
1448290001Sglebiusthen
1449290001Sglebius    case `getsysinfo -f cpu_type` in
1450290001Sglebius    c1*)
1451290001Sglebius	echo c1-convex-bsd
1452290001Sglebius	exit ;;
1453290001Sglebius    c2*)
1454290001Sglebius	if getsysinfo -f scalar_acc
1455290001Sglebius	then echo c32-convex-bsd
1456290001Sglebius	else echo c2-convex-bsd
1457290001Sglebius	fi
1458290001Sglebius	exit ;;
1459290001Sglebius    c34*)
1460290001Sglebius	echo c34-convex-bsd
1461290001Sglebius	exit ;;
1462290001Sglebius    c38*)
1463290001Sglebius	echo c38-convex-bsd
1464290001Sglebius	exit ;;
1465290001Sglebius    c4*)
1466290001Sglebius	echo c4-convex-bsd
1467290001Sglebius	exit ;;
1468290001Sglebius    esac
1469290001Sglebiusfi
1470290001Sglebius
1471290001Sglebiuscat >&2 <<EOF
1472290001Sglebius$0: unable to guess system type
1473290001Sglebius
1474290001SglebiusThis script, last modified $timestamp, has failed to recognize
1475290001Sglebiusthe operating system you are using. It is advised that you
1476290001Sglebiusdownload the most up to date version of the config scripts from
1477290001Sglebius
1478290001Sglebius  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
1479290001Sglebiusand
1480290001Sglebius  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
1481290001Sglebius
1482290001SglebiusIf the version you run ($0) is already up to date, please
1483290001Sglebiussend the following data and any information you think might be
1484290001Sglebiuspertinent to <config-patches@gnu.org> in order to provide the needed
1485290001Sglebiusinformation to handle your system.
1486290001Sglebius
1487290001Sglebiusconfig.guess timestamp = $timestamp
1488290001Sglebius
1489290001Sglebiusuname -m = `(uname -m) 2>/dev/null || echo unknown`
1490290001Sglebiusuname -r = `(uname -r) 2>/dev/null || echo unknown`
1491290001Sglebiusuname -s = `(uname -s) 2>/dev/null || echo unknown`
1492290001Sglebiusuname -v = `(uname -v) 2>/dev/null || echo unknown`
1493290001Sglebius
1494290001Sglebius/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1495290001Sglebius/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1496290001Sglebius
1497290001Sglebiushostinfo               = `(hostinfo) 2>/dev/null`
1498290001Sglebius/bin/universe          = `(/bin/universe) 2>/dev/null`
1499290001Sglebius/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1500290001Sglebius/bin/arch              = `(/bin/arch) 2>/dev/null`
1501290001Sglebius/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1502290001Sglebius/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1503290001Sglebius
1504290001SglebiusUNAME_MACHINE = ${UNAME_MACHINE}
1505290001SglebiusUNAME_RELEASE = ${UNAME_RELEASE}
1506290001SglebiusUNAME_SYSTEM  = ${UNAME_SYSTEM}
1507290001SglebiusUNAME_VERSION = ${UNAME_VERSION}
1508290001SglebiusEOF
1509290001Sglebius
1510290001Sglebiusexit 1
1511290001Sglebius
1512290001Sglebius# Local variables:
1513290001Sglebius# eval: (add-hook 'write-file-hooks 'time-stamp)
1514290001Sglebius# time-stamp-start: "timestamp='"
1515290001Sglebius# time-stamp-format: "%:y-%02m-%02d"
1516290001Sglebius# time-stamp-end: "'"
1517290001Sglebius# End:
1518