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