133965Sjdp#! /bin/sh
233965Sjdp# Attempt to guess a canonical system name.
389857Sobrien#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4218822Sdim#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
5218822Sdim#   Inc.
668765Sobrien
7218822Sdimtimestamp='2007-05-17'
868765Sobrien
933965Sjdp# This file is free software; you can redistribute it and/or modify it
1033965Sjdp# under the terms of the GNU General Public License as published by
1133965Sjdp# the Free Software Foundation; either version 2 of the License, or
1233965Sjdp# (at your option) any later version.
1333965Sjdp#
1433965Sjdp# This program is distributed in the hope that it will be useful, but
1533965Sjdp# WITHOUT ANY WARRANTY; without even the implied warranty of
1633965Sjdp# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1733965Sjdp# General Public License for more details.
1833965Sjdp#
1933965Sjdp# You should have received a copy of the GNU General Public License
2033965Sjdp# along with this program; if not, write to the Free Software
21218822Sdim# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
22218822Sdim# 02110-1301, USA.
2333965Sjdp#
2433965Sjdp# As a special exception to the GNU General Public License, if you
2533965Sjdp# distribute this file as part of a program that contains a
2633965Sjdp# configuration script generated by Autoconf, you may include it under
2733965Sjdp# the same distribution terms that you use for the rest of that program.
2833965Sjdp
29218822Sdim
3089857Sobrien# Originally written by Per Bothner <per@bothner.com>.
3189857Sobrien# Please send patches to <config-patches@gnu.org>.  Submit a context
3289857Sobrien# diff and a properly formatted ChangeLog entry.
3333965Sjdp#
3433965Sjdp# This script attempts to guess a canonical system name similar to
3533965Sjdp# config.sub.  If it succeeds, it prints the system name on stdout, and
3633965Sjdp# exits with 0.  Otherwise, it exits with 1.
3733965Sjdp#
3833965Sjdp# The plan is that this can be called by configure scripts if you
3977298Sobrien# don't specify an explicit build system type.
4033965Sjdp
4168765Sobrienme=`echo "$0" | sed -e 's,.*/,,'`
4268765Sobrien
4368765Sobrienusage="\
4468765SobrienUsage: $0 [OPTION]
4568765Sobrien
4677298SobrienOutput the configuration name of the system \`$me' is run on.
4768765Sobrien
4868765SobrienOperation modes:
4977298Sobrien  -h, --help         print this help, then exit
5077298Sobrien  -t, --time-stamp   print date of last modification, then exit
5177298Sobrien  -v, --version      print version number, then exit
5268765Sobrien
5377298SobrienReport bugs and patches to <config-patches@gnu.org>."
5477298Sobrien
5577298Sobrienversion="\
5677298SobrienGNU config.guess ($timestamp)
5777298Sobrien
5877298SobrienOriginally written by Per Bothner.
59218822SdimCopyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
6077298SobrienFree Software Foundation, Inc.
6177298Sobrien
6277298SobrienThis is free software; see the source for copying conditions.  There is NO
6377298Sobrienwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
6477298Sobrien
6568765Sobrienhelp="
6668765SobrienTry \`$me --help' for more information."
6768765Sobrien
6868765Sobrien# Parse command line
6968765Sobrienwhile test $# -gt 0 ; do
7077298Sobrien  case $1 in
7177298Sobrien    --time-stamp | --time* | -t )
72218822Sdim       echo "$timestamp" ; exit ;;
7377298Sobrien    --version | -v )
74218822Sdim       echo "$version" ; exit ;;
7568765Sobrien    --help | --h* | -h )
76218822Sdim       echo "$usage"; exit ;;
7768765Sobrien    -- )     # Stop option processing
7868765Sobrien       shift; break ;;
7968765Sobrien    - )	# Use stdin as input.
8068765Sobrien       break ;;
8168765Sobrien    -* )
8277298Sobrien       echo "$me: invalid option $1$help" >&2
8368765Sobrien       exit 1 ;;
8468765Sobrien    * )
8568765Sobrien       break ;;
8668765Sobrien  esac
8768765Sobriendone
8868765Sobrien
8968765Sobrienif test $# != 0; then
9068765Sobrien  echo "$me: too many arguments$help" >&2
9168765Sobrien  exit 1
9268765Sobrienfi
9368765Sobrien
94130561Sobrientrap 'exit 1' 1 2 15
9560484Sobrien
96130561Sobrien# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
97130561Sobrien# compiler to aid in system detection is discouraged as it requires
98130561Sobrien# temporary files to be created and, as you can see below, it is a
99130561Sobrien# headache to deal with in a portable fashion.
10060484Sobrien
10177298Sobrien# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
10277298Sobrien# use `HOST_CC' if defined, but it is deprecated.
10377298Sobrien
104130561Sobrien# Portable tmp directory creation inspired by the Autoconf team.
105130561Sobrien
106130561Sobrienset_cc_for_build='
107130561Sobrientrap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
108130561Sobrientrap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
109130561Sobrien: ${TMPDIR=/tmp} ;
110218822Sdim { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
111130561Sobrien { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
112130561Sobrien { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
113130561Sobrien { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
114130561Sobriendummy=$tmp/dummy ;
115130561Sobrientmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
116130561Sobriencase $CC_FOR_BUILD,$HOST_CC,$CC in
117130561Sobrien ,,)    echo "int x;" > $dummy.c ;
118104834Sobrien	for c in cc gcc c89 c99 ; do
119130561Sobrien	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
12089857Sobrien	     CC_FOR_BUILD="$c"; break ;
12189857Sobrien	  fi ;
12289857Sobrien	done ;
12377298Sobrien	if test x"$CC_FOR_BUILD" = x ; then
12489857Sobrien	  CC_FOR_BUILD=no_compiler_found ;
12577298Sobrien	fi
12677298Sobrien	;;
12777298Sobrien ,,*)   CC_FOR_BUILD=$CC ;;
12877298Sobrien ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
129218822Sdimesac ; set_cc_for_build= ;'
13077298Sobrien
13133965Sjdp# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
13289857Sobrien# (ghazi@noc.rutgers.edu 1994-08-24)
13333965Sjdpif (test -f /.attbin/uname) >/dev/null 2>&1 ; then
13433965Sjdp	PATH=$PATH:/.attbin ; export PATH
13533965Sjdpfi
13633965Sjdp
13733965SjdpUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
13833965SjdpUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
13977298SobrienUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
14033965SjdpUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
14133965Sjdp
14233965Sjdp# Note: order is significant - the case branches are not exclusive.
14333965Sjdp
14433965Sjdpcase "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
14560484Sobrien    *:NetBSD:*:*)
14689857Sobrien	# NetBSD (nbsd) targets should (where applicable) match one or
14760484Sobrien	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
14860484Sobrien	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
14960484Sobrien	# switched to ELF, *-*-netbsd* would select the old
15060484Sobrien	# object file format.  This provides both forward
15160484Sobrien	# compatibility and a consistent mechanism for selecting the
15260484Sobrien	# object file format.
15389857Sobrien	#
15489857Sobrien	# Note: NetBSD doesn't particularly care about the vendor
15589857Sobrien	# portion of the name.  We always set it to "unknown".
156104834Sobrien	sysctl="sysctl -n hw.machine_arch"
157104834Sobrien	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
158104834Sobrien	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
15989857Sobrien	case "${UNAME_MACHINE_ARCH}" in
160104834Sobrien	    armeb) machine=armeb-unknown ;;
16189857Sobrien	    arm*) machine=arm-unknown ;;
16289857Sobrien	    sh3el) machine=shl-unknown ;;
16389857Sobrien	    sh3eb) machine=sh-unknown ;;
164218822Sdim	    sh5el) machine=sh5le-unknown ;;
16589857Sobrien	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
16660484Sobrien	esac
16777298Sobrien	# The Operating System including object format, if it has switched
16877298Sobrien	# to ELF recently, or will in the future.
16989857Sobrien	case "${UNAME_MACHINE_ARCH}" in
17089857Sobrien	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
17189857Sobrien		eval $set_cc_for_build
17277298Sobrien		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
17377298Sobrien			| grep __ELF__ >/dev/null
17477298Sobrien		then
17577298Sobrien		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
17677298Sobrien		    # Return netbsd for either.  FIX?
17777298Sobrien		    os=netbsd
17877298Sobrien		else
17977298Sobrien		    os=netbsdelf
18077298Sobrien		fi
18177298Sobrien		;;
18277298Sobrien	    *)
18377298Sobrien	        os=netbsd
18477298Sobrien		;;
18577298Sobrien	esac
18660484Sobrien	# The OS release
187130561Sobrien	# Debian GNU/NetBSD machines have a different userland, and
188130561Sobrien	# thus, need a distinct triplet. However, they do not need
189130561Sobrien	# kernel version information, so it can be replaced with a
190130561Sobrien	# suitable tag, in the style of linux-gnu.
191130561Sobrien	case "${UNAME_VERSION}" in
192130561Sobrien	    Debian*)
193130561Sobrien		release='-gnu'
194130561Sobrien		;;
195130561Sobrien	    *)
196130561Sobrien		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
197130561Sobrien		;;
198130561Sobrien	esac
19960484Sobrien	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
20060484Sobrien	# contains redundant information, the shorter form:
20160484Sobrien	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
20260484Sobrien	echo "${machine}-${os}${release}"
203218822Sdim	exit ;;
20489857Sobrien    *:OpenBSD:*:*)
205218822Sdim	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
206218822Sdim	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
207218822Sdim	exit ;;
208130561Sobrien    *:ekkoBSD:*:*)
209130561Sobrien	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
210218822Sdim	exit ;;
211218822Sdim    *:SolidBSD:*:*)
212218822Sdim	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
213218822Sdim	exit ;;
214130561Sobrien    macppc:MirBSD:*:*)
215218822Sdim	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
216218822Sdim	exit ;;
217130561Sobrien    *:MirBSD:*:*)
218130561Sobrien	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
219218822Sdim	exit ;;
22033965Sjdp    alpha:OSF1:*:*)
221218822Sdim	case $UNAME_RELEASE in
222218822Sdim	*4.0)
22338889Sjdp		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
224218822Sdim		;;
225218822Sdim	*5.*)
226218822Sdim	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
227218822Sdim		;;
228218822Sdim	esac
229130561Sobrien	# According to Compaq, /usr/sbin/psrinfo has been available on
230130561Sobrien	# OSF/1 and Tru64 systems produced since 1995.  I hope that
231130561Sobrien	# covers most systems running today.  This code pipes the CPU
232130561Sobrien	# types through head -n 1, so we only detect the type of CPU 0.
233130561Sobrien	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
234130561Sobrien	case "$ALPHA_CPU_TYPE" in
235130561Sobrien	    "EV4 (21064)")
236130561Sobrien		UNAME_MACHINE="alpha" ;;
237130561Sobrien	    "EV4.5 (21064)")
238130561Sobrien		UNAME_MACHINE="alpha" ;;
239130561Sobrien	    "LCA4 (21066/21068)")
240130561Sobrien		UNAME_MACHINE="alpha" ;;
241130561Sobrien	    "EV5 (21164)")
242130561Sobrien		UNAME_MACHINE="alphaev5" ;;
243130561Sobrien	    "EV5.6 (21164A)")
244130561Sobrien		UNAME_MACHINE="alphaev56" ;;
245130561Sobrien	    "EV5.6 (21164PC)")
246130561Sobrien		UNAME_MACHINE="alphapca56" ;;
247130561Sobrien	    "EV5.7 (21164PC)")
248130561Sobrien		UNAME_MACHINE="alphapca57" ;;
249130561Sobrien	    "EV6 (21264)")
250130561Sobrien		UNAME_MACHINE="alphaev6" ;;
251130561Sobrien	    "EV6.7 (21264A)")
252130561Sobrien		UNAME_MACHINE="alphaev67" ;;
253130561Sobrien	    "EV6.8CB (21264C)")
254130561Sobrien		UNAME_MACHINE="alphaev68" ;;
255130561Sobrien	    "EV6.8AL (21264B)")
256130561Sobrien		UNAME_MACHINE="alphaev68" ;;
257130561Sobrien	    "EV6.8CX (21264D)")
258130561Sobrien		UNAME_MACHINE="alphaev68" ;;
259130561Sobrien	    "EV6.9A (21264/EV69A)")
260130561Sobrien		UNAME_MACHINE="alphaev69" ;;
261130561Sobrien	    "EV7 (21364)")
262130561Sobrien		UNAME_MACHINE="alphaev7" ;;
263130561Sobrien	    "EV7.9 (21364A)")
264130561Sobrien		UNAME_MACHINE="alphaev79" ;;
265130561Sobrien	esac
266218822Sdim	# A Pn.n version is a patched version.
26733965Sjdp	# A Vn.n version is a released version.
26833965Sjdp	# A Tn.n version is a released field test version.
26933965Sjdp	# A Xn.n version is an unreleased experimental baselevel.
27033965Sjdp	# 1.2 uses "1.2" for uname -r.
271218822Sdim	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
272218822Sdim	exit ;;
27360484Sobrien    Alpha\ *:Windows_NT*:*)
27460484Sobrien	# How do we know it's Interix rather than the generic POSIX subsystem?
27560484Sobrien	# Should we change UNAME_MACHINE based on the output of uname instead
27660484Sobrien	# of the specific Alpha model?
27760484Sobrien	echo alpha-pc-interix
278218822Sdim	exit ;;
27933965Sjdp    21064:Windows_NT:50:3)
28033965Sjdp	echo alpha-dec-winnt3.5
281218822Sdim	exit ;;
28233965Sjdp    Amiga*:UNIX_System_V:4.0:*)
28368765Sobrien	echo m68k-unknown-sysv4
284218822Sdim	exit ;;
28560484Sobrien    *:[Aa]miga[Oo][Ss]:*:*)
28660484Sobrien	echo ${UNAME_MACHINE}-unknown-amigaos
287218822Sdim	exit ;;
28889857Sobrien    *:[Mm]orph[Oo][Ss]:*:*)
28989857Sobrien	echo ${UNAME_MACHINE}-unknown-morphos
290218822Sdim	exit ;;
29160484Sobrien    *:OS/390:*:*)
29260484Sobrien	echo i370-ibm-openedition
293218822Sdim	exit ;;
294218822Sdim    *:z/VM:*:*)
295218822Sdim	echo s390-ibm-zvmoe
296218822Sdim	exit ;;
297130561Sobrien    *:OS400:*:*)
298130561Sobrien        echo powerpc-ibm-os400
299218822Sdim	exit ;;
30033965Sjdp    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
30133965Sjdp	echo arm-acorn-riscix${UNAME_RELEASE}
302218822Sdim	exit ;;
303218822Sdim    arm:riscos:*:*|arm:RISCOS:*:*)
304218822Sdim	echo arm-unknown-riscos
305218822Sdim	exit ;;
30677298Sobrien    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
30733965Sjdp	echo hppa1.1-hitachi-hiuxmpp
308218822Sdim	exit ;;
30960484Sobrien    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
31033965Sjdp	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
31133965Sjdp	if test "`(/bin/universe) 2>/dev/null`" = att ; then
31233965Sjdp		echo pyramid-pyramid-sysv3
31333965Sjdp	else
31433965Sjdp		echo pyramid-pyramid-bsd
31533965Sjdp	fi
316218822Sdim	exit ;;
31760484Sobrien    NILE*:*:*:dcosx)
31833965Sjdp	echo pyramid-pyramid-svr4
319218822Sdim	exit ;;
320130561Sobrien    DRS?6000:unix:4.0:6*)
321130561Sobrien	echo sparc-icl-nx6
322218822Sdim	exit ;;
323218822Sdim    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
324130561Sobrien	case `/usr/bin/uname -p` in
325218822Sdim	    sparc) echo sparc-icl-nx7; exit ;;
326130561Sobrien	esac ;;
32760484Sobrien    sun4H:SunOS:5.*:*)
32860484Sobrien	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
329218822Sdim	exit ;;
33033965Sjdp    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
33133965Sjdp	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
332218822Sdim	exit ;;
333218822Sdim    i86pc:SunOS:5.*:* | ix86xen:SunOS:5.*:*)
33433965Sjdp	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
335218822Sdim	exit ;;
33633965Sjdp    sun4*:SunOS:6*:*)
33733965Sjdp	# According to config.sub, this is the proper way to canonicalize
33833965Sjdp	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
33933965Sjdp	# it's likely to be more like Solaris than SunOS4.
34033965Sjdp	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
341218822Sdim	exit ;;
34233965Sjdp    sun4*:SunOS:*:*)
34333965Sjdp	case "`/usr/bin/arch -k`" in
34433965Sjdp	    Series*|S4*)
34533965Sjdp		UNAME_RELEASE=`uname -v`
34633965Sjdp		;;
34733965Sjdp	esac
34833965Sjdp	# Japanese Language versions have a version number like `4.1.3-JL'.
34933965Sjdp	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
350218822Sdim	exit ;;
35133965Sjdp    sun3*:SunOS:*:*)
35233965Sjdp	echo m68k-sun-sunos${UNAME_RELEASE}
353218822Sdim	exit ;;
35438889Sjdp    sun*:*:4.2BSD:*)
35592828Sobrien	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
35638889Sjdp	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
35738889Sjdp	case "`/bin/arch`" in
35838889Sjdp	    sun3)
35938889Sjdp		echo m68k-sun-sunos${UNAME_RELEASE}
36038889Sjdp		;;
36138889Sjdp	    sun4)
36238889Sjdp		echo sparc-sun-sunos${UNAME_RELEASE}
36338889Sjdp		;;
36438889Sjdp	esac
365218822Sdim	exit ;;
36633965Sjdp    aushp:SunOS:*:*)
36733965Sjdp	echo sparc-auspex-sunos${UNAME_RELEASE}
368218822Sdim	exit ;;
36960484Sobrien    # The situation for MiNT is a little confusing.  The machine name
37060484Sobrien    # can be virtually everything (everything which is not
37168765Sobrien    # "atarist" or "atariste" at least should have a processor
37260484Sobrien    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
37360484Sobrien    # to the lowercase version "mint" (or "freemint").  Finally
37460484Sobrien    # the system name "TOS" denotes a system which is actually not
37560484Sobrien    # MiNT.  But MiNT is downward compatible to TOS, so this should
37660484Sobrien    # be no problem.
37760484Sobrien    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
37860484Sobrien        echo m68k-atari-mint${UNAME_RELEASE}
379218822Sdim	exit ;;
38060484Sobrien    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
38160484Sobrien	echo m68k-atari-mint${UNAME_RELEASE}
382218822Sdim        exit ;;
38360484Sobrien    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
38460484Sobrien        echo m68k-atari-mint${UNAME_RELEASE}
385218822Sdim	exit ;;
38660484Sobrien    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
38760484Sobrien        echo m68k-milan-mint${UNAME_RELEASE}
388218822Sdim        exit ;;
38960484Sobrien    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
39060484Sobrien        echo m68k-hades-mint${UNAME_RELEASE}
391218822Sdim        exit ;;
39260484Sobrien    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
39360484Sobrien        echo m68k-unknown-mint${UNAME_RELEASE}
394218822Sdim        exit ;;
395130561Sobrien    m68k:machten:*:*)
396130561Sobrien	echo m68k-apple-machten${UNAME_RELEASE}
397218822Sdim	exit ;;
39833965Sjdp    powerpc:machten:*:*)
39933965Sjdp	echo powerpc-apple-machten${UNAME_RELEASE}
400218822Sdim	exit ;;
40133965Sjdp    RISC*:Mach:*:*)
40233965Sjdp	echo mips-dec-mach_bsd4.3
403218822Sdim	exit ;;
40433965Sjdp    RISC*:ULTRIX:*:*)
40533965Sjdp	echo mips-dec-ultrix${UNAME_RELEASE}
406218822Sdim	exit ;;
40733965Sjdp    VAX*:ULTRIX*:*:*)
40833965Sjdp	echo vax-dec-ultrix${UNAME_RELEASE}
409218822Sdim	exit ;;
41060484Sobrien    2020:CLIX:*:* | 2430:CLIX:*:*)
41138889Sjdp	echo clipper-intergraph-clix${UNAME_RELEASE}
412218822Sdim	exit ;;
41333965Sjdp    mips:*:*:UMIPS | mips:*:*:RISCos)
41489857Sobrien	eval $set_cc_for_build
41560484Sobrien	sed 's/^	//' << EOF >$dummy.c
41660484Sobrien#ifdef __cplusplus
41760484Sobrien#include <stdio.h>  /* for printf() prototype */
41860484Sobrien	int main (int argc, char *argv[]) {
41960484Sobrien#else
42060484Sobrien	int main (argc, argv) int argc; char *argv[]; {
42160484Sobrien#endif
42233965Sjdp	#if defined (host_mips) && defined (MIPSEB)
42333965Sjdp	#if defined (SYSTYPE_SYSV)
42433965Sjdp	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
42533965Sjdp	#endif
42633965Sjdp	#if defined (SYSTYPE_SVR4)
42733965Sjdp	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
42833965Sjdp	#endif
42933965Sjdp	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
43033965Sjdp	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
43133965Sjdp	#endif
43233965Sjdp	#endif
43333965Sjdp	  exit (-1);
43433965Sjdp	}
43533965SjdpEOF
436218822Sdim	$CC_FOR_BUILD -o $dummy $dummy.c &&
437218822Sdim	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
438218822Sdim	  SYSTEM_NAME=`$dummy $dummyarg` &&
439218822Sdim	    { echo "$SYSTEM_NAME"; exit; }
44033965Sjdp	echo mips-mips-riscos${UNAME_RELEASE}
441218822Sdim	exit ;;
44289857Sobrien    Motorola:PowerMAX_OS:*:*)
44389857Sobrien	echo powerpc-motorola-powermax
444218822Sdim	exit ;;
445130561Sobrien    Motorola:*:4.3:PL8-*)
446104834Sobrien	echo powerpc-harris-powermax
447218822Sdim	exit ;;
448130561Sobrien    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
449130561Sobrien	echo powerpc-harris-powermax
450218822Sdim	exit ;;
45133965Sjdp    Night_Hawk:Power_UNIX:*:*)
45233965Sjdp	echo powerpc-harris-powerunix
453218822Sdim	exit ;;
45433965Sjdp    m88k:CX/UX:7*:*)
45533965Sjdp	echo m88k-harris-cxux7
456218822Sdim	exit ;;
45733965Sjdp    m88k:*:4*:R4*)
45833965Sjdp	echo m88k-motorola-sysv4
459218822Sdim	exit ;;
46033965Sjdp    m88k:*:3*:R3*)
46133965Sjdp	echo m88k-motorola-sysv3
462218822Sdim	exit ;;
46333965Sjdp    AViiON:dgux:*:*)
46433965Sjdp        # DG/UX returns AViiON for all architectures
46533965Sjdp        UNAME_PROCESSOR=`/usr/bin/uname -p`
46668765Sobrien	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
46760484Sobrien	then
46860484Sobrien	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
46960484Sobrien	       [ ${TARGET_BINARY_INTERFACE}x = x ]
47060484Sobrien	    then
47133965Sjdp		echo m88k-dg-dgux${UNAME_RELEASE}
47260484Sobrien	    else
47360484Sobrien		echo m88k-dg-dguxbcs${UNAME_RELEASE}
47460484Sobrien	    fi
47533965Sjdp	else
47660484Sobrien	    echo i586-dg-dgux${UNAME_RELEASE}
47733965Sjdp	fi
478218822Sdim 	exit ;;
47933965Sjdp    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
48033965Sjdp	echo m88k-dolphin-sysv3
481218822Sdim	exit ;;
48233965Sjdp    M88*:*:R3*:*)
48333965Sjdp	# Delta 88k system running SVR3
48433965Sjdp	echo m88k-motorola-sysv3
485218822Sdim	exit ;;
48633965Sjdp    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
48733965Sjdp	echo m88k-tektronix-sysv3
488218822Sdim	exit ;;
48933965Sjdp    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
49033965Sjdp	echo m68k-tektronix-bsd
491218822Sdim	exit ;;
49233965Sjdp    *:IRIX*:*:*)
49333965Sjdp	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
494218822Sdim	exit ;;
49533965Sjdp    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
496218822Sdim	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
497218822Sdim	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
49889857Sobrien    i*86:AIX:*:*)
49933965Sjdp	echo i386-ibm-aix
500218822Sdim	exit ;;
50177298Sobrien    ia64:AIX:*:*)
50277298Sobrien	if [ -x /usr/bin/oslevel ] ; then
50377298Sobrien		IBM_REV=`/usr/bin/oslevel`
50477298Sobrien	else
50577298Sobrien		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
50677298Sobrien	fi
50777298Sobrien	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
508218822Sdim	exit ;;
50933965Sjdp    *:AIX:2:3)
51033965Sjdp	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
51189857Sobrien		eval $set_cc_for_build
51260484Sobrien		sed 's/^		//' << EOF >$dummy.c
51333965Sjdp		#include <sys/systemcfg.h>
51433965Sjdp
51533965Sjdp		main()
51633965Sjdp			{
51733965Sjdp			if (!__power_pc())
51833965Sjdp				exit(1);
51933965Sjdp			puts("powerpc-ibm-aix3.2.5");
52033965Sjdp			exit(0);
52133965Sjdp			}
52233965SjdpEOF
523218822Sdim		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
524218822Sdim		then
525218822Sdim			echo "$SYSTEM_NAME"
526218822Sdim		else
527218822Sdim			echo rs6000-ibm-aix3.2.5
528218822Sdim		fi
52933965Sjdp	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
53033965Sjdp		echo rs6000-ibm-aix3.2.4
53133965Sjdp	else
53233965Sjdp		echo rs6000-ibm-aix3.2
53333965Sjdp	fi
534218822Sdim	exit ;;
53577298Sobrien    *:AIX:*:[45])
53692828Sobrien	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
53777298Sobrien	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
53833965Sjdp		IBM_ARCH=rs6000
53933965Sjdp	else
54033965Sjdp		IBM_ARCH=powerpc
54133965Sjdp	fi
54233965Sjdp	if [ -x /usr/bin/oslevel ] ; then
54333965Sjdp		IBM_REV=`/usr/bin/oslevel`
54433965Sjdp	else
54577298Sobrien		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
54633965Sjdp	fi
54733965Sjdp	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
548218822Sdim	exit ;;
54933965Sjdp    *:AIX:*:*)
55033965Sjdp	echo rs6000-ibm-aix
551218822Sdim	exit ;;
55233965Sjdp    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
55333965Sjdp	echo romp-ibm-bsd4.4
554218822Sdim	exit ;;
55560484Sobrien    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
55633965Sjdp	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
557218822Sdim	exit ;;                             # report: romp-ibm BSD 4.3
55833965Sjdp    *:BOSX:*:*)
55933965Sjdp	echo rs6000-bull-bosx
560218822Sdim	exit ;;
56133965Sjdp    DPX/2?00:B.O.S.:*:*)
56233965Sjdp	echo m68k-bull-sysv3
563218822Sdim	exit ;;
56433965Sjdp    9000/[34]??:4.3bsd:1.*:*)
56533965Sjdp	echo m68k-hp-bsd
566218822Sdim	exit ;;
56733965Sjdp    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
56833965Sjdp	echo m68k-hp-bsd4.4
569218822Sdim	exit ;;
57060484Sobrien    9000/[34678]??:HP-UX:*:*)
57177298Sobrien	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
57233965Sjdp	case "${UNAME_MACHINE}" in
57333965Sjdp	    9000/31? )            HP_ARCH=m68000 ;;
57433965Sjdp	    9000/[34]?? )         HP_ARCH=m68k ;;
57560484Sobrien	    9000/[678][0-9][0-9])
57689857Sobrien		if [ -x /usr/bin/getconf ]; then
57789857Sobrien		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
57877298Sobrien                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
57977298Sobrien                    case "${sc_cpu_version}" in
58077298Sobrien                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
58177298Sobrien                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
58277298Sobrien                      532)                      # CPU_PA_RISC2_0
58377298Sobrien                        case "${sc_kernel_bits}" in
58477298Sobrien                          32) HP_ARCH="hppa2.0n" ;;
58577298Sobrien                          64) HP_ARCH="hppa2.0w" ;;
58689857Sobrien			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
58777298Sobrien                        esac ;;
58877298Sobrien                    esac
58989857Sobrien		fi
59089857Sobrien		if [ "${HP_ARCH}" = "" ]; then
59189857Sobrien		    eval $set_cc_for_build
59289857Sobrien		    sed 's/^              //' << EOF >$dummy.c
59368765Sobrien
59468765Sobrien              #define _HPUX_SOURCE
59560484Sobrien              #include <stdlib.h>
59660484Sobrien              #include <unistd.h>
59760484Sobrien
59860484Sobrien              int main ()
59960484Sobrien              {
60060484Sobrien              #if defined(_SC_KERNEL_BITS)
60160484Sobrien                  long bits = sysconf(_SC_KERNEL_BITS);
60260484Sobrien              #endif
60360484Sobrien                  long cpu  = sysconf (_SC_CPU_VERSION);
60460484Sobrien
60560484Sobrien                  switch (cpu)
60660484Sobrien              	{
60760484Sobrien              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
60860484Sobrien              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
60960484Sobrien              	case CPU_PA_RISC2_0:
61060484Sobrien              #if defined(_SC_KERNEL_BITS)
61160484Sobrien              	    switch (bits)
61260484Sobrien              		{
61360484Sobrien              		case 64: puts ("hppa2.0w"); break;
61460484Sobrien              		case 32: puts ("hppa2.0n"); break;
61560484Sobrien              		default: puts ("hppa2.0"); break;
61660484Sobrien              		} break;
61760484Sobrien              #else  /* !defined(_SC_KERNEL_BITS) */
61860484Sobrien              	    puts ("hppa2.0"); break;
61960484Sobrien              #endif
62060484Sobrien              	default: puts ("hppa1.0"); break;
62160484Sobrien              	}
62260484Sobrien                  exit (0);
62360484Sobrien              }
62460484SobrienEOF
625130561Sobrien		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
626130561Sobrien		    test -z "$HP_ARCH" && HP_ARCH=hppa
62789857Sobrien		fi ;;
62833965Sjdp	esac
629130561Sobrien	if [ ${HP_ARCH} = "hppa2.0w" ]
630130561Sobrien	then
631218822Sdim	    eval $set_cc_for_build
632218822Sdim
633218822Sdim	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
634218822Sdim	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
635218822Sdim	    # generating 64-bit code.  GNU and HP use different nomenclature:
636218822Sdim	    #
637218822Sdim	    # $ CC_FOR_BUILD=cc ./config.guess
638218822Sdim	    # => hppa2.0w-hp-hpux11.23
639218822Sdim	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
640218822Sdim	    # => hppa64-hp-hpux11.23
641218822Sdim
642218822Sdim	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
643218822Sdim		grep __LP64__ >/dev/null
644130561Sobrien	    then
645130561Sobrien		HP_ARCH="hppa2.0w"
646130561Sobrien	    else
647130561Sobrien		HP_ARCH="hppa64"
648130561Sobrien	    fi
649130561Sobrien	fi
65033965Sjdp	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
651218822Sdim	exit ;;
65277298Sobrien    ia64:HP-UX:*:*)
65377298Sobrien	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
65477298Sobrien	echo ia64-hp-hpux${HPUX_REV}
655218822Sdim	exit ;;
65633965Sjdp    3050*:HI-UX:*:*)
65789857Sobrien	eval $set_cc_for_build
65860484Sobrien	sed 's/^	//' << EOF >$dummy.c
65933965Sjdp	#include <unistd.h>
66033965Sjdp	int
66133965Sjdp	main ()
66233965Sjdp	{
66333965Sjdp	  long cpu = sysconf (_SC_CPU_VERSION);
66433965Sjdp	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
66533965Sjdp	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
66633965Sjdp	     results, however.  */
66733965Sjdp	  if (CPU_IS_PA_RISC (cpu))
66833965Sjdp	    {
66933965Sjdp	      switch (cpu)
67033965Sjdp		{
67133965Sjdp		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
67233965Sjdp		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
67333965Sjdp		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
67433965Sjdp		  default: puts ("hppa-hitachi-hiuxwe2"); break;
67533965Sjdp		}
67633965Sjdp	    }
67733965Sjdp	  else if (CPU_IS_HP_MC68K (cpu))
67833965Sjdp	    puts ("m68k-hitachi-hiuxwe2");
67933965Sjdp	  else puts ("unknown-hitachi-hiuxwe2");
68033965Sjdp	  exit (0);
68133965Sjdp	}
68233965SjdpEOF
683218822Sdim	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
684218822Sdim		{ echo "$SYSTEM_NAME"; exit; }
68533965Sjdp	echo unknown-hitachi-hiuxwe2
686218822Sdim	exit ;;
68733965Sjdp    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
68833965Sjdp	echo hppa1.1-hp-bsd
689218822Sdim	exit ;;
69033965Sjdp    9000/8??:4.3bsd:*:*)
69133965Sjdp	echo hppa1.0-hp-bsd
692218822Sdim	exit ;;
69389857Sobrien    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
69460484Sobrien	echo hppa1.0-hp-mpeix
695218822Sdim	exit ;;
69633965Sjdp    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
69733965Sjdp	echo hppa1.1-hp-osf
698218822Sdim	exit ;;
69933965Sjdp    hp8??:OSF1:*:*)
70033965Sjdp	echo hppa1.0-hp-osf
701218822Sdim	exit ;;
70289857Sobrien    i*86:OSF1:*:*)
70333965Sjdp	if [ -x /usr/sbin/sysversion ] ; then
70433965Sjdp	    echo ${UNAME_MACHINE}-unknown-osf1mk
70533965Sjdp	else
70633965Sjdp	    echo ${UNAME_MACHINE}-unknown-osf1
70733965Sjdp	fi
708218822Sdim	exit ;;
70933965Sjdp    parisc*:Lites*:*:*)
71033965Sjdp	echo hppa1.1-hp-lites
711218822Sdim	exit ;;
71233965Sjdp    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
71333965Sjdp	echo c1-convex-bsd
714218822Sdim        exit ;;
71533965Sjdp    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
71633965Sjdp	if getsysinfo -f scalar_acc
71733965Sjdp	then echo c32-convex-bsd
71833965Sjdp	else echo c2-convex-bsd
71933965Sjdp	fi
720218822Sdim        exit ;;
72133965Sjdp    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
72233965Sjdp	echo c34-convex-bsd
723218822Sdim        exit ;;
72433965Sjdp    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
72533965Sjdp	echo c38-convex-bsd
726218822Sdim        exit ;;
72733965Sjdp    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
72833965Sjdp	echo c4-convex-bsd
729218822Sdim        exit ;;
73033965Sjdp    CRAY*Y-MP:*:*:*)
73189857Sobrien	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
732218822Sdim	exit ;;
73333965Sjdp    CRAY*[A-Z]90:*:*:*)
73433965Sjdp	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
73533965Sjdp	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
73689857Sobrien	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
73789857Sobrien	      -e 's/\.[^.]*$/.X/'
738218822Sdim	exit ;;
73933965Sjdp    CRAY*TS:*:*:*)
74060484Sobrien	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
741218822Sdim	exit ;;
74277298Sobrien    CRAY*T3E:*:*:*)
74377298Sobrien	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
744218822Sdim	exit ;;
74560484Sobrien    CRAY*SV1:*:*:*)
74668765Sobrien	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
747218822Sdim	exit ;;
748130561Sobrien    *:UNICOS/mp:*:*)
749218822Sdim	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
750218822Sdim	exit ;;
75177298Sobrien    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
75277298Sobrien	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
75360484Sobrien        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
75433965Sjdp        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
75577298Sobrien        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
756218822Sdim        exit ;;
757130561Sobrien    5000:UNIX_System_V:4.*:*)
758130561Sobrien        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
759130561Sobrien        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
760130561Sobrien        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
761218822Sdim	exit ;;
76289857Sobrien    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
76333965Sjdp	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
764218822Sdim	exit ;;
76560484Sobrien    sparc*:BSD/OS:*:*)
76660484Sobrien	echo sparc-unknown-bsdi${UNAME_RELEASE}
767218822Sdim	exit ;;
76860484Sobrien    *:BSD/OS:*:*)
76960484Sobrien	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
770218822Sdim	exit ;;
77133965Sjdp    *:FreeBSD:*:*)
772218822Sdim	case ${UNAME_MACHINE} in
773218822Sdim	    pc98)
774218822Sdim		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
775218822Sdim	    amd64)
776218822Sdim		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
777218822Sdim	    *)
778218822Sdim		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
779218822Sdim	esac
780218822Sdim	exit ;;
78133965Sjdp    i*:CYGWIN*:*)
78260484Sobrien	echo ${UNAME_MACHINE}-pc-cygwin
783218822Sdim	exit ;;
784218822Sdim    *:MINGW*:*)
78538889Sjdp	echo ${UNAME_MACHINE}-pc-mingw32
786218822Sdim	exit ;;
787218822Sdim    i*:windows32*:*)
788218822Sdim    	# uname -m includes "-pc" on this system.
789218822Sdim    	echo ${UNAME_MACHINE}-mingw32
790218822Sdim	exit ;;
79168765Sobrien    i*:PW*:*)
79268765Sobrien	echo ${UNAME_MACHINE}-pc-pw32
793218822Sdim	exit ;;
794218822Sdim    *:Interix*:[3456]*)
795218822Sdim    	case ${UNAME_MACHINE} in
796218822Sdim	    x86) 
797218822Sdim		echo i586-pc-interix${UNAME_RELEASE}
798218822Sdim		exit ;;
799218822Sdim	    EM64T | authenticamd)
800218822Sdim		echo x86_64-unknown-interix${UNAME_RELEASE}
801218822Sdim		exit ;;
802218822Sdim	esac ;;
803130561Sobrien    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
804130561Sobrien	echo i${UNAME_MACHINE}-pc-mks
805218822Sdim	exit ;;
80660484Sobrien    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
80760484Sobrien	# How do we know it's Interix rather than the generic POSIX subsystem?
80860484Sobrien	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
80960484Sobrien	# UNAME_MACHINE based on the output of uname instead of i386?
810130561Sobrien	echo i586-pc-interix
811218822Sdim	exit ;;
81260484Sobrien    i*:UWIN*:*)
81360484Sobrien	echo ${UNAME_MACHINE}-pc-uwin
814218822Sdim	exit ;;
815218822Sdim    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
816218822Sdim	echo x86_64-unknown-cygwin
817218822Sdim	exit ;;
81833965Sjdp    p*:CYGWIN*:*)
81960484Sobrien	echo powerpcle-unknown-cygwin
820218822Sdim	exit ;;
82133965Sjdp    prep*:SunOS:5.*:*)
82233965Sjdp	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
823218822Sdim	exit ;;
82433965Sjdp    *:GNU:*:*)
825130561Sobrien	# the GNU system
82638889Sjdp	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
827218822Sdim	exit ;;
828130561Sobrien    *:GNU/*:*:*)
829130561Sobrien	# other systems with GNU libc and userland
830130561Sobrien	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
831218822Sdim	exit ;;
83268765Sobrien    i*86:Minix:*:*)
83368765Sobrien	echo ${UNAME_MACHINE}-pc-minix
834218822Sdim	exit ;;
83577298Sobrien    arm*:Linux:*:*)
83677298Sobrien	echo ${UNAME_MACHINE}-unknown-linux-gnu
837218822Sdim	exit ;;
838218822Sdim    avr32*:Linux:*:*)
839218822Sdim	echo ${UNAME_MACHINE}-unknown-linux-gnu
840218822Sdim	exit ;;
841130561Sobrien    cris:Linux:*:*)
842130561Sobrien	echo cris-axis-linux-gnu
843218822Sdim	exit ;;
844218822Sdim    crisv32:Linux:*:*)
845218822Sdim	echo crisv32-axis-linux-gnu
846218822Sdim	exit ;;
847218822Sdim    frv:Linux:*:*)
848218822Sdim    	echo frv-unknown-linux-gnu
849218822Sdim	exit ;;
85077298Sobrien    ia64:Linux:*:*)
851104834Sobrien	echo ${UNAME_MACHINE}-unknown-linux-gnu
852218822Sdim	exit ;;
853218822Sdim    m32r*:Linux:*:*)
854218822Sdim	echo ${UNAME_MACHINE}-unknown-linux-gnu
855218822Sdim	exit ;;
85677298Sobrien    m68*:Linux:*:*)
85777298Sobrien	echo ${UNAME_MACHINE}-unknown-linux-gnu
858218822Sdim	exit ;;
85977298Sobrien    mips:Linux:*:*)
86089857Sobrien	eval $set_cc_for_build
86189857Sobrien	sed 's/^	//' << EOF >$dummy.c
86289857Sobrien	#undef CPU
86389857Sobrien	#undef mips
86489857Sobrien	#undef mipsel
865104834Sobrien	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
866104834Sobrien	CPU=mipsel
86789857Sobrien	#else
868104834Sobrien	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
86989857Sobrien	CPU=mips
87089857Sobrien	#else
87189857Sobrien	CPU=
87289857Sobrien	#endif
873104834Sobrien	#endif
87477298SobrienEOF
875218822Sdim	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
876218822Sdim	    /^CPU/{
877218822Sdim		s: ::g
878218822Sdim		p
879218822Sdim	    }'`"
880218822Sdim	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
88177298Sobrien	;;
882130561Sobrien    mips64:Linux:*:*)
883130561Sobrien	eval $set_cc_for_build
884130561Sobrien	sed 's/^	//' << EOF >$dummy.c
885130561Sobrien	#undef CPU
886130561Sobrien	#undef mips64
887130561Sobrien	#undef mips64el
888130561Sobrien	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
889130561Sobrien	CPU=mips64el
890130561Sobrien	#else
891130561Sobrien	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
892130561Sobrien	CPU=mips64
893130561Sobrien	#else
894130561Sobrien	CPU=
895130561Sobrien	#endif
896130561Sobrien	#endif
897130561SobrienEOF
898218822Sdim	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
899218822Sdim	    /^CPU/{
900218822Sdim		s: ::g
901218822Sdim		p
902218822Sdim	    }'`"
903218822Sdim	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
904130561Sobrien	;;
905218822Sdim    or32:Linux:*:*)
906218822Sdim	echo or32-unknown-linux-gnu
907218822Sdim	exit ;;
90877298Sobrien    ppc:Linux:*:*)
90989857Sobrien	echo powerpc-unknown-linux-gnu
910218822Sdim	exit ;;
91189857Sobrien    ppc64:Linux:*:*)
91289857Sobrien	echo powerpc64-unknown-linux-gnu
913218822Sdim	exit ;;
91477298Sobrien    alpha:Linux:*:*)
91589857Sobrien	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
91689857Sobrien	  EV5)   UNAME_MACHINE=alphaev5 ;;
91789857Sobrien	  EV56)  UNAME_MACHINE=alphaev56 ;;
91889857Sobrien	  PCA56) UNAME_MACHINE=alphapca56 ;;
91989857Sobrien	  PCA57) UNAME_MACHINE=alphapca56 ;;
92089857Sobrien	  EV6)   UNAME_MACHINE=alphaev6 ;;
92189857Sobrien	  EV67)  UNAME_MACHINE=alphaev67 ;;
92289857Sobrien	  EV68*) UNAME_MACHINE=alphaev68 ;;
92389857Sobrien        esac
92489857Sobrien	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
92589857Sobrien	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
92677298Sobrien	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
927218822Sdim	exit ;;
92877298Sobrien    parisc:Linux:*:* | hppa:Linux:*:*)
92977298Sobrien	# Look for CPU level
93077298Sobrien	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
93177298Sobrien	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
93277298Sobrien	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
93377298Sobrien	  *)    echo hppa-unknown-linux-gnu ;;
93477298Sobrien	esac
935218822Sdim	exit ;;
93677298Sobrien    parisc64:Linux:*:* | hppa64:Linux:*:*)
93777298Sobrien	echo hppa64-unknown-linux-gnu
938218822Sdim	exit ;;
93977298Sobrien    s390:Linux:*:* | s390x:Linux:*:*)
94077298Sobrien	echo ${UNAME_MACHINE}-ibm-linux
941218822Sdim	exit ;;
942130561Sobrien    sh64*:Linux:*:*)
943130561Sobrien    	echo ${UNAME_MACHINE}-unknown-linux-gnu
944218822Sdim	exit ;;
94577298Sobrien    sh*:Linux:*:*)
94677298Sobrien	echo ${UNAME_MACHINE}-unknown-linux-gnu
947218822Sdim	exit ;;
94877298Sobrien    sparc:Linux:*:* | sparc64:Linux:*:*)
94977298Sobrien	echo ${UNAME_MACHINE}-unknown-linux-gnu
950218822Sdim	exit ;;
951218822Sdim    vax:Linux:*:*)
952218822Sdim	echo ${UNAME_MACHINE}-dec-linux-gnu
953218822Sdim	exit ;;
95477298Sobrien    x86_64:Linux:*:*)
95577298Sobrien	echo x86_64-unknown-linux-gnu
956218822Sdim	exit ;;
957218822Sdim    xtensa:Linux:*:*)
958218822Sdim    	echo xtensa-unknown-linux-gnu
959218822Sdim	exit ;;
96089857Sobrien    i*86:Linux:*:*)
96177298Sobrien	# The BFD linker knows what the default object file format is, so
96277298Sobrien	# first see if it will tell us. cd to the root directory to prevent
96377298Sobrien	# problems with other programs or directories called `ld' in the path.
96492828Sobrien	# Set LC_ALL=C to ensure ld outputs messages in English.
96592828Sobrien	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
96689857Sobrien			 | sed -ne '/supported targets:/!d
96777298Sobrien				    s/[ 	][ 	]*/ /g
96889857Sobrien				    s/.*supported targets: *//
96977298Sobrien				    s/ .*//
97077298Sobrien				    p'`
97189857Sobrien        case "$ld_supported_targets" in
97289857Sobrien	  elf32-i386)
97377298Sobrien		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
97477298Sobrien		;;
97589857Sobrien	  a.out-i386-linux)
97689857Sobrien		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
977218822Sdim		exit ;;
97889857Sobrien	  coff-i386)
97977298Sobrien		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
980218822Sdim		exit ;;
98189857Sobrien	  "")
98289857Sobrien		# Either a pre-BFD a.out linker (linux-gnuoldld) or
98389857Sobrien		# one that does not give us useful --help.
98489857Sobrien		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
985218822Sdim		exit ;;
98638889Sjdp	esac
98777298Sobrien	# Determine whether the default compiler is a.out or elf
98889857Sobrien	eval $set_cc_for_build
98989857Sobrien	sed 's/^	//' << EOF >$dummy.c
99089857Sobrien	#include <features.h>
99189857Sobrien	#ifdef __ELF__
99289857Sobrien	# ifdef __GLIBC__
99389857Sobrien	#  if __GLIBC__ >= 2
99489857Sobrien	LIBC=gnu
99589857Sobrien	#  else
99689857Sobrien	LIBC=gnulibc1
99789857Sobrien	#  endif
99889857Sobrien	# else
99989857Sobrien	LIBC=gnulibc1
100089857Sobrien	# endif
100189857Sobrien	#else
1002218822Sdim	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
100391041Sobrien	LIBC=gnu
100491041Sobrien	#else
100589857Sobrien	LIBC=gnuaout
100689857Sobrien	#endif
100791041Sobrien	#endif
1008130561Sobrien	#ifdef __dietlibc__
1009130561Sobrien	LIBC=dietlibc
1010130561Sobrien	#endif
101133965SjdpEOF
1012218822Sdim	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
1013218822Sdim	    /^LIBC/{
1014218822Sdim		s: ::g
1015218822Sdim		p
1016218822Sdim	    }'`"
1017218822Sdim	test x"${LIBC}" != x && {
1018218822Sdim		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
1019218822Sdim		exit
1020218822Sdim	}
1021218822Sdim	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
102277298Sobrien	;;
102389857Sobrien    i*86:DYNIX/ptx:4*:*)
102489857Sobrien	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
102589857Sobrien	# earlier versions are messed up and put the nodename in both
102689857Sobrien	# sysname and nodename.
102733965Sjdp	echo i386-sequent-sysv4
1028218822Sdim	exit ;;
102989857Sobrien    i*86:UNIX_SV:4.2MP:2.*)
103038889Sjdp        # Unixware is an offshoot of SVR4, but it has its own version
103138889Sjdp        # number series starting with 2...
103238889Sjdp        # I am not positive that other SVR4 systems won't match this,
103338889Sjdp	# I just have to hope.  -- rms.
103438889Sjdp        # Use sysv4.2uw... so that sysv4* matches it.
103538889Sjdp	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
1036218822Sdim	exit ;;
1037130561Sobrien    i*86:OS/2:*:*)
1038130561Sobrien	# If we were able to find `uname', then EMX Unix compatibility
1039130561Sobrien	# is probably installed.
1040130561Sobrien	echo ${UNAME_MACHINE}-pc-os2-emx
1041218822Sdim	exit ;;
1042130561Sobrien    i*86:XTS-300:*:STOP)
1043130561Sobrien	echo ${UNAME_MACHINE}-unknown-stop
1044218822Sdim	exit ;;
1045130561Sobrien    i*86:atheos:*:*)
1046130561Sobrien	echo ${UNAME_MACHINE}-unknown-atheos
1047218822Sdim	exit ;;
1048218822Sdim    i*86:syllable:*:*)
1049130561Sobrien	echo ${UNAME_MACHINE}-pc-syllable
1050218822Sdim	exit ;;
1051130561Sobrien    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
1052130561Sobrien	echo i386-unknown-lynxos${UNAME_RELEASE}
1053218822Sdim	exit ;;
1054130561Sobrien    i*86:*DOS:*:*)
1055130561Sobrien	echo ${UNAME_MACHINE}-pc-msdosdjgpp
1056218822Sdim	exit ;;
105789857Sobrien    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
105860484Sobrien	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
105933965Sjdp	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
106060484Sobrien		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
106133965Sjdp	else
106260484Sobrien		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
106333965Sjdp	fi
1064218822Sdim	exit ;;
1065218822Sdim    i*86:*:5:[678]*)
1066218822Sdim    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
106789857Sobrien	case `/bin/uname -X | grep "^Machine"` in
106889857Sobrien	    *486*)	     UNAME_MACHINE=i486 ;;
106989857Sobrien	    *Pentium)	     UNAME_MACHINE=i586 ;;
107089857Sobrien	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
107189857Sobrien	esac
107289857Sobrien	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1073218822Sdim	exit ;;
107489857Sobrien    i*86:*:3.2:*)
107533965Sjdp	if test -f /usr/options/cb.name; then
107633965Sjdp		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
107733965Sjdp		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
107833965Sjdp	elif /bin/uname -X 2>/dev/null >/dev/null ; then
1079130561Sobrien		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1080130561Sobrien		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1081130561Sobrien		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
108233965Sjdp			&& UNAME_MACHINE=i586
1083130561Sobrien		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
108460484Sobrien			&& UNAME_MACHINE=i686
1085130561Sobrien		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
108660484Sobrien			&& UNAME_MACHINE=i686
108733965Sjdp		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
108833965Sjdp	else
108933965Sjdp		echo ${UNAME_MACHINE}-pc-sysv32
109033965Sjdp	fi
1091218822Sdim	exit ;;
109238889Sjdp    pc:*:*:*)
109360484Sobrien	# Left here for compatibility:
109438889Sjdp        # uname -m prints for DJGPP always 'pc', but it prints nothing about
109538889Sjdp        # the processor, so we play safe by assuming i386.
109638889Sjdp	echo i386-pc-msdosdjgpp
1097218822Sdim        exit ;;
109833965Sjdp    Intel:Mach:3*:*)
109933965Sjdp	echo i386-pc-mach3
1100218822Sdim	exit ;;
110133965Sjdp    paragon:*:*:*)
110233965Sjdp	echo i860-intel-osf1
1103218822Sdim	exit ;;
110433965Sjdp    i860:*:4.*:*) # i860-SVR4
110533965Sjdp	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
110633965Sjdp	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
110733965Sjdp	else # Add other i860-SVR4 vendors below as they are discovered.
110833965Sjdp	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
110933965Sjdp	fi
1110218822Sdim	exit ;;
111133965Sjdp    mini*:CTIX:SYS*5:*)
111233965Sjdp	# "miniframe"
111333965Sjdp	echo m68010-convergent-sysv
1114218822Sdim	exit ;;
1115130561Sobrien    mc68k:UNIX:SYSTEM5:3.51m)
1116130561Sobrien	echo m68k-convergent-sysv
1117218822Sdim	exit ;;
1118130561Sobrien    M680?0:D-NIX:5.3:*)
1119130561Sobrien	echo m68k-diab-dnix
1120218822Sdim	exit ;;
1121218822Sdim    M68*:*:R3V[5678]*:*)
1122218822Sdim	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1123218822Sdim    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)
112433965Sjdp	OS_REL=''
112533965Sjdp	test -r /etc/.relid \
112633965Sjdp	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
112733965Sjdp	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1128218822Sdim	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
112933965Sjdp	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1130218822Sdim	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
113133965Sjdp    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
113233965Sjdp        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1133218822Sdim          && { echo i486-ncr-sysv4; exit; } ;;
113489857Sobrien    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
113533965Sjdp	echo m68k-unknown-lynxos${UNAME_RELEASE}
1136218822Sdim	exit ;;
113733965Sjdp    mc68030:UNIX_System_V:4.*:*)
113833965Sjdp	echo m68k-atari-sysv4
1139218822Sdim	exit ;;
114033965Sjdp    TSUNAMI:LynxOS:2.*:*)
114133965Sjdp	echo sparc-unknown-lynxos${UNAME_RELEASE}
1142218822Sdim	exit ;;
114377298Sobrien    rs6000:LynxOS:2.*:*)
114433965Sjdp	echo rs6000-unknown-lynxos${UNAME_RELEASE}
1145218822Sdim	exit ;;
114689857Sobrien    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
114777298Sobrien	echo powerpc-unknown-lynxos${UNAME_RELEASE}
1148218822Sdim	exit ;;
114933965Sjdp    SM[BE]S:UNIX_SV:*:*)
115033965Sjdp	echo mips-dde-sysv${UNAME_RELEASE}
1151218822Sdim	exit ;;
115260484Sobrien    RM*:ReliantUNIX-*:*:*)
115360484Sobrien	echo mips-sni-sysv4
1154218822Sdim	exit ;;
115533965Sjdp    RM*:SINIX-*:*:*)
115633965Sjdp	echo mips-sni-sysv4
1157218822Sdim	exit ;;
115833965Sjdp    *:SINIX-*:*:*)
115933965Sjdp	if uname -p 2>/dev/null >/dev/null ; then
116033965Sjdp		UNAME_MACHINE=`(uname -p) 2>/dev/null`
116133965Sjdp		echo ${UNAME_MACHINE}-sni-sysv4
116233965Sjdp	else
116333965Sjdp		echo ns32k-sni-sysv
116433965Sjdp	fi
1165218822Sdim	exit ;;
116689857Sobrien    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
116789857Sobrien                      # says <Richard.M.Bartel@ccMail.Census.GOV>
116833965Sjdp        echo i586-unisys-sysv4
1169218822Sdim        exit ;;
117033965Sjdp    *:UNIX_System_V:4*:FTX*)
117133965Sjdp	# From Gerald Hewes <hewes@openmarket.com>.
117233965Sjdp	# How about differentiating between stratus architectures? -djm
117333965Sjdp	echo hppa1.1-stratus-sysv4
1174218822Sdim	exit ;;
117533965Sjdp    *:*:*:FTX*)
117633965Sjdp	# From seanf@swdc.stratus.com.
117733965Sjdp	echo i860-stratus-sysv4
1178218822Sdim	exit ;;
1179218822Sdim    i*86:VOS:*:*)
1180218822Sdim	# From Paul.Green@stratus.com.
1181218822Sdim	echo ${UNAME_MACHINE}-stratus-vos
1182218822Sdim	exit ;;
118389857Sobrien    *:VOS:*:*)
118489857Sobrien	# From Paul.Green@stratus.com.
118589857Sobrien	echo hppa1.1-stratus-vos
1186218822Sdim	exit ;;
118733965Sjdp    mc68*:A/UX:*:*)
118833965Sjdp	echo m68k-apple-aux${UNAME_RELEASE}
1189218822Sdim	exit ;;
119068765Sobrien    news*:NEWS-OS:6*:*)
119138889Sjdp	echo mips-sony-newsos6
1192218822Sdim	exit ;;
119360484Sobrien    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
119433965Sjdp	if [ -d /usr/nec ]; then
119533965Sjdp	        echo mips-nec-sysv${UNAME_RELEASE}
119633965Sjdp	else
119733965Sjdp	        echo mips-unknown-sysv${UNAME_RELEASE}
119833965Sjdp	fi
1199218822Sdim        exit ;;
120038889Sjdp    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
120138889Sjdp	echo powerpc-be-beos
1202218822Sdim	exit ;;
120338889Sjdp    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
120438889Sjdp	echo powerpc-apple-beos
1205218822Sdim	exit ;;
120660484Sobrien    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
120760484Sobrien	echo i586-pc-beos
1208218822Sdim	exit ;;
120960484Sobrien    SX-4:SUPER-UX:*:*)
121060484Sobrien	echo sx4-nec-superux${UNAME_RELEASE}
1211218822Sdim	exit ;;
121260484Sobrien    SX-5:SUPER-UX:*:*)
121360484Sobrien	echo sx5-nec-superux${UNAME_RELEASE}
1214218822Sdim	exit ;;
1215130561Sobrien    SX-6:SUPER-UX:*:*)
1216130561Sobrien	echo sx6-nec-superux${UNAME_RELEASE}
1217218822Sdim	exit ;;
1218218822Sdim    SX-7:SUPER-UX:*:*)
1219218822Sdim	echo sx7-nec-superux${UNAME_RELEASE}
1220218822Sdim	exit ;;
1221218822Sdim    SX-8:SUPER-UX:*:*)
1222218822Sdim	echo sx8-nec-superux${UNAME_RELEASE}
1223218822Sdim	exit ;;
1224218822Sdim    SX-8R:SUPER-UX:*:*)
1225218822Sdim	echo sx8r-nec-superux${UNAME_RELEASE}
1226218822Sdim	exit ;;
122760484Sobrien    Power*:Rhapsody:*:*)
122860484Sobrien	echo powerpc-apple-rhapsody${UNAME_RELEASE}
1229218822Sdim	exit ;;
123060484Sobrien    *:Rhapsody:*:*)
123160484Sobrien	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
1232218822Sdim	exit ;;
123368765Sobrien    *:Darwin:*:*)
1234218822Sdim	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1235218822Sdim	case $UNAME_PROCESSOR in
1236218822Sdim	    unknown) UNAME_PROCESSOR=powerpc ;;
1237130561Sobrien	esac
1238130561Sobrien	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
1239218822Sdim	exit ;;
124068765Sobrien    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1241104834Sobrien	UNAME_PROCESSOR=`uname -p`
1242104834Sobrien	if test "$UNAME_PROCESSOR" = "x86"; then
1243104834Sobrien		UNAME_PROCESSOR=i386
124468765Sobrien		UNAME_MACHINE=pc
124568765Sobrien	fi
1246104834Sobrien	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
1247218822Sdim	exit ;;
124860484Sobrien    *:QNX:*:4*)
124968765Sobrien	echo i386-pc-qnx
1250218822Sdim	exit ;;
1251218822Sdim    NSE-?:NONSTOP_KERNEL:*:*)
1252218822Sdim	echo nse-tandem-nsk${UNAME_RELEASE}
1253218822Sdim	exit ;;
1254130561Sobrien    NSR-?:NONSTOP_KERNEL:*:*)
125568765Sobrien	echo nsr-tandem-nsk${UNAME_RELEASE}
1256218822Sdim	exit ;;
125777298Sobrien    *:NonStop-UX:*:*)
125877298Sobrien	echo mips-compaq-nonstopux
1259218822Sdim	exit ;;
126068765Sobrien    BS2000:POSIX*:*:*)
126168765Sobrien	echo bs2000-siemens-sysv
1262218822Sdim	exit ;;
126368765Sobrien    DS/*:UNIX_System_V:*:*)
126468765Sobrien	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
1265218822Sdim	exit ;;
126668765Sobrien    *:Plan9:*:*)
126768765Sobrien	# "uname -m" is not consistent, so use $cputype instead. 386
126868765Sobrien	# is converted to i386 for consistency with other x86
126968765Sobrien	# operating systems.
127068765Sobrien	if test "$cputype" = "386"; then
127168765Sobrien	    UNAME_MACHINE=i386
127268765Sobrien	else
127368765Sobrien	    UNAME_MACHINE="$cputype"
127468765Sobrien	fi
127568765Sobrien	echo ${UNAME_MACHINE}-unknown-plan9
1276218822Sdim	exit ;;
127777298Sobrien    *:TOPS-10:*:*)
127877298Sobrien	echo pdp10-unknown-tops10
1279218822Sdim	exit ;;
128077298Sobrien    *:TENEX:*:*)
128177298Sobrien	echo pdp10-unknown-tenex
1282218822Sdim	exit ;;
128377298Sobrien    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
128477298Sobrien	echo pdp10-dec-tops20
1285218822Sdim	exit ;;
128677298Sobrien    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
128777298Sobrien	echo pdp10-xkl-tops20
1288218822Sdim	exit ;;
128977298Sobrien    *:TOPS-20:*:*)
129077298Sobrien	echo pdp10-unknown-tops20
1291218822Sdim	exit ;;
129277298Sobrien    *:ITS:*:*)
129377298Sobrien	echo pdp10-unknown-its
1294218822Sdim	exit ;;
1295130561Sobrien    SEI:*:*:SEIUX)
1296130561Sobrien        echo mips-sei-seiux${UNAME_RELEASE}
1297218822Sdim	exit ;;
1298130561Sobrien    *:DragonFly:*:*)
1299130561Sobrien	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
1300218822Sdim	exit ;;
1301218822Sdim    *:*VMS:*:*)
1302218822Sdim    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1303218822Sdim	case "${UNAME_MACHINE}" in
1304218822Sdim	    A*) echo alpha-dec-vms ; exit ;;
1305218822Sdim	    I*) echo ia64-dec-vms ; exit ;;
1306218822Sdim	    V*) echo vax-dec-vms ; exit ;;
1307218822Sdim	esac ;;
1308218822Sdim    *:XENIX:*:SysV)
1309218822Sdim	echo i386-pc-xenix
1310218822Sdim	exit ;;
1311218822Sdim    i*86:skyos:*:*)
1312218822Sdim	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
1313218822Sdim	exit ;;
1314218822Sdim    i*86:rdos:*:*)
1315218822Sdim	echo ${UNAME_MACHINE}-pc-rdos
1316218822Sdim	exit ;;
131733965Sjdpesac
131833965Sjdp
131933965Sjdp#echo '(No uname command or uname output not recognized.)' 1>&2
132033965Sjdp#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
132133965Sjdp
132289857Sobrieneval $set_cc_for_build
132360484Sobriencat >$dummy.c <<EOF
132433965Sjdp#ifdef _SEQUENT_
132533965Sjdp# include <sys/types.h>
132633965Sjdp# include <sys/utsname.h>
132733965Sjdp#endif
132833965Sjdpmain ()
132933965Sjdp{
133033965Sjdp#if defined (sony)
133133965Sjdp#if defined (MIPSEB)
133233965Sjdp  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
133333965Sjdp     I don't know....  */
133433965Sjdp  printf ("mips-sony-bsd\n"); exit (0);
133533965Sjdp#else
133633965Sjdp#include <sys/param.h>
133733965Sjdp  printf ("m68k-sony-newsos%s\n",
133833965Sjdp#ifdef NEWSOS4
133933965Sjdp          "4"
134033965Sjdp#else
134133965Sjdp	  ""
134233965Sjdp#endif
134333965Sjdp         ); exit (0);
134433965Sjdp#endif
134533965Sjdp#endif
134633965Sjdp
134733965Sjdp#if defined (__arm) && defined (__acorn) && defined (__unix)
1348218822Sdim  printf ("arm-acorn-riscix\n"); exit (0);
134933965Sjdp#endif
135033965Sjdp
135133965Sjdp#if defined (hp300) && !defined (hpux)
135233965Sjdp  printf ("m68k-hp-bsd\n"); exit (0);
135333965Sjdp#endif
135433965Sjdp
135533965Sjdp#if defined (NeXT)
135633965Sjdp#if !defined (__ARCHITECTURE__)
135733965Sjdp#define __ARCHITECTURE__ "m68k"
135833965Sjdp#endif
135933965Sjdp  int version;
136033965Sjdp  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
136160484Sobrien  if (version < 4)
136260484Sobrien    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
136360484Sobrien  else
136460484Sobrien    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
136533965Sjdp  exit (0);
136633965Sjdp#endif
136733965Sjdp
136833965Sjdp#if defined (MULTIMAX) || defined (n16)
136933965Sjdp#if defined (UMAXV)
137033965Sjdp  printf ("ns32k-encore-sysv\n"); exit (0);
137133965Sjdp#else
137233965Sjdp#if defined (CMU)
137333965Sjdp  printf ("ns32k-encore-mach\n"); exit (0);
137433965Sjdp#else
137533965Sjdp  printf ("ns32k-encore-bsd\n"); exit (0);
137633965Sjdp#endif
137733965Sjdp#endif
137833965Sjdp#endif
137933965Sjdp
138033965Sjdp#if defined (__386BSD__)
138133965Sjdp  printf ("i386-pc-bsd\n"); exit (0);
138233965Sjdp#endif
138333965Sjdp
138433965Sjdp#if defined (sequent)
138533965Sjdp#if defined (i386)
138633965Sjdp  printf ("i386-sequent-dynix\n"); exit (0);
138733965Sjdp#endif
138833965Sjdp#if defined (ns32000)
138933965Sjdp  printf ("ns32k-sequent-dynix\n"); exit (0);
139033965Sjdp#endif
139133965Sjdp#endif
139233965Sjdp
139333965Sjdp#if defined (_SEQUENT_)
139433965Sjdp    struct utsname un;
139533965Sjdp
139633965Sjdp    uname(&un);
139733965Sjdp
139833965Sjdp    if (strncmp(un.version, "V2", 2) == 0) {
139933965Sjdp	printf ("i386-sequent-ptx2\n"); exit (0);
140033965Sjdp    }
140133965Sjdp    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
140233965Sjdp	printf ("i386-sequent-ptx1\n"); exit (0);
140333965Sjdp    }
140433965Sjdp    printf ("i386-sequent-ptx\n"); exit (0);
140533965Sjdp
140633965Sjdp#endif
140733965Sjdp
140833965Sjdp#if defined (vax)
140977298Sobrien# if !defined (ultrix)
141077298Sobrien#  include <sys/param.h>
141177298Sobrien#  if defined (BSD)
141277298Sobrien#   if BSD == 43
141377298Sobrien      printf ("vax-dec-bsd4.3\n"); exit (0);
141477298Sobrien#   else
141577298Sobrien#    if BSD == 199006
141677298Sobrien      printf ("vax-dec-bsd4.3reno\n"); exit (0);
141777298Sobrien#    else
141877298Sobrien      printf ("vax-dec-bsd\n"); exit (0);
141977298Sobrien#    endif
142077298Sobrien#   endif
142177298Sobrien#  else
142277298Sobrien    printf ("vax-dec-bsd\n"); exit (0);
142377298Sobrien#  endif
142477298Sobrien# else
142577298Sobrien    printf ("vax-dec-ultrix\n"); exit (0);
142677298Sobrien# endif
142733965Sjdp#endif
142833965Sjdp
142933965Sjdp#if defined (alliant) && defined (i860)
143033965Sjdp  printf ("i860-alliant-bsd\n"); exit (0);
143133965Sjdp#endif
143233965Sjdp
143333965Sjdp  exit (1);
143433965Sjdp}
143533965SjdpEOF
143633965Sjdp
1437218822Sdim$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
1438218822Sdim	{ echo "$SYSTEM_NAME"; exit; }
143933965Sjdp
144033965Sjdp# Apollos put the system type in the environment.
144133965Sjdp
1442218822Sdimtest -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
144333965Sjdp
144433965Sjdp# Convex versions that predate uname can use getsysinfo(1)
144533965Sjdp
144633965Sjdpif [ -x /usr/convex/getsysinfo ]
144733965Sjdpthen
144833965Sjdp    case `getsysinfo -f cpu_type` in
144933965Sjdp    c1*)
145033965Sjdp	echo c1-convex-bsd
1451218822Sdim	exit ;;
145233965Sjdp    c2*)
145333965Sjdp	if getsysinfo -f scalar_acc
145433965Sjdp	then echo c32-convex-bsd
145533965Sjdp	else echo c2-convex-bsd
145633965Sjdp	fi
1457218822Sdim	exit ;;
145833965Sjdp    c34*)
145933965Sjdp	echo c34-convex-bsd
1460218822Sdim	exit ;;
146133965Sjdp    c38*)
146233965Sjdp	echo c38-convex-bsd
1463218822Sdim	exit ;;
146433965Sjdp    c4*)
146533965Sjdp	echo c4-convex-bsd
1466218822Sdim	exit ;;
146733965Sjdp    esac
146833965Sjdpfi
146933965Sjdp
147068765Sobriencat >&2 <<EOF
147168765Sobrien$0: unable to guess system type
147233965Sjdp
147377298SobrienThis script, last modified $timestamp, has failed to recognize
147477298Sobrienthe operating system you are using. It is advised that you
147577298Sobriendownload the most up to date version of the config scripts from
147668765Sobrien
1477218822Sdim  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
1478218822Sdimand
1479218822Sdim  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
148068765Sobrien
148168765SobrienIf the version you run ($0) is already up to date, please
148268765Sobriensend the following data and any information you think might be
148368765Sobrienpertinent to <config-patches@gnu.org> in order to provide the needed
148468765Sobrieninformation to handle your system.
148568765Sobrien
148677298Sobrienconfig.guess timestamp = $timestamp
148768765Sobrien
148868765Sobrienuname -m = `(uname -m) 2>/dev/null || echo unknown`
148968765Sobrienuname -r = `(uname -r) 2>/dev/null || echo unknown`
149068765Sobrienuname -s = `(uname -s) 2>/dev/null || echo unknown`
149168765Sobrienuname -v = `(uname -v) 2>/dev/null || echo unknown`
149268765Sobrien
149368765Sobrien/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
149468765Sobrien/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
149568765Sobrien
149668765Sobrienhostinfo               = `(hostinfo) 2>/dev/null`
149768765Sobrien/bin/universe          = `(/bin/universe) 2>/dev/null`
149868765Sobrien/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
149968765Sobrien/bin/arch              = `(/bin/arch) 2>/dev/null`
150068765Sobrien/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
150168765Sobrien/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
150268765Sobrien
150368765SobrienUNAME_MACHINE = ${UNAME_MACHINE}
150468765SobrienUNAME_RELEASE = ${UNAME_RELEASE}
150568765SobrienUNAME_SYSTEM  = ${UNAME_SYSTEM}
150668765SobrienUNAME_VERSION = ${UNAME_VERSION}
150768765SobrienEOF
150868765Sobrien
150933965Sjdpexit 1
151068765Sobrien
151168765Sobrien# Local variables:
151268765Sobrien# eval: (add-hook 'write-file-hooks 'time-stamp)
151377298Sobrien# time-stamp-start: "timestamp='"
151468765Sobrien# time-stamp-format: "%:y-%02m-%02d"
151568765Sobrien# time-stamp-end: "'"
151668765Sobrien# End:
1517