1234949Sbapt#! /bin/sh
2234949Sbapt# Attempt to guess a canonical system name.
3268899Sbapt#   Copyright 1992-2014 Free Software Foundation, Inc.
4234949Sbapt
5268899Sbapttimestamp='2014-03-23'
6234949Sbapt
7234949Sbapt# This file is free software; you can redistribute it and/or modify it
8234949Sbapt# under the terms of the GNU General Public License as published by
9251143Sbapt# the Free Software Foundation; either version 3 of the License, or
10234949Sbapt# (at your option) any later version.
11234949Sbapt#
12234949Sbapt# This program is distributed in the hope that it will be useful, but
13234949Sbapt# WITHOUT ANY WARRANTY; without even the implied warranty of
14234949Sbapt# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15234949Sbapt# General Public License for more details.
16234949Sbapt#
17234949Sbapt# You should have received a copy of the GNU General Public License
18251143Sbapt# along with this program; if not, see <http://www.gnu.org/licenses/>.
19234949Sbapt#
20234949Sbapt# As a special exception to the GNU General Public License, if you
21234949Sbapt# distribute this file as part of a program that contains a
22234949Sbapt# configuration script generated by Autoconf, you may include it under
23251143Sbapt# the same distribution terms that you use for the rest of that
24251143Sbapt# program.  This Exception is an additional permission under section 7
25251143Sbapt# of the GNU General Public License, version 3 ("GPLv3").
26234949Sbapt#
27251143Sbapt# Originally written by Per Bothner.
28234949Sbapt#
29234949Sbapt# You can get the latest version of this script from:
30234949Sbapt# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
31251143Sbapt#
32251143Sbapt# Please send patches with a ChangeLog entry to config-patches@gnu.org.
33234949Sbapt
34251143Sbapt
35234949Sbaptme=`echo "$0" | sed -e 's,.*/,,'`
36234949Sbapt
37234949Sbaptusage="\
38234949SbaptUsage: $0 [OPTION]
39234949Sbapt
40234949SbaptOutput the configuration name of the system \`$me' is run on.
41234949Sbapt
42234949SbaptOperation modes:
43234949Sbapt  -h, --help         print this help, then exit
44234949Sbapt  -t, --time-stamp   print date of last modification, then exit
45234949Sbapt  -v, --version      print version number, then exit
46234949Sbapt
47234949SbaptReport bugs and patches to <config-patches@gnu.org>."
48234949Sbapt
49234949Sbaptversion="\
50234949SbaptGNU config.guess ($timestamp)
51234949Sbapt
52234949SbaptOriginally written by Per Bothner.
53268899SbaptCopyright 1992-2014 Free Software Foundation, Inc.
54234949Sbapt
55234949SbaptThis is free software; see the source for copying conditions.  There is NO
56234949Sbaptwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
57234949Sbapt
58234949Sbapthelp="
59234949SbaptTry \`$me --help' for more information."
60234949Sbapt
61234949Sbapt# Parse command line
62234949Sbaptwhile test $# -gt 0 ; do
63234949Sbapt  case $1 in
64234949Sbapt    --time-stamp | --time* | -t )
65234949Sbapt       echo "$timestamp" ; exit ;;
66234949Sbapt    --version | -v )
67234949Sbapt       echo "$version" ; exit ;;
68234949Sbapt    --help | --h* | -h )
69234949Sbapt       echo "$usage"; exit ;;
70234949Sbapt    -- )     # Stop option processing
71234949Sbapt       shift; break ;;
72234949Sbapt    - )	# Use stdin as input.
73234949Sbapt       break ;;
74234949Sbapt    -* )
75234949Sbapt       echo "$me: invalid option $1$help" >&2
76234949Sbapt       exit 1 ;;
77234949Sbapt    * )
78234949Sbapt       break ;;
79234949Sbapt  esac
80234949Sbaptdone
81234949Sbapt
82234949Sbaptif test $# != 0; then
83234949Sbapt  echo "$me: too many arguments$help" >&2
84234949Sbapt  exit 1
85234949Sbaptfi
86234949Sbapt
87234949Sbapttrap 'exit 1' 1 2 15
88234949Sbapt
89234949Sbapt# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
90234949Sbapt# compiler to aid in system detection is discouraged as it requires
91234949Sbapt# temporary files to be created and, as you can see below, it is a
92234949Sbapt# headache to deal with in a portable fashion.
93234949Sbapt
94234949Sbapt# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
95234949Sbapt# use `HOST_CC' if defined, but it is deprecated.
96234949Sbapt
97234949Sbapt# Portable tmp directory creation inspired by the Autoconf team.
98234949Sbapt
99234949Sbaptset_cc_for_build='
100234949Sbapttrap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
101234949Sbapttrap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
102234949Sbapt: ${TMPDIR=/tmp} ;
103234949Sbapt { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
104234949Sbapt { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
105234949Sbapt { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
106234949Sbapt { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
107234949Sbaptdummy=$tmp/dummy ;
108234949Sbapttmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
109234949Sbaptcase $CC_FOR_BUILD,$HOST_CC,$CC in
110234949Sbapt ,,)    echo "int x;" > $dummy.c ;
111234949Sbapt	for c in cc gcc c89 c99 ; do
112234949Sbapt	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
113234949Sbapt	     CC_FOR_BUILD="$c"; break ;
114234949Sbapt	  fi ;
115234949Sbapt	done ;
116234949Sbapt	if test x"$CC_FOR_BUILD" = x ; then
117234949Sbapt	  CC_FOR_BUILD=no_compiler_found ;
118234949Sbapt	fi
119234949Sbapt	;;
120234949Sbapt ,,*)   CC_FOR_BUILD=$CC ;;
121234949Sbapt ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
122234949Sbaptesac ; set_cc_for_build= ;'
123234949Sbapt
124234949Sbapt# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
125234949Sbapt# (ghazi@noc.rutgers.edu 1994-08-24)
126234949Sbaptif (test -f /.attbin/uname) >/dev/null 2>&1 ; then
127234949Sbapt	PATH=$PATH:/.attbin ; export PATH
128234949Sbaptfi
129234949Sbapt
130234949SbaptUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
131234949SbaptUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
132234949SbaptUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
133234949SbaptUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
134234949Sbapt
135268899Sbaptcase "${UNAME_SYSTEM}" in
136268899SbaptLinux|GNU|GNU/*)
137268899Sbapt	# If the system lacks a compiler, then just pick glibc.
138268899Sbapt	# We could probably try harder.
139268899Sbapt	LIBC=gnu
140268899Sbapt
141268899Sbapt	eval $set_cc_for_build
142268899Sbapt	cat <<-EOF > $dummy.c
143268899Sbapt	#include <features.h>
144268899Sbapt	#if defined(__UCLIBC__)
145268899Sbapt	LIBC=uclibc
146268899Sbapt	#elif defined(__dietlibc__)
147268899Sbapt	LIBC=dietlibc
148268899Sbapt	#else
149268899Sbapt	LIBC=gnu
150268899Sbapt	#endif
151268899Sbapt	EOF
152268899Sbapt	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
153268899Sbapt	;;
154268899Sbaptesac
155268899Sbapt
156234949Sbapt# Note: order is significant - the case branches are not exclusive.
157234949Sbapt
158234949Sbaptcase "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
159234949Sbapt    *:NetBSD:*:*)
160234949Sbapt	# NetBSD (nbsd) targets should (where applicable) match one or
161251143Sbapt	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
162234949Sbapt	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
163234949Sbapt	# switched to ELF, *-*-netbsd* would select the old
164234949Sbapt	# object file format.  This provides both forward
165234949Sbapt	# compatibility and a consistent mechanism for selecting the
166234949Sbapt	# object file format.
167234949Sbapt	#
168234949Sbapt	# Note: NetBSD doesn't particularly care about the vendor
169234949Sbapt	# portion of the name.  We always set it to "unknown".
170234949Sbapt	sysctl="sysctl -n hw.machine_arch"
171234949Sbapt	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
172234949Sbapt	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
173234949Sbapt	case "${UNAME_MACHINE_ARCH}" in
174234949Sbapt	    armeb) machine=armeb-unknown ;;
175234949Sbapt	    arm*) machine=arm-unknown ;;
176234949Sbapt	    sh3el) machine=shl-unknown ;;
177234949Sbapt	    sh3eb) machine=sh-unknown ;;
178234949Sbapt	    sh5el) machine=sh5le-unknown ;;
179234949Sbapt	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
180234949Sbapt	esac
181234949Sbapt	# The Operating System including object format, if it has switched
182234949Sbapt	# to ELF recently, or will in the future.
183234949Sbapt	case "${UNAME_MACHINE_ARCH}" in
184234949Sbapt	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
185234949Sbapt		eval $set_cc_for_build
186234949Sbapt		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
187234949Sbapt			| grep -q __ELF__
188234949Sbapt		then
189234949Sbapt		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
190234949Sbapt		    # Return netbsd for either.  FIX?
191234949Sbapt		    os=netbsd
192234949Sbapt		else
193234949Sbapt		    os=netbsdelf
194234949Sbapt		fi
195234949Sbapt		;;
196234949Sbapt	    *)
197234949Sbapt		os=netbsd
198234949Sbapt		;;
199234949Sbapt	esac
200234949Sbapt	# The OS release
201234949Sbapt	# Debian GNU/NetBSD machines have a different userland, and
202234949Sbapt	# thus, need a distinct triplet. However, they do not need
203234949Sbapt	# kernel version information, so it can be replaced with a
204234949Sbapt	# suitable tag, in the style of linux-gnu.
205234949Sbapt	case "${UNAME_VERSION}" in
206234949Sbapt	    Debian*)
207234949Sbapt		release='-gnu'
208234949Sbapt		;;
209234949Sbapt	    *)
210234949Sbapt		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
211234949Sbapt		;;
212234949Sbapt	esac
213234949Sbapt	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
214234949Sbapt	# contains redundant information, the shorter form:
215234949Sbapt	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
216234949Sbapt	echo "${machine}-${os}${release}"
217234949Sbapt	exit ;;
218251143Sbapt    *:Bitrig:*:*)
219251143Sbapt	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
220251143Sbapt	echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
221251143Sbapt	exit ;;
222234949Sbapt    *:OpenBSD:*:*)
223234949Sbapt	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
224234949Sbapt	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
225234949Sbapt	exit ;;
226234949Sbapt    *:ekkoBSD:*:*)
227234949Sbapt	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
228234949Sbapt	exit ;;
229234949Sbapt    *:SolidBSD:*:*)
230234949Sbapt	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
231234949Sbapt	exit ;;
232234949Sbapt    macppc:MirBSD:*:*)
233234949Sbapt	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
234234949Sbapt	exit ;;
235234949Sbapt    *:MirBSD:*:*)
236234949Sbapt	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
237234949Sbapt	exit ;;
238234949Sbapt    alpha:OSF1:*:*)
239234949Sbapt	case $UNAME_RELEASE in
240251143Sbapt	*4.0)
241234949Sbapt		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
242234949Sbapt		;;
243251143Sbapt	*5.*)
244234949Sbapt		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
245234949Sbapt		;;
246234949Sbapt	esac
247234949Sbapt	# According to Compaq, /usr/sbin/psrinfo has been available on
248234949Sbapt	# OSF/1 and Tru64 systems produced since 1995.  I hope that
249234949Sbapt	# covers most systems running today.  This code pipes the CPU
250234949Sbapt	# types through head -n 1, so we only detect the type of CPU 0.
251234949Sbapt	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
252234949Sbapt	case "$ALPHA_CPU_TYPE" in
253234949Sbapt	    "EV4 (21064)")
254234949Sbapt		UNAME_MACHINE="alpha" ;;
255234949Sbapt	    "EV4.5 (21064)")
256234949Sbapt		UNAME_MACHINE="alpha" ;;
257234949Sbapt	    "LCA4 (21066/21068)")
258234949Sbapt		UNAME_MACHINE="alpha" ;;
259234949Sbapt	    "EV5 (21164)")
260234949Sbapt		UNAME_MACHINE="alphaev5" ;;
261234949Sbapt	    "EV5.6 (21164A)")
262234949Sbapt		UNAME_MACHINE="alphaev56" ;;
263234949Sbapt	    "EV5.6 (21164PC)")
264234949Sbapt		UNAME_MACHINE="alphapca56" ;;
265234949Sbapt	    "EV5.7 (21164PC)")
266234949Sbapt		UNAME_MACHINE="alphapca57" ;;
267234949Sbapt	    "EV6 (21264)")
268234949Sbapt		UNAME_MACHINE="alphaev6" ;;
269234949Sbapt	    "EV6.7 (21264A)")
270234949Sbapt		UNAME_MACHINE="alphaev67" ;;
271234949Sbapt	    "EV6.8CB (21264C)")
272234949Sbapt		UNAME_MACHINE="alphaev68" ;;
273234949Sbapt	    "EV6.8AL (21264B)")
274234949Sbapt		UNAME_MACHINE="alphaev68" ;;
275234949Sbapt	    "EV6.8CX (21264D)")
276234949Sbapt		UNAME_MACHINE="alphaev68" ;;
277234949Sbapt	    "EV6.9A (21264/EV69A)")
278234949Sbapt		UNAME_MACHINE="alphaev69" ;;
279234949Sbapt	    "EV7 (21364)")
280234949Sbapt		UNAME_MACHINE="alphaev7" ;;
281234949Sbapt	    "EV7.9 (21364A)")
282234949Sbapt		UNAME_MACHINE="alphaev79" ;;
283234949Sbapt	esac
284234949Sbapt	# A Pn.n version is a patched version.
285234949Sbapt	# A Vn.n version is a released version.
286234949Sbapt	# A Tn.n version is a released field test version.
287234949Sbapt	# A Xn.n version is an unreleased experimental baselevel.
288234949Sbapt	# 1.2 uses "1.2" for uname -r.
289234949Sbapt	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
290234949Sbapt	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
291234949Sbapt	exitcode=$?
292234949Sbapt	trap '' 0
293234949Sbapt	exit $exitcode ;;
294234949Sbapt    Alpha\ *:Windows_NT*:*)
295234949Sbapt	# How do we know it's Interix rather than the generic POSIX subsystem?
296234949Sbapt	# Should we change UNAME_MACHINE based on the output of uname instead
297234949Sbapt	# of the specific Alpha model?
298234949Sbapt	echo alpha-pc-interix
299234949Sbapt	exit ;;
300234949Sbapt    21064:Windows_NT:50:3)
301234949Sbapt	echo alpha-dec-winnt3.5
302234949Sbapt	exit ;;
303234949Sbapt    Amiga*:UNIX_System_V:4.0:*)
304234949Sbapt	echo m68k-unknown-sysv4
305234949Sbapt	exit ;;
306234949Sbapt    *:[Aa]miga[Oo][Ss]:*:*)
307234949Sbapt	echo ${UNAME_MACHINE}-unknown-amigaos
308234949Sbapt	exit ;;
309234949Sbapt    *:[Mm]orph[Oo][Ss]:*:*)
310234949Sbapt	echo ${UNAME_MACHINE}-unknown-morphos
311234949Sbapt	exit ;;
312234949Sbapt    *:OS/390:*:*)
313234949Sbapt	echo i370-ibm-openedition
314234949Sbapt	exit ;;
315234949Sbapt    *:z/VM:*:*)
316234949Sbapt	echo s390-ibm-zvmoe
317234949Sbapt	exit ;;
318234949Sbapt    *:OS400:*:*)
319234949Sbapt	echo powerpc-ibm-os400
320234949Sbapt	exit ;;
321234949Sbapt    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
322234949Sbapt	echo arm-acorn-riscix${UNAME_RELEASE}
323234949Sbapt	exit ;;
324251143Sbapt    arm*:riscos:*:*|arm*:RISCOS:*:*)
325234949Sbapt	echo arm-unknown-riscos
326234949Sbapt	exit ;;
327234949Sbapt    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
328234949Sbapt	echo hppa1.1-hitachi-hiuxmpp
329234949Sbapt	exit ;;
330234949Sbapt    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
331234949Sbapt	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
332234949Sbapt	if test "`(/bin/universe) 2>/dev/null`" = att ; then
333234949Sbapt		echo pyramid-pyramid-sysv3
334234949Sbapt	else
335234949Sbapt		echo pyramid-pyramid-bsd
336234949Sbapt	fi
337234949Sbapt	exit ;;
338234949Sbapt    NILE*:*:*:dcosx)
339234949Sbapt	echo pyramid-pyramid-svr4
340234949Sbapt	exit ;;
341234949Sbapt    DRS?6000:unix:4.0:6*)
342234949Sbapt	echo sparc-icl-nx6
343234949Sbapt	exit ;;
344234949Sbapt    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
345234949Sbapt	case `/usr/bin/uname -p` in
346234949Sbapt	    sparc) echo sparc-icl-nx7; exit ;;
347234949Sbapt	esac ;;
348234949Sbapt    s390x:SunOS:*:*)
349234949Sbapt	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
350234949Sbapt	exit ;;
351234949Sbapt    sun4H:SunOS:5.*:*)
352234949Sbapt	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
353234949Sbapt	exit ;;
354234949Sbapt    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
355234949Sbapt	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
356234949Sbapt	exit ;;
357234949Sbapt    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
358234949Sbapt	echo i386-pc-auroraux${UNAME_RELEASE}
359234949Sbapt	exit ;;
360234949Sbapt    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
361234949Sbapt	eval $set_cc_for_build
362234949Sbapt	SUN_ARCH="i386"
363234949Sbapt	# If there is a compiler, see if it is configured for 64-bit objects.
364234949Sbapt	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
365234949Sbapt	# This test works for both compilers.
366234949Sbapt	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
367234949Sbapt	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
368234949Sbapt		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
369234949Sbapt		grep IS_64BIT_ARCH >/dev/null
370234949Sbapt	    then
371234949Sbapt		SUN_ARCH="x86_64"
372234949Sbapt	    fi
373234949Sbapt	fi
374234949Sbapt	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
375234949Sbapt	exit ;;
376234949Sbapt    sun4*:SunOS:6*:*)
377234949Sbapt	# According to config.sub, this is the proper way to canonicalize
378234949Sbapt	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
379234949Sbapt	# it's likely to be more like Solaris than SunOS4.
380234949Sbapt	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
381234949Sbapt	exit ;;
382234949Sbapt    sun4*:SunOS:*:*)
383234949Sbapt	case "`/usr/bin/arch -k`" in
384234949Sbapt	    Series*|S4*)
385234949Sbapt		UNAME_RELEASE=`uname -v`
386234949Sbapt		;;
387234949Sbapt	esac
388234949Sbapt	# Japanese Language versions have a version number like `4.1.3-JL'.
389234949Sbapt	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
390234949Sbapt	exit ;;
391234949Sbapt    sun3*:SunOS:*:*)
392234949Sbapt	echo m68k-sun-sunos${UNAME_RELEASE}
393234949Sbapt	exit ;;
394234949Sbapt    sun*:*:4.2BSD:*)
395234949Sbapt	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
396234949Sbapt	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
397234949Sbapt	case "`/bin/arch`" in
398234949Sbapt	    sun3)
399234949Sbapt		echo m68k-sun-sunos${UNAME_RELEASE}
400234949Sbapt		;;
401234949Sbapt	    sun4)
402234949Sbapt		echo sparc-sun-sunos${UNAME_RELEASE}
403234949Sbapt		;;
404234949Sbapt	esac
405234949Sbapt	exit ;;
406234949Sbapt    aushp:SunOS:*:*)
407234949Sbapt	echo sparc-auspex-sunos${UNAME_RELEASE}
408234949Sbapt	exit ;;
409234949Sbapt    # The situation for MiNT is a little confusing.  The machine name
410234949Sbapt    # can be virtually everything (everything which is not
411234949Sbapt    # "atarist" or "atariste" at least should have a processor
412234949Sbapt    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
413234949Sbapt    # to the lowercase version "mint" (or "freemint").  Finally
414234949Sbapt    # the system name "TOS" denotes a system which is actually not
415234949Sbapt    # MiNT.  But MiNT is downward compatible to TOS, so this should
416234949Sbapt    # be no problem.
417234949Sbapt    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
418234949Sbapt	echo m68k-atari-mint${UNAME_RELEASE}
419234949Sbapt	exit ;;
420234949Sbapt    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
421234949Sbapt	echo m68k-atari-mint${UNAME_RELEASE}
422234949Sbapt	exit ;;
423234949Sbapt    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
424234949Sbapt	echo m68k-atari-mint${UNAME_RELEASE}
425234949Sbapt	exit ;;
426234949Sbapt    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
427234949Sbapt	echo m68k-milan-mint${UNAME_RELEASE}
428234949Sbapt	exit ;;
429234949Sbapt    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
430234949Sbapt	echo m68k-hades-mint${UNAME_RELEASE}
431234949Sbapt	exit ;;
432234949Sbapt    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
433234949Sbapt	echo m68k-unknown-mint${UNAME_RELEASE}
434234949Sbapt	exit ;;
435234949Sbapt    m68k:machten:*:*)
436234949Sbapt	echo m68k-apple-machten${UNAME_RELEASE}
437234949Sbapt	exit ;;
438234949Sbapt    powerpc:machten:*:*)
439234949Sbapt	echo powerpc-apple-machten${UNAME_RELEASE}
440234949Sbapt	exit ;;
441234949Sbapt    RISC*:Mach:*:*)
442234949Sbapt	echo mips-dec-mach_bsd4.3
443234949Sbapt	exit ;;
444234949Sbapt    RISC*:ULTRIX:*:*)
445234949Sbapt	echo mips-dec-ultrix${UNAME_RELEASE}
446234949Sbapt	exit ;;
447234949Sbapt    VAX*:ULTRIX*:*:*)
448234949Sbapt	echo vax-dec-ultrix${UNAME_RELEASE}
449234949Sbapt	exit ;;
450234949Sbapt    2020:CLIX:*:* | 2430:CLIX:*:*)
451234949Sbapt	echo clipper-intergraph-clix${UNAME_RELEASE}
452234949Sbapt	exit ;;
453234949Sbapt    mips:*:*:UMIPS | mips:*:*:RISCos)
454234949Sbapt	eval $set_cc_for_build
455234949Sbapt	sed 's/^	//' << EOF >$dummy.c
456234949Sbapt#ifdef __cplusplus
457234949Sbapt#include <stdio.h>  /* for printf() prototype */
458234949Sbapt	int main (int argc, char *argv[]) {
459234949Sbapt#else
460234949Sbapt	int main (argc, argv) int argc; char *argv[]; {
461234949Sbapt#endif
462234949Sbapt	#if defined (host_mips) && defined (MIPSEB)
463234949Sbapt	#if defined (SYSTYPE_SYSV)
464234949Sbapt	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
465234949Sbapt	#endif
466234949Sbapt	#if defined (SYSTYPE_SVR4)
467234949Sbapt	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
468234949Sbapt	#endif
469234949Sbapt	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
470234949Sbapt	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
471234949Sbapt	#endif
472234949Sbapt	#endif
473234949Sbapt	  exit (-1);
474234949Sbapt	}
475234949SbaptEOF
476234949Sbapt	$CC_FOR_BUILD -o $dummy $dummy.c &&
477234949Sbapt	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
478234949Sbapt	  SYSTEM_NAME=`$dummy $dummyarg` &&
479234949Sbapt	    { echo "$SYSTEM_NAME"; exit; }
480234949Sbapt	echo mips-mips-riscos${UNAME_RELEASE}
481234949Sbapt	exit ;;
482234949Sbapt    Motorola:PowerMAX_OS:*:*)
483234949Sbapt	echo powerpc-motorola-powermax
484234949Sbapt	exit ;;
485234949Sbapt    Motorola:*:4.3:PL8-*)
486234949Sbapt	echo powerpc-harris-powermax
487234949Sbapt	exit ;;
488234949Sbapt    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
489234949Sbapt	echo powerpc-harris-powermax
490234949Sbapt	exit ;;
491234949Sbapt    Night_Hawk:Power_UNIX:*:*)
492234949Sbapt	echo powerpc-harris-powerunix
493234949Sbapt	exit ;;
494234949Sbapt    m88k:CX/UX:7*:*)
495234949Sbapt	echo m88k-harris-cxux7
496234949Sbapt	exit ;;
497234949Sbapt    m88k:*:4*:R4*)
498234949Sbapt	echo m88k-motorola-sysv4
499234949Sbapt	exit ;;
500234949Sbapt    m88k:*:3*:R3*)
501234949Sbapt	echo m88k-motorola-sysv3
502234949Sbapt	exit ;;
503234949Sbapt    AViiON:dgux:*:*)
504234949Sbapt	# DG/UX returns AViiON for all architectures
505234949Sbapt	UNAME_PROCESSOR=`/usr/bin/uname -p`
506234949Sbapt	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
507234949Sbapt	then
508234949Sbapt	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
509234949Sbapt	       [ ${TARGET_BINARY_INTERFACE}x = x ]
510234949Sbapt	    then
511234949Sbapt		echo m88k-dg-dgux${UNAME_RELEASE}
512234949Sbapt	    else
513234949Sbapt		echo m88k-dg-dguxbcs${UNAME_RELEASE}
514234949Sbapt	    fi
515234949Sbapt	else
516234949Sbapt	    echo i586-dg-dgux${UNAME_RELEASE}
517234949Sbapt	fi
518234949Sbapt	exit ;;
519234949Sbapt    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
520234949Sbapt	echo m88k-dolphin-sysv3
521234949Sbapt	exit ;;
522234949Sbapt    M88*:*:R3*:*)
523234949Sbapt	# Delta 88k system running SVR3
524234949Sbapt	echo m88k-motorola-sysv3
525234949Sbapt	exit ;;
526234949Sbapt    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
527234949Sbapt	echo m88k-tektronix-sysv3
528234949Sbapt	exit ;;
529234949Sbapt    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
530234949Sbapt	echo m68k-tektronix-bsd
531234949Sbapt	exit ;;
532234949Sbapt    *:IRIX*:*:*)
533234949Sbapt	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
534234949Sbapt	exit ;;
535234949Sbapt    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
536234949Sbapt	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
537234949Sbapt	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
538234949Sbapt    i*86:AIX:*:*)
539234949Sbapt	echo i386-ibm-aix
540234949Sbapt	exit ;;
541234949Sbapt    ia64:AIX:*:*)
542234949Sbapt	if [ -x /usr/bin/oslevel ] ; then
543234949Sbapt		IBM_REV=`/usr/bin/oslevel`
544234949Sbapt	else
545234949Sbapt		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
546234949Sbapt	fi
547234949Sbapt	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
548234949Sbapt	exit ;;
549234949Sbapt    *:AIX:2:3)
550234949Sbapt	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
551234949Sbapt		eval $set_cc_for_build
552234949Sbapt		sed 's/^		//' << EOF >$dummy.c
553234949Sbapt		#include <sys/systemcfg.h>
554234949Sbapt
555234949Sbapt		main()
556234949Sbapt			{
557234949Sbapt			if (!__power_pc())
558234949Sbapt				exit(1);
559234949Sbapt			puts("powerpc-ibm-aix3.2.5");
560234949Sbapt			exit(0);
561234949Sbapt			}
562234949SbaptEOF
563234949Sbapt		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
564234949Sbapt		then
565234949Sbapt			echo "$SYSTEM_NAME"
566234949Sbapt		else
567234949Sbapt			echo rs6000-ibm-aix3.2.5
568234949Sbapt		fi
569234949Sbapt	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
570234949Sbapt		echo rs6000-ibm-aix3.2.4
571234949Sbapt	else
572234949Sbapt		echo rs6000-ibm-aix3.2
573234949Sbapt	fi
574234949Sbapt	exit ;;
575234949Sbapt    *:AIX:*:[4567])
576234949Sbapt	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
577234949Sbapt	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
578234949Sbapt		IBM_ARCH=rs6000
579234949Sbapt	else
580234949Sbapt		IBM_ARCH=powerpc
581234949Sbapt	fi
582234949Sbapt	if [ -x /usr/bin/oslevel ] ; then
583234949Sbapt		IBM_REV=`/usr/bin/oslevel`
584234949Sbapt	else
585234949Sbapt		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
586234949Sbapt	fi
587234949Sbapt	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
588234949Sbapt	exit ;;
589234949Sbapt    *:AIX:*:*)
590234949Sbapt	echo rs6000-ibm-aix
591234949Sbapt	exit ;;
592234949Sbapt    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
593234949Sbapt	echo romp-ibm-bsd4.4
594234949Sbapt	exit ;;
595234949Sbapt    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
596234949Sbapt	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
597234949Sbapt	exit ;;                             # report: romp-ibm BSD 4.3
598234949Sbapt    *:BOSX:*:*)
599234949Sbapt	echo rs6000-bull-bosx
600234949Sbapt	exit ;;
601234949Sbapt    DPX/2?00:B.O.S.:*:*)
602234949Sbapt	echo m68k-bull-sysv3
603234949Sbapt	exit ;;
604234949Sbapt    9000/[34]??:4.3bsd:1.*:*)
605234949Sbapt	echo m68k-hp-bsd
606234949Sbapt	exit ;;
607234949Sbapt    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
608234949Sbapt	echo m68k-hp-bsd4.4
609234949Sbapt	exit ;;
610234949Sbapt    9000/[34678]??:HP-UX:*:*)
611234949Sbapt	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
612234949Sbapt	case "${UNAME_MACHINE}" in
613234949Sbapt	    9000/31? )            HP_ARCH=m68000 ;;
614234949Sbapt	    9000/[34]?? )         HP_ARCH=m68k ;;
615234949Sbapt	    9000/[678][0-9][0-9])
616234949Sbapt		if [ -x /usr/bin/getconf ]; then
617234949Sbapt		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
618234949Sbapt		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
619234949Sbapt		    case "${sc_cpu_version}" in
620251143Sbapt		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
621251143Sbapt		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
622251143Sbapt		      532)                      # CPU_PA_RISC2_0
623251143Sbapt			case "${sc_kernel_bits}" in
624251143Sbapt			  32) HP_ARCH="hppa2.0n" ;;
625251143Sbapt			  64) HP_ARCH="hppa2.0w" ;;
626234949Sbapt			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
627251143Sbapt			esac ;;
628251143Sbapt		    esac
629234949Sbapt		fi
630234949Sbapt		if [ "${HP_ARCH}" = "" ]; then
631234949Sbapt		    eval $set_cc_for_build
632251143Sbapt		    sed 's/^		//' << EOF >$dummy.c
633234949Sbapt
634251143Sbapt		#define _HPUX_SOURCE
635251143Sbapt		#include <stdlib.h>
636251143Sbapt		#include <unistd.h>
637234949Sbapt
638251143Sbapt		int main ()
639251143Sbapt		{
640251143Sbapt		#if defined(_SC_KERNEL_BITS)
641251143Sbapt		    long bits = sysconf(_SC_KERNEL_BITS);
642251143Sbapt		#endif
643251143Sbapt		    long cpu  = sysconf (_SC_CPU_VERSION);
644234949Sbapt
645251143Sbapt		    switch (cpu)
646251143Sbapt			{
647251143Sbapt			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
648251143Sbapt			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
649251143Sbapt			case CPU_PA_RISC2_0:
650251143Sbapt		#if defined(_SC_KERNEL_BITS)
651251143Sbapt			    switch (bits)
652251143Sbapt				{
653251143Sbapt				case 64: puts ("hppa2.0w"); break;
654251143Sbapt				case 32: puts ("hppa2.0n"); break;
655251143Sbapt				default: puts ("hppa2.0"); break;
656251143Sbapt				} break;
657251143Sbapt		#else  /* !defined(_SC_KERNEL_BITS) */
658251143Sbapt			    puts ("hppa2.0"); break;
659251143Sbapt		#endif
660251143Sbapt			default: puts ("hppa1.0"); break;
661251143Sbapt			}
662251143Sbapt		    exit (0);
663251143Sbapt		}
664234949SbaptEOF
665234949Sbapt		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
666234949Sbapt		    test -z "$HP_ARCH" && HP_ARCH=hppa
667234949Sbapt		fi ;;
668234949Sbapt	esac
669234949Sbapt	if [ ${HP_ARCH} = "hppa2.0w" ]
670234949Sbapt	then
671234949Sbapt	    eval $set_cc_for_build
672234949Sbapt
673234949Sbapt	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
674234949Sbapt	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
675234949Sbapt	    # generating 64-bit code.  GNU and HP use different nomenclature:
676234949Sbapt	    #
677234949Sbapt	    # $ CC_FOR_BUILD=cc ./config.guess
678234949Sbapt	    # => hppa2.0w-hp-hpux11.23
679234949Sbapt	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
680234949Sbapt	    # => hppa64-hp-hpux11.23
681234949Sbapt
682234949Sbapt	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
683234949Sbapt		grep -q __LP64__
684234949Sbapt	    then
685234949Sbapt		HP_ARCH="hppa2.0w"
686234949Sbapt	    else
687234949Sbapt		HP_ARCH="hppa64"
688234949Sbapt	    fi
689234949Sbapt	fi
690234949Sbapt	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
691234949Sbapt	exit ;;
692234949Sbapt    ia64:HP-UX:*:*)
693234949Sbapt	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
694234949Sbapt	echo ia64-hp-hpux${HPUX_REV}
695234949Sbapt	exit ;;
696234949Sbapt    3050*:HI-UX:*:*)
697234949Sbapt	eval $set_cc_for_build
698234949Sbapt	sed 's/^	//' << EOF >$dummy.c
699234949Sbapt	#include <unistd.h>
700234949Sbapt	int
701234949Sbapt	main ()
702234949Sbapt	{
703234949Sbapt	  long cpu = sysconf (_SC_CPU_VERSION);
704234949Sbapt	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
705234949Sbapt	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
706234949Sbapt	     results, however.  */
707234949Sbapt	  if (CPU_IS_PA_RISC (cpu))
708234949Sbapt	    {
709234949Sbapt	      switch (cpu)
710234949Sbapt		{
711234949Sbapt		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
712234949Sbapt		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
713234949Sbapt		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
714234949Sbapt		  default: puts ("hppa-hitachi-hiuxwe2"); break;
715234949Sbapt		}
716234949Sbapt	    }
717234949Sbapt	  else if (CPU_IS_HP_MC68K (cpu))
718234949Sbapt	    puts ("m68k-hitachi-hiuxwe2");
719234949Sbapt	  else puts ("unknown-hitachi-hiuxwe2");
720234949Sbapt	  exit (0);
721234949Sbapt	}
722234949SbaptEOF
723234949Sbapt	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
724234949Sbapt		{ echo "$SYSTEM_NAME"; exit; }
725234949Sbapt	echo unknown-hitachi-hiuxwe2
726234949Sbapt	exit ;;
727234949Sbapt    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
728234949Sbapt	echo hppa1.1-hp-bsd
729234949Sbapt	exit ;;
730234949Sbapt    9000/8??:4.3bsd:*:*)
731234949Sbapt	echo hppa1.0-hp-bsd
732234949Sbapt	exit ;;
733234949Sbapt    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
734234949Sbapt	echo hppa1.0-hp-mpeix
735234949Sbapt	exit ;;
736234949Sbapt    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
737234949Sbapt	echo hppa1.1-hp-osf
738234949Sbapt	exit ;;
739234949Sbapt    hp8??:OSF1:*:*)
740234949Sbapt	echo hppa1.0-hp-osf
741234949Sbapt	exit ;;
742234949Sbapt    i*86:OSF1:*:*)
743234949Sbapt	if [ -x /usr/sbin/sysversion ] ; then
744234949Sbapt	    echo ${UNAME_MACHINE}-unknown-osf1mk
745234949Sbapt	else
746234949Sbapt	    echo ${UNAME_MACHINE}-unknown-osf1
747234949Sbapt	fi
748234949Sbapt	exit ;;
749234949Sbapt    parisc*:Lites*:*:*)
750234949Sbapt	echo hppa1.1-hp-lites
751234949Sbapt	exit ;;
752234949Sbapt    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
753234949Sbapt	echo c1-convex-bsd
754234949Sbapt	exit ;;
755234949Sbapt    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
756234949Sbapt	if getsysinfo -f scalar_acc
757234949Sbapt	then echo c32-convex-bsd
758234949Sbapt	else echo c2-convex-bsd
759234949Sbapt	fi
760234949Sbapt	exit ;;
761234949Sbapt    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
762234949Sbapt	echo c34-convex-bsd
763234949Sbapt	exit ;;
764234949Sbapt    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
765234949Sbapt	echo c38-convex-bsd
766234949Sbapt	exit ;;
767234949Sbapt    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
768234949Sbapt	echo c4-convex-bsd
769234949Sbapt	exit ;;
770234949Sbapt    CRAY*Y-MP:*:*:*)
771234949Sbapt	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
772234949Sbapt	exit ;;
773234949Sbapt    CRAY*[A-Z]90:*:*:*)
774234949Sbapt	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
775234949Sbapt	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
776234949Sbapt	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
777234949Sbapt	      -e 's/\.[^.]*$/.X/'
778234949Sbapt	exit ;;
779234949Sbapt    CRAY*TS:*:*:*)
780234949Sbapt	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
781234949Sbapt	exit ;;
782234949Sbapt    CRAY*T3E:*:*:*)
783234949Sbapt	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
784234949Sbapt	exit ;;
785234949Sbapt    CRAY*SV1:*:*:*)
786234949Sbapt	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
787234949Sbapt	exit ;;
788234949Sbapt    *:UNICOS/mp:*:*)
789234949Sbapt	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
790234949Sbapt	exit ;;
791234949Sbapt    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
792234949Sbapt	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
793234949Sbapt	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
794234949Sbapt	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
795234949Sbapt	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
796234949Sbapt	exit ;;
797234949Sbapt    5000:UNIX_System_V:4.*:*)
798234949Sbapt	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
799234949Sbapt	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
800234949Sbapt	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
801234949Sbapt	exit ;;
802234949Sbapt    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
803234949Sbapt	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
804234949Sbapt	exit ;;
805234949Sbapt    sparc*:BSD/OS:*:*)
806234949Sbapt	echo sparc-unknown-bsdi${UNAME_RELEASE}
807234949Sbapt	exit ;;
808234949Sbapt    *:BSD/OS:*:*)
809234949Sbapt	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
810234949Sbapt	exit ;;
811234949Sbapt    *:FreeBSD:*:*)
812251143Sbapt	UNAME_PROCESSOR=`/usr/bin/uname -p`
813251143Sbapt	case ${UNAME_PROCESSOR} in
814234949Sbapt	    amd64)
815234949Sbapt		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
816234949Sbapt	    *)
817251143Sbapt		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
818234949Sbapt	esac
819234949Sbapt	exit ;;
820234949Sbapt    i*:CYGWIN*:*)
821234949Sbapt	echo ${UNAME_MACHINE}-pc-cygwin
822234949Sbapt	exit ;;
823251143Sbapt    *:MINGW64*:*)
824251143Sbapt	echo ${UNAME_MACHINE}-pc-mingw64
825251143Sbapt	exit ;;
826234949Sbapt    *:MINGW*:*)
827234949Sbapt	echo ${UNAME_MACHINE}-pc-mingw32
828234949Sbapt	exit ;;
829268899Sbapt    *:MSYS*:*)
830251143Sbapt	echo ${UNAME_MACHINE}-pc-msys
831251143Sbapt	exit ;;
832234949Sbapt    i*:windows32*:*)
833234949Sbapt	# uname -m includes "-pc" on this system.
834234949Sbapt	echo ${UNAME_MACHINE}-mingw32
835234949Sbapt	exit ;;
836234949Sbapt    i*:PW*:*)
837234949Sbapt	echo ${UNAME_MACHINE}-pc-pw32
838234949Sbapt	exit ;;
839234949Sbapt    *:Interix*:*)
840234949Sbapt	case ${UNAME_MACHINE} in
841234949Sbapt	    x86)
842234949Sbapt		echo i586-pc-interix${UNAME_RELEASE}
843234949Sbapt		exit ;;
844234949Sbapt	    authenticamd | genuineintel | EM64T)
845234949Sbapt		echo x86_64-unknown-interix${UNAME_RELEASE}
846234949Sbapt		exit ;;
847234949Sbapt	    IA64)
848234949Sbapt		echo ia64-unknown-interix${UNAME_RELEASE}
849234949Sbapt		exit ;;
850234949Sbapt	esac ;;
851234949Sbapt    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
852234949Sbapt	echo i${UNAME_MACHINE}-pc-mks
853234949Sbapt	exit ;;
854234949Sbapt    8664:Windows_NT:*)
855234949Sbapt	echo x86_64-pc-mks
856234949Sbapt	exit ;;
857234949Sbapt    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
858234949Sbapt	# How do we know it's Interix rather than the generic POSIX subsystem?
859234949Sbapt	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
860234949Sbapt	# UNAME_MACHINE based on the output of uname instead of i386?
861234949Sbapt	echo i586-pc-interix
862234949Sbapt	exit ;;
863234949Sbapt    i*:UWIN*:*)
864234949Sbapt	echo ${UNAME_MACHINE}-pc-uwin
865234949Sbapt	exit ;;
866234949Sbapt    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
867234949Sbapt	echo x86_64-unknown-cygwin
868234949Sbapt	exit ;;
869234949Sbapt    p*:CYGWIN*:*)
870234949Sbapt	echo powerpcle-unknown-cygwin
871234949Sbapt	exit ;;
872234949Sbapt    prep*:SunOS:5.*:*)
873234949Sbapt	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
874234949Sbapt	exit ;;
875234949Sbapt    *:GNU:*:*)
876234949Sbapt	# the GNU system
877268899Sbapt	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
878234949Sbapt	exit ;;
879234949Sbapt    *:GNU/*:*:*)
880234949Sbapt	# other systems with GNU libc and userland
881268899Sbapt	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
882234949Sbapt	exit ;;
883234949Sbapt    i*86:Minix:*:*)
884234949Sbapt	echo ${UNAME_MACHINE}-pc-minix
885234949Sbapt	exit ;;
886251143Sbapt    aarch64:Linux:*:*)
887268899Sbapt	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
888251143Sbapt	exit ;;
889251143Sbapt    aarch64_be:Linux:*:*)
890251143Sbapt	UNAME_MACHINE=aarch64_be
891268899Sbapt	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
892251143Sbapt	exit ;;
893234949Sbapt    alpha:Linux:*:*)
894234949Sbapt	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
895251143Sbapt	  EV5)   UNAME_MACHINE=alphaev5 ;;
896251143Sbapt	  EV56)  UNAME_MACHINE=alphaev56 ;;
897251143Sbapt	  PCA56) UNAME_MACHINE=alphapca56 ;;
898251143Sbapt	  PCA57) UNAME_MACHINE=alphapca56 ;;
899251143Sbapt	  EV6)   UNAME_MACHINE=alphaev6 ;;
900251143Sbapt	  EV67)  UNAME_MACHINE=alphaev67 ;;
901251143Sbapt	  EV68*) UNAME_MACHINE=alphaev68 ;;
902234949Sbapt	esac
903234949Sbapt	objdump --private-headers /bin/sh | grep -q ld.so.1
904268899Sbapt	if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
905268899Sbapt	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
906234949Sbapt	exit ;;
907268899Sbapt    arc:Linux:*:* | arceb:Linux:*:*)
908268899Sbapt	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
909268899Sbapt	exit ;;
910234949Sbapt    arm*:Linux:*:*)
911234949Sbapt	eval $set_cc_for_build
912251143Sbapt	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
913251143Sbapt	    | grep -q __ARM_EABI__
914234949Sbapt	then
915268899Sbapt	    echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
916234949Sbapt	else
917251143Sbapt	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
918251143Sbapt		| grep -q __ARM_PCS_VFP
919251143Sbapt	    then
920268899Sbapt		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
921251143Sbapt	    else
922268899Sbapt		echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
923251143Sbapt	    fi
924234949Sbapt	fi
925234949Sbapt	exit ;;
926234949Sbapt    avr32*:Linux:*:*)
927268899Sbapt	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
928234949Sbapt	exit ;;
929234949Sbapt    cris:Linux:*:*)
930268899Sbapt	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
931234949Sbapt	exit ;;
932234949Sbapt    crisv32:Linux:*:*)
933268899Sbapt	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
934234949Sbapt	exit ;;
935234949Sbapt    frv:Linux:*:*)
936268899Sbapt	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
937234949Sbapt	exit ;;
938251143Sbapt    hexagon:Linux:*:*)
939268899Sbapt	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
940251143Sbapt	exit ;;
941234949Sbapt    i*86:Linux:*:*)
942268899Sbapt	echo ${UNAME_MACHINE}-pc-linux-${LIBC}
943234949Sbapt	exit ;;
944234949Sbapt    ia64:Linux:*:*)
945268899Sbapt	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
946234949Sbapt	exit ;;
947234949Sbapt    m32r*:Linux:*:*)
948268899Sbapt	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
949234949Sbapt	exit ;;
950234949Sbapt    m68*:Linux:*:*)
951268899Sbapt	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
952234949Sbapt	exit ;;
953234949Sbapt    mips:Linux:*:* | mips64:Linux:*:*)
954234949Sbapt	eval $set_cc_for_build
955234949Sbapt	sed 's/^	//' << EOF >$dummy.c
956234949Sbapt	#undef CPU
957234949Sbapt	#undef ${UNAME_MACHINE}
958234949Sbapt	#undef ${UNAME_MACHINE}el
959234949Sbapt	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
960234949Sbapt	CPU=${UNAME_MACHINE}el
961234949Sbapt	#else
962234949Sbapt	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
963234949Sbapt	CPU=${UNAME_MACHINE}
964234949Sbapt	#else
965234949Sbapt	CPU=
966234949Sbapt	#endif
967234949Sbapt	#endif
968234949SbaptEOF
969234949Sbapt	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
970268899Sbapt	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
971234949Sbapt	;;
972268899Sbapt    openrisc*:Linux:*:*)
973268899Sbapt	echo or1k-unknown-linux-${LIBC}
974234949Sbapt	exit ;;
975268899Sbapt    or32:Linux:*:* | or1k*:Linux:*:*)
976268899Sbapt	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
977268899Sbapt	exit ;;
978234949Sbapt    padre:Linux:*:*)
979268899Sbapt	echo sparc-unknown-linux-${LIBC}
980234949Sbapt	exit ;;
981234949Sbapt    parisc64:Linux:*:* | hppa64:Linux:*:*)
982268899Sbapt	echo hppa64-unknown-linux-${LIBC}
983234949Sbapt	exit ;;
984234949Sbapt    parisc:Linux:*:* | hppa:Linux:*:*)
985234949Sbapt	# Look for CPU level
986234949Sbapt	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
987268899Sbapt	  PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
988268899Sbapt	  PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
989268899Sbapt	  *)    echo hppa-unknown-linux-${LIBC} ;;
990234949Sbapt	esac
991234949Sbapt	exit ;;
992234949Sbapt    ppc64:Linux:*:*)
993268899Sbapt	echo powerpc64-unknown-linux-${LIBC}
994234949Sbapt	exit ;;
995234949Sbapt    ppc:Linux:*:*)
996268899Sbapt	echo powerpc-unknown-linux-${LIBC}
997234949Sbapt	exit ;;
998268899Sbapt    ppc64le:Linux:*:*)
999268899Sbapt	echo powerpc64le-unknown-linux-${LIBC}
1000268899Sbapt	exit ;;
1001268899Sbapt    ppcle:Linux:*:*)
1002268899Sbapt	echo powerpcle-unknown-linux-${LIBC}
1003268899Sbapt	exit ;;
1004234949Sbapt    s390:Linux:*:* | s390x:Linux:*:*)
1005268899Sbapt	echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
1006234949Sbapt	exit ;;
1007234949Sbapt    sh64*:Linux:*:*)
1008268899Sbapt	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1009234949Sbapt	exit ;;
1010234949Sbapt    sh*:Linux:*:*)
1011268899Sbapt	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1012234949Sbapt	exit ;;
1013234949Sbapt    sparc:Linux:*:* | sparc64:Linux:*:*)
1014268899Sbapt	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1015234949Sbapt	exit ;;
1016234949Sbapt    tile*:Linux:*:*)
1017268899Sbapt	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1018234949Sbapt	exit ;;
1019234949Sbapt    vax:Linux:*:*)
1020268899Sbapt	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
1021234949Sbapt	exit ;;
1022234949Sbapt    x86_64:Linux:*:*)
1023268899Sbapt	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1024234949Sbapt	exit ;;
1025234949Sbapt    xtensa*:Linux:*:*)
1026268899Sbapt	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1027234949Sbapt	exit ;;
1028234949Sbapt    i*86:DYNIX/ptx:4*:*)
1029234949Sbapt	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1030234949Sbapt	# earlier versions are messed up and put the nodename in both
1031234949Sbapt	# sysname and nodename.
1032234949Sbapt	echo i386-sequent-sysv4
1033234949Sbapt	exit ;;
1034234949Sbapt    i*86:UNIX_SV:4.2MP:2.*)
1035234949Sbapt	# Unixware is an offshoot of SVR4, but it has its own version
1036234949Sbapt	# number series starting with 2...
1037234949Sbapt	# I am not positive that other SVR4 systems won't match this,
1038234949Sbapt	# I just have to hope.  -- rms.
1039234949Sbapt	# Use sysv4.2uw... so that sysv4* matches it.
1040234949Sbapt	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
1041234949Sbapt	exit ;;
1042234949Sbapt    i*86:OS/2:*:*)
1043234949Sbapt	# If we were able to find `uname', then EMX Unix compatibility
1044234949Sbapt	# is probably installed.
1045234949Sbapt	echo ${UNAME_MACHINE}-pc-os2-emx
1046234949Sbapt	exit ;;
1047234949Sbapt    i*86:XTS-300:*:STOP)
1048234949Sbapt	echo ${UNAME_MACHINE}-unknown-stop
1049234949Sbapt	exit ;;
1050234949Sbapt    i*86:atheos:*:*)
1051234949Sbapt	echo ${UNAME_MACHINE}-unknown-atheos
1052234949Sbapt	exit ;;
1053234949Sbapt    i*86:syllable:*:*)
1054234949Sbapt	echo ${UNAME_MACHINE}-pc-syllable
1055234949Sbapt	exit ;;
1056234949Sbapt    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1057234949Sbapt	echo i386-unknown-lynxos${UNAME_RELEASE}
1058234949Sbapt	exit ;;
1059234949Sbapt    i*86:*DOS:*:*)
1060234949Sbapt	echo ${UNAME_MACHINE}-pc-msdosdjgpp
1061234949Sbapt	exit ;;
1062234949Sbapt    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
1063234949Sbapt	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
1064234949Sbapt	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1065234949Sbapt		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
1066234949Sbapt	else
1067234949Sbapt		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
1068234949Sbapt	fi
1069234949Sbapt	exit ;;
1070234949Sbapt    i*86:*:5:[678]*)
1071234949Sbapt	# UnixWare 7.x, OpenUNIX and OpenServer 6.
1072234949Sbapt	case `/bin/uname -X | grep "^Machine"` in
1073234949Sbapt	    *486*)	     UNAME_MACHINE=i486 ;;
1074234949Sbapt	    *Pentium)	     UNAME_MACHINE=i586 ;;
1075234949Sbapt	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1076234949Sbapt	esac
1077234949Sbapt	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1078234949Sbapt	exit ;;
1079234949Sbapt    i*86:*:3.2:*)
1080234949Sbapt	if test -f /usr/options/cb.name; then
1081234949Sbapt		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1082234949Sbapt		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
1083234949Sbapt	elif /bin/uname -X 2>/dev/null >/dev/null ; then
1084234949Sbapt		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1085234949Sbapt		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1086234949Sbapt		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1087234949Sbapt			&& UNAME_MACHINE=i586
1088234949Sbapt		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1089234949Sbapt			&& UNAME_MACHINE=i686
1090234949Sbapt		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1091234949Sbapt			&& UNAME_MACHINE=i686
1092234949Sbapt		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
1093234949Sbapt	else
1094234949Sbapt		echo ${UNAME_MACHINE}-pc-sysv32
1095234949Sbapt	fi
1096234949Sbapt	exit ;;
1097234949Sbapt    pc:*:*:*)
1098234949Sbapt	# Left here for compatibility:
1099234949Sbapt	# uname -m prints for DJGPP always 'pc', but it prints nothing about
1100234949Sbapt	# the processor, so we play safe by assuming i586.
1101234949Sbapt	# Note: whatever this is, it MUST be the same as what config.sub
1102234949Sbapt	# prints for the "djgpp" host, or else GDB configury will decide that
1103234949Sbapt	# this is a cross-build.
1104234949Sbapt	echo i586-pc-msdosdjgpp
1105234949Sbapt	exit ;;
1106234949Sbapt    Intel:Mach:3*:*)
1107234949Sbapt	echo i386-pc-mach3
1108234949Sbapt	exit ;;
1109234949Sbapt    paragon:*:*:*)
1110234949Sbapt	echo i860-intel-osf1
1111234949Sbapt	exit ;;
1112234949Sbapt    i860:*:4.*:*) # i860-SVR4
1113234949Sbapt	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1114234949Sbapt	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
1115234949Sbapt	else # Add other i860-SVR4 vendors below as they are discovered.
1116234949Sbapt	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
1117234949Sbapt	fi
1118234949Sbapt	exit ;;
1119234949Sbapt    mini*:CTIX:SYS*5:*)
1120234949Sbapt	# "miniframe"
1121234949Sbapt	echo m68010-convergent-sysv
1122234949Sbapt	exit ;;
1123234949Sbapt    mc68k:UNIX:SYSTEM5:3.51m)
1124234949Sbapt	echo m68k-convergent-sysv
1125234949Sbapt	exit ;;
1126234949Sbapt    M680?0:D-NIX:5.3:*)
1127234949Sbapt	echo m68k-diab-dnix
1128234949Sbapt	exit ;;
1129234949Sbapt    M68*:*:R3V[5678]*:*)
1130234949Sbapt	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1131234949Sbapt    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)
1132234949Sbapt	OS_REL=''
1133234949Sbapt	test -r /etc/.relid \
1134234949Sbapt	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1135234949Sbapt	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1136234949Sbapt	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1137234949Sbapt	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1138234949Sbapt	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1139234949Sbapt    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1140234949Sbapt	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1141251143Sbapt	  && { echo i486-ncr-sysv4; exit; } ;;
1142234949Sbapt    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1143234949Sbapt	OS_REL='.3'
1144234949Sbapt	test -r /etc/.relid \
1145234949Sbapt	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1146234949Sbapt	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1147234949Sbapt	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1148234949Sbapt	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1149234949Sbapt	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
1150234949Sbapt	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1151234949Sbapt	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1152234949Sbapt    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1153234949Sbapt	echo m68k-unknown-lynxos${UNAME_RELEASE}
1154234949Sbapt	exit ;;
1155234949Sbapt    mc68030:UNIX_System_V:4.*:*)
1156234949Sbapt	echo m68k-atari-sysv4
1157234949Sbapt	exit ;;
1158234949Sbapt    TSUNAMI:LynxOS:2.*:*)
1159234949Sbapt	echo sparc-unknown-lynxos${UNAME_RELEASE}
1160234949Sbapt	exit ;;
1161234949Sbapt    rs6000:LynxOS:2.*:*)
1162234949Sbapt	echo rs6000-unknown-lynxos${UNAME_RELEASE}
1163234949Sbapt	exit ;;
1164234949Sbapt    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1165234949Sbapt	echo powerpc-unknown-lynxos${UNAME_RELEASE}
1166234949Sbapt	exit ;;
1167234949Sbapt    SM[BE]S:UNIX_SV:*:*)
1168234949Sbapt	echo mips-dde-sysv${UNAME_RELEASE}
1169234949Sbapt	exit ;;
1170234949Sbapt    RM*:ReliantUNIX-*:*:*)
1171234949Sbapt	echo mips-sni-sysv4
1172234949Sbapt	exit ;;
1173234949Sbapt    RM*:SINIX-*:*:*)
1174234949Sbapt	echo mips-sni-sysv4
1175234949Sbapt	exit ;;
1176234949Sbapt    *:SINIX-*:*:*)
1177234949Sbapt	if uname -p 2>/dev/null >/dev/null ; then
1178234949Sbapt		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1179234949Sbapt		echo ${UNAME_MACHINE}-sni-sysv4
1180234949Sbapt	else
1181234949Sbapt		echo ns32k-sni-sysv
1182234949Sbapt	fi
1183234949Sbapt	exit ;;
1184251143Sbapt    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1185251143Sbapt			# says <Richard.M.Bartel@ccMail.Census.GOV>
1186234949Sbapt	echo i586-unisys-sysv4
1187234949Sbapt	exit ;;
1188234949Sbapt    *:UNIX_System_V:4*:FTX*)
1189234949Sbapt	# From Gerald Hewes <hewes@openmarket.com>.
1190234949Sbapt	# How about differentiating between stratus architectures? -djm
1191234949Sbapt	echo hppa1.1-stratus-sysv4
1192234949Sbapt	exit ;;
1193234949Sbapt    *:*:*:FTX*)
1194234949Sbapt	# From seanf@swdc.stratus.com.
1195234949Sbapt	echo i860-stratus-sysv4
1196234949Sbapt	exit ;;
1197234949Sbapt    i*86:VOS:*:*)
1198234949Sbapt	# From Paul.Green@stratus.com.
1199234949Sbapt	echo ${UNAME_MACHINE}-stratus-vos
1200234949Sbapt	exit ;;
1201234949Sbapt    *:VOS:*:*)
1202234949Sbapt	# From Paul.Green@stratus.com.
1203234949Sbapt	echo hppa1.1-stratus-vos
1204234949Sbapt	exit ;;
1205234949Sbapt    mc68*:A/UX:*:*)
1206234949Sbapt	echo m68k-apple-aux${UNAME_RELEASE}
1207234949Sbapt	exit ;;
1208234949Sbapt    news*:NEWS-OS:6*:*)
1209234949Sbapt	echo mips-sony-newsos6
1210234949Sbapt	exit ;;
1211234949Sbapt    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1212234949Sbapt	if [ -d /usr/nec ]; then
1213251143Sbapt		echo mips-nec-sysv${UNAME_RELEASE}
1214234949Sbapt	else
1215251143Sbapt		echo mips-unknown-sysv${UNAME_RELEASE}
1216234949Sbapt	fi
1217234949Sbapt	exit ;;
1218234949Sbapt    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1219234949Sbapt	echo powerpc-be-beos
1220234949Sbapt	exit ;;
1221234949Sbapt    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1222234949Sbapt	echo powerpc-apple-beos
1223234949Sbapt	exit ;;
1224234949Sbapt    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1225234949Sbapt	echo i586-pc-beos
1226234949Sbapt	exit ;;
1227234949Sbapt    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
1228234949Sbapt	echo i586-pc-haiku
1229234949Sbapt	exit ;;
1230251143Sbapt    x86_64:Haiku:*:*)
1231251143Sbapt	echo x86_64-unknown-haiku
1232251143Sbapt	exit ;;
1233234949Sbapt    SX-4:SUPER-UX:*:*)
1234234949Sbapt	echo sx4-nec-superux${UNAME_RELEASE}
1235234949Sbapt	exit ;;
1236234949Sbapt    SX-5:SUPER-UX:*:*)
1237234949Sbapt	echo sx5-nec-superux${UNAME_RELEASE}
1238234949Sbapt	exit ;;
1239234949Sbapt    SX-6:SUPER-UX:*:*)
1240234949Sbapt	echo sx6-nec-superux${UNAME_RELEASE}
1241234949Sbapt	exit ;;
1242234949Sbapt    SX-7:SUPER-UX:*:*)
1243234949Sbapt	echo sx7-nec-superux${UNAME_RELEASE}
1244234949Sbapt	exit ;;
1245234949Sbapt    SX-8:SUPER-UX:*:*)
1246234949Sbapt	echo sx8-nec-superux${UNAME_RELEASE}
1247234949Sbapt	exit ;;
1248234949Sbapt    SX-8R:SUPER-UX:*:*)
1249234949Sbapt	echo sx8r-nec-superux${UNAME_RELEASE}
1250234949Sbapt	exit ;;
1251234949Sbapt    Power*:Rhapsody:*:*)
1252234949Sbapt	echo powerpc-apple-rhapsody${UNAME_RELEASE}
1253234949Sbapt	exit ;;
1254234949Sbapt    *:Rhapsody:*:*)
1255234949Sbapt	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
1256234949Sbapt	exit ;;
1257234949Sbapt    *:Darwin:*:*)
1258234949Sbapt	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1259268899Sbapt	eval $set_cc_for_build
1260268899Sbapt	if test "$UNAME_PROCESSOR" = unknown ; then
1261268899Sbapt	    UNAME_PROCESSOR=powerpc
1262268899Sbapt	fi
1263268899Sbapt	if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
1264268899Sbapt	    if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
1265268899Sbapt		if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1266268899Sbapt		    (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
1267268899Sbapt		    grep IS_64BIT_ARCH >/dev/null
1268268899Sbapt		then
1269268899Sbapt		    case $UNAME_PROCESSOR in
1270268899Sbapt			i386) UNAME_PROCESSOR=x86_64 ;;
1271268899Sbapt			powerpc) UNAME_PROCESSOR=powerpc64 ;;
1272268899Sbapt		    esac
1273268899Sbapt		fi
1274268899Sbapt	    fi
1275268899Sbapt	elif test "$UNAME_PROCESSOR" = i386 ; then
1276268899Sbapt	    # Avoid executing cc on OS X 10.9, as it ships with a stub
1277268899Sbapt	    # that puts up a graphical alert prompting to install
1278268899Sbapt	    # developer tools.  Any system running Mac OS X 10.7 or
1279268899Sbapt	    # later (Darwin 11 and later) is required to have a 64-bit
1280268899Sbapt	    # processor. This is not true of the ARM version of Darwin
1281268899Sbapt	    # that Apple uses in portable devices.
1282268899Sbapt	    UNAME_PROCESSOR=x86_64
1283268899Sbapt	fi
1284234949Sbapt	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
1285234949Sbapt	exit ;;
1286234949Sbapt    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1287234949Sbapt	UNAME_PROCESSOR=`uname -p`
1288234949Sbapt	if test "$UNAME_PROCESSOR" = "x86"; then
1289251143Sbapt		UNAME_PROCESSOR=i386
1290251143Sbapt		UNAME_MACHINE=pc
1291234949Sbapt	fi
1292234949Sbapt	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
1293234949Sbapt	exit ;;
1294234949Sbapt    *:QNX:*:4*)
1295234949Sbapt	echo i386-pc-qnx
1296234949Sbapt	exit ;;
1297234949Sbapt    NEO-?:NONSTOP_KERNEL:*:*)
1298234949Sbapt	echo neo-tandem-nsk${UNAME_RELEASE}
1299234949Sbapt	exit ;;
1300251143Sbapt    NSE-*:NONSTOP_KERNEL:*:*)
1301234949Sbapt	echo nse-tandem-nsk${UNAME_RELEASE}
1302234949Sbapt	exit ;;
1303234949Sbapt    NSR-?:NONSTOP_KERNEL:*:*)
1304234949Sbapt	echo nsr-tandem-nsk${UNAME_RELEASE}
1305234949Sbapt	exit ;;
1306234949Sbapt    *:NonStop-UX:*:*)
1307234949Sbapt	echo mips-compaq-nonstopux
1308234949Sbapt	exit ;;
1309234949Sbapt    BS2000:POSIX*:*:*)
1310234949Sbapt	echo bs2000-siemens-sysv
1311234949Sbapt	exit ;;
1312234949Sbapt    DS/*:UNIX_System_V:*:*)
1313234949Sbapt	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
1314234949Sbapt	exit ;;
1315234949Sbapt    *:Plan9:*:*)
1316234949Sbapt	# "uname -m" is not consistent, so use $cputype instead. 386
1317234949Sbapt	# is converted to i386 for consistency with other x86
1318234949Sbapt	# operating systems.
1319234949Sbapt	if test "$cputype" = "386"; then
1320234949Sbapt	    UNAME_MACHINE=i386
1321234949Sbapt	else
1322234949Sbapt	    UNAME_MACHINE="$cputype"
1323234949Sbapt	fi
1324234949Sbapt	echo ${UNAME_MACHINE}-unknown-plan9
1325234949Sbapt	exit ;;
1326234949Sbapt    *:TOPS-10:*:*)
1327234949Sbapt	echo pdp10-unknown-tops10
1328234949Sbapt	exit ;;
1329234949Sbapt    *:TENEX:*:*)
1330234949Sbapt	echo pdp10-unknown-tenex
1331234949Sbapt	exit ;;
1332234949Sbapt    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1333234949Sbapt	echo pdp10-dec-tops20
1334234949Sbapt	exit ;;
1335234949Sbapt    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1336234949Sbapt	echo pdp10-xkl-tops20
1337234949Sbapt	exit ;;
1338234949Sbapt    *:TOPS-20:*:*)
1339234949Sbapt	echo pdp10-unknown-tops20
1340234949Sbapt	exit ;;
1341234949Sbapt    *:ITS:*:*)
1342234949Sbapt	echo pdp10-unknown-its
1343234949Sbapt	exit ;;
1344234949Sbapt    SEI:*:*:SEIUX)
1345234949Sbapt	echo mips-sei-seiux${UNAME_RELEASE}
1346234949Sbapt	exit ;;
1347234949Sbapt    *:DragonFly:*:*)
1348234949Sbapt	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
1349234949Sbapt	exit ;;
1350234949Sbapt    *:*VMS:*:*)
1351234949Sbapt	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1352234949Sbapt	case "${UNAME_MACHINE}" in
1353234949Sbapt	    A*) echo alpha-dec-vms ; exit ;;
1354234949Sbapt	    I*) echo ia64-dec-vms ; exit ;;
1355234949Sbapt	    V*) echo vax-dec-vms ; exit ;;
1356234949Sbapt	esac ;;
1357234949Sbapt    *:XENIX:*:SysV)
1358234949Sbapt	echo i386-pc-xenix
1359234949Sbapt	exit ;;
1360234949Sbapt    i*86:skyos:*:*)
1361234949Sbapt	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
1362234949Sbapt	exit ;;
1363234949Sbapt    i*86:rdos:*:*)
1364234949Sbapt	echo ${UNAME_MACHINE}-pc-rdos
1365234949Sbapt	exit ;;
1366234949Sbapt    i*86:AROS:*:*)
1367234949Sbapt	echo ${UNAME_MACHINE}-pc-aros
1368234949Sbapt	exit ;;
1369251143Sbapt    x86_64:VMkernel:*:*)
1370251143Sbapt	echo ${UNAME_MACHINE}-unknown-esx
1371251143Sbapt	exit ;;
1372234949Sbaptesac
1373234949Sbapt
1374234949Sbaptcat >&2 <<EOF
1375234949Sbapt$0: unable to guess system type
1376234949Sbapt
1377234949SbaptThis script, last modified $timestamp, has failed to recognize
1378234949Sbaptthe operating system you are using. It is advised that you
1379234949Sbaptdownload the most up to date version of the config scripts from
1380234949Sbapt
1381234949Sbapt  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
1382234949Sbaptand
1383234949Sbapt  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
1384234949Sbapt
1385234949SbaptIf the version you run ($0) is already up to date, please
1386234949Sbaptsend the following data and any information you think might be
1387234949Sbaptpertinent to <config-patches@gnu.org> in order to provide the needed
1388234949Sbaptinformation to handle your system.
1389234949Sbapt
1390234949Sbaptconfig.guess timestamp = $timestamp
1391234949Sbapt
1392234949Sbaptuname -m = `(uname -m) 2>/dev/null || echo unknown`
1393234949Sbaptuname -r = `(uname -r) 2>/dev/null || echo unknown`
1394234949Sbaptuname -s = `(uname -s) 2>/dev/null || echo unknown`
1395234949Sbaptuname -v = `(uname -v) 2>/dev/null || echo unknown`
1396234949Sbapt
1397234949Sbapt/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1398234949Sbapt/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1399234949Sbapt
1400234949Sbapthostinfo               = `(hostinfo) 2>/dev/null`
1401234949Sbapt/bin/universe          = `(/bin/universe) 2>/dev/null`
1402234949Sbapt/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1403234949Sbapt/bin/arch              = `(/bin/arch) 2>/dev/null`
1404234949Sbapt/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1405234949Sbapt/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1406234949Sbapt
1407234949SbaptUNAME_MACHINE = ${UNAME_MACHINE}
1408234949SbaptUNAME_RELEASE = ${UNAME_RELEASE}
1409234949SbaptUNAME_SYSTEM  = ${UNAME_SYSTEM}
1410234949SbaptUNAME_VERSION = ${UNAME_VERSION}
1411234949SbaptEOF
1412234949Sbapt
1413234949Sbaptexit 1
1414234949Sbapt
1415234949Sbapt# Local variables:
1416234949Sbapt# eval: (add-hook 'write-file-hooks 'time-stamp)
1417234949Sbapt# time-stamp-start: "timestamp='"
1418234949Sbapt# time-stamp-format: "%:y-%02m-%02d"
1419234949Sbapt# time-stamp-end: "'"
1420234949Sbapt# End:
1421