xref: /freebsd/crypto/openssh/config.guess (revision f374ba41)
183d2307dSDag-Erling Smørgrav#! /bin/sh
283d2307dSDag-Erling Smørgrav# Attempt to guess a canonical system name.
3f374ba41SEd Maste#   Copyright 1992-2022 Free Software Foundation, Inc.
483d2307dSDag-Erling Smørgrav
5f374ba41SEd Maste# shellcheck disable=SC2006,SC2268 # see below for rationale
6f374ba41SEd Maste
7f374ba41SEd Mastetimestamp='2022-09-17'
883d2307dSDag-Erling Smørgrav
983d2307dSDag-Erling Smørgrav# This file is free software; you can redistribute it and/or modify it
1083d2307dSDag-Erling Smørgrav# under the terms of the GNU General Public License as published by
11f374ba41SEd Maste# the Free Software Foundation, either version 3 of the License, or
1283d2307dSDag-Erling Smørgrav# (at your option) any later version.
1383d2307dSDag-Erling Smørgrav#
1483d2307dSDag-Erling Smørgrav# This program is distributed in the hope that it will be useful, but
1583d2307dSDag-Erling Smørgrav# WITHOUT ANY WARRANTY; without even the implied warranty of
1683d2307dSDag-Erling Smørgrav# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1783d2307dSDag-Erling Smørgrav# General Public License for more details.
1883d2307dSDag-Erling Smørgrav#
1983d2307dSDag-Erling Smørgrav# You should have received a copy of the GNU General Public License
2019261079SEd Maste# along with this program; if not, see <https://www.gnu.org/licenses/>.
2183d2307dSDag-Erling Smørgrav#
2283d2307dSDag-Erling Smørgrav# As a special exception to the GNU General Public License, if you
2383d2307dSDag-Erling Smørgrav# distribute this file as part of a program that contains a
2483d2307dSDag-Erling Smørgrav# configuration script generated by Autoconf, you may include it under
25ca86bcf2SDag-Erling Smørgrav# the same distribution terms that you use for the rest of that
26ca86bcf2SDag-Erling Smørgrav# program.  This Exception is an additional permission under section 7
27ca86bcf2SDag-Erling Smørgrav# of the GNU General Public License, version 3 ("GPLv3").
2883d2307dSDag-Erling Smørgrav#
29ca86bcf2SDag-Erling Smørgrav# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
3083d2307dSDag-Erling Smørgrav#
31b15c8340SDag-Erling Smørgrav# You can get the latest version of this script from:
32f374ba41SEd Maste# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
33ca86bcf2SDag-Erling Smørgrav#
34ca86bcf2SDag-Erling Smørgrav# Please send patches to <config-patches@gnu.org>.
35ca86bcf2SDag-Erling Smørgrav
3683d2307dSDag-Erling Smørgrav
37f374ba41SEd Maste# The "shellcheck disable" line above the timestamp inhibits complaints
38f374ba41SEd Maste# about features and limitations of the classic Bourne shell that were
39f374ba41SEd Maste# superseded or lifted in POSIX.  However, this script identifies a wide
40f374ba41SEd Maste# variety of pre-POSIX systems that do not have POSIX shells at all, and
41f374ba41SEd Maste# even some reasonably current systems (Solaris 10 as case-in-point) still
42f374ba41SEd Maste# have a pre-POSIX /bin/sh.
43f374ba41SEd Maste
44f374ba41SEd Maste
4583d2307dSDag-Erling Smørgravme=`echo "$0" | sed -e 's,.*/,,'`
4683d2307dSDag-Erling Smørgrav
4783d2307dSDag-Erling Smørgravusage="\
4883d2307dSDag-Erling SmørgravUsage: $0 [OPTION]
4983d2307dSDag-Erling Smørgrav
5083d2307dSDag-Erling SmørgravOutput the configuration name of the system \`$me' is run on.
5183d2307dSDag-Erling Smørgrav
5219261079SEd MasteOptions:
5383d2307dSDag-Erling Smørgrav  -h, --help         print this help, then exit
5483d2307dSDag-Erling Smørgrav  -t, --time-stamp   print date of last modification, then exit
5583d2307dSDag-Erling Smørgrav  -v, --version      print version number, then exit
5683d2307dSDag-Erling Smørgrav
5783d2307dSDag-Erling SmørgravReport bugs and patches to <config-patches@gnu.org>."
5883d2307dSDag-Erling Smørgrav
5983d2307dSDag-Erling Smørgravversion="\
6083d2307dSDag-Erling SmørgravGNU config.guess ($timestamp)
6183d2307dSDag-Erling Smørgrav
6283d2307dSDag-Erling SmørgravOriginally written by Per Bothner.
63f374ba41SEd MasteCopyright 1992-2022 Free Software Foundation, Inc.
6483d2307dSDag-Erling Smørgrav
6583d2307dSDag-Erling SmørgravThis is free software; see the source for copying conditions.  There is NO
6683d2307dSDag-Erling Smørgravwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
6783d2307dSDag-Erling Smørgrav
6883d2307dSDag-Erling Smørgravhelp="
6983d2307dSDag-Erling SmørgravTry \`$me --help' for more information."
7083d2307dSDag-Erling Smørgrav
7183d2307dSDag-Erling Smørgrav# Parse command line
7283d2307dSDag-Erling Smørgravwhile test $# -gt 0 ; do
7383d2307dSDag-Erling Smørgrav  case $1 in
7483d2307dSDag-Erling Smørgrav    --time-stamp | --time* | -t )
75043840dfSDag-Erling Smørgrav       echo "$timestamp" ; exit ;;
7683d2307dSDag-Erling Smørgrav    --version | -v )
77043840dfSDag-Erling Smørgrav       echo "$version" ; exit ;;
7883d2307dSDag-Erling Smørgrav    --help | --h* | -h )
79043840dfSDag-Erling Smørgrav       echo "$usage"; exit ;;
8083d2307dSDag-Erling Smørgrav    -- )     # Stop option processing
8183d2307dSDag-Erling Smørgrav       shift; break ;;
8283d2307dSDag-Erling Smørgrav    - )	# Use stdin as input.
8383d2307dSDag-Erling Smørgrav       break ;;
8483d2307dSDag-Erling Smørgrav    -* )
8583d2307dSDag-Erling Smørgrav       echo "$me: invalid option $1$help" >&2
8683d2307dSDag-Erling Smørgrav       exit 1 ;;
8783d2307dSDag-Erling Smørgrav    * )
8883d2307dSDag-Erling Smørgrav       break ;;
8983d2307dSDag-Erling Smørgrav  esac
9083d2307dSDag-Erling Smørgravdone
9183d2307dSDag-Erling Smørgrav
9283d2307dSDag-Erling Smørgravif test $# != 0; then
9383d2307dSDag-Erling Smørgrav  echo "$me: too many arguments$help" >&2
9483d2307dSDag-Erling Smørgrav  exit 1
9583d2307dSDag-Erling Smørgravfi
9683d2307dSDag-Erling Smørgrav
97f374ba41SEd Maste# Just in case it came from the environment.
98f374ba41SEd MasteGUESS=
99f374ba41SEd Maste
1004b17dab0SDag-Erling Smørgrav# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
1014b17dab0SDag-Erling Smørgrav# compiler to aid in system detection is discouraged as it requires
1024b17dab0SDag-Erling Smørgrav# temporary files to be created and, as you can see below, it is a
1034b17dab0SDag-Erling Smørgrav# headache to deal with in a portable fashion.
10483d2307dSDag-Erling Smørgrav
10583d2307dSDag-Erling Smørgrav# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
10683d2307dSDag-Erling Smørgrav# use `HOST_CC' if defined, but it is deprecated.
10783d2307dSDag-Erling Smørgrav
108d74d50a8SDag-Erling Smørgrav# Portable tmp directory creation inspired by the Autoconf team.
1094b17dab0SDag-Erling Smørgrav
11019261079SEd Mastetmp=
11119261079SEd Maste# shellcheck disable=SC2172
11219261079SEd Mastetrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
11319261079SEd Maste
11419261079SEd Masteset_cc_for_build() {
11519261079SEd Maste    # prevent multiple calls if $tmp is already set
11619261079SEd Maste    test "$tmp" && return 0
11719261079SEd Maste    : "${TMPDIR=/tmp}"
118f374ba41SEd Maste    # shellcheck disable=SC2039,SC3028
119cce7d346SDag-Erling Smørgrav    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
12019261079SEd Maste	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
12119261079SEd Maste	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
12219261079SEd Maste	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
12319261079SEd Maste    dummy=$tmp/dummy
12419261079SEd Maste    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
12519261079SEd Maste	,,)    echo "int x;" > "$dummy.c"
12619261079SEd Maste	       for driver in cc gcc c89 c99 ; do
12719261079SEd Maste		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
128f374ba41SEd Maste		       CC_FOR_BUILD=$driver
12919261079SEd Maste		       break
13019261079SEd Maste		   fi
13119261079SEd Maste	       done
13283d2307dSDag-Erling Smørgrav	       if test x"$CC_FOR_BUILD" = x ; then
13319261079SEd Maste		   CC_FOR_BUILD=no_compiler_found
13483d2307dSDag-Erling Smørgrav	       fi
13583d2307dSDag-Erling Smørgrav	       ;;
13683d2307dSDag-Erling Smørgrav	,,*)   CC_FOR_BUILD=$CC ;;
13783d2307dSDag-Erling Smørgrav	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
13819261079SEd Maste    esac
13919261079SEd Maste}
14083d2307dSDag-Erling Smørgrav
14183d2307dSDag-Erling Smørgrav# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
14283d2307dSDag-Erling Smørgrav# (ghazi@noc.rutgers.edu 1994-08-24)
14319261079SEd Masteif test -f /.attbin/uname ; then
14483d2307dSDag-Erling Smørgrav	PATH=$PATH:/.attbin ; export PATH
14583d2307dSDag-Erling Smørgravfi
14683d2307dSDag-Erling Smørgrav
14783d2307dSDag-Erling SmørgravUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
14883d2307dSDag-Erling SmørgravUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
14983d2307dSDag-Erling SmørgravUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
15083d2307dSDag-Erling SmørgravUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
15183d2307dSDag-Erling Smørgrav
152f374ba41SEd Mastecase $UNAME_SYSTEM in
153ca86bcf2SDag-Erling SmørgravLinux|GNU|GNU/*)
154f374ba41SEd Maste	LIBC=unknown
155ca86bcf2SDag-Erling Smørgrav
15619261079SEd Maste	set_cc_for_build
15719261079SEd Maste	cat <<-EOF > "$dummy.c"
158ca86bcf2SDag-Erling Smørgrav	#include <features.h>
159ca86bcf2SDag-Erling Smørgrav	#if defined(__UCLIBC__)
160ca86bcf2SDag-Erling Smørgrav	LIBC=uclibc
161ca86bcf2SDag-Erling Smørgrav	#elif defined(__dietlibc__)
162ca86bcf2SDag-Erling Smørgrav	LIBC=dietlibc
163f374ba41SEd Maste	#elif defined(__GLIBC__)
164ca86bcf2SDag-Erling Smørgrav	LIBC=gnu
165f374ba41SEd Maste	#else
166f374ba41SEd Maste	#include <stdarg.h>
167f374ba41SEd Maste	/* First heuristic to detect musl libc.  */
168f374ba41SEd Maste	#ifdef __DEFINED_va_list
169f374ba41SEd Maste	LIBC=musl
170f374ba41SEd Maste	#endif
171ca86bcf2SDag-Erling Smørgrav	#endif
172ca86bcf2SDag-Erling Smørgrav	EOF
173f374ba41SEd Maste	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
174f374ba41SEd Maste	eval "$cc_set_libc"
17519261079SEd Maste
176f374ba41SEd Maste	# Second heuristic to detect musl libc.
177f374ba41SEd Maste	if [ "$LIBC" = unknown ] &&
178f374ba41SEd Maste	   command -v ldd >/dev/null &&
179f374ba41SEd Maste	   ldd --version 2>&1 | grep -q ^musl; then
18019261079SEd Maste		LIBC=musl
18119261079SEd Maste	fi
182f374ba41SEd Maste
183f374ba41SEd Maste	# If the system lacks a compiler, then just pick glibc.
184f374ba41SEd Maste	# We could probably try harder.
185f374ba41SEd Maste	if [ "$LIBC" = unknown ]; then
186f374ba41SEd Maste		LIBC=gnu
187f374ba41SEd Maste	fi
188ca86bcf2SDag-Erling Smørgrav	;;
189ca86bcf2SDag-Erling Smørgravesac
190ca86bcf2SDag-Erling Smørgrav
19183d2307dSDag-Erling Smørgrav# Note: order is significant - the case branches are not exclusive.
19283d2307dSDag-Erling Smørgrav
193f374ba41SEd Mastecase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
19483d2307dSDag-Erling Smørgrav    *:NetBSD:*:*)
19583d2307dSDag-Erling Smørgrav	# NetBSD (nbsd) targets should (where applicable) match one or
196e4a9863fSDag-Erling Smørgrav	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
19783d2307dSDag-Erling Smørgrav	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
19883d2307dSDag-Erling Smørgrav	# switched to ELF, *-*-netbsd* would select the old
19983d2307dSDag-Erling Smørgrav	# object file format.  This provides both forward
20083d2307dSDag-Erling Smørgrav	# compatibility and a consistent mechanism for selecting the
20183d2307dSDag-Erling Smørgrav	# object file format.
20283d2307dSDag-Erling Smørgrav	#
20383d2307dSDag-Erling Smørgrav	# Note: NetBSD doesn't particularly care about the vendor
20483d2307dSDag-Erling Smørgrav	# portion of the name.  We always set it to "unknown".
205ca86bcf2SDag-Erling Smørgrav	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
206f374ba41SEd Maste	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
207f374ba41SEd Maste	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
208ca86bcf2SDag-Erling Smørgrav	    echo unknown)`
209f374ba41SEd Maste	case $UNAME_MACHINE_ARCH in
210f374ba41SEd Maste	    aarch64eb) machine=aarch64_be-unknown ;;
2114b17dab0SDag-Erling Smørgrav	    armeb) machine=armeb-unknown ;;
21283d2307dSDag-Erling Smørgrav	    arm*) machine=arm-unknown ;;
21383d2307dSDag-Erling Smørgrav	    sh3el) machine=shl-unknown ;;
21483d2307dSDag-Erling Smørgrav	    sh3eb) machine=sh-unknown ;;
215cce7d346SDag-Erling Smørgrav	    sh5el) machine=sh5le-unknown ;;
216ca86bcf2SDag-Erling Smørgrav	    earmv*)
21719261079SEd Maste		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
21819261079SEd Maste		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
219f374ba41SEd Maste		machine=${arch}${endian}-unknown
220ca86bcf2SDag-Erling Smørgrav		;;
221f374ba41SEd Maste	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
22283d2307dSDag-Erling Smørgrav	esac
22383d2307dSDag-Erling Smørgrav	# The Operating System including object format, if it has switched
224ca86bcf2SDag-Erling Smørgrav	# to ELF recently (or will in the future) and ABI.
225f374ba41SEd Maste	case $UNAME_MACHINE_ARCH in
226ca86bcf2SDag-Erling Smørgrav	    earm*)
227ca86bcf2SDag-Erling Smørgrav		os=netbsdelf
228ca86bcf2SDag-Erling Smørgrav		;;
22983d2307dSDag-Erling Smørgrav	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
23019261079SEd Maste		set_cc_for_build
23183d2307dSDag-Erling Smørgrav		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
232b15c8340SDag-Erling Smørgrav			| grep -q __ELF__
23383d2307dSDag-Erling Smørgrav		then
23483d2307dSDag-Erling Smørgrav		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
23583d2307dSDag-Erling Smørgrav		    # Return netbsd for either.  FIX?
23683d2307dSDag-Erling Smørgrav		    os=netbsd
23783d2307dSDag-Erling Smørgrav		else
23883d2307dSDag-Erling Smørgrav		    os=netbsdelf
23983d2307dSDag-Erling Smørgrav		fi
24083d2307dSDag-Erling Smørgrav		;;
24183d2307dSDag-Erling Smørgrav	    *)
24283d2307dSDag-Erling Smørgrav		os=netbsd
24383d2307dSDag-Erling Smørgrav		;;
24483d2307dSDag-Erling Smørgrav	esac
245ca86bcf2SDag-Erling Smørgrav	# Determine ABI tags.
246f374ba41SEd Maste	case $UNAME_MACHINE_ARCH in
247ca86bcf2SDag-Erling Smørgrav	    earm*)
248ca86bcf2SDag-Erling Smørgrav		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
24919261079SEd Maste		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
250ca86bcf2SDag-Erling Smørgrav		;;
251ca86bcf2SDag-Erling Smørgrav	esac
25283d2307dSDag-Erling Smørgrav	# The OS release
253d74d50a8SDag-Erling Smørgrav	# Debian GNU/NetBSD machines have a different userland, and
254d74d50a8SDag-Erling Smørgrav	# thus, need a distinct triplet. However, they do not need
255d74d50a8SDag-Erling Smørgrav	# kernel version information, so it can be replaced with a
256d74d50a8SDag-Erling Smørgrav	# suitable tag, in the style of linux-gnu.
257f374ba41SEd Maste	case $UNAME_VERSION in
258d74d50a8SDag-Erling Smørgrav	    Debian*)
259d74d50a8SDag-Erling Smørgrav		release='-gnu'
260d74d50a8SDag-Erling Smørgrav		;;
261d74d50a8SDag-Erling Smørgrav	    *)
26219261079SEd Maste		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
263d74d50a8SDag-Erling Smørgrav		;;
264d74d50a8SDag-Erling Smørgrav	esac
26583d2307dSDag-Erling Smørgrav	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
26683d2307dSDag-Erling Smørgrav	# contains redundant information, the shorter form:
26783d2307dSDag-Erling Smørgrav	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
268f374ba41SEd Maste	GUESS=$machine-${os}${release}${abi-}
269f374ba41SEd Maste	;;
270e4a9863fSDag-Erling Smørgrav    *:Bitrig:*:*)
271e4a9863fSDag-Erling Smørgrav	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
272f374ba41SEd Maste	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
273f374ba41SEd Maste	;;
27483d2307dSDag-Erling Smørgrav    *:OpenBSD:*:*)
275cce7d346SDag-Erling Smørgrav	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
276f374ba41SEd Maste	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
277f374ba41SEd Maste	;;
278f374ba41SEd Maste    *:SecBSD:*:*)
279f374ba41SEd Maste	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
280f374ba41SEd Maste	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
281f374ba41SEd Maste	;;
282ca86bcf2SDag-Erling Smørgrav    *:LibertyBSD:*:*)
283ca86bcf2SDag-Erling Smørgrav	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
284f374ba41SEd Maste	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
285f374ba41SEd Maste	;;
28619261079SEd Maste    *:MidnightBSD:*:*)
287f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
288f374ba41SEd Maste	;;
289043840dfSDag-Erling Smørgrav    *:ekkoBSD:*:*)
290f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
291f374ba41SEd Maste	;;
292cce7d346SDag-Erling Smørgrav    *:SolidBSD:*:*)
293f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
294f374ba41SEd Maste	;;
29519261079SEd Maste    *:OS108:*:*)
296f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
297f374ba41SEd Maste	;;
298043840dfSDag-Erling Smørgrav    macppc:MirBSD:*:*)
299f374ba41SEd Maste	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
300f374ba41SEd Maste	;;
301043840dfSDag-Erling Smørgrav    *:MirBSD:*:*)
302f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
303f374ba41SEd Maste	;;
304ca86bcf2SDag-Erling Smørgrav    *:Sortix:*:*)
305f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-sortix
306f374ba41SEd Maste	;;
30719261079SEd Maste    *:Twizzler:*:*)
308f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-twizzler
309f374ba41SEd Maste	;;
31019261079SEd Maste    *:Redox:*:*)
311f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-redox
312f374ba41SEd Maste	;;
31319261079SEd Maste    mips:OSF1:*.*)
314f374ba41SEd Maste	GUESS=mips-dec-osf1
315f374ba41SEd Maste	;;
31683d2307dSDag-Erling Smørgrav    alpha:OSF1:*:*)
317f374ba41SEd Maste	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
318f374ba41SEd Maste	trap '' 0
319043840dfSDag-Erling Smørgrav	case $UNAME_RELEASE in
320043840dfSDag-Erling Smørgrav	*4.0)
32183d2307dSDag-Erling Smørgrav		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
322043840dfSDag-Erling Smørgrav		;;
323043840dfSDag-Erling Smørgrav	*5.*)
324043840dfSDag-Erling Smørgrav		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
325043840dfSDag-Erling Smørgrav		;;
326043840dfSDag-Erling Smørgrav	esac
327d74d50a8SDag-Erling Smørgrav	# According to Compaq, /usr/sbin/psrinfo has been available on
328d74d50a8SDag-Erling Smørgrav	# OSF/1 and Tru64 systems produced since 1995.  I hope that
329d74d50a8SDag-Erling Smørgrav	# covers most systems running today.  This code pipes the CPU
330d74d50a8SDag-Erling Smørgrav	# types through head -n 1, so we only detect the type of CPU 0.
331d74d50a8SDag-Erling Smørgrav	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
332f374ba41SEd Maste	case $ALPHA_CPU_TYPE in
333d74d50a8SDag-Erling Smørgrav	    "EV4 (21064)")
334ca86bcf2SDag-Erling Smørgrav		UNAME_MACHINE=alpha ;;
335d74d50a8SDag-Erling Smørgrav	    "EV4.5 (21064)")
336ca86bcf2SDag-Erling Smørgrav		UNAME_MACHINE=alpha ;;
337d74d50a8SDag-Erling Smørgrav	    "LCA4 (21066/21068)")
338ca86bcf2SDag-Erling Smørgrav		UNAME_MACHINE=alpha ;;
339d74d50a8SDag-Erling Smørgrav	    "EV5 (21164)")
340ca86bcf2SDag-Erling Smørgrav		UNAME_MACHINE=alphaev5 ;;
341d74d50a8SDag-Erling Smørgrav	    "EV5.6 (21164A)")
342ca86bcf2SDag-Erling Smørgrav		UNAME_MACHINE=alphaev56 ;;
343d74d50a8SDag-Erling Smørgrav	    "EV5.6 (21164PC)")
344ca86bcf2SDag-Erling Smørgrav		UNAME_MACHINE=alphapca56 ;;
345d74d50a8SDag-Erling Smørgrav	    "EV5.7 (21164PC)")
346ca86bcf2SDag-Erling Smørgrav		UNAME_MACHINE=alphapca57 ;;
347d74d50a8SDag-Erling Smørgrav	    "EV6 (21264)")
348ca86bcf2SDag-Erling Smørgrav		UNAME_MACHINE=alphaev6 ;;
349d74d50a8SDag-Erling Smørgrav	    "EV6.7 (21264A)")
350ca86bcf2SDag-Erling Smørgrav		UNAME_MACHINE=alphaev67 ;;
351d74d50a8SDag-Erling Smørgrav	    "EV6.8CB (21264C)")
352ca86bcf2SDag-Erling Smørgrav		UNAME_MACHINE=alphaev68 ;;
353d74d50a8SDag-Erling Smørgrav	    "EV6.8AL (21264B)")
354ca86bcf2SDag-Erling Smørgrav		UNAME_MACHINE=alphaev68 ;;
355d74d50a8SDag-Erling Smørgrav	    "EV6.8CX (21264D)")
356ca86bcf2SDag-Erling Smørgrav		UNAME_MACHINE=alphaev68 ;;
357d74d50a8SDag-Erling Smørgrav	    "EV6.9A (21264/EV69A)")
358ca86bcf2SDag-Erling Smørgrav		UNAME_MACHINE=alphaev69 ;;
359d74d50a8SDag-Erling Smørgrav	    "EV7 (21364)")
360ca86bcf2SDag-Erling Smørgrav		UNAME_MACHINE=alphaev7 ;;
361d74d50a8SDag-Erling Smørgrav	    "EV7.9 (21364A)")
362ca86bcf2SDag-Erling Smørgrav		UNAME_MACHINE=alphaev79 ;;
363d74d50a8SDag-Erling Smørgrav	esac
364043840dfSDag-Erling Smørgrav	# A Pn.n version is a patched version.
36583d2307dSDag-Erling Smørgrav	# A Vn.n version is a released version.
36683d2307dSDag-Erling Smørgrav	# A Tn.n version is a released field test version.
36783d2307dSDag-Erling Smørgrav	# A Xn.n version is an unreleased experimental baselevel.
36883d2307dSDag-Erling Smørgrav	# 1.2 uses "1.2" for uname -r.
369f374ba41SEd Maste	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
370f374ba41SEd Maste	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
371f374ba41SEd Maste	;;
37283d2307dSDag-Erling Smørgrav    Amiga*:UNIX_System_V:4.0:*)
373f374ba41SEd Maste	GUESS=m68k-unknown-sysv4
374f374ba41SEd Maste	;;
37583d2307dSDag-Erling Smørgrav    *:[Aa]miga[Oo][Ss]:*:*)
376f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-amigaos
377f374ba41SEd Maste	;;
37883d2307dSDag-Erling Smørgrav    *:[Mm]orph[Oo][Ss]:*:*)
379f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-morphos
380f374ba41SEd Maste	;;
38183d2307dSDag-Erling Smørgrav    *:OS/390:*:*)
382f374ba41SEd Maste	GUESS=i370-ibm-openedition
383f374ba41SEd Maste	;;
384043840dfSDag-Erling Smørgrav    *:z/VM:*:*)
385f374ba41SEd Maste	GUESS=s390-ibm-zvmoe
386f374ba41SEd Maste	;;
387043840dfSDag-Erling Smørgrav    *:OS400:*:*)
388f374ba41SEd Maste	GUESS=powerpc-ibm-os400
389f374ba41SEd Maste	;;
39083d2307dSDag-Erling Smørgrav    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
391f374ba41SEd Maste	GUESS=arm-acorn-riscix$UNAME_RELEASE
392f374ba41SEd Maste	;;
393e4a9863fSDag-Erling Smørgrav    arm*:riscos:*:*|arm*:RISCOS:*:*)
394f374ba41SEd Maste	GUESS=arm-unknown-riscos
395f374ba41SEd Maste	;;
39683d2307dSDag-Erling Smørgrav    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
397f374ba41SEd Maste	GUESS=hppa1.1-hitachi-hiuxmpp
398f374ba41SEd Maste	;;
39983d2307dSDag-Erling Smørgrav    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
40083d2307dSDag-Erling Smørgrav	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
401f374ba41SEd Maste	case `(/bin/universe) 2>/dev/null` in
402f374ba41SEd Maste	    att) GUESS=pyramid-pyramid-sysv3 ;;
403f374ba41SEd Maste	    *)   GUESS=pyramid-pyramid-bsd   ;;
404f374ba41SEd Maste	esac
405f374ba41SEd Maste	;;
40683d2307dSDag-Erling Smørgrav    NILE*:*:*:dcosx)
407f374ba41SEd Maste	GUESS=pyramid-pyramid-svr4
408f374ba41SEd Maste	;;
409d74d50a8SDag-Erling Smørgrav    DRS?6000:unix:4.0:6*)
410f374ba41SEd Maste	GUESS=sparc-icl-nx6
411f374ba41SEd Maste	;;
412043840dfSDag-Erling Smørgrav    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
4134b17dab0SDag-Erling Smørgrav	case `/usr/bin/uname -p` in
414f374ba41SEd Maste	    sparc) GUESS=sparc-icl-nx7 ;;
415f374ba41SEd Maste	esac
416f374ba41SEd Maste	;;
417b15c8340SDag-Erling Smørgrav    s390x:SunOS:*:*)
418f374ba41SEd Maste	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
419f374ba41SEd Maste	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
420f374ba41SEd Maste	;;
42183d2307dSDag-Erling Smørgrav    sun4H:SunOS:5.*:*)
422f374ba41SEd Maste	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
423f374ba41SEd Maste	GUESS=sparc-hal-solaris2$SUN_REL
424f374ba41SEd Maste	;;
42583d2307dSDag-Erling Smørgrav    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
426f374ba41SEd Maste	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
427f374ba41SEd Maste	GUESS=sparc-sun-solaris2$SUN_REL
428f374ba41SEd Maste	;;
429b15c8340SDag-Erling Smørgrav    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
430f374ba41SEd Maste	GUESS=i386-pc-auroraux$UNAME_RELEASE
431f374ba41SEd Maste	;;
432cce7d346SDag-Erling Smørgrav    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
43319261079SEd Maste	set_cc_for_build
434ca86bcf2SDag-Erling Smørgrav	SUN_ARCH=i386
435b15c8340SDag-Erling Smørgrav	# If there is a compiler, see if it is configured for 64-bit objects.
436b15c8340SDag-Erling Smørgrav	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
437b15c8340SDag-Erling Smørgrav	# This test works for both compilers.
438f374ba41SEd Maste	if test "$CC_FOR_BUILD" != no_compiler_found; then
439b15c8340SDag-Erling Smørgrav	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
440f374ba41SEd Maste		(CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \
441b15c8340SDag-Erling Smørgrav		grep IS_64BIT_ARCH >/dev/null
442b15c8340SDag-Erling Smørgrav	    then
443ca86bcf2SDag-Erling Smørgrav		SUN_ARCH=x86_64
444b15c8340SDag-Erling Smørgrav	    fi
445b15c8340SDag-Erling Smørgrav	fi
446f374ba41SEd Maste	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
447f374ba41SEd Maste	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
448f374ba41SEd Maste	;;
44983d2307dSDag-Erling Smørgrav    sun4*:SunOS:6*:*)
45083d2307dSDag-Erling Smørgrav	# According to config.sub, this is the proper way to canonicalize
45183d2307dSDag-Erling Smørgrav	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
45283d2307dSDag-Erling Smørgrav	# it's likely to be more like Solaris than SunOS4.
453f374ba41SEd Maste	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
454f374ba41SEd Maste	GUESS=sparc-sun-solaris3$SUN_REL
455f374ba41SEd Maste	;;
45683d2307dSDag-Erling Smørgrav    sun4*:SunOS:*:*)
457f374ba41SEd Maste	case `/usr/bin/arch -k` in
45883d2307dSDag-Erling Smørgrav	    Series*|S4*)
45983d2307dSDag-Erling Smørgrav		UNAME_RELEASE=`uname -v`
46083d2307dSDag-Erling Smørgrav		;;
46183d2307dSDag-Erling Smørgrav	esac
46283d2307dSDag-Erling Smørgrav	# Japanese Language versions have a version number like `4.1.3-JL'.
463f374ba41SEd Maste	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
464f374ba41SEd Maste	GUESS=sparc-sun-sunos$SUN_REL
465f374ba41SEd Maste	;;
46683d2307dSDag-Erling Smørgrav    sun3*:SunOS:*:*)
467f374ba41SEd Maste	GUESS=m68k-sun-sunos$UNAME_RELEASE
468f374ba41SEd Maste	;;
46983d2307dSDag-Erling Smørgrav    sun*:*:4.2BSD:*)
4704b17dab0SDag-Erling Smørgrav	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
47119261079SEd Maste	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
472f374ba41SEd Maste	case `/bin/arch` in
47383d2307dSDag-Erling Smørgrav	    sun3)
474f374ba41SEd Maste		GUESS=m68k-sun-sunos$UNAME_RELEASE
47583d2307dSDag-Erling Smørgrav		;;
47683d2307dSDag-Erling Smørgrav	    sun4)
477f374ba41SEd Maste		GUESS=sparc-sun-sunos$UNAME_RELEASE
47883d2307dSDag-Erling Smørgrav		;;
47983d2307dSDag-Erling Smørgrav	esac
480f374ba41SEd Maste	;;
48183d2307dSDag-Erling Smørgrav    aushp:SunOS:*:*)
482f374ba41SEd Maste	GUESS=sparc-auspex-sunos$UNAME_RELEASE
483f374ba41SEd Maste	;;
48483d2307dSDag-Erling Smørgrav    # The situation for MiNT is a little confusing.  The machine name
48583d2307dSDag-Erling Smørgrav    # can be virtually everything (everything which is not
48683d2307dSDag-Erling Smørgrav    # "atarist" or "atariste" at least should have a processor
48783d2307dSDag-Erling Smørgrav    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
48883d2307dSDag-Erling Smørgrav    # to the lowercase version "mint" (or "freemint").  Finally
48983d2307dSDag-Erling Smørgrav    # the system name "TOS" denotes a system which is actually not
49083d2307dSDag-Erling Smørgrav    # MiNT.  But MiNT is downward compatible to TOS, so this should
49183d2307dSDag-Erling Smørgrav    # be no problem.
49283d2307dSDag-Erling Smørgrav    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
493f374ba41SEd Maste	GUESS=m68k-atari-mint$UNAME_RELEASE
494f374ba41SEd Maste	;;
49583d2307dSDag-Erling Smørgrav    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
496f374ba41SEd Maste	GUESS=m68k-atari-mint$UNAME_RELEASE
497f374ba41SEd Maste	;;
49883d2307dSDag-Erling Smørgrav    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
499f374ba41SEd Maste	GUESS=m68k-atari-mint$UNAME_RELEASE
500f374ba41SEd Maste	;;
50183d2307dSDag-Erling Smørgrav    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
502f374ba41SEd Maste	GUESS=m68k-milan-mint$UNAME_RELEASE
503f374ba41SEd Maste	;;
50483d2307dSDag-Erling Smørgrav    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
505f374ba41SEd Maste	GUESS=m68k-hades-mint$UNAME_RELEASE
506f374ba41SEd Maste	;;
50783d2307dSDag-Erling Smørgrav    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
508f374ba41SEd Maste	GUESS=m68k-unknown-mint$UNAME_RELEASE
509f374ba41SEd Maste	;;
510043840dfSDag-Erling Smørgrav    m68k:machten:*:*)
511f374ba41SEd Maste	GUESS=m68k-apple-machten$UNAME_RELEASE
512f374ba41SEd Maste	;;
51383d2307dSDag-Erling Smørgrav    powerpc:machten:*:*)
514f374ba41SEd Maste	GUESS=powerpc-apple-machten$UNAME_RELEASE
515f374ba41SEd Maste	;;
51683d2307dSDag-Erling Smørgrav    RISC*:Mach:*:*)
517f374ba41SEd Maste	GUESS=mips-dec-mach_bsd4.3
518f374ba41SEd Maste	;;
51983d2307dSDag-Erling Smørgrav    RISC*:ULTRIX:*:*)
520f374ba41SEd Maste	GUESS=mips-dec-ultrix$UNAME_RELEASE
521f374ba41SEd Maste	;;
52283d2307dSDag-Erling Smørgrav    VAX*:ULTRIX*:*:*)
523f374ba41SEd Maste	GUESS=vax-dec-ultrix$UNAME_RELEASE
524f374ba41SEd Maste	;;
52583d2307dSDag-Erling Smørgrav    2020:CLIX:*:* | 2430:CLIX:*:*)
526f374ba41SEd Maste	GUESS=clipper-intergraph-clix$UNAME_RELEASE
527f374ba41SEd Maste	;;
52883d2307dSDag-Erling Smørgrav    mips:*:*:UMIPS | mips:*:*:RISCos)
52919261079SEd Maste	set_cc_for_build
53019261079SEd Maste	sed 's/^	//' << EOF > "$dummy.c"
53183d2307dSDag-Erling Smørgrav#ifdef __cplusplus
53283d2307dSDag-Erling Smørgrav#include <stdio.h>  /* for printf() prototype */
53383d2307dSDag-Erling Smørgrav	int main (int argc, char *argv[]) {
53483d2307dSDag-Erling Smørgrav#else
53583d2307dSDag-Erling Smørgrav	int main (argc, argv) int argc; char *argv[]; {
53683d2307dSDag-Erling Smørgrav#endif
53783d2307dSDag-Erling Smørgrav	#if defined (host_mips) && defined (MIPSEB)
53883d2307dSDag-Erling Smørgrav	#if defined (SYSTYPE_SYSV)
53919261079SEd Maste	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
54083d2307dSDag-Erling Smørgrav	#endif
54183d2307dSDag-Erling Smørgrav	#if defined (SYSTYPE_SVR4)
54219261079SEd Maste	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
54383d2307dSDag-Erling Smørgrav	#endif
54483d2307dSDag-Erling Smørgrav	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
54519261079SEd Maste	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
54683d2307dSDag-Erling Smørgrav	#endif
54783d2307dSDag-Erling Smørgrav	#endif
54883d2307dSDag-Erling Smørgrav	  exit (-1);
54983d2307dSDag-Erling Smørgrav	}
55083d2307dSDag-Erling SmørgravEOF
55119261079SEd Maste	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
55219261079SEd Maste	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
55319261079SEd Maste	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
554043840dfSDag-Erling Smørgrav	    { echo "$SYSTEM_NAME"; exit; }
555f374ba41SEd Maste	GUESS=mips-mips-riscos$UNAME_RELEASE
556f374ba41SEd Maste	;;
55783d2307dSDag-Erling Smørgrav    Motorola:PowerMAX_OS:*:*)
558f374ba41SEd Maste	GUESS=powerpc-motorola-powermax
559f374ba41SEd Maste	;;
560d74d50a8SDag-Erling Smørgrav    Motorola:*:4.3:PL8-*)
561f374ba41SEd Maste	GUESS=powerpc-harris-powermax
562f374ba41SEd Maste	;;
563d74d50a8SDag-Erling Smørgrav    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
564f374ba41SEd Maste	GUESS=powerpc-harris-powermax
565f374ba41SEd Maste	;;
56683d2307dSDag-Erling Smørgrav    Night_Hawk:Power_UNIX:*:*)
567f374ba41SEd Maste	GUESS=powerpc-harris-powerunix
568f374ba41SEd Maste	;;
56983d2307dSDag-Erling Smørgrav    m88k:CX/UX:7*:*)
570f374ba41SEd Maste	GUESS=m88k-harris-cxux7
571f374ba41SEd Maste	;;
57283d2307dSDag-Erling Smørgrav    m88k:*:4*:R4*)
573f374ba41SEd Maste	GUESS=m88k-motorola-sysv4
574f374ba41SEd Maste	;;
57583d2307dSDag-Erling Smørgrav    m88k:*:3*:R3*)
576f374ba41SEd Maste	GUESS=m88k-motorola-sysv3
577f374ba41SEd Maste	;;
57883d2307dSDag-Erling Smørgrav    AViiON:dgux:*:*)
57983d2307dSDag-Erling Smørgrav	# DG/UX returns AViiON for all architectures
58083d2307dSDag-Erling Smørgrav	UNAME_PROCESSOR=`/usr/bin/uname -p`
581f374ba41SEd Maste	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
58283d2307dSDag-Erling Smørgrav	then
583f374ba41SEd Maste	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
584f374ba41SEd Maste	       test "$TARGET_BINARY_INTERFACE"x = x
58583d2307dSDag-Erling Smørgrav	    then
586f374ba41SEd Maste		GUESS=m88k-dg-dgux$UNAME_RELEASE
58783d2307dSDag-Erling Smørgrav	    else
588f374ba41SEd Maste		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
58983d2307dSDag-Erling Smørgrav	    fi
59083d2307dSDag-Erling Smørgrav	else
591f374ba41SEd Maste	    GUESS=i586-dg-dgux$UNAME_RELEASE
59283d2307dSDag-Erling Smørgrav	fi
593f374ba41SEd Maste	;;
59483d2307dSDag-Erling Smørgrav    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
595f374ba41SEd Maste	GUESS=m88k-dolphin-sysv3
596f374ba41SEd Maste	;;
59783d2307dSDag-Erling Smørgrav    M88*:*:R3*:*)
59883d2307dSDag-Erling Smørgrav	# Delta 88k system running SVR3
599f374ba41SEd Maste	GUESS=m88k-motorola-sysv3
600f374ba41SEd Maste	;;
60183d2307dSDag-Erling Smørgrav    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
602f374ba41SEd Maste	GUESS=m88k-tektronix-sysv3
603f374ba41SEd Maste	;;
60483d2307dSDag-Erling Smørgrav    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
605f374ba41SEd Maste	GUESS=m68k-tektronix-bsd
606f374ba41SEd Maste	;;
60783d2307dSDag-Erling Smørgrav    *:IRIX*:*:*)
608f374ba41SEd Maste	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
609f374ba41SEd Maste	GUESS=mips-sgi-irix$IRIX_REL
610f374ba41SEd Maste	;;
61183d2307dSDag-Erling Smørgrav    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
612f374ba41SEd Maste	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
613f374ba41SEd Maste	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
61483d2307dSDag-Erling Smørgrav    i*86:AIX:*:*)
615f374ba41SEd Maste	GUESS=i386-ibm-aix
616f374ba41SEd Maste	;;
61783d2307dSDag-Erling Smørgrav    ia64:AIX:*:*)
618f374ba41SEd Maste	if test -x /usr/bin/oslevel ; then
61983d2307dSDag-Erling Smørgrav		IBM_REV=`/usr/bin/oslevel`
62083d2307dSDag-Erling Smørgrav	else
621f374ba41SEd Maste		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
62283d2307dSDag-Erling Smørgrav	fi
623f374ba41SEd Maste	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
624f374ba41SEd Maste	;;
62583d2307dSDag-Erling Smørgrav    *:AIX:2:3)
62683d2307dSDag-Erling Smørgrav	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
62719261079SEd Maste		set_cc_for_build
62819261079SEd Maste		sed 's/^		//' << EOF > "$dummy.c"
62983d2307dSDag-Erling Smørgrav		#include <sys/systemcfg.h>
63083d2307dSDag-Erling Smørgrav
63183d2307dSDag-Erling Smørgrav		main()
63283d2307dSDag-Erling Smørgrav			{
63383d2307dSDag-Erling Smørgrav			if (!__power_pc())
63483d2307dSDag-Erling Smørgrav				exit(1);
63583d2307dSDag-Erling Smørgrav			puts("powerpc-ibm-aix3.2.5");
63683d2307dSDag-Erling Smørgrav			exit(0);
63783d2307dSDag-Erling Smørgrav			}
63883d2307dSDag-Erling SmørgravEOF
63919261079SEd Maste		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
640043840dfSDag-Erling Smørgrav		then
641f374ba41SEd Maste			GUESS=$SYSTEM_NAME
642043840dfSDag-Erling Smørgrav		else
643f374ba41SEd Maste			GUESS=rs6000-ibm-aix3.2.5
644043840dfSDag-Erling Smørgrav		fi
64583d2307dSDag-Erling Smørgrav	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
646f374ba41SEd Maste		GUESS=rs6000-ibm-aix3.2.4
64783d2307dSDag-Erling Smørgrav	else
648f374ba41SEd Maste		GUESS=rs6000-ibm-aix3.2
64983d2307dSDag-Erling Smørgrav	fi
650f374ba41SEd Maste	;;
651e146993eSDag-Erling Smørgrav    *:AIX:*:[4567])
6524b17dab0SDag-Erling Smørgrav	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
65319261079SEd Maste	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
65483d2307dSDag-Erling Smørgrav		IBM_ARCH=rs6000
65583d2307dSDag-Erling Smørgrav	else
65683d2307dSDag-Erling Smørgrav		IBM_ARCH=powerpc
65783d2307dSDag-Erling Smørgrav	fi
658f374ba41SEd Maste	if test -x /usr/bin/lslpp ; then
659f374ba41SEd Maste		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
660ca86bcf2SDag-Erling Smørgrav			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
66183d2307dSDag-Erling Smørgrav	else
662f374ba41SEd Maste		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
66383d2307dSDag-Erling Smørgrav	fi
664f374ba41SEd Maste	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
665f374ba41SEd Maste	;;
66683d2307dSDag-Erling Smørgrav    *:AIX:*:*)
667f374ba41SEd Maste	GUESS=rs6000-ibm-aix
668f374ba41SEd Maste	;;
66919261079SEd Maste    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
670f374ba41SEd Maste	GUESS=romp-ibm-bsd4.4
671f374ba41SEd Maste	;;
67283d2307dSDag-Erling Smørgrav    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
673f374ba41SEd Maste	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
674f374ba41SEd Maste	;;                                  # report: romp-ibm BSD 4.3
67583d2307dSDag-Erling Smørgrav    *:BOSX:*:*)
676f374ba41SEd Maste	GUESS=rs6000-bull-bosx
677f374ba41SEd Maste	;;
67883d2307dSDag-Erling Smørgrav    DPX/2?00:B.O.S.:*:*)
679f374ba41SEd Maste	GUESS=m68k-bull-sysv3
680f374ba41SEd Maste	;;
68183d2307dSDag-Erling Smørgrav    9000/[34]??:4.3bsd:1.*:*)
682f374ba41SEd Maste	GUESS=m68k-hp-bsd
683f374ba41SEd Maste	;;
68483d2307dSDag-Erling Smørgrav    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
685f374ba41SEd Maste	GUESS=m68k-hp-bsd4.4
686f374ba41SEd Maste	;;
68783d2307dSDag-Erling Smørgrav    9000/[34678]??:HP-UX:*:*)
68819261079SEd Maste	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
689f374ba41SEd Maste	case $UNAME_MACHINE in
69083d2307dSDag-Erling Smørgrav	    9000/31?)            HP_ARCH=m68000 ;;
69183d2307dSDag-Erling Smørgrav	    9000/[34]??)         HP_ARCH=m68k ;;
69283d2307dSDag-Erling Smørgrav	    9000/[678][0-9][0-9])
693f374ba41SEd Maste		if test -x /usr/bin/getconf; then
69483d2307dSDag-Erling Smørgrav		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
69583d2307dSDag-Erling Smørgrav		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
696f374ba41SEd Maste		    case $sc_cpu_version in
697ca86bcf2SDag-Erling Smørgrav		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
698ca86bcf2SDag-Erling Smørgrav		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
69983d2307dSDag-Erling Smørgrav		      532)                      # CPU_PA_RISC2_0
700f374ba41SEd Maste			case $sc_kernel_bits in
701ca86bcf2SDag-Erling Smørgrav			  32) HP_ARCH=hppa2.0n ;;
702ca86bcf2SDag-Erling Smørgrav			  64) HP_ARCH=hppa2.0w ;;
703ca86bcf2SDag-Erling Smørgrav			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
70483d2307dSDag-Erling Smørgrav			esac ;;
70583d2307dSDag-Erling Smørgrav		    esac
70683d2307dSDag-Erling Smørgrav		fi
707f374ba41SEd Maste		if test "$HP_ARCH" = ""; then
70819261079SEd Maste		    set_cc_for_build
70919261079SEd Maste		    sed 's/^		//' << EOF > "$dummy.c"
71083d2307dSDag-Erling Smørgrav
71183d2307dSDag-Erling Smørgrav		#define _HPUX_SOURCE
71283d2307dSDag-Erling Smørgrav		#include <stdlib.h>
71383d2307dSDag-Erling Smørgrav		#include <unistd.h>
71483d2307dSDag-Erling Smørgrav
71583d2307dSDag-Erling Smørgrav		int main ()
71683d2307dSDag-Erling Smørgrav		{
71783d2307dSDag-Erling Smørgrav		#if defined(_SC_KERNEL_BITS)
71883d2307dSDag-Erling Smørgrav		    long bits = sysconf(_SC_KERNEL_BITS);
71983d2307dSDag-Erling Smørgrav		#endif
72083d2307dSDag-Erling Smørgrav		    long cpu  = sysconf (_SC_CPU_VERSION);
72183d2307dSDag-Erling Smørgrav
72283d2307dSDag-Erling Smørgrav		    switch (cpu)
72383d2307dSDag-Erling Smørgrav			{
72483d2307dSDag-Erling Smørgrav			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
72583d2307dSDag-Erling Smørgrav			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
72683d2307dSDag-Erling Smørgrav			case CPU_PA_RISC2_0:
72783d2307dSDag-Erling Smørgrav		#if defined(_SC_KERNEL_BITS)
72883d2307dSDag-Erling Smørgrav			    switch (bits)
72983d2307dSDag-Erling Smørgrav				{
73083d2307dSDag-Erling Smørgrav				case 64: puts ("hppa2.0w"); break;
73183d2307dSDag-Erling Smørgrav				case 32: puts ("hppa2.0n"); break;
73283d2307dSDag-Erling Smørgrav				default: puts ("hppa2.0"); break;
73383d2307dSDag-Erling Smørgrav				} break;
73483d2307dSDag-Erling Smørgrav		#else  /* !defined(_SC_KERNEL_BITS) */
73583d2307dSDag-Erling Smørgrav			    puts ("hppa2.0"); break;
73683d2307dSDag-Erling Smørgrav		#endif
73783d2307dSDag-Erling Smørgrav			default: puts ("hppa1.0"); break;
73883d2307dSDag-Erling Smørgrav			}
73983d2307dSDag-Erling Smørgrav		    exit (0);
74083d2307dSDag-Erling Smørgrav		}
74183d2307dSDag-Erling SmørgravEOF
74219261079SEd Maste		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
743d74d50a8SDag-Erling Smørgrav		    test -z "$HP_ARCH" && HP_ARCH=hppa
74483d2307dSDag-Erling Smørgrav		fi ;;
74583d2307dSDag-Erling Smørgrav	esac
746f374ba41SEd Maste	if test "$HP_ARCH" = hppa2.0w
747d74d50a8SDag-Erling Smørgrav	then
74819261079SEd Maste	    set_cc_for_build
749043840dfSDag-Erling Smørgrav
750043840dfSDag-Erling Smørgrav	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
751043840dfSDag-Erling Smørgrav	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
752043840dfSDag-Erling Smørgrav	    # generating 64-bit code.  GNU and HP use different nomenclature:
753043840dfSDag-Erling Smørgrav	    #
754043840dfSDag-Erling Smørgrav	    # $ CC_FOR_BUILD=cc ./config.guess
755043840dfSDag-Erling Smørgrav	    # => hppa2.0w-hp-hpux11.23
756043840dfSDag-Erling Smørgrav	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
757043840dfSDag-Erling Smørgrav	    # => hppa64-hp-hpux11.23
758043840dfSDag-Erling Smørgrav
759ca86bcf2SDag-Erling Smørgrav	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
760b15c8340SDag-Erling Smørgrav		grep -q __LP64__
761d74d50a8SDag-Erling Smørgrav	    then
762ca86bcf2SDag-Erling Smørgrav		HP_ARCH=hppa2.0w
763d74d50a8SDag-Erling Smørgrav	    else
764ca86bcf2SDag-Erling Smørgrav		HP_ARCH=hppa64
765d74d50a8SDag-Erling Smørgrav	    fi
766d74d50a8SDag-Erling Smørgrav	fi
767f374ba41SEd Maste	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
768f374ba41SEd Maste	;;
76983d2307dSDag-Erling Smørgrav    ia64:HP-UX:*:*)
77019261079SEd Maste	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
771f374ba41SEd Maste	GUESS=ia64-hp-hpux$HPUX_REV
772f374ba41SEd Maste	;;
77383d2307dSDag-Erling Smørgrav    3050*:HI-UX:*:*)
77419261079SEd Maste	set_cc_for_build
77519261079SEd Maste	sed 's/^	//' << EOF > "$dummy.c"
77683d2307dSDag-Erling Smørgrav	#include <unistd.h>
77783d2307dSDag-Erling Smørgrav	int
77883d2307dSDag-Erling Smørgrav	main ()
77983d2307dSDag-Erling Smørgrav	{
78083d2307dSDag-Erling Smørgrav	  long cpu = sysconf (_SC_CPU_VERSION);
78183d2307dSDag-Erling Smørgrav	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
78283d2307dSDag-Erling Smørgrav	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
78383d2307dSDag-Erling Smørgrav	     results, however.  */
78483d2307dSDag-Erling Smørgrav	  if (CPU_IS_PA_RISC (cpu))
78583d2307dSDag-Erling Smørgrav	    {
78683d2307dSDag-Erling Smørgrav	      switch (cpu)
78783d2307dSDag-Erling Smørgrav		{
78883d2307dSDag-Erling Smørgrav		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
78983d2307dSDag-Erling Smørgrav		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
79083d2307dSDag-Erling Smørgrav		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
79183d2307dSDag-Erling Smørgrav		  default: puts ("hppa-hitachi-hiuxwe2"); break;
79283d2307dSDag-Erling Smørgrav		}
79383d2307dSDag-Erling Smørgrav	    }
79483d2307dSDag-Erling Smørgrav	  else if (CPU_IS_HP_MC68K (cpu))
79583d2307dSDag-Erling Smørgrav	    puts ("m68k-hitachi-hiuxwe2");
79683d2307dSDag-Erling Smørgrav	  else puts ("unknown-hitachi-hiuxwe2");
79783d2307dSDag-Erling Smørgrav	  exit (0);
79883d2307dSDag-Erling Smørgrav	}
79983d2307dSDag-Erling SmørgravEOF
80019261079SEd Maste	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
801043840dfSDag-Erling Smørgrav		{ echo "$SYSTEM_NAME"; exit; }
802f374ba41SEd Maste	GUESS=unknown-hitachi-hiuxwe2
803f374ba41SEd Maste	;;
80483d2307dSDag-Erling Smørgrav    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
805f374ba41SEd Maste	GUESS=hppa1.1-hp-bsd
806f374ba41SEd Maste	;;
80783d2307dSDag-Erling Smørgrav    9000/8??:4.3bsd:*:*)
808f374ba41SEd Maste	GUESS=hppa1.0-hp-bsd
809f374ba41SEd Maste	;;
81083d2307dSDag-Erling Smørgrav    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
811f374ba41SEd Maste	GUESS=hppa1.0-hp-mpeix
812f374ba41SEd Maste	;;
81383d2307dSDag-Erling Smørgrav    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
814f374ba41SEd Maste	GUESS=hppa1.1-hp-osf
815f374ba41SEd Maste	;;
81683d2307dSDag-Erling Smørgrav    hp8??:OSF1:*:*)
817f374ba41SEd Maste	GUESS=hppa1.0-hp-osf
818f374ba41SEd Maste	;;
81983d2307dSDag-Erling Smørgrav    i*86:OSF1:*:*)
820f374ba41SEd Maste	if test -x /usr/sbin/sysversion ; then
821f374ba41SEd Maste	    GUESS=$UNAME_MACHINE-unknown-osf1mk
82283d2307dSDag-Erling Smørgrav	else
823f374ba41SEd Maste	    GUESS=$UNAME_MACHINE-unknown-osf1
82483d2307dSDag-Erling Smørgrav	fi
825f374ba41SEd Maste	;;
82683d2307dSDag-Erling Smørgrav    parisc*:Lites*:*:*)
827f374ba41SEd Maste	GUESS=hppa1.1-hp-lites
828f374ba41SEd Maste	;;
82983d2307dSDag-Erling Smørgrav    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
830f374ba41SEd Maste	GUESS=c1-convex-bsd
831f374ba41SEd Maste	;;
83283d2307dSDag-Erling Smørgrav    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
83383d2307dSDag-Erling Smørgrav	if getsysinfo -f scalar_acc
83483d2307dSDag-Erling Smørgrav	then echo c32-convex-bsd
83583d2307dSDag-Erling Smørgrav	else echo c2-convex-bsd
83683d2307dSDag-Erling Smørgrav	fi
837043840dfSDag-Erling Smørgrav	exit ;;
83883d2307dSDag-Erling Smørgrav    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
839f374ba41SEd Maste	GUESS=c34-convex-bsd
840f374ba41SEd Maste	;;
84183d2307dSDag-Erling Smørgrav    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
842f374ba41SEd Maste	GUESS=c38-convex-bsd
843f374ba41SEd Maste	;;
84483d2307dSDag-Erling Smørgrav    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
845f374ba41SEd Maste	GUESS=c4-convex-bsd
846f374ba41SEd Maste	;;
84783d2307dSDag-Erling Smørgrav    CRAY*Y-MP:*:*:*)
848f374ba41SEd Maste	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
849f374ba41SEd Maste	GUESS=ymp-cray-unicos$CRAY_REL
850f374ba41SEd Maste	;;
85183d2307dSDag-Erling Smørgrav    CRAY*[A-Z]90:*:*:*)
85219261079SEd Maste	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
85383d2307dSDag-Erling Smørgrav	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
85483d2307dSDag-Erling Smørgrav	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
85583d2307dSDag-Erling Smørgrav	      -e 's/\.[^.]*$/.X/'
856043840dfSDag-Erling Smørgrav	exit ;;
85783d2307dSDag-Erling Smørgrav    CRAY*TS:*:*:*)
858f374ba41SEd Maste	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
859f374ba41SEd Maste	GUESS=t90-cray-unicos$CRAY_REL
860f374ba41SEd Maste	;;
86183d2307dSDag-Erling Smørgrav    CRAY*T3E:*:*:*)
862f374ba41SEd Maste	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
863f374ba41SEd Maste	GUESS=alphaev5-cray-unicosmk$CRAY_REL
864f374ba41SEd Maste	;;
86583d2307dSDag-Erling Smørgrav    CRAY*SV1:*:*:*)
866f374ba41SEd Maste	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
867f374ba41SEd Maste	GUESS=sv1-cray-unicos$CRAY_REL
868f374ba41SEd Maste	;;
869d0c8c0bcSDag-Erling Smørgrav    *:UNICOS/mp:*:*)
870f374ba41SEd Maste	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
871f374ba41SEd Maste	GUESS=craynv-cray-unicosmp$CRAY_REL
872f374ba41SEd Maste	;;
87383d2307dSDag-Erling Smørgrav    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
874ca86bcf2SDag-Erling Smørgrav	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
875ca86bcf2SDag-Erling Smørgrav	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
87619261079SEd Maste	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
877f374ba41SEd Maste	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
878f374ba41SEd Maste	;;
879043840dfSDag-Erling Smørgrav    5000:UNIX_System_V:4.*:*)
880ca86bcf2SDag-Erling Smørgrav	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
88119261079SEd Maste	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
882f374ba41SEd Maste	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
883f374ba41SEd Maste	;;
88483d2307dSDag-Erling Smørgrav    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
885f374ba41SEd Maste	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
886f374ba41SEd Maste	;;
88783d2307dSDag-Erling Smørgrav    sparc*:BSD/OS:*:*)
888f374ba41SEd Maste	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
889f374ba41SEd Maste	;;
89083d2307dSDag-Erling Smørgrav    *:BSD/OS:*:*)
891f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
892f374ba41SEd Maste	;;
89319261079SEd Maste    arm:FreeBSD:*:*)
89419261079SEd Maste	UNAME_PROCESSOR=`uname -p`
89519261079SEd Maste	set_cc_for_build
89619261079SEd Maste	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
89719261079SEd Maste	    | grep -q __ARM_PCS_VFP
89819261079SEd Maste	then
899f374ba41SEd Maste	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
900f374ba41SEd Maste	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
90119261079SEd Maste	else
902f374ba41SEd Maste	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
903f374ba41SEd Maste	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
90419261079SEd Maste	fi
905f374ba41SEd Maste	;;
906043840dfSDag-Erling Smørgrav    *:FreeBSD:*:*)
907e4a9863fSDag-Erling Smørgrav	UNAME_PROCESSOR=`/usr/bin/uname -p`
908f374ba41SEd Maste	case $UNAME_PROCESSOR in
909cce7d346SDag-Erling Smørgrav	    amd64)
91019261079SEd Maste		UNAME_PROCESSOR=x86_64 ;;
91119261079SEd Maste	    i386)
91219261079SEd Maste		UNAME_PROCESSOR=i586 ;;
913cce7d346SDag-Erling Smørgrav	esac
914f374ba41SEd Maste	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
915f374ba41SEd Maste	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
916f374ba41SEd Maste	;;
91783d2307dSDag-Erling Smørgrav    i*:CYGWIN*:*)
918f374ba41SEd Maste	GUESS=$UNAME_MACHINE-pc-cygwin
919f374ba41SEd Maste	;;
920e4a9863fSDag-Erling Smørgrav    *:MINGW64*:*)
921f374ba41SEd Maste	GUESS=$UNAME_MACHINE-pc-mingw64
922f374ba41SEd Maste	;;
923cce7d346SDag-Erling Smørgrav    *:MINGW*:*)
924f374ba41SEd Maste	GUESS=$UNAME_MACHINE-pc-mingw32
925f374ba41SEd Maste	;;
926ca86bcf2SDag-Erling Smørgrav    *:MSYS*:*)
927f374ba41SEd Maste	GUESS=$UNAME_MACHINE-pc-msys
928f374ba41SEd Maste	;;
92983d2307dSDag-Erling Smørgrav    i*:PW*:*)
930f374ba41SEd Maste	GUESS=$UNAME_MACHINE-pc-pw32
931f374ba41SEd Maste	;;
932f374ba41SEd Maste    *:SerenityOS:*:*)
933f374ba41SEd Maste        GUESS=$UNAME_MACHINE-pc-serenity
934f374ba41SEd Maste        ;;
935b15c8340SDag-Erling Smørgrav    *:Interix*:*)
936f374ba41SEd Maste	case $UNAME_MACHINE in
937cce7d346SDag-Erling Smørgrav	    x86)
938f374ba41SEd Maste		GUESS=i586-pc-interix$UNAME_RELEASE
939f374ba41SEd Maste		;;
940b15c8340SDag-Erling Smørgrav	    authenticamd | genuineintel | EM64T)
941f374ba41SEd Maste		GUESS=x86_64-unknown-interix$UNAME_RELEASE
942f374ba41SEd Maste		;;
943cce7d346SDag-Erling Smørgrav	    IA64)
944f374ba41SEd Maste		GUESS=ia64-unknown-interix$UNAME_RELEASE
945f374ba41SEd Maste		;;
946cce7d346SDag-Erling Smørgrav	esac ;;
94783d2307dSDag-Erling Smørgrav    i*:UWIN*:*)
948f374ba41SEd Maste	GUESS=$UNAME_MACHINE-pc-uwin
949f374ba41SEd Maste	;;
950cce7d346SDag-Erling Smørgrav    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
951f374ba41SEd Maste	GUESS=x86_64-pc-cygwin
952f374ba41SEd Maste	;;
95383d2307dSDag-Erling Smørgrav    prep*:SunOS:5.*:*)
954f374ba41SEd Maste	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
955f374ba41SEd Maste	GUESS=powerpcle-unknown-solaris2$SUN_REL
956f374ba41SEd Maste	;;
95783d2307dSDag-Erling Smørgrav    *:GNU:*:*)
958043840dfSDag-Erling Smørgrav	# the GNU system
959f374ba41SEd Maste	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
960f374ba41SEd Maste	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
961f374ba41SEd Maste	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
962f374ba41SEd Maste	;;
963043840dfSDag-Erling Smørgrav    *:GNU/*:*:*)
964043840dfSDag-Erling Smørgrav	# other systems with GNU libc and userland
965f374ba41SEd Maste	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
966f374ba41SEd Maste	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
967f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
968f374ba41SEd Maste	;;
969f374ba41SEd Maste    x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*)
970f374ba41SEd Maste	GUESS="$UNAME_MACHINE-pc-managarm-mlibc"
971f374ba41SEd Maste	;;
972f374ba41SEd Maste    *:[Mm]anagarm:*:*)
973f374ba41SEd Maste	GUESS="$UNAME_MACHINE-unknown-managarm-mlibc"
974f374ba41SEd Maste	;;
97519261079SEd Maste    *:Minix:*:*)
976f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-minix
977f374ba41SEd Maste	;;
978e4a9863fSDag-Erling Smørgrav    aarch64:Linux:*:*)
979f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
980f374ba41SEd Maste	;;
981e4a9863fSDag-Erling Smørgrav    aarch64_be:Linux:*:*)
982e4a9863fSDag-Erling Smørgrav	UNAME_MACHINE=aarch64_be
983f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
984f374ba41SEd Maste	;;
985b15c8340SDag-Erling Smørgrav    alpha:Linux:*:*)
98619261079SEd Maste	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
987b15c8340SDag-Erling Smørgrav	  EV5)   UNAME_MACHINE=alphaev5 ;;
988b15c8340SDag-Erling Smørgrav	  EV56)  UNAME_MACHINE=alphaev56 ;;
989b15c8340SDag-Erling Smørgrav	  PCA56) UNAME_MACHINE=alphapca56 ;;
990b15c8340SDag-Erling Smørgrav	  PCA57) UNAME_MACHINE=alphapca56 ;;
991b15c8340SDag-Erling Smørgrav	  EV6)   UNAME_MACHINE=alphaev6 ;;
992b15c8340SDag-Erling Smørgrav	  EV67)  UNAME_MACHINE=alphaev67 ;;
993b15c8340SDag-Erling Smørgrav	  EV68*) UNAME_MACHINE=alphaev68 ;;
994b15c8340SDag-Erling Smørgrav	esac
995b15c8340SDag-Erling Smørgrav	objdump --private-headers /bin/sh | grep -q ld.so.1
996ca86bcf2SDag-Erling Smørgrav	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
997f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
998f374ba41SEd Maste	;;
999f374ba41SEd Maste    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
1000f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1001f374ba41SEd Maste	;;
100283d2307dSDag-Erling Smørgrav    arm*:Linux:*:*)
100319261079SEd Maste	set_cc_for_build
1004cce7d346SDag-Erling Smørgrav	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
1005cce7d346SDag-Erling Smørgrav	    | grep -q __ARM_EABI__
1006cce7d346SDag-Erling Smørgrav	then
1007f374ba41SEd Maste	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1008cce7d346SDag-Erling Smørgrav	else
1009e4a9863fSDag-Erling Smørgrav	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
1010e4a9863fSDag-Erling Smørgrav		| grep -q __ARM_PCS_VFP
1011e4a9863fSDag-Erling Smørgrav	    then
1012f374ba41SEd Maste		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
1013e4a9863fSDag-Erling Smørgrav	    else
1014f374ba41SEd Maste		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
1015e4a9863fSDag-Erling Smørgrav	    fi
1016cce7d346SDag-Erling Smørgrav	fi
1017f374ba41SEd Maste	;;
1018cce7d346SDag-Erling Smørgrav    avr32*:Linux:*:*)
1019f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1020f374ba41SEd Maste	;;
1021d74d50a8SDag-Erling Smørgrav    cris:Linux:*:*)
1022f374ba41SEd Maste	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1023f374ba41SEd Maste	;;
1024043840dfSDag-Erling Smørgrav    crisv32:Linux:*:*)
1025f374ba41SEd Maste	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1026f374ba41SEd Maste	;;
1027ca86bcf2SDag-Erling Smørgrav    e2k:Linux:*:*)
1028f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1029f374ba41SEd Maste	;;
1030043840dfSDag-Erling Smørgrav    frv:Linux:*:*)
1031f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1032f374ba41SEd Maste	;;
1033e4a9863fSDag-Erling Smørgrav    hexagon:Linux:*:*)
1034f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1035f374ba41SEd Maste	;;
1036b15c8340SDag-Erling Smørgrav    i*86:Linux:*:*)
1037f374ba41SEd Maste	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
1038f374ba41SEd Maste	;;
103983d2307dSDag-Erling Smørgrav    ia64:Linux:*:*)
1040f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1041f374ba41SEd Maste	;;
1042ca86bcf2SDag-Erling Smørgrav    k1om:Linux:*:*)
1043f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1044f374ba41SEd Maste	;;
1045f374ba41SEd Maste    loongarch32:Linux:*:* | loongarch64:Linux:*:*)
1046f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1047f374ba41SEd Maste	;;
1048043840dfSDag-Erling Smørgrav    m32r*:Linux:*:*)
1049f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1050f374ba41SEd Maste	;;
105183d2307dSDag-Erling Smørgrav    m68*:Linux:*:*)
1052f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1053f374ba41SEd Maste	;;
1054b15c8340SDag-Erling Smørgrav    mips:Linux:*:* | mips64:Linux:*:*)
105519261079SEd Maste	set_cc_for_build
105619261079SEd Maste	IS_GLIBC=0
105719261079SEd Maste	test x"${LIBC}" = xgnu && IS_GLIBC=1
105819261079SEd Maste	sed 's/^	//' << EOF > "$dummy.c"
105983d2307dSDag-Erling Smørgrav	#undef CPU
106019261079SEd Maste	#undef mips
106119261079SEd Maste	#undef mipsel
106219261079SEd Maste	#undef mips64
106319261079SEd Maste	#undef mips64el
106419261079SEd Maste	#if ${IS_GLIBC} && defined(_ABI64)
106519261079SEd Maste	LIBCABI=gnuabi64
106619261079SEd Maste	#else
106719261079SEd Maste	#if ${IS_GLIBC} && defined(_ABIN32)
106819261079SEd Maste	LIBCABI=gnuabin32
106919261079SEd Maste	#else
107019261079SEd Maste	LIBCABI=${LIBC}
107119261079SEd Maste	#endif
107219261079SEd Maste	#endif
107319261079SEd Maste
107419261079SEd Maste	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
107519261079SEd Maste	CPU=mipsisa64r6
107619261079SEd Maste	#else
107719261079SEd Maste	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
107819261079SEd Maste	CPU=mipsisa32r6
107919261079SEd Maste	#else
108019261079SEd Maste	#if defined(__mips64)
108119261079SEd Maste	CPU=mips64
108219261079SEd Maste	#else
108319261079SEd Maste	CPU=mips
108419261079SEd Maste	#endif
108519261079SEd Maste	#endif
108619261079SEd Maste	#endif
108719261079SEd Maste
108883d2307dSDag-Erling Smørgrav	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
108919261079SEd Maste	MIPS_ENDIAN=el
109083d2307dSDag-Erling Smørgrav	#else
109183d2307dSDag-Erling Smørgrav	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
109219261079SEd Maste	MIPS_ENDIAN=
109383d2307dSDag-Erling Smørgrav	#else
109419261079SEd Maste	MIPS_ENDIAN=
109583d2307dSDag-Erling Smørgrav	#endif
109683d2307dSDag-Erling Smørgrav	#endif
109783d2307dSDag-Erling SmørgravEOF
1098f374ba41SEd Maste	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
1099f374ba41SEd Maste	eval "$cc_set_vars"
110019261079SEd Maste	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
110183d2307dSDag-Erling Smørgrav	;;
110219261079SEd Maste    mips64el:Linux:*:*)
1103f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1104f374ba41SEd Maste	;;
1105ca86bcf2SDag-Erling Smørgrav    openrisc*:Linux:*:*)
1106f374ba41SEd Maste	GUESS=or1k-unknown-linux-$LIBC
1107f374ba41SEd Maste	;;
1108ca86bcf2SDag-Erling Smørgrav    or32:Linux:*:* | or1k*:Linux:*:*)
1109f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1110f374ba41SEd Maste	;;
1111b15c8340SDag-Erling Smørgrav    padre:Linux:*:*)
1112f374ba41SEd Maste	GUESS=sparc-unknown-linux-$LIBC
1113f374ba41SEd Maste	;;
1114b15c8340SDag-Erling Smørgrav    parisc64:Linux:*:* | hppa64:Linux:*:*)
1115f374ba41SEd Maste	GUESS=hppa64-unknown-linux-$LIBC
1116f374ba41SEd Maste	;;
111783d2307dSDag-Erling Smørgrav    parisc:Linux:*:* | hppa:Linux:*:*)
111883d2307dSDag-Erling Smørgrav	# Look for CPU level
111983d2307dSDag-Erling Smørgrav	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
1120f374ba41SEd Maste	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
1121f374ba41SEd Maste	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
1122f374ba41SEd Maste	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
112383d2307dSDag-Erling Smørgrav	esac
1124f374ba41SEd Maste	;;
1125b15c8340SDag-Erling Smørgrav    ppc64:Linux:*:*)
1126f374ba41SEd Maste	GUESS=powerpc64-unknown-linux-$LIBC
1127f374ba41SEd Maste	;;
1128b15c8340SDag-Erling Smørgrav    ppc:Linux:*:*)
1129f374ba41SEd Maste	GUESS=powerpc-unknown-linux-$LIBC
1130f374ba41SEd Maste	;;
1131557f75e5SDag-Erling Smørgrav    ppc64le:Linux:*:*)
1132f374ba41SEd Maste	GUESS=powerpc64le-unknown-linux-$LIBC
1133f374ba41SEd Maste	;;
1134557f75e5SDag-Erling Smørgrav    ppcle:Linux:*:*)
1135f374ba41SEd Maste	GUESS=powerpcle-unknown-linux-$LIBC
1136f374ba41SEd Maste	;;
1137f374ba41SEd Maste    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
1138f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1139f374ba41SEd Maste	;;
114083d2307dSDag-Erling Smørgrav    s390:Linux:*:* | s390x:Linux:*:*)
1141f374ba41SEd Maste	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
1142f374ba41SEd Maste	;;
1143d74d50a8SDag-Erling Smørgrav    sh64*:Linux:*:*)
1144f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1145f374ba41SEd Maste	;;
114683d2307dSDag-Erling Smørgrav    sh*:Linux:*:*)
1147f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1148f374ba41SEd Maste	;;
114983d2307dSDag-Erling Smørgrav    sparc:Linux:*:* | sparc64:Linux:*:*)
1150f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1151f374ba41SEd Maste	;;
1152e146993eSDag-Erling Smørgrav    tile*:Linux:*:*)
1153f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1154f374ba41SEd Maste	;;
1155cce7d346SDag-Erling Smørgrav    vax:Linux:*:*)
1156f374ba41SEd Maste	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
1157f374ba41SEd Maste	;;
115883d2307dSDag-Erling Smørgrav    x86_64:Linux:*:*)
1159f374ba41SEd Maste	set_cc_for_build
1160f374ba41SEd Maste	CPU=$UNAME_MACHINE
1161f374ba41SEd Maste	LIBCABI=$LIBC
1162f374ba41SEd Maste	if test "$CC_FOR_BUILD" != no_compiler_found; then
1163f374ba41SEd Maste	    ABI=64
1164f374ba41SEd Maste	    sed 's/^	    //' << EOF > "$dummy.c"
1165f374ba41SEd Maste	    #ifdef __i386__
1166f374ba41SEd Maste	    ABI=x86
1167f374ba41SEd Maste	    #else
1168f374ba41SEd Maste	    #ifdef __ILP32__
1169f374ba41SEd Maste	    ABI=x32
1170f374ba41SEd Maste	    #endif
1171f374ba41SEd Maste	    #endif
1172f374ba41SEd MasteEOF
1173f374ba41SEd Maste	    cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'`
1174f374ba41SEd Maste	    eval "$cc_set_abi"
1175f374ba41SEd Maste	    case $ABI in
1176f374ba41SEd Maste		x86) CPU=i686 ;;
1177f374ba41SEd Maste		x32) LIBCABI=${LIBC}x32 ;;
1178f374ba41SEd Maste	    esac
1179f374ba41SEd Maste	fi
1180f374ba41SEd Maste	GUESS=$CPU-pc-linux-$LIBCABI
1181f374ba41SEd Maste	;;
1182cce7d346SDag-Erling Smørgrav    xtensa*:Linux:*:*)
1183f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1184f374ba41SEd Maste	;;
118583d2307dSDag-Erling Smørgrav    i*86:DYNIX/ptx:4*:*)
118683d2307dSDag-Erling Smørgrav	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
118783d2307dSDag-Erling Smørgrav	# earlier versions are messed up and put the nodename in both
118883d2307dSDag-Erling Smørgrav	# sysname and nodename.
1189f374ba41SEd Maste	GUESS=i386-sequent-sysv4
1190f374ba41SEd Maste	;;
119183d2307dSDag-Erling Smørgrav    i*86:UNIX_SV:4.2MP:2.*)
119283d2307dSDag-Erling Smørgrav	# Unixware is an offshoot of SVR4, but it has its own version
119383d2307dSDag-Erling Smørgrav	# number series starting with 2...
119483d2307dSDag-Erling Smørgrav	# I am not positive that other SVR4 systems won't match this,
119583d2307dSDag-Erling Smørgrav	# I just have to hope.  -- rms.
119683d2307dSDag-Erling Smørgrav	# Use sysv4.2uw... so that sysv4* matches it.
1197f374ba41SEd Maste	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
1198f374ba41SEd Maste	;;
1199d74d50a8SDag-Erling Smørgrav    i*86:OS/2:*:*)
1200d74d50a8SDag-Erling Smørgrav	# If we were able to find `uname', then EMX Unix compatibility
1201d74d50a8SDag-Erling Smørgrav	# is probably installed.
1202f374ba41SEd Maste	GUESS=$UNAME_MACHINE-pc-os2-emx
1203f374ba41SEd Maste	;;
1204d74d50a8SDag-Erling Smørgrav    i*86:XTS-300:*:STOP)
1205f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-stop
1206f374ba41SEd Maste	;;
1207d74d50a8SDag-Erling Smørgrav    i*86:atheos:*:*)
1208f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-atheos
1209f374ba41SEd Maste	;;
1210043840dfSDag-Erling Smørgrav    i*86:syllable:*:*)
1211f374ba41SEd Maste	GUESS=$UNAME_MACHINE-pc-syllable
1212f374ba41SEd Maste	;;
1213b15c8340SDag-Erling Smørgrav    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1214f374ba41SEd Maste	GUESS=i386-unknown-lynxos$UNAME_RELEASE
1215f374ba41SEd Maste	;;
1216d74d50a8SDag-Erling Smørgrav    i*86:*DOS:*:*)
1217f374ba41SEd Maste	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
1218f374ba41SEd Maste	;;
121919261079SEd Maste    i*86:*:4.*:*)
122019261079SEd Maste	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
122183d2307dSDag-Erling Smørgrav	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1222f374ba41SEd Maste		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
122383d2307dSDag-Erling Smørgrav	else
1224f374ba41SEd Maste		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
122583d2307dSDag-Erling Smørgrav	fi
1226f374ba41SEd Maste	;;
12274518870cSDag-Erling Smørgrav    i*86:*:5:[678]*)
1228043840dfSDag-Erling Smørgrav	# UnixWare 7.x, OpenUNIX and OpenServer 6.
122983d2307dSDag-Erling Smørgrav	case `/bin/uname -X | grep "^Machine"` in
123083d2307dSDag-Erling Smørgrav	    *486*)	     UNAME_MACHINE=i486 ;;
123183d2307dSDag-Erling Smørgrav	    *Pentium)	     UNAME_MACHINE=i586 ;;
123283d2307dSDag-Erling Smørgrav	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
123383d2307dSDag-Erling Smørgrav	esac
1234f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1235f374ba41SEd Maste	;;
123683d2307dSDag-Erling Smørgrav    i*86:*:3.2:*)
123783d2307dSDag-Erling Smørgrav	if test -f /usr/options/cb.name; then
123883d2307dSDag-Erling Smørgrav		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1239f374ba41SEd Maste		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
124083d2307dSDag-Erling Smørgrav	elif /bin/uname -X 2>/dev/null >/dev/null ; then
12414b17dab0SDag-Erling Smørgrav		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
12424b17dab0SDag-Erling Smørgrav		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
12434b17dab0SDag-Erling Smørgrav		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
124483d2307dSDag-Erling Smørgrav			&& UNAME_MACHINE=i586
12454b17dab0SDag-Erling Smørgrav		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
124683d2307dSDag-Erling Smørgrav			&& UNAME_MACHINE=i686
12474b17dab0SDag-Erling Smørgrav		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
124883d2307dSDag-Erling Smørgrav			&& UNAME_MACHINE=i686
1249f374ba41SEd Maste		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
125083d2307dSDag-Erling Smørgrav	else
1251f374ba41SEd Maste		GUESS=$UNAME_MACHINE-pc-sysv32
125283d2307dSDag-Erling Smørgrav	fi
1253f374ba41SEd Maste	;;
125483d2307dSDag-Erling Smørgrav    pc:*:*:*)
125583d2307dSDag-Erling Smørgrav	# Left here for compatibility:
125683d2307dSDag-Erling Smørgrav	# uname -m prints for DJGPP always 'pc', but it prints nothing about
1257b15c8340SDag-Erling Smørgrav	# the processor, so we play safe by assuming i586.
1258b15c8340SDag-Erling Smørgrav	# Note: whatever this is, it MUST be the same as what config.sub
1259ca86bcf2SDag-Erling Smørgrav	# prints for the "djgpp" host, or else GDB configure will decide that
1260b15c8340SDag-Erling Smørgrav	# this is a cross-build.
1261f374ba41SEd Maste	GUESS=i586-pc-msdosdjgpp
1262f374ba41SEd Maste	;;
126383d2307dSDag-Erling Smørgrav    Intel:Mach:3*:*)
1264f374ba41SEd Maste	GUESS=i386-pc-mach3
1265f374ba41SEd Maste	;;
126683d2307dSDag-Erling Smørgrav    paragon:*:*:*)
1267f374ba41SEd Maste	GUESS=i860-intel-osf1
1268f374ba41SEd Maste	;;
126983d2307dSDag-Erling Smørgrav    i860:*:4.*:*) # i860-SVR4
127083d2307dSDag-Erling Smørgrav	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1271f374ba41SEd Maste	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
127283d2307dSDag-Erling Smørgrav	else # Add other i860-SVR4 vendors below as they are discovered.
1273f374ba41SEd Maste	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
127483d2307dSDag-Erling Smørgrav	fi
1275f374ba41SEd Maste	;;
127683d2307dSDag-Erling Smørgrav    mini*:CTIX:SYS*5:*)
127783d2307dSDag-Erling Smørgrav	# "miniframe"
1278f374ba41SEd Maste	GUESS=m68010-convergent-sysv
1279f374ba41SEd Maste	;;
1280d74d50a8SDag-Erling Smørgrav    mc68k:UNIX:SYSTEM5:3.51m)
1281f374ba41SEd Maste	GUESS=m68k-convergent-sysv
1282f374ba41SEd Maste	;;
1283d74d50a8SDag-Erling Smørgrav    M680?0:D-NIX:5.3:*)
1284f374ba41SEd Maste	GUESS=m68k-diab-dnix
1285f374ba41SEd Maste	;;
1286043840dfSDag-Erling Smørgrav    M68*:*:R3V[5678]*:*)
1287043840dfSDag-Erling Smørgrav	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1288043840dfSDag-Erling Smørgrav    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)
128983d2307dSDag-Erling Smørgrav	OS_REL=''
129083d2307dSDag-Erling Smørgrav	test -r /etc/.relid \
129183d2307dSDag-Erling Smørgrav	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
129283d2307dSDag-Erling Smørgrav	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
129319261079SEd Maste	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
129483d2307dSDag-Erling Smørgrav	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
129519261079SEd Maste	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
129683d2307dSDag-Erling Smørgrav    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
129783d2307dSDag-Erling Smørgrav	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1298043840dfSDag-Erling Smørgrav	  && { echo i486-ncr-sysv4; exit; } ;;
1299b15c8340SDag-Erling Smørgrav    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1300b15c8340SDag-Erling Smørgrav	OS_REL='.3'
1301b15c8340SDag-Erling Smørgrav	test -r /etc/.relid \
1302b15c8340SDag-Erling Smørgrav	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1303b15c8340SDag-Erling Smørgrav	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
130419261079SEd Maste	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1305b15c8340SDag-Erling Smørgrav	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
130619261079SEd Maste	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
1307b15c8340SDag-Erling Smørgrav	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
130819261079SEd Maste	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
130983d2307dSDag-Erling Smørgrav    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1310f374ba41SEd Maste	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
1311f374ba41SEd Maste	;;
131283d2307dSDag-Erling Smørgrav    mc68030:UNIX_System_V:4.*:*)
1313f374ba41SEd Maste	GUESS=m68k-atari-sysv4
1314f374ba41SEd Maste	;;
131583d2307dSDag-Erling Smørgrav    TSUNAMI:LynxOS:2.*:*)
1316f374ba41SEd Maste	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
1317f374ba41SEd Maste	;;
131883d2307dSDag-Erling Smørgrav    rs6000:LynxOS:2.*:*)
1319f374ba41SEd Maste	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
1320f374ba41SEd Maste	;;
1321b15c8340SDag-Erling Smørgrav    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1322f374ba41SEd Maste	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
1323f374ba41SEd Maste	;;
132483d2307dSDag-Erling Smørgrav    SM[BE]S:UNIX_SV:*:*)
1325f374ba41SEd Maste	GUESS=mips-dde-sysv$UNAME_RELEASE
1326f374ba41SEd Maste	;;
132783d2307dSDag-Erling Smørgrav    RM*:ReliantUNIX-*:*:*)
1328f374ba41SEd Maste	GUESS=mips-sni-sysv4
1329f374ba41SEd Maste	;;
133083d2307dSDag-Erling Smørgrav    RM*:SINIX-*:*:*)
1331f374ba41SEd Maste	GUESS=mips-sni-sysv4
1332f374ba41SEd Maste	;;
133383d2307dSDag-Erling Smørgrav    *:SINIX-*:*:*)
133483d2307dSDag-Erling Smørgrav	if uname -p 2>/dev/null >/dev/null ; then
133583d2307dSDag-Erling Smørgrav		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1336f374ba41SEd Maste		GUESS=$UNAME_MACHINE-sni-sysv4
133783d2307dSDag-Erling Smørgrav	else
1338f374ba41SEd Maste		GUESS=ns32k-sni-sysv
133983d2307dSDag-Erling Smørgrav	fi
1340f374ba41SEd Maste	;;
134183d2307dSDag-Erling Smørgrav    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
134283d2307dSDag-Erling Smørgrav			# says <Richard.M.Bartel@ccMail.Census.GOV>
1343f374ba41SEd Maste	GUESS=i586-unisys-sysv4
1344f374ba41SEd Maste	;;
134583d2307dSDag-Erling Smørgrav    *:UNIX_System_V:4*:FTX*)
134683d2307dSDag-Erling Smørgrav	# From Gerald Hewes <hewes@openmarket.com>.
134783d2307dSDag-Erling Smørgrav	# How about differentiating between stratus architectures? -djm
1348f374ba41SEd Maste	GUESS=hppa1.1-stratus-sysv4
1349f374ba41SEd Maste	;;
135083d2307dSDag-Erling Smørgrav    *:*:*:FTX*)
135183d2307dSDag-Erling Smørgrav	# From seanf@swdc.stratus.com.
1352f374ba41SEd Maste	GUESS=i860-stratus-sysv4
1353f374ba41SEd Maste	;;
1354043840dfSDag-Erling Smørgrav    i*86:VOS:*:*)
1355043840dfSDag-Erling Smørgrav	# From Paul.Green@stratus.com.
1356f374ba41SEd Maste	GUESS=$UNAME_MACHINE-stratus-vos
1357f374ba41SEd Maste	;;
135883d2307dSDag-Erling Smørgrav    *:VOS:*:*)
135983d2307dSDag-Erling Smørgrav	# From Paul.Green@stratus.com.
1360f374ba41SEd Maste	GUESS=hppa1.1-stratus-vos
1361f374ba41SEd Maste	;;
136283d2307dSDag-Erling Smørgrav    mc68*:A/UX:*:*)
1363f374ba41SEd Maste	GUESS=m68k-apple-aux$UNAME_RELEASE
1364f374ba41SEd Maste	;;
136583d2307dSDag-Erling Smørgrav    news*:NEWS-OS:6*:*)
1366f374ba41SEd Maste	GUESS=mips-sony-newsos6
1367f374ba41SEd Maste	;;
136883d2307dSDag-Erling Smørgrav    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1369f374ba41SEd Maste	if test -d /usr/nec; then
1370f374ba41SEd Maste		GUESS=mips-nec-sysv$UNAME_RELEASE
137183d2307dSDag-Erling Smørgrav	else
1372f374ba41SEd Maste		GUESS=mips-unknown-sysv$UNAME_RELEASE
137383d2307dSDag-Erling Smørgrav	fi
1374f374ba41SEd Maste	;;
137583d2307dSDag-Erling Smørgrav    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1376f374ba41SEd Maste	GUESS=powerpc-be-beos
1377f374ba41SEd Maste	;;
137883d2307dSDag-Erling Smørgrav    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1379f374ba41SEd Maste	GUESS=powerpc-apple-beos
1380f374ba41SEd Maste	;;
138183d2307dSDag-Erling Smørgrav    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1382f374ba41SEd Maste	GUESS=i586-pc-beos
1383f374ba41SEd Maste	;;
1384cce7d346SDag-Erling Smørgrav    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
1385f374ba41SEd Maste	GUESS=i586-pc-haiku
1386f374ba41SEd Maste	;;
1387f374ba41SEd Maste    ppc:Haiku:*:*)	# Haiku running on Apple PowerPC
1388f374ba41SEd Maste	GUESS=powerpc-apple-haiku
1389f374ba41SEd Maste	;;
1390f374ba41SEd Maste    *:Haiku:*:*)	# Haiku modern gcc (not bound by BeOS compat)
1391f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-haiku
1392f374ba41SEd Maste	;;
139383d2307dSDag-Erling Smørgrav    SX-4:SUPER-UX:*:*)
1394f374ba41SEd Maste	GUESS=sx4-nec-superux$UNAME_RELEASE
1395f374ba41SEd Maste	;;
139683d2307dSDag-Erling Smørgrav    SX-5:SUPER-UX:*:*)
1397f374ba41SEd Maste	GUESS=sx5-nec-superux$UNAME_RELEASE
1398f374ba41SEd Maste	;;
1399d74d50a8SDag-Erling Smørgrav    SX-6:SUPER-UX:*:*)
1400f374ba41SEd Maste	GUESS=sx6-nec-superux$UNAME_RELEASE
1401f374ba41SEd Maste	;;
1402cce7d346SDag-Erling Smørgrav    SX-7:SUPER-UX:*:*)
1403f374ba41SEd Maste	GUESS=sx7-nec-superux$UNAME_RELEASE
1404f374ba41SEd Maste	;;
1405cce7d346SDag-Erling Smørgrav    SX-8:SUPER-UX:*:*)
1406f374ba41SEd Maste	GUESS=sx8-nec-superux$UNAME_RELEASE
1407f374ba41SEd Maste	;;
1408cce7d346SDag-Erling Smørgrav    SX-8R:SUPER-UX:*:*)
1409f374ba41SEd Maste	GUESS=sx8r-nec-superux$UNAME_RELEASE
1410f374ba41SEd Maste	;;
1411ca86bcf2SDag-Erling Smørgrav    SX-ACE:SUPER-UX:*:*)
1412f374ba41SEd Maste	GUESS=sxace-nec-superux$UNAME_RELEASE
1413f374ba41SEd Maste	;;
141483d2307dSDag-Erling Smørgrav    Power*:Rhapsody:*:*)
1415f374ba41SEd Maste	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
1416f374ba41SEd Maste	;;
141783d2307dSDag-Erling Smørgrav    *:Rhapsody:*:*)
1418f374ba41SEd Maste	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
1419f374ba41SEd Maste	;;
1420f374ba41SEd Maste    arm64:Darwin:*:*)
1421f374ba41SEd Maste	GUESS=aarch64-apple-darwin$UNAME_RELEASE
1422f374ba41SEd Maste	;;
142383d2307dSDag-Erling Smørgrav    *:Darwin:*:*)
142419261079SEd Maste	UNAME_PROCESSOR=`uname -p`
142519261079SEd Maste	case $UNAME_PROCESSOR in
142619261079SEd Maste	    unknown) UNAME_PROCESSOR=powerpc ;;
142719261079SEd Maste	esac
142819261079SEd Maste	if command -v xcode-select > /dev/null 2> /dev/null && \
142919261079SEd Maste		! xcode-select --print-path > /dev/null 2> /dev/null ; then
143019261079SEd Maste	    # Avoid executing cc if there is no toolchain installed as
143119261079SEd Maste	    # cc will be a stub that puts up a graphical alert
143219261079SEd Maste	    # prompting the user to install developer tools.
143319261079SEd Maste	    CC_FOR_BUILD=no_compiler_found
143419261079SEd Maste	else
143519261079SEd Maste	    set_cc_for_build
1436ca86bcf2SDag-Erling Smørgrav	fi
1437f374ba41SEd Maste	if test "$CC_FOR_BUILD" != no_compiler_found; then
1438b15c8340SDag-Erling Smørgrav	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1439ca86bcf2SDag-Erling Smørgrav		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1440b15c8340SDag-Erling Smørgrav		   grep IS_64BIT_ARCH >/dev/null
1441b15c8340SDag-Erling Smørgrav	    then
1442ca86bcf2SDag-Erling Smørgrav		case $UNAME_PROCESSOR in
1443ca86bcf2SDag-Erling Smørgrav		    i386) UNAME_PROCESSOR=x86_64 ;;
1444ca86bcf2SDag-Erling Smørgrav		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
1445d74d50a8SDag-Erling Smørgrav		esac
1446ca86bcf2SDag-Erling Smørgrav	    fi
144719261079SEd Maste	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
144819261079SEd Maste	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
144919261079SEd Maste		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
145019261079SEd Maste		   grep IS_PPC >/dev/null
145119261079SEd Maste	    then
145219261079SEd Maste		UNAME_PROCESSOR=powerpc
1453ca86bcf2SDag-Erling Smørgrav	    fi
1454ca86bcf2SDag-Erling Smørgrav	elif test "$UNAME_PROCESSOR" = i386 ; then
145519261079SEd Maste	    # uname -m returns i386 or x86_64
145619261079SEd Maste	    UNAME_PROCESSOR=$UNAME_MACHINE
1457ca86bcf2SDag-Erling Smørgrav	fi
1458f374ba41SEd Maste	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
1459f374ba41SEd Maste	;;
146083d2307dSDag-Erling Smørgrav    *:procnto*:*:* | *:QNX:[0123456789]*:*)
14614b17dab0SDag-Erling Smørgrav	UNAME_PROCESSOR=`uname -p`
1462ca86bcf2SDag-Erling Smørgrav	if test "$UNAME_PROCESSOR" = x86; then
14634b17dab0SDag-Erling Smørgrav		UNAME_PROCESSOR=i386
146483d2307dSDag-Erling Smørgrav		UNAME_MACHINE=pc
146583d2307dSDag-Erling Smørgrav	fi
1466f374ba41SEd Maste	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
1467f374ba41SEd Maste	;;
146883d2307dSDag-Erling Smørgrav    *:QNX:*:4*)
1469f374ba41SEd Maste	GUESS=i386-pc-qnx
1470f374ba41SEd Maste	;;
147119261079SEd Maste    NEO-*:NONSTOP_KERNEL:*:*)
1472f374ba41SEd Maste	GUESS=neo-tandem-nsk$UNAME_RELEASE
1473f374ba41SEd Maste	;;
1474e4a9863fSDag-Erling Smørgrav    NSE-*:NONSTOP_KERNEL:*:*)
1475f374ba41SEd Maste	GUESS=nse-tandem-nsk$UNAME_RELEASE
1476f374ba41SEd Maste	;;
147719261079SEd Maste    NSR-*:NONSTOP_KERNEL:*:*)
1478f374ba41SEd Maste	GUESS=nsr-tandem-nsk$UNAME_RELEASE
1479f374ba41SEd Maste	;;
148019261079SEd Maste    NSV-*:NONSTOP_KERNEL:*:*)
1481f374ba41SEd Maste	GUESS=nsv-tandem-nsk$UNAME_RELEASE
1482f374ba41SEd Maste	;;
148319261079SEd Maste    NSX-*:NONSTOP_KERNEL:*:*)
1484f374ba41SEd Maste	GUESS=nsx-tandem-nsk$UNAME_RELEASE
1485f374ba41SEd Maste	;;
148683d2307dSDag-Erling Smørgrav    *:NonStop-UX:*:*)
1487f374ba41SEd Maste	GUESS=mips-compaq-nonstopux
1488f374ba41SEd Maste	;;
148983d2307dSDag-Erling Smørgrav    BS2000:POSIX*:*:*)
1490f374ba41SEd Maste	GUESS=bs2000-siemens-sysv
1491f374ba41SEd Maste	;;
149283d2307dSDag-Erling Smørgrav    DS/*:UNIX_System_V:*:*)
1493f374ba41SEd Maste	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
1494f374ba41SEd Maste	;;
149583d2307dSDag-Erling Smørgrav    *:Plan9:*:*)
149683d2307dSDag-Erling Smørgrav	# "uname -m" is not consistent, so use $cputype instead. 386
149783d2307dSDag-Erling Smørgrav	# is converted to i386 for consistency with other x86
149883d2307dSDag-Erling Smørgrav	# operating systems.
1499f374ba41SEd Maste	if test "${cputype-}" = 386; then
150083d2307dSDag-Erling Smørgrav	    UNAME_MACHINE=i386
1501f374ba41SEd Maste	elif test "x${cputype-}" != x; then
1502f374ba41SEd Maste	    UNAME_MACHINE=$cputype
150383d2307dSDag-Erling Smørgrav	fi
1504f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-plan9
1505f374ba41SEd Maste	;;
150683d2307dSDag-Erling Smørgrav    *:TOPS-10:*:*)
1507f374ba41SEd Maste	GUESS=pdp10-unknown-tops10
1508f374ba41SEd Maste	;;
150983d2307dSDag-Erling Smørgrav    *:TENEX:*:*)
1510f374ba41SEd Maste	GUESS=pdp10-unknown-tenex
1511f374ba41SEd Maste	;;
151283d2307dSDag-Erling Smørgrav    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1513f374ba41SEd Maste	GUESS=pdp10-dec-tops20
1514f374ba41SEd Maste	;;
151583d2307dSDag-Erling Smørgrav    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1516f374ba41SEd Maste	GUESS=pdp10-xkl-tops20
1517f374ba41SEd Maste	;;
151883d2307dSDag-Erling Smørgrav    *:TOPS-20:*:*)
1519f374ba41SEd Maste	GUESS=pdp10-unknown-tops20
1520f374ba41SEd Maste	;;
152183d2307dSDag-Erling Smørgrav    *:ITS:*:*)
1522f374ba41SEd Maste	GUESS=pdp10-unknown-its
1523f374ba41SEd Maste	;;
1524d74d50a8SDag-Erling Smørgrav    SEI:*:*:SEIUX)
1525f374ba41SEd Maste	GUESS=mips-sei-seiux$UNAME_RELEASE
1526f374ba41SEd Maste	;;
1527043840dfSDag-Erling Smørgrav    *:DragonFly:*:*)
1528f374ba41SEd Maste	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
1529f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
1530f374ba41SEd Maste	;;
1531043840dfSDag-Erling Smørgrav    *:*VMS:*:*)
1532043840dfSDag-Erling Smørgrav	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1533f374ba41SEd Maste	case $UNAME_MACHINE in
1534f374ba41SEd Maste	    A*) GUESS=alpha-dec-vms ;;
1535f374ba41SEd Maste	    I*) GUESS=ia64-dec-vms ;;
1536f374ba41SEd Maste	    V*) GUESS=vax-dec-vms ;;
1537043840dfSDag-Erling Smørgrav	esac ;;
1538043840dfSDag-Erling Smørgrav    *:XENIX:*:SysV)
1539f374ba41SEd Maste	GUESS=i386-pc-xenix
1540f374ba41SEd Maste	;;
1541043840dfSDag-Erling Smørgrav    i*86:skyos:*:*)
1542f374ba41SEd Maste	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
1543f374ba41SEd Maste	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
1544f374ba41SEd Maste	;;
1545cce7d346SDag-Erling Smørgrav    i*86:rdos:*:*)
1546f374ba41SEd Maste	GUESS=$UNAME_MACHINE-pc-rdos
1547f374ba41SEd Maste	;;
1548f374ba41SEd Maste    i*86:Fiwix:*:*)
1549f374ba41SEd Maste	GUESS=$UNAME_MACHINE-pc-fiwix
1550f374ba41SEd Maste	;;
1551f374ba41SEd Maste    *:AROS:*:*)
1552f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-aros
1553f374ba41SEd Maste	;;
1554e4a9863fSDag-Erling Smørgrav    x86_64:VMkernel:*:*)
1555f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-esx
1556f374ba41SEd Maste	;;
1557ca86bcf2SDag-Erling Smørgrav    amd64:Isilon\ OneFS:*:*)
1558f374ba41SEd Maste	GUESS=x86_64-unknown-onefs
1559f374ba41SEd Maste	;;
156019261079SEd Maste    *:Unleashed:*:*)
1561f374ba41SEd Maste	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
1562f374ba41SEd Maste	;;
156319261079SEd Masteesac
156419261079SEd Maste
1565f374ba41SEd Maste# Do we have a guess based on uname results?
1566f374ba41SEd Masteif test "x$GUESS" != x; then
1567f374ba41SEd Maste    echo "$GUESS"
1568f374ba41SEd Maste    exit
1569f374ba41SEd Mastefi
1570f374ba41SEd Maste
157119261079SEd Maste# No uname command or uname output not recognized.
157219261079SEd Masteset_cc_for_build
157319261079SEd Mastecat > "$dummy.c" <<EOF
157419261079SEd Maste#ifdef _SEQUENT_
157519261079SEd Maste#include <sys/types.h>
157619261079SEd Maste#include <sys/utsname.h>
157719261079SEd Maste#endif
157819261079SEd Maste#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
157919261079SEd Maste#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
158019261079SEd Maste#include <signal.h>
158119261079SEd Maste#if defined(_SIZE_T_) || defined(SIGLOST)
158219261079SEd Maste#include <sys/utsname.h>
158319261079SEd Maste#endif
158419261079SEd Maste#endif
158519261079SEd Maste#endif
158619261079SEd Mastemain ()
158719261079SEd Maste{
158819261079SEd Maste#if defined (sony)
158919261079SEd Maste#if defined (MIPSEB)
159019261079SEd Maste  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
159119261079SEd Maste     I don't know....  */
159219261079SEd Maste  printf ("mips-sony-bsd\n"); exit (0);
159319261079SEd Maste#else
159419261079SEd Maste#include <sys/param.h>
159519261079SEd Maste  printf ("m68k-sony-newsos%s\n",
159619261079SEd Maste#ifdef NEWSOS4
159719261079SEd Maste  "4"
159819261079SEd Maste#else
159919261079SEd Maste  ""
160019261079SEd Maste#endif
160119261079SEd Maste  ); exit (0);
160219261079SEd Maste#endif
160319261079SEd Maste#endif
160419261079SEd Maste
160519261079SEd Maste#if defined (NeXT)
160619261079SEd Maste#if !defined (__ARCHITECTURE__)
160719261079SEd Maste#define __ARCHITECTURE__ "m68k"
160819261079SEd Maste#endif
160919261079SEd Maste  int version;
161019261079SEd Maste  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
161119261079SEd Maste  if (version < 4)
161219261079SEd Maste    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
161319261079SEd Maste  else
161419261079SEd Maste    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
161519261079SEd Maste  exit (0);
161619261079SEd Maste#endif
161719261079SEd Maste
161819261079SEd Maste#if defined (MULTIMAX) || defined (n16)
161919261079SEd Maste#if defined (UMAXV)
162019261079SEd Maste  printf ("ns32k-encore-sysv\n"); exit (0);
162119261079SEd Maste#else
162219261079SEd Maste#if defined (CMU)
162319261079SEd Maste  printf ("ns32k-encore-mach\n"); exit (0);
162419261079SEd Maste#else
162519261079SEd Maste  printf ("ns32k-encore-bsd\n"); exit (0);
162619261079SEd Maste#endif
162719261079SEd Maste#endif
162819261079SEd Maste#endif
162919261079SEd Maste
163019261079SEd Maste#if defined (__386BSD__)
163119261079SEd Maste  printf ("i386-pc-bsd\n"); exit (0);
163219261079SEd Maste#endif
163319261079SEd Maste
163419261079SEd Maste#if defined (sequent)
163519261079SEd Maste#if defined (i386)
163619261079SEd Maste  printf ("i386-sequent-dynix\n"); exit (0);
163719261079SEd Maste#endif
163819261079SEd Maste#if defined (ns32000)
163919261079SEd Maste  printf ("ns32k-sequent-dynix\n"); exit (0);
164019261079SEd Maste#endif
164119261079SEd Maste#endif
164219261079SEd Maste
164319261079SEd Maste#if defined (_SEQUENT_)
164419261079SEd Maste  struct utsname un;
164519261079SEd Maste
164619261079SEd Maste  uname(&un);
164719261079SEd Maste  if (strncmp(un.version, "V2", 2) == 0) {
164819261079SEd Maste    printf ("i386-sequent-ptx2\n"); exit (0);
164919261079SEd Maste  }
165019261079SEd Maste  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
165119261079SEd Maste    printf ("i386-sequent-ptx1\n"); exit (0);
165219261079SEd Maste  }
165319261079SEd Maste  printf ("i386-sequent-ptx\n"); exit (0);
165419261079SEd Maste#endif
165519261079SEd Maste
165619261079SEd Maste#if defined (vax)
165719261079SEd Maste#if !defined (ultrix)
165819261079SEd Maste#include <sys/param.h>
165919261079SEd Maste#if defined (BSD)
166019261079SEd Maste#if BSD == 43
166119261079SEd Maste  printf ("vax-dec-bsd4.3\n"); exit (0);
166219261079SEd Maste#else
166319261079SEd Maste#if BSD == 199006
166419261079SEd Maste  printf ("vax-dec-bsd4.3reno\n"); exit (0);
166519261079SEd Maste#else
166619261079SEd Maste  printf ("vax-dec-bsd\n"); exit (0);
166719261079SEd Maste#endif
166819261079SEd Maste#endif
166919261079SEd Maste#else
167019261079SEd Maste  printf ("vax-dec-bsd\n"); exit (0);
167119261079SEd Maste#endif
167219261079SEd Maste#else
167319261079SEd Maste#if defined(_SIZE_T_) || defined(SIGLOST)
167419261079SEd Maste  struct utsname un;
167519261079SEd Maste  uname (&un);
167619261079SEd Maste  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
167719261079SEd Maste#else
167819261079SEd Maste  printf ("vax-dec-ultrix\n"); exit (0);
167919261079SEd Maste#endif
168019261079SEd Maste#endif
168119261079SEd Maste#endif
168219261079SEd Maste#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
168319261079SEd Maste#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
168419261079SEd Maste#if defined(_SIZE_T_) || defined(SIGLOST)
168519261079SEd Maste  struct utsname *un;
168619261079SEd Maste  uname (&un);
168719261079SEd Maste  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
168819261079SEd Maste#else
168919261079SEd Maste  printf ("mips-dec-ultrix\n"); exit (0);
169019261079SEd Maste#endif
169119261079SEd Maste#endif
169219261079SEd Maste#endif
169319261079SEd Maste
169419261079SEd Maste#if defined (alliant) && defined (i860)
169519261079SEd Maste  printf ("i860-alliant-bsd\n"); exit (0);
169619261079SEd Maste#endif
169719261079SEd Maste
169819261079SEd Maste  exit (1);
169919261079SEd Maste}
170019261079SEd MasteEOF
170119261079SEd Maste
1702f374ba41SEd Maste$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
170319261079SEd Maste	{ echo "$SYSTEM_NAME"; exit; }
170419261079SEd Maste
170519261079SEd Maste# Apollos put the system type in the environment.
170619261079SEd Mastetest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
170719261079SEd Maste
170819261079SEd Masteecho "$0: unable to guess system type" >&2
170919261079SEd Maste
1710f374ba41SEd Mastecase $UNAME_MACHINE:$UNAME_SYSTEM in
171119261079SEd Maste    mips:Linux | mips64:Linux)
171219261079SEd Maste	# If we got here on MIPS GNU/Linux, output extra information.
171319261079SEd Maste	cat >&2 <<EOF
171419261079SEd Maste
171519261079SEd MasteNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
171619261079SEd Mastethe system type. Please install a C compiler and try again.
171719261079SEd MasteEOF
171819261079SEd Maste	;;
171983d2307dSDag-Erling Smørgravesac
172083d2307dSDag-Erling Smørgrav
172183d2307dSDag-Erling Smørgravcat >&2 <<EOF
172283d2307dSDag-Erling Smørgrav
1723ca86bcf2SDag-Erling SmørgravThis script (version $timestamp), has failed to recognize the
172419261079SEd Masteoperating system you are using. If your script is old, overwrite *all*
172519261079SEd Mastecopies of config.guess and config.sub with the latest versions from:
172683d2307dSDag-Erling Smørgrav
1727f374ba41SEd Maste  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
1728043840dfSDag-Erling Smørgravand
1729f374ba41SEd Maste  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
173019261079SEd MasteEOF
173119261079SEd Maste
1732f374ba41SEd Masteour_year=`echo $timestamp | sed 's,-.*,,'`
1733f374ba41SEd Mastethisyear=`date +%Y`
173419261079SEd Maste# shellcheck disable=SC2003
1735f374ba41SEd Mastescript_age=`expr "$thisyear" - "$our_year"`
1736f374ba41SEd Masteif test "$script_age" -lt 3 ; then
173719261079SEd Maste   cat >&2 <<EOF
173883d2307dSDag-Erling Smørgrav
1739ca86bcf2SDag-Erling SmørgravIf $0 has already been updated, send the following data and any
1740ca86bcf2SDag-Erling Smørgravinformation you think might be pertinent to config-patches@gnu.org to
1741ca86bcf2SDag-Erling Smørgravprovide the necessary information to handle your system.
174283d2307dSDag-Erling Smørgrav
174383d2307dSDag-Erling Smørgravconfig.guess timestamp = $timestamp
174483d2307dSDag-Erling Smørgrav
174583d2307dSDag-Erling Smørgravuname -m = `(uname -m) 2>/dev/null || echo unknown`
174683d2307dSDag-Erling Smørgravuname -r = `(uname -r) 2>/dev/null || echo unknown`
174783d2307dSDag-Erling Smørgravuname -s = `(uname -s) 2>/dev/null || echo unknown`
174883d2307dSDag-Erling Smørgravuname -v = `(uname -v) 2>/dev/null || echo unknown`
174983d2307dSDag-Erling Smørgrav
175083d2307dSDag-Erling Smørgrav/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
175183d2307dSDag-Erling Smørgrav/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
175283d2307dSDag-Erling Smørgrav
175383d2307dSDag-Erling Smørgravhostinfo               = `(hostinfo) 2>/dev/null`
175483d2307dSDag-Erling Smørgrav/bin/universe          = `(/bin/universe) 2>/dev/null`
175583d2307dSDag-Erling Smørgrav/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
175683d2307dSDag-Erling Smørgrav/bin/arch              = `(/bin/arch) 2>/dev/null`
175783d2307dSDag-Erling Smørgrav/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
175883d2307dSDag-Erling Smørgrav/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
175983d2307dSDag-Erling Smørgrav
176019261079SEd MasteUNAME_MACHINE = "$UNAME_MACHINE"
176119261079SEd MasteUNAME_RELEASE = "$UNAME_RELEASE"
176219261079SEd MasteUNAME_SYSTEM  = "$UNAME_SYSTEM"
176319261079SEd MasteUNAME_VERSION = "$UNAME_VERSION"
176483d2307dSDag-Erling SmørgravEOF
176519261079SEd Mastefi
176683d2307dSDag-Erling Smørgrav
176783d2307dSDag-Erling Smørgravexit 1
176883d2307dSDag-Erling Smørgrav
176983d2307dSDag-Erling Smørgrav# Local variables:
177019261079SEd Maste# eval: (add-hook 'before-save-hook 'time-stamp)
177183d2307dSDag-Erling Smørgrav# time-stamp-start: "timestamp='"
177283d2307dSDag-Erling Smørgrav# time-stamp-format: "%:y-%02m-%02d"
177383d2307dSDag-Erling Smørgrav# time-stamp-end: "'"
177483d2307dSDag-Erling Smørgrav# End:
1775