xref: /minix3/external/bsd/flex/dist/config.guess (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1357f1050SThomas Veerman#! /bin/sh
2357f1050SThomas Veerman# Attempt to guess a canonical system name.
3357f1050SThomas Veerman#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4*0a6a1f1dSLionel Sambuc#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
5*0a6a1f1dSLionel Sambuc#   2011, 2012 Free Software Foundation, Inc.
6357f1050SThomas Veerman
7*0a6a1f1dSLionel Sambuctimestamp='2012-02-10'
8357f1050SThomas Veerman
9357f1050SThomas Veerman# This file is free software; you can redistribute it and/or modify it
10357f1050SThomas Veerman# under the terms of the GNU General Public License as published by
11357f1050SThomas Veerman# the Free Software Foundation; either version 2 of the License, or
12357f1050SThomas Veerman# (at your option) any later version.
13357f1050SThomas Veerman#
14357f1050SThomas Veerman# This program is distributed in the hope that it will be useful, but
15357f1050SThomas Veerman# WITHOUT ANY WARRANTY; without even the implied warranty of
16357f1050SThomas Veerman# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17357f1050SThomas Veerman# General Public License for more details.
18357f1050SThomas Veerman#
19357f1050SThomas Veerman# You should have received a copy of the GNU General Public License
20*0a6a1f1dSLionel Sambuc# along with this program; if not, see <http://www.gnu.org/licenses/>.
21357f1050SThomas Veerman#
22357f1050SThomas Veerman# As a special exception to the GNU General Public License, if you
23357f1050SThomas Veerman# distribute this file as part of a program that contains a
24357f1050SThomas Veerman# configuration script generated by Autoconf, you may include it under
25357f1050SThomas Veerman# the same distribution terms that you use for the rest of that program.
26357f1050SThomas Veerman
27357f1050SThomas Veerman
28*0a6a1f1dSLionel Sambuc# Originally written by Per Bothner.  Please send patches (context
29*0a6a1f1dSLionel Sambuc# diff format) to <config-patches@gnu.org> and include a ChangeLog
30*0a6a1f1dSLionel Sambuc# entry.
31357f1050SThomas Veerman#
32357f1050SThomas Veerman# This script attempts to guess a canonical system name similar to
33357f1050SThomas Veerman# config.sub.  If it succeeds, it prints the system name on stdout, and
34357f1050SThomas Veerman# exits with 0.  Otherwise, it exits with 1.
35357f1050SThomas Veerman#
36*0a6a1f1dSLionel Sambuc# You can get the latest version of this script from:
37*0a6a1f1dSLionel Sambuc# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
38357f1050SThomas Veerman
39357f1050SThomas Veermanme=`echo "$0" | sed -e 's,.*/,,'`
40357f1050SThomas Veerman
41357f1050SThomas Veermanusage="\
42357f1050SThomas VeermanUsage: $0 [OPTION]
43357f1050SThomas Veerman
44357f1050SThomas VeermanOutput the configuration name of the system \`$me' is run on.
45357f1050SThomas Veerman
46357f1050SThomas VeermanOperation modes:
47357f1050SThomas Veerman  -h, --help         print this help, then exit
48357f1050SThomas Veerman  -t, --time-stamp   print date of last modification, then exit
49357f1050SThomas Veerman  -v, --version      print version number, then exit
50357f1050SThomas Veerman
51357f1050SThomas VeermanReport bugs and patches to <config-patches@gnu.org>."
52357f1050SThomas Veerman
53357f1050SThomas Veermanversion="\
54357f1050SThomas VeermanGNU config.guess ($timestamp)
55357f1050SThomas Veerman
56357f1050SThomas VeermanOriginally written by Per Bothner.
57*0a6a1f1dSLionel SambucCopyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
58*0a6a1f1dSLionel Sambuc2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
59*0a6a1f1dSLionel SambucFree Software Foundation, Inc.
60357f1050SThomas Veerman
61357f1050SThomas VeermanThis is free software; see the source for copying conditions.  There is NO
62357f1050SThomas Veermanwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
63357f1050SThomas Veerman
64357f1050SThomas Veermanhelp="
65357f1050SThomas VeermanTry \`$me --help' for more information."
66357f1050SThomas Veerman
67357f1050SThomas Veerman# Parse command line
68357f1050SThomas Veermanwhile test $# -gt 0 ; do
69357f1050SThomas Veerman  case $1 in
70357f1050SThomas Veerman    --time-stamp | --time* | -t )
71357f1050SThomas Veerman       echo "$timestamp" ; exit ;;
72357f1050SThomas Veerman    --version | -v )
73357f1050SThomas Veerman       echo "$version" ; exit ;;
74357f1050SThomas Veerman    --help | --h* | -h )
75357f1050SThomas Veerman       echo "$usage"; exit ;;
76357f1050SThomas Veerman    -- )     # Stop option processing
77357f1050SThomas Veerman       shift; break ;;
78357f1050SThomas Veerman    - )	# Use stdin as input.
79357f1050SThomas Veerman       break ;;
80357f1050SThomas Veerman    -* )
81357f1050SThomas Veerman       echo "$me: invalid option $1$help" >&2
82357f1050SThomas Veerman       exit 1 ;;
83357f1050SThomas Veerman    * )
84357f1050SThomas Veerman       break ;;
85357f1050SThomas Veerman  esac
86357f1050SThomas Veermandone
87357f1050SThomas Veerman
88357f1050SThomas Veermanif test $# != 0; then
89357f1050SThomas Veerman  echo "$me: too many arguments$help" >&2
90357f1050SThomas Veerman  exit 1
91357f1050SThomas Veermanfi
92357f1050SThomas Veerman
93357f1050SThomas Veermantrap 'exit 1' 1 2 15
94357f1050SThomas Veerman
95357f1050SThomas Veerman# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
96357f1050SThomas Veerman# compiler to aid in system detection is discouraged as it requires
97357f1050SThomas Veerman# temporary files to be created and, as you can see below, it is a
98357f1050SThomas Veerman# headache to deal with in a portable fashion.
99357f1050SThomas Veerman
100357f1050SThomas Veerman# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
101357f1050SThomas Veerman# use `HOST_CC' if defined, but it is deprecated.
102357f1050SThomas Veerman
103357f1050SThomas Veerman# Portable tmp directory creation inspired by the Autoconf team.
104357f1050SThomas Veerman
105357f1050SThomas Veermanset_cc_for_build='
106357f1050SThomas Veermantrap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
107357f1050SThomas Veermantrap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
108357f1050SThomas Veerman: ${TMPDIR=/tmp} ;
10984d9c625SLionel Sambuc { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
110357f1050SThomas Veerman { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
111357f1050SThomas Veerman { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
112357f1050SThomas Veerman { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
113357f1050SThomas Veermandummy=$tmp/dummy ;
114357f1050SThomas Veermantmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
115357f1050SThomas Veermancase $CC_FOR_BUILD,$HOST_CC,$CC in
116357f1050SThomas Veerman ,,)    echo "int x;" > $dummy.c ;
117357f1050SThomas Veerman	for c in cc gcc c89 c99 ; do
118357f1050SThomas Veerman	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
119357f1050SThomas Veerman	     CC_FOR_BUILD="$c"; break ;
120357f1050SThomas Veerman	  fi ;
121357f1050SThomas Veerman	done ;
122357f1050SThomas Veerman	if test x"$CC_FOR_BUILD" = x ; then
123357f1050SThomas Veerman	  CC_FOR_BUILD=no_compiler_found ;
124357f1050SThomas Veerman	fi
125357f1050SThomas Veerman	;;
126357f1050SThomas Veerman ,,*)   CC_FOR_BUILD=$CC ;;
127357f1050SThomas Veerman ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
128357f1050SThomas Veermanesac ; set_cc_for_build= ;'
129357f1050SThomas Veerman
130357f1050SThomas Veerman# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
131357f1050SThomas Veerman# (ghazi@noc.rutgers.edu 1994-08-24)
132357f1050SThomas Veermanif (test -f /.attbin/uname) >/dev/null 2>&1 ; then
133357f1050SThomas Veerman	PATH=$PATH:/.attbin ; export PATH
134357f1050SThomas Veermanfi
135357f1050SThomas Veerman
136357f1050SThomas VeermanUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
137357f1050SThomas VeermanUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
138357f1050SThomas VeermanUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
139357f1050SThomas VeermanUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
140357f1050SThomas Veerman
141357f1050SThomas Veerman# Note: order is significant - the case branches are not exclusive.
142357f1050SThomas Veerman
143357f1050SThomas Veermancase "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
144357f1050SThomas Veerman    *:NetBSD:*:*)
145357f1050SThomas Veerman	# NetBSD (nbsd) targets should (where applicable) match one or
146*0a6a1f1dSLionel Sambuc	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
147357f1050SThomas Veerman	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
148357f1050SThomas Veerman	# switched to ELF, *-*-netbsd* would select the old
149357f1050SThomas Veerman	# object file format.  This provides both forward
150357f1050SThomas Veerman	# compatibility and a consistent mechanism for selecting the
151357f1050SThomas Veerman	# object file format.
152357f1050SThomas Veerman	#
153357f1050SThomas Veerman	# Note: NetBSD doesn't particularly care about the vendor
154357f1050SThomas Veerman	# portion of the name.  We always set it to "unknown".
155357f1050SThomas Veerman	sysctl="sysctl -n hw.machine_arch"
156357f1050SThomas Veerman	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
157357f1050SThomas Veerman	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
158357f1050SThomas Veerman	case "${UNAME_MACHINE_ARCH}" in
159357f1050SThomas Veerman	    armeb) machine=armeb-unknown ;;
160357f1050SThomas Veerman	    arm*) machine=arm-unknown ;;
161357f1050SThomas Veerman	    sh3el) machine=shl-unknown ;;
162357f1050SThomas Veerman	    sh3eb) machine=sh-unknown ;;
16384d9c625SLionel Sambuc	    sh5el) machine=sh5le-unknown ;;
164357f1050SThomas Veerman	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
165357f1050SThomas Veerman	esac
166357f1050SThomas Veerman	# The Operating System including object format, if it has switched
167357f1050SThomas Veerman	# to ELF recently, or will in the future.
168357f1050SThomas Veerman	case "${UNAME_MACHINE_ARCH}" in
169357f1050SThomas Veerman	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
170357f1050SThomas Veerman		eval $set_cc_for_build
171357f1050SThomas Veerman		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
17284d9c625SLionel Sambuc			| grep -q __ELF__
173357f1050SThomas Veerman		then
174357f1050SThomas Veerman		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
175357f1050SThomas Veerman		    # Return netbsd for either.  FIX?
176357f1050SThomas Veerman		    os=netbsd
177357f1050SThomas Veerman		else
178357f1050SThomas Veerman		    os=netbsdelf
179357f1050SThomas Veerman		fi
180357f1050SThomas Veerman		;;
181357f1050SThomas Veerman	    *)
182357f1050SThomas Veerman		os=netbsd
183357f1050SThomas Veerman		;;
184357f1050SThomas Veerman	esac
185357f1050SThomas Veerman	# The OS release
186357f1050SThomas Veerman	# Debian GNU/NetBSD machines have a different userland, and
187357f1050SThomas Veerman	# thus, need a distinct triplet. However, they do not need
188357f1050SThomas Veerman	# kernel version information, so it can be replaced with a
189357f1050SThomas Veerman	# suitable tag, in the style of linux-gnu.
190357f1050SThomas Veerman	case "${UNAME_VERSION}" in
191357f1050SThomas Veerman	    Debian*)
192357f1050SThomas Veerman		release='-gnu'
193357f1050SThomas Veerman		;;
194357f1050SThomas Veerman	    *)
195357f1050SThomas Veerman		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
196357f1050SThomas Veerman		;;
197357f1050SThomas Veerman	esac
198357f1050SThomas Veerman	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
199357f1050SThomas Veerman	# contains redundant information, the shorter form:
200357f1050SThomas Veerman	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
201357f1050SThomas Veerman	echo "${machine}-${os}${release}"
202357f1050SThomas Veerman	exit ;;
203357f1050SThomas Veerman    *:OpenBSD:*:*)
204357f1050SThomas Veerman	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
205357f1050SThomas Veerman	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
206357f1050SThomas Veerman	exit ;;
207357f1050SThomas Veerman    *:ekkoBSD:*:*)
208357f1050SThomas Veerman	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
209357f1050SThomas Veerman	exit ;;
21084d9c625SLionel Sambuc    *:SolidBSD:*:*)
21184d9c625SLionel Sambuc	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
21284d9c625SLionel Sambuc	exit ;;
213357f1050SThomas Veerman    macppc:MirBSD:*:*)
21484d9c625SLionel Sambuc	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
215357f1050SThomas Veerman	exit ;;
216357f1050SThomas Veerman    *:MirBSD:*:*)
217357f1050SThomas Veerman	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
218357f1050SThomas Veerman	exit ;;
219357f1050SThomas Veerman    alpha:OSF1:*:*)
220357f1050SThomas Veerman	case $UNAME_RELEASE in
221357f1050SThomas Veerman	*4.0)
222357f1050SThomas Veerman		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
223357f1050SThomas Veerman		;;
224357f1050SThomas Veerman	*5.*)
225357f1050SThomas Veerman		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
226357f1050SThomas Veerman		;;
227357f1050SThomas Veerman	esac
228357f1050SThomas Veerman	# According to Compaq, /usr/sbin/psrinfo has been available on
229357f1050SThomas Veerman	# OSF/1 and Tru64 systems produced since 1995.  I hope that
230357f1050SThomas Veerman	# covers most systems running today.  This code pipes the CPU
231357f1050SThomas Veerman	# types through head -n 1, so we only detect the type of CPU 0.
232357f1050SThomas Veerman	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
233357f1050SThomas Veerman	case "$ALPHA_CPU_TYPE" in
234357f1050SThomas Veerman	    "EV4 (21064)")
235357f1050SThomas Veerman		UNAME_MACHINE="alpha" ;;
236357f1050SThomas Veerman	    "EV4.5 (21064)")
237357f1050SThomas Veerman		UNAME_MACHINE="alpha" ;;
238357f1050SThomas Veerman	    "LCA4 (21066/21068)")
239357f1050SThomas Veerman		UNAME_MACHINE="alpha" ;;
240357f1050SThomas Veerman	    "EV5 (21164)")
241357f1050SThomas Veerman		UNAME_MACHINE="alphaev5" ;;
242357f1050SThomas Veerman	    "EV5.6 (21164A)")
243357f1050SThomas Veerman		UNAME_MACHINE="alphaev56" ;;
244357f1050SThomas Veerman	    "EV5.6 (21164PC)")
245357f1050SThomas Veerman		UNAME_MACHINE="alphapca56" ;;
246357f1050SThomas Veerman	    "EV5.7 (21164PC)")
247357f1050SThomas Veerman		UNAME_MACHINE="alphapca57" ;;
248357f1050SThomas Veerman	    "EV6 (21264)")
249357f1050SThomas Veerman		UNAME_MACHINE="alphaev6" ;;
250357f1050SThomas Veerman	    "EV6.7 (21264A)")
251357f1050SThomas Veerman		UNAME_MACHINE="alphaev67" ;;
252357f1050SThomas Veerman	    "EV6.8CB (21264C)")
253357f1050SThomas Veerman		UNAME_MACHINE="alphaev68" ;;
254357f1050SThomas Veerman	    "EV6.8AL (21264B)")
255357f1050SThomas Veerman		UNAME_MACHINE="alphaev68" ;;
256357f1050SThomas Veerman	    "EV6.8CX (21264D)")
257357f1050SThomas Veerman		UNAME_MACHINE="alphaev68" ;;
258357f1050SThomas Veerman	    "EV6.9A (21264/EV69A)")
259357f1050SThomas Veerman		UNAME_MACHINE="alphaev69" ;;
260357f1050SThomas Veerman	    "EV7 (21364)")
261357f1050SThomas Veerman		UNAME_MACHINE="alphaev7" ;;
262357f1050SThomas Veerman	    "EV7.9 (21364A)")
263357f1050SThomas Veerman		UNAME_MACHINE="alphaev79" ;;
264357f1050SThomas Veerman	esac
265357f1050SThomas Veerman	# A Pn.n version is a patched version.
266357f1050SThomas Veerman	# A Vn.n version is a released version.
267357f1050SThomas Veerman	# A Tn.n version is a released field test version.
268357f1050SThomas Veerman	# A Xn.n version is an unreleased experimental baselevel.
269357f1050SThomas Veerman	# 1.2 uses "1.2" for uname -r.
270357f1050SThomas Veerman	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
271*0a6a1f1dSLionel Sambuc	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
272*0a6a1f1dSLionel Sambuc	exitcode=$?
273*0a6a1f1dSLionel Sambuc	trap '' 0
274*0a6a1f1dSLionel Sambuc	exit $exitcode ;;
275357f1050SThomas Veerman    Alpha\ *:Windows_NT*:*)
276357f1050SThomas Veerman	# How do we know it's Interix rather than the generic POSIX subsystem?
277357f1050SThomas Veerman	# Should we change UNAME_MACHINE based on the output of uname instead
278357f1050SThomas Veerman	# of the specific Alpha model?
279357f1050SThomas Veerman	echo alpha-pc-interix
280357f1050SThomas Veerman	exit ;;
281357f1050SThomas Veerman    21064:Windows_NT:50:3)
282357f1050SThomas Veerman	echo alpha-dec-winnt3.5
283357f1050SThomas Veerman	exit ;;
284357f1050SThomas Veerman    Amiga*:UNIX_System_V:4.0:*)
285357f1050SThomas Veerman	echo m68k-unknown-sysv4
286357f1050SThomas Veerman	exit ;;
287357f1050SThomas Veerman    *:[Aa]miga[Oo][Ss]:*:*)
288357f1050SThomas Veerman	echo ${UNAME_MACHINE}-unknown-amigaos
289357f1050SThomas Veerman	exit ;;
290357f1050SThomas Veerman    *:[Mm]orph[Oo][Ss]:*:*)
291357f1050SThomas Veerman	echo ${UNAME_MACHINE}-unknown-morphos
292357f1050SThomas Veerman	exit ;;
293357f1050SThomas Veerman    *:OS/390:*:*)
294357f1050SThomas Veerman	echo i370-ibm-openedition
295357f1050SThomas Veerman	exit ;;
296357f1050SThomas Veerman    *:z/VM:*:*)
297357f1050SThomas Veerman	echo s390-ibm-zvmoe
298357f1050SThomas Veerman	exit ;;
299357f1050SThomas Veerman    *:OS400:*:*)
300357f1050SThomas Veerman	echo powerpc-ibm-os400
301357f1050SThomas Veerman	exit ;;
302357f1050SThomas Veerman    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
303357f1050SThomas Veerman	echo arm-acorn-riscix${UNAME_RELEASE}
304357f1050SThomas Veerman	exit ;;
305357f1050SThomas Veerman    arm:riscos:*:*|arm:RISCOS:*:*)
306357f1050SThomas Veerman	echo arm-unknown-riscos
307357f1050SThomas Veerman	exit ;;
308357f1050SThomas Veerman    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
309357f1050SThomas Veerman	echo hppa1.1-hitachi-hiuxmpp
310357f1050SThomas Veerman	exit ;;
311357f1050SThomas Veerman    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
312357f1050SThomas Veerman	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
313357f1050SThomas Veerman	if test "`(/bin/universe) 2>/dev/null`" = att ; then
314357f1050SThomas Veerman		echo pyramid-pyramid-sysv3
315357f1050SThomas Veerman	else
316357f1050SThomas Veerman		echo pyramid-pyramid-bsd
317357f1050SThomas Veerman	fi
318357f1050SThomas Veerman	exit ;;
319357f1050SThomas Veerman    NILE*:*:*:dcosx)
320357f1050SThomas Veerman	echo pyramid-pyramid-svr4
321357f1050SThomas Veerman	exit ;;
322357f1050SThomas Veerman    DRS?6000:unix:4.0:6*)
323357f1050SThomas Veerman	echo sparc-icl-nx6
324357f1050SThomas Veerman	exit ;;
325357f1050SThomas Veerman    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
326357f1050SThomas Veerman	case `/usr/bin/uname -p` in
327357f1050SThomas Veerman	    sparc) echo sparc-icl-nx7; exit ;;
328357f1050SThomas Veerman	esac ;;
32984d9c625SLionel Sambuc    s390x:SunOS:*:*)
33084d9c625SLionel Sambuc	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
33184d9c625SLionel Sambuc	exit ;;
332357f1050SThomas Veerman    sun4H:SunOS:5.*:*)
333357f1050SThomas Veerman	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
334357f1050SThomas Veerman	exit ;;
335357f1050SThomas Veerman    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
336357f1050SThomas Veerman	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
337357f1050SThomas Veerman	exit ;;
338*0a6a1f1dSLionel Sambuc    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
339*0a6a1f1dSLionel Sambuc	echo i386-pc-auroraux${UNAME_RELEASE}
340*0a6a1f1dSLionel Sambuc	exit ;;
34184d9c625SLionel Sambuc    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
34284d9c625SLionel Sambuc	eval $set_cc_for_build
34384d9c625SLionel Sambuc	SUN_ARCH="i386"
34484d9c625SLionel Sambuc	# If there is a compiler, see if it is configured for 64-bit objects.
34584d9c625SLionel Sambuc	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
34684d9c625SLionel Sambuc	# This test works for both compilers.
34784d9c625SLionel Sambuc	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
34884d9c625SLionel Sambuc	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
34984d9c625SLionel Sambuc		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
35084d9c625SLionel Sambuc		grep IS_64BIT_ARCH >/dev/null
35184d9c625SLionel Sambuc	    then
35284d9c625SLionel Sambuc		SUN_ARCH="x86_64"
35384d9c625SLionel Sambuc	    fi
35484d9c625SLionel Sambuc	fi
35584d9c625SLionel Sambuc	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
356357f1050SThomas Veerman	exit ;;
357357f1050SThomas Veerman    sun4*:SunOS:6*:*)
358357f1050SThomas Veerman	# According to config.sub, this is the proper way to canonicalize
359357f1050SThomas Veerman	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
360357f1050SThomas Veerman	# it's likely to be more like Solaris than SunOS4.
361357f1050SThomas Veerman	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
362357f1050SThomas Veerman	exit ;;
363357f1050SThomas Veerman    sun4*:SunOS:*:*)
364357f1050SThomas Veerman	case "`/usr/bin/arch -k`" in
365357f1050SThomas Veerman	    Series*|S4*)
366357f1050SThomas Veerman		UNAME_RELEASE=`uname -v`
367357f1050SThomas Veerman		;;
368357f1050SThomas Veerman	esac
369357f1050SThomas Veerman	# Japanese Language versions have a version number like `4.1.3-JL'.
370357f1050SThomas Veerman	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
371357f1050SThomas Veerman	exit ;;
372357f1050SThomas Veerman    sun3*:SunOS:*:*)
373357f1050SThomas Veerman	echo m68k-sun-sunos${UNAME_RELEASE}
374357f1050SThomas Veerman	exit ;;
375357f1050SThomas Veerman    sun*:*:4.2BSD:*)
376357f1050SThomas Veerman	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
377357f1050SThomas Veerman	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
378357f1050SThomas Veerman	case "`/bin/arch`" in
379357f1050SThomas Veerman	    sun3)
380357f1050SThomas Veerman		echo m68k-sun-sunos${UNAME_RELEASE}
381357f1050SThomas Veerman		;;
382357f1050SThomas Veerman	    sun4)
383357f1050SThomas Veerman		echo sparc-sun-sunos${UNAME_RELEASE}
384357f1050SThomas Veerman		;;
385357f1050SThomas Veerman	esac
386357f1050SThomas Veerman	exit ;;
387357f1050SThomas Veerman    aushp:SunOS:*:*)
388357f1050SThomas Veerman	echo sparc-auspex-sunos${UNAME_RELEASE}
389357f1050SThomas Veerman	exit ;;
390357f1050SThomas Veerman    # The situation for MiNT is a little confusing.  The machine name
391357f1050SThomas Veerman    # can be virtually everything (everything which is not
392357f1050SThomas Veerman    # "atarist" or "atariste" at least should have a processor
393357f1050SThomas Veerman    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
394357f1050SThomas Veerman    # to the lowercase version "mint" (or "freemint").  Finally
395357f1050SThomas Veerman    # the system name "TOS" denotes a system which is actually not
396357f1050SThomas Veerman    # MiNT.  But MiNT is downward compatible to TOS, so this should
397357f1050SThomas Veerman    # be no problem.
398357f1050SThomas Veerman    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
399357f1050SThomas Veerman	echo m68k-atari-mint${UNAME_RELEASE}
400357f1050SThomas Veerman	exit ;;
401357f1050SThomas Veerman    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
402357f1050SThomas Veerman	echo m68k-atari-mint${UNAME_RELEASE}
403357f1050SThomas Veerman	exit ;;
404357f1050SThomas Veerman    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
405357f1050SThomas Veerman	echo m68k-atari-mint${UNAME_RELEASE}
406357f1050SThomas Veerman	exit ;;
407357f1050SThomas Veerman    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
408357f1050SThomas Veerman	echo m68k-milan-mint${UNAME_RELEASE}
409357f1050SThomas Veerman	exit ;;
410357f1050SThomas Veerman    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
411357f1050SThomas Veerman	echo m68k-hades-mint${UNAME_RELEASE}
412357f1050SThomas Veerman	exit ;;
413357f1050SThomas Veerman    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
414357f1050SThomas Veerman	echo m68k-unknown-mint${UNAME_RELEASE}
415357f1050SThomas Veerman	exit ;;
416357f1050SThomas Veerman    m68k:machten:*:*)
417357f1050SThomas Veerman	echo m68k-apple-machten${UNAME_RELEASE}
418357f1050SThomas Veerman	exit ;;
419357f1050SThomas Veerman    powerpc:machten:*:*)
420357f1050SThomas Veerman	echo powerpc-apple-machten${UNAME_RELEASE}
421357f1050SThomas Veerman	exit ;;
422357f1050SThomas Veerman    RISC*:Mach:*:*)
423357f1050SThomas Veerman	echo mips-dec-mach_bsd4.3
424357f1050SThomas Veerman	exit ;;
425357f1050SThomas Veerman    RISC*:ULTRIX:*:*)
426357f1050SThomas Veerman	echo mips-dec-ultrix${UNAME_RELEASE}
427357f1050SThomas Veerman	exit ;;
428357f1050SThomas Veerman    VAX*:ULTRIX*:*:*)
429357f1050SThomas Veerman	echo vax-dec-ultrix${UNAME_RELEASE}
430357f1050SThomas Veerman	exit ;;
431357f1050SThomas Veerman    2020:CLIX:*:* | 2430:CLIX:*:*)
432357f1050SThomas Veerman	echo clipper-intergraph-clix${UNAME_RELEASE}
433357f1050SThomas Veerman	exit ;;
434357f1050SThomas Veerman    mips:*:*:UMIPS | mips:*:*:RISCos)
435357f1050SThomas Veerman	eval $set_cc_for_build
436357f1050SThomas Veerman	sed 's/^	//' << EOF >$dummy.c
437357f1050SThomas Veerman#ifdef __cplusplus
438357f1050SThomas Veerman#include <stdio.h>  /* for printf() prototype */
439357f1050SThomas Veerman	int main (int argc, char *argv[]) {
440357f1050SThomas Veerman#else
441357f1050SThomas Veerman	int main (argc, argv) int argc; char *argv[]; {
442357f1050SThomas Veerman#endif
443357f1050SThomas Veerman	#if defined (host_mips) && defined (MIPSEB)
444357f1050SThomas Veerman	#if defined (SYSTYPE_SYSV)
445357f1050SThomas Veerman	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
446357f1050SThomas Veerman	#endif
447357f1050SThomas Veerman	#if defined (SYSTYPE_SVR4)
448357f1050SThomas Veerman	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
449357f1050SThomas Veerman	#endif
450357f1050SThomas Veerman	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
451357f1050SThomas Veerman	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
452357f1050SThomas Veerman	#endif
453357f1050SThomas Veerman	#endif
454357f1050SThomas Veerman	  exit (-1);
455357f1050SThomas Veerman	}
456357f1050SThomas VeermanEOF
457357f1050SThomas Veerman	$CC_FOR_BUILD -o $dummy $dummy.c &&
458357f1050SThomas Veerman	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
459357f1050SThomas Veerman	  SYSTEM_NAME=`$dummy $dummyarg` &&
460357f1050SThomas Veerman	    { echo "$SYSTEM_NAME"; exit; }
461357f1050SThomas Veerman	echo mips-mips-riscos${UNAME_RELEASE}
462357f1050SThomas Veerman	exit ;;
463357f1050SThomas Veerman    Motorola:PowerMAX_OS:*:*)
464357f1050SThomas Veerman	echo powerpc-motorola-powermax
465357f1050SThomas Veerman	exit ;;
466357f1050SThomas Veerman    Motorola:*:4.3:PL8-*)
467357f1050SThomas Veerman	echo powerpc-harris-powermax
468357f1050SThomas Veerman	exit ;;
469357f1050SThomas Veerman    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
470357f1050SThomas Veerman	echo powerpc-harris-powermax
471357f1050SThomas Veerman	exit ;;
472357f1050SThomas Veerman    Night_Hawk:Power_UNIX:*:*)
473357f1050SThomas Veerman	echo powerpc-harris-powerunix
474357f1050SThomas Veerman	exit ;;
475357f1050SThomas Veerman    m88k:CX/UX:7*:*)
476357f1050SThomas Veerman	echo m88k-harris-cxux7
477357f1050SThomas Veerman	exit ;;
478357f1050SThomas Veerman    m88k:*:4*:R4*)
479357f1050SThomas Veerman	echo m88k-motorola-sysv4
480357f1050SThomas Veerman	exit ;;
481357f1050SThomas Veerman    m88k:*:3*:R3*)
482357f1050SThomas Veerman	echo m88k-motorola-sysv3
483357f1050SThomas Veerman	exit ;;
484357f1050SThomas Veerman    AViiON:dgux:*:*)
485357f1050SThomas Veerman	# DG/UX returns AViiON for all architectures
486357f1050SThomas Veerman	UNAME_PROCESSOR=`/usr/bin/uname -p`
487357f1050SThomas Veerman	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
488357f1050SThomas Veerman	then
489357f1050SThomas Veerman	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
490357f1050SThomas Veerman	       [ ${TARGET_BINARY_INTERFACE}x = x ]
491357f1050SThomas Veerman	    then
492357f1050SThomas Veerman		echo m88k-dg-dgux${UNAME_RELEASE}
493357f1050SThomas Veerman	    else
494357f1050SThomas Veerman		echo m88k-dg-dguxbcs${UNAME_RELEASE}
495357f1050SThomas Veerman	    fi
496357f1050SThomas Veerman	else
497357f1050SThomas Veerman	    echo i586-dg-dgux${UNAME_RELEASE}
498357f1050SThomas Veerman	fi
499357f1050SThomas Veerman	exit ;;
500357f1050SThomas Veerman    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
501357f1050SThomas Veerman	echo m88k-dolphin-sysv3
502357f1050SThomas Veerman	exit ;;
503357f1050SThomas Veerman    M88*:*:R3*:*)
504357f1050SThomas Veerman	# Delta 88k system running SVR3
505357f1050SThomas Veerman	echo m88k-motorola-sysv3
506357f1050SThomas Veerman	exit ;;
507357f1050SThomas Veerman    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
508357f1050SThomas Veerman	echo m88k-tektronix-sysv3
509357f1050SThomas Veerman	exit ;;
510357f1050SThomas Veerman    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
511357f1050SThomas Veerman	echo m68k-tektronix-bsd
512357f1050SThomas Veerman	exit ;;
513357f1050SThomas Veerman    *:IRIX*:*:*)
514357f1050SThomas Veerman	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
515357f1050SThomas Veerman	exit ;;
516357f1050SThomas Veerman    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
517357f1050SThomas Veerman	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
518357f1050SThomas Veerman	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
519357f1050SThomas Veerman    i*86:AIX:*:*)
520357f1050SThomas Veerman	echo i386-ibm-aix
521357f1050SThomas Veerman	exit ;;
522357f1050SThomas Veerman    ia64:AIX:*:*)
523357f1050SThomas Veerman	if [ -x /usr/bin/oslevel ] ; then
524357f1050SThomas Veerman		IBM_REV=`/usr/bin/oslevel`
525357f1050SThomas Veerman	else
526357f1050SThomas Veerman		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
527357f1050SThomas Veerman	fi
528357f1050SThomas Veerman	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
529357f1050SThomas Veerman	exit ;;
530357f1050SThomas Veerman    *:AIX:2:3)
531357f1050SThomas Veerman	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
532357f1050SThomas Veerman		eval $set_cc_for_build
533357f1050SThomas Veerman		sed 's/^		//' << EOF >$dummy.c
534357f1050SThomas Veerman		#include <sys/systemcfg.h>
535357f1050SThomas Veerman
536357f1050SThomas Veerman		main()
537357f1050SThomas Veerman			{
538357f1050SThomas Veerman			if (!__power_pc())
539357f1050SThomas Veerman				exit(1);
540357f1050SThomas Veerman			puts("powerpc-ibm-aix3.2.5");
541357f1050SThomas Veerman			exit(0);
542357f1050SThomas Veerman			}
543357f1050SThomas VeermanEOF
544357f1050SThomas Veerman		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
545357f1050SThomas Veerman		then
546357f1050SThomas Veerman			echo "$SYSTEM_NAME"
547357f1050SThomas Veerman		else
548357f1050SThomas Veerman			echo rs6000-ibm-aix3.2.5
549357f1050SThomas Veerman		fi
550357f1050SThomas Veerman	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
551357f1050SThomas Veerman		echo rs6000-ibm-aix3.2.4
552357f1050SThomas Veerman	else
553357f1050SThomas Veerman		echo rs6000-ibm-aix3.2
554357f1050SThomas Veerman	fi
555357f1050SThomas Veerman	exit ;;
556*0a6a1f1dSLionel Sambuc    *:AIX:*:[4567])
557357f1050SThomas Veerman	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
558357f1050SThomas Veerman	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
559357f1050SThomas Veerman		IBM_ARCH=rs6000
560357f1050SThomas Veerman	else
561357f1050SThomas Veerman		IBM_ARCH=powerpc
562357f1050SThomas Veerman	fi
563357f1050SThomas Veerman	if [ -x /usr/bin/oslevel ] ; then
564357f1050SThomas Veerman		IBM_REV=`/usr/bin/oslevel`
565357f1050SThomas Veerman	else
566357f1050SThomas Veerman		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
567357f1050SThomas Veerman	fi
568357f1050SThomas Veerman	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
569357f1050SThomas Veerman	exit ;;
570357f1050SThomas Veerman    *:AIX:*:*)
571357f1050SThomas Veerman	echo rs6000-ibm-aix
572357f1050SThomas Veerman	exit ;;
573357f1050SThomas Veerman    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
574357f1050SThomas Veerman	echo romp-ibm-bsd4.4
575357f1050SThomas Veerman	exit ;;
576357f1050SThomas Veerman    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
577357f1050SThomas Veerman	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
578357f1050SThomas Veerman	exit ;;                             # report: romp-ibm BSD 4.3
579357f1050SThomas Veerman    *:BOSX:*:*)
580357f1050SThomas Veerman	echo rs6000-bull-bosx
581357f1050SThomas Veerman	exit ;;
582357f1050SThomas Veerman    DPX/2?00:B.O.S.:*:*)
583357f1050SThomas Veerman	echo m68k-bull-sysv3
584357f1050SThomas Veerman	exit ;;
585357f1050SThomas Veerman    9000/[34]??:4.3bsd:1.*:*)
586357f1050SThomas Veerman	echo m68k-hp-bsd
587357f1050SThomas Veerman	exit ;;
588357f1050SThomas Veerman    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
589357f1050SThomas Veerman	echo m68k-hp-bsd4.4
590357f1050SThomas Veerman	exit ;;
591357f1050SThomas Veerman    9000/[34678]??:HP-UX:*:*)
592357f1050SThomas Veerman	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
593357f1050SThomas Veerman	case "${UNAME_MACHINE}" in
594357f1050SThomas Veerman	    9000/31? )            HP_ARCH=m68000 ;;
595357f1050SThomas Veerman	    9000/[34]?? )         HP_ARCH=m68k ;;
596357f1050SThomas Veerman	    9000/[678][0-9][0-9])
597357f1050SThomas Veerman		if [ -x /usr/bin/getconf ]; then
598357f1050SThomas Veerman		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
599357f1050SThomas Veerman		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
600357f1050SThomas Veerman		    case "${sc_cpu_version}" in
601357f1050SThomas Veerman		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
602357f1050SThomas Veerman		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
603357f1050SThomas Veerman		      532)                      # CPU_PA_RISC2_0
604357f1050SThomas Veerman			case "${sc_kernel_bits}" in
605357f1050SThomas Veerman			  32) HP_ARCH="hppa2.0n" ;;
606357f1050SThomas Veerman			  64) HP_ARCH="hppa2.0w" ;;
607357f1050SThomas Veerman			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
608357f1050SThomas Veerman			esac ;;
609357f1050SThomas Veerman		    esac
610357f1050SThomas Veerman		fi
611357f1050SThomas Veerman		if [ "${HP_ARCH}" = "" ]; then
612357f1050SThomas Veerman		    eval $set_cc_for_build
613357f1050SThomas Veerman		    sed 's/^		//' << EOF >$dummy.c
614357f1050SThomas Veerman
615357f1050SThomas Veerman		#define _HPUX_SOURCE
616357f1050SThomas Veerman		#include <stdlib.h>
617357f1050SThomas Veerman		#include <unistd.h>
618357f1050SThomas Veerman
619357f1050SThomas Veerman		int main ()
620357f1050SThomas Veerman		{
621357f1050SThomas Veerman		#if defined(_SC_KERNEL_BITS)
622357f1050SThomas Veerman		    long bits = sysconf(_SC_KERNEL_BITS);
623357f1050SThomas Veerman		#endif
624357f1050SThomas Veerman		    long cpu  = sysconf (_SC_CPU_VERSION);
625357f1050SThomas Veerman
626357f1050SThomas Veerman		    switch (cpu)
627357f1050SThomas Veerman			{
628357f1050SThomas Veerman			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
629357f1050SThomas Veerman			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
630357f1050SThomas Veerman			case CPU_PA_RISC2_0:
631357f1050SThomas Veerman		#if defined(_SC_KERNEL_BITS)
632357f1050SThomas Veerman			    switch (bits)
633357f1050SThomas Veerman				{
634357f1050SThomas Veerman				case 64: puts ("hppa2.0w"); break;
635357f1050SThomas Veerman				case 32: puts ("hppa2.0n"); break;
636357f1050SThomas Veerman				default: puts ("hppa2.0"); break;
637357f1050SThomas Veerman				} break;
638357f1050SThomas Veerman		#else  /* !defined(_SC_KERNEL_BITS) */
639357f1050SThomas Veerman			    puts ("hppa2.0"); break;
640357f1050SThomas Veerman		#endif
641357f1050SThomas Veerman			default: puts ("hppa1.0"); break;
642357f1050SThomas Veerman			}
643357f1050SThomas Veerman		    exit (0);
644357f1050SThomas Veerman		}
645357f1050SThomas VeermanEOF
646357f1050SThomas Veerman		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
647357f1050SThomas Veerman		    test -z "$HP_ARCH" && HP_ARCH=hppa
648357f1050SThomas Veerman		fi ;;
649357f1050SThomas Veerman	esac
650357f1050SThomas Veerman	if [ ${HP_ARCH} = "hppa2.0w" ]
651357f1050SThomas Veerman	then
652357f1050SThomas Veerman	    eval $set_cc_for_build
653357f1050SThomas Veerman
654357f1050SThomas Veerman	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
655357f1050SThomas Veerman	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
656357f1050SThomas Veerman	    # generating 64-bit code.  GNU and HP use different nomenclature:
657357f1050SThomas Veerman	    #
658357f1050SThomas Veerman	    # $ CC_FOR_BUILD=cc ./config.guess
659357f1050SThomas Veerman	    # => hppa2.0w-hp-hpux11.23
660357f1050SThomas Veerman	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
661357f1050SThomas Veerman	    # => hppa64-hp-hpux11.23
662357f1050SThomas Veerman
663357f1050SThomas Veerman	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
66484d9c625SLionel Sambuc		grep -q __LP64__
665357f1050SThomas Veerman	    then
666357f1050SThomas Veerman		HP_ARCH="hppa2.0w"
667357f1050SThomas Veerman	    else
668357f1050SThomas Veerman		HP_ARCH="hppa64"
669357f1050SThomas Veerman	    fi
670357f1050SThomas Veerman	fi
671357f1050SThomas Veerman	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
672357f1050SThomas Veerman	exit ;;
673357f1050SThomas Veerman    ia64:HP-UX:*:*)
674357f1050SThomas Veerman	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
675357f1050SThomas Veerman	echo ia64-hp-hpux${HPUX_REV}
676357f1050SThomas Veerman	exit ;;
677357f1050SThomas Veerman    3050*:HI-UX:*:*)
678357f1050SThomas Veerman	eval $set_cc_for_build
679357f1050SThomas Veerman	sed 's/^	//' << EOF >$dummy.c
680357f1050SThomas Veerman	#include <unistd.h>
681357f1050SThomas Veerman	int
682357f1050SThomas Veerman	main ()
683357f1050SThomas Veerman	{
684357f1050SThomas Veerman	  long cpu = sysconf (_SC_CPU_VERSION);
685357f1050SThomas Veerman	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
686357f1050SThomas Veerman	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
687357f1050SThomas Veerman	     results, however.  */
688357f1050SThomas Veerman	  if (CPU_IS_PA_RISC (cpu))
689357f1050SThomas Veerman	    {
690357f1050SThomas Veerman	      switch (cpu)
691357f1050SThomas Veerman		{
692357f1050SThomas Veerman		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
693357f1050SThomas Veerman		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
694357f1050SThomas Veerman		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
695357f1050SThomas Veerman		  default: puts ("hppa-hitachi-hiuxwe2"); break;
696357f1050SThomas Veerman		}
697357f1050SThomas Veerman	    }
698357f1050SThomas Veerman	  else if (CPU_IS_HP_MC68K (cpu))
699357f1050SThomas Veerman	    puts ("m68k-hitachi-hiuxwe2");
700357f1050SThomas Veerman	  else puts ("unknown-hitachi-hiuxwe2");
701357f1050SThomas Veerman	  exit (0);
702357f1050SThomas Veerman	}
703357f1050SThomas VeermanEOF
704357f1050SThomas Veerman	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
705357f1050SThomas Veerman		{ echo "$SYSTEM_NAME"; exit; }
706357f1050SThomas Veerman	echo unknown-hitachi-hiuxwe2
707357f1050SThomas Veerman	exit ;;
708357f1050SThomas Veerman    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
709357f1050SThomas Veerman	echo hppa1.1-hp-bsd
710357f1050SThomas Veerman	exit ;;
711357f1050SThomas Veerman    9000/8??:4.3bsd:*:*)
712357f1050SThomas Veerman	echo hppa1.0-hp-bsd
713357f1050SThomas Veerman	exit ;;
714357f1050SThomas Veerman    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
715357f1050SThomas Veerman	echo hppa1.0-hp-mpeix
716357f1050SThomas Veerman	exit ;;
717357f1050SThomas Veerman    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
718357f1050SThomas Veerman	echo hppa1.1-hp-osf
719357f1050SThomas Veerman	exit ;;
720357f1050SThomas Veerman    hp8??:OSF1:*:*)
721357f1050SThomas Veerman	echo hppa1.0-hp-osf
722357f1050SThomas Veerman	exit ;;
723357f1050SThomas Veerman    i*86:OSF1:*:*)
724357f1050SThomas Veerman	if [ -x /usr/sbin/sysversion ] ; then
725357f1050SThomas Veerman	    echo ${UNAME_MACHINE}-unknown-osf1mk
726357f1050SThomas Veerman	else
727357f1050SThomas Veerman	    echo ${UNAME_MACHINE}-unknown-osf1
728357f1050SThomas Veerman	fi
729357f1050SThomas Veerman	exit ;;
730357f1050SThomas Veerman    parisc*:Lites*:*:*)
731357f1050SThomas Veerman	echo hppa1.1-hp-lites
732357f1050SThomas Veerman	exit ;;
733357f1050SThomas Veerman    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
734357f1050SThomas Veerman	echo c1-convex-bsd
735357f1050SThomas Veerman	exit ;;
736357f1050SThomas Veerman    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
737357f1050SThomas Veerman	if getsysinfo -f scalar_acc
738357f1050SThomas Veerman	then echo c32-convex-bsd
739357f1050SThomas Veerman	else echo c2-convex-bsd
740357f1050SThomas Veerman	fi
741357f1050SThomas Veerman	exit ;;
742357f1050SThomas Veerman    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
743357f1050SThomas Veerman	echo c34-convex-bsd
744357f1050SThomas Veerman	exit ;;
745357f1050SThomas Veerman    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
746357f1050SThomas Veerman	echo c38-convex-bsd
747357f1050SThomas Veerman	exit ;;
748357f1050SThomas Veerman    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
749357f1050SThomas Veerman	echo c4-convex-bsd
750357f1050SThomas Veerman	exit ;;
751357f1050SThomas Veerman    CRAY*Y-MP:*:*:*)
752357f1050SThomas Veerman	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
753357f1050SThomas Veerman	exit ;;
754357f1050SThomas Veerman    CRAY*[A-Z]90:*:*:*)
755357f1050SThomas Veerman	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
756357f1050SThomas Veerman	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
757357f1050SThomas Veerman	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
758357f1050SThomas Veerman	      -e 's/\.[^.]*$/.X/'
759357f1050SThomas Veerman	exit ;;
760357f1050SThomas Veerman    CRAY*TS:*:*:*)
761357f1050SThomas Veerman	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
762357f1050SThomas Veerman	exit ;;
763357f1050SThomas Veerman    CRAY*T3E:*:*:*)
764357f1050SThomas Veerman	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
765357f1050SThomas Veerman	exit ;;
766357f1050SThomas Veerman    CRAY*SV1:*:*:*)
767357f1050SThomas Veerman	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
768357f1050SThomas Veerman	exit ;;
769357f1050SThomas Veerman    *:UNICOS/mp:*:*)
770357f1050SThomas Veerman	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
771357f1050SThomas Veerman	exit ;;
772357f1050SThomas Veerman    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
773357f1050SThomas Veerman	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
774357f1050SThomas Veerman	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
775357f1050SThomas Veerman	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
776357f1050SThomas Veerman	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
777357f1050SThomas Veerman	exit ;;
778357f1050SThomas Veerman    5000:UNIX_System_V:4.*:*)
779357f1050SThomas Veerman	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
780357f1050SThomas Veerman	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
781357f1050SThomas Veerman	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
782357f1050SThomas Veerman	exit ;;
783357f1050SThomas Veerman    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
784357f1050SThomas Veerman	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
785357f1050SThomas Veerman	exit ;;
786357f1050SThomas Veerman    sparc*:BSD/OS:*:*)
787357f1050SThomas Veerman	echo sparc-unknown-bsdi${UNAME_RELEASE}
788357f1050SThomas Veerman	exit ;;
789357f1050SThomas Veerman    *:BSD/OS:*:*)
790357f1050SThomas Veerman	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
791357f1050SThomas Veerman	exit ;;
792357f1050SThomas Veerman    *:FreeBSD:*:*)
793*0a6a1f1dSLionel Sambuc	UNAME_PROCESSOR=`/usr/bin/uname -p`
794*0a6a1f1dSLionel Sambuc	case ${UNAME_PROCESSOR} in
79584d9c625SLionel Sambuc	    amd64)
79684d9c625SLionel Sambuc		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
79784d9c625SLionel Sambuc	    *)
798*0a6a1f1dSLionel Sambuc		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
79984d9c625SLionel Sambuc	esac
800357f1050SThomas Veerman	exit ;;
801357f1050SThomas Veerman    i*:CYGWIN*:*)
802357f1050SThomas Veerman	echo ${UNAME_MACHINE}-pc-cygwin
803357f1050SThomas Veerman	exit ;;
80484d9c625SLionel Sambuc    *:MINGW*:*)
805357f1050SThomas Veerman	echo ${UNAME_MACHINE}-pc-mingw32
806357f1050SThomas Veerman	exit ;;
807*0a6a1f1dSLionel Sambuc    i*:MSYS*:*)
808*0a6a1f1dSLionel Sambuc	echo ${UNAME_MACHINE}-pc-msys
809*0a6a1f1dSLionel Sambuc	exit ;;
810357f1050SThomas Veerman    i*:windows32*:*)
811357f1050SThomas Veerman	# uname -m includes "-pc" on this system.
812357f1050SThomas Veerman	echo ${UNAME_MACHINE}-mingw32
813357f1050SThomas Veerman	exit ;;
814357f1050SThomas Veerman    i*:PW*:*)
815357f1050SThomas Veerman	echo ${UNAME_MACHINE}-pc-pw32
816357f1050SThomas Veerman	exit ;;
817*0a6a1f1dSLionel Sambuc    *:Interix*:*)
81884d9c625SLionel Sambuc	case ${UNAME_MACHINE} in
81984d9c625SLionel Sambuc	    x86)
82084d9c625SLionel Sambuc		echo i586-pc-interix${UNAME_RELEASE}
821357f1050SThomas Veerman		exit ;;
822*0a6a1f1dSLionel Sambuc	    authenticamd | genuineintel | EM64T)
82384d9c625SLionel Sambuc		echo x86_64-unknown-interix${UNAME_RELEASE}
82484d9c625SLionel Sambuc		exit ;;
82584d9c625SLionel Sambuc	    IA64)
82684d9c625SLionel Sambuc		echo ia64-unknown-interix${UNAME_RELEASE}
82784d9c625SLionel Sambuc		exit ;;
82884d9c625SLionel Sambuc	esac ;;
829357f1050SThomas Veerman    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
830357f1050SThomas Veerman	echo i${UNAME_MACHINE}-pc-mks
831357f1050SThomas Veerman	exit ;;
83284d9c625SLionel Sambuc    8664:Windows_NT:*)
83384d9c625SLionel Sambuc	echo x86_64-pc-mks
83484d9c625SLionel Sambuc	exit ;;
835357f1050SThomas Veerman    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
836357f1050SThomas Veerman	# How do we know it's Interix rather than the generic POSIX subsystem?
837357f1050SThomas Veerman	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
838357f1050SThomas Veerman	# UNAME_MACHINE based on the output of uname instead of i386?
839357f1050SThomas Veerman	echo i586-pc-interix
840357f1050SThomas Veerman	exit ;;
841357f1050SThomas Veerman    i*:UWIN*:*)
842357f1050SThomas Veerman	echo ${UNAME_MACHINE}-pc-uwin
843357f1050SThomas Veerman	exit ;;
844357f1050SThomas Veerman    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
845357f1050SThomas Veerman	echo x86_64-unknown-cygwin
846357f1050SThomas Veerman	exit ;;
847357f1050SThomas Veerman    p*:CYGWIN*:*)
848357f1050SThomas Veerman	echo powerpcle-unknown-cygwin
849357f1050SThomas Veerman	exit ;;
850357f1050SThomas Veerman    prep*:SunOS:5.*:*)
851357f1050SThomas Veerman	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
852357f1050SThomas Veerman	exit ;;
853357f1050SThomas Veerman    *:GNU:*:*)
854357f1050SThomas Veerman	# the GNU system
855357f1050SThomas Veerman	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
856357f1050SThomas Veerman	exit ;;
857357f1050SThomas Veerman    *:GNU/*:*:*)
858357f1050SThomas Veerman	# other systems with GNU libc and userland
859357f1050SThomas Veerman	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
860357f1050SThomas Veerman	exit ;;
861*0a6a1f1dSLionel Sambuc    *:Minix:*:*)
86284d9c625SLionel Sambuc	echo ${UNAME_MACHINE}-elf32-minix # MINIX, LSC, Should help a bit
863357f1050SThomas Veerman	exit ;;
864*0a6a1f1dSLionel Sambuc    aarch64:Linux:*:*)
865*0a6a1f1dSLionel Sambuc	echo ${UNAME_MACHINE}-unknown-linux-gnu
866*0a6a1f1dSLionel Sambuc	exit ;;
867*0a6a1f1dSLionel Sambuc    aarch64_be:Linux:*:*)
868*0a6a1f1dSLionel Sambuc	UNAME_MACHINE=aarch64_be
869*0a6a1f1dSLionel Sambuc	echo ${UNAME_MACHINE}-unknown-linux-gnu
870*0a6a1f1dSLionel Sambuc	exit ;;
871*0a6a1f1dSLionel Sambuc    alpha:Linux:*:*)
872*0a6a1f1dSLionel Sambuc	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
873*0a6a1f1dSLionel Sambuc	  EV5)   UNAME_MACHINE=alphaev5 ;;
874*0a6a1f1dSLionel Sambuc	  EV56)  UNAME_MACHINE=alphaev56 ;;
875*0a6a1f1dSLionel Sambuc	  PCA56) UNAME_MACHINE=alphapca56 ;;
876*0a6a1f1dSLionel Sambuc	  PCA57) UNAME_MACHINE=alphapca56 ;;
877*0a6a1f1dSLionel Sambuc	  EV6)   UNAME_MACHINE=alphaev6 ;;
878*0a6a1f1dSLionel Sambuc	  EV67)  UNAME_MACHINE=alphaev67 ;;
879*0a6a1f1dSLionel Sambuc	  EV68*) UNAME_MACHINE=alphaev68 ;;
880*0a6a1f1dSLionel Sambuc	esac
881*0a6a1f1dSLionel Sambuc	objdump --private-headers /bin/sh | grep -q ld.so.1
882*0a6a1f1dSLionel Sambuc	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
883*0a6a1f1dSLionel Sambuc	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
884*0a6a1f1dSLionel Sambuc	exit ;;
885357f1050SThomas Veerman    arm*:Linux:*:*)
88684d9c625SLionel Sambuc	eval $set_cc_for_build
88784d9c625SLionel Sambuc	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
88884d9c625SLionel Sambuc	    | grep -q __ARM_EABI__
88984d9c625SLionel Sambuc	then
89084d9c625SLionel Sambuc	    echo ${UNAME_MACHINE}-unknown-linux-gnu
89184d9c625SLionel Sambuc	else
892*0a6a1f1dSLionel Sambuc	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
893*0a6a1f1dSLionel Sambuc		| grep -q __ARM_PCS_VFP
894*0a6a1f1dSLionel Sambuc	    then
89584d9c625SLionel Sambuc		echo ${UNAME_MACHINE}-unknown-linux-gnueabi
896*0a6a1f1dSLionel Sambuc	    else
897*0a6a1f1dSLionel Sambuc		echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
898*0a6a1f1dSLionel Sambuc	    fi
89984d9c625SLionel Sambuc	fi
90084d9c625SLionel Sambuc	exit ;;
90184d9c625SLionel Sambuc    avr32*:Linux:*:*)
902357f1050SThomas Veerman	echo ${UNAME_MACHINE}-unknown-linux-gnu
903357f1050SThomas Veerman	exit ;;
904357f1050SThomas Veerman    cris:Linux:*:*)
905*0a6a1f1dSLionel Sambuc	echo ${UNAME_MACHINE}-axis-linux-gnu
906357f1050SThomas Veerman	exit ;;
907357f1050SThomas Veerman    crisv32:Linux:*:*)
908*0a6a1f1dSLionel Sambuc	echo ${UNAME_MACHINE}-axis-linux-gnu
909357f1050SThomas Veerman	exit ;;
910357f1050SThomas Veerman    frv:Linux:*:*)
911*0a6a1f1dSLionel Sambuc	echo ${UNAME_MACHINE}-unknown-linux-gnu
912*0a6a1f1dSLionel Sambuc	exit ;;
913*0a6a1f1dSLionel Sambuc    hexagon:Linux:*:*)
914*0a6a1f1dSLionel Sambuc	echo ${UNAME_MACHINE}-unknown-linux-gnu
915*0a6a1f1dSLionel Sambuc	exit ;;
916*0a6a1f1dSLionel Sambuc    i*86:Linux:*:*)
917*0a6a1f1dSLionel Sambuc	LIBC=gnu
918*0a6a1f1dSLionel Sambuc	eval $set_cc_for_build
919*0a6a1f1dSLionel Sambuc	sed 's/^	//' << EOF >$dummy.c
920*0a6a1f1dSLionel Sambuc	#ifdef __dietlibc__
921*0a6a1f1dSLionel Sambuc	LIBC=dietlibc
922*0a6a1f1dSLionel Sambuc	#endif
923*0a6a1f1dSLionel SambucEOF
924*0a6a1f1dSLionel Sambuc	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
925*0a6a1f1dSLionel Sambuc	echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
926357f1050SThomas Veerman	exit ;;
927357f1050SThomas Veerman    ia64:Linux:*:*)
928357f1050SThomas Veerman	echo ${UNAME_MACHINE}-unknown-linux-gnu
929357f1050SThomas Veerman	exit ;;
930357f1050SThomas Veerman    m32r*:Linux:*:*)
931357f1050SThomas Veerman	echo ${UNAME_MACHINE}-unknown-linux-gnu
932357f1050SThomas Veerman	exit ;;
933357f1050SThomas Veerman    m68*:Linux:*:*)
934357f1050SThomas Veerman	echo ${UNAME_MACHINE}-unknown-linux-gnu
935357f1050SThomas Veerman	exit ;;
93684d9c625SLionel Sambuc    mips:Linux:*:* | mips64:Linux:*:*)
937357f1050SThomas Veerman	eval $set_cc_for_build
938357f1050SThomas Veerman	sed 's/^	//' << EOF >$dummy.c
939357f1050SThomas Veerman	#undef CPU
94084d9c625SLionel Sambuc	#undef ${UNAME_MACHINE}
94184d9c625SLionel Sambuc	#undef ${UNAME_MACHINE}el
942357f1050SThomas Veerman	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
94384d9c625SLionel Sambuc	CPU=${UNAME_MACHINE}el
944357f1050SThomas Veerman	#else
945357f1050SThomas Veerman	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
94684d9c625SLionel Sambuc	CPU=${UNAME_MACHINE}
947357f1050SThomas Veerman	#else
948357f1050SThomas Veerman	CPU=
949357f1050SThomas Veerman	#endif
950357f1050SThomas Veerman	#endif
951357f1050SThomas VeermanEOF
952*0a6a1f1dSLionel Sambuc	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
953357f1050SThomas Veerman	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
954357f1050SThomas Veerman	;;
955357f1050SThomas Veerman    or32:Linux:*:*)
956*0a6a1f1dSLionel Sambuc	echo ${UNAME_MACHINE}-unknown-linux-gnu
957357f1050SThomas Veerman	exit ;;
95884d9c625SLionel Sambuc    padre:Linux:*:*)
95984d9c625SLionel Sambuc	echo sparc-unknown-linux-gnu
96084d9c625SLionel Sambuc	exit ;;
961*0a6a1f1dSLionel Sambuc    parisc64:Linux:*:* | hppa64:Linux:*:*)
962*0a6a1f1dSLionel Sambuc	echo hppa64-unknown-linux-gnu
963*0a6a1f1dSLionel Sambuc	exit ;;
964357f1050SThomas Veerman    parisc:Linux:*:* | hppa:Linux:*:*)
965357f1050SThomas Veerman	# Look for CPU level
966357f1050SThomas Veerman	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
967357f1050SThomas Veerman	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
968357f1050SThomas Veerman	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
969357f1050SThomas Veerman	  *)    echo hppa-unknown-linux-gnu ;;
970357f1050SThomas Veerman	esac
971357f1050SThomas Veerman	exit ;;
972*0a6a1f1dSLionel Sambuc    ppc64:Linux:*:*)
973*0a6a1f1dSLionel Sambuc	echo powerpc64-unknown-linux-gnu
974*0a6a1f1dSLionel Sambuc	exit ;;
975*0a6a1f1dSLionel Sambuc    ppc:Linux:*:*)
976*0a6a1f1dSLionel Sambuc	echo powerpc-unknown-linux-gnu
977357f1050SThomas Veerman	exit ;;
978357f1050SThomas Veerman    s390:Linux:*:* | s390x:Linux:*:*)
979357f1050SThomas Veerman	echo ${UNAME_MACHINE}-ibm-linux
980357f1050SThomas Veerman	exit ;;
981357f1050SThomas Veerman    sh64*:Linux:*:*)
982357f1050SThomas Veerman	echo ${UNAME_MACHINE}-unknown-linux-gnu
983357f1050SThomas Veerman	exit ;;
984357f1050SThomas Veerman    sh*:Linux:*:*)
985357f1050SThomas Veerman	echo ${UNAME_MACHINE}-unknown-linux-gnu
986357f1050SThomas Veerman	exit ;;
987357f1050SThomas Veerman    sparc:Linux:*:* | sparc64:Linux:*:*)
988357f1050SThomas Veerman	echo ${UNAME_MACHINE}-unknown-linux-gnu
989357f1050SThomas Veerman	exit ;;
990*0a6a1f1dSLionel Sambuc    tile*:Linux:*:*)
991*0a6a1f1dSLionel Sambuc	echo ${UNAME_MACHINE}-unknown-linux-gnu
992*0a6a1f1dSLionel Sambuc	exit ;;
99384d9c625SLionel Sambuc    vax:Linux:*:*)
99484d9c625SLionel Sambuc	echo ${UNAME_MACHINE}-dec-linux-gnu
99584d9c625SLionel Sambuc	exit ;;
996357f1050SThomas Veerman    x86_64:Linux:*:*)
997*0a6a1f1dSLionel Sambuc	echo ${UNAME_MACHINE}-unknown-linux-gnu
998357f1050SThomas Veerman	exit ;;
99984d9c625SLionel Sambuc    xtensa*:Linux:*:*)
100084d9c625SLionel Sambuc	echo ${UNAME_MACHINE}-unknown-linux-gnu
100184d9c625SLionel Sambuc	exit ;;
1002357f1050SThomas Veerman    i*86:DYNIX/ptx:4*:*)
1003357f1050SThomas Veerman	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1004357f1050SThomas Veerman	# earlier versions are messed up and put the nodename in both
1005357f1050SThomas Veerman	# sysname and nodename.
1006357f1050SThomas Veerman	echo i386-sequent-sysv4
1007357f1050SThomas Veerman	exit ;;
1008357f1050SThomas Veerman    i*86:UNIX_SV:4.2MP:2.*)
1009357f1050SThomas Veerman	# Unixware is an offshoot of SVR4, but it has its own version
1010357f1050SThomas Veerman	# number series starting with 2...
1011357f1050SThomas Veerman	# I am not positive that other SVR4 systems won't match this,
1012357f1050SThomas Veerman	# I just have to hope.  -- rms.
1013357f1050SThomas Veerman	# Use sysv4.2uw... so that sysv4* matches it.
1014357f1050SThomas Veerman	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
1015357f1050SThomas Veerman	exit ;;
1016357f1050SThomas Veerman    i*86:OS/2:*:*)
1017357f1050SThomas Veerman	# If we were able to find `uname', then EMX Unix compatibility
1018357f1050SThomas Veerman	# is probably installed.
1019357f1050SThomas Veerman	echo ${UNAME_MACHINE}-pc-os2-emx
1020357f1050SThomas Veerman	exit ;;
1021357f1050SThomas Veerman    i*86:XTS-300:*:STOP)
1022357f1050SThomas Veerman	echo ${UNAME_MACHINE}-unknown-stop
1023357f1050SThomas Veerman	exit ;;
1024357f1050SThomas Veerman    i*86:atheos:*:*)
1025357f1050SThomas Veerman	echo ${UNAME_MACHINE}-unknown-atheos
1026357f1050SThomas Veerman	exit ;;
1027357f1050SThomas Veerman    i*86:syllable:*:*)
1028357f1050SThomas Veerman	echo ${UNAME_MACHINE}-pc-syllable
1029357f1050SThomas Veerman	exit ;;
103084d9c625SLionel Sambuc    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1031357f1050SThomas Veerman	echo i386-unknown-lynxos${UNAME_RELEASE}
1032357f1050SThomas Veerman	exit ;;
1033357f1050SThomas Veerman    i*86:*DOS:*:*)
1034357f1050SThomas Veerman	echo ${UNAME_MACHINE}-pc-msdosdjgpp
1035357f1050SThomas Veerman	exit ;;
1036357f1050SThomas Veerman    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
1037357f1050SThomas Veerman	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
1038357f1050SThomas Veerman	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1039357f1050SThomas Veerman		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
1040357f1050SThomas Veerman	else
1041357f1050SThomas Veerman		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
1042357f1050SThomas Veerman	fi
1043357f1050SThomas Veerman	exit ;;
1044357f1050SThomas Veerman    i*86:*:5:[678]*)
1045357f1050SThomas Veerman	# UnixWare 7.x, OpenUNIX and OpenServer 6.
1046357f1050SThomas Veerman	case `/bin/uname -X | grep "^Machine"` in
1047357f1050SThomas Veerman	    *486*)	     UNAME_MACHINE=i486 ;;
1048357f1050SThomas Veerman	    *Pentium)	     UNAME_MACHINE=i586 ;;
1049357f1050SThomas Veerman	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1050357f1050SThomas Veerman	esac
1051357f1050SThomas Veerman	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1052357f1050SThomas Veerman	exit ;;
1053357f1050SThomas Veerman    i*86:*:3.2:*)
1054357f1050SThomas Veerman	if test -f /usr/options/cb.name; then
1055357f1050SThomas Veerman		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1056357f1050SThomas Veerman		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
1057357f1050SThomas Veerman	elif /bin/uname -X 2>/dev/null >/dev/null ; then
1058357f1050SThomas Veerman		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1059357f1050SThomas Veerman		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1060357f1050SThomas Veerman		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1061357f1050SThomas Veerman			&& UNAME_MACHINE=i586
1062357f1050SThomas Veerman		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1063357f1050SThomas Veerman			&& UNAME_MACHINE=i686
1064357f1050SThomas Veerman		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1065357f1050SThomas Veerman			&& UNAME_MACHINE=i686
1066357f1050SThomas Veerman		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
1067357f1050SThomas Veerman	else
1068357f1050SThomas Veerman		echo ${UNAME_MACHINE}-pc-sysv32
1069357f1050SThomas Veerman	fi
1070357f1050SThomas Veerman	exit ;;
1071357f1050SThomas Veerman    pc:*:*:*)
1072357f1050SThomas Veerman	# Left here for compatibility:
1073357f1050SThomas Veerman	# uname -m prints for DJGPP always 'pc', but it prints nothing about
107484d9c625SLionel Sambuc	# the processor, so we play safe by assuming i586.
107584d9c625SLionel Sambuc	# Note: whatever this is, it MUST be the same as what config.sub
107684d9c625SLionel Sambuc	# prints for the "djgpp" host, or else GDB configury will decide that
107784d9c625SLionel Sambuc	# this is a cross-build.
107884d9c625SLionel Sambuc	echo i586-pc-msdosdjgpp
1079357f1050SThomas Veerman	exit ;;
1080357f1050SThomas Veerman    Intel:Mach:3*:*)
1081357f1050SThomas Veerman	echo i386-pc-mach3
1082357f1050SThomas Veerman	exit ;;
1083357f1050SThomas Veerman    paragon:*:*:*)
1084357f1050SThomas Veerman	echo i860-intel-osf1
1085357f1050SThomas Veerman	exit ;;
1086357f1050SThomas Veerman    i860:*:4.*:*) # i860-SVR4
1087357f1050SThomas Veerman	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1088357f1050SThomas Veerman	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
1089357f1050SThomas Veerman	else # Add other i860-SVR4 vendors below as they are discovered.
1090357f1050SThomas Veerman	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
1091357f1050SThomas Veerman	fi
1092357f1050SThomas Veerman	exit ;;
1093357f1050SThomas Veerman    mini*:CTIX:SYS*5:*)
1094357f1050SThomas Veerman	# "miniframe"
1095357f1050SThomas Veerman	echo m68010-convergent-sysv
1096357f1050SThomas Veerman	exit ;;
1097357f1050SThomas Veerman    mc68k:UNIX:SYSTEM5:3.51m)
1098357f1050SThomas Veerman	echo m68k-convergent-sysv
1099357f1050SThomas Veerman	exit ;;
1100357f1050SThomas Veerman    M680?0:D-NIX:5.3:*)
1101357f1050SThomas Veerman	echo m68k-diab-dnix
1102357f1050SThomas Veerman	exit ;;
1103357f1050SThomas Veerman    M68*:*:R3V[5678]*:*)
1104357f1050SThomas Veerman	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1105357f1050SThomas Veerman    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)
1106357f1050SThomas Veerman	OS_REL=''
1107357f1050SThomas Veerman	test -r /etc/.relid \
1108357f1050SThomas Veerman	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1109357f1050SThomas Veerman	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1110357f1050SThomas Veerman	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1111357f1050SThomas Veerman	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1112357f1050SThomas Veerman	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1113357f1050SThomas Veerman    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1114357f1050SThomas Veerman	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1115357f1050SThomas Veerman	  && { echo i486-ncr-sysv4; exit; } ;;
111684d9c625SLionel Sambuc    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
111784d9c625SLionel Sambuc	OS_REL='.3'
111884d9c625SLionel Sambuc	test -r /etc/.relid \
111984d9c625SLionel Sambuc	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
112084d9c625SLionel Sambuc	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
112184d9c625SLionel Sambuc	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
112284d9c625SLionel Sambuc	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
112384d9c625SLionel Sambuc	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
112484d9c625SLionel Sambuc	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
112584d9c625SLionel Sambuc	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1126357f1050SThomas Veerman    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1127357f1050SThomas Veerman	echo m68k-unknown-lynxos${UNAME_RELEASE}
1128357f1050SThomas Veerman	exit ;;
1129357f1050SThomas Veerman    mc68030:UNIX_System_V:4.*:*)
1130357f1050SThomas Veerman	echo m68k-atari-sysv4
1131357f1050SThomas Veerman	exit ;;
1132357f1050SThomas Veerman    TSUNAMI:LynxOS:2.*:*)
1133357f1050SThomas Veerman	echo sparc-unknown-lynxos${UNAME_RELEASE}
1134357f1050SThomas Veerman	exit ;;
1135357f1050SThomas Veerman    rs6000:LynxOS:2.*:*)
1136357f1050SThomas Veerman	echo rs6000-unknown-lynxos${UNAME_RELEASE}
1137357f1050SThomas Veerman	exit ;;
113884d9c625SLionel Sambuc    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1139357f1050SThomas Veerman	echo powerpc-unknown-lynxos${UNAME_RELEASE}
1140357f1050SThomas Veerman	exit ;;
1141357f1050SThomas Veerman    SM[BE]S:UNIX_SV:*:*)
1142357f1050SThomas Veerman	echo mips-dde-sysv${UNAME_RELEASE}
1143357f1050SThomas Veerman	exit ;;
1144357f1050SThomas Veerman    RM*:ReliantUNIX-*:*:*)
1145357f1050SThomas Veerman	echo mips-sni-sysv4
1146357f1050SThomas Veerman	exit ;;
1147357f1050SThomas Veerman    RM*:SINIX-*:*:*)
1148357f1050SThomas Veerman	echo mips-sni-sysv4
1149357f1050SThomas Veerman	exit ;;
1150357f1050SThomas Veerman    *:SINIX-*:*:*)
1151357f1050SThomas Veerman	if uname -p 2>/dev/null >/dev/null ; then
1152357f1050SThomas Veerman		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1153357f1050SThomas Veerman		echo ${UNAME_MACHINE}-sni-sysv4
1154357f1050SThomas Veerman	else
1155357f1050SThomas Veerman		echo ns32k-sni-sysv
1156357f1050SThomas Veerman	fi
1157357f1050SThomas Veerman	exit ;;
1158357f1050SThomas Veerman    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1159357f1050SThomas Veerman			# says <Richard.M.Bartel@ccMail.Census.GOV>
1160357f1050SThomas Veerman	echo i586-unisys-sysv4
1161357f1050SThomas Veerman	exit ;;
1162357f1050SThomas Veerman    *:UNIX_System_V:4*:FTX*)
1163357f1050SThomas Veerman	# From Gerald Hewes <hewes@openmarket.com>.
1164357f1050SThomas Veerman	# How about differentiating between stratus architectures? -djm
1165357f1050SThomas Veerman	echo hppa1.1-stratus-sysv4
1166357f1050SThomas Veerman	exit ;;
1167357f1050SThomas Veerman    *:*:*:FTX*)
1168357f1050SThomas Veerman	# From seanf@swdc.stratus.com.
1169357f1050SThomas Veerman	echo i860-stratus-sysv4
1170357f1050SThomas Veerman	exit ;;
1171357f1050SThomas Veerman    i*86:VOS:*:*)
1172357f1050SThomas Veerman	# From Paul.Green@stratus.com.
1173357f1050SThomas Veerman	echo ${UNAME_MACHINE}-stratus-vos
1174357f1050SThomas Veerman	exit ;;
1175357f1050SThomas Veerman    *:VOS:*:*)
1176357f1050SThomas Veerman	# From Paul.Green@stratus.com.
1177357f1050SThomas Veerman	echo hppa1.1-stratus-vos
1178357f1050SThomas Veerman	exit ;;
1179357f1050SThomas Veerman    mc68*:A/UX:*:*)
1180357f1050SThomas Veerman	echo m68k-apple-aux${UNAME_RELEASE}
1181357f1050SThomas Veerman	exit ;;
1182357f1050SThomas Veerman    news*:NEWS-OS:6*:*)
1183357f1050SThomas Veerman	echo mips-sony-newsos6
1184357f1050SThomas Veerman	exit ;;
1185357f1050SThomas Veerman    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1186357f1050SThomas Veerman	if [ -d /usr/nec ]; then
1187357f1050SThomas Veerman		echo mips-nec-sysv${UNAME_RELEASE}
1188357f1050SThomas Veerman	else
1189357f1050SThomas Veerman		echo mips-unknown-sysv${UNAME_RELEASE}
1190357f1050SThomas Veerman	fi
1191357f1050SThomas Veerman	exit ;;
1192357f1050SThomas Veerman    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1193357f1050SThomas Veerman	echo powerpc-be-beos
1194357f1050SThomas Veerman	exit ;;
1195357f1050SThomas Veerman    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1196357f1050SThomas Veerman	echo powerpc-apple-beos
1197357f1050SThomas Veerman	exit ;;
1198357f1050SThomas Veerman    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1199357f1050SThomas Veerman	echo i586-pc-beos
1200357f1050SThomas Veerman	exit ;;
120184d9c625SLionel Sambuc    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
120284d9c625SLionel Sambuc	echo i586-pc-haiku
120384d9c625SLionel Sambuc	exit ;;
1204357f1050SThomas Veerman    SX-4:SUPER-UX:*:*)
1205357f1050SThomas Veerman	echo sx4-nec-superux${UNAME_RELEASE}
1206357f1050SThomas Veerman	exit ;;
1207357f1050SThomas Veerman    SX-5:SUPER-UX:*:*)
1208357f1050SThomas Veerman	echo sx5-nec-superux${UNAME_RELEASE}
1209357f1050SThomas Veerman	exit ;;
1210357f1050SThomas Veerman    SX-6:SUPER-UX:*:*)
1211357f1050SThomas Veerman	echo sx6-nec-superux${UNAME_RELEASE}
1212357f1050SThomas Veerman	exit ;;
121384d9c625SLionel Sambuc    SX-7:SUPER-UX:*:*)
121484d9c625SLionel Sambuc	echo sx7-nec-superux${UNAME_RELEASE}
121584d9c625SLionel Sambuc	exit ;;
121684d9c625SLionel Sambuc    SX-8:SUPER-UX:*:*)
121784d9c625SLionel Sambuc	echo sx8-nec-superux${UNAME_RELEASE}
121884d9c625SLionel Sambuc	exit ;;
121984d9c625SLionel Sambuc    SX-8R:SUPER-UX:*:*)
122084d9c625SLionel Sambuc	echo sx8r-nec-superux${UNAME_RELEASE}
122184d9c625SLionel Sambuc	exit ;;
1222357f1050SThomas Veerman    Power*:Rhapsody:*:*)
1223357f1050SThomas Veerman	echo powerpc-apple-rhapsody${UNAME_RELEASE}
1224357f1050SThomas Veerman	exit ;;
1225357f1050SThomas Veerman    *:Rhapsody:*:*)
1226357f1050SThomas Veerman	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
1227357f1050SThomas Veerman	exit ;;
1228357f1050SThomas Veerman    *:Darwin:*:*)
1229357f1050SThomas Veerman	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1230357f1050SThomas Veerman	case $UNAME_PROCESSOR in
1231*0a6a1f1dSLionel Sambuc	    i386)
1232*0a6a1f1dSLionel Sambuc		eval $set_cc_for_build
1233*0a6a1f1dSLionel Sambuc		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
1234*0a6a1f1dSLionel Sambuc		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1235*0a6a1f1dSLionel Sambuc		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
1236*0a6a1f1dSLionel Sambuc		      grep IS_64BIT_ARCH >/dev/null
1237*0a6a1f1dSLionel Sambuc		  then
1238*0a6a1f1dSLionel Sambuc		      UNAME_PROCESSOR="x86_64"
1239*0a6a1f1dSLionel Sambuc		  fi
1240*0a6a1f1dSLionel Sambuc		fi ;;
1241357f1050SThomas Veerman	    unknown) UNAME_PROCESSOR=powerpc ;;
1242357f1050SThomas Veerman	esac
1243357f1050SThomas Veerman	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
1244357f1050SThomas Veerman	exit ;;
1245357f1050SThomas Veerman    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1246357f1050SThomas Veerman	UNAME_PROCESSOR=`uname -p`
1247357f1050SThomas Veerman	if test "$UNAME_PROCESSOR" = "x86"; then
1248357f1050SThomas Veerman		UNAME_PROCESSOR=i386
1249357f1050SThomas Veerman		UNAME_MACHINE=pc
1250357f1050SThomas Veerman	fi
1251357f1050SThomas Veerman	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
1252357f1050SThomas Veerman	exit ;;
1253357f1050SThomas Veerman    *:QNX:*:4*)
1254357f1050SThomas Veerman	echo i386-pc-qnx
1255357f1050SThomas Veerman	exit ;;
1256*0a6a1f1dSLionel Sambuc    NEO-?:NONSTOP_KERNEL:*:*)
1257*0a6a1f1dSLionel Sambuc	echo neo-tandem-nsk${UNAME_RELEASE}
1258*0a6a1f1dSLionel Sambuc	exit ;;
1259357f1050SThomas Veerman    NSE-?:NONSTOP_KERNEL:*:*)
1260357f1050SThomas Veerman	echo nse-tandem-nsk${UNAME_RELEASE}
1261357f1050SThomas Veerman	exit ;;
1262357f1050SThomas Veerman    NSR-?:NONSTOP_KERNEL:*:*)
1263357f1050SThomas Veerman	echo nsr-tandem-nsk${UNAME_RELEASE}
1264357f1050SThomas Veerman	exit ;;
1265357f1050SThomas Veerman    *:NonStop-UX:*:*)
1266357f1050SThomas Veerman	echo mips-compaq-nonstopux
1267357f1050SThomas Veerman	exit ;;
1268357f1050SThomas Veerman    BS2000:POSIX*:*:*)
1269357f1050SThomas Veerman	echo bs2000-siemens-sysv
1270357f1050SThomas Veerman	exit ;;
1271357f1050SThomas Veerman    DS/*:UNIX_System_V:*:*)
1272357f1050SThomas Veerman	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
1273357f1050SThomas Veerman	exit ;;
1274357f1050SThomas Veerman    *:Plan9:*:*)
1275357f1050SThomas Veerman	# "uname -m" is not consistent, so use $cputype instead. 386
1276357f1050SThomas Veerman	# is converted to i386 for consistency with other x86
1277357f1050SThomas Veerman	# operating systems.
1278357f1050SThomas Veerman	if test "$cputype" = "386"; then
1279357f1050SThomas Veerman	    UNAME_MACHINE=i386
1280357f1050SThomas Veerman	else
1281357f1050SThomas Veerman	    UNAME_MACHINE="$cputype"
1282357f1050SThomas Veerman	fi
1283357f1050SThomas Veerman	echo ${UNAME_MACHINE}-unknown-plan9
1284357f1050SThomas Veerman	exit ;;
1285357f1050SThomas Veerman    *:TOPS-10:*:*)
1286357f1050SThomas Veerman	echo pdp10-unknown-tops10
1287357f1050SThomas Veerman	exit ;;
1288357f1050SThomas Veerman    *:TENEX:*:*)
1289357f1050SThomas Veerman	echo pdp10-unknown-tenex
1290357f1050SThomas Veerman	exit ;;
1291357f1050SThomas Veerman    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1292357f1050SThomas Veerman	echo pdp10-dec-tops20
1293357f1050SThomas Veerman	exit ;;
1294357f1050SThomas Veerman    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1295357f1050SThomas Veerman	echo pdp10-xkl-tops20
1296357f1050SThomas Veerman	exit ;;
1297357f1050SThomas Veerman    *:TOPS-20:*:*)
1298357f1050SThomas Veerman	echo pdp10-unknown-tops20
1299357f1050SThomas Veerman	exit ;;
1300357f1050SThomas Veerman    *:ITS:*:*)
1301357f1050SThomas Veerman	echo pdp10-unknown-its
1302357f1050SThomas Veerman	exit ;;
1303357f1050SThomas Veerman    SEI:*:*:SEIUX)
1304357f1050SThomas Veerman	echo mips-sei-seiux${UNAME_RELEASE}
1305357f1050SThomas Veerman	exit ;;
1306357f1050SThomas Veerman    *:DragonFly:*:*)
1307357f1050SThomas Veerman	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
1308357f1050SThomas Veerman	exit ;;
1309357f1050SThomas Veerman    *:*VMS:*:*)
1310357f1050SThomas Veerman	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1311357f1050SThomas Veerman	case "${UNAME_MACHINE}" in
1312357f1050SThomas Veerman	    A*) echo alpha-dec-vms ; exit ;;
1313357f1050SThomas Veerman	    I*) echo ia64-dec-vms ; exit ;;
1314357f1050SThomas Veerman	    V*) echo vax-dec-vms ; exit ;;
1315357f1050SThomas Veerman	esac ;;
1316357f1050SThomas Veerman    *:XENIX:*:SysV)
1317357f1050SThomas Veerman	echo i386-pc-xenix
1318357f1050SThomas Veerman	exit ;;
1319357f1050SThomas Veerman    i*86:skyos:*:*)
1320357f1050SThomas Veerman	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
1321357f1050SThomas Veerman	exit ;;
132284d9c625SLionel Sambuc    i*86:rdos:*:*)
132384d9c625SLionel Sambuc	echo ${UNAME_MACHINE}-pc-rdos
132484d9c625SLionel Sambuc	exit ;;
132584d9c625SLionel Sambuc    i*86:AROS:*:*)
132684d9c625SLionel Sambuc	echo ${UNAME_MACHINE}-pc-aros
132784d9c625SLionel Sambuc	exit ;;
1328*0a6a1f1dSLionel Sambuc    x86_64:VMkernel:*:*)
1329*0a6a1f1dSLionel Sambuc	echo ${UNAME_MACHINE}-unknown-esx
1330*0a6a1f1dSLionel Sambuc	exit ;;
1331357f1050SThomas Veermanesac
1332357f1050SThomas Veerman
1333357f1050SThomas Veerman#echo '(No uname command or uname output not recognized.)' 1>&2
1334357f1050SThomas Veerman#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
1335357f1050SThomas Veerman
1336357f1050SThomas Veermaneval $set_cc_for_build
1337357f1050SThomas Veermancat >$dummy.c <<EOF
1338357f1050SThomas Veerman#ifdef _SEQUENT_
1339357f1050SThomas Veerman# include <sys/types.h>
1340357f1050SThomas Veerman# include <sys/utsname.h>
1341357f1050SThomas Veerman#endif
1342357f1050SThomas Veermanmain ()
1343357f1050SThomas Veerman{
1344357f1050SThomas Veerman#if defined (sony)
1345357f1050SThomas Veerman#if defined (MIPSEB)
1346357f1050SThomas Veerman  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1347357f1050SThomas Veerman     I don't know....  */
1348357f1050SThomas Veerman  printf ("mips-sony-bsd\n"); exit (0);
1349357f1050SThomas Veerman#else
1350357f1050SThomas Veerman#include <sys/param.h>
1351357f1050SThomas Veerman  printf ("m68k-sony-newsos%s\n",
1352357f1050SThomas Veerman#ifdef NEWSOS4
1353357f1050SThomas Veerman	"4"
1354357f1050SThomas Veerman#else
1355357f1050SThomas Veerman	""
1356357f1050SThomas Veerman#endif
1357357f1050SThomas Veerman	); exit (0);
1358357f1050SThomas Veerman#endif
1359357f1050SThomas Veerman#endif
1360357f1050SThomas Veerman
1361357f1050SThomas Veerman#if defined (__arm) && defined (__acorn) && defined (__unix)
1362357f1050SThomas Veerman  printf ("arm-acorn-riscix\n"); exit (0);
1363357f1050SThomas Veerman#endif
1364357f1050SThomas Veerman
1365357f1050SThomas Veerman#if defined (hp300) && !defined (hpux)
1366357f1050SThomas Veerman  printf ("m68k-hp-bsd\n"); exit (0);
1367357f1050SThomas Veerman#endif
1368357f1050SThomas Veerman
1369357f1050SThomas Veerman#if defined (NeXT)
1370357f1050SThomas Veerman#if !defined (__ARCHITECTURE__)
1371357f1050SThomas Veerman#define __ARCHITECTURE__ "m68k"
1372357f1050SThomas Veerman#endif
1373357f1050SThomas Veerman  int version;
1374357f1050SThomas Veerman  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1375357f1050SThomas Veerman  if (version < 4)
1376357f1050SThomas Veerman    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1377357f1050SThomas Veerman  else
1378357f1050SThomas Veerman    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1379357f1050SThomas Veerman  exit (0);
1380357f1050SThomas Veerman#endif
1381357f1050SThomas Veerman
1382357f1050SThomas Veerman#if defined (MULTIMAX) || defined (n16)
1383357f1050SThomas Veerman#if defined (UMAXV)
1384357f1050SThomas Veerman  printf ("ns32k-encore-sysv\n"); exit (0);
1385357f1050SThomas Veerman#else
1386357f1050SThomas Veerman#if defined (CMU)
1387357f1050SThomas Veerman  printf ("ns32k-encore-mach\n"); exit (0);
1388357f1050SThomas Veerman#else
1389357f1050SThomas Veerman  printf ("ns32k-encore-bsd\n"); exit (0);
1390357f1050SThomas Veerman#endif
1391357f1050SThomas Veerman#endif
1392357f1050SThomas Veerman#endif
1393357f1050SThomas Veerman
1394357f1050SThomas Veerman#if defined (__386BSD__)
1395357f1050SThomas Veerman  printf ("i386-pc-bsd\n"); exit (0);
1396357f1050SThomas Veerman#endif
1397357f1050SThomas Veerman
1398357f1050SThomas Veerman#if defined (sequent)
1399357f1050SThomas Veerman#if defined (i386)
1400357f1050SThomas Veerman  printf ("i386-sequent-dynix\n"); exit (0);
1401357f1050SThomas Veerman#endif
1402357f1050SThomas Veerman#if defined (ns32000)
1403357f1050SThomas Veerman  printf ("ns32k-sequent-dynix\n"); exit (0);
1404357f1050SThomas Veerman#endif
1405357f1050SThomas Veerman#endif
1406357f1050SThomas Veerman
1407357f1050SThomas Veerman#if defined (_SEQUENT_)
1408357f1050SThomas Veerman    struct utsname un;
1409357f1050SThomas Veerman
1410357f1050SThomas Veerman    uname(&un);
1411357f1050SThomas Veerman
1412357f1050SThomas Veerman    if (strncmp(un.version, "V2", 2) == 0) {
1413357f1050SThomas Veerman	printf ("i386-sequent-ptx2\n"); exit (0);
1414357f1050SThomas Veerman    }
1415357f1050SThomas Veerman    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1416357f1050SThomas Veerman	printf ("i386-sequent-ptx1\n"); exit (0);
1417357f1050SThomas Veerman    }
1418357f1050SThomas Veerman    printf ("i386-sequent-ptx\n"); exit (0);
1419357f1050SThomas Veerman
1420357f1050SThomas Veerman#endif
1421357f1050SThomas Veerman
1422357f1050SThomas Veerman#if defined (vax)
1423357f1050SThomas Veerman# if !defined (ultrix)
1424357f1050SThomas Veerman#  include <sys/param.h>
1425357f1050SThomas Veerman#  if defined (BSD)
1426357f1050SThomas Veerman#   if BSD == 43
1427357f1050SThomas Veerman      printf ("vax-dec-bsd4.3\n"); exit (0);
1428357f1050SThomas Veerman#   else
1429357f1050SThomas Veerman#    if BSD == 199006
1430357f1050SThomas Veerman      printf ("vax-dec-bsd4.3reno\n"); exit (0);
1431357f1050SThomas Veerman#    else
1432357f1050SThomas Veerman      printf ("vax-dec-bsd\n"); exit (0);
1433357f1050SThomas Veerman#    endif
1434357f1050SThomas Veerman#   endif
1435357f1050SThomas Veerman#  else
1436357f1050SThomas Veerman    printf ("vax-dec-bsd\n"); exit (0);
1437357f1050SThomas Veerman#  endif
1438357f1050SThomas Veerman# else
1439357f1050SThomas Veerman    printf ("vax-dec-ultrix\n"); exit (0);
1440357f1050SThomas Veerman# endif
1441357f1050SThomas Veerman#endif
1442357f1050SThomas Veerman
1443357f1050SThomas Veerman#if defined (alliant) && defined (i860)
1444357f1050SThomas Veerman  printf ("i860-alliant-bsd\n"); exit (0);
1445357f1050SThomas Veerman#endif
1446357f1050SThomas Veerman
1447357f1050SThomas Veerman  exit (1);
1448357f1050SThomas Veerman}
1449357f1050SThomas VeermanEOF
1450357f1050SThomas Veerman
1451357f1050SThomas Veerman$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
1452357f1050SThomas Veerman	{ echo "$SYSTEM_NAME"; exit; }
1453357f1050SThomas Veerman
1454357f1050SThomas Veerman# Apollos put the system type in the environment.
1455357f1050SThomas Veerman
1456357f1050SThomas Veermantest -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
1457357f1050SThomas Veerman
1458357f1050SThomas Veerman# Convex versions that predate uname can use getsysinfo(1)
1459357f1050SThomas Veerman
1460357f1050SThomas Veermanif [ -x /usr/convex/getsysinfo ]
1461357f1050SThomas Veermanthen
1462357f1050SThomas Veerman    case `getsysinfo -f cpu_type` in
1463357f1050SThomas Veerman    c1*)
1464357f1050SThomas Veerman	echo c1-convex-bsd
1465357f1050SThomas Veerman	exit ;;
1466357f1050SThomas Veerman    c2*)
1467357f1050SThomas Veerman	if getsysinfo -f scalar_acc
1468357f1050SThomas Veerman	then echo c32-convex-bsd
1469357f1050SThomas Veerman	else echo c2-convex-bsd
1470357f1050SThomas Veerman	fi
1471357f1050SThomas Veerman	exit ;;
1472357f1050SThomas Veerman    c34*)
1473357f1050SThomas Veerman	echo c34-convex-bsd
1474357f1050SThomas Veerman	exit ;;
1475357f1050SThomas Veerman    c38*)
1476357f1050SThomas Veerman	echo c38-convex-bsd
1477357f1050SThomas Veerman	exit ;;
1478357f1050SThomas Veerman    c4*)
1479357f1050SThomas Veerman	echo c4-convex-bsd
1480357f1050SThomas Veerman	exit ;;
1481357f1050SThomas Veerman    esac
1482357f1050SThomas Veermanfi
1483357f1050SThomas Veerman
1484357f1050SThomas Veermancat >&2 <<EOF
1485357f1050SThomas Veerman$0: unable to guess system type
1486357f1050SThomas Veerman
1487357f1050SThomas VeermanThis script, last modified $timestamp, has failed to recognize
1488357f1050SThomas Veermanthe operating system you are using. It is advised that you
1489357f1050SThomas Veermandownload the most up to date version of the config scripts from
1490357f1050SThomas Veerman
149184d9c625SLionel Sambuc  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
1492357f1050SThomas Veermanand
149384d9c625SLionel Sambuc  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
1494357f1050SThomas Veerman
1495357f1050SThomas VeermanIf the version you run ($0) is already up to date, please
1496357f1050SThomas Veermansend the following data and any information you think might be
1497357f1050SThomas Veermanpertinent to <config-patches@gnu.org> in order to provide the needed
1498357f1050SThomas Veermaninformation to handle your system.
1499357f1050SThomas Veerman
1500357f1050SThomas Veermanconfig.guess timestamp = $timestamp
1501357f1050SThomas Veerman
1502357f1050SThomas Veermanuname -m = `(uname -m) 2>/dev/null || echo unknown`
1503357f1050SThomas Veermanuname -r = `(uname -r) 2>/dev/null || echo unknown`
1504357f1050SThomas Veermanuname -s = `(uname -s) 2>/dev/null || echo unknown`
1505357f1050SThomas Veermanuname -v = `(uname -v) 2>/dev/null || echo unknown`
1506357f1050SThomas Veerman
1507357f1050SThomas Veerman/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1508357f1050SThomas Veerman/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1509357f1050SThomas Veerman
1510357f1050SThomas Veermanhostinfo               = `(hostinfo) 2>/dev/null`
1511357f1050SThomas Veerman/bin/universe          = `(/bin/universe) 2>/dev/null`
1512357f1050SThomas Veerman/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1513357f1050SThomas Veerman/bin/arch              = `(/bin/arch) 2>/dev/null`
1514357f1050SThomas Veerman/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1515357f1050SThomas Veerman/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1516357f1050SThomas Veerman
1517357f1050SThomas VeermanUNAME_MACHINE = ${UNAME_MACHINE}
1518357f1050SThomas VeermanUNAME_RELEASE = ${UNAME_RELEASE}
1519357f1050SThomas VeermanUNAME_SYSTEM  = ${UNAME_SYSTEM}
1520357f1050SThomas VeermanUNAME_VERSION = ${UNAME_VERSION}
1521357f1050SThomas VeermanEOF
1522357f1050SThomas Veerman
1523357f1050SThomas Veermanexit 1
1524357f1050SThomas Veerman
1525357f1050SThomas Veerman# Local variables:
1526357f1050SThomas Veerman# eval: (add-hook 'write-file-hooks 'time-stamp)
1527357f1050SThomas Veerman# time-stamp-start: "timestamp='"
1528357f1050SThomas Veerman# time-stamp-format: "%:y-%02m-%02d"
1529357f1050SThomas Veerman# time-stamp-end: "'"
1530357f1050SThomas Veerman# End:
1531