config.guess revision b425557e
1ee3138f1Smrg#! /bin/sh
2ee3138f1Smrg# Attempt to guess a canonical system name.
3ee3138f1Smrg#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4b425557eSmrg#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
579a8a9c6Smrg#   Free Software Foundation, Inc.
6ee3138f1Smrg
7b425557eSmrgtimestamp='2010-08-21'
8ee3138f1Smrg
9ee3138f1Smrg# This file is free software; you can redistribute it and/or modify it
10ee3138f1Smrg# under the terms of the GNU General Public License as published by
11ee3138f1Smrg# the Free Software Foundation; either version 2 of the License, or
12ee3138f1Smrg# (at your option) any later version.
13ee3138f1Smrg#
14ee3138f1Smrg# This program is distributed in the hope that it will be useful, but
15ee3138f1Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
16ee3138f1Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17ee3138f1Smrg# General Public License for more details.
18ee3138f1Smrg#
19ee3138f1Smrg# You should have received a copy of the GNU General Public License
20ee3138f1Smrg# along with this program; if not, write to the Free Software
21ee3138f1Smrg# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
22ee3138f1Smrg# 02110-1301, USA.
23ee3138f1Smrg#
24ee3138f1Smrg# As a special exception to the GNU General Public License, if you
25ee3138f1Smrg# distribute this file as part of a program that contains a
26ee3138f1Smrg# configuration script generated by Autoconf, you may include it under
27ee3138f1Smrg# the same distribution terms that you use for the rest of that program.
28ee3138f1Smrg
29ee3138f1Smrg
30b425557eSmrg# Originally written by Per Bothner.  Please send patches (context
31b425557eSmrg# diff format) to <config-patches@gnu.org> and include a ChangeLog
32b425557eSmrg# entry.
33ee3138f1Smrg#
34ee3138f1Smrg# This script attempts to guess a canonical system name similar to
35ee3138f1Smrg# config.sub.  If it succeeds, it prints the system name on stdout, and
36ee3138f1Smrg# exits with 0.  Otherwise, it exits with 1.
37ee3138f1Smrg#
38b425557eSmrg# You can get the latest version of this script from:
39b425557eSmrg# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
40ee3138f1Smrg
41ee3138f1Smrgme=`echo "$0" | sed -e 's,.*/,,'`
42ee3138f1Smrg
43ee3138f1Smrgusage="\
44ee3138f1SmrgUsage: $0 [OPTION]
45ee3138f1Smrg
46ee3138f1SmrgOutput the configuration name of the system \`$me' is run on.
47ee3138f1Smrg
48ee3138f1SmrgOperation modes:
49ee3138f1Smrg  -h, --help         print this help, then exit
50ee3138f1Smrg  -t, --time-stamp   print date of last modification, then exit
51ee3138f1Smrg  -v, --version      print version number, then exit
52ee3138f1Smrg
53ee3138f1SmrgReport bugs and patches to <config-patches@gnu.org>."
54ee3138f1Smrg
55ee3138f1Smrgversion="\
56ee3138f1SmrgGNU config.guess ($timestamp)
57ee3138f1Smrg
58ee3138f1SmrgOriginally written by Per Bothner.
59b425557eSmrgCopyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
60b425557eSmrg2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
61b425557eSmrgSoftware Foundation, Inc.
62ee3138f1Smrg
63ee3138f1SmrgThis is free software; see the source for copying conditions.  There is NO
64ee3138f1Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
65ee3138f1Smrg
66ee3138f1Smrghelp="
67ee3138f1SmrgTry \`$me --help' for more information."
68ee3138f1Smrg
69ee3138f1Smrg# Parse command line
70ee3138f1Smrgwhile test $# -gt 0 ; do
71ee3138f1Smrg  case $1 in
72ee3138f1Smrg    --time-stamp | --time* | -t )
73ee3138f1Smrg       echo "$timestamp" ; exit ;;
74ee3138f1Smrg    --version | -v )
75ee3138f1Smrg       echo "$version" ; exit ;;
76ee3138f1Smrg    --help | --h* | -h )
77ee3138f1Smrg       echo "$usage"; exit ;;
78ee3138f1Smrg    -- )     # Stop option processing
79ee3138f1Smrg       shift; break ;;
80ee3138f1Smrg    - )	# Use stdin as input.
81ee3138f1Smrg       break ;;
82ee3138f1Smrg    -* )
83ee3138f1Smrg       echo "$me: invalid option $1$help" >&2
84ee3138f1Smrg       exit 1 ;;
85ee3138f1Smrg    * )
86ee3138f1Smrg       break ;;
87ee3138f1Smrg  esac
88ee3138f1Smrgdone
89ee3138f1Smrg
90ee3138f1Smrgif test $# != 0; then
91ee3138f1Smrg  echo "$me: too many arguments$help" >&2
92ee3138f1Smrg  exit 1
93ee3138f1Smrgfi
94ee3138f1Smrg
95b425557eSmrgtrap 'exit 1' HUP INT TERM
96ee3138f1Smrg
97ee3138f1Smrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
98ee3138f1Smrg# compiler to aid in system detection is discouraged as it requires
99ee3138f1Smrg# temporary files to be created and, as you can see below, it is a
100ee3138f1Smrg# headache to deal with in a portable fashion.
101ee3138f1Smrg
102ee3138f1Smrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
103ee3138f1Smrg# use `HOST_CC' if defined, but it is deprecated.
104ee3138f1Smrg
105ee3138f1Smrg# Portable tmp directory creation inspired by the Autoconf team.
106ee3138f1Smrg
107ee3138f1Smrgset_cc_for_build='
108ee3138f1Smrgtrap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
109b425557eSmrgtrap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" HUP INT PIPE TERM ;
110ee3138f1Smrg: ${TMPDIR=/tmp} ;
111ee3138f1Smrg { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
112ee3138f1Smrg { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
113ee3138f1Smrg { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
114ee3138f1Smrg { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
115ee3138f1Smrgdummy=$tmp/dummy ;
116ee3138f1Smrgtmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
117ee3138f1Smrgcase $CC_FOR_BUILD,$HOST_CC,$CC in
118ee3138f1Smrg ,,)    echo "int x;" > $dummy.c ;
119ee3138f1Smrg	for c in cc gcc c89 c99 ; do
120ee3138f1Smrg	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
121ee3138f1Smrg	     CC_FOR_BUILD="$c"; break ;
122ee3138f1Smrg	  fi ;
123ee3138f1Smrg	done ;
124ee3138f1Smrg	if test x"$CC_FOR_BUILD" = x ; then
125ee3138f1Smrg	  CC_FOR_BUILD=no_compiler_found ;
126ee3138f1Smrg	fi
127ee3138f1Smrg	;;
128ee3138f1Smrg ,,*)   CC_FOR_BUILD=$CC ;;
129ee3138f1Smrg ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
130ee3138f1Smrgesac ; set_cc_for_build= ;'
131ee3138f1Smrg
132ee3138f1Smrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
133ee3138f1Smrg# (ghazi@noc.rutgers.edu 1994-08-24)
134ee3138f1Smrgif (test -f /.attbin/uname) >/dev/null 2>&1 ; then
135ee3138f1Smrg	PATH=$PATH:/.attbin ; export PATH
136ee3138f1Smrgfi
137ee3138f1Smrg
138ee3138f1SmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
139ee3138f1SmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
140ee3138f1SmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
141ee3138f1SmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
142ee3138f1Smrg
143ee3138f1Smrg# Note: order is significant - the case branches are not exclusive.
144ee3138f1Smrg
145ee3138f1Smrgcase "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
146ee3138f1Smrg    *:NetBSD:*:*)
147ee3138f1Smrg	# NetBSD (nbsd) targets should (where applicable) match one or
148ee3138f1Smrg	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
149ee3138f1Smrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
150ee3138f1Smrg	# switched to ELF, *-*-netbsd* would select the old
151ee3138f1Smrg	# object file format.  This provides both forward
152ee3138f1Smrg	# compatibility and a consistent mechanism for selecting the
153ee3138f1Smrg	# object file format.
154ee3138f1Smrg	#
155ee3138f1Smrg	# Note: NetBSD doesn't particularly care about the vendor
156ee3138f1Smrg	# portion of the name.  We always set it to "unknown".
157ee3138f1Smrg	sysctl="sysctl -n hw.machine_arch"
158ee3138f1Smrg	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
159ee3138f1Smrg	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
160ee3138f1Smrg	case "${UNAME_MACHINE_ARCH}" in
161ee3138f1Smrg	    armeb) machine=armeb-unknown ;;
162ee3138f1Smrg	    arm*) machine=arm-unknown ;;
163ee3138f1Smrg	    sh3el) machine=shl-unknown ;;
164ee3138f1Smrg	    sh3eb) machine=sh-unknown ;;
165ee3138f1Smrg	    sh5el) machine=sh5le-unknown ;;
166ee3138f1Smrg	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
167ee3138f1Smrg	esac
168ee3138f1Smrg	# The Operating System including object format, if it has switched
169ee3138f1Smrg	# to ELF recently, or will in the future.
170ee3138f1Smrg	case "${UNAME_MACHINE_ARCH}" in
171ee3138f1Smrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
172ee3138f1Smrg		eval $set_cc_for_build
173ee3138f1Smrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
174b425557eSmrg			| grep -q __ELF__
175ee3138f1Smrg		then
176ee3138f1Smrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
177ee3138f1Smrg		    # Return netbsd for either.  FIX?
178ee3138f1Smrg		    os=netbsd
179ee3138f1Smrg		else
180ee3138f1Smrg		    os=netbsdelf
181ee3138f1Smrg		fi
182ee3138f1Smrg		;;
183ee3138f1Smrg	    *)
184ee3138f1Smrg	        os=netbsd
185ee3138f1Smrg		;;
186ee3138f1Smrg	esac
187ee3138f1Smrg	# The OS release
188ee3138f1Smrg	# Debian GNU/NetBSD machines have a different userland, and
189ee3138f1Smrg	# thus, need a distinct triplet. However, they do not need
190ee3138f1Smrg	# kernel version information, so it can be replaced with a
191ee3138f1Smrg	# suitable tag, in the style of linux-gnu.
192ee3138f1Smrg	case "${UNAME_VERSION}" in
193ee3138f1Smrg	    Debian*)
194ee3138f1Smrg		release='-gnu'
195ee3138f1Smrg		;;
196ee3138f1Smrg	    *)
197ee3138f1Smrg		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
198ee3138f1Smrg		;;
199ee3138f1Smrg	esac
200ee3138f1Smrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
201ee3138f1Smrg	# contains redundant information, the shorter form:
202ee3138f1Smrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
203ee3138f1Smrg	echo "${machine}-${os}${release}"
204ee3138f1Smrg	exit ;;
205ee3138f1Smrg    *:OpenBSD:*:*)
206ee3138f1Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
207ee3138f1Smrg	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
208ee3138f1Smrg	exit ;;
209ee3138f1Smrg    *:ekkoBSD:*:*)
210ee3138f1Smrg	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
211ee3138f1Smrg	exit ;;
212ee3138f1Smrg    *:SolidBSD:*:*)
213ee3138f1Smrg	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
214ee3138f1Smrg	exit ;;
215ee3138f1Smrg    macppc:MirBSD:*:*)
216ee3138f1Smrg	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
217ee3138f1Smrg	exit ;;
218ee3138f1Smrg    *:MirBSD:*:*)
219ee3138f1Smrg	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
220ee3138f1Smrg	exit ;;
221ee3138f1Smrg    alpha:OSF1:*:*)
222ee3138f1Smrg	case $UNAME_RELEASE in
223ee3138f1Smrg	*4.0)
224ee3138f1Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
225ee3138f1Smrg		;;
226ee3138f1Smrg	*5.*)
227ee3138f1Smrg	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
228ee3138f1Smrg		;;
229ee3138f1Smrg	esac
230ee3138f1Smrg	# According to Compaq, /usr/sbin/psrinfo has been available on
231ee3138f1Smrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
232ee3138f1Smrg	# covers most systems running today.  This code pipes the CPU
233ee3138f1Smrg	# types through head -n 1, so we only detect the type of CPU 0.
234ee3138f1Smrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
235ee3138f1Smrg	case "$ALPHA_CPU_TYPE" in
236ee3138f1Smrg	    "EV4 (21064)")
237ee3138f1Smrg		UNAME_MACHINE="alpha" ;;
238ee3138f1Smrg	    "EV4.5 (21064)")
239ee3138f1Smrg		UNAME_MACHINE="alpha" ;;
240ee3138f1Smrg	    "LCA4 (21066/21068)")
241ee3138f1Smrg		UNAME_MACHINE="alpha" ;;
242ee3138f1Smrg	    "EV5 (21164)")
243ee3138f1Smrg		UNAME_MACHINE="alphaev5" ;;
244ee3138f1Smrg	    "EV5.6 (21164A)")
245ee3138f1Smrg		UNAME_MACHINE="alphaev56" ;;
246ee3138f1Smrg	    "EV5.6 (21164PC)")
247ee3138f1Smrg		UNAME_MACHINE="alphapca56" ;;
248ee3138f1Smrg	    "EV5.7 (21164PC)")
249ee3138f1Smrg		UNAME_MACHINE="alphapca57" ;;
250ee3138f1Smrg	    "EV6 (21264)")
251ee3138f1Smrg		UNAME_MACHINE="alphaev6" ;;
252ee3138f1Smrg	    "EV6.7 (21264A)")
253ee3138f1Smrg		UNAME_MACHINE="alphaev67" ;;
254ee3138f1Smrg	    "EV6.8CB (21264C)")
255ee3138f1Smrg		UNAME_MACHINE="alphaev68" ;;
256ee3138f1Smrg	    "EV6.8AL (21264B)")
257ee3138f1Smrg		UNAME_MACHINE="alphaev68" ;;
258ee3138f1Smrg	    "EV6.8CX (21264D)")
259ee3138f1Smrg		UNAME_MACHINE="alphaev68" ;;
260ee3138f1Smrg	    "EV6.9A (21264/EV69A)")
261ee3138f1Smrg		UNAME_MACHINE="alphaev69" ;;
262ee3138f1Smrg	    "EV7 (21364)")
263ee3138f1Smrg		UNAME_MACHINE="alphaev7" ;;
264ee3138f1Smrg	    "EV7.9 (21364A)")
265ee3138f1Smrg		UNAME_MACHINE="alphaev79" ;;
266ee3138f1Smrg	esac
267ee3138f1Smrg	# A Pn.n version is a patched version.
268ee3138f1Smrg	# A Vn.n version is a released version.
269ee3138f1Smrg	# A Tn.n version is a released field test version.
270ee3138f1Smrg	# A Xn.n version is an unreleased experimental baselevel.
271ee3138f1Smrg	# 1.2 uses "1.2" for uname -r.
272ee3138f1Smrg	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
273ee3138f1Smrg	exit ;;
274ee3138f1Smrg    Alpha\ *:Windows_NT*:*)
275ee3138f1Smrg	# How do we know it's Interix rather than the generic POSIX subsystem?
276ee3138f1Smrg	# Should we change UNAME_MACHINE based on the output of uname instead
277ee3138f1Smrg	# of the specific Alpha model?
278ee3138f1Smrg	echo alpha-pc-interix
279ee3138f1Smrg	exit ;;
280ee3138f1Smrg    21064:Windows_NT:50:3)
281ee3138f1Smrg	echo alpha-dec-winnt3.5
282ee3138f1Smrg	exit ;;
283ee3138f1Smrg    Amiga*:UNIX_System_V:4.0:*)
284ee3138f1Smrg	echo m68k-unknown-sysv4
285ee3138f1Smrg	exit ;;
286ee3138f1Smrg    *:[Aa]miga[Oo][Ss]:*:*)
287ee3138f1Smrg	echo ${UNAME_MACHINE}-unknown-amigaos
288ee3138f1Smrg	exit ;;
289ee3138f1Smrg    *:[Mm]orph[Oo][Ss]:*:*)
290ee3138f1Smrg	echo ${UNAME_MACHINE}-unknown-morphos
291ee3138f1Smrg	exit ;;
292ee3138f1Smrg    *:OS/390:*:*)
293ee3138f1Smrg	echo i370-ibm-openedition
294ee3138f1Smrg	exit ;;
295ee3138f1Smrg    *:z/VM:*:*)
296ee3138f1Smrg	echo s390-ibm-zvmoe
297ee3138f1Smrg	exit ;;
298ee3138f1Smrg    *:OS400:*:*)
299ee3138f1Smrg        echo powerpc-ibm-os400
300ee3138f1Smrg	exit ;;
301ee3138f1Smrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
302ee3138f1Smrg	echo arm-acorn-riscix${UNAME_RELEASE}
303ee3138f1Smrg	exit ;;
304ee3138f1Smrg    arm:riscos:*:*|arm:RISCOS:*:*)
305ee3138f1Smrg	echo arm-unknown-riscos
306ee3138f1Smrg	exit ;;
307ee3138f1Smrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
308ee3138f1Smrg	echo hppa1.1-hitachi-hiuxmpp
309ee3138f1Smrg	exit ;;
310ee3138f1Smrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
311ee3138f1Smrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
312ee3138f1Smrg	if test "`(/bin/universe) 2>/dev/null`" = att ; then
313ee3138f1Smrg		echo pyramid-pyramid-sysv3
314ee3138f1Smrg	else
315ee3138f1Smrg		echo pyramid-pyramid-bsd
316ee3138f1Smrg	fi
317ee3138f1Smrg	exit ;;
318ee3138f1Smrg    NILE*:*:*:dcosx)
319ee3138f1Smrg	echo pyramid-pyramid-svr4
320ee3138f1Smrg	exit ;;
321ee3138f1Smrg    DRS?6000:unix:4.0:6*)
322ee3138f1Smrg	echo sparc-icl-nx6
323ee3138f1Smrg	exit ;;
324ee3138f1Smrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
325ee3138f1Smrg	case `/usr/bin/uname -p` in
326ee3138f1Smrg	    sparc) echo sparc-icl-nx7; exit ;;
327ee3138f1Smrg	esac ;;
32834977a2fSmrg    s390x:SunOS:*:*)
32934977a2fSmrg	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
33034977a2fSmrg	exit ;;
331ee3138f1Smrg    sun4H:SunOS:5.*:*)
332ee3138f1Smrg	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
333ee3138f1Smrg	exit ;;
334ee3138f1Smrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
335ee3138f1Smrg	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
336ee3138f1Smrg	exit ;;
337b425557eSmrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
338b425557eSmrg	echo i386-pc-auroraux${UNAME_RELEASE}
339b425557eSmrg	exit ;;
34079a8a9c6Smrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
34134977a2fSmrg	eval $set_cc_for_build
34234977a2fSmrg	SUN_ARCH="i386"
34334977a2fSmrg	# If there is a compiler, see if it is configured for 64-bit objects.
34434977a2fSmrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
34534977a2fSmrg	# This test works for both compilers.
34634977a2fSmrg	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
34734977a2fSmrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
34834977a2fSmrg		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
34934977a2fSmrg		grep IS_64BIT_ARCH >/dev/null
35034977a2fSmrg	    then
35134977a2fSmrg		SUN_ARCH="x86_64"
35234977a2fSmrg	    fi
35334977a2fSmrg	fi
35434977a2fSmrg	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
355ee3138f1Smrg	exit ;;
356ee3138f1Smrg    sun4*:SunOS:6*:*)
357ee3138f1Smrg	# According to config.sub, this is the proper way to canonicalize
358ee3138f1Smrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
359ee3138f1Smrg	# it's likely to be more like Solaris than SunOS4.
360ee3138f1Smrg	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
361ee3138f1Smrg	exit ;;
362ee3138f1Smrg    sun4*:SunOS:*:*)
363ee3138f1Smrg	case "`/usr/bin/arch -k`" in
364ee3138f1Smrg	    Series*|S4*)
365ee3138f1Smrg		UNAME_RELEASE=`uname -v`
366ee3138f1Smrg		;;
367ee3138f1Smrg	esac
368ee3138f1Smrg	# Japanese Language versions have a version number like `4.1.3-JL'.
369ee3138f1Smrg	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
370ee3138f1Smrg	exit ;;
371ee3138f1Smrg    sun3*:SunOS:*:*)
372ee3138f1Smrg	echo m68k-sun-sunos${UNAME_RELEASE}
373ee3138f1Smrg	exit ;;
374ee3138f1Smrg    sun*:*:4.2BSD:*)
375ee3138f1Smrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
376ee3138f1Smrg	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
377ee3138f1Smrg	case "`/bin/arch`" in
378ee3138f1Smrg	    sun3)
379ee3138f1Smrg		echo m68k-sun-sunos${UNAME_RELEASE}
380ee3138f1Smrg		;;
381ee3138f1Smrg	    sun4)
382ee3138f1Smrg		echo sparc-sun-sunos${UNAME_RELEASE}
383ee3138f1Smrg		;;
384ee3138f1Smrg	esac
385ee3138f1Smrg	exit ;;
386ee3138f1Smrg    aushp:SunOS:*:*)
387ee3138f1Smrg	echo sparc-auspex-sunos${UNAME_RELEASE}
388ee3138f1Smrg	exit ;;
389ee3138f1Smrg    # The situation for MiNT is a little confusing.  The machine name
390ee3138f1Smrg    # can be virtually everything (everything which is not
391ee3138f1Smrg    # "atarist" or "atariste" at least should have a processor
392ee3138f1Smrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
393ee3138f1Smrg    # to the lowercase version "mint" (or "freemint").  Finally
394ee3138f1Smrg    # the system name "TOS" denotes a system which is actually not
395ee3138f1Smrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
396ee3138f1Smrg    # be no problem.
397ee3138f1Smrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
398ee3138f1Smrg        echo m68k-atari-mint${UNAME_RELEASE}
399ee3138f1Smrg	exit ;;
400ee3138f1Smrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
401ee3138f1Smrg	echo m68k-atari-mint${UNAME_RELEASE}
402ee3138f1Smrg        exit ;;
403ee3138f1Smrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
404ee3138f1Smrg        echo m68k-atari-mint${UNAME_RELEASE}
405ee3138f1Smrg	exit ;;
406ee3138f1Smrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
407ee3138f1Smrg        echo m68k-milan-mint${UNAME_RELEASE}
408ee3138f1Smrg        exit ;;
409ee3138f1Smrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
410ee3138f1Smrg        echo m68k-hades-mint${UNAME_RELEASE}
411ee3138f1Smrg        exit ;;
412ee3138f1Smrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
413ee3138f1Smrg        echo m68k-unknown-mint${UNAME_RELEASE}
414ee3138f1Smrg        exit ;;
415ee3138f1Smrg    m68k:machten:*:*)
416ee3138f1Smrg	echo m68k-apple-machten${UNAME_RELEASE}
417ee3138f1Smrg	exit ;;
418ee3138f1Smrg    powerpc:machten:*:*)
419ee3138f1Smrg	echo powerpc-apple-machten${UNAME_RELEASE}
420ee3138f1Smrg	exit ;;
421ee3138f1Smrg    RISC*:Mach:*:*)
422ee3138f1Smrg	echo mips-dec-mach_bsd4.3
423ee3138f1Smrg	exit ;;
424ee3138f1Smrg    RISC*:ULTRIX:*:*)
425ee3138f1Smrg	echo mips-dec-ultrix${UNAME_RELEASE}
426ee3138f1Smrg	exit ;;
427ee3138f1Smrg    VAX*:ULTRIX*:*:*)
428ee3138f1Smrg	echo vax-dec-ultrix${UNAME_RELEASE}
429ee3138f1Smrg	exit ;;
430ee3138f1Smrg    2020:CLIX:*:* | 2430:CLIX:*:*)
431ee3138f1Smrg	echo clipper-intergraph-clix${UNAME_RELEASE}
432ee3138f1Smrg	exit ;;
433ee3138f1Smrg    mips:*:*:UMIPS | mips:*:*:RISCos)
434ee3138f1Smrg	eval $set_cc_for_build
435ee3138f1Smrg	sed 's/^	//' << EOF >$dummy.c
436ee3138f1Smrg#ifdef __cplusplus
437ee3138f1Smrg#include <stdio.h>  /* for printf() prototype */
438ee3138f1Smrg	int main (int argc, char *argv[]) {
439ee3138f1Smrg#else
440ee3138f1Smrg	int main (argc, argv) int argc; char *argv[]; {
441ee3138f1Smrg#endif
442ee3138f1Smrg	#if defined (host_mips) && defined (MIPSEB)
443ee3138f1Smrg	#if defined (SYSTYPE_SYSV)
444ee3138f1Smrg	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
445ee3138f1Smrg	#endif
446ee3138f1Smrg	#if defined (SYSTYPE_SVR4)
447ee3138f1Smrg	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
448ee3138f1Smrg	#endif
449ee3138f1Smrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
450ee3138f1Smrg	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
451ee3138f1Smrg	#endif
452ee3138f1Smrg	#endif
453ee3138f1Smrg	  exit (-1);
454ee3138f1Smrg	}
455ee3138f1SmrgEOF
456ee3138f1Smrg	$CC_FOR_BUILD -o $dummy $dummy.c &&
457ee3138f1Smrg	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
458ee3138f1Smrg	  SYSTEM_NAME=`$dummy $dummyarg` &&
459ee3138f1Smrg	    { echo "$SYSTEM_NAME"; exit; }
460ee3138f1Smrg	echo mips-mips-riscos${UNAME_RELEASE}
461ee3138f1Smrg	exit ;;
462ee3138f1Smrg    Motorola:PowerMAX_OS:*:*)
463ee3138f1Smrg	echo powerpc-motorola-powermax
464ee3138f1Smrg	exit ;;
465ee3138f1Smrg    Motorola:*:4.3:PL8-*)
466ee3138f1Smrg	echo powerpc-harris-powermax
467ee3138f1Smrg	exit ;;
468ee3138f1Smrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
469ee3138f1Smrg	echo powerpc-harris-powermax
470ee3138f1Smrg	exit ;;
471ee3138f1Smrg    Night_Hawk:Power_UNIX:*:*)
472ee3138f1Smrg	echo powerpc-harris-powerunix
473ee3138f1Smrg	exit ;;
474ee3138f1Smrg    m88k:CX/UX:7*:*)
475ee3138f1Smrg	echo m88k-harris-cxux7
476ee3138f1Smrg	exit ;;
477ee3138f1Smrg    m88k:*:4*:R4*)
478ee3138f1Smrg	echo m88k-motorola-sysv4
479ee3138f1Smrg	exit ;;
480ee3138f1Smrg    m88k:*:3*:R3*)
481ee3138f1Smrg	echo m88k-motorola-sysv3
482ee3138f1Smrg	exit ;;
483ee3138f1Smrg    AViiON:dgux:*:*)
484ee3138f1Smrg        # DG/UX returns AViiON for all architectures
485ee3138f1Smrg        UNAME_PROCESSOR=`/usr/bin/uname -p`
486ee3138f1Smrg	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
487ee3138f1Smrg	then
488ee3138f1Smrg	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
489ee3138f1Smrg	       [ ${TARGET_BINARY_INTERFACE}x = x ]
490ee3138f1Smrg	    then
491ee3138f1Smrg		echo m88k-dg-dgux${UNAME_RELEASE}
492ee3138f1Smrg	    else
493ee3138f1Smrg		echo m88k-dg-dguxbcs${UNAME_RELEASE}
494ee3138f1Smrg	    fi
495ee3138f1Smrg	else
496ee3138f1Smrg	    echo i586-dg-dgux${UNAME_RELEASE}
497ee3138f1Smrg	fi
498ee3138f1Smrg 	exit ;;
499ee3138f1Smrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
500ee3138f1Smrg	echo m88k-dolphin-sysv3
501ee3138f1Smrg	exit ;;
502ee3138f1Smrg    M88*:*:R3*:*)
503ee3138f1Smrg	# Delta 88k system running SVR3
504ee3138f1Smrg	echo m88k-motorola-sysv3
505ee3138f1Smrg	exit ;;
506ee3138f1Smrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
507ee3138f1Smrg	echo m88k-tektronix-sysv3
508ee3138f1Smrg	exit ;;
509ee3138f1Smrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
510ee3138f1Smrg	echo m68k-tektronix-bsd
511ee3138f1Smrg	exit ;;
512ee3138f1Smrg    *:IRIX*:*:*)
513ee3138f1Smrg	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
514ee3138f1Smrg	exit ;;
515ee3138f1Smrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
516ee3138f1Smrg	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
517ee3138f1Smrg	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
518ee3138f1Smrg    i*86:AIX:*:*)
519ee3138f1Smrg	echo i386-ibm-aix
520ee3138f1Smrg	exit ;;
521ee3138f1Smrg    ia64:AIX:*:*)
522ee3138f1Smrg	if [ -x /usr/bin/oslevel ] ; then
523ee3138f1Smrg		IBM_REV=`/usr/bin/oslevel`
524ee3138f1Smrg	else
525ee3138f1Smrg		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
526ee3138f1Smrg	fi
527ee3138f1Smrg	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
528ee3138f1Smrg	exit ;;
529ee3138f1Smrg    *:AIX:2:3)
530ee3138f1Smrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
531ee3138f1Smrg		eval $set_cc_for_build
532ee3138f1Smrg		sed 's/^		//' << EOF >$dummy.c
533ee3138f1Smrg		#include <sys/systemcfg.h>
534ee3138f1Smrg
535ee3138f1Smrg		main()
536ee3138f1Smrg			{
537ee3138f1Smrg			if (!__power_pc())
538ee3138f1Smrg				exit(1);
539ee3138f1Smrg			puts("powerpc-ibm-aix3.2.5");
540ee3138f1Smrg			exit(0);
541ee3138f1Smrg			}
542ee3138f1SmrgEOF
543ee3138f1Smrg		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
544ee3138f1Smrg		then
545ee3138f1Smrg			echo "$SYSTEM_NAME"
546ee3138f1Smrg		else
547ee3138f1Smrg			echo rs6000-ibm-aix3.2.5
548ee3138f1Smrg		fi
549ee3138f1Smrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
550ee3138f1Smrg		echo rs6000-ibm-aix3.2.4
551ee3138f1Smrg	else
552ee3138f1Smrg		echo rs6000-ibm-aix3.2
553ee3138f1Smrg	fi
554ee3138f1Smrg	exit ;;
555b425557eSmrg    *:AIX:*:[4567])
556ee3138f1Smrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
557ee3138f1Smrg	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
558ee3138f1Smrg		IBM_ARCH=rs6000
559ee3138f1Smrg	else
560ee3138f1Smrg		IBM_ARCH=powerpc
561ee3138f1Smrg	fi
562ee3138f1Smrg	if [ -x /usr/bin/oslevel ] ; then
563ee3138f1Smrg		IBM_REV=`/usr/bin/oslevel`
564ee3138f1Smrg	else
565ee3138f1Smrg		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
566ee3138f1Smrg	fi
567ee3138f1Smrg	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
568ee3138f1Smrg	exit ;;
569ee3138f1Smrg    *:AIX:*:*)
570ee3138f1Smrg	echo rs6000-ibm-aix
571ee3138f1Smrg	exit ;;
572ee3138f1Smrg    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
573ee3138f1Smrg	echo romp-ibm-bsd4.4
574ee3138f1Smrg	exit ;;
575ee3138f1Smrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
576ee3138f1Smrg	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
577ee3138f1Smrg	exit ;;                             # report: romp-ibm BSD 4.3
578ee3138f1Smrg    *:BOSX:*:*)
579ee3138f1Smrg	echo rs6000-bull-bosx
580ee3138f1Smrg	exit ;;
581ee3138f1Smrg    DPX/2?00:B.O.S.:*:*)
582ee3138f1Smrg	echo m68k-bull-sysv3
583ee3138f1Smrg	exit ;;
584ee3138f1Smrg    9000/[34]??:4.3bsd:1.*:*)
585ee3138f1Smrg	echo m68k-hp-bsd
586ee3138f1Smrg	exit ;;
587ee3138f1Smrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
588ee3138f1Smrg	echo m68k-hp-bsd4.4
589ee3138f1Smrg	exit ;;
590ee3138f1Smrg    9000/[34678]??:HP-UX:*:*)
591ee3138f1Smrg	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
592ee3138f1Smrg	case "${UNAME_MACHINE}" in
593ee3138f1Smrg	    9000/31? )            HP_ARCH=m68000 ;;
594ee3138f1Smrg	    9000/[34]?? )         HP_ARCH=m68k ;;
595ee3138f1Smrg	    9000/[678][0-9][0-9])
596ee3138f1Smrg		if [ -x /usr/bin/getconf ]; then
597ee3138f1Smrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
598ee3138f1Smrg                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
599ee3138f1Smrg                    case "${sc_cpu_version}" in
600ee3138f1Smrg                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
601ee3138f1Smrg                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
602ee3138f1Smrg                      532)                      # CPU_PA_RISC2_0
603ee3138f1Smrg                        case "${sc_kernel_bits}" in
604ee3138f1Smrg                          32) HP_ARCH="hppa2.0n" ;;
605ee3138f1Smrg                          64) HP_ARCH="hppa2.0w" ;;
606ee3138f1Smrg			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
607ee3138f1Smrg                        esac ;;
608ee3138f1Smrg                    esac
609ee3138f1Smrg		fi
610ee3138f1Smrg		if [ "${HP_ARCH}" = "" ]; then
611ee3138f1Smrg		    eval $set_cc_for_build
612ee3138f1Smrg		    sed 's/^              //' << EOF >$dummy.c
613ee3138f1Smrg
614ee3138f1Smrg              #define _HPUX_SOURCE
615ee3138f1Smrg              #include <stdlib.h>
616ee3138f1Smrg              #include <unistd.h>
617ee3138f1Smrg
618ee3138f1Smrg              int main ()
619ee3138f1Smrg              {
620ee3138f1Smrg              #if defined(_SC_KERNEL_BITS)
621ee3138f1Smrg                  long bits = sysconf(_SC_KERNEL_BITS);
622ee3138f1Smrg              #endif
623ee3138f1Smrg                  long cpu  = sysconf (_SC_CPU_VERSION);
624ee3138f1Smrg
625ee3138f1Smrg                  switch (cpu)
626ee3138f1Smrg              	{
627ee3138f1Smrg              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
628ee3138f1Smrg              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
629ee3138f1Smrg              	case CPU_PA_RISC2_0:
630ee3138f1Smrg              #if defined(_SC_KERNEL_BITS)
631ee3138f1Smrg              	    switch (bits)
632ee3138f1Smrg              		{
633ee3138f1Smrg              		case 64: puts ("hppa2.0w"); break;
634ee3138f1Smrg              		case 32: puts ("hppa2.0n"); break;
635ee3138f1Smrg              		default: puts ("hppa2.0"); break;
636ee3138f1Smrg              		} break;
637ee3138f1Smrg              #else  /* !defined(_SC_KERNEL_BITS) */
638ee3138f1Smrg              	    puts ("hppa2.0"); break;
639ee3138f1Smrg              #endif
640ee3138f1Smrg              	default: puts ("hppa1.0"); break;
641ee3138f1Smrg              	}
642ee3138f1Smrg                  exit (0);
643ee3138f1Smrg              }
644ee3138f1SmrgEOF
645ee3138f1Smrg		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
646ee3138f1Smrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
647ee3138f1Smrg		fi ;;
648ee3138f1Smrg	esac
649ee3138f1Smrg	if [ ${HP_ARCH} = "hppa2.0w" ]
650ee3138f1Smrg	then
651ee3138f1Smrg	    eval $set_cc_for_build
652ee3138f1Smrg
653ee3138f1Smrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
654ee3138f1Smrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
655ee3138f1Smrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
656ee3138f1Smrg	    #
657ee3138f1Smrg	    # $ CC_FOR_BUILD=cc ./config.guess
658ee3138f1Smrg	    # => hppa2.0w-hp-hpux11.23
659ee3138f1Smrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
660ee3138f1Smrg	    # => hppa64-hp-hpux11.23
661ee3138f1Smrg
662ee3138f1Smrg	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
663b425557eSmrg		grep -q __LP64__
664ee3138f1Smrg	    then
665ee3138f1Smrg		HP_ARCH="hppa2.0w"
666ee3138f1Smrg	    else
667ee3138f1Smrg		HP_ARCH="hppa64"
668ee3138f1Smrg	    fi
669ee3138f1Smrg	fi
670ee3138f1Smrg	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
671ee3138f1Smrg	exit ;;
672ee3138f1Smrg    ia64:HP-UX:*:*)
673ee3138f1Smrg	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
674ee3138f1Smrg	echo ia64-hp-hpux${HPUX_REV}
675ee3138f1Smrg	exit ;;
676ee3138f1Smrg    3050*:HI-UX:*:*)
677ee3138f1Smrg	eval $set_cc_for_build
678ee3138f1Smrg	sed 's/^	//' << EOF >$dummy.c
679ee3138f1Smrg	#include <unistd.h>
680ee3138f1Smrg	int
681ee3138f1Smrg	main ()
682ee3138f1Smrg	{
683ee3138f1Smrg	  long cpu = sysconf (_SC_CPU_VERSION);
684ee3138f1Smrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
685ee3138f1Smrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
686ee3138f1Smrg	     results, however.  */
687ee3138f1Smrg	  if (CPU_IS_PA_RISC (cpu))
688ee3138f1Smrg	    {
689ee3138f1Smrg	      switch (cpu)
690ee3138f1Smrg		{
691ee3138f1Smrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
692ee3138f1Smrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
693ee3138f1Smrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
694ee3138f1Smrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
695ee3138f1Smrg		}
696ee3138f1Smrg	    }
697ee3138f1Smrg	  else if (CPU_IS_HP_MC68K (cpu))
698ee3138f1Smrg	    puts ("m68k-hitachi-hiuxwe2");
699ee3138f1Smrg	  else puts ("unknown-hitachi-hiuxwe2");
700ee3138f1Smrg	  exit (0);
701ee3138f1Smrg	}
702ee3138f1SmrgEOF
703ee3138f1Smrg	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
704ee3138f1Smrg		{ echo "$SYSTEM_NAME"; exit; }
705ee3138f1Smrg	echo unknown-hitachi-hiuxwe2
706ee3138f1Smrg	exit ;;
707ee3138f1Smrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
708ee3138f1Smrg	echo hppa1.1-hp-bsd
709ee3138f1Smrg	exit ;;
710ee3138f1Smrg    9000/8??:4.3bsd:*:*)
711ee3138f1Smrg	echo hppa1.0-hp-bsd
712ee3138f1Smrg	exit ;;
713ee3138f1Smrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
714ee3138f1Smrg	echo hppa1.0-hp-mpeix
715ee3138f1Smrg	exit ;;
716ee3138f1Smrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
717ee3138f1Smrg	echo hppa1.1-hp-osf
718ee3138f1Smrg	exit ;;
719ee3138f1Smrg    hp8??:OSF1:*:*)
720ee3138f1Smrg	echo hppa1.0-hp-osf
721ee3138f1Smrg	exit ;;
722ee3138f1Smrg    i*86:OSF1:*:*)
723ee3138f1Smrg	if [ -x /usr/sbin/sysversion ] ; then
724ee3138f1Smrg	    echo ${UNAME_MACHINE}-unknown-osf1mk
725ee3138f1Smrg	else
726ee3138f1Smrg	    echo ${UNAME_MACHINE}-unknown-osf1
727ee3138f1Smrg	fi
728ee3138f1Smrg	exit ;;
729ee3138f1Smrg    parisc*:Lites*:*:*)
730ee3138f1Smrg	echo hppa1.1-hp-lites
731ee3138f1Smrg	exit ;;
732ee3138f1Smrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
733ee3138f1Smrg	echo c1-convex-bsd
734ee3138f1Smrg        exit ;;
735ee3138f1Smrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
736ee3138f1Smrg	if getsysinfo -f scalar_acc
737ee3138f1Smrg	then echo c32-convex-bsd
738ee3138f1Smrg	else echo c2-convex-bsd
739ee3138f1Smrg	fi
740ee3138f1Smrg        exit ;;
741ee3138f1Smrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
742ee3138f1Smrg	echo c34-convex-bsd
743ee3138f1Smrg        exit ;;
744ee3138f1Smrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
745ee3138f1Smrg	echo c38-convex-bsd
746ee3138f1Smrg        exit ;;
747ee3138f1Smrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
748ee3138f1Smrg	echo c4-convex-bsd
749ee3138f1Smrg        exit ;;
750ee3138f1Smrg    CRAY*Y-MP:*:*:*)
751ee3138f1Smrg	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
752ee3138f1Smrg	exit ;;
753ee3138f1Smrg    CRAY*[A-Z]90:*:*:*)
754ee3138f1Smrg	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
755ee3138f1Smrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
756ee3138f1Smrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
757ee3138f1Smrg	      -e 's/\.[^.]*$/.X/'
758ee3138f1Smrg	exit ;;
759ee3138f1Smrg    CRAY*TS:*:*:*)
760ee3138f1Smrg	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
761ee3138f1Smrg	exit ;;
762ee3138f1Smrg    CRAY*T3E:*:*:*)
763ee3138f1Smrg	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
764ee3138f1Smrg	exit ;;
765ee3138f1Smrg    CRAY*SV1:*:*:*)
766ee3138f1Smrg	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
767ee3138f1Smrg	exit ;;
768ee3138f1Smrg    *:UNICOS/mp:*:*)
769ee3138f1Smrg	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
770ee3138f1Smrg	exit ;;
771ee3138f1Smrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
772ee3138f1Smrg	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
773ee3138f1Smrg        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
774ee3138f1Smrg        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
775ee3138f1Smrg        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
776ee3138f1Smrg        exit ;;
777ee3138f1Smrg    5000:UNIX_System_V:4.*:*)
778ee3138f1Smrg        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
779ee3138f1Smrg        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
780ee3138f1Smrg        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
781ee3138f1Smrg	exit ;;
782ee3138f1Smrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
783ee3138f1Smrg	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
784ee3138f1Smrg	exit ;;
785ee3138f1Smrg    sparc*:BSD/OS:*:*)
786ee3138f1Smrg	echo sparc-unknown-bsdi${UNAME_RELEASE}
787ee3138f1Smrg	exit ;;
788ee3138f1Smrg    *:BSD/OS:*:*)
789ee3138f1Smrg	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
790ee3138f1Smrg	exit ;;
791ee3138f1Smrg    *:FreeBSD:*:*)
792ee3138f1Smrg	case ${UNAME_MACHINE} in
793ee3138f1Smrg	    pc98)
794ee3138f1Smrg		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
795ee3138f1Smrg	    amd64)
796ee3138f1Smrg		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
797ee3138f1Smrg	    *)
798ee3138f1Smrg		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
799ee3138f1Smrg	esac
800ee3138f1Smrg	exit ;;
801ee3138f1Smrg    i*:CYGWIN*:*)
802ee3138f1Smrg	echo ${UNAME_MACHINE}-pc-cygwin
803ee3138f1Smrg	exit ;;
804ee3138f1Smrg    *:MINGW*:*)
805ee3138f1Smrg	echo ${UNAME_MACHINE}-pc-mingw32
806ee3138f1Smrg	exit ;;
807ee3138f1Smrg    i*:windows32*:*)
808ee3138f1Smrg    	# uname -m includes "-pc" on this system.
809ee3138f1Smrg    	echo ${UNAME_MACHINE}-mingw32
810ee3138f1Smrg	exit ;;
811ee3138f1Smrg    i*:PW*:*)
812ee3138f1Smrg	echo ${UNAME_MACHINE}-pc-pw32
813ee3138f1Smrg	exit ;;
814b425557eSmrg    *:Interix*:*)
815ee3138f1Smrg    	case ${UNAME_MACHINE} in
81679a8a9c6Smrg	    x86)
817ee3138f1Smrg		echo i586-pc-interix${UNAME_RELEASE}
818ee3138f1Smrg		exit ;;
819b425557eSmrg	    authenticamd | genuineintel | EM64T)
820ee3138f1Smrg		echo x86_64-unknown-interix${UNAME_RELEASE}
821ee3138f1Smrg		exit ;;
82279a8a9c6Smrg	    IA64)
82379a8a9c6Smrg		echo ia64-unknown-interix${UNAME_RELEASE}
82479a8a9c6Smrg		exit ;;
825ee3138f1Smrg	esac ;;
826ee3138f1Smrg    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
827ee3138f1Smrg	echo i${UNAME_MACHINE}-pc-mks
828ee3138f1Smrg	exit ;;
829b425557eSmrg    8664:Windows_NT:*)
830b425557eSmrg	echo x86_64-pc-mks
831b425557eSmrg	exit ;;
832ee3138f1Smrg    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
833ee3138f1Smrg	# How do we know it's Interix rather than the generic POSIX subsystem?
834ee3138f1Smrg	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
835ee3138f1Smrg	# UNAME_MACHINE based on the output of uname instead of i386?
836ee3138f1Smrg	echo i586-pc-interix
837ee3138f1Smrg	exit ;;
838ee3138f1Smrg    i*:UWIN*:*)
839ee3138f1Smrg	echo ${UNAME_MACHINE}-pc-uwin
840ee3138f1Smrg	exit ;;
841ee3138f1Smrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
842ee3138f1Smrg	echo x86_64-unknown-cygwin
843ee3138f1Smrg	exit ;;
844ee3138f1Smrg    p*:CYGWIN*:*)
845ee3138f1Smrg	echo powerpcle-unknown-cygwin
846ee3138f1Smrg	exit ;;
847ee3138f1Smrg    prep*:SunOS:5.*:*)
848ee3138f1Smrg	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
849ee3138f1Smrg	exit ;;
850ee3138f1Smrg    *:GNU:*:*)
851ee3138f1Smrg	# the GNU system
852ee3138f1Smrg	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
853ee3138f1Smrg	exit ;;
854ee3138f1Smrg    *:GNU/*:*:*)
855ee3138f1Smrg	# other systems with GNU libc and userland
856ee3138f1Smrg	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
857ee3138f1Smrg	exit ;;
858ee3138f1Smrg    i*86:Minix:*:*)
859ee3138f1Smrg	echo ${UNAME_MACHINE}-pc-minix
860ee3138f1Smrg	exit ;;
861b425557eSmrg    alpha:Linux:*:*)
862b425557eSmrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
863b425557eSmrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
864b425557eSmrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
865b425557eSmrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
866b425557eSmrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
867b425557eSmrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
868b425557eSmrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
869b425557eSmrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
870b425557eSmrg        esac
871b425557eSmrg	objdump --private-headers /bin/sh | grep -q ld.so.1
872b425557eSmrg	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
873b425557eSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
874b425557eSmrg	exit ;;
875ee3138f1Smrg    arm*:Linux:*:*)
87679a8a9c6Smrg	eval $set_cc_for_build
87779a8a9c6Smrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
87879a8a9c6Smrg	    | grep -q __ARM_EABI__
87979a8a9c6Smrg	then
88079a8a9c6Smrg	    echo ${UNAME_MACHINE}-unknown-linux-gnu
88179a8a9c6Smrg	else
88279a8a9c6Smrg	    echo ${UNAME_MACHINE}-unknown-linux-gnueabi
88379a8a9c6Smrg	fi
884ee3138f1Smrg	exit ;;
885ee3138f1Smrg    avr32*:Linux:*:*)
886ee3138f1Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
887ee3138f1Smrg	exit ;;
888ee3138f1Smrg    cris:Linux:*:*)
889ee3138f1Smrg	echo cris-axis-linux-gnu
890ee3138f1Smrg	exit ;;
891ee3138f1Smrg    crisv32:Linux:*:*)
892ee3138f1Smrg	echo crisv32-axis-linux-gnu
893ee3138f1Smrg	exit ;;
894ee3138f1Smrg    frv:Linux:*:*)
895ee3138f1Smrg    	echo frv-unknown-linux-gnu
896ee3138f1Smrg	exit ;;
897b425557eSmrg    i*86:Linux:*:*)
898b425557eSmrg	LIBC=gnu
899b425557eSmrg	eval $set_cc_for_build
900b425557eSmrg	sed 's/^	//' << EOF >$dummy.c
901b425557eSmrg	#ifdef __dietlibc__
902b425557eSmrg	LIBC=dietlibc
903b425557eSmrg	#endif
904b425557eSmrgEOF
905b425557eSmrg	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
906b425557eSmrg	echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
907b425557eSmrg	exit ;;
908ee3138f1Smrg    ia64:Linux:*:*)
909ee3138f1Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
910ee3138f1Smrg	exit ;;
911ee3138f1Smrg    m32r*:Linux:*:*)
912ee3138f1Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
913ee3138f1Smrg	exit ;;
914ee3138f1Smrg    m68*:Linux:*:*)
915ee3138f1Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
916ee3138f1Smrg	exit ;;
917b425557eSmrg    mips:Linux:*:* | mips64:Linux:*:*)
918ee3138f1Smrg	eval $set_cc_for_build
919ee3138f1Smrg	sed 's/^	//' << EOF >$dummy.c
920ee3138f1Smrg	#undef CPU
921b425557eSmrg	#undef ${UNAME_MACHINE}
922b425557eSmrg	#undef ${UNAME_MACHINE}el
923ee3138f1Smrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
924b425557eSmrg	CPU=${UNAME_MACHINE}el
925ee3138f1Smrg	#else
926ee3138f1Smrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
927b425557eSmrg	CPU=${UNAME_MACHINE}
928ee3138f1Smrg	#else
929ee3138f1Smrg	CPU=
930ee3138f1Smrg	#endif
931ee3138f1Smrg	#endif
932ee3138f1SmrgEOF
933b425557eSmrg	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
934ee3138f1Smrg	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
935ee3138f1Smrg	;;
936ee3138f1Smrg    or32:Linux:*:*)
937ee3138f1Smrg	echo or32-unknown-linux-gnu
938ee3138f1Smrg	exit ;;
93934977a2fSmrg    padre:Linux:*:*)
94034977a2fSmrg	echo sparc-unknown-linux-gnu
94134977a2fSmrg	exit ;;
942b425557eSmrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
943b425557eSmrg	echo hppa64-unknown-linux-gnu
944b425557eSmrg	exit ;;
945ee3138f1Smrg    parisc:Linux:*:* | hppa:Linux:*:*)
946ee3138f1Smrg	# Look for CPU level
947ee3138f1Smrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
948ee3138f1Smrg	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
949ee3138f1Smrg	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
950ee3138f1Smrg	  *)    echo hppa-unknown-linux-gnu ;;
951ee3138f1Smrg	esac
952ee3138f1Smrg	exit ;;
953b425557eSmrg    ppc64:Linux:*:*)
954b425557eSmrg	echo powerpc64-unknown-linux-gnu
955b425557eSmrg	exit ;;
956b425557eSmrg    ppc:Linux:*:*)
957b425557eSmrg	echo powerpc-unknown-linux-gnu
958ee3138f1Smrg	exit ;;
959ee3138f1Smrg    s390:Linux:*:* | s390x:Linux:*:*)
960ee3138f1Smrg	echo ${UNAME_MACHINE}-ibm-linux
961ee3138f1Smrg	exit ;;
962ee3138f1Smrg    sh64*:Linux:*:*)
963ee3138f1Smrg    	echo ${UNAME_MACHINE}-unknown-linux-gnu
964ee3138f1Smrg	exit ;;
965ee3138f1Smrg    sh*:Linux:*:*)
966ee3138f1Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
967ee3138f1Smrg	exit ;;
968ee3138f1Smrg    sparc:Linux:*:* | sparc64:Linux:*:*)
969ee3138f1Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
970ee3138f1Smrg	exit ;;
971b425557eSmrg    tile*:Linux:*:*)
972b425557eSmrg	echo ${UNAME_MACHINE}-tilera-linux-gnu
973b425557eSmrg	exit ;;
974ee3138f1Smrg    vax:Linux:*:*)
975ee3138f1Smrg	echo ${UNAME_MACHINE}-dec-linux-gnu
976ee3138f1Smrg	exit ;;
977ee3138f1Smrg    x86_64:Linux:*:*)
978ee3138f1Smrg	echo x86_64-unknown-linux-gnu
979ee3138f1Smrg	exit ;;
98079a8a9c6Smrg    xtensa*:Linux:*:*)
98179a8a9c6Smrg    	echo ${UNAME_MACHINE}-unknown-linux-gnu
982ee3138f1Smrg	exit ;;
983ee3138f1Smrg    i*86:DYNIX/ptx:4*:*)
984ee3138f1Smrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
985ee3138f1Smrg	# earlier versions are messed up and put the nodename in both
986ee3138f1Smrg	# sysname and nodename.
987ee3138f1Smrg	echo i386-sequent-sysv4
988ee3138f1Smrg	exit ;;
989ee3138f1Smrg    i*86:UNIX_SV:4.2MP:2.*)
990ee3138f1Smrg        # Unixware is an offshoot of SVR4, but it has its own version
991ee3138f1Smrg        # number series starting with 2...
992ee3138f1Smrg        # I am not positive that other SVR4 systems won't match this,
993ee3138f1Smrg	# I just have to hope.  -- rms.
994ee3138f1Smrg        # Use sysv4.2uw... so that sysv4* matches it.
995ee3138f1Smrg	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
996ee3138f1Smrg	exit ;;
997ee3138f1Smrg    i*86:OS/2:*:*)
998ee3138f1Smrg	# If we were able to find `uname', then EMX Unix compatibility
999ee3138f1Smrg	# is probably installed.
1000ee3138f1Smrg	echo ${UNAME_MACHINE}-pc-os2-emx
1001ee3138f1Smrg	exit ;;
1002ee3138f1Smrg    i*86:XTS-300:*:STOP)
1003ee3138f1Smrg	echo ${UNAME_MACHINE}-unknown-stop
1004ee3138f1Smrg	exit ;;
1005ee3138f1Smrg    i*86:atheos:*:*)
1006ee3138f1Smrg	echo ${UNAME_MACHINE}-unknown-atheos
1007ee3138f1Smrg	exit ;;
1008ee3138f1Smrg    i*86:syllable:*:*)
1009ee3138f1Smrg	echo ${UNAME_MACHINE}-pc-syllable
1010ee3138f1Smrg	exit ;;
1011b425557eSmrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1012ee3138f1Smrg	echo i386-unknown-lynxos${UNAME_RELEASE}
1013ee3138f1Smrg	exit ;;
1014ee3138f1Smrg    i*86:*DOS:*:*)
1015ee3138f1Smrg	echo ${UNAME_MACHINE}-pc-msdosdjgpp
1016ee3138f1Smrg	exit ;;
1017ee3138f1Smrg    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
1018ee3138f1Smrg	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
1019ee3138f1Smrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1020ee3138f1Smrg		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
1021ee3138f1Smrg	else
1022ee3138f1Smrg		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
1023ee3138f1Smrg	fi
1024ee3138f1Smrg	exit ;;
1025ee3138f1Smrg    i*86:*:5:[678]*)
1026ee3138f1Smrg    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
1027ee3138f1Smrg	case `/bin/uname -X | grep "^Machine"` in
1028ee3138f1Smrg	    *486*)	     UNAME_MACHINE=i486 ;;
1029ee3138f1Smrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
1030ee3138f1Smrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1031ee3138f1Smrg	esac
1032ee3138f1Smrg	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1033ee3138f1Smrg	exit ;;
1034ee3138f1Smrg    i*86:*:3.2:*)
1035ee3138f1Smrg	if test -f /usr/options/cb.name; then
1036ee3138f1Smrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1037ee3138f1Smrg		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
1038ee3138f1Smrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
1039ee3138f1Smrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1040ee3138f1Smrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1041ee3138f1Smrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1042ee3138f1Smrg			&& UNAME_MACHINE=i586
1043ee3138f1Smrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1044ee3138f1Smrg			&& UNAME_MACHINE=i686
1045ee3138f1Smrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1046ee3138f1Smrg			&& UNAME_MACHINE=i686
1047ee3138f1Smrg		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
1048ee3138f1Smrg	else
1049ee3138f1Smrg		echo ${UNAME_MACHINE}-pc-sysv32
1050ee3138f1Smrg	fi
1051ee3138f1Smrg	exit ;;
1052ee3138f1Smrg    pc:*:*:*)
1053ee3138f1Smrg	# Left here for compatibility:
1054ee3138f1Smrg        # uname -m prints for DJGPP always 'pc', but it prints nothing about
105534977a2fSmrg        # the processor, so we play safe by assuming i586.
105634977a2fSmrg	# Note: whatever this is, it MUST be the same as what config.sub
105734977a2fSmrg	# prints for the "djgpp" host, or else GDB configury will decide that
105834977a2fSmrg	# this is a cross-build.
105934977a2fSmrg	echo i586-pc-msdosdjgpp
1060ee3138f1Smrg        exit ;;
1061ee3138f1Smrg    Intel:Mach:3*:*)
1062ee3138f1Smrg	echo i386-pc-mach3
1063ee3138f1Smrg	exit ;;
1064ee3138f1Smrg    paragon:*:*:*)
1065ee3138f1Smrg	echo i860-intel-osf1
1066ee3138f1Smrg	exit ;;
1067ee3138f1Smrg    i860:*:4.*:*) # i860-SVR4
1068ee3138f1Smrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1069ee3138f1Smrg	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
1070ee3138f1Smrg	else # Add other i860-SVR4 vendors below as they are discovered.
1071ee3138f1Smrg	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
1072ee3138f1Smrg	fi
1073ee3138f1Smrg	exit ;;
1074ee3138f1Smrg    mini*:CTIX:SYS*5:*)
1075ee3138f1Smrg	# "miniframe"
1076ee3138f1Smrg	echo m68010-convergent-sysv
1077ee3138f1Smrg	exit ;;
1078ee3138f1Smrg    mc68k:UNIX:SYSTEM5:3.51m)
1079ee3138f1Smrg	echo m68k-convergent-sysv
1080ee3138f1Smrg	exit ;;
1081ee3138f1Smrg    M680?0:D-NIX:5.3:*)
1082ee3138f1Smrg	echo m68k-diab-dnix
1083ee3138f1Smrg	exit ;;
1084ee3138f1Smrg    M68*:*:R3V[5678]*:*)
1085ee3138f1Smrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1086ee3138f1Smrg    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
1087ee3138f1Smrg	OS_REL=''
1088ee3138f1Smrg	test -r /etc/.relid \
1089ee3138f1Smrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1090ee3138f1Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1091ee3138f1Smrg	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1092ee3138f1Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1093ee3138f1Smrg	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1094ee3138f1Smrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1095ee3138f1Smrg        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1096ee3138f1Smrg          && { echo i486-ncr-sysv4; exit; } ;;
109734977a2fSmrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
109834977a2fSmrg	OS_REL='.3'
109934977a2fSmrg	test -r /etc/.relid \
110034977a2fSmrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
110134977a2fSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
110234977a2fSmrg	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
110334977a2fSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
110434977a2fSmrg	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
110534977a2fSmrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
110634977a2fSmrg	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1107ee3138f1Smrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1108ee3138f1Smrg	echo m68k-unknown-lynxos${UNAME_RELEASE}
1109ee3138f1Smrg	exit ;;
1110ee3138f1Smrg    mc68030:UNIX_System_V:4.*:*)
1111ee3138f1Smrg	echo m68k-atari-sysv4
1112ee3138f1Smrg	exit ;;
1113ee3138f1Smrg    TSUNAMI:LynxOS:2.*:*)
1114ee3138f1Smrg	echo sparc-unknown-lynxos${UNAME_RELEASE}
1115ee3138f1Smrg	exit ;;
1116ee3138f1Smrg    rs6000:LynxOS:2.*:*)
1117ee3138f1Smrg	echo rs6000-unknown-lynxos${UNAME_RELEASE}
1118ee3138f1Smrg	exit ;;
1119b425557eSmrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1120ee3138f1Smrg	echo powerpc-unknown-lynxos${UNAME_RELEASE}
1121ee3138f1Smrg	exit ;;
1122ee3138f1Smrg    SM[BE]S:UNIX_SV:*:*)
1123ee3138f1Smrg	echo mips-dde-sysv${UNAME_RELEASE}
1124ee3138f1Smrg	exit ;;
1125ee3138f1Smrg    RM*:ReliantUNIX-*:*:*)
1126ee3138f1Smrg	echo mips-sni-sysv4
1127ee3138f1Smrg	exit ;;
1128ee3138f1Smrg    RM*:SINIX-*:*:*)
1129ee3138f1Smrg	echo mips-sni-sysv4
1130ee3138f1Smrg	exit ;;
1131ee3138f1Smrg    *:SINIX-*:*:*)
1132ee3138f1Smrg	if uname -p 2>/dev/null >/dev/null ; then
1133ee3138f1Smrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1134ee3138f1Smrg		echo ${UNAME_MACHINE}-sni-sysv4
1135ee3138f1Smrg	else
1136ee3138f1Smrg		echo ns32k-sni-sysv
1137ee3138f1Smrg	fi
1138ee3138f1Smrg	exit ;;
1139ee3138f1Smrg    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1140ee3138f1Smrg                      # says <Richard.M.Bartel@ccMail.Census.GOV>
1141ee3138f1Smrg        echo i586-unisys-sysv4
1142ee3138f1Smrg        exit ;;
1143ee3138f1Smrg    *:UNIX_System_V:4*:FTX*)
1144ee3138f1Smrg	# From Gerald Hewes <hewes@openmarket.com>.
1145ee3138f1Smrg	# How about differentiating between stratus architectures? -djm
1146ee3138f1Smrg	echo hppa1.1-stratus-sysv4
1147ee3138f1Smrg	exit ;;
1148ee3138f1Smrg    *:*:*:FTX*)
1149ee3138f1Smrg	# From seanf@swdc.stratus.com.
1150ee3138f1Smrg	echo i860-stratus-sysv4
1151ee3138f1Smrg	exit ;;
1152ee3138f1Smrg    i*86:VOS:*:*)
1153ee3138f1Smrg	# From Paul.Green@stratus.com.
1154ee3138f1Smrg	echo ${UNAME_MACHINE}-stratus-vos
1155ee3138f1Smrg	exit ;;
1156ee3138f1Smrg    *:VOS:*:*)
1157ee3138f1Smrg	# From Paul.Green@stratus.com.
1158ee3138f1Smrg	echo hppa1.1-stratus-vos
1159ee3138f1Smrg	exit ;;
1160ee3138f1Smrg    mc68*:A/UX:*:*)
1161ee3138f1Smrg	echo m68k-apple-aux${UNAME_RELEASE}
1162ee3138f1Smrg	exit ;;
1163ee3138f1Smrg    news*:NEWS-OS:6*:*)
1164ee3138f1Smrg	echo mips-sony-newsos6
1165ee3138f1Smrg	exit ;;
1166ee3138f1Smrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1167ee3138f1Smrg	if [ -d /usr/nec ]; then
1168ee3138f1Smrg	        echo mips-nec-sysv${UNAME_RELEASE}
1169ee3138f1Smrg	else
1170ee3138f1Smrg	        echo mips-unknown-sysv${UNAME_RELEASE}
1171ee3138f1Smrg	fi
1172ee3138f1Smrg        exit ;;
1173ee3138f1Smrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1174ee3138f1Smrg	echo powerpc-be-beos
1175ee3138f1Smrg	exit ;;
1176ee3138f1Smrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1177ee3138f1Smrg	echo powerpc-apple-beos
1178ee3138f1Smrg	exit ;;
1179ee3138f1Smrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1180ee3138f1Smrg	echo i586-pc-beos
1181ee3138f1Smrg	exit ;;
118234977a2fSmrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
118334977a2fSmrg	echo i586-pc-haiku
118434977a2fSmrg	exit ;;
1185ee3138f1Smrg    SX-4:SUPER-UX:*:*)
1186ee3138f1Smrg	echo sx4-nec-superux${UNAME_RELEASE}
1187ee3138f1Smrg	exit ;;
1188ee3138f1Smrg    SX-5:SUPER-UX:*:*)
1189ee3138f1Smrg	echo sx5-nec-superux${UNAME_RELEASE}
1190ee3138f1Smrg	exit ;;
1191ee3138f1Smrg    SX-6:SUPER-UX:*:*)
1192ee3138f1Smrg	echo sx6-nec-superux${UNAME_RELEASE}
1193ee3138f1Smrg	exit ;;
1194ee3138f1Smrg    SX-7:SUPER-UX:*:*)
1195ee3138f1Smrg	echo sx7-nec-superux${UNAME_RELEASE}
1196ee3138f1Smrg	exit ;;
1197ee3138f1Smrg    SX-8:SUPER-UX:*:*)
1198ee3138f1Smrg	echo sx8-nec-superux${UNAME_RELEASE}
1199ee3138f1Smrg	exit ;;
1200ee3138f1Smrg    SX-8R:SUPER-UX:*:*)
1201ee3138f1Smrg	echo sx8r-nec-superux${UNAME_RELEASE}
1202ee3138f1Smrg	exit ;;
1203ee3138f1Smrg    Power*:Rhapsody:*:*)
1204ee3138f1Smrg	echo powerpc-apple-rhapsody${UNAME_RELEASE}
1205ee3138f1Smrg	exit ;;
1206ee3138f1Smrg    *:Rhapsody:*:*)
1207ee3138f1Smrg	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
1208ee3138f1Smrg	exit ;;
1209ee3138f1Smrg    *:Darwin:*:*)
1210ee3138f1Smrg	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1211ee3138f1Smrg	case $UNAME_PROCESSOR in
1212b425557eSmrg	    i386)
1213b425557eSmrg		eval $set_cc_for_build
1214b425557eSmrg		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
1215b425557eSmrg		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1216b425557eSmrg		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
1217b425557eSmrg		      grep IS_64BIT_ARCH >/dev/null
1218b425557eSmrg		  then
1219b425557eSmrg		      UNAME_PROCESSOR="x86_64"
1220b425557eSmrg		  fi
1221b425557eSmrg		fi ;;
1222ee3138f1Smrg	    unknown) UNAME_PROCESSOR=powerpc ;;
1223ee3138f1Smrg	esac
1224ee3138f1Smrg	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
1225ee3138f1Smrg	exit ;;
1226ee3138f1Smrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1227ee3138f1Smrg	UNAME_PROCESSOR=`uname -p`
1228ee3138f1Smrg	if test "$UNAME_PROCESSOR" = "x86"; then
1229ee3138f1Smrg		UNAME_PROCESSOR=i386
1230ee3138f1Smrg		UNAME_MACHINE=pc
1231ee3138f1Smrg	fi
1232ee3138f1Smrg	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
1233ee3138f1Smrg	exit ;;
1234ee3138f1Smrg    *:QNX:*:4*)
1235ee3138f1Smrg	echo i386-pc-qnx
1236ee3138f1Smrg	exit ;;
1237ee3138f1Smrg    NSE-?:NONSTOP_KERNEL:*:*)
1238ee3138f1Smrg	echo nse-tandem-nsk${UNAME_RELEASE}
1239ee3138f1Smrg	exit ;;
1240ee3138f1Smrg    NSR-?:NONSTOP_KERNEL:*:*)
1241ee3138f1Smrg	echo nsr-tandem-nsk${UNAME_RELEASE}
1242ee3138f1Smrg	exit ;;
1243ee3138f1Smrg    *:NonStop-UX:*:*)
1244ee3138f1Smrg	echo mips-compaq-nonstopux
1245ee3138f1Smrg	exit ;;
1246ee3138f1Smrg    BS2000:POSIX*:*:*)
1247ee3138f1Smrg	echo bs2000-siemens-sysv
1248ee3138f1Smrg	exit ;;
1249ee3138f1Smrg    DS/*:UNIX_System_V:*:*)
1250ee3138f1Smrg	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
1251ee3138f1Smrg	exit ;;
1252ee3138f1Smrg    *:Plan9:*:*)
1253ee3138f1Smrg	# "uname -m" is not consistent, so use $cputype instead. 386
1254ee3138f1Smrg	# is converted to i386 for consistency with other x86
1255ee3138f1Smrg	# operating systems.
1256ee3138f1Smrg	if test "$cputype" = "386"; then
1257ee3138f1Smrg	    UNAME_MACHINE=i386
1258ee3138f1Smrg	else
1259ee3138f1Smrg	    UNAME_MACHINE="$cputype"
1260ee3138f1Smrg	fi
1261ee3138f1Smrg	echo ${UNAME_MACHINE}-unknown-plan9
1262ee3138f1Smrg	exit ;;
1263ee3138f1Smrg    *:TOPS-10:*:*)
1264ee3138f1Smrg	echo pdp10-unknown-tops10
1265ee3138f1Smrg	exit ;;
1266ee3138f1Smrg    *:TENEX:*:*)
1267ee3138f1Smrg	echo pdp10-unknown-tenex
1268ee3138f1Smrg	exit ;;
1269ee3138f1Smrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1270ee3138f1Smrg	echo pdp10-dec-tops20
1271ee3138f1Smrg	exit ;;
1272ee3138f1Smrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1273ee3138f1Smrg	echo pdp10-xkl-tops20
1274ee3138f1Smrg	exit ;;
1275ee3138f1Smrg    *:TOPS-20:*:*)
1276ee3138f1Smrg	echo pdp10-unknown-tops20
1277ee3138f1Smrg	exit ;;
1278ee3138f1Smrg    *:ITS:*:*)
1279ee3138f1Smrg	echo pdp10-unknown-its
1280ee3138f1Smrg	exit ;;
1281ee3138f1Smrg    SEI:*:*:SEIUX)
1282ee3138f1Smrg        echo mips-sei-seiux${UNAME_RELEASE}
1283ee3138f1Smrg	exit ;;
1284ee3138f1Smrg    *:DragonFly:*:*)
1285ee3138f1Smrg	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
1286ee3138f1Smrg	exit ;;
1287ee3138f1Smrg    *:*VMS:*:*)
1288ee3138f1Smrg    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1289ee3138f1Smrg	case "${UNAME_MACHINE}" in
1290ee3138f1Smrg	    A*) echo alpha-dec-vms ; exit ;;
1291ee3138f1Smrg	    I*) echo ia64-dec-vms ; exit ;;
1292ee3138f1Smrg	    V*) echo vax-dec-vms ; exit ;;
1293ee3138f1Smrg	esac ;;
1294ee3138f1Smrg    *:XENIX:*:SysV)
1295ee3138f1Smrg	echo i386-pc-xenix
1296ee3138f1Smrg	exit ;;
1297ee3138f1Smrg    i*86:skyos:*:*)
1298ee3138f1Smrg	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
1299ee3138f1Smrg	exit ;;
1300ee3138f1Smrg    i*86:rdos:*:*)
1301ee3138f1Smrg	echo ${UNAME_MACHINE}-pc-rdos
1302ee3138f1Smrg	exit ;;
130334977a2fSmrg    i*86:AROS:*:*)
130434977a2fSmrg	echo ${UNAME_MACHINE}-pc-aros
130534977a2fSmrg	exit ;;
1306ee3138f1Smrgesac
1307ee3138f1Smrg
1308ee3138f1Smrg#echo '(No uname command or uname output not recognized.)' 1>&2
1309ee3138f1Smrg#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
1310ee3138f1Smrg
1311ee3138f1Smrgeval $set_cc_for_build
1312ee3138f1Smrgcat >$dummy.c <<EOF
1313ee3138f1Smrg#ifdef _SEQUENT_
1314ee3138f1Smrg# include <sys/types.h>
1315ee3138f1Smrg# include <sys/utsname.h>
1316ee3138f1Smrg#endif
1317ee3138f1Smrgmain ()
1318ee3138f1Smrg{
1319ee3138f1Smrg#if defined (sony)
1320ee3138f1Smrg#if defined (MIPSEB)
1321ee3138f1Smrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1322ee3138f1Smrg     I don't know....  */
1323ee3138f1Smrg  printf ("mips-sony-bsd\n"); exit (0);
1324ee3138f1Smrg#else
1325ee3138f1Smrg#include <sys/param.h>
1326ee3138f1Smrg  printf ("m68k-sony-newsos%s\n",
1327ee3138f1Smrg#ifdef NEWSOS4
1328ee3138f1Smrg          "4"
1329ee3138f1Smrg#else
1330ee3138f1Smrg	  ""
1331ee3138f1Smrg#endif
1332ee3138f1Smrg         ); exit (0);
1333ee3138f1Smrg#endif
1334ee3138f1Smrg#endif
1335ee3138f1Smrg
1336ee3138f1Smrg#if defined (__arm) && defined (__acorn) && defined (__unix)
1337ee3138f1Smrg  printf ("arm-acorn-riscix\n"); exit (0);
1338ee3138f1Smrg#endif
1339ee3138f1Smrg
1340ee3138f1Smrg#if defined (hp300) && !defined (hpux)
1341ee3138f1Smrg  printf ("m68k-hp-bsd\n"); exit (0);
1342ee3138f1Smrg#endif
1343ee3138f1Smrg
1344ee3138f1Smrg#if defined (NeXT)
1345ee3138f1Smrg#if !defined (__ARCHITECTURE__)
1346ee3138f1Smrg#define __ARCHITECTURE__ "m68k"
1347ee3138f1Smrg#endif
1348ee3138f1Smrg  int version;
1349ee3138f1Smrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1350ee3138f1Smrg  if (version < 4)
1351ee3138f1Smrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1352ee3138f1Smrg  else
1353ee3138f1Smrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1354ee3138f1Smrg  exit (0);
1355ee3138f1Smrg#endif
1356ee3138f1Smrg
1357ee3138f1Smrg#if defined (MULTIMAX) || defined (n16)
1358ee3138f1Smrg#if defined (UMAXV)
1359ee3138f1Smrg  printf ("ns32k-encore-sysv\n"); exit (0);
1360ee3138f1Smrg#else
1361ee3138f1Smrg#if defined (CMU)
1362ee3138f1Smrg  printf ("ns32k-encore-mach\n"); exit (0);
1363ee3138f1Smrg#else
1364ee3138f1Smrg  printf ("ns32k-encore-bsd\n"); exit (0);
1365ee3138f1Smrg#endif
1366ee3138f1Smrg#endif
1367ee3138f1Smrg#endif
1368ee3138f1Smrg
1369ee3138f1Smrg#if defined (__386BSD__)
1370ee3138f1Smrg  printf ("i386-pc-bsd\n"); exit (0);
1371ee3138f1Smrg#endif
1372ee3138f1Smrg
1373ee3138f1Smrg#if defined (sequent)
1374ee3138f1Smrg#if defined (i386)
1375ee3138f1Smrg  printf ("i386-sequent-dynix\n"); exit (0);
1376ee3138f1Smrg#endif
1377ee3138f1Smrg#if defined (ns32000)
1378ee3138f1Smrg  printf ("ns32k-sequent-dynix\n"); exit (0);
1379ee3138f1Smrg#endif
1380ee3138f1Smrg#endif
1381ee3138f1Smrg
1382ee3138f1Smrg#if defined (_SEQUENT_)
1383ee3138f1Smrg    struct utsname un;
1384ee3138f1Smrg
1385ee3138f1Smrg    uname(&un);
1386ee3138f1Smrg
1387ee3138f1Smrg    if (strncmp(un.version, "V2", 2) == 0) {
1388ee3138f1Smrg	printf ("i386-sequent-ptx2\n"); exit (0);
1389ee3138f1Smrg    }
1390ee3138f1Smrg    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1391ee3138f1Smrg	printf ("i386-sequent-ptx1\n"); exit (0);
1392ee3138f1Smrg    }
1393ee3138f1Smrg    printf ("i386-sequent-ptx\n"); exit (0);
1394ee3138f1Smrg
1395ee3138f1Smrg#endif
1396ee3138f1Smrg
1397ee3138f1Smrg#if defined (vax)
1398ee3138f1Smrg# if !defined (ultrix)
1399ee3138f1Smrg#  include <sys/param.h>
1400ee3138f1Smrg#  if defined (BSD)
1401ee3138f1Smrg#   if BSD == 43
1402ee3138f1Smrg      printf ("vax-dec-bsd4.3\n"); exit (0);
1403ee3138f1Smrg#   else
1404ee3138f1Smrg#    if BSD == 199006
1405ee3138f1Smrg      printf ("vax-dec-bsd4.3reno\n"); exit (0);
1406ee3138f1Smrg#    else
1407ee3138f1Smrg      printf ("vax-dec-bsd\n"); exit (0);
1408ee3138f1Smrg#    endif
1409ee3138f1Smrg#   endif
1410ee3138f1Smrg#  else
1411ee3138f1Smrg    printf ("vax-dec-bsd\n"); exit (0);
1412ee3138f1Smrg#  endif
1413ee3138f1Smrg# else
1414ee3138f1Smrg    printf ("vax-dec-ultrix\n"); exit (0);
1415ee3138f1Smrg# endif
1416ee3138f1Smrg#endif
1417ee3138f1Smrg
1418ee3138f1Smrg#if defined (alliant) && defined (i860)
1419ee3138f1Smrg  printf ("i860-alliant-bsd\n"); exit (0);
1420ee3138f1Smrg#endif
1421ee3138f1Smrg
1422ee3138f1Smrg  exit (1);
1423ee3138f1Smrg}
1424ee3138f1SmrgEOF
1425ee3138f1Smrg
1426ee3138f1Smrg$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
1427ee3138f1Smrg	{ echo "$SYSTEM_NAME"; exit; }
1428ee3138f1Smrg
1429ee3138f1Smrg# Apollos put the system type in the environment.
1430ee3138f1Smrg
1431ee3138f1Smrgtest -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
1432ee3138f1Smrg
1433ee3138f1Smrg# Convex versions that predate uname can use getsysinfo(1)
1434ee3138f1Smrg
1435ee3138f1Smrgif [ -x /usr/convex/getsysinfo ]
1436ee3138f1Smrgthen
1437ee3138f1Smrg    case `getsysinfo -f cpu_type` in
1438ee3138f1Smrg    c1*)
1439ee3138f1Smrg	echo c1-convex-bsd
1440ee3138f1Smrg	exit ;;
1441ee3138f1Smrg    c2*)
1442ee3138f1Smrg	if getsysinfo -f scalar_acc
1443ee3138f1Smrg	then echo c32-convex-bsd
1444ee3138f1Smrg	else echo c2-convex-bsd
1445ee3138f1Smrg	fi
1446ee3138f1Smrg	exit ;;
1447ee3138f1Smrg    c34*)
1448ee3138f1Smrg	echo c34-convex-bsd
1449ee3138f1Smrg	exit ;;
1450ee3138f1Smrg    c38*)
1451ee3138f1Smrg	echo c38-convex-bsd
1452ee3138f1Smrg	exit ;;
1453ee3138f1Smrg    c4*)
1454ee3138f1Smrg	echo c4-convex-bsd
1455ee3138f1Smrg	exit ;;
1456ee3138f1Smrg    esac
1457ee3138f1Smrgfi
1458ee3138f1Smrg
1459ee3138f1Smrgcat >&2 <<EOF
1460ee3138f1Smrg$0: unable to guess system type
1461ee3138f1Smrg
1462ee3138f1SmrgThis script, last modified $timestamp, has failed to recognize
1463ee3138f1Smrgthe operating system you are using. It is advised that you
1464ee3138f1Smrgdownload the most up to date version of the config scripts from
1465ee3138f1Smrg
146679a8a9c6Smrg  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
1467ee3138f1Smrgand
146879a8a9c6Smrg  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
1469ee3138f1Smrg
1470ee3138f1SmrgIf the version you run ($0) is already up to date, please
1471ee3138f1Smrgsend the following data and any information you think might be
1472ee3138f1Smrgpertinent to <config-patches@gnu.org> in order to provide the needed
1473ee3138f1Smrginformation to handle your system.
1474ee3138f1Smrg
1475ee3138f1Smrgconfig.guess timestamp = $timestamp
1476ee3138f1Smrg
1477ee3138f1Smrguname -m = `(uname -m) 2>/dev/null || echo unknown`
1478ee3138f1Smrguname -r = `(uname -r) 2>/dev/null || echo unknown`
1479ee3138f1Smrguname -s = `(uname -s) 2>/dev/null || echo unknown`
1480ee3138f1Smrguname -v = `(uname -v) 2>/dev/null || echo unknown`
1481ee3138f1Smrg
1482ee3138f1Smrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1483ee3138f1Smrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1484ee3138f1Smrg
1485ee3138f1Smrghostinfo               = `(hostinfo) 2>/dev/null`
1486ee3138f1Smrg/bin/universe          = `(/bin/universe) 2>/dev/null`
1487ee3138f1Smrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1488ee3138f1Smrg/bin/arch              = `(/bin/arch) 2>/dev/null`
1489ee3138f1Smrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1490ee3138f1Smrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1491ee3138f1Smrg
1492ee3138f1SmrgUNAME_MACHINE = ${UNAME_MACHINE}
1493ee3138f1SmrgUNAME_RELEASE = ${UNAME_RELEASE}
1494ee3138f1SmrgUNAME_SYSTEM  = ${UNAME_SYSTEM}
1495ee3138f1SmrgUNAME_VERSION = ${UNAME_VERSION}
1496ee3138f1SmrgEOF
1497ee3138f1Smrg
1498ee3138f1Smrgexit 1
1499ee3138f1Smrg
1500ee3138f1Smrg# Local variables:
1501ee3138f1Smrg# eval: (add-hook 'write-file-hooks 'time-stamp)
1502ee3138f1Smrg# time-stamp-start: "timestamp='"
1503ee3138f1Smrg# time-stamp-format: "%:y-%02m-%02d"
1504ee3138f1Smrg# time-stamp-end: "'"
1505ee3138f1Smrg# End:
1506