config.guess revision b12e5c03
109885543Smrg#! /bin/sh
209885543Smrg# Attempt to guess a canonical system name.
309885543Smrg#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4b12e5c03Smrg#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
5b12e5c03Smrg#   2011, 2012 Free Software Foundation, Inc.
609885543Smrg
7b12e5c03Smrgtimestamp='2012-01-01'
809885543Smrg
909885543Smrg# This file is free software; you can redistribute it and/or modify it
1009885543Smrg# under the terms of the GNU General Public License as published by
1109885543Smrg# the Free Software Foundation; either version 2 of the License, or
1209885543Smrg# (at your option) any later version.
1309885543Smrg#
1409885543Smrg# This program is distributed in the hope that it will be useful, but
1509885543Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1609885543Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1709885543Smrg# General Public License for more details.
1809885543Smrg#
1909885543Smrg# You should have received a copy of the GNU General Public License
2009885543Smrg# along with this program; if not, write to the Free Software
2109885543Smrg# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
2209885543Smrg# 02110-1301, USA.
2309885543Smrg#
2409885543Smrg# As a special exception to the GNU General Public License, if you
2509885543Smrg# distribute this file as part of a program that contains a
2609885543Smrg# configuration script generated by Autoconf, you may include it under
2709885543Smrg# the same distribution terms that you use for the rest of that program.
2809885543Smrg
2909885543Smrg
30e4f6584cSmrg# Originally written by Per Bothner.  Please send patches (context
31e4f6584cSmrg# diff format) to <config-patches@gnu.org> and include a ChangeLog
32e4f6584cSmrg# entry.
3309885543Smrg#
3409885543Smrg# This script attempts to guess a canonical system name similar to
3509885543Smrg# config.sub.  If it succeeds, it prints the system name on stdout, and
3609885543Smrg# exits with 0.  Otherwise, it exits with 1.
3709885543Smrg#
38e4f6584cSmrg# You can get the latest version of this script from:
39e4f6584cSmrg# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
4009885543Smrg
4109885543Smrgme=`echo "$0" | sed -e 's,.*/,,'`
4209885543Smrg
4309885543Smrgusage="\
4409885543SmrgUsage: $0 [OPTION]
4509885543Smrg
4609885543SmrgOutput the configuration name of the system \`$me' is run on.
4709885543Smrg
4809885543SmrgOperation modes:
4909885543Smrg  -h, --help         print this help, then exit
5009885543Smrg  -t, --time-stamp   print date of last modification, then exit
5109885543Smrg  -v, --version      print version number, then exit
5209885543Smrg
5309885543SmrgReport bugs and patches to <config-patches@gnu.org>."
5409885543Smrg
5509885543Smrgversion="\
5609885543SmrgGNU config.guess ($timestamp)
5709885543Smrg
5809885543SmrgOriginally written by Per Bothner.
597b58d2e0SmrgCopyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
60b12e5c03Smrg2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
61b12e5c03SmrgFree Software Foundation, Inc.
6209885543Smrg
6309885543SmrgThis is free software; see the source for copying conditions.  There is NO
6409885543Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
6509885543Smrg
6609885543Smrghelp="
6709885543SmrgTry \`$me --help' for more information."
6809885543Smrg
6909885543Smrg# Parse command line
7009885543Smrgwhile test $# -gt 0 ; do
7109885543Smrg  case $1 in
7209885543Smrg    --time-stamp | --time* | -t )
7309885543Smrg       echo "$timestamp" ; exit ;;
7409885543Smrg    --version | -v )
7509885543Smrg       echo "$version" ; exit ;;
7609885543Smrg    --help | --h* | -h )
7709885543Smrg       echo "$usage"; exit ;;
7809885543Smrg    -- )     # Stop option processing
7909885543Smrg       shift; break ;;
8009885543Smrg    - )	# Use stdin as input.
8109885543Smrg       break ;;
8209885543Smrg    -* )
8309885543Smrg       echo "$me: invalid option $1$help" >&2
8409885543Smrg       exit 1 ;;
8509885543Smrg    * )
8609885543Smrg       break ;;
8709885543Smrg  esac
8809885543Smrgdone
8909885543Smrg
9009885543Smrgif test $# != 0; then
9109885543Smrg  echo "$me: too many arguments$help" >&2
9209885543Smrg  exit 1
9309885543Smrgfi
9409885543Smrg
9509885543Smrgtrap 'exit 1' 1 2 15
9609885543Smrg
9709885543Smrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
9809885543Smrg# compiler to aid in system detection is discouraged as it requires
9909885543Smrg# temporary files to be created and, as you can see below, it is a
10009885543Smrg# headache to deal with in a portable fashion.
10109885543Smrg
10209885543Smrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
10309885543Smrg# use `HOST_CC' if defined, but it is deprecated.
10409885543Smrg
10509885543Smrg# Portable tmp directory creation inspired by the Autoconf team.
10609885543Smrg
10709885543Smrgset_cc_for_build='
10809885543Smrgtrap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
10909885543Smrgtrap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
11009885543Smrg: ${TMPDIR=/tmp} ;
11109885543Smrg { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
11209885543Smrg { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
11309885543Smrg { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
11409885543Smrg { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
11509885543Smrgdummy=$tmp/dummy ;
11609885543Smrgtmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
11709885543Smrgcase $CC_FOR_BUILD,$HOST_CC,$CC in
11809885543Smrg ,,)    echo "int x;" > $dummy.c ;
11909885543Smrg	for c in cc gcc c89 c99 ; do
12009885543Smrg	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
12109885543Smrg	     CC_FOR_BUILD="$c"; break ;
12209885543Smrg	  fi ;
12309885543Smrg	done ;
12409885543Smrg	if test x"$CC_FOR_BUILD" = x ; then
12509885543Smrg	  CC_FOR_BUILD=no_compiler_found ;
12609885543Smrg	fi
12709885543Smrg	;;
12809885543Smrg ,,*)   CC_FOR_BUILD=$CC ;;
12909885543Smrg ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
13009885543Smrgesac ; set_cc_for_build= ;'
13109885543Smrg
13209885543Smrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
13309885543Smrg# (ghazi@noc.rutgers.edu 1994-08-24)
13409885543Smrgif (test -f /.attbin/uname) >/dev/null 2>&1 ; then
13509885543Smrg	PATH=$PATH:/.attbin ; export PATH
13609885543Smrgfi
13709885543Smrg
13809885543SmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
13909885543SmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
14009885543SmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
14109885543SmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
14209885543Smrg
14309885543Smrg# Note: order is significant - the case branches are not exclusive.
14409885543Smrg
14509885543Smrgcase "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
14609885543Smrg    *:NetBSD:*:*)
14709885543Smrg	# NetBSD (nbsd) targets should (where applicable) match one or
148b12e5c03Smrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
14909885543Smrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
15009885543Smrg	# switched to ELF, *-*-netbsd* would select the old
15109885543Smrg	# object file format.  This provides both forward
15209885543Smrg	# compatibility and a consistent mechanism for selecting the
15309885543Smrg	# object file format.
15409885543Smrg	#
15509885543Smrg	# Note: NetBSD doesn't particularly care about the vendor
15609885543Smrg	# portion of the name.  We always set it to "unknown".
15709885543Smrg	sysctl="sysctl -n hw.machine_arch"
15809885543Smrg	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
15909885543Smrg	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
16009885543Smrg	case "${UNAME_MACHINE_ARCH}" in
16109885543Smrg	    armeb) machine=armeb-unknown ;;
16209885543Smrg	    arm*) machine=arm-unknown ;;
16309885543Smrg	    sh3el) machine=shl-unknown ;;
16409885543Smrg	    sh3eb) machine=sh-unknown ;;
1657104f784Smrg	    sh5el) machine=sh5le-unknown ;;
16609885543Smrg	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
16709885543Smrg	esac
16809885543Smrg	# The Operating System including object format, if it has switched
16909885543Smrg	# to ELF recently, or will in the future.
17009885543Smrg	case "${UNAME_MACHINE_ARCH}" in
17109885543Smrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
17209885543Smrg		eval $set_cc_for_build
17309885543Smrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
174e4f6584cSmrg			| grep -q __ELF__
17509885543Smrg		then
17609885543Smrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
17709885543Smrg		    # Return netbsd for either.  FIX?
17809885543Smrg		    os=netbsd
17909885543Smrg		else
18009885543Smrg		    os=netbsdelf
18109885543Smrg		fi
18209885543Smrg		;;
18309885543Smrg	    *)
184b12e5c03Smrg		os=netbsd
18509885543Smrg		;;
18609885543Smrg	esac
18709885543Smrg	# The OS release
18809885543Smrg	# Debian GNU/NetBSD machines have a different userland, and
18909885543Smrg	# thus, need a distinct triplet. However, they do not need
19009885543Smrg	# kernel version information, so it can be replaced with a
19109885543Smrg	# suitable tag, in the style of linux-gnu.
19209885543Smrg	case "${UNAME_VERSION}" in
19309885543Smrg	    Debian*)
19409885543Smrg		release='-gnu'
19509885543Smrg		;;
19609885543Smrg	    *)
19709885543Smrg		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
19809885543Smrg		;;
19909885543Smrg	esac
20009885543Smrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
20109885543Smrg	# contains redundant information, the shorter form:
20209885543Smrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
20309885543Smrg	echo "${machine}-${os}${release}"
20409885543Smrg	exit ;;
20509885543Smrg    *:OpenBSD:*:*)
20609885543Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
20709885543Smrg	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
20809885543Smrg	exit ;;
20909885543Smrg    *:ekkoBSD:*:*)
21009885543Smrg	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
21109885543Smrg	exit ;;
21209885543Smrg    *:SolidBSD:*:*)
21309885543Smrg	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
21409885543Smrg	exit ;;
21509885543Smrg    macppc:MirBSD:*:*)
21609885543Smrg	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
21709885543Smrg	exit ;;
21809885543Smrg    *:MirBSD:*:*)
21909885543Smrg	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
22009885543Smrg	exit ;;
22109885543Smrg    alpha:OSF1:*:*)
22209885543Smrg	case $UNAME_RELEASE in
22309885543Smrg	*4.0)
22409885543Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
22509885543Smrg		;;
22609885543Smrg	*5.*)
227b12e5c03Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
22809885543Smrg		;;
22909885543Smrg	esac
23009885543Smrg	# According to Compaq, /usr/sbin/psrinfo has been available on
23109885543Smrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
23209885543Smrg	# covers most systems running today.  This code pipes the CPU
23309885543Smrg	# types through head -n 1, so we only detect the type of CPU 0.
23409885543Smrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
23509885543Smrg	case "$ALPHA_CPU_TYPE" in
23609885543Smrg	    "EV4 (21064)")
23709885543Smrg		UNAME_MACHINE="alpha" ;;
23809885543Smrg	    "EV4.5 (21064)")
23909885543Smrg		UNAME_MACHINE="alpha" ;;
24009885543Smrg	    "LCA4 (21066/21068)")
24109885543Smrg		UNAME_MACHINE="alpha" ;;
24209885543Smrg	    "EV5 (21164)")
24309885543Smrg		UNAME_MACHINE="alphaev5" ;;
24409885543Smrg	    "EV5.6 (21164A)")
24509885543Smrg		UNAME_MACHINE="alphaev56" ;;
24609885543Smrg	    "EV5.6 (21164PC)")
24709885543Smrg		UNAME_MACHINE="alphapca56" ;;
24809885543Smrg	    "EV5.7 (21164PC)")
24909885543Smrg		UNAME_MACHINE="alphapca57" ;;
25009885543Smrg	    "EV6 (21264)")
25109885543Smrg		UNAME_MACHINE="alphaev6" ;;
25209885543Smrg	    "EV6.7 (21264A)")
25309885543Smrg		UNAME_MACHINE="alphaev67" ;;
25409885543Smrg	    "EV6.8CB (21264C)")
25509885543Smrg		UNAME_MACHINE="alphaev68" ;;
25609885543Smrg	    "EV6.8AL (21264B)")
25709885543Smrg		UNAME_MACHINE="alphaev68" ;;
25809885543Smrg	    "EV6.8CX (21264D)")
25909885543Smrg		UNAME_MACHINE="alphaev68" ;;
26009885543Smrg	    "EV6.9A (21264/EV69A)")
26109885543Smrg		UNAME_MACHINE="alphaev69" ;;
26209885543Smrg	    "EV7 (21364)")
26309885543Smrg		UNAME_MACHINE="alphaev7" ;;
26409885543Smrg	    "EV7.9 (21364A)")
26509885543Smrg		UNAME_MACHINE="alphaev79" ;;
26609885543Smrg	esac
26709885543Smrg	# A Pn.n version is a patched version.
26809885543Smrg	# A Vn.n version is a released version.
26909885543Smrg	# A Tn.n version is a released field test version.
27009885543Smrg	# A Xn.n version is an unreleased experimental baselevel.
27109885543Smrg	# 1.2 uses "1.2" for uname -r.
27209885543Smrg	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
273b12e5c03Smrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
274b12e5c03Smrg	exitcode=$?
275b12e5c03Smrg	trap '' 0
276b12e5c03Smrg	exit $exitcode ;;
27709885543Smrg    Alpha\ *:Windows_NT*:*)
27809885543Smrg	# How do we know it's Interix rather than the generic POSIX subsystem?
27909885543Smrg	# Should we change UNAME_MACHINE based on the output of uname instead
28009885543Smrg	# of the specific Alpha model?
28109885543Smrg	echo alpha-pc-interix
28209885543Smrg	exit ;;
28309885543Smrg    21064:Windows_NT:50:3)
28409885543Smrg	echo alpha-dec-winnt3.5
28509885543Smrg	exit ;;
28609885543Smrg    Amiga*:UNIX_System_V:4.0:*)
28709885543Smrg	echo m68k-unknown-sysv4
28809885543Smrg	exit ;;
28909885543Smrg    *:[Aa]miga[Oo][Ss]:*:*)
29009885543Smrg	echo ${UNAME_MACHINE}-unknown-amigaos
29109885543Smrg	exit ;;
29209885543Smrg    *:[Mm]orph[Oo][Ss]:*:*)
29309885543Smrg	echo ${UNAME_MACHINE}-unknown-morphos
29409885543Smrg	exit ;;
29509885543Smrg    *:OS/390:*:*)
29609885543Smrg	echo i370-ibm-openedition
29709885543Smrg	exit ;;
29809885543Smrg    *:z/VM:*:*)
29909885543Smrg	echo s390-ibm-zvmoe
30009885543Smrg	exit ;;
30109885543Smrg    *:OS400:*:*)
302b12e5c03Smrg	echo powerpc-ibm-os400
30309885543Smrg	exit ;;
30409885543Smrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
30509885543Smrg	echo arm-acorn-riscix${UNAME_RELEASE}
30609885543Smrg	exit ;;
30709885543Smrg    arm:riscos:*:*|arm:RISCOS:*:*)
30809885543Smrg	echo arm-unknown-riscos
30909885543Smrg	exit ;;
31009885543Smrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
31109885543Smrg	echo hppa1.1-hitachi-hiuxmpp
31209885543Smrg	exit ;;
31309885543Smrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
31409885543Smrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
31509885543Smrg	if test "`(/bin/universe) 2>/dev/null`" = att ; then
31609885543Smrg		echo pyramid-pyramid-sysv3
31709885543Smrg	else
31809885543Smrg		echo pyramid-pyramid-bsd
31909885543Smrg	fi
32009885543Smrg	exit ;;
32109885543Smrg    NILE*:*:*:dcosx)
32209885543Smrg	echo pyramid-pyramid-svr4
32309885543Smrg	exit ;;
32409885543Smrg    DRS?6000:unix:4.0:6*)
32509885543Smrg	echo sparc-icl-nx6
32609885543Smrg	exit ;;
32709885543Smrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
32809885543Smrg	case `/usr/bin/uname -p` in
32909885543Smrg	    sparc) echo sparc-icl-nx7; exit ;;
33009885543Smrg	esac ;;
331e4f6584cSmrg    s390x:SunOS:*:*)
332e4f6584cSmrg	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
333e4f6584cSmrg	exit ;;
33409885543Smrg    sun4H:SunOS:5.*:*)
33509885543Smrg	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
33609885543Smrg	exit ;;
33709885543Smrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
33809885543Smrg	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
33909885543Smrg	exit ;;
340e4f6584cSmrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
341e4f6584cSmrg	echo i386-pc-auroraux${UNAME_RELEASE}
342e4f6584cSmrg	exit ;;
3437104f784Smrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
344e4f6584cSmrg	eval $set_cc_for_build
345e4f6584cSmrg	SUN_ARCH="i386"
346e4f6584cSmrg	# If there is a compiler, see if it is configured for 64-bit objects.
347e4f6584cSmrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
348e4f6584cSmrg	# This test works for both compilers.
349e4f6584cSmrg	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
350e4f6584cSmrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
351e4f6584cSmrg		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
352e4f6584cSmrg		grep IS_64BIT_ARCH >/dev/null
353e4f6584cSmrg	    then
354e4f6584cSmrg		SUN_ARCH="x86_64"
355e4f6584cSmrg	    fi
356e4f6584cSmrg	fi
357e4f6584cSmrg	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
35809885543Smrg	exit ;;
35909885543Smrg    sun4*:SunOS:6*:*)
36009885543Smrg	# According to config.sub, this is the proper way to canonicalize
36109885543Smrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
36209885543Smrg	# it's likely to be more like Solaris than SunOS4.
36309885543Smrg	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
36409885543Smrg	exit ;;
36509885543Smrg    sun4*:SunOS:*:*)
36609885543Smrg	case "`/usr/bin/arch -k`" in
36709885543Smrg	    Series*|S4*)
36809885543Smrg		UNAME_RELEASE=`uname -v`
36909885543Smrg		;;
37009885543Smrg	esac
37109885543Smrg	# Japanese Language versions have a version number like `4.1.3-JL'.
37209885543Smrg	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
37309885543Smrg	exit ;;
37409885543Smrg    sun3*:SunOS:*:*)
37509885543Smrg	echo m68k-sun-sunos${UNAME_RELEASE}
37609885543Smrg	exit ;;
37709885543Smrg    sun*:*:4.2BSD:*)
37809885543Smrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
37909885543Smrg	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
38009885543Smrg	case "`/bin/arch`" in
38109885543Smrg	    sun3)
38209885543Smrg		echo m68k-sun-sunos${UNAME_RELEASE}
38309885543Smrg		;;
38409885543Smrg	    sun4)
38509885543Smrg		echo sparc-sun-sunos${UNAME_RELEASE}
38609885543Smrg		;;
38709885543Smrg	esac
38809885543Smrg	exit ;;
38909885543Smrg    aushp:SunOS:*:*)
39009885543Smrg	echo sparc-auspex-sunos${UNAME_RELEASE}
39109885543Smrg	exit ;;
39209885543Smrg    # The situation for MiNT is a little confusing.  The machine name
39309885543Smrg    # can be virtually everything (everything which is not
39409885543Smrg    # "atarist" or "atariste" at least should have a processor
39509885543Smrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
39609885543Smrg    # to the lowercase version "mint" (or "freemint").  Finally
39709885543Smrg    # the system name "TOS" denotes a system which is actually not
39809885543Smrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
39909885543Smrg    # be no problem.
40009885543Smrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
401b12e5c03Smrg	echo m68k-atari-mint${UNAME_RELEASE}
40209885543Smrg	exit ;;
40309885543Smrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
40409885543Smrg	echo m68k-atari-mint${UNAME_RELEASE}
405b12e5c03Smrg	exit ;;
40609885543Smrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
407b12e5c03Smrg	echo m68k-atari-mint${UNAME_RELEASE}
40809885543Smrg	exit ;;
40909885543Smrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
410b12e5c03Smrg	echo m68k-milan-mint${UNAME_RELEASE}
411b12e5c03Smrg	exit ;;
41209885543Smrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
413b12e5c03Smrg	echo m68k-hades-mint${UNAME_RELEASE}
414b12e5c03Smrg	exit ;;
41509885543Smrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
416b12e5c03Smrg	echo m68k-unknown-mint${UNAME_RELEASE}
417b12e5c03Smrg	exit ;;
41809885543Smrg    m68k:machten:*:*)
41909885543Smrg	echo m68k-apple-machten${UNAME_RELEASE}
42009885543Smrg	exit ;;
42109885543Smrg    powerpc:machten:*:*)
42209885543Smrg	echo powerpc-apple-machten${UNAME_RELEASE}
42309885543Smrg	exit ;;
42409885543Smrg    RISC*:Mach:*:*)
42509885543Smrg	echo mips-dec-mach_bsd4.3
42609885543Smrg	exit ;;
42709885543Smrg    RISC*:ULTRIX:*:*)
42809885543Smrg	echo mips-dec-ultrix${UNAME_RELEASE}
42909885543Smrg	exit ;;
43009885543Smrg    VAX*:ULTRIX*:*:*)
43109885543Smrg	echo vax-dec-ultrix${UNAME_RELEASE}
43209885543Smrg	exit ;;
43309885543Smrg    2020:CLIX:*:* | 2430:CLIX:*:*)
43409885543Smrg	echo clipper-intergraph-clix${UNAME_RELEASE}
43509885543Smrg	exit ;;
43609885543Smrg    mips:*:*:UMIPS | mips:*:*:RISCos)
43709885543Smrg	eval $set_cc_for_build
43809885543Smrg	sed 's/^	//' << EOF >$dummy.c
43909885543Smrg#ifdef __cplusplus
44009885543Smrg#include <stdio.h>  /* for printf() prototype */
44109885543Smrg	int main (int argc, char *argv[]) {
44209885543Smrg#else
44309885543Smrg	int main (argc, argv) int argc; char *argv[]; {
44409885543Smrg#endif
44509885543Smrg	#if defined (host_mips) && defined (MIPSEB)
44609885543Smrg	#if defined (SYSTYPE_SYSV)
44709885543Smrg	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
44809885543Smrg	#endif
44909885543Smrg	#if defined (SYSTYPE_SVR4)
45009885543Smrg	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
45109885543Smrg	#endif
45209885543Smrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
45309885543Smrg	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
45409885543Smrg	#endif
45509885543Smrg	#endif
45609885543Smrg	  exit (-1);
45709885543Smrg	}
45809885543SmrgEOF
45909885543Smrg	$CC_FOR_BUILD -o $dummy $dummy.c &&
46009885543Smrg	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
46109885543Smrg	  SYSTEM_NAME=`$dummy $dummyarg` &&
46209885543Smrg	    { echo "$SYSTEM_NAME"; exit; }
46309885543Smrg	echo mips-mips-riscos${UNAME_RELEASE}
46409885543Smrg	exit ;;
46509885543Smrg    Motorola:PowerMAX_OS:*:*)
46609885543Smrg	echo powerpc-motorola-powermax
46709885543Smrg	exit ;;
46809885543Smrg    Motorola:*:4.3:PL8-*)
46909885543Smrg	echo powerpc-harris-powermax
47009885543Smrg	exit ;;
47109885543Smrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
47209885543Smrg	echo powerpc-harris-powermax
47309885543Smrg	exit ;;
47409885543Smrg    Night_Hawk:Power_UNIX:*:*)
47509885543Smrg	echo powerpc-harris-powerunix
47609885543Smrg	exit ;;
47709885543Smrg    m88k:CX/UX:7*:*)
47809885543Smrg	echo m88k-harris-cxux7
47909885543Smrg	exit ;;
48009885543Smrg    m88k:*:4*:R4*)
48109885543Smrg	echo m88k-motorola-sysv4
48209885543Smrg	exit ;;
48309885543Smrg    m88k:*:3*:R3*)
48409885543Smrg	echo m88k-motorola-sysv3
48509885543Smrg	exit ;;
48609885543Smrg    AViiON:dgux:*:*)
487b12e5c03Smrg	# DG/UX returns AViiON for all architectures
488b12e5c03Smrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
48909885543Smrg	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
49009885543Smrg	then
49109885543Smrg	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
49209885543Smrg	       [ ${TARGET_BINARY_INTERFACE}x = x ]
49309885543Smrg	    then
49409885543Smrg		echo m88k-dg-dgux${UNAME_RELEASE}
49509885543Smrg	    else
49609885543Smrg		echo m88k-dg-dguxbcs${UNAME_RELEASE}
49709885543Smrg	    fi
49809885543Smrg	else
49909885543Smrg	    echo i586-dg-dgux${UNAME_RELEASE}
50009885543Smrg	fi
501b12e5c03Smrg	exit ;;
50209885543Smrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
50309885543Smrg	echo m88k-dolphin-sysv3
50409885543Smrg	exit ;;
50509885543Smrg    M88*:*:R3*:*)
50609885543Smrg	# Delta 88k system running SVR3
50709885543Smrg	echo m88k-motorola-sysv3
50809885543Smrg	exit ;;
50909885543Smrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
51009885543Smrg	echo m88k-tektronix-sysv3
51109885543Smrg	exit ;;
51209885543Smrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
51309885543Smrg	echo m68k-tektronix-bsd
51409885543Smrg	exit ;;
51509885543Smrg    *:IRIX*:*:*)
51609885543Smrg	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
51709885543Smrg	exit ;;
51809885543Smrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
51909885543Smrg	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
52009885543Smrg	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
52109885543Smrg    i*86:AIX:*:*)
52209885543Smrg	echo i386-ibm-aix
52309885543Smrg	exit ;;
52409885543Smrg    ia64:AIX:*:*)
52509885543Smrg	if [ -x /usr/bin/oslevel ] ; then
52609885543Smrg		IBM_REV=`/usr/bin/oslevel`
52709885543Smrg	else
52809885543Smrg		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
52909885543Smrg	fi
53009885543Smrg	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
53109885543Smrg	exit ;;
53209885543Smrg    *:AIX:2:3)
53309885543Smrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
53409885543Smrg		eval $set_cc_for_build
53509885543Smrg		sed 's/^		//' << EOF >$dummy.c
53609885543Smrg		#include <sys/systemcfg.h>
53709885543Smrg
53809885543Smrg		main()
53909885543Smrg			{
54009885543Smrg			if (!__power_pc())
54109885543Smrg				exit(1);
54209885543Smrg			puts("powerpc-ibm-aix3.2.5");
54309885543Smrg			exit(0);
54409885543Smrg			}
54509885543SmrgEOF
54609885543Smrg		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
54709885543Smrg		then
54809885543Smrg			echo "$SYSTEM_NAME"
54909885543Smrg		else
55009885543Smrg			echo rs6000-ibm-aix3.2.5
55109885543Smrg		fi
55209885543Smrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
55309885543Smrg		echo rs6000-ibm-aix3.2.4
55409885543Smrg	else
55509885543Smrg		echo rs6000-ibm-aix3.2
55609885543Smrg	fi
55709885543Smrg	exit ;;
558b12e5c03Smrg    *:AIX:*:[4567])
55909885543Smrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
56009885543Smrg	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
56109885543Smrg		IBM_ARCH=rs6000
56209885543Smrg	else
56309885543Smrg		IBM_ARCH=powerpc
56409885543Smrg	fi
56509885543Smrg	if [ -x /usr/bin/oslevel ] ; then
56609885543Smrg		IBM_REV=`/usr/bin/oslevel`
56709885543Smrg	else
56809885543Smrg		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
56909885543Smrg	fi
57009885543Smrg	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
57109885543Smrg	exit ;;
57209885543Smrg    *:AIX:*:*)
57309885543Smrg	echo rs6000-ibm-aix
57409885543Smrg	exit ;;
57509885543Smrg    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
57609885543Smrg	echo romp-ibm-bsd4.4
57709885543Smrg	exit ;;
57809885543Smrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
57909885543Smrg	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
58009885543Smrg	exit ;;                             # report: romp-ibm BSD 4.3
58109885543Smrg    *:BOSX:*:*)
58209885543Smrg	echo rs6000-bull-bosx
58309885543Smrg	exit ;;
58409885543Smrg    DPX/2?00:B.O.S.:*:*)
58509885543Smrg	echo m68k-bull-sysv3
58609885543Smrg	exit ;;
58709885543Smrg    9000/[34]??:4.3bsd:1.*:*)
58809885543Smrg	echo m68k-hp-bsd
58909885543Smrg	exit ;;
59009885543Smrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
59109885543Smrg	echo m68k-hp-bsd4.4
59209885543Smrg	exit ;;
59309885543Smrg    9000/[34678]??:HP-UX:*:*)
59409885543Smrg	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
59509885543Smrg	case "${UNAME_MACHINE}" in
59609885543Smrg	    9000/31? )            HP_ARCH=m68000 ;;
59709885543Smrg	    9000/[34]?? )         HP_ARCH=m68k ;;
59809885543Smrg	    9000/[678][0-9][0-9])
59909885543Smrg		if [ -x /usr/bin/getconf ]; then
60009885543Smrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
601b12e5c03Smrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
602b12e5c03Smrg		    case "${sc_cpu_version}" in
603b12e5c03Smrg		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
604b12e5c03Smrg		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
605b12e5c03Smrg		      532)                      # CPU_PA_RISC2_0
606b12e5c03Smrg			case "${sc_kernel_bits}" in
607b12e5c03Smrg			  32) HP_ARCH="hppa2.0n" ;;
608b12e5c03Smrg			  64) HP_ARCH="hppa2.0w" ;;
60909885543Smrg			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
610b12e5c03Smrg			esac ;;
611b12e5c03Smrg		    esac
61209885543Smrg		fi
61309885543Smrg		if [ "${HP_ARCH}" = "" ]; then
61409885543Smrg		    eval $set_cc_for_build
615b12e5c03Smrg		    sed 's/^		//' << EOF >$dummy.c
61609885543Smrg
617b12e5c03Smrg		#define _HPUX_SOURCE
618b12e5c03Smrg		#include <stdlib.h>
619b12e5c03Smrg		#include <unistd.h>
62009885543Smrg
621b12e5c03Smrg		int main ()
622b12e5c03Smrg		{
623b12e5c03Smrg		#if defined(_SC_KERNEL_BITS)
624b12e5c03Smrg		    long bits = sysconf(_SC_KERNEL_BITS);
625b12e5c03Smrg		#endif
626b12e5c03Smrg		    long cpu  = sysconf (_SC_CPU_VERSION);
62709885543Smrg
628b12e5c03Smrg		    switch (cpu)
629b12e5c03Smrg			{
630b12e5c03Smrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
631b12e5c03Smrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
632b12e5c03Smrg			case CPU_PA_RISC2_0:
633b12e5c03Smrg		#if defined(_SC_KERNEL_BITS)
634b12e5c03Smrg			    switch (bits)
635b12e5c03Smrg				{
636b12e5c03Smrg				case 64: puts ("hppa2.0w"); break;
637b12e5c03Smrg				case 32: puts ("hppa2.0n"); break;
638b12e5c03Smrg				default: puts ("hppa2.0"); break;
639b12e5c03Smrg				} break;
640b12e5c03Smrg		#else  /* !defined(_SC_KERNEL_BITS) */
641b12e5c03Smrg			    puts ("hppa2.0"); break;
642b12e5c03Smrg		#endif
643b12e5c03Smrg			default: puts ("hppa1.0"); break;
644b12e5c03Smrg			}
645b12e5c03Smrg		    exit (0);
646b12e5c03Smrg		}
64709885543SmrgEOF
64809885543Smrg		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
64909885543Smrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
65009885543Smrg		fi ;;
65109885543Smrg	esac
65209885543Smrg	if [ ${HP_ARCH} = "hppa2.0w" ]
65309885543Smrg	then
65409885543Smrg	    eval $set_cc_for_build
65509885543Smrg
65609885543Smrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
65709885543Smrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
65809885543Smrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
65909885543Smrg	    #
66009885543Smrg	    # $ CC_FOR_BUILD=cc ./config.guess
66109885543Smrg	    # => hppa2.0w-hp-hpux11.23
66209885543Smrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
66309885543Smrg	    # => hppa64-hp-hpux11.23
66409885543Smrg
66509885543Smrg	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
666e4f6584cSmrg		grep -q __LP64__
66709885543Smrg	    then
66809885543Smrg		HP_ARCH="hppa2.0w"
66909885543Smrg	    else
67009885543Smrg		HP_ARCH="hppa64"
67109885543Smrg	    fi
67209885543Smrg	fi
67309885543Smrg	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
67409885543Smrg	exit ;;
67509885543Smrg    ia64:HP-UX:*:*)
67609885543Smrg	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
67709885543Smrg	echo ia64-hp-hpux${HPUX_REV}
67809885543Smrg	exit ;;
67909885543Smrg    3050*:HI-UX:*:*)
68009885543Smrg	eval $set_cc_for_build
68109885543Smrg	sed 's/^	//' << EOF >$dummy.c
68209885543Smrg	#include <unistd.h>
68309885543Smrg	int
68409885543Smrg	main ()
68509885543Smrg	{
68609885543Smrg	  long cpu = sysconf (_SC_CPU_VERSION);
68709885543Smrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
68809885543Smrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
68909885543Smrg	     results, however.  */
69009885543Smrg	  if (CPU_IS_PA_RISC (cpu))
69109885543Smrg	    {
69209885543Smrg	      switch (cpu)
69309885543Smrg		{
69409885543Smrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
69509885543Smrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
69609885543Smrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
69709885543Smrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
69809885543Smrg		}
69909885543Smrg	    }
70009885543Smrg	  else if (CPU_IS_HP_MC68K (cpu))
70109885543Smrg	    puts ("m68k-hitachi-hiuxwe2");
70209885543Smrg	  else puts ("unknown-hitachi-hiuxwe2");
70309885543Smrg	  exit (0);
70409885543Smrg	}
70509885543SmrgEOF
70609885543Smrg	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
70709885543Smrg		{ echo "$SYSTEM_NAME"; exit; }
70809885543Smrg	echo unknown-hitachi-hiuxwe2
70909885543Smrg	exit ;;
71009885543Smrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
71109885543Smrg	echo hppa1.1-hp-bsd
71209885543Smrg	exit ;;
71309885543Smrg    9000/8??:4.3bsd:*:*)
71409885543Smrg	echo hppa1.0-hp-bsd
71509885543Smrg	exit ;;
71609885543Smrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
71709885543Smrg	echo hppa1.0-hp-mpeix
71809885543Smrg	exit ;;
71909885543Smrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
72009885543Smrg	echo hppa1.1-hp-osf
72109885543Smrg	exit ;;
72209885543Smrg    hp8??:OSF1:*:*)
72309885543Smrg	echo hppa1.0-hp-osf
72409885543Smrg	exit ;;
72509885543Smrg    i*86:OSF1:*:*)
72609885543Smrg	if [ -x /usr/sbin/sysversion ] ; then
72709885543Smrg	    echo ${UNAME_MACHINE}-unknown-osf1mk
72809885543Smrg	else
72909885543Smrg	    echo ${UNAME_MACHINE}-unknown-osf1
73009885543Smrg	fi
73109885543Smrg	exit ;;
73209885543Smrg    parisc*:Lites*:*:*)
73309885543Smrg	echo hppa1.1-hp-lites
73409885543Smrg	exit ;;
73509885543Smrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
73609885543Smrg	echo c1-convex-bsd
737b12e5c03Smrg	exit ;;
73809885543Smrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
73909885543Smrg	if getsysinfo -f scalar_acc
74009885543Smrg	then echo c32-convex-bsd
74109885543Smrg	else echo c2-convex-bsd
74209885543Smrg	fi
743b12e5c03Smrg	exit ;;
74409885543Smrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
74509885543Smrg	echo c34-convex-bsd
746b12e5c03Smrg	exit ;;
74709885543Smrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
74809885543Smrg	echo c38-convex-bsd
749b12e5c03Smrg	exit ;;
75009885543Smrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
75109885543Smrg	echo c4-convex-bsd
752b12e5c03Smrg	exit ;;
75309885543Smrg    CRAY*Y-MP:*:*:*)
75409885543Smrg	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
75509885543Smrg	exit ;;
75609885543Smrg    CRAY*[A-Z]90:*:*:*)
75709885543Smrg	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
75809885543Smrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
75909885543Smrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
76009885543Smrg	      -e 's/\.[^.]*$/.X/'
76109885543Smrg	exit ;;
76209885543Smrg    CRAY*TS:*:*:*)
76309885543Smrg	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
76409885543Smrg	exit ;;
76509885543Smrg    CRAY*T3E:*:*:*)
76609885543Smrg	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
76709885543Smrg	exit ;;
76809885543Smrg    CRAY*SV1:*:*:*)
76909885543Smrg	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
77009885543Smrg	exit ;;
77109885543Smrg    *:UNICOS/mp:*:*)
77209885543Smrg	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
77309885543Smrg	exit ;;
77409885543Smrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
77509885543Smrg	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
776b12e5c03Smrg	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
777b12e5c03Smrg	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
778b12e5c03Smrg	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
779b12e5c03Smrg	exit ;;
78009885543Smrg    5000:UNIX_System_V:4.*:*)
781b12e5c03Smrg	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
782b12e5c03Smrg	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
783b12e5c03Smrg	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
78409885543Smrg	exit ;;
78509885543Smrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
78609885543Smrg	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
78709885543Smrg	exit ;;
78809885543Smrg    sparc*:BSD/OS:*:*)
78909885543Smrg	echo sparc-unknown-bsdi${UNAME_RELEASE}
79009885543Smrg	exit ;;
79109885543Smrg    *:BSD/OS:*:*)
79209885543Smrg	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
79309885543Smrg	exit ;;
79409885543Smrg    *:FreeBSD:*:*)
795b12e5c03Smrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
796b12e5c03Smrg	case ${UNAME_PROCESSOR} in
79709885543Smrg	    amd64)
79809885543Smrg		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
79909885543Smrg	    *)
800b12e5c03Smrg		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
80109885543Smrg	esac
80209885543Smrg	exit ;;
80309885543Smrg    i*:CYGWIN*:*)
80409885543Smrg	echo ${UNAME_MACHINE}-pc-cygwin
80509885543Smrg	exit ;;
8067104f784Smrg    *:MINGW*:*)
80709885543Smrg	echo ${UNAME_MACHINE}-pc-mingw32
80809885543Smrg	exit ;;
809b12e5c03Smrg    i*:MSYS*:*)
810b12e5c03Smrg	echo ${UNAME_MACHINE}-pc-msys
811b12e5c03Smrg	exit ;;
81209885543Smrg    i*:windows32*:*)
813b12e5c03Smrg	# uname -m includes "-pc" on this system.
814b12e5c03Smrg	echo ${UNAME_MACHINE}-mingw32
81509885543Smrg	exit ;;
81609885543Smrg    i*:PW*:*)
81709885543Smrg	echo ${UNAME_MACHINE}-pc-pw32
81809885543Smrg	exit ;;
819e4f6584cSmrg    *:Interix*:*)
820b12e5c03Smrg	case ${UNAME_MACHINE} in
8217104f784Smrg	    x86)
8227104f784Smrg		echo i586-pc-interix${UNAME_RELEASE}
8237104f784Smrg		exit ;;
824e4f6584cSmrg	    authenticamd | genuineintel | EM64T)
8257104f784Smrg		echo x86_64-unknown-interix${UNAME_RELEASE}
8267104f784Smrg		exit ;;
8277104f784Smrg	    IA64)
8287104f784Smrg		echo ia64-unknown-interix${UNAME_RELEASE}
8297104f784Smrg		exit ;;
8307104f784Smrg	esac ;;
83109885543Smrg    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
83209885543Smrg	echo i${UNAME_MACHINE}-pc-mks
83309885543Smrg	exit ;;
834e4f6584cSmrg    8664:Windows_NT:*)
835e4f6584cSmrg	echo x86_64-pc-mks
836e4f6584cSmrg	exit ;;
83709885543Smrg    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
83809885543Smrg	# How do we know it's Interix rather than the generic POSIX subsystem?
83909885543Smrg	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
84009885543Smrg	# UNAME_MACHINE based on the output of uname instead of i386?
84109885543Smrg	echo i586-pc-interix
84209885543Smrg	exit ;;
84309885543Smrg    i*:UWIN*:*)
84409885543Smrg	echo ${UNAME_MACHINE}-pc-uwin
84509885543Smrg	exit ;;
84609885543Smrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
84709885543Smrg	echo x86_64-unknown-cygwin
84809885543Smrg	exit ;;
84909885543Smrg    p*:CYGWIN*:*)
85009885543Smrg	echo powerpcle-unknown-cygwin
85109885543Smrg	exit ;;
85209885543Smrg    prep*:SunOS:5.*:*)
85309885543Smrg	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
85409885543Smrg	exit ;;
85509885543Smrg    *:GNU:*:*)
85609885543Smrg	# the GNU system
85709885543Smrg	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
85809885543Smrg	exit ;;
85909885543Smrg    *:GNU/*:*:*)
86009885543Smrg	# other systems with GNU libc and userland
86109885543Smrg	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
86209885543Smrg	exit ;;
86309885543Smrg    i*86:Minix:*:*)
86409885543Smrg	echo ${UNAME_MACHINE}-pc-minix
86509885543Smrg	exit ;;
866e4f6584cSmrg    alpha:Linux:*:*)
867e4f6584cSmrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
868e4f6584cSmrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
869e4f6584cSmrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
870e4f6584cSmrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
871e4f6584cSmrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
872e4f6584cSmrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
873e4f6584cSmrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
874e4f6584cSmrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
875b12e5c03Smrg	esac
876e4f6584cSmrg	objdump --private-headers /bin/sh | grep -q ld.so.1
877e4f6584cSmrg	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
878e4f6584cSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
879e4f6584cSmrg	exit ;;
88009885543Smrg    arm*:Linux:*:*)
8817104f784Smrg	eval $set_cc_for_build
8827104f784Smrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
8837104f784Smrg	    | grep -q __ARM_EABI__
8847104f784Smrg	then
8852ec8c4b4Smrg	    echo ${UNAME_MACHINE}-unknown-linux-gnu
8867104f784Smrg	else
887b12e5c03Smrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
888b12e5c03Smrg		| grep -q __ARM_PCS_VFP
889b12e5c03Smrg	    then
890b12e5c03Smrg		echo ${UNAME_MACHINE}-unknown-linux-gnueabi
891b12e5c03Smrg	    else
892b12e5c03Smrg		echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
893b12e5c03Smrg	    fi
8947104f784Smrg	fi
89509885543Smrg	exit ;;
89609885543Smrg    avr32*:Linux:*:*)
8972ec8c4b4Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
89809885543Smrg	exit ;;
89909885543Smrg    cris:Linux:*:*)
900b12e5c03Smrg	echo ${UNAME_MACHINE}-axis-linux-gnu
90109885543Smrg	exit ;;
90209885543Smrg    crisv32:Linux:*:*)
903b12e5c03Smrg	echo ${UNAME_MACHINE}-axis-linux-gnu
90409885543Smrg	exit ;;
90509885543Smrg    frv:Linux:*:*)
906b12e5c03Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
907b12e5c03Smrg	exit ;;
908b12e5c03Smrg    hexagon:Linux:*:*)
909b12e5c03Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
91009885543Smrg	exit ;;
911e4f6584cSmrg    i*86:Linux:*:*)
912e4f6584cSmrg	LIBC=gnu
913e4f6584cSmrg	eval $set_cc_for_build
914e4f6584cSmrg	sed 's/^	//' << EOF >$dummy.c
915e4f6584cSmrg	#ifdef __dietlibc__
916e4f6584cSmrg	LIBC=dietlibc
917e4f6584cSmrg	#endif
918e4f6584cSmrgEOF
919e4f6584cSmrg	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
920e4f6584cSmrg	echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
921e4f6584cSmrg	exit ;;
92209885543Smrg    ia64:Linux:*:*)
9232ec8c4b4Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
92409885543Smrg	exit ;;
92509885543Smrg    m32r*:Linux:*:*)
9262ec8c4b4Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
92709885543Smrg	exit ;;
92809885543Smrg    m68*:Linux:*:*)
9292ec8c4b4Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
93009885543Smrg	exit ;;
931e4f6584cSmrg    mips:Linux:*:* | mips64:Linux:*:*)
93209885543Smrg	eval $set_cc_for_build
93309885543Smrg	sed 's/^	//' << EOF >$dummy.c
93409885543Smrg	#undef CPU
935e4f6584cSmrg	#undef ${UNAME_MACHINE}
936e4f6584cSmrg	#undef ${UNAME_MACHINE}el
93709885543Smrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
938e4f6584cSmrg	CPU=${UNAME_MACHINE}el
93909885543Smrg	#else
94009885543Smrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
941e4f6584cSmrg	CPU=${UNAME_MACHINE}
94209885543Smrg	#else
94309885543Smrg	CPU=
94409885543Smrg	#endif
94509885543Smrg	#endif
94609885543SmrgEOF
947e4f6584cSmrg	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
9482ec8c4b4Smrg	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
94909885543Smrg	;;
95009885543Smrg    or32:Linux:*:*)
951b12e5c03Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
95209885543Smrg	exit ;;
953e4f6584cSmrg    padre:Linux:*:*)
954e4f6584cSmrg	echo sparc-unknown-linux-gnu
95509885543Smrg	exit ;;
956e4f6584cSmrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
957e4f6584cSmrg	echo hppa64-unknown-linux-gnu
9582ec8c4b4Smrg	exit ;;
95909885543Smrg    parisc:Linux:*:* | hppa:Linux:*:*)
96009885543Smrg	# Look for CPU level
96109885543Smrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
9622ec8c4b4Smrg	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
9632ec8c4b4Smrg	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
9642ec8c4b4Smrg	  *)    echo hppa-unknown-linux-gnu ;;
96509885543Smrg	esac
96609885543Smrg	exit ;;
967e4f6584cSmrg    ppc64:Linux:*:*)
968e4f6584cSmrg	echo powerpc64-unknown-linux-gnu
969e4f6584cSmrg	exit ;;
970e4f6584cSmrg    ppc:Linux:*:*)
971e4f6584cSmrg	echo powerpc-unknown-linux-gnu
97209885543Smrg	exit ;;
97309885543Smrg    s390:Linux:*:* | s390x:Linux:*:*)
97409885543Smrg	echo ${UNAME_MACHINE}-ibm-linux
97509885543Smrg	exit ;;
97609885543Smrg    sh64*:Linux:*:*)
977b12e5c03Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
97809885543Smrg	exit ;;
97909885543Smrg    sh*:Linux:*:*)
9802ec8c4b4Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
98109885543Smrg	exit ;;
98209885543Smrg    sparc:Linux:*:* | sparc64:Linux:*:*)
9832ec8c4b4Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
98409885543Smrg	exit ;;
985b12e5c03Smrg    tile*:Linux:*:*)
986b12e5c03Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
987b12e5c03Smrg	exit ;;
98809885543Smrg    vax:Linux:*:*)
9892ec8c4b4Smrg	echo ${UNAME_MACHINE}-dec-linux-gnu
99009885543Smrg	exit ;;
99109885543Smrg    x86_64:Linux:*:*)
992b12e5c03Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
9937104f784Smrg	exit ;;
9947104f784Smrg    xtensa*:Linux:*:*)
995b12e5c03Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
99609885543Smrg	exit ;;
99709885543Smrg    i*86:DYNIX/ptx:4*:*)
99809885543Smrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
99909885543Smrg	# earlier versions are messed up and put the nodename in both
100009885543Smrg	# sysname and nodename.
100109885543Smrg	echo i386-sequent-sysv4
100209885543Smrg	exit ;;
100309885543Smrg    i*86:UNIX_SV:4.2MP:2.*)
1004b12e5c03Smrg	# Unixware is an offshoot of SVR4, but it has its own version
1005b12e5c03Smrg	# number series starting with 2...
1006b12e5c03Smrg	# I am not positive that other SVR4 systems won't match this,
100709885543Smrg	# I just have to hope.  -- rms.
1008b12e5c03Smrg	# Use sysv4.2uw... so that sysv4* matches it.
100909885543Smrg	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
101009885543Smrg	exit ;;
101109885543Smrg    i*86:OS/2:*:*)
101209885543Smrg	# If we were able to find `uname', then EMX Unix compatibility
101309885543Smrg	# is probably installed.
101409885543Smrg	echo ${UNAME_MACHINE}-pc-os2-emx
101509885543Smrg	exit ;;
101609885543Smrg    i*86:XTS-300:*:STOP)
101709885543Smrg	echo ${UNAME_MACHINE}-unknown-stop
101809885543Smrg	exit ;;
101909885543Smrg    i*86:atheos:*:*)
102009885543Smrg	echo ${UNAME_MACHINE}-unknown-atheos
102109885543Smrg	exit ;;
102209885543Smrg    i*86:syllable:*:*)
102309885543Smrg	echo ${UNAME_MACHINE}-pc-syllable
102409885543Smrg	exit ;;
1025e4f6584cSmrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
102609885543Smrg	echo i386-unknown-lynxos${UNAME_RELEASE}
102709885543Smrg	exit ;;
102809885543Smrg    i*86:*DOS:*:*)
102909885543Smrg	echo ${UNAME_MACHINE}-pc-msdosdjgpp
103009885543Smrg	exit ;;
103109885543Smrg    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
103209885543Smrg	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
103309885543Smrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
103409885543Smrg		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
103509885543Smrg	else
103609885543Smrg		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
103709885543Smrg	fi
103809885543Smrg	exit ;;
103909885543Smrg    i*86:*:5:[678]*)
1040b12e5c03Smrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
104109885543Smrg	case `/bin/uname -X | grep "^Machine"` in
104209885543Smrg	    *486*)	     UNAME_MACHINE=i486 ;;
104309885543Smrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
104409885543Smrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
104509885543Smrg	esac
104609885543Smrg	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
104709885543Smrg	exit ;;
104809885543Smrg    i*86:*:3.2:*)
104909885543Smrg	if test -f /usr/options/cb.name; then
105009885543Smrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
105109885543Smrg		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
105209885543Smrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
105309885543Smrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
105409885543Smrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
105509885543Smrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
105609885543Smrg			&& UNAME_MACHINE=i586
105709885543Smrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
105809885543Smrg			&& UNAME_MACHINE=i686
105909885543Smrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
106009885543Smrg			&& UNAME_MACHINE=i686
106109885543Smrg		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
106209885543Smrg	else
106309885543Smrg		echo ${UNAME_MACHINE}-pc-sysv32
106409885543Smrg	fi
106509885543Smrg	exit ;;
106609885543Smrg    pc:*:*:*)
106709885543Smrg	# Left here for compatibility:
1068b12e5c03Smrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
1069b12e5c03Smrg	# the processor, so we play safe by assuming i586.
1070e4f6584cSmrg	# Note: whatever this is, it MUST be the same as what config.sub
1071e4f6584cSmrg	# prints for the "djgpp" host, or else GDB configury will decide that
1072e4f6584cSmrg	# this is a cross-build.
1073e4f6584cSmrg	echo i586-pc-msdosdjgpp
1074b12e5c03Smrg	exit ;;
107509885543Smrg    Intel:Mach:3*:*)
107609885543Smrg	echo i386-pc-mach3
107709885543Smrg	exit ;;
107809885543Smrg    paragon:*:*:*)
107909885543Smrg	echo i860-intel-osf1
108009885543Smrg	exit ;;
108109885543Smrg    i860:*:4.*:*) # i860-SVR4
108209885543Smrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
108309885543Smrg	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
108409885543Smrg	else # Add other i860-SVR4 vendors below as they are discovered.
108509885543Smrg	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
108609885543Smrg	fi
108709885543Smrg	exit ;;
108809885543Smrg    mini*:CTIX:SYS*5:*)
108909885543Smrg	# "miniframe"
109009885543Smrg	echo m68010-convergent-sysv
109109885543Smrg	exit ;;
109209885543Smrg    mc68k:UNIX:SYSTEM5:3.51m)
109309885543Smrg	echo m68k-convergent-sysv
109409885543Smrg	exit ;;
109509885543Smrg    M680?0:D-NIX:5.3:*)
109609885543Smrg	echo m68k-diab-dnix
109709885543Smrg	exit ;;
109809885543Smrg    M68*:*:R3V[5678]*:*)
109909885543Smrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
110009885543Smrg    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)
110109885543Smrg	OS_REL=''
110209885543Smrg	test -r /etc/.relid \
110309885543Smrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
110409885543Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
110509885543Smrg	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
110609885543Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
110709885543Smrg	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
110809885543Smrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1109b12e5c03Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1110b12e5c03Smrg	  && { echo i486-ncr-sysv4; exit; } ;;
1111e4f6584cSmrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1112e4f6584cSmrg	OS_REL='.3'
1113e4f6584cSmrg	test -r /etc/.relid \
1114e4f6584cSmrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1115e4f6584cSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1116e4f6584cSmrg	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1117e4f6584cSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1118e4f6584cSmrg	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
1119e4f6584cSmrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1120e4f6584cSmrg	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
112109885543Smrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
112209885543Smrg	echo m68k-unknown-lynxos${UNAME_RELEASE}
112309885543Smrg	exit ;;
112409885543Smrg    mc68030:UNIX_System_V:4.*:*)
112509885543Smrg	echo m68k-atari-sysv4
112609885543Smrg	exit ;;
112709885543Smrg    TSUNAMI:LynxOS:2.*:*)
112809885543Smrg	echo sparc-unknown-lynxos${UNAME_RELEASE}
112909885543Smrg	exit ;;
113009885543Smrg    rs6000:LynxOS:2.*:*)
113109885543Smrg	echo rs6000-unknown-lynxos${UNAME_RELEASE}
113209885543Smrg	exit ;;
1133e4f6584cSmrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
113409885543Smrg	echo powerpc-unknown-lynxos${UNAME_RELEASE}
113509885543Smrg	exit ;;
113609885543Smrg    SM[BE]S:UNIX_SV:*:*)
113709885543Smrg	echo mips-dde-sysv${UNAME_RELEASE}
113809885543Smrg	exit ;;
113909885543Smrg    RM*:ReliantUNIX-*:*:*)
114009885543Smrg	echo mips-sni-sysv4
114109885543Smrg	exit ;;
114209885543Smrg    RM*:SINIX-*:*:*)
114309885543Smrg	echo mips-sni-sysv4
114409885543Smrg	exit ;;
114509885543Smrg    *:SINIX-*:*:*)
114609885543Smrg	if uname -p 2>/dev/null >/dev/null ; then
114709885543Smrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
114809885543Smrg		echo ${UNAME_MACHINE}-sni-sysv4
114909885543Smrg	else
115009885543Smrg		echo ns32k-sni-sysv
115109885543Smrg	fi
115209885543Smrg	exit ;;
1153b12e5c03Smrg    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1154b12e5c03Smrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
1155b12e5c03Smrg	echo i586-unisys-sysv4
1156b12e5c03Smrg	exit ;;
115709885543Smrg    *:UNIX_System_V:4*:FTX*)
115809885543Smrg	# From Gerald Hewes <hewes@openmarket.com>.
115909885543Smrg	# How about differentiating between stratus architectures? -djm
116009885543Smrg	echo hppa1.1-stratus-sysv4
116109885543Smrg	exit ;;
116209885543Smrg    *:*:*:FTX*)
116309885543Smrg	# From seanf@swdc.stratus.com.
116409885543Smrg	echo i860-stratus-sysv4
116509885543Smrg	exit ;;
116609885543Smrg    i*86:VOS:*:*)
116709885543Smrg	# From Paul.Green@stratus.com.
116809885543Smrg	echo ${UNAME_MACHINE}-stratus-vos
116909885543Smrg	exit ;;
117009885543Smrg    *:VOS:*:*)
117109885543Smrg	# From Paul.Green@stratus.com.
117209885543Smrg	echo hppa1.1-stratus-vos
117309885543Smrg	exit ;;
117409885543Smrg    mc68*:A/UX:*:*)
117509885543Smrg	echo m68k-apple-aux${UNAME_RELEASE}
117609885543Smrg	exit ;;
117709885543Smrg    news*:NEWS-OS:6*:*)
117809885543Smrg	echo mips-sony-newsos6
117909885543Smrg	exit ;;
118009885543Smrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
118109885543Smrg	if [ -d /usr/nec ]; then
1182b12e5c03Smrg		echo mips-nec-sysv${UNAME_RELEASE}
118309885543Smrg	else
1184b12e5c03Smrg		echo mips-unknown-sysv${UNAME_RELEASE}
118509885543Smrg	fi
1186b12e5c03Smrg	exit ;;
118709885543Smrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
118809885543Smrg	echo powerpc-be-beos
118909885543Smrg	exit ;;
119009885543Smrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
119109885543Smrg	echo powerpc-apple-beos
119209885543Smrg	exit ;;
119309885543Smrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
119409885543Smrg	echo i586-pc-beos
119509885543Smrg	exit ;;
1196e4f6584cSmrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
1197e4f6584cSmrg	echo i586-pc-haiku
1198e4f6584cSmrg	exit ;;
119909885543Smrg    SX-4:SUPER-UX:*:*)
120009885543Smrg	echo sx4-nec-superux${UNAME_RELEASE}
120109885543Smrg	exit ;;
120209885543Smrg    SX-5:SUPER-UX:*:*)
120309885543Smrg	echo sx5-nec-superux${UNAME_RELEASE}
120409885543Smrg	exit ;;
120509885543Smrg    SX-6:SUPER-UX:*:*)
120609885543Smrg	echo sx6-nec-superux${UNAME_RELEASE}
120709885543Smrg	exit ;;
12087104f784Smrg    SX-7:SUPER-UX:*:*)
12097104f784Smrg	echo sx7-nec-superux${UNAME_RELEASE}
12107104f784Smrg	exit ;;
12117104f784Smrg    SX-8:SUPER-UX:*:*)
12127104f784Smrg	echo sx8-nec-superux${UNAME_RELEASE}
12137104f784Smrg	exit ;;
12147104f784Smrg    SX-8R:SUPER-UX:*:*)
12157104f784Smrg	echo sx8r-nec-superux${UNAME_RELEASE}
12167104f784Smrg	exit ;;
121709885543Smrg    Power*:Rhapsody:*:*)
121809885543Smrg	echo powerpc-apple-rhapsody${UNAME_RELEASE}
121909885543Smrg	exit ;;
122009885543Smrg    *:Rhapsody:*:*)
122109885543Smrg	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
122209885543Smrg	exit ;;
122309885543Smrg    *:Darwin:*:*)
122409885543Smrg	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
122509885543Smrg	case $UNAME_PROCESSOR in
1226e4f6584cSmrg	    i386)
1227e4f6584cSmrg		eval $set_cc_for_build
1228e4f6584cSmrg		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
1229e4f6584cSmrg		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1230e4f6584cSmrg		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
1231e4f6584cSmrg		      grep IS_64BIT_ARCH >/dev/null
1232e4f6584cSmrg		  then
1233e4f6584cSmrg		      UNAME_PROCESSOR="x86_64"
1234e4f6584cSmrg		  fi
1235e4f6584cSmrg		fi ;;
123609885543Smrg	    unknown) UNAME_PROCESSOR=powerpc ;;
123709885543Smrg	esac
123809885543Smrg	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
123909885543Smrg	exit ;;
124009885543Smrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
124109885543Smrg	UNAME_PROCESSOR=`uname -p`
124209885543Smrg	if test "$UNAME_PROCESSOR" = "x86"; then
124309885543Smrg		UNAME_PROCESSOR=i386
124409885543Smrg		UNAME_MACHINE=pc
124509885543Smrg	fi
124609885543Smrg	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
124709885543Smrg	exit ;;
124809885543Smrg    *:QNX:*:4*)
124909885543Smrg	echo i386-pc-qnx
125009885543Smrg	exit ;;
1251b12e5c03Smrg    NEO-?:NONSTOP_KERNEL:*:*)
1252b12e5c03Smrg	echo neo-tandem-nsk${UNAME_RELEASE}
1253b12e5c03Smrg	exit ;;
125409885543Smrg    NSE-?:NONSTOP_KERNEL:*:*)
125509885543Smrg	echo nse-tandem-nsk${UNAME_RELEASE}
125609885543Smrg	exit ;;
125709885543Smrg    NSR-?:NONSTOP_KERNEL:*:*)
125809885543Smrg	echo nsr-tandem-nsk${UNAME_RELEASE}
125909885543Smrg	exit ;;
126009885543Smrg    *:NonStop-UX:*:*)
126109885543Smrg	echo mips-compaq-nonstopux
126209885543Smrg	exit ;;
126309885543Smrg    BS2000:POSIX*:*:*)
126409885543Smrg	echo bs2000-siemens-sysv
126509885543Smrg	exit ;;
126609885543Smrg    DS/*:UNIX_System_V:*:*)
126709885543Smrg	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
126809885543Smrg	exit ;;
126909885543Smrg    *:Plan9:*:*)
127009885543Smrg	# "uname -m" is not consistent, so use $cputype instead. 386
127109885543Smrg	# is converted to i386 for consistency with other x86
127209885543Smrg	# operating systems.
127309885543Smrg	if test "$cputype" = "386"; then
127409885543Smrg	    UNAME_MACHINE=i386
127509885543Smrg	else
127609885543Smrg	    UNAME_MACHINE="$cputype"
127709885543Smrg	fi
127809885543Smrg	echo ${UNAME_MACHINE}-unknown-plan9
127909885543Smrg	exit ;;
128009885543Smrg    *:TOPS-10:*:*)
128109885543Smrg	echo pdp10-unknown-tops10
128209885543Smrg	exit ;;
128309885543Smrg    *:TENEX:*:*)
128409885543Smrg	echo pdp10-unknown-tenex
128509885543Smrg	exit ;;
128609885543Smrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
128709885543Smrg	echo pdp10-dec-tops20
128809885543Smrg	exit ;;
128909885543Smrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
129009885543Smrg	echo pdp10-xkl-tops20
129109885543Smrg	exit ;;
129209885543Smrg    *:TOPS-20:*:*)
129309885543Smrg	echo pdp10-unknown-tops20
129409885543Smrg	exit ;;
129509885543Smrg    *:ITS:*:*)
129609885543Smrg	echo pdp10-unknown-its
129709885543Smrg	exit ;;
129809885543Smrg    SEI:*:*:SEIUX)
1299b12e5c03Smrg	echo mips-sei-seiux${UNAME_RELEASE}
130009885543Smrg	exit ;;
130109885543Smrg    *:DragonFly:*:*)
130209885543Smrg	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
130309885543Smrg	exit ;;
130409885543Smrg    *:*VMS:*:*)
1305b12e5c03Smrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
130609885543Smrg	case "${UNAME_MACHINE}" in
130709885543Smrg	    A*) echo alpha-dec-vms ; exit ;;
130809885543Smrg	    I*) echo ia64-dec-vms ; exit ;;
130909885543Smrg	    V*) echo vax-dec-vms ; exit ;;
131009885543Smrg	esac ;;
131109885543Smrg    *:XENIX:*:SysV)
131209885543Smrg	echo i386-pc-xenix
131309885543Smrg	exit ;;
131409885543Smrg    i*86:skyos:*:*)
131509885543Smrg	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
131609885543Smrg	exit ;;
131709885543Smrg    i*86:rdos:*:*)
131809885543Smrg	echo ${UNAME_MACHINE}-pc-rdos
131909885543Smrg	exit ;;
1320e4f6584cSmrg    i*86:AROS:*:*)
1321e4f6584cSmrg	echo ${UNAME_MACHINE}-pc-aros
1322e4f6584cSmrg	exit ;;
132309885543Smrgesac
132409885543Smrg
132509885543Smrg#echo '(No uname command or uname output not recognized.)' 1>&2
132609885543Smrg#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
132709885543Smrg
132809885543Smrgeval $set_cc_for_build
132909885543Smrgcat >$dummy.c <<EOF
133009885543Smrg#ifdef _SEQUENT_
133109885543Smrg# include <sys/types.h>
133209885543Smrg# include <sys/utsname.h>
133309885543Smrg#endif
133409885543Smrgmain ()
133509885543Smrg{
133609885543Smrg#if defined (sony)
133709885543Smrg#if defined (MIPSEB)
133809885543Smrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
133909885543Smrg     I don't know....  */
134009885543Smrg  printf ("mips-sony-bsd\n"); exit (0);
134109885543Smrg#else
134209885543Smrg#include <sys/param.h>
134309885543Smrg  printf ("m68k-sony-newsos%s\n",
134409885543Smrg#ifdef NEWSOS4
1345b12e5c03Smrg	"4"
134609885543Smrg#else
1347b12e5c03Smrg	""
134809885543Smrg#endif
1349b12e5c03Smrg	); exit (0);
135009885543Smrg#endif
135109885543Smrg#endif
135209885543Smrg
135309885543Smrg#if defined (__arm) && defined (__acorn) && defined (__unix)
135409885543Smrg  printf ("arm-acorn-riscix\n"); exit (0);
135509885543Smrg#endif
135609885543Smrg
135709885543Smrg#if defined (hp300) && !defined (hpux)
135809885543Smrg  printf ("m68k-hp-bsd\n"); exit (0);
135909885543Smrg#endif
136009885543Smrg
136109885543Smrg#if defined (NeXT)
136209885543Smrg#if !defined (__ARCHITECTURE__)
136309885543Smrg#define __ARCHITECTURE__ "m68k"
136409885543Smrg#endif
136509885543Smrg  int version;
136609885543Smrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
136709885543Smrg  if (version < 4)
136809885543Smrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
136909885543Smrg  else
137009885543Smrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
137109885543Smrg  exit (0);
137209885543Smrg#endif
137309885543Smrg
137409885543Smrg#if defined (MULTIMAX) || defined (n16)
137509885543Smrg#if defined (UMAXV)
137609885543Smrg  printf ("ns32k-encore-sysv\n"); exit (0);
137709885543Smrg#else
137809885543Smrg#if defined (CMU)
137909885543Smrg  printf ("ns32k-encore-mach\n"); exit (0);
138009885543Smrg#else
138109885543Smrg  printf ("ns32k-encore-bsd\n"); exit (0);
138209885543Smrg#endif
138309885543Smrg#endif
138409885543Smrg#endif
138509885543Smrg
138609885543Smrg#if defined (__386BSD__)
138709885543Smrg  printf ("i386-pc-bsd\n"); exit (0);
138809885543Smrg#endif
138909885543Smrg
139009885543Smrg#if defined (sequent)
139109885543Smrg#if defined (i386)
139209885543Smrg  printf ("i386-sequent-dynix\n"); exit (0);
139309885543Smrg#endif
139409885543Smrg#if defined (ns32000)
139509885543Smrg  printf ("ns32k-sequent-dynix\n"); exit (0);
139609885543Smrg#endif
139709885543Smrg#endif
139809885543Smrg
139909885543Smrg#if defined (_SEQUENT_)
140009885543Smrg    struct utsname un;
140109885543Smrg
140209885543Smrg    uname(&un);
140309885543Smrg
140409885543Smrg    if (strncmp(un.version, "V2", 2) == 0) {
140509885543Smrg	printf ("i386-sequent-ptx2\n"); exit (0);
140609885543Smrg    }
140709885543Smrg    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
140809885543Smrg	printf ("i386-sequent-ptx1\n"); exit (0);
140909885543Smrg    }
141009885543Smrg    printf ("i386-sequent-ptx\n"); exit (0);
141109885543Smrg
141209885543Smrg#endif
141309885543Smrg
141409885543Smrg#if defined (vax)
141509885543Smrg# if !defined (ultrix)
141609885543Smrg#  include <sys/param.h>
141709885543Smrg#  if defined (BSD)
141809885543Smrg#   if BSD == 43
141909885543Smrg      printf ("vax-dec-bsd4.3\n"); exit (0);
142009885543Smrg#   else
142109885543Smrg#    if BSD == 199006
142209885543Smrg      printf ("vax-dec-bsd4.3reno\n"); exit (0);
142309885543Smrg#    else
142409885543Smrg      printf ("vax-dec-bsd\n"); exit (0);
142509885543Smrg#    endif
142609885543Smrg#   endif
142709885543Smrg#  else
142809885543Smrg    printf ("vax-dec-bsd\n"); exit (0);
142909885543Smrg#  endif
143009885543Smrg# else
143109885543Smrg    printf ("vax-dec-ultrix\n"); exit (0);
143209885543Smrg# endif
143309885543Smrg#endif
143409885543Smrg
143509885543Smrg#if defined (alliant) && defined (i860)
143609885543Smrg  printf ("i860-alliant-bsd\n"); exit (0);
143709885543Smrg#endif
143809885543Smrg
143909885543Smrg  exit (1);
144009885543Smrg}
144109885543SmrgEOF
144209885543Smrg
144309885543Smrg$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
144409885543Smrg	{ echo "$SYSTEM_NAME"; exit; }
144509885543Smrg
144609885543Smrg# Apollos put the system type in the environment.
144709885543Smrg
144809885543Smrgtest -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
144909885543Smrg
145009885543Smrg# Convex versions that predate uname can use getsysinfo(1)
145109885543Smrg
145209885543Smrgif [ -x /usr/convex/getsysinfo ]
145309885543Smrgthen
145409885543Smrg    case `getsysinfo -f cpu_type` in
145509885543Smrg    c1*)
145609885543Smrg	echo c1-convex-bsd
145709885543Smrg	exit ;;
145809885543Smrg    c2*)
145909885543Smrg	if getsysinfo -f scalar_acc
146009885543Smrg	then echo c32-convex-bsd
146109885543Smrg	else echo c2-convex-bsd
146209885543Smrg	fi
146309885543Smrg	exit ;;
146409885543Smrg    c34*)
146509885543Smrg	echo c34-convex-bsd
146609885543Smrg	exit ;;
146709885543Smrg    c38*)
146809885543Smrg	echo c38-convex-bsd
146909885543Smrg	exit ;;
147009885543Smrg    c4*)
147109885543Smrg	echo c4-convex-bsd
147209885543Smrg	exit ;;
147309885543Smrg    esac
147409885543Smrgfi
147509885543Smrg
147609885543Smrgcat >&2 <<EOF
147709885543Smrg$0: unable to guess system type
147809885543Smrg
147909885543SmrgThis script, last modified $timestamp, has failed to recognize
148009885543Smrgthe operating system you are using. It is advised that you
148109885543Smrgdownload the most up to date version of the config scripts from
148209885543Smrg
14837104f784Smrg  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
148409885543Smrgand
14857104f784Smrg  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
148609885543Smrg
148709885543SmrgIf the version you run ($0) is already up to date, please
148809885543Smrgsend the following data and any information you think might be
148909885543Smrgpertinent to <config-patches@gnu.org> in order to provide the needed
149009885543Smrginformation to handle your system.
149109885543Smrg
149209885543Smrgconfig.guess timestamp = $timestamp
149309885543Smrg
149409885543Smrguname -m = `(uname -m) 2>/dev/null || echo unknown`
149509885543Smrguname -r = `(uname -r) 2>/dev/null || echo unknown`
149609885543Smrguname -s = `(uname -s) 2>/dev/null || echo unknown`
149709885543Smrguname -v = `(uname -v) 2>/dev/null || echo unknown`
149809885543Smrg
149909885543Smrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
150009885543Smrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
150109885543Smrg
150209885543Smrghostinfo               = `(hostinfo) 2>/dev/null`
150309885543Smrg/bin/universe          = `(/bin/universe) 2>/dev/null`
150409885543Smrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
150509885543Smrg/bin/arch              = `(/bin/arch) 2>/dev/null`
150609885543Smrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
150709885543Smrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
150809885543Smrg
150909885543SmrgUNAME_MACHINE = ${UNAME_MACHINE}
151009885543SmrgUNAME_RELEASE = ${UNAME_RELEASE}
151109885543SmrgUNAME_SYSTEM  = ${UNAME_SYSTEM}
151209885543SmrgUNAME_VERSION = ${UNAME_VERSION}
151309885543SmrgEOF
151409885543Smrg
151509885543Smrgexit 1
151609885543Smrg
151709885543Smrg# Local variables:
151809885543Smrg# eval: (add-hook 'write-file-hooks 'time-stamp)
151909885543Smrg# time-stamp-start: "timestamp='"
152009885543Smrg# time-stamp-format: "%:y-%02m-%02d"
152109885543Smrg# time-stamp-end: "'"
152209885543Smrg# End:
1523