config.guess revision 7ce7e03c
1f7ec340bSmacallan#! /bin/sh
2f7ec340bSmacallan# Attempt to guess a canonical system name.
3f7ec340bSmacallan#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
47ce7e03cSmrg#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
57ce7e03cSmrg#   Free Software Foundation, Inc.
6f7ec340bSmacallan
77ce7e03cSmrgtimestamp='2008-01-23'
8f7ec340bSmacallan
9f7ec340bSmacallan# This file is free software; you can redistribute it and/or modify it
10f7ec340bSmacallan# under the terms of the GNU General Public License as published by
11f7ec340bSmacallan# the Free Software Foundation; either version 2 of the License, or
12f7ec340bSmacallan# (at your option) any later version.
13f7ec340bSmacallan#
14f7ec340bSmacallan# This program is distributed in the hope that it will be useful, but
15f7ec340bSmacallan# WITHOUT ANY WARRANTY; without even the implied warranty of
16f7ec340bSmacallan# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17f7ec340bSmacallan# General Public License for more details.
18f7ec340bSmacallan#
19f7ec340bSmacallan# You should have received a copy of the GNU General Public License
20f7ec340bSmacallan# along with this program; if not, write to the Free Software
217ce7e03cSmrg# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
227ce7e03cSmrg# 02110-1301, USA.
23f7ec340bSmacallan#
24f7ec340bSmacallan# As a special exception to the GNU General Public License, if you
25f7ec340bSmacallan# distribute this file as part of a program that contains a
26f7ec340bSmacallan# configuration script generated by Autoconf, you may include it under
27f7ec340bSmacallan# the same distribution terms that you use for the rest of that program.
28f7ec340bSmacallan
297ce7e03cSmrg
30f7ec340bSmacallan# Originally written by Per Bothner <per@bothner.com>.
31f7ec340bSmacallan# Please send patches to <config-patches@gnu.org>.  Submit a context
32f7ec340bSmacallan# diff and a properly formatted ChangeLog entry.
33f7ec340bSmacallan#
34f7ec340bSmacallan# This script attempts to guess a canonical system name similar to
35f7ec340bSmacallan# config.sub.  If it succeeds, it prints the system name on stdout, and
36f7ec340bSmacallan# exits with 0.  Otherwise, it exits with 1.
37f7ec340bSmacallan#
38f7ec340bSmacallan# The plan is that this can be called by configure scripts if you
39f7ec340bSmacallan# don't specify an explicit build system type.
40f7ec340bSmacallan
41f7ec340bSmacallanme=`echo "$0" | sed -e 's,.*/,,'`
42f7ec340bSmacallan
43f7ec340bSmacallanusage="\
44f7ec340bSmacallanUsage: $0 [OPTION]
45f7ec340bSmacallan
46f7ec340bSmacallanOutput the configuration name of the system \`$me' is run on.
47f7ec340bSmacallan
48f7ec340bSmacallanOperation modes:
49f7ec340bSmacallan  -h, --help         print this help, then exit
50f7ec340bSmacallan  -t, --time-stamp   print date of last modification, then exit
51f7ec340bSmacallan  -v, --version      print version number, then exit
52f7ec340bSmacallan
53f7ec340bSmacallanReport bugs and patches to <config-patches@gnu.org>."
54f7ec340bSmacallan
55f7ec340bSmacallanversion="\
56f7ec340bSmacallanGNU config.guess ($timestamp)
57f7ec340bSmacallan
58f7ec340bSmacallanOriginally written by Per Bothner.
597ce7e03cSmrgCopyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
607ce7e03cSmrg2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
61f7ec340bSmacallan
62f7ec340bSmacallanThis is free software; see the source for copying conditions.  There is NO
63f7ec340bSmacallanwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
64f7ec340bSmacallan
65f7ec340bSmacallanhelp="
66f7ec340bSmacallanTry \`$me --help' for more information."
67f7ec340bSmacallan
68f7ec340bSmacallan# Parse command line
69f7ec340bSmacallanwhile test $# -gt 0 ; do
70f7ec340bSmacallan  case $1 in
71f7ec340bSmacallan    --time-stamp | --time* | -t )
727ce7e03cSmrg       echo "$timestamp" ; exit ;;
73f7ec340bSmacallan    --version | -v )
747ce7e03cSmrg       echo "$version" ; exit ;;
75f7ec340bSmacallan    --help | --h* | -h )
767ce7e03cSmrg       echo "$usage"; exit ;;
77f7ec340bSmacallan    -- )     # Stop option processing
78f7ec340bSmacallan       shift; break ;;
79f7ec340bSmacallan    - )	# Use stdin as input.
80f7ec340bSmacallan       break ;;
81f7ec340bSmacallan    -* )
82f7ec340bSmacallan       echo "$me: invalid option $1$help" >&2
83f7ec340bSmacallan       exit 1 ;;
84f7ec340bSmacallan    * )
85f7ec340bSmacallan       break ;;
86f7ec340bSmacallan  esac
87f7ec340bSmacallandone
88f7ec340bSmacallan
89f7ec340bSmacallanif test $# != 0; then
90f7ec340bSmacallan  echo "$me: too many arguments$help" >&2
91f7ec340bSmacallan  exit 1
92f7ec340bSmacallanfi
93f7ec340bSmacallan
94f7ec340bSmacallantrap 'exit 1' 1 2 15
95f7ec340bSmacallan
96f7ec340bSmacallan# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
97f7ec340bSmacallan# compiler to aid in system detection is discouraged as it requires
98f7ec340bSmacallan# temporary files to be created and, as you can see below, it is a
99f7ec340bSmacallan# headache to deal with in a portable fashion.
100f7ec340bSmacallan
101f7ec340bSmacallan# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
102f7ec340bSmacallan# use `HOST_CC' if defined, but it is deprecated.
103f7ec340bSmacallan
104f7ec340bSmacallan# Portable tmp directory creation inspired by the Autoconf team.
105f7ec340bSmacallan
106f7ec340bSmacallanset_cc_for_build='
107f7ec340bSmacallantrap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
108f7ec340bSmacallantrap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
109f7ec340bSmacallan: ${TMPDIR=/tmp} ;
1107ce7e03cSmrg { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
111f7ec340bSmacallan { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
112f7ec340bSmacallan { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
113f7ec340bSmacallan { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
114f7ec340bSmacallandummy=$tmp/dummy ;
115f7ec340bSmacallantmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
116f7ec340bSmacallancase $CC_FOR_BUILD,$HOST_CC,$CC in
117f7ec340bSmacallan ,,)    echo "int x;" > $dummy.c ;
118f7ec340bSmacallan	for c in cc gcc c89 c99 ; do
119f7ec340bSmacallan	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
120f7ec340bSmacallan	     CC_FOR_BUILD="$c"; break ;
121f7ec340bSmacallan	  fi ;
122f7ec340bSmacallan	done ;
123f7ec340bSmacallan	if test x"$CC_FOR_BUILD" = x ; then
124f7ec340bSmacallan	  CC_FOR_BUILD=no_compiler_found ;
125f7ec340bSmacallan	fi
126f7ec340bSmacallan	;;
127f7ec340bSmacallan ,,*)   CC_FOR_BUILD=$CC ;;
128f7ec340bSmacallan ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
1297ce7e03cSmrgesac ; set_cc_for_build= ;'
130f7ec340bSmacallan
131f7ec340bSmacallan# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
132f7ec340bSmacallan# (ghazi@noc.rutgers.edu 1994-08-24)
133f7ec340bSmacallanif (test -f /.attbin/uname) >/dev/null 2>&1 ; then
134f7ec340bSmacallan	PATH=$PATH:/.attbin ; export PATH
135f7ec340bSmacallanfi
136f7ec340bSmacallan
137f7ec340bSmacallanUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
138f7ec340bSmacallanUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
139f7ec340bSmacallanUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
140f7ec340bSmacallanUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
141f7ec340bSmacallan
142f7ec340bSmacallan# Note: order is significant - the case branches are not exclusive.
143f7ec340bSmacallan
144f7ec340bSmacallancase "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
145f7ec340bSmacallan    *:NetBSD:*:*)
146f7ec340bSmacallan	# NetBSD (nbsd) targets should (where applicable) match one or
147f7ec340bSmacallan	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
148f7ec340bSmacallan	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
149f7ec340bSmacallan	# switched to ELF, *-*-netbsd* would select the old
150f7ec340bSmacallan	# object file format.  This provides both forward
151f7ec340bSmacallan	# compatibility and a consistent mechanism for selecting the
152f7ec340bSmacallan	# object file format.
153f7ec340bSmacallan	#
154f7ec340bSmacallan	# Note: NetBSD doesn't particularly care about the vendor
155f7ec340bSmacallan	# portion of the name.  We always set it to "unknown".
156f7ec340bSmacallan	sysctl="sysctl -n hw.machine_arch"
157f7ec340bSmacallan	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
158f7ec340bSmacallan	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
159f7ec340bSmacallan	case "${UNAME_MACHINE_ARCH}" in
160f7ec340bSmacallan	    armeb) machine=armeb-unknown ;;
161f7ec340bSmacallan	    arm*) machine=arm-unknown ;;
162f7ec340bSmacallan	    sh3el) machine=shl-unknown ;;
163f7ec340bSmacallan	    sh3eb) machine=sh-unknown ;;
1647ce7e03cSmrg	    sh5el) machine=sh5le-unknown ;;
165f7ec340bSmacallan	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
166f7ec340bSmacallan	esac
167f7ec340bSmacallan	# The Operating System including object format, if it has switched
168f7ec340bSmacallan	# to ELF recently, or will in the future.
169f7ec340bSmacallan	case "${UNAME_MACHINE_ARCH}" in
170f7ec340bSmacallan	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
171f7ec340bSmacallan		eval $set_cc_for_build
172f7ec340bSmacallan		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
173f7ec340bSmacallan			| grep __ELF__ >/dev/null
174f7ec340bSmacallan		then
175f7ec340bSmacallan		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
176f7ec340bSmacallan		    # Return netbsd for either.  FIX?
177f7ec340bSmacallan		    os=netbsd
178f7ec340bSmacallan		else
179f7ec340bSmacallan		    os=netbsdelf
180f7ec340bSmacallan		fi
181f7ec340bSmacallan		;;
182f7ec340bSmacallan	    *)
183f7ec340bSmacallan	        os=netbsd
184f7ec340bSmacallan		;;
185f7ec340bSmacallan	esac
186f7ec340bSmacallan	# The OS release
187f7ec340bSmacallan	# Debian GNU/NetBSD machines have a different userland, and
188f7ec340bSmacallan	# thus, need a distinct triplet. However, they do not need
189f7ec340bSmacallan	# kernel version information, so it can be replaced with a
190f7ec340bSmacallan	# suitable tag, in the style of linux-gnu.
191f7ec340bSmacallan	case "${UNAME_VERSION}" in
192f7ec340bSmacallan	    Debian*)
193f7ec340bSmacallan		release='-gnu'
194f7ec340bSmacallan		;;
195f7ec340bSmacallan	    *)
196f7ec340bSmacallan		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
197f7ec340bSmacallan		;;
198f7ec340bSmacallan	esac
199f7ec340bSmacallan	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
200f7ec340bSmacallan	# contains redundant information, the shorter form:
201f7ec340bSmacallan	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
202f7ec340bSmacallan	echo "${machine}-${os}${release}"
2037ce7e03cSmrg	exit ;;
204f7ec340bSmacallan    *:OpenBSD:*:*)
2057ce7e03cSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
2067ce7e03cSmrg	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
2077ce7e03cSmrg	exit ;;
2087ce7e03cSmrg    *:ekkoBSD:*:*)
2097ce7e03cSmrg	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
2107ce7e03cSmrg	exit ;;
2117ce7e03cSmrg    *:SolidBSD:*:*)
2127ce7e03cSmrg	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
2137ce7e03cSmrg	exit ;;
2147ce7e03cSmrg    macppc:MirBSD:*:*)
2157ce7e03cSmrg	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
2167ce7e03cSmrg	exit ;;
2177ce7e03cSmrg    *:MirBSD:*:*)
2187ce7e03cSmrg	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
2197ce7e03cSmrg	exit ;;
220f7ec340bSmacallan    alpha:OSF1:*:*)
2217ce7e03cSmrg	case $UNAME_RELEASE in
2227ce7e03cSmrg	*4.0)
223f7ec340bSmacallan		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
2247ce7e03cSmrg		;;
2257ce7e03cSmrg	*5.*)
2267ce7e03cSmrg	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
2277ce7e03cSmrg		;;
2287ce7e03cSmrg	esac
229f7ec340bSmacallan	# According to Compaq, /usr/sbin/psrinfo has been available on
230f7ec340bSmacallan	# OSF/1 and Tru64 systems produced since 1995.  I hope that
231f7ec340bSmacallan	# covers most systems running today.  This code pipes the CPU
232f7ec340bSmacallan	# types through head -n 1, so we only detect the type of CPU 0.
233f7ec340bSmacallan	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
234f7ec340bSmacallan	case "$ALPHA_CPU_TYPE" in
235f7ec340bSmacallan	    "EV4 (21064)")
236f7ec340bSmacallan		UNAME_MACHINE="alpha" ;;
237f7ec340bSmacallan	    "EV4.5 (21064)")
238f7ec340bSmacallan		UNAME_MACHINE="alpha" ;;
239f7ec340bSmacallan	    "LCA4 (21066/21068)")
240f7ec340bSmacallan		UNAME_MACHINE="alpha" ;;
241f7ec340bSmacallan	    "EV5 (21164)")
242f7ec340bSmacallan		UNAME_MACHINE="alphaev5" ;;
243f7ec340bSmacallan	    "EV5.6 (21164A)")
244f7ec340bSmacallan		UNAME_MACHINE="alphaev56" ;;
245f7ec340bSmacallan	    "EV5.6 (21164PC)")
246f7ec340bSmacallan		UNAME_MACHINE="alphapca56" ;;
247f7ec340bSmacallan	    "EV5.7 (21164PC)")
248f7ec340bSmacallan		UNAME_MACHINE="alphapca57" ;;
249f7ec340bSmacallan	    "EV6 (21264)")
250f7ec340bSmacallan		UNAME_MACHINE="alphaev6" ;;
251f7ec340bSmacallan	    "EV6.7 (21264A)")
252f7ec340bSmacallan		UNAME_MACHINE="alphaev67" ;;
253f7ec340bSmacallan	    "EV6.8CB (21264C)")
254f7ec340bSmacallan		UNAME_MACHINE="alphaev68" ;;
255f7ec340bSmacallan	    "EV6.8AL (21264B)")
256f7ec340bSmacallan		UNAME_MACHINE="alphaev68" ;;
257f7ec340bSmacallan	    "EV6.8CX (21264D)")
258f7ec340bSmacallan		UNAME_MACHINE="alphaev68" ;;
259f7ec340bSmacallan	    "EV6.9A (21264/EV69A)")
260f7ec340bSmacallan		UNAME_MACHINE="alphaev69" ;;
261f7ec340bSmacallan	    "EV7 (21364)")
262f7ec340bSmacallan		UNAME_MACHINE="alphaev7" ;;
263f7ec340bSmacallan	    "EV7.9 (21364A)")
264f7ec340bSmacallan		UNAME_MACHINE="alphaev79" ;;
265f7ec340bSmacallan	esac
2667ce7e03cSmrg	# A Pn.n version is a patched version.
267f7ec340bSmacallan	# A Vn.n version is a released version.
268f7ec340bSmacallan	# A Tn.n version is a released field test version.
269f7ec340bSmacallan	# A Xn.n version is an unreleased experimental baselevel.
270f7ec340bSmacallan	# 1.2 uses "1.2" for uname -r.
2717ce7e03cSmrg	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
2727ce7e03cSmrg	exit ;;
273f7ec340bSmacallan    Alpha\ *:Windows_NT*:*)
274f7ec340bSmacallan	# How do we know it's Interix rather than the generic POSIX subsystem?
275f7ec340bSmacallan	# Should we change UNAME_MACHINE based on the output of uname instead
276f7ec340bSmacallan	# of the specific Alpha model?
277f7ec340bSmacallan	echo alpha-pc-interix
2787ce7e03cSmrg	exit ;;
279f7ec340bSmacallan    21064:Windows_NT:50:3)
280f7ec340bSmacallan	echo alpha-dec-winnt3.5
2817ce7e03cSmrg	exit ;;
282f7ec340bSmacallan    Amiga*:UNIX_System_V:4.0:*)
283f7ec340bSmacallan	echo m68k-unknown-sysv4
2847ce7e03cSmrg	exit ;;
285f7ec340bSmacallan    *:[Aa]miga[Oo][Ss]:*:*)
286f7ec340bSmacallan	echo ${UNAME_MACHINE}-unknown-amigaos
2877ce7e03cSmrg	exit ;;
288f7ec340bSmacallan    *:[Mm]orph[Oo][Ss]:*:*)
289f7ec340bSmacallan	echo ${UNAME_MACHINE}-unknown-morphos
2907ce7e03cSmrg	exit ;;
291f7ec340bSmacallan    *:OS/390:*:*)
292f7ec340bSmacallan	echo i370-ibm-openedition
2937ce7e03cSmrg	exit ;;
2947ce7e03cSmrg    *:z/VM:*:*)
2957ce7e03cSmrg	echo s390-ibm-zvmoe
2967ce7e03cSmrg	exit ;;
2977ce7e03cSmrg    *:OS400:*:*)
2987ce7e03cSmrg        echo powerpc-ibm-os400
2997ce7e03cSmrg	exit ;;
300f7ec340bSmacallan    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
301f7ec340bSmacallan	echo arm-acorn-riscix${UNAME_RELEASE}
3027ce7e03cSmrg	exit ;;
3037ce7e03cSmrg    arm:riscos:*:*|arm:RISCOS:*:*)
3047ce7e03cSmrg	echo arm-unknown-riscos
3057ce7e03cSmrg	exit ;;
306f7ec340bSmacallan    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
307f7ec340bSmacallan	echo hppa1.1-hitachi-hiuxmpp
3087ce7e03cSmrg	exit ;;
309f7ec340bSmacallan    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
310f7ec340bSmacallan	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
311f7ec340bSmacallan	if test "`(/bin/universe) 2>/dev/null`" = att ; then
312f7ec340bSmacallan		echo pyramid-pyramid-sysv3
313f7ec340bSmacallan	else
314f7ec340bSmacallan		echo pyramid-pyramid-bsd
315f7ec340bSmacallan	fi
3167ce7e03cSmrg	exit ;;
317f7ec340bSmacallan    NILE*:*:*:dcosx)
318f7ec340bSmacallan	echo pyramid-pyramid-svr4
3197ce7e03cSmrg	exit ;;
320f7ec340bSmacallan    DRS?6000:unix:4.0:6*)
321f7ec340bSmacallan	echo sparc-icl-nx6
3227ce7e03cSmrg	exit ;;
3237ce7e03cSmrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
324f7ec340bSmacallan	case `/usr/bin/uname -p` in
3257ce7e03cSmrg	    sparc) echo sparc-icl-nx7; exit ;;
326f7ec340bSmacallan	esac ;;
327f7ec340bSmacallan    sun4H:SunOS:5.*:*)
328f7ec340bSmacallan	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3297ce7e03cSmrg	exit ;;
330f7ec340bSmacallan    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
331f7ec340bSmacallan	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3327ce7e03cSmrg	exit ;;
3337ce7e03cSmrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
334f7ec340bSmacallan	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3357ce7e03cSmrg	exit ;;
336f7ec340bSmacallan    sun4*:SunOS:6*:*)
337f7ec340bSmacallan	# According to config.sub, this is the proper way to canonicalize
338f7ec340bSmacallan	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
339f7ec340bSmacallan	# it's likely to be more like Solaris than SunOS4.
340f7ec340bSmacallan	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3417ce7e03cSmrg	exit ;;
342f7ec340bSmacallan    sun4*:SunOS:*:*)
343f7ec340bSmacallan	case "`/usr/bin/arch -k`" in
344f7ec340bSmacallan	    Series*|S4*)
345f7ec340bSmacallan		UNAME_RELEASE=`uname -v`
346f7ec340bSmacallan		;;
347f7ec340bSmacallan	esac
348f7ec340bSmacallan	# Japanese Language versions have a version number like `4.1.3-JL'.
349f7ec340bSmacallan	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
3507ce7e03cSmrg	exit ;;
351f7ec340bSmacallan    sun3*:SunOS:*:*)
352f7ec340bSmacallan	echo m68k-sun-sunos${UNAME_RELEASE}
3537ce7e03cSmrg	exit ;;
354f7ec340bSmacallan    sun*:*:4.2BSD:*)
355f7ec340bSmacallan	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
356f7ec340bSmacallan	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
357f7ec340bSmacallan	case "`/bin/arch`" in
358f7ec340bSmacallan	    sun3)
359f7ec340bSmacallan		echo m68k-sun-sunos${UNAME_RELEASE}
360f7ec340bSmacallan		;;
361f7ec340bSmacallan	    sun4)
362f7ec340bSmacallan		echo sparc-sun-sunos${UNAME_RELEASE}
363f7ec340bSmacallan		;;
364f7ec340bSmacallan	esac
3657ce7e03cSmrg	exit ;;
366f7ec340bSmacallan    aushp:SunOS:*:*)
367f7ec340bSmacallan	echo sparc-auspex-sunos${UNAME_RELEASE}
3687ce7e03cSmrg	exit ;;
369f7ec340bSmacallan    # The situation for MiNT is a little confusing.  The machine name
370f7ec340bSmacallan    # can be virtually everything (everything which is not
371f7ec340bSmacallan    # "atarist" or "atariste" at least should have a processor
372f7ec340bSmacallan    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
373f7ec340bSmacallan    # to the lowercase version "mint" (or "freemint").  Finally
374f7ec340bSmacallan    # the system name "TOS" denotes a system which is actually not
375f7ec340bSmacallan    # MiNT.  But MiNT is downward compatible to TOS, so this should
376f7ec340bSmacallan    # be no problem.
377f7ec340bSmacallan    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
378f7ec340bSmacallan        echo m68k-atari-mint${UNAME_RELEASE}
3797ce7e03cSmrg	exit ;;
380f7ec340bSmacallan    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
381f7ec340bSmacallan	echo m68k-atari-mint${UNAME_RELEASE}
3827ce7e03cSmrg        exit ;;
383f7ec340bSmacallan    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
384f7ec340bSmacallan        echo m68k-atari-mint${UNAME_RELEASE}
3857ce7e03cSmrg	exit ;;
386f7ec340bSmacallan    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
387f7ec340bSmacallan        echo m68k-milan-mint${UNAME_RELEASE}
3887ce7e03cSmrg        exit ;;
389f7ec340bSmacallan    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
390f7ec340bSmacallan        echo m68k-hades-mint${UNAME_RELEASE}
3917ce7e03cSmrg        exit ;;
392f7ec340bSmacallan    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
393f7ec340bSmacallan        echo m68k-unknown-mint${UNAME_RELEASE}
3947ce7e03cSmrg        exit ;;
3957ce7e03cSmrg    m68k:machten:*:*)
3967ce7e03cSmrg	echo m68k-apple-machten${UNAME_RELEASE}
3977ce7e03cSmrg	exit ;;
398f7ec340bSmacallan    powerpc:machten:*:*)
399f7ec340bSmacallan	echo powerpc-apple-machten${UNAME_RELEASE}
4007ce7e03cSmrg	exit ;;
401f7ec340bSmacallan    RISC*:Mach:*:*)
402f7ec340bSmacallan	echo mips-dec-mach_bsd4.3
4037ce7e03cSmrg	exit ;;
404f7ec340bSmacallan    RISC*:ULTRIX:*:*)
405f7ec340bSmacallan	echo mips-dec-ultrix${UNAME_RELEASE}
4067ce7e03cSmrg	exit ;;
407f7ec340bSmacallan    VAX*:ULTRIX*:*:*)
408f7ec340bSmacallan	echo vax-dec-ultrix${UNAME_RELEASE}
4097ce7e03cSmrg	exit ;;
410f7ec340bSmacallan    2020:CLIX:*:* | 2430:CLIX:*:*)
411f7ec340bSmacallan	echo clipper-intergraph-clix${UNAME_RELEASE}
4127ce7e03cSmrg	exit ;;
413f7ec340bSmacallan    mips:*:*:UMIPS | mips:*:*:RISCos)
414f7ec340bSmacallan	eval $set_cc_for_build
415f7ec340bSmacallan	sed 's/^	//' << EOF >$dummy.c
416f7ec340bSmacallan#ifdef __cplusplus
417f7ec340bSmacallan#include <stdio.h>  /* for printf() prototype */
418f7ec340bSmacallan	int main (int argc, char *argv[]) {
419f7ec340bSmacallan#else
420f7ec340bSmacallan	int main (argc, argv) int argc; char *argv[]; {
421f7ec340bSmacallan#endif
422f7ec340bSmacallan	#if defined (host_mips) && defined (MIPSEB)
423f7ec340bSmacallan	#if defined (SYSTYPE_SYSV)
424f7ec340bSmacallan	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
425f7ec340bSmacallan	#endif
426f7ec340bSmacallan	#if defined (SYSTYPE_SVR4)
427f7ec340bSmacallan	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
428f7ec340bSmacallan	#endif
429f7ec340bSmacallan	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
430f7ec340bSmacallan	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
431f7ec340bSmacallan	#endif
432f7ec340bSmacallan	#endif
433f7ec340bSmacallan	  exit (-1);
434f7ec340bSmacallan	}
435f7ec340bSmacallanEOF
4367ce7e03cSmrg	$CC_FOR_BUILD -o $dummy $dummy.c &&
4377ce7e03cSmrg	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
4387ce7e03cSmrg	  SYSTEM_NAME=`$dummy $dummyarg` &&
4397ce7e03cSmrg	    { echo "$SYSTEM_NAME"; exit; }
440f7ec340bSmacallan	echo mips-mips-riscos${UNAME_RELEASE}
4417ce7e03cSmrg	exit ;;
442f7ec340bSmacallan    Motorola:PowerMAX_OS:*:*)
443f7ec340bSmacallan	echo powerpc-motorola-powermax
4447ce7e03cSmrg	exit ;;
445f7ec340bSmacallan    Motorola:*:4.3:PL8-*)
446f7ec340bSmacallan	echo powerpc-harris-powermax
4477ce7e03cSmrg	exit ;;
448f7ec340bSmacallan    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
449f7ec340bSmacallan	echo powerpc-harris-powermax
4507ce7e03cSmrg	exit ;;
451f7ec340bSmacallan    Night_Hawk:Power_UNIX:*:*)
452f7ec340bSmacallan	echo powerpc-harris-powerunix
4537ce7e03cSmrg	exit ;;
454f7ec340bSmacallan    m88k:CX/UX:7*:*)
455f7ec340bSmacallan	echo m88k-harris-cxux7
4567ce7e03cSmrg	exit ;;
457f7ec340bSmacallan    m88k:*:4*:R4*)
458f7ec340bSmacallan	echo m88k-motorola-sysv4
4597ce7e03cSmrg	exit ;;
460f7ec340bSmacallan    m88k:*:3*:R3*)
461f7ec340bSmacallan	echo m88k-motorola-sysv3
4627ce7e03cSmrg	exit ;;
463f7ec340bSmacallan    AViiON:dgux:*:*)
464f7ec340bSmacallan        # DG/UX returns AViiON for all architectures
465f7ec340bSmacallan        UNAME_PROCESSOR=`/usr/bin/uname -p`
466f7ec340bSmacallan	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
467f7ec340bSmacallan	then
468f7ec340bSmacallan	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
469f7ec340bSmacallan	       [ ${TARGET_BINARY_INTERFACE}x = x ]
470f7ec340bSmacallan	    then
471f7ec340bSmacallan		echo m88k-dg-dgux${UNAME_RELEASE}
472f7ec340bSmacallan	    else
473f7ec340bSmacallan		echo m88k-dg-dguxbcs${UNAME_RELEASE}
474f7ec340bSmacallan	    fi
475f7ec340bSmacallan	else
476f7ec340bSmacallan	    echo i586-dg-dgux${UNAME_RELEASE}
477f7ec340bSmacallan	fi
4787ce7e03cSmrg 	exit ;;
479f7ec340bSmacallan    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
480f7ec340bSmacallan	echo m88k-dolphin-sysv3
4817ce7e03cSmrg	exit ;;
482f7ec340bSmacallan    M88*:*:R3*:*)
483f7ec340bSmacallan	# Delta 88k system running SVR3
484f7ec340bSmacallan	echo m88k-motorola-sysv3
4857ce7e03cSmrg	exit ;;
486f7ec340bSmacallan    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
487f7ec340bSmacallan	echo m88k-tektronix-sysv3
4887ce7e03cSmrg	exit ;;
489f7ec340bSmacallan    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
490f7ec340bSmacallan	echo m68k-tektronix-bsd
4917ce7e03cSmrg	exit ;;
492f7ec340bSmacallan    *:IRIX*:*:*)
493f7ec340bSmacallan	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
4947ce7e03cSmrg	exit ;;
495f7ec340bSmacallan    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
4967ce7e03cSmrg	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
4977ce7e03cSmrg	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
498f7ec340bSmacallan    i*86:AIX:*:*)
499f7ec340bSmacallan	echo i386-ibm-aix
5007ce7e03cSmrg	exit ;;
501f7ec340bSmacallan    ia64:AIX:*:*)
502f7ec340bSmacallan	if [ -x /usr/bin/oslevel ] ; then
503f7ec340bSmacallan		IBM_REV=`/usr/bin/oslevel`
504f7ec340bSmacallan	else
505f7ec340bSmacallan		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
506f7ec340bSmacallan	fi
507f7ec340bSmacallan	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
5087ce7e03cSmrg	exit ;;
509f7ec340bSmacallan    *:AIX:2:3)
510f7ec340bSmacallan	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
511f7ec340bSmacallan		eval $set_cc_for_build
512f7ec340bSmacallan		sed 's/^		//' << EOF >$dummy.c
513f7ec340bSmacallan		#include <sys/systemcfg.h>
514f7ec340bSmacallan
515f7ec340bSmacallan		main()
516f7ec340bSmacallan			{
517f7ec340bSmacallan			if (!__power_pc())
518f7ec340bSmacallan				exit(1);
519f7ec340bSmacallan			puts("powerpc-ibm-aix3.2.5");
520f7ec340bSmacallan			exit(0);
521f7ec340bSmacallan			}
522f7ec340bSmacallanEOF
5237ce7e03cSmrg		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
5247ce7e03cSmrg		then
5257ce7e03cSmrg			echo "$SYSTEM_NAME"
5267ce7e03cSmrg		else
5277ce7e03cSmrg			echo rs6000-ibm-aix3.2.5
5287ce7e03cSmrg		fi
529f7ec340bSmacallan	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
530f7ec340bSmacallan		echo rs6000-ibm-aix3.2.4
531f7ec340bSmacallan	else
532f7ec340bSmacallan		echo rs6000-ibm-aix3.2
533f7ec340bSmacallan	fi
5347ce7e03cSmrg	exit ;;
5357ce7e03cSmrg    *:AIX:*:[456])
536f7ec340bSmacallan	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
537f7ec340bSmacallan	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
538f7ec340bSmacallan		IBM_ARCH=rs6000
539f7ec340bSmacallan	else
540f7ec340bSmacallan		IBM_ARCH=powerpc
541f7ec340bSmacallan	fi
542f7ec340bSmacallan	if [ -x /usr/bin/oslevel ] ; then
543f7ec340bSmacallan		IBM_REV=`/usr/bin/oslevel`
544f7ec340bSmacallan	else
545f7ec340bSmacallan		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
546f7ec340bSmacallan	fi
547f7ec340bSmacallan	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
5487ce7e03cSmrg	exit ;;
549f7ec340bSmacallan    *:AIX:*:*)
550f7ec340bSmacallan	echo rs6000-ibm-aix
5517ce7e03cSmrg	exit ;;
552f7ec340bSmacallan    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
553f7ec340bSmacallan	echo romp-ibm-bsd4.4
5547ce7e03cSmrg	exit ;;
555f7ec340bSmacallan    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
556f7ec340bSmacallan	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
5577ce7e03cSmrg	exit ;;                             # report: romp-ibm BSD 4.3
558f7ec340bSmacallan    *:BOSX:*:*)
559f7ec340bSmacallan	echo rs6000-bull-bosx
5607ce7e03cSmrg	exit ;;
561f7ec340bSmacallan    DPX/2?00:B.O.S.:*:*)
562f7ec340bSmacallan	echo m68k-bull-sysv3
5637ce7e03cSmrg	exit ;;
564f7ec340bSmacallan    9000/[34]??:4.3bsd:1.*:*)
565f7ec340bSmacallan	echo m68k-hp-bsd
5667ce7e03cSmrg	exit ;;
567f7ec340bSmacallan    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
568f7ec340bSmacallan	echo m68k-hp-bsd4.4
5697ce7e03cSmrg	exit ;;
570f7ec340bSmacallan    9000/[34678]??:HP-UX:*:*)
571f7ec340bSmacallan	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
572f7ec340bSmacallan	case "${UNAME_MACHINE}" in
573f7ec340bSmacallan	    9000/31? )            HP_ARCH=m68000 ;;
574f7ec340bSmacallan	    9000/[34]?? )         HP_ARCH=m68k ;;
575f7ec340bSmacallan	    9000/[678][0-9][0-9])
576f7ec340bSmacallan		if [ -x /usr/bin/getconf ]; then
577f7ec340bSmacallan		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
578f7ec340bSmacallan                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
579f7ec340bSmacallan                    case "${sc_cpu_version}" in
580f7ec340bSmacallan                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
581f7ec340bSmacallan                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
582f7ec340bSmacallan                      532)                      # CPU_PA_RISC2_0
583f7ec340bSmacallan                        case "${sc_kernel_bits}" in
584f7ec340bSmacallan                          32) HP_ARCH="hppa2.0n" ;;
585f7ec340bSmacallan                          64) HP_ARCH="hppa2.0w" ;;
586f7ec340bSmacallan			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
587f7ec340bSmacallan                        esac ;;
588f7ec340bSmacallan                    esac
589f7ec340bSmacallan		fi
590f7ec340bSmacallan		if [ "${HP_ARCH}" = "" ]; then
591f7ec340bSmacallan		    eval $set_cc_for_build
592f7ec340bSmacallan		    sed 's/^              //' << EOF >$dummy.c
593f7ec340bSmacallan
594f7ec340bSmacallan              #define _HPUX_SOURCE
595f7ec340bSmacallan              #include <stdlib.h>
596f7ec340bSmacallan              #include <unistd.h>
597f7ec340bSmacallan
598f7ec340bSmacallan              int main ()
599f7ec340bSmacallan              {
600f7ec340bSmacallan              #if defined(_SC_KERNEL_BITS)
601f7ec340bSmacallan                  long bits = sysconf(_SC_KERNEL_BITS);
602f7ec340bSmacallan              #endif
603f7ec340bSmacallan                  long cpu  = sysconf (_SC_CPU_VERSION);
604f7ec340bSmacallan
605f7ec340bSmacallan                  switch (cpu)
606f7ec340bSmacallan              	{
607f7ec340bSmacallan              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
608f7ec340bSmacallan              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
609f7ec340bSmacallan              	case CPU_PA_RISC2_0:
610f7ec340bSmacallan              #if defined(_SC_KERNEL_BITS)
611f7ec340bSmacallan              	    switch (bits)
612f7ec340bSmacallan              		{
613f7ec340bSmacallan              		case 64: puts ("hppa2.0w"); break;
614f7ec340bSmacallan              		case 32: puts ("hppa2.0n"); break;
615f7ec340bSmacallan              		default: puts ("hppa2.0"); break;
616f7ec340bSmacallan              		} break;
617f7ec340bSmacallan              #else  /* !defined(_SC_KERNEL_BITS) */
618f7ec340bSmacallan              	    puts ("hppa2.0"); break;
619f7ec340bSmacallan              #endif
620f7ec340bSmacallan              	default: puts ("hppa1.0"); break;
621f7ec340bSmacallan              	}
622f7ec340bSmacallan                  exit (0);
623f7ec340bSmacallan              }
624f7ec340bSmacallanEOF
625f7ec340bSmacallan		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
626f7ec340bSmacallan		    test -z "$HP_ARCH" && HP_ARCH=hppa
627f7ec340bSmacallan		fi ;;
628f7ec340bSmacallan	esac
629f7ec340bSmacallan	if [ ${HP_ARCH} = "hppa2.0w" ]
630f7ec340bSmacallan	then
6317ce7e03cSmrg	    eval $set_cc_for_build
6327ce7e03cSmrg
6337ce7e03cSmrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
6347ce7e03cSmrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
6357ce7e03cSmrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
6367ce7e03cSmrg	    #
6377ce7e03cSmrg	    # $ CC_FOR_BUILD=cc ./config.guess
6387ce7e03cSmrg	    # => hppa2.0w-hp-hpux11.23
6397ce7e03cSmrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
6407ce7e03cSmrg	    # => hppa64-hp-hpux11.23
6417ce7e03cSmrg
6427ce7e03cSmrg	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
6437ce7e03cSmrg		grep __LP64__ >/dev/null
644f7ec340bSmacallan	    then
645f7ec340bSmacallan		HP_ARCH="hppa2.0w"
646f7ec340bSmacallan	    else
647f7ec340bSmacallan		HP_ARCH="hppa64"
648f7ec340bSmacallan	    fi
649f7ec340bSmacallan	fi
650f7ec340bSmacallan	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
6517ce7e03cSmrg	exit ;;
652f7ec340bSmacallan    ia64:HP-UX:*:*)
653f7ec340bSmacallan	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
654f7ec340bSmacallan	echo ia64-hp-hpux${HPUX_REV}
6557ce7e03cSmrg	exit ;;
656f7ec340bSmacallan    3050*:HI-UX:*:*)
657f7ec340bSmacallan	eval $set_cc_for_build
658f7ec340bSmacallan	sed 's/^	//' << EOF >$dummy.c
659f7ec340bSmacallan	#include <unistd.h>
660f7ec340bSmacallan	int
661f7ec340bSmacallan	main ()
662f7ec340bSmacallan	{
663f7ec340bSmacallan	  long cpu = sysconf (_SC_CPU_VERSION);
664f7ec340bSmacallan	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
665f7ec340bSmacallan	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
666f7ec340bSmacallan	     results, however.  */
667f7ec340bSmacallan	  if (CPU_IS_PA_RISC (cpu))
668f7ec340bSmacallan	    {
669f7ec340bSmacallan	      switch (cpu)
670f7ec340bSmacallan		{
671f7ec340bSmacallan		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
672f7ec340bSmacallan		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
673f7ec340bSmacallan		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
674f7ec340bSmacallan		  default: puts ("hppa-hitachi-hiuxwe2"); break;
675f7ec340bSmacallan		}
676f7ec340bSmacallan	    }
677f7ec340bSmacallan	  else if (CPU_IS_HP_MC68K (cpu))
678f7ec340bSmacallan	    puts ("m68k-hitachi-hiuxwe2");
679f7ec340bSmacallan	  else puts ("unknown-hitachi-hiuxwe2");
680f7ec340bSmacallan	  exit (0);
681f7ec340bSmacallan	}
682f7ec340bSmacallanEOF
6837ce7e03cSmrg	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
6847ce7e03cSmrg		{ echo "$SYSTEM_NAME"; exit; }
685f7ec340bSmacallan	echo unknown-hitachi-hiuxwe2
6867ce7e03cSmrg	exit ;;
687f7ec340bSmacallan    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
688f7ec340bSmacallan	echo hppa1.1-hp-bsd
6897ce7e03cSmrg	exit ;;
690f7ec340bSmacallan    9000/8??:4.3bsd:*:*)
691f7ec340bSmacallan	echo hppa1.0-hp-bsd
6927ce7e03cSmrg	exit ;;
693f7ec340bSmacallan    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
694f7ec340bSmacallan	echo hppa1.0-hp-mpeix
6957ce7e03cSmrg	exit ;;
696f7ec340bSmacallan    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
697f7ec340bSmacallan	echo hppa1.1-hp-osf
6987ce7e03cSmrg	exit ;;
699f7ec340bSmacallan    hp8??:OSF1:*:*)
700f7ec340bSmacallan	echo hppa1.0-hp-osf
7017ce7e03cSmrg	exit ;;
702f7ec340bSmacallan    i*86:OSF1:*:*)
703f7ec340bSmacallan	if [ -x /usr/sbin/sysversion ] ; then
704f7ec340bSmacallan	    echo ${UNAME_MACHINE}-unknown-osf1mk
705f7ec340bSmacallan	else
706f7ec340bSmacallan	    echo ${UNAME_MACHINE}-unknown-osf1
707f7ec340bSmacallan	fi
7087ce7e03cSmrg	exit ;;
709f7ec340bSmacallan    parisc*:Lites*:*:*)
710f7ec340bSmacallan	echo hppa1.1-hp-lites
7117ce7e03cSmrg	exit ;;
712f7ec340bSmacallan    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
713f7ec340bSmacallan	echo c1-convex-bsd
7147ce7e03cSmrg        exit ;;
715f7ec340bSmacallan    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
716f7ec340bSmacallan	if getsysinfo -f scalar_acc
717f7ec340bSmacallan	then echo c32-convex-bsd
718f7ec340bSmacallan	else echo c2-convex-bsd
719f7ec340bSmacallan	fi
7207ce7e03cSmrg        exit ;;
721f7ec340bSmacallan    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
722f7ec340bSmacallan	echo c34-convex-bsd
7237ce7e03cSmrg        exit ;;
724f7ec340bSmacallan    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
725f7ec340bSmacallan	echo c38-convex-bsd
7267ce7e03cSmrg        exit ;;
727f7ec340bSmacallan    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
728f7ec340bSmacallan	echo c4-convex-bsd
7297ce7e03cSmrg        exit ;;
730f7ec340bSmacallan    CRAY*Y-MP:*:*:*)
731f7ec340bSmacallan	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7327ce7e03cSmrg	exit ;;
733f7ec340bSmacallan    CRAY*[A-Z]90:*:*:*)
734f7ec340bSmacallan	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
735f7ec340bSmacallan	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
736f7ec340bSmacallan	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
737f7ec340bSmacallan	      -e 's/\.[^.]*$/.X/'
7387ce7e03cSmrg	exit ;;
739f7ec340bSmacallan    CRAY*TS:*:*:*)
740f7ec340bSmacallan	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7417ce7e03cSmrg	exit ;;
742f7ec340bSmacallan    CRAY*T3E:*:*:*)
743f7ec340bSmacallan	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7447ce7e03cSmrg	exit ;;
745f7ec340bSmacallan    CRAY*SV1:*:*:*)
746f7ec340bSmacallan	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7477ce7e03cSmrg	exit ;;
748f7ec340bSmacallan    *:UNICOS/mp:*:*)
7497ce7e03cSmrg	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7507ce7e03cSmrg	exit ;;
751f7ec340bSmacallan    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
752f7ec340bSmacallan	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
753f7ec340bSmacallan        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
754f7ec340bSmacallan        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
755f7ec340bSmacallan        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
7567ce7e03cSmrg        exit ;;
7577ce7e03cSmrg    5000:UNIX_System_V:4.*:*)
7587ce7e03cSmrg        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
7597ce7e03cSmrg        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
7607ce7e03cSmrg        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
7617ce7e03cSmrg	exit ;;
762f7ec340bSmacallan    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
763f7ec340bSmacallan	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
7647ce7e03cSmrg	exit ;;
765f7ec340bSmacallan    sparc*:BSD/OS:*:*)
766f7ec340bSmacallan	echo sparc-unknown-bsdi${UNAME_RELEASE}
7677ce7e03cSmrg	exit ;;
768f7ec340bSmacallan    *:BSD/OS:*:*)
769f7ec340bSmacallan	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
7707ce7e03cSmrg	exit ;;
7717ce7e03cSmrg    *:FreeBSD:*:*)
7727ce7e03cSmrg	case ${UNAME_MACHINE} in
7737ce7e03cSmrg	    pc98)
7747ce7e03cSmrg		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
7757ce7e03cSmrg	    amd64)
7767ce7e03cSmrg		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
7777ce7e03cSmrg	    *)
7787ce7e03cSmrg		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
7797ce7e03cSmrg	esac
7807ce7e03cSmrg	exit ;;
781f7ec340bSmacallan    i*:CYGWIN*:*)
782f7ec340bSmacallan	echo ${UNAME_MACHINE}-pc-cygwin
7837ce7e03cSmrg	exit ;;
7847ce7e03cSmrg    *:MINGW*:*)
785f7ec340bSmacallan	echo ${UNAME_MACHINE}-pc-mingw32
7867ce7e03cSmrg	exit ;;
7877ce7e03cSmrg    i*:windows32*:*)
7887ce7e03cSmrg    	# uname -m includes "-pc" on this system.
7897ce7e03cSmrg    	echo ${UNAME_MACHINE}-mingw32
7907ce7e03cSmrg	exit ;;
791f7ec340bSmacallan    i*:PW*:*)
792f7ec340bSmacallan	echo ${UNAME_MACHINE}-pc-pw32
7937ce7e03cSmrg	exit ;;
7947ce7e03cSmrg    *:Interix*:[3456]*)
7957ce7e03cSmrg    	case ${UNAME_MACHINE} in
7967ce7e03cSmrg	    x86)
7977ce7e03cSmrg		echo i586-pc-interix${UNAME_RELEASE}
7987ce7e03cSmrg		exit ;;
7997ce7e03cSmrg	    EM64T | authenticamd)
8007ce7e03cSmrg		echo x86_64-unknown-interix${UNAME_RELEASE}
8017ce7e03cSmrg		exit ;;
8027ce7e03cSmrg	    IA64)
8037ce7e03cSmrg		echo ia64-unknown-interix${UNAME_RELEASE}
8047ce7e03cSmrg		exit ;;
8057ce7e03cSmrg	esac ;;
806f7ec340bSmacallan    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
807f7ec340bSmacallan	echo i${UNAME_MACHINE}-pc-mks
8087ce7e03cSmrg	exit ;;
809f7ec340bSmacallan    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
810f7ec340bSmacallan	# How do we know it's Interix rather than the generic POSIX subsystem?
811f7ec340bSmacallan	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
812f7ec340bSmacallan	# UNAME_MACHINE based on the output of uname instead of i386?
813f7ec340bSmacallan	echo i586-pc-interix
8147ce7e03cSmrg	exit ;;
815f7ec340bSmacallan    i*:UWIN*:*)
816f7ec340bSmacallan	echo ${UNAME_MACHINE}-pc-uwin
8177ce7e03cSmrg	exit ;;
8187ce7e03cSmrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
8197ce7e03cSmrg	echo x86_64-unknown-cygwin
8207ce7e03cSmrg	exit ;;
821f7ec340bSmacallan    p*:CYGWIN*:*)
822f7ec340bSmacallan	echo powerpcle-unknown-cygwin
8237ce7e03cSmrg	exit ;;
824f7ec340bSmacallan    prep*:SunOS:5.*:*)
825f7ec340bSmacallan	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
8267ce7e03cSmrg	exit ;;
827f7ec340bSmacallan    *:GNU:*:*)
8287ce7e03cSmrg	# the GNU system
829f7ec340bSmacallan	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
8307ce7e03cSmrg	exit ;;
8317ce7e03cSmrg    *:GNU/*:*:*)
8327ce7e03cSmrg	# other systems with GNU libc and userland
8337ce7e03cSmrg	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
8347ce7e03cSmrg	exit ;;
835f7ec340bSmacallan    i*86:Minix:*:*)
836f7ec340bSmacallan	echo ${UNAME_MACHINE}-pc-minix
8377ce7e03cSmrg	exit ;;
838f7ec340bSmacallan    arm*:Linux:*:*)
8397ce7e03cSmrg	eval $set_cc_for_build
8407ce7e03cSmrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
8417ce7e03cSmrg	    | grep -q __ARM_EABI__
8427ce7e03cSmrg	then
8437ce7e03cSmrg	    echo ${UNAME_MACHINE}-unknown-linux-gnu
8447ce7e03cSmrg	else
8457ce7e03cSmrg	    echo ${UNAME_MACHINE}-unknown-linux-gnueabi
8467ce7e03cSmrg	fi
8477ce7e03cSmrg	exit ;;
8487ce7e03cSmrg    avr32*:Linux:*:*)
849f7ec340bSmacallan	echo ${UNAME_MACHINE}-unknown-linux-gnu
8507ce7e03cSmrg	exit ;;
851f7ec340bSmacallan    cris:Linux:*:*)
852f7ec340bSmacallan	echo cris-axis-linux-gnu
8537ce7e03cSmrg	exit ;;
8547ce7e03cSmrg    crisv32:Linux:*:*)
8557ce7e03cSmrg	echo crisv32-axis-linux-gnu
8567ce7e03cSmrg	exit ;;
8577ce7e03cSmrg    frv:Linux:*:*)
8587ce7e03cSmrg    	echo frv-unknown-linux-gnu
8597ce7e03cSmrg	exit ;;
860f7ec340bSmacallan    ia64:Linux:*:*)
8617ce7e03cSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
8627ce7e03cSmrg	exit ;;
8637ce7e03cSmrg    m32r*:Linux:*:*)
8647ce7e03cSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
8657ce7e03cSmrg	exit ;;
866f7ec340bSmacallan    m68*:Linux:*:*)
867f7ec340bSmacallan	echo ${UNAME_MACHINE}-unknown-linux-gnu
8687ce7e03cSmrg	exit ;;
869f7ec340bSmacallan    mips:Linux:*:*)
870f7ec340bSmacallan	eval $set_cc_for_build
871f7ec340bSmacallan	sed 's/^	//' << EOF >$dummy.c
872f7ec340bSmacallan	#undef CPU
873f7ec340bSmacallan	#undef mips
874f7ec340bSmacallan	#undef mipsel
875f7ec340bSmacallan	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
876f7ec340bSmacallan	CPU=mipsel
877f7ec340bSmacallan	#else
878f7ec340bSmacallan	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
879f7ec340bSmacallan	CPU=mips
880f7ec340bSmacallan	#else
881f7ec340bSmacallan	CPU=
882f7ec340bSmacallan	#endif
883f7ec340bSmacallan	#endif
884f7ec340bSmacallanEOF
8857ce7e03cSmrg	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
8867ce7e03cSmrg	    /^CPU/{
8877ce7e03cSmrg		s: ::g
8887ce7e03cSmrg		p
8897ce7e03cSmrg	    }'`"
8907ce7e03cSmrg	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
891f7ec340bSmacallan	;;
892f7ec340bSmacallan    mips64:Linux:*:*)
893f7ec340bSmacallan	eval $set_cc_for_build
894f7ec340bSmacallan	sed 's/^	//' << EOF >$dummy.c
895f7ec340bSmacallan	#undef CPU
896f7ec340bSmacallan	#undef mips64
897f7ec340bSmacallan	#undef mips64el
898f7ec340bSmacallan	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
899f7ec340bSmacallan	CPU=mips64el
900f7ec340bSmacallan	#else
901f7ec340bSmacallan	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
902f7ec340bSmacallan	CPU=mips64
903f7ec340bSmacallan	#else
904f7ec340bSmacallan	CPU=
905f7ec340bSmacallan	#endif
906f7ec340bSmacallan	#endif
907f7ec340bSmacallanEOF
9087ce7e03cSmrg	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
9097ce7e03cSmrg	    /^CPU/{
9107ce7e03cSmrg		s: ::g
9117ce7e03cSmrg		p
9127ce7e03cSmrg	    }'`"
9137ce7e03cSmrg	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
914f7ec340bSmacallan	;;
9157ce7e03cSmrg    or32:Linux:*:*)
9167ce7e03cSmrg	echo or32-unknown-linux-gnu
9177ce7e03cSmrg	exit ;;
918f7ec340bSmacallan    ppc:Linux:*:*)
9197ce7e03cSmrg	echo powerpc-unknown-linux-gnu
9207ce7e03cSmrg	exit ;;
921f7ec340bSmacallan    ppc64:Linux:*:*)
9227ce7e03cSmrg	echo powerpc64-unknown-linux-gnu
9237ce7e03cSmrg	exit ;;
924f7ec340bSmacallan    alpha:Linux:*:*)
925f7ec340bSmacallan	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
926f7ec340bSmacallan	  EV5)   UNAME_MACHINE=alphaev5 ;;
927f7ec340bSmacallan	  EV56)  UNAME_MACHINE=alphaev56 ;;
928f7ec340bSmacallan	  PCA56) UNAME_MACHINE=alphapca56 ;;
929f7ec340bSmacallan	  PCA57) UNAME_MACHINE=alphapca56 ;;
930f7ec340bSmacallan	  EV6)   UNAME_MACHINE=alphaev6 ;;
931f7ec340bSmacallan	  EV67)  UNAME_MACHINE=alphaev67 ;;
932f7ec340bSmacallan	  EV68*) UNAME_MACHINE=alphaev68 ;;
933f7ec340bSmacallan        esac
934f7ec340bSmacallan	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
935f7ec340bSmacallan	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
936f7ec340bSmacallan	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
9377ce7e03cSmrg	exit ;;
938f7ec340bSmacallan    parisc:Linux:*:* | hppa:Linux:*:*)
939f7ec340bSmacallan	# Look for CPU level
940f7ec340bSmacallan	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
941f7ec340bSmacallan	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
942f7ec340bSmacallan	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
943f7ec340bSmacallan	  *)    echo hppa-unknown-linux-gnu ;;
944f7ec340bSmacallan	esac
9457ce7e03cSmrg	exit ;;
946f7ec340bSmacallan    parisc64:Linux:*:* | hppa64:Linux:*:*)
947f7ec340bSmacallan	echo hppa64-unknown-linux-gnu
9487ce7e03cSmrg	exit ;;
949f7ec340bSmacallan    s390:Linux:*:* | s390x:Linux:*:*)
9507ce7e03cSmrg	echo ${UNAME_MACHINE}-ibm-linux
9517ce7e03cSmrg	exit ;;
952f7ec340bSmacallan    sh64*:Linux:*:*)
953f7ec340bSmacallan    	echo ${UNAME_MACHINE}-unknown-linux-gnu
9547ce7e03cSmrg	exit ;;
955f7ec340bSmacallan    sh*:Linux:*:*)
956f7ec340bSmacallan	echo ${UNAME_MACHINE}-unknown-linux-gnu
9577ce7e03cSmrg	exit ;;
958f7ec340bSmacallan    sparc:Linux:*:* | sparc64:Linux:*:*)
959f7ec340bSmacallan	echo ${UNAME_MACHINE}-unknown-linux-gnu
9607ce7e03cSmrg	exit ;;
9617ce7e03cSmrg    vax:Linux:*:*)
9627ce7e03cSmrg	echo ${UNAME_MACHINE}-dec-linux-gnu
9637ce7e03cSmrg	exit ;;
964f7ec340bSmacallan    x86_64:Linux:*:*)
9657ce7e03cSmrg	echo x86_64-unknown-linux-gnu
9667ce7e03cSmrg	exit ;;
9677ce7e03cSmrg    xtensa*:Linux:*:*)
9687ce7e03cSmrg    	echo ${UNAME_MACHINE}-unknown-linux-gnu
9697ce7e03cSmrg	exit ;;
970f7ec340bSmacallan    i*86:Linux:*:*)
971f7ec340bSmacallan	# The BFD linker knows what the default object file format is, so
972f7ec340bSmacallan	# first see if it will tell us. cd to the root directory to prevent
973f7ec340bSmacallan	# problems with other programs or directories called `ld' in the path.
974f7ec340bSmacallan	# Set LC_ALL=C to ensure ld outputs messages in English.
975f7ec340bSmacallan	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
976f7ec340bSmacallan			 | sed -ne '/supported targets:/!d
977f7ec340bSmacallan				    s/[ 	][ 	]*/ /g
978f7ec340bSmacallan				    s/.*supported targets: *//
979f7ec340bSmacallan				    s/ .*//
980f7ec340bSmacallan				    p'`
981f7ec340bSmacallan        case "$ld_supported_targets" in
982f7ec340bSmacallan	  elf32-i386)
983f7ec340bSmacallan		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
984f7ec340bSmacallan		;;
985f7ec340bSmacallan	  a.out-i386-linux)
986f7ec340bSmacallan		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
9877ce7e03cSmrg		exit ;;
988f7ec340bSmacallan	  coff-i386)
989f7ec340bSmacallan		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
9907ce7e03cSmrg		exit ;;
991f7ec340bSmacallan	  "")
992f7ec340bSmacallan		# Either a pre-BFD a.out linker (linux-gnuoldld) or
993f7ec340bSmacallan		# one that does not give us useful --help.
994f7ec340bSmacallan		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
9957ce7e03cSmrg		exit ;;
996f7ec340bSmacallan	esac
997f7ec340bSmacallan	# Determine whether the default compiler is a.out or elf
998f7ec340bSmacallan	eval $set_cc_for_build
999f7ec340bSmacallan	sed 's/^	//' << EOF >$dummy.c
1000f7ec340bSmacallan	#include <features.h>
1001f7ec340bSmacallan	#ifdef __ELF__
1002f7ec340bSmacallan	# ifdef __GLIBC__
1003f7ec340bSmacallan	#  if __GLIBC__ >= 2
1004f7ec340bSmacallan	LIBC=gnu
1005f7ec340bSmacallan	#  else
1006f7ec340bSmacallan	LIBC=gnulibc1
1007f7ec340bSmacallan	#  endif
1008f7ec340bSmacallan	# else
1009f7ec340bSmacallan	LIBC=gnulibc1
1010f7ec340bSmacallan	# endif
1011f7ec340bSmacallan	#else
10127ce7e03cSmrg	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
1013f7ec340bSmacallan	LIBC=gnu
1014f7ec340bSmacallan	#else
1015f7ec340bSmacallan	LIBC=gnuaout
1016f7ec340bSmacallan	#endif
1017f7ec340bSmacallan	#endif
10187ce7e03cSmrg	#ifdef __dietlibc__
10197ce7e03cSmrg	LIBC=dietlibc
10207ce7e03cSmrg	#endif
1021f7ec340bSmacallanEOF
10227ce7e03cSmrg	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
10237ce7e03cSmrg	    /^LIBC/{
10247ce7e03cSmrg		s: ::g
10257ce7e03cSmrg		p
10267ce7e03cSmrg	    }'`"
10277ce7e03cSmrg	test x"${LIBC}" != x && {
10287ce7e03cSmrg		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
10297ce7e03cSmrg		exit
10307ce7e03cSmrg	}
10317ce7e03cSmrg	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
1032f7ec340bSmacallan	;;
1033f7ec340bSmacallan    i*86:DYNIX/ptx:4*:*)
1034f7ec340bSmacallan	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1035f7ec340bSmacallan	# earlier versions are messed up and put the nodename in both
1036f7ec340bSmacallan	# sysname and nodename.
1037f7ec340bSmacallan	echo i386-sequent-sysv4
10387ce7e03cSmrg	exit ;;
1039f7ec340bSmacallan    i*86:UNIX_SV:4.2MP:2.*)
1040f7ec340bSmacallan        # Unixware is an offshoot of SVR4, but it has its own version
1041f7ec340bSmacallan        # number series starting with 2...
1042f7ec340bSmacallan        # I am not positive that other SVR4 systems won't match this,
1043f7ec340bSmacallan	# I just have to hope.  -- rms.
1044f7ec340bSmacallan        # Use sysv4.2uw... so that sysv4* matches it.
1045f7ec340bSmacallan	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
10467ce7e03cSmrg	exit ;;
1047f7ec340bSmacallan    i*86:OS/2:*:*)
1048f7ec340bSmacallan	# If we were able to find `uname', then EMX Unix compatibility
1049f7ec340bSmacallan	# is probably installed.
1050f7ec340bSmacallan	echo ${UNAME_MACHINE}-pc-os2-emx
10517ce7e03cSmrg	exit ;;
1052f7ec340bSmacallan    i*86:XTS-300:*:STOP)
1053f7ec340bSmacallan	echo ${UNAME_MACHINE}-unknown-stop
10547ce7e03cSmrg	exit ;;
1055f7ec340bSmacallan    i*86:atheos:*:*)
1056f7ec340bSmacallan	echo ${UNAME_MACHINE}-unknown-atheos
10577ce7e03cSmrg	exit ;;
10587ce7e03cSmrg    i*86:syllable:*:*)
10597ce7e03cSmrg	echo ${UNAME_MACHINE}-pc-syllable
10607ce7e03cSmrg	exit ;;
1061f7ec340bSmacallan    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
1062f7ec340bSmacallan	echo i386-unknown-lynxos${UNAME_RELEASE}
10637ce7e03cSmrg	exit ;;
1064f7ec340bSmacallan    i*86:*DOS:*:*)
1065f7ec340bSmacallan	echo ${UNAME_MACHINE}-pc-msdosdjgpp
10667ce7e03cSmrg	exit ;;
1067f7ec340bSmacallan    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
1068f7ec340bSmacallan	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
1069f7ec340bSmacallan	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1070f7ec340bSmacallan		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
1071f7ec340bSmacallan	else
1072f7ec340bSmacallan		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
1073f7ec340bSmacallan	fi
10747ce7e03cSmrg	exit ;;
10757ce7e03cSmrg    i*86:*:5:[678]*)
10767ce7e03cSmrg    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
1077f7ec340bSmacallan	case `/bin/uname -X | grep "^Machine"` in
1078f7ec340bSmacallan	    *486*)	     UNAME_MACHINE=i486 ;;
1079f7ec340bSmacallan	    *Pentium)	     UNAME_MACHINE=i586 ;;
1080f7ec340bSmacallan	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1081f7ec340bSmacallan	esac
1082f7ec340bSmacallan	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
10837ce7e03cSmrg	exit ;;
1084f7ec340bSmacallan    i*86:*:3.2:*)
1085f7ec340bSmacallan	if test -f /usr/options/cb.name; then
1086f7ec340bSmacallan		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1087f7ec340bSmacallan		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
1088f7ec340bSmacallan	elif /bin/uname -X 2>/dev/null >/dev/null ; then
1089f7ec340bSmacallan		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1090f7ec340bSmacallan		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1091f7ec340bSmacallan		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1092f7ec340bSmacallan			&& UNAME_MACHINE=i586
1093f7ec340bSmacallan		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1094f7ec340bSmacallan			&& UNAME_MACHINE=i686
1095f7ec340bSmacallan		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1096f7ec340bSmacallan			&& UNAME_MACHINE=i686
1097f7ec340bSmacallan		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
1098f7ec340bSmacallan	else
1099f7ec340bSmacallan		echo ${UNAME_MACHINE}-pc-sysv32
1100f7ec340bSmacallan	fi
11017ce7e03cSmrg	exit ;;
1102f7ec340bSmacallan    pc:*:*:*)
1103f7ec340bSmacallan	# Left here for compatibility:
1104f7ec340bSmacallan        # uname -m prints for DJGPP always 'pc', but it prints nothing about
1105f7ec340bSmacallan        # the processor, so we play safe by assuming i386.
1106f7ec340bSmacallan	echo i386-pc-msdosdjgpp
11077ce7e03cSmrg        exit ;;
1108f7ec340bSmacallan    Intel:Mach:3*:*)
1109f7ec340bSmacallan	echo i386-pc-mach3
11107ce7e03cSmrg	exit ;;
1111f7ec340bSmacallan    paragon:*:*:*)
1112f7ec340bSmacallan	echo i860-intel-osf1
11137ce7e03cSmrg	exit ;;
1114f7ec340bSmacallan    i860:*:4.*:*) # i860-SVR4
1115f7ec340bSmacallan	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1116f7ec340bSmacallan	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
1117f7ec340bSmacallan	else # Add other i860-SVR4 vendors below as they are discovered.
1118f7ec340bSmacallan	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
1119f7ec340bSmacallan	fi
11207ce7e03cSmrg	exit ;;
1121f7ec340bSmacallan    mini*:CTIX:SYS*5:*)
1122f7ec340bSmacallan	# "miniframe"
1123f7ec340bSmacallan	echo m68010-convergent-sysv
11247ce7e03cSmrg	exit ;;
1125f7ec340bSmacallan    mc68k:UNIX:SYSTEM5:3.51m)
1126f7ec340bSmacallan	echo m68k-convergent-sysv
11277ce7e03cSmrg	exit ;;
1128f7ec340bSmacallan    M680?0:D-NIX:5.3:*)
1129f7ec340bSmacallan	echo m68k-diab-dnix
11307ce7e03cSmrg	exit ;;
11317ce7e03cSmrg    M68*:*:R3V[5678]*:*)
11327ce7e03cSmrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
11337ce7e03cSmrg    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)
1134f7ec340bSmacallan	OS_REL=''
1135f7ec340bSmacallan	test -r /etc/.relid \
1136f7ec340bSmacallan	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1137f7ec340bSmacallan	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
11387ce7e03cSmrg	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1139f7ec340bSmacallan	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
11407ce7e03cSmrg	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1141f7ec340bSmacallan    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1142f7ec340bSmacallan        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
11437ce7e03cSmrg          && { echo i486-ncr-sysv4; exit; } ;;
1144f7ec340bSmacallan    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1145f7ec340bSmacallan	echo m68k-unknown-lynxos${UNAME_RELEASE}
11467ce7e03cSmrg	exit ;;
1147f7ec340bSmacallan    mc68030:UNIX_System_V:4.*:*)
1148f7ec340bSmacallan	echo m68k-atari-sysv4
11497ce7e03cSmrg	exit ;;
1150f7ec340bSmacallan    TSUNAMI:LynxOS:2.*:*)
1151f7ec340bSmacallan	echo sparc-unknown-lynxos${UNAME_RELEASE}
11527ce7e03cSmrg	exit ;;
1153f7ec340bSmacallan    rs6000:LynxOS:2.*:*)
1154f7ec340bSmacallan	echo rs6000-unknown-lynxos${UNAME_RELEASE}
11557ce7e03cSmrg	exit ;;
1156f7ec340bSmacallan    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
1157f7ec340bSmacallan	echo powerpc-unknown-lynxos${UNAME_RELEASE}
11587ce7e03cSmrg	exit ;;
1159f7ec340bSmacallan    SM[BE]S:UNIX_SV:*:*)
1160f7ec340bSmacallan	echo mips-dde-sysv${UNAME_RELEASE}
11617ce7e03cSmrg	exit ;;
1162f7ec340bSmacallan    RM*:ReliantUNIX-*:*:*)
1163f7ec340bSmacallan	echo mips-sni-sysv4
11647ce7e03cSmrg	exit ;;
1165f7ec340bSmacallan    RM*:SINIX-*:*:*)
1166f7ec340bSmacallan	echo mips-sni-sysv4
11677ce7e03cSmrg	exit ;;
1168f7ec340bSmacallan    *:SINIX-*:*:*)
1169f7ec340bSmacallan	if uname -p 2>/dev/null >/dev/null ; then
1170f7ec340bSmacallan		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1171f7ec340bSmacallan		echo ${UNAME_MACHINE}-sni-sysv4
1172f7ec340bSmacallan	else
1173f7ec340bSmacallan		echo ns32k-sni-sysv
1174f7ec340bSmacallan	fi
11757ce7e03cSmrg	exit ;;
1176f7ec340bSmacallan    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1177f7ec340bSmacallan                      # says <Richard.M.Bartel@ccMail.Census.GOV>
1178f7ec340bSmacallan        echo i586-unisys-sysv4
11797ce7e03cSmrg        exit ;;
1180f7ec340bSmacallan    *:UNIX_System_V:4*:FTX*)
1181f7ec340bSmacallan	# From Gerald Hewes <hewes@openmarket.com>.
1182f7ec340bSmacallan	# How about differentiating between stratus architectures? -djm
1183f7ec340bSmacallan	echo hppa1.1-stratus-sysv4
11847ce7e03cSmrg	exit ;;
1185f7ec340bSmacallan    *:*:*:FTX*)
1186f7ec340bSmacallan	# From seanf@swdc.stratus.com.
1187f7ec340bSmacallan	echo i860-stratus-sysv4
11887ce7e03cSmrg	exit ;;
11897ce7e03cSmrg    i*86:VOS:*:*)
11907ce7e03cSmrg	# From Paul.Green@stratus.com.
11917ce7e03cSmrg	echo ${UNAME_MACHINE}-stratus-vos
11927ce7e03cSmrg	exit ;;
1193f7ec340bSmacallan    *:VOS:*:*)
1194f7ec340bSmacallan	# From Paul.Green@stratus.com.
1195f7ec340bSmacallan	echo hppa1.1-stratus-vos
11967ce7e03cSmrg	exit ;;
1197f7ec340bSmacallan    mc68*:A/UX:*:*)
1198f7ec340bSmacallan	echo m68k-apple-aux${UNAME_RELEASE}
11997ce7e03cSmrg	exit ;;
1200f7ec340bSmacallan    news*:NEWS-OS:6*:*)
1201f7ec340bSmacallan	echo mips-sony-newsos6
12027ce7e03cSmrg	exit ;;
1203f7ec340bSmacallan    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1204f7ec340bSmacallan	if [ -d /usr/nec ]; then
1205f7ec340bSmacallan	        echo mips-nec-sysv${UNAME_RELEASE}
1206f7ec340bSmacallan	else
1207f7ec340bSmacallan	        echo mips-unknown-sysv${UNAME_RELEASE}
1208f7ec340bSmacallan	fi
12097ce7e03cSmrg        exit ;;
1210f7ec340bSmacallan    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1211f7ec340bSmacallan	echo powerpc-be-beos
12127ce7e03cSmrg	exit ;;
1213f7ec340bSmacallan    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1214f7ec340bSmacallan	echo powerpc-apple-beos
12157ce7e03cSmrg	exit ;;
1216f7ec340bSmacallan    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1217f7ec340bSmacallan	echo i586-pc-beos
12187ce7e03cSmrg	exit ;;
1219f7ec340bSmacallan    SX-4:SUPER-UX:*:*)
1220f7ec340bSmacallan	echo sx4-nec-superux${UNAME_RELEASE}
12217ce7e03cSmrg	exit ;;
1222f7ec340bSmacallan    SX-5:SUPER-UX:*:*)
1223f7ec340bSmacallan	echo sx5-nec-superux${UNAME_RELEASE}
12247ce7e03cSmrg	exit ;;
1225f7ec340bSmacallan    SX-6:SUPER-UX:*:*)
1226f7ec340bSmacallan	echo sx6-nec-superux${UNAME_RELEASE}
12277ce7e03cSmrg	exit ;;
12287ce7e03cSmrg    SX-7:SUPER-UX:*:*)
12297ce7e03cSmrg	echo sx7-nec-superux${UNAME_RELEASE}
12307ce7e03cSmrg	exit ;;
12317ce7e03cSmrg    SX-8:SUPER-UX:*:*)
12327ce7e03cSmrg	echo sx8-nec-superux${UNAME_RELEASE}
12337ce7e03cSmrg	exit ;;
12347ce7e03cSmrg    SX-8R:SUPER-UX:*:*)
12357ce7e03cSmrg	echo sx8r-nec-superux${UNAME_RELEASE}
12367ce7e03cSmrg	exit ;;
1237f7ec340bSmacallan    Power*:Rhapsody:*:*)
1238f7ec340bSmacallan	echo powerpc-apple-rhapsody${UNAME_RELEASE}
12397ce7e03cSmrg	exit ;;
1240f7ec340bSmacallan    *:Rhapsody:*:*)
1241f7ec340bSmacallan	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
12427ce7e03cSmrg	exit ;;
1243f7ec340bSmacallan    *:Darwin:*:*)
12447ce7e03cSmrg	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
12457ce7e03cSmrg	case $UNAME_PROCESSOR in
12467ce7e03cSmrg	    unknown) UNAME_PROCESSOR=powerpc ;;
1247f7ec340bSmacallan	esac
1248f7ec340bSmacallan	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
12497ce7e03cSmrg	exit ;;
1250f7ec340bSmacallan    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1251f7ec340bSmacallan	UNAME_PROCESSOR=`uname -p`
1252f7ec340bSmacallan	if test "$UNAME_PROCESSOR" = "x86"; then
1253f7ec340bSmacallan		UNAME_PROCESSOR=i386
1254f7ec340bSmacallan		UNAME_MACHINE=pc
1255f7ec340bSmacallan	fi
1256f7ec340bSmacallan	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
12577ce7e03cSmrg	exit ;;
1258f7ec340bSmacallan    *:QNX:*:4*)
1259f7ec340bSmacallan	echo i386-pc-qnx
12607ce7e03cSmrg	exit ;;
12617ce7e03cSmrg    NSE-?:NONSTOP_KERNEL:*:*)
12627ce7e03cSmrg	echo nse-tandem-nsk${UNAME_RELEASE}
12637ce7e03cSmrg	exit ;;
12647ce7e03cSmrg    NSR-?:NONSTOP_KERNEL:*:*)
1265f7ec340bSmacallan	echo nsr-tandem-nsk${UNAME_RELEASE}
12667ce7e03cSmrg	exit ;;
1267f7ec340bSmacallan    *:NonStop-UX:*:*)
1268f7ec340bSmacallan	echo mips-compaq-nonstopux
12697ce7e03cSmrg	exit ;;
1270f7ec340bSmacallan    BS2000:POSIX*:*:*)
1271f7ec340bSmacallan	echo bs2000-siemens-sysv
12727ce7e03cSmrg	exit ;;
1273f7ec340bSmacallan    DS/*:UNIX_System_V:*:*)
1274f7ec340bSmacallan	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
12757ce7e03cSmrg	exit ;;
1276f7ec340bSmacallan    *:Plan9:*:*)
1277f7ec340bSmacallan	# "uname -m" is not consistent, so use $cputype instead. 386
1278f7ec340bSmacallan	# is converted to i386 for consistency with other x86
1279f7ec340bSmacallan	# operating systems.
1280f7ec340bSmacallan	if test "$cputype" = "386"; then
1281f7ec340bSmacallan	    UNAME_MACHINE=i386
1282f7ec340bSmacallan	else
1283f7ec340bSmacallan	    UNAME_MACHINE="$cputype"
1284f7ec340bSmacallan	fi
1285f7ec340bSmacallan	echo ${UNAME_MACHINE}-unknown-plan9
12867ce7e03cSmrg	exit ;;
1287f7ec340bSmacallan    *:TOPS-10:*:*)
1288f7ec340bSmacallan	echo pdp10-unknown-tops10
12897ce7e03cSmrg	exit ;;
1290f7ec340bSmacallan    *:TENEX:*:*)
1291f7ec340bSmacallan	echo pdp10-unknown-tenex
12927ce7e03cSmrg	exit ;;
1293f7ec340bSmacallan    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1294f7ec340bSmacallan	echo pdp10-dec-tops20
12957ce7e03cSmrg	exit ;;
1296f7ec340bSmacallan    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1297f7ec340bSmacallan	echo pdp10-xkl-tops20
12987ce7e03cSmrg	exit ;;
1299f7ec340bSmacallan    *:TOPS-20:*:*)
1300f7ec340bSmacallan	echo pdp10-unknown-tops20
13017ce7e03cSmrg	exit ;;
1302f7ec340bSmacallan    *:ITS:*:*)
1303f7ec340bSmacallan	echo pdp10-unknown-its
13047ce7e03cSmrg	exit ;;
1305f7ec340bSmacallan    SEI:*:*:SEIUX)
1306f7ec340bSmacallan        echo mips-sei-seiux${UNAME_RELEASE}
13077ce7e03cSmrg	exit ;;
13087ce7e03cSmrg    *:DragonFly:*:*)
13097ce7e03cSmrg	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
13107ce7e03cSmrg	exit ;;
13117ce7e03cSmrg    *:*VMS:*:*)
13127ce7e03cSmrg    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
13137ce7e03cSmrg	case "${UNAME_MACHINE}" in
13147ce7e03cSmrg	    A*) echo alpha-dec-vms ; exit ;;
13157ce7e03cSmrg	    I*) echo ia64-dec-vms ; exit ;;
13167ce7e03cSmrg	    V*) echo vax-dec-vms ; exit ;;
13177ce7e03cSmrg	esac ;;
13187ce7e03cSmrg    *:XENIX:*:SysV)
13197ce7e03cSmrg	echo i386-pc-xenix
13207ce7e03cSmrg	exit ;;
13217ce7e03cSmrg    i*86:skyos:*:*)
13227ce7e03cSmrg	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
13237ce7e03cSmrg	exit ;;
13247ce7e03cSmrg    i*86:rdos:*:*)
13257ce7e03cSmrg	echo ${UNAME_MACHINE}-pc-rdos
13267ce7e03cSmrg	exit ;;
1327f7ec340bSmacallanesac
1328f7ec340bSmacallan
1329f7ec340bSmacallan#echo '(No uname command or uname output not recognized.)' 1>&2
1330f7ec340bSmacallan#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
1331f7ec340bSmacallan
1332f7ec340bSmacallaneval $set_cc_for_build
1333f7ec340bSmacallancat >$dummy.c <<EOF
1334f7ec340bSmacallan#ifdef _SEQUENT_
1335f7ec340bSmacallan# include <sys/types.h>
1336f7ec340bSmacallan# include <sys/utsname.h>
1337f7ec340bSmacallan#endif
1338f7ec340bSmacallanmain ()
1339f7ec340bSmacallan{
1340f7ec340bSmacallan#if defined (sony)
1341f7ec340bSmacallan#if defined (MIPSEB)
1342f7ec340bSmacallan  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1343f7ec340bSmacallan     I don't know....  */
1344f7ec340bSmacallan  printf ("mips-sony-bsd\n"); exit (0);
1345f7ec340bSmacallan#else
1346f7ec340bSmacallan#include <sys/param.h>
1347f7ec340bSmacallan  printf ("m68k-sony-newsos%s\n",
1348f7ec340bSmacallan#ifdef NEWSOS4
1349f7ec340bSmacallan          "4"
1350f7ec340bSmacallan#else
1351f7ec340bSmacallan	  ""
1352f7ec340bSmacallan#endif
1353f7ec340bSmacallan         ); exit (0);
1354f7ec340bSmacallan#endif
1355f7ec340bSmacallan#endif
1356f7ec340bSmacallan
1357f7ec340bSmacallan#if defined (__arm) && defined (__acorn) && defined (__unix)
13587ce7e03cSmrg  printf ("arm-acorn-riscix\n"); exit (0);
1359f7ec340bSmacallan#endif
1360f7ec340bSmacallan
1361f7ec340bSmacallan#if defined (hp300) && !defined (hpux)
1362f7ec340bSmacallan  printf ("m68k-hp-bsd\n"); exit (0);
1363f7ec340bSmacallan#endif
1364f7ec340bSmacallan
1365f7ec340bSmacallan#if defined (NeXT)
1366f7ec340bSmacallan#if !defined (__ARCHITECTURE__)
1367f7ec340bSmacallan#define __ARCHITECTURE__ "m68k"
1368f7ec340bSmacallan#endif
1369f7ec340bSmacallan  int version;
1370f7ec340bSmacallan  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1371f7ec340bSmacallan  if (version < 4)
1372f7ec340bSmacallan    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1373f7ec340bSmacallan  else
1374f7ec340bSmacallan    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1375f7ec340bSmacallan  exit (0);
1376f7ec340bSmacallan#endif
1377f7ec340bSmacallan
1378f7ec340bSmacallan#if defined (MULTIMAX) || defined (n16)
1379f7ec340bSmacallan#if defined (UMAXV)
1380f7ec340bSmacallan  printf ("ns32k-encore-sysv\n"); exit (0);
1381f7ec340bSmacallan#else
1382f7ec340bSmacallan#if defined (CMU)
1383f7ec340bSmacallan  printf ("ns32k-encore-mach\n"); exit (0);
1384f7ec340bSmacallan#else
1385f7ec340bSmacallan  printf ("ns32k-encore-bsd\n"); exit (0);
1386f7ec340bSmacallan#endif
1387f7ec340bSmacallan#endif
1388f7ec340bSmacallan#endif
1389f7ec340bSmacallan
1390f7ec340bSmacallan#if defined (__386BSD__)
1391f7ec340bSmacallan  printf ("i386-pc-bsd\n"); exit (0);
1392f7ec340bSmacallan#endif
1393f7ec340bSmacallan
1394f7ec340bSmacallan#if defined (sequent)
1395f7ec340bSmacallan#if defined (i386)
1396f7ec340bSmacallan  printf ("i386-sequent-dynix\n"); exit (0);
1397f7ec340bSmacallan#endif
1398f7ec340bSmacallan#if defined (ns32000)
1399f7ec340bSmacallan  printf ("ns32k-sequent-dynix\n"); exit (0);
1400f7ec340bSmacallan#endif
1401f7ec340bSmacallan#endif
1402f7ec340bSmacallan
1403f7ec340bSmacallan#if defined (_SEQUENT_)
1404f7ec340bSmacallan    struct utsname un;
1405f7ec340bSmacallan
1406f7ec340bSmacallan    uname(&un);
1407f7ec340bSmacallan
1408f7ec340bSmacallan    if (strncmp(un.version, "V2", 2) == 0) {
1409f7ec340bSmacallan	printf ("i386-sequent-ptx2\n"); exit (0);
1410f7ec340bSmacallan    }
1411f7ec340bSmacallan    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1412f7ec340bSmacallan	printf ("i386-sequent-ptx1\n"); exit (0);
1413f7ec340bSmacallan    }
1414f7ec340bSmacallan    printf ("i386-sequent-ptx\n"); exit (0);
1415f7ec340bSmacallan
1416f7ec340bSmacallan#endif
1417f7ec340bSmacallan
1418f7ec340bSmacallan#if defined (vax)
1419f7ec340bSmacallan# if !defined (ultrix)
1420f7ec340bSmacallan#  include <sys/param.h>
1421f7ec340bSmacallan#  if defined (BSD)
1422f7ec340bSmacallan#   if BSD == 43
1423f7ec340bSmacallan      printf ("vax-dec-bsd4.3\n"); exit (0);
1424f7ec340bSmacallan#   else
1425f7ec340bSmacallan#    if BSD == 199006
1426f7ec340bSmacallan      printf ("vax-dec-bsd4.3reno\n"); exit (0);
1427f7ec340bSmacallan#    else
1428f7ec340bSmacallan      printf ("vax-dec-bsd\n"); exit (0);
1429f7ec340bSmacallan#    endif
1430f7ec340bSmacallan#   endif
1431f7ec340bSmacallan#  else
1432f7ec340bSmacallan    printf ("vax-dec-bsd\n"); exit (0);
1433f7ec340bSmacallan#  endif
1434f7ec340bSmacallan# else
1435f7ec340bSmacallan    printf ("vax-dec-ultrix\n"); exit (0);
1436f7ec340bSmacallan# endif
1437f7ec340bSmacallan#endif
1438f7ec340bSmacallan
1439f7ec340bSmacallan#if defined (alliant) && defined (i860)
1440f7ec340bSmacallan  printf ("i860-alliant-bsd\n"); exit (0);
1441f7ec340bSmacallan#endif
1442f7ec340bSmacallan
1443f7ec340bSmacallan  exit (1);
1444f7ec340bSmacallan}
1445f7ec340bSmacallanEOF
1446f7ec340bSmacallan
14477ce7e03cSmrg$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
14487ce7e03cSmrg	{ echo "$SYSTEM_NAME"; exit; }
1449f7ec340bSmacallan
1450f7ec340bSmacallan# Apollos put the system type in the environment.
1451f7ec340bSmacallan
14527ce7e03cSmrgtest -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
1453f7ec340bSmacallan
1454f7ec340bSmacallan# Convex versions that predate uname can use getsysinfo(1)
1455f7ec340bSmacallan
1456f7ec340bSmacallanif [ -x /usr/convex/getsysinfo ]
1457f7ec340bSmacallanthen
1458f7ec340bSmacallan    case `getsysinfo -f cpu_type` in
1459f7ec340bSmacallan    c1*)
1460f7ec340bSmacallan	echo c1-convex-bsd
14617ce7e03cSmrg	exit ;;
1462f7ec340bSmacallan    c2*)
1463f7ec340bSmacallan	if getsysinfo -f scalar_acc
1464f7ec340bSmacallan	then echo c32-convex-bsd
1465f7ec340bSmacallan	else echo c2-convex-bsd
1466f7ec340bSmacallan	fi
14677ce7e03cSmrg	exit ;;
1468f7ec340bSmacallan    c34*)
1469f7ec340bSmacallan	echo c34-convex-bsd
14707ce7e03cSmrg	exit ;;
1471f7ec340bSmacallan    c38*)
1472f7ec340bSmacallan	echo c38-convex-bsd
14737ce7e03cSmrg	exit ;;
1474f7ec340bSmacallan    c4*)
1475f7ec340bSmacallan	echo c4-convex-bsd
14767ce7e03cSmrg	exit ;;
1477f7ec340bSmacallan    esac
1478f7ec340bSmacallanfi
1479f7ec340bSmacallan
1480f7ec340bSmacallancat >&2 <<EOF
1481f7ec340bSmacallan$0: unable to guess system type
1482f7ec340bSmacallan
1483f7ec340bSmacallanThis script, last modified $timestamp, has failed to recognize
1484f7ec340bSmacallanthe operating system you are using. It is advised that you
1485f7ec340bSmacallandownload the most up to date version of the config scripts from
1486f7ec340bSmacallan
14877ce7e03cSmrg  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
14887ce7e03cSmrgand
14897ce7e03cSmrg  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
1490f7ec340bSmacallan
1491f7ec340bSmacallanIf the version you run ($0) is already up to date, please
1492f7ec340bSmacallansend the following data and any information you think might be
1493f7ec340bSmacallanpertinent to <config-patches@gnu.org> in order to provide the needed
1494f7ec340bSmacallaninformation to handle your system.
1495f7ec340bSmacallan
1496f7ec340bSmacallanconfig.guess timestamp = $timestamp
1497f7ec340bSmacallan
1498f7ec340bSmacallanuname -m = `(uname -m) 2>/dev/null || echo unknown`
1499f7ec340bSmacallanuname -r = `(uname -r) 2>/dev/null || echo unknown`
1500f7ec340bSmacallanuname -s = `(uname -s) 2>/dev/null || echo unknown`
1501f7ec340bSmacallanuname -v = `(uname -v) 2>/dev/null || echo unknown`
1502f7ec340bSmacallan
1503f7ec340bSmacallan/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1504f7ec340bSmacallan/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1505f7ec340bSmacallan
1506f7ec340bSmacallanhostinfo               = `(hostinfo) 2>/dev/null`
1507f7ec340bSmacallan/bin/universe          = `(/bin/universe) 2>/dev/null`
1508f7ec340bSmacallan/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1509f7ec340bSmacallan/bin/arch              = `(/bin/arch) 2>/dev/null`
1510f7ec340bSmacallan/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1511f7ec340bSmacallan/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1512f7ec340bSmacallan
1513f7ec340bSmacallanUNAME_MACHINE = ${UNAME_MACHINE}
1514f7ec340bSmacallanUNAME_RELEASE = ${UNAME_RELEASE}
1515f7ec340bSmacallanUNAME_SYSTEM  = ${UNAME_SYSTEM}
1516f7ec340bSmacallanUNAME_VERSION = ${UNAME_VERSION}
1517f7ec340bSmacallanEOF
1518f7ec340bSmacallan
1519f7ec340bSmacallanexit 1
1520f7ec340bSmacallan
1521f7ec340bSmacallan# Local variables:
1522f7ec340bSmacallan# eval: (add-hook 'write-file-hooks 'time-stamp)
1523f7ec340bSmacallan# time-stamp-start: "timestamp='"
1524f7ec340bSmacallan# time-stamp-format: "%:y-%02m-%02d"
1525f7ec340bSmacallan# time-stamp-end: "'"
1526f7ec340bSmacallan# End:
1527