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