11acd27e7Smillert#! /bin/sh
21acd27e7Smillert# Attempt to guess a canonical system name.
3af70c2dfSkettenis#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4af70c2dfSkettenis#   2000, 2001, 2002 Free Software Foundation, Inc.
5af70c2dfSkettenis
6af70c2dfSkettenistimestamp='2002-03-20'
7af70c2dfSkettenis
81acd27e7Smillert# This file is free software; you can redistribute it and/or modify it
91acd27e7Smillert# under the terms of the GNU General Public License as published by
101acd27e7Smillert# the Free Software Foundation; either version 2 of the License, or
111acd27e7Smillert# (at your option) any later version.
121acd27e7Smillert#
131acd27e7Smillert# This program is distributed in the hope that it will be useful, but
141acd27e7Smillert# WITHOUT ANY WARRANTY; without even the implied warranty of
151acd27e7Smillert# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
161acd27e7Smillert# General Public License for more details.
171acd27e7Smillert#
181acd27e7Smillert# You should have received a copy of the GNU General Public License
191acd27e7Smillert# along with this program; if not, write to the Free Software
201acd27e7Smillert# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
211acd27e7Smillert#
221acd27e7Smillert# As a special exception to the GNU General Public License, if you
231acd27e7Smillert# distribute this file as part of a program that contains a
241acd27e7Smillert# configuration script generated by Autoconf, you may include it under
251acd27e7Smillert# the same distribution terms that you use for the rest of that program.
261acd27e7Smillert
27af70c2dfSkettenis# Originally written by Per Bothner <per@bothner.com>.
28af70c2dfSkettenis# Please send patches to <config-patches@gnu.org>.  Submit a context
29af70c2dfSkettenis# diff and a properly formatted ChangeLog entry.
301acd27e7Smillert#
311acd27e7Smillert# This script attempts to guess a canonical system name similar to
321acd27e7Smillert# config.sub.  If it succeeds, it prints the system name on stdout, and
331acd27e7Smillert# exits with 0.  Otherwise, it exits with 1.
341acd27e7Smillert#
351acd27e7Smillert# The plan is that this can be called by configure scripts if you
36af70c2dfSkettenis# don't specify an explicit build system type.
371acd27e7Smillert
38af70c2dfSkettenisme=`echo "$0" | sed -e 's,.*/,,'`
39af70c2dfSkettenis
40af70c2dfSkettenisusage="\
41af70c2dfSkettenisUsage: $0 [OPTION]
42af70c2dfSkettenis
43af70c2dfSkettenisOutput the configuration name of the system \`$me' is run on.
44af70c2dfSkettenis
45af70c2dfSkettenisOperation modes:
46af70c2dfSkettenis  -h, --help         print this help, then exit
47af70c2dfSkettenis  -t, --time-stamp   print date of last modification, then exit
48af70c2dfSkettenis  -v, --version      print version number, then exit
49af70c2dfSkettenis
50af70c2dfSkettenisReport bugs and patches to <config-patches@gnu.org>."
51af70c2dfSkettenis
52af70c2dfSkettenisversion="\
53af70c2dfSkettenisGNU config.guess ($timestamp)
54af70c2dfSkettenis
55af70c2dfSkettenisOriginally written by Per Bothner.
56af70c2dfSkettenisCopyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
57af70c2dfSkettenisFree Software Foundation, Inc.
58af70c2dfSkettenis
59af70c2dfSkettenisThis is free software; see the source for copying conditions.  There is NO
60af70c2dfSketteniswarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
61af70c2dfSkettenis
62af70c2dfSkettenishelp="
63af70c2dfSkettenisTry \`$me --help' for more information."
64af70c2dfSkettenis
65af70c2dfSkettenis# Parse command line
66af70c2dfSketteniswhile test $# -gt 0 ; do
67af70c2dfSkettenis  case $1 in
68af70c2dfSkettenis    --time-stamp | --time* | -t )
69af70c2dfSkettenis       echo "$timestamp" ; exit 0 ;;
70af70c2dfSkettenis    --version | -v )
71af70c2dfSkettenis       echo "$version" ; exit 0 ;;
72af70c2dfSkettenis    --help | --h* | -h )
73af70c2dfSkettenis       echo "$usage"; exit 0 ;;
74af70c2dfSkettenis    -- )     # Stop option processing
75af70c2dfSkettenis       shift; break ;;
76af70c2dfSkettenis    - )	# Use stdin as input.
77af70c2dfSkettenis       break ;;
78af70c2dfSkettenis    -* )
79af70c2dfSkettenis       echo "$me: invalid option $1$help" >&2
80af70c2dfSkettenis       exit 1 ;;
81af70c2dfSkettenis    * )
82af70c2dfSkettenis       break ;;
83af70c2dfSkettenis  esac
84af70c2dfSkettenisdone
85af70c2dfSkettenis
86af70c2dfSkettenisif test $# != 0; then
87af70c2dfSkettenis  echo "$me: too many arguments$help" >&2
88af70c2dfSkettenis  exit 1
89af70c2dfSkettenisfi
90af70c2dfSkettenis
91af70c2dfSkettenis
92af70c2dfSkettenisdummy=dummy-$$
93af70c2dfSkettenistrap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15
94af70c2dfSkettenis
95af70c2dfSkettenis# CC_FOR_BUILD -- compiler used by this script.
96af70c2dfSkettenis# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
97af70c2dfSkettenis# use `HOST_CC' if defined, but it is deprecated.
98af70c2dfSkettenis
99af70c2dfSkettenisset_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in
100af70c2dfSkettenis ,,)    echo "int dummy(){}" > $dummy.c ;
101af70c2dfSkettenis	for c in cc gcc c89 c99 ; do
102af70c2dfSkettenis	  ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ;
103af70c2dfSkettenis	  if test $? = 0 ; then
104af70c2dfSkettenis	     CC_FOR_BUILD="$c"; break ;
105af70c2dfSkettenis	  fi ;
106af70c2dfSkettenis	done ;
107af70c2dfSkettenis	rm -f $dummy.c $dummy.o $dummy.rel ;
1081acd27e7Smillert	if test x"$CC_FOR_BUILD" = x ; then
109af70c2dfSkettenis	  CC_FOR_BUILD=no_compiler_found ;
1101acd27e7Smillert	fi
111af70c2dfSkettenis	;;
112af70c2dfSkettenis ,,*)   CC_FOR_BUILD=$CC ;;
113af70c2dfSkettenis ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
114af70c2dfSkettenisesac'
1151acd27e7Smillert
1161acd27e7Smillert# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
117af70c2dfSkettenis# (ghazi@noc.rutgers.edu 1994-08-24)
1181acd27e7Smillertif (test -f /.attbin/uname) >/dev/null 2>&1 ; then
1191acd27e7Smillert	PATH=$PATH:/.attbin ; export PATH
120af70c2dfSketteniselif (test -f /usr/5bin/uname) >/dev/null 2>&1 ; then	# bash
1211acd27e7Smillert	PATH=$PATH:/usr/5bin
1221acd27e7Smillertfi
1231acd27e7Smillert
124af70c2dfSkettenisUNAME=`(uname) 2>/dev/null` || UNAME=unknown	# bash
1251acd27e7SmillertUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
1261acd27e7SmillertUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
1271acd27e7SmillertUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
1281acd27e7SmillertUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
1291acd27e7Smillert
1301acd27e7Smillert# Note: order is significant - the case branches are not exclusive.
1311acd27e7Smillert
1321acd27e7Smillertcase "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
133af70c2dfSkettenis    # NOTE -- begin cases added for bash (mostly legacy) -- NOTE
1341acd27e7Smillert    mac68k:machten:*:*)
1351acd27e7Smillert	echo mac68k-apple-machten${UNAME_RELEASE}
1361acd27e7Smillert	exit 0 ;;
1371acd27e7Smillert    concurrent*:*:*:*)
1381acd27e7Smillert	if test "`(/bin/universe) 2>/dev/null`" = att ; then
1391acd27e7Smillert		echo concurrent-concurrent-sysv3
1401acd27e7Smillert	else
1411acd27e7Smillert		echo concurrent-concurrent-bsd
1421acd27e7Smillert	fi
1431acd27e7Smillert	exit 0 ;;
1441acd27e7Smillert    ppc*:SunOS:5.*:*)
1451acd27e7Smillert	echo ppc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
1461acd27e7Smillert	exit 0 ;;
1471acd27e7Smillert    sparc:UNIX_SV:4.*:*)
1481acd27e7Smillert	echo sparc-unknown-sysv${UNAME_RELEASE}
1491acd27e7Smillert	exit 0 ;;
1501acd27e7Smillert    mips:UNIX_SV:4.*:*)
1511acd27e7Smillert	echo mips-mips-sysv${UNAME_RELEASE}
1521acd27e7Smillert	exit 0 ;;
1531acd27e7Smillert    mips:OSF*1:*:*)
1541acd27e7Smillert	echo mips-mips-osf1
1551acd27e7Smillert	exit 0 ;;
1561acd27e7Smillert    mips:4.4BSD:*:*)
1571acd27e7Smillert	echo mips-mips-bsd4.4
1581acd27e7Smillert	exit 0 ;;
159af70c2dfSkettenis    MIS*:SMP_DC.OSx:*:dcosx)	# not the same as below
160af70c2dfSkettenis	echo pyramid-pyramid-sysv4
1611acd27e7Smillert	exit 0 ;;
1621acd27e7Smillert    news*:NEWS*:*:*)
1631acd27e7Smillert	echo mips-sony-newsos${UNAME_RELEASE}
1641acd27e7Smillert	exit 0 ;;
1651acd27e7Smillert    *370:AIX:*:*)
166af70c2dfSkettenis	echo ibm370-ibm-aix${UNAME_RELEASE}
1671acd27e7Smillert	exit 0 ;;
1681acd27e7Smillert    ksr1:OSF*1:*:*)
1691acd27e7Smillert	echo ksr1-ksr-osf1
1701acd27e7Smillert	exit 0 ;;
1711acd27e7Smillert    esa:OSF*1:*:* | ESA:OSF*:*:*)
1721acd27e7Smillert	echo esa-ibm-osf1
1731acd27e7Smillert	exit 0 ;;
1741acd27e7Smillert    DNP*:DNIX:*:*)
1751acd27e7Smillert	echo m68k-dnix-sysv
1761acd27e7Smillert	exit 0 ;;
1771acd27e7Smillert    *3b2*:*:*:*)
1781acd27e7Smillert	echo we32k-att-sysv3
1791acd27e7Smillert	exit 0 ;;
180af70c2dfSkettenis    Alpha*:Windows_NT:*:SP*)
1811acd27e7Smillert	echo alpha-pc-opennt
1821acd27e7Smillert	exit 0 ;;
183af70c2dfSkettenis    *:Windows_NT:*:SP*)
184af70c2dfSkettenis	echo i386-pc-opennt
1851acd27e7Smillert	exit 0 ;;
186af70c2dfSkettenis
187af70c2dfSkettenis    # NOTE -- end legacy cases added for bash -- NOTE
188af70c2dfSkettenis    *:NetBSD:*:*)
189af70c2dfSkettenis	# NetBSD (nbsd) targets should (where applicable) match one or
190af70c2dfSkettenis	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
191af70c2dfSkettenis	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
192af70c2dfSkettenis	# switched to ELF, *-*-netbsd* would select the old
193af70c2dfSkettenis	# object file format.  This provides both forward
194af70c2dfSkettenis	# compatibility and a consistent mechanism for selecting the
195af70c2dfSkettenis	# object file format.
196af70c2dfSkettenis	#
197af70c2dfSkettenis	# Note: NetBSD doesn't particularly care about the vendor
198af70c2dfSkettenis	# portion of the name.  We always set it to "unknown".
199af70c2dfSkettenis	sysctl="sysctl -n hw.machine_arch"
200af70c2dfSkettenis	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
201af70c2dfSkettenis	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
202af70c2dfSkettenis	case "${UNAME_MACHINE_ARCH}" in
203af70c2dfSkettenis	    arm*) machine=arm-unknown ;;
204af70c2dfSkettenis	    sh3el) machine=shl-unknown ;;
205af70c2dfSkettenis	    sh3eb) machine=sh-unknown ;;
206af70c2dfSkettenis	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
207af70c2dfSkettenis	esac
208af70c2dfSkettenis	# The Operating System including object format, if it has switched
209af70c2dfSkettenis	# to ELF recently, or will in the future.
210af70c2dfSkettenis	case "${UNAME_MACHINE_ARCH}" in
211af70c2dfSkettenis	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
212af70c2dfSkettenis		eval $set_cc_for_build
213af70c2dfSkettenis		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
214af70c2dfSkettenis			| grep __ELF__ >/dev/null
215af70c2dfSkettenis		then
216af70c2dfSkettenis		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
217af70c2dfSkettenis		    # Return netbsd for either.  FIX?
218af70c2dfSkettenis		    os=netbsd
219af70c2dfSkettenis		else
220af70c2dfSkettenis		    os=netbsdelf
221af70c2dfSkettenis		fi
222af70c2dfSkettenis		;;
223af70c2dfSkettenis	    *)
224af70c2dfSkettenis	        os=netbsd
225af70c2dfSkettenis		;;
226af70c2dfSkettenis	esac
227af70c2dfSkettenis	# The OS release
228af70c2dfSkettenis	release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
229af70c2dfSkettenis	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
230af70c2dfSkettenis	# contains redundant information, the shorter form:
231af70c2dfSkettenis	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
232af70c2dfSkettenis	echo "${machine}-${os}${release}"
233af70c2dfSkettenis	exit 0 ;;
234af70c2dfSkettenis    *:OpenBSD:*:*)
235*ee19cecdSbrad	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
236*ee19cecdSbrad	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
237af70c2dfSkettenis	exit 0 ;;
2381acd27e7Smillert    alpha:OSF1:*:*)
2391acd27e7Smillert	if test $UNAME_RELEASE = "V4.0"; then
2401acd27e7Smillert		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
2411acd27e7Smillert	fi
2421acd27e7Smillert	# A Vn.n version is a released version.
2431acd27e7Smillert	# A Tn.n version is a released field test version.
2441acd27e7Smillert	# A Xn.n version is an unreleased experimental baselevel.
2451acd27e7Smillert	# 1.2 uses "1.2" for uname -r.
2461acd27e7Smillert	cat <<EOF >$dummy.s
247af70c2dfSkettenis	.data
248af70c2dfSkettenis\$Lformat:
249af70c2dfSkettenis	.byte 37,100,45,37,120,10,0	# "%d-%x\n"
250af70c2dfSkettenis
251af70c2dfSkettenis	.text
2521acd27e7Smillert	.globl main
253af70c2dfSkettenis	.align 4
2541acd27e7Smillert	.ent main
2551acd27e7Smillertmain:
256af70c2dfSkettenis	.frame \$30,16,\$26,0
257af70c2dfSkettenis	ldgp \$29,0(\$27)
258af70c2dfSkettenis	.prologue 1
259af70c2dfSkettenis	.long 0x47e03d80 # implver \$0
260af70c2dfSkettenis	lda \$2,-1
261af70c2dfSkettenis	.long 0x47e20c21 # amask \$2,\$1
262af70c2dfSkettenis	lda \$16,\$Lformat
263af70c2dfSkettenis	mov \$0,\$17
264af70c2dfSkettenis	not \$1,\$18
265af70c2dfSkettenis	jsr \$26,printf
266af70c2dfSkettenis	ldgp \$29,0(\$26)
267af70c2dfSkettenis	mov 0,\$16
268af70c2dfSkettenis	jsr \$26,exit
2691acd27e7Smillert	.end main
2701acd27e7SmillertEOF
271af70c2dfSkettenis	eval $set_cc_for_build
2721acd27e7Smillert	$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
2731acd27e7Smillert	if test "$?" = 0 ; then
274af70c2dfSkettenis		case `./$dummy` in
275af70c2dfSkettenis			0-0)
2761acd27e7Smillert				UNAME_MACHINE="alpha"
2771acd27e7Smillert				;;
278af70c2dfSkettenis			1-0)
2791acd27e7Smillert				UNAME_MACHINE="alphaev5"
2801acd27e7Smillert				;;
281af70c2dfSkettenis			1-1)
2821acd27e7Smillert				UNAME_MACHINE="alphaev56"
2831acd27e7Smillert				;;
284af70c2dfSkettenis			1-101)
2851acd27e7Smillert				UNAME_MACHINE="alphapca56"
2861acd27e7Smillert				;;
287af70c2dfSkettenis			2-303)
2881acd27e7Smillert				UNAME_MACHINE="alphaev6"
2891acd27e7Smillert				;;
290af70c2dfSkettenis			2-307)
291af70c2dfSkettenis				UNAME_MACHINE="alphaev67"
292af70c2dfSkettenis				;;
293af70c2dfSkettenis			2-1307)
294af70c2dfSkettenis				UNAME_MACHINE="alphaev68"
295af70c2dfSkettenis				;;
2961acd27e7Smillert		esac
2971acd27e7Smillert	fi
2981acd27e7Smillert	rm -f $dummy.s $dummy
2991acd27e7Smillert	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
3001acd27e7Smillert	exit 0 ;;
3011acd27e7Smillert    Alpha\ *:Windows_NT*:*)
3021acd27e7Smillert	# How do we know it's Interix rather than the generic POSIX subsystem?
3031acd27e7Smillert	# Should we change UNAME_MACHINE based on the output of uname instead
3041acd27e7Smillert	# of the specific Alpha model?
3051acd27e7Smillert	echo alpha-pc-interix
3061acd27e7Smillert	exit 0 ;;
3071acd27e7Smillert    21064:Windows_NT:50:3)
3081acd27e7Smillert	echo alpha-dec-winnt3.5
3091acd27e7Smillert	exit 0 ;;
3101acd27e7Smillert    Amiga*:UNIX_System_V:4.0:*)
311af70c2dfSkettenis	echo m68k-unknown-sysv4
3121acd27e7Smillert	exit 0;;
3131acd27e7Smillert    *:[Aa]miga[Oo][Ss]:*:*)
3141acd27e7Smillert	echo ${UNAME_MACHINE}-unknown-amigaos
3151acd27e7Smillert	exit 0 ;;
316af70c2dfSkettenis    *:[Mm]orph[Oo][Ss]:*:*)
317af70c2dfSkettenis	echo ${UNAME_MACHINE}-unknown-morphos
3181acd27e7Smillert	exit 0 ;;
319af70c2dfSkettenis    *:OS/390:*:*)
320af70c2dfSkettenis	echo i370-ibm-openedition
3211acd27e7Smillert	exit 0 ;;
3221acd27e7Smillert    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
3231acd27e7Smillert	echo arm-acorn-riscix${UNAME_RELEASE}
3241acd27e7Smillert	exit 0;;
325af70c2dfSkettenis    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
3261acd27e7Smillert	echo hppa1.1-hitachi-hiuxmpp
3271acd27e7Smillert	exit 0;;
3281acd27e7Smillert    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
3291acd27e7Smillert	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
3301acd27e7Smillert	if test "`(/bin/universe) 2>/dev/null`" = att ; then
3311acd27e7Smillert		echo pyramid-pyramid-sysv3
3321acd27e7Smillert	else
3331acd27e7Smillert		echo pyramid-pyramid-bsd
3341acd27e7Smillert	fi
3351acd27e7Smillert	exit 0 ;;
336af70c2dfSkettenis    NILE*:*:*:dcosx)
3371acd27e7Smillert	echo pyramid-pyramid-svr4
3381acd27e7Smillert	exit 0 ;;
3391acd27e7Smillert    sun4H:SunOS:5.*:*)
3401acd27e7Smillert	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3411acd27e7Smillert	exit 0 ;;
3421acd27e7Smillert    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
3431acd27e7Smillert	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3441acd27e7Smillert	exit 0 ;;
3451acd27e7Smillert    i86pc:SunOS:5.*:*)
3461acd27e7Smillert	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3471acd27e7Smillert	exit 0 ;;
3481acd27e7Smillert    sun4*:SunOS:6*:*)
3491acd27e7Smillert	# According to config.sub, this is the proper way to canonicalize
3501acd27e7Smillert	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
3511acd27e7Smillert	# it's likely to be more like Solaris than SunOS4.
3521acd27e7Smillert	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3531acd27e7Smillert	exit 0 ;;
3541acd27e7Smillert    sun4*:SunOS:*:*)
3551acd27e7Smillert	case "`/usr/bin/arch -k`" in
3561acd27e7Smillert	    Series*|S4*)
3571acd27e7Smillert		UNAME_RELEASE=`uname -v`
3581acd27e7Smillert		;;
3591acd27e7Smillert	esac
3601acd27e7Smillert	# Japanese Language versions have a version number like `4.1.3-JL'.
3611acd27e7Smillert	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
3621acd27e7Smillert	exit 0 ;;
3631acd27e7Smillert    sun3*:SunOS:*:*)
3641acd27e7Smillert	echo m68k-sun-sunos${UNAME_RELEASE}
3651acd27e7Smillert	exit 0 ;;
3661acd27e7Smillert    sun*:*:4.2BSD:*)
367af70c2dfSkettenis	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
3681acd27e7Smillert	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
3691acd27e7Smillert	case "`/bin/arch`" in
3701acd27e7Smillert	    sun3)
3711acd27e7Smillert		echo m68k-sun-sunos${UNAME_RELEASE}
3721acd27e7Smillert		;;
3731acd27e7Smillert	    sun4)
3741acd27e7Smillert		echo sparc-sun-sunos${UNAME_RELEASE}
3751acd27e7Smillert		;;
3761acd27e7Smillert	esac
3771acd27e7Smillert	exit 0 ;;
3781acd27e7Smillert    aushp:SunOS:*:*)
3791acd27e7Smillert	echo sparc-auspex-sunos${UNAME_RELEASE}
3801acd27e7Smillert	exit 0 ;;
3811acd27e7Smillert    # The situation for MiNT is a little confusing.  The machine name
3821acd27e7Smillert    # can be virtually everything (everything which is not
3831acd27e7Smillert    # "atarist" or "atariste" at least should have a processor
3841acd27e7Smillert    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
3851acd27e7Smillert    # to the lowercase version "mint" (or "freemint").  Finally
3861acd27e7Smillert    # the system name "TOS" denotes a system which is actually not
3871acd27e7Smillert    # MiNT.  But MiNT is downward compatible to TOS, so this should
3881acd27e7Smillert    # be no problem.
3891acd27e7Smillert    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
3901acd27e7Smillert        echo m68k-atari-mint${UNAME_RELEASE}
3911acd27e7Smillert	exit 0 ;;
3921acd27e7Smillert    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
3931acd27e7Smillert	echo m68k-atari-mint${UNAME_RELEASE}
3941acd27e7Smillert        exit 0 ;;
3951acd27e7Smillert    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
3961acd27e7Smillert        echo m68k-atari-mint${UNAME_RELEASE}
3971acd27e7Smillert	exit 0 ;;
3981acd27e7Smillert    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
3991acd27e7Smillert        echo m68k-milan-mint${UNAME_RELEASE}
4001acd27e7Smillert        exit 0 ;;
4011acd27e7Smillert    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
4021acd27e7Smillert        echo m68k-hades-mint${UNAME_RELEASE}
4031acd27e7Smillert        exit 0 ;;
4041acd27e7Smillert    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
4051acd27e7Smillert        echo m68k-unknown-mint${UNAME_RELEASE}
4061acd27e7Smillert        exit 0 ;;
4071acd27e7Smillert    powerpc:machten:*:*)
4081acd27e7Smillert	echo powerpc-apple-machten${UNAME_RELEASE}
4091acd27e7Smillert	exit 0 ;;
4101acd27e7Smillert    RISC*:Mach:*:*)
4111acd27e7Smillert	echo mips-dec-mach_bsd4.3
4121acd27e7Smillert	exit 0 ;;
4131acd27e7Smillert    RISC*:ULTRIX:*:*)
4141acd27e7Smillert	echo mips-dec-ultrix${UNAME_RELEASE}
4151acd27e7Smillert	exit 0 ;;
4161acd27e7Smillert    VAX*:ULTRIX*:*:*)
4171acd27e7Smillert	echo vax-dec-ultrix${UNAME_RELEASE}
4181acd27e7Smillert	exit 0 ;;
4191acd27e7Smillert    2020:CLIX:*:* | 2430:CLIX:*:*)
4201acd27e7Smillert	echo clipper-intergraph-clix${UNAME_RELEASE}
4211acd27e7Smillert	exit 0 ;;
4221acd27e7Smillert    mips:*:*:UMIPS | mips:*:*:RISCos)
423af70c2dfSkettenis	eval $set_cc_for_build
4241acd27e7Smillert	sed 's/^	//' << EOF >$dummy.c
4251acd27e7Smillert#ifdef __cplusplus
426af70c2dfSkettenis#include <stdio.h>  /* for printf() prototype */
4271acd27e7Smillert	int main (int argc, char *argv[]) {
4281acd27e7Smillert#else
4291acd27e7Smillert	int main (argc, argv) int argc; char *argv[]; {
4301acd27e7Smillert#endif
4311acd27e7Smillert	#if defined (host_mips) && defined (MIPSEB)
4321acd27e7Smillert	#if defined (SYSTYPE_SYSV)
4331acd27e7Smillert	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
4341acd27e7Smillert	#endif
4351acd27e7Smillert	#if defined (SYSTYPE_SVR4)
4361acd27e7Smillert	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
4371acd27e7Smillert	#endif
4381acd27e7Smillert	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
4391acd27e7Smillert	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
4401acd27e7Smillert	#endif
4411acd27e7Smillert	#endif
4421acd27e7Smillert	  exit (-1);
4431acd27e7Smillert	}
4441acd27e7SmillertEOF
4451acd27e7Smillert	$CC_FOR_BUILD $dummy.c -o $dummy \
4461acd27e7Smillert	  && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
447af70c2dfSkettenis	  && rm -f $dummy.c $dummy && exit 0
4481acd27e7Smillert	rm -f $dummy.c $dummy
4491acd27e7Smillert	echo mips-mips-riscos${UNAME_RELEASE}
4501acd27e7Smillert	exit 0 ;;
451af70c2dfSkettenis    Motorola:PowerMAX_OS:*:*)
452af70c2dfSkettenis	echo powerpc-motorola-powermax
453af70c2dfSkettenis	exit 0 ;;
4541acd27e7Smillert    Night_Hawk:Power_UNIX:*:*)
4551acd27e7Smillert	echo powerpc-harris-powerunix
4561acd27e7Smillert	exit 0 ;;
4571acd27e7Smillert    m88k:CX/UX:7*:*)
4581acd27e7Smillert	echo m88k-harris-cxux7
4591acd27e7Smillert	exit 0 ;;
4601acd27e7Smillert    m88k:*:4*:R4*)
4611acd27e7Smillert	echo m88k-motorola-sysv4
4621acd27e7Smillert	exit 0 ;;
4631acd27e7Smillert    m88k:*:3*:R3*)
4641acd27e7Smillert	echo m88k-motorola-sysv3
4651acd27e7Smillert	exit 0 ;;
4661acd27e7Smillert    AViiON:dgux:*:*)
4671acd27e7Smillert        # DG/UX returns AViiON for all architectures
4681acd27e7Smillert        UNAME_PROCESSOR=`/usr/bin/uname -p`
469af70c2dfSkettenis	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
470af70c2dfSkettenis	then
471af70c2dfSkettenis	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
472af70c2dfSkettenis	       [ ${TARGET_BINARY_INTERFACE}x = x ]
473af70c2dfSkettenis	    then
4741acd27e7Smillert		echo m88k-dg-dgux${UNAME_RELEASE}
4751acd27e7Smillert	    else
4761acd27e7Smillert		echo m88k-dg-dguxbcs${UNAME_RELEASE}
4771acd27e7Smillert	    fi
4781acd27e7Smillert	else
4791acd27e7Smillert	    echo i586-dg-dgux${UNAME_RELEASE}
4801acd27e7Smillert	fi
4811acd27e7Smillert 	exit 0 ;;
4821acd27e7Smillert    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
4831acd27e7Smillert	echo m88k-dolphin-sysv3
4841acd27e7Smillert	exit 0 ;;
4851acd27e7Smillert    M88*:*:R3*:*)
4861acd27e7Smillert	# Delta 88k system running SVR3
4871acd27e7Smillert	echo m88k-motorola-sysv3
4881acd27e7Smillert	exit 0 ;;
4891acd27e7Smillert    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
4901acd27e7Smillert	echo m88k-tektronix-sysv3
4911acd27e7Smillert	exit 0 ;;
4921acd27e7Smillert    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
4931acd27e7Smillert	echo m68k-tektronix-bsd
4941acd27e7Smillert	exit 0 ;;
4951acd27e7Smillert    *:IRIX*:*:*)
4961acd27e7Smillert	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
4971acd27e7Smillert	exit 0 ;;
4981acd27e7Smillert    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
4991acd27e7Smillert	echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
5001acd27e7Smillert	exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
501af70c2dfSkettenis    i*86:AIX:*:*)
5021acd27e7Smillert	echo i386-ibm-aix
5031acd27e7Smillert	exit 0 ;;
504af70c2dfSkettenis    ia64:AIX:*:*)
505af70c2dfSkettenis	if [ -x /usr/bin/oslevel ] ; then
506af70c2dfSkettenis		IBM_REV=`/usr/bin/oslevel`
507af70c2dfSkettenis	else
508af70c2dfSkettenis		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
509af70c2dfSkettenis	fi
510af70c2dfSkettenis	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
511af70c2dfSkettenis	exit 0 ;;
5121acd27e7Smillert    *:AIX:2:3)
5131acd27e7Smillert	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
514af70c2dfSkettenis		eval $set_cc_for_build
5151acd27e7Smillert		sed 's/^		//' << EOF >$dummy.c
5161acd27e7Smillert		#include <sys/systemcfg.h>
5171acd27e7Smillert
5181acd27e7Smillert		main()
5191acd27e7Smillert			{
5201acd27e7Smillert			if (!__power_pc())
5211acd27e7Smillert				exit(1);
5221acd27e7Smillert			puts("powerpc-ibm-aix3.2.5");
5231acd27e7Smillert			exit(0);
5241acd27e7Smillert			}
5251acd27e7SmillertEOF
526af70c2dfSkettenis		$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
5271acd27e7Smillert		rm -f $dummy.c $dummy
5281acd27e7Smillert		echo rs6000-ibm-aix3.2.5
5291acd27e7Smillert	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
5301acd27e7Smillert		echo rs6000-ibm-aix3.2.4
5311acd27e7Smillert	else
5321acd27e7Smillert		echo rs6000-ibm-aix3.2
5331acd27e7Smillert	fi
5341acd27e7Smillert	exit 0 ;;
535af70c2dfSkettenis    *:AIX:*:[45])
536af70c2dfSkettenis	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
537af70c2dfSkettenis	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
5381acd27e7Smillert		IBM_ARCH=rs6000
5391acd27e7Smillert	else
5401acd27e7Smillert		IBM_ARCH=powerpc
5411acd27e7Smillert	fi
5421acd27e7Smillert	if [ -x /usr/bin/oslevel ] ; then
5431acd27e7Smillert		IBM_REV=`/usr/bin/oslevel`
5441acd27e7Smillert	else
545af70c2dfSkettenis		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
5461acd27e7Smillert	fi
5471acd27e7Smillert	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
5481acd27e7Smillert	exit 0 ;;
5491acd27e7Smillert    *:AIX:*:*)
5501acd27e7Smillert	echo rs6000-ibm-aix
5511acd27e7Smillert	exit 0 ;;
5521acd27e7Smillert    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
5531acd27e7Smillert	echo romp-ibm-bsd4.4
5541acd27e7Smillert	exit 0 ;;
555af70c2dfSkettenis    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
5561acd27e7Smillert	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
5571acd27e7Smillert	exit 0 ;;                           # report: romp-ibm BSD 4.3
5581acd27e7Smillert    *:BOSX:*:*)
5591acd27e7Smillert	echo rs6000-bull-bosx
5601acd27e7Smillert	exit 0 ;;
5611acd27e7Smillert    DPX/2?00:B.O.S.:*:*)
5621acd27e7Smillert	echo m68k-bull-sysv3
5631acd27e7Smillert	exit 0 ;;
5641acd27e7Smillert    9000/[34]??:4.3bsd:1.*:*)
5651acd27e7Smillert	echo m68k-hp-bsd
5661acd27e7Smillert	exit 0 ;;
5671acd27e7Smillert    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
5681acd27e7Smillert	echo m68k-hp-bsd4.4
5691acd27e7Smillert	exit 0 ;;
5701acd27e7Smillert    9000/[34678]??:HP-UX:*:*)
571af70c2dfSkettenis	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
5721acd27e7Smillert	case "${UNAME_MACHINE}" in
5731acd27e7Smillert	    9000/31? )            HP_ARCH=m68000 ;;
5741acd27e7Smillert	    9000/[34]?? )         HP_ARCH=m68k ;;
5751acd27e7Smillert	    9000/[678][0-9][0-9])
576af70c2dfSkettenis		if [ -x /usr/bin/getconf ]; then
577af70c2dfSkettenis		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
578af70c2dfSkettenis                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
579af70c2dfSkettenis                    case "${sc_cpu_version}" in
580af70c2dfSkettenis                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
581af70c2dfSkettenis                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
582af70c2dfSkettenis                      532)                      # CPU_PA_RISC2_0
583af70c2dfSkettenis                        case "${sc_kernel_bits}" in
584af70c2dfSkettenis                          32) HP_ARCH="hppa2.0n" ;;
585af70c2dfSkettenis                          64) HP_ARCH="hppa2.0w" ;;
586af70c2dfSkettenis			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
587af70c2dfSkettenis                        esac ;;
588af70c2dfSkettenis                    esac
589af70c2dfSkettenis		fi
590af70c2dfSkettenis		if [ "${HP_ARCH}" = "" ]; then
591af70c2dfSkettenis		    eval $set_cc_for_build
5921acd27e7Smillert		    sed 's/^              //' << EOF >$dummy.c
593af70c2dfSkettenis
594af70c2dfSkettenis              #define _HPUX_SOURCE
5951acd27e7Smillert              #include <stdlib.h>
5961acd27e7Smillert              #include <unistd.h>
5971acd27e7Smillert
5981acd27e7Smillert              int main ()
5991acd27e7Smillert              {
6001acd27e7Smillert              #if defined(_SC_KERNEL_BITS)
6011acd27e7Smillert                  long bits = sysconf(_SC_KERNEL_BITS);
6021acd27e7Smillert              #endif
6031acd27e7Smillert                  long cpu  = sysconf (_SC_CPU_VERSION);
6041acd27e7Smillert
6051acd27e7Smillert                  switch (cpu)
6061acd27e7Smillert              	{
6071acd27e7Smillert              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
6081acd27e7Smillert              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
6091acd27e7Smillert              	case CPU_PA_RISC2_0:
6101acd27e7Smillert              #if defined(_SC_KERNEL_BITS)
6111acd27e7Smillert              	    switch (bits)
6121acd27e7Smillert              		{
6131acd27e7Smillert              		case 64: puts ("hppa2.0w"); break;
6141acd27e7Smillert              		case 32: puts ("hppa2.0n"); break;
6151acd27e7Smillert              		default: puts ("hppa2.0"); break;
6161acd27e7Smillert              		} break;
6171acd27e7Smillert              #else  /* !defined(_SC_KERNEL_BITS) */
6181acd27e7Smillert              	    puts ("hppa2.0"); break;
6191acd27e7Smillert              #endif
6201acd27e7Smillert              	default: puts ("hppa1.0"); break;
6211acd27e7Smillert              	}
6221acd27e7Smillert                  exit (0);
6231acd27e7Smillert              }
6241acd27e7SmillertEOF
625af70c2dfSkettenis		    (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy`
626af70c2dfSkettenis		    if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
6271acd27e7Smillert		    rm -f $dummy.c $dummy
628af70c2dfSkettenis		fi ;;
6291acd27e7Smillert	esac
6301acd27e7Smillert	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
6311acd27e7Smillert	exit 0 ;;
632af70c2dfSkettenis    ia64:HP-UX:*:*)
633af70c2dfSkettenis	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
634af70c2dfSkettenis	echo ia64-hp-hpux${HPUX_REV}
635af70c2dfSkettenis	exit 0 ;;
6361acd27e7Smillert    3050*:HI-UX:*:*)
637af70c2dfSkettenis	eval $set_cc_for_build
6381acd27e7Smillert	sed 's/^	//' << EOF >$dummy.c
6391acd27e7Smillert	#include <unistd.h>
6401acd27e7Smillert	int
6411acd27e7Smillert	main ()
6421acd27e7Smillert	{
6431acd27e7Smillert	  long cpu = sysconf (_SC_CPU_VERSION);
6441acd27e7Smillert	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
6451acd27e7Smillert	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
6461acd27e7Smillert	     results, however.  */
6471acd27e7Smillert	  if (CPU_IS_PA_RISC (cpu))
6481acd27e7Smillert	    {
6491acd27e7Smillert	      switch (cpu)
6501acd27e7Smillert		{
6511acd27e7Smillert		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
6521acd27e7Smillert		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
6531acd27e7Smillert		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
6541acd27e7Smillert		  default: puts ("hppa-hitachi-hiuxwe2"); break;
6551acd27e7Smillert		}
6561acd27e7Smillert	    }
6571acd27e7Smillert	  else if (CPU_IS_HP_MC68K (cpu))
6581acd27e7Smillert	    puts ("m68k-hitachi-hiuxwe2");
6591acd27e7Smillert	  else puts ("unknown-hitachi-hiuxwe2");
6601acd27e7Smillert	  exit (0);
6611acd27e7Smillert	}
6621acd27e7SmillertEOF
663af70c2dfSkettenis	$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
6641acd27e7Smillert	rm -f $dummy.c $dummy
6651acd27e7Smillert	echo unknown-hitachi-hiuxwe2
6661acd27e7Smillert	exit 0 ;;
6671acd27e7Smillert    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
6681acd27e7Smillert	echo hppa1.1-hp-bsd
6691acd27e7Smillert	exit 0 ;;
6701acd27e7Smillert    9000/8??:4.3bsd:*:*)
6711acd27e7Smillert	echo hppa1.0-hp-bsd
6721acd27e7Smillert	exit 0 ;;
673af70c2dfSkettenis    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
6741acd27e7Smillert	echo hppa1.0-hp-mpeix
6751acd27e7Smillert	exit 0 ;;
6761acd27e7Smillert    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
6771acd27e7Smillert	echo hppa1.1-hp-osf
6781acd27e7Smillert	exit 0 ;;
6791acd27e7Smillert    hp8??:OSF1:*:*)
6801acd27e7Smillert	echo hppa1.0-hp-osf
6811acd27e7Smillert	exit 0 ;;
682af70c2dfSkettenis    i*86:OSF1:*:*)
6831acd27e7Smillert	if [ -x /usr/sbin/sysversion ] ; then
6841acd27e7Smillert	    echo ${UNAME_MACHINE}-unknown-osf1mk
6851acd27e7Smillert	else
6861acd27e7Smillert	    echo ${UNAME_MACHINE}-unknown-osf1
6871acd27e7Smillert	fi
6881acd27e7Smillert	exit 0 ;;
6891acd27e7Smillert    parisc*:Lites*:*:*)
6901acd27e7Smillert	echo hppa1.1-hp-lites
6911acd27e7Smillert	exit 0 ;;
6921acd27e7Smillert    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
6931acd27e7Smillert	echo c1-convex-bsd
6941acd27e7Smillert        exit 0 ;;
6951acd27e7Smillert    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
6961acd27e7Smillert	if getsysinfo -f scalar_acc
6971acd27e7Smillert	then echo c32-convex-bsd
6981acd27e7Smillert	else echo c2-convex-bsd
6991acd27e7Smillert	fi
7001acd27e7Smillert        exit 0 ;;
7011acd27e7Smillert    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
7021acd27e7Smillert	echo c34-convex-bsd
7031acd27e7Smillert        exit 0 ;;
7041acd27e7Smillert    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
7051acd27e7Smillert	echo c38-convex-bsd
7061acd27e7Smillert        exit 0 ;;
7071acd27e7Smillert    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
7081acd27e7Smillert	echo c4-convex-bsd
7091acd27e7Smillert        exit 0 ;;
7101acd27e7Smillert    CRAY*Y-MP:*:*:*)
711af70c2dfSkettenis	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7121acd27e7Smillert	exit 0 ;;
7131acd27e7Smillert    CRAY*[A-Z]90:*:*:*)
7141acd27e7Smillert	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
7151acd27e7Smillert	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
716af70c2dfSkettenis	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
717af70c2dfSkettenis	      -e 's/\.[^.]*$/.X/'
7181acd27e7Smillert	exit 0 ;;
7191acd27e7Smillert    CRAY*TS:*:*:*)
720af70c2dfSkettenis	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
721af70c2dfSkettenis	exit 0 ;;
722af70c2dfSkettenis    CRAY*T3D:*:*:*)
723af70c2dfSkettenis	echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7241acd27e7Smillert	exit 0 ;;
7251acd27e7Smillert    CRAY*T3E:*:*:*)
726af70c2dfSkettenis	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7271acd27e7Smillert	exit 0 ;;
728af70c2dfSkettenis    CRAY*SV1:*:*:*)
729af70c2dfSkettenis	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7301acd27e7Smillert	exit 0 ;;
731af70c2dfSkettenis    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
732af70c2dfSkettenis	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
7331acd27e7Smillert        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
7341acd27e7Smillert        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
735af70c2dfSkettenis        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
7361acd27e7Smillert        exit 0 ;;
737af70c2dfSkettenis    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
7381acd27e7Smillert	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
7391acd27e7Smillert	exit 0 ;;
7401acd27e7Smillert    sparc*:BSD/OS:*:*)
7411acd27e7Smillert	echo sparc-unknown-bsdi${UNAME_RELEASE}
7421acd27e7Smillert	exit 0 ;;
7431acd27e7Smillert    *:BSD/OS:*:*)
7441acd27e7Smillert	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
7451acd27e7Smillert	exit 0 ;;
7461acd27e7Smillert    *:FreeBSD:*:*)
747af70c2dfSkettenis	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
7481acd27e7Smillert	exit 0 ;;
7491acd27e7Smillert    i*:CYGWIN*:*)
750af70c2dfSkettenis	echo ${UNAME_MACHINE}-pc-cygwin
7511acd27e7Smillert	exit 0 ;;
7521acd27e7Smillert    i*:MINGW*:*)
7531acd27e7Smillert	echo ${UNAME_MACHINE}-pc-mingw32
7541acd27e7Smillert	exit 0 ;;
755af70c2dfSkettenis    i*:PW*:*)
756af70c2dfSkettenis	echo ${UNAME_MACHINE}-pc-pw32
757af70c2dfSkettenis	exit 0 ;;
758af70c2dfSkettenis    x86:Interix*:3*)
759af70c2dfSkettenis	echo i386-pc-interix3
760af70c2dfSkettenis	exit 0 ;;
7611acd27e7Smillert    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
7621acd27e7Smillert	# How do we know it's Interix rather than the generic POSIX subsystem?
7631acd27e7Smillert	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
7641acd27e7Smillert	# UNAME_MACHINE based on the output of uname instead of i386?
7651acd27e7Smillert	echo i386-pc-interix
7661acd27e7Smillert	exit 0 ;;
7671acd27e7Smillert    i*:UWIN*:*)
7681acd27e7Smillert	echo ${UNAME_MACHINE}-pc-uwin
7691acd27e7Smillert	exit 0 ;;
7701acd27e7Smillert    p*:CYGWIN*:*)
7711acd27e7Smillert	echo powerpcle-unknown-cygwin
7721acd27e7Smillert	exit 0 ;;
7731acd27e7Smillert    prep*:SunOS:5.*:*)
7741acd27e7Smillert	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
7751acd27e7Smillert	exit 0 ;;
7761acd27e7Smillert    *:GNU:*:*)
7771acd27e7Smillert	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
7781acd27e7Smillert	exit 0 ;;
779af70c2dfSkettenis    i*86:Minix:*:*)
780af70c2dfSkettenis	echo ${UNAME_MACHINE}-pc-minix
781af70c2dfSkettenis	exit 0 ;;
782af70c2dfSkettenis    arm*:Linux:*:*)
783af70c2dfSkettenis	echo ${UNAME_MACHINE}-unknown-linux-gnu
784af70c2dfSkettenis	exit 0 ;;
785af70c2dfSkettenis    ia64:Linux:*:*)
786af70c2dfSkettenis	echo ${UNAME_MACHINE}-unknown-linux-gnu
787af70c2dfSkettenis	exit 0 ;;
788af70c2dfSkettenis    m68*:Linux:*:*)
789af70c2dfSkettenis	echo ${UNAME_MACHINE}-unknown-linux-gnu
790af70c2dfSkettenis	exit 0 ;;
791af70c2dfSkettenis    mips:Linux:*:*)
792af70c2dfSkettenis	eval $set_cc_for_build
793af70c2dfSkettenis	sed 's/^	//' << EOF >$dummy.c
794af70c2dfSkettenis	#undef CPU
795af70c2dfSkettenis	#undef mips
796af70c2dfSkettenis	#undef mipsel
797af70c2dfSkettenis	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
798af70c2dfSkettenis	CPU=mipsel
799af70c2dfSkettenis	#else
800af70c2dfSkettenis	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
801af70c2dfSkettenis	CPU=mips
802af70c2dfSkettenis	#else
803af70c2dfSkettenis	CPU=
804af70c2dfSkettenis	#endif
805af70c2dfSkettenis	#endif
806af70c2dfSkettenisEOF
807af70c2dfSkettenis	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
808af70c2dfSkettenis	rm -f $dummy.c
809af70c2dfSkettenis	test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
810af70c2dfSkettenis	;;
811af70c2dfSkettenis    ppc:Linux:*:*)
812af70c2dfSkettenis	echo powerpc-unknown-linux-gnu
813af70c2dfSkettenis	exit 0 ;;
814af70c2dfSkettenis    ppc64:Linux:*:*)
815af70c2dfSkettenis	echo powerpc64-unknown-linux-gnu
816af70c2dfSkettenis	exit 0 ;;
817af70c2dfSkettenis    alpha:Linux:*:*)
818af70c2dfSkettenis	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
819af70c2dfSkettenis	  EV5)   UNAME_MACHINE=alphaev5 ;;
820af70c2dfSkettenis	  EV56)  UNAME_MACHINE=alphaev56 ;;
821af70c2dfSkettenis	  PCA56) UNAME_MACHINE=alphapca56 ;;
822af70c2dfSkettenis	  PCA57) UNAME_MACHINE=alphapca56 ;;
823af70c2dfSkettenis	  EV6)   UNAME_MACHINE=alphaev6 ;;
824af70c2dfSkettenis	  EV67)  UNAME_MACHINE=alphaev67 ;;
825af70c2dfSkettenis	  EV68*) UNAME_MACHINE=alphaev68 ;;
8261acd27e7Smillert        esac
827af70c2dfSkettenis	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
828af70c2dfSkettenis	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
829af70c2dfSkettenis	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
830af70c2dfSkettenis	exit 0 ;;
831af70c2dfSkettenis    parisc:Linux:*:* | hppa:Linux:*:*)
832af70c2dfSkettenis	# Look for CPU level
833af70c2dfSkettenis	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
834af70c2dfSkettenis	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
835af70c2dfSkettenis	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
836af70c2dfSkettenis	  *)    echo hppa-unknown-linux-gnu ;;
837af70c2dfSkettenis	esac
838af70c2dfSkettenis	exit 0 ;;
839af70c2dfSkettenis    parisc64:Linux:*:* | hppa64:Linux:*:*)
840af70c2dfSkettenis	echo hppa64-unknown-linux-gnu
841af70c2dfSkettenis	exit 0 ;;
842af70c2dfSkettenis    s390:Linux:*:* | s390x:Linux:*:*)
843af70c2dfSkettenis	echo ${UNAME_MACHINE}-ibm-linux
844af70c2dfSkettenis	exit 0 ;;
845af70c2dfSkettenis    sh*:Linux:*:*)
846af70c2dfSkettenis	echo ${UNAME_MACHINE}-unknown-linux-gnu
847af70c2dfSkettenis	exit 0 ;;
848af70c2dfSkettenis    sparc:Linux:*:* | sparc64:Linux:*:*)
849af70c2dfSkettenis	echo ${UNAME_MACHINE}-unknown-linux-gnu
850af70c2dfSkettenis	exit 0 ;;
851af70c2dfSkettenis    x86_64:Linux:*:*)
852af70c2dfSkettenis	echo x86_64-unknown-linux-gnu
853af70c2dfSkettenis	exit 0 ;;
854af70c2dfSkettenis    i*86:Linux:*:*)
8551acd27e7Smillert	# The BFD linker knows what the default object file format is, so
8561acd27e7Smillert	# first see if it will tell us. cd to the root directory to prevent
8571acd27e7Smillert	# problems with other programs or directories called `ld' in the path.
858af70c2dfSkettenis	# Set LC_ALL=C to ensure ld outputs messages in English.
859af70c2dfSkettenis	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
860af70c2dfSkettenis			 | sed -ne '/supported targets:/!d
8611acd27e7Smillert				    s/[ 	][ 	]*/ /g
862af70c2dfSkettenis				    s/.*supported targets: *//
8631acd27e7Smillert				    s/ .*//
8641acd27e7Smillert				    p'`
865af70c2dfSkettenis        case "$ld_supported_targets" in
866af70c2dfSkettenis	  elf32-i386)
867af70c2dfSkettenis		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
8681acd27e7Smillert		;;
869af70c2dfSkettenis	  a.out-i386-linux)
870af70c2dfSkettenis		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
871af70c2dfSkettenis		exit 0 ;;
872af70c2dfSkettenis	  coff-i386)
873af70c2dfSkettenis		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
874af70c2dfSkettenis		exit 0 ;;
875af70c2dfSkettenis	  "")
876af70c2dfSkettenis		# Either a pre-BFD a.out linker (linux-gnuoldld) or
877af70c2dfSkettenis		# one that does not give us useful --help.
878af70c2dfSkettenis		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
879af70c2dfSkettenis		exit 0 ;;
8801acd27e7Smillert	esac
8811acd27e7Smillert	# Determine whether the default compiler is a.out or elf
882af70c2dfSkettenis	eval $set_cc_for_build
883af70c2dfSkettenis	sed 's/^	//' << EOF >$dummy.c
8841acd27e7Smillert	#include <features.h>
8851acd27e7Smillert	#ifdef __ELF__
8861acd27e7Smillert	# ifdef __GLIBC__
8871acd27e7Smillert	#  if __GLIBC__ >= 2
888af70c2dfSkettenis	LIBC=gnu
8891acd27e7Smillert	#  else
890af70c2dfSkettenis	LIBC=gnulibc1
8911acd27e7Smillert	#  endif
8921acd27e7Smillert	# else
893af70c2dfSkettenis	LIBC=gnulibc1
8941acd27e7Smillert	# endif
8951acd27e7Smillert	#else
896af70c2dfSkettenis	#ifdef __INTEL_COMPILER
897af70c2dfSkettenis	LIBC=gnu
898af70c2dfSkettenis	#else
899af70c2dfSkettenis	LIBC=gnuaout
9001acd27e7Smillert	#endif
901af70c2dfSkettenis	#endif
9021acd27e7SmillertEOF
903af70c2dfSkettenis	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
904af70c2dfSkettenis	rm -f $dummy.c
905af70c2dfSkettenis	test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
906af70c2dfSkettenis	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
907af70c2dfSkettenis	;;
908af70c2dfSkettenis    i*86:DYNIX/ptx:4*:*)
909af70c2dfSkettenis	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
910af70c2dfSkettenis	# earlier versions are messed up and put the nodename in both
911af70c2dfSkettenis	# sysname and nodename.
9121acd27e7Smillert	echo i386-sequent-sysv4
9131acd27e7Smillert	exit 0 ;;
914af70c2dfSkettenis    i*86:UNIX_SV:4.2MP:2.*)
9151acd27e7Smillert        # Unixware is an offshoot of SVR4, but it has its own version
9161acd27e7Smillert        # number series starting with 2...
9171acd27e7Smillert        # I am not positive that other SVR4 systems won't match this,
9181acd27e7Smillert	# I just have to hope.  -- rms.
9191acd27e7Smillert        # Use sysv4.2uw... so that sysv4* matches it.
9201acd27e7Smillert	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
9211acd27e7Smillert	exit 0 ;;
922af70c2dfSkettenis    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
923af70c2dfSkettenis	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
9241acd27e7Smillert	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
925af70c2dfSkettenis		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
9261acd27e7Smillert	else
927af70c2dfSkettenis		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
9281acd27e7Smillert	fi
9291acd27e7Smillert	exit 0 ;;
930af70c2dfSkettenis    i*86:*:5:[78]*)
931af70c2dfSkettenis	case `/bin/uname -X | grep "^Machine"` in
932af70c2dfSkettenis	    *486*)	     UNAME_MACHINE=i486 ;;
933af70c2dfSkettenis	    *Pentium)	     UNAME_MACHINE=i586 ;;
934af70c2dfSkettenis	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
935af70c2dfSkettenis	esac
936af70c2dfSkettenis	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
9371acd27e7Smillert	exit 0 ;;
938af70c2dfSkettenis    i*86:*:3.2:*)
9391acd27e7Smillert	if test -f /usr/options/cb.name; then
9401acd27e7Smillert		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
9411acd27e7Smillert		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
9421acd27e7Smillert	elif /bin/uname -X 2>/dev/null >/dev/null ; then
9431acd27e7Smillert		UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
9441acd27e7Smillert		(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
9451acd27e7Smillert		(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
9461acd27e7Smillert			&& UNAME_MACHINE=i586
9471acd27e7Smillert		(/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
9481acd27e7Smillert			&& UNAME_MACHINE=i686
9491acd27e7Smillert		(/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
9501acd27e7Smillert			&& UNAME_MACHINE=i686
9511acd27e7Smillert		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
9521acd27e7Smillert	else
9531acd27e7Smillert		echo ${UNAME_MACHINE}-pc-sysv32
9541acd27e7Smillert	fi
9551acd27e7Smillert	exit 0 ;;
956af70c2dfSkettenis    i*86:*DOS:*:*)
957af70c2dfSkettenis	echo ${UNAME_MACHINE}-pc-msdosdjgpp
958af70c2dfSkettenis	exit 0 ;;
9591acd27e7Smillert    pc:*:*:*)
960af70c2dfSkettenis	# Left here for compatibility:
9611acd27e7Smillert        # uname -m prints for DJGPP always 'pc', but it prints nothing about
9621acd27e7Smillert        # the processor, so we play safe by assuming i386.
9631acd27e7Smillert	echo i386-pc-msdosdjgpp
9641acd27e7Smillert        exit 0 ;;
9651acd27e7Smillert    Intel:Mach:3*:*)
9661acd27e7Smillert	echo i386-pc-mach3
9671acd27e7Smillert	exit 0 ;;
9681acd27e7Smillert    paragon:*:*:*)
9691acd27e7Smillert	echo i860-intel-osf1
9701acd27e7Smillert	exit 0 ;;
9711acd27e7Smillert    i860:*:4.*:*) # i860-SVR4
9721acd27e7Smillert	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
9731acd27e7Smillert	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
9741acd27e7Smillert	else # Add other i860-SVR4 vendors below as they are discovered.
9751acd27e7Smillert	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
9761acd27e7Smillert	fi
9771acd27e7Smillert	exit 0 ;;
9781acd27e7Smillert    mini*:CTIX:SYS*5:*)
9791acd27e7Smillert	# "miniframe"
9801acd27e7Smillert	echo m68010-convergent-sysv
9811acd27e7Smillert	exit 0 ;;
9821acd27e7Smillert    M68*:*:R3V[567]*:*)
9831acd27e7Smillert	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
984af70c2dfSkettenis    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 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
9851acd27e7Smillert	OS_REL=''
9861acd27e7Smillert	test -r /etc/.relid \
9871acd27e7Smillert	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
9881acd27e7Smillert	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
9891acd27e7Smillert	  && echo i486-ncr-sysv4.3${OS_REL} && exit 0
9901acd27e7Smillert	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
9911acd27e7Smillert	  && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
9921acd27e7Smillert    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
9931acd27e7Smillert        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
9941acd27e7Smillert          && echo i486-ncr-sysv4 && exit 0 ;;
995af70c2dfSkettenis    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
996af70c2dfSkettenis	echo m68k-unknown-lynxos${UNAME_RELEASE}
997af70c2dfSkettenis	exit 0 ;;
9981acd27e7Smillert    mc68030:UNIX_System_V:4.*:*)
9991acd27e7Smillert	echo m68k-atari-sysv4
10001acd27e7Smillert	exit 0 ;;
1001af70c2dfSkettenis    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
1002af70c2dfSkettenis	echo i386-unknown-lynxos${UNAME_RELEASE}
10031acd27e7Smillert	exit 0 ;;
10041acd27e7Smillert    TSUNAMI:LynxOS:2.*:*)
10051acd27e7Smillert	echo sparc-unknown-lynxos${UNAME_RELEASE}
10061acd27e7Smillert	exit 0 ;;
1007af70c2dfSkettenis    rs6000:LynxOS:2.*:*)
10081acd27e7Smillert	echo rs6000-unknown-lynxos${UNAME_RELEASE}
10091acd27e7Smillert	exit 0 ;;
1010af70c2dfSkettenis    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
1011af70c2dfSkettenis	echo powerpc-unknown-lynxos${UNAME_RELEASE}
10121acd27e7Smillert	exit 0 ;;
10131acd27e7Smillert    SM[BE]S:UNIX_SV:*:*)
10141acd27e7Smillert	echo mips-dde-sysv${UNAME_RELEASE}
10151acd27e7Smillert	exit 0 ;;
1016af70c2dfSkettenis    RM*:ReliantUNIX-*:*:*)
1017af70c2dfSkettenis	echo mips-sni-sysv4
1018af70c2dfSkettenis	exit 0 ;;
1019af70c2dfSkettenis    RM*:SINIX-*:*:*)
10201acd27e7Smillert	echo mips-sni-sysv4
10211acd27e7Smillert	exit 0 ;;
10221acd27e7Smillert    *:SINIX-*:*:*)
10231acd27e7Smillert	if uname -p 2>/dev/null >/dev/null ; then
10241acd27e7Smillert		UNAME_MACHINE=`(uname -p) 2>/dev/null`
10251acd27e7Smillert		echo ${UNAME_MACHINE}-sni-sysv4
10261acd27e7Smillert	else
10271acd27e7Smillert		echo ns32k-sni-sysv
10281acd27e7Smillert	fi
10291acd27e7Smillert	exit 0 ;;
1030af70c2dfSkettenis    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
10311acd27e7Smillert                      # says <Richard.M.Bartel@ccMail.Census.GOV>
10321acd27e7Smillert        echo i586-unisys-sysv4
10331acd27e7Smillert        exit 0 ;;
10341acd27e7Smillert    *:UNIX_System_V:4*:FTX*)
10351acd27e7Smillert	# From Gerald Hewes <hewes@openmarket.com>.
10361acd27e7Smillert	# How about differentiating between stratus architectures? -djm
10371acd27e7Smillert	echo hppa1.1-stratus-sysv4
10381acd27e7Smillert	exit 0 ;;
10391acd27e7Smillert    *:*:*:FTX*)
10401acd27e7Smillert	# From seanf@swdc.stratus.com.
10411acd27e7Smillert	echo i860-stratus-sysv4
10421acd27e7Smillert	exit 0 ;;
1043af70c2dfSkettenis    *:VOS:*:*)
1044af70c2dfSkettenis	# From Paul.Green@stratus.com.
1045af70c2dfSkettenis	echo hppa1.1-stratus-vos
1046af70c2dfSkettenis	exit 0 ;;
10471acd27e7Smillert    mc68*:A/UX:*:*)
10481acd27e7Smillert	echo m68k-apple-aux${UNAME_RELEASE}
10491acd27e7Smillert	exit 0 ;;
1050af70c2dfSkettenis    news*:NEWS-OS:6*:*)
10511acd27e7Smillert	echo mips-sony-newsos6
10521acd27e7Smillert	exit 0 ;;
1053af70c2dfSkettenis    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
10541acd27e7Smillert	if [ -d /usr/nec ]; then
10551acd27e7Smillert	        echo mips-nec-sysv${UNAME_RELEASE}
10561acd27e7Smillert	else
10571acd27e7Smillert	        echo mips-unknown-sysv${UNAME_RELEASE}
10581acd27e7Smillert	fi
10591acd27e7Smillert        exit 0 ;;
10601acd27e7Smillert    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1061af70c2dfSkettenis	echo powerpc-be-beos
1062af70c2dfSkettenis	exit 0 ;;
1063af70c2dfSkettenis    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
10641acd27e7Smillert	echo powerpc-apple-beos
10651acd27e7Smillert	exit 0 ;;
1066af70c2dfSkettenis    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
10671acd27e7Smillert	echo i586-pc-beos
10681acd27e7Smillert	exit 0 ;;
10691acd27e7Smillert    SX-4:SUPER-UX:*:*)
10701acd27e7Smillert	echo sx4-nec-superux${UNAME_RELEASE}
10711acd27e7Smillert	exit 0 ;;
10721acd27e7Smillert    SX-5:SUPER-UX:*:*)
10731acd27e7Smillert	echo sx5-nec-superux${UNAME_RELEASE}
10741acd27e7Smillert	exit 0 ;;
10751acd27e7Smillert    Power*:Rhapsody:*:*)
10761acd27e7Smillert	echo powerpc-apple-rhapsody${UNAME_RELEASE}
10771acd27e7Smillert	exit 0 ;;
10781acd27e7Smillert    *:Rhapsody:*:*)
10791acd27e7Smillert	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
10801acd27e7Smillert	exit 0 ;;
1081af70c2dfSkettenis    *:Darwin:*:*)
1082af70c2dfSkettenis	echo `uname -p`-apple-darwin${UNAME_RELEASE}
1083af70c2dfSkettenis	exit 0 ;;
1084af70c2dfSkettenis    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1085af70c2dfSkettenis	UNAME_PROCESSOR=`uname -p`
1086af70c2dfSkettenis	if test "$UNAME_PROCESSOR" = "x86"; then
1087af70c2dfSkettenis		UNAME_PROCESSOR=i386
1088af70c2dfSkettenis		UNAME_MACHINE=pc
1089af70c2dfSkettenis	fi
1090af70c2dfSkettenis	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
1091af70c2dfSkettenis	exit 0 ;;
1092af70c2dfSkettenis    *:QNX:*:4*)
1093af70c2dfSkettenis	echo i386-pc-qnx
1094af70c2dfSkettenis	exit 0 ;;
1095af70c2dfSkettenis    NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*)
1096af70c2dfSkettenis	echo nsr-tandem-nsk${UNAME_RELEASE}
1097af70c2dfSkettenis	exit 0 ;;
1098af70c2dfSkettenis    *:NonStop-UX:*:*)
1099af70c2dfSkettenis	echo mips-compaq-nonstopux
1100af70c2dfSkettenis	exit 0 ;;
1101af70c2dfSkettenis    BS2000:POSIX*:*:*)
1102af70c2dfSkettenis	echo bs2000-siemens-sysv
1103af70c2dfSkettenis	exit 0 ;;
1104af70c2dfSkettenis    DS/*:UNIX_System_V:*:*)
1105af70c2dfSkettenis	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
1106af70c2dfSkettenis	exit 0 ;;
1107af70c2dfSkettenis    *:Plan9:*:*)
1108af70c2dfSkettenis	# "uname -m" is not consistent, so use $cputype instead. 386
1109af70c2dfSkettenis	# is converted to i386 for consistency with other x86
1110af70c2dfSkettenis	# operating systems.
1111af70c2dfSkettenis	if test "$cputype" = "386"; then
1112af70c2dfSkettenis	    UNAME_MACHINE=i386
1113af70c2dfSkettenis	else
1114af70c2dfSkettenis	    UNAME_MACHINE="$cputype"
1115af70c2dfSkettenis	fi
1116af70c2dfSkettenis	echo ${UNAME_MACHINE}-unknown-plan9
1117af70c2dfSkettenis	exit 0 ;;
1118af70c2dfSkettenis    i*86:OS/2:*:*)
1119af70c2dfSkettenis	# If we were able to find `uname', then EMX Unix compatibility
1120af70c2dfSkettenis	# is probably installed.
1121af70c2dfSkettenis	echo ${UNAME_MACHINE}-pc-os2-emx
1122af70c2dfSkettenis	exit 0 ;;
1123af70c2dfSkettenis    *:TOPS-10:*:*)
1124af70c2dfSkettenis	echo pdp10-unknown-tops10
1125af70c2dfSkettenis	exit 0 ;;
1126af70c2dfSkettenis    *:TENEX:*:*)
1127af70c2dfSkettenis	echo pdp10-unknown-tenex
1128af70c2dfSkettenis	exit 0 ;;
1129af70c2dfSkettenis    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1130af70c2dfSkettenis	echo pdp10-dec-tops20
1131af70c2dfSkettenis	exit 0 ;;
1132af70c2dfSkettenis    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1133af70c2dfSkettenis	echo pdp10-xkl-tops20
1134af70c2dfSkettenis	exit 0 ;;
1135af70c2dfSkettenis    *:TOPS-20:*:*)
1136af70c2dfSkettenis	echo pdp10-unknown-tops20
1137af70c2dfSkettenis	exit 0 ;;
1138af70c2dfSkettenis    *:ITS:*:*)
1139af70c2dfSkettenis	echo pdp10-unknown-its
1140af70c2dfSkettenis	exit 0 ;;
1141af70c2dfSkettenis    i*86:XTS-300:*:STOP)
1142af70c2dfSkettenis	echo ${UNAME_MACHINE}-unknown-stop
1143af70c2dfSkettenis	exit 0 ;;
1144af70c2dfSkettenis    i*86:atheos:*:*)
1145af70c2dfSkettenis	echo ${UNAME_MACHINE}-unknown-atheos
1146af70c2dfSkettenis	exit 0 ;;
11471acd27e7Smillertesac
11481acd27e7Smillert
11491acd27e7Smillert#echo '(No uname command or uname output not recognized.)' 1>&2
11501acd27e7Smillert#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
11511acd27e7Smillert
1152af70c2dfSketteniseval $set_cc_for_build
11531acd27e7Smillertcat >$dummy.c <<EOF
11541acd27e7Smillert#ifdef _SEQUENT_
11551acd27e7Smillert# include <sys/types.h>
11561acd27e7Smillert# include <sys/utsname.h>
11571acd27e7Smillert#endif
11581acd27e7Smillertmain ()
11591acd27e7Smillert{
11601acd27e7Smillert#if defined (sony)
11611acd27e7Smillert#if defined (MIPSEB)
11621acd27e7Smillert  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
11631acd27e7Smillert     I don't know....  */
11641acd27e7Smillert  printf ("mips-sony-bsd\n"); exit (0);
11651acd27e7Smillert#else
11661acd27e7Smillert#include <sys/param.h>
11671acd27e7Smillert  printf ("m68k-sony-newsos%s\n",
11681acd27e7Smillert#ifdef NEWSOS4
11691acd27e7Smillert          "4"
11701acd27e7Smillert#else
11711acd27e7Smillert	  ""
11721acd27e7Smillert#endif
11731acd27e7Smillert         ); exit (0);
11741acd27e7Smillert#endif
11751acd27e7Smillert#endif
11761acd27e7Smillert
11771acd27e7Smillert#if defined (__arm) && defined (__acorn) && defined (__unix)
1178af70c2dfSkettenis  printf ("arm-acorn-riscix"); exit (0);
11791acd27e7Smillert#endif
11801acd27e7Smillert
11811acd27e7Smillert#if defined (hp300) && !defined (hpux)
11821acd27e7Smillert  printf ("m68k-hp-bsd\n"); exit (0);
11831acd27e7Smillert#endif
11841acd27e7Smillert
11851acd27e7Smillert#if defined (NeXT)
11861acd27e7Smillert#if !defined (__ARCHITECTURE__)
11871acd27e7Smillert#define __ARCHITECTURE__ "m68k"
11881acd27e7Smillert#endif
11891acd27e7Smillert  int version;
11901acd27e7Smillert  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
11911acd27e7Smillert  if (version < 4)
11921acd27e7Smillert    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
11931acd27e7Smillert  else
11941acd27e7Smillert    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
11951acd27e7Smillert  exit (0);
11961acd27e7Smillert#endif
11971acd27e7Smillert
11981acd27e7Smillert#if defined (MULTIMAX) || defined (n16)
11991acd27e7Smillert#if defined (UMAXV)
12001acd27e7Smillert  printf ("ns32k-encore-sysv\n"); exit (0);
12011acd27e7Smillert#else
12021acd27e7Smillert#if defined (CMU)
12031acd27e7Smillert  printf ("ns32k-encore-mach\n"); exit (0);
12041acd27e7Smillert#else
12051acd27e7Smillert  printf ("ns32k-encore-bsd\n"); exit (0);
12061acd27e7Smillert#endif
12071acd27e7Smillert#endif
12081acd27e7Smillert#endif
12091acd27e7Smillert
12101acd27e7Smillert#if defined (__386BSD__)
12111acd27e7Smillert  printf ("i386-pc-bsd\n"); exit (0);
12121acd27e7Smillert#endif
12131acd27e7Smillert
12141acd27e7Smillert#if defined (sequent)
12151acd27e7Smillert#if defined (i386)
12161acd27e7Smillert  printf ("i386-sequent-dynix\n"); exit (0);
12171acd27e7Smillert#endif
12181acd27e7Smillert#if defined (ns32000)
12191acd27e7Smillert  printf ("ns32k-sequent-dynix\n"); exit (0);
12201acd27e7Smillert#endif
12211acd27e7Smillert#endif
12221acd27e7Smillert
12231acd27e7Smillert#if defined (_SEQUENT_)
12241acd27e7Smillert    struct utsname un;
12251acd27e7Smillert
12261acd27e7Smillert    uname(&un);
12271acd27e7Smillert
12281acd27e7Smillert    if (strncmp(un.version, "V2", 2) == 0) {
12291acd27e7Smillert	printf ("i386-sequent-ptx2\n"); exit (0);
12301acd27e7Smillert    }
12311acd27e7Smillert    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
12321acd27e7Smillert	printf ("i386-sequent-ptx1\n"); exit (0);
12331acd27e7Smillert    }
12341acd27e7Smillert    printf ("i386-sequent-ptx\n"); exit (0);
12351acd27e7Smillert
12361acd27e7Smillert#endif
12371acd27e7Smillert
12381acd27e7Smillert#if defined (vax)
12391acd27e7Smillert# if !defined (ultrix)
1240af70c2dfSkettenis#  include <sys/param.h>
1241af70c2dfSkettenis#  if defined (BSD)
1242af70c2dfSkettenis#   if BSD == 43
1243af70c2dfSkettenis      printf ("vax-dec-bsd4.3\n"); exit (0);
1244af70c2dfSkettenis#   else
1245af70c2dfSkettenis#    if BSD == 199006
1246af70c2dfSkettenis      printf ("vax-dec-bsd4.3reno\n"); exit (0);
1247af70c2dfSkettenis#    else
12481acd27e7Smillert      printf ("vax-dec-bsd\n"); exit (0);
1249af70c2dfSkettenis#    endif
1250af70c2dfSkettenis#   endif
1251af70c2dfSkettenis#  else
1252af70c2dfSkettenis    printf ("vax-dec-bsd\n"); exit (0);
1253af70c2dfSkettenis#  endif
12541acd27e7Smillert# else
12551acd27e7Smillert    printf ("vax-dec-ultrix\n"); exit (0);
12561acd27e7Smillert# endif
12571acd27e7Smillert#endif
12581acd27e7Smillert
12591acd27e7Smillert#if defined (alliant) && defined (i860)
12601acd27e7Smillert  printf ("i860-alliant-bsd\n"); exit (0);
12611acd27e7Smillert#endif
12621acd27e7Smillert
12631acd27e7Smillert  exit (1);
12641acd27e7Smillert}
12651acd27e7SmillertEOF
12661acd27e7Smillert
1267af70c2dfSkettenis$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0
12681acd27e7Smillertrm -f $dummy.c $dummy
12691acd27e7Smillert
12701acd27e7Smillert# Apollos put the system type in the environment.
12711acd27e7Smillert
12721acd27e7Smillerttest -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
12731acd27e7Smillert
12741acd27e7Smillert# Convex versions that predate uname can use getsysinfo(1)
12751acd27e7Smillert
12761acd27e7Smillertif [ -x /usr/convex/getsysinfo ]
12771acd27e7Smillertthen
12781acd27e7Smillert    case `getsysinfo -f cpu_type` in
12791acd27e7Smillert    c1*)
12801acd27e7Smillert	echo c1-convex-bsd
12811acd27e7Smillert	exit 0 ;;
12821acd27e7Smillert    c2*)
12831acd27e7Smillert	if getsysinfo -f scalar_acc
12841acd27e7Smillert	then echo c32-convex-bsd
12851acd27e7Smillert	else echo c2-convex-bsd
12861acd27e7Smillert	fi
12871acd27e7Smillert	exit 0 ;;
12881acd27e7Smillert    c34*)
12891acd27e7Smillert	echo c34-convex-bsd
12901acd27e7Smillert	exit 0 ;;
12911acd27e7Smillert    c38*)
12921acd27e7Smillert	echo c38-convex-bsd
12931acd27e7Smillert	exit 0 ;;
12941acd27e7Smillert    c4*)
12951acd27e7Smillert	echo c4-convex-bsd
12961acd27e7Smillert	exit 0 ;;
12971acd27e7Smillert    esac
12981acd27e7Smillertfi
12991acd27e7Smillert
1300af70c2dfSkettenis# NOTE -- Begin fallback cases added for bash -- NOTE
13011acd27e7Smillertcase "$UNAME" in
13021acd27e7Smillertuts) echo uts-amdahl-sysv${UNAME_RELEASE}; exit 0 ;;
13031acd27e7Smillertesac
13041acd27e7Smillert
13051acd27e7Smillertif [ -f /bin/fxc.info ]; then
13061acd27e7Smillert	echo fxc-alliant-concentrix
13071acd27e7Smillert	exit 0
13081acd27e7Smillertfi
1309af70c2dfSkettenis# NOTE -- End fallback cases added for bash -- NOTE
13101acd27e7Smillert
1311af70c2dfSketteniscat >&2 <<EOF
1312af70c2dfSkettenis$0: unable to guess system type
1313af70c2dfSkettenis
1314af70c2dfSkettenisThis script, last modified $timestamp, has failed to recognize
1315af70c2dfSkettenisthe operating system you are using. It is advised that you
1316af70c2dfSkettenisdownload the most up to date version of the config scripts from
1317af70c2dfSkettenis
1318af70c2dfSkettenis    ftp://ftp.gnu.org/pub/gnu/config/
1319af70c2dfSkettenis
1320af70c2dfSkettenisIf the version you run ($0) is already up to date, please
1321af70c2dfSkettenissend the following data and any information you think might be
1322af70c2dfSkettenispertinent to <config-patches@gnu.org> in order to provide the needed
1323af70c2dfSkettenisinformation to handle your system.
1324af70c2dfSkettenis
1325af70c2dfSkettenisconfig.guess timestamp = $timestamp
1326af70c2dfSkettenis
1327af70c2dfSkettenisuname -m = `(uname -m) 2>/dev/null || echo unknown`
1328af70c2dfSkettenisuname -r = `(uname -r) 2>/dev/null || echo unknown`
1329af70c2dfSkettenisuname -s = `(uname -s) 2>/dev/null || echo unknown`
1330af70c2dfSkettenisuname -v = `(uname -v) 2>/dev/null || echo unknown`
1331af70c2dfSkettenis
1332af70c2dfSkettenis/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1333af70c2dfSkettenis/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1334af70c2dfSkettenis
1335af70c2dfSkettenishostinfo               = `(hostinfo) 2>/dev/null`
1336af70c2dfSkettenis/bin/universe          = `(/bin/universe) 2>/dev/null`
1337af70c2dfSkettenis/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1338af70c2dfSkettenis/bin/arch              = `(/bin/arch) 2>/dev/null`
1339af70c2dfSkettenis/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1340af70c2dfSkettenis/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1341af70c2dfSkettenis
1342af70c2dfSkettenisUNAME_MACHINE = ${UNAME_MACHINE}
1343af70c2dfSkettenisUNAME_RELEASE = ${UNAME_RELEASE}
1344af70c2dfSkettenisUNAME_SYSTEM  = ${UNAME_SYSTEM}
1345af70c2dfSkettenisUNAME_VERSION = ${UNAME_VERSION}
1346af70c2dfSkettenisEOF
13471acd27e7Smillert
13481acd27e7Smillertexit 1
1349af70c2dfSkettenis
1350af70c2dfSkettenis# Local variables:
1351af70c2dfSkettenis# eval: (add-hook 'write-file-hooks 'time-stamp)
1352af70c2dfSkettenis# time-stamp-start: "timestamp='"
1353af70c2dfSkettenis# time-stamp-format: "%:y-%02m-%02d"
1354af70c2dfSkettenis# time-stamp-end: "'"
1355af70c2dfSkettenis# End:
1356