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