140dd5a57Smrg#! /bin/sh
240dd5a57Smrg# Attempt to guess a canonical system name.
340dd5a57Smrg#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
440dd5a57Smrg#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
540dd5a57Smrg#   Free Software Foundation, Inc.
640dd5a57Smrg
740dd5a57Smrgtimestamp='2009-11-20'
840dd5a57Smrg
940dd5a57Smrg# This file is free software; you can redistribute it and/or modify it
1040dd5a57Smrg# under the terms of the GNU General Public License as published by
1140dd5a57Smrg# the Free Software Foundation; either version 2 of the License, or
1240dd5a57Smrg# (at your option) any later version.
1340dd5a57Smrg#
1440dd5a57Smrg# This program is distributed in the hope that it will be useful, but
1540dd5a57Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1640dd5a57Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1740dd5a57Smrg# General Public License for more details.
1840dd5a57Smrg#
1940dd5a57Smrg# You should have received a copy of the GNU General Public License
2040dd5a57Smrg# along with this program; if not, write to the Free Software
2140dd5a57Smrg# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
2240dd5a57Smrg# 02110-1301, USA.
2340dd5a57Smrg#
2440dd5a57Smrg# As a special exception to the GNU General Public License, if you
2540dd5a57Smrg# distribute this file as part of a program that contains a
2640dd5a57Smrg# configuration script generated by Autoconf, you may include it under
2740dd5a57Smrg# the same distribution terms that you use for the rest of that program.
2840dd5a57Smrg
2940dd5a57Smrg
3040dd5a57Smrg# Originally written by Per Bothner.  Please send patches (context
3140dd5a57Smrg# diff format) to <config-patches@gnu.org> and include a ChangeLog
3240dd5a57Smrg# entry.
3340dd5a57Smrg#
3440dd5a57Smrg# This script attempts to guess a canonical system name similar to
3540dd5a57Smrg# config.sub.  If it succeeds, it prints the system name on stdout, and
3640dd5a57Smrg# exits with 0.  Otherwise, it exits with 1.
3740dd5a57Smrg#
3840dd5a57Smrg# You can get the latest version of this script from:
3940dd5a57Smrg# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
4040dd5a57Smrg
4140dd5a57Smrgme=`echo "$0" | sed -e 's,.*/,,'`
4240dd5a57Smrg
4340dd5a57Smrgusage="\
4440dd5a57SmrgUsage: $0 [OPTION]
4540dd5a57Smrg
4640dd5a57SmrgOutput the configuration name of the system \`$me' is run on.
4740dd5a57Smrg
4840dd5a57SmrgOperation modes:
4940dd5a57Smrg  -h, --help         print this help, then exit
5040dd5a57Smrg  -t, --time-stamp   print date of last modification, then exit
5140dd5a57Smrg  -v, --version      print version number, then exit
5240dd5a57Smrg
5340dd5a57SmrgReport bugs and patches to <config-patches@gnu.org>."
5440dd5a57Smrg
5540dd5a57Smrgversion="\
5640dd5a57SmrgGNU config.guess ($timestamp)
5740dd5a57Smrg
5840dd5a57SmrgOriginally written by Per Bothner.
5940dd5a57SmrgCopyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
6040dd5a57Smrg2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
6140dd5a57Smrg
6240dd5a57SmrgThis is free software; see the source for copying conditions.  There is NO
6340dd5a57Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
6440dd5a57Smrg
6540dd5a57Smrghelp="
6640dd5a57SmrgTry \`$me --help' for more information."
6740dd5a57Smrg
6840dd5a57Smrg# Parse command line
6940dd5a57Smrgwhile test $# -gt 0 ; do
7040dd5a57Smrg  case $1 in
7140dd5a57Smrg    --time-stamp | --time* | -t )
7240dd5a57Smrg       echo "$timestamp" ; exit ;;
7340dd5a57Smrg    --version | -v )
7440dd5a57Smrg       echo "$version" ; exit ;;
7540dd5a57Smrg    --help | --h* | -h )
7640dd5a57Smrg       echo "$usage"; exit ;;
7740dd5a57Smrg    -- )     # Stop option processing
7840dd5a57Smrg       shift; break ;;
7940dd5a57Smrg    - )	# Use stdin as input.
8040dd5a57Smrg       break ;;
8140dd5a57Smrg    -* )
8240dd5a57Smrg       echo "$me: invalid option $1$help" >&2
8340dd5a57Smrg       exit 1 ;;
8440dd5a57Smrg    * )
8540dd5a57Smrg       break ;;
8640dd5a57Smrg  esac
8740dd5a57Smrgdone
8840dd5a57Smrg
8940dd5a57Smrgif test $# != 0; then
9040dd5a57Smrg  echo "$me: too many arguments$help" >&2
9140dd5a57Smrg  exit 1
9240dd5a57Smrgfi
9340dd5a57Smrg
9440dd5a57Smrgtrap 'exit 1' 1 2 15
9540dd5a57Smrg
9640dd5a57Smrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
9740dd5a57Smrg# compiler to aid in system detection is discouraged as it requires
9840dd5a57Smrg# temporary files to be created and, as you can see below, it is a
9940dd5a57Smrg# headache to deal with in a portable fashion.
10040dd5a57Smrg
10140dd5a57Smrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
10240dd5a57Smrg# use `HOST_CC' if defined, but it is deprecated.
10340dd5a57Smrg
10440dd5a57Smrg# Portable tmp directory creation inspired by the Autoconf team.
10540dd5a57Smrg
10640dd5a57Smrgset_cc_for_build='
10740dd5a57Smrgtrap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
10840dd5a57Smrgtrap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
10940dd5a57Smrg: ${TMPDIR=/tmp} ;
11040dd5a57Smrg { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
11140dd5a57Smrg { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
11240dd5a57Smrg { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
11340dd5a57Smrg { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
11440dd5a57Smrgdummy=$tmp/dummy ;
11540dd5a57Smrgtmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
11640dd5a57Smrgcase $CC_FOR_BUILD,$HOST_CC,$CC in
11740dd5a57Smrg ,,)    echo "int x;" > $dummy.c ;
11840dd5a57Smrg	for c in cc gcc c89 c99 ; do
11940dd5a57Smrg	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
12040dd5a57Smrg	     CC_FOR_BUILD="$c"; break ;
12140dd5a57Smrg	  fi ;
12240dd5a57Smrg	done ;
12340dd5a57Smrg	if test x"$CC_FOR_BUILD" = x ; then
12440dd5a57Smrg	  CC_FOR_BUILD=no_compiler_found ;
12540dd5a57Smrg	fi
12640dd5a57Smrg	;;
12740dd5a57Smrg ,,*)   CC_FOR_BUILD=$CC ;;
12840dd5a57Smrg ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
12940dd5a57Smrgesac ; set_cc_for_build= ;'
13040dd5a57Smrg
13140dd5a57Smrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
13240dd5a57Smrg# (ghazi@noc.rutgers.edu 1994-08-24)
13340dd5a57Smrgif (test -f /.attbin/uname) >/dev/null 2>&1 ; then
13440dd5a57Smrg	PATH=$PATH:/.attbin ; export PATH
13540dd5a57Smrgfi
13640dd5a57Smrg
13740dd5a57SmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
13840dd5a57SmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
13940dd5a57SmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
14040dd5a57SmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
14140dd5a57Smrg
14240dd5a57Smrg# Note: order is significant - the case branches are not exclusive.
14340dd5a57Smrg
14440dd5a57Smrgcase "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
14540dd5a57Smrg    *:NetBSD:*:*)
14640dd5a57Smrg	# NetBSD (nbsd) targets should (where applicable) match one or
14740dd5a57Smrg	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
14840dd5a57Smrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
14940dd5a57Smrg	# switched to ELF, *-*-netbsd* would select the old
15040dd5a57Smrg	# object file format.  This provides both forward
15140dd5a57Smrg	# compatibility and a consistent mechanism for selecting the
15240dd5a57Smrg	# object file format.
15340dd5a57Smrg	#
15440dd5a57Smrg	# Note: NetBSD doesn't particularly care about the vendor
15540dd5a57Smrg	# portion of the name.  We always set it to "unknown".
15640dd5a57Smrg	sysctl="sysctl -n hw.machine_arch"
15740dd5a57Smrg	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
15840dd5a57Smrg	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
15940dd5a57Smrg	case "${UNAME_MACHINE_ARCH}" in
16040dd5a57Smrg	    armeb) machine=armeb-unknown ;;
16140dd5a57Smrg	    arm*) machine=arm-unknown ;;
16240dd5a57Smrg	    sh3el) machine=shl-unknown ;;
16340dd5a57Smrg	    sh3eb) machine=sh-unknown ;;
16440dd5a57Smrg	    sh5el) machine=sh5le-unknown ;;
16540dd5a57Smrg	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
16640dd5a57Smrg	esac
16740dd5a57Smrg	# The Operating System including object format, if it has switched
16840dd5a57Smrg	# to ELF recently, or will in the future.
16940dd5a57Smrg	case "${UNAME_MACHINE_ARCH}" in
17040dd5a57Smrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
17140dd5a57Smrg		eval $set_cc_for_build
17240dd5a57Smrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
17340dd5a57Smrg			| grep -q __ELF__
17440dd5a57Smrg		then
17540dd5a57Smrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
17640dd5a57Smrg		    # Return netbsd for either.  FIX?
17740dd5a57Smrg		    os=netbsd
17840dd5a57Smrg		else
17940dd5a57Smrg		    os=netbsdelf
18040dd5a57Smrg		fi
18140dd5a57Smrg		;;
18240dd5a57Smrg	    *)
18340dd5a57Smrg	        os=netbsd
18440dd5a57Smrg		;;
18540dd5a57Smrg	esac
18640dd5a57Smrg	# The OS release
18740dd5a57Smrg	# Debian GNU/NetBSD machines have a different userland, and
18840dd5a57Smrg	# thus, need a distinct triplet. However, they do not need
18940dd5a57Smrg	# kernel version information, so it can be replaced with a
19040dd5a57Smrg	# suitable tag, in the style of linux-gnu.
19140dd5a57Smrg	case "${UNAME_VERSION}" in
19240dd5a57Smrg	    Debian*)
19340dd5a57Smrg		release='-gnu'
19440dd5a57Smrg		;;
19540dd5a57Smrg	    *)
19640dd5a57Smrg		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
19740dd5a57Smrg		;;
19840dd5a57Smrg	esac
19940dd5a57Smrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
20040dd5a57Smrg	# contains redundant information, the shorter form:
20140dd5a57Smrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
20240dd5a57Smrg	echo "${machine}-${os}${release}"
20340dd5a57Smrg	exit ;;
20440dd5a57Smrg    *:OpenBSD:*:*)
20540dd5a57Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
20640dd5a57Smrg	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
20740dd5a57Smrg	exit ;;
20840dd5a57Smrg    *:ekkoBSD:*:*)
20940dd5a57Smrg	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
21040dd5a57Smrg	exit ;;
21140dd5a57Smrg    *:SolidBSD:*:*)
21240dd5a57Smrg	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
21340dd5a57Smrg	exit ;;
21440dd5a57Smrg    macppc:MirBSD:*:*)
21540dd5a57Smrg	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
21640dd5a57Smrg	exit ;;
21740dd5a57Smrg    *:MirBSD:*:*)
21840dd5a57Smrg	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
21940dd5a57Smrg	exit ;;
22040dd5a57Smrg    alpha:OSF1:*:*)
22140dd5a57Smrg	case $UNAME_RELEASE in
22240dd5a57Smrg	*4.0)
22340dd5a57Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
22440dd5a57Smrg		;;
22540dd5a57Smrg	*5.*)
22640dd5a57Smrg	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
22740dd5a57Smrg		;;
22840dd5a57Smrg	esac
22940dd5a57Smrg	# According to Compaq, /usr/sbin/psrinfo has been available on
23040dd5a57Smrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
23140dd5a57Smrg	# covers most systems running today.  This code pipes the CPU
23240dd5a57Smrg	# types through head -n 1, so we only detect the type of CPU 0.
23340dd5a57Smrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
23440dd5a57Smrg	case "$ALPHA_CPU_TYPE" in
23540dd5a57Smrg	    "EV4 (21064)")
23640dd5a57Smrg		UNAME_MACHINE="alpha" ;;
23740dd5a57Smrg	    "EV4.5 (21064)")
23840dd5a57Smrg		UNAME_MACHINE="alpha" ;;
23940dd5a57Smrg	    "LCA4 (21066/21068)")
24040dd5a57Smrg		UNAME_MACHINE="alpha" ;;
24140dd5a57Smrg	    "EV5 (21164)")
24240dd5a57Smrg		UNAME_MACHINE="alphaev5" ;;
24340dd5a57Smrg	    "EV5.6 (21164A)")
24440dd5a57Smrg		UNAME_MACHINE="alphaev56" ;;
24540dd5a57Smrg	    "EV5.6 (21164PC)")
24640dd5a57Smrg		UNAME_MACHINE="alphapca56" ;;
24740dd5a57Smrg	    "EV5.7 (21164PC)")
24840dd5a57Smrg		UNAME_MACHINE="alphapca57" ;;
24940dd5a57Smrg	    "EV6 (21264)")
25040dd5a57Smrg		UNAME_MACHINE="alphaev6" ;;
25140dd5a57Smrg	    "EV6.7 (21264A)")
25240dd5a57Smrg		UNAME_MACHINE="alphaev67" ;;
25340dd5a57Smrg	    "EV6.8CB (21264C)")
25440dd5a57Smrg		UNAME_MACHINE="alphaev68" ;;
25540dd5a57Smrg	    "EV6.8AL (21264B)")
25640dd5a57Smrg		UNAME_MACHINE="alphaev68" ;;
25740dd5a57Smrg	    "EV6.8CX (21264D)")
25840dd5a57Smrg		UNAME_MACHINE="alphaev68" ;;
25940dd5a57Smrg	    "EV6.9A (21264/EV69A)")
26040dd5a57Smrg		UNAME_MACHINE="alphaev69" ;;
26140dd5a57Smrg	    "EV7 (21364)")
26240dd5a57Smrg		UNAME_MACHINE="alphaev7" ;;
26340dd5a57Smrg	    "EV7.9 (21364A)")
26440dd5a57Smrg		UNAME_MACHINE="alphaev79" ;;
26540dd5a57Smrg	esac
26640dd5a57Smrg	# A Pn.n version is a patched version.
26740dd5a57Smrg	# A Vn.n version is a released version.
26840dd5a57Smrg	# A Tn.n version is a released field test version.
26940dd5a57Smrg	# A Xn.n version is an unreleased experimental baselevel.
27040dd5a57Smrg	# 1.2 uses "1.2" for uname -r.
27140dd5a57Smrg	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
27240dd5a57Smrg	exit ;;
27340dd5a57Smrg    Alpha\ *:Windows_NT*:*)
27440dd5a57Smrg	# How do we know it's Interix rather than the generic POSIX subsystem?
27540dd5a57Smrg	# Should we change UNAME_MACHINE based on the output of uname instead
27640dd5a57Smrg	# of the specific Alpha model?
27740dd5a57Smrg	echo alpha-pc-interix
27840dd5a57Smrg	exit ;;
27940dd5a57Smrg    21064:Windows_NT:50:3)
28040dd5a57Smrg	echo alpha-dec-winnt3.5
28140dd5a57Smrg	exit ;;
28240dd5a57Smrg    Amiga*:UNIX_System_V:4.0:*)
28340dd5a57Smrg	echo m68k-unknown-sysv4
28440dd5a57Smrg	exit ;;
28540dd5a57Smrg    *:[Aa]miga[Oo][Ss]:*:*)
28640dd5a57Smrg	echo ${UNAME_MACHINE}-unknown-amigaos
28740dd5a57Smrg	exit ;;
28840dd5a57Smrg    *:[Mm]orph[Oo][Ss]:*:*)
28940dd5a57Smrg	echo ${UNAME_MACHINE}-unknown-morphos
29040dd5a57Smrg	exit ;;
29140dd5a57Smrg    *:OS/390:*:*)
29240dd5a57Smrg	echo i370-ibm-openedition
29340dd5a57Smrg	exit ;;
29440dd5a57Smrg    *:z/VM:*:*)
29540dd5a57Smrg	echo s390-ibm-zvmoe
29640dd5a57Smrg	exit ;;
29740dd5a57Smrg    *:OS400:*:*)
29840dd5a57Smrg        echo powerpc-ibm-os400
29940dd5a57Smrg	exit ;;
30040dd5a57Smrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
30140dd5a57Smrg	echo arm-acorn-riscix${UNAME_RELEASE}
30240dd5a57Smrg	exit ;;
30340dd5a57Smrg    arm:riscos:*:*|arm:RISCOS:*:*)
30440dd5a57Smrg	echo arm-unknown-riscos
30540dd5a57Smrg	exit ;;
30640dd5a57Smrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
30740dd5a57Smrg	echo hppa1.1-hitachi-hiuxmpp
30840dd5a57Smrg	exit ;;
30940dd5a57Smrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
31040dd5a57Smrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
31140dd5a57Smrg	if test "`(/bin/universe) 2>/dev/null`" = att ; then
31240dd5a57Smrg		echo pyramid-pyramid-sysv3
31340dd5a57Smrg	else
31440dd5a57Smrg		echo pyramid-pyramid-bsd
31540dd5a57Smrg	fi
31640dd5a57Smrg	exit ;;
31740dd5a57Smrg    NILE*:*:*:dcosx)
31840dd5a57Smrg	echo pyramid-pyramid-svr4
31940dd5a57Smrg	exit ;;
32040dd5a57Smrg    DRS?6000:unix:4.0:6*)
32140dd5a57Smrg	echo sparc-icl-nx6
32240dd5a57Smrg	exit ;;
32340dd5a57Smrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
32440dd5a57Smrg	case `/usr/bin/uname -p` in
32540dd5a57Smrg	    sparc) echo sparc-icl-nx7; exit ;;
32640dd5a57Smrg	esac ;;
32740dd5a57Smrg    s390x:SunOS:*:*)
32840dd5a57Smrg	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
32940dd5a57Smrg	exit ;;
33040dd5a57Smrg    sun4H:SunOS:5.*:*)
33140dd5a57Smrg	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
33240dd5a57Smrg	exit ;;
33340dd5a57Smrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
33440dd5a57Smrg	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
33540dd5a57Smrg	exit ;;
33640dd5a57Smrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
33740dd5a57Smrg	echo i386-pc-auroraux${UNAME_RELEASE}
33840dd5a57Smrg	exit ;;
33940dd5a57Smrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
34040dd5a57Smrg	eval $set_cc_for_build
34140dd5a57Smrg	SUN_ARCH="i386"
34240dd5a57Smrg	# If there is a compiler, see if it is configured for 64-bit objects.
34340dd5a57Smrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
34440dd5a57Smrg	# This test works for both compilers.
34540dd5a57Smrg	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
34640dd5a57Smrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
34740dd5a57Smrg		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
34840dd5a57Smrg		grep IS_64BIT_ARCH >/dev/null
34940dd5a57Smrg	    then
35040dd5a57Smrg		SUN_ARCH="x86_64"
35140dd5a57Smrg	    fi
35240dd5a57Smrg	fi
35340dd5a57Smrg	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
35440dd5a57Smrg	exit ;;
35540dd5a57Smrg    sun4*:SunOS:6*:*)
35640dd5a57Smrg	# According to config.sub, this is the proper way to canonicalize
35740dd5a57Smrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
35840dd5a57Smrg	# it's likely to be more like Solaris than SunOS4.
35940dd5a57Smrg	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
36040dd5a57Smrg	exit ;;
36140dd5a57Smrg    sun4*:SunOS:*:*)
36240dd5a57Smrg	case "`/usr/bin/arch -k`" in
36340dd5a57Smrg	    Series*|S4*)
36440dd5a57Smrg		UNAME_RELEASE=`uname -v`
36540dd5a57Smrg		;;
36640dd5a57Smrg	esac
36740dd5a57Smrg	# Japanese Language versions have a version number like `4.1.3-JL'.
36840dd5a57Smrg	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
36940dd5a57Smrg	exit ;;
37040dd5a57Smrg    sun3*:SunOS:*:*)
37140dd5a57Smrg	echo m68k-sun-sunos${UNAME_RELEASE}
37240dd5a57Smrg	exit ;;
37340dd5a57Smrg    sun*:*:4.2BSD:*)
37440dd5a57Smrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
37540dd5a57Smrg	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
37640dd5a57Smrg	case "`/bin/arch`" in
37740dd5a57Smrg	    sun3)
37840dd5a57Smrg		echo m68k-sun-sunos${UNAME_RELEASE}
37940dd5a57Smrg		;;
38040dd5a57Smrg	    sun4)
38140dd5a57Smrg		echo sparc-sun-sunos${UNAME_RELEASE}
38240dd5a57Smrg		;;
38340dd5a57Smrg	esac
38440dd5a57Smrg	exit ;;
38540dd5a57Smrg    aushp:SunOS:*:*)
38640dd5a57Smrg	echo sparc-auspex-sunos${UNAME_RELEASE}
38740dd5a57Smrg	exit ;;
38840dd5a57Smrg    # The situation for MiNT is a little confusing.  The machine name
38940dd5a57Smrg    # can be virtually everything (everything which is not
39040dd5a57Smrg    # "atarist" or "atariste" at least should have a processor
39140dd5a57Smrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
39240dd5a57Smrg    # to the lowercase version "mint" (or "freemint").  Finally
39340dd5a57Smrg    # the system name "TOS" denotes a system which is actually not
39440dd5a57Smrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
39540dd5a57Smrg    # be no problem.
39640dd5a57Smrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
39740dd5a57Smrg        echo m68k-atari-mint${UNAME_RELEASE}
39840dd5a57Smrg	exit ;;
39940dd5a57Smrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
40040dd5a57Smrg	echo m68k-atari-mint${UNAME_RELEASE}
40140dd5a57Smrg        exit ;;
40240dd5a57Smrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
40340dd5a57Smrg        echo m68k-atari-mint${UNAME_RELEASE}
40440dd5a57Smrg	exit ;;
40540dd5a57Smrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
40640dd5a57Smrg        echo m68k-milan-mint${UNAME_RELEASE}
40740dd5a57Smrg        exit ;;
40840dd5a57Smrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
40940dd5a57Smrg        echo m68k-hades-mint${UNAME_RELEASE}
41040dd5a57Smrg        exit ;;
41140dd5a57Smrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
41240dd5a57Smrg        echo m68k-unknown-mint${UNAME_RELEASE}
41340dd5a57Smrg        exit ;;
41440dd5a57Smrg    m68k:machten:*:*)
41540dd5a57Smrg	echo m68k-apple-machten${UNAME_RELEASE}
41640dd5a57Smrg	exit ;;
41740dd5a57Smrg    powerpc:machten:*:*)
41840dd5a57Smrg	echo powerpc-apple-machten${UNAME_RELEASE}
41940dd5a57Smrg	exit ;;
42040dd5a57Smrg    RISC*:Mach:*:*)
42140dd5a57Smrg	echo mips-dec-mach_bsd4.3
42240dd5a57Smrg	exit ;;
42340dd5a57Smrg    RISC*:ULTRIX:*:*)
42440dd5a57Smrg	echo mips-dec-ultrix${UNAME_RELEASE}
42540dd5a57Smrg	exit ;;
42640dd5a57Smrg    VAX*:ULTRIX*:*:*)
42740dd5a57Smrg	echo vax-dec-ultrix${UNAME_RELEASE}
42840dd5a57Smrg	exit ;;
42940dd5a57Smrg    2020:CLIX:*:* | 2430:CLIX:*:*)
43040dd5a57Smrg	echo clipper-intergraph-clix${UNAME_RELEASE}
43140dd5a57Smrg	exit ;;
43240dd5a57Smrg    mips:*:*:UMIPS | mips:*:*:RISCos)
43340dd5a57Smrg	eval $set_cc_for_build
43440dd5a57Smrg	sed 's/^	//' << EOF >$dummy.c
43540dd5a57Smrg#ifdef __cplusplus
43640dd5a57Smrg#include <stdio.h>  /* for printf() prototype */
43740dd5a57Smrg	int main (int argc, char *argv[]) {
43840dd5a57Smrg#else
43940dd5a57Smrg	int main (argc, argv) int argc; char *argv[]; {
44040dd5a57Smrg#endif
44140dd5a57Smrg	#if defined (host_mips) && defined (MIPSEB)
44240dd5a57Smrg	#if defined (SYSTYPE_SYSV)
44340dd5a57Smrg	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
44440dd5a57Smrg	#endif
44540dd5a57Smrg	#if defined (SYSTYPE_SVR4)
44640dd5a57Smrg	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
44740dd5a57Smrg	#endif
44840dd5a57Smrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
44940dd5a57Smrg	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
45040dd5a57Smrg	#endif
45140dd5a57Smrg	#endif
45240dd5a57Smrg	  exit (-1);
45340dd5a57Smrg	}
45440dd5a57SmrgEOF
45540dd5a57Smrg	$CC_FOR_BUILD -o $dummy $dummy.c &&
45640dd5a57Smrg	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
45740dd5a57Smrg	  SYSTEM_NAME=`$dummy $dummyarg` &&
45840dd5a57Smrg	    { echo "$SYSTEM_NAME"; exit; }
45940dd5a57Smrg	echo mips-mips-riscos${UNAME_RELEASE}
46040dd5a57Smrg	exit ;;
46140dd5a57Smrg    Motorola:PowerMAX_OS:*:*)
46240dd5a57Smrg	echo powerpc-motorola-powermax
46340dd5a57Smrg	exit ;;
46440dd5a57Smrg    Motorola:*:4.3:PL8-*)
46540dd5a57Smrg	echo powerpc-harris-powermax
46640dd5a57Smrg	exit ;;
46740dd5a57Smrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
46840dd5a57Smrg	echo powerpc-harris-powermax
46940dd5a57Smrg	exit ;;
47040dd5a57Smrg    Night_Hawk:Power_UNIX:*:*)
47140dd5a57Smrg	echo powerpc-harris-powerunix
47240dd5a57Smrg	exit ;;
47340dd5a57Smrg    m88k:CX/UX:7*:*)
47440dd5a57Smrg	echo m88k-harris-cxux7
47540dd5a57Smrg	exit ;;
47640dd5a57Smrg    m88k:*:4*:R4*)
47740dd5a57Smrg	echo m88k-motorola-sysv4
47840dd5a57Smrg	exit ;;
47940dd5a57Smrg    m88k:*:3*:R3*)
48040dd5a57Smrg	echo m88k-motorola-sysv3
48140dd5a57Smrg	exit ;;
48240dd5a57Smrg    AViiON:dgux:*:*)
48340dd5a57Smrg        # DG/UX returns AViiON for all architectures
48440dd5a57Smrg        UNAME_PROCESSOR=`/usr/bin/uname -p`
48540dd5a57Smrg	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
48640dd5a57Smrg	then
48740dd5a57Smrg	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
48840dd5a57Smrg	       [ ${TARGET_BINARY_INTERFACE}x = x ]
48940dd5a57Smrg	    then
49040dd5a57Smrg		echo m88k-dg-dgux${UNAME_RELEASE}
49140dd5a57Smrg	    else
49240dd5a57Smrg		echo m88k-dg-dguxbcs${UNAME_RELEASE}
49340dd5a57Smrg	    fi
49440dd5a57Smrg	else
49540dd5a57Smrg	    echo i586-dg-dgux${UNAME_RELEASE}
49640dd5a57Smrg	fi
49740dd5a57Smrg 	exit ;;
49840dd5a57Smrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
49940dd5a57Smrg	echo m88k-dolphin-sysv3
50040dd5a57Smrg	exit ;;
50140dd5a57Smrg    M88*:*:R3*:*)
50240dd5a57Smrg	# Delta 88k system running SVR3
50340dd5a57Smrg	echo m88k-motorola-sysv3
50440dd5a57Smrg	exit ;;
50540dd5a57Smrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
50640dd5a57Smrg	echo m88k-tektronix-sysv3
50740dd5a57Smrg	exit ;;
50840dd5a57Smrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
50940dd5a57Smrg	echo m68k-tektronix-bsd
51040dd5a57Smrg	exit ;;
51140dd5a57Smrg    *:IRIX*:*:*)
51240dd5a57Smrg	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
51340dd5a57Smrg	exit ;;
51440dd5a57Smrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
51540dd5a57Smrg	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
51640dd5a57Smrg	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
51740dd5a57Smrg    i*86:AIX:*:*)
51840dd5a57Smrg	echo i386-ibm-aix
51940dd5a57Smrg	exit ;;
52040dd5a57Smrg    ia64:AIX:*:*)
52140dd5a57Smrg	if [ -x /usr/bin/oslevel ] ; then
52240dd5a57Smrg		IBM_REV=`/usr/bin/oslevel`
52340dd5a57Smrg	else
52440dd5a57Smrg		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
52540dd5a57Smrg	fi
52640dd5a57Smrg	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
52740dd5a57Smrg	exit ;;
52840dd5a57Smrg    *:AIX:2:3)
52940dd5a57Smrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
53040dd5a57Smrg		eval $set_cc_for_build
53140dd5a57Smrg		sed 's/^		//' << EOF >$dummy.c
53240dd5a57Smrg		#include <sys/systemcfg.h>
53340dd5a57Smrg
53440dd5a57Smrg		main()
53540dd5a57Smrg			{
53640dd5a57Smrg			if (!__power_pc())
53740dd5a57Smrg				exit(1);
53840dd5a57Smrg			puts("powerpc-ibm-aix3.2.5");
53940dd5a57Smrg			exit(0);
54040dd5a57Smrg			}
54140dd5a57SmrgEOF
54240dd5a57Smrg		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
54340dd5a57Smrg		then
54440dd5a57Smrg			echo "$SYSTEM_NAME"
54540dd5a57Smrg		else
54640dd5a57Smrg			echo rs6000-ibm-aix3.2.5
54740dd5a57Smrg		fi
54840dd5a57Smrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
54940dd5a57Smrg		echo rs6000-ibm-aix3.2.4
55040dd5a57Smrg	else
55140dd5a57Smrg		echo rs6000-ibm-aix3.2
55240dd5a57Smrg	fi
55340dd5a57Smrg	exit ;;
55440dd5a57Smrg    *:AIX:*:[456])
55540dd5a57Smrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
55640dd5a57Smrg	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
55740dd5a57Smrg		IBM_ARCH=rs6000
55840dd5a57Smrg	else
55940dd5a57Smrg		IBM_ARCH=powerpc
56040dd5a57Smrg	fi
56140dd5a57Smrg	if [ -x /usr/bin/oslevel ] ; then
56240dd5a57Smrg		IBM_REV=`/usr/bin/oslevel`
56340dd5a57Smrg	else
56440dd5a57Smrg		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
56540dd5a57Smrg	fi
56640dd5a57Smrg	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
56740dd5a57Smrg	exit ;;
56840dd5a57Smrg    *:AIX:*:*)
56940dd5a57Smrg	echo rs6000-ibm-aix
57040dd5a57Smrg	exit ;;
57140dd5a57Smrg    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
57240dd5a57Smrg	echo romp-ibm-bsd4.4
57340dd5a57Smrg	exit ;;
57440dd5a57Smrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
57540dd5a57Smrg	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
57640dd5a57Smrg	exit ;;                             # report: romp-ibm BSD 4.3
57740dd5a57Smrg    *:BOSX:*:*)
57840dd5a57Smrg	echo rs6000-bull-bosx
57940dd5a57Smrg	exit ;;
58040dd5a57Smrg    DPX/2?00:B.O.S.:*:*)
58140dd5a57Smrg	echo m68k-bull-sysv3
58240dd5a57Smrg	exit ;;
58340dd5a57Smrg    9000/[34]??:4.3bsd:1.*:*)
58440dd5a57Smrg	echo m68k-hp-bsd
58540dd5a57Smrg	exit ;;
58640dd5a57Smrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
58740dd5a57Smrg	echo m68k-hp-bsd4.4
58840dd5a57Smrg	exit ;;
58940dd5a57Smrg    9000/[34678]??:HP-UX:*:*)
59040dd5a57Smrg	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
59140dd5a57Smrg	case "${UNAME_MACHINE}" in
59240dd5a57Smrg	    9000/31? )            HP_ARCH=m68000 ;;
59340dd5a57Smrg	    9000/[34]?? )         HP_ARCH=m68k ;;
59440dd5a57Smrg	    9000/[678][0-9][0-9])
59540dd5a57Smrg		if [ -x /usr/bin/getconf ]; then
59640dd5a57Smrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
59740dd5a57Smrg                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
59840dd5a57Smrg                    case "${sc_cpu_version}" in
59940dd5a57Smrg                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
60040dd5a57Smrg                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
60140dd5a57Smrg                      532)                      # CPU_PA_RISC2_0
60240dd5a57Smrg                        case "${sc_kernel_bits}" in
60340dd5a57Smrg                          32) HP_ARCH="hppa2.0n" ;;
60440dd5a57Smrg                          64) HP_ARCH="hppa2.0w" ;;
60540dd5a57Smrg			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
60640dd5a57Smrg                        esac ;;
60740dd5a57Smrg                    esac
60840dd5a57Smrg		fi
60940dd5a57Smrg		if [ "${HP_ARCH}" = "" ]; then
61040dd5a57Smrg		    eval $set_cc_for_build
61140dd5a57Smrg		    sed 's/^              //' << EOF >$dummy.c
61240dd5a57Smrg
61340dd5a57Smrg              #define _HPUX_SOURCE
61440dd5a57Smrg              #include <stdlib.h>
61540dd5a57Smrg              #include <unistd.h>
61640dd5a57Smrg
61740dd5a57Smrg              int main ()
61840dd5a57Smrg              {
61940dd5a57Smrg              #if defined(_SC_KERNEL_BITS)
62040dd5a57Smrg                  long bits = sysconf(_SC_KERNEL_BITS);
62140dd5a57Smrg              #endif
62240dd5a57Smrg                  long cpu  = sysconf (_SC_CPU_VERSION);
62340dd5a57Smrg
62440dd5a57Smrg                  switch (cpu)
62540dd5a57Smrg              	{
62640dd5a57Smrg              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
62740dd5a57Smrg              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
62840dd5a57Smrg              	case CPU_PA_RISC2_0:
62940dd5a57Smrg              #if defined(_SC_KERNEL_BITS)
63040dd5a57Smrg              	    switch (bits)
63140dd5a57Smrg              		{
63240dd5a57Smrg              		case 64: puts ("hppa2.0w"); break;
63340dd5a57Smrg              		case 32: puts ("hppa2.0n"); break;
63440dd5a57Smrg              		default: puts ("hppa2.0"); break;
63540dd5a57Smrg              		} break;
63640dd5a57Smrg              #else  /* !defined(_SC_KERNEL_BITS) */
63740dd5a57Smrg              	    puts ("hppa2.0"); break;
63840dd5a57Smrg              #endif
63940dd5a57Smrg              	default: puts ("hppa1.0"); break;
64040dd5a57Smrg              	}
64140dd5a57Smrg                  exit (0);
64240dd5a57Smrg              }
64340dd5a57SmrgEOF
64440dd5a57Smrg		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
64540dd5a57Smrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
64640dd5a57Smrg		fi ;;
64740dd5a57Smrg	esac
64840dd5a57Smrg	if [ ${HP_ARCH} = "hppa2.0w" ]
64940dd5a57Smrg	then
65040dd5a57Smrg	    eval $set_cc_for_build
65140dd5a57Smrg
65240dd5a57Smrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
65340dd5a57Smrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
65440dd5a57Smrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
65540dd5a57Smrg	    #
65640dd5a57Smrg	    # $ CC_FOR_BUILD=cc ./config.guess
65740dd5a57Smrg	    # => hppa2.0w-hp-hpux11.23
65840dd5a57Smrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
65940dd5a57Smrg	    # => hppa64-hp-hpux11.23
66040dd5a57Smrg
66140dd5a57Smrg	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
66240dd5a57Smrg		grep -q __LP64__
66340dd5a57Smrg	    then
66440dd5a57Smrg		HP_ARCH="hppa2.0w"
66540dd5a57Smrg	    else
66640dd5a57Smrg		HP_ARCH="hppa64"
66740dd5a57Smrg	    fi
66840dd5a57Smrg	fi
66940dd5a57Smrg	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
67040dd5a57Smrg	exit ;;
67140dd5a57Smrg    ia64:HP-UX:*:*)
67240dd5a57Smrg	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
67340dd5a57Smrg	echo ia64-hp-hpux${HPUX_REV}
67440dd5a57Smrg	exit ;;
67540dd5a57Smrg    3050*:HI-UX:*:*)
67640dd5a57Smrg	eval $set_cc_for_build
67740dd5a57Smrg	sed 's/^	//' << EOF >$dummy.c
67840dd5a57Smrg	#include <unistd.h>
67940dd5a57Smrg	int
68040dd5a57Smrg	main ()
68140dd5a57Smrg	{
68240dd5a57Smrg	  long cpu = sysconf (_SC_CPU_VERSION);
68340dd5a57Smrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
68440dd5a57Smrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
68540dd5a57Smrg	     results, however.  */
68640dd5a57Smrg	  if (CPU_IS_PA_RISC (cpu))
68740dd5a57Smrg	    {
68840dd5a57Smrg	      switch (cpu)
68940dd5a57Smrg		{
69040dd5a57Smrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
69140dd5a57Smrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
69240dd5a57Smrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
69340dd5a57Smrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
69440dd5a57Smrg		}
69540dd5a57Smrg	    }
69640dd5a57Smrg	  else if (CPU_IS_HP_MC68K (cpu))
69740dd5a57Smrg	    puts ("m68k-hitachi-hiuxwe2");
69840dd5a57Smrg	  else puts ("unknown-hitachi-hiuxwe2");
69940dd5a57Smrg	  exit (0);
70040dd5a57Smrg	}
70140dd5a57SmrgEOF
70240dd5a57Smrg	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
70340dd5a57Smrg		{ echo "$SYSTEM_NAME"; exit; }
70440dd5a57Smrg	echo unknown-hitachi-hiuxwe2
70540dd5a57Smrg	exit ;;
70640dd5a57Smrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
70740dd5a57Smrg	echo hppa1.1-hp-bsd
70840dd5a57Smrg	exit ;;
70940dd5a57Smrg    9000/8??:4.3bsd:*:*)
71040dd5a57Smrg	echo hppa1.0-hp-bsd
71140dd5a57Smrg	exit ;;
71240dd5a57Smrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
71340dd5a57Smrg	echo hppa1.0-hp-mpeix
71440dd5a57Smrg	exit ;;
71540dd5a57Smrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
71640dd5a57Smrg	echo hppa1.1-hp-osf
71740dd5a57Smrg	exit ;;
71840dd5a57Smrg    hp8??:OSF1:*:*)
71940dd5a57Smrg	echo hppa1.0-hp-osf
72040dd5a57Smrg	exit ;;
72140dd5a57Smrg    i*86:OSF1:*:*)
72240dd5a57Smrg	if [ -x /usr/sbin/sysversion ] ; then
72340dd5a57Smrg	    echo ${UNAME_MACHINE}-unknown-osf1mk
72440dd5a57Smrg	else
72540dd5a57Smrg	    echo ${UNAME_MACHINE}-unknown-osf1
72640dd5a57Smrg	fi
72740dd5a57Smrg	exit ;;
72840dd5a57Smrg    parisc*:Lites*:*:*)
72940dd5a57Smrg	echo hppa1.1-hp-lites
73040dd5a57Smrg	exit ;;
73140dd5a57Smrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
73240dd5a57Smrg	echo c1-convex-bsd
73340dd5a57Smrg        exit ;;
73440dd5a57Smrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
73540dd5a57Smrg	if getsysinfo -f scalar_acc
73640dd5a57Smrg	then echo c32-convex-bsd
73740dd5a57Smrg	else echo c2-convex-bsd
73840dd5a57Smrg	fi
73940dd5a57Smrg        exit ;;
74040dd5a57Smrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
74140dd5a57Smrg	echo c34-convex-bsd
74240dd5a57Smrg        exit ;;
74340dd5a57Smrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
74440dd5a57Smrg	echo c38-convex-bsd
74540dd5a57Smrg        exit ;;
74640dd5a57Smrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
74740dd5a57Smrg	echo c4-convex-bsd
74840dd5a57Smrg        exit ;;
74940dd5a57Smrg    CRAY*Y-MP:*:*:*)
75040dd5a57Smrg	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
75140dd5a57Smrg	exit ;;
75240dd5a57Smrg    CRAY*[A-Z]90:*:*:*)
75340dd5a57Smrg	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
75440dd5a57Smrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
75540dd5a57Smrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
75640dd5a57Smrg	      -e 's/\.[^.]*$/.X/'
75740dd5a57Smrg	exit ;;
75840dd5a57Smrg    CRAY*TS:*:*:*)
75940dd5a57Smrg	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
76040dd5a57Smrg	exit ;;
76140dd5a57Smrg    CRAY*T3E:*:*:*)
76240dd5a57Smrg	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
76340dd5a57Smrg	exit ;;
76440dd5a57Smrg    CRAY*SV1:*:*:*)
76540dd5a57Smrg	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
76640dd5a57Smrg	exit ;;
76740dd5a57Smrg    *:UNICOS/mp:*:*)
76840dd5a57Smrg	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
76940dd5a57Smrg	exit ;;
77040dd5a57Smrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
77140dd5a57Smrg	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
77240dd5a57Smrg        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
77340dd5a57Smrg        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
77440dd5a57Smrg        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
77540dd5a57Smrg        exit ;;
77640dd5a57Smrg    5000:UNIX_System_V:4.*:*)
77740dd5a57Smrg        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
77840dd5a57Smrg        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
77940dd5a57Smrg        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
78040dd5a57Smrg	exit ;;
78140dd5a57Smrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
78240dd5a57Smrg	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
78340dd5a57Smrg	exit ;;
78440dd5a57Smrg    sparc*:BSD/OS:*:*)
78540dd5a57Smrg	echo sparc-unknown-bsdi${UNAME_RELEASE}
78640dd5a57Smrg	exit ;;
78740dd5a57Smrg    *:BSD/OS:*:*)
78840dd5a57Smrg	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
78940dd5a57Smrg	exit ;;
79040dd5a57Smrg    *:FreeBSD:*:*)
79140dd5a57Smrg	case ${UNAME_MACHINE} in
79240dd5a57Smrg	    pc98)
79340dd5a57Smrg		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
79440dd5a57Smrg	    amd64)
79540dd5a57Smrg		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
79640dd5a57Smrg	    *)
79740dd5a57Smrg		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
79840dd5a57Smrg	esac
79940dd5a57Smrg	exit ;;
80040dd5a57Smrg    i*:CYGWIN*:*)
80140dd5a57Smrg	echo ${UNAME_MACHINE}-pc-cygwin
80240dd5a57Smrg	exit ;;
80340dd5a57Smrg    *:MINGW*:*)
80440dd5a57Smrg	echo ${UNAME_MACHINE}-pc-mingw32
80540dd5a57Smrg	exit ;;
80640dd5a57Smrg    i*:windows32*:*)
80740dd5a57Smrg    	# uname -m includes "-pc" on this system.
80840dd5a57Smrg    	echo ${UNAME_MACHINE}-mingw32
80940dd5a57Smrg	exit ;;
81040dd5a57Smrg    i*:PW*:*)
81140dd5a57Smrg	echo ${UNAME_MACHINE}-pc-pw32
81240dd5a57Smrg	exit ;;
81340dd5a57Smrg    *:Interix*:*)
81440dd5a57Smrg    	case ${UNAME_MACHINE} in
81540dd5a57Smrg	    x86)
81640dd5a57Smrg		echo i586-pc-interix${UNAME_RELEASE}
81740dd5a57Smrg		exit ;;
81840dd5a57Smrg	    authenticamd | genuineintel | EM64T)
81940dd5a57Smrg		echo x86_64-unknown-interix${UNAME_RELEASE}
82040dd5a57Smrg		exit ;;
82140dd5a57Smrg	    IA64)
82240dd5a57Smrg		echo ia64-unknown-interix${UNAME_RELEASE}
82340dd5a57Smrg		exit ;;
82440dd5a57Smrg	esac ;;
82540dd5a57Smrg    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
82640dd5a57Smrg	echo i${UNAME_MACHINE}-pc-mks
82740dd5a57Smrg	exit ;;
82840dd5a57Smrg    8664:Windows_NT:*)
82940dd5a57Smrg	echo x86_64-pc-mks
83040dd5a57Smrg	exit ;;
83140dd5a57Smrg    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
83240dd5a57Smrg	# How do we know it's Interix rather than the generic POSIX subsystem?
83340dd5a57Smrg	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
83440dd5a57Smrg	# UNAME_MACHINE based on the output of uname instead of i386?
83540dd5a57Smrg	echo i586-pc-interix
83640dd5a57Smrg	exit ;;
83740dd5a57Smrg    i*:UWIN*:*)
83840dd5a57Smrg	echo ${UNAME_MACHINE}-pc-uwin
83940dd5a57Smrg	exit ;;
84040dd5a57Smrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
84140dd5a57Smrg	echo x86_64-unknown-cygwin
84240dd5a57Smrg	exit ;;
84340dd5a57Smrg    p*:CYGWIN*:*)
84440dd5a57Smrg	echo powerpcle-unknown-cygwin
84540dd5a57Smrg	exit ;;
84640dd5a57Smrg    prep*:SunOS:5.*:*)
84740dd5a57Smrg	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
84840dd5a57Smrg	exit ;;
84940dd5a57Smrg    *:GNU:*:*)
85040dd5a57Smrg	# the GNU system
85140dd5a57Smrg	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
85240dd5a57Smrg	exit ;;
85340dd5a57Smrg    *:GNU/*:*:*)
85440dd5a57Smrg	# other systems with GNU libc and userland
85540dd5a57Smrg	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
85640dd5a57Smrg	exit ;;
85740dd5a57Smrg    i*86:Minix:*:*)
85840dd5a57Smrg	echo ${UNAME_MACHINE}-pc-minix
85940dd5a57Smrg	exit ;;
86040dd5a57Smrg    alpha:Linux:*:*)
86140dd5a57Smrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
86240dd5a57Smrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
86340dd5a57Smrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
86440dd5a57Smrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
86540dd5a57Smrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
86640dd5a57Smrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
86740dd5a57Smrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
86840dd5a57Smrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
86940dd5a57Smrg        esac
87040dd5a57Smrg	objdump --private-headers /bin/sh | grep -q ld.so.1
87140dd5a57Smrg	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
87240dd5a57Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
87340dd5a57Smrg	exit ;;
87440dd5a57Smrg    arm*:Linux:*:*)
87540dd5a57Smrg	eval $set_cc_for_build
87640dd5a57Smrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
87740dd5a57Smrg	    | grep -q __ARM_EABI__
87840dd5a57Smrg	then
87940dd5a57Smrg	    echo ${UNAME_MACHINE}-unknown-linux-gnu
88040dd5a57Smrg	else
88140dd5a57Smrg	    echo ${UNAME_MACHINE}-unknown-linux-gnueabi
88240dd5a57Smrg	fi
88340dd5a57Smrg	exit ;;
88440dd5a57Smrg    avr32*:Linux:*:*)
88540dd5a57Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
88640dd5a57Smrg	exit ;;
88740dd5a57Smrg    cris:Linux:*:*)
88840dd5a57Smrg	echo cris-axis-linux-gnu
88940dd5a57Smrg	exit ;;
89040dd5a57Smrg    crisv32:Linux:*:*)
89140dd5a57Smrg	echo crisv32-axis-linux-gnu
89240dd5a57Smrg	exit ;;
89340dd5a57Smrg    frv:Linux:*:*)
89440dd5a57Smrg    	echo frv-unknown-linux-gnu
89540dd5a57Smrg	exit ;;
89640dd5a57Smrg    i*86:Linux:*:*)
89740dd5a57Smrg	LIBC=gnu
89840dd5a57Smrg	eval $set_cc_for_build
89940dd5a57Smrg	sed 's/^	//' << EOF >$dummy.c
90040dd5a57Smrg	#ifdef __dietlibc__
90140dd5a57Smrg	LIBC=dietlibc
90240dd5a57Smrg	#endif
90340dd5a57SmrgEOF
90440dd5a57Smrg	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
90540dd5a57Smrg	echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
90640dd5a57Smrg	exit ;;
90740dd5a57Smrg    ia64:Linux:*:*)
90840dd5a57Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
90940dd5a57Smrg	exit ;;
91040dd5a57Smrg    m32r*:Linux:*:*)
91140dd5a57Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
91240dd5a57Smrg	exit ;;
91340dd5a57Smrg    m68*:Linux:*:*)
91440dd5a57Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
91540dd5a57Smrg	exit ;;
91640dd5a57Smrg    mips:Linux:*:* | mips64:Linux:*:*)
91740dd5a57Smrg	eval $set_cc_for_build
91840dd5a57Smrg	sed 's/^	//' << EOF >$dummy.c
91940dd5a57Smrg	#undef CPU
92040dd5a57Smrg	#undef ${UNAME_MACHINE}
92140dd5a57Smrg	#undef ${UNAME_MACHINE}el
92240dd5a57Smrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
92340dd5a57Smrg	CPU=${UNAME_MACHINE}el
92440dd5a57Smrg	#else
92540dd5a57Smrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
92640dd5a57Smrg	CPU=${UNAME_MACHINE}
92740dd5a57Smrg	#else
92840dd5a57Smrg	CPU=
92940dd5a57Smrg	#endif
93040dd5a57Smrg	#endif
93140dd5a57SmrgEOF
93240dd5a57Smrg	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
93340dd5a57Smrg	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
93440dd5a57Smrg	;;
93540dd5a57Smrg    or32:Linux:*:*)
93640dd5a57Smrg	echo or32-unknown-linux-gnu
93740dd5a57Smrg	exit ;;
93840dd5a57Smrg    padre:Linux:*:*)
93940dd5a57Smrg	echo sparc-unknown-linux-gnu
94040dd5a57Smrg	exit ;;
94140dd5a57Smrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
94240dd5a57Smrg	echo hppa64-unknown-linux-gnu
94340dd5a57Smrg	exit ;;
94440dd5a57Smrg    parisc:Linux:*:* | hppa:Linux:*:*)
94540dd5a57Smrg	# Look for CPU level
94640dd5a57Smrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
94740dd5a57Smrg	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
94840dd5a57Smrg	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
94940dd5a57Smrg	  *)    echo hppa-unknown-linux-gnu ;;
95040dd5a57Smrg	esac
95140dd5a57Smrg	exit ;;
95240dd5a57Smrg    ppc64:Linux:*:*)
95340dd5a57Smrg	echo powerpc64-unknown-linux-gnu
95440dd5a57Smrg	exit ;;
95540dd5a57Smrg    ppc:Linux:*:*)
95640dd5a57Smrg	echo powerpc-unknown-linux-gnu
95740dd5a57Smrg	exit ;;
95840dd5a57Smrg    s390:Linux:*:* | s390x:Linux:*:*)
95940dd5a57Smrg	echo ${UNAME_MACHINE}-ibm-linux
96040dd5a57Smrg	exit ;;
96140dd5a57Smrg    sh64*:Linux:*:*)
96240dd5a57Smrg    	echo ${UNAME_MACHINE}-unknown-linux-gnu
96340dd5a57Smrg	exit ;;
96440dd5a57Smrg    sh*:Linux:*:*)
96540dd5a57Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
96640dd5a57Smrg	exit ;;
96740dd5a57Smrg    sparc:Linux:*:* | sparc64:Linux:*:*)
96840dd5a57Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
96940dd5a57Smrg	exit ;;
97040dd5a57Smrg    vax:Linux:*:*)
97140dd5a57Smrg	echo ${UNAME_MACHINE}-dec-linux-gnu
97240dd5a57Smrg	exit ;;
97340dd5a57Smrg    x86_64:Linux:*:*)
97440dd5a57Smrg	echo x86_64-unknown-linux-gnu
97540dd5a57Smrg	exit ;;
97640dd5a57Smrg    xtensa*:Linux:*:*)
97740dd5a57Smrg    	echo ${UNAME_MACHINE}-unknown-linux-gnu
97840dd5a57Smrg	exit ;;
97940dd5a57Smrg    i*86:DYNIX/ptx:4*:*)
98040dd5a57Smrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
98140dd5a57Smrg	# earlier versions are messed up and put the nodename in both
98240dd5a57Smrg	# sysname and nodename.
98340dd5a57Smrg	echo i386-sequent-sysv4
98440dd5a57Smrg	exit ;;
98540dd5a57Smrg    i*86:UNIX_SV:4.2MP:2.*)
98640dd5a57Smrg        # Unixware is an offshoot of SVR4, but it has its own version
98740dd5a57Smrg        # number series starting with 2...
98840dd5a57Smrg        # I am not positive that other SVR4 systems won't match this,
98940dd5a57Smrg	# I just have to hope.  -- rms.
99040dd5a57Smrg        # Use sysv4.2uw... so that sysv4* matches it.
99140dd5a57Smrg	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
99240dd5a57Smrg	exit ;;
99340dd5a57Smrg    i*86:OS/2:*:*)
99440dd5a57Smrg	# If we were able to find `uname', then EMX Unix compatibility
99540dd5a57Smrg	# is probably installed.
99640dd5a57Smrg	echo ${UNAME_MACHINE}-pc-os2-emx
99740dd5a57Smrg	exit ;;
99840dd5a57Smrg    i*86:XTS-300:*:STOP)
99940dd5a57Smrg	echo ${UNAME_MACHINE}-unknown-stop
100040dd5a57Smrg	exit ;;
100140dd5a57Smrg    i*86:atheos:*:*)
100240dd5a57Smrg	echo ${UNAME_MACHINE}-unknown-atheos
100340dd5a57Smrg	exit ;;
100440dd5a57Smrg    i*86:syllable:*:*)
100540dd5a57Smrg	echo ${UNAME_MACHINE}-pc-syllable
100640dd5a57Smrg	exit ;;
100740dd5a57Smrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
100840dd5a57Smrg	echo i386-unknown-lynxos${UNAME_RELEASE}
100940dd5a57Smrg	exit ;;
101040dd5a57Smrg    i*86:*DOS:*:*)
101140dd5a57Smrg	echo ${UNAME_MACHINE}-pc-msdosdjgpp
101240dd5a57Smrg	exit ;;
101340dd5a57Smrg    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
101440dd5a57Smrg	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
101540dd5a57Smrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
101640dd5a57Smrg		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
101740dd5a57Smrg	else
101840dd5a57Smrg		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
101940dd5a57Smrg	fi
102040dd5a57Smrg	exit ;;
102140dd5a57Smrg    i*86:*:5:[678]*)
102240dd5a57Smrg    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
102340dd5a57Smrg	case `/bin/uname -X | grep "^Machine"` in
102440dd5a57Smrg	    *486*)	     UNAME_MACHINE=i486 ;;
102540dd5a57Smrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
102640dd5a57Smrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
102740dd5a57Smrg	esac
102840dd5a57Smrg	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
102940dd5a57Smrg	exit ;;
103040dd5a57Smrg    i*86:*:3.2:*)
103140dd5a57Smrg	if test -f /usr/options/cb.name; then
103240dd5a57Smrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
103340dd5a57Smrg		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
103440dd5a57Smrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
103540dd5a57Smrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
103640dd5a57Smrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
103740dd5a57Smrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
103840dd5a57Smrg			&& UNAME_MACHINE=i586
103940dd5a57Smrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
104040dd5a57Smrg			&& UNAME_MACHINE=i686
104140dd5a57Smrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
104240dd5a57Smrg			&& UNAME_MACHINE=i686
104340dd5a57Smrg		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
104440dd5a57Smrg	else
104540dd5a57Smrg		echo ${UNAME_MACHINE}-pc-sysv32
104640dd5a57Smrg	fi
104740dd5a57Smrg	exit ;;
104840dd5a57Smrg    pc:*:*:*)
104940dd5a57Smrg	# Left here for compatibility:
105040dd5a57Smrg        # uname -m prints for DJGPP always 'pc', but it prints nothing about
105140dd5a57Smrg        # the processor, so we play safe by assuming i586.
105240dd5a57Smrg	# Note: whatever this is, it MUST be the same as what config.sub
105340dd5a57Smrg	# prints for the "djgpp" host, or else GDB configury will decide that
105440dd5a57Smrg	# this is a cross-build.
105540dd5a57Smrg	echo i586-pc-msdosdjgpp
105640dd5a57Smrg        exit ;;
105740dd5a57Smrg    Intel:Mach:3*:*)
105840dd5a57Smrg	echo i386-pc-mach3
105940dd5a57Smrg	exit ;;
106040dd5a57Smrg    paragon:*:*:*)
106140dd5a57Smrg	echo i860-intel-osf1
106240dd5a57Smrg	exit ;;
106340dd5a57Smrg    i860:*:4.*:*) # i860-SVR4
106440dd5a57Smrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
106540dd5a57Smrg	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
106640dd5a57Smrg	else # Add other i860-SVR4 vendors below as they are discovered.
106740dd5a57Smrg	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
106840dd5a57Smrg	fi
106940dd5a57Smrg	exit ;;
107040dd5a57Smrg    mini*:CTIX:SYS*5:*)
107140dd5a57Smrg	# "miniframe"
107240dd5a57Smrg	echo m68010-convergent-sysv
107340dd5a57Smrg	exit ;;
107440dd5a57Smrg    mc68k:UNIX:SYSTEM5:3.51m)
107540dd5a57Smrg	echo m68k-convergent-sysv
107640dd5a57Smrg	exit ;;
107740dd5a57Smrg    M680?0:D-NIX:5.3:*)
107840dd5a57Smrg	echo m68k-diab-dnix
107940dd5a57Smrg	exit ;;
108040dd5a57Smrg    M68*:*:R3V[5678]*:*)
108140dd5a57Smrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
108240dd5a57Smrg    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)
108340dd5a57Smrg	OS_REL=''
108440dd5a57Smrg	test -r /etc/.relid \
108540dd5a57Smrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
108640dd5a57Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
108740dd5a57Smrg	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
108840dd5a57Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
108940dd5a57Smrg	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
109040dd5a57Smrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
109140dd5a57Smrg        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
109240dd5a57Smrg          && { echo i486-ncr-sysv4; exit; } ;;
109340dd5a57Smrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
109440dd5a57Smrg	OS_REL='.3'
109540dd5a57Smrg	test -r /etc/.relid \
109640dd5a57Smrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
109740dd5a57Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
109840dd5a57Smrg	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
109940dd5a57Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
110040dd5a57Smrg	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
110140dd5a57Smrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
110240dd5a57Smrg	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
110340dd5a57Smrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
110440dd5a57Smrg	echo m68k-unknown-lynxos${UNAME_RELEASE}
110540dd5a57Smrg	exit ;;
110640dd5a57Smrg    mc68030:UNIX_System_V:4.*:*)
110740dd5a57Smrg	echo m68k-atari-sysv4
110840dd5a57Smrg	exit ;;
110940dd5a57Smrg    TSUNAMI:LynxOS:2.*:*)
111040dd5a57Smrg	echo sparc-unknown-lynxos${UNAME_RELEASE}
111140dd5a57Smrg	exit ;;
111240dd5a57Smrg    rs6000:LynxOS:2.*:*)
111340dd5a57Smrg	echo rs6000-unknown-lynxos${UNAME_RELEASE}
111440dd5a57Smrg	exit ;;
111540dd5a57Smrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
111640dd5a57Smrg	echo powerpc-unknown-lynxos${UNAME_RELEASE}
111740dd5a57Smrg	exit ;;
111840dd5a57Smrg    SM[BE]S:UNIX_SV:*:*)
111940dd5a57Smrg	echo mips-dde-sysv${UNAME_RELEASE}
112040dd5a57Smrg	exit ;;
112140dd5a57Smrg    RM*:ReliantUNIX-*:*:*)
112240dd5a57Smrg	echo mips-sni-sysv4
112340dd5a57Smrg	exit ;;
112440dd5a57Smrg    RM*:SINIX-*:*:*)
112540dd5a57Smrg	echo mips-sni-sysv4
112640dd5a57Smrg	exit ;;
112740dd5a57Smrg    *:SINIX-*:*:*)
112840dd5a57Smrg	if uname -p 2>/dev/null >/dev/null ; then
112940dd5a57Smrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
113040dd5a57Smrg		echo ${UNAME_MACHINE}-sni-sysv4
113140dd5a57Smrg	else
113240dd5a57Smrg		echo ns32k-sni-sysv
113340dd5a57Smrg	fi
113440dd5a57Smrg	exit ;;
113540dd5a57Smrg    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
113640dd5a57Smrg                      # says <Richard.M.Bartel@ccMail.Census.GOV>
113740dd5a57Smrg        echo i586-unisys-sysv4
113840dd5a57Smrg        exit ;;
113940dd5a57Smrg    *:UNIX_System_V:4*:FTX*)
114040dd5a57Smrg	# From Gerald Hewes <hewes@openmarket.com>.
114140dd5a57Smrg	# How about differentiating between stratus architectures? -djm
114240dd5a57Smrg	echo hppa1.1-stratus-sysv4
114340dd5a57Smrg	exit ;;
114440dd5a57Smrg    *:*:*:FTX*)
114540dd5a57Smrg	# From seanf@swdc.stratus.com.
114640dd5a57Smrg	echo i860-stratus-sysv4
114740dd5a57Smrg	exit ;;
114840dd5a57Smrg    i*86:VOS:*:*)
114940dd5a57Smrg	# From Paul.Green@stratus.com.
115040dd5a57Smrg	echo ${UNAME_MACHINE}-stratus-vos
115140dd5a57Smrg	exit ;;
115240dd5a57Smrg    *:VOS:*:*)
115340dd5a57Smrg	# From Paul.Green@stratus.com.
115440dd5a57Smrg	echo hppa1.1-stratus-vos
115540dd5a57Smrg	exit ;;
115640dd5a57Smrg    mc68*:A/UX:*:*)
115740dd5a57Smrg	echo m68k-apple-aux${UNAME_RELEASE}
115840dd5a57Smrg	exit ;;
115940dd5a57Smrg    news*:NEWS-OS:6*:*)
116040dd5a57Smrg	echo mips-sony-newsos6
116140dd5a57Smrg	exit ;;
116240dd5a57Smrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
116340dd5a57Smrg	if [ -d /usr/nec ]; then
116440dd5a57Smrg	        echo mips-nec-sysv${UNAME_RELEASE}
116540dd5a57Smrg	else
116640dd5a57Smrg	        echo mips-unknown-sysv${UNAME_RELEASE}
116740dd5a57Smrg	fi
116840dd5a57Smrg        exit ;;
116940dd5a57Smrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
117040dd5a57Smrg	echo powerpc-be-beos
117140dd5a57Smrg	exit ;;
117240dd5a57Smrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
117340dd5a57Smrg	echo powerpc-apple-beos
117440dd5a57Smrg	exit ;;
117540dd5a57Smrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
117640dd5a57Smrg	echo i586-pc-beos
117740dd5a57Smrg	exit ;;
117840dd5a57Smrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
117940dd5a57Smrg	echo i586-pc-haiku
118040dd5a57Smrg	exit ;;
118140dd5a57Smrg    SX-4:SUPER-UX:*:*)
118240dd5a57Smrg	echo sx4-nec-superux${UNAME_RELEASE}
118340dd5a57Smrg	exit ;;
118440dd5a57Smrg    SX-5:SUPER-UX:*:*)
118540dd5a57Smrg	echo sx5-nec-superux${UNAME_RELEASE}
118640dd5a57Smrg	exit ;;
118740dd5a57Smrg    SX-6:SUPER-UX:*:*)
118840dd5a57Smrg	echo sx6-nec-superux${UNAME_RELEASE}
118940dd5a57Smrg	exit ;;
119040dd5a57Smrg    SX-7:SUPER-UX:*:*)
119140dd5a57Smrg	echo sx7-nec-superux${UNAME_RELEASE}
119240dd5a57Smrg	exit ;;
119340dd5a57Smrg    SX-8:SUPER-UX:*:*)
119440dd5a57Smrg	echo sx8-nec-superux${UNAME_RELEASE}
119540dd5a57Smrg	exit ;;
119640dd5a57Smrg    SX-8R:SUPER-UX:*:*)
119740dd5a57Smrg	echo sx8r-nec-superux${UNAME_RELEASE}
119840dd5a57Smrg	exit ;;
119940dd5a57Smrg    Power*:Rhapsody:*:*)
120040dd5a57Smrg	echo powerpc-apple-rhapsody${UNAME_RELEASE}
120140dd5a57Smrg	exit ;;
120240dd5a57Smrg    *:Rhapsody:*:*)
120340dd5a57Smrg	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
120440dd5a57Smrg	exit ;;
120540dd5a57Smrg    *:Darwin:*:*)
120640dd5a57Smrg	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
120740dd5a57Smrg	case $UNAME_PROCESSOR in
120840dd5a57Smrg	    i386)
120940dd5a57Smrg		eval $set_cc_for_build
121040dd5a57Smrg		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
121140dd5a57Smrg		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
121240dd5a57Smrg		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
121340dd5a57Smrg		      grep IS_64BIT_ARCH >/dev/null
121440dd5a57Smrg		  then
121540dd5a57Smrg		      UNAME_PROCESSOR="x86_64"
121640dd5a57Smrg		  fi
121740dd5a57Smrg		fi ;;
121840dd5a57Smrg	    unknown) UNAME_PROCESSOR=powerpc ;;
121940dd5a57Smrg	esac
122040dd5a57Smrg	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
122140dd5a57Smrg	exit ;;
122240dd5a57Smrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
122340dd5a57Smrg	UNAME_PROCESSOR=`uname -p`
122440dd5a57Smrg	if test "$UNAME_PROCESSOR" = "x86"; then
122540dd5a57Smrg		UNAME_PROCESSOR=i386
122640dd5a57Smrg		UNAME_MACHINE=pc
122740dd5a57Smrg	fi
122840dd5a57Smrg	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
122940dd5a57Smrg	exit ;;
123040dd5a57Smrg    *:QNX:*:4*)
123140dd5a57Smrg	echo i386-pc-qnx
123240dd5a57Smrg	exit ;;
123340dd5a57Smrg    NSE-?:NONSTOP_KERNEL:*:*)
123440dd5a57Smrg	echo nse-tandem-nsk${UNAME_RELEASE}
123540dd5a57Smrg	exit ;;
123640dd5a57Smrg    NSR-?:NONSTOP_KERNEL:*:*)
123740dd5a57Smrg	echo nsr-tandem-nsk${UNAME_RELEASE}
123840dd5a57Smrg	exit ;;
123940dd5a57Smrg    *:NonStop-UX:*:*)
124040dd5a57Smrg	echo mips-compaq-nonstopux
124140dd5a57Smrg	exit ;;
124240dd5a57Smrg    BS2000:POSIX*:*:*)
124340dd5a57Smrg	echo bs2000-siemens-sysv
124440dd5a57Smrg	exit ;;
124540dd5a57Smrg    DS/*:UNIX_System_V:*:*)
124640dd5a57Smrg	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
124740dd5a57Smrg	exit ;;
124840dd5a57Smrg    *:Plan9:*:*)
124940dd5a57Smrg	# "uname -m" is not consistent, so use $cputype instead. 386
125040dd5a57Smrg	# is converted to i386 for consistency with other x86
125140dd5a57Smrg	# operating systems.
125240dd5a57Smrg	if test "$cputype" = "386"; then
125340dd5a57Smrg	    UNAME_MACHINE=i386
125440dd5a57Smrg	else
125540dd5a57Smrg	    UNAME_MACHINE="$cputype"
125640dd5a57Smrg	fi
125740dd5a57Smrg	echo ${UNAME_MACHINE}-unknown-plan9
125840dd5a57Smrg	exit ;;
125940dd5a57Smrg    *:TOPS-10:*:*)
126040dd5a57Smrg	echo pdp10-unknown-tops10
126140dd5a57Smrg	exit ;;
126240dd5a57Smrg    *:TENEX:*:*)
126340dd5a57Smrg	echo pdp10-unknown-tenex
126440dd5a57Smrg	exit ;;
126540dd5a57Smrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
126640dd5a57Smrg	echo pdp10-dec-tops20
126740dd5a57Smrg	exit ;;
126840dd5a57Smrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
126940dd5a57Smrg	echo pdp10-xkl-tops20
127040dd5a57Smrg	exit ;;
127140dd5a57Smrg    *:TOPS-20:*:*)
127240dd5a57Smrg	echo pdp10-unknown-tops20
127340dd5a57Smrg	exit ;;
127440dd5a57Smrg    *:ITS:*:*)
127540dd5a57Smrg	echo pdp10-unknown-its
127640dd5a57Smrg	exit ;;
127740dd5a57Smrg    SEI:*:*:SEIUX)
127840dd5a57Smrg        echo mips-sei-seiux${UNAME_RELEASE}
127940dd5a57Smrg	exit ;;
128040dd5a57Smrg    *:DragonFly:*:*)
128140dd5a57Smrg	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
128240dd5a57Smrg	exit ;;
128340dd5a57Smrg    *:*VMS:*:*)
128440dd5a57Smrg    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
128540dd5a57Smrg	case "${UNAME_MACHINE}" in
128640dd5a57Smrg	    A*) echo alpha-dec-vms ; exit ;;
128740dd5a57Smrg	    I*) echo ia64-dec-vms ; exit ;;
128840dd5a57Smrg	    V*) echo vax-dec-vms ; exit ;;
128940dd5a57Smrg	esac ;;
129040dd5a57Smrg    *:XENIX:*:SysV)
129140dd5a57Smrg	echo i386-pc-xenix
129240dd5a57Smrg	exit ;;
129340dd5a57Smrg    i*86:skyos:*:*)
129440dd5a57Smrg	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
129540dd5a57Smrg	exit ;;
129640dd5a57Smrg    i*86:rdos:*:*)
129740dd5a57Smrg	echo ${UNAME_MACHINE}-pc-rdos
129840dd5a57Smrg	exit ;;
129940dd5a57Smrg    i*86:AROS:*:*)
130040dd5a57Smrg	echo ${UNAME_MACHINE}-pc-aros
130140dd5a57Smrg	exit ;;
130240dd5a57Smrgesac
130340dd5a57Smrg
130440dd5a57Smrg#echo '(No uname command or uname output not recognized.)' 1>&2
130540dd5a57Smrg#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
130640dd5a57Smrg
130740dd5a57Smrgeval $set_cc_for_build
130840dd5a57Smrgcat >$dummy.c <<EOF
130940dd5a57Smrg#ifdef _SEQUENT_
131040dd5a57Smrg# include <sys/types.h>
131140dd5a57Smrg# include <sys/utsname.h>
131240dd5a57Smrg#endif
131340dd5a57Smrgmain ()
131440dd5a57Smrg{
131540dd5a57Smrg#if defined (sony)
131640dd5a57Smrg#if defined (MIPSEB)
131740dd5a57Smrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
131840dd5a57Smrg     I don't know....  */
131940dd5a57Smrg  printf ("mips-sony-bsd\n"); exit (0);
132040dd5a57Smrg#else
132140dd5a57Smrg#include <sys/param.h>
132240dd5a57Smrg  printf ("m68k-sony-newsos%s\n",
132340dd5a57Smrg#ifdef NEWSOS4
132440dd5a57Smrg          "4"
132540dd5a57Smrg#else
132640dd5a57Smrg	  ""
132740dd5a57Smrg#endif
132840dd5a57Smrg         ); exit (0);
132940dd5a57Smrg#endif
133040dd5a57Smrg#endif
133140dd5a57Smrg
133240dd5a57Smrg#if defined (__arm) && defined (__acorn) && defined (__unix)
133340dd5a57Smrg  printf ("arm-acorn-riscix\n"); exit (0);
133440dd5a57Smrg#endif
133540dd5a57Smrg
133640dd5a57Smrg#if defined (hp300) && !defined (hpux)
133740dd5a57Smrg  printf ("m68k-hp-bsd\n"); exit (0);
133840dd5a57Smrg#endif
133940dd5a57Smrg
134040dd5a57Smrg#if defined (NeXT)
134140dd5a57Smrg#if !defined (__ARCHITECTURE__)
134240dd5a57Smrg#define __ARCHITECTURE__ "m68k"
134340dd5a57Smrg#endif
134440dd5a57Smrg  int version;
134540dd5a57Smrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
134640dd5a57Smrg  if (version < 4)
134740dd5a57Smrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
134840dd5a57Smrg  else
134940dd5a57Smrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
135040dd5a57Smrg  exit (0);
135140dd5a57Smrg#endif
135240dd5a57Smrg
135340dd5a57Smrg#if defined (MULTIMAX) || defined (n16)
135440dd5a57Smrg#if defined (UMAXV)
135540dd5a57Smrg  printf ("ns32k-encore-sysv\n"); exit (0);
135640dd5a57Smrg#else
135740dd5a57Smrg#if defined (CMU)
135840dd5a57Smrg  printf ("ns32k-encore-mach\n"); exit (0);
135940dd5a57Smrg#else
136040dd5a57Smrg  printf ("ns32k-encore-bsd\n"); exit (0);
136140dd5a57Smrg#endif
136240dd5a57Smrg#endif
136340dd5a57Smrg#endif
136440dd5a57Smrg
136540dd5a57Smrg#if defined (__386BSD__)
136640dd5a57Smrg  printf ("i386-pc-bsd\n"); exit (0);
136740dd5a57Smrg#endif
136840dd5a57Smrg
136940dd5a57Smrg#if defined (sequent)
137040dd5a57Smrg#if defined (i386)
137140dd5a57Smrg  printf ("i386-sequent-dynix\n"); exit (0);
137240dd5a57Smrg#endif
137340dd5a57Smrg#if defined (ns32000)
137440dd5a57Smrg  printf ("ns32k-sequent-dynix\n"); exit (0);
137540dd5a57Smrg#endif
137640dd5a57Smrg#endif
137740dd5a57Smrg
137840dd5a57Smrg#if defined (_SEQUENT_)
137940dd5a57Smrg    struct utsname un;
138040dd5a57Smrg
138140dd5a57Smrg    uname(&un);
138240dd5a57Smrg
138340dd5a57Smrg    if (strncmp(un.version, "V2", 2) == 0) {
138440dd5a57Smrg	printf ("i386-sequent-ptx2\n"); exit (0);
138540dd5a57Smrg    }
138640dd5a57Smrg    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
138740dd5a57Smrg	printf ("i386-sequent-ptx1\n"); exit (0);
138840dd5a57Smrg    }
138940dd5a57Smrg    printf ("i386-sequent-ptx\n"); exit (0);
139040dd5a57Smrg
139140dd5a57Smrg#endif
139240dd5a57Smrg
139340dd5a57Smrg#if defined (vax)
139440dd5a57Smrg# if !defined (ultrix)
139540dd5a57Smrg#  include <sys/param.h>
139640dd5a57Smrg#  if defined (BSD)
139740dd5a57Smrg#   if BSD == 43
139840dd5a57Smrg      printf ("vax-dec-bsd4.3\n"); exit (0);
139940dd5a57Smrg#   else
140040dd5a57Smrg#    if BSD == 199006
140140dd5a57Smrg      printf ("vax-dec-bsd4.3reno\n"); exit (0);
140240dd5a57Smrg#    else
140340dd5a57Smrg      printf ("vax-dec-bsd\n"); exit (0);
140440dd5a57Smrg#    endif
140540dd5a57Smrg#   endif
140640dd5a57Smrg#  else
140740dd5a57Smrg    printf ("vax-dec-bsd\n"); exit (0);
140840dd5a57Smrg#  endif
140940dd5a57Smrg# else
141040dd5a57Smrg    printf ("vax-dec-ultrix\n"); exit (0);
141140dd5a57Smrg# endif
141240dd5a57Smrg#endif
141340dd5a57Smrg
141440dd5a57Smrg#if defined (alliant) && defined (i860)
141540dd5a57Smrg  printf ("i860-alliant-bsd\n"); exit (0);
141640dd5a57Smrg#endif
141740dd5a57Smrg
141840dd5a57Smrg  exit (1);
141940dd5a57Smrg}
142040dd5a57SmrgEOF
142140dd5a57Smrg
142240dd5a57Smrg$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
142340dd5a57Smrg	{ echo "$SYSTEM_NAME"; exit; }
142440dd5a57Smrg
142540dd5a57Smrg# Apollos put the system type in the environment.
142640dd5a57Smrg
142740dd5a57Smrgtest -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
142840dd5a57Smrg
142940dd5a57Smrg# Convex versions that predate uname can use getsysinfo(1)
143040dd5a57Smrg
143140dd5a57Smrgif [ -x /usr/convex/getsysinfo ]
143240dd5a57Smrgthen
143340dd5a57Smrg    case `getsysinfo -f cpu_type` in
143440dd5a57Smrg    c1*)
143540dd5a57Smrg	echo c1-convex-bsd
143640dd5a57Smrg	exit ;;
143740dd5a57Smrg    c2*)
143840dd5a57Smrg	if getsysinfo -f scalar_acc
143940dd5a57Smrg	then echo c32-convex-bsd
144040dd5a57Smrg	else echo c2-convex-bsd
144140dd5a57Smrg	fi
144240dd5a57Smrg	exit ;;
144340dd5a57Smrg    c34*)
144440dd5a57Smrg	echo c34-convex-bsd
144540dd5a57Smrg	exit ;;
144640dd5a57Smrg    c38*)
144740dd5a57Smrg	echo c38-convex-bsd
144840dd5a57Smrg	exit ;;
144940dd5a57Smrg    c4*)
145040dd5a57Smrg	echo c4-convex-bsd
145140dd5a57Smrg	exit ;;
145240dd5a57Smrg    esac
145340dd5a57Smrgfi
145440dd5a57Smrg
145540dd5a57Smrgcat >&2 <<EOF
145640dd5a57Smrg$0: unable to guess system type
145740dd5a57Smrg
145840dd5a57SmrgThis script, last modified $timestamp, has failed to recognize
145940dd5a57Smrgthe operating system you are using. It is advised that you
146040dd5a57Smrgdownload the most up to date version of the config scripts from
146140dd5a57Smrg
146240dd5a57Smrg  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
146340dd5a57Smrgand
146440dd5a57Smrg  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
146540dd5a57Smrg
146640dd5a57SmrgIf the version you run ($0) is already up to date, please
146740dd5a57Smrgsend the following data and any information you think might be
146840dd5a57Smrgpertinent to <config-patches@gnu.org> in order to provide the needed
146940dd5a57Smrginformation to handle your system.
147040dd5a57Smrg
147140dd5a57Smrgconfig.guess timestamp = $timestamp
147240dd5a57Smrg
147340dd5a57Smrguname -m = `(uname -m) 2>/dev/null || echo unknown`
147440dd5a57Smrguname -r = `(uname -r) 2>/dev/null || echo unknown`
147540dd5a57Smrguname -s = `(uname -s) 2>/dev/null || echo unknown`
147640dd5a57Smrguname -v = `(uname -v) 2>/dev/null || echo unknown`
147740dd5a57Smrg
147840dd5a57Smrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
147940dd5a57Smrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
148040dd5a57Smrg
148140dd5a57Smrghostinfo               = `(hostinfo) 2>/dev/null`
148240dd5a57Smrg/bin/universe          = `(/bin/universe) 2>/dev/null`
148340dd5a57Smrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
148440dd5a57Smrg/bin/arch              = `(/bin/arch) 2>/dev/null`
148540dd5a57Smrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
148640dd5a57Smrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
148740dd5a57Smrg
148840dd5a57SmrgUNAME_MACHINE = ${UNAME_MACHINE}
148940dd5a57SmrgUNAME_RELEASE = ${UNAME_RELEASE}
149040dd5a57SmrgUNAME_SYSTEM  = ${UNAME_SYSTEM}
149140dd5a57SmrgUNAME_VERSION = ${UNAME_VERSION}
149240dd5a57SmrgEOF
149340dd5a57Smrg
149440dd5a57Smrgexit 1
149540dd5a57Smrg
149640dd5a57Smrg# Local variables:
149740dd5a57Smrg# eval: (add-hook 'write-file-hooks 'time-stamp)
149840dd5a57Smrg# time-stamp-start: "timestamp='"
149940dd5a57Smrg# time-stamp-format: "%:y-%02m-%02d"
150040dd5a57Smrg# time-stamp-end: "'"
150140dd5a57Smrg# End:
1502