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