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