config.guess revision 219ffec0
197e8a2e8Smrg#! /bin/sh
297e8a2e8Smrg# Attempt to guess a canonical system name.
3219ffec0Smrg#   Copyright 1992-2021 Free Software Foundation, Inc.
497e8a2e8Smrg
5219ffec0Smrg# shellcheck disable=SC2006,SC2268 # see below for rationale
6219ffec0Smrg
7219ffec0Smrgtimestamp='2021-06-03'
897e8a2e8Smrg
997e8a2e8Smrg# This file is free software; you can redistribute it and/or modify it
1097e8a2e8Smrg# under the terms of the GNU General Public License as published by
1168af480fSmrg# the Free Software Foundation; either version 3 of the License, or
1297e8a2e8Smrg# (at your option) any later version.
1397e8a2e8Smrg#
1497e8a2e8Smrg# This program is distributed in the hope that it will be useful, but
1597e8a2e8Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1697e8a2e8Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1797e8a2e8Smrg# General Public License for more details.
1897e8a2e8Smrg#
1997e8a2e8Smrg# You should have received a copy of the GNU General Public License
20219ffec0Smrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
2197e8a2e8Smrg#
2297e8a2e8Smrg# As a special exception to the GNU General Public License, if you
2397e8a2e8Smrg# distribute this file as part of a program that contains a
2497e8a2e8Smrg# configuration script generated by Autoconf, you may include it under
2568af480fSmrg# the same distribution terms that you use for the rest of that
2668af480fSmrg# program.  This Exception is an additional permission under section 7
2768af480fSmrg# of the GNU General Public License, version 3 ("GPLv3").
2897e8a2e8Smrg#
29219ffec0Smrg# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
3097e8a2e8Smrg#
31c3f70f0aSmrg# You can get the latest version of this script from:
32219ffec0Smrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
3368af480fSmrg#
34219ffec0Smrg# Please send patches to <config-patches@gnu.org>.
35219ffec0Smrg
36219ffec0Smrg
37219ffec0Smrg# The "shellcheck disable" line above the timestamp inhibits complaints
38219ffec0Smrg# about features and limitations of the classic Bourne shell that were
39219ffec0Smrg# superseded or lifted in POSIX.  However, this script identifies a wide
40219ffec0Smrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
41219ffec0Smrg# even some reasonably current systems (Solaris 10 as case-in-point) still
42219ffec0Smrg# have a pre-POSIX /bin/sh.
4368af480fSmrg
4497e8a2e8Smrg
4597e8a2e8Smrgme=`echo "$0" | sed -e 's,.*/,,'`
4697e8a2e8Smrg
4797e8a2e8Smrgusage="\
4897e8a2e8SmrgUsage: $0 [OPTION]
4997e8a2e8Smrg
5097e8a2e8SmrgOutput the configuration name of the system \`$me' is run on.
5197e8a2e8Smrg
52219ffec0SmrgOptions:
5397e8a2e8Smrg  -h, --help         print this help, then exit
5497e8a2e8Smrg  -t, --time-stamp   print date of last modification, then exit
5597e8a2e8Smrg  -v, --version      print version number, then exit
5697e8a2e8Smrg
5797e8a2e8SmrgReport bugs and patches to <config-patches@gnu.org>."
5897e8a2e8Smrg
5997e8a2e8Smrgversion="\
6097e8a2e8SmrgGNU config.guess ($timestamp)
6197e8a2e8Smrg
6297e8a2e8SmrgOriginally written by Per Bothner.
63219ffec0SmrgCopyright 1992-2021 Free Software Foundation, Inc.
6497e8a2e8Smrg
6597e8a2e8SmrgThis is free software; see the source for copying conditions.  There is NO
6697e8a2e8Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
6797e8a2e8Smrg
6897e8a2e8Smrghelp="
6997e8a2e8SmrgTry \`$me --help' for more information."
7097e8a2e8Smrg
7197e8a2e8Smrg# Parse command line
7297e8a2e8Smrgwhile test $# -gt 0 ; do
7397e8a2e8Smrg  case $1 in
7497e8a2e8Smrg    --time-stamp | --time* | -t )
75d7accfefSmrg       echo "$timestamp" ; exit ;;
7697e8a2e8Smrg    --version | -v )
77d7accfefSmrg       echo "$version" ; exit ;;
7897e8a2e8Smrg    --help | --h* | -h )
79d7accfefSmrg       echo "$usage"; exit ;;
8097e8a2e8Smrg    -- )     # Stop option processing
8197e8a2e8Smrg       shift; break ;;
8297e8a2e8Smrg    - )	# Use stdin as input.
8397e8a2e8Smrg       break ;;
8497e8a2e8Smrg    -* )
8597e8a2e8Smrg       echo "$me: invalid option $1$help" >&2
8697e8a2e8Smrg       exit 1 ;;
8797e8a2e8Smrg    * )
8897e8a2e8Smrg       break ;;
8997e8a2e8Smrg  esac
9097e8a2e8Smrgdone
9197e8a2e8Smrg
9297e8a2e8Smrgif test $# != 0; then
9397e8a2e8Smrg  echo "$me: too many arguments$help" >&2
9497e8a2e8Smrg  exit 1
9597e8a2e8Smrgfi
9697e8a2e8Smrg
97219ffec0Smrg# Just in case it came from the environment.
98219ffec0SmrgGUESS=
9997e8a2e8Smrg
10097e8a2e8Smrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
10197e8a2e8Smrg# compiler to aid in system detection is discouraged as it requires
10297e8a2e8Smrg# temporary files to be created and, as you can see below, it is a
10397e8a2e8Smrg# headache to deal with in a portable fashion.
10497e8a2e8Smrg
10597e8a2e8Smrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
10697e8a2e8Smrg# use `HOST_CC' if defined, but it is deprecated.
10797e8a2e8Smrg
10897e8a2e8Smrg# Portable tmp directory creation inspired by the Autoconf team.
10997e8a2e8Smrg
110219ffec0Smrgtmp=
111219ffec0Smrg# shellcheck disable=SC2172
112219ffec0Smrgtrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
113219ffec0Smrg
114219ffec0Smrgset_cc_for_build() {
115219ffec0Smrg    # prevent multiple calls if $tmp is already set
116219ffec0Smrg    test "$tmp" && return 0
117219ffec0Smrg    : "${TMPDIR=/tmp}"
118219ffec0Smrg    # shellcheck disable=SC2039,SC3028
119219ffec0Smrg    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
120219ffec0Smrg	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
121219ffec0Smrg	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
122219ffec0Smrg	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
123219ffec0Smrg    dummy=$tmp/dummy
124219ffec0Smrg    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
125219ffec0Smrg	,,)    echo "int x;" > "$dummy.c"
126219ffec0Smrg	       for driver in cc gcc c89 c99 ; do
127219ffec0Smrg		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
128219ffec0Smrg		       CC_FOR_BUILD=$driver
129219ffec0Smrg		       break
130219ffec0Smrg		   fi
131219ffec0Smrg	       done
132219ffec0Smrg	       if test x"$CC_FOR_BUILD" = x ; then
133219ffec0Smrg		   CC_FOR_BUILD=no_compiler_found
134219ffec0Smrg	       fi
135219ffec0Smrg	       ;;
136219ffec0Smrg	,,*)   CC_FOR_BUILD=$CC ;;
137219ffec0Smrg	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
138219ffec0Smrg    esac
139219ffec0Smrg}
14097e8a2e8Smrg
14197e8a2e8Smrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
14297e8a2e8Smrg# (ghazi@noc.rutgers.edu 1994-08-24)
143219ffec0Smrgif test -f /.attbin/uname ; then
14497e8a2e8Smrg	PATH=$PATH:/.attbin ; export PATH
14597e8a2e8Smrgfi
14697e8a2e8Smrg
14797e8a2e8SmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
14897e8a2e8SmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
149219ffec0SmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
15097e8a2e8SmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
15197e8a2e8Smrg
152219ffec0Smrgcase $UNAME_SYSTEM in
15368af480fSmrgLinux|GNU|GNU/*)
154219ffec0Smrg	LIBC=unknown
15568af480fSmrg
156219ffec0Smrg	set_cc_for_build
157219ffec0Smrg	cat <<-EOF > "$dummy.c"
15868af480fSmrg	#include <features.h>
15968af480fSmrg	#if defined(__UCLIBC__)
16068af480fSmrg	LIBC=uclibc
16168af480fSmrg	#elif defined(__dietlibc__)
16268af480fSmrg	LIBC=dietlibc
163219ffec0Smrg	#elif defined(__GLIBC__)
16468af480fSmrg	LIBC=gnu
165219ffec0Smrg	#else
166219ffec0Smrg	#include <stdarg.h>
167219ffec0Smrg	/* First heuristic to detect musl libc.  */
168219ffec0Smrg	#ifdef __DEFINED_va_list
169219ffec0Smrg	LIBC=musl
170219ffec0Smrg	#endif
17168af480fSmrg	#endif
17268af480fSmrg	EOF
173219ffec0Smrg	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
174219ffec0Smrg	eval "$cc_set_libc"
175219ffec0Smrg
176219ffec0Smrg	# Second heuristic to detect musl libc.
177219ffec0Smrg	if [ "$LIBC" = unknown ] &&
178219ffec0Smrg	   command -v ldd >/dev/null &&
179219ffec0Smrg	   ldd --version 2>&1 | grep -q ^musl; then
180219ffec0Smrg		LIBC=musl
181219ffec0Smrg	fi
182219ffec0Smrg
183219ffec0Smrg	# If the system lacks a compiler, then just pick glibc.
184219ffec0Smrg	# We could probably try harder.
185219ffec0Smrg	if [ "$LIBC" = unknown ]; then
186219ffec0Smrg		LIBC=gnu
187219ffec0Smrg	fi
18868af480fSmrg	;;
18968af480fSmrgesac
19068af480fSmrg
19197e8a2e8Smrg# Note: order is significant - the case branches are not exclusive.
19297e8a2e8Smrg
193219ffec0Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
19497e8a2e8Smrg    *:NetBSD:*:*)
19597e8a2e8Smrg	# NetBSD (nbsd) targets should (where applicable) match one or
19668af480fSmrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
19797e8a2e8Smrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
19897e8a2e8Smrg	# switched to ELF, *-*-netbsd* would select the old
19997e8a2e8Smrg	# object file format.  This provides both forward
20097e8a2e8Smrg	# compatibility and a consistent mechanism for selecting the
20197e8a2e8Smrg	# object file format.
20297e8a2e8Smrg	#
20397e8a2e8Smrg	# Note: NetBSD doesn't particularly care about the vendor
20497e8a2e8Smrg	# portion of the name.  We always set it to "unknown".
205219ffec0Smrg	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
206219ffec0Smrg	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
207219ffec0Smrg	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
208219ffec0Smrg	    echo unknown)`
209219ffec0Smrg	case $UNAME_MACHINE_ARCH in
210219ffec0Smrg	    aarch64eb) machine=aarch64_be-unknown ;;
21197e8a2e8Smrg	    armeb) machine=armeb-unknown ;;
21297e8a2e8Smrg	    arm*) machine=arm-unknown ;;
21397e8a2e8Smrg	    sh3el) machine=shl-unknown ;;
21497e8a2e8Smrg	    sh3eb) machine=sh-unknown ;;
215d7accfefSmrg	    sh5el) machine=sh5le-unknown ;;
216219ffec0Smrg	    earmv*)
217219ffec0Smrg		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
218219ffec0Smrg		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
219219ffec0Smrg		machine=${arch}${endian}-unknown
220219ffec0Smrg		;;
221219ffec0Smrg	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
22297e8a2e8Smrg	esac
22397e8a2e8Smrg	# The Operating System including object format, if it has switched
224219ffec0Smrg	# to ELF recently (or will in the future) and ABI.
225219ffec0Smrg	case $UNAME_MACHINE_ARCH in
226219ffec0Smrg	    earm*)
227219ffec0Smrg		os=netbsdelf
228219ffec0Smrg		;;
22997e8a2e8Smrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
230219ffec0Smrg		set_cc_for_build
23197e8a2e8Smrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
232c3f70f0aSmrg			| grep -q __ELF__
23397e8a2e8Smrg		then
23497e8a2e8Smrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
23597e8a2e8Smrg		    # Return netbsd for either.  FIX?
23697e8a2e8Smrg		    os=netbsd
23797e8a2e8Smrg		else
23897e8a2e8Smrg		    os=netbsdelf
23997e8a2e8Smrg		fi
24097e8a2e8Smrg		;;
24197e8a2e8Smrg	    *)
24268af480fSmrg		os=netbsd
24397e8a2e8Smrg		;;
24497e8a2e8Smrg	esac
245219ffec0Smrg	# Determine ABI tags.
246219ffec0Smrg	case $UNAME_MACHINE_ARCH in
247219ffec0Smrg	    earm*)
248219ffec0Smrg		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
249219ffec0Smrg		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
250219ffec0Smrg		;;
251219ffec0Smrg	esac
25297e8a2e8Smrg	# The OS release
25397e8a2e8Smrg	# Debian GNU/NetBSD machines have a different userland, and
25497e8a2e8Smrg	# thus, need a distinct triplet. However, they do not need
25597e8a2e8Smrg	# kernel version information, so it can be replaced with a
25697e8a2e8Smrg	# suitable tag, in the style of linux-gnu.
257219ffec0Smrg	case $UNAME_VERSION in
25897e8a2e8Smrg	    Debian*)
25997e8a2e8Smrg		release='-gnu'
26097e8a2e8Smrg		;;
26197e8a2e8Smrg	    *)
262219ffec0Smrg		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
26397e8a2e8Smrg		;;
26497e8a2e8Smrg	esac
26597e8a2e8Smrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
26697e8a2e8Smrg	# contains redundant information, the shorter form:
26797e8a2e8Smrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
268219ffec0Smrg	GUESS=$machine-${os}${release}${abi-}
269219ffec0Smrg	;;
27068af480fSmrg    *:Bitrig:*:*)
27168af480fSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
272219ffec0Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
273219ffec0Smrg	;;
27497e8a2e8Smrg    *:OpenBSD:*:*)
275d7accfefSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
276219ffec0Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
277219ffec0Smrg	;;
278219ffec0Smrg    *:SecBSD:*:*)
279219ffec0Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
280219ffec0Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
281219ffec0Smrg	;;
282219ffec0Smrg    *:LibertyBSD:*:*)
283219ffec0Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
284219ffec0Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
285219ffec0Smrg	;;
286219ffec0Smrg    *:MidnightBSD:*:*)
287219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
288219ffec0Smrg	;;
289d7accfefSmrg    *:ekkoBSD:*:*)
290219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
291219ffec0Smrg	;;
292d7accfefSmrg    *:SolidBSD:*:*)
293219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
294219ffec0Smrg	;;
295219ffec0Smrg    *:OS108:*:*)
296219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
297219ffec0Smrg	;;
298d7accfefSmrg    macppc:MirBSD:*:*)
299219ffec0Smrg	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
300219ffec0Smrg	;;
301d7accfefSmrg    *:MirBSD:*:*)
302219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
303219ffec0Smrg	;;
304219ffec0Smrg    *:Sortix:*:*)
305219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-sortix
306219ffec0Smrg	;;
307219ffec0Smrg    *:Twizzler:*:*)
308219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-twizzler
309219ffec0Smrg	;;
310219ffec0Smrg    *:Redox:*:*)
311219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-redox
312219ffec0Smrg	;;
313219ffec0Smrg    mips:OSF1:*.*)
314219ffec0Smrg	GUESS=mips-dec-osf1
315219ffec0Smrg	;;
31697e8a2e8Smrg    alpha:OSF1:*:*)
317219ffec0Smrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
318219ffec0Smrg	trap '' 0
319d7accfefSmrg	case $UNAME_RELEASE in
320d7accfefSmrg	*4.0)
32197e8a2e8Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
322d7accfefSmrg		;;
323d7accfefSmrg	*5.*)
32468af480fSmrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
325d7accfefSmrg		;;
326d7accfefSmrg	esac
32797e8a2e8Smrg	# According to Compaq, /usr/sbin/psrinfo has been available on
32897e8a2e8Smrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
32997e8a2e8Smrg	# covers most systems running today.  This code pipes the CPU
33097e8a2e8Smrg	# types through head -n 1, so we only detect the type of CPU 0.
33197e8a2e8Smrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
332219ffec0Smrg	case $ALPHA_CPU_TYPE in
33397e8a2e8Smrg	    "EV4 (21064)")
334219ffec0Smrg		UNAME_MACHINE=alpha ;;
33597e8a2e8Smrg	    "EV4.5 (21064)")
336219ffec0Smrg		UNAME_MACHINE=alpha ;;
33797e8a2e8Smrg	    "LCA4 (21066/21068)")
338219ffec0Smrg		UNAME_MACHINE=alpha ;;
33997e8a2e8Smrg	    "EV5 (21164)")
340219ffec0Smrg		UNAME_MACHINE=alphaev5 ;;
34197e8a2e8Smrg	    "EV5.6 (21164A)")
342219ffec0Smrg		UNAME_MACHINE=alphaev56 ;;
34397e8a2e8Smrg	    "EV5.6 (21164PC)")
344219ffec0Smrg		UNAME_MACHINE=alphapca56 ;;
34597e8a2e8Smrg	    "EV5.7 (21164PC)")
346219ffec0Smrg		UNAME_MACHINE=alphapca57 ;;
34797e8a2e8Smrg	    "EV6 (21264)")
348219ffec0Smrg		UNAME_MACHINE=alphaev6 ;;
34997e8a2e8Smrg	    "EV6.7 (21264A)")
350219ffec0Smrg		UNAME_MACHINE=alphaev67 ;;
35197e8a2e8Smrg	    "EV6.8CB (21264C)")
352219ffec0Smrg		UNAME_MACHINE=alphaev68 ;;
35397e8a2e8Smrg	    "EV6.8AL (21264B)")
354219ffec0Smrg		UNAME_MACHINE=alphaev68 ;;
35597e8a2e8Smrg	    "EV6.8CX (21264D)")
356219ffec0Smrg		UNAME_MACHINE=alphaev68 ;;
35797e8a2e8Smrg	    "EV6.9A (21264/EV69A)")
358219ffec0Smrg		UNAME_MACHINE=alphaev69 ;;
35997e8a2e8Smrg	    "EV7 (21364)")
360219ffec0Smrg		UNAME_MACHINE=alphaev7 ;;
36197e8a2e8Smrg	    "EV7.9 (21364A)")
362219ffec0Smrg		UNAME_MACHINE=alphaev79 ;;
36397e8a2e8Smrg	esac
364d7accfefSmrg	# A Pn.n version is a patched version.
36597e8a2e8Smrg	# A Vn.n version is a released version.
36697e8a2e8Smrg	# A Tn.n version is a released field test version.
36797e8a2e8Smrg	# A Xn.n version is an unreleased experimental baselevel.
36897e8a2e8Smrg	# 1.2 uses "1.2" for uname -r.
369219ffec0Smrg	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
370219ffec0Smrg	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
371219ffec0Smrg	;;
37297e8a2e8Smrg    Amiga*:UNIX_System_V:4.0:*)
373219ffec0Smrg	GUESS=m68k-unknown-sysv4
374219ffec0Smrg	;;
37597e8a2e8Smrg    *:[Aa]miga[Oo][Ss]:*:*)
376219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-amigaos
377219ffec0Smrg	;;
37897e8a2e8Smrg    *:[Mm]orph[Oo][Ss]:*:*)
379219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-morphos
380219ffec0Smrg	;;
38197e8a2e8Smrg    *:OS/390:*:*)
382219ffec0Smrg	GUESS=i370-ibm-openedition
383219ffec0Smrg	;;
384d7accfefSmrg    *:z/VM:*:*)
385219ffec0Smrg	GUESS=s390-ibm-zvmoe
386219ffec0Smrg	;;
387d7accfefSmrg    *:OS400:*:*)
388219ffec0Smrg	GUESS=powerpc-ibm-os400
389219ffec0Smrg	;;
39097e8a2e8Smrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
391219ffec0Smrg	GUESS=arm-acorn-riscix$UNAME_RELEASE
392219ffec0Smrg	;;
39368af480fSmrg    arm*:riscos:*:*|arm*:RISCOS:*:*)
394219ffec0Smrg	GUESS=arm-unknown-riscos
395219ffec0Smrg	;;
39697e8a2e8Smrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
397219ffec0Smrg	GUESS=hppa1.1-hitachi-hiuxmpp
398219ffec0Smrg	;;
39997e8a2e8Smrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
40097e8a2e8Smrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
401219ffec0Smrg	case `(/bin/universe) 2>/dev/null` in
402219ffec0Smrg	    att) GUESS=pyramid-pyramid-sysv3 ;;
403219ffec0Smrg	    *)   GUESS=pyramid-pyramid-bsd   ;;
404219ffec0Smrg	esac
405219ffec0Smrg	;;
40697e8a2e8Smrg    NILE*:*:*:dcosx)
407219ffec0Smrg	GUESS=pyramid-pyramid-svr4
408219ffec0Smrg	;;
40997e8a2e8Smrg    DRS?6000:unix:4.0:6*)
410219ffec0Smrg	GUESS=sparc-icl-nx6
411219ffec0Smrg	;;
412d7accfefSmrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
41397e8a2e8Smrg	case `/usr/bin/uname -p` in
414219ffec0Smrg	    sparc) GUESS=sparc-icl-nx7 ;;
415219ffec0Smrg	esac
416219ffec0Smrg	;;
417d7accfefSmrg    s390x:SunOS:*:*)
418219ffec0Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
419219ffec0Smrg	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
420219ffec0Smrg	;;
42197e8a2e8Smrg    sun4H:SunOS:5.*:*)
422219ffec0Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
423219ffec0Smrg	GUESS=sparc-hal-solaris2$SUN_REL
424219ffec0Smrg	;;
42597e8a2e8Smrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
426219ffec0Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
427219ffec0Smrg	GUESS=sparc-sun-solaris2$SUN_REL
428219ffec0Smrg	;;
429c3f70f0aSmrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
430219ffec0Smrg	GUESS=i386-pc-auroraux$UNAME_RELEASE
431219ffec0Smrg	;;
432d7accfefSmrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
433219ffec0Smrg	set_cc_for_build
434219ffec0Smrg	SUN_ARCH=i386
435d7accfefSmrg	# If there is a compiler, see if it is configured for 64-bit objects.
436d7accfefSmrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
437d7accfefSmrg	# This test works for both compilers.
438219ffec0Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
439d7accfefSmrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
440219ffec0Smrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
441d7accfefSmrg		grep IS_64BIT_ARCH >/dev/null
442d7accfefSmrg	    then
443219ffec0Smrg		SUN_ARCH=x86_64
444d7accfefSmrg	    fi
445d7accfefSmrg	fi
446219ffec0Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
447219ffec0Smrg	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
448219ffec0Smrg	;;
44997e8a2e8Smrg    sun4*:SunOS:6*:*)
45097e8a2e8Smrg	# According to config.sub, this is the proper way to canonicalize
45197e8a2e8Smrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
45297e8a2e8Smrg	# it's likely to be more like Solaris than SunOS4.
453219ffec0Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
454219ffec0Smrg	GUESS=sparc-sun-solaris3$SUN_REL
455219ffec0Smrg	;;
45697e8a2e8Smrg    sun4*:SunOS:*:*)
457219ffec0Smrg	case `/usr/bin/arch -k` in
45897e8a2e8Smrg	    Series*|S4*)
45997e8a2e8Smrg		UNAME_RELEASE=`uname -v`
46097e8a2e8Smrg		;;
46197e8a2e8Smrg	esac
46297e8a2e8Smrg	# Japanese Language versions have a version number like `4.1.3-JL'.
463219ffec0Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
464219ffec0Smrg	GUESS=sparc-sun-sunos$SUN_REL
465219ffec0Smrg	;;
46697e8a2e8Smrg    sun3*:SunOS:*:*)
467219ffec0Smrg	GUESS=m68k-sun-sunos$UNAME_RELEASE
468219ffec0Smrg	;;
46997e8a2e8Smrg    sun*:*:4.2BSD:*)
47097e8a2e8Smrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
471219ffec0Smrg	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
472219ffec0Smrg	case `/bin/arch` in
47397e8a2e8Smrg	    sun3)
474219ffec0Smrg		GUESS=m68k-sun-sunos$UNAME_RELEASE
47597e8a2e8Smrg		;;
47697e8a2e8Smrg	    sun4)
477219ffec0Smrg		GUESS=sparc-sun-sunos$UNAME_RELEASE
47897e8a2e8Smrg		;;
47997e8a2e8Smrg	esac
480219ffec0Smrg	;;
48197e8a2e8Smrg    aushp:SunOS:*:*)
482219ffec0Smrg	GUESS=sparc-auspex-sunos$UNAME_RELEASE
483219ffec0Smrg	;;
48497e8a2e8Smrg    # The situation for MiNT is a little confusing.  The machine name
48597e8a2e8Smrg    # can be virtually everything (everything which is not
48697e8a2e8Smrg    # "atarist" or "atariste" at least should have a processor
48797e8a2e8Smrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
48897e8a2e8Smrg    # to the lowercase version "mint" (or "freemint").  Finally
48997e8a2e8Smrg    # the system name "TOS" denotes a system which is actually not
49097e8a2e8Smrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
49197e8a2e8Smrg    # be no problem.
49297e8a2e8Smrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
493219ffec0Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
494219ffec0Smrg	;;
49597e8a2e8Smrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
496219ffec0Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
497219ffec0Smrg	;;
49897e8a2e8Smrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
499219ffec0Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
500219ffec0Smrg	;;
50197e8a2e8Smrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
502219ffec0Smrg	GUESS=m68k-milan-mint$UNAME_RELEASE
503219ffec0Smrg	;;
50497e8a2e8Smrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
505219ffec0Smrg	GUESS=m68k-hades-mint$UNAME_RELEASE
506219ffec0Smrg	;;
50797e8a2e8Smrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
508219ffec0Smrg	GUESS=m68k-unknown-mint$UNAME_RELEASE
509219ffec0Smrg	;;
510d7accfefSmrg    m68k:machten:*:*)
511219ffec0Smrg	GUESS=m68k-apple-machten$UNAME_RELEASE
512219ffec0Smrg	;;
51397e8a2e8Smrg    powerpc:machten:*:*)
514219ffec0Smrg	GUESS=powerpc-apple-machten$UNAME_RELEASE
515219ffec0Smrg	;;
51697e8a2e8Smrg    RISC*:Mach:*:*)
517219ffec0Smrg	GUESS=mips-dec-mach_bsd4.3
518219ffec0Smrg	;;
51997e8a2e8Smrg    RISC*:ULTRIX:*:*)
520219ffec0Smrg	GUESS=mips-dec-ultrix$UNAME_RELEASE
521219ffec0Smrg	;;
52297e8a2e8Smrg    VAX*:ULTRIX*:*:*)
523219ffec0Smrg	GUESS=vax-dec-ultrix$UNAME_RELEASE
524219ffec0Smrg	;;
52597e8a2e8Smrg    2020:CLIX:*:* | 2430:CLIX:*:*)
526219ffec0Smrg	GUESS=clipper-intergraph-clix$UNAME_RELEASE
527219ffec0Smrg	;;
52897e8a2e8Smrg    mips:*:*:UMIPS | mips:*:*:RISCos)
529219ffec0Smrg	set_cc_for_build
530219ffec0Smrg	sed 's/^	//' << EOF > "$dummy.c"
53197e8a2e8Smrg#ifdef __cplusplus
53297e8a2e8Smrg#include <stdio.h>  /* for printf() prototype */
53397e8a2e8Smrg	int main (int argc, char *argv[]) {
53497e8a2e8Smrg#else
53597e8a2e8Smrg	int main (argc, argv) int argc; char *argv[]; {
53697e8a2e8Smrg#endif
53797e8a2e8Smrg	#if defined (host_mips) && defined (MIPSEB)
53897e8a2e8Smrg	#if defined (SYSTYPE_SYSV)
539219ffec0Smrg	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
54097e8a2e8Smrg	#endif
54197e8a2e8Smrg	#if defined (SYSTYPE_SVR4)
542219ffec0Smrg	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
54397e8a2e8Smrg	#endif
54497e8a2e8Smrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
545219ffec0Smrg	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
54697e8a2e8Smrg	#endif
54797e8a2e8Smrg	#endif
54897e8a2e8Smrg	  exit (-1);
54997e8a2e8Smrg	}
55097e8a2e8SmrgEOF
551219ffec0Smrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
552219ffec0Smrg	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
553219ffec0Smrg	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
554d7accfefSmrg	    { echo "$SYSTEM_NAME"; exit; }
555219ffec0Smrg	GUESS=mips-mips-riscos$UNAME_RELEASE
556219ffec0Smrg	;;
55797e8a2e8Smrg    Motorola:PowerMAX_OS:*:*)
558219ffec0Smrg	GUESS=powerpc-motorola-powermax
559219ffec0Smrg	;;
56097e8a2e8Smrg    Motorola:*:4.3:PL8-*)
561219ffec0Smrg	GUESS=powerpc-harris-powermax
562219ffec0Smrg	;;
56397e8a2e8Smrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
564219ffec0Smrg	GUESS=powerpc-harris-powermax
565219ffec0Smrg	;;
56697e8a2e8Smrg    Night_Hawk:Power_UNIX:*:*)
567219ffec0Smrg	GUESS=powerpc-harris-powerunix
568219ffec0Smrg	;;
56997e8a2e8Smrg    m88k:CX/UX:7*:*)
570219ffec0Smrg	GUESS=m88k-harris-cxux7
571219ffec0Smrg	;;
57297e8a2e8Smrg    m88k:*:4*:R4*)
573219ffec0Smrg	GUESS=m88k-motorola-sysv4
574219ffec0Smrg	;;
57597e8a2e8Smrg    m88k:*:3*:R3*)
576219ffec0Smrg	GUESS=m88k-motorola-sysv3
577219ffec0Smrg	;;
57897e8a2e8Smrg    AViiON:dgux:*:*)
57968af480fSmrg	# DG/UX returns AViiON for all architectures
58068af480fSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
581219ffec0Smrg	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
58297e8a2e8Smrg	then
583219ffec0Smrg	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
584219ffec0Smrg	       test "$TARGET_BINARY_INTERFACE"x = x
58597e8a2e8Smrg	    then
586219ffec0Smrg		GUESS=m88k-dg-dgux$UNAME_RELEASE
58797e8a2e8Smrg	    else
588219ffec0Smrg		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
58997e8a2e8Smrg	    fi
59097e8a2e8Smrg	else
591219ffec0Smrg	    GUESS=i586-dg-dgux$UNAME_RELEASE
59297e8a2e8Smrg	fi
593219ffec0Smrg	;;
59497e8a2e8Smrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
595219ffec0Smrg	GUESS=m88k-dolphin-sysv3
596219ffec0Smrg	;;
59797e8a2e8Smrg    M88*:*:R3*:*)
59897e8a2e8Smrg	# Delta 88k system running SVR3
599219ffec0Smrg	GUESS=m88k-motorola-sysv3
600219ffec0Smrg	;;
60197e8a2e8Smrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
602219ffec0Smrg	GUESS=m88k-tektronix-sysv3
603219ffec0Smrg	;;
60497e8a2e8Smrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
605219ffec0Smrg	GUESS=m68k-tektronix-bsd
606219ffec0Smrg	;;
60797e8a2e8Smrg    *:IRIX*:*:*)
608219ffec0Smrg	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
609219ffec0Smrg	GUESS=mips-sgi-irix$IRIX_REL
610219ffec0Smrg	;;
61197e8a2e8Smrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
612219ffec0Smrg	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
613219ffec0Smrg	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
61497e8a2e8Smrg    i*86:AIX:*:*)
615219ffec0Smrg	GUESS=i386-ibm-aix
616219ffec0Smrg	;;
61797e8a2e8Smrg    ia64:AIX:*:*)
618219ffec0Smrg	if test -x /usr/bin/oslevel ; then
61997e8a2e8Smrg		IBM_REV=`/usr/bin/oslevel`
62097e8a2e8Smrg	else
621219ffec0Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
62297e8a2e8Smrg	fi
623219ffec0Smrg	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
624219ffec0Smrg	;;
62597e8a2e8Smrg    *:AIX:2:3)
62697e8a2e8Smrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
627219ffec0Smrg		set_cc_for_build
628219ffec0Smrg		sed 's/^		//' << EOF > "$dummy.c"
62997e8a2e8Smrg		#include <sys/systemcfg.h>
63097e8a2e8Smrg
63197e8a2e8Smrg		main()
63297e8a2e8Smrg			{
63397e8a2e8Smrg			if (!__power_pc())
63497e8a2e8Smrg				exit(1);
63597e8a2e8Smrg			puts("powerpc-ibm-aix3.2.5");
63697e8a2e8Smrg			exit(0);
63797e8a2e8Smrg			}
63897e8a2e8SmrgEOF
639219ffec0Smrg		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
640d7accfefSmrg		then
641219ffec0Smrg			GUESS=$SYSTEM_NAME
642d7accfefSmrg		else
643219ffec0Smrg			GUESS=rs6000-ibm-aix3.2.5
644d7accfefSmrg		fi
64597e8a2e8Smrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
646219ffec0Smrg		GUESS=rs6000-ibm-aix3.2.4
64797e8a2e8Smrg	else
648219ffec0Smrg		GUESS=rs6000-ibm-aix3.2
64997e8a2e8Smrg	fi
650219ffec0Smrg	;;
651c3f70f0aSmrg    *:AIX:*:[4567])
65297e8a2e8Smrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
653219ffec0Smrg	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
65497e8a2e8Smrg		IBM_ARCH=rs6000
65597e8a2e8Smrg	else
65697e8a2e8Smrg		IBM_ARCH=powerpc
65797e8a2e8Smrg	fi
658219ffec0Smrg	if test -x /usr/bin/lslpp ; then
659219ffec0Smrg		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
660219ffec0Smrg			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
66197e8a2e8Smrg	else
662219ffec0Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
66397e8a2e8Smrg	fi
664219ffec0Smrg	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
665219ffec0Smrg	;;
66697e8a2e8Smrg    *:AIX:*:*)
667219ffec0Smrg	GUESS=rs6000-ibm-aix
668219ffec0Smrg	;;
669219ffec0Smrg    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
670219ffec0Smrg	GUESS=romp-ibm-bsd4.4
671219ffec0Smrg	;;
67297e8a2e8Smrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
673219ffec0Smrg	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
674219ffec0Smrg	;;                                  # report: romp-ibm BSD 4.3
67597e8a2e8Smrg    *:BOSX:*:*)
676219ffec0Smrg	GUESS=rs6000-bull-bosx
677219ffec0Smrg	;;
67897e8a2e8Smrg    DPX/2?00:B.O.S.:*:*)
679219ffec0Smrg	GUESS=m68k-bull-sysv3
680219ffec0Smrg	;;
68197e8a2e8Smrg    9000/[34]??:4.3bsd:1.*:*)
682219ffec0Smrg	GUESS=m68k-hp-bsd
683219ffec0Smrg	;;
68497e8a2e8Smrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
685219ffec0Smrg	GUESS=m68k-hp-bsd4.4
686219ffec0Smrg	;;
68797e8a2e8Smrg    9000/[34678]??:HP-UX:*:*)
688219ffec0Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
689219ffec0Smrg	case $UNAME_MACHINE in
690219ffec0Smrg	    9000/31?)            HP_ARCH=m68000 ;;
691219ffec0Smrg	    9000/[34]??)         HP_ARCH=m68k ;;
69297e8a2e8Smrg	    9000/[678][0-9][0-9])
693219ffec0Smrg		if test -x /usr/bin/getconf; then
69497e8a2e8Smrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
69568af480fSmrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
696219ffec0Smrg		    case $sc_cpu_version in
697219ffec0Smrg		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
698219ffec0Smrg		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
69968af480fSmrg		      532)                      # CPU_PA_RISC2_0
700219ffec0Smrg			case $sc_kernel_bits in
701219ffec0Smrg			  32) HP_ARCH=hppa2.0n ;;
702219ffec0Smrg			  64) HP_ARCH=hppa2.0w ;;
703219ffec0Smrg			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
70468af480fSmrg			esac ;;
70568af480fSmrg		    esac
70697e8a2e8Smrg		fi
707219ffec0Smrg		if test "$HP_ARCH" = ""; then
708219ffec0Smrg		    set_cc_for_build
709219ffec0Smrg		    sed 's/^		//' << EOF > "$dummy.c"
71097e8a2e8Smrg
71168af480fSmrg		#define _HPUX_SOURCE
71268af480fSmrg		#include <stdlib.h>
71368af480fSmrg		#include <unistd.h>
71497e8a2e8Smrg
71568af480fSmrg		int main ()
71668af480fSmrg		{
71768af480fSmrg		#if defined(_SC_KERNEL_BITS)
71868af480fSmrg		    long bits = sysconf(_SC_KERNEL_BITS);
71968af480fSmrg		#endif
72068af480fSmrg		    long cpu  = sysconf (_SC_CPU_VERSION);
72197e8a2e8Smrg
72268af480fSmrg		    switch (cpu)
72368af480fSmrg			{
72468af480fSmrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
72568af480fSmrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
72668af480fSmrg			case CPU_PA_RISC2_0:
72768af480fSmrg		#if defined(_SC_KERNEL_BITS)
72868af480fSmrg			    switch (bits)
72968af480fSmrg				{
73068af480fSmrg				case 64: puts ("hppa2.0w"); break;
73168af480fSmrg				case 32: puts ("hppa2.0n"); break;
73268af480fSmrg				default: puts ("hppa2.0"); break;
73368af480fSmrg				} break;
73468af480fSmrg		#else  /* !defined(_SC_KERNEL_BITS) */
73568af480fSmrg			    puts ("hppa2.0"); break;
73668af480fSmrg		#endif
73768af480fSmrg			default: puts ("hppa1.0"); break;
73868af480fSmrg			}
73968af480fSmrg		    exit (0);
74068af480fSmrg		}
74197e8a2e8SmrgEOF
742219ffec0Smrg		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
74397e8a2e8Smrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
74497e8a2e8Smrg		fi ;;
74597e8a2e8Smrg	esac
746219ffec0Smrg	if test "$HP_ARCH" = hppa2.0w
74797e8a2e8Smrg	then
748219ffec0Smrg	    set_cc_for_build
749d7accfefSmrg
750d7accfefSmrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
751d7accfefSmrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
752d7accfefSmrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
753d7accfefSmrg	    #
754d7accfefSmrg	    # $ CC_FOR_BUILD=cc ./config.guess
755d7accfefSmrg	    # => hppa2.0w-hp-hpux11.23
756d7accfefSmrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
757d7accfefSmrg	    # => hppa64-hp-hpux11.23
758d7accfefSmrg
759219ffec0Smrg	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
760c3f70f0aSmrg		grep -q __LP64__
76197e8a2e8Smrg	    then
762219ffec0Smrg		HP_ARCH=hppa2.0w
76397e8a2e8Smrg	    else
764219ffec0Smrg		HP_ARCH=hppa64
76597e8a2e8Smrg	    fi
76697e8a2e8Smrg	fi
767219ffec0Smrg	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
768219ffec0Smrg	;;
76997e8a2e8Smrg    ia64:HP-UX:*:*)
770219ffec0Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
771219ffec0Smrg	GUESS=ia64-hp-hpux$HPUX_REV
772219ffec0Smrg	;;
77397e8a2e8Smrg    3050*:HI-UX:*:*)
774219ffec0Smrg	set_cc_for_build
775219ffec0Smrg	sed 's/^	//' << EOF > "$dummy.c"
77697e8a2e8Smrg	#include <unistd.h>
77797e8a2e8Smrg	int
77897e8a2e8Smrg	main ()
77997e8a2e8Smrg	{
78097e8a2e8Smrg	  long cpu = sysconf (_SC_CPU_VERSION);
78197e8a2e8Smrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
78297e8a2e8Smrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
78397e8a2e8Smrg	     results, however.  */
78497e8a2e8Smrg	  if (CPU_IS_PA_RISC (cpu))
78597e8a2e8Smrg	    {
78697e8a2e8Smrg	      switch (cpu)
78797e8a2e8Smrg		{
78897e8a2e8Smrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
78997e8a2e8Smrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
79097e8a2e8Smrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
79197e8a2e8Smrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
79297e8a2e8Smrg		}
79397e8a2e8Smrg	    }
79497e8a2e8Smrg	  else if (CPU_IS_HP_MC68K (cpu))
79597e8a2e8Smrg	    puts ("m68k-hitachi-hiuxwe2");
79697e8a2e8Smrg	  else puts ("unknown-hitachi-hiuxwe2");
79797e8a2e8Smrg	  exit (0);
79897e8a2e8Smrg	}
79997e8a2e8SmrgEOF
800219ffec0Smrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
801d7accfefSmrg		{ echo "$SYSTEM_NAME"; exit; }
802219ffec0Smrg	GUESS=unknown-hitachi-hiuxwe2
803219ffec0Smrg	;;
804219ffec0Smrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
805219ffec0Smrg	GUESS=hppa1.1-hp-bsd
806219ffec0Smrg	;;
80797e8a2e8Smrg    9000/8??:4.3bsd:*:*)
808219ffec0Smrg	GUESS=hppa1.0-hp-bsd
809219ffec0Smrg	;;
81097e8a2e8Smrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
811219ffec0Smrg	GUESS=hppa1.0-hp-mpeix
812219ffec0Smrg	;;
813219ffec0Smrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
814219ffec0Smrg	GUESS=hppa1.1-hp-osf
815219ffec0Smrg	;;
81697e8a2e8Smrg    hp8??:OSF1:*:*)
817219ffec0Smrg	GUESS=hppa1.0-hp-osf
818219ffec0Smrg	;;
81997e8a2e8Smrg    i*86:OSF1:*:*)
820219ffec0Smrg	if test -x /usr/sbin/sysversion ; then
821219ffec0Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1mk
82297e8a2e8Smrg	else
823219ffec0Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1
82497e8a2e8Smrg	fi
825219ffec0Smrg	;;
82697e8a2e8Smrg    parisc*:Lites*:*:*)
827219ffec0Smrg	GUESS=hppa1.1-hp-lites
828219ffec0Smrg	;;
82997e8a2e8Smrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
830219ffec0Smrg	GUESS=c1-convex-bsd
831219ffec0Smrg	;;
83297e8a2e8Smrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
83397e8a2e8Smrg	if getsysinfo -f scalar_acc
83497e8a2e8Smrg	then echo c32-convex-bsd
83597e8a2e8Smrg	else echo c2-convex-bsd
83697e8a2e8Smrg	fi
83768af480fSmrg	exit ;;
83897e8a2e8Smrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
839219ffec0Smrg	GUESS=c34-convex-bsd
840219ffec0Smrg	;;
84197e8a2e8Smrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
842219ffec0Smrg	GUESS=c38-convex-bsd
843219ffec0Smrg	;;
84497e8a2e8Smrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
845219ffec0Smrg	GUESS=c4-convex-bsd
846219ffec0Smrg	;;
84797e8a2e8Smrg    CRAY*Y-MP:*:*:*)
848219ffec0Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
849219ffec0Smrg	GUESS=ymp-cray-unicos$CRAY_REL
850219ffec0Smrg	;;
85197e8a2e8Smrg    CRAY*[A-Z]90:*:*:*)
852219ffec0Smrg	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
85397e8a2e8Smrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
85497e8a2e8Smrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
85597e8a2e8Smrg	      -e 's/\.[^.]*$/.X/'
856d7accfefSmrg	exit ;;
85797e8a2e8Smrg    CRAY*TS:*:*:*)
858219ffec0Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
859219ffec0Smrg	GUESS=t90-cray-unicos$CRAY_REL
860219ffec0Smrg	;;
86197e8a2e8Smrg    CRAY*T3E:*:*:*)
862219ffec0Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
863219ffec0Smrg	GUESS=alphaev5-cray-unicosmk$CRAY_REL
864219ffec0Smrg	;;
86597e8a2e8Smrg    CRAY*SV1:*:*:*)
866219ffec0Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
867219ffec0Smrg	GUESS=sv1-cray-unicos$CRAY_REL
868219ffec0Smrg	;;
86997e8a2e8Smrg    *:UNICOS/mp:*:*)
870219ffec0Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
871219ffec0Smrg	GUESS=craynv-cray-unicosmp$CRAY_REL
872219ffec0Smrg	;;
87397e8a2e8Smrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
874219ffec0Smrg	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
875219ffec0Smrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
876219ffec0Smrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
877219ffec0Smrg	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
878219ffec0Smrg	;;
879d7accfefSmrg    5000:UNIX_System_V:4.*:*)
880219ffec0Smrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
881219ffec0Smrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
882219ffec0Smrg	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
883219ffec0Smrg	;;
88497e8a2e8Smrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
885219ffec0Smrg	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
886219ffec0Smrg	;;
88797e8a2e8Smrg    sparc*:BSD/OS:*:*)
888219ffec0Smrg	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
889219ffec0Smrg	;;
89097e8a2e8Smrg    *:BSD/OS:*:*)
891219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
892219ffec0Smrg	;;
893219ffec0Smrg    arm:FreeBSD:*:*)
894219ffec0Smrg	UNAME_PROCESSOR=`uname -p`
895219ffec0Smrg	set_cc_for_build
896219ffec0Smrg	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
897219ffec0Smrg	    | grep -q __ARM_PCS_VFP
898219ffec0Smrg	then
899219ffec0Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
900219ffec0Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
901219ffec0Smrg	else
902219ffec0Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
903219ffec0Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
904219ffec0Smrg	fi
905219ffec0Smrg	;;
906d7accfefSmrg    *:FreeBSD:*:*)
90768af480fSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
908219ffec0Smrg	case $UNAME_PROCESSOR in
909d7accfefSmrg	    amd64)
910219ffec0Smrg		UNAME_PROCESSOR=x86_64 ;;
911219ffec0Smrg	    i386)
912219ffec0Smrg		UNAME_PROCESSOR=i586 ;;
913d7accfefSmrg	esac
914219ffec0Smrg	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
915219ffec0Smrg	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
916219ffec0Smrg	;;
91797e8a2e8Smrg    i*:CYGWIN*:*)
918219ffec0Smrg	GUESS=$UNAME_MACHINE-pc-cygwin
919219ffec0Smrg	;;
92068af480fSmrg    *:MINGW64*:*)
921219ffec0Smrg	GUESS=$UNAME_MACHINE-pc-mingw64
922219ffec0Smrg	;;
923d7accfefSmrg    *:MINGW*:*)
924219ffec0Smrg	GUESS=$UNAME_MACHINE-pc-mingw32
925219ffec0Smrg	;;
926219ffec0Smrg    *:MSYS*:*)
927219ffec0Smrg	GUESS=$UNAME_MACHINE-pc-msys
928219ffec0Smrg	;;
92997e8a2e8Smrg    i*:PW*:*)
930219ffec0Smrg	GUESS=$UNAME_MACHINE-pc-pw32
931219ffec0Smrg	;;
932c3f70f0aSmrg    *:Interix*:*)
933219ffec0Smrg	case $UNAME_MACHINE in
934d7accfefSmrg	    x86)
935219ffec0Smrg		GUESS=i586-pc-interix$UNAME_RELEASE
936219ffec0Smrg		;;
937c3f70f0aSmrg	    authenticamd | genuineintel | EM64T)
938219ffec0Smrg		GUESS=x86_64-unknown-interix$UNAME_RELEASE
939219ffec0Smrg		;;
940d7accfefSmrg	    IA64)
941219ffec0Smrg		GUESS=ia64-unknown-interix$UNAME_RELEASE
942219ffec0Smrg		;;
943d7accfefSmrg	esac ;;
94497e8a2e8Smrg    i*:UWIN*:*)
945219ffec0Smrg	GUESS=$UNAME_MACHINE-pc-uwin
946219ffec0Smrg	;;
947d7accfefSmrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
948219ffec0Smrg	GUESS=x86_64-pc-cygwin
949219ffec0Smrg	;;
95097e8a2e8Smrg    prep*:SunOS:5.*:*)
951219ffec0Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
952219ffec0Smrg	GUESS=powerpcle-unknown-solaris2$SUN_REL
953219ffec0Smrg	;;
95497e8a2e8Smrg    *:GNU:*:*)
955d7accfefSmrg	# the GNU system
956219ffec0Smrg	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
957219ffec0Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
958219ffec0Smrg	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
959219ffec0Smrg	;;
960d7accfefSmrg    *:GNU/*:*:*)
961d7accfefSmrg	# other systems with GNU libc and userland
962219ffec0Smrg	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
963219ffec0Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
964219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
965219ffec0Smrg	;;
966219ffec0Smrg    *:Minix:*:*)
967219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-minix
968219ffec0Smrg	;;
96968af480fSmrg    aarch64:Linux:*:*)
970219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
971219ffec0Smrg	;;
97268af480fSmrg    aarch64_be:Linux:*:*)
97368af480fSmrg	UNAME_MACHINE=aarch64_be
974219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
975219ffec0Smrg	;;
976c3f70f0aSmrg    alpha:Linux:*:*)
977219ffec0Smrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
978c3f70f0aSmrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
979c3f70f0aSmrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
980c3f70f0aSmrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
981c3f70f0aSmrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
982c3f70f0aSmrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
983c3f70f0aSmrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
984c3f70f0aSmrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
98568af480fSmrg	esac
986c3f70f0aSmrg	objdump --private-headers /bin/sh | grep -q ld.so.1
987219ffec0Smrg	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
988219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
989219ffec0Smrg	;;
990219ffec0Smrg    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
991219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
992219ffec0Smrg	;;
99397e8a2e8Smrg    arm*:Linux:*:*)
994219ffec0Smrg	set_cc_for_build
995d7accfefSmrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
996d7accfefSmrg	    | grep -q __ARM_EABI__
997d7accfefSmrg	then
998219ffec0Smrg	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
999d7accfefSmrg	else
100068af480fSmrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
100168af480fSmrg		| grep -q __ARM_PCS_VFP
100268af480fSmrg	    then
1003219ffec0Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
100468af480fSmrg	    else
1005219ffec0Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
100668af480fSmrg	    fi
1007d7accfefSmrg	fi
1008219ffec0Smrg	;;
1009d7accfefSmrg    avr32*:Linux:*:*)
1010219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1011219ffec0Smrg	;;
101297e8a2e8Smrg    cris:Linux:*:*)
1013219ffec0Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1014219ffec0Smrg	;;
1015d7accfefSmrg    crisv32:Linux:*:*)
1016219ffec0Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1017219ffec0Smrg	;;
1018219ffec0Smrg    e2k:Linux:*:*)
1019219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1020219ffec0Smrg	;;
1021d7accfefSmrg    frv:Linux:*:*)
1022219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1023219ffec0Smrg	;;
102468af480fSmrg    hexagon:Linux:*:*)
1025219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1026219ffec0Smrg	;;
1027c3f70f0aSmrg    i*86:Linux:*:*)
1028219ffec0Smrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
1029219ffec0Smrg	;;
103097e8a2e8Smrg    ia64:Linux:*:*)
1031219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1032219ffec0Smrg	;;
1033219ffec0Smrg    k1om:Linux:*:*)
1034219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1035219ffec0Smrg	;;
1036219ffec0Smrg    loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
1037219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1038219ffec0Smrg	;;
1039d7accfefSmrg    m32r*:Linux:*:*)
1040219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1041219ffec0Smrg	;;
104297e8a2e8Smrg    m68*:Linux:*:*)
1043219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1044219ffec0Smrg	;;
1045c3f70f0aSmrg    mips:Linux:*:* | mips64:Linux:*:*)
1046219ffec0Smrg	set_cc_for_build
1047219ffec0Smrg	IS_GLIBC=0
1048219ffec0Smrg	test x"${LIBC}" = xgnu && IS_GLIBC=1
1049219ffec0Smrg	sed 's/^	//' << EOF > "$dummy.c"
105097e8a2e8Smrg	#undef CPU
1051219ffec0Smrg	#undef mips
1052219ffec0Smrg	#undef mipsel
1053219ffec0Smrg	#undef mips64
1054219ffec0Smrg	#undef mips64el
1055219ffec0Smrg	#if ${IS_GLIBC} && defined(_ABI64)
1056219ffec0Smrg	LIBCABI=gnuabi64
1057219ffec0Smrg	#else
1058219ffec0Smrg	#if ${IS_GLIBC} && defined(_ABIN32)
1059219ffec0Smrg	LIBCABI=gnuabin32
1060219ffec0Smrg	#else
1061219ffec0Smrg	LIBCABI=${LIBC}
1062219ffec0Smrg	#endif
1063219ffec0Smrg	#endif
1064219ffec0Smrg
1065219ffec0Smrg	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1066219ffec0Smrg	CPU=mipsisa64r6
1067219ffec0Smrg	#else
1068219ffec0Smrg	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1069219ffec0Smrg	CPU=mipsisa32r6
1070219ffec0Smrg	#else
1071219ffec0Smrg	#if defined(__mips64)
1072219ffec0Smrg	CPU=mips64
1073219ffec0Smrg	#else
1074219ffec0Smrg	CPU=mips
1075219ffec0Smrg	#endif
1076219ffec0Smrg	#endif
1077219ffec0Smrg	#endif
1078219ffec0Smrg
107997e8a2e8Smrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
1080219ffec0Smrg	MIPS_ENDIAN=el
108197e8a2e8Smrg	#else
108297e8a2e8Smrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
1083219ffec0Smrg	MIPS_ENDIAN=
108497e8a2e8Smrg	#else
1085219ffec0Smrg	MIPS_ENDIAN=
108697e8a2e8Smrg	#endif
108797e8a2e8Smrg	#endif
108897e8a2e8SmrgEOF
1089219ffec0Smrg	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
1090219ffec0Smrg	eval "$cc_set_vars"
1091219ffec0Smrg	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
1092219ffec0Smrg	;;
1093219ffec0Smrg    mips64el:Linux:*:*)
1094219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1095219ffec0Smrg	;;
1096219ffec0Smrg    openrisc*:Linux:*:*)
1097219ffec0Smrg	GUESS=or1k-unknown-linux-$LIBC
1098219ffec0Smrg	;;
1099219ffec0Smrg    or32:Linux:*:* | or1k*:Linux:*:*)
1100219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
110197e8a2e8Smrg	;;
1102d7accfefSmrg    padre:Linux:*:*)
1103219ffec0Smrg	GUESS=sparc-unknown-linux-$LIBC
1104219ffec0Smrg	;;
1105c3f70f0aSmrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
1106219ffec0Smrg	GUESS=hppa64-unknown-linux-$LIBC
1107219ffec0Smrg	;;
110897e8a2e8Smrg    parisc:Linux:*:* | hppa:Linux:*:*)
110997e8a2e8Smrg	# Look for CPU level
111097e8a2e8Smrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
1111219ffec0Smrg	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
1112219ffec0Smrg	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
1113219ffec0Smrg	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
111497e8a2e8Smrg	esac
1115219ffec0Smrg	;;
1116c3f70f0aSmrg    ppc64:Linux:*:*)
1117219ffec0Smrg	GUESS=powerpc64-unknown-linux-$LIBC
1118219ffec0Smrg	;;
1119c3f70f0aSmrg    ppc:Linux:*:*)
1120219ffec0Smrg	GUESS=powerpc-unknown-linux-$LIBC
1121219ffec0Smrg	;;
112268af480fSmrg    ppc64le:Linux:*:*)
1123219ffec0Smrg	GUESS=powerpc64le-unknown-linux-$LIBC
1124219ffec0Smrg	;;
112568af480fSmrg    ppcle:Linux:*:*)
1126219ffec0Smrg	GUESS=powerpcle-unknown-linux-$LIBC
1127219ffec0Smrg	;;
1128219ffec0Smrg    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
1129219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1130219ffec0Smrg	;;
113197e8a2e8Smrg    s390:Linux:*:* | s390x:Linux:*:*)
1132219ffec0Smrg	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
1133219ffec0Smrg	;;
113497e8a2e8Smrg    sh64*:Linux:*:*)
1135219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1136219ffec0Smrg	;;
113797e8a2e8Smrg    sh*:Linux:*:*)
1138219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1139219ffec0Smrg	;;
114097e8a2e8Smrg    sparc:Linux:*:* | sparc64:Linux:*:*)
1141219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1142219ffec0Smrg	;;
1143c3f70f0aSmrg    tile*:Linux:*:*)
1144219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1145219ffec0Smrg	;;
1146d7accfefSmrg    vax:Linux:*:*)
1147219ffec0Smrg	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
1148219ffec0Smrg	;;
114997e8a2e8Smrg    x86_64:Linux:*:*)
1150219ffec0Smrg	set_cc_for_build
1151219ffec0Smrg	LIBCABI=$LIBC
1152219ffec0Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
1153219ffec0Smrg	    if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
1154219ffec0Smrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1155219ffec0Smrg		grep IS_X32 >/dev/null
1156219ffec0Smrg	    then
1157219ffec0Smrg		LIBCABI=${LIBC}x32
1158219ffec0Smrg	    fi
1159219ffec0Smrg	fi
1160219ffec0Smrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBCABI
1161219ffec0Smrg	;;
1162d7accfefSmrg    xtensa*:Linux:*:*)
1163219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1164219ffec0Smrg	;;
116597e8a2e8Smrg    i*86:DYNIX/ptx:4*:*)
116697e8a2e8Smrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
116797e8a2e8Smrg	# earlier versions are messed up and put the nodename in both
116897e8a2e8Smrg	# sysname and nodename.
1169219ffec0Smrg	GUESS=i386-sequent-sysv4
1170219ffec0Smrg	;;
117197e8a2e8Smrg    i*86:UNIX_SV:4.2MP:2.*)
117268af480fSmrg	# Unixware is an offshoot of SVR4, but it has its own version
117368af480fSmrg	# number series starting with 2...
117468af480fSmrg	# I am not positive that other SVR4 systems won't match this,
117597e8a2e8Smrg	# I just have to hope.  -- rms.
117668af480fSmrg	# Use sysv4.2uw... so that sysv4* matches it.
1177219ffec0Smrg	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
1178219ffec0Smrg	;;
117997e8a2e8Smrg    i*86:OS/2:*:*)
118097e8a2e8Smrg	# If we were able to find `uname', then EMX Unix compatibility
118197e8a2e8Smrg	# is probably installed.
1182219ffec0Smrg	GUESS=$UNAME_MACHINE-pc-os2-emx
1183219ffec0Smrg	;;
118497e8a2e8Smrg    i*86:XTS-300:*:STOP)
1185219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-stop
1186219ffec0Smrg	;;
118797e8a2e8Smrg    i*86:atheos:*:*)
1188219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-atheos
1189219ffec0Smrg	;;
1190d7accfefSmrg    i*86:syllable:*:*)
1191219ffec0Smrg	GUESS=$UNAME_MACHINE-pc-syllable
1192219ffec0Smrg	;;
1193c3f70f0aSmrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1194219ffec0Smrg	GUESS=i386-unknown-lynxos$UNAME_RELEASE
1195219ffec0Smrg	;;
119697e8a2e8Smrg    i*86:*DOS:*:*)
1197219ffec0Smrg	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
1198219ffec0Smrg	;;
1199219ffec0Smrg    i*86:*:4.*:*)
1200219ffec0Smrg	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
120197e8a2e8Smrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1202219ffec0Smrg		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
120397e8a2e8Smrg	else
1204219ffec0Smrg		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
120597e8a2e8Smrg	fi
1206219ffec0Smrg	;;
1207d7accfefSmrg    i*86:*:5:[678]*)
120868af480fSmrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
120997e8a2e8Smrg	case `/bin/uname -X | grep "^Machine"` in
121097e8a2e8Smrg	    *486*)	     UNAME_MACHINE=i486 ;;
121197e8a2e8Smrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
121297e8a2e8Smrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
121397e8a2e8Smrg	esac
1214219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1215219ffec0Smrg	;;
121697e8a2e8Smrg    i*86:*:3.2:*)
121797e8a2e8Smrg	if test -f /usr/options/cb.name; then
121897e8a2e8Smrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1219219ffec0Smrg		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
122097e8a2e8Smrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
122197e8a2e8Smrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
122297e8a2e8Smrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
122397e8a2e8Smrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
122497e8a2e8Smrg			&& UNAME_MACHINE=i586
122597e8a2e8Smrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
122697e8a2e8Smrg			&& UNAME_MACHINE=i686
122797e8a2e8Smrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
122897e8a2e8Smrg			&& UNAME_MACHINE=i686
1229219ffec0Smrg		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
123097e8a2e8Smrg	else
1231219ffec0Smrg		GUESS=$UNAME_MACHINE-pc-sysv32
123297e8a2e8Smrg	fi
1233219ffec0Smrg	;;
123497e8a2e8Smrg    pc:*:*:*)
123597e8a2e8Smrg	# Left here for compatibility:
123668af480fSmrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
123768af480fSmrg	# the processor, so we play safe by assuming i586.
1238d7accfefSmrg	# Note: whatever this is, it MUST be the same as what config.sub
1239219ffec0Smrg	# prints for the "djgpp" host, or else GDB configure will decide that
1240d7accfefSmrg	# this is a cross-build.
1241219ffec0Smrg	GUESS=i586-pc-msdosdjgpp
1242219ffec0Smrg	;;
124397e8a2e8Smrg    Intel:Mach:3*:*)
1244219ffec0Smrg	GUESS=i386-pc-mach3
1245219ffec0Smrg	;;
124697e8a2e8Smrg    paragon:*:*:*)
1247219ffec0Smrg	GUESS=i860-intel-osf1
1248219ffec0Smrg	;;
124997e8a2e8Smrg    i860:*:4.*:*) # i860-SVR4
125097e8a2e8Smrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1251219ffec0Smrg	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
125297e8a2e8Smrg	else # Add other i860-SVR4 vendors below as they are discovered.
1253219ffec0Smrg	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
125497e8a2e8Smrg	fi
1255219ffec0Smrg	;;
125697e8a2e8Smrg    mini*:CTIX:SYS*5:*)
125797e8a2e8Smrg	# "miniframe"
1258219ffec0Smrg	GUESS=m68010-convergent-sysv
1259219ffec0Smrg	;;
126097e8a2e8Smrg    mc68k:UNIX:SYSTEM5:3.51m)
1261219ffec0Smrg	GUESS=m68k-convergent-sysv
1262219ffec0Smrg	;;
126397e8a2e8Smrg    M680?0:D-NIX:5.3:*)
1264219ffec0Smrg	GUESS=m68k-diab-dnix
1265219ffec0Smrg	;;
1266d7accfefSmrg    M68*:*:R3V[5678]*:*)
1267d7accfefSmrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1268d7accfefSmrg    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)
126997e8a2e8Smrg	OS_REL=''
127097e8a2e8Smrg	test -r /etc/.relid \
127197e8a2e8Smrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
127297e8a2e8Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1273219ffec0Smrg	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
127497e8a2e8Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1275219ffec0Smrg	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
127697e8a2e8Smrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
127768af480fSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
127868af480fSmrg	  && { echo i486-ncr-sysv4; exit; } ;;
1279d7accfefSmrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1280d7accfefSmrg	OS_REL='.3'
1281d7accfefSmrg	test -r /etc/.relid \
1282d7accfefSmrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1283d7accfefSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1284219ffec0Smrg	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1285d7accfefSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1286219ffec0Smrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
1287d7accfefSmrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1288219ffec0Smrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
128997e8a2e8Smrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1290219ffec0Smrg	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
1291219ffec0Smrg	;;
129297e8a2e8Smrg    mc68030:UNIX_System_V:4.*:*)
1293219ffec0Smrg	GUESS=m68k-atari-sysv4
1294219ffec0Smrg	;;
129597e8a2e8Smrg    TSUNAMI:LynxOS:2.*:*)
1296219ffec0Smrg	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
1297219ffec0Smrg	;;
129897e8a2e8Smrg    rs6000:LynxOS:2.*:*)
1299219ffec0Smrg	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
1300219ffec0Smrg	;;
1301c3f70f0aSmrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1302219ffec0Smrg	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
1303219ffec0Smrg	;;
130497e8a2e8Smrg    SM[BE]S:UNIX_SV:*:*)
1305219ffec0Smrg	GUESS=mips-dde-sysv$UNAME_RELEASE
1306219ffec0Smrg	;;
130797e8a2e8Smrg    RM*:ReliantUNIX-*:*:*)
1308219ffec0Smrg	GUESS=mips-sni-sysv4
1309219ffec0Smrg	;;
131097e8a2e8Smrg    RM*:SINIX-*:*:*)
1311219ffec0Smrg	GUESS=mips-sni-sysv4
1312219ffec0Smrg	;;
131397e8a2e8Smrg    *:SINIX-*:*:*)
131497e8a2e8Smrg	if uname -p 2>/dev/null >/dev/null ; then
131597e8a2e8Smrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1316219ffec0Smrg		GUESS=$UNAME_MACHINE-sni-sysv4
131797e8a2e8Smrg	else
1318219ffec0Smrg		GUESS=ns32k-sni-sysv
131997e8a2e8Smrg	fi
1320219ffec0Smrg	;;
132168af480fSmrg    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
132268af480fSmrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
1323219ffec0Smrg	GUESS=i586-unisys-sysv4
1324219ffec0Smrg	;;
132597e8a2e8Smrg    *:UNIX_System_V:4*:FTX*)
132697e8a2e8Smrg	# From Gerald Hewes <hewes@openmarket.com>.
132797e8a2e8Smrg	# How about differentiating between stratus architectures? -djm
1328219ffec0Smrg	GUESS=hppa1.1-stratus-sysv4
1329219ffec0Smrg	;;
133097e8a2e8Smrg    *:*:*:FTX*)
133197e8a2e8Smrg	# From seanf@swdc.stratus.com.
1332219ffec0Smrg	GUESS=i860-stratus-sysv4
1333219ffec0Smrg	;;
1334d7accfefSmrg    i*86:VOS:*:*)
1335d7accfefSmrg	# From Paul.Green@stratus.com.
1336219ffec0Smrg	GUESS=$UNAME_MACHINE-stratus-vos
1337219ffec0Smrg	;;
133897e8a2e8Smrg    *:VOS:*:*)
133997e8a2e8Smrg	# From Paul.Green@stratus.com.
1340219ffec0Smrg	GUESS=hppa1.1-stratus-vos
1341219ffec0Smrg	;;
134297e8a2e8Smrg    mc68*:A/UX:*:*)
1343219ffec0Smrg	GUESS=m68k-apple-aux$UNAME_RELEASE
1344219ffec0Smrg	;;
134597e8a2e8Smrg    news*:NEWS-OS:6*:*)
1346219ffec0Smrg	GUESS=mips-sony-newsos6
1347219ffec0Smrg	;;
134897e8a2e8Smrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1349219ffec0Smrg	if test -d /usr/nec; then
1350219ffec0Smrg		GUESS=mips-nec-sysv$UNAME_RELEASE
135197e8a2e8Smrg	else
1352219ffec0Smrg		GUESS=mips-unknown-sysv$UNAME_RELEASE
135397e8a2e8Smrg	fi
1354219ffec0Smrg	;;
135597e8a2e8Smrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1356219ffec0Smrg	GUESS=powerpc-be-beos
1357219ffec0Smrg	;;
135897e8a2e8Smrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1359219ffec0Smrg	GUESS=powerpc-apple-beos
1360219ffec0Smrg	;;
136197e8a2e8Smrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1362219ffec0Smrg	GUESS=i586-pc-beos
1363219ffec0Smrg	;;
1364d7accfefSmrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
1365219ffec0Smrg	GUESS=i586-pc-haiku
1366219ffec0Smrg	;;
136768af480fSmrg    x86_64:Haiku:*:*)
1368219ffec0Smrg	GUESS=x86_64-unknown-haiku
1369219ffec0Smrg	;;
137097e8a2e8Smrg    SX-4:SUPER-UX:*:*)
1371219ffec0Smrg	GUESS=sx4-nec-superux$UNAME_RELEASE
1372219ffec0Smrg	;;
137397e8a2e8Smrg    SX-5:SUPER-UX:*:*)
1374219ffec0Smrg	GUESS=sx5-nec-superux$UNAME_RELEASE
1375219ffec0Smrg	;;
137697e8a2e8Smrg    SX-6:SUPER-UX:*:*)
1377219ffec0Smrg	GUESS=sx6-nec-superux$UNAME_RELEASE
1378219ffec0Smrg	;;
1379d7accfefSmrg    SX-7:SUPER-UX:*:*)
1380219ffec0Smrg	GUESS=sx7-nec-superux$UNAME_RELEASE
1381219ffec0Smrg	;;
1382d7accfefSmrg    SX-8:SUPER-UX:*:*)
1383219ffec0Smrg	GUESS=sx8-nec-superux$UNAME_RELEASE
1384219ffec0Smrg	;;
1385d7accfefSmrg    SX-8R:SUPER-UX:*:*)
1386219ffec0Smrg	GUESS=sx8r-nec-superux$UNAME_RELEASE
1387219ffec0Smrg	;;
1388219ffec0Smrg    SX-ACE:SUPER-UX:*:*)
1389219ffec0Smrg	GUESS=sxace-nec-superux$UNAME_RELEASE
1390219ffec0Smrg	;;
139197e8a2e8Smrg    Power*:Rhapsody:*:*)
1392219ffec0Smrg	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
1393219ffec0Smrg	;;
139497e8a2e8Smrg    *:Rhapsody:*:*)
1395219ffec0Smrg	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
1396219ffec0Smrg	;;
1397219ffec0Smrg    arm64:Darwin:*:*)
1398219ffec0Smrg	GUESS=aarch64-apple-darwin$UNAME_RELEASE
1399219ffec0Smrg	;;
140097e8a2e8Smrg    *:Darwin:*:*)
1401219ffec0Smrg	UNAME_PROCESSOR=`uname -p`
1402219ffec0Smrg	case $UNAME_PROCESSOR in
1403219ffec0Smrg	    unknown) UNAME_PROCESSOR=powerpc ;;
1404219ffec0Smrg	esac
1405219ffec0Smrg	if command -v xcode-select > /dev/null 2> /dev/null && \
1406219ffec0Smrg		! xcode-select --print-path > /dev/null 2> /dev/null ; then
1407219ffec0Smrg	    # Avoid executing cc if there is no toolchain installed as
1408219ffec0Smrg	    # cc will be a stub that puts up a graphical alert
1409219ffec0Smrg	    # prompting the user to install developer tools.
1410219ffec0Smrg	    CC_FOR_BUILD=no_compiler_found
1411219ffec0Smrg	else
1412219ffec0Smrg	    set_cc_for_build
141368af480fSmrg	fi
1414219ffec0Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
141568af480fSmrg	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1416219ffec0Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1417219ffec0Smrg		   grep IS_64BIT_ARCH >/dev/null
141868af480fSmrg	    then
141968af480fSmrg		case $UNAME_PROCESSOR in
142068af480fSmrg		    i386) UNAME_PROCESSOR=x86_64 ;;
142168af480fSmrg		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
142268af480fSmrg		esac
142368af480fSmrg	    fi
1424219ffec0Smrg	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
1425219ffec0Smrg	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
1426219ffec0Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1427219ffec0Smrg		   grep IS_PPC >/dev/null
1428219ffec0Smrg	    then
1429219ffec0Smrg		UNAME_PROCESSOR=powerpc
1430219ffec0Smrg	    fi
1431219ffec0Smrg	elif test "$UNAME_PROCESSOR" = i386 ; then
1432219ffec0Smrg	    # uname -m returns i386 or x86_64
1433219ffec0Smrg	    UNAME_PROCESSOR=$UNAME_MACHINE
143468af480fSmrg	fi
1435219ffec0Smrg	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
1436219ffec0Smrg	;;
143797e8a2e8Smrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
143897e8a2e8Smrg	UNAME_PROCESSOR=`uname -p`
1439219ffec0Smrg	if test "$UNAME_PROCESSOR" = x86; then
144097e8a2e8Smrg		UNAME_PROCESSOR=i386
144197e8a2e8Smrg		UNAME_MACHINE=pc
144297e8a2e8Smrg	fi
1443219ffec0Smrg	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
1444219ffec0Smrg	;;
144597e8a2e8Smrg    *:QNX:*:4*)
1446219ffec0Smrg	GUESS=i386-pc-qnx
1447219ffec0Smrg	;;
1448219ffec0Smrg    NEO-*:NONSTOP_KERNEL:*:*)
1449219ffec0Smrg	GUESS=neo-tandem-nsk$UNAME_RELEASE
1450219ffec0Smrg	;;
145168af480fSmrg    NSE-*:NONSTOP_KERNEL:*:*)
1452219ffec0Smrg	GUESS=nse-tandem-nsk$UNAME_RELEASE
1453219ffec0Smrg	;;
1454219ffec0Smrg    NSR-*:NONSTOP_KERNEL:*:*)
1455219ffec0Smrg	GUESS=nsr-tandem-nsk$UNAME_RELEASE
1456219ffec0Smrg	;;
1457219ffec0Smrg    NSV-*:NONSTOP_KERNEL:*:*)
1458219ffec0Smrg	GUESS=nsv-tandem-nsk$UNAME_RELEASE
1459219ffec0Smrg	;;
1460219ffec0Smrg    NSX-*:NONSTOP_KERNEL:*:*)
1461219ffec0Smrg	GUESS=nsx-tandem-nsk$UNAME_RELEASE
1462219ffec0Smrg	;;
146397e8a2e8Smrg    *:NonStop-UX:*:*)
1464219ffec0Smrg	GUESS=mips-compaq-nonstopux
1465219ffec0Smrg	;;
146697e8a2e8Smrg    BS2000:POSIX*:*:*)
1467219ffec0Smrg	GUESS=bs2000-siemens-sysv
1468219ffec0Smrg	;;
146997e8a2e8Smrg    DS/*:UNIX_System_V:*:*)
1470219ffec0Smrg	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
1471219ffec0Smrg	;;
147297e8a2e8Smrg    *:Plan9:*:*)
147397e8a2e8Smrg	# "uname -m" is not consistent, so use $cputype instead. 386
147497e8a2e8Smrg	# is converted to i386 for consistency with other x86
147597e8a2e8Smrg	# operating systems.
1476219ffec0Smrg	if test "${cputype-}" = 386; then
147797e8a2e8Smrg	    UNAME_MACHINE=i386
1478219ffec0Smrg	elif test "x${cputype-}" != x; then
1479219ffec0Smrg	    UNAME_MACHINE=$cputype
148097e8a2e8Smrg	fi
1481219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-plan9
1482219ffec0Smrg	;;
148397e8a2e8Smrg    *:TOPS-10:*:*)
1484219ffec0Smrg	GUESS=pdp10-unknown-tops10
1485219ffec0Smrg	;;
148697e8a2e8Smrg    *:TENEX:*:*)
1487219ffec0Smrg	GUESS=pdp10-unknown-tenex
1488219ffec0Smrg	;;
148997e8a2e8Smrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1490219ffec0Smrg	GUESS=pdp10-dec-tops20
1491219ffec0Smrg	;;
149297e8a2e8Smrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1493219ffec0Smrg	GUESS=pdp10-xkl-tops20
1494219ffec0Smrg	;;
149597e8a2e8Smrg    *:TOPS-20:*:*)
1496219ffec0Smrg	GUESS=pdp10-unknown-tops20
1497219ffec0Smrg	;;
149897e8a2e8Smrg    *:ITS:*:*)
1499219ffec0Smrg	GUESS=pdp10-unknown-its
1500219ffec0Smrg	;;
150197e8a2e8Smrg    SEI:*:*:SEIUX)
1502219ffec0Smrg	GUESS=mips-sei-seiux$UNAME_RELEASE
1503219ffec0Smrg	;;
1504d7accfefSmrg    *:DragonFly:*:*)
1505219ffec0Smrg	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
1506219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
1507219ffec0Smrg	;;
1508d7accfefSmrg    *:*VMS:*:*)
150968af480fSmrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1510219ffec0Smrg	case $UNAME_MACHINE in
1511219ffec0Smrg	    A*) GUESS=alpha-dec-vms ;;
1512219ffec0Smrg	    I*) GUESS=ia64-dec-vms ;;
1513219ffec0Smrg	    V*) GUESS=vax-dec-vms ;;
1514d7accfefSmrg	esac ;;
1515d7accfefSmrg    *:XENIX:*:SysV)
1516219ffec0Smrg	GUESS=i386-pc-xenix
1517219ffec0Smrg	;;
1518d7accfefSmrg    i*86:skyos:*:*)
1519219ffec0Smrg	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
1520219ffec0Smrg	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
1521219ffec0Smrg	;;
1522d7accfefSmrg    i*86:rdos:*:*)
1523219ffec0Smrg	GUESS=$UNAME_MACHINE-pc-rdos
1524219ffec0Smrg	;;
1525219ffec0Smrg    *:AROS:*:*)
1526219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-aros
1527219ffec0Smrg	;;
152868af480fSmrg    x86_64:VMkernel:*:*)
1529219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-esx
1530219ffec0Smrg	;;
1531219ffec0Smrg    amd64:Isilon\ OneFS:*:*)
1532219ffec0Smrg	GUESS=x86_64-unknown-onefs
1533219ffec0Smrg	;;
1534219ffec0Smrg    *:Unleashed:*:*)
1535219ffec0Smrg	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
1536219ffec0Smrg	;;
153797e8a2e8Smrgesac
153897e8a2e8Smrg
1539219ffec0Smrg# Do we have a guess based on uname results?
1540219ffec0Smrgif test "x$GUESS" != x; then
1541219ffec0Smrg    echo "$GUESS"
1542219ffec0Smrg    exit
1543219ffec0Smrgfi
1544219ffec0Smrg
1545219ffec0Smrg# No uname command or uname output not recognized.
1546219ffec0Smrgset_cc_for_build
1547219ffec0Smrgcat > "$dummy.c" <<EOF
154897e8a2e8Smrg#ifdef _SEQUENT_
1549219ffec0Smrg#include <sys/types.h>
1550219ffec0Smrg#include <sys/utsname.h>
1551219ffec0Smrg#endif
1552219ffec0Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1553219ffec0Smrg#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1554219ffec0Smrg#include <signal.h>
1555219ffec0Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
1556219ffec0Smrg#include <sys/utsname.h>
1557219ffec0Smrg#endif
1558219ffec0Smrg#endif
155997e8a2e8Smrg#endif
156097e8a2e8Smrgmain ()
156197e8a2e8Smrg{
156297e8a2e8Smrg#if defined (sony)
156397e8a2e8Smrg#if defined (MIPSEB)
156497e8a2e8Smrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
156597e8a2e8Smrg     I don't know....  */
156697e8a2e8Smrg  printf ("mips-sony-bsd\n"); exit (0);
156797e8a2e8Smrg#else
156897e8a2e8Smrg#include <sys/param.h>
156997e8a2e8Smrg  printf ("m68k-sony-newsos%s\n",
157097e8a2e8Smrg#ifdef NEWSOS4
1571219ffec0Smrg  "4"
157297e8a2e8Smrg#else
1573219ffec0Smrg  ""
157497e8a2e8Smrg#endif
1575219ffec0Smrg  ); exit (0);
157697e8a2e8Smrg#endif
157797e8a2e8Smrg#endif
157897e8a2e8Smrg
157997e8a2e8Smrg#if defined (NeXT)
158097e8a2e8Smrg#if !defined (__ARCHITECTURE__)
158197e8a2e8Smrg#define __ARCHITECTURE__ "m68k"
158297e8a2e8Smrg#endif
158397e8a2e8Smrg  int version;
158497e8a2e8Smrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
158597e8a2e8Smrg  if (version < 4)
158697e8a2e8Smrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
158797e8a2e8Smrg  else
158897e8a2e8Smrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
158997e8a2e8Smrg  exit (0);
159097e8a2e8Smrg#endif
159197e8a2e8Smrg
159297e8a2e8Smrg#if defined (MULTIMAX) || defined (n16)
159397e8a2e8Smrg#if defined (UMAXV)
159497e8a2e8Smrg  printf ("ns32k-encore-sysv\n"); exit (0);
159597e8a2e8Smrg#else
159697e8a2e8Smrg#if defined (CMU)
159797e8a2e8Smrg  printf ("ns32k-encore-mach\n"); exit (0);
159897e8a2e8Smrg#else
159997e8a2e8Smrg  printf ("ns32k-encore-bsd\n"); exit (0);
160097e8a2e8Smrg#endif
160197e8a2e8Smrg#endif
160297e8a2e8Smrg#endif
160397e8a2e8Smrg
160497e8a2e8Smrg#if defined (__386BSD__)
160597e8a2e8Smrg  printf ("i386-pc-bsd\n"); exit (0);
160697e8a2e8Smrg#endif
160797e8a2e8Smrg
160897e8a2e8Smrg#if defined (sequent)
160997e8a2e8Smrg#if defined (i386)
161097e8a2e8Smrg  printf ("i386-sequent-dynix\n"); exit (0);
161197e8a2e8Smrg#endif
161297e8a2e8Smrg#if defined (ns32000)
161397e8a2e8Smrg  printf ("ns32k-sequent-dynix\n"); exit (0);
161497e8a2e8Smrg#endif
161597e8a2e8Smrg#endif
161697e8a2e8Smrg
161797e8a2e8Smrg#if defined (_SEQUENT_)
1618219ffec0Smrg  struct utsname un;
161997e8a2e8Smrg
1620219ffec0Smrg  uname(&un);
1621219ffec0Smrg  if (strncmp(un.version, "V2", 2) == 0) {
1622219ffec0Smrg    printf ("i386-sequent-ptx2\n"); exit (0);
1623219ffec0Smrg  }
1624219ffec0Smrg  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1625219ffec0Smrg    printf ("i386-sequent-ptx1\n"); exit (0);
1626219ffec0Smrg  }
1627219ffec0Smrg  printf ("i386-sequent-ptx\n"); exit (0);
162897e8a2e8Smrg#endif
162997e8a2e8Smrg
163097e8a2e8Smrg#if defined (vax)
1631219ffec0Smrg#if !defined (ultrix)
1632219ffec0Smrg#include <sys/param.h>
1633219ffec0Smrg#if defined (BSD)
1634219ffec0Smrg#if BSD == 43
1635219ffec0Smrg  printf ("vax-dec-bsd4.3\n"); exit (0);
1636219ffec0Smrg#else
1637219ffec0Smrg#if BSD == 199006
1638219ffec0Smrg  printf ("vax-dec-bsd4.3reno\n"); exit (0);
1639219ffec0Smrg#else
1640219ffec0Smrg  printf ("vax-dec-bsd\n"); exit (0);
1641219ffec0Smrg#endif
1642219ffec0Smrg#endif
1643219ffec0Smrg#else
1644219ffec0Smrg  printf ("vax-dec-bsd\n"); exit (0);
1645219ffec0Smrg#endif
1646219ffec0Smrg#else
1647219ffec0Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
1648219ffec0Smrg  struct utsname un;
1649219ffec0Smrg  uname (&un);
1650219ffec0Smrg  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
1651219ffec0Smrg#else
1652219ffec0Smrg  printf ("vax-dec-ultrix\n"); exit (0);
1653219ffec0Smrg#endif
1654219ffec0Smrg#endif
1655219ffec0Smrg#endif
1656219ffec0Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1657219ffec0Smrg#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1658219ffec0Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
1659219ffec0Smrg  struct utsname *un;
1660219ffec0Smrg  uname (&un);
1661219ffec0Smrg  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
1662219ffec0Smrg#else
1663219ffec0Smrg  printf ("mips-dec-ultrix\n"); exit (0);
1664219ffec0Smrg#endif
1665219ffec0Smrg#endif
166697e8a2e8Smrg#endif
166797e8a2e8Smrg
166897e8a2e8Smrg#if defined (alliant) && defined (i860)
166997e8a2e8Smrg  printf ("i860-alliant-bsd\n"); exit (0);
167097e8a2e8Smrg#endif
167197e8a2e8Smrg
167297e8a2e8Smrg  exit (1);
167397e8a2e8Smrg}
167497e8a2e8SmrgEOF
167597e8a2e8Smrg
1676219ffec0Smrg$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
1677d7accfefSmrg	{ echo "$SYSTEM_NAME"; exit; }
167897e8a2e8Smrg
167997e8a2e8Smrg# Apollos put the system type in the environment.
1680219ffec0Smrgtest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
168197e8a2e8Smrg
1682219ffec0Smrgecho "$0: unable to guess system type" >&2
168397e8a2e8Smrg
1684219ffec0Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM in
1685219ffec0Smrg    mips:Linux | mips64:Linux)
1686219ffec0Smrg	# If we got here on MIPS GNU/Linux, output extra information.
1687219ffec0Smrg	cat >&2 <<EOF
168897e8a2e8Smrg
1689219ffec0SmrgNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
1690219ffec0Smrgthe system type. Please install a C compiler and try again.
1691219ffec0SmrgEOF
1692219ffec0Smrg	;;
1693219ffec0Smrgesac
169497e8a2e8Smrg
169597e8a2e8Smrgcat >&2 <<EOF
169697e8a2e8Smrg
1697219ffec0SmrgThis script (version $timestamp), has failed to recognize the
1698219ffec0Smrgoperating system you are using. If your script is old, overwrite *all*
1699219ffec0Smrgcopies of config.guess and config.sub with the latest versions from:
170097e8a2e8Smrg
1701219ffec0Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
1702d7accfefSmrgand
1703219ffec0Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
1704219ffec0SmrgEOF
170597e8a2e8Smrg
1706219ffec0Smrgour_year=`echo $timestamp | sed 's,-.*,,'`
1707219ffec0Smrgthisyear=`date +%Y`
1708219ffec0Smrg# shellcheck disable=SC2003
1709219ffec0Smrgscript_age=`expr "$thisyear" - "$our_year"`
1710219ffec0Smrgif test "$script_age" -lt 3 ; then
1711219ffec0Smrg   cat >&2 <<EOF
1712219ffec0Smrg
1713219ffec0SmrgIf $0 has already been updated, send the following data and any
1714219ffec0Smrginformation you think might be pertinent to config-patches@gnu.org to
1715219ffec0Smrgprovide the necessary information to handle your system.
171697e8a2e8Smrg
171797e8a2e8Smrgconfig.guess timestamp = $timestamp
171897e8a2e8Smrg
171997e8a2e8Smrguname -m = `(uname -m) 2>/dev/null || echo unknown`
172097e8a2e8Smrguname -r = `(uname -r) 2>/dev/null || echo unknown`
172197e8a2e8Smrguname -s = `(uname -s) 2>/dev/null || echo unknown`
172297e8a2e8Smrguname -v = `(uname -v) 2>/dev/null || echo unknown`
172397e8a2e8Smrg
172497e8a2e8Smrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
172597e8a2e8Smrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
172697e8a2e8Smrg
172797e8a2e8Smrghostinfo               = `(hostinfo) 2>/dev/null`
172897e8a2e8Smrg/bin/universe          = `(/bin/universe) 2>/dev/null`
172997e8a2e8Smrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
173097e8a2e8Smrg/bin/arch              = `(/bin/arch) 2>/dev/null`
173197e8a2e8Smrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
173297e8a2e8Smrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
173397e8a2e8Smrg
1734219ffec0SmrgUNAME_MACHINE = "$UNAME_MACHINE"
1735219ffec0SmrgUNAME_RELEASE = "$UNAME_RELEASE"
1736219ffec0SmrgUNAME_SYSTEM  = "$UNAME_SYSTEM"
1737219ffec0SmrgUNAME_VERSION = "$UNAME_VERSION"
173897e8a2e8SmrgEOF
1739219ffec0Smrgfi
174097e8a2e8Smrg
174197e8a2e8Smrgexit 1
174297e8a2e8Smrg
174397e8a2e8Smrg# Local variables:
1744219ffec0Smrg# eval: (add-hook 'before-save-hook 'time-stamp)
174597e8a2e8Smrg# time-stamp-start: "timestamp='"
174697e8a2e8Smrg# time-stamp-format: "%:y-%02m-%02d"
174797e8a2e8Smrg# time-stamp-end: "'"
174897e8a2e8Smrg# End:
1749