16ea72052Smrg#! /bin/sh
26ea72052Smrg# Attempt to guess a canonical system name.
3e32e2dabSmrg#   Copyright 1992-2024 Free Software Foundation, Inc.
46ea72052Smrg
5f3e6ffc5Smrg# shellcheck disable=SC2006,SC2268 # see below for rationale
6f3e6ffc5Smrg
7e32e2dabSmrgtimestamp='2024-01-01'
86ea72052Smrg
96ea72052Smrg# This file is free software; you can redistribute it and/or modify it
106ea72052Smrg# under the terms of the GNU General Public License as published by
11e32e2dabSmrg# the Free Software Foundation, either version 3 of the License, or
126ea72052Smrg# (at your option) any later version.
136ea72052Smrg#
146ea72052Smrg# This program is distributed in the hope that it will be useful, but
156ea72052Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
166ea72052Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
176ea72052Smrg# General Public License for more details.
186ea72052Smrg#
196ea72052Smrg# You should have received a copy of the GNU General Public License
20b0c24a08Smrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
216ea72052Smrg#
226ea72052Smrg# As a special exception to the GNU General Public License, if you
236ea72052Smrg# distribute this file as part of a program that contains a
246ea72052Smrg# configuration script generated by Autoconf, you may include it under
25b0c24a08Smrg# the same distribution terms that you use for the rest of that
26b0c24a08Smrg# program.  This Exception is an additional permission under section 7
27b0c24a08Smrg# of the GNU General Public License, version 3 ("GPLv3").
286ea72052Smrg#
29b0c24a08Smrg# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
306ea72052Smrg#
31168023feSmrg# You can get the latest version of this script from:
32f3e6ffc5Smrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
33b0c24a08Smrg#
34b0c24a08Smrg# Please send patches to <config-patches@gnu.org>.
35b0c24a08Smrg
366ea72052Smrg
37f3e6ffc5Smrg# The "shellcheck disable" line above the timestamp inhibits complaints
38f3e6ffc5Smrg# about features and limitations of the classic Bourne shell that were
39f3e6ffc5Smrg# superseded or lifted in POSIX.  However, this script identifies a wide
40f3e6ffc5Smrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
41f3e6ffc5Smrg# even some reasonably current systems (Solaris 10 as case-in-point) still
42f3e6ffc5Smrg# have a pre-POSIX /bin/sh.
43f3e6ffc5Smrg
44f3e6ffc5Smrg
456ea72052Smrgme=`echo "$0" | sed -e 's,.*/,,'`
466ea72052Smrg
476ea72052Smrgusage="\
486ea72052SmrgUsage: $0 [OPTION]
496ea72052Smrg
50e32e2dabSmrgOutput the configuration name of the system '$me' is run on.
516ea72052Smrg
52b0c24a08SmrgOptions:
536ea72052Smrg  -h, --help         print this help, then exit
546ea72052Smrg  -t, --time-stamp   print date of last modification, then exit
556ea72052Smrg  -v, --version      print version number, then exit
566ea72052Smrg
576ea72052SmrgReport bugs and patches to <config-patches@gnu.org>."
586ea72052Smrg
596ea72052Smrgversion="\
606ea72052SmrgGNU config.guess ($timestamp)
616ea72052Smrg
626ea72052SmrgOriginally written by Per Bothner.
63e32e2dabSmrgCopyright 1992-2024 Free Software Foundation, Inc.
646ea72052Smrg
656ea72052SmrgThis is free software; see the source for copying conditions.  There is NO
666ea72052Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
676ea72052Smrg
686ea72052Smrghelp="
69e32e2dabSmrgTry '$me --help' for more information."
706ea72052Smrg
716ea72052Smrg# Parse command line
726ea72052Smrgwhile test $# -gt 0 ; do
736ea72052Smrg  case $1 in
746ea72052Smrg    --time-stamp | --time* | -t )
75168023feSmrg       echo "$timestamp" ; exit ;;
766ea72052Smrg    --version | -v )
77168023feSmrg       echo "$version" ; exit ;;
786ea72052Smrg    --help | --h* | -h )
79168023feSmrg       echo "$usage"; exit ;;
806ea72052Smrg    -- )     # Stop option processing
816ea72052Smrg       shift; break ;;
826ea72052Smrg    - )	# Use stdin as input.
836ea72052Smrg       break ;;
846ea72052Smrg    -* )
856ea72052Smrg       echo "$me: invalid option $1$help" >&2
866ea72052Smrg       exit 1 ;;
876ea72052Smrg    * )
886ea72052Smrg       break ;;
896ea72052Smrg  esac
906ea72052Smrgdone
916ea72052Smrg
926ea72052Smrgif test $# != 0; then
936ea72052Smrg  echo "$me: too many arguments$help" >&2
946ea72052Smrg  exit 1
956ea72052Smrgfi
966ea72052Smrg
97f3e6ffc5Smrg# Just in case it came from the environment.
98f3e6ffc5SmrgGUESS=
996ea72052Smrg
1006ea72052Smrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
1016ea72052Smrg# compiler to aid in system detection is discouraged as it requires
1026ea72052Smrg# temporary files to be created and, as you can see below, it is a
1036ea72052Smrg# headache to deal with in a portable fashion.
1046ea72052Smrg
105e32e2dabSmrg# Historically, 'CC_FOR_BUILD' used to be named 'HOST_CC'. We still
106e32e2dabSmrg# use 'HOST_CC' if defined, but it is deprecated.
1076ea72052Smrg
1086ea72052Smrg# Portable tmp directory creation inspired by the Autoconf team.
1096ea72052Smrg
110f3e6ffc5Smrgtmp=
111f3e6ffc5Smrg# shellcheck disable=SC2172
112f3e6ffc5Smrgtrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
113f3e6ffc5Smrg
114f3e6ffc5Smrgset_cc_for_build() {
115f3e6ffc5Smrg    # prevent multiple calls if $tmp is already set
116f3e6ffc5Smrg    test "$tmp" && return 0
117f3e6ffc5Smrg    : "${TMPDIR=/tmp}"
118f3e6ffc5Smrg    # shellcheck disable=SC2039,SC3028
119f3e6ffc5Smrg    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
120f3e6ffc5Smrg	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
121f3e6ffc5Smrg	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
122f3e6ffc5Smrg	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
123f3e6ffc5Smrg    dummy=$tmp/dummy
124f3e6ffc5Smrg    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
125f3e6ffc5Smrg	,,)    echo "int x;" > "$dummy.c"
126f3e6ffc5Smrg	       for driver in cc gcc c89 c99 ; do
127f3e6ffc5Smrg		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
128f3e6ffc5Smrg		       CC_FOR_BUILD=$driver
129f3e6ffc5Smrg		       break
130f3e6ffc5Smrg		   fi
131f3e6ffc5Smrg	       done
132f3e6ffc5Smrg	       if test x"$CC_FOR_BUILD" = x ; then
133f3e6ffc5Smrg		   CC_FOR_BUILD=no_compiler_found
134f3e6ffc5Smrg	       fi
135f3e6ffc5Smrg	       ;;
136f3e6ffc5Smrg	,,*)   CC_FOR_BUILD=$CC ;;
137f3e6ffc5Smrg	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
138f3e6ffc5Smrg    esac
139f3e6ffc5Smrg}
1406ea72052Smrg
1416ea72052Smrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
1426ea72052Smrg# (ghazi@noc.rutgers.edu 1994-08-24)
143f3e6ffc5Smrgif test -f /.attbin/uname ; then
1446ea72052Smrg	PATH=$PATH:/.attbin ; export PATH
1456ea72052Smrgfi
1466ea72052Smrg
1476ea72052SmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
1486ea72052SmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
149f3e6ffc5SmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
1506ea72052SmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
1516ea72052Smrg
152f3e6ffc5Smrgcase $UNAME_SYSTEM in
153b0c24a08SmrgLinux|GNU|GNU/*)
154f3e6ffc5Smrg	LIBC=unknown
155b0c24a08Smrg
156f3e6ffc5Smrg	set_cc_for_build
157b0c24a08Smrg	cat <<-EOF > "$dummy.c"
158e32e2dabSmrg	#if defined(__ANDROID__)
159e32e2dabSmrg	LIBC=android
160e32e2dabSmrg	#else
161b0c24a08Smrg	#include <features.h>
162b0c24a08Smrg	#if defined(__UCLIBC__)
163b0c24a08Smrg	LIBC=uclibc
164b0c24a08Smrg	#elif defined(__dietlibc__)
165b0c24a08Smrg	LIBC=dietlibc
166f3e6ffc5Smrg	#elif defined(__GLIBC__)
167b0c24a08Smrg	LIBC=gnu
168e32e2dabSmrg	#elif defined(__LLVM_LIBC__)
169e32e2dabSmrg	LIBC=llvm
170f3e6ffc5Smrg	#else
171f3e6ffc5Smrg	#include <stdarg.h>
172f3e6ffc5Smrg	/* First heuristic to detect musl libc.  */
173f3e6ffc5Smrg	#ifdef __DEFINED_va_list
174f3e6ffc5Smrg	LIBC=musl
175f3e6ffc5Smrg	#endif
176b0c24a08Smrg	#endif
177e32e2dabSmrg	#endif
178b0c24a08Smrg	EOF
179f3e6ffc5Smrg	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
180f3e6ffc5Smrg	eval "$cc_set_libc"
181b0c24a08Smrg
182f3e6ffc5Smrg	# Second heuristic to detect musl libc.
183f3e6ffc5Smrg	if [ "$LIBC" = unknown ] &&
184f3e6ffc5Smrg	   command -v ldd >/dev/null &&
185f3e6ffc5Smrg	   ldd --version 2>&1 | grep -q ^musl; then
186f3e6ffc5Smrg		LIBC=musl
187f3e6ffc5Smrg	fi
188f3e6ffc5Smrg
189f3e6ffc5Smrg	# If the system lacks a compiler, then just pick glibc.
190f3e6ffc5Smrg	# We could probably try harder.
191f3e6ffc5Smrg	if [ "$LIBC" = unknown ]; then
192f3e6ffc5Smrg		LIBC=gnu
193b0c24a08Smrg	fi
194b0c24a08Smrg	;;
195b0c24a08Smrgesac
196b0c24a08Smrg
1976ea72052Smrg# Note: order is significant - the case branches are not exclusive.
1986ea72052Smrg
199f3e6ffc5Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
2006ea72052Smrg    *:NetBSD:*:*)
2016ea72052Smrg	# NetBSD (nbsd) targets should (where applicable) match one or
202b0c24a08Smrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
2036ea72052Smrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
2046ea72052Smrg	# switched to ELF, *-*-netbsd* would select the old
2056ea72052Smrg	# object file format.  This provides both forward
2066ea72052Smrg	# compatibility and a consistent mechanism for selecting the
2076ea72052Smrg	# object file format.
2086ea72052Smrg	#
2096ea72052Smrg	# Note: NetBSD doesn't particularly care about the vendor
2106ea72052Smrg	# portion of the name.  We always set it to "unknown".
211b0c24a08Smrg	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
212f3e6ffc5Smrg	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
213f3e6ffc5Smrg	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
214b0c24a08Smrg	    echo unknown)`
215f3e6ffc5Smrg	case $UNAME_MACHINE_ARCH in
216f3e6ffc5Smrg	    aarch64eb) machine=aarch64_be-unknown ;;
2176ea72052Smrg	    armeb) machine=armeb-unknown ;;
2186ea72052Smrg	    arm*) machine=arm-unknown ;;
2196ea72052Smrg	    sh3el) machine=shl-unknown ;;
2206ea72052Smrg	    sh3eb) machine=sh-unknown ;;
221168023feSmrg	    sh5el) machine=sh5le-unknown ;;
222b0c24a08Smrg	    earmv*)
223b0c24a08Smrg		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
224b0c24a08Smrg		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
225f3e6ffc5Smrg		machine=${arch}${endian}-unknown
226b0c24a08Smrg		;;
227f3e6ffc5Smrg	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
2286ea72052Smrg	esac
2296ea72052Smrg	# The Operating System including object format, if it has switched
230b0c24a08Smrg	# to ELF recently (or will in the future) and ABI.
231f3e6ffc5Smrg	case $UNAME_MACHINE_ARCH in
232b0c24a08Smrg	    earm*)
233b0c24a08Smrg		os=netbsdelf
234b0c24a08Smrg		;;
2356ea72052Smrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
236f3e6ffc5Smrg		set_cc_for_build
2376ea72052Smrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
238168023feSmrg			| grep -q __ELF__
2396ea72052Smrg		then
2406ea72052Smrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
2416ea72052Smrg		    # Return netbsd for either.  FIX?
2426ea72052Smrg		    os=netbsd
2436ea72052Smrg		else
2446ea72052Smrg		    os=netbsdelf
2456ea72052Smrg		fi
2466ea72052Smrg		;;
2476ea72052Smrg	    *)
248b0c24a08Smrg		os=netbsd
249b0c24a08Smrg		;;
250b0c24a08Smrg	esac
251b0c24a08Smrg	# Determine ABI tags.
252f3e6ffc5Smrg	case $UNAME_MACHINE_ARCH in
253b0c24a08Smrg	    earm*)
254b0c24a08Smrg		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
255b0c24a08Smrg		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
2566ea72052Smrg		;;
2576ea72052Smrg	esac
2586ea72052Smrg	# The OS release
2596ea72052Smrg	# Debian GNU/NetBSD machines have a different userland, and
2606ea72052Smrg	# thus, need a distinct triplet. However, they do not need
2616ea72052Smrg	# kernel version information, so it can be replaced with a
2626ea72052Smrg	# suitable tag, in the style of linux-gnu.
263f3e6ffc5Smrg	case $UNAME_VERSION in
2646ea72052Smrg	    Debian*)
2656ea72052Smrg		release='-gnu'
2666ea72052Smrg		;;
2676ea72052Smrg	    *)
268b0c24a08Smrg		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
2696ea72052Smrg		;;
2706ea72052Smrg	esac
2716ea72052Smrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
2726ea72052Smrg	# contains redundant information, the shorter form:
2736ea72052Smrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
274f3e6ffc5Smrg	GUESS=$machine-${os}${release}${abi-}
275f3e6ffc5Smrg	;;
276b0c24a08Smrg    *:Bitrig:*:*)
277b0c24a08Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
278f3e6ffc5Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
279f3e6ffc5Smrg	;;
2806ea72052Smrg    *:OpenBSD:*:*)
281168023feSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
282f3e6ffc5Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
283f3e6ffc5Smrg	;;
284f3e6ffc5Smrg    *:SecBSD:*:*)
285f3e6ffc5Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
286f3e6ffc5Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
287f3e6ffc5Smrg	;;
288b0c24a08Smrg    *:LibertyBSD:*:*)
289b0c24a08Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
290f3e6ffc5Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
291f3e6ffc5Smrg	;;
292b0c24a08Smrg    *:MidnightBSD:*:*)
293f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
294f3e6ffc5Smrg	;;
295168023feSmrg    *:ekkoBSD:*:*)
296f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
297f3e6ffc5Smrg	;;
298168023feSmrg    *:SolidBSD:*:*)
299f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
300f3e6ffc5Smrg	;;
301f3e6ffc5Smrg    *:OS108:*:*)
302f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
303f3e6ffc5Smrg	;;
304168023feSmrg    macppc:MirBSD:*:*)
305f3e6ffc5Smrg	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
306f3e6ffc5Smrg	;;
307168023feSmrg    *:MirBSD:*:*)
308f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
309f3e6ffc5Smrg	;;
310b0c24a08Smrg    *:Sortix:*:*)
311f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-sortix
312f3e6ffc5Smrg	;;
313f3e6ffc5Smrg    *:Twizzler:*:*)
314f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-twizzler
315f3e6ffc5Smrg	;;
316b0c24a08Smrg    *:Redox:*:*)
317f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-redox
318f3e6ffc5Smrg	;;
319b0c24a08Smrg    mips:OSF1:*.*)
320f3e6ffc5Smrg	GUESS=mips-dec-osf1
321f3e6ffc5Smrg	;;
3226ea72052Smrg    alpha:OSF1:*:*)
323f3e6ffc5Smrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
324f3e6ffc5Smrg	trap '' 0
325168023feSmrg	case $UNAME_RELEASE in
326168023feSmrg	*4.0)
3276ea72052Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
328168023feSmrg		;;
329168023feSmrg	*5.*)
330b0c24a08Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
331168023feSmrg		;;
332168023feSmrg	esac
3336ea72052Smrg	# According to Compaq, /usr/sbin/psrinfo has been available on
3346ea72052Smrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
3356ea72052Smrg	# covers most systems running today.  This code pipes the CPU
3366ea72052Smrg	# types through head -n 1, so we only detect the type of CPU 0.
3376ea72052Smrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
338f3e6ffc5Smrg	case $ALPHA_CPU_TYPE in
3396ea72052Smrg	    "EV4 (21064)")
340b0c24a08Smrg		UNAME_MACHINE=alpha ;;
3416ea72052Smrg	    "EV4.5 (21064)")
342b0c24a08Smrg		UNAME_MACHINE=alpha ;;
3436ea72052Smrg	    "LCA4 (21066/21068)")
344b0c24a08Smrg		UNAME_MACHINE=alpha ;;
3456ea72052Smrg	    "EV5 (21164)")
346b0c24a08Smrg		UNAME_MACHINE=alphaev5 ;;
3476ea72052Smrg	    "EV5.6 (21164A)")
348b0c24a08Smrg		UNAME_MACHINE=alphaev56 ;;
3496ea72052Smrg	    "EV5.6 (21164PC)")
350b0c24a08Smrg		UNAME_MACHINE=alphapca56 ;;
3516ea72052Smrg	    "EV5.7 (21164PC)")
352b0c24a08Smrg		UNAME_MACHINE=alphapca57 ;;
3536ea72052Smrg	    "EV6 (21264)")
354b0c24a08Smrg		UNAME_MACHINE=alphaev6 ;;
3556ea72052Smrg	    "EV6.7 (21264A)")
356b0c24a08Smrg		UNAME_MACHINE=alphaev67 ;;
3576ea72052Smrg	    "EV6.8CB (21264C)")
358b0c24a08Smrg		UNAME_MACHINE=alphaev68 ;;
3596ea72052Smrg	    "EV6.8AL (21264B)")
360b0c24a08Smrg		UNAME_MACHINE=alphaev68 ;;
3616ea72052Smrg	    "EV6.8CX (21264D)")
362b0c24a08Smrg		UNAME_MACHINE=alphaev68 ;;
3636ea72052Smrg	    "EV6.9A (21264/EV69A)")
364b0c24a08Smrg		UNAME_MACHINE=alphaev69 ;;
3656ea72052Smrg	    "EV7 (21364)")
366b0c24a08Smrg		UNAME_MACHINE=alphaev7 ;;
3676ea72052Smrg	    "EV7.9 (21364A)")
368b0c24a08Smrg		UNAME_MACHINE=alphaev79 ;;
3696ea72052Smrg	esac
370168023feSmrg	# A Pn.n version is a patched version.
3716ea72052Smrg	# A Vn.n version is a released version.
3726ea72052Smrg	# A Tn.n version is a released field test version.
3736ea72052Smrg	# A Xn.n version is an unreleased experimental baselevel.
3746ea72052Smrg	# 1.2 uses "1.2" for uname -r.
375f3e6ffc5Smrg	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
376f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
377f3e6ffc5Smrg	;;
3786ea72052Smrg    Amiga*:UNIX_System_V:4.0:*)
379f3e6ffc5Smrg	GUESS=m68k-unknown-sysv4
380f3e6ffc5Smrg	;;
3816ea72052Smrg    *:[Aa]miga[Oo][Ss]:*:*)
382f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-amigaos
383f3e6ffc5Smrg	;;
3846ea72052Smrg    *:[Mm]orph[Oo][Ss]:*:*)
385f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-morphos
386f3e6ffc5Smrg	;;
3876ea72052Smrg    *:OS/390:*:*)
388f3e6ffc5Smrg	GUESS=i370-ibm-openedition
389f3e6ffc5Smrg	;;
390168023feSmrg    *:z/VM:*:*)
391f3e6ffc5Smrg	GUESS=s390-ibm-zvmoe
392f3e6ffc5Smrg	;;
393168023feSmrg    *:OS400:*:*)
394f3e6ffc5Smrg	GUESS=powerpc-ibm-os400
395f3e6ffc5Smrg	;;
3966ea72052Smrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
397f3e6ffc5Smrg	GUESS=arm-acorn-riscix$UNAME_RELEASE
398f3e6ffc5Smrg	;;
399b0c24a08Smrg    arm*:riscos:*:*|arm*:RISCOS:*:*)
400f3e6ffc5Smrg	GUESS=arm-unknown-riscos
401f3e6ffc5Smrg	;;
4026ea72052Smrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
403f3e6ffc5Smrg	GUESS=hppa1.1-hitachi-hiuxmpp
404f3e6ffc5Smrg	;;
4056ea72052Smrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
4066ea72052Smrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
407f3e6ffc5Smrg	case `(/bin/universe) 2>/dev/null` in
408f3e6ffc5Smrg	    att) GUESS=pyramid-pyramid-sysv3 ;;
409f3e6ffc5Smrg	    *)   GUESS=pyramid-pyramid-bsd   ;;
410f3e6ffc5Smrg	esac
411f3e6ffc5Smrg	;;
4126ea72052Smrg    NILE*:*:*:dcosx)
413f3e6ffc5Smrg	GUESS=pyramid-pyramid-svr4
414f3e6ffc5Smrg	;;
4156ea72052Smrg    DRS?6000:unix:4.0:6*)
416f3e6ffc5Smrg	GUESS=sparc-icl-nx6
417f3e6ffc5Smrg	;;
418168023feSmrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
4196ea72052Smrg	case `/usr/bin/uname -p` in
420f3e6ffc5Smrg	    sparc) GUESS=sparc-icl-nx7 ;;
421f3e6ffc5Smrg	esac
422f3e6ffc5Smrg	;;
423168023feSmrg    s390x:SunOS:*:*)
424f3e6ffc5Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
425f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
426f3e6ffc5Smrg	;;
4276ea72052Smrg    sun4H:SunOS:5.*:*)
428f3e6ffc5Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
429f3e6ffc5Smrg	GUESS=sparc-hal-solaris2$SUN_REL
430f3e6ffc5Smrg	;;
4316ea72052Smrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
432f3e6ffc5Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
433f3e6ffc5Smrg	GUESS=sparc-sun-solaris2$SUN_REL
434f3e6ffc5Smrg	;;
435168023feSmrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
436f3e6ffc5Smrg	GUESS=i386-pc-auroraux$UNAME_RELEASE
437f3e6ffc5Smrg	;;
438168023feSmrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
439f3e6ffc5Smrg	set_cc_for_build
440b0c24a08Smrg	SUN_ARCH=i386
441168023feSmrg	# If there is a compiler, see if it is configured for 64-bit objects.
442168023feSmrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
443168023feSmrg	# This test works for both compilers.
444f3e6ffc5Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
445168023feSmrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
446e32e2dabSmrg		(CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \
447168023feSmrg		grep IS_64BIT_ARCH >/dev/null
448168023feSmrg	    then
449b0c24a08Smrg		SUN_ARCH=x86_64
450168023feSmrg	    fi
451168023feSmrg	fi
452f3e6ffc5Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
453f3e6ffc5Smrg	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
454f3e6ffc5Smrg	;;
4556ea72052Smrg    sun4*:SunOS:6*:*)
4566ea72052Smrg	# According to config.sub, this is the proper way to canonicalize
4576ea72052Smrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
4586ea72052Smrg	# it's likely to be more like Solaris than SunOS4.
459f3e6ffc5Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
460f3e6ffc5Smrg	GUESS=sparc-sun-solaris3$SUN_REL
461f3e6ffc5Smrg	;;
4626ea72052Smrg    sun4*:SunOS:*:*)
463f3e6ffc5Smrg	case `/usr/bin/arch -k` in
4646ea72052Smrg	    Series*|S4*)
4656ea72052Smrg		UNAME_RELEASE=`uname -v`
4666ea72052Smrg		;;
4676ea72052Smrg	esac
468e32e2dabSmrg	# Japanese Language versions have a version number like '4.1.3-JL'.
469f3e6ffc5Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
470f3e6ffc5Smrg	GUESS=sparc-sun-sunos$SUN_REL
471f3e6ffc5Smrg	;;
4726ea72052Smrg    sun3*:SunOS:*:*)
473f3e6ffc5Smrg	GUESS=m68k-sun-sunos$UNAME_RELEASE
474f3e6ffc5Smrg	;;
4756ea72052Smrg    sun*:*:4.2BSD:*)
4766ea72052Smrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
477b0c24a08Smrg	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
478f3e6ffc5Smrg	case `/bin/arch` in
4796ea72052Smrg	    sun3)
480f3e6ffc5Smrg		GUESS=m68k-sun-sunos$UNAME_RELEASE
4816ea72052Smrg		;;
4826ea72052Smrg	    sun4)
483f3e6ffc5Smrg		GUESS=sparc-sun-sunos$UNAME_RELEASE
4846ea72052Smrg		;;
4856ea72052Smrg	esac
486f3e6ffc5Smrg	;;
4876ea72052Smrg    aushp:SunOS:*:*)
488f3e6ffc5Smrg	GUESS=sparc-auspex-sunos$UNAME_RELEASE
489f3e6ffc5Smrg	;;
4906ea72052Smrg    # The situation for MiNT is a little confusing.  The machine name
4916ea72052Smrg    # can be virtually everything (everything which is not
4926ea72052Smrg    # "atarist" or "atariste" at least should have a processor
4936ea72052Smrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
4946ea72052Smrg    # to the lowercase version "mint" (or "freemint").  Finally
4956ea72052Smrg    # the system name "TOS" denotes a system which is actually not
4966ea72052Smrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
4976ea72052Smrg    # be no problem.
4986ea72052Smrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
499f3e6ffc5Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
500f3e6ffc5Smrg	;;
5016ea72052Smrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
502f3e6ffc5Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
503f3e6ffc5Smrg	;;
5046ea72052Smrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
505f3e6ffc5Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
506f3e6ffc5Smrg	;;
5076ea72052Smrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
508f3e6ffc5Smrg	GUESS=m68k-milan-mint$UNAME_RELEASE
509f3e6ffc5Smrg	;;
5106ea72052Smrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
511f3e6ffc5Smrg	GUESS=m68k-hades-mint$UNAME_RELEASE
512f3e6ffc5Smrg	;;
5136ea72052Smrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
514f3e6ffc5Smrg	GUESS=m68k-unknown-mint$UNAME_RELEASE
515f3e6ffc5Smrg	;;
516168023feSmrg    m68k:machten:*:*)
517f3e6ffc5Smrg	GUESS=m68k-apple-machten$UNAME_RELEASE
518f3e6ffc5Smrg	;;
5196ea72052Smrg    powerpc:machten:*:*)
520f3e6ffc5Smrg	GUESS=powerpc-apple-machten$UNAME_RELEASE
521f3e6ffc5Smrg	;;
5226ea72052Smrg    RISC*:Mach:*:*)
523f3e6ffc5Smrg	GUESS=mips-dec-mach_bsd4.3
524f3e6ffc5Smrg	;;
5256ea72052Smrg    RISC*:ULTRIX:*:*)
526f3e6ffc5Smrg	GUESS=mips-dec-ultrix$UNAME_RELEASE
527f3e6ffc5Smrg	;;
5286ea72052Smrg    VAX*:ULTRIX*:*:*)
529f3e6ffc5Smrg	GUESS=vax-dec-ultrix$UNAME_RELEASE
530f3e6ffc5Smrg	;;
5316ea72052Smrg    2020:CLIX:*:* | 2430:CLIX:*:*)
532f3e6ffc5Smrg	GUESS=clipper-intergraph-clix$UNAME_RELEASE
533f3e6ffc5Smrg	;;
5346ea72052Smrg    mips:*:*:UMIPS | mips:*:*:RISCos)
535f3e6ffc5Smrg	set_cc_for_build
536b0c24a08Smrg	sed 's/^	//' << EOF > "$dummy.c"
5376ea72052Smrg#ifdef __cplusplus
5386ea72052Smrg#include <stdio.h>  /* for printf() prototype */
5396ea72052Smrg	int main (int argc, char *argv[]) {
5406ea72052Smrg#else
5416ea72052Smrg	int main (argc, argv) int argc; char *argv[]; {
5426ea72052Smrg#endif
5436ea72052Smrg	#if defined (host_mips) && defined (MIPSEB)
5446ea72052Smrg	#if defined (SYSTYPE_SYSV)
545b0c24a08Smrg	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
5466ea72052Smrg	#endif
5476ea72052Smrg	#if defined (SYSTYPE_SVR4)
548b0c24a08Smrg	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
5496ea72052Smrg	#endif
5506ea72052Smrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
551b0c24a08Smrg	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
5526ea72052Smrg	#endif
5536ea72052Smrg	#endif
5546ea72052Smrg	  exit (-1);
5556ea72052Smrg	}
5566ea72052SmrgEOF
557b0c24a08Smrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
558b0c24a08Smrg	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
559b0c24a08Smrg	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
560168023feSmrg	    { echo "$SYSTEM_NAME"; exit; }
561f3e6ffc5Smrg	GUESS=mips-mips-riscos$UNAME_RELEASE
562f3e6ffc5Smrg	;;
5636ea72052Smrg    Motorola:PowerMAX_OS:*:*)
564f3e6ffc5Smrg	GUESS=powerpc-motorola-powermax
565f3e6ffc5Smrg	;;
5666ea72052Smrg    Motorola:*:4.3:PL8-*)
567f3e6ffc5Smrg	GUESS=powerpc-harris-powermax
568f3e6ffc5Smrg	;;
5696ea72052Smrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
570f3e6ffc5Smrg	GUESS=powerpc-harris-powermax
571f3e6ffc5Smrg	;;
5726ea72052Smrg    Night_Hawk:Power_UNIX:*:*)
573f3e6ffc5Smrg	GUESS=powerpc-harris-powerunix
574f3e6ffc5Smrg	;;
5756ea72052Smrg    m88k:CX/UX:7*:*)
576f3e6ffc5Smrg	GUESS=m88k-harris-cxux7
577f3e6ffc5Smrg	;;
5786ea72052Smrg    m88k:*:4*:R4*)
579f3e6ffc5Smrg	GUESS=m88k-motorola-sysv4
580f3e6ffc5Smrg	;;
5816ea72052Smrg    m88k:*:3*:R3*)
582f3e6ffc5Smrg	GUESS=m88k-motorola-sysv3
583f3e6ffc5Smrg	;;
5846ea72052Smrg    AViiON:dgux:*:*)
585b0c24a08Smrg	# DG/UX returns AViiON for all architectures
586b0c24a08Smrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
587f3e6ffc5Smrg	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
5886ea72052Smrg	then
589f3e6ffc5Smrg	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
590f3e6ffc5Smrg	       test "$TARGET_BINARY_INTERFACE"x = x
5916ea72052Smrg	    then
592f3e6ffc5Smrg		GUESS=m88k-dg-dgux$UNAME_RELEASE
5936ea72052Smrg	    else
594f3e6ffc5Smrg		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
5956ea72052Smrg	    fi
5966ea72052Smrg	else
597f3e6ffc5Smrg	    GUESS=i586-dg-dgux$UNAME_RELEASE
5986ea72052Smrg	fi
599f3e6ffc5Smrg	;;
6006ea72052Smrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
601f3e6ffc5Smrg	GUESS=m88k-dolphin-sysv3
602f3e6ffc5Smrg	;;
6036ea72052Smrg    M88*:*:R3*:*)
6046ea72052Smrg	# Delta 88k system running SVR3
605f3e6ffc5Smrg	GUESS=m88k-motorola-sysv3
606f3e6ffc5Smrg	;;
6076ea72052Smrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
608f3e6ffc5Smrg	GUESS=m88k-tektronix-sysv3
609f3e6ffc5Smrg	;;
6106ea72052Smrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
611f3e6ffc5Smrg	GUESS=m68k-tektronix-bsd
612f3e6ffc5Smrg	;;
6136ea72052Smrg    *:IRIX*:*:*)
614f3e6ffc5Smrg	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
615f3e6ffc5Smrg	GUESS=mips-sgi-irix$IRIX_REL
616f3e6ffc5Smrg	;;
6176ea72052Smrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
618f3e6ffc5Smrg	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
619f3e6ffc5Smrg	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
6206ea72052Smrg    i*86:AIX:*:*)
621f3e6ffc5Smrg	GUESS=i386-ibm-aix
622f3e6ffc5Smrg	;;
6236ea72052Smrg    ia64:AIX:*:*)
624f3e6ffc5Smrg	if test -x /usr/bin/oslevel ; then
6256ea72052Smrg		IBM_REV=`/usr/bin/oslevel`
6266ea72052Smrg	else
627f3e6ffc5Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
6286ea72052Smrg	fi
629f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
630f3e6ffc5Smrg	;;
6316ea72052Smrg    *:AIX:2:3)
6326ea72052Smrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
633f3e6ffc5Smrg		set_cc_for_build
634b0c24a08Smrg		sed 's/^		//' << EOF > "$dummy.c"
6356ea72052Smrg		#include <sys/systemcfg.h>
6366ea72052Smrg
6376ea72052Smrg		main()
6386ea72052Smrg			{
6396ea72052Smrg			if (!__power_pc())
6406ea72052Smrg				exit(1);
6416ea72052Smrg			puts("powerpc-ibm-aix3.2.5");
6426ea72052Smrg			exit(0);
6436ea72052Smrg			}
6446ea72052SmrgEOF
645b0c24a08Smrg		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
646168023feSmrg		then
647f3e6ffc5Smrg			GUESS=$SYSTEM_NAME
648168023feSmrg		else
649f3e6ffc5Smrg			GUESS=rs6000-ibm-aix3.2.5
650168023feSmrg		fi
6516ea72052Smrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
652f3e6ffc5Smrg		GUESS=rs6000-ibm-aix3.2.4
6536ea72052Smrg	else
654f3e6ffc5Smrg		GUESS=rs6000-ibm-aix3.2
6556ea72052Smrg	fi
656f3e6ffc5Smrg	;;
65749e82cebSmrg    *:AIX:*:[4567])
6586ea72052Smrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
659b0c24a08Smrg	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
6606ea72052Smrg		IBM_ARCH=rs6000
6616ea72052Smrg	else
6626ea72052Smrg		IBM_ARCH=powerpc
6636ea72052Smrg	fi
664f3e6ffc5Smrg	if test -x /usr/bin/lslpp ; then
665f3e6ffc5Smrg		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
666b0c24a08Smrg			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
6676ea72052Smrg	else
668f3e6ffc5Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
6696ea72052Smrg	fi
670f3e6ffc5Smrg	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
671f3e6ffc5Smrg	;;
6726ea72052Smrg    *:AIX:*:*)
673f3e6ffc5Smrg	GUESS=rs6000-ibm-aix
674f3e6ffc5Smrg	;;
675b0c24a08Smrg    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
676f3e6ffc5Smrg	GUESS=romp-ibm-bsd4.4
677f3e6ffc5Smrg	;;
6786ea72052Smrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
679f3e6ffc5Smrg	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
680f3e6ffc5Smrg	;;                                  # report: romp-ibm BSD 4.3
6816ea72052Smrg    *:BOSX:*:*)
682f3e6ffc5Smrg	GUESS=rs6000-bull-bosx
683f3e6ffc5Smrg	;;
6846ea72052Smrg    DPX/2?00:B.O.S.:*:*)
685f3e6ffc5Smrg	GUESS=m68k-bull-sysv3
686f3e6ffc5Smrg	;;
6876ea72052Smrg    9000/[34]??:4.3bsd:1.*:*)
688f3e6ffc5Smrg	GUESS=m68k-hp-bsd
689f3e6ffc5Smrg	;;
6906ea72052Smrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
691f3e6ffc5Smrg	GUESS=m68k-hp-bsd4.4
692f3e6ffc5Smrg	;;
6936ea72052Smrg    9000/[34678]??:HP-UX:*:*)
694f3e6ffc5Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
695f3e6ffc5Smrg	case $UNAME_MACHINE in
696b0c24a08Smrg	    9000/31?)            HP_ARCH=m68000 ;;
697b0c24a08Smrg	    9000/[34]??)         HP_ARCH=m68k ;;
6986ea72052Smrg	    9000/[678][0-9][0-9])
699f3e6ffc5Smrg		if test -x /usr/bin/getconf; then
7006ea72052Smrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
701b0c24a08Smrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
702f3e6ffc5Smrg		    case $sc_cpu_version in
703b0c24a08Smrg		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
704b0c24a08Smrg		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
705b0c24a08Smrg		      532)                      # CPU_PA_RISC2_0
706f3e6ffc5Smrg			case $sc_kernel_bits in
707b0c24a08Smrg			  32) HP_ARCH=hppa2.0n ;;
708b0c24a08Smrg			  64) HP_ARCH=hppa2.0w ;;
709b0c24a08Smrg			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
710b0c24a08Smrg			esac ;;
711b0c24a08Smrg		    esac
7126ea72052Smrg		fi
713f3e6ffc5Smrg		if test "$HP_ARCH" = ""; then
714f3e6ffc5Smrg		    set_cc_for_build
715b0c24a08Smrg		    sed 's/^		//' << EOF > "$dummy.c"
7166ea72052Smrg
717b0c24a08Smrg		#define _HPUX_SOURCE
718b0c24a08Smrg		#include <stdlib.h>
719b0c24a08Smrg		#include <unistd.h>
7206ea72052Smrg
721b0c24a08Smrg		int main ()
722b0c24a08Smrg		{
723b0c24a08Smrg		#if defined(_SC_KERNEL_BITS)
724b0c24a08Smrg		    long bits = sysconf(_SC_KERNEL_BITS);
725b0c24a08Smrg		#endif
726b0c24a08Smrg		    long cpu  = sysconf (_SC_CPU_VERSION);
7276ea72052Smrg
728b0c24a08Smrg		    switch (cpu)
729b0c24a08Smrg			{
730b0c24a08Smrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
731b0c24a08Smrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
732b0c24a08Smrg			case CPU_PA_RISC2_0:
733b0c24a08Smrg		#if defined(_SC_KERNEL_BITS)
734b0c24a08Smrg			    switch (bits)
735b0c24a08Smrg				{
736b0c24a08Smrg				case 64: puts ("hppa2.0w"); break;
737b0c24a08Smrg				case 32: puts ("hppa2.0n"); break;
738b0c24a08Smrg				default: puts ("hppa2.0"); break;
739b0c24a08Smrg				} break;
740b0c24a08Smrg		#else  /* !defined(_SC_KERNEL_BITS) */
741b0c24a08Smrg			    puts ("hppa2.0"); break;
742b0c24a08Smrg		#endif
743b0c24a08Smrg			default: puts ("hppa1.0"); break;
744b0c24a08Smrg			}
745b0c24a08Smrg		    exit (0);
746b0c24a08Smrg		}
7476ea72052SmrgEOF
748b0c24a08Smrg		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
7496ea72052Smrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
7506ea72052Smrg		fi ;;
7516ea72052Smrg	esac
752f3e6ffc5Smrg	if test "$HP_ARCH" = hppa2.0w
7536ea72052Smrg	then
754f3e6ffc5Smrg	    set_cc_for_build
755168023feSmrg
756168023feSmrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
757168023feSmrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
758168023feSmrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
759168023feSmrg	    #
760168023feSmrg	    # $ CC_FOR_BUILD=cc ./config.guess
761168023feSmrg	    # => hppa2.0w-hp-hpux11.23
762168023feSmrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
763168023feSmrg	    # => hppa64-hp-hpux11.23
764168023feSmrg
765b0c24a08Smrg	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
766168023feSmrg		grep -q __LP64__
7676ea72052Smrg	    then
768b0c24a08Smrg		HP_ARCH=hppa2.0w
7696ea72052Smrg	    else
770b0c24a08Smrg		HP_ARCH=hppa64
7716ea72052Smrg	    fi
7726ea72052Smrg	fi
773f3e6ffc5Smrg	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
774f3e6ffc5Smrg	;;
7756ea72052Smrg    ia64:HP-UX:*:*)
776f3e6ffc5Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
777f3e6ffc5Smrg	GUESS=ia64-hp-hpux$HPUX_REV
778f3e6ffc5Smrg	;;
7796ea72052Smrg    3050*:HI-UX:*:*)
780f3e6ffc5Smrg	set_cc_for_build
781b0c24a08Smrg	sed 's/^	//' << EOF > "$dummy.c"
7826ea72052Smrg	#include <unistd.h>
7836ea72052Smrg	int
7846ea72052Smrg	main ()
7856ea72052Smrg	{
7866ea72052Smrg	  long cpu = sysconf (_SC_CPU_VERSION);
7876ea72052Smrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
7886ea72052Smrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
7896ea72052Smrg	     results, however.  */
7906ea72052Smrg	  if (CPU_IS_PA_RISC (cpu))
7916ea72052Smrg	    {
7926ea72052Smrg	      switch (cpu)
7936ea72052Smrg		{
7946ea72052Smrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
7956ea72052Smrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
7966ea72052Smrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
7976ea72052Smrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
7986ea72052Smrg		}
7996ea72052Smrg	    }
8006ea72052Smrg	  else if (CPU_IS_HP_MC68K (cpu))
8016ea72052Smrg	    puts ("m68k-hitachi-hiuxwe2");
8026ea72052Smrg	  else puts ("unknown-hitachi-hiuxwe2");
8036ea72052Smrg	  exit (0);
8046ea72052Smrg	}
8056ea72052SmrgEOF
806b0c24a08Smrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
807168023feSmrg		{ echo "$SYSTEM_NAME"; exit; }
808f3e6ffc5Smrg	GUESS=unknown-hitachi-hiuxwe2
809f3e6ffc5Smrg	;;
810b0c24a08Smrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
811f3e6ffc5Smrg	GUESS=hppa1.1-hp-bsd
812f3e6ffc5Smrg	;;
8136ea72052Smrg    9000/8??:4.3bsd:*:*)
814f3e6ffc5Smrg	GUESS=hppa1.0-hp-bsd
815f3e6ffc5Smrg	;;
8166ea72052Smrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
817f3e6ffc5Smrg	GUESS=hppa1.0-hp-mpeix
818f3e6ffc5Smrg	;;
819b0c24a08Smrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
820f3e6ffc5Smrg	GUESS=hppa1.1-hp-osf
821f3e6ffc5Smrg	;;
8226ea72052Smrg    hp8??:OSF1:*:*)
823f3e6ffc5Smrg	GUESS=hppa1.0-hp-osf
824f3e6ffc5Smrg	;;
8256ea72052Smrg    i*86:OSF1:*:*)
826f3e6ffc5Smrg	if test -x /usr/sbin/sysversion ; then
827f3e6ffc5Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1mk
8286ea72052Smrg	else
829f3e6ffc5Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1
8306ea72052Smrg	fi
831f3e6ffc5Smrg	;;
8326ea72052Smrg    parisc*:Lites*:*:*)
833f3e6ffc5Smrg	GUESS=hppa1.1-hp-lites
834f3e6ffc5Smrg	;;
8356ea72052Smrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
836f3e6ffc5Smrg	GUESS=c1-convex-bsd
837f3e6ffc5Smrg	;;
8386ea72052Smrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
8396ea72052Smrg	if getsysinfo -f scalar_acc
8406ea72052Smrg	then echo c32-convex-bsd
8416ea72052Smrg	else echo c2-convex-bsd
8426ea72052Smrg	fi
843b0c24a08Smrg	exit ;;
8446ea72052Smrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
845f3e6ffc5Smrg	GUESS=c34-convex-bsd
846f3e6ffc5Smrg	;;
8476ea72052Smrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
848f3e6ffc5Smrg	GUESS=c38-convex-bsd
849f3e6ffc5Smrg	;;
8506ea72052Smrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
851f3e6ffc5Smrg	GUESS=c4-convex-bsd
852f3e6ffc5Smrg	;;
8536ea72052Smrg    CRAY*Y-MP:*:*:*)
854f3e6ffc5Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
855f3e6ffc5Smrg	GUESS=ymp-cray-unicos$CRAY_REL
856f3e6ffc5Smrg	;;
8576ea72052Smrg    CRAY*[A-Z]90:*:*:*)
858b0c24a08Smrg	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
8596ea72052Smrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
8606ea72052Smrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
8616ea72052Smrg	      -e 's/\.[^.]*$/.X/'
862168023feSmrg	exit ;;
8636ea72052Smrg    CRAY*TS:*:*:*)
864f3e6ffc5Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
865f3e6ffc5Smrg	GUESS=t90-cray-unicos$CRAY_REL
866f3e6ffc5Smrg	;;
8676ea72052Smrg    CRAY*T3E:*:*:*)
868f3e6ffc5Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
869f3e6ffc5Smrg	GUESS=alphaev5-cray-unicosmk$CRAY_REL
870f3e6ffc5Smrg	;;
8716ea72052Smrg    CRAY*SV1:*:*:*)
872f3e6ffc5Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
873f3e6ffc5Smrg	GUESS=sv1-cray-unicos$CRAY_REL
874f3e6ffc5Smrg	;;
8756ea72052Smrg    *:UNICOS/mp:*:*)
876f3e6ffc5Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
877f3e6ffc5Smrg	GUESS=craynv-cray-unicosmp$CRAY_REL
878f3e6ffc5Smrg	;;
8796ea72052Smrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
880b0c24a08Smrg	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
881b0c24a08Smrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
882b0c24a08Smrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
883f3e6ffc5Smrg	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
884f3e6ffc5Smrg	;;
885168023feSmrg    5000:UNIX_System_V:4.*:*)
886b0c24a08Smrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
887b0c24a08Smrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
888f3e6ffc5Smrg	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
889f3e6ffc5Smrg	;;
8906ea72052Smrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
891f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
892f3e6ffc5Smrg	;;
8936ea72052Smrg    sparc*:BSD/OS:*:*)
894f3e6ffc5Smrg	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
895f3e6ffc5Smrg	;;
8966ea72052Smrg    *:BSD/OS:*:*)
897f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
898f3e6ffc5Smrg	;;
899f3e6ffc5Smrg    arm:FreeBSD:*:*)
900f3e6ffc5Smrg	UNAME_PROCESSOR=`uname -p`
901f3e6ffc5Smrg	set_cc_for_build
902f3e6ffc5Smrg	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
903f3e6ffc5Smrg	    | grep -q __ARM_PCS_VFP
904f3e6ffc5Smrg	then
905f3e6ffc5Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
906f3e6ffc5Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
907f3e6ffc5Smrg	else
908f3e6ffc5Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
909f3e6ffc5Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
910f3e6ffc5Smrg	fi
911f3e6ffc5Smrg	;;
912168023feSmrg    *:FreeBSD:*:*)
913e32e2dabSmrg	UNAME_PROCESSOR=`uname -p`
914f3e6ffc5Smrg	case $UNAME_PROCESSOR in
915168023feSmrg	    amd64)
916b0c24a08Smrg		UNAME_PROCESSOR=x86_64 ;;
917b0c24a08Smrg	    i386)
918b0c24a08Smrg		UNAME_PROCESSOR=i586 ;;
919168023feSmrg	esac
920f3e6ffc5Smrg	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
921f3e6ffc5Smrg	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
922f3e6ffc5Smrg	;;
9236ea72052Smrg    i*:CYGWIN*:*)
924f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-pc-cygwin
925f3e6ffc5Smrg	;;
926b0c24a08Smrg    *:MINGW64*:*)
927f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-pc-mingw64
928f3e6ffc5Smrg	;;
929168023feSmrg    *:MINGW*:*)
930f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-pc-mingw32
931f3e6ffc5Smrg	;;
932b0c24a08Smrg    *:MSYS*:*)
933f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-pc-msys
934f3e6ffc5Smrg	;;
9356ea72052Smrg    i*:PW*:*)
936f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-pc-pw32
937f3e6ffc5Smrg	;;
938e32e2dabSmrg    *:SerenityOS:*:*)
939e32e2dabSmrg        GUESS=$UNAME_MACHINE-pc-serenity
940e32e2dabSmrg        ;;
941168023feSmrg    *:Interix*:*)
942f3e6ffc5Smrg	case $UNAME_MACHINE in
943168023feSmrg	    x86)
944f3e6ffc5Smrg		GUESS=i586-pc-interix$UNAME_RELEASE
945f3e6ffc5Smrg		;;
946168023feSmrg	    authenticamd | genuineintel | EM64T)
947f3e6ffc5Smrg		GUESS=x86_64-unknown-interix$UNAME_RELEASE
948f3e6ffc5Smrg		;;
949168023feSmrg	    IA64)
950f3e6ffc5Smrg		GUESS=ia64-unknown-interix$UNAME_RELEASE
951f3e6ffc5Smrg		;;
952168023feSmrg	esac ;;
9536ea72052Smrg    i*:UWIN*:*)
954f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-pc-uwin
955f3e6ffc5Smrg	;;
956168023feSmrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
957f3e6ffc5Smrg	GUESS=x86_64-pc-cygwin
958f3e6ffc5Smrg	;;
9596ea72052Smrg    prep*:SunOS:5.*:*)
960f3e6ffc5Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
961f3e6ffc5Smrg	GUESS=powerpcle-unknown-solaris2$SUN_REL
962f3e6ffc5Smrg	;;
9636ea72052Smrg    *:GNU:*:*)
964168023feSmrg	# the GNU system
965f3e6ffc5Smrg	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
966f3e6ffc5Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
967f3e6ffc5Smrg	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
968f3e6ffc5Smrg	;;
969168023feSmrg    *:GNU/*:*:*)
970168023feSmrg	# other systems with GNU libc and userland
971f3e6ffc5Smrg	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
972f3e6ffc5Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
973f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
974f3e6ffc5Smrg	;;
975e32e2dabSmrg    x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*)
976e32e2dabSmrg	GUESS="$UNAME_MACHINE-pc-managarm-mlibc"
977e32e2dabSmrg	;;
978e32e2dabSmrg    *:[Mm]anagarm:*:*)
979e32e2dabSmrg	GUESS="$UNAME_MACHINE-unknown-managarm-mlibc"
980e32e2dabSmrg	;;
981f3e6ffc5Smrg    *:Minix:*:*)
982f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-minix
983f3e6ffc5Smrg	;;
984b0c24a08Smrg    aarch64:Linux:*:*)
985e32e2dabSmrg	set_cc_for_build
986e32e2dabSmrg	CPU=$UNAME_MACHINE
987e32e2dabSmrg	LIBCABI=$LIBC
988e32e2dabSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
989e32e2dabSmrg	    ABI=64
990e32e2dabSmrg	    sed 's/^	    //' << EOF > "$dummy.c"
991e32e2dabSmrg	    #ifdef __ARM_EABI__
992e32e2dabSmrg	    #ifdef __ARM_PCS_VFP
993e32e2dabSmrg	    ABI=eabihf
994e32e2dabSmrg	    #else
995e32e2dabSmrg	    ABI=eabi
996e32e2dabSmrg	    #endif
997e32e2dabSmrg	    #endif
998e32e2dabSmrgEOF
999e32e2dabSmrg	    cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'`
1000e32e2dabSmrg	    eval "$cc_set_abi"
1001e32e2dabSmrg	    case $ABI in
1002e32e2dabSmrg		eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;;
1003e32e2dabSmrg	    esac
1004e32e2dabSmrg	fi
1005e32e2dabSmrg	GUESS=$CPU-unknown-linux-$LIBCABI
1006f3e6ffc5Smrg	;;
1007b0c24a08Smrg    aarch64_be:Linux:*:*)
1008b0c24a08Smrg	UNAME_MACHINE=aarch64_be
1009f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1010f3e6ffc5Smrg	;;
1011168023feSmrg    alpha:Linux:*:*)
1012f3e6ffc5Smrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
1013168023feSmrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
1014168023feSmrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
1015168023feSmrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
1016168023feSmrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
1017168023feSmrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
1018168023feSmrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
1019168023feSmrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
1020b0c24a08Smrg	esac
1021168023feSmrg	objdump --private-headers /bin/sh | grep -q ld.so.1
1022b0c24a08Smrg	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
1023f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1024f3e6ffc5Smrg	;;
1025f3e6ffc5Smrg    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
1026f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1027f3e6ffc5Smrg	;;
10286ea72052Smrg    arm*:Linux:*:*)
1029f3e6ffc5Smrg	set_cc_for_build
1030168023feSmrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
1031168023feSmrg	    | grep -q __ARM_EABI__
1032168023feSmrg	then
1033f3e6ffc5Smrg	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1034168023feSmrg	else
1035b0c24a08Smrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
1036b0c24a08Smrg		| grep -q __ARM_PCS_VFP
1037b0c24a08Smrg	    then
1038f3e6ffc5Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
1039b0c24a08Smrg	    else
1040f3e6ffc5Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
1041b0c24a08Smrg	    fi
1042168023feSmrg	fi
1043f3e6ffc5Smrg	;;
1044168023feSmrg    avr32*:Linux:*:*)
1045f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1046f3e6ffc5Smrg	;;
10476ea72052Smrg    cris:Linux:*:*)
1048f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1049f3e6ffc5Smrg	;;
1050168023feSmrg    crisv32:Linux:*:*)
1051f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1052f3e6ffc5Smrg	;;
1053b0c24a08Smrg    e2k:Linux:*:*)
1054f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1055f3e6ffc5Smrg	;;
1056168023feSmrg    frv:Linux:*:*)
1057f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1058f3e6ffc5Smrg	;;
1059b0c24a08Smrg    hexagon:Linux:*:*)
1060f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1061f3e6ffc5Smrg	;;
1062168023feSmrg    i*86:Linux:*:*)
1063f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
1064f3e6ffc5Smrg	;;
1065168023feSmrg    ia64:Linux:*:*)
1066f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1067f3e6ffc5Smrg	;;
1068b0c24a08Smrg    k1om:Linux:*:*)
1069f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1070f3e6ffc5Smrg	;;
1071e32e2dabSmrg    kvx:Linux:*:*)
1072e32e2dabSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1073e32e2dabSmrg	;;
1074e32e2dabSmrg    kvx:cos:*:*)
1075e32e2dabSmrg	GUESS=$UNAME_MACHINE-unknown-cos
1076e32e2dabSmrg	;;
1077e32e2dabSmrg    kvx:mbr:*:*)
1078e32e2dabSmrg	GUESS=$UNAME_MACHINE-unknown-mbr
1079e32e2dabSmrg	;;
1080e32e2dabSmrg    loongarch32:Linux:*:* | loongarch64:Linux:*:*)
1081f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1082f3e6ffc5Smrg	;;
1083168023feSmrg    m32r*:Linux:*:*)
1084f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1085f3e6ffc5Smrg	;;
1086168023feSmrg    m68*:Linux:*:*)
1087f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1088f3e6ffc5Smrg	;;
1089168023feSmrg    mips:Linux:*:* | mips64:Linux:*:*)
1090f3e6ffc5Smrg	set_cc_for_build
1091f3e6ffc5Smrg	IS_GLIBC=0
1092f3e6ffc5Smrg	test x"${LIBC}" = xgnu && IS_GLIBC=1
1093b0c24a08Smrg	sed 's/^	//' << EOF > "$dummy.c"
10946ea72052Smrg	#undef CPU
1095f3e6ffc5Smrg	#undef mips
1096f3e6ffc5Smrg	#undef mipsel
1097f3e6ffc5Smrg	#undef mips64
1098f3e6ffc5Smrg	#undef mips64el
1099f3e6ffc5Smrg	#if ${IS_GLIBC} && defined(_ABI64)
1100f3e6ffc5Smrg	LIBCABI=gnuabi64
1101f3e6ffc5Smrg	#else
1102f3e6ffc5Smrg	#if ${IS_GLIBC} && defined(_ABIN32)
1103f3e6ffc5Smrg	LIBCABI=gnuabin32
1104f3e6ffc5Smrg	#else
1105f3e6ffc5Smrg	LIBCABI=${LIBC}
1106f3e6ffc5Smrg	#endif
1107f3e6ffc5Smrg	#endif
1108f3e6ffc5Smrg
1109f3e6ffc5Smrg	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1110f3e6ffc5Smrg	CPU=mipsisa64r6
1111f3e6ffc5Smrg	#else
1112f3e6ffc5Smrg	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1113f3e6ffc5Smrg	CPU=mipsisa32r6
1114f3e6ffc5Smrg	#else
1115f3e6ffc5Smrg	#if defined(__mips64)
1116f3e6ffc5Smrg	CPU=mips64
1117f3e6ffc5Smrg	#else
1118f3e6ffc5Smrg	CPU=mips
1119f3e6ffc5Smrg	#endif
1120f3e6ffc5Smrg	#endif
1121f3e6ffc5Smrg	#endif
1122f3e6ffc5Smrg
11236ea72052Smrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
1124f3e6ffc5Smrg	MIPS_ENDIAN=el
11256ea72052Smrg	#else
11266ea72052Smrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
1127f3e6ffc5Smrg	MIPS_ENDIAN=
11286ea72052Smrg	#else
1129f3e6ffc5Smrg	MIPS_ENDIAN=
11306ea72052Smrg	#endif
11316ea72052Smrg	#endif
11326ea72052SmrgEOF
1133f3e6ffc5Smrg	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
1134f3e6ffc5Smrg	eval "$cc_set_vars"
1135f3e6ffc5Smrg	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
11366ea72052Smrg	;;
1137b0c24a08Smrg    mips64el:Linux:*:*)
1138f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1139f3e6ffc5Smrg	;;
1140b0c24a08Smrg    openrisc*:Linux:*:*)
1141f3e6ffc5Smrg	GUESS=or1k-unknown-linux-$LIBC
1142f3e6ffc5Smrg	;;
1143b0c24a08Smrg    or32:Linux:*:* | or1k*:Linux:*:*)
1144f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1145f3e6ffc5Smrg	;;
1146168023feSmrg    padre:Linux:*:*)
1147f3e6ffc5Smrg	GUESS=sparc-unknown-linux-$LIBC
1148f3e6ffc5Smrg	;;
1149168023feSmrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
1150f3e6ffc5Smrg	GUESS=hppa64-unknown-linux-$LIBC
1151f3e6ffc5Smrg	;;
11526ea72052Smrg    parisc:Linux:*:* | hppa:Linux:*:*)
11536ea72052Smrg	# Look for CPU level
11546ea72052Smrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
1155f3e6ffc5Smrg	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
1156f3e6ffc5Smrg	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
1157f3e6ffc5Smrg	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
11586ea72052Smrg	esac
1159f3e6ffc5Smrg	;;
1160168023feSmrg    ppc64:Linux:*:*)
1161f3e6ffc5Smrg	GUESS=powerpc64-unknown-linux-$LIBC
1162f3e6ffc5Smrg	;;
1163168023feSmrg    ppc:Linux:*:*)
1164f3e6ffc5Smrg	GUESS=powerpc-unknown-linux-$LIBC
1165f3e6ffc5Smrg	;;
1166b0c24a08Smrg    ppc64le:Linux:*:*)
1167f3e6ffc5Smrg	GUESS=powerpc64le-unknown-linux-$LIBC
1168f3e6ffc5Smrg	;;
1169b0c24a08Smrg    ppcle:Linux:*:*)
1170f3e6ffc5Smrg	GUESS=powerpcle-unknown-linux-$LIBC
1171f3e6ffc5Smrg	;;
1172f3e6ffc5Smrg    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
1173f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1174f3e6ffc5Smrg	;;
11756ea72052Smrg    s390:Linux:*:* | s390x:Linux:*:*)
1176f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
1177f3e6ffc5Smrg	;;
11786ea72052Smrg    sh64*:Linux:*:*)
1179f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1180f3e6ffc5Smrg	;;
11816ea72052Smrg    sh*:Linux:*:*)
1182f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1183f3e6ffc5Smrg	;;
11846ea72052Smrg    sparc:Linux:*:* | sparc64:Linux:*:*)
1185f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1186f3e6ffc5Smrg	;;
118749e82cebSmrg    tile*:Linux:*:*)
1188f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1189f3e6ffc5Smrg	;;
1190168023feSmrg    vax:Linux:*:*)
1191f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
1192f3e6ffc5Smrg	;;
11936ea72052Smrg    x86_64:Linux:*:*)
1194f3e6ffc5Smrg	set_cc_for_build
1195e32e2dabSmrg	CPU=$UNAME_MACHINE
1196f3e6ffc5Smrg	LIBCABI=$LIBC
1197f3e6ffc5Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
1198e32e2dabSmrg	    ABI=64
1199e32e2dabSmrg	    sed 's/^	    //' << EOF > "$dummy.c"
1200e32e2dabSmrg	    #ifdef __i386__
1201e32e2dabSmrg	    ABI=x86
1202e32e2dabSmrg	    #else
1203e32e2dabSmrg	    #ifdef __ILP32__
1204e32e2dabSmrg	    ABI=x32
1205e32e2dabSmrg	    #endif
1206e32e2dabSmrg	    #endif
1207e32e2dabSmrgEOF
1208e32e2dabSmrg	    cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'`
1209e32e2dabSmrg	    eval "$cc_set_abi"
1210e32e2dabSmrg	    case $ABI in
1211e32e2dabSmrg		x86) CPU=i686 ;;
1212e32e2dabSmrg		x32) LIBCABI=${LIBC}x32 ;;
1213e32e2dabSmrg	    esac
1214f3e6ffc5Smrg	fi
1215e32e2dabSmrg	GUESS=$CPU-pc-linux-$LIBCABI
1216f3e6ffc5Smrg	;;
1217168023feSmrg    xtensa*:Linux:*:*)
1218f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1219f3e6ffc5Smrg	;;
12206ea72052Smrg    i*86:DYNIX/ptx:4*:*)
12216ea72052Smrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
12226ea72052Smrg	# earlier versions are messed up and put the nodename in both
12236ea72052Smrg	# sysname and nodename.
1224f3e6ffc5Smrg	GUESS=i386-sequent-sysv4
1225f3e6ffc5Smrg	;;
12266ea72052Smrg    i*86:UNIX_SV:4.2MP:2.*)
1227b0c24a08Smrg	# Unixware is an offshoot of SVR4, but it has its own version
1228b0c24a08Smrg	# number series starting with 2...
1229b0c24a08Smrg	# I am not positive that other SVR4 systems won't match this,
12306ea72052Smrg	# I just have to hope.  -- rms.
1231b0c24a08Smrg	# Use sysv4.2uw... so that sysv4* matches it.
1232f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
1233f3e6ffc5Smrg	;;
12346ea72052Smrg    i*86:OS/2:*:*)
1235e32e2dabSmrg	# If we were able to find 'uname', then EMX Unix compatibility
12366ea72052Smrg	# is probably installed.
1237f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-pc-os2-emx
1238f3e6ffc5Smrg	;;
12396ea72052Smrg    i*86:XTS-300:*:STOP)
1240f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-stop
1241f3e6ffc5Smrg	;;
12426ea72052Smrg    i*86:atheos:*:*)
1243f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-atheos
1244f3e6ffc5Smrg	;;
1245168023feSmrg    i*86:syllable:*:*)
1246f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-pc-syllable
1247f3e6ffc5Smrg	;;
1248168023feSmrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1249f3e6ffc5Smrg	GUESS=i386-unknown-lynxos$UNAME_RELEASE
1250f3e6ffc5Smrg	;;
12516ea72052Smrg    i*86:*DOS:*:*)
1252f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
1253f3e6ffc5Smrg	;;
1254b0c24a08Smrg    i*86:*:4.*:*)
1255b0c24a08Smrg	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
12566ea72052Smrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1257f3e6ffc5Smrg		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
12586ea72052Smrg	else
1259f3e6ffc5Smrg		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
12606ea72052Smrg	fi
1261f3e6ffc5Smrg	;;
1262168023feSmrg    i*86:*:5:[678]*)
1263b0c24a08Smrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
12646ea72052Smrg	case `/bin/uname -X | grep "^Machine"` in
12656ea72052Smrg	    *486*)	     UNAME_MACHINE=i486 ;;
12666ea72052Smrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
12676ea72052Smrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
12686ea72052Smrg	esac
1269f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1270f3e6ffc5Smrg	;;
12716ea72052Smrg    i*86:*:3.2:*)
12726ea72052Smrg	if test -f /usr/options/cb.name; then
12736ea72052Smrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1274f3e6ffc5Smrg		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
12756ea72052Smrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
12766ea72052Smrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
12776ea72052Smrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
12786ea72052Smrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
12796ea72052Smrg			&& UNAME_MACHINE=i586
12806ea72052Smrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
12816ea72052Smrg			&& UNAME_MACHINE=i686
12826ea72052Smrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
12836ea72052Smrg			&& UNAME_MACHINE=i686
1284f3e6ffc5Smrg		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
12856ea72052Smrg	else
1286f3e6ffc5Smrg		GUESS=$UNAME_MACHINE-pc-sysv32
12876ea72052Smrg	fi
1288f3e6ffc5Smrg	;;
12896ea72052Smrg    pc:*:*:*)
12906ea72052Smrg	# Left here for compatibility:
1291b0c24a08Smrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
1292b0c24a08Smrg	# the processor, so we play safe by assuming i586.
1293168023feSmrg	# Note: whatever this is, it MUST be the same as what config.sub
1294b0c24a08Smrg	# prints for the "djgpp" host, or else GDB configure will decide that
1295168023feSmrg	# this is a cross-build.
1296f3e6ffc5Smrg	GUESS=i586-pc-msdosdjgpp
1297f3e6ffc5Smrg	;;
12986ea72052Smrg    Intel:Mach:3*:*)
1299f3e6ffc5Smrg	GUESS=i386-pc-mach3
1300f3e6ffc5Smrg	;;
13016ea72052Smrg    paragon:*:*:*)
1302f3e6ffc5Smrg	GUESS=i860-intel-osf1
1303f3e6ffc5Smrg	;;
13046ea72052Smrg    i860:*:4.*:*) # i860-SVR4
13056ea72052Smrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1306f3e6ffc5Smrg	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
13076ea72052Smrg	else # Add other i860-SVR4 vendors below as they are discovered.
1308f3e6ffc5Smrg	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
13096ea72052Smrg	fi
1310f3e6ffc5Smrg	;;
13116ea72052Smrg    mini*:CTIX:SYS*5:*)
13126ea72052Smrg	# "miniframe"
1313f3e6ffc5Smrg	GUESS=m68010-convergent-sysv
1314f3e6ffc5Smrg	;;
13156ea72052Smrg    mc68k:UNIX:SYSTEM5:3.51m)
1316f3e6ffc5Smrg	GUESS=m68k-convergent-sysv
1317f3e6ffc5Smrg	;;
13186ea72052Smrg    M680?0:D-NIX:5.3:*)
1319f3e6ffc5Smrg	GUESS=m68k-diab-dnix
1320f3e6ffc5Smrg	;;
1321168023feSmrg    M68*:*:R3V[5678]*:*)
1322168023feSmrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1323168023feSmrg    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)
13246ea72052Smrg	OS_REL=''
13256ea72052Smrg	test -r /etc/.relid \
13266ea72052Smrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
13276ea72052Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1328b0c24a08Smrg	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
13296ea72052Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1330b0c24a08Smrg	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
13316ea72052Smrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1332b0c24a08Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1333b0c24a08Smrg	  && { echo i486-ncr-sysv4; exit; } ;;
1334168023feSmrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1335168023feSmrg	OS_REL='.3'
1336168023feSmrg	test -r /etc/.relid \
1337168023feSmrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1338168023feSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1339b0c24a08Smrg	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1340168023feSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1341b0c24a08Smrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
1342168023feSmrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1343b0c24a08Smrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
13446ea72052Smrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1345f3e6ffc5Smrg	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
1346f3e6ffc5Smrg	;;
13476ea72052Smrg    mc68030:UNIX_System_V:4.*:*)
1348f3e6ffc5Smrg	GUESS=m68k-atari-sysv4
1349f3e6ffc5Smrg	;;
13506ea72052Smrg    TSUNAMI:LynxOS:2.*:*)
1351f3e6ffc5Smrg	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
1352f3e6ffc5Smrg	;;
13536ea72052Smrg    rs6000:LynxOS:2.*:*)
1354f3e6ffc5Smrg	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
1355f3e6ffc5Smrg	;;
1356168023feSmrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1357f3e6ffc5Smrg	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
1358f3e6ffc5Smrg	;;
13596ea72052Smrg    SM[BE]S:UNIX_SV:*:*)
1360f3e6ffc5Smrg	GUESS=mips-dde-sysv$UNAME_RELEASE
1361f3e6ffc5Smrg	;;
13626ea72052Smrg    RM*:ReliantUNIX-*:*:*)
1363f3e6ffc5Smrg	GUESS=mips-sni-sysv4
1364f3e6ffc5Smrg	;;
13656ea72052Smrg    RM*:SINIX-*:*:*)
1366f3e6ffc5Smrg	GUESS=mips-sni-sysv4
1367f3e6ffc5Smrg	;;
13686ea72052Smrg    *:SINIX-*:*:*)
13696ea72052Smrg	if uname -p 2>/dev/null >/dev/null ; then
13706ea72052Smrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1371f3e6ffc5Smrg		GUESS=$UNAME_MACHINE-sni-sysv4
13726ea72052Smrg	else
1373f3e6ffc5Smrg		GUESS=ns32k-sni-sysv
13746ea72052Smrg	fi
1375f3e6ffc5Smrg	;;
1376e32e2dabSmrg    PENTIUM:*:4.0*:*)	# Unisys 'ClearPath HMP IX 4000' SVR4/MP effort
1377b0c24a08Smrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
1378f3e6ffc5Smrg	GUESS=i586-unisys-sysv4
1379f3e6ffc5Smrg	;;
13806ea72052Smrg    *:UNIX_System_V:4*:FTX*)
13816ea72052Smrg	# From Gerald Hewes <hewes@openmarket.com>.
13826ea72052Smrg	# How about differentiating between stratus architectures? -djm
1383f3e6ffc5Smrg	GUESS=hppa1.1-stratus-sysv4
1384f3e6ffc5Smrg	;;
13856ea72052Smrg    *:*:*:FTX*)
13866ea72052Smrg	# From seanf@swdc.stratus.com.
1387f3e6ffc5Smrg	GUESS=i860-stratus-sysv4
1388f3e6ffc5Smrg	;;
1389168023feSmrg    i*86:VOS:*:*)
1390168023feSmrg	# From Paul.Green@stratus.com.
1391f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-stratus-vos
1392f3e6ffc5Smrg	;;
13936ea72052Smrg    *:VOS:*:*)
13946ea72052Smrg	# From Paul.Green@stratus.com.
1395f3e6ffc5Smrg	GUESS=hppa1.1-stratus-vos
1396f3e6ffc5Smrg	;;
13976ea72052Smrg    mc68*:A/UX:*:*)
1398f3e6ffc5Smrg	GUESS=m68k-apple-aux$UNAME_RELEASE
1399f3e6ffc5Smrg	;;
14006ea72052Smrg    news*:NEWS-OS:6*:*)
1401f3e6ffc5Smrg	GUESS=mips-sony-newsos6
1402f3e6ffc5Smrg	;;
14036ea72052Smrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1404f3e6ffc5Smrg	if test -d /usr/nec; then
1405f3e6ffc5Smrg		GUESS=mips-nec-sysv$UNAME_RELEASE
14066ea72052Smrg	else
1407f3e6ffc5Smrg		GUESS=mips-unknown-sysv$UNAME_RELEASE
14086ea72052Smrg	fi
1409f3e6ffc5Smrg	;;
14106ea72052Smrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1411f3e6ffc5Smrg	GUESS=powerpc-be-beos
1412f3e6ffc5Smrg	;;
14136ea72052Smrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1414f3e6ffc5Smrg	GUESS=powerpc-apple-beos
1415f3e6ffc5Smrg	;;
14166ea72052Smrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1417f3e6ffc5Smrg	GUESS=i586-pc-beos
1418f3e6ffc5Smrg	;;
1419168023feSmrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
1420f3e6ffc5Smrg	GUESS=i586-pc-haiku
1421f3e6ffc5Smrg	;;
1422e32e2dabSmrg    ppc:Haiku:*:*)	# Haiku running on Apple PowerPC
1423e32e2dabSmrg	GUESS=powerpc-apple-haiku
1424e32e2dabSmrg	;;
1425e32e2dabSmrg    *:Haiku:*:*)	# Haiku modern gcc (not bound by BeOS compat)
1426e32e2dabSmrg	GUESS=$UNAME_MACHINE-unknown-haiku
1427f3e6ffc5Smrg	;;
14286ea72052Smrg    SX-4:SUPER-UX:*:*)
1429f3e6ffc5Smrg	GUESS=sx4-nec-superux$UNAME_RELEASE
1430f3e6ffc5Smrg	;;
14316ea72052Smrg    SX-5:SUPER-UX:*:*)
1432f3e6ffc5Smrg	GUESS=sx5-nec-superux$UNAME_RELEASE
1433f3e6ffc5Smrg	;;
14346ea72052Smrg    SX-6:SUPER-UX:*:*)
1435f3e6ffc5Smrg	GUESS=sx6-nec-superux$UNAME_RELEASE
1436f3e6ffc5Smrg	;;
1437168023feSmrg    SX-7:SUPER-UX:*:*)
1438f3e6ffc5Smrg	GUESS=sx7-nec-superux$UNAME_RELEASE
1439f3e6ffc5Smrg	;;
1440168023feSmrg    SX-8:SUPER-UX:*:*)
1441f3e6ffc5Smrg	GUESS=sx8-nec-superux$UNAME_RELEASE
1442f3e6ffc5Smrg	;;
1443168023feSmrg    SX-8R:SUPER-UX:*:*)
1444f3e6ffc5Smrg	GUESS=sx8r-nec-superux$UNAME_RELEASE
1445f3e6ffc5Smrg	;;
1446b0c24a08Smrg    SX-ACE:SUPER-UX:*:*)
1447f3e6ffc5Smrg	GUESS=sxace-nec-superux$UNAME_RELEASE
1448f3e6ffc5Smrg	;;
14496ea72052Smrg    Power*:Rhapsody:*:*)
1450f3e6ffc5Smrg	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
1451f3e6ffc5Smrg	;;
14526ea72052Smrg    *:Rhapsody:*:*)
1453f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
1454f3e6ffc5Smrg	;;
1455f3e6ffc5Smrg    arm64:Darwin:*:*)
1456f3e6ffc5Smrg	GUESS=aarch64-apple-darwin$UNAME_RELEASE
1457f3e6ffc5Smrg	;;
14586ea72052Smrg    *:Darwin:*:*)
1459f3e6ffc5Smrg	UNAME_PROCESSOR=`uname -p`
1460f3e6ffc5Smrg	case $UNAME_PROCESSOR in
1461f3e6ffc5Smrg	    unknown) UNAME_PROCESSOR=powerpc ;;
1462f3e6ffc5Smrg	esac
1463f3e6ffc5Smrg	if command -v xcode-select > /dev/null 2> /dev/null && \
1464f3e6ffc5Smrg		! xcode-select --print-path > /dev/null 2> /dev/null ; then
1465f3e6ffc5Smrg	    # Avoid executing cc if there is no toolchain installed as
1466f3e6ffc5Smrg	    # cc will be a stub that puts up a graphical alert
1467f3e6ffc5Smrg	    # prompting the user to install developer tools.
1468f3e6ffc5Smrg	    CC_FOR_BUILD=no_compiler_found
1469f3e6ffc5Smrg	else
1470f3e6ffc5Smrg	    set_cc_for_build
1471b0c24a08Smrg	fi
1472f3e6ffc5Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
1473f3e6ffc5Smrg	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1474f3e6ffc5Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1475f3e6ffc5Smrg		   grep IS_64BIT_ARCH >/dev/null
1476f3e6ffc5Smrg	    then
1477f3e6ffc5Smrg		case $UNAME_PROCESSOR in
1478f3e6ffc5Smrg		    i386) UNAME_PROCESSOR=x86_64 ;;
1479f3e6ffc5Smrg		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
1480f3e6ffc5Smrg		esac
1481f3e6ffc5Smrg	    fi
1482f3e6ffc5Smrg	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
1483f3e6ffc5Smrg	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
1484f3e6ffc5Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1485f3e6ffc5Smrg		   grep IS_PPC >/dev/null
1486f3e6ffc5Smrg	    then
1487f3e6ffc5Smrg		UNAME_PROCESSOR=powerpc
1488b0c24a08Smrg	    fi
1489b0c24a08Smrg	elif test "$UNAME_PROCESSOR" = i386 ; then
1490f3e6ffc5Smrg	    # uname -m returns i386 or x86_64
1491f3e6ffc5Smrg	    UNAME_PROCESSOR=$UNAME_MACHINE
1492b0c24a08Smrg	fi
1493f3e6ffc5Smrg	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
1494f3e6ffc5Smrg	;;
14956ea72052Smrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
14966ea72052Smrg	UNAME_PROCESSOR=`uname -p`
1497b0c24a08Smrg	if test "$UNAME_PROCESSOR" = x86; then
14986ea72052Smrg		UNAME_PROCESSOR=i386
14996ea72052Smrg		UNAME_MACHINE=pc
15006ea72052Smrg	fi
1501f3e6ffc5Smrg	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
1502f3e6ffc5Smrg	;;
15036ea72052Smrg    *:QNX:*:4*)
1504f3e6ffc5Smrg	GUESS=i386-pc-qnx
1505f3e6ffc5Smrg	;;
1506b0c24a08Smrg    NEO-*:NONSTOP_KERNEL:*:*)
1507f3e6ffc5Smrg	GUESS=neo-tandem-nsk$UNAME_RELEASE
1508f3e6ffc5Smrg	;;
1509b0c24a08Smrg    NSE-*:NONSTOP_KERNEL:*:*)
1510f3e6ffc5Smrg	GUESS=nse-tandem-nsk$UNAME_RELEASE
1511f3e6ffc5Smrg	;;
1512b0c24a08Smrg    NSR-*:NONSTOP_KERNEL:*:*)
1513f3e6ffc5Smrg	GUESS=nsr-tandem-nsk$UNAME_RELEASE
1514f3e6ffc5Smrg	;;
1515b0c24a08Smrg    NSV-*:NONSTOP_KERNEL:*:*)
1516f3e6ffc5Smrg	GUESS=nsv-tandem-nsk$UNAME_RELEASE
1517f3e6ffc5Smrg	;;
1518b0c24a08Smrg    NSX-*:NONSTOP_KERNEL:*:*)
1519f3e6ffc5Smrg	GUESS=nsx-tandem-nsk$UNAME_RELEASE
1520f3e6ffc5Smrg	;;
15216ea72052Smrg    *:NonStop-UX:*:*)
1522f3e6ffc5Smrg	GUESS=mips-compaq-nonstopux
1523f3e6ffc5Smrg	;;
15246ea72052Smrg    BS2000:POSIX*:*:*)
1525f3e6ffc5Smrg	GUESS=bs2000-siemens-sysv
1526f3e6ffc5Smrg	;;
15276ea72052Smrg    DS/*:UNIX_System_V:*:*)
1528f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
1529f3e6ffc5Smrg	;;
15306ea72052Smrg    *:Plan9:*:*)
15316ea72052Smrg	# "uname -m" is not consistent, so use $cputype instead. 386
15326ea72052Smrg	# is converted to i386 for consistency with other x86
15336ea72052Smrg	# operating systems.
1534f3e6ffc5Smrg	if test "${cputype-}" = 386; then
15356ea72052Smrg	    UNAME_MACHINE=i386
1536f3e6ffc5Smrg	elif test "x${cputype-}" != x; then
1537f3e6ffc5Smrg	    UNAME_MACHINE=$cputype
15386ea72052Smrg	fi
1539f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-plan9
1540f3e6ffc5Smrg	;;
15416ea72052Smrg    *:TOPS-10:*:*)
1542f3e6ffc5Smrg	GUESS=pdp10-unknown-tops10
1543f3e6ffc5Smrg	;;
15446ea72052Smrg    *:TENEX:*:*)
1545f3e6ffc5Smrg	GUESS=pdp10-unknown-tenex
1546f3e6ffc5Smrg	;;
15476ea72052Smrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1548f3e6ffc5Smrg	GUESS=pdp10-dec-tops20
1549f3e6ffc5Smrg	;;
15506ea72052Smrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1551f3e6ffc5Smrg	GUESS=pdp10-xkl-tops20
1552f3e6ffc5Smrg	;;
15536ea72052Smrg    *:TOPS-20:*:*)
1554f3e6ffc5Smrg	GUESS=pdp10-unknown-tops20
1555f3e6ffc5Smrg	;;
15566ea72052Smrg    *:ITS:*:*)
1557f3e6ffc5Smrg	GUESS=pdp10-unknown-its
1558f3e6ffc5Smrg	;;
15596ea72052Smrg    SEI:*:*:SEIUX)
1560f3e6ffc5Smrg	GUESS=mips-sei-seiux$UNAME_RELEASE
1561f3e6ffc5Smrg	;;
1562168023feSmrg    *:DragonFly:*:*)
1563f3e6ffc5Smrg	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
1564f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
1565f3e6ffc5Smrg	;;
1566168023feSmrg    *:*VMS:*:*)
1567b0c24a08Smrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1568f3e6ffc5Smrg	case $UNAME_MACHINE in
1569f3e6ffc5Smrg	    A*) GUESS=alpha-dec-vms ;;
1570f3e6ffc5Smrg	    I*) GUESS=ia64-dec-vms ;;
1571f3e6ffc5Smrg	    V*) GUESS=vax-dec-vms ;;
1572168023feSmrg	esac ;;
1573168023feSmrg    *:XENIX:*:SysV)
1574f3e6ffc5Smrg	GUESS=i386-pc-xenix
1575f3e6ffc5Smrg	;;
1576168023feSmrg    i*86:skyos:*:*)
1577f3e6ffc5Smrg	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
1578f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
1579f3e6ffc5Smrg	;;
1580168023feSmrg    i*86:rdos:*:*)
1581f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-pc-rdos
1582f3e6ffc5Smrg	;;
1583e32e2dabSmrg    i*86:Fiwix:*:*)
1584e32e2dabSmrg	GUESS=$UNAME_MACHINE-pc-fiwix
1585e32e2dabSmrg	;;
1586f3e6ffc5Smrg    *:AROS:*:*)
1587f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-aros
1588f3e6ffc5Smrg	;;
1589b0c24a08Smrg    x86_64:VMkernel:*:*)
1590f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-esx
1591f3e6ffc5Smrg	;;
1592b0c24a08Smrg    amd64:Isilon\ OneFS:*:*)
1593f3e6ffc5Smrg	GUESS=x86_64-unknown-onefs
1594f3e6ffc5Smrg	;;
1595f3e6ffc5Smrg    *:Unleashed:*:*)
1596f3e6ffc5Smrg	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
1597f3e6ffc5Smrg	;;
1598e32e2dabSmrg    *:Ironclad:*:*)
1599e32e2dabSmrg	GUESS=$UNAME_MACHINE-unknown-ironclad
1600e32e2dabSmrg	;;
16016ea72052Smrgesac
16026ea72052Smrg
1603f3e6ffc5Smrg# Do we have a guess based on uname results?
1604f3e6ffc5Smrgif test "x$GUESS" != x; then
1605f3e6ffc5Smrg    echo "$GUESS"
1606f3e6ffc5Smrg    exit
1607f3e6ffc5Smrgfi
1608f3e6ffc5Smrg
1609f3e6ffc5Smrg# No uname command or uname output not recognized.
1610f3e6ffc5Smrgset_cc_for_build
1611f3e6ffc5Smrgcat > "$dummy.c" <<EOF
1612f3e6ffc5Smrg#ifdef _SEQUENT_
1613f3e6ffc5Smrg#include <sys/types.h>
1614f3e6ffc5Smrg#include <sys/utsname.h>
1615f3e6ffc5Smrg#endif
1616f3e6ffc5Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1617f3e6ffc5Smrg#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1618f3e6ffc5Smrg#include <signal.h>
1619f3e6ffc5Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
1620f3e6ffc5Smrg#include <sys/utsname.h>
1621f3e6ffc5Smrg#endif
1622f3e6ffc5Smrg#endif
1623f3e6ffc5Smrg#endif
1624f3e6ffc5Smrgmain ()
1625f3e6ffc5Smrg{
1626f3e6ffc5Smrg#if defined (sony)
1627f3e6ffc5Smrg#if defined (MIPSEB)
1628f3e6ffc5Smrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1629f3e6ffc5Smrg     I don't know....  */
1630f3e6ffc5Smrg  printf ("mips-sony-bsd\n"); exit (0);
1631f3e6ffc5Smrg#else
1632f3e6ffc5Smrg#include <sys/param.h>
1633f3e6ffc5Smrg  printf ("m68k-sony-newsos%s\n",
1634f3e6ffc5Smrg#ifdef NEWSOS4
1635f3e6ffc5Smrg  "4"
1636f3e6ffc5Smrg#else
1637f3e6ffc5Smrg  ""
1638f3e6ffc5Smrg#endif
1639f3e6ffc5Smrg  ); exit (0);
1640f3e6ffc5Smrg#endif
1641f3e6ffc5Smrg#endif
1642f3e6ffc5Smrg
1643f3e6ffc5Smrg#if defined (NeXT)
1644f3e6ffc5Smrg#if !defined (__ARCHITECTURE__)
1645f3e6ffc5Smrg#define __ARCHITECTURE__ "m68k"
1646f3e6ffc5Smrg#endif
1647f3e6ffc5Smrg  int version;
1648f3e6ffc5Smrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1649f3e6ffc5Smrg  if (version < 4)
1650f3e6ffc5Smrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1651f3e6ffc5Smrg  else
1652f3e6ffc5Smrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1653f3e6ffc5Smrg  exit (0);
1654f3e6ffc5Smrg#endif
1655f3e6ffc5Smrg
1656f3e6ffc5Smrg#if defined (MULTIMAX) || defined (n16)
1657f3e6ffc5Smrg#if defined (UMAXV)
1658f3e6ffc5Smrg  printf ("ns32k-encore-sysv\n"); exit (0);
1659f3e6ffc5Smrg#else
1660f3e6ffc5Smrg#if defined (CMU)
1661f3e6ffc5Smrg  printf ("ns32k-encore-mach\n"); exit (0);
1662f3e6ffc5Smrg#else
1663f3e6ffc5Smrg  printf ("ns32k-encore-bsd\n"); exit (0);
1664f3e6ffc5Smrg#endif
1665f3e6ffc5Smrg#endif
1666f3e6ffc5Smrg#endif
1667f3e6ffc5Smrg
1668f3e6ffc5Smrg#if defined (__386BSD__)
1669f3e6ffc5Smrg  printf ("i386-pc-bsd\n"); exit (0);
1670f3e6ffc5Smrg#endif
1671f3e6ffc5Smrg
1672f3e6ffc5Smrg#if defined (sequent)
1673f3e6ffc5Smrg#if defined (i386)
1674f3e6ffc5Smrg  printf ("i386-sequent-dynix\n"); exit (0);
1675f3e6ffc5Smrg#endif
1676f3e6ffc5Smrg#if defined (ns32000)
1677f3e6ffc5Smrg  printf ("ns32k-sequent-dynix\n"); exit (0);
1678f3e6ffc5Smrg#endif
1679f3e6ffc5Smrg#endif
1680f3e6ffc5Smrg
1681f3e6ffc5Smrg#if defined (_SEQUENT_)
1682f3e6ffc5Smrg  struct utsname un;
1683f3e6ffc5Smrg
1684f3e6ffc5Smrg  uname(&un);
1685f3e6ffc5Smrg  if (strncmp(un.version, "V2", 2) == 0) {
1686f3e6ffc5Smrg    printf ("i386-sequent-ptx2\n"); exit (0);
1687f3e6ffc5Smrg  }
1688f3e6ffc5Smrg  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1689f3e6ffc5Smrg    printf ("i386-sequent-ptx1\n"); exit (0);
1690f3e6ffc5Smrg  }
1691f3e6ffc5Smrg  printf ("i386-sequent-ptx\n"); exit (0);
1692f3e6ffc5Smrg#endif
1693f3e6ffc5Smrg
1694f3e6ffc5Smrg#if defined (vax)
1695f3e6ffc5Smrg#if !defined (ultrix)
1696f3e6ffc5Smrg#include <sys/param.h>
1697f3e6ffc5Smrg#if defined (BSD)
1698f3e6ffc5Smrg#if BSD == 43
1699f3e6ffc5Smrg  printf ("vax-dec-bsd4.3\n"); exit (0);
1700f3e6ffc5Smrg#else
1701f3e6ffc5Smrg#if BSD == 199006
1702f3e6ffc5Smrg  printf ("vax-dec-bsd4.3reno\n"); exit (0);
1703f3e6ffc5Smrg#else
1704f3e6ffc5Smrg  printf ("vax-dec-bsd\n"); exit (0);
1705f3e6ffc5Smrg#endif
1706f3e6ffc5Smrg#endif
1707f3e6ffc5Smrg#else
1708f3e6ffc5Smrg  printf ("vax-dec-bsd\n"); exit (0);
1709f3e6ffc5Smrg#endif
1710f3e6ffc5Smrg#else
1711f3e6ffc5Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
1712f3e6ffc5Smrg  struct utsname un;
1713f3e6ffc5Smrg  uname (&un);
1714f3e6ffc5Smrg  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
1715f3e6ffc5Smrg#else
1716f3e6ffc5Smrg  printf ("vax-dec-ultrix\n"); exit (0);
1717f3e6ffc5Smrg#endif
1718f3e6ffc5Smrg#endif
1719f3e6ffc5Smrg#endif
1720f3e6ffc5Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1721f3e6ffc5Smrg#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1722f3e6ffc5Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
1723f3e6ffc5Smrg  struct utsname *un;
1724f3e6ffc5Smrg  uname (&un);
1725f3e6ffc5Smrg  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
1726f3e6ffc5Smrg#else
1727f3e6ffc5Smrg  printf ("mips-dec-ultrix\n"); exit (0);
1728f3e6ffc5Smrg#endif
1729f3e6ffc5Smrg#endif
1730f3e6ffc5Smrg#endif
1731f3e6ffc5Smrg
1732f3e6ffc5Smrg#if defined (alliant) && defined (i860)
1733f3e6ffc5Smrg  printf ("i860-alliant-bsd\n"); exit (0);
1734f3e6ffc5Smrg#endif
1735f3e6ffc5Smrg
1736f3e6ffc5Smrg  exit (1);
1737f3e6ffc5Smrg}
1738f3e6ffc5SmrgEOF
1739f3e6ffc5Smrg
1740f3e6ffc5Smrg$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
1741f3e6ffc5Smrg	{ echo "$SYSTEM_NAME"; exit; }
1742f3e6ffc5Smrg
1743f3e6ffc5Smrg# Apollos put the system type in the environment.
1744f3e6ffc5Smrgtest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
1745f3e6ffc5Smrg
1746b0c24a08Smrgecho "$0: unable to guess system type" >&2
17476ea72052Smrg
1748f3e6ffc5Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM in
1749b0c24a08Smrg    mips:Linux | mips64:Linux)
1750b0c24a08Smrg	# If we got here on MIPS GNU/Linux, output extra information.
1751b0c24a08Smrg	cat >&2 <<EOF
17526ea72052Smrg
1753b0c24a08SmrgNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
1754b0c24a08Smrgthe system type. Please install a C compiler and try again.
17556ea72052SmrgEOF
1756b0c24a08Smrg	;;
1757b0c24a08Smrgesac
17586ea72052Smrg
17596ea72052Smrgcat >&2 <<EOF
17606ea72052Smrg
1761b0c24a08SmrgThis script (version $timestamp), has failed to recognize the
1762b0c24a08Smrgoperating system you are using. If your script is old, overwrite *all*
1763b0c24a08Smrgcopies of config.guess and config.sub with the latest versions from:
17646ea72052Smrg
1765f3e6ffc5Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
1766168023feSmrgand
1767f3e6ffc5Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
1768f3e6ffc5SmrgEOF
1769f3e6ffc5Smrg
1770f3e6ffc5Smrgour_year=`echo $timestamp | sed 's,-.*,,'`
1771f3e6ffc5Smrgthisyear=`date +%Y`
1772f3e6ffc5Smrg# shellcheck disable=SC2003
1773f3e6ffc5Smrgscript_age=`expr "$thisyear" - "$our_year"`
1774f3e6ffc5Smrgif test "$script_age" -lt 3 ; then
1775f3e6ffc5Smrg   cat >&2 <<EOF
17766ea72052Smrg
1777b0c24a08SmrgIf $0 has already been updated, send the following data and any
1778b0c24a08Smrginformation you think might be pertinent to config-patches@gnu.org to
1779b0c24a08Smrgprovide the necessary information to handle your system.
17806ea72052Smrg
17816ea72052Smrgconfig.guess timestamp = $timestamp
17826ea72052Smrg
17836ea72052Smrguname -m = `(uname -m) 2>/dev/null || echo unknown`
17846ea72052Smrguname -r = `(uname -r) 2>/dev/null || echo unknown`
17856ea72052Smrguname -s = `(uname -s) 2>/dev/null || echo unknown`
17866ea72052Smrguname -v = `(uname -v) 2>/dev/null || echo unknown`
17876ea72052Smrg
17886ea72052Smrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
17896ea72052Smrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
17906ea72052Smrg
17916ea72052Smrghostinfo               = `(hostinfo) 2>/dev/null`
17926ea72052Smrg/bin/universe          = `(/bin/universe) 2>/dev/null`
17936ea72052Smrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
17946ea72052Smrg/bin/arch              = `(/bin/arch) 2>/dev/null`
17956ea72052Smrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
17966ea72052Smrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
17976ea72052Smrg
1798b0c24a08SmrgUNAME_MACHINE = "$UNAME_MACHINE"
1799b0c24a08SmrgUNAME_RELEASE = "$UNAME_RELEASE"
1800b0c24a08SmrgUNAME_SYSTEM  = "$UNAME_SYSTEM"
1801b0c24a08SmrgUNAME_VERSION = "$UNAME_VERSION"
18026ea72052SmrgEOF
1803f3e6ffc5Smrgfi
18046ea72052Smrg
18056ea72052Smrgexit 1
18066ea72052Smrg
18076ea72052Smrg# Local variables:
1808f3e6ffc5Smrg# eval: (add-hook 'before-save-hook 'time-stamp)
18096ea72052Smrg# time-stamp-start: "timestamp='"
18106ea72052Smrg# time-stamp-format: "%:y-%02m-%02d"
18116ea72052Smrg# time-stamp-end: "'"
18126ea72052Smrg# End:
1813