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