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