config.guess revision 47202d7b
129459361Smrg#! /bin/sh
229459361Smrg# Attempt to guess a canonical system name.
329459361Smrg#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
447202d7bSmrg#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
547202d7bSmrg#   Free Software Foundation, Inc.
629459361Smrg
747202d7bSmrgtimestamp='2009-04-27'
829459361Smrg
929459361Smrg# This file is free software; you can redistribute it and/or modify it
1029459361Smrg# under the terms of the GNU General Public License as published by
1129459361Smrg# the Free Software Foundation; either version 2 of the License, or
1229459361Smrg# (at your option) any later version.
1329459361Smrg#
1429459361Smrg# This program is distributed in the hope that it will be useful, but
1529459361Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1629459361Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1729459361Smrg# General Public License for more details.
1829459361Smrg#
1929459361Smrg# You should have received a copy of the GNU General Public License
2029459361Smrg# along with this program; if not, write to the Free Software
2129459361Smrg# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
2229459361Smrg# 02110-1301, USA.
2329459361Smrg#
2429459361Smrg# As a special exception to the GNU General Public License, if you
2529459361Smrg# distribute this file as part of a program that contains a
2629459361Smrg# configuration script generated by Autoconf, you may include it under
2729459361Smrg# the same distribution terms that you use for the rest of that program.
2829459361Smrg
2929459361Smrg
3029459361Smrg# Originally written by Per Bothner <per@bothner.com>.
3129459361Smrg# Please send patches to <config-patches@gnu.org>.  Submit a context
3229459361Smrg# diff and a properly formatted ChangeLog entry.
3329459361Smrg#
3429459361Smrg# This script attempts to guess a canonical system name similar to
3529459361Smrg# config.sub.  If it succeeds, it prints the system name on stdout, and
3629459361Smrg# exits with 0.  Otherwise, it exits with 1.
3729459361Smrg#
3829459361Smrg# The plan is that this can be called by configure scripts if you
3929459361Smrg# don't specify an explicit build system type.
4029459361Smrg
4129459361Smrgme=`echo "$0" | sed -e 's,.*/,,'`
4229459361Smrg
4329459361Smrgusage="\
4429459361SmrgUsage: $0 [OPTION]
4529459361Smrg
4629459361SmrgOutput the configuration name of the system \`$me' is run on.
4729459361Smrg
4829459361SmrgOperation modes:
4929459361Smrg  -h, --help         print this help, then exit
5029459361Smrg  -t, --time-stamp   print date of last modification, then exit
5129459361Smrg  -v, --version      print version number, then exit
5229459361Smrg
5329459361SmrgReport bugs and patches to <config-patches@gnu.org>."
5429459361Smrg
5529459361Smrgversion="\
5629459361SmrgGNU config.guess ($timestamp)
5729459361Smrg
5829459361SmrgOriginally written by Per Bothner.
5947202d7bSmrgCopyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
6047202d7bSmrg2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
6129459361Smrg
6229459361SmrgThis is free software; see the source for copying conditions.  There is NO
6329459361Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
6429459361Smrg
6529459361Smrghelp="
6629459361SmrgTry \`$me --help' for more information."
6729459361Smrg
6829459361Smrg# Parse command line
6929459361Smrgwhile test $# -gt 0 ; do
7029459361Smrg  case $1 in
7129459361Smrg    --time-stamp | --time* | -t )
7229459361Smrg       echo "$timestamp" ; exit ;;
7329459361Smrg    --version | -v )
7429459361Smrg       echo "$version" ; exit ;;
7529459361Smrg    --help | --h* | -h )
7629459361Smrg       echo "$usage"; exit ;;
7729459361Smrg    -- )     # Stop option processing
7829459361Smrg       shift; break ;;
7929459361Smrg    - )	# Use stdin as input.
8029459361Smrg       break ;;
8129459361Smrg    -* )
8229459361Smrg       echo "$me: invalid option $1$help" >&2
8329459361Smrg       exit 1 ;;
8429459361Smrg    * )
8529459361Smrg       break ;;
8629459361Smrg  esac
8729459361Smrgdone
8829459361Smrg
8929459361Smrgif test $# != 0; then
9029459361Smrg  echo "$me: too many arguments$help" >&2
9129459361Smrg  exit 1
9229459361Smrgfi
9329459361Smrg
9429459361Smrgtrap 'exit 1' 1 2 15
9529459361Smrg
9629459361Smrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
9729459361Smrg# compiler to aid in system detection is discouraged as it requires
9829459361Smrg# temporary files to be created and, as you can see below, it is a
9929459361Smrg# headache to deal with in a portable fashion.
10029459361Smrg
10129459361Smrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
10229459361Smrg# use `HOST_CC' if defined, but it is deprecated.
10329459361Smrg
10429459361Smrg# Portable tmp directory creation inspired by the Autoconf team.
10529459361Smrg
10629459361Smrgset_cc_for_build='
10729459361Smrgtrap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
10829459361Smrgtrap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
10929459361Smrg: ${TMPDIR=/tmp} ;
11029459361Smrg { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
11129459361Smrg { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
11229459361Smrg { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
11329459361Smrg { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
11429459361Smrgdummy=$tmp/dummy ;
11529459361Smrgtmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
11629459361Smrgcase $CC_FOR_BUILD,$HOST_CC,$CC in
11729459361Smrg ,,)    echo "int x;" > $dummy.c ;
11829459361Smrg	for c in cc gcc c89 c99 ; do
11929459361Smrg	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
12029459361Smrg	     CC_FOR_BUILD="$c"; break ;
12129459361Smrg	  fi ;
12229459361Smrg	done ;
12329459361Smrg	if test x"$CC_FOR_BUILD" = x ; then
12429459361Smrg	  CC_FOR_BUILD=no_compiler_found ;
12529459361Smrg	fi
12629459361Smrg	;;
12729459361Smrg ,,*)   CC_FOR_BUILD=$CC ;;
12829459361Smrg ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
12929459361Smrgesac ; set_cc_for_build= ;'
13029459361Smrg
13129459361Smrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
13229459361Smrg# (ghazi@noc.rutgers.edu 1994-08-24)
13329459361Smrgif (test -f /.attbin/uname) >/dev/null 2>&1 ; then
13429459361Smrg	PATH=$PATH:/.attbin ; export PATH
13529459361Smrgfi
13629459361Smrg
13729459361SmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
13829459361SmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
13929459361SmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
14029459361SmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
14129459361Smrg
14229459361Smrg# Note: order is significant - the case branches are not exclusive.
14329459361Smrg
14429459361Smrgcase "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
14529459361Smrg    *:NetBSD:*:*)
14629459361Smrg	# NetBSD (nbsd) targets should (where applicable) match one or
14729459361Smrg	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
14829459361Smrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
14929459361Smrg	# switched to ELF, *-*-netbsd* would select the old
15029459361Smrg	# object file format.  This provides both forward
15129459361Smrg	# compatibility and a consistent mechanism for selecting the
15229459361Smrg	# object file format.
15329459361Smrg	#
15429459361Smrg	# Note: NetBSD doesn't particularly care about the vendor
15529459361Smrg	# portion of the name.  We always set it to "unknown".
15629459361Smrg	sysctl="sysctl -n hw.machine_arch"
15729459361Smrg	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
15829459361Smrg	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
15929459361Smrg	case "${UNAME_MACHINE_ARCH}" in
16029459361Smrg	    armeb) machine=armeb-unknown ;;
16129459361Smrg	    arm*) machine=arm-unknown ;;
16229459361Smrg	    sh3el) machine=shl-unknown ;;
16329459361Smrg	    sh3eb) machine=sh-unknown ;;
16429459361Smrg	    sh5el) machine=sh5le-unknown ;;
16529459361Smrg	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
16629459361Smrg	esac
16729459361Smrg	# The Operating System including object format, if it has switched
16829459361Smrg	# to ELF recently, or will in the future.
16929459361Smrg	case "${UNAME_MACHINE_ARCH}" in
17029459361Smrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
17129459361Smrg		eval $set_cc_for_build
17229459361Smrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
17329459361Smrg			| grep __ELF__ >/dev/null
17429459361Smrg		then
17529459361Smrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
17629459361Smrg		    # Return netbsd for either.  FIX?
17729459361Smrg		    os=netbsd
17829459361Smrg		else
17929459361Smrg		    os=netbsdelf
18029459361Smrg		fi
18129459361Smrg		;;
18229459361Smrg	    *)
18329459361Smrg	        os=netbsd
18429459361Smrg		;;
18529459361Smrg	esac
18629459361Smrg	# The OS release
18729459361Smrg	# Debian GNU/NetBSD machines have a different userland, and
18829459361Smrg	# thus, need a distinct triplet. However, they do not need
18929459361Smrg	# kernel version information, so it can be replaced with a
19029459361Smrg	# suitable tag, in the style of linux-gnu.
19129459361Smrg	case "${UNAME_VERSION}" in
19229459361Smrg	    Debian*)
19329459361Smrg		release='-gnu'
19429459361Smrg		;;
19529459361Smrg	    *)
19629459361Smrg		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
19729459361Smrg		;;
19829459361Smrg	esac
19929459361Smrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
20029459361Smrg	# contains redundant information, the shorter form:
20129459361Smrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
20229459361Smrg	echo "${machine}-${os}${release}"
20329459361Smrg	exit ;;
20429459361Smrg    *:OpenBSD:*:*)
20529459361Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
20629459361Smrg	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
20729459361Smrg	exit ;;
20829459361Smrg    *:ekkoBSD:*:*)
20929459361Smrg	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
21029459361Smrg	exit ;;
21129459361Smrg    *:SolidBSD:*:*)
21229459361Smrg	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
21329459361Smrg	exit ;;
21429459361Smrg    macppc:MirBSD:*:*)
21529459361Smrg	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
21629459361Smrg	exit ;;
21729459361Smrg    *:MirBSD:*:*)
21829459361Smrg	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
21929459361Smrg	exit ;;
22029459361Smrg    alpha:OSF1:*:*)
22129459361Smrg	case $UNAME_RELEASE in
22229459361Smrg	*4.0)
22329459361Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
22429459361Smrg		;;
22529459361Smrg	*5.*)
22629459361Smrg	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
22729459361Smrg		;;
22829459361Smrg	esac
22929459361Smrg	# According to Compaq, /usr/sbin/psrinfo has been available on
23029459361Smrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
23129459361Smrg	# covers most systems running today.  This code pipes the CPU
23229459361Smrg	# types through head -n 1, so we only detect the type of CPU 0.
23329459361Smrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
23429459361Smrg	case "$ALPHA_CPU_TYPE" in
23529459361Smrg	    "EV4 (21064)")
23629459361Smrg		UNAME_MACHINE="alpha" ;;
23729459361Smrg	    "EV4.5 (21064)")
23829459361Smrg		UNAME_MACHINE="alpha" ;;
23929459361Smrg	    "LCA4 (21066/21068)")
24029459361Smrg		UNAME_MACHINE="alpha" ;;
24129459361Smrg	    "EV5 (21164)")
24229459361Smrg		UNAME_MACHINE="alphaev5" ;;
24329459361Smrg	    "EV5.6 (21164A)")
24429459361Smrg		UNAME_MACHINE="alphaev56" ;;
24529459361Smrg	    "EV5.6 (21164PC)")
24629459361Smrg		UNAME_MACHINE="alphapca56" ;;
24729459361Smrg	    "EV5.7 (21164PC)")
24829459361Smrg		UNAME_MACHINE="alphapca57" ;;
24929459361Smrg	    "EV6 (21264)")
25029459361Smrg		UNAME_MACHINE="alphaev6" ;;
25129459361Smrg	    "EV6.7 (21264A)")
25229459361Smrg		UNAME_MACHINE="alphaev67" ;;
25329459361Smrg	    "EV6.8CB (21264C)")
25429459361Smrg		UNAME_MACHINE="alphaev68" ;;
25529459361Smrg	    "EV6.8AL (21264B)")
25629459361Smrg		UNAME_MACHINE="alphaev68" ;;
25729459361Smrg	    "EV6.8CX (21264D)")
25829459361Smrg		UNAME_MACHINE="alphaev68" ;;
25929459361Smrg	    "EV6.9A (21264/EV69A)")
26029459361Smrg		UNAME_MACHINE="alphaev69" ;;
26129459361Smrg	    "EV7 (21364)")
26229459361Smrg		UNAME_MACHINE="alphaev7" ;;
26329459361Smrg	    "EV7.9 (21364A)")
26429459361Smrg		UNAME_MACHINE="alphaev79" ;;
26529459361Smrg	esac
26629459361Smrg	# A Pn.n version is a patched version.
26729459361Smrg	# A Vn.n version is a released version.
26829459361Smrg	# A Tn.n version is a released field test version.
26929459361Smrg	# A Xn.n version is an unreleased experimental baselevel.
27029459361Smrg	# 1.2 uses "1.2" for uname -r.
27129459361Smrg	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
27229459361Smrg	exit ;;
27329459361Smrg    Alpha\ *:Windows_NT*:*)
27429459361Smrg	# How do we know it's Interix rather than the generic POSIX subsystem?
27529459361Smrg	# Should we change UNAME_MACHINE based on the output of uname instead
27629459361Smrg	# of the specific Alpha model?
27729459361Smrg	echo alpha-pc-interix
27829459361Smrg	exit ;;
27929459361Smrg    21064:Windows_NT:50:3)
28029459361Smrg	echo alpha-dec-winnt3.5
28129459361Smrg	exit ;;
28229459361Smrg    Amiga*:UNIX_System_V:4.0:*)
28329459361Smrg	echo m68k-unknown-sysv4
28429459361Smrg	exit ;;
28529459361Smrg    *:[Aa]miga[Oo][Ss]:*:*)
28629459361Smrg	echo ${UNAME_MACHINE}-unknown-amigaos
28729459361Smrg	exit ;;
28829459361Smrg    *:[Mm]orph[Oo][Ss]:*:*)
28929459361Smrg	echo ${UNAME_MACHINE}-unknown-morphos
29029459361Smrg	exit ;;
29129459361Smrg    *:OS/390:*:*)
29229459361Smrg	echo i370-ibm-openedition
29329459361Smrg	exit ;;
29429459361Smrg    *:z/VM:*:*)
29529459361Smrg	echo s390-ibm-zvmoe
29629459361Smrg	exit ;;
29729459361Smrg    *:OS400:*:*)
29829459361Smrg        echo powerpc-ibm-os400
29929459361Smrg	exit ;;
30029459361Smrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
30129459361Smrg	echo arm-acorn-riscix${UNAME_RELEASE}
30229459361Smrg	exit ;;
30329459361Smrg    arm:riscos:*:*|arm:RISCOS:*:*)
30429459361Smrg	echo arm-unknown-riscos
30529459361Smrg	exit ;;
30629459361Smrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
30729459361Smrg	echo hppa1.1-hitachi-hiuxmpp
30829459361Smrg	exit ;;
30929459361Smrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
31029459361Smrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
31129459361Smrg	if test "`(/bin/universe) 2>/dev/null`" = att ; then
31229459361Smrg		echo pyramid-pyramid-sysv3
31329459361Smrg	else
31429459361Smrg		echo pyramid-pyramid-bsd
31529459361Smrg	fi
31629459361Smrg	exit ;;
31729459361Smrg    NILE*:*:*:dcosx)
31829459361Smrg	echo pyramid-pyramid-svr4
31929459361Smrg	exit ;;
32029459361Smrg    DRS?6000:unix:4.0:6*)
32129459361Smrg	echo sparc-icl-nx6
32229459361Smrg	exit ;;
32329459361Smrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
32429459361Smrg	case `/usr/bin/uname -p` in
32529459361Smrg	    sparc) echo sparc-icl-nx7; exit ;;
32629459361Smrg	esac ;;
32747202d7bSmrg    s390x:SunOS:*:*)
32847202d7bSmrg	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
32947202d7bSmrg	exit ;;
33029459361Smrg    sun4H:SunOS:5.*:*)
33129459361Smrg	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
33229459361Smrg	exit ;;
33329459361Smrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
33429459361Smrg	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
33529459361Smrg	exit ;;
33647202d7bSmrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
33747202d7bSmrg	eval $set_cc_for_build
33847202d7bSmrg	SUN_ARCH="i386"
33947202d7bSmrg	# If there is a compiler, see if it is configured for 64-bit objects.
34047202d7bSmrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
34147202d7bSmrg	# This test works for both compilers.
34247202d7bSmrg	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
34347202d7bSmrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
34447202d7bSmrg		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
34547202d7bSmrg		grep IS_64BIT_ARCH >/dev/null
34647202d7bSmrg	    then
34747202d7bSmrg		SUN_ARCH="x86_64"
34847202d7bSmrg	    fi
34947202d7bSmrg	fi
35047202d7bSmrg	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
35129459361Smrg	exit ;;
35229459361Smrg    sun4*:SunOS:6*:*)
35329459361Smrg	# According to config.sub, this is the proper way to canonicalize
35429459361Smrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
35529459361Smrg	# it's likely to be more like Solaris than SunOS4.
35629459361Smrg	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
35729459361Smrg	exit ;;
35829459361Smrg    sun4*:SunOS:*:*)
35929459361Smrg	case "`/usr/bin/arch -k`" in
36029459361Smrg	    Series*|S4*)
36129459361Smrg		UNAME_RELEASE=`uname -v`
36229459361Smrg		;;
36329459361Smrg	esac
36429459361Smrg	# Japanese Language versions have a version number like `4.1.3-JL'.
36529459361Smrg	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
36629459361Smrg	exit ;;
36729459361Smrg    sun3*:SunOS:*:*)
36829459361Smrg	echo m68k-sun-sunos${UNAME_RELEASE}
36929459361Smrg	exit ;;
37029459361Smrg    sun*:*:4.2BSD:*)
37129459361Smrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
37229459361Smrg	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
37329459361Smrg	case "`/bin/arch`" in
37429459361Smrg	    sun3)
37529459361Smrg		echo m68k-sun-sunos${UNAME_RELEASE}
37629459361Smrg		;;
37729459361Smrg	    sun4)
37829459361Smrg		echo sparc-sun-sunos${UNAME_RELEASE}
37929459361Smrg		;;
38029459361Smrg	esac
38129459361Smrg	exit ;;
38229459361Smrg    aushp:SunOS:*:*)
38329459361Smrg	echo sparc-auspex-sunos${UNAME_RELEASE}
38429459361Smrg	exit ;;
38529459361Smrg    # The situation for MiNT is a little confusing.  The machine name
38629459361Smrg    # can be virtually everything (everything which is not
38729459361Smrg    # "atarist" or "atariste" at least should have a processor
38829459361Smrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
38929459361Smrg    # to the lowercase version "mint" (or "freemint").  Finally
39029459361Smrg    # the system name "TOS" denotes a system which is actually not
39129459361Smrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
39229459361Smrg    # be no problem.
39329459361Smrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
39429459361Smrg        echo m68k-atari-mint${UNAME_RELEASE}
39529459361Smrg	exit ;;
39629459361Smrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
39729459361Smrg	echo m68k-atari-mint${UNAME_RELEASE}
39829459361Smrg        exit ;;
39929459361Smrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
40029459361Smrg        echo m68k-atari-mint${UNAME_RELEASE}
40129459361Smrg	exit ;;
40229459361Smrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
40329459361Smrg        echo m68k-milan-mint${UNAME_RELEASE}
40429459361Smrg        exit ;;
40529459361Smrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
40629459361Smrg        echo m68k-hades-mint${UNAME_RELEASE}
40729459361Smrg        exit ;;
40829459361Smrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
40929459361Smrg        echo m68k-unknown-mint${UNAME_RELEASE}
41029459361Smrg        exit ;;
41129459361Smrg    m68k:machten:*:*)
41229459361Smrg	echo m68k-apple-machten${UNAME_RELEASE}
41329459361Smrg	exit ;;
41429459361Smrg    powerpc:machten:*:*)
41529459361Smrg	echo powerpc-apple-machten${UNAME_RELEASE}
41629459361Smrg	exit ;;
41729459361Smrg    RISC*:Mach:*:*)
41829459361Smrg	echo mips-dec-mach_bsd4.3
41929459361Smrg	exit ;;
42029459361Smrg    RISC*:ULTRIX:*:*)
42129459361Smrg	echo mips-dec-ultrix${UNAME_RELEASE}
42229459361Smrg	exit ;;
42329459361Smrg    VAX*:ULTRIX*:*:*)
42429459361Smrg	echo vax-dec-ultrix${UNAME_RELEASE}
42529459361Smrg	exit ;;
42629459361Smrg    2020:CLIX:*:* | 2430:CLIX:*:*)
42729459361Smrg	echo clipper-intergraph-clix${UNAME_RELEASE}
42829459361Smrg	exit ;;
42929459361Smrg    mips:*:*:UMIPS | mips:*:*:RISCos)
43029459361Smrg	eval $set_cc_for_build
43129459361Smrg	sed 's/^	//' << EOF >$dummy.c
43229459361Smrg#ifdef __cplusplus
43329459361Smrg#include <stdio.h>  /* for printf() prototype */
43429459361Smrg	int main (int argc, char *argv[]) {
43529459361Smrg#else
43629459361Smrg	int main (argc, argv) int argc; char *argv[]; {
43729459361Smrg#endif
43829459361Smrg	#if defined (host_mips) && defined (MIPSEB)
43929459361Smrg	#if defined (SYSTYPE_SYSV)
44029459361Smrg	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
44129459361Smrg	#endif
44229459361Smrg	#if defined (SYSTYPE_SVR4)
44329459361Smrg	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
44429459361Smrg	#endif
44529459361Smrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
44629459361Smrg	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
44729459361Smrg	#endif
44829459361Smrg	#endif
44929459361Smrg	  exit (-1);
45029459361Smrg	}
45129459361SmrgEOF
45229459361Smrg	$CC_FOR_BUILD -o $dummy $dummy.c &&
45329459361Smrg	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
45429459361Smrg	  SYSTEM_NAME=`$dummy $dummyarg` &&
45529459361Smrg	    { echo "$SYSTEM_NAME"; exit; }
45629459361Smrg	echo mips-mips-riscos${UNAME_RELEASE}
45729459361Smrg	exit ;;
45829459361Smrg    Motorola:PowerMAX_OS:*:*)
45929459361Smrg	echo powerpc-motorola-powermax
46029459361Smrg	exit ;;
46129459361Smrg    Motorola:*:4.3:PL8-*)
46229459361Smrg	echo powerpc-harris-powermax
46329459361Smrg	exit ;;
46429459361Smrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
46529459361Smrg	echo powerpc-harris-powermax
46629459361Smrg	exit ;;
46729459361Smrg    Night_Hawk:Power_UNIX:*:*)
46829459361Smrg	echo powerpc-harris-powerunix
46929459361Smrg	exit ;;
47029459361Smrg    m88k:CX/UX:7*:*)
47129459361Smrg	echo m88k-harris-cxux7
47229459361Smrg	exit ;;
47329459361Smrg    m88k:*:4*:R4*)
47429459361Smrg	echo m88k-motorola-sysv4
47529459361Smrg	exit ;;
47629459361Smrg    m88k:*:3*:R3*)
47729459361Smrg	echo m88k-motorola-sysv3
47829459361Smrg	exit ;;
47929459361Smrg    AViiON:dgux:*:*)
48029459361Smrg        # DG/UX returns AViiON for all architectures
48129459361Smrg        UNAME_PROCESSOR=`/usr/bin/uname -p`
48229459361Smrg	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
48329459361Smrg	then
48429459361Smrg	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
48529459361Smrg	       [ ${TARGET_BINARY_INTERFACE}x = x ]
48629459361Smrg	    then
48729459361Smrg		echo m88k-dg-dgux${UNAME_RELEASE}
48829459361Smrg	    else
48929459361Smrg		echo m88k-dg-dguxbcs${UNAME_RELEASE}
49029459361Smrg	    fi
49129459361Smrg	else
49229459361Smrg	    echo i586-dg-dgux${UNAME_RELEASE}
49329459361Smrg	fi
49429459361Smrg 	exit ;;
49529459361Smrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
49629459361Smrg	echo m88k-dolphin-sysv3
49729459361Smrg	exit ;;
49829459361Smrg    M88*:*:R3*:*)
49929459361Smrg	# Delta 88k system running SVR3
50029459361Smrg	echo m88k-motorola-sysv3
50129459361Smrg	exit ;;
50229459361Smrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
50329459361Smrg	echo m88k-tektronix-sysv3
50429459361Smrg	exit ;;
50529459361Smrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
50629459361Smrg	echo m68k-tektronix-bsd
50729459361Smrg	exit ;;
50829459361Smrg    *:IRIX*:*:*)
50929459361Smrg	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
51029459361Smrg	exit ;;
51129459361Smrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
51229459361Smrg	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
51329459361Smrg	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
51429459361Smrg    i*86:AIX:*:*)
51529459361Smrg	echo i386-ibm-aix
51629459361Smrg	exit ;;
51729459361Smrg    ia64:AIX:*:*)
51829459361Smrg	if [ -x /usr/bin/oslevel ] ; then
51929459361Smrg		IBM_REV=`/usr/bin/oslevel`
52029459361Smrg	else
52129459361Smrg		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
52229459361Smrg	fi
52329459361Smrg	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
52429459361Smrg	exit ;;
52529459361Smrg    *:AIX:2:3)
52629459361Smrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
52729459361Smrg		eval $set_cc_for_build
52829459361Smrg		sed 's/^		//' << EOF >$dummy.c
52929459361Smrg		#include <sys/systemcfg.h>
53029459361Smrg
53129459361Smrg		main()
53229459361Smrg			{
53329459361Smrg			if (!__power_pc())
53429459361Smrg				exit(1);
53529459361Smrg			puts("powerpc-ibm-aix3.2.5");
53629459361Smrg			exit(0);
53729459361Smrg			}
53829459361SmrgEOF
53929459361Smrg		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
54029459361Smrg		then
54129459361Smrg			echo "$SYSTEM_NAME"
54229459361Smrg		else
54329459361Smrg			echo rs6000-ibm-aix3.2.5
54429459361Smrg		fi
54529459361Smrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
54629459361Smrg		echo rs6000-ibm-aix3.2.4
54729459361Smrg	else
54829459361Smrg		echo rs6000-ibm-aix3.2
54929459361Smrg	fi
55029459361Smrg	exit ;;
55147202d7bSmrg    *:AIX:*:[456])
55229459361Smrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
55329459361Smrg	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
55429459361Smrg		IBM_ARCH=rs6000
55529459361Smrg	else
55629459361Smrg		IBM_ARCH=powerpc
55729459361Smrg	fi
55829459361Smrg	if [ -x /usr/bin/oslevel ] ; then
55929459361Smrg		IBM_REV=`/usr/bin/oslevel`
56029459361Smrg	else
56129459361Smrg		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
56229459361Smrg	fi
56329459361Smrg	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
56429459361Smrg	exit ;;
56529459361Smrg    *:AIX:*:*)
56629459361Smrg	echo rs6000-ibm-aix
56729459361Smrg	exit ;;
56829459361Smrg    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
56929459361Smrg	echo romp-ibm-bsd4.4
57029459361Smrg	exit ;;
57129459361Smrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
57229459361Smrg	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
57329459361Smrg	exit ;;                             # report: romp-ibm BSD 4.3
57429459361Smrg    *:BOSX:*:*)
57529459361Smrg	echo rs6000-bull-bosx
57629459361Smrg	exit ;;
57729459361Smrg    DPX/2?00:B.O.S.:*:*)
57829459361Smrg	echo m68k-bull-sysv3
57929459361Smrg	exit ;;
58029459361Smrg    9000/[34]??:4.3bsd:1.*:*)
58129459361Smrg	echo m68k-hp-bsd
58229459361Smrg	exit ;;
58329459361Smrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
58429459361Smrg	echo m68k-hp-bsd4.4
58529459361Smrg	exit ;;
58629459361Smrg    9000/[34678]??:HP-UX:*:*)
58729459361Smrg	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
58829459361Smrg	case "${UNAME_MACHINE}" in
58929459361Smrg	    9000/31? )            HP_ARCH=m68000 ;;
59029459361Smrg	    9000/[34]?? )         HP_ARCH=m68k ;;
59129459361Smrg	    9000/[678][0-9][0-9])
59229459361Smrg		if [ -x /usr/bin/getconf ]; then
59329459361Smrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
59429459361Smrg                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
59529459361Smrg                    case "${sc_cpu_version}" in
59629459361Smrg                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
59729459361Smrg                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
59829459361Smrg                      532)                      # CPU_PA_RISC2_0
59929459361Smrg                        case "${sc_kernel_bits}" in
60029459361Smrg                          32) HP_ARCH="hppa2.0n" ;;
60129459361Smrg                          64) HP_ARCH="hppa2.0w" ;;
60229459361Smrg			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
60329459361Smrg                        esac ;;
60429459361Smrg                    esac
60529459361Smrg		fi
60629459361Smrg		if [ "${HP_ARCH}" = "" ]; then
60729459361Smrg		    eval $set_cc_for_build
60829459361Smrg		    sed 's/^              //' << EOF >$dummy.c
60929459361Smrg
61029459361Smrg              #define _HPUX_SOURCE
61129459361Smrg              #include <stdlib.h>
61229459361Smrg              #include <unistd.h>
61329459361Smrg
61429459361Smrg              int main ()
61529459361Smrg              {
61629459361Smrg              #if defined(_SC_KERNEL_BITS)
61729459361Smrg                  long bits = sysconf(_SC_KERNEL_BITS);
61829459361Smrg              #endif
61929459361Smrg                  long cpu  = sysconf (_SC_CPU_VERSION);
62029459361Smrg
62129459361Smrg                  switch (cpu)
62229459361Smrg              	{
62329459361Smrg              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
62429459361Smrg              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
62529459361Smrg              	case CPU_PA_RISC2_0:
62629459361Smrg              #if defined(_SC_KERNEL_BITS)
62729459361Smrg              	    switch (bits)
62829459361Smrg              		{
62929459361Smrg              		case 64: puts ("hppa2.0w"); break;
63029459361Smrg              		case 32: puts ("hppa2.0n"); break;
63129459361Smrg              		default: puts ("hppa2.0"); break;
63229459361Smrg              		} break;
63329459361Smrg              #else  /* !defined(_SC_KERNEL_BITS) */
63429459361Smrg              	    puts ("hppa2.0"); break;
63529459361Smrg              #endif
63629459361Smrg              	default: puts ("hppa1.0"); break;
63729459361Smrg              	}
63829459361Smrg                  exit (0);
63929459361Smrg              }
64029459361SmrgEOF
64129459361Smrg		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
64229459361Smrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
64329459361Smrg		fi ;;
64429459361Smrg	esac
64529459361Smrg	if [ ${HP_ARCH} = "hppa2.0w" ]
64629459361Smrg	then
64729459361Smrg	    eval $set_cc_for_build
64829459361Smrg
64929459361Smrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
65029459361Smrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
65129459361Smrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
65229459361Smrg	    #
65329459361Smrg	    # $ CC_FOR_BUILD=cc ./config.guess
65429459361Smrg	    # => hppa2.0w-hp-hpux11.23
65529459361Smrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
65629459361Smrg	    # => hppa64-hp-hpux11.23
65729459361Smrg
65829459361Smrg	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
65929459361Smrg		grep __LP64__ >/dev/null
66029459361Smrg	    then
66129459361Smrg		HP_ARCH="hppa2.0w"
66229459361Smrg	    else
66329459361Smrg		HP_ARCH="hppa64"
66429459361Smrg	    fi
66529459361Smrg	fi
66629459361Smrg	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
66729459361Smrg	exit ;;
66829459361Smrg    ia64:HP-UX:*:*)
66929459361Smrg	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
67029459361Smrg	echo ia64-hp-hpux${HPUX_REV}
67129459361Smrg	exit ;;
67229459361Smrg    3050*:HI-UX:*:*)
67329459361Smrg	eval $set_cc_for_build
67429459361Smrg	sed 's/^	//' << EOF >$dummy.c
67529459361Smrg	#include <unistd.h>
67629459361Smrg	int
67729459361Smrg	main ()
67829459361Smrg	{
67929459361Smrg	  long cpu = sysconf (_SC_CPU_VERSION);
68029459361Smrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
68129459361Smrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
68229459361Smrg	     results, however.  */
68329459361Smrg	  if (CPU_IS_PA_RISC (cpu))
68429459361Smrg	    {
68529459361Smrg	      switch (cpu)
68629459361Smrg		{
68729459361Smrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
68829459361Smrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
68929459361Smrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
69029459361Smrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
69129459361Smrg		}
69229459361Smrg	    }
69329459361Smrg	  else if (CPU_IS_HP_MC68K (cpu))
69429459361Smrg	    puts ("m68k-hitachi-hiuxwe2");
69529459361Smrg	  else puts ("unknown-hitachi-hiuxwe2");
69629459361Smrg	  exit (0);
69729459361Smrg	}
69829459361SmrgEOF
69929459361Smrg	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
70029459361Smrg		{ echo "$SYSTEM_NAME"; exit; }
70129459361Smrg	echo unknown-hitachi-hiuxwe2
70229459361Smrg	exit ;;
70329459361Smrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
70429459361Smrg	echo hppa1.1-hp-bsd
70529459361Smrg	exit ;;
70629459361Smrg    9000/8??:4.3bsd:*:*)
70729459361Smrg	echo hppa1.0-hp-bsd
70829459361Smrg	exit ;;
70929459361Smrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
71029459361Smrg	echo hppa1.0-hp-mpeix
71129459361Smrg	exit ;;
71229459361Smrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
71329459361Smrg	echo hppa1.1-hp-osf
71429459361Smrg	exit ;;
71529459361Smrg    hp8??:OSF1:*:*)
71629459361Smrg	echo hppa1.0-hp-osf
71729459361Smrg	exit ;;
71829459361Smrg    i*86:OSF1:*:*)
71929459361Smrg	if [ -x /usr/sbin/sysversion ] ; then
72029459361Smrg	    echo ${UNAME_MACHINE}-unknown-osf1mk
72129459361Smrg	else
72229459361Smrg	    echo ${UNAME_MACHINE}-unknown-osf1
72329459361Smrg	fi
72429459361Smrg	exit ;;
72529459361Smrg    parisc*:Lites*:*:*)
72629459361Smrg	echo hppa1.1-hp-lites
72729459361Smrg	exit ;;
72829459361Smrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
72929459361Smrg	echo c1-convex-bsd
73029459361Smrg        exit ;;
73129459361Smrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
73229459361Smrg	if getsysinfo -f scalar_acc
73329459361Smrg	then echo c32-convex-bsd
73429459361Smrg	else echo c2-convex-bsd
73529459361Smrg	fi
73629459361Smrg        exit ;;
73729459361Smrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
73829459361Smrg	echo c34-convex-bsd
73929459361Smrg        exit ;;
74029459361Smrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
74129459361Smrg	echo c38-convex-bsd
74229459361Smrg        exit ;;
74329459361Smrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
74429459361Smrg	echo c4-convex-bsd
74529459361Smrg        exit ;;
74629459361Smrg    CRAY*Y-MP:*:*:*)
74729459361Smrg	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
74829459361Smrg	exit ;;
74929459361Smrg    CRAY*[A-Z]90:*:*:*)
75029459361Smrg	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
75129459361Smrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
75229459361Smrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
75329459361Smrg	      -e 's/\.[^.]*$/.X/'
75429459361Smrg	exit ;;
75529459361Smrg    CRAY*TS:*:*:*)
75629459361Smrg	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
75729459361Smrg	exit ;;
75829459361Smrg    CRAY*T3E:*:*:*)
75929459361Smrg	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
76029459361Smrg	exit ;;
76129459361Smrg    CRAY*SV1:*:*:*)
76229459361Smrg	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
76329459361Smrg	exit ;;
76429459361Smrg    *:UNICOS/mp:*:*)
76529459361Smrg	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
76629459361Smrg	exit ;;
76729459361Smrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
76829459361Smrg	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
76929459361Smrg        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
77029459361Smrg        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
77129459361Smrg        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
77229459361Smrg        exit ;;
77329459361Smrg    5000:UNIX_System_V:4.*:*)
77429459361Smrg        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
77529459361Smrg        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
77629459361Smrg        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
77729459361Smrg	exit ;;
77829459361Smrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
77929459361Smrg	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
78029459361Smrg	exit ;;
78129459361Smrg    sparc*:BSD/OS:*:*)
78229459361Smrg	echo sparc-unknown-bsdi${UNAME_RELEASE}
78329459361Smrg	exit ;;
78429459361Smrg    *:BSD/OS:*:*)
78529459361Smrg	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
78629459361Smrg	exit ;;
78729459361Smrg    *:FreeBSD:*:*)
78829459361Smrg	case ${UNAME_MACHINE} in
78929459361Smrg	    pc98)
79029459361Smrg		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
79129459361Smrg	    amd64)
79229459361Smrg		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
79329459361Smrg	    *)
79429459361Smrg		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
79529459361Smrg	esac
79629459361Smrg	exit ;;
79729459361Smrg    i*:CYGWIN*:*)
79829459361Smrg	echo ${UNAME_MACHINE}-pc-cygwin
79929459361Smrg	exit ;;
80047202d7bSmrg    *:MINGW*:*)
80129459361Smrg	echo ${UNAME_MACHINE}-pc-mingw32
80229459361Smrg	exit ;;
80329459361Smrg    i*:windows32*:*)
80429459361Smrg    	# uname -m includes "-pc" on this system.
80529459361Smrg    	echo ${UNAME_MACHINE}-mingw32
80629459361Smrg	exit ;;
80729459361Smrg    i*:PW*:*)
80829459361Smrg	echo ${UNAME_MACHINE}-pc-pw32
80929459361Smrg	exit ;;
81047202d7bSmrg    *:Interix*:[3456]*)
81147202d7bSmrg    	case ${UNAME_MACHINE} in
81247202d7bSmrg	    x86)
81347202d7bSmrg		echo i586-pc-interix${UNAME_RELEASE}
81447202d7bSmrg		exit ;;
81547202d7bSmrg	    EM64T | authenticamd | genuineintel)
81647202d7bSmrg		echo x86_64-unknown-interix${UNAME_RELEASE}
81747202d7bSmrg		exit ;;
81847202d7bSmrg	    IA64)
81947202d7bSmrg		echo ia64-unknown-interix${UNAME_RELEASE}
82047202d7bSmrg		exit ;;
82147202d7bSmrg	esac ;;
82229459361Smrg    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
82329459361Smrg	echo i${UNAME_MACHINE}-pc-mks
82429459361Smrg	exit ;;
82529459361Smrg    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
82629459361Smrg	# How do we know it's Interix rather than the generic POSIX subsystem?
82729459361Smrg	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
82829459361Smrg	# UNAME_MACHINE based on the output of uname instead of i386?
82929459361Smrg	echo i586-pc-interix
83029459361Smrg	exit ;;
83129459361Smrg    i*:UWIN*:*)
83229459361Smrg	echo ${UNAME_MACHINE}-pc-uwin
83329459361Smrg	exit ;;
83429459361Smrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
83529459361Smrg	echo x86_64-unknown-cygwin
83629459361Smrg	exit ;;
83729459361Smrg    p*:CYGWIN*:*)
83829459361Smrg	echo powerpcle-unknown-cygwin
83929459361Smrg	exit ;;
84029459361Smrg    prep*:SunOS:5.*:*)
84129459361Smrg	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
84229459361Smrg	exit ;;
84329459361Smrg    *:GNU:*:*)
84429459361Smrg	# the GNU system
84529459361Smrg	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
84629459361Smrg	exit ;;
84729459361Smrg    *:GNU/*:*:*)
84829459361Smrg	# other systems with GNU libc and userland
84929459361Smrg	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
85029459361Smrg	exit ;;
85129459361Smrg    i*86:Minix:*:*)
85229459361Smrg	echo ${UNAME_MACHINE}-pc-minix
85329459361Smrg	exit ;;
85429459361Smrg    arm*:Linux:*:*)
85547202d7bSmrg	eval $set_cc_for_build
85647202d7bSmrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
85747202d7bSmrg	    | grep -q __ARM_EABI__
85847202d7bSmrg	then
85947202d7bSmrg	    echo ${UNAME_MACHINE}-unknown-linux-gnu
86047202d7bSmrg	else
86147202d7bSmrg	    echo ${UNAME_MACHINE}-unknown-linux-gnueabi
86247202d7bSmrg	fi
86329459361Smrg	exit ;;
86429459361Smrg    avr32*:Linux:*:*)
86529459361Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
86629459361Smrg	exit ;;
86729459361Smrg    cris:Linux:*:*)
86829459361Smrg	echo cris-axis-linux-gnu
86929459361Smrg	exit ;;
87029459361Smrg    crisv32:Linux:*:*)
87129459361Smrg	echo crisv32-axis-linux-gnu
87229459361Smrg	exit ;;
87329459361Smrg    frv:Linux:*:*)
87429459361Smrg    	echo frv-unknown-linux-gnu
87529459361Smrg	exit ;;
87629459361Smrg    ia64:Linux:*:*)
87729459361Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
87829459361Smrg	exit ;;
87929459361Smrg    m32r*:Linux:*:*)
88029459361Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
88129459361Smrg	exit ;;
88229459361Smrg    m68*:Linux:*:*)
88329459361Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
88429459361Smrg	exit ;;
88529459361Smrg    mips:Linux:*:*)
88629459361Smrg	eval $set_cc_for_build
88729459361Smrg	sed 's/^	//' << EOF >$dummy.c
88829459361Smrg	#undef CPU
88929459361Smrg	#undef mips
89029459361Smrg	#undef mipsel
89129459361Smrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
89229459361Smrg	CPU=mipsel
89329459361Smrg	#else
89429459361Smrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
89529459361Smrg	CPU=mips
89629459361Smrg	#else
89729459361Smrg	CPU=
89829459361Smrg	#endif
89929459361Smrg	#endif
90029459361SmrgEOF
90129459361Smrg	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
90229459361Smrg	    /^CPU/{
90329459361Smrg		s: ::g
90429459361Smrg		p
90529459361Smrg	    }'`"
90629459361Smrg	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
90729459361Smrg	;;
90829459361Smrg    mips64:Linux:*:*)
90929459361Smrg	eval $set_cc_for_build
91029459361Smrg	sed 's/^	//' << EOF >$dummy.c
91129459361Smrg	#undef CPU
91229459361Smrg	#undef mips64
91329459361Smrg	#undef mips64el
91429459361Smrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
91529459361Smrg	CPU=mips64el
91629459361Smrg	#else
91729459361Smrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
91829459361Smrg	CPU=mips64
91929459361Smrg	#else
92029459361Smrg	CPU=
92129459361Smrg	#endif
92229459361Smrg	#endif
92329459361SmrgEOF
92429459361Smrg	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
92529459361Smrg	    /^CPU/{
92629459361Smrg		s: ::g
92729459361Smrg		p
92829459361Smrg	    }'`"
92929459361Smrg	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
93029459361Smrg	;;
93129459361Smrg    or32:Linux:*:*)
93229459361Smrg	echo or32-unknown-linux-gnu
93329459361Smrg	exit ;;
93429459361Smrg    ppc:Linux:*:*)
93529459361Smrg	echo powerpc-unknown-linux-gnu
93629459361Smrg	exit ;;
93729459361Smrg    ppc64:Linux:*:*)
93829459361Smrg	echo powerpc64-unknown-linux-gnu
93929459361Smrg	exit ;;
94029459361Smrg    alpha:Linux:*:*)
94129459361Smrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
94229459361Smrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
94329459361Smrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
94429459361Smrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
94529459361Smrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
94629459361Smrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
94729459361Smrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
94829459361Smrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
94929459361Smrg        esac
95029459361Smrg	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
95129459361Smrg	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
95229459361Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
95329459361Smrg	exit ;;
95447202d7bSmrg    padre:Linux:*:*)
95547202d7bSmrg	echo sparc-unknown-linux-gnu
95647202d7bSmrg	exit ;;
95729459361Smrg    parisc:Linux:*:* | hppa:Linux:*:*)
95829459361Smrg	# Look for CPU level
95929459361Smrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
96029459361Smrg	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
96129459361Smrg	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
96229459361Smrg	  *)    echo hppa-unknown-linux-gnu ;;
96329459361Smrg	esac
96429459361Smrg	exit ;;
96529459361Smrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
96629459361Smrg	echo hppa64-unknown-linux-gnu
96729459361Smrg	exit ;;
96829459361Smrg    s390:Linux:*:* | s390x:Linux:*:*)
96929459361Smrg	echo ${UNAME_MACHINE}-ibm-linux
97029459361Smrg	exit ;;
97129459361Smrg    sh64*:Linux:*:*)
97229459361Smrg    	echo ${UNAME_MACHINE}-unknown-linux-gnu
97329459361Smrg	exit ;;
97429459361Smrg    sh*:Linux:*:*)
97529459361Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
97629459361Smrg	exit ;;
97729459361Smrg    sparc:Linux:*:* | sparc64:Linux:*:*)
97829459361Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
97929459361Smrg	exit ;;
98029459361Smrg    vax:Linux:*:*)
98129459361Smrg	echo ${UNAME_MACHINE}-dec-linux-gnu
98229459361Smrg	exit ;;
98329459361Smrg    x86_64:Linux:*:*)
98429459361Smrg	echo x86_64-unknown-linux-gnu
98529459361Smrg	exit ;;
98647202d7bSmrg    xtensa*:Linux:*:*)
98747202d7bSmrg    	echo ${UNAME_MACHINE}-unknown-linux-gnu
98829459361Smrg	exit ;;
98929459361Smrg    i*86:Linux:*:*)
99029459361Smrg	# The BFD linker knows what the default object file format is, so
99129459361Smrg	# first see if it will tell us. cd to the root directory to prevent
99229459361Smrg	# problems with other programs or directories called `ld' in the path.
99329459361Smrg	# Set LC_ALL=C to ensure ld outputs messages in English.
99429459361Smrg	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
99529459361Smrg			 | sed -ne '/supported targets:/!d
99629459361Smrg				    s/[ 	][ 	]*/ /g
99729459361Smrg				    s/.*supported targets: *//
99829459361Smrg				    s/ .*//
99929459361Smrg				    p'`
100029459361Smrg        case "$ld_supported_targets" in
100129459361Smrg	  elf32-i386)
100229459361Smrg		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
100329459361Smrg		;;
100429459361Smrg	  a.out-i386-linux)
100529459361Smrg		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
100629459361Smrg		exit ;;
100729459361Smrg	  "")
100829459361Smrg		# Either a pre-BFD a.out linker (linux-gnuoldld) or
100929459361Smrg		# one that does not give us useful --help.
101029459361Smrg		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
101129459361Smrg		exit ;;
101229459361Smrg	esac
101329459361Smrg	# Determine whether the default compiler is a.out or elf
101429459361Smrg	eval $set_cc_for_build
101529459361Smrg	sed 's/^	//' << EOF >$dummy.c
101629459361Smrg	#include <features.h>
101729459361Smrg	#ifdef __ELF__
101829459361Smrg	# ifdef __GLIBC__
101929459361Smrg	#  if __GLIBC__ >= 2
102029459361Smrg	LIBC=gnu
102129459361Smrg	#  else
102229459361Smrg	LIBC=gnulibc1
102329459361Smrg	#  endif
102429459361Smrg	# else
102529459361Smrg	LIBC=gnulibc1
102629459361Smrg	# endif
102729459361Smrg	#else
102829459361Smrg	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
102929459361Smrg	LIBC=gnu
103029459361Smrg	#else
103129459361Smrg	LIBC=gnuaout
103229459361Smrg	#endif
103329459361Smrg	#endif
103429459361Smrg	#ifdef __dietlibc__
103529459361Smrg	LIBC=dietlibc
103629459361Smrg	#endif
103729459361SmrgEOF
103829459361Smrg	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
103929459361Smrg	    /^LIBC/{
104029459361Smrg		s: ::g
104129459361Smrg		p
104229459361Smrg	    }'`"
104329459361Smrg	test x"${LIBC}" != x && {
104429459361Smrg		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
104529459361Smrg		exit
104629459361Smrg	}
104729459361Smrg	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
104829459361Smrg	;;
104929459361Smrg    i*86:DYNIX/ptx:4*:*)
105029459361Smrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
105129459361Smrg	# earlier versions are messed up and put the nodename in both
105229459361Smrg	# sysname and nodename.
105329459361Smrg	echo i386-sequent-sysv4
105429459361Smrg	exit ;;
105529459361Smrg    i*86:UNIX_SV:4.2MP:2.*)
105629459361Smrg        # Unixware is an offshoot of SVR4, but it has its own version
105729459361Smrg        # number series starting with 2...
105829459361Smrg        # I am not positive that other SVR4 systems won't match this,
105929459361Smrg	# I just have to hope.  -- rms.
106029459361Smrg        # Use sysv4.2uw... so that sysv4* matches it.
106129459361Smrg	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
106229459361Smrg	exit ;;
106329459361Smrg    i*86:OS/2:*:*)
106429459361Smrg	# If we were able to find `uname', then EMX Unix compatibility
106529459361Smrg	# is probably installed.
106629459361Smrg	echo ${UNAME_MACHINE}-pc-os2-emx
106729459361Smrg	exit ;;
106829459361Smrg    i*86:XTS-300:*:STOP)
106929459361Smrg	echo ${UNAME_MACHINE}-unknown-stop
107029459361Smrg	exit ;;
107129459361Smrg    i*86:atheos:*:*)
107229459361Smrg	echo ${UNAME_MACHINE}-unknown-atheos
107329459361Smrg	exit ;;
107429459361Smrg    i*86:syllable:*:*)
107529459361Smrg	echo ${UNAME_MACHINE}-pc-syllable
107629459361Smrg	exit ;;
107729459361Smrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
107829459361Smrg	echo i386-unknown-lynxos${UNAME_RELEASE}
107929459361Smrg	exit ;;
108029459361Smrg    i*86:*DOS:*:*)
108129459361Smrg	echo ${UNAME_MACHINE}-pc-msdosdjgpp
108229459361Smrg	exit ;;
108329459361Smrg    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
108429459361Smrg	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
108529459361Smrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
108629459361Smrg		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
108729459361Smrg	else
108829459361Smrg		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
108929459361Smrg	fi
109029459361Smrg	exit ;;
109129459361Smrg    i*86:*:5:[678]*)
109229459361Smrg    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
109329459361Smrg	case `/bin/uname -X | grep "^Machine"` in
109429459361Smrg	    *486*)	     UNAME_MACHINE=i486 ;;
109529459361Smrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
109629459361Smrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
109729459361Smrg	esac
109829459361Smrg	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
109929459361Smrg	exit ;;
110029459361Smrg    i*86:*:3.2:*)
110129459361Smrg	if test -f /usr/options/cb.name; then
110229459361Smrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
110329459361Smrg		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
110429459361Smrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
110529459361Smrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
110629459361Smrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
110729459361Smrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
110829459361Smrg			&& UNAME_MACHINE=i586
110929459361Smrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
111029459361Smrg			&& UNAME_MACHINE=i686
111129459361Smrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
111229459361Smrg			&& UNAME_MACHINE=i686
111329459361Smrg		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
111429459361Smrg	else
111529459361Smrg		echo ${UNAME_MACHINE}-pc-sysv32
111629459361Smrg	fi
111729459361Smrg	exit ;;
111829459361Smrg    pc:*:*:*)
111929459361Smrg	# Left here for compatibility:
112029459361Smrg        # uname -m prints for DJGPP always 'pc', but it prints nothing about
112147202d7bSmrg        # the processor, so we play safe by assuming i586.
112247202d7bSmrg	# Note: whatever this is, it MUST be the same as what config.sub
112347202d7bSmrg	# prints for the "djgpp" host, or else GDB configury will decide that
112447202d7bSmrg	# this is a cross-build.
112547202d7bSmrg	echo i586-pc-msdosdjgpp
112629459361Smrg        exit ;;
112729459361Smrg    Intel:Mach:3*:*)
112829459361Smrg	echo i386-pc-mach3
112929459361Smrg	exit ;;
113029459361Smrg    paragon:*:*:*)
113129459361Smrg	echo i860-intel-osf1
113229459361Smrg	exit ;;
113329459361Smrg    i860:*:4.*:*) # i860-SVR4
113429459361Smrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
113529459361Smrg	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
113629459361Smrg	else # Add other i860-SVR4 vendors below as they are discovered.
113729459361Smrg	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
113829459361Smrg	fi
113929459361Smrg	exit ;;
114029459361Smrg    mini*:CTIX:SYS*5:*)
114129459361Smrg	# "miniframe"
114229459361Smrg	echo m68010-convergent-sysv
114329459361Smrg	exit ;;
114429459361Smrg    mc68k:UNIX:SYSTEM5:3.51m)
114529459361Smrg	echo m68k-convergent-sysv
114629459361Smrg	exit ;;
114729459361Smrg    M680?0:D-NIX:5.3:*)
114829459361Smrg	echo m68k-diab-dnix
114929459361Smrg	exit ;;
115029459361Smrg    M68*:*:R3V[5678]*:*)
115129459361Smrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
115229459361Smrg    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)
115329459361Smrg	OS_REL=''
115429459361Smrg	test -r /etc/.relid \
115529459361Smrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
115629459361Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
115729459361Smrg	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
115829459361Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
115929459361Smrg	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
116029459361Smrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
116129459361Smrg        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
116229459361Smrg          && { echo i486-ncr-sysv4; exit; } ;;
116347202d7bSmrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
116447202d7bSmrg	OS_REL='.3'
116547202d7bSmrg	test -r /etc/.relid \
116647202d7bSmrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
116747202d7bSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
116847202d7bSmrg	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
116947202d7bSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
117047202d7bSmrg	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
117147202d7bSmrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
117247202d7bSmrg	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
117329459361Smrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
117429459361Smrg	echo m68k-unknown-lynxos${UNAME_RELEASE}
117529459361Smrg	exit ;;
117629459361Smrg    mc68030:UNIX_System_V:4.*:*)
117729459361Smrg	echo m68k-atari-sysv4
117829459361Smrg	exit ;;
117929459361Smrg    TSUNAMI:LynxOS:2.*:*)
118029459361Smrg	echo sparc-unknown-lynxos${UNAME_RELEASE}
118129459361Smrg	exit ;;
118229459361Smrg    rs6000:LynxOS:2.*:*)
118329459361Smrg	echo rs6000-unknown-lynxos${UNAME_RELEASE}
118429459361Smrg	exit ;;
118529459361Smrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
118629459361Smrg	echo powerpc-unknown-lynxos${UNAME_RELEASE}
118729459361Smrg	exit ;;
118829459361Smrg    SM[BE]S:UNIX_SV:*:*)
118929459361Smrg	echo mips-dde-sysv${UNAME_RELEASE}
119029459361Smrg	exit ;;
119129459361Smrg    RM*:ReliantUNIX-*:*:*)
119229459361Smrg	echo mips-sni-sysv4
119329459361Smrg	exit ;;
119429459361Smrg    RM*:SINIX-*:*:*)
119529459361Smrg	echo mips-sni-sysv4
119629459361Smrg	exit ;;
119729459361Smrg    *:SINIX-*:*:*)
119829459361Smrg	if uname -p 2>/dev/null >/dev/null ; then
119929459361Smrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
120029459361Smrg		echo ${UNAME_MACHINE}-sni-sysv4
120129459361Smrg	else
120229459361Smrg		echo ns32k-sni-sysv
120329459361Smrg	fi
120429459361Smrg	exit ;;
120529459361Smrg    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
120629459361Smrg                      # says <Richard.M.Bartel@ccMail.Census.GOV>
120729459361Smrg        echo i586-unisys-sysv4
120829459361Smrg        exit ;;
120929459361Smrg    *:UNIX_System_V:4*:FTX*)
121029459361Smrg	# From Gerald Hewes <hewes@openmarket.com>.
121129459361Smrg	# How about differentiating between stratus architectures? -djm
121229459361Smrg	echo hppa1.1-stratus-sysv4
121329459361Smrg	exit ;;
121429459361Smrg    *:*:*:FTX*)
121529459361Smrg	# From seanf@swdc.stratus.com.
121629459361Smrg	echo i860-stratus-sysv4
121729459361Smrg	exit ;;
121829459361Smrg    i*86:VOS:*:*)
121929459361Smrg	# From Paul.Green@stratus.com.
122029459361Smrg	echo ${UNAME_MACHINE}-stratus-vos
122129459361Smrg	exit ;;
122229459361Smrg    *:VOS:*:*)
122329459361Smrg	# From Paul.Green@stratus.com.
122429459361Smrg	echo hppa1.1-stratus-vos
122529459361Smrg	exit ;;
122629459361Smrg    mc68*:A/UX:*:*)
122729459361Smrg	echo m68k-apple-aux${UNAME_RELEASE}
122829459361Smrg	exit ;;
122929459361Smrg    news*:NEWS-OS:6*:*)
123029459361Smrg	echo mips-sony-newsos6
123129459361Smrg	exit ;;
123229459361Smrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
123329459361Smrg	if [ -d /usr/nec ]; then
123429459361Smrg	        echo mips-nec-sysv${UNAME_RELEASE}
123529459361Smrg	else
123629459361Smrg	        echo mips-unknown-sysv${UNAME_RELEASE}
123729459361Smrg	fi
123829459361Smrg        exit ;;
123929459361Smrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
124029459361Smrg	echo powerpc-be-beos
124129459361Smrg	exit ;;
124229459361Smrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
124329459361Smrg	echo powerpc-apple-beos
124429459361Smrg	exit ;;
124529459361Smrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
124629459361Smrg	echo i586-pc-beos
124729459361Smrg	exit ;;
124847202d7bSmrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
124947202d7bSmrg	echo i586-pc-haiku
125047202d7bSmrg	exit ;;
125129459361Smrg    SX-4:SUPER-UX:*:*)
125229459361Smrg	echo sx4-nec-superux${UNAME_RELEASE}
125329459361Smrg	exit ;;
125429459361Smrg    SX-5:SUPER-UX:*:*)
125529459361Smrg	echo sx5-nec-superux${UNAME_RELEASE}
125629459361Smrg	exit ;;
125729459361Smrg    SX-6:SUPER-UX:*:*)
125829459361Smrg	echo sx6-nec-superux${UNAME_RELEASE}
125929459361Smrg	exit ;;
126029459361Smrg    SX-7:SUPER-UX:*:*)
126129459361Smrg	echo sx7-nec-superux${UNAME_RELEASE}
126229459361Smrg	exit ;;
126329459361Smrg    SX-8:SUPER-UX:*:*)
126429459361Smrg	echo sx8-nec-superux${UNAME_RELEASE}
126529459361Smrg	exit ;;
126647202d7bSmrg    SX-8R:SUPER-UX:*:*)
126747202d7bSmrg	echo sx8r-nec-superux${UNAME_RELEASE}
126847202d7bSmrg	exit ;;
126929459361Smrg    Power*:Rhapsody:*:*)
127029459361Smrg	echo powerpc-apple-rhapsody${UNAME_RELEASE}
127129459361Smrg	exit ;;
127229459361Smrg    *:Rhapsody:*:*)
127329459361Smrg	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
127429459361Smrg	exit ;;
127529459361Smrg    *:Darwin:*:*)
127629459361Smrg	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
127729459361Smrg	case $UNAME_PROCESSOR in
127829459361Smrg	    unknown) UNAME_PROCESSOR=powerpc ;;
127929459361Smrg	esac
128029459361Smrg	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
128129459361Smrg	exit ;;
128229459361Smrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
128329459361Smrg	UNAME_PROCESSOR=`uname -p`
128429459361Smrg	if test "$UNAME_PROCESSOR" = "x86"; then
128529459361Smrg		UNAME_PROCESSOR=i386
128629459361Smrg		UNAME_MACHINE=pc
128729459361Smrg	fi
128829459361Smrg	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
128929459361Smrg	exit ;;
129029459361Smrg    *:QNX:*:4*)
129129459361Smrg	echo i386-pc-qnx
129229459361Smrg	exit ;;
129329459361Smrg    NSE-?:NONSTOP_KERNEL:*:*)
129429459361Smrg	echo nse-tandem-nsk${UNAME_RELEASE}
129529459361Smrg	exit ;;
129629459361Smrg    NSR-?:NONSTOP_KERNEL:*:*)
129729459361Smrg	echo nsr-tandem-nsk${UNAME_RELEASE}
129829459361Smrg	exit ;;
129929459361Smrg    *:NonStop-UX:*:*)
130029459361Smrg	echo mips-compaq-nonstopux
130129459361Smrg	exit ;;
130229459361Smrg    BS2000:POSIX*:*:*)
130329459361Smrg	echo bs2000-siemens-sysv
130429459361Smrg	exit ;;
130529459361Smrg    DS/*:UNIX_System_V:*:*)
130629459361Smrg	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
130729459361Smrg	exit ;;
130829459361Smrg    *:Plan9:*:*)
130929459361Smrg	# "uname -m" is not consistent, so use $cputype instead. 386
131029459361Smrg	# is converted to i386 for consistency with other x86
131129459361Smrg	# operating systems.
131229459361Smrg	if test "$cputype" = "386"; then
131329459361Smrg	    UNAME_MACHINE=i386
131429459361Smrg	else
131529459361Smrg	    UNAME_MACHINE="$cputype"
131629459361Smrg	fi
131729459361Smrg	echo ${UNAME_MACHINE}-unknown-plan9
131829459361Smrg	exit ;;
131929459361Smrg    *:TOPS-10:*:*)
132029459361Smrg	echo pdp10-unknown-tops10
132129459361Smrg	exit ;;
132229459361Smrg    *:TENEX:*:*)
132329459361Smrg	echo pdp10-unknown-tenex
132429459361Smrg	exit ;;
132529459361Smrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
132629459361Smrg	echo pdp10-dec-tops20
132729459361Smrg	exit ;;
132829459361Smrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
132929459361Smrg	echo pdp10-xkl-tops20
133029459361Smrg	exit ;;
133129459361Smrg    *:TOPS-20:*:*)
133229459361Smrg	echo pdp10-unknown-tops20
133329459361Smrg	exit ;;
133429459361Smrg    *:ITS:*:*)
133529459361Smrg	echo pdp10-unknown-its
133629459361Smrg	exit ;;
133729459361Smrg    SEI:*:*:SEIUX)
133829459361Smrg        echo mips-sei-seiux${UNAME_RELEASE}
133929459361Smrg	exit ;;
134029459361Smrg    *:DragonFly:*:*)
134129459361Smrg	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
134229459361Smrg	exit ;;
134329459361Smrg    *:*VMS:*:*)
134429459361Smrg    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
134529459361Smrg	case "${UNAME_MACHINE}" in
134629459361Smrg	    A*) echo alpha-dec-vms ; exit ;;
134729459361Smrg	    I*) echo ia64-dec-vms ; exit ;;
134829459361Smrg	    V*) echo vax-dec-vms ; exit ;;
134929459361Smrg	esac ;;
135029459361Smrg    *:XENIX:*:SysV)
135129459361Smrg	echo i386-pc-xenix
135229459361Smrg	exit ;;
135329459361Smrg    i*86:skyos:*:*)
135429459361Smrg	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
135529459361Smrg	exit ;;
135629459361Smrg    i*86:rdos:*:*)
135729459361Smrg	echo ${UNAME_MACHINE}-pc-rdos
135829459361Smrg	exit ;;
135947202d7bSmrg    i*86:AROS:*:*)
136047202d7bSmrg	echo ${UNAME_MACHINE}-pc-aros
136147202d7bSmrg	exit ;;
136229459361Smrgesac
136329459361Smrg
136429459361Smrg#echo '(No uname command or uname output not recognized.)' 1>&2
136529459361Smrg#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
136629459361Smrg
136729459361Smrgeval $set_cc_for_build
136829459361Smrgcat >$dummy.c <<EOF
136929459361Smrg#ifdef _SEQUENT_
137029459361Smrg# include <sys/types.h>
137129459361Smrg# include <sys/utsname.h>
137229459361Smrg#endif
137329459361Smrgmain ()
137429459361Smrg{
137529459361Smrg#if defined (sony)
137629459361Smrg#if defined (MIPSEB)
137729459361Smrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
137829459361Smrg     I don't know....  */
137929459361Smrg  printf ("mips-sony-bsd\n"); exit (0);
138029459361Smrg#else
138129459361Smrg#include <sys/param.h>
138229459361Smrg  printf ("m68k-sony-newsos%s\n",
138329459361Smrg#ifdef NEWSOS4
138429459361Smrg          "4"
138529459361Smrg#else
138629459361Smrg	  ""
138729459361Smrg#endif
138829459361Smrg         ); exit (0);
138929459361Smrg#endif
139029459361Smrg#endif
139129459361Smrg
139229459361Smrg#if defined (__arm) && defined (__acorn) && defined (__unix)
139329459361Smrg  printf ("arm-acorn-riscix\n"); exit (0);
139429459361Smrg#endif
139529459361Smrg
139629459361Smrg#if defined (hp300) && !defined (hpux)
139729459361Smrg  printf ("m68k-hp-bsd\n"); exit (0);
139829459361Smrg#endif
139929459361Smrg
140029459361Smrg#if defined (NeXT)
140129459361Smrg#if !defined (__ARCHITECTURE__)
140229459361Smrg#define __ARCHITECTURE__ "m68k"
140329459361Smrg#endif
140429459361Smrg  int version;
140529459361Smrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
140629459361Smrg  if (version < 4)
140729459361Smrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
140829459361Smrg  else
140929459361Smrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
141029459361Smrg  exit (0);
141129459361Smrg#endif
141229459361Smrg
141329459361Smrg#if defined (MULTIMAX) || defined (n16)
141429459361Smrg#if defined (UMAXV)
141529459361Smrg  printf ("ns32k-encore-sysv\n"); exit (0);
141629459361Smrg#else
141729459361Smrg#if defined (CMU)
141829459361Smrg  printf ("ns32k-encore-mach\n"); exit (0);
141929459361Smrg#else
142029459361Smrg  printf ("ns32k-encore-bsd\n"); exit (0);
142129459361Smrg#endif
142229459361Smrg#endif
142329459361Smrg#endif
142429459361Smrg
142529459361Smrg#if defined (__386BSD__)
142629459361Smrg  printf ("i386-pc-bsd\n"); exit (0);
142729459361Smrg#endif
142829459361Smrg
142929459361Smrg#if defined (sequent)
143029459361Smrg#if defined (i386)
143129459361Smrg  printf ("i386-sequent-dynix\n"); exit (0);
143229459361Smrg#endif
143329459361Smrg#if defined (ns32000)
143429459361Smrg  printf ("ns32k-sequent-dynix\n"); exit (0);
143529459361Smrg#endif
143629459361Smrg#endif
143729459361Smrg
143829459361Smrg#if defined (_SEQUENT_)
143929459361Smrg    struct utsname un;
144029459361Smrg
144129459361Smrg    uname(&un);
144229459361Smrg
144329459361Smrg    if (strncmp(un.version, "V2", 2) == 0) {
144429459361Smrg	printf ("i386-sequent-ptx2\n"); exit (0);
144529459361Smrg    }
144629459361Smrg    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
144729459361Smrg	printf ("i386-sequent-ptx1\n"); exit (0);
144829459361Smrg    }
144929459361Smrg    printf ("i386-sequent-ptx\n"); exit (0);
145029459361Smrg
145129459361Smrg#endif
145229459361Smrg
145329459361Smrg#if defined (vax)
145429459361Smrg# if !defined (ultrix)
145529459361Smrg#  include <sys/param.h>
145629459361Smrg#  if defined (BSD)
145729459361Smrg#   if BSD == 43
145829459361Smrg      printf ("vax-dec-bsd4.3\n"); exit (0);
145929459361Smrg#   else
146029459361Smrg#    if BSD == 199006
146129459361Smrg      printf ("vax-dec-bsd4.3reno\n"); exit (0);
146229459361Smrg#    else
146329459361Smrg      printf ("vax-dec-bsd\n"); exit (0);
146429459361Smrg#    endif
146529459361Smrg#   endif
146629459361Smrg#  else
146729459361Smrg    printf ("vax-dec-bsd\n"); exit (0);
146829459361Smrg#  endif
146929459361Smrg# else
147029459361Smrg    printf ("vax-dec-ultrix\n"); exit (0);
147129459361Smrg# endif
147229459361Smrg#endif
147329459361Smrg
147429459361Smrg#if defined (alliant) && defined (i860)
147529459361Smrg  printf ("i860-alliant-bsd\n"); exit (0);
147629459361Smrg#endif
147729459361Smrg
147829459361Smrg  exit (1);
147929459361Smrg}
148029459361SmrgEOF
148129459361Smrg
148229459361Smrg$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
148329459361Smrg	{ echo "$SYSTEM_NAME"; exit; }
148429459361Smrg
148529459361Smrg# Apollos put the system type in the environment.
148629459361Smrg
148729459361Smrgtest -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
148829459361Smrg
148929459361Smrg# Convex versions that predate uname can use getsysinfo(1)
149029459361Smrg
149129459361Smrgif [ -x /usr/convex/getsysinfo ]
149229459361Smrgthen
149329459361Smrg    case `getsysinfo -f cpu_type` in
149429459361Smrg    c1*)
149529459361Smrg	echo c1-convex-bsd
149629459361Smrg	exit ;;
149729459361Smrg    c2*)
149829459361Smrg	if getsysinfo -f scalar_acc
149929459361Smrg	then echo c32-convex-bsd
150029459361Smrg	else echo c2-convex-bsd
150129459361Smrg	fi
150229459361Smrg	exit ;;
150329459361Smrg    c34*)
150429459361Smrg	echo c34-convex-bsd
150529459361Smrg	exit ;;
150629459361Smrg    c38*)
150729459361Smrg	echo c38-convex-bsd
150829459361Smrg	exit ;;
150929459361Smrg    c4*)
151029459361Smrg	echo c4-convex-bsd
151129459361Smrg	exit ;;
151229459361Smrg    esac
151329459361Smrgfi
151429459361Smrg
151529459361Smrgcat >&2 <<EOF
151629459361Smrg$0: unable to guess system type
151729459361Smrg
151829459361SmrgThis script, last modified $timestamp, has failed to recognize
151929459361Smrgthe operating system you are using. It is advised that you
152029459361Smrgdownload the most up to date version of the config scripts from
152129459361Smrg
152247202d7bSmrg  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
152329459361Smrgand
152447202d7bSmrg  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
152529459361Smrg
152629459361SmrgIf the version you run ($0) is already up to date, please
152729459361Smrgsend the following data and any information you think might be
152829459361Smrgpertinent to <config-patches@gnu.org> in order to provide the needed
152929459361Smrginformation to handle your system.
153029459361Smrg
153129459361Smrgconfig.guess timestamp = $timestamp
153229459361Smrg
153329459361Smrguname -m = `(uname -m) 2>/dev/null || echo unknown`
153429459361Smrguname -r = `(uname -r) 2>/dev/null || echo unknown`
153529459361Smrguname -s = `(uname -s) 2>/dev/null || echo unknown`
153629459361Smrguname -v = `(uname -v) 2>/dev/null || echo unknown`
153729459361Smrg
153829459361Smrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
153929459361Smrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
154029459361Smrg
154129459361Smrghostinfo               = `(hostinfo) 2>/dev/null`
154229459361Smrg/bin/universe          = `(/bin/universe) 2>/dev/null`
154329459361Smrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
154429459361Smrg/bin/arch              = `(/bin/arch) 2>/dev/null`
154529459361Smrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
154629459361Smrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
154729459361Smrg
154829459361SmrgUNAME_MACHINE = ${UNAME_MACHINE}
154929459361SmrgUNAME_RELEASE = ${UNAME_RELEASE}
155029459361SmrgUNAME_SYSTEM  = ${UNAME_SYSTEM}
155129459361SmrgUNAME_VERSION = ${UNAME_VERSION}
155229459361SmrgEOF
155329459361Smrg
155429459361Smrgexit 1
155529459361Smrg
155629459361Smrg# Local variables:
155729459361Smrg# eval: (add-hook 'write-file-hooks 'time-stamp)
155829459361Smrg# time-stamp-start: "timestamp='"
155929459361Smrg# time-stamp-format: "%:y-%02m-%02d"
156029459361Smrg# time-stamp-end: "'"
156129459361Smrg# End:
1562