config.guess revision 142403
155682Smarkm#! /bin/sh
255682Smarkm# Attempt to guess a canonical system name.
3102644Snectar#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4127808Snectar#   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
572445Sassar
6142403Snectartimestamp='2004-03-03'
772445Sassar
855682Smarkm# This file is free software; you can redistribute it and/or modify it
955682Smarkm# under the terms of the GNU General Public License as published by
1055682Smarkm# the Free Software Foundation; either version 2 of the License, or
1155682Smarkm# (at your option) any later version.
1255682Smarkm#
1355682Smarkm# This program is distributed in the hope that it will be useful, but
1455682Smarkm# WITHOUT ANY WARRANTY; without even the implied warranty of
1555682Smarkm# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1655682Smarkm# General Public License for more details.
1755682Smarkm#
1855682Smarkm# You should have received a copy of the GNU General Public License
1955682Smarkm# along with this program; if not, write to the Free Software
2055682Smarkm# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2155682Smarkm#
2255682Smarkm# As a special exception to the GNU General Public License, if you
2355682Smarkm# distribute this file as part of a program that contains a
2455682Smarkm# configuration script generated by Autoconf, you may include it under
2555682Smarkm# the same distribution terms that you use for the rest of that program.
2655682Smarkm
27102644Snectar# Originally written by Per Bothner <per@bothner.com>.
28102644Snectar# Please send patches to <config-patches@gnu.org>.  Submit a context
29102644Snectar# diff and a properly formatted ChangeLog entry.
3055682Smarkm#
3155682Smarkm# This script attempts to guess a canonical system name similar to
3255682Smarkm# config.sub.  If it succeeds, it prints the system name on stdout, and
3355682Smarkm# exits with 0.  Otherwise, it exits with 1.
3455682Smarkm#
3555682Smarkm# The plan is that this can be called by configure scripts if you
3690926Snectar# don't specify an explicit build system type.
3755682Smarkm
3872445Sassarme=`echo "$0" | sed -e 's,.*/,,'`
3972445Sassar
4072445Sassarusage="\
4172445SassarUsage: $0 [OPTION]
4272445Sassar
4390926SnectarOutput the configuration name of the system \`$me' is run on.
4472445Sassar
4572445SassarOperation modes:
4690926Snectar  -h, --help         print this help, then exit
4790926Snectar  -t, --time-stamp   print date of last modification, then exit
4890926Snectar  -v, --version      print version number, then exit
4972445Sassar
5090926SnectarReport bugs and patches to <config-patches@gnu.org>."
5190926Snectar
5290926Snectarversion="\
5390926SnectarGNU config.guess ($timestamp)
5490926Snectar
5590926SnectarOriginally written by Per Bothner.
5690926SnectarCopyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
5790926SnectarFree Software Foundation, Inc.
5890926Snectar
5990926SnectarThis is free software; see the source for copying conditions.  There is NO
6090926Snectarwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
6190926Snectar
6272445Sassarhelp="
6372445SassarTry \`$me --help' for more information."
6472445Sassar
6572445Sassar# Parse command line
6672445Sassarwhile test $# -gt 0 ; do
6790926Snectar  case $1 in
6890926Snectar    --time-stamp | --time* | -t )
6990926Snectar       echo "$timestamp" ; exit 0 ;;
7090926Snectar    --version | -v )
7172445Sassar       echo "$version" ; exit 0 ;;
7272445Sassar    --help | --h* | -h )
7372445Sassar       echo "$usage"; exit 0 ;;
7472445Sassar    -- )     # Stop option processing
7572445Sassar       shift; break ;;
7672445Sassar    - )	# Use stdin as input.
7772445Sassar       break ;;
7872445Sassar    -* )
7990926Snectar       echo "$me: invalid option $1$help" >&2
8072445Sassar       exit 1 ;;
8172445Sassar    * )
8272445Sassar       break ;;
8372445Sassar  esac
8472445Sassardone
8572445Sassar
8672445Sassarif test $# != 0; then
8772445Sassar  echo "$me: too many arguments$help" >&2
8872445Sassar  exit 1
8972445Sassarfi
9072445Sassar
91127808Snectartrap 'exit 1' 1 2 15
9272445Sassar
93127808Snectar# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
94127808Snectar# compiler to aid in system detection is discouraged as it requires
95127808Snectar# temporary files to be created and, as you can see below, it is a
96127808Snectar# headache to deal with in a portable fashion.
9772445Sassar
9890926Snectar# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
9990926Snectar# use `HOST_CC' if defined, but it is deprecated.
10090926Snectar
101127808Snectar# Portable tmp directory creation inspired by the Autoconf team.
102127808Snectar
103127808Snectarset_cc_for_build='
104127808Snectartrap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
105127808Snectartrap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
106127808Snectar: ${TMPDIR=/tmp} ;
107127808Snectar { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
108127808Snectar { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
109127808Snectar { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
110127808Snectar { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
111127808Snectardummy=$tmp/dummy ;
112127808Snectartmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
113127808Snectarcase $CC_FOR_BUILD,$HOST_CC,$CC in
114127808Snectar ,,)    echo "int x;" > $dummy.c ;
115102644Snectar	for c in cc gcc c89 c99 ; do
116127808Snectar	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
11790926Snectar	     CC_FOR_BUILD="$c"; break ;
11890926Snectar	  fi ;
11990926Snectar	done ;
12090926Snectar	if test x"$CC_FOR_BUILD" = x ; then
12190926Snectar	  CC_FOR_BUILD=no_compiler_found ;
12290926Snectar	fi
12390926Snectar	;;
12490926Snectar ,,*)   CC_FOR_BUILD=$CC ;;
12590926Snectar ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
126127808Snectaresac ;'
12790926Snectar
12855682Smarkm# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
12990926Snectar# (ghazi@noc.rutgers.edu 1994-08-24)
13055682Smarkmif (test -f /.attbin/uname) >/dev/null 2>&1 ; then
13155682Smarkm	PATH=$PATH:/.attbin ; export PATH
13255682Smarkmfi
13355682Smarkm
13455682SmarkmUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
13555682SmarkmUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
136102644SnectarUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
13755682SmarkmUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
13855682Smarkm
13955682Smarkm# Note: order is significant - the case branches are not exclusive.
14055682Smarkm
14155682Smarkmcase "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
14272445Sassar    *:NetBSD:*:*)
143102644Snectar	# NetBSD (nbsd) targets should (where applicable) match one or
14472445Sassar	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
14572445Sassar	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
14672445Sassar	# switched to ELF, *-*-netbsd* would select the old
14772445Sassar	# object file format.  This provides both forward
14872445Sassar	# compatibility and a consistent mechanism for selecting the
14972445Sassar	# object file format.
150102644Snectar	#
151102644Snectar	# Note: NetBSD doesn't particularly care about the vendor
152102644Snectar	# portion of the name.  We always set it to "unknown".
153102644Snectar	sysctl="sysctl -n hw.machine_arch"
154102644Snectar	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
155102644Snectar	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
156102644Snectar	case "${UNAME_MACHINE_ARCH}" in
157127808Snectar	    armeb) machine=armeb-unknown ;;
158102644Snectar	    arm*) machine=arm-unknown ;;
159102644Snectar	    sh3el) machine=shl-unknown ;;
160102644Snectar	    sh3eb) machine=sh-unknown ;;
161102644Snectar	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
16272445Sassar	esac
16390926Snectar	# The Operating System including object format, if it has switched
16490926Snectar	# to ELF recently, or will in the future.
165102644Snectar	case "${UNAME_MACHINE_ARCH}" in
166102644Snectar	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
16790926Snectar		eval $set_cc_for_build
16890926Snectar		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
16990926Snectar			| grep __ELF__ >/dev/null
17090926Snectar		then
17190926Snectar		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
17290926Snectar		    # Return netbsd for either.  FIX?
17390926Snectar		    os=netbsd
17490926Snectar		else
17590926Snectar		    os=netbsdelf
17690926Snectar		fi
17790926Snectar		;;
17890926Snectar	    *)
17990926Snectar	        os=netbsd
18090926Snectar		;;
18190926Snectar	esac
18272445Sassar	# The OS release
183127808Snectar	# Debian GNU/NetBSD machines have a different userland, and
184127808Snectar	# thus, need a distinct triplet. However, they do not need
185127808Snectar	# kernel version information, so it can be replaced with a
186127808Snectar	# suitable tag, in the style of linux-gnu.
187127808Snectar	case "${UNAME_VERSION}" in
188127808Snectar	    Debian*)
189127808Snectar		release='-gnu'
190127808Snectar		;;
191127808Snectar	    *)
192127808Snectar		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
193127808Snectar		;;
194127808Snectar	esac
19572445Sassar	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
19672445Sassar	# contains redundant information, the shorter form:
19772445Sassar	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
19872445Sassar	echo "${machine}-${os}${release}"
19972445Sassar	exit 0 ;;
200142403Snectar    amd64:OpenBSD:*:*)
201142403Snectar	echo x86_64-unknown-openbsd${UNAME_RELEASE}
202142403Snectar	exit 0 ;;
203102644Snectar    amiga:OpenBSD:*:*)
204102644Snectar	echo m68k-unknown-openbsd${UNAME_RELEASE}
205102644Snectar	exit 0 ;;
206102644Snectar    arc:OpenBSD:*:*)
207102644Snectar	echo mipsel-unknown-openbsd${UNAME_RELEASE}
208102644Snectar	exit 0 ;;
209142403Snectar    cats:OpenBSD:*:*)
210142403Snectar	echo arm-unknown-openbsd${UNAME_RELEASE}
211142403Snectar	exit 0 ;;
212102644Snectar    hp300:OpenBSD:*:*)
213102644Snectar	echo m68k-unknown-openbsd${UNAME_RELEASE}
214102644Snectar	exit 0 ;;
215102644Snectar    mac68k:OpenBSD:*:*)
216102644Snectar	echo m68k-unknown-openbsd${UNAME_RELEASE}
217102644Snectar	exit 0 ;;
218102644Snectar    macppc:OpenBSD:*:*)
219102644Snectar	echo powerpc-unknown-openbsd${UNAME_RELEASE}
220102644Snectar	exit 0 ;;
221102644Snectar    mvme68k:OpenBSD:*:*)
222102644Snectar	echo m68k-unknown-openbsd${UNAME_RELEASE}
223102644Snectar	exit 0 ;;
224102644Snectar    mvme88k:OpenBSD:*:*)
225102644Snectar	echo m88k-unknown-openbsd${UNAME_RELEASE}
226102644Snectar	exit 0 ;;
227102644Snectar    mvmeppc:OpenBSD:*:*)
228102644Snectar	echo powerpc-unknown-openbsd${UNAME_RELEASE}
229102644Snectar	exit 0 ;;
230142403Snectar    pegasos:OpenBSD:*:*)
231142403Snectar	echo powerpc-unknown-openbsd${UNAME_RELEASE}
232142403Snectar	exit 0 ;;
233102644Snectar    pmax:OpenBSD:*:*)
234102644Snectar	echo mipsel-unknown-openbsd${UNAME_RELEASE}
235102644Snectar	exit 0 ;;
236102644Snectar    sgi:OpenBSD:*:*)
237102644Snectar	echo mipseb-unknown-openbsd${UNAME_RELEASE}
238102644Snectar	exit 0 ;;
239102644Snectar    sun3:OpenBSD:*:*)
240102644Snectar	echo m68k-unknown-openbsd${UNAME_RELEASE}
241102644Snectar	exit 0 ;;
242102644Snectar    wgrisc:OpenBSD:*:*)
243102644Snectar	echo mipsel-unknown-openbsd${UNAME_RELEASE}
244102644Snectar	exit 0 ;;
245102644Snectar    *:OpenBSD:*:*)
246102644Snectar	echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
247102644Snectar	exit 0 ;;
248142403Snectar    *:ekkoBSD:*:*)
249142403Snectar	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
250142403Snectar	exit 0 ;;
251142403Snectar    macppc:MirBSD:*:*)
252142403Snectar	echo powerppc-unknown-mirbsd${UNAME_RELEASE}
253142403Snectar	exit 0 ;;
254142403Snectar    *:MirBSD:*:*)
255142403Snectar	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
256142403Snectar	exit 0 ;;
25755682Smarkm    alpha:OSF1:*:*)
258142403Snectar	case $UNAME_RELEASE in
259142403Snectar	*4.0)
26055682Smarkm		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
261142403Snectar		;;
262142403Snectar	*5.*)
263142403Snectar	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
264142403Snectar		;;
265142403Snectar	esac
266127808Snectar	# According to Compaq, /usr/sbin/psrinfo has been available on
267127808Snectar	# OSF/1 and Tru64 systems produced since 1995.  I hope that
268127808Snectar	# covers most systems running today.  This code pipes the CPU
269127808Snectar	# types through head -n 1, so we only detect the type of CPU 0.
270127808Snectar	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
271127808Snectar	case "$ALPHA_CPU_TYPE" in
272127808Snectar	    "EV4 (21064)")
273127808Snectar		UNAME_MACHINE="alpha" ;;
274127808Snectar	    "EV4.5 (21064)")
275127808Snectar		UNAME_MACHINE="alpha" ;;
276127808Snectar	    "LCA4 (21066/21068)")
277127808Snectar		UNAME_MACHINE="alpha" ;;
278127808Snectar	    "EV5 (21164)")
279127808Snectar		UNAME_MACHINE="alphaev5" ;;
280127808Snectar	    "EV5.6 (21164A)")
281127808Snectar		UNAME_MACHINE="alphaev56" ;;
282127808Snectar	    "EV5.6 (21164PC)")
283127808Snectar		UNAME_MACHINE="alphapca56" ;;
284127808Snectar	    "EV5.7 (21164PC)")
285127808Snectar		UNAME_MACHINE="alphapca57" ;;
286127808Snectar	    "EV6 (21264)")
287127808Snectar		UNAME_MACHINE="alphaev6" ;;
288127808Snectar	    "EV6.7 (21264A)")
289127808Snectar		UNAME_MACHINE="alphaev67" ;;
290127808Snectar	    "EV6.8CB (21264C)")
291127808Snectar		UNAME_MACHINE="alphaev68" ;;
292127808Snectar	    "EV6.8AL (21264B)")
293127808Snectar		UNAME_MACHINE="alphaev68" ;;
294127808Snectar	    "EV6.8CX (21264D)")
295127808Snectar		UNAME_MACHINE="alphaev68" ;;
296127808Snectar	    "EV6.9A (21264/EV69A)")
297127808Snectar		UNAME_MACHINE="alphaev69" ;;
298127808Snectar	    "EV7 (21364)")
299127808Snectar		UNAME_MACHINE="alphaev7" ;;
300127808Snectar	    "EV7.9 (21364A)")
301127808Snectar		UNAME_MACHINE="alphaev79" ;;
302127808Snectar	esac
303142403Snectar	# A Pn.n version is a patched version.
30455682Smarkm	# A Vn.n version is a released version.
30555682Smarkm	# A Tn.n version is a released field test version.
30655682Smarkm	# A Xn.n version is an unreleased experimental baselevel.
30755682Smarkm	# 1.2 uses "1.2" for uname -r.
308142403Snectar	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
30955682Smarkm	exit 0 ;;
310127808Snectar    Alpha*:OpenVMS:*:*)
311127808Snectar	echo alpha-hp-vms
312127808Snectar	exit 0 ;;
31372445Sassar    Alpha\ *:Windows_NT*:*)
31472445Sassar	# How do we know it's Interix rather than the generic POSIX subsystem?
31572445Sassar	# Should we change UNAME_MACHINE based on the output of uname instead
31672445Sassar	# of the specific Alpha model?
31772445Sassar	echo alpha-pc-interix
31872445Sassar	exit 0 ;;
31955682Smarkm    21064:Windows_NT:50:3)
32055682Smarkm	echo alpha-dec-winnt3.5
32155682Smarkm	exit 0 ;;
32255682Smarkm    Amiga*:UNIX_System_V:4.0:*)
32372445Sassar	echo m68k-unknown-sysv4
32455682Smarkm	exit 0;;
32555682Smarkm    *:[Aa]miga[Oo][Ss]:*:*)
32655682Smarkm	echo ${UNAME_MACHINE}-unknown-amigaos
32755682Smarkm	exit 0 ;;
328102644Snectar    *:[Mm]orph[Oo][Ss]:*:*)
329102644Snectar	echo ${UNAME_MACHINE}-unknown-morphos
33055682Smarkm	exit 0 ;;
33172445Sassar    *:OS/390:*:*)
33272445Sassar	echo i370-ibm-openedition
33372445Sassar	exit 0 ;;
334142403Snectar    *:OS400:*:*)
335142403Snectar        echo powerpc-ibm-os400
336142403Snectar	exit 0 ;;
33755682Smarkm    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
33855682Smarkm	echo arm-acorn-riscix${UNAME_RELEASE}
33955682Smarkm	exit 0;;
34090926Snectar    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
34155682Smarkm	echo hppa1.1-hitachi-hiuxmpp
34255682Smarkm	exit 0;;
34372445Sassar    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
34455682Smarkm	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
34555682Smarkm	if test "`(/bin/universe) 2>/dev/null`" = att ; then
34655682Smarkm		echo pyramid-pyramid-sysv3
34755682Smarkm	else
34855682Smarkm		echo pyramid-pyramid-bsd
34955682Smarkm	fi
35055682Smarkm	exit 0 ;;
35172445Sassar    NILE*:*:*:dcosx)
35255682Smarkm	echo pyramid-pyramid-svr4
35355682Smarkm	exit 0 ;;
354127808Snectar    DRS?6000:unix:4.0:6*)
355127808Snectar	echo sparc-icl-nx6
356127808Snectar	exit 0 ;;
357127808Snectar    DRS?6000:UNIX_SV:4.2*:7*)
358127808Snectar	case `/usr/bin/uname -p` in
359127808Snectar	    sparc) echo sparc-icl-nx7 && exit 0 ;;
360127808Snectar	esac ;;
36155682Smarkm    sun4H:SunOS:5.*:*)
36255682Smarkm	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
36355682Smarkm	exit 0 ;;
36455682Smarkm    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
36555682Smarkm	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
36655682Smarkm	exit 0 ;;
36755682Smarkm    i86pc:SunOS:5.*:*)
36855682Smarkm	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
36955682Smarkm	exit 0 ;;
37055682Smarkm    sun4*:SunOS:6*:*)
37155682Smarkm	# According to config.sub, this is the proper way to canonicalize
37255682Smarkm	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
37355682Smarkm	# it's likely to be more like Solaris than SunOS4.
37455682Smarkm	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
37555682Smarkm	exit 0 ;;
37655682Smarkm    sun4*:SunOS:*:*)
37755682Smarkm	case "`/usr/bin/arch -k`" in
37855682Smarkm	    Series*|S4*)
37955682Smarkm		UNAME_RELEASE=`uname -v`
38055682Smarkm		;;
38155682Smarkm	esac
38255682Smarkm	# Japanese Language versions have a version number like `4.1.3-JL'.
38355682Smarkm	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
38455682Smarkm	exit 0 ;;
38555682Smarkm    sun3*:SunOS:*:*)
38655682Smarkm	echo m68k-sun-sunos${UNAME_RELEASE}
38755682Smarkm	exit 0 ;;
38855682Smarkm    sun*:*:4.2BSD:*)
389102644Snectar	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
39055682Smarkm	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
39155682Smarkm	case "`/bin/arch`" in
39255682Smarkm	    sun3)
39355682Smarkm		echo m68k-sun-sunos${UNAME_RELEASE}
39455682Smarkm		;;
39555682Smarkm	    sun4)
39655682Smarkm		echo sparc-sun-sunos${UNAME_RELEASE}
39755682Smarkm		;;
39855682Smarkm	esac
39955682Smarkm	exit 0 ;;
40055682Smarkm    aushp:SunOS:*:*)
40155682Smarkm	echo sparc-auspex-sunos${UNAME_RELEASE}
40255682Smarkm	exit 0 ;;
40372445Sassar    # The situation for MiNT is a little confusing.  The machine name
40472445Sassar    # can be virtually everything (everything which is not
405102644Snectar    # "atarist" or "atariste" at least should have a processor
40672445Sassar    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
40772445Sassar    # to the lowercase version "mint" (or "freemint").  Finally
40872445Sassar    # the system name "TOS" denotes a system which is actually not
40972445Sassar    # MiNT.  But MiNT is downward compatible to TOS, so this should
41072445Sassar    # be no problem.
41172445Sassar    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
41272445Sassar        echo m68k-atari-mint${UNAME_RELEASE}
41355682Smarkm	exit 0 ;;
41472445Sassar    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
41572445Sassar	echo m68k-atari-mint${UNAME_RELEASE}
41672445Sassar        exit 0 ;;
41772445Sassar    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
41872445Sassar        echo m68k-atari-mint${UNAME_RELEASE}
41972445Sassar	exit 0 ;;
42072445Sassar    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
42172445Sassar        echo m68k-milan-mint${UNAME_RELEASE}
42272445Sassar        exit 0 ;;
42372445Sassar    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
42472445Sassar        echo m68k-hades-mint${UNAME_RELEASE}
42572445Sassar        exit 0 ;;
42672445Sassar    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
42772445Sassar        echo m68k-unknown-mint${UNAME_RELEASE}
42872445Sassar        exit 0 ;;
429142403Snectar    m68k:machten:*:*)
430142403Snectar	echo m68k-apple-machten${UNAME_RELEASE}
431142403Snectar	exit 0 ;;
43255682Smarkm    powerpc:machten:*:*)
43355682Smarkm	echo powerpc-apple-machten${UNAME_RELEASE}
43455682Smarkm	exit 0 ;;
43555682Smarkm    RISC*:Mach:*:*)
43655682Smarkm	echo mips-dec-mach_bsd4.3
43755682Smarkm	exit 0 ;;
43855682Smarkm    RISC*:ULTRIX:*:*)
43955682Smarkm	echo mips-dec-ultrix${UNAME_RELEASE}
44055682Smarkm	exit 0 ;;
44155682Smarkm    VAX*:ULTRIX*:*:*)
44255682Smarkm	echo vax-dec-ultrix${UNAME_RELEASE}
44355682Smarkm	exit 0 ;;
44472445Sassar    2020:CLIX:*:* | 2430:CLIX:*:*)
44555682Smarkm	echo clipper-intergraph-clix${UNAME_RELEASE}
44655682Smarkm	exit 0 ;;
44755682Smarkm    mips:*:*:UMIPS | mips:*:*:RISCos)
44890926Snectar	eval $set_cc_for_build
44955682Smarkm	sed 's/^	//' << EOF >$dummy.c
45072445Sassar#ifdef __cplusplus
45172445Sassar#include <stdio.h>  /* for printf() prototype */
45272445Sassar	int main (int argc, char *argv[]) {
45372445Sassar#else
45472445Sassar	int main (argc, argv) int argc; char *argv[]; {
45572445Sassar#endif
45655682Smarkm	#if defined (host_mips) && defined (MIPSEB)
45755682Smarkm	#if defined (SYSTYPE_SYSV)
45855682Smarkm	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
45955682Smarkm	#endif
46055682Smarkm	#if defined (SYSTYPE_SVR4)
46155682Smarkm	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
46255682Smarkm	#endif
46355682Smarkm	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
46455682Smarkm	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
46555682Smarkm	#endif
46655682Smarkm	#endif
46755682Smarkm	  exit (-1);
46855682Smarkm	}
46955682SmarkmEOF
470127808Snectar	$CC_FOR_BUILD -o $dummy $dummy.c \
471127808Snectar	  && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
472127808Snectar	  && exit 0
47355682Smarkm	echo mips-mips-riscos${UNAME_RELEASE}
47455682Smarkm	exit 0 ;;
47590926Snectar    Motorola:PowerMAX_OS:*:*)
47690926Snectar	echo powerpc-motorola-powermax
47790926Snectar	exit 0 ;;
478127808Snectar    Motorola:*:4.3:PL8-*)
479127808Snectar	echo powerpc-harris-powermax
480127808Snectar	exit 0 ;;
481127808Snectar    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
482127808Snectar	echo powerpc-harris-powermax
483127808Snectar	exit 0 ;;
48455682Smarkm    Night_Hawk:Power_UNIX:*:*)
48555682Smarkm	echo powerpc-harris-powerunix
48655682Smarkm	exit 0 ;;
48755682Smarkm    m88k:CX/UX:7*:*)
48855682Smarkm	echo m88k-harris-cxux7
48955682Smarkm	exit 0 ;;
49055682Smarkm    m88k:*:4*:R4*)
49155682Smarkm	echo m88k-motorola-sysv4
49255682Smarkm	exit 0 ;;
49355682Smarkm    m88k:*:3*:R3*)
49455682Smarkm	echo m88k-motorola-sysv3
49555682Smarkm	exit 0 ;;
49655682Smarkm    AViiON:dgux:*:*)
49755682Smarkm        # DG/UX returns AViiON for all architectures
49855682Smarkm        UNAME_PROCESSOR=`/usr/bin/uname -p`
499102644Snectar	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
50072445Sassar	then
50172445Sassar	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
50272445Sassar	       [ ${TARGET_BINARY_INTERFACE}x = x ]
50372445Sassar	    then
50455682Smarkm		echo m88k-dg-dgux${UNAME_RELEASE}
50572445Sassar	    else
50672445Sassar		echo m88k-dg-dguxbcs${UNAME_RELEASE}
50772445Sassar	    fi
50855682Smarkm	else
50972445Sassar	    echo i586-dg-dgux${UNAME_RELEASE}
51055682Smarkm	fi
51155682Smarkm 	exit 0 ;;
51255682Smarkm    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
51355682Smarkm	echo m88k-dolphin-sysv3
51455682Smarkm	exit 0 ;;
51555682Smarkm    M88*:*:R3*:*)
51655682Smarkm	# Delta 88k system running SVR3
51755682Smarkm	echo m88k-motorola-sysv3
51855682Smarkm	exit 0 ;;
51955682Smarkm    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
52055682Smarkm	echo m88k-tektronix-sysv3
52155682Smarkm	exit 0 ;;
52255682Smarkm    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
52355682Smarkm	echo m68k-tektronix-bsd
52455682Smarkm	exit 0 ;;
52555682Smarkm    *:IRIX*:*:*)
52655682Smarkm	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
52755682Smarkm	exit 0 ;;
52855682Smarkm    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
52955682Smarkm	echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
53055682Smarkm	exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
53190926Snectar    i*86:AIX:*:*)
53255682Smarkm	echo i386-ibm-aix
53355682Smarkm	exit 0 ;;
53490926Snectar    ia64:AIX:*:*)
53590926Snectar	if [ -x /usr/bin/oslevel ] ; then
53690926Snectar		IBM_REV=`/usr/bin/oslevel`
53790926Snectar	else
53890926Snectar		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
53990926Snectar	fi
54090926Snectar	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
54190926Snectar	exit 0 ;;
54255682Smarkm    *:AIX:2:3)
54355682Smarkm	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
54490926Snectar		eval $set_cc_for_build
54555682Smarkm		sed 's/^		//' << EOF >$dummy.c
54655682Smarkm		#include <sys/systemcfg.h>
54755682Smarkm
54855682Smarkm		main()
54955682Smarkm			{
55055682Smarkm			if (!__power_pc())
55155682Smarkm				exit(1);
55255682Smarkm			puts("powerpc-ibm-aix3.2.5");
55355682Smarkm			exit(0);
55455682Smarkm			}
55555682SmarkmEOF
556127808Snectar		$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
55755682Smarkm		echo rs6000-ibm-aix3.2.5
55855682Smarkm	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
55955682Smarkm		echo rs6000-ibm-aix3.2.4
56055682Smarkm	else
56155682Smarkm		echo rs6000-ibm-aix3.2
56255682Smarkm	fi
56355682Smarkm	exit 0 ;;
56490926Snectar    *:AIX:*:[45])
565102644Snectar	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
56690926Snectar	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
56755682Smarkm		IBM_ARCH=rs6000
56855682Smarkm	else
56955682Smarkm		IBM_ARCH=powerpc
57055682Smarkm	fi
57155682Smarkm	if [ -x /usr/bin/oslevel ] ; then
57255682Smarkm		IBM_REV=`/usr/bin/oslevel`
57355682Smarkm	else
57490926Snectar		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
57555682Smarkm	fi
57655682Smarkm	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
57755682Smarkm	exit 0 ;;
57855682Smarkm    *:AIX:*:*)
57955682Smarkm	echo rs6000-ibm-aix
58055682Smarkm	exit 0 ;;
58155682Smarkm    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
58255682Smarkm	echo romp-ibm-bsd4.4
58355682Smarkm	exit 0 ;;
58472445Sassar    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
58555682Smarkm	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
58655682Smarkm	exit 0 ;;                           # report: romp-ibm BSD 4.3
58755682Smarkm    *:BOSX:*:*)
58855682Smarkm	echo rs6000-bull-bosx
58955682Smarkm	exit 0 ;;
59055682Smarkm    DPX/2?00:B.O.S.:*:*)
59155682Smarkm	echo m68k-bull-sysv3
59255682Smarkm	exit 0 ;;
59355682Smarkm    9000/[34]??:4.3bsd:1.*:*)
59455682Smarkm	echo m68k-hp-bsd
59555682Smarkm	exit 0 ;;
59655682Smarkm    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
59755682Smarkm	echo m68k-hp-bsd4.4
59855682Smarkm	exit 0 ;;
59955682Smarkm    9000/[34678]??:HP-UX:*:*)
60090926Snectar	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
60155682Smarkm	case "${UNAME_MACHINE}" in
60255682Smarkm	    9000/31? )            HP_ARCH=m68000 ;;
60355682Smarkm	    9000/[34]?? )         HP_ARCH=m68k ;;
60472445Sassar	    9000/[678][0-9][0-9])
605102644Snectar		if [ -x /usr/bin/getconf ]; then
606102644Snectar		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
60790926Snectar                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
60890926Snectar                    case "${sc_cpu_version}" in
60990926Snectar                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
61090926Snectar                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
61190926Snectar                      532)                      # CPU_PA_RISC2_0
61290926Snectar                        case "${sc_kernel_bits}" in
61390926Snectar                          32) HP_ARCH="hppa2.0n" ;;
61490926Snectar                          64) HP_ARCH="hppa2.0w" ;;
615102644Snectar			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
61690926Snectar                        esac ;;
61790926Snectar                    esac
618102644Snectar		fi
619102644Snectar		if [ "${HP_ARCH}" = "" ]; then
620102644Snectar		    eval $set_cc_for_build
621102644Snectar		    sed 's/^              //' << EOF >$dummy.c
62272445Sassar
62372445Sassar              #define _HPUX_SOURCE
62455682Smarkm              #include <stdlib.h>
62555682Smarkm              #include <unistd.h>
62672445Sassar
62755682Smarkm              int main ()
62855682Smarkm              {
62955682Smarkm              #if defined(_SC_KERNEL_BITS)
63055682Smarkm                  long bits = sysconf(_SC_KERNEL_BITS);
63172445Sassar              #endif
63255682Smarkm                  long cpu  = sysconf (_SC_CPU_VERSION);
63372445Sassar
63472445Sassar                  switch (cpu)
63555682Smarkm              	{
63655682Smarkm              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
63755682Smarkm              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
63872445Sassar              	case CPU_PA_RISC2_0:
63955682Smarkm              #if defined(_SC_KERNEL_BITS)
64072445Sassar              	    switch (bits)
64155682Smarkm              		{
64255682Smarkm              		case 64: puts ("hppa2.0w"); break;
64355682Smarkm              		case 32: puts ("hppa2.0n"); break;
64455682Smarkm              		default: puts ("hppa2.0"); break;
64555682Smarkm              		} break;
64655682Smarkm              #else  /* !defined(_SC_KERNEL_BITS) */
64755682Smarkm              	    puts ("hppa2.0"); break;
64872445Sassar              #endif
64955682Smarkm              	default: puts ("hppa1.0"); break;
65055682Smarkm              	}
65155682Smarkm                  exit (0);
65255682Smarkm              }
65355682SmarkmEOF
654127808Snectar		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
655127808Snectar		    test -z "$HP_ARCH" && HP_ARCH=hppa
656102644Snectar		fi ;;
65755682Smarkm	esac
658127808Snectar	if [ ${HP_ARCH} = "hppa2.0w" ]
659127808Snectar	then
660127808Snectar	    # avoid double evaluation of $set_cc_for_build
661127808Snectar	    test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
662127808Snectar	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
663127808Snectar	    then
664127808Snectar		HP_ARCH="hppa2.0w"
665127808Snectar	    else
666127808Snectar		HP_ARCH="hppa64"
667127808Snectar	    fi
668127808Snectar	fi
66955682Smarkm	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
67055682Smarkm	exit 0 ;;
67190926Snectar    ia64:HP-UX:*:*)
67290926Snectar	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
67390926Snectar	echo ia64-hp-hpux${HPUX_REV}
67490926Snectar	exit 0 ;;
67555682Smarkm    3050*:HI-UX:*:*)
67690926Snectar	eval $set_cc_for_build
67755682Smarkm	sed 's/^	//' << EOF >$dummy.c
67855682Smarkm	#include <unistd.h>
67955682Smarkm	int
68055682Smarkm	main ()
68155682Smarkm	{
68255682Smarkm	  long cpu = sysconf (_SC_CPU_VERSION);
68355682Smarkm	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
68455682Smarkm	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
68555682Smarkm	     results, however.  */
68655682Smarkm	  if (CPU_IS_PA_RISC (cpu))
68755682Smarkm	    {
68855682Smarkm	      switch (cpu)
68955682Smarkm		{
69055682Smarkm		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
69155682Smarkm		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
69255682Smarkm		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
69355682Smarkm		  default: puts ("hppa-hitachi-hiuxwe2"); break;
69455682Smarkm		}
69555682Smarkm	    }
69655682Smarkm	  else if (CPU_IS_HP_MC68K (cpu))
69755682Smarkm	    puts ("m68k-hitachi-hiuxwe2");
69855682Smarkm	  else puts ("unknown-hitachi-hiuxwe2");
69955682Smarkm	  exit (0);
70055682Smarkm	}
70155682SmarkmEOF
702127808Snectar	$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
70355682Smarkm	echo unknown-hitachi-hiuxwe2
70455682Smarkm	exit 0 ;;
70555682Smarkm    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
70655682Smarkm	echo hppa1.1-hp-bsd
70755682Smarkm	exit 0 ;;
70855682Smarkm    9000/8??:4.3bsd:*:*)
70955682Smarkm	echo hppa1.0-hp-bsd
71055682Smarkm	exit 0 ;;
71190926Snectar    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
71272445Sassar	echo hppa1.0-hp-mpeix
71372445Sassar	exit 0 ;;
71455682Smarkm    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
71555682Smarkm	echo hppa1.1-hp-osf
71655682Smarkm	exit 0 ;;
71755682Smarkm    hp8??:OSF1:*:*)
71855682Smarkm	echo hppa1.0-hp-osf
71955682Smarkm	exit 0 ;;
72090926Snectar    i*86:OSF1:*:*)
72155682Smarkm	if [ -x /usr/sbin/sysversion ] ; then
72255682Smarkm	    echo ${UNAME_MACHINE}-unknown-osf1mk
72355682Smarkm	else
72455682Smarkm	    echo ${UNAME_MACHINE}-unknown-osf1
72555682Smarkm	fi
72655682Smarkm	exit 0 ;;
72755682Smarkm    parisc*:Lites*:*:*)
72855682Smarkm	echo hppa1.1-hp-lites
72955682Smarkm	exit 0 ;;
73055682Smarkm    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
73155682Smarkm	echo c1-convex-bsd
73255682Smarkm        exit 0 ;;
73355682Smarkm    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
73455682Smarkm	if getsysinfo -f scalar_acc
73555682Smarkm	then echo c32-convex-bsd
73655682Smarkm	else echo c2-convex-bsd
73755682Smarkm	fi
73855682Smarkm        exit 0 ;;
73955682Smarkm    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
74055682Smarkm	echo c34-convex-bsd
74155682Smarkm        exit 0 ;;
74255682Smarkm    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
74355682Smarkm	echo c38-convex-bsd
74455682Smarkm        exit 0 ;;
74555682Smarkm    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
74655682Smarkm	echo c4-convex-bsd
74755682Smarkm        exit 0 ;;
74855682Smarkm    CRAY*Y-MP:*:*:*)
74990926Snectar	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
75055682Smarkm	exit 0 ;;
75155682Smarkm    CRAY*[A-Z]90:*:*:*)
75255682Smarkm	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
75355682Smarkm	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
75490926Snectar	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
75590926Snectar	      -e 's/\.[^.]*$/.X/'
75655682Smarkm	exit 0 ;;
75755682Smarkm    CRAY*TS:*:*:*)
75872445Sassar	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
75955682Smarkm	exit 0 ;;
76090926Snectar    CRAY*T3E:*:*:*)
76190926Snectar	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
76290926Snectar	exit 0 ;;
76372445Sassar    CRAY*SV1:*:*:*)
764102644Snectar	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
76572445Sassar	exit 0 ;;
766127808Snectar    *:UNICOS/mp:*:*)
767127808Snectar	echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
768127808Snectar	exit 0 ;;
76990926Snectar    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
77090926Snectar	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
77172445Sassar        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
77255682Smarkm        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
77390926Snectar        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
77455682Smarkm        exit 0 ;;
775142403Snectar    5000:UNIX_System_V:4.*:*)
776142403Snectar        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
777142403Snectar        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
778142403Snectar        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
779142403Snectar	exit 0 ;;
78090926Snectar    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
78172445Sassar	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
78272445Sassar	exit 0 ;;
78355682Smarkm    sparc*:BSD/OS:*:*)
78455682Smarkm	echo sparc-unknown-bsdi${UNAME_RELEASE}
78555682Smarkm	exit 0 ;;
78655682Smarkm    *:BSD/OS:*:*)
78755682Smarkm	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
78855682Smarkm	exit 0 ;;
789142403Snectar    *:FreeBSD:*:*)
790127808Snectar	# Determine whether the default compiler uses glibc.
791127808Snectar	eval $set_cc_for_build
792127808Snectar	sed 's/^	//' << EOF >$dummy.c
793127808Snectar	#include <features.h>
794127808Snectar	#if __GLIBC__ >= 2
795127808Snectar	LIBC=gnu
796127808Snectar	#else
797127808Snectar	LIBC=
798127808Snectar	#endif
799127808SnectarEOF
800127808Snectar	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
801142403Snectar	# GNU/KFreeBSD systems have a "k" prefix to indicate we are using
802127808Snectar	# FreeBSD's kernel, but not the complete OS.
803127808Snectar	case ${LIBC} in gnu) kernel_only='k' ;; esac
804127808Snectar	echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
80555682Smarkm	exit 0 ;;
80655682Smarkm    i*:CYGWIN*:*)
80755682Smarkm	echo ${UNAME_MACHINE}-pc-cygwin
80855682Smarkm	exit 0 ;;
80955682Smarkm    i*:MINGW*:*)
81055682Smarkm	echo ${UNAME_MACHINE}-pc-mingw32
81155682Smarkm	exit 0 ;;
81272445Sassar    i*:PW*:*)
81372445Sassar	echo ${UNAME_MACHINE}-pc-pw32
81472445Sassar	exit 0 ;;
815127808Snectar    x86:Interix*:[34]*)
816127808Snectar	echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
817102644Snectar	exit 0 ;;
818127808Snectar    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
819127808Snectar	echo i${UNAME_MACHINE}-pc-mks
820127808Snectar	exit 0 ;;
82172445Sassar    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
82272445Sassar	# How do we know it's Interix rather than the generic POSIX subsystem?
82372445Sassar	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
82472445Sassar	# UNAME_MACHINE based on the output of uname instead of i386?
825127808Snectar	echo i586-pc-interix
82672445Sassar	exit 0 ;;
82772445Sassar    i*:UWIN*:*)
82872445Sassar	echo ${UNAME_MACHINE}-pc-uwin
82972445Sassar	exit 0 ;;
83055682Smarkm    p*:CYGWIN*:*)
83155682Smarkm	echo powerpcle-unknown-cygwin
83255682Smarkm	exit 0 ;;
83355682Smarkm    prep*:SunOS:5.*:*)
83455682Smarkm	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
83555682Smarkm	exit 0 ;;
83655682Smarkm    *:GNU:*:*)
837142403Snectar	# the GNU system
83855682Smarkm	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
83955682Smarkm	exit 0 ;;
840142403Snectar    *:GNU/*:*:*)
841142403Snectar	# other systems with GNU libc and userland
842142403Snectar	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
843142403Snectar	exit 0 ;;
84472445Sassar    i*86:Minix:*:*)
84572445Sassar	echo ${UNAME_MACHINE}-pc-minix
84672445Sassar	exit 0 ;;
84790926Snectar    arm*:Linux:*:*)
84890926Snectar	echo ${UNAME_MACHINE}-unknown-linux-gnu
84990926Snectar	exit 0 ;;
850127808Snectar    cris:Linux:*:*)
851127808Snectar	echo cris-axis-linux-gnu
852127808Snectar	exit 0 ;;
85390926Snectar    ia64:Linux:*:*)
854102644Snectar	echo ${UNAME_MACHINE}-unknown-linux-gnu
85590926Snectar	exit 0 ;;
85690926Snectar    m68*:Linux:*:*)
85790926Snectar	echo ${UNAME_MACHINE}-unknown-linux-gnu
85890926Snectar	exit 0 ;;
85990926Snectar    mips:Linux:*:*)
860102644Snectar	eval $set_cc_for_build
861102644Snectar	sed 's/^	//' << EOF >$dummy.c
862102644Snectar	#undef CPU
863102644Snectar	#undef mips
864102644Snectar	#undef mipsel
865102644Snectar	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
866102644Snectar	CPU=mipsel
867102644Snectar	#else
868102644Snectar	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
869102644Snectar	CPU=mips
870102644Snectar	#else
871102644Snectar	CPU=
872102644Snectar	#endif
873102644Snectar	#endif
874102644SnectarEOF
875102644Snectar	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
876127808Snectar	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
87790926Snectar	;;
878127808Snectar    mips64:Linux:*:*)
879127808Snectar	eval $set_cc_for_build
880127808Snectar	sed 's/^	//' << EOF >$dummy.c
881127808Snectar	#undef CPU
882127808Snectar	#undef mips64
883127808Snectar	#undef mips64el
884127808Snectar	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
885127808Snectar	CPU=mips64el
886127808Snectar	#else
887127808Snectar	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
888127808Snectar	CPU=mips64
889127808Snectar	#else
890127808Snectar	CPU=
891127808Snectar	#endif
892127808Snectar	#endif
893127808SnectarEOF
894127808Snectar	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
895127808Snectar	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
896127808Snectar	;;
89790926Snectar    ppc:Linux:*:*)
89890926Snectar	echo powerpc-unknown-linux-gnu
89990926Snectar	exit 0 ;;
90090926Snectar    ppc64:Linux:*:*)
90190926Snectar	echo powerpc64-unknown-linux-gnu
90290926Snectar	exit 0 ;;
90390926Snectar    alpha:Linux:*:*)
90490926Snectar	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
90590926Snectar	  EV5)   UNAME_MACHINE=alphaev5 ;;
90690926Snectar	  EV56)  UNAME_MACHINE=alphaev56 ;;
90790926Snectar	  PCA56) UNAME_MACHINE=alphapca56 ;;
90890926Snectar	  PCA57) UNAME_MACHINE=alphapca56 ;;
90990926Snectar	  EV6)   UNAME_MACHINE=alphaev6 ;;
91090926Snectar	  EV67)  UNAME_MACHINE=alphaev67 ;;
91190926Snectar	  EV68*) UNAME_MACHINE=alphaev68 ;;
91290926Snectar        esac
91390926Snectar	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
91490926Snectar	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
91590926Snectar	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
91690926Snectar	exit 0 ;;
91790926Snectar    parisc:Linux:*:* | hppa:Linux:*:*)
91890926Snectar	# Look for CPU level
91990926Snectar	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
92090926Snectar	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
92190926Snectar	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
92290926Snectar	  *)    echo hppa-unknown-linux-gnu ;;
92390926Snectar	esac
92490926Snectar	exit 0 ;;
92590926Snectar    parisc64:Linux:*:* | hppa64:Linux:*:*)
92690926Snectar	echo hppa64-unknown-linux-gnu
92790926Snectar	exit 0 ;;
92890926Snectar    s390:Linux:*:* | s390x:Linux:*:*)
92990926Snectar	echo ${UNAME_MACHINE}-ibm-linux
93090926Snectar	exit 0 ;;
931127808Snectar    sh64*:Linux:*:*)
932127808Snectar    	echo ${UNAME_MACHINE}-unknown-linux-gnu
933127808Snectar	exit 0 ;;
93490926Snectar    sh*:Linux:*:*)
93590926Snectar	echo ${UNAME_MACHINE}-unknown-linux-gnu
93690926Snectar	exit 0 ;;
93790926Snectar    sparc:Linux:*:* | sparc64:Linux:*:*)
93890926Snectar	echo ${UNAME_MACHINE}-unknown-linux-gnu
93990926Snectar	exit 0 ;;
94090926Snectar    x86_64:Linux:*:*)
94190926Snectar	echo x86_64-unknown-linux-gnu
94290926Snectar	exit 0 ;;
94390926Snectar    i*86:Linux:*:*)
94455682Smarkm	# The BFD linker knows what the default object file format is, so
94572445Sassar	# first see if it will tell us. cd to the root directory to prevent
94672445Sassar	# problems with other programs or directories called `ld' in the path.
947102644Snectar	# Set LC_ALL=C to ensure ld outputs messages in English.
948102644Snectar	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
94990926Snectar			 | sed -ne '/supported targets:/!d
95055682Smarkm				    s/[ 	][ 	]*/ /g
95190926Snectar				    s/.*supported targets: *//
95255682Smarkm				    s/ .*//
95355682Smarkm				    p'`
95490926Snectar        case "$ld_supported_targets" in
95590926Snectar	  elf32-i386)
95690926Snectar		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
95772445Sassar		;;
95890926Snectar	  a.out-i386-linux)
95972445Sassar		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
960127808Snectar		exit 0 ;;
96190926Snectar	  coff-i386)
96272445Sassar		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
96390926Snectar		exit 0 ;;
96490926Snectar	  "")
96590926Snectar		# Either a pre-BFD a.out linker (linux-gnuoldld) or
96690926Snectar		# one that does not give us useful --help.
96790926Snectar		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
96890926Snectar		exit 0 ;;
96955682Smarkm	esac
97090926Snectar	# Determine whether the default compiler is a.out or elf
97190926Snectar	eval $set_cc_for_build
972102644Snectar	sed 's/^	//' << EOF >$dummy.c
973102644Snectar	#include <features.h>
974102644Snectar	#ifdef __ELF__
975102644Snectar	# ifdef __GLIBC__
976102644Snectar	#  if __GLIBC__ >= 2
977102644Snectar	LIBC=gnu
978102644Snectar	#  else
979102644Snectar	LIBC=gnulibc1
980102644Snectar	#  endif
981102644Snectar	# else
982102644Snectar	LIBC=gnulibc1
983102644Snectar	# endif
984102644Snectar	#else
985102644Snectar	#ifdef __INTEL_COMPILER
986102644Snectar	LIBC=gnu
987102644Snectar	#else
988102644Snectar	LIBC=gnuaout
989102644Snectar	#endif
990102644Snectar	#endif
991127808Snectar	#ifdef __dietlibc__
992127808Snectar	LIBC=dietlibc
993127808Snectar	#endif
99455682SmarkmEOF
995102644Snectar	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
996102644Snectar	test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
99790926Snectar	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
99890926Snectar	;;
99990926Snectar    i*86:DYNIX/ptx:4*:*)
100090926Snectar	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
100190926Snectar	# earlier versions are messed up and put the nodename in both
100290926Snectar	# sysname and nodename.
100355682Smarkm	echo i386-sequent-sysv4
100455682Smarkm	exit 0 ;;
100590926Snectar    i*86:UNIX_SV:4.2MP:2.*)
100655682Smarkm        # Unixware is an offshoot of SVR4, but it has its own version
100755682Smarkm        # number series starting with 2...
100855682Smarkm        # I am not positive that other SVR4 systems won't match this,
100955682Smarkm	# I just have to hope.  -- rms.
101055682Smarkm        # Use sysv4.2uw... so that sysv4* matches it.
101155682Smarkm	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
101255682Smarkm	exit 0 ;;
1013127808Snectar    i*86:OS/2:*:*)
1014127808Snectar	# If we were able to find `uname', then EMX Unix compatibility
1015127808Snectar	# is probably installed.
1016127808Snectar	echo ${UNAME_MACHINE}-pc-os2-emx
1017127808Snectar	exit 0 ;;
1018127808Snectar    i*86:XTS-300:*:STOP)
1019127808Snectar	echo ${UNAME_MACHINE}-unknown-stop
1020127808Snectar	exit 0 ;;
1021127808Snectar    i*86:atheos:*:*)
1022127808Snectar	echo ${UNAME_MACHINE}-unknown-atheos
1023127808Snectar	exit 0 ;;
1024142403Snectar	i*86:syllable:*:*)
1025142403Snectar	echo ${UNAME_MACHINE}-pc-syllable
1026142403Snectar	exit 0 ;;
1027127808Snectar    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
1028127808Snectar	echo i386-unknown-lynxos${UNAME_RELEASE}
1029127808Snectar	exit 0 ;;
1030127808Snectar    i*86:*DOS:*:*)
1031127808Snectar	echo ${UNAME_MACHINE}-pc-msdosdjgpp
1032127808Snectar	exit 0 ;;
103390926Snectar    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
103472445Sassar	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
103555682Smarkm	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
103672445Sassar		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
103755682Smarkm	else
103872445Sassar		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
103955682Smarkm	fi
104055682Smarkm	exit 0 ;;
104190926Snectar    i*86:*:5:[78]*)
104290926Snectar	case `/bin/uname -X | grep "^Machine"` in
104390926Snectar	    *486*)	     UNAME_MACHINE=i486 ;;
104490926Snectar	    *Pentium)	     UNAME_MACHINE=i586 ;;
104590926Snectar	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
104690926Snectar	esac
104790926Snectar	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
104872445Sassar	exit 0 ;;
104990926Snectar    i*86:*:3.2:*)
105055682Smarkm	if test -f /usr/options/cb.name; then
105155682Smarkm		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
105255682Smarkm		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
105355682Smarkm	elif /bin/uname -X 2>/dev/null >/dev/null ; then
1054127808Snectar		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1055127808Snectar		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1056127808Snectar		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
105755682Smarkm			&& UNAME_MACHINE=i586
1058127808Snectar		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
105972445Sassar			&& UNAME_MACHINE=i686
1060127808Snectar		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
106172445Sassar			&& UNAME_MACHINE=i686
106255682Smarkm		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
106355682Smarkm	else
106455682Smarkm		echo ${UNAME_MACHINE}-pc-sysv32
106555682Smarkm	fi
106655682Smarkm	exit 0 ;;
106755682Smarkm    pc:*:*:*)
106872445Sassar	# Left here for compatibility:
106955682Smarkm        # uname -m prints for DJGPP always 'pc', but it prints nothing about
107055682Smarkm        # the processor, so we play safe by assuming i386.
107155682Smarkm	echo i386-pc-msdosdjgpp
107255682Smarkm        exit 0 ;;
107355682Smarkm    Intel:Mach:3*:*)
107455682Smarkm	echo i386-pc-mach3
107555682Smarkm	exit 0 ;;
107655682Smarkm    paragon:*:*:*)
107755682Smarkm	echo i860-intel-osf1
107855682Smarkm	exit 0 ;;
107955682Smarkm    i860:*:4.*:*) # i860-SVR4
108055682Smarkm	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
108155682Smarkm	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
108255682Smarkm	else # Add other i860-SVR4 vendors below as they are discovered.
108355682Smarkm	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
108455682Smarkm	fi
108555682Smarkm	exit 0 ;;
108655682Smarkm    mini*:CTIX:SYS*5:*)
108755682Smarkm	# "miniframe"
108855682Smarkm	echo m68010-convergent-sysv
108955682Smarkm	exit 0 ;;
1090127808Snectar    mc68k:UNIX:SYSTEM5:3.51m)
1091127808Snectar	echo m68k-convergent-sysv
1092127808Snectar	exit 0 ;;
1093127808Snectar    M680?0:D-NIX:5.3:*)
1094127808Snectar	echo m68k-diab-dnix
1095127808Snectar	exit 0 ;;
109655682Smarkm    M68*:*:R3V[567]*:*)
109755682Smarkm	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
1098142403Snectar    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)
109955682Smarkm	OS_REL=''
110055682Smarkm	test -r /etc/.relid \
110155682Smarkm	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
110255682Smarkm	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
110355682Smarkm	  && echo i486-ncr-sysv4.3${OS_REL} && exit 0
110455682Smarkm	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
110555682Smarkm	  && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
110655682Smarkm    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
110755682Smarkm        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
110855682Smarkm          && echo i486-ncr-sysv4 && exit 0 ;;
110990926Snectar    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
111055682Smarkm	echo m68k-unknown-lynxos${UNAME_RELEASE}
111155682Smarkm	exit 0 ;;
111255682Smarkm    mc68030:UNIX_System_V:4.*:*)
111355682Smarkm	echo m68k-atari-sysv4
111455682Smarkm	exit 0 ;;
111555682Smarkm    TSUNAMI:LynxOS:2.*:*)
111655682Smarkm	echo sparc-unknown-lynxos${UNAME_RELEASE}
111755682Smarkm	exit 0 ;;
111890926Snectar    rs6000:LynxOS:2.*:*)
111955682Smarkm	echo rs6000-unknown-lynxos${UNAME_RELEASE}
112055682Smarkm	exit 0 ;;
112190926Snectar    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
112290926Snectar	echo powerpc-unknown-lynxos${UNAME_RELEASE}
112390926Snectar	exit 0 ;;
112455682Smarkm    SM[BE]S:UNIX_SV:*:*)
112555682Smarkm	echo mips-dde-sysv${UNAME_RELEASE}
112655682Smarkm	exit 0 ;;
112772445Sassar    RM*:ReliantUNIX-*:*:*)
112872445Sassar	echo mips-sni-sysv4
112972445Sassar	exit 0 ;;
113055682Smarkm    RM*:SINIX-*:*:*)
113155682Smarkm	echo mips-sni-sysv4
113255682Smarkm	exit 0 ;;
113355682Smarkm    *:SINIX-*:*:*)
113455682Smarkm	if uname -p 2>/dev/null >/dev/null ; then
113555682Smarkm		UNAME_MACHINE=`(uname -p) 2>/dev/null`
113655682Smarkm		echo ${UNAME_MACHINE}-sni-sysv4
113755682Smarkm	else
113855682Smarkm		echo ns32k-sni-sysv
113955682Smarkm	fi
114055682Smarkm	exit 0 ;;
114190926Snectar    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
114290926Snectar                      # says <Richard.M.Bartel@ccMail.Census.GOV>
114355682Smarkm        echo i586-unisys-sysv4
114455682Smarkm        exit 0 ;;
114555682Smarkm    *:UNIX_System_V:4*:FTX*)
114655682Smarkm	# From Gerald Hewes <hewes@openmarket.com>.
114755682Smarkm	# How about differentiating between stratus architectures? -djm
114855682Smarkm	echo hppa1.1-stratus-sysv4
114955682Smarkm	exit 0 ;;
115055682Smarkm    *:*:*:FTX*)
115155682Smarkm	# From seanf@swdc.stratus.com.
115255682Smarkm	echo i860-stratus-sysv4
115355682Smarkm	exit 0 ;;
115490926Snectar    *:VOS:*:*)
115590926Snectar	# From Paul.Green@stratus.com.
115690926Snectar	echo hppa1.1-stratus-vos
115790926Snectar	exit 0 ;;
115855682Smarkm    mc68*:A/UX:*:*)
115955682Smarkm	echo m68k-apple-aux${UNAME_RELEASE}
116055682Smarkm	exit 0 ;;
116172445Sassar    news*:NEWS-OS:6*:*)
116255682Smarkm	echo mips-sony-newsos6
116355682Smarkm	exit 0 ;;
116472445Sassar    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
116555682Smarkm	if [ -d /usr/nec ]; then
116655682Smarkm	        echo mips-nec-sysv${UNAME_RELEASE}
116755682Smarkm	else
116855682Smarkm	        echo mips-unknown-sysv${UNAME_RELEASE}
116955682Smarkm	fi
117055682Smarkm        exit 0 ;;
117155682Smarkm    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
117255682Smarkm	echo powerpc-be-beos
117355682Smarkm	exit 0 ;;
117455682Smarkm    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
117555682Smarkm	echo powerpc-apple-beos
117655682Smarkm	exit 0 ;;
117755682Smarkm    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
117855682Smarkm	echo i586-pc-beos
117955682Smarkm	exit 0 ;;
118055682Smarkm    SX-4:SUPER-UX:*:*)
118155682Smarkm	echo sx4-nec-superux${UNAME_RELEASE}
118255682Smarkm	exit 0 ;;
118355682Smarkm    SX-5:SUPER-UX:*:*)
118455682Smarkm	echo sx5-nec-superux${UNAME_RELEASE}
118555682Smarkm	exit 0 ;;
1186127808Snectar    SX-6:SUPER-UX:*:*)
1187127808Snectar	echo sx6-nec-superux${UNAME_RELEASE}
1188127808Snectar	exit 0 ;;
118955682Smarkm    Power*:Rhapsody:*:*)
119055682Smarkm	echo powerpc-apple-rhapsody${UNAME_RELEASE}
119155682Smarkm	exit 0 ;;
119255682Smarkm    *:Rhapsody:*:*)
119355682Smarkm	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
119455682Smarkm	exit 0 ;;
119572445Sassar    *:Darwin:*:*)
1196127808Snectar	case `uname -p` in
1197127808Snectar	    *86) UNAME_PROCESSOR=i686 ;;
1198127808Snectar	    powerpc) UNAME_PROCESSOR=powerpc ;;
1199127808Snectar	esac
1200127808Snectar	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
120172445Sassar	exit 0 ;;
120272445Sassar    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1203102644Snectar	UNAME_PROCESSOR=`uname -p`
1204102644Snectar	if test "$UNAME_PROCESSOR" = "x86"; then
1205102644Snectar		UNAME_PROCESSOR=i386
120672445Sassar		UNAME_MACHINE=pc
120772445Sassar	fi
1208102644Snectar	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
120972445Sassar	exit 0 ;;
121072445Sassar    *:QNX:*:4*)
121172445Sassar	echo i386-pc-qnx
121272445Sassar	exit 0 ;;
1213142403Snectar    NSR-?:NONSTOP_KERNEL:*:*)
121472445Sassar	echo nsr-tandem-nsk${UNAME_RELEASE}
121572445Sassar	exit 0 ;;
121690926Snectar    *:NonStop-UX:*:*)
121790926Snectar	echo mips-compaq-nonstopux
121890926Snectar	exit 0 ;;
121972445Sassar    BS2000:POSIX*:*:*)
122072445Sassar	echo bs2000-siemens-sysv
122172445Sassar	exit 0 ;;
122272445Sassar    DS/*:UNIX_System_V:*:*)
122372445Sassar	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
122472445Sassar	exit 0 ;;
122572445Sassar    *:Plan9:*:*)
122672445Sassar	# "uname -m" is not consistent, so use $cputype instead. 386
122772445Sassar	# is converted to i386 for consistency with other x86
122872445Sassar	# operating systems.
122972445Sassar	if test "$cputype" = "386"; then
123072445Sassar	    UNAME_MACHINE=i386
123172445Sassar	else
123272445Sassar	    UNAME_MACHINE="$cputype"
123372445Sassar	fi
123472445Sassar	echo ${UNAME_MACHINE}-unknown-plan9
123572445Sassar	exit 0 ;;
123690926Snectar    *:TOPS-10:*:*)
123790926Snectar	echo pdp10-unknown-tops10
123890926Snectar	exit 0 ;;
123990926Snectar    *:TENEX:*:*)
124090926Snectar	echo pdp10-unknown-tenex
124190926Snectar	exit 0 ;;
124290926Snectar    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
124390926Snectar	echo pdp10-dec-tops20
124490926Snectar	exit 0 ;;
124590926Snectar    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
124690926Snectar	echo pdp10-xkl-tops20
124790926Snectar	exit 0 ;;
124890926Snectar    *:TOPS-20:*:*)
124990926Snectar	echo pdp10-unknown-tops20
125090926Snectar	exit 0 ;;
125190926Snectar    *:ITS:*:*)
125290926Snectar	echo pdp10-unknown-its
125390926Snectar	exit 0 ;;
1254127808Snectar    SEI:*:*:SEIUX)
1255127808Snectar        echo mips-sei-seiux${UNAME_RELEASE}
125690926Snectar	exit 0 ;;
1257142403Snectar    *:DragonFly:*:*)
1258142403Snectar	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
1259142403Snectar	exit 0 ;;
126055682Smarkmesac
126155682Smarkm
126255682Smarkm#echo '(No uname command or uname output not recognized.)' 1>&2
126355682Smarkm#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
126455682Smarkm
126590926Snectareval $set_cc_for_build
126655682Smarkmcat >$dummy.c <<EOF
126755682Smarkm#ifdef _SEQUENT_
126855682Smarkm# include <sys/types.h>
126955682Smarkm# include <sys/utsname.h>
127055682Smarkm#endif
127155682Smarkmmain ()
127255682Smarkm{
127355682Smarkm#if defined (sony)
127455682Smarkm#if defined (MIPSEB)
127555682Smarkm  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
127655682Smarkm     I don't know....  */
127755682Smarkm  printf ("mips-sony-bsd\n"); exit (0);
127855682Smarkm#else
127955682Smarkm#include <sys/param.h>
128055682Smarkm  printf ("m68k-sony-newsos%s\n",
128155682Smarkm#ifdef NEWSOS4
128255682Smarkm          "4"
128355682Smarkm#else
128455682Smarkm	  ""
128555682Smarkm#endif
128655682Smarkm         ); exit (0);
128755682Smarkm#endif
128855682Smarkm#endif
128955682Smarkm
129055682Smarkm#if defined (__arm) && defined (__acorn) && defined (__unix)
129155682Smarkm  printf ("arm-acorn-riscix"); exit (0);
129255682Smarkm#endif
129355682Smarkm
129455682Smarkm#if defined (hp300) && !defined (hpux)
129555682Smarkm  printf ("m68k-hp-bsd\n"); exit (0);
129655682Smarkm#endif
129755682Smarkm
129855682Smarkm#if defined (NeXT)
129955682Smarkm#if !defined (__ARCHITECTURE__)
130055682Smarkm#define __ARCHITECTURE__ "m68k"
130155682Smarkm#endif
130255682Smarkm  int version;
130355682Smarkm  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
130455682Smarkm  if (version < 4)
130555682Smarkm    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
130655682Smarkm  else
130755682Smarkm    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
130855682Smarkm  exit (0);
130955682Smarkm#endif
131055682Smarkm
131155682Smarkm#if defined (MULTIMAX) || defined (n16)
131255682Smarkm#if defined (UMAXV)
131355682Smarkm  printf ("ns32k-encore-sysv\n"); exit (0);
131455682Smarkm#else
131555682Smarkm#if defined (CMU)
131655682Smarkm  printf ("ns32k-encore-mach\n"); exit (0);
131755682Smarkm#else
131855682Smarkm  printf ("ns32k-encore-bsd\n"); exit (0);
131955682Smarkm#endif
132055682Smarkm#endif
132155682Smarkm#endif
132255682Smarkm
132355682Smarkm#if defined (__386BSD__)
132455682Smarkm  printf ("i386-pc-bsd\n"); exit (0);
132555682Smarkm#endif
132655682Smarkm
132755682Smarkm#if defined (sequent)
132855682Smarkm#if defined (i386)
132955682Smarkm  printf ("i386-sequent-dynix\n"); exit (0);
133055682Smarkm#endif
133155682Smarkm#if defined (ns32000)
133255682Smarkm  printf ("ns32k-sequent-dynix\n"); exit (0);
133355682Smarkm#endif
133455682Smarkm#endif
133555682Smarkm
133655682Smarkm#if defined (_SEQUENT_)
133755682Smarkm    struct utsname un;
133855682Smarkm
133955682Smarkm    uname(&un);
134055682Smarkm
134155682Smarkm    if (strncmp(un.version, "V2", 2) == 0) {
134255682Smarkm	printf ("i386-sequent-ptx2\n"); exit (0);
134355682Smarkm    }
134455682Smarkm    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
134555682Smarkm	printf ("i386-sequent-ptx1\n"); exit (0);
134655682Smarkm    }
134755682Smarkm    printf ("i386-sequent-ptx\n"); exit (0);
134855682Smarkm
134955682Smarkm#endif
135055682Smarkm
135155682Smarkm#if defined (vax)
135290926Snectar# if !defined (ultrix)
135390926Snectar#  include <sys/param.h>
135490926Snectar#  if defined (BSD)
135590926Snectar#   if BSD == 43
135690926Snectar      printf ("vax-dec-bsd4.3\n"); exit (0);
135790926Snectar#   else
135890926Snectar#    if BSD == 199006
135990926Snectar      printf ("vax-dec-bsd4.3reno\n"); exit (0);
136090926Snectar#    else
136190926Snectar      printf ("vax-dec-bsd\n"); exit (0);
136290926Snectar#    endif
136390926Snectar#   endif
136490926Snectar#  else
136590926Snectar    printf ("vax-dec-bsd\n"); exit (0);
136690926Snectar#  endif
136790926Snectar# else
136890926Snectar    printf ("vax-dec-ultrix\n"); exit (0);
136990926Snectar# endif
137055682Smarkm#endif
137155682Smarkm
137255682Smarkm#if defined (alliant) && defined (i860)
137355682Smarkm  printf ("i860-alliant-bsd\n"); exit (0);
137455682Smarkm#endif
137555682Smarkm
137655682Smarkm  exit (1);
137755682Smarkm}
137855682SmarkmEOF
137955682Smarkm
1380127808Snectar$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
138155682Smarkm
138255682Smarkm# Apollos put the system type in the environment.
138355682Smarkm
138455682Smarkmtest -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
138555682Smarkm
138655682Smarkm# Convex versions that predate uname can use getsysinfo(1)
138755682Smarkm
138855682Smarkmif [ -x /usr/convex/getsysinfo ]
138955682Smarkmthen
139055682Smarkm    case `getsysinfo -f cpu_type` in
139155682Smarkm    c1*)
139255682Smarkm	echo c1-convex-bsd
139355682Smarkm	exit 0 ;;
139455682Smarkm    c2*)
139555682Smarkm	if getsysinfo -f scalar_acc
139655682Smarkm	then echo c32-convex-bsd
139755682Smarkm	else echo c2-convex-bsd
139855682Smarkm	fi
139955682Smarkm	exit 0 ;;
140055682Smarkm    c34*)
140155682Smarkm	echo c34-convex-bsd
140255682Smarkm	exit 0 ;;
140355682Smarkm    c38*)
140455682Smarkm	echo c38-convex-bsd
140555682Smarkm	exit 0 ;;
140655682Smarkm    c4*)
140755682Smarkm	echo c4-convex-bsd
140855682Smarkm	exit 0 ;;
140955682Smarkm    esac
141055682Smarkmfi
141155682Smarkm
141272445Sassarcat >&2 <<EOF
141372445Sassar$0: unable to guess system type
141455682Smarkm
141590926SnectarThis script, last modified $timestamp, has failed to recognize
141690926Snectarthe operating system you are using. It is advised that you
141790926Snectardownload the most up to date version of the config scripts from
141872445Sassar
141972445Sassar    ftp://ftp.gnu.org/pub/gnu/config/
142072445Sassar
142172445SassarIf the version you run ($0) is already up to date, please
142272445Sassarsend the following data and any information you think might be
142372445Sassarpertinent to <config-patches@gnu.org> in order to provide the needed
142472445Sassarinformation to handle your system.
142572445Sassar
142690926Snectarconfig.guess timestamp = $timestamp
142772445Sassar
142872445Sassaruname -m = `(uname -m) 2>/dev/null || echo unknown`
142972445Sassaruname -r = `(uname -r) 2>/dev/null || echo unknown`
143072445Sassaruname -s = `(uname -s) 2>/dev/null || echo unknown`
143172445Sassaruname -v = `(uname -v) 2>/dev/null || echo unknown`
143272445Sassar
143372445Sassar/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
143472445Sassar/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
143572445Sassar
143672445Sassarhostinfo               = `(hostinfo) 2>/dev/null`
143772445Sassar/bin/universe          = `(/bin/universe) 2>/dev/null`
143872445Sassar/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
143972445Sassar/bin/arch              = `(/bin/arch) 2>/dev/null`
144072445Sassar/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
144172445Sassar/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
144272445Sassar
144372445SassarUNAME_MACHINE = ${UNAME_MACHINE}
144472445SassarUNAME_RELEASE = ${UNAME_RELEASE}
144572445SassarUNAME_SYSTEM  = ${UNAME_SYSTEM}
144672445SassarUNAME_VERSION = ${UNAME_VERSION}
144772445SassarEOF
144872445Sassar
144955682Smarkmexit 1
145072445Sassar
145172445Sassar# Local variables:
145272445Sassar# eval: (add-hook 'write-file-hooks 'time-stamp)
145390926Snectar# time-stamp-start: "timestamp='"
145472445Sassar# time-stamp-format: "%:y-%02m-%02d"
145572445Sassar# time-stamp-end: "'"
145672445Sassar# End:
1457