config.guess revision 127808
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
6127808Snectartimestamp='2003-10-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 ;;
200102644Snectar    amiga:OpenBSD:*:*)
201102644Snectar	echo m68k-unknown-openbsd${UNAME_RELEASE}
202102644Snectar	exit 0 ;;
203102644Snectar    arc:OpenBSD:*:*)
204102644Snectar	echo mipsel-unknown-openbsd${UNAME_RELEASE}
205102644Snectar	exit 0 ;;
206102644Snectar    hp300:OpenBSD:*:*)
207102644Snectar	echo m68k-unknown-openbsd${UNAME_RELEASE}
208102644Snectar	exit 0 ;;
209102644Snectar    mac68k:OpenBSD:*:*)
210102644Snectar	echo m68k-unknown-openbsd${UNAME_RELEASE}
211102644Snectar	exit 0 ;;
212102644Snectar    macppc:OpenBSD:*:*)
213102644Snectar	echo powerpc-unknown-openbsd${UNAME_RELEASE}
214102644Snectar	exit 0 ;;
215102644Snectar    mvme68k:OpenBSD:*:*)
216102644Snectar	echo m68k-unknown-openbsd${UNAME_RELEASE}
217102644Snectar	exit 0 ;;
218102644Snectar    mvme88k:OpenBSD:*:*)
219102644Snectar	echo m88k-unknown-openbsd${UNAME_RELEASE}
220102644Snectar	exit 0 ;;
221102644Snectar    mvmeppc:OpenBSD:*:*)
222102644Snectar	echo powerpc-unknown-openbsd${UNAME_RELEASE}
223102644Snectar	exit 0 ;;
224102644Snectar    pmax:OpenBSD:*:*)
225102644Snectar	echo mipsel-unknown-openbsd${UNAME_RELEASE}
226102644Snectar	exit 0 ;;
227102644Snectar    sgi:OpenBSD:*:*)
228102644Snectar	echo mipseb-unknown-openbsd${UNAME_RELEASE}
229102644Snectar	exit 0 ;;
230102644Snectar    sun3:OpenBSD:*:*)
231102644Snectar	echo m68k-unknown-openbsd${UNAME_RELEASE}
232102644Snectar	exit 0 ;;
233102644Snectar    wgrisc:OpenBSD:*:*)
234102644Snectar	echo mipsel-unknown-openbsd${UNAME_RELEASE}
235102644Snectar	exit 0 ;;
236102644Snectar    *:OpenBSD:*:*)
237102644Snectar	echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
238102644Snectar	exit 0 ;;
23955682Smarkm    alpha:OSF1:*:*)
24055682Smarkm	if test $UNAME_RELEASE = "V4.0"; then
24155682Smarkm		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
24255682Smarkm	fi
243127808Snectar	# According to Compaq, /usr/sbin/psrinfo has been available on
244127808Snectar	# OSF/1 and Tru64 systems produced since 1995.  I hope that
245127808Snectar	# covers most systems running today.  This code pipes the CPU
246127808Snectar	# types through head -n 1, so we only detect the type of CPU 0.
247127808Snectar	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
248127808Snectar	case "$ALPHA_CPU_TYPE" in
249127808Snectar	    "EV4 (21064)")
250127808Snectar		UNAME_MACHINE="alpha" ;;
251127808Snectar	    "EV4.5 (21064)")
252127808Snectar		UNAME_MACHINE="alpha" ;;
253127808Snectar	    "LCA4 (21066/21068)")
254127808Snectar		UNAME_MACHINE="alpha" ;;
255127808Snectar	    "EV5 (21164)")
256127808Snectar		UNAME_MACHINE="alphaev5" ;;
257127808Snectar	    "EV5.6 (21164A)")
258127808Snectar		UNAME_MACHINE="alphaev56" ;;
259127808Snectar	    "EV5.6 (21164PC)")
260127808Snectar		UNAME_MACHINE="alphapca56" ;;
261127808Snectar	    "EV5.7 (21164PC)")
262127808Snectar		UNAME_MACHINE="alphapca57" ;;
263127808Snectar	    "EV6 (21264)")
264127808Snectar		UNAME_MACHINE="alphaev6" ;;
265127808Snectar	    "EV6.7 (21264A)")
266127808Snectar		UNAME_MACHINE="alphaev67" ;;
267127808Snectar	    "EV6.8CB (21264C)")
268127808Snectar		UNAME_MACHINE="alphaev68" ;;
269127808Snectar	    "EV6.8AL (21264B)")
270127808Snectar		UNAME_MACHINE="alphaev68" ;;
271127808Snectar	    "EV6.8CX (21264D)")
272127808Snectar		UNAME_MACHINE="alphaev68" ;;
273127808Snectar	    "EV6.9A (21264/EV69A)")
274127808Snectar		UNAME_MACHINE="alphaev69" ;;
275127808Snectar	    "EV7 (21364)")
276127808Snectar		UNAME_MACHINE="alphaev7" ;;
277127808Snectar	    "EV7.9 (21364A)")
278127808Snectar		UNAME_MACHINE="alphaev79" ;;
279127808Snectar	esac
28055682Smarkm	# A Vn.n version is a released version.
28155682Smarkm	# A Tn.n version is a released field test version.
28255682Smarkm	# A Xn.n version is an unreleased experimental baselevel.
28355682Smarkm	# 1.2 uses "1.2" for uname -r.
28472445Sassar	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
28555682Smarkm	exit 0 ;;
286127808Snectar    Alpha*:OpenVMS:*:*)
287127808Snectar	echo alpha-hp-vms
288127808Snectar	exit 0 ;;
28972445Sassar    Alpha\ *:Windows_NT*:*)
29072445Sassar	# How do we know it's Interix rather than the generic POSIX subsystem?
29172445Sassar	# Should we change UNAME_MACHINE based on the output of uname instead
29272445Sassar	# of the specific Alpha model?
29372445Sassar	echo alpha-pc-interix
29472445Sassar	exit 0 ;;
29555682Smarkm    21064:Windows_NT:50:3)
29655682Smarkm	echo alpha-dec-winnt3.5
29755682Smarkm	exit 0 ;;
29855682Smarkm    Amiga*:UNIX_System_V:4.0:*)
29972445Sassar	echo m68k-unknown-sysv4
30055682Smarkm	exit 0;;
30155682Smarkm    *:[Aa]miga[Oo][Ss]:*:*)
30255682Smarkm	echo ${UNAME_MACHINE}-unknown-amigaos
30355682Smarkm	exit 0 ;;
304102644Snectar    *:[Mm]orph[Oo][Ss]:*:*)
305102644Snectar	echo ${UNAME_MACHINE}-unknown-morphos
30655682Smarkm	exit 0 ;;
30772445Sassar    *:OS/390:*:*)
30872445Sassar	echo i370-ibm-openedition
30972445Sassar	exit 0 ;;
31055682Smarkm    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
31155682Smarkm	echo arm-acorn-riscix${UNAME_RELEASE}
31255682Smarkm	exit 0;;
31390926Snectar    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
31455682Smarkm	echo hppa1.1-hitachi-hiuxmpp
31555682Smarkm	exit 0;;
31672445Sassar    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
31755682Smarkm	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
31855682Smarkm	if test "`(/bin/universe) 2>/dev/null`" = att ; then
31955682Smarkm		echo pyramid-pyramid-sysv3
32055682Smarkm	else
32155682Smarkm		echo pyramid-pyramid-bsd
32255682Smarkm	fi
32355682Smarkm	exit 0 ;;
32472445Sassar    NILE*:*:*:dcosx)
32555682Smarkm	echo pyramid-pyramid-svr4
32655682Smarkm	exit 0 ;;
327127808Snectar    DRS?6000:unix:4.0:6*)
328127808Snectar	echo sparc-icl-nx6
329127808Snectar	exit 0 ;;
330127808Snectar    DRS?6000:UNIX_SV:4.2*:7*)
331127808Snectar	case `/usr/bin/uname -p` in
332127808Snectar	    sparc) echo sparc-icl-nx7 && exit 0 ;;
333127808Snectar	esac ;;
33455682Smarkm    sun4H:SunOS:5.*:*)
33555682Smarkm	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
33655682Smarkm	exit 0 ;;
33755682Smarkm    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
33855682Smarkm	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
33955682Smarkm	exit 0 ;;
34055682Smarkm    i86pc:SunOS:5.*:*)
34155682Smarkm	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
34255682Smarkm	exit 0 ;;
34355682Smarkm    sun4*:SunOS:6*:*)
34455682Smarkm	# According to config.sub, this is the proper way to canonicalize
34555682Smarkm	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
34655682Smarkm	# it's likely to be more like Solaris than SunOS4.
34755682Smarkm	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
34855682Smarkm	exit 0 ;;
34955682Smarkm    sun4*:SunOS:*:*)
35055682Smarkm	case "`/usr/bin/arch -k`" in
35155682Smarkm	    Series*|S4*)
35255682Smarkm		UNAME_RELEASE=`uname -v`
35355682Smarkm		;;
35455682Smarkm	esac
35555682Smarkm	# Japanese Language versions have a version number like `4.1.3-JL'.
35655682Smarkm	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
35755682Smarkm	exit 0 ;;
35855682Smarkm    sun3*:SunOS:*:*)
35955682Smarkm	echo m68k-sun-sunos${UNAME_RELEASE}
36055682Smarkm	exit 0 ;;
36155682Smarkm    sun*:*:4.2BSD:*)
362102644Snectar	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
36355682Smarkm	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
36455682Smarkm	case "`/bin/arch`" in
36555682Smarkm	    sun3)
36655682Smarkm		echo m68k-sun-sunos${UNAME_RELEASE}
36755682Smarkm		;;
36855682Smarkm	    sun4)
36955682Smarkm		echo sparc-sun-sunos${UNAME_RELEASE}
37055682Smarkm		;;
37155682Smarkm	esac
37255682Smarkm	exit 0 ;;
37355682Smarkm    aushp:SunOS:*:*)
37455682Smarkm	echo sparc-auspex-sunos${UNAME_RELEASE}
37555682Smarkm	exit 0 ;;
37672445Sassar    # The situation for MiNT is a little confusing.  The machine name
37772445Sassar    # can be virtually everything (everything which is not
378102644Snectar    # "atarist" or "atariste" at least should have a processor
37972445Sassar    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
38072445Sassar    # to the lowercase version "mint" (or "freemint").  Finally
38172445Sassar    # the system name "TOS" denotes a system which is actually not
38272445Sassar    # MiNT.  But MiNT is downward compatible to TOS, so this should
38372445Sassar    # be no problem.
38472445Sassar    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
38572445Sassar        echo m68k-atari-mint${UNAME_RELEASE}
38655682Smarkm	exit 0 ;;
38772445Sassar    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
38872445Sassar	echo m68k-atari-mint${UNAME_RELEASE}
38972445Sassar        exit 0 ;;
39072445Sassar    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
39172445Sassar        echo m68k-atari-mint${UNAME_RELEASE}
39272445Sassar	exit 0 ;;
39372445Sassar    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
39472445Sassar        echo m68k-milan-mint${UNAME_RELEASE}
39572445Sassar        exit 0 ;;
39672445Sassar    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
39772445Sassar        echo m68k-hades-mint${UNAME_RELEASE}
39872445Sassar        exit 0 ;;
39972445Sassar    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
40072445Sassar        echo m68k-unknown-mint${UNAME_RELEASE}
40172445Sassar        exit 0 ;;
40255682Smarkm    powerpc:machten:*:*)
40355682Smarkm	echo powerpc-apple-machten${UNAME_RELEASE}
40455682Smarkm	exit 0 ;;
40555682Smarkm    RISC*:Mach:*:*)
40655682Smarkm	echo mips-dec-mach_bsd4.3
40755682Smarkm	exit 0 ;;
40855682Smarkm    RISC*:ULTRIX:*:*)
40955682Smarkm	echo mips-dec-ultrix${UNAME_RELEASE}
41055682Smarkm	exit 0 ;;
41155682Smarkm    VAX*:ULTRIX*:*:*)
41255682Smarkm	echo vax-dec-ultrix${UNAME_RELEASE}
41355682Smarkm	exit 0 ;;
41472445Sassar    2020:CLIX:*:* | 2430:CLIX:*:*)
41555682Smarkm	echo clipper-intergraph-clix${UNAME_RELEASE}
41655682Smarkm	exit 0 ;;
41755682Smarkm    mips:*:*:UMIPS | mips:*:*:RISCos)
41890926Snectar	eval $set_cc_for_build
41955682Smarkm	sed 's/^	//' << EOF >$dummy.c
42072445Sassar#ifdef __cplusplus
42172445Sassar#include <stdio.h>  /* for printf() prototype */
42272445Sassar	int main (int argc, char *argv[]) {
42372445Sassar#else
42472445Sassar	int main (argc, argv) int argc; char *argv[]; {
42572445Sassar#endif
42655682Smarkm	#if defined (host_mips) && defined (MIPSEB)
42755682Smarkm	#if defined (SYSTYPE_SYSV)
42855682Smarkm	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
42955682Smarkm	#endif
43055682Smarkm	#if defined (SYSTYPE_SVR4)
43155682Smarkm	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
43255682Smarkm	#endif
43355682Smarkm	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
43455682Smarkm	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
43555682Smarkm	#endif
43655682Smarkm	#endif
43755682Smarkm	  exit (-1);
43855682Smarkm	}
43955682SmarkmEOF
440127808Snectar	$CC_FOR_BUILD -o $dummy $dummy.c \
441127808Snectar	  && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
442127808Snectar	  && exit 0
44355682Smarkm	echo mips-mips-riscos${UNAME_RELEASE}
44455682Smarkm	exit 0 ;;
44590926Snectar    Motorola:PowerMAX_OS:*:*)
44690926Snectar	echo powerpc-motorola-powermax
44790926Snectar	exit 0 ;;
448127808Snectar    Motorola:*:4.3:PL8-*)
449127808Snectar	echo powerpc-harris-powermax
450127808Snectar	exit 0 ;;
451127808Snectar    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
452127808Snectar	echo powerpc-harris-powermax
453127808Snectar	exit 0 ;;
45455682Smarkm    Night_Hawk:Power_UNIX:*:*)
45555682Smarkm	echo powerpc-harris-powerunix
45655682Smarkm	exit 0 ;;
45755682Smarkm    m88k:CX/UX:7*:*)
45855682Smarkm	echo m88k-harris-cxux7
45955682Smarkm	exit 0 ;;
46055682Smarkm    m88k:*:4*:R4*)
46155682Smarkm	echo m88k-motorola-sysv4
46255682Smarkm	exit 0 ;;
46355682Smarkm    m88k:*:3*:R3*)
46455682Smarkm	echo m88k-motorola-sysv3
46555682Smarkm	exit 0 ;;
46655682Smarkm    AViiON:dgux:*:*)
46755682Smarkm        # DG/UX returns AViiON for all architectures
46855682Smarkm        UNAME_PROCESSOR=`/usr/bin/uname -p`
469102644Snectar	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
47072445Sassar	then
47172445Sassar	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
47272445Sassar	       [ ${TARGET_BINARY_INTERFACE}x = x ]
47372445Sassar	    then
47455682Smarkm		echo m88k-dg-dgux${UNAME_RELEASE}
47572445Sassar	    else
47672445Sassar		echo m88k-dg-dguxbcs${UNAME_RELEASE}
47772445Sassar	    fi
47855682Smarkm	else
47972445Sassar	    echo i586-dg-dgux${UNAME_RELEASE}
48055682Smarkm	fi
48155682Smarkm 	exit 0 ;;
48255682Smarkm    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
48355682Smarkm	echo m88k-dolphin-sysv3
48455682Smarkm	exit 0 ;;
48555682Smarkm    M88*:*:R3*:*)
48655682Smarkm	# Delta 88k system running SVR3
48755682Smarkm	echo m88k-motorola-sysv3
48855682Smarkm	exit 0 ;;
48955682Smarkm    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
49055682Smarkm	echo m88k-tektronix-sysv3
49155682Smarkm	exit 0 ;;
49255682Smarkm    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
49355682Smarkm	echo m68k-tektronix-bsd
49455682Smarkm	exit 0 ;;
49555682Smarkm    *:IRIX*:*:*)
49655682Smarkm	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
49755682Smarkm	exit 0 ;;
49855682Smarkm    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
49955682Smarkm	echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
50055682Smarkm	exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
50190926Snectar    i*86:AIX:*:*)
50255682Smarkm	echo i386-ibm-aix
50355682Smarkm	exit 0 ;;
50490926Snectar    ia64:AIX:*:*)
50590926Snectar	if [ -x /usr/bin/oslevel ] ; then
50690926Snectar		IBM_REV=`/usr/bin/oslevel`
50790926Snectar	else
50890926Snectar		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
50990926Snectar	fi
51090926Snectar	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
51190926Snectar	exit 0 ;;
51255682Smarkm    *:AIX:2:3)
51355682Smarkm	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
51490926Snectar		eval $set_cc_for_build
51555682Smarkm		sed 's/^		//' << EOF >$dummy.c
51655682Smarkm		#include <sys/systemcfg.h>
51755682Smarkm
51855682Smarkm		main()
51955682Smarkm			{
52055682Smarkm			if (!__power_pc())
52155682Smarkm				exit(1);
52255682Smarkm			puts("powerpc-ibm-aix3.2.5");
52355682Smarkm			exit(0);
52455682Smarkm			}
52555682SmarkmEOF
526127808Snectar		$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
52755682Smarkm		echo rs6000-ibm-aix3.2.5
52855682Smarkm	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
52955682Smarkm		echo rs6000-ibm-aix3.2.4
53055682Smarkm	else
53155682Smarkm		echo rs6000-ibm-aix3.2
53255682Smarkm	fi
53355682Smarkm	exit 0 ;;
53490926Snectar    *:AIX:*:[45])
535102644Snectar	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
53690926Snectar	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
53755682Smarkm		IBM_ARCH=rs6000
53855682Smarkm	else
53955682Smarkm		IBM_ARCH=powerpc
54055682Smarkm	fi
54155682Smarkm	if [ -x /usr/bin/oslevel ] ; then
54255682Smarkm		IBM_REV=`/usr/bin/oslevel`
54355682Smarkm	else
54490926Snectar		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
54555682Smarkm	fi
54655682Smarkm	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
54755682Smarkm	exit 0 ;;
54855682Smarkm    *:AIX:*:*)
54955682Smarkm	echo rs6000-ibm-aix
55055682Smarkm	exit 0 ;;
55155682Smarkm    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
55255682Smarkm	echo romp-ibm-bsd4.4
55355682Smarkm	exit 0 ;;
55472445Sassar    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
55555682Smarkm	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
55655682Smarkm	exit 0 ;;                           # report: romp-ibm BSD 4.3
55755682Smarkm    *:BOSX:*:*)
55855682Smarkm	echo rs6000-bull-bosx
55955682Smarkm	exit 0 ;;
56055682Smarkm    DPX/2?00:B.O.S.:*:*)
56155682Smarkm	echo m68k-bull-sysv3
56255682Smarkm	exit 0 ;;
56355682Smarkm    9000/[34]??:4.3bsd:1.*:*)
56455682Smarkm	echo m68k-hp-bsd
56555682Smarkm	exit 0 ;;
56655682Smarkm    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
56755682Smarkm	echo m68k-hp-bsd4.4
56855682Smarkm	exit 0 ;;
56955682Smarkm    9000/[34678]??:HP-UX:*:*)
57090926Snectar	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
57155682Smarkm	case "${UNAME_MACHINE}" in
57255682Smarkm	    9000/31? )            HP_ARCH=m68000 ;;
57355682Smarkm	    9000/[34]?? )         HP_ARCH=m68k ;;
57472445Sassar	    9000/[678][0-9][0-9])
575102644Snectar		if [ -x /usr/bin/getconf ]; then
576102644Snectar		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
57790926Snectar                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
57890926Snectar                    case "${sc_cpu_version}" in
57990926Snectar                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
58090926Snectar                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
58190926Snectar                      532)                      # CPU_PA_RISC2_0
58290926Snectar                        case "${sc_kernel_bits}" in
58390926Snectar                          32) HP_ARCH="hppa2.0n" ;;
58490926Snectar                          64) HP_ARCH="hppa2.0w" ;;
585102644Snectar			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
58690926Snectar                        esac ;;
58790926Snectar                    esac
588102644Snectar		fi
589102644Snectar		if [ "${HP_ARCH}" = "" ]; then
590102644Snectar		    eval $set_cc_for_build
591102644Snectar		    sed 's/^              //' << EOF >$dummy.c
59272445Sassar
59372445Sassar              #define _HPUX_SOURCE
59455682Smarkm              #include <stdlib.h>
59555682Smarkm              #include <unistd.h>
59672445Sassar
59755682Smarkm              int main ()
59855682Smarkm              {
59955682Smarkm              #if defined(_SC_KERNEL_BITS)
60055682Smarkm                  long bits = sysconf(_SC_KERNEL_BITS);
60172445Sassar              #endif
60255682Smarkm                  long cpu  = sysconf (_SC_CPU_VERSION);
60372445Sassar
60472445Sassar                  switch (cpu)
60555682Smarkm              	{
60655682Smarkm              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
60755682Smarkm              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
60872445Sassar              	case CPU_PA_RISC2_0:
60955682Smarkm              #if defined(_SC_KERNEL_BITS)
61072445Sassar              	    switch (bits)
61155682Smarkm              		{
61255682Smarkm              		case 64: puts ("hppa2.0w"); break;
61355682Smarkm              		case 32: puts ("hppa2.0n"); break;
61455682Smarkm              		default: puts ("hppa2.0"); break;
61555682Smarkm              		} break;
61655682Smarkm              #else  /* !defined(_SC_KERNEL_BITS) */
61755682Smarkm              	    puts ("hppa2.0"); break;
61872445Sassar              #endif
61955682Smarkm              	default: puts ("hppa1.0"); break;
62055682Smarkm              	}
62155682Smarkm                  exit (0);
62255682Smarkm              }
62355682SmarkmEOF
624127808Snectar		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
625127808Snectar		    test -z "$HP_ARCH" && HP_ARCH=hppa
626102644Snectar		fi ;;
62755682Smarkm	esac
628127808Snectar	if [ ${HP_ARCH} = "hppa2.0w" ]
629127808Snectar	then
630127808Snectar	    # avoid double evaluation of $set_cc_for_build
631127808Snectar	    test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
632127808Snectar	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
633127808Snectar	    then
634127808Snectar		HP_ARCH="hppa2.0w"
635127808Snectar	    else
636127808Snectar		HP_ARCH="hppa64"
637127808Snectar	    fi
638127808Snectar	fi
63955682Smarkm	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
64055682Smarkm	exit 0 ;;
64190926Snectar    ia64:HP-UX:*:*)
64290926Snectar	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
64390926Snectar	echo ia64-hp-hpux${HPUX_REV}
64490926Snectar	exit 0 ;;
64555682Smarkm    3050*:HI-UX:*:*)
64690926Snectar	eval $set_cc_for_build
64755682Smarkm	sed 's/^	//' << EOF >$dummy.c
64855682Smarkm	#include <unistd.h>
64955682Smarkm	int
65055682Smarkm	main ()
65155682Smarkm	{
65255682Smarkm	  long cpu = sysconf (_SC_CPU_VERSION);
65355682Smarkm	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
65455682Smarkm	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
65555682Smarkm	     results, however.  */
65655682Smarkm	  if (CPU_IS_PA_RISC (cpu))
65755682Smarkm	    {
65855682Smarkm	      switch (cpu)
65955682Smarkm		{
66055682Smarkm		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
66155682Smarkm		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
66255682Smarkm		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
66355682Smarkm		  default: puts ("hppa-hitachi-hiuxwe2"); break;
66455682Smarkm		}
66555682Smarkm	    }
66655682Smarkm	  else if (CPU_IS_HP_MC68K (cpu))
66755682Smarkm	    puts ("m68k-hitachi-hiuxwe2");
66855682Smarkm	  else puts ("unknown-hitachi-hiuxwe2");
66955682Smarkm	  exit (0);
67055682Smarkm	}
67155682SmarkmEOF
672127808Snectar	$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
67355682Smarkm	echo unknown-hitachi-hiuxwe2
67455682Smarkm	exit 0 ;;
67555682Smarkm    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
67655682Smarkm	echo hppa1.1-hp-bsd
67755682Smarkm	exit 0 ;;
67855682Smarkm    9000/8??:4.3bsd:*:*)
67955682Smarkm	echo hppa1.0-hp-bsd
68055682Smarkm	exit 0 ;;
68190926Snectar    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
68272445Sassar	echo hppa1.0-hp-mpeix
68372445Sassar	exit 0 ;;
68455682Smarkm    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
68555682Smarkm	echo hppa1.1-hp-osf
68655682Smarkm	exit 0 ;;
68755682Smarkm    hp8??:OSF1:*:*)
68855682Smarkm	echo hppa1.0-hp-osf
68955682Smarkm	exit 0 ;;
69090926Snectar    i*86:OSF1:*:*)
69155682Smarkm	if [ -x /usr/sbin/sysversion ] ; then
69255682Smarkm	    echo ${UNAME_MACHINE}-unknown-osf1mk
69355682Smarkm	else
69455682Smarkm	    echo ${UNAME_MACHINE}-unknown-osf1
69555682Smarkm	fi
69655682Smarkm	exit 0 ;;
69755682Smarkm    parisc*:Lites*:*:*)
69855682Smarkm	echo hppa1.1-hp-lites
69955682Smarkm	exit 0 ;;
70055682Smarkm    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
70155682Smarkm	echo c1-convex-bsd
70255682Smarkm        exit 0 ;;
70355682Smarkm    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
70455682Smarkm	if getsysinfo -f scalar_acc
70555682Smarkm	then echo c32-convex-bsd
70655682Smarkm	else echo c2-convex-bsd
70755682Smarkm	fi
70855682Smarkm        exit 0 ;;
70955682Smarkm    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
71055682Smarkm	echo c34-convex-bsd
71155682Smarkm        exit 0 ;;
71255682Smarkm    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
71355682Smarkm	echo c38-convex-bsd
71455682Smarkm        exit 0 ;;
71555682Smarkm    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
71655682Smarkm	echo c4-convex-bsd
71755682Smarkm        exit 0 ;;
71855682Smarkm    CRAY*Y-MP:*:*:*)
71990926Snectar	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
72055682Smarkm	exit 0 ;;
72155682Smarkm    CRAY*[A-Z]90:*:*:*)
72255682Smarkm	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
72355682Smarkm	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
72490926Snectar	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
72590926Snectar	      -e 's/\.[^.]*$/.X/'
72655682Smarkm	exit 0 ;;
72755682Smarkm    CRAY*TS:*:*:*)
72872445Sassar	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
72955682Smarkm	exit 0 ;;
73090926Snectar    CRAY*T3E:*:*:*)
73190926Snectar	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
73290926Snectar	exit 0 ;;
73372445Sassar    CRAY*SV1:*:*:*)
734102644Snectar	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
73572445Sassar	exit 0 ;;
736127808Snectar    *:UNICOS/mp:*:*)
737127808Snectar	echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
738127808Snectar	exit 0 ;;
73990926Snectar    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
74090926Snectar	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
74172445Sassar        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
74255682Smarkm        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
74390926Snectar        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
74455682Smarkm        exit 0 ;;
74590926Snectar    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
74672445Sassar	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
74772445Sassar	exit 0 ;;
74855682Smarkm    sparc*:BSD/OS:*:*)
74955682Smarkm	echo sparc-unknown-bsdi${UNAME_RELEASE}
75055682Smarkm	exit 0 ;;
75155682Smarkm    *:BSD/OS:*:*)
75255682Smarkm	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
75355682Smarkm	exit 0 ;;
754127808Snectar    *:FreeBSD:*:*|*:GNU/FreeBSD:*:*)
755127808Snectar	# Determine whether the default compiler uses glibc.
756127808Snectar	eval $set_cc_for_build
757127808Snectar	sed 's/^	//' << EOF >$dummy.c
758127808Snectar	#include <features.h>
759127808Snectar	#if __GLIBC__ >= 2
760127808Snectar	LIBC=gnu
761127808Snectar	#else
762127808Snectar	LIBC=
763127808Snectar	#endif
764127808SnectarEOF
765127808Snectar	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
766127808Snectar	# GNU/FreeBSD systems have a "k" prefix to indicate we are using
767127808Snectar	# FreeBSD's kernel, but not the complete OS.
768127808Snectar	case ${LIBC} in gnu) kernel_only='k' ;; esac
769127808Snectar	echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
77055682Smarkm	exit 0 ;;
77155682Smarkm    i*:CYGWIN*:*)
77255682Smarkm	echo ${UNAME_MACHINE}-pc-cygwin
77355682Smarkm	exit 0 ;;
77455682Smarkm    i*:MINGW*:*)
77555682Smarkm	echo ${UNAME_MACHINE}-pc-mingw32
77655682Smarkm	exit 0 ;;
77772445Sassar    i*:PW*:*)
77872445Sassar	echo ${UNAME_MACHINE}-pc-pw32
77972445Sassar	exit 0 ;;
780127808Snectar    x86:Interix*:[34]*)
781127808Snectar	echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
782102644Snectar	exit 0 ;;
783127808Snectar    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
784127808Snectar	echo i${UNAME_MACHINE}-pc-mks
785127808Snectar	exit 0 ;;
78672445Sassar    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
78772445Sassar	# How do we know it's Interix rather than the generic POSIX subsystem?
78872445Sassar	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
78972445Sassar	# UNAME_MACHINE based on the output of uname instead of i386?
790127808Snectar	echo i586-pc-interix
79172445Sassar	exit 0 ;;
79272445Sassar    i*:UWIN*:*)
79372445Sassar	echo ${UNAME_MACHINE}-pc-uwin
79472445Sassar	exit 0 ;;
79555682Smarkm    p*:CYGWIN*:*)
79655682Smarkm	echo powerpcle-unknown-cygwin
79755682Smarkm	exit 0 ;;
79855682Smarkm    prep*:SunOS:5.*:*)
79955682Smarkm	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
80055682Smarkm	exit 0 ;;
80155682Smarkm    *:GNU:*:*)
80255682Smarkm	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
80355682Smarkm	exit 0 ;;
80472445Sassar    i*86:Minix:*:*)
80572445Sassar	echo ${UNAME_MACHINE}-pc-minix
80672445Sassar	exit 0 ;;
80790926Snectar    arm*:Linux:*:*)
80890926Snectar	echo ${UNAME_MACHINE}-unknown-linux-gnu
80990926Snectar	exit 0 ;;
810127808Snectar    cris:Linux:*:*)
811127808Snectar	echo cris-axis-linux-gnu
812127808Snectar	exit 0 ;;
81390926Snectar    ia64:Linux:*:*)
814102644Snectar	echo ${UNAME_MACHINE}-unknown-linux-gnu
81590926Snectar	exit 0 ;;
81690926Snectar    m68*:Linux:*:*)
81790926Snectar	echo ${UNAME_MACHINE}-unknown-linux-gnu
81890926Snectar	exit 0 ;;
81990926Snectar    mips:Linux:*:*)
820102644Snectar	eval $set_cc_for_build
821102644Snectar	sed 's/^	//' << EOF >$dummy.c
822102644Snectar	#undef CPU
823102644Snectar	#undef mips
824102644Snectar	#undef mipsel
825102644Snectar	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
826102644Snectar	CPU=mipsel
827102644Snectar	#else
828102644Snectar	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
829102644Snectar	CPU=mips
830102644Snectar	#else
831102644Snectar	CPU=
832102644Snectar	#endif
833102644Snectar	#endif
834102644SnectarEOF
835102644Snectar	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
836127808Snectar	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
83790926Snectar	;;
838127808Snectar    mips64:Linux:*:*)
839127808Snectar	eval $set_cc_for_build
840127808Snectar	sed 's/^	//' << EOF >$dummy.c
841127808Snectar	#undef CPU
842127808Snectar	#undef mips64
843127808Snectar	#undef mips64el
844127808Snectar	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
845127808Snectar	CPU=mips64el
846127808Snectar	#else
847127808Snectar	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
848127808Snectar	CPU=mips64
849127808Snectar	#else
850127808Snectar	CPU=
851127808Snectar	#endif
852127808Snectar	#endif
853127808SnectarEOF
854127808Snectar	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
855127808Snectar	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
856127808Snectar	;;
85790926Snectar    ppc:Linux:*:*)
85890926Snectar	echo powerpc-unknown-linux-gnu
85990926Snectar	exit 0 ;;
86090926Snectar    ppc64:Linux:*:*)
86190926Snectar	echo powerpc64-unknown-linux-gnu
86290926Snectar	exit 0 ;;
86390926Snectar    alpha:Linux:*:*)
86490926Snectar	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
86590926Snectar	  EV5)   UNAME_MACHINE=alphaev5 ;;
86690926Snectar	  EV56)  UNAME_MACHINE=alphaev56 ;;
86790926Snectar	  PCA56) UNAME_MACHINE=alphapca56 ;;
86890926Snectar	  PCA57) UNAME_MACHINE=alphapca56 ;;
86990926Snectar	  EV6)   UNAME_MACHINE=alphaev6 ;;
87090926Snectar	  EV67)  UNAME_MACHINE=alphaev67 ;;
87190926Snectar	  EV68*) UNAME_MACHINE=alphaev68 ;;
87290926Snectar        esac
87390926Snectar	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
87490926Snectar	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
87590926Snectar	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
87690926Snectar	exit 0 ;;
87790926Snectar    parisc:Linux:*:* | hppa:Linux:*:*)
87890926Snectar	# Look for CPU level
87990926Snectar	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
88090926Snectar	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
88190926Snectar	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
88290926Snectar	  *)    echo hppa-unknown-linux-gnu ;;
88390926Snectar	esac
88490926Snectar	exit 0 ;;
88590926Snectar    parisc64:Linux:*:* | hppa64:Linux:*:*)
88690926Snectar	echo hppa64-unknown-linux-gnu
88790926Snectar	exit 0 ;;
88890926Snectar    s390:Linux:*:* | s390x:Linux:*:*)
88990926Snectar	echo ${UNAME_MACHINE}-ibm-linux
89090926Snectar	exit 0 ;;
891127808Snectar    sh64*:Linux:*:*)
892127808Snectar    	echo ${UNAME_MACHINE}-unknown-linux-gnu
893127808Snectar	exit 0 ;;
89490926Snectar    sh*:Linux:*:*)
89590926Snectar	echo ${UNAME_MACHINE}-unknown-linux-gnu
89690926Snectar	exit 0 ;;
89790926Snectar    sparc:Linux:*:* | sparc64:Linux:*:*)
89890926Snectar	echo ${UNAME_MACHINE}-unknown-linux-gnu
89990926Snectar	exit 0 ;;
90090926Snectar    x86_64:Linux:*:*)
90190926Snectar	echo x86_64-unknown-linux-gnu
90290926Snectar	exit 0 ;;
90390926Snectar    i*86:Linux:*:*)
90455682Smarkm	# The BFD linker knows what the default object file format is, so
90572445Sassar	# first see if it will tell us. cd to the root directory to prevent
90672445Sassar	# problems with other programs or directories called `ld' in the path.
907102644Snectar	# Set LC_ALL=C to ensure ld outputs messages in English.
908102644Snectar	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
90990926Snectar			 | sed -ne '/supported targets:/!d
91055682Smarkm				    s/[ 	][ 	]*/ /g
91190926Snectar				    s/.*supported targets: *//
91255682Smarkm				    s/ .*//
91355682Smarkm				    p'`
91490926Snectar        case "$ld_supported_targets" in
91590926Snectar	  elf32-i386)
91690926Snectar		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
91772445Sassar		;;
91890926Snectar	  a.out-i386-linux)
91972445Sassar		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
920127808Snectar		exit 0 ;;
92190926Snectar	  coff-i386)
92272445Sassar		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
92390926Snectar		exit 0 ;;
92490926Snectar	  "")
92590926Snectar		# Either a pre-BFD a.out linker (linux-gnuoldld) or
92690926Snectar		# one that does not give us useful --help.
92790926Snectar		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
92890926Snectar		exit 0 ;;
92955682Smarkm	esac
93090926Snectar	# Determine whether the default compiler is a.out or elf
93190926Snectar	eval $set_cc_for_build
932102644Snectar	sed 's/^	//' << EOF >$dummy.c
933102644Snectar	#include <features.h>
934102644Snectar	#ifdef __ELF__
935102644Snectar	# ifdef __GLIBC__
936102644Snectar	#  if __GLIBC__ >= 2
937102644Snectar	LIBC=gnu
938102644Snectar	#  else
939102644Snectar	LIBC=gnulibc1
940102644Snectar	#  endif
941102644Snectar	# else
942102644Snectar	LIBC=gnulibc1
943102644Snectar	# endif
944102644Snectar	#else
945102644Snectar	#ifdef __INTEL_COMPILER
946102644Snectar	LIBC=gnu
947102644Snectar	#else
948102644Snectar	LIBC=gnuaout
949102644Snectar	#endif
950102644Snectar	#endif
951127808Snectar	#ifdef __dietlibc__
952127808Snectar	LIBC=dietlibc
953127808Snectar	#endif
95455682SmarkmEOF
955102644Snectar	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
956102644Snectar	test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
95790926Snectar	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
95890926Snectar	;;
95990926Snectar    i*86:DYNIX/ptx:4*:*)
96090926Snectar	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
96190926Snectar	# earlier versions are messed up and put the nodename in both
96290926Snectar	# sysname and nodename.
96355682Smarkm	echo i386-sequent-sysv4
96455682Smarkm	exit 0 ;;
96590926Snectar    i*86:UNIX_SV:4.2MP:2.*)
96655682Smarkm        # Unixware is an offshoot of SVR4, but it has its own version
96755682Smarkm        # number series starting with 2...
96855682Smarkm        # I am not positive that other SVR4 systems won't match this,
96955682Smarkm	# I just have to hope.  -- rms.
97055682Smarkm        # Use sysv4.2uw... so that sysv4* matches it.
97155682Smarkm	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
97255682Smarkm	exit 0 ;;
973127808Snectar    i*86:OS/2:*:*)
974127808Snectar	# If we were able to find `uname', then EMX Unix compatibility
975127808Snectar	# is probably installed.
976127808Snectar	echo ${UNAME_MACHINE}-pc-os2-emx
977127808Snectar	exit 0 ;;
978127808Snectar    i*86:XTS-300:*:STOP)
979127808Snectar	echo ${UNAME_MACHINE}-unknown-stop
980127808Snectar	exit 0 ;;
981127808Snectar    i*86:atheos:*:*)
982127808Snectar	echo ${UNAME_MACHINE}-unknown-atheos
983127808Snectar	exit 0 ;;
984127808Snectar    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
985127808Snectar	echo i386-unknown-lynxos${UNAME_RELEASE}
986127808Snectar	exit 0 ;;
987127808Snectar    i*86:*DOS:*:*)
988127808Snectar	echo ${UNAME_MACHINE}-pc-msdosdjgpp
989127808Snectar	exit 0 ;;
99090926Snectar    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
99172445Sassar	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
99255682Smarkm	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
99372445Sassar		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
99455682Smarkm	else
99572445Sassar		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
99655682Smarkm	fi
99755682Smarkm	exit 0 ;;
99890926Snectar    i*86:*:5:[78]*)
99990926Snectar	case `/bin/uname -X | grep "^Machine"` in
100090926Snectar	    *486*)	     UNAME_MACHINE=i486 ;;
100190926Snectar	    *Pentium)	     UNAME_MACHINE=i586 ;;
100290926Snectar	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
100390926Snectar	esac
100490926Snectar	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
100572445Sassar	exit 0 ;;
100690926Snectar    i*86:*:3.2:*)
100755682Smarkm	if test -f /usr/options/cb.name; then
100855682Smarkm		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
100955682Smarkm		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
101055682Smarkm	elif /bin/uname -X 2>/dev/null >/dev/null ; then
1011127808Snectar		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1012127808Snectar		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1013127808Snectar		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
101455682Smarkm			&& UNAME_MACHINE=i586
1015127808Snectar		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
101672445Sassar			&& UNAME_MACHINE=i686
1017127808Snectar		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
101872445Sassar			&& UNAME_MACHINE=i686
101955682Smarkm		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
102055682Smarkm	else
102155682Smarkm		echo ${UNAME_MACHINE}-pc-sysv32
102255682Smarkm	fi
102355682Smarkm	exit 0 ;;
102455682Smarkm    pc:*:*:*)
102572445Sassar	# Left here for compatibility:
102655682Smarkm        # uname -m prints for DJGPP always 'pc', but it prints nothing about
102755682Smarkm        # the processor, so we play safe by assuming i386.
102855682Smarkm	echo i386-pc-msdosdjgpp
102955682Smarkm        exit 0 ;;
103055682Smarkm    Intel:Mach:3*:*)
103155682Smarkm	echo i386-pc-mach3
103255682Smarkm	exit 0 ;;
103355682Smarkm    paragon:*:*:*)
103455682Smarkm	echo i860-intel-osf1
103555682Smarkm	exit 0 ;;
103655682Smarkm    i860:*:4.*:*) # i860-SVR4
103755682Smarkm	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
103855682Smarkm	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
103955682Smarkm	else # Add other i860-SVR4 vendors below as they are discovered.
104055682Smarkm	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
104155682Smarkm	fi
104255682Smarkm	exit 0 ;;
104355682Smarkm    mini*:CTIX:SYS*5:*)
104455682Smarkm	# "miniframe"
104555682Smarkm	echo m68010-convergent-sysv
104655682Smarkm	exit 0 ;;
1047127808Snectar    mc68k:UNIX:SYSTEM5:3.51m)
1048127808Snectar	echo m68k-convergent-sysv
1049127808Snectar	exit 0 ;;
1050127808Snectar    M680?0:D-NIX:5.3:*)
1051127808Snectar	echo m68k-diab-dnix
1052127808Snectar	exit 0 ;;
105355682Smarkm    M68*:*:R3V[567]*:*)
105455682Smarkm	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
1055127808Snectar    3[34]??:*: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)
105655682Smarkm	OS_REL=''
105755682Smarkm	test -r /etc/.relid \
105855682Smarkm	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
105955682Smarkm	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
106055682Smarkm	  && echo i486-ncr-sysv4.3${OS_REL} && exit 0
106155682Smarkm	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
106255682Smarkm	  && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
106355682Smarkm    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
106455682Smarkm        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
106555682Smarkm          && echo i486-ncr-sysv4 && exit 0 ;;
106690926Snectar    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
106755682Smarkm	echo m68k-unknown-lynxos${UNAME_RELEASE}
106855682Smarkm	exit 0 ;;
106955682Smarkm    mc68030:UNIX_System_V:4.*:*)
107055682Smarkm	echo m68k-atari-sysv4
107155682Smarkm	exit 0 ;;
107255682Smarkm    TSUNAMI:LynxOS:2.*:*)
107355682Smarkm	echo sparc-unknown-lynxos${UNAME_RELEASE}
107455682Smarkm	exit 0 ;;
107590926Snectar    rs6000:LynxOS:2.*:*)
107655682Smarkm	echo rs6000-unknown-lynxos${UNAME_RELEASE}
107755682Smarkm	exit 0 ;;
107890926Snectar    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
107990926Snectar	echo powerpc-unknown-lynxos${UNAME_RELEASE}
108090926Snectar	exit 0 ;;
108155682Smarkm    SM[BE]S:UNIX_SV:*:*)
108255682Smarkm	echo mips-dde-sysv${UNAME_RELEASE}
108355682Smarkm	exit 0 ;;
108472445Sassar    RM*:ReliantUNIX-*:*:*)
108572445Sassar	echo mips-sni-sysv4
108672445Sassar	exit 0 ;;
108755682Smarkm    RM*:SINIX-*:*:*)
108855682Smarkm	echo mips-sni-sysv4
108955682Smarkm	exit 0 ;;
109055682Smarkm    *:SINIX-*:*:*)
109155682Smarkm	if uname -p 2>/dev/null >/dev/null ; then
109255682Smarkm		UNAME_MACHINE=`(uname -p) 2>/dev/null`
109355682Smarkm		echo ${UNAME_MACHINE}-sni-sysv4
109455682Smarkm	else
109555682Smarkm		echo ns32k-sni-sysv
109655682Smarkm	fi
109755682Smarkm	exit 0 ;;
109890926Snectar    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
109990926Snectar                      # says <Richard.M.Bartel@ccMail.Census.GOV>
110055682Smarkm        echo i586-unisys-sysv4
110155682Smarkm        exit 0 ;;
110255682Smarkm    *:UNIX_System_V:4*:FTX*)
110355682Smarkm	# From Gerald Hewes <hewes@openmarket.com>.
110455682Smarkm	# How about differentiating between stratus architectures? -djm
110555682Smarkm	echo hppa1.1-stratus-sysv4
110655682Smarkm	exit 0 ;;
110755682Smarkm    *:*:*:FTX*)
110855682Smarkm	# From seanf@swdc.stratus.com.
110955682Smarkm	echo i860-stratus-sysv4
111055682Smarkm	exit 0 ;;
111190926Snectar    *:VOS:*:*)
111290926Snectar	# From Paul.Green@stratus.com.
111390926Snectar	echo hppa1.1-stratus-vos
111490926Snectar	exit 0 ;;
111555682Smarkm    mc68*:A/UX:*:*)
111655682Smarkm	echo m68k-apple-aux${UNAME_RELEASE}
111755682Smarkm	exit 0 ;;
111872445Sassar    news*:NEWS-OS:6*:*)
111955682Smarkm	echo mips-sony-newsos6
112055682Smarkm	exit 0 ;;
112172445Sassar    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
112255682Smarkm	if [ -d /usr/nec ]; then
112355682Smarkm	        echo mips-nec-sysv${UNAME_RELEASE}
112455682Smarkm	else
112555682Smarkm	        echo mips-unknown-sysv${UNAME_RELEASE}
112655682Smarkm	fi
112755682Smarkm        exit 0 ;;
112855682Smarkm    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
112955682Smarkm	echo powerpc-be-beos
113055682Smarkm	exit 0 ;;
113155682Smarkm    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
113255682Smarkm	echo powerpc-apple-beos
113355682Smarkm	exit 0 ;;
113455682Smarkm    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
113555682Smarkm	echo i586-pc-beos
113655682Smarkm	exit 0 ;;
113755682Smarkm    SX-4:SUPER-UX:*:*)
113855682Smarkm	echo sx4-nec-superux${UNAME_RELEASE}
113955682Smarkm	exit 0 ;;
114055682Smarkm    SX-5:SUPER-UX:*:*)
114155682Smarkm	echo sx5-nec-superux${UNAME_RELEASE}
114255682Smarkm	exit 0 ;;
1143127808Snectar    SX-6:SUPER-UX:*:*)
1144127808Snectar	echo sx6-nec-superux${UNAME_RELEASE}
1145127808Snectar	exit 0 ;;
114655682Smarkm    Power*:Rhapsody:*:*)
114755682Smarkm	echo powerpc-apple-rhapsody${UNAME_RELEASE}
114855682Smarkm	exit 0 ;;
114955682Smarkm    *:Rhapsody:*:*)
115055682Smarkm	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
115155682Smarkm	exit 0 ;;
115272445Sassar    *:Darwin:*:*)
1153127808Snectar	case `uname -p` in
1154127808Snectar	    *86) UNAME_PROCESSOR=i686 ;;
1155127808Snectar	    powerpc) UNAME_PROCESSOR=powerpc ;;
1156127808Snectar	esac
1157127808Snectar	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
115872445Sassar	exit 0 ;;
115972445Sassar    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1160102644Snectar	UNAME_PROCESSOR=`uname -p`
1161102644Snectar	if test "$UNAME_PROCESSOR" = "x86"; then
1162102644Snectar		UNAME_PROCESSOR=i386
116372445Sassar		UNAME_MACHINE=pc
116472445Sassar	fi
1165102644Snectar	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
116672445Sassar	exit 0 ;;
116772445Sassar    *:QNX:*:4*)
116872445Sassar	echo i386-pc-qnx
116972445Sassar	exit 0 ;;
1170127808Snectar    NSR-[DGKLNPTVWY]:NONSTOP_KERNEL:*:*)
117172445Sassar	echo nsr-tandem-nsk${UNAME_RELEASE}
117272445Sassar	exit 0 ;;
117390926Snectar    *:NonStop-UX:*:*)
117490926Snectar	echo mips-compaq-nonstopux
117590926Snectar	exit 0 ;;
117672445Sassar    BS2000:POSIX*:*:*)
117772445Sassar	echo bs2000-siemens-sysv
117872445Sassar	exit 0 ;;
117972445Sassar    DS/*:UNIX_System_V:*:*)
118072445Sassar	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
118172445Sassar	exit 0 ;;
118272445Sassar    *:Plan9:*:*)
118372445Sassar	# "uname -m" is not consistent, so use $cputype instead. 386
118472445Sassar	# is converted to i386 for consistency with other x86
118572445Sassar	# operating systems.
118672445Sassar	if test "$cputype" = "386"; then
118772445Sassar	    UNAME_MACHINE=i386
118872445Sassar	else
118972445Sassar	    UNAME_MACHINE="$cputype"
119072445Sassar	fi
119172445Sassar	echo ${UNAME_MACHINE}-unknown-plan9
119272445Sassar	exit 0 ;;
119390926Snectar    *:TOPS-10:*:*)
119490926Snectar	echo pdp10-unknown-tops10
119590926Snectar	exit 0 ;;
119690926Snectar    *:TENEX:*:*)
119790926Snectar	echo pdp10-unknown-tenex
119890926Snectar	exit 0 ;;
119990926Snectar    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
120090926Snectar	echo pdp10-dec-tops20
120190926Snectar	exit 0 ;;
120290926Snectar    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
120390926Snectar	echo pdp10-xkl-tops20
120490926Snectar	exit 0 ;;
120590926Snectar    *:TOPS-20:*:*)
120690926Snectar	echo pdp10-unknown-tops20
120790926Snectar	exit 0 ;;
120890926Snectar    *:ITS:*:*)
120990926Snectar	echo pdp10-unknown-its
121090926Snectar	exit 0 ;;
1211127808Snectar    SEI:*:*:SEIUX)
1212127808Snectar        echo mips-sei-seiux${UNAME_RELEASE}
121390926Snectar	exit 0 ;;
121455682Smarkmesac
121555682Smarkm
121655682Smarkm#echo '(No uname command or uname output not recognized.)' 1>&2
121755682Smarkm#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
121855682Smarkm
121990926Snectareval $set_cc_for_build
122055682Smarkmcat >$dummy.c <<EOF
122155682Smarkm#ifdef _SEQUENT_
122255682Smarkm# include <sys/types.h>
122355682Smarkm# include <sys/utsname.h>
122455682Smarkm#endif
122555682Smarkmmain ()
122655682Smarkm{
122755682Smarkm#if defined (sony)
122855682Smarkm#if defined (MIPSEB)
122955682Smarkm  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
123055682Smarkm     I don't know....  */
123155682Smarkm  printf ("mips-sony-bsd\n"); exit (0);
123255682Smarkm#else
123355682Smarkm#include <sys/param.h>
123455682Smarkm  printf ("m68k-sony-newsos%s\n",
123555682Smarkm#ifdef NEWSOS4
123655682Smarkm          "4"
123755682Smarkm#else
123855682Smarkm	  ""
123955682Smarkm#endif
124055682Smarkm         ); exit (0);
124155682Smarkm#endif
124255682Smarkm#endif
124355682Smarkm
124455682Smarkm#if defined (__arm) && defined (__acorn) && defined (__unix)
124555682Smarkm  printf ("arm-acorn-riscix"); exit (0);
124655682Smarkm#endif
124755682Smarkm
124855682Smarkm#if defined (hp300) && !defined (hpux)
124955682Smarkm  printf ("m68k-hp-bsd\n"); exit (0);
125055682Smarkm#endif
125155682Smarkm
125255682Smarkm#if defined (NeXT)
125355682Smarkm#if !defined (__ARCHITECTURE__)
125455682Smarkm#define __ARCHITECTURE__ "m68k"
125555682Smarkm#endif
125655682Smarkm  int version;
125755682Smarkm  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
125855682Smarkm  if (version < 4)
125955682Smarkm    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
126055682Smarkm  else
126155682Smarkm    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
126255682Smarkm  exit (0);
126355682Smarkm#endif
126455682Smarkm
126555682Smarkm#if defined (MULTIMAX) || defined (n16)
126655682Smarkm#if defined (UMAXV)
126755682Smarkm  printf ("ns32k-encore-sysv\n"); exit (0);
126855682Smarkm#else
126955682Smarkm#if defined (CMU)
127055682Smarkm  printf ("ns32k-encore-mach\n"); exit (0);
127155682Smarkm#else
127255682Smarkm  printf ("ns32k-encore-bsd\n"); exit (0);
127355682Smarkm#endif
127455682Smarkm#endif
127555682Smarkm#endif
127655682Smarkm
127755682Smarkm#if defined (__386BSD__)
127855682Smarkm  printf ("i386-pc-bsd\n"); exit (0);
127955682Smarkm#endif
128055682Smarkm
128155682Smarkm#if defined (sequent)
128255682Smarkm#if defined (i386)
128355682Smarkm  printf ("i386-sequent-dynix\n"); exit (0);
128455682Smarkm#endif
128555682Smarkm#if defined (ns32000)
128655682Smarkm  printf ("ns32k-sequent-dynix\n"); exit (0);
128755682Smarkm#endif
128855682Smarkm#endif
128955682Smarkm
129055682Smarkm#if defined (_SEQUENT_)
129155682Smarkm    struct utsname un;
129255682Smarkm
129355682Smarkm    uname(&un);
129455682Smarkm
129555682Smarkm    if (strncmp(un.version, "V2", 2) == 0) {
129655682Smarkm	printf ("i386-sequent-ptx2\n"); exit (0);
129755682Smarkm    }
129855682Smarkm    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
129955682Smarkm	printf ("i386-sequent-ptx1\n"); exit (0);
130055682Smarkm    }
130155682Smarkm    printf ("i386-sequent-ptx\n"); exit (0);
130255682Smarkm
130355682Smarkm#endif
130455682Smarkm
130555682Smarkm#if defined (vax)
130690926Snectar# if !defined (ultrix)
130790926Snectar#  include <sys/param.h>
130890926Snectar#  if defined (BSD)
130990926Snectar#   if BSD == 43
131090926Snectar      printf ("vax-dec-bsd4.3\n"); exit (0);
131190926Snectar#   else
131290926Snectar#    if BSD == 199006
131390926Snectar      printf ("vax-dec-bsd4.3reno\n"); exit (0);
131490926Snectar#    else
131590926Snectar      printf ("vax-dec-bsd\n"); exit (0);
131690926Snectar#    endif
131790926Snectar#   endif
131890926Snectar#  else
131990926Snectar    printf ("vax-dec-bsd\n"); exit (0);
132090926Snectar#  endif
132190926Snectar# else
132290926Snectar    printf ("vax-dec-ultrix\n"); exit (0);
132390926Snectar# endif
132455682Smarkm#endif
132555682Smarkm
132655682Smarkm#if defined (alliant) && defined (i860)
132755682Smarkm  printf ("i860-alliant-bsd\n"); exit (0);
132855682Smarkm#endif
132955682Smarkm
133055682Smarkm  exit (1);
133155682Smarkm}
133255682SmarkmEOF
133355682Smarkm
1334127808Snectar$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
133555682Smarkm
133655682Smarkm# Apollos put the system type in the environment.
133755682Smarkm
133855682Smarkmtest -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
133955682Smarkm
134055682Smarkm# Convex versions that predate uname can use getsysinfo(1)
134155682Smarkm
134255682Smarkmif [ -x /usr/convex/getsysinfo ]
134355682Smarkmthen
134455682Smarkm    case `getsysinfo -f cpu_type` in
134555682Smarkm    c1*)
134655682Smarkm	echo c1-convex-bsd
134755682Smarkm	exit 0 ;;
134855682Smarkm    c2*)
134955682Smarkm	if getsysinfo -f scalar_acc
135055682Smarkm	then echo c32-convex-bsd
135155682Smarkm	else echo c2-convex-bsd
135255682Smarkm	fi
135355682Smarkm	exit 0 ;;
135455682Smarkm    c34*)
135555682Smarkm	echo c34-convex-bsd
135655682Smarkm	exit 0 ;;
135755682Smarkm    c38*)
135855682Smarkm	echo c38-convex-bsd
135955682Smarkm	exit 0 ;;
136055682Smarkm    c4*)
136155682Smarkm	echo c4-convex-bsd
136255682Smarkm	exit 0 ;;
136355682Smarkm    esac
136455682Smarkmfi
136555682Smarkm
136672445Sassarcat >&2 <<EOF
136772445Sassar$0: unable to guess system type
136855682Smarkm
136990926SnectarThis script, last modified $timestamp, has failed to recognize
137090926Snectarthe operating system you are using. It is advised that you
137190926Snectardownload the most up to date version of the config scripts from
137272445Sassar
137372445Sassar    ftp://ftp.gnu.org/pub/gnu/config/
137472445Sassar
137572445SassarIf the version you run ($0) is already up to date, please
137672445Sassarsend the following data and any information you think might be
137772445Sassarpertinent to <config-patches@gnu.org> in order to provide the needed
137872445Sassarinformation to handle your system.
137972445Sassar
138090926Snectarconfig.guess timestamp = $timestamp
138172445Sassar
138272445Sassaruname -m = `(uname -m) 2>/dev/null || echo unknown`
138372445Sassaruname -r = `(uname -r) 2>/dev/null || echo unknown`
138472445Sassaruname -s = `(uname -s) 2>/dev/null || echo unknown`
138572445Sassaruname -v = `(uname -v) 2>/dev/null || echo unknown`
138672445Sassar
138772445Sassar/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
138872445Sassar/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
138972445Sassar
139072445Sassarhostinfo               = `(hostinfo) 2>/dev/null`
139172445Sassar/bin/universe          = `(/bin/universe) 2>/dev/null`
139272445Sassar/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
139372445Sassar/bin/arch              = `(/bin/arch) 2>/dev/null`
139472445Sassar/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
139572445Sassar/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
139672445Sassar
139772445SassarUNAME_MACHINE = ${UNAME_MACHINE}
139872445SassarUNAME_RELEASE = ${UNAME_RELEASE}
139972445SassarUNAME_SYSTEM  = ${UNAME_SYSTEM}
140072445SassarUNAME_VERSION = ${UNAME_VERSION}
140172445SassarEOF
140272445Sassar
140355682Smarkmexit 1
140472445Sassar
140572445Sassar# Local variables:
140672445Sassar# eval: (add-hook 'write-file-hooks 'time-stamp)
140790926Snectar# time-stamp-start: "timestamp='"
140872445Sassar# time-stamp-format: "%:y-%02m-%02d"
140972445Sassar# time-stamp-end: "'"
141072445Sassar# End:
1411