1240a9a23Smbalmer#! /bin/sh
2240a9a23Smbalmer# Attempt to guess a canonical system name.
3240a9a23Smbalmer#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4240a9a23Smbalmer#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
5240a9a23Smbalmer
6240a9a23Smbalmertimestamp='2005-07-08'
7240a9a23Smbalmer
8240a9a23Smbalmer# This file is free software; you can redistribute it and/or modify it
9240a9a23Smbalmer# under the terms of the GNU General Public License as published by
10240a9a23Smbalmer# the Free Software Foundation; either version 2 of the License, or
11240a9a23Smbalmer# (at your option) any later version.
12240a9a23Smbalmer#
13240a9a23Smbalmer# This program is distributed in the hope that it will be useful, but
14240a9a23Smbalmer# WITHOUT ANY WARRANTY; without even the implied warranty of
15240a9a23Smbalmer# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16240a9a23Smbalmer# General Public License for more details.
17240a9a23Smbalmer#
18240a9a23Smbalmer# You should have received a copy of the GNU General Public License
19240a9a23Smbalmer# along with this program; if not, write to the Free Software
20240a9a23Smbalmer# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
21240a9a23Smbalmer# 02110-1301, USA.
22240a9a23Smbalmer#
23240a9a23Smbalmer# As a special exception to the GNU General Public License, if you
24240a9a23Smbalmer# distribute this file as part of a program that contains a
25240a9a23Smbalmer# configuration script generated by Autoconf, you may include it under
26240a9a23Smbalmer# the same distribution terms that you use for the rest of that program.
27240a9a23Smbalmer
28240a9a23Smbalmer
29240a9a23Smbalmer# Originally written by Per Bothner <per@bothner.com>.
30240a9a23Smbalmer# Please send patches to <config-patches@gnu.org>.  Submit a context
31240a9a23Smbalmer# diff and a properly formatted ChangeLog entry.
32240a9a23Smbalmer#
33240a9a23Smbalmer# This script attempts to guess a canonical system name similar to
34240a9a23Smbalmer# config.sub.  If it succeeds, it prints the system name on stdout, and
35240a9a23Smbalmer# exits with 0.  Otherwise, it exits with 1.
36240a9a23Smbalmer#
37240a9a23Smbalmer# The plan is that this can be called by configure scripts if you
38240a9a23Smbalmer# don't specify an explicit build system type.
39240a9a23Smbalmer
40240a9a23Smbalmerme=`echo "$0" | sed -e 's,.*/,,'`
41240a9a23Smbalmer
42240a9a23Smbalmerusage="\
43240a9a23SmbalmerUsage: $0 [OPTION]
44240a9a23Smbalmer
45240a9a23SmbalmerOutput the configuration name of the system \`$me' is run on.
46240a9a23Smbalmer
47240a9a23SmbalmerOperation modes:
48240a9a23Smbalmer  -h, --help         print this help, then exit
49240a9a23Smbalmer  -t, --time-stamp   print date of last modification, then exit
50240a9a23Smbalmer  -v, --version      print version number, then exit
51240a9a23Smbalmer
52240a9a23SmbalmerReport bugs and patches to <config-patches@gnu.org>."
53240a9a23Smbalmer
54240a9a23Smbalmerversion="\
55240a9a23SmbalmerGNU config.guess ($timestamp)
56240a9a23Smbalmer
57240a9a23SmbalmerOriginally written by Per Bothner.
58240a9a23SmbalmerCopyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
59240a9a23SmbalmerFree Software Foundation, Inc.
60240a9a23Smbalmer
61240a9a23SmbalmerThis is free software; see the source for copying conditions.  There is NO
62240a9a23Smbalmerwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
63240a9a23Smbalmer
64240a9a23Smbalmerhelp="
65240a9a23SmbalmerTry \`$me --help' for more information."
66240a9a23Smbalmer
67240a9a23Smbalmer# Parse command line
68240a9a23Smbalmerwhile test $# -gt 0 ; do
69240a9a23Smbalmer  case $1 in
70240a9a23Smbalmer    --time-stamp | --time* | -t )
71240a9a23Smbalmer       echo "$timestamp" ; exit ;;
72240a9a23Smbalmer    --version | -v )
73240a9a23Smbalmer       echo "$version" ; exit ;;
74240a9a23Smbalmer    --help | --h* | -h )
75240a9a23Smbalmer       echo "$usage"; exit ;;
76240a9a23Smbalmer    -- )     # Stop option processing
77240a9a23Smbalmer       shift; break ;;
78240a9a23Smbalmer    - )	# Use stdin as input.
79240a9a23Smbalmer       break ;;
80240a9a23Smbalmer    -* )
81240a9a23Smbalmer       echo "$me: invalid option $1$help" >&2
82240a9a23Smbalmer       exit 1 ;;
83240a9a23Smbalmer    * )
84240a9a23Smbalmer       break ;;
85240a9a23Smbalmer  esac
86240a9a23Smbalmerdone
87240a9a23Smbalmer
88240a9a23Smbalmerif test $# != 0; then
89240a9a23Smbalmer  echo "$me: too many arguments$help" >&2
90240a9a23Smbalmer  exit 1
91240a9a23Smbalmerfi
92240a9a23Smbalmer
93240a9a23Smbalmertrap 'exit 1' 1 2 15
94240a9a23Smbalmer
95240a9a23Smbalmer# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
96240a9a23Smbalmer# compiler to aid in system detection is discouraged as it requires
97240a9a23Smbalmer# temporary files to be created and, as you can see below, it is a
98240a9a23Smbalmer# headache to deal with in a portable fashion.
99240a9a23Smbalmer
100240a9a23Smbalmer# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
101240a9a23Smbalmer# use `HOST_CC' if defined, but it is deprecated.
102240a9a23Smbalmer
103240a9a23Smbalmer# Portable tmp directory creation inspired by the Autoconf team.
104240a9a23Smbalmer
105240a9a23Smbalmerset_cc_for_build='
106240a9a23Smbalmertrap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
107240a9a23Smbalmertrap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
108240a9a23Smbalmer: ${TMPDIR=/tmp} ;
109240a9a23Smbalmer { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
110240a9a23Smbalmer { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
111240a9a23Smbalmer { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
112240a9a23Smbalmer { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
113240a9a23Smbalmerdummy=$tmp/dummy ;
114240a9a23Smbalmertmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
115240a9a23Smbalmercase $CC_FOR_BUILD,$HOST_CC,$CC in
116240a9a23Smbalmer ,,)    echo "int x;" > $dummy.c ;
117240a9a23Smbalmer	for c in cc gcc c89 c99 ; do
118240a9a23Smbalmer	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
119240a9a23Smbalmer	     CC_FOR_BUILD="$c"; break ;
120240a9a23Smbalmer	  fi ;
121240a9a23Smbalmer	done ;
122240a9a23Smbalmer	if test x"$CC_FOR_BUILD" = x ; then
123240a9a23Smbalmer	  CC_FOR_BUILD=no_compiler_found ;
124240a9a23Smbalmer	fi
125240a9a23Smbalmer	;;
126240a9a23Smbalmer ,,*)   CC_FOR_BUILD=$CC ;;
127240a9a23Smbalmer ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
128240a9a23Smbalmeresac ; set_cc_for_build= ;'
129240a9a23Smbalmer
130240a9a23Smbalmer# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
131240a9a23Smbalmer# (ghazi@noc.rutgers.edu 1994-08-24)
132240a9a23Smbalmerif (test -f /.attbin/uname) >/dev/null 2>&1 ; then
133240a9a23Smbalmer	PATH=$PATH:/.attbin ; export PATH
134240a9a23Smbalmerfi
135240a9a23Smbalmer
136240a9a23SmbalmerUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
137240a9a23SmbalmerUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
138240a9a23SmbalmerUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
139240a9a23SmbalmerUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
140240a9a23Smbalmer
141240a9a23Smbalmer# Note: order is significant - the case branches are not exclusive.
142240a9a23Smbalmer
143240a9a23Smbalmercase "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
144240a9a23Smbalmer    *:NetBSD:*:*)
145240a9a23Smbalmer	# NetBSD (nbsd) targets should (where applicable) match one or
146240a9a23Smbalmer	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
147240a9a23Smbalmer	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
148240a9a23Smbalmer	# switched to ELF, *-*-netbsd* would select the old
149240a9a23Smbalmer	# object file format.  This provides both forward
150240a9a23Smbalmer	# compatibility and a consistent mechanism for selecting the
151240a9a23Smbalmer	# object file format.
152240a9a23Smbalmer	#
153240a9a23Smbalmer	# Note: NetBSD doesn't particularly care about the vendor
154240a9a23Smbalmer	# portion of the name.  We always set it to "unknown".
155240a9a23Smbalmer	sysctl="sysctl -n hw.machine_arch"
156240a9a23Smbalmer	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
157240a9a23Smbalmer	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
158240a9a23Smbalmer	case "${UNAME_MACHINE_ARCH}" in
159240a9a23Smbalmer	    armeb) machine=armeb-unknown ;;
160240a9a23Smbalmer	    arm*) machine=arm-unknown ;;
161240a9a23Smbalmer	    sh3el) machine=shl-unknown ;;
162240a9a23Smbalmer	    sh3eb) machine=sh-unknown ;;
163240a9a23Smbalmer	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
164240a9a23Smbalmer	esac
165240a9a23Smbalmer	# The Operating System including object format, if it has switched
166240a9a23Smbalmer	# to ELF recently, or will in the future.
167240a9a23Smbalmer	case "${UNAME_MACHINE_ARCH}" in
168240a9a23Smbalmer	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
169240a9a23Smbalmer		eval $set_cc_for_build
170240a9a23Smbalmer		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
171240a9a23Smbalmer			| grep __ELF__ >/dev/null
172240a9a23Smbalmer		then
173240a9a23Smbalmer		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
174240a9a23Smbalmer		    # Return netbsd for either.  FIX?
175240a9a23Smbalmer		    os=netbsd
176240a9a23Smbalmer		else
177240a9a23Smbalmer		    os=netbsdelf
178240a9a23Smbalmer		fi
179240a9a23Smbalmer		;;
180240a9a23Smbalmer	    *)
181240a9a23Smbalmer	        os=netbsd
182240a9a23Smbalmer		;;
183240a9a23Smbalmer	esac
184240a9a23Smbalmer	# The OS release
185240a9a23Smbalmer	# Debian GNU/NetBSD machines have a different userland, and
186240a9a23Smbalmer	# thus, need a distinct triplet. However, they do not need
187240a9a23Smbalmer	# kernel version information, so it can be replaced with a
188240a9a23Smbalmer	# suitable tag, in the style of linux-gnu.
189240a9a23Smbalmer	case "${UNAME_VERSION}" in
190240a9a23Smbalmer	    Debian*)
191240a9a23Smbalmer		release='-gnu'
192240a9a23Smbalmer		;;
193240a9a23Smbalmer	    *)
194240a9a23Smbalmer		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
195240a9a23Smbalmer		;;
196240a9a23Smbalmer	esac
197240a9a23Smbalmer	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
198240a9a23Smbalmer	# contains redundant information, the shorter form:
199240a9a23Smbalmer	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
200240a9a23Smbalmer	echo "${machine}-${os}${release}"
201240a9a23Smbalmer	exit ;;
202240a9a23Smbalmer    *:OpenBSD:*:*)
203240a9a23Smbalmer	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
204240a9a23Smbalmer	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
205240a9a23Smbalmer	exit ;;
206240a9a23Smbalmer    *:ekkoBSD:*:*)
207240a9a23Smbalmer	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
208240a9a23Smbalmer	exit ;;
209240a9a23Smbalmer    macppc:MirBSD:*:*)
210240a9a23Smbalmer	echo powerppc-unknown-mirbsd${UNAME_RELEASE}
211240a9a23Smbalmer	exit ;;
212240a9a23Smbalmer    *:MirBSD:*:*)
213240a9a23Smbalmer	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
214240a9a23Smbalmer	exit ;;
215240a9a23Smbalmer    alpha:OSF1:*:*)
216240a9a23Smbalmer	case $UNAME_RELEASE in
217240a9a23Smbalmer	*4.0)
218240a9a23Smbalmer		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
219240a9a23Smbalmer		;;
220240a9a23Smbalmer	*5.*)
221240a9a23Smbalmer	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
222240a9a23Smbalmer		;;
223240a9a23Smbalmer	esac
224240a9a23Smbalmer	# According to Compaq, /usr/sbin/psrinfo has been available on
225240a9a23Smbalmer	# OSF/1 and Tru64 systems produced since 1995.  I hope that
226240a9a23Smbalmer	# covers most systems running today.  This code pipes the CPU
227240a9a23Smbalmer	# types through head -n 1, so we only detect the type of CPU 0.
228240a9a23Smbalmer	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
229240a9a23Smbalmer	case "$ALPHA_CPU_TYPE" in
230240a9a23Smbalmer	    "EV4 (21064)")
231240a9a23Smbalmer		UNAME_MACHINE="alpha" ;;
232240a9a23Smbalmer	    "EV4.5 (21064)")
233240a9a23Smbalmer		UNAME_MACHINE="alpha" ;;
234240a9a23Smbalmer	    "LCA4 (21066/21068)")
235240a9a23Smbalmer		UNAME_MACHINE="alpha" ;;
236240a9a23Smbalmer	    "EV5 (21164)")
237240a9a23Smbalmer		UNAME_MACHINE="alphaev5" ;;
238240a9a23Smbalmer	    "EV5.6 (21164A)")
239240a9a23Smbalmer		UNAME_MACHINE="alphaev56" ;;
240240a9a23Smbalmer	    "EV5.6 (21164PC)")
241240a9a23Smbalmer		UNAME_MACHINE="alphapca56" ;;
242240a9a23Smbalmer	    "EV5.7 (21164PC)")
243240a9a23Smbalmer		UNAME_MACHINE="alphapca57" ;;
244240a9a23Smbalmer	    "EV6 (21264)")
245240a9a23Smbalmer		UNAME_MACHINE="alphaev6" ;;
246240a9a23Smbalmer	    "EV6.7 (21264A)")
247240a9a23Smbalmer		UNAME_MACHINE="alphaev67" ;;
248240a9a23Smbalmer	    "EV6.8CB (21264C)")
249240a9a23Smbalmer		UNAME_MACHINE="alphaev68" ;;
250240a9a23Smbalmer	    "EV6.8AL (21264B)")
251240a9a23Smbalmer		UNAME_MACHINE="alphaev68" ;;
252240a9a23Smbalmer	    "EV6.8CX (21264D)")
253240a9a23Smbalmer		UNAME_MACHINE="alphaev68" ;;
254240a9a23Smbalmer	    "EV6.9A (21264/EV69A)")
255240a9a23Smbalmer		UNAME_MACHINE="alphaev69" ;;
256240a9a23Smbalmer	    "EV7 (21364)")
257240a9a23Smbalmer		UNAME_MACHINE="alphaev7" ;;
258240a9a23Smbalmer	    "EV7.9 (21364A)")
259240a9a23Smbalmer		UNAME_MACHINE="alphaev79" ;;
260240a9a23Smbalmer	esac
261240a9a23Smbalmer	# A Pn.n version is a patched version.
262240a9a23Smbalmer	# A Vn.n version is a released version.
263240a9a23Smbalmer	# A Tn.n version is a released field test version.
264240a9a23Smbalmer	# A Xn.n version is an unreleased experimental baselevel.
265240a9a23Smbalmer	# 1.2 uses "1.2" for uname -r.
266240a9a23Smbalmer	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
267240a9a23Smbalmer	exit ;;
268240a9a23Smbalmer    Alpha\ *:Windows_NT*:*)
269240a9a23Smbalmer	# How do we know it's Interix rather than the generic POSIX subsystem?
270240a9a23Smbalmer	# Should we change UNAME_MACHINE based on the output of uname instead
271240a9a23Smbalmer	# of the specific Alpha model?
272240a9a23Smbalmer	echo alpha-pc-interix
273240a9a23Smbalmer	exit ;;
274240a9a23Smbalmer    21064:Windows_NT:50:3)
275240a9a23Smbalmer	echo alpha-dec-winnt3.5
276240a9a23Smbalmer	exit ;;
277240a9a23Smbalmer    Amiga*:UNIX_System_V:4.0:*)
278240a9a23Smbalmer	echo m68k-unknown-sysv4
279240a9a23Smbalmer	exit ;;
280240a9a23Smbalmer    *:[Aa]miga[Oo][Ss]:*:*)
281240a9a23Smbalmer	echo ${UNAME_MACHINE}-unknown-amigaos
282240a9a23Smbalmer	exit ;;
283240a9a23Smbalmer    *:[Mm]orph[Oo][Ss]:*:*)
284240a9a23Smbalmer	echo ${UNAME_MACHINE}-unknown-morphos
285240a9a23Smbalmer	exit ;;
286240a9a23Smbalmer    *:OS/390:*:*)
287240a9a23Smbalmer	echo i370-ibm-openedition
288240a9a23Smbalmer	exit ;;
289240a9a23Smbalmer    *:z/VM:*:*)
290240a9a23Smbalmer	echo s390-ibm-zvmoe
291240a9a23Smbalmer	exit ;;
292240a9a23Smbalmer    *:OS400:*:*)
293240a9a23Smbalmer        echo powerpc-ibm-os400
294240a9a23Smbalmer	exit ;;
295240a9a23Smbalmer    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
296240a9a23Smbalmer	echo arm-acorn-riscix${UNAME_RELEASE}
297240a9a23Smbalmer	exit ;;
298240a9a23Smbalmer    arm:riscos:*:*|arm:RISCOS:*:*)
299240a9a23Smbalmer	echo arm-unknown-riscos
300240a9a23Smbalmer	exit ;;
301240a9a23Smbalmer    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
302240a9a23Smbalmer	echo hppa1.1-hitachi-hiuxmpp
303240a9a23Smbalmer	exit ;;
304240a9a23Smbalmer    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
305240a9a23Smbalmer	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
306240a9a23Smbalmer	if test "`(/bin/universe) 2>/dev/null`" = att ; then
307240a9a23Smbalmer		echo pyramid-pyramid-sysv3
308240a9a23Smbalmer	else
309240a9a23Smbalmer		echo pyramid-pyramid-bsd
310240a9a23Smbalmer	fi
311240a9a23Smbalmer	exit ;;
312240a9a23Smbalmer    NILE*:*:*:dcosx)
313240a9a23Smbalmer	echo pyramid-pyramid-svr4
314240a9a23Smbalmer	exit ;;
315240a9a23Smbalmer    DRS?6000:unix:4.0:6*)
316240a9a23Smbalmer	echo sparc-icl-nx6
317240a9a23Smbalmer	exit ;;
318240a9a23Smbalmer    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
319240a9a23Smbalmer	case `/usr/bin/uname -p` in
320240a9a23Smbalmer	    sparc) echo sparc-icl-nx7; exit ;;
321240a9a23Smbalmer	esac ;;
322240a9a23Smbalmer    sun4H:SunOS:5.*:*)
323240a9a23Smbalmer	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
324240a9a23Smbalmer	exit ;;
325240a9a23Smbalmer    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
326240a9a23Smbalmer	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
327240a9a23Smbalmer	exit ;;
328240a9a23Smbalmer    i86pc:SunOS:5.*:*)
329240a9a23Smbalmer	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
330240a9a23Smbalmer	exit ;;
331240a9a23Smbalmer    sun4*:SunOS:6*:*)
332240a9a23Smbalmer	# According to config.sub, this is the proper way to canonicalize
333240a9a23Smbalmer	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
334240a9a23Smbalmer	# it's likely to be more like Solaris than SunOS4.
335240a9a23Smbalmer	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
336240a9a23Smbalmer	exit ;;
337240a9a23Smbalmer    sun4*:SunOS:*:*)
338240a9a23Smbalmer	case "`/usr/bin/arch -k`" in
339240a9a23Smbalmer	    Series*|S4*)
340240a9a23Smbalmer		UNAME_RELEASE=`uname -v`
341240a9a23Smbalmer		;;
342240a9a23Smbalmer	esac
343240a9a23Smbalmer	# Japanese Language versions have a version number like `4.1.3-JL'.
344240a9a23Smbalmer	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
345240a9a23Smbalmer	exit ;;
346240a9a23Smbalmer    sun3*:SunOS:*:*)
347240a9a23Smbalmer	echo m68k-sun-sunos${UNAME_RELEASE}
348240a9a23Smbalmer	exit ;;
349240a9a23Smbalmer    sun*:*:4.2BSD:*)
350240a9a23Smbalmer	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
351240a9a23Smbalmer	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
352240a9a23Smbalmer	case "`/bin/arch`" in
353240a9a23Smbalmer	    sun3)
354240a9a23Smbalmer		echo m68k-sun-sunos${UNAME_RELEASE}
355240a9a23Smbalmer		;;
356240a9a23Smbalmer	    sun4)
357240a9a23Smbalmer		echo sparc-sun-sunos${UNAME_RELEASE}
358240a9a23Smbalmer		;;
359240a9a23Smbalmer	esac
360240a9a23Smbalmer	exit ;;
361240a9a23Smbalmer    aushp:SunOS:*:*)
362240a9a23Smbalmer	echo sparc-auspex-sunos${UNAME_RELEASE}
363240a9a23Smbalmer	exit ;;
364240a9a23Smbalmer    # The situation for MiNT is a little confusing.  The machine name
365240a9a23Smbalmer    # can be virtually everything (everything which is not
366240a9a23Smbalmer    # "atarist" or "atariste" at least should have a processor
367240a9a23Smbalmer    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
368240a9a23Smbalmer    # to the lowercase version "mint" (or "freemint").  Finally
369240a9a23Smbalmer    # the system name "TOS" denotes a system which is actually not
370240a9a23Smbalmer    # MiNT.  But MiNT is downward compatible to TOS, so this should
371240a9a23Smbalmer    # be no problem.
372240a9a23Smbalmer    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
373240a9a23Smbalmer        echo m68k-atari-mint${UNAME_RELEASE}
374240a9a23Smbalmer	exit ;;
375240a9a23Smbalmer    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
376240a9a23Smbalmer	echo m68k-atari-mint${UNAME_RELEASE}
377240a9a23Smbalmer        exit ;;
378240a9a23Smbalmer    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
379240a9a23Smbalmer        echo m68k-atari-mint${UNAME_RELEASE}
380240a9a23Smbalmer	exit ;;
381240a9a23Smbalmer    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
382240a9a23Smbalmer        echo m68k-milan-mint${UNAME_RELEASE}
383240a9a23Smbalmer        exit ;;
384240a9a23Smbalmer    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
385240a9a23Smbalmer        echo m68k-hades-mint${UNAME_RELEASE}
386240a9a23Smbalmer        exit ;;
387240a9a23Smbalmer    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
388240a9a23Smbalmer        echo m68k-unknown-mint${UNAME_RELEASE}
389240a9a23Smbalmer        exit ;;
390240a9a23Smbalmer    m68k:machten:*:*)
391240a9a23Smbalmer	echo m68k-apple-machten${UNAME_RELEASE}
392240a9a23Smbalmer	exit ;;
393240a9a23Smbalmer    powerpc:machten:*:*)
394240a9a23Smbalmer	echo powerpc-apple-machten${UNAME_RELEASE}
395240a9a23Smbalmer	exit ;;
396240a9a23Smbalmer    RISC*:Mach:*:*)
397240a9a23Smbalmer	echo mips-dec-mach_bsd4.3
398240a9a23Smbalmer	exit ;;
399240a9a23Smbalmer    RISC*:ULTRIX:*:*)
400240a9a23Smbalmer	echo mips-dec-ultrix${UNAME_RELEASE}
401240a9a23Smbalmer	exit ;;
402240a9a23Smbalmer    VAX*:ULTRIX*:*:*)
403240a9a23Smbalmer	echo vax-dec-ultrix${UNAME_RELEASE}
404240a9a23Smbalmer	exit ;;
405240a9a23Smbalmer    2020:CLIX:*:* | 2430:CLIX:*:*)
406240a9a23Smbalmer	echo clipper-intergraph-clix${UNAME_RELEASE}
407240a9a23Smbalmer	exit ;;
408240a9a23Smbalmer    mips:*:*:UMIPS | mips:*:*:RISCos)
409240a9a23Smbalmer	eval $set_cc_for_build
410240a9a23Smbalmer	sed 's/^	//' << EOF >$dummy.c
411240a9a23Smbalmer#ifdef __cplusplus
412240a9a23Smbalmer#include <stdio.h>  /* for printf() prototype */
413240a9a23Smbalmer	int main (int argc, char *argv[]) {
414240a9a23Smbalmer#else
415240a9a23Smbalmer	int main (argc, argv) int argc; char *argv[]; {
416240a9a23Smbalmer#endif
417240a9a23Smbalmer	#if defined (host_mips) && defined (MIPSEB)
418240a9a23Smbalmer	#if defined (SYSTYPE_SYSV)
419240a9a23Smbalmer	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
420240a9a23Smbalmer	#endif
421240a9a23Smbalmer	#if defined (SYSTYPE_SVR4)
422240a9a23Smbalmer	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
423240a9a23Smbalmer	#endif
424240a9a23Smbalmer	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
425240a9a23Smbalmer	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
426240a9a23Smbalmer	#endif
427240a9a23Smbalmer	#endif
428240a9a23Smbalmer	  exit (-1);
429240a9a23Smbalmer	}
430240a9a23SmbalmerEOF
431240a9a23Smbalmer	$CC_FOR_BUILD -o $dummy $dummy.c &&
432240a9a23Smbalmer	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
433240a9a23Smbalmer	  SYSTEM_NAME=`$dummy $dummyarg` &&
434240a9a23Smbalmer	    { echo "$SYSTEM_NAME"; exit; }
435240a9a23Smbalmer	echo mips-mips-riscos${UNAME_RELEASE}
436240a9a23Smbalmer	exit ;;
437240a9a23Smbalmer    Motorola:PowerMAX_OS:*:*)
438240a9a23Smbalmer	echo powerpc-motorola-powermax
439240a9a23Smbalmer	exit ;;
440240a9a23Smbalmer    Motorola:*:4.3:PL8-*)
441240a9a23Smbalmer	echo powerpc-harris-powermax
442240a9a23Smbalmer	exit ;;
443240a9a23Smbalmer    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
444240a9a23Smbalmer	echo powerpc-harris-powermax
445240a9a23Smbalmer	exit ;;
446240a9a23Smbalmer    Night_Hawk:Power_UNIX:*:*)
447240a9a23Smbalmer	echo powerpc-harris-powerunix
448240a9a23Smbalmer	exit ;;
449240a9a23Smbalmer    m88k:CX/UX:7*:*)
450240a9a23Smbalmer	echo m88k-harris-cxux7
451240a9a23Smbalmer	exit ;;
452240a9a23Smbalmer    m88k:*:4*:R4*)
453240a9a23Smbalmer	echo m88k-motorola-sysv4
454240a9a23Smbalmer	exit ;;
455240a9a23Smbalmer    m88k:*:3*:R3*)
456240a9a23Smbalmer	echo m88k-motorola-sysv3
457240a9a23Smbalmer	exit ;;
458240a9a23Smbalmer    AViiON:dgux:*:*)
459240a9a23Smbalmer        # DG/UX returns AViiON for all architectures
460240a9a23Smbalmer        UNAME_PROCESSOR=`/usr/bin/uname -p`
461240a9a23Smbalmer	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
462240a9a23Smbalmer	then
463240a9a23Smbalmer	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
464240a9a23Smbalmer	       [ ${TARGET_BINARY_INTERFACE}x = x ]
465240a9a23Smbalmer	    then
466240a9a23Smbalmer		echo m88k-dg-dgux${UNAME_RELEASE}
467240a9a23Smbalmer	    else
468240a9a23Smbalmer		echo m88k-dg-dguxbcs${UNAME_RELEASE}
469240a9a23Smbalmer	    fi
470240a9a23Smbalmer	else
471240a9a23Smbalmer	    echo i586-dg-dgux${UNAME_RELEASE}
472240a9a23Smbalmer	fi
473240a9a23Smbalmer 	exit ;;
474240a9a23Smbalmer    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
475240a9a23Smbalmer	echo m88k-dolphin-sysv3
476240a9a23Smbalmer	exit ;;
477240a9a23Smbalmer    M88*:*:R3*:*)
478240a9a23Smbalmer	# Delta 88k system running SVR3
479240a9a23Smbalmer	echo m88k-motorola-sysv3
480240a9a23Smbalmer	exit ;;
481240a9a23Smbalmer    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
482240a9a23Smbalmer	echo m88k-tektronix-sysv3
483240a9a23Smbalmer	exit ;;
484240a9a23Smbalmer    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
485240a9a23Smbalmer	echo m68k-tektronix-bsd
486240a9a23Smbalmer	exit ;;
487240a9a23Smbalmer    *:IRIX*:*:*)
488240a9a23Smbalmer	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
489240a9a23Smbalmer	exit ;;
490240a9a23Smbalmer    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
491240a9a23Smbalmer	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
492240a9a23Smbalmer	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
493240a9a23Smbalmer    i*86:AIX:*:*)
494240a9a23Smbalmer	echo i386-ibm-aix
495240a9a23Smbalmer	exit ;;
496240a9a23Smbalmer    ia64:AIX:*:*)
497240a9a23Smbalmer	if [ -x /usr/bin/oslevel ] ; then
498240a9a23Smbalmer		IBM_REV=`/usr/bin/oslevel`
499240a9a23Smbalmer	else
500240a9a23Smbalmer		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
501240a9a23Smbalmer	fi
502240a9a23Smbalmer	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
503240a9a23Smbalmer	exit ;;
504240a9a23Smbalmer    *:AIX:2:3)
505240a9a23Smbalmer	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
506240a9a23Smbalmer		eval $set_cc_for_build
507240a9a23Smbalmer		sed 's/^		//' << EOF >$dummy.c
508240a9a23Smbalmer		#include <sys/systemcfg.h>
509240a9a23Smbalmer
510240a9a23Smbalmer		main()
511240a9a23Smbalmer			{
512240a9a23Smbalmer			if (!__power_pc())
513240a9a23Smbalmer				exit(1);
514240a9a23Smbalmer			puts("powerpc-ibm-aix3.2.5");
515240a9a23Smbalmer			exit(0);
516240a9a23Smbalmer			}
517240a9a23SmbalmerEOF
518240a9a23Smbalmer		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
519240a9a23Smbalmer		then
520240a9a23Smbalmer			echo "$SYSTEM_NAME"
521240a9a23Smbalmer		else
522240a9a23Smbalmer			echo rs6000-ibm-aix3.2.5
523240a9a23Smbalmer		fi
524240a9a23Smbalmer	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
525240a9a23Smbalmer		echo rs6000-ibm-aix3.2.4
526240a9a23Smbalmer	else
527240a9a23Smbalmer		echo rs6000-ibm-aix3.2
528240a9a23Smbalmer	fi
529240a9a23Smbalmer	exit ;;
530240a9a23Smbalmer    *:AIX:*:[45])
531240a9a23Smbalmer	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
532240a9a23Smbalmer	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
533240a9a23Smbalmer		IBM_ARCH=rs6000
534240a9a23Smbalmer	else
535240a9a23Smbalmer		IBM_ARCH=powerpc
536240a9a23Smbalmer	fi
537240a9a23Smbalmer	if [ -x /usr/bin/oslevel ] ; then
538240a9a23Smbalmer		IBM_REV=`/usr/bin/oslevel`
539240a9a23Smbalmer	else
540240a9a23Smbalmer		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
541240a9a23Smbalmer	fi
542240a9a23Smbalmer	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
543240a9a23Smbalmer	exit ;;
544240a9a23Smbalmer    *:AIX:*:*)
545240a9a23Smbalmer	echo rs6000-ibm-aix
546240a9a23Smbalmer	exit ;;
547240a9a23Smbalmer    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
548240a9a23Smbalmer	echo romp-ibm-bsd4.4
549240a9a23Smbalmer	exit ;;
550240a9a23Smbalmer    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
551240a9a23Smbalmer	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
552240a9a23Smbalmer	exit ;;                             # report: romp-ibm BSD 4.3
553240a9a23Smbalmer    *:BOSX:*:*)
554240a9a23Smbalmer	echo rs6000-bull-bosx
555240a9a23Smbalmer	exit ;;
556240a9a23Smbalmer    DPX/2?00:B.O.S.:*:*)
557240a9a23Smbalmer	echo m68k-bull-sysv3
558240a9a23Smbalmer	exit ;;
559240a9a23Smbalmer    9000/[34]??:4.3bsd:1.*:*)
560240a9a23Smbalmer	echo m68k-hp-bsd
561240a9a23Smbalmer	exit ;;
562240a9a23Smbalmer    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
563240a9a23Smbalmer	echo m68k-hp-bsd4.4
564240a9a23Smbalmer	exit ;;
565240a9a23Smbalmer    9000/[34678]??:HP-UX:*:*)
566240a9a23Smbalmer	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
567240a9a23Smbalmer	case "${UNAME_MACHINE}" in
568240a9a23Smbalmer	    9000/31? )            HP_ARCH=m68000 ;;
569240a9a23Smbalmer	    9000/[34]?? )         HP_ARCH=m68k ;;
570240a9a23Smbalmer	    9000/[678][0-9][0-9])
571240a9a23Smbalmer		if [ -x /usr/bin/getconf ]; then
572240a9a23Smbalmer		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
573240a9a23Smbalmer                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
574240a9a23Smbalmer                    case "${sc_cpu_version}" in
575240a9a23Smbalmer                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
576240a9a23Smbalmer                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
577240a9a23Smbalmer                      532)                      # CPU_PA_RISC2_0
578240a9a23Smbalmer                        case "${sc_kernel_bits}" in
579240a9a23Smbalmer                          32) HP_ARCH="hppa2.0n" ;;
580240a9a23Smbalmer                          64) HP_ARCH="hppa2.0w" ;;
581240a9a23Smbalmer			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
582240a9a23Smbalmer                        esac ;;
583240a9a23Smbalmer                    esac
584240a9a23Smbalmer		fi
585240a9a23Smbalmer		if [ "${HP_ARCH}" = "" ]; then
586240a9a23Smbalmer		    eval $set_cc_for_build
587240a9a23Smbalmer		    sed 's/^              //' << EOF >$dummy.c
588240a9a23Smbalmer
589240a9a23Smbalmer              #define _HPUX_SOURCE
590240a9a23Smbalmer              #include <stdlib.h>
591240a9a23Smbalmer              #include <unistd.h>
592240a9a23Smbalmer
593240a9a23Smbalmer              int main ()
594240a9a23Smbalmer              {
595240a9a23Smbalmer              #if defined(_SC_KERNEL_BITS)
596240a9a23Smbalmer                  long bits = sysconf(_SC_KERNEL_BITS);
597240a9a23Smbalmer              #endif
598240a9a23Smbalmer                  long cpu  = sysconf (_SC_CPU_VERSION);
599240a9a23Smbalmer
600240a9a23Smbalmer                  switch (cpu)
601240a9a23Smbalmer              	{
602240a9a23Smbalmer              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
603240a9a23Smbalmer              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
604240a9a23Smbalmer              	case CPU_PA_RISC2_0:
605240a9a23Smbalmer              #if defined(_SC_KERNEL_BITS)
606240a9a23Smbalmer              	    switch (bits)
607240a9a23Smbalmer              		{
608240a9a23Smbalmer              		case 64: puts ("hppa2.0w"); break;
609240a9a23Smbalmer              		case 32: puts ("hppa2.0n"); break;
610240a9a23Smbalmer              		default: puts ("hppa2.0"); break;
611240a9a23Smbalmer              		} break;
612240a9a23Smbalmer              #else  /* !defined(_SC_KERNEL_BITS) */
613240a9a23Smbalmer              	    puts ("hppa2.0"); break;
614240a9a23Smbalmer              #endif
615240a9a23Smbalmer              	default: puts ("hppa1.0"); break;
616240a9a23Smbalmer              	}
617240a9a23Smbalmer                  exit (0);
618240a9a23Smbalmer              }
619240a9a23SmbalmerEOF
620240a9a23Smbalmer		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
621240a9a23Smbalmer		    test -z "$HP_ARCH" && HP_ARCH=hppa
622240a9a23Smbalmer		fi ;;
623240a9a23Smbalmer	esac
624240a9a23Smbalmer	if [ ${HP_ARCH} = "hppa2.0w" ]
625240a9a23Smbalmer	then
626240a9a23Smbalmer	    eval $set_cc_for_build
627240a9a23Smbalmer
628240a9a23Smbalmer	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
629240a9a23Smbalmer	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
630240a9a23Smbalmer	    # generating 64-bit code.  GNU and HP use different nomenclature:
631240a9a23Smbalmer	    #
632240a9a23Smbalmer	    # $ CC_FOR_BUILD=cc ./config.guess
633240a9a23Smbalmer	    # => hppa2.0w-hp-hpux11.23
634240a9a23Smbalmer	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
635240a9a23Smbalmer	    # => hppa64-hp-hpux11.23
636240a9a23Smbalmer
637240a9a23Smbalmer	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
638240a9a23Smbalmer		grep __LP64__ >/dev/null
639240a9a23Smbalmer	    then
640240a9a23Smbalmer		HP_ARCH="hppa2.0w"
641240a9a23Smbalmer	    else
642240a9a23Smbalmer		HP_ARCH="hppa64"
643240a9a23Smbalmer	    fi
644240a9a23Smbalmer	fi
645240a9a23Smbalmer	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
646240a9a23Smbalmer	exit ;;
647240a9a23Smbalmer    ia64:HP-UX:*:*)
648240a9a23Smbalmer	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
649240a9a23Smbalmer	echo ia64-hp-hpux${HPUX_REV}
650240a9a23Smbalmer	exit ;;
651240a9a23Smbalmer    3050*:HI-UX:*:*)
652240a9a23Smbalmer	eval $set_cc_for_build
653240a9a23Smbalmer	sed 's/^	//' << EOF >$dummy.c
654240a9a23Smbalmer	#include <unistd.h>
655240a9a23Smbalmer	int
656240a9a23Smbalmer	main ()
657240a9a23Smbalmer	{
658240a9a23Smbalmer	  long cpu = sysconf (_SC_CPU_VERSION);
659240a9a23Smbalmer	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
660240a9a23Smbalmer	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
661240a9a23Smbalmer	     results, however.  */
662240a9a23Smbalmer	  if (CPU_IS_PA_RISC (cpu))
663240a9a23Smbalmer	    {
664240a9a23Smbalmer	      switch (cpu)
665240a9a23Smbalmer		{
666240a9a23Smbalmer		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
667240a9a23Smbalmer		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
668240a9a23Smbalmer		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
669240a9a23Smbalmer		  default: puts ("hppa-hitachi-hiuxwe2"); break;
670240a9a23Smbalmer		}
671240a9a23Smbalmer	    }
672240a9a23Smbalmer	  else if (CPU_IS_HP_MC68K (cpu))
673240a9a23Smbalmer	    puts ("m68k-hitachi-hiuxwe2");
674240a9a23Smbalmer	  else puts ("unknown-hitachi-hiuxwe2");
675240a9a23Smbalmer	  exit (0);
676240a9a23Smbalmer	}
677240a9a23SmbalmerEOF
678240a9a23Smbalmer	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
679240a9a23Smbalmer		{ echo "$SYSTEM_NAME"; exit; }
680240a9a23Smbalmer	echo unknown-hitachi-hiuxwe2
681240a9a23Smbalmer	exit ;;
682240a9a23Smbalmer    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
683240a9a23Smbalmer	echo hppa1.1-hp-bsd
684240a9a23Smbalmer	exit ;;
685240a9a23Smbalmer    9000/8??:4.3bsd:*:*)
686240a9a23Smbalmer	echo hppa1.0-hp-bsd
687240a9a23Smbalmer	exit ;;
688240a9a23Smbalmer    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
689240a9a23Smbalmer	echo hppa1.0-hp-mpeix
690240a9a23Smbalmer	exit ;;
691240a9a23Smbalmer    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
692240a9a23Smbalmer	echo hppa1.1-hp-osf
693240a9a23Smbalmer	exit ;;
694240a9a23Smbalmer    hp8??:OSF1:*:*)
695240a9a23Smbalmer	echo hppa1.0-hp-osf
696240a9a23Smbalmer	exit ;;
697240a9a23Smbalmer    i*86:OSF1:*:*)
698240a9a23Smbalmer	if [ -x /usr/sbin/sysversion ] ; then
699240a9a23Smbalmer	    echo ${UNAME_MACHINE}-unknown-osf1mk
700240a9a23Smbalmer	else
701240a9a23Smbalmer	    echo ${UNAME_MACHINE}-unknown-osf1
702240a9a23Smbalmer	fi
703240a9a23Smbalmer	exit ;;
704240a9a23Smbalmer    parisc*:Lites*:*:*)
705240a9a23Smbalmer	echo hppa1.1-hp-lites
706240a9a23Smbalmer	exit ;;
707240a9a23Smbalmer    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
708240a9a23Smbalmer	echo c1-convex-bsd
709240a9a23Smbalmer        exit ;;
710240a9a23Smbalmer    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
711240a9a23Smbalmer	if getsysinfo -f scalar_acc
712240a9a23Smbalmer	then echo c32-convex-bsd
713240a9a23Smbalmer	else echo c2-convex-bsd
714240a9a23Smbalmer	fi
715240a9a23Smbalmer        exit ;;
716240a9a23Smbalmer    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
717240a9a23Smbalmer	echo c34-convex-bsd
718240a9a23Smbalmer        exit ;;
719240a9a23Smbalmer    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
720240a9a23Smbalmer	echo c38-convex-bsd
721240a9a23Smbalmer        exit ;;
722240a9a23Smbalmer    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
723240a9a23Smbalmer	echo c4-convex-bsd
724240a9a23Smbalmer        exit ;;
725240a9a23Smbalmer    CRAY*Y-MP:*:*:*)
726240a9a23Smbalmer	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
727240a9a23Smbalmer	exit ;;
728240a9a23Smbalmer    CRAY*[A-Z]90:*:*:*)
729240a9a23Smbalmer	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
730240a9a23Smbalmer	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
731240a9a23Smbalmer	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
732240a9a23Smbalmer	      -e 's/\.[^.]*$/.X/'
733240a9a23Smbalmer	exit ;;
734240a9a23Smbalmer    CRAY*TS:*:*:*)
735240a9a23Smbalmer	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
736240a9a23Smbalmer	exit ;;
737240a9a23Smbalmer    CRAY*T3E:*:*:*)
738240a9a23Smbalmer	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
739240a9a23Smbalmer	exit ;;
740240a9a23Smbalmer    CRAY*SV1:*:*:*)
741240a9a23Smbalmer	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
742240a9a23Smbalmer	exit ;;
743240a9a23Smbalmer    *:UNICOS/mp:*:*)
744240a9a23Smbalmer	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
745240a9a23Smbalmer	exit ;;
746240a9a23Smbalmer    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
747240a9a23Smbalmer	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
748240a9a23Smbalmer        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
749240a9a23Smbalmer        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
750240a9a23Smbalmer        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
751240a9a23Smbalmer        exit ;;
752240a9a23Smbalmer    5000:UNIX_System_V:4.*:*)
753240a9a23Smbalmer        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
754240a9a23Smbalmer        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
755240a9a23Smbalmer        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
756240a9a23Smbalmer	exit ;;
757240a9a23Smbalmer    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
758240a9a23Smbalmer	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
759240a9a23Smbalmer	exit ;;
760240a9a23Smbalmer    sparc*:BSD/OS:*:*)
761240a9a23Smbalmer	echo sparc-unknown-bsdi${UNAME_RELEASE}
762240a9a23Smbalmer	exit ;;
763240a9a23Smbalmer    *:BSD/OS:*:*)
764240a9a23Smbalmer	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
765240a9a23Smbalmer	exit ;;
766240a9a23Smbalmer    *:FreeBSD:*:*)
767240a9a23Smbalmer	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
768240a9a23Smbalmer	exit ;;
769240a9a23Smbalmer    i*:CYGWIN*:*)
770240a9a23Smbalmer	echo ${UNAME_MACHINE}-pc-cygwin
771240a9a23Smbalmer	exit ;;
772240a9a23Smbalmer    i*:MINGW*:*)
773240a9a23Smbalmer	echo ${UNAME_MACHINE}-pc-mingw32
774240a9a23Smbalmer	exit ;;
775240a9a23Smbalmer    i*:windows32*:*)
776240a9a23Smbalmer    	# uname -m includes "-pc" on this system.
777240a9a23Smbalmer    	echo ${UNAME_MACHINE}-mingw32
778240a9a23Smbalmer	exit ;;
779240a9a23Smbalmer    i*:PW*:*)
780240a9a23Smbalmer	echo ${UNAME_MACHINE}-pc-pw32
781240a9a23Smbalmer	exit ;;
782240a9a23Smbalmer    x86:Interix*:[34]*)
783240a9a23Smbalmer	echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
784240a9a23Smbalmer	exit ;;
785240a9a23Smbalmer    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
786240a9a23Smbalmer	echo i${UNAME_MACHINE}-pc-mks
787240a9a23Smbalmer	exit ;;
788240a9a23Smbalmer    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
789240a9a23Smbalmer	# How do we know it's Interix rather than the generic POSIX subsystem?
790240a9a23Smbalmer	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
791240a9a23Smbalmer	# UNAME_MACHINE based on the output of uname instead of i386?
792240a9a23Smbalmer	echo i586-pc-interix
793240a9a23Smbalmer	exit ;;
794240a9a23Smbalmer    i*:UWIN*:*)
795240a9a23Smbalmer	echo ${UNAME_MACHINE}-pc-uwin
796240a9a23Smbalmer	exit ;;
797240a9a23Smbalmer    amd64:CYGWIN*:*:*)
798240a9a23Smbalmer	echo x86_64-unknown-cygwin
799240a9a23Smbalmer	exit ;;
800240a9a23Smbalmer    p*:CYGWIN*:*)
801240a9a23Smbalmer	echo powerpcle-unknown-cygwin
802240a9a23Smbalmer	exit ;;
803240a9a23Smbalmer    prep*:SunOS:5.*:*)
804240a9a23Smbalmer	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
805240a9a23Smbalmer	exit ;;
806240a9a23Smbalmer    *:GNU:*:*)
807240a9a23Smbalmer	# the GNU system
808240a9a23Smbalmer	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
809240a9a23Smbalmer	exit ;;
810240a9a23Smbalmer    *:GNU/*:*:*)
811240a9a23Smbalmer	# other systems with GNU libc and userland
812240a9a23Smbalmer	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
813240a9a23Smbalmer	exit ;;
814240a9a23Smbalmer    i*86:Minix:*:*)
815240a9a23Smbalmer	echo ${UNAME_MACHINE}-pc-minix
816240a9a23Smbalmer	exit ;;
817240a9a23Smbalmer    arm*:Linux:*:*)
818240a9a23Smbalmer	echo ${UNAME_MACHINE}-unknown-linux-gnu
819240a9a23Smbalmer	exit ;;
820240a9a23Smbalmer    cris:Linux:*:*)
821240a9a23Smbalmer	echo cris-axis-linux-gnu
822240a9a23Smbalmer	exit ;;
823240a9a23Smbalmer    crisv32:Linux:*:*)
824240a9a23Smbalmer	echo crisv32-axis-linux-gnu
825240a9a23Smbalmer	exit ;;
826240a9a23Smbalmer    frv:Linux:*:*)
827240a9a23Smbalmer    	echo frv-unknown-linux-gnu
828240a9a23Smbalmer	exit ;;
829240a9a23Smbalmer    ia64:Linux:*:*)
830240a9a23Smbalmer	echo ${UNAME_MACHINE}-unknown-linux-gnu
831240a9a23Smbalmer	exit ;;
832240a9a23Smbalmer    m32r*:Linux:*:*)
833240a9a23Smbalmer	echo ${UNAME_MACHINE}-unknown-linux-gnu
834240a9a23Smbalmer	exit ;;
835240a9a23Smbalmer    m68*:Linux:*:*)
836240a9a23Smbalmer	echo ${UNAME_MACHINE}-unknown-linux-gnu
837240a9a23Smbalmer	exit ;;
838240a9a23Smbalmer    mips:Linux:*:*)
839240a9a23Smbalmer	eval $set_cc_for_build
840240a9a23Smbalmer	sed 's/^	//' << EOF >$dummy.c
841240a9a23Smbalmer	#undef CPU
842240a9a23Smbalmer	#undef mips
843240a9a23Smbalmer	#undef mipsel
844240a9a23Smbalmer	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
845240a9a23Smbalmer	CPU=mipsel
846240a9a23Smbalmer	#else
847240a9a23Smbalmer	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
848240a9a23Smbalmer	CPU=mips
849240a9a23Smbalmer	#else
850240a9a23Smbalmer	CPU=
851240a9a23Smbalmer	#endif
852240a9a23Smbalmer	#endif
853240a9a23SmbalmerEOF
854240a9a23Smbalmer	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
855240a9a23Smbalmer	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
856240a9a23Smbalmer	;;
857240a9a23Smbalmer    mips64:Linux:*:*)
858240a9a23Smbalmer	eval $set_cc_for_build
859240a9a23Smbalmer	sed 's/^	//' << EOF >$dummy.c
860240a9a23Smbalmer	#undef CPU
861240a9a23Smbalmer	#undef mips64
862240a9a23Smbalmer	#undef mips64el
863240a9a23Smbalmer	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
864240a9a23Smbalmer	CPU=mips64el
865240a9a23Smbalmer	#else
866240a9a23Smbalmer	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
867240a9a23Smbalmer	CPU=mips64
868240a9a23Smbalmer	#else
869240a9a23Smbalmer	CPU=
870240a9a23Smbalmer	#endif
871240a9a23Smbalmer	#endif
872240a9a23SmbalmerEOF
873240a9a23Smbalmer	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
874240a9a23Smbalmer	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
875240a9a23Smbalmer	;;
876240a9a23Smbalmer    ppc:Linux:*:*)
877240a9a23Smbalmer	echo powerpc-unknown-linux-gnu
878240a9a23Smbalmer	exit ;;
879240a9a23Smbalmer    ppc64:Linux:*:*)
880240a9a23Smbalmer	echo powerpc64-unknown-linux-gnu
881240a9a23Smbalmer	exit ;;
882240a9a23Smbalmer    alpha:Linux:*:*)
883240a9a23Smbalmer	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
884240a9a23Smbalmer	  EV5)   UNAME_MACHINE=alphaev5 ;;
885240a9a23Smbalmer	  EV56)  UNAME_MACHINE=alphaev56 ;;
886240a9a23Smbalmer	  PCA56) UNAME_MACHINE=alphapca56 ;;
887240a9a23Smbalmer	  PCA57) UNAME_MACHINE=alphapca56 ;;
888240a9a23Smbalmer	  EV6)   UNAME_MACHINE=alphaev6 ;;
889240a9a23Smbalmer	  EV67)  UNAME_MACHINE=alphaev67 ;;
890240a9a23Smbalmer	  EV68*) UNAME_MACHINE=alphaev68 ;;
891240a9a23Smbalmer        esac
892240a9a23Smbalmer	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
893240a9a23Smbalmer	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
894240a9a23Smbalmer	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
895240a9a23Smbalmer	exit ;;
896240a9a23Smbalmer    parisc:Linux:*:* | hppa:Linux:*:*)
897240a9a23Smbalmer	# Look for CPU level
898240a9a23Smbalmer	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
899240a9a23Smbalmer	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
900240a9a23Smbalmer	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
901240a9a23Smbalmer	  *)    echo hppa-unknown-linux-gnu ;;
902240a9a23Smbalmer	esac
903240a9a23Smbalmer	exit ;;
904240a9a23Smbalmer    parisc64:Linux:*:* | hppa64:Linux:*:*)
905240a9a23Smbalmer	echo hppa64-unknown-linux-gnu
906240a9a23Smbalmer	exit ;;
907240a9a23Smbalmer    s390:Linux:*:* | s390x:Linux:*:*)
908240a9a23Smbalmer	echo ${UNAME_MACHINE}-ibm-linux
909240a9a23Smbalmer	exit ;;
910240a9a23Smbalmer    sh64*:Linux:*:*)
911240a9a23Smbalmer    	echo ${UNAME_MACHINE}-unknown-linux-gnu
912240a9a23Smbalmer	exit ;;
913240a9a23Smbalmer    sh*:Linux:*:*)
914240a9a23Smbalmer	echo ${UNAME_MACHINE}-unknown-linux-gnu
915240a9a23Smbalmer	exit ;;
916240a9a23Smbalmer    sparc:Linux:*:* | sparc64:Linux:*:*)
917240a9a23Smbalmer	echo ${UNAME_MACHINE}-unknown-linux-gnu
918240a9a23Smbalmer	exit ;;
919240a9a23Smbalmer    x86_64:Linux:*:*)
920240a9a23Smbalmer	echo x86_64-unknown-linux-gnu
921240a9a23Smbalmer	exit ;;
922240a9a23Smbalmer    i*86:Linux:*:*)
923240a9a23Smbalmer	# The BFD linker knows what the default object file format is, so
924240a9a23Smbalmer	# first see if it will tell us. cd to the root directory to prevent
925240a9a23Smbalmer	# problems with other programs or directories called `ld' in the path.
926240a9a23Smbalmer	# Set LC_ALL=C to ensure ld outputs messages in English.
927240a9a23Smbalmer	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
928240a9a23Smbalmer			 | sed -ne '/supported targets:/!d
929240a9a23Smbalmer				    s/[ 	][ 	]*/ /g
930240a9a23Smbalmer				    s/.*supported targets: *//
931240a9a23Smbalmer				    s/ .*//
932240a9a23Smbalmer				    p'`
933240a9a23Smbalmer        case "$ld_supported_targets" in
934240a9a23Smbalmer	  elf32-i386)
935240a9a23Smbalmer		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
936240a9a23Smbalmer		;;
937240a9a23Smbalmer	  a.out-i386-linux)
938240a9a23Smbalmer		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
939240a9a23Smbalmer		exit ;;
940240a9a23Smbalmer	  coff-i386)
941240a9a23Smbalmer		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
942240a9a23Smbalmer		exit ;;
943240a9a23Smbalmer	  "")
944240a9a23Smbalmer		# Either a pre-BFD a.out linker (linux-gnuoldld) or
945240a9a23Smbalmer		# one that does not give us useful --help.
946240a9a23Smbalmer		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
947240a9a23Smbalmer		exit ;;
948240a9a23Smbalmer	esac
949240a9a23Smbalmer	# Determine whether the default compiler is a.out or elf
950240a9a23Smbalmer	eval $set_cc_for_build
951240a9a23Smbalmer	sed 's/^	//' << EOF >$dummy.c
952240a9a23Smbalmer	#include <features.h>
953240a9a23Smbalmer	#ifdef __ELF__
954240a9a23Smbalmer	# ifdef __GLIBC__
955240a9a23Smbalmer	#  if __GLIBC__ >= 2
956240a9a23Smbalmer	LIBC=gnu
957240a9a23Smbalmer	#  else
958240a9a23Smbalmer	LIBC=gnulibc1
959240a9a23Smbalmer	#  endif
960240a9a23Smbalmer	# else
961240a9a23Smbalmer	LIBC=gnulibc1
962240a9a23Smbalmer	# endif
963240a9a23Smbalmer	#else
964240a9a23Smbalmer	#ifdef __INTEL_COMPILER
965240a9a23Smbalmer	LIBC=gnu
966240a9a23Smbalmer	#else
967240a9a23Smbalmer	LIBC=gnuaout
968240a9a23Smbalmer	#endif
969240a9a23Smbalmer	#endif
970240a9a23Smbalmer	#ifdef __dietlibc__
971240a9a23Smbalmer	LIBC=dietlibc
972240a9a23Smbalmer	#endif
973240a9a23SmbalmerEOF
974240a9a23Smbalmer	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
975240a9a23Smbalmer	test x"${LIBC}" != x && {
976240a9a23Smbalmer		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
977240a9a23Smbalmer		exit
978240a9a23Smbalmer	}
979240a9a23Smbalmer	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
980240a9a23Smbalmer	;;
981240a9a23Smbalmer    i*86:DYNIX/ptx:4*:*)
982240a9a23Smbalmer	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
983240a9a23Smbalmer	# earlier versions are messed up and put the nodename in both
984240a9a23Smbalmer	# sysname and nodename.
985240a9a23Smbalmer	echo i386-sequent-sysv4
986240a9a23Smbalmer	exit ;;
987240a9a23Smbalmer    i*86:UNIX_SV:4.2MP:2.*)
988240a9a23Smbalmer        # Unixware is an offshoot of SVR4, but it has its own version
989240a9a23Smbalmer        # number series starting with 2...
990240a9a23Smbalmer        # I am not positive that other SVR4 systems won't match this,
991240a9a23Smbalmer	# I just have to hope.  -- rms.
992240a9a23Smbalmer        # Use sysv4.2uw... so that sysv4* matches it.
993240a9a23Smbalmer	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
994240a9a23Smbalmer	exit ;;
995240a9a23Smbalmer    i*86:OS/2:*:*)
996240a9a23Smbalmer	# If we were able to find `uname', then EMX Unix compatibility
997240a9a23Smbalmer	# is probably installed.
998240a9a23Smbalmer	echo ${UNAME_MACHINE}-pc-os2-emx
999240a9a23Smbalmer	exit ;;
1000240a9a23Smbalmer    i*86:XTS-300:*:STOP)
1001240a9a23Smbalmer	echo ${UNAME_MACHINE}-unknown-stop
1002240a9a23Smbalmer	exit ;;
1003240a9a23Smbalmer    i*86:atheos:*:*)
1004240a9a23Smbalmer	echo ${UNAME_MACHINE}-unknown-atheos
1005240a9a23Smbalmer	exit ;;
1006240a9a23Smbalmer    i*86:syllable:*:*)
1007240a9a23Smbalmer	echo ${UNAME_MACHINE}-pc-syllable
1008240a9a23Smbalmer	exit ;;
1009240a9a23Smbalmer    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
1010240a9a23Smbalmer	echo i386-unknown-lynxos${UNAME_RELEASE}
1011240a9a23Smbalmer	exit ;;
1012240a9a23Smbalmer    i*86:*DOS:*:*)
1013240a9a23Smbalmer	echo ${UNAME_MACHINE}-pc-msdosdjgpp
1014240a9a23Smbalmer	exit ;;
1015240a9a23Smbalmer    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
1016240a9a23Smbalmer	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
1017240a9a23Smbalmer	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1018240a9a23Smbalmer		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
1019240a9a23Smbalmer	else
1020240a9a23Smbalmer		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
1021240a9a23Smbalmer	fi
1022240a9a23Smbalmer	exit ;;
1023240a9a23Smbalmer    i*86:*:5:[678]*)
1024240a9a23Smbalmer    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
1025240a9a23Smbalmer	case `/bin/uname -X | grep "^Machine"` in
1026240a9a23Smbalmer	    *486*)	     UNAME_MACHINE=i486 ;;
1027240a9a23Smbalmer	    *Pentium)	     UNAME_MACHINE=i586 ;;
1028240a9a23Smbalmer	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1029240a9a23Smbalmer	esac
1030240a9a23Smbalmer	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1031240a9a23Smbalmer	exit ;;
1032240a9a23Smbalmer    i*86:*:3.2:*)
1033240a9a23Smbalmer	if test -f /usr/options/cb.name; then
1034240a9a23Smbalmer		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1035240a9a23Smbalmer		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
1036240a9a23Smbalmer	elif /bin/uname -X 2>/dev/null >/dev/null ; then
1037240a9a23Smbalmer		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1038240a9a23Smbalmer		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1039240a9a23Smbalmer		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1040240a9a23Smbalmer			&& UNAME_MACHINE=i586
1041240a9a23Smbalmer		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1042240a9a23Smbalmer			&& UNAME_MACHINE=i686
1043240a9a23Smbalmer		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1044240a9a23Smbalmer			&& UNAME_MACHINE=i686
1045240a9a23Smbalmer		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
1046240a9a23Smbalmer	else
1047240a9a23Smbalmer		echo ${UNAME_MACHINE}-pc-sysv32
1048240a9a23Smbalmer	fi
1049240a9a23Smbalmer	exit ;;
1050240a9a23Smbalmer    pc:*:*:*)
1051240a9a23Smbalmer	# Left here for compatibility:
1052240a9a23Smbalmer        # uname -m prints for DJGPP always 'pc', but it prints nothing about
1053240a9a23Smbalmer        # the processor, so we play safe by assuming i386.
1054240a9a23Smbalmer	echo i386-pc-msdosdjgpp
1055240a9a23Smbalmer        exit ;;
1056240a9a23Smbalmer    Intel:Mach:3*:*)
1057240a9a23Smbalmer	echo i386-pc-mach3
1058240a9a23Smbalmer	exit ;;
1059240a9a23Smbalmer    paragon:*:*:*)
1060240a9a23Smbalmer	echo i860-intel-osf1
1061240a9a23Smbalmer	exit ;;
1062240a9a23Smbalmer    i860:*:4.*:*) # i860-SVR4
1063240a9a23Smbalmer	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1064240a9a23Smbalmer	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
1065240a9a23Smbalmer	else # Add other i860-SVR4 vendors below as they are discovered.
1066240a9a23Smbalmer	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
1067240a9a23Smbalmer	fi
1068240a9a23Smbalmer	exit ;;
1069240a9a23Smbalmer    mini*:CTIX:SYS*5:*)
1070240a9a23Smbalmer	# "miniframe"
1071240a9a23Smbalmer	echo m68010-convergent-sysv
1072240a9a23Smbalmer	exit ;;
1073240a9a23Smbalmer    mc68k:UNIX:SYSTEM5:3.51m)
1074240a9a23Smbalmer	echo m68k-convergent-sysv
1075240a9a23Smbalmer	exit ;;
1076240a9a23Smbalmer    M680?0:D-NIX:5.3:*)
1077240a9a23Smbalmer	echo m68k-diab-dnix
1078240a9a23Smbalmer	exit ;;
1079240a9a23Smbalmer    M68*:*:R3V[5678]*:*)
1080240a9a23Smbalmer	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1081240a9a23Smbalmer    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)
1082240a9a23Smbalmer	OS_REL=''
1083240a9a23Smbalmer	test -r /etc/.relid \
1084240a9a23Smbalmer	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1085240a9a23Smbalmer	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1086240a9a23Smbalmer	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1087240a9a23Smbalmer	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1088240a9a23Smbalmer	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1089240a9a23Smbalmer    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1090240a9a23Smbalmer        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1091240a9a23Smbalmer          && { echo i486-ncr-sysv4; exit; } ;;
1092240a9a23Smbalmer    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1093240a9a23Smbalmer	echo m68k-unknown-lynxos${UNAME_RELEASE}
1094240a9a23Smbalmer	exit ;;
1095240a9a23Smbalmer    mc68030:UNIX_System_V:4.*:*)
1096240a9a23Smbalmer	echo m68k-atari-sysv4
1097240a9a23Smbalmer	exit ;;
1098240a9a23Smbalmer    TSUNAMI:LynxOS:2.*:*)
1099240a9a23Smbalmer	echo sparc-unknown-lynxos${UNAME_RELEASE}
1100240a9a23Smbalmer	exit ;;
1101240a9a23Smbalmer    rs6000:LynxOS:2.*:*)
1102240a9a23Smbalmer	echo rs6000-unknown-lynxos${UNAME_RELEASE}
1103240a9a23Smbalmer	exit ;;
1104240a9a23Smbalmer    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
1105240a9a23Smbalmer	echo powerpc-unknown-lynxos${UNAME_RELEASE}
1106240a9a23Smbalmer	exit ;;
1107240a9a23Smbalmer    SM[BE]S:UNIX_SV:*:*)
1108240a9a23Smbalmer	echo mips-dde-sysv${UNAME_RELEASE}
1109240a9a23Smbalmer	exit ;;
1110240a9a23Smbalmer    RM*:ReliantUNIX-*:*:*)
1111240a9a23Smbalmer	echo mips-sni-sysv4
1112240a9a23Smbalmer	exit ;;
1113240a9a23Smbalmer    RM*:SINIX-*:*:*)
1114240a9a23Smbalmer	echo mips-sni-sysv4
1115240a9a23Smbalmer	exit ;;
1116240a9a23Smbalmer    *:SINIX-*:*:*)
1117240a9a23Smbalmer	if uname -p 2>/dev/null >/dev/null ; then
1118240a9a23Smbalmer		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1119240a9a23Smbalmer		echo ${UNAME_MACHINE}-sni-sysv4
1120240a9a23Smbalmer	else
1121240a9a23Smbalmer		echo ns32k-sni-sysv
1122240a9a23Smbalmer	fi
1123240a9a23Smbalmer	exit ;;
1124240a9a23Smbalmer    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1125240a9a23Smbalmer                      # says <Richard.M.Bartel@ccMail.Census.GOV>
1126240a9a23Smbalmer        echo i586-unisys-sysv4
1127240a9a23Smbalmer        exit ;;
1128240a9a23Smbalmer    *:UNIX_System_V:4*:FTX*)
1129240a9a23Smbalmer	# From Gerald Hewes <hewes@openmarket.com>.
1130240a9a23Smbalmer	# How about differentiating between stratus architectures? -djm
1131240a9a23Smbalmer	echo hppa1.1-stratus-sysv4
1132240a9a23Smbalmer	exit ;;
1133240a9a23Smbalmer    *:*:*:FTX*)
1134240a9a23Smbalmer	# From seanf@swdc.stratus.com.
1135240a9a23Smbalmer	echo i860-stratus-sysv4
1136240a9a23Smbalmer	exit ;;
1137240a9a23Smbalmer    i*86:VOS:*:*)
1138240a9a23Smbalmer	# From Paul.Green@stratus.com.
1139240a9a23Smbalmer	echo ${UNAME_MACHINE}-stratus-vos
1140240a9a23Smbalmer	exit ;;
1141240a9a23Smbalmer    *:VOS:*:*)
1142240a9a23Smbalmer	# From Paul.Green@stratus.com.
1143240a9a23Smbalmer	echo hppa1.1-stratus-vos
1144240a9a23Smbalmer	exit ;;
1145240a9a23Smbalmer    mc68*:A/UX:*:*)
1146240a9a23Smbalmer	echo m68k-apple-aux${UNAME_RELEASE}
1147240a9a23Smbalmer	exit ;;
1148240a9a23Smbalmer    news*:NEWS-OS:6*:*)
1149240a9a23Smbalmer	echo mips-sony-newsos6
1150240a9a23Smbalmer	exit ;;
1151240a9a23Smbalmer    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1152240a9a23Smbalmer	if [ -d /usr/nec ]; then
1153240a9a23Smbalmer	        echo mips-nec-sysv${UNAME_RELEASE}
1154240a9a23Smbalmer	else
1155240a9a23Smbalmer	        echo mips-unknown-sysv${UNAME_RELEASE}
1156240a9a23Smbalmer	fi
1157240a9a23Smbalmer        exit ;;
1158240a9a23Smbalmer    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1159240a9a23Smbalmer	echo powerpc-be-beos
1160240a9a23Smbalmer	exit ;;
1161240a9a23Smbalmer    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1162240a9a23Smbalmer	echo powerpc-apple-beos
1163240a9a23Smbalmer	exit ;;
1164240a9a23Smbalmer    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1165240a9a23Smbalmer	echo i586-pc-beos
1166240a9a23Smbalmer	exit ;;
1167240a9a23Smbalmer    SX-4:SUPER-UX:*:*)
1168240a9a23Smbalmer	echo sx4-nec-superux${UNAME_RELEASE}
1169240a9a23Smbalmer	exit ;;
1170240a9a23Smbalmer    SX-5:SUPER-UX:*:*)
1171240a9a23Smbalmer	echo sx5-nec-superux${UNAME_RELEASE}
1172240a9a23Smbalmer	exit ;;
1173240a9a23Smbalmer    SX-6:SUPER-UX:*:*)
1174240a9a23Smbalmer	echo sx6-nec-superux${UNAME_RELEASE}
1175240a9a23Smbalmer	exit ;;
1176240a9a23Smbalmer    Power*:Rhapsody:*:*)
1177240a9a23Smbalmer	echo powerpc-apple-rhapsody${UNAME_RELEASE}
1178240a9a23Smbalmer	exit ;;
1179240a9a23Smbalmer    *:Rhapsody:*:*)
1180240a9a23Smbalmer	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
1181240a9a23Smbalmer	exit ;;
1182240a9a23Smbalmer    *:Darwin:*:*)
1183240a9a23Smbalmer	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1184240a9a23Smbalmer	case $UNAME_PROCESSOR in
1185240a9a23Smbalmer	    *86) UNAME_PROCESSOR=i686 ;;
1186240a9a23Smbalmer	    unknown) UNAME_PROCESSOR=powerpc ;;
1187240a9a23Smbalmer	esac
1188240a9a23Smbalmer	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
1189240a9a23Smbalmer	exit ;;
1190240a9a23Smbalmer    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1191240a9a23Smbalmer	UNAME_PROCESSOR=`uname -p`
1192240a9a23Smbalmer	if test "$UNAME_PROCESSOR" = "x86"; then
1193240a9a23Smbalmer		UNAME_PROCESSOR=i386
1194240a9a23Smbalmer		UNAME_MACHINE=pc
1195240a9a23Smbalmer	fi
1196240a9a23Smbalmer	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
1197240a9a23Smbalmer	exit ;;
1198240a9a23Smbalmer    *:QNX:*:4*)
1199240a9a23Smbalmer	echo i386-pc-qnx
1200240a9a23Smbalmer	exit ;;
1201240a9a23Smbalmer    NSE-?:NONSTOP_KERNEL:*:*)
1202240a9a23Smbalmer	echo nse-tandem-nsk${UNAME_RELEASE}
1203240a9a23Smbalmer	exit ;;
1204240a9a23Smbalmer    NSR-?:NONSTOP_KERNEL:*:*)
1205240a9a23Smbalmer	echo nsr-tandem-nsk${UNAME_RELEASE}
1206240a9a23Smbalmer	exit ;;
1207240a9a23Smbalmer    *:NonStop-UX:*:*)
1208240a9a23Smbalmer	echo mips-compaq-nonstopux
1209240a9a23Smbalmer	exit ;;
1210240a9a23Smbalmer    BS2000:POSIX*:*:*)
1211240a9a23Smbalmer	echo bs2000-siemens-sysv
1212240a9a23Smbalmer	exit ;;
1213240a9a23Smbalmer    DS/*:UNIX_System_V:*:*)
1214240a9a23Smbalmer	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
1215240a9a23Smbalmer	exit ;;
1216240a9a23Smbalmer    *:Plan9:*:*)
1217240a9a23Smbalmer	# "uname -m" is not consistent, so use $cputype instead. 386
1218240a9a23Smbalmer	# is converted to i386 for consistency with other x86
1219240a9a23Smbalmer	# operating systems.
1220240a9a23Smbalmer	if test "$cputype" = "386"; then
1221240a9a23Smbalmer	    UNAME_MACHINE=i386
1222240a9a23Smbalmer	else
1223240a9a23Smbalmer	    UNAME_MACHINE="$cputype"
1224240a9a23Smbalmer	fi
1225240a9a23Smbalmer	echo ${UNAME_MACHINE}-unknown-plan9
1226240a9a23Smbalmer	exit ;;
1227240a9a23Smbalmer    *:TOPS-10:*:*)
1228240a9a23Smbalmer	echo pdp10-unknown-tops10
1229240a9a23Smbalmer	exit ;;
1230240a9a23Smbalmer    *:TENEX:*:*)
1231240a9a23Smbalmer	echo pdp10-unknown-tenex
1232240a9a23Smbalmer	exit ;;
1233240a9a23Smbalmer    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1234240a9a23Smbalmer	echo pdp10-dec-tops20
1235240a9a23Smbalmer	exit ;;
1236240a9a23Smbalmer    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1237240a9a23Smbalmer	echo pdp10-xkl-tops20
1238240a9a23Smbalmer	exit ;;
1239240a9a23Smbalmer    *:TOPS-20:*:*)
1240240a9a23Smbalmer	echo pdp10-unknown-tops20
1241240a9a23Smbalmer	exit ;;
1242240a9a23Smbalmer    *:ITS:*:*)
1243240a9a23Smbalmer	echo pdp10-unknown-its
1244240a9a23Smbalmer	exit ;;
1245240a9a23Smbalmer    SEI:*:*:SEIUX)
1246240a9a23Smbalmer        echo mips-sei-seiux${UNAME_RELEASE}
1247240a9a23Smbalmer	exit ;;
1248240a9a23Smbalmer    *:DragonFly:*:*)
1249240a9a23Smbalmer	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
1250240a9a23Smbalmer	exit ;;
1251240a9a23Smbalmer    *:*VMS:*:*)
1252240a9a23Smbalmer    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1253240a9a23Smbalmer	case "${UNAME_MACHINE}" in
1254240a9a23Smbalmer	    A*) echo alpha-dec-vms ; exit ;;
1255240a9a23Smbalmer	    I*) echo ia64-dec-vms ; exit ;;
1256240a9a23Smbalmer	    V*) echo vax-dec-vms ; exit ;;
1257240a9a23Smbalmer	esac ;;
1258240a9a23Smbalmer    *:XENIX:*:SysV)
1259240a9a23Smbalmer	echo i386-pc-xenix
1260240a9a23Smbalmer	exit ;;
1261240a9a23Smbalmer    i*86:skyos:*:*)
1262240a9a23Smbalmer	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
1263240a9a23Smbalmer	exit ;;
1264240a9a23Smbalmeresac
1265240a9a23Smbalmer
1266240a9a23Smbalmer#echo '(No uname command or uname output not recognized.)' 1>&2
1267240a9a23Smbalmer#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
1268240a9a23Smbalmer
1269240a9a23Smbalmereval $set_cc_for_build
1270240a9a23Smbalmercat >$dummy.c <<EOF
1271240a9a23Smbalmer#ifdef _SEQUENT_
1272240a9a23Smbalmer# include <sys/types.h>
1273240a9a23Smbalmer# include <sys/utsname.h>
1274240a9a23Smbalmer#endif
1275240a9a23Smbalmermain ()
1276240a9a23Smbalmer{
1277240a9a23Smbalmer#if defined (sony)
1278240a9a23Smbalmer#if defined (MIPSEB)
1279240a9a23Smbalmer  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1280240a9a23Smbalmer     I don't know....  */
1281240a9a23Smbalmer  printf ("mips-sony-bsd\n"); exit (0);
1282240a9a23Smbalmer#else
1283240a9a23Smbalmer#include <sys/param.h>
1284240a9a23Smbalmer  printf ("m68k-sony-newsos%s\n",
1285240a9a23Smbalmer#ifdef NEWSOS4
1286240a9a23Smbalmer          "4"
1287240a9a23Smbalmer#else
1288240a9a23Smbalmer	  ""
1289240a9a23Smbalmer#endif
1290240a9a23Smbalmer         ); exit (0);
1291240a9a23Smbalmer#endif
1292240a9a23Smbalmer#endif
1293240a9a23Smbalmer
1294240a9a23Smbalmer#if defined (__arm) && defined (__acorn) && defined (__unix)
1295240a9a23Smbalmer  printf ("arm-acorn-riscix\n"); exit (0);
1296240a9a23Smbalmer#endif
1297240a9a23Smbalmer
1298240a9a23Smbalmer#if defined (hp300) && !defined (hpux)
1299240a9a23Smbalmer  printf ("m68k-hp-bsd\n"); exit (0);
1300240a9a23Smbalmer#endif
1301240a9a23Smbalmer
1302240a9a23Smbalmer#if defined (NeXT)
1303240a9a23Smbalmer#if !defined (__ARCHITECTURE__)
1304240a9a23Smbalmer#define __ARCHITECTURE__ "m68k"
1305240a9a23Smbalmer#endif
1306240a9a23Smbalmer  int version;
1307240a9a23Smbalmer  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1308240a9a23Smbalmer  if (version < 4)
1309240a9a23Smbalmer    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1310240a9a23Smbalmer  else
1311240a9a23Smbalmer    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1312240a9a23Smbalmer  exit (0);
1313240a9a23Smbalmer#endif
1314240a9a23Smbalmer
1315240a9a23Smbalmer#if defined (MULTIMAX) || defined (n16)
1316240a9a23Smbalmer#if defined (UMAXV)
1317240a9a23Smbalmer  printf ("ns32k-encore-sysv\n"); exit (0);
1318240a9a23Smbalmer#else
1319240a9a23Smbalmer#if defined (CMU)
1320240a9a23Smbalmer  printf ("ns32k-encore-mach\n"); exit (0);
1321240a9a23Smbalmer#else
1322240a9a23Smbalmer  printf ("ns32k-encore-bsd\n"); exit (0);
1323240a9a23Smbalmer#endif
1324240a9a23Smbalmer#endif
1325240a9a23Smbalmer#endif
1326240a9a23Smbalmer
1327240a9a23Smbalmer#if defined (__386BSD__)
1328240a9a23Smbalmer  printf ("i386-pc-bsd\n"); exit (0);
1329240a9a23Smbalmer#endif
1330240a9a23Smbalmer
1331240a9a23Smbalmer#if defined (sequent)
1332240a9a23Smbalmer#if defined (i386)
1333240a9a23Smbalmer  printf ("i386-sequent-dynix\n"); exit (0);
1334240a9a23Smbalmer#endif
1335240a9a23Smbalmer#if defined (ns32000)
1336240a9a23Smbalmer  printf ("ns32k-sequent-dynix\n"); exit (0);
1337240a9a23Smbalmer#endif
1338240a9a23Smbalmer#endif
1339240a9a23Smbalmer
1340240a9a23Smbalmer#if defined (_SEQUENT_)
1341240a9a23Smbalmer    struct utsname un;
1342240a9a23Smbalmer
1343240a9a23Smbalmer    uname(&un);
1344240a9a23Smbalmer
1345240a9a23Smbalmer    if (strncmp(un.version, "V2", 2) == 0) {
1346240a9a23Smbalmer	printf ("i386-sequent-ptx2\n"); exit (0);
1347240a9a23Smbalmer    }
1348240a9a23Smbalmer    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1349240a9a23Smbalmer	printf ("i386-sequent-ptx1\n"); exit (0);
1350240a9a23Smbalmer    }
1351240a9a23Smbalmer    printf ("i386-sequent-ptx\n"); exit (0);
1352240a9a23Smbalmer
1353240a9a23Smbalmer#endif
1354240a9a23Smbalmer
1355240a9a23Smbalmer#if defined (vax)
1356240a9a23Smbalmer# if !defined (ultrix)
1357240a9a23Smbalmer#  include <sys/param.h>
1358240a9a23Smbalmer#  if defined (BSD)
1359240a9a23Smbalmer#   if BSD == 43
1360240a9a23Smbalmer      printf ("vax-dec-bsd4.3\n"); exit (0);
1361240a9a23Smbalmer#   else
1362240a9a23Smbalmer#    if BSD == 199006
1363240a9a23Smbalmer      printf ("vax-dec-bsd4.3reno\n"); exit (0);
1364240a9a23Smbalmer#    else
1365240a9a23Smbalmer      printf ("vax-dec-bsd\n"); exit (0);
1366240a9a23Smbalmer#    endif
1367240a9a23Smbalmer#   endif
1368240a9a23Smbalmer#  else
1369240a9a23Smbalmer    printf ("vax-dec-bsd\n"); exit (0);
1370240a9a23Smbalmer#  endif
1371240a9a23Smbalmer# else
1372240a9a23Smbalmer    printf ("vax-dec-ultrix\n"); exit (0);
1373240a9a23Smbalmer# endif
1374240a9a23Smbalmer#endif
1375240a9a23Smbalmer
1376240a9a23Smbalmer#if defined (alliant) && defined (i860)
1377240a9a23Smbalmer  printf ("i860-alliant-bsd\n"); exit (0);
1378240a9a23Smbalmer#endif
1379240a9a23Smbalmer
1380240a9a23Smbalmer  exit (1);
1381240a9a23Smbalmer}
1382240a9a23SmbalmerEOF
1383240a9a23Smbalmer
1384240a9a23Smbalmer$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
1385240a9a23Smbalmer	{ echo "$SYSTEM_NAME"; exit; }
1386240a9a23Smbalmer
1387240a9a23Smbalmer# Apollos put the system type in the environment.
1388240a9a23Smbalmer
1389240a9a23Smbalmertest -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
1390240a9a23Smbalmer
1391240a9a23Smbalmer# Convex versions that predate uname can use getsysinfo(1)
1392240a9a23Smbalmer
1393240a9a23Smbalmerif [ -x /usr/convex/getsysinfo ]
1394240a9a23Smbalmerthen
1395240a9a23Smbalmer    case `getsysinfo -f cpu_type` in
1396240a9a23Smbalmer    c1*)
1397240a9a23Smbalmer	echo c1-convex-bsd
1398240a9a23Smbalmer	exit ;;
1399240a9a23Smbalmer    c2*)
1400240a9a23Smbalmer	if getsysinfo -f scalar_acc
1401240a9a23Smbalmer	then echo c32-convex-bsd
1402240a9a23Smbalmer	else echo c2-convex-bsd
1403240a9a23Smbalmer	fi
1404240a9a23Smbalmer	exit ;;
1405240a9a23Smbalmer    c34*)
1406240a9a23Smbalmer	echo c34-convex-bsd
1407240a9a23Smbalmer	exit ;;
1408240a9a23Smbalmer    c38*)
1409240a9a23Smbalmer	echo c38-convex-bsd
1410240a9a23Smbalmer	exit ;;
1411240a9a23Smbalmer    c4*)
1412240a9a23Smbalmer	echo c4-convex-bsd
1413240a9a23Smbalmer	exit ;;
1414240a9a23Smbalmer    esac
1415240a9a23Smbalmerfi
1416240a9a23Smbalmer
1417240a9a23Smbalmercat >&2 <<EOF
1418240a9a23Smbalmer$0: unable to guess system type
1419240a9a23Smbalmer
1420240a9a23SmbalmerThis script, last modified $timestamp, has failed to recognize
1421240a9a23Smbalmerthe operating system you are using. It is advised that you
1422240a9a23Smbalmerdownload the most up to date version of the config scripts from
1423240a9a23Smbalmer
1424240a9a23Smbalmer  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
1425240a9a23Smbalmerand
1426240a9a23Smbalmer  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
1427240a9a23Smbalmer
1428240a9a23SmbalmerIf the version you run ($0) is already up to date, please
1429240a9a23Smbalmersend the following data and any information you think might be
1430240a9a23Smbalmerpertinent to <config-patches@gnu.org> in order to provide the needed
1431240a9a23Smbalmerinformation to handle your system.
1432240a9a23Smbalmer
1433240a9a23Smbalmerconfig.guess timestamp = $timestamp
1434240a9a23Smbalmer
1435240a9a23Smbalmeruname -m = `(uname -m) 2>/dev/null || echo unknown`
1436240a9a23Smbalmeruname -r = `(uname -r) 2>/dev/null || echo unknown`
1437240a9a23Smbalmeruname -s = `(uname -s) 2>/dev/null || echo unknown`
1438240a9a23Smbalmeruname -v = `(uname -v) 2>/dev/null || echo unknown`
1439240a9a23Smbalmer
1440240a9a23Smbalmer/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1441240a9a23Smbalmer/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1442240a9a23Smbalmer
1443240a9a23Smbalmerhostinfo               = `(hostinfo) 2>/dev/null`
1444240a9a23Smbalmer/bin/universe          = `(/bin/universe) 2>/dev/null`
1445240a9a23Smbalmer/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1446240a9a23Smbalmer/bin/arch              = `(/bin/arch) 2>/dev/null`
1447240a9a23Smbalmer/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1448240a9a23Smbalmer/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1449240a9a23Smbalmer
1450240a9a23SmbalmerUNAME_MACHINE = ${UNAME_MACHINE}
1451240a9a23SmbalmerUNAME_RELEASE = ${UNAME_RELEASE}
1452240a9a23SmbalmerUNAME_SYSTEM  = ${UNAME_SYSTEM}
1453240a9a23SmbalmerUNAME_VERSION = ${UNAME_VERSION}
1454240a9a23SmbalmerEOF
1455240a9a23Smbalmer
1456240a9a23Smbalmerexit 1
1457240a9a23Smbalmer
1458240a9a23Smbalmer# Local variables:
1459240a9a23Smbalmer# eval: (add-hook 'write-file-hooks 'time-stamp)
1460240a9a23Smbalmer# time-stamp-start: "timestamp='"
1461240a9a23Smbalmer# time-stamp-format: "%:y-%02m-%02d"
1462240a9a23Smbalmer# time-stamp-end: "'"
1463240a9a23Smbalmer# End:
1464