config.guess revision 084f91cc
19bd41f2cSmrg#! /bin/sh
29bd41f2cSmrg# Attempt to guess a canonical system name.
3084f91ccSmrg#   Copyright 1992-2022 Free Software Foundation, Inc.
49bd41f2cSmrg
5084f91ccSmrg# shellcheck disable=SC2006,SC2268 # see below for rationale
6084f91ccSmrg
7084f91ccSmrgtimestamp='2022-05-08'
89bd41f2cSmrg
99bd41f2cSmrg# This file is free software; you can redistribute it and/or modify it
109bd41f2cSmrg# under the terms of the GNU General Public License as published by
11084f91ccSmrg# the Free Software Foundation, either version 3 of the License, or
129bd41f2cSmrg# (at your option) any later version.
139bd41f2cSmrg#
149bd41f2cSmrg# This program is distributed in the hope that it will be useful, but
159bd41f2cSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
169bd41f2cSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
179bd41f2cSmrg# General Public License for more details.
189bd41f2cSmrg#
199bd41f2cSmrg# You should have received a copy of the GNU General Public License
20084f91ccSmrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
219bd41f2cSmrg#
229bd41f2cSmrg# As a special exception to the GNU General Public License, if you
239bd41f2cSmrg# distribute this file as part of a program that contains a
249bd41f2cSmrg# configuration script generated by Autoconf, you may include it under
25084f91ccSmrg# the same distribution terms that you use for the rest of that
26084f91ccSmrg# program.  This Exception is an additional permission under section 7
27084f91ccSmrg# of the GNU General Public License, version 3 ("GPLv3").
289bd41f2cSmrg#
29084f91ccSmrg# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
309bd41f2cSmrg#
310da4cdccSmrg# You can get the latest version of this script from:
32084f91ccSmrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
33084f91ccSmrg#
34084f91ccSmrg# Please send patches to <config-patches@gnu.org>.
35084f91ccSmrg
36084f91ccSmrg
37084f91ccSmrg# The "shellcheck disable" line above the timestamp inhibits complaints
38084f91ccSmrg# about features and limitations of the classic Bourne shell that were
39084f91ccSmrg# superseded or lifted in POSIX.  However, this script identifies a wide
40084f91ccSmrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
41084f91ccSmrg# even some reasonably current systems (Solaris 10 as case-in-point) still
42084f91ccSmrg# have a pre-POSIX /bin/sh.
43084f91ccSmrg
449bd41f2cSmrg
459bd41f2cSmrgme=`echo "$0" | sed -e 's,.*/,,'`
469bd41f2cSmrg
479bd41f2cSmrgusage="\
489bd41f2cSmrgUsage: $0 [OPTION]
499bd41f2cSmrg
509bd41f2cSmrgOutput the configuration name of the system \`$me' is run on.
519bd41f2cSmrg
52084f91ccSmrgOptions:
539bd41f2cSmrg  -h, --help         print this help, then exit
549bd41f2cSmrg  -t, --time-stamp   print date of last modification, then exit
559bd41f2cSmrg  -v, --version      print version number, then exit
569bd41f2cSmrg
579bd41f2cSmrgReport bugs and patches to <config-patches@gnu.org>."
589bd41f2cSmrg
599bd41f2cSmrgversion="\
609bd41f2cSmrgGNU config.guess ($timestamp)
619bd41f2cSmrg
629bd41f2cSmrgOriginally written by Per Bothner.
63084f91ccSmrgCopyright 1992-2022 Free Software Foundation, Inc.
649bd41f2cSmrg
659bd41f2cSmrgThis is free software; see the source for copying conditions.  There is NO
669bd41f2cSmrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
679bd41f2cSmrg
689bd41f2cSmrghelp="
699bd41f2cSmrgTry \`$me --help' for more information."
709bd41f2cSmrg
719bd41f2cSmrg# Parse command line
729bd41f2cSmrgwhile test $# -gt 0 ; do
739bd41f2cSmrg  case $1 in
749bd41f2cSmrg    --time-stamp | --time* | -t )
759bd41f2cSmrg       echo "$timestamp" ; exit ;;
769bd41f2cSmrg    --version | -v )
779bd41f2cSmrg       echo "$version" ; exit ;;
789bd41f2cSmrg    --help | --h* | -h )
799bd41f2cSmrg       echo "$usage"; exit ;;
809bd41f2cSmrg    -- )     # Stop option processing
819bd41f2cSmrg       shift; break ;;
829bd41f2cSmrg    - )	# Use stdin as input.
839bd41f2cSmrg       break ;;
849bd41f2cSmrg    -* )
859bd41f2cSmrg       echo "$me: invalid option $1$help" >&2
869bd41f2cSmrg       exit 1 ;;
879bd41f2cSmrg    * )
889bd41f2cSmrg       break ;;
899bd41f2cSmrg  esac
909bd41f2cSmrgdone
919bd41f2cSmrg
929bd41f2cSmrgif test $# != 0; then
939bd41f2cSmrg  echo "$me: too many arguments$help" >&2
949bd41f2cSmrg  exit 1
959bd41f2cSmrgfi
969bd41f2cSmrg
97084f91ccSmrg# Just in case it came from the environment.
98084f91ccSmrgGUESS=
999bd41f2cSmrg
1009bd41f2cSmrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
1019bd41f2cSmrg# compiler to aid in system detection is discouraged as it requires
1029bd41f2cSmrg# temporary files to be created and, as you can see below, it is a
1039bd41f2cSmrg# headache to deal with in a portable fashion.
1049bd41f2cSmrg
1059bd41f2cSmrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
1069bd41f2cSmrg# use `HOST_CC' if defined, but it is deprecated.
1079bd41f2cSmrg
1089bd41f2cSmrg# Portable tmp directory creation inspired by the Autoconf team.
1099bd41f2cSmrg
110084f91ccSmrgtmp=
111084f91ccSmrg# shellcheck disable=SC2172
112084f91ccSmrgtrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
113084f91ccSmrg
114084f91ccSmrgset_cc_for_build() {
115084f91ccSmrg    # prevent multiple calls if $tmp is already set
116084f91ccSmrg    test "$tmp" && return 0
117084f91ccSmrg    : "${TMPDIR=/tmp}"
118084f91ccSmrg    # shellcheck disable=SC2039,SC3028
119084f91ccSmrg    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
120084f91ccSmrg	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
121084f91ccSmrg	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
122084f91ccSmrg	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
123084f91ccSmrg    dummy=$tmp/dummy
124084f91ccSmrg    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
125084f91ccSmrg	,,)    echo "int x;" > "$dummy.c"
126084f91ccSmrg	       for driver in cc gcc c89 c99 ; do
127084f91ccSmrg		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
128084f91ccSmrg		       CC_FOR_BUILD=$driver
129084f91ccSmrg		       break
130084f91ccSmrg		   fi
131084f91ccSmrg	       done
132084f91ccSmrg	       if test x"$CC_FOR_BUILD" = x ; then
133084f91ccSmrg		   CC_FOR_BUILD=no_compiler_found
134084f91ccSmrg	       fi
135084f91ccSmrg	       ;;
136084f91ccSmrg	,,*)   CC_FOR_BUILD=$CC ;;
137084f91ccSmrg	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
138084f91ccSmrg    esac
139084f91ccSmrg}
1409bd41f2cSmrg
1419bd41f2cSmrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
1429bd41f2cSmrg# (ghazi@noc.rutgers.edu 1994-08-24)
143084f91ccSmrgif test -f /.attbin/uname ; then
1449bd41f2cSmrg	PATH=$PATH:/.attbin ; export PATH
1459bd41f2cSmrgfi
1469bd41f2cSmrg
1479bd41f2cSmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
1489bd41f2cSmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
149084f91ccSmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
1509bd41f2cSmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
1519bd41f2cSmrg
152084f91ccSmrgcase $UNAME_SYSTEM in
153084f91ccSmrgLinux|GNU|GNU/*)
154084f91ccSmrg	LIBC=unknown
155084f91ccSmrg
156084f91ccSmrg	set_cc_for_build
157084f91ccSmrg	cat <<-EOF > "$dummy.c"
158084f91ccSmrg	#include <features.h>
159084f91ccSmrg	#if defined(__UCLIBC__)
160084f91ccSmrg	LIBC=uclibc
161084f91ccSmrg	#elif defined(__dietlibc__)
162084f91ccSmrg	LIBC=dietlibc
163084f91ccSmrg	#elif defined(__GLIBC__)
164084f91ccSmrg	LIBC=gnu
165084f91ccSmrg	#else
166084f91ccSmrg	#include <stdarg.h>
167084f91ccSmrg	/* First heuristic to detect musl libc.  */
168084f91ccSmrg	#ifdef __DEFINED_va_list
169084f91ccSmrg	LIBC=musl
170084f91ccSmrg	#endif
171084f91ccSmrg	#endif
172084f91ccSmrg	EOF
173084f91ccSmrg	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
174084f91ccSmrg	eval "$cc_set_libc"
175084f91ccSmrg
176084f91ccSmrg	# Second heuristic to detect musl libc.
177084f91ccSmrg	if [ "$LIBC" = unknown ] &&
178084f91ccSmrg	   command -v ldd >/dev/null &&
179084f91ccSmrg	   ldd --version 2>&1 | grep -q ^musl; then
180084f91ccSmrg		LIBC=musl
181084f91ccSmrg	fi
182084f91ccSmrg
183084f91ccSmrg	# If the system lacks a compiler, then just pick glibc.
184084f91ccSmrg	# We could probably try harder.
185084f91ccSmrg	if [ "$LIBC" = unknown ]; then
186084f91ccSmrg		LIBC=gnu
187084f91ccSmrg	fi
188084f91ccSmrg	;;
189084f91ccSmrgesac
190084f91ccSmrg
1919bd41f2cSmrg# Note: order is significant - the case branches are not exclusive.
1929bd41f2cSmrg
193084f91ccSmrgcase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
1949bd41f2cSmrg    *:NetBSD:*:*)
1959bd41f2cSmrg	# NetBSD (nbsd) targets should (where applicable) match one or
1960da4cdccSmrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
1979bd41f2cSmrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
1989bd41f2cSmrg	# switched to ELF, *-*-netbsd* would select the old
1999bd41f2cSmrg	# object file format.  This provides both forward
2009bd41f2cSmrg	# compatibility and a consistent mechanism for selecting the
2019bd41f2cSmrg	# object file format.
2029bd41f2cSmrg	#
2039bd41f2cSmrg	# Note: NetBSD doesn't particularly care about the vendor
2049bd41f2cSmrg	# portion of the name.  We always set it to "unknown".
205084f91ccSmrg	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
206084f91ccSmrg	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
207084f91ccSmrg	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
208084f91ccSmrg	    echo unknown)`
209084f91ccSmrg	case $UNAME_MACHINE_ARCH in
210084f91ccSmrg	    aarch64eb) machine=aarch64_be-unknown ;;
2119bd41f2cSmrg	    armeb) machine=armeb-unknown ;;
2129bd41f2cSmrg	    arm*) machine=arm-unknown ;;
2139bd41f2cSmrg	    sh3el) machine=shl-unknown ;;
2149bd41f2cSmrg	    sh3eb) machine=sh-unknown ;;
2159418810dSmrg	    sh5el) machine=sh5le-unknown ;;
216084f91ccSmrg	    earmv*)
217084f91ccSmrg		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
218084f91ccSmrg		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
219084f91ccSmrg		machine=${arch}${endian}-unknown
220084f91ccSmrg		;;
221084f91ccSmrg	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
2229bd41f2cSmrg	esac
2239bd41f2cSmrg	# The Operating System including object format, if it has switched
224084f91ccSmrg	# to ELF recently (or will in the future) and ABI.
225084f91ccSmrg	case $UNAME_MACHINE_ARCH in
226084f91ccSmrg	    earm*)
227084f91ccSmrg		os=netbsdelf
228084f91ccSmrg		;;
2299bd41f2cSmrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
230084f91ccSmrg		set_cc_for_build
2319bd41f2cSmrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
2320da4cdccSmrg			| grep -q __ELF__
2339bd41f2cSmrg		then
2349bd41f2cSmrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
2359bd41f2cSmrg		    # Return netbsd for either.  FIX?
2369bd41f2cSmrg		    os=netbsd
2379bd41f2cSmrg		else
2389bd41f2cSmrg		    os=netbsdelf
2399bd41f2cSmrg		fi
2409bd41f2cSmrg		;;
2419bd41f2cSmrg	    *)
2420da4cdccSmrg		os=netbsd
2439bd41f2cSmrg		;;
2449bd41f2cSmrg	esac
245084f91ccSmrg	# Determine ABI tags.
246084f91ccSmrg	case $UNAME_MACHINE_ARCH in
247084f91ccSmrg	    earm*)
248084f91ccSmrg		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
249084f91ccSmrg		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
250084f91ccSmrg		;;
251084f91ccSmrg	esac
2529bd41f2cSmrg	# The OS release
2539bd41f2cSmrg	# Debian GNU/NetBSD machines have a different userland, and
2549bd41f2cSmrg	# thus, need a distinct triplet. However, they do not need
2559bd41f2cSmrg	# kernel version information, so it can be replaced with a
2569bd41f2cSmrg	# suitable tag, in the style of linux-gnu.
257084f91ccSmrg	case $UNAME_VERSION in
2589bd41f2cSmrg	    Debian*)
2599bd41f2cSmrg		release='-gnu'
2609bd41f2cSmrg		;;
2619bd41f2cSmrg	    *)
262084f91ccSmrg		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
2639bd41f2cSmrg		;;
2649bd41f2cSmrg	esac
2659bd41f2cSmrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
2669bd41f2cSmrg	# contains redundant information, the shorter form:
2679bd41f2cSmrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
268084f91ccSmrg	GUESS=$machine-${os}${release}${abi-}
269084f91ccSmrg	;;
270084f91ccSmrg    *:Bitrig:*:*)
271084f91ccSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
272084f91ccSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
273084f91ccSmrg	;;
2749bd41f2cSmrg    *:OpenBSD:*:*)
2759bd41f2cSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
276084f91ccSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
277084f91ccSmrg	;;
278084f91ccSmrg    *:SecBSD:*:*)
279084f91ccSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
280084f91ccSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
281084f91ccSmrg	;;
282084f91ccSmrg    *:LibertyBSD:*:*)
283084f91ccSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
284084f91ccSmrg	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
285084f91ccSmrg	;;
286084f91ccSmrg    *:MidnightBSD:*:*)
287084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
288084f91ccSmrg	;;
2899bd41f2cSmrg    *:ekkoBSD:*:*)
290084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
291084f91ccSmrg	;;
2929418810dSmrg    *:SolidBSD:*:*)
293084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
294084f91ccSmrg	;;
295084f91ccSmrg    *:OS108:*:*)
296084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
297084f91ccSmrg	;;
2989bd41f2cSmrg    macppc:MirBSD:*:*)
299084f91ccSmrg	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
300084f91ccSmrg	;;
3019bd41f2cSmrg    *:MirBSD:*:*)
302084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
303084f91ccSmrg	;;
304084f91ccSmrg    *:Sortix:*:*)
305084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-sortix
306084f91ccSmrg	;;
307084f91ccSmrg    *:Twizzler:*:*)
308084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-twizzler
309084f91ccSmrg	;;
310084f91ccSmrg    *:Redox:*:*)
311084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-redox
312084f91ccSmrg	;;
313084f91ccSmrg    mips:OSF1:*.*)
314084f91ccSmrg	GUESS=mips-dec-osf1
315084f91ccSmrg	;;
3169bd41f2cSmrg    alpha:OSF1:*:*)
317084f91ccSmrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
318084f91ccSmrg	trap '' 0
3199bd41f2cSmrg	case $UNAME_RELEASE in
3209bd41f2cSmrg	*4.0)
3219bd41f2cSmrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
3229bd41f2cSmrg		;;
3239bd41f2cSmrg	*5.*)
3240da4cdccSmrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
3259bd41f2cSmrg		;;
3269bd41f2cSmrg	esac
3279bd41f2cSmrg	# According to Compaq, /usr/sbin/psrinfo has been available on
3289bd41f2cSmrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
3299bd41f2cSmrg	# covers most systems running today.  This code pipes the CPU
3309bd41f2cSmrg	# types through head -n 1, so we only detect the type of CPU 0.
3319bd41f2cSmrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
332084f91ccSmrg	case $ALPHA_CPU_TYPE in
3339bd41f2cSmrg	    "EV4 (21064)")
334084f91ccSmrg		UNAME_MACHINE=alpha ;;
3359bd41f2cSmrg	    "EV4.5 (21064)")
336084f91ccSmrg		UNAME_MACHINE=alpha ;;
3379bd41f2cSmrg	    "LCA4 (21066/21068)")
338084f91ccSmrg		UNAME_MACHINE=alpha ;;
3399bd41f2cSmrg	    "EV5 (21164)")
340084f91ccSmrg		UNAME_MACHINE=alphaev5 ;;
3419bd41f2cSmrg	    "EV5.6 (21164A)")
342084f91ccSmrg		UNAME_MACHINE=alphaev56 ;;
3439bd41f2cSmrg	    "EV5.6 (21164PC)")
344084f91ccSmrg		UNAME_MACHINE=alphapca56 ;;
3459bd41f2cSmrg	    "EV5.7 (21164PC)")
346084f91ccSmrg		UNAME_MACHINE=alphapca57 ;;
3479bd41f2cSmrg	    "EV6 (21264)")
348084f91ccSmrg		UNAME_MACHINE=alphaev6 ;;
3499bd41f2cSmrg	    "EV6.7 (21264A)")
350084f91ccSmrg		UNAME_MACHINE=alphaev67 ;;
3519bd41f2cSmrg	    "EV6.8CB (21264C)")
352084f91ccSmrg		UNAME_MACHINE=alphaev68 ;;
3539bd41f2cSmrg	    "EV6.8AL (21264B)")
354084f91ccSmrg		UNAME_MACHINE=alphaev68 ;;
3559bd41f2cSmrg	    "EV6.8CX (21264D)")
356084f91ccSmrg		UNAME_MACHINE=alphaev68 ;;
3579bd41f2cSmrg	    "EV6.9A (21264/EV69A)")
358084f91ccSmrg		UNAME_MACHINE=alphaev69 ;;
3599bd41f2cSmrg	    "EV7 (21364)")
360084f91ccSmrg		UNAME_MACHINE=alphaev7 ;;
3619bd41f2cSmrg	    "EV7.9 (21364A)")
362084f91ccSmrg		UNAME_MACHINE=alphaev79 ;;
3639bd41f2cSmrg	esac
3649bd41f2cSmrg	# A Pn.n version is a patched version.
3659bd41f2cSmrg	# A Vn.n version is a released version.
3669bd41f2cSmrg	# A Tn.n version is a released field test version.
3679bd41f2cSmrg	# A Xn.n version is an unreleased experimental baselevel.
3689bd41f2cSmrg	# 1.2 uses "1.2" for uname -r.
369084f91ccSmrg	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
370084f91ccSmrg	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
371084f91ccSmrg	;;
3729bd41f2cSmrg    Amiga*:UNIX_System_V:4.0:*)
373084f91ccSmrg	GUESS=m68k-unknown-sysv4
374084f91ccSmrg	;;
3759bd41f2cSmrg    *:[Aa]miga[Oo][Ss]:*:*)
376084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-amigaos
377084f91ccSmrg	;;
3789bd41f2cSmrg    *:[Mm]orph[Oo][Ss]:*:*)
379084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-morphos
380084f91ccSmrg	;;
3819bd41f2cSmrg    *:OS/390:*:*)
382084f91ccSmrg	GUESS=i370-ibm-openedition
383084f91ccSmrg	;;
3849bd41f2cSmrg    *:z/VM:*:*)
385084f91ccSmrg	GUESS=s390-ibm-zvmoe
386084f91ccSmrg	;;
3879bd41f2cSmrg    *:OS400:*:*)
388084f91ccSmrg	GUESS=powerpc-ibm-os400
389084f91ccSmrg	;;
3909bd41f2cSmrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
391084f91ccSmrg	GUESS=arm-acorn-riscix$UNAME_RELEASE
392084f91ccSmrg	;;
393084f91ccSmrg    arm*:riscos:*:*|arm*:RISCOS:*:*)
394084f91ccSmrg	GUESS=arm-unknown-riscos
395084f91ccSmrg	;;
3969bd41f2cSmrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
397084f91ccSmrg	GUESS=hppa1.1-hitachi-hiuxmpp
398084f91ccSmrg	;;
3999bd41f2cSmrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
4009bd41f2cSmrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
401084f91ccSmrg	case `(/bin/universe) 2>/dev/null` in
402084f91ccSmrg	    att) GUESS=pyramid-pyramid-sysv3 ;;
403084f91ccSmrg	    *)   GUESS=pyramid-pyramid-bsd   ;;
404084f91ccSmrg	esac
405084f91ccSmrg	;;
4069bd41f2cSmrg    NILE*:*:*:dcosx)
407084f91ccSmrg	GUESS=pyramid-pyramid-svr4
408084f91ccSmrg	;;
4099bd41f2cSmrg    DRS?6000:unix:4.0:6*)
410084f91ccSmrg	GUESS=sparc-icl-nx6
411084f91ccSmrg	;;
4129bd41f2cSmrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
4139bd41f2cSmrg	case `/usr/bin/uname -p` in
414084f91ccSmrg	    sparc) GUESS=sparc-icl-nx7 ;;
415084f91ccSmrg	esac
416084f91ccSmrg	;;
4170da4cdccSmrg    s390x:SunOS:*:*)
418084f91ccSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
419084f91ccSmrg	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
420084f91ccSmrg	;;
4219bd41f2cSmrg    sun4H:SunOS:5.*:*)
422084f91ccSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
423084f91ccSmrg	GUESS=sparc-hal-solaris2$SUN_REL
424084f91ccSmrg	;;
4259bd41f2cSmrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
426084f91ccSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
427084f91ccSmrg	GUESS=sparc-sun-solaris2$SUN_REL
428084f91ccSmrg	;;
4290da4cdccSmrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
430084f91ccSmrg	GUESS=i386-pc-auroraux$UNAME_RELEASE
431084f91ccSmrg	;;
4329418810dSmrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
433084f91ccSmrg	set_cc_for_build
434084f91ccSmrg	SUN_ARCH=i386
4359418810dSmrg	# If there is a compiler, see if it is configured for 64-bit objects.
4369418810dSmrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
4379418810dSmrg	# This test works for both compilers.
438084f91ccSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
4390da4cdccSmrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
440084f91ccSmrg		(CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \
4419418810dSmrg		grep IS_64BIT_ARCH >/dev/null
4429418810dSmrg	    then
443084f91ccSmrg		SUN_ARCH=x86_64
4449418810dSmrg	    fi
4459418810dSmrg	fi
446084f91ccSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
447084f91ccSmrg	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
448084f91ccSmrg	;;
4499bd41f2cSmrg    sun4*:SunOS:6*:*)
4509bd41f2cSmrg	# According to config.sub, this is the proper way to canonicalize
4519bd41f2cSmrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
4529bd41f2cSmrg	# it's likely to be more like Solaris than SunOS4.
453084f91ccSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
454084f91ccSmrg	GUESS=sparc-sun-solaris3$SUN_REL
455084f91ccSmrg	;;
4569bd41f2cSmrg    sun4*:SunOS:*:*)
457084f91ccSmrg	case `/usr/bin/arch -k` in
4589bd41f2cSmrg	    Series*|S4*)
4599bd41f2cSmrg		UNAME_RELEASE=`uname -v`
4609bd41f2cSmrg		;;
4619bd41f2cSmrg	esac
4629bd41f2cSmrg	# Japanese Language versions have a version number like `4.1.3-JL'.
463084f91ccSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
464084f91ccSmrg	GUESS=sparc-sun-sunos$SUN_REL
465084f91ccSmrg	;;
4669bd41f2cSmrg    sun3*:SunOS:*:*)
467084f91ccSmrg	GUESS=m68k-sun-sunos$UNAME_RELEASE
468084f91ccSmrg	;;
4699bd41f2cSmrg    sun*:*:4.2BSD:*)
4709bd41f2cSmrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
471084f91ccSmrg	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
472084f91ccSmrg	case `/bin/arch` in
4739bd41f2cSmrg	    sun3)
474084f91ccSmrg		GUESS=m68k-sun-sunos$UNAME_RELEASE
4759bd41f2cSmrg		;;
4769bd41f2cSmrg	    sun4)
477084f91ccSmrg		GUESS=sparc-sun-sunos$UNAME_RELEASE
4789bd41f2cSmrg		;;
4799bd41f2cSmrg	esac
480084f91ccSmrg	;;
4819bd41f2cSmrg    aushp:SunOS:*:*)
482084f91ccSmrg	GUESS=sparc-auspex-sunos$UNAME_RELEASE
483084f91ccSmrg	;;
4849bd41f2cSmrg    # The situation for MiNT is a little confusing.  The machine name
4859bd41f2cSmrg    # can be virtually everything (everything which is not
4869bd41f2cSmrg    # "atarist" or "atariste" at least should have a processor
4879bd41f2cSmrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
4889bd41f2cSmrg    # to the lowercase version "mint" (or "freemint").  Finally
4899bd41f2cSmrg    # the system name "TOS" denotes a system which is actually not
4909bd41f2cSmrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
4919bd41f2cSmrg    # be no problem.
4929bd41f2cSmrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
493084f91ccSmrg	GUESS=m68k-atari-mint$UNAME_RELEASE
494084f91ccSmrg	;;
4959bd41f2cSmrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
496084f91ccSmrg	GUESS=m68k-atari-mint$UNAME_RELEASE
497084f91ccSmrg	;;
4989bd41f2cSmrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
499084f91ccSmrg	GUESS=m68k-atari-mint$UNAME_RELEASE
500084f91ccSmrg	;;
5019bd41f2cSmrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
502084f91ccSmrg	GUESS=m68k-milan-mint$UNAME_RELEASE
503084f91ccSmrg	;;
5049bd41f2cSmrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
505084f91ccSmrg	GUESS=m68k-hades-mint$UNAME_RELEASE
506084f91ccSmrg	;;
5079bd41f2cSmrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
508084f91ccSmrg	GUESS=m68k-unknown-mint$UNAME_RELEASE
509084f91ccSmrg	;;
5109bd41f2cSmrg    m68k:machten:*:*)
511084f91ccSmrg	GUESS=m68k-apple-machten$UNAME_RELEASE
512084f91ccSmrg	;;
5139bd41f2cSmrg    powerpc:machten:*:*)
514084f91ccSmrg	GUESS=powerpc-apple-machten$UNAME_RELEASE
515084f91ccSmrg	;;
5169bd41f2cSmrg    RISC*:Mach:*:*)
517084f91ccSmrg	GUESS=mips-dec-mach_bsd4.3
518084f91ccSmrg	;;
5199bd41f2cSmrg    RISC*:ULTRIX:*:*)
520084f91ccSmrg	GUESS=mips-dec-ultrix$UNAME_RELEASE
521084f91ccSmrg	;;
5229bd41f2cSmrg    VAX*:ULTRIX*:*:*)
523084f91ccSmrg	GUESS=vax-dec-ultrix$UNAME_RELEASE
524084f91ccSmrg	;;
5259bd41f2cSmrg    2020:CLIX:*:* | 2430:CLIX:*:*)
526084f91ccSmrg	GUESS=clipper-intergraph-clix$UNAME_RELEASE
527084f91ccSmrg	;;
5289bd41f2cSmrg    mips:*:*:UMIPS | mips:*:*:RISCos)
529084f91ccSmrg	set_cc_for_build
530084f91ccSmrg	sed 's/^	//' << EOF > "$dummy.c"
5319bd41f2cSmrg#ifdef __cplusplus
5329bd41f2cSmrg#include <stdio.h>  /* for printf() prototype */
5339bd41f2cSmrg	int main (int argc, char *argv[]) {
5349bd41f2cSmrg#else
5359bd41f2cSmrg	int main (argc, argv) int argc; char *argv[]; {
5369bd41f2cSmrg#endif
5379bd41f2cSmrg	#if defined (host_mips) && defined (MIPSEB)
5389bd41f2cSmrg	#if defined (SYSTYPE_SYSV)
539084f91ccSmrg	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
5409bd41f2cSmrg	#endif
5419bd41f2cSmrg	#if defined (SYSTYPE_SVR4)
542084f91ccSmrg	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
5439bd41f2cSmrg	#endif
5449bd41f2cSmrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
545084f91ccSmrg	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
5469bd41f2cSmrg	#endif
5479bd41f2cSmrg	#endif
5489bd41f2cSmrg	  exit (-1);
5499bd41f2cSmrg	}
5509bd41f2cSmrgEOF
551084f91ccSmrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
552084f91ccSmrg	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
553084f91ccSmrg	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
5549bd41f2cSmrg	    { echo "$SYSTEM_NAME"; exit; }
555084f91ccSmrg	GUESS=mips-mips-riscos$UNAME_RELEASE
556084f91ccSmrg	;;
5579bd41f2cSmrg    Motorola:PowerMAX_OS:*:*)
558084f91ccSmrg	GUESS=powerpc-motorola-powermax
559084f91ccSmrg	;;
5609bd41f2cSmrg    Motorola:*:4.3:PL8-*)
561084f91ccSmrg	GUESS=powerpc-harris-powermax
562084f91ccSmrg	;;
5639bd41f2cSmrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
564084f91ccSmrg	GUESS=powerpc-harris-powermax
565084f91ccSmrg	;;
5669bd41f2cSmrg    Night_Hawk:Power_UNIX:*:*)
567084f91ccSmrg	GUESS=powerpc-harris-powerunix
568084f91ccSmrg	;;
5699bd41f2cSmrg    m88k:CX/UX:7*:*)
570084f91ccSmrg	GUESS=m88k-harris-cxux7
571084f91ccSmrg	;;
5729bd41f2cSmrg    m88k:*:4*:R4*)
573084f91ccSmrg	GUESS=m88k-motorola-sysv4
574084f91ccSmrg	;;
5759bd41f2cSmrg    m88k:*:3*:R3*)
576084f91ccSmrg	GUESS=m88k-motorola-sysv3
577084f91ccSmrg	;;
5789bd41f2cSmrg    AViiON:dgux:*:*)
5790da4cdccSmrg	# DG/UX returns AViiON for all architectures
5800da4cdccSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
581084f91ccSmrg	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
5829bd41f2cSmrg	then
583084f91ccSmrg	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
584084f91ccSmrg	       test "$TARGET_BINARY_INTERFACE"x = x
5859bd41f2cSmrg	    then
586084f91ccSmrg		GUESS=m88k-dg-dgux$UNAME_RELEASE
5879bd41f2cSmrg	    else
588084f91ccSmrg		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
5899bd41f2cSmrg	    fi
5909bd41f2cSmrg	else
591084f91ccSmrg	    GUESS=i586-dg-dgux$UNAME_RELEASE
5929bd41f2cSmrg	fi
593084f91ccSmrg	;;
5949bd41f2cSmrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
595084f91ccSmrg	GUESS=m88k-dolphin-sysv3
596084f91ccSmrg	;;
5979bd41f2cSmrg    M88*:*:R3*:*)
5989bd41f2cSmrg	# Delta 88k system running SVR3
599084f91ccSmrg	GUESS=m88k-motorola-sysv3
600084f91ccSmrg	;;
6019bd41f2cSmrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
602084f91ccSmrg	GUESS=m88k-tektronix-sysv3
603084f91ccSmrg	;;
6049bd41f2cSmrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
605084f91ccSmrg	GUESS=m68k-tektronix-bsd
606084f91ccSmrg	;;
6079bd41f2cSmrg    *:IRIX*:*:*)
608084f91ccSmrg	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
609084f91ccSmrg	GUESS=mips-sgi-irix$IRIX_REL
610084f91ccSmrg	;;
6119bd41f2cSmrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
612084f91ccSmrg	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
613084f91ccSmrg	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
6149bd41f2cSmrg    i*86:AIX:*:*)
615084f91ccSmrg	GUESS=i386-ibm-aix
616084f91ccSmrg	;;
6179bd41f2cSmrg    ia64:AIX:*:*)
618084f91ccSmrg	if test -x /usr/bin/oslevel ; then
6199bd41f2cSmrg		IBM_REV=`/usr/bin/oslevel`
6209bd41f2cSmrg	else
621084f91ccSmrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
6229bd41f2cSmrg	fi
623084f91ccSmrg	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
624084f91ccSmrg	;;
6259bd41f2cSmrg    *:AIX:2:3)
6269bd41f2cSmrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
627084f91ccSmrg		set_cc_for_build
628084f91ccSmrg		sed 's/^		//' << EOF > "$dummy.c"
6299bd41f2cSmrg		#include <sys/systemcfg.h>
6309bd41f2cSmrg
6319bd41f2cSmrg		main()
6329bd41f2cSmrg			{
6339bd41f2cSmrg			if (!__power_pc())
6349bd41f2cSmrg				exit(1);
6359bd41f2cSmrg			puts("powerpc-ibm-aix3.2.5");
6369bd41f2cSmrg			exit(0);
6379bd41f2cSmrg			}
6389bd41f2cSmrgEOF
639084f91ccSmrg		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
6409bd41f2cSmrg		then
641084f91ccSmrg			GUESS=$SYSTEM_NAME
6429bd41f2cSmrg		else
643084f91ccSmrg			GUESS=rs6000-ibm-aix3.2.5
6449bd41f2cSmrg		fi
6459bd41f2cSmrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
646084f91ccSmrg		GUESS=rs6000-ibm-aix3.2.4
6479bd41f2cSmrg	else
648084f91ccSmrg		GUESS=rs6000-ibm-aix3.2
6499bd41f2cSmrg	fi
650084f91ccSmrg	;;
6510da4cdccSmrg    *:AIX:*:[4567])
6529bd41f2cSmrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
653084f91ccSmrg	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
6549bd41f2cSmrg		IBM_ARCH=rs6000
6559bd41f2cSmrg	else
6569bd41f2cSmrg		IBM_ARCH=powerpc
6579bd41f2cSmrg	fi
658084f91ccSmrg	if test -x /usr/bin/lslpp ; then
659084f91ccSmrg		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
660084f91ccSmrg			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
6619bd41f2cSmrg	else
662084f91ccSmrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
6639bd41f2cSmrg	fi
664084f91ccSmrg	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
665084f91ccSmrg	;;
6669bd41f2cSmrg    *:AIX:*:*)
667084f91ccSmrg	GUESS=rs6000-ibm-aix
668084f91ccSmrg	;;
669084f91ccSmrg    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
670084f91ccSmrg	GUESS=romp-ibm-bsd4.4
671084f91ccSmrg	;;
6729bd41f2cSmrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
673084f91ccSmrg	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
674084f91ccSmrg	;;                                  # report: romp-ibm BSD 4.3
6759bd41f2cSmrg    *:BOSX:*:*)
676084f91ccSmrg	GUESS=rs6000-bull-bosx
677084f91ccSmrg	;;
6789bd41f2cSmrg    DPX/2?00:B.O.S.:*:*)
679084f91ccSmrg	GUESS=m68k-bull-sysv3
680084f91ccSmrg	;;
6819bd41f2cSmrg    9000/[34]??:4.3bsd:1.*:*)
682084f91ccSmrg	GUESS=m68k-hp-bsd
683084f91ccSmrg	;;
6849bd41f2cSmrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
685084f91ccSmrg	GUESS=m68k-hp-bsd4.4
686084f91ccSmrg	;;
6879bd41f2cSmrg    9000/[34678]??:HP-UX:*:*)
688084f91ccSmrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
689084f91ccSmrg	case $UNAME_MACHINE in
690084f91ccSmrg	    9000/31?)            HP_ARCH=m68000 ;;
691084f91ccSmrg	    9000/[34]??)         HP_ARCH=m68k ;;
6929bd41f2cSmrg	    9000/[678][0-9][0-9])
693084f91ccSmrg		if test -x /usr/bin/getconf; then
6949bd41f2cSmrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
6950da4cdccSmrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
696084f91ccSmrg		    case $sc_cpu_version in
697084f91ccSmrg		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
698084f91ccSmrg		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
6990da4cdccSmrg		      532)                      # CPU_PA_RISC2_0
700084f91ccSmrg			case $sc_kernel_bits in
701084f91ccSmrg			  32) HP_ARCH=hppa2.0n ;;
702084f91ccSmrg			  64) HP_ARCH=hppa2.0w ;;
703084f91ccSmrg			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
7040da4cdccSmrg			esac ;;
7050da4cdccSmrg		    esac
7069bd41f2cSmrg		fi
707084f91ccSmrg		if test "$HP_ARCH" = ""; then
708084f91ccSmrg		    set_cc_for_build
709084f91ccSmrg		    sed 's/^		//' << EOF > "$dummy.c"
7109bd41f2cSmrg
7110da4cdccSmrg		#define _HPUX_SOURCE
7120da4cdccSmrg		#include <stdlib.h>
7130da4cdccSmrg		#include <unistd.h>
7149bd41f2cSmrg
7150da4cdccSmrg		int main ()
7160da4cdccSmrg		{
7170da4cdccSmrg		#if defined(_SC_KERNEL_BITS)
7180da4cdccSmrg		    long bits = sysconf(_SC_KERNEL_BITS);
7190da4cdccSmrg		#endif
7200da4cdccSmrg		    long cpu  = sysconf (_SC_CPU_VERSION);
7219bd41f2cSmrg
7220da4cdccSmrg		    switch (cpu)
7230da4cdccSmrg			{
7240da4cdccSmrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
7250da4cdccSmrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
7260da4cdccSmrg			case CPU_PA_RISC2_0:
7270da4cdccSmrg		#if defined(_SC_KERNEL_BITS)
7280da4cdccSmrg			    switch (bits)
7290da4cdccSmrg				{
7300da4cdccSmrg				case 64: puts ("hppa2.0w"); break;
7310da4cdccSmrg				case 32: puts ("hppa2.0n"); break;
7320da4cdccSmrg				default: puts ("hppa2.0"); break;
7330da4cdccSmrg				} break;
7340da4cdccSmrg		#else  /* !defined(_SC_KERNEL_BITS) */
7350da4cdccSmrg			    puts ("hppa2.0"); break;
7360da4cdccSmrg		#endif
7370da4cdccSmrg			default: puts ("hppa1.0"); break;
7380da4cdccSmrg			}
7390da4cdccSmrg		    exit (0);
7400da4cdccSmrg		}
7419bd41f2cSmrgEOF
742084f91ccSmrg		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
7439bd41f2cSmrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
7449bd41f2cSmrg		fi ;;
7459bd41f2cSmrg	esac
746084f91ccSmrg	if test "$HP_ARCH" = hppa2.0w
7479bd41f2cSmrg	then
748084f91ccSmrg	    set_cc_for_build
7499bd41f2cSmrg
7509bd41f2cSmrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
7519bd41f2cSmrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
7529bd41f2cSmrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
7539bd41f2cSmrg	    #
7549bd41f2cSmrg	    # $ CC_FOR_BUILD=cc ./config.guess
7559bd41f2cSmrg	    # => hppa2.0w-hp-hpux11.23
7569bd41f2cSmrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
7579bd41f2cSmrg	    # => hppa64-hp-hpux11.23
7589bd41f2cSmrg
759084f91ccSmrg	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
7600da4cdccSmrg		grep -q __LP64__
7619bd41f2cSmrg	    then
762084f91ccSmrg		HP_ARCH=hppa2.0w
7639bd41f2cSmrg	    else
764084f91ccSmrg		HP_ARCH=hppa64
7659bd41f2cSmrg	    fi
7669bd41f2cSmrg	fi
767084f91ccSmrg	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
768084f91ccSmrg	;;
7699bd41f2cSmrg    ia64:HP-UX:*:*)
770084f91ccSmrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
771084f91ccSmrg	GUESS=ia64-hp-hpux$HPUX_REV
772084f91ccSmrg	;;
7739bd41f2cSmrg    3050*:HI-UX:*:*)
774084f91ccSmrg	set_cc_for_build
775084f91ccSmrg	sed 's/^	//' << EOF > "$dummy.c"
7769bd41f2cSmrg	#include <unistd.h>
7779bd41f2cSmrg	int
7789bd41f2cSmrg	main ()
7799bd41f2cSmrg	{
7809bd41f2cSmrg	  long cpu = sysconf (_SC_CPU_VERSION);
7819bd41f2cSmrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
7829bd41f2cSmrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
7839bd41f2cSmrg	     results, however.  */
7849bd41f2cSmrg	  if (CPU_IS_PA_RISC (cpu))
7859bd41f2cSmrg	    {
7869bd41f2cSmrg	      switch (cpu)
7879bd41f2cSmrg		{
7889bd41f2cSmrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
7899bd41f2cSmrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
7909bd41f2cSmrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
7919bd41f2cSmrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
7929bd41f2cSmrg		}
7939bd41f2cSmrg	    }
7949bd41f2cSmrg	  else if (CPU_IS_HP_MC68K (cpu))
7959bd41f2cSmrg	    puts ("m68k-hitachi-hiuxwe2");
7969bd41f2cSmrg	  else puts ("unknown-hitachi-hiuxwe2");
7979bd41f2cSmrg	  exit (0);
7989bd41f2cSmrg	}
7999bd41f2cSmrgEOF
800084f91ccSmrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
8019bd41f2cSmrg		{ echo "$SYSTEM_NAME"; exit; }
802084f91ccSmrg	GUESS=unknown-hitachi-hiuxwe2
803084f91ccSmrg	;;
804084f91ccSmrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
805084f91ccSmrg	GUESS=hppa1.1-hp-bsd
806084f91ccSmrg	;;
8079bd41f2cSmrg    9000/8??:4.3bsd:*:*)
808084f91ccSmrg	GUESS=hppa1.0-hp-bsd
809084f91ccSmrg	;;
8109bd41f2cSmrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
811084f91ccSmrg	GUESS=hppa1.0-hp-mpeix
812084f91ccSmrg	;;
813084f91ccSmrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
814084f91ccSmrg	GUESS=hppa1.1-hp-osf
815084f91ccSmrg	;;
8169bd41f2cSmrg    hp8??:OSF1:*:*)
817084f91ccSmrg	GUESS=hppa1.0-hp-osf
818084f91ccSmrg	;;
8199bd41f2cSmrg    i*86:OSF1:*:*)
820084f91ccSmrg	if test -x /usr/sbin/sysversion ; then
821084f91ccSmrg	    GUESS=$UNAME_MACHINE-unknown-osf1mk
8229bd41f2cSmrg	else
823084f91ccSmrg	    GUESS=$UNAME_MACHINE-unknown-osf1
8249bd41f2cSmrg	fi
825084f91ccSmrg	;;
8269bd41f2cSmrg    parisc*:Lites*:*:*)
827084f91ccSmrg	GUESS=hppa1.1-hp-lites
828084f91ccSmrg	;;
8299bd41f2cSmrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
830084f91ccSmrg	GUESS=c1-convex-bsd
831084f91ccSmrg	;;
8329bd41f2cSmrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
8339bd41f2cSmrg	if getsysinfo -f scalar_acc
8349bd41f2cSmrg	then echo c32-convex-bsd
8359bd41f2cSmrg	else echo c2-convex-bsd
8369bd41f2cSmrg	fi
8370da4cdccSmrg	exit ;;
8389bd41f2cSmrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
839084f91ccSmrg	GUESS=c34-convex-bsd
840084f91ccSmrg	;;
8419bd41f2cSmrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
842084f91ccSmrg	GUESS=c38-convex-bsd
843084f91ccSmrg	;;
8449bd41f2cSmrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
845084f91ccSmrg	GUESS=c4-convex-bsd
846084f91ccSmrg	;;
8479bd41f2cSmrg    CRAY*Y-MP:*:*:*)
848084f91ccSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
849084f91ccSmrg	GUESS=ymp-cray-unicos$CRAY_REL
850084f91ccSmrg	;;
8519bd41f2cSmrg    CRAY*[A-Z]90:*:*:*)
852084f91ccSmrg	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
8539bd41f2cSmrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
8549bd41f2cSmrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
8559bd41f2cSmrg	      -e 's/\.[^.]*$/.X/'
8569bd41f2cSmrg	exit ;;
8579bd41f2cSmrg    CRAY*TS:*:*:*)
858084f91ccSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
859084f91ccSmrg	GUESS=t90-cray-unicos$CRAY_REL
860084f91ccSmrg	;;
8619bd41f2cSmrg    CRAY*T3E:*:*:*)
862084f91ccSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
863084f91ccSmrg	GUESS=alphaev5-cray-unicosmk$CRAY_REL
864084f91ccSmrg	;;
8659bd41f2cSmrg    CRAY*SV1:*:*:*)
866084f91ccSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
867084f91ccSmrg	GUESS=sv1-cray-unicos$CRAY_REL
868084f91ccSmrg	;;
8699bd41f2cSmrg    *:UNICOS/mp:*:*)
870084f91ccSmrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
871084f91ccSmrg	GUESS=craynv-cray-unicosmp$CRAY_REL
872084f91ccSmrg	;;
8739bd41f2cSmrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
874084f91ccSmrg	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
875084f91ccSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
876084f91ccSmrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
877084f91ccSmrg	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
878084f91ccSmrg	;;
8799bd41f2cSmrg    5000:UNIX_System_V:4.*:*)
880084f91ccSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
881084f91ccSmrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
882084f91ccSmrg	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
883084f91ccSmrg	;;
8849bd41f2cSmrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
885084f91ccSmrg	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
886084f91ccSmrg	;;
8879bd41f2cSmrg    sparc*:BSD/OS:*:*)
888084f91ccSmrg	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
889084f91ccSmrg	;;
8909bd41f2cSmrg    *:BSD/OS:*:*)
891084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
892084f91ccSmrg	;;
893084f91ccSmrg    arm:FreeBSD:*:*)
894084f91ccSmrg	UNAME_PROCESSOR=`uname -p`
895084f91ccSmrg	set_cc_for_build
896084f91ccSmrg	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
897084f91ccSmrg	    | grep -q __ARM_PCS_VFP
898084f91ccSmrg	then
899084f91ccSmrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
900084f91ccSmrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
901084f91ccSmrg	else
902084f91ccSmrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
903084f91ccSmrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
904084f91ccSmrg	fi
905084f91ccSmrg	;;
9069bd41f2cSmrg    *:FreeBSD:*:*)
9070da4cdccSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
908084f91ccSmrg	case $UNAME_PROCESSOR in
9099418810dSmrg	    amd64)
910084f91ccSmrg		UNAME_PROCESSOR=x86_64 ;;
911084f91ccSmrg	    i386)
912084f91ccSmrg		UNAME_PROCESSOR=i586 ;;
9139418810dSmrg	esac
914084f91ccSmrg	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
915084f91ccSmrg	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
916084f91ccSmrg	;;
9179bd41f2cSmrg    i*:CYGWIN*:*)
918084f91ccSmrg	GUESS=$UNAME_MACHINE-pc-cygwin
919084f91ccSmrg	;;
920084f91ccSmrg    *:MINGW64*:*)
921084f91ccSmrg	GUESS=$UNAME_MACHINE-pc-mingw64
922084f91ccSmrg	;;
9239418810dSmrg    *:MINGW*:*)
924084f91ccSmrg	GUESS=$UNAME_MACHINE-pc-mingw32
925084f91ccSmrg	;;
926084f91ccSmrg    *:MSYS*:*)
927084f91ccSmrg	GUESS=$UNAME_MACHINE-pc-msys
928084f91ccSmrg	;;
9299bd41f2cSmrg    i*:PW*:*)
930084f91ccSmrg	GUESS=$UNAME_MACHINE-pc-pw32
931084f91ccSmrg	;;
932084f91ccSmrg    *:SerenityOS:*:*)
933084f91ccSmrg        GUESS=$UNAME_MACHINE-pc-serenity
934084f91ccSmrg        ;;
9350da4cdccSmrg    *:Interix*:*)
936084f91ccSmrg	case $UNAME_MACHINE in
9379418810dSmrg	    x86)
938084f91ccSmrg		GUESS=i586-pc-interix$UNAME_RELEASE
939084f91ccSmrg		;;
9400da4cdccSmrg	    authenticamd | genuineintel | EM64T)
941084f91ccSmrg		GUESS=x86_64-unknown-interix$UNAME_RELEASE
942084f91ccSmrg		;;
9439418810dSmrg	    IA64)
944084f91ccSmrg		GUESS=ia64-unknown-interix$UNAME_RELEASE
945084f91ccSmrg		;;
9469418810dSmrg	esac ;;
9479bd41f2cSmrg    i*:UWIN*:*)
948084f91ccSmrg	GUESS=$UNAME_MACHINE-pc-uwin
949084f91ccSmrg	;;
9509bd41f2cSmrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
951084f91ccSmrg	GUESS=x86_64-pc-cygwin
952084f91ccSmrg	;;
9539bd41f2cSmrg    prep*:SunOS:5.*:*)
954084f91ccSmrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
955084f91ccSmrg	GUESS=powerpcle-unknown-solaris2$SUN_REL
956084f91ccSmrg	;;
9579bd41f2cSmrg    *:GNU:*:*)
9589bd41f2cSmrg	# the GNU system
959084f91ccSmrg	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
960084f91ccSmrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
961084f91ccSmrg	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
962084f91ccSmrg	;;
9639bd41f2cSmrg    *:GNU/*:*:*)
9649bd41f2cSmrg	# other systems with GNU libc and userland
965084f91ccSmrg	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
966084f91ccSmrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
967084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
968084f91ccSmrg	;;
969084f91ccSmrg    *:Minix:*:*)
970084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-minix
971084f91ccSmrg	;;
9720da4cdccSmrg    aarch64:Linux:*:*)
973084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
974084f91ccSmrg	;;
9750da4cdccSmrg    aarch64_be:Linux:*:*)
9760da4cdccSmrg	UNAME_MACHINE=aarch64_be
977084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
978084f91ccSmrg	;;
9790da4cdccSmrg    alpha:Linux:*:*)
980084f91ccSmrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
9810da4cdccSmrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
9820da4cdccSmrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
9830da4cdccSmrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
9840da4cdccSmrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
9850da4cdccSmrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
9860da4cdccSmrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
9870da4cdccSmrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
9880da4cdccSmrg	esac
9890da4cdccSmrg	objdump --private-headers /bin/sh | grep -q ld.so.1
990084f91ccSmrg	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
991084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
992084f91ccSmrg	;;
993084f91ccSmrg    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
994084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
995084f91ccSmrg	;;
9969bd41f2cSmrg    arm*:Linux:*:*)
997084f91ccSmrg	set_cc_for_build
9989418810dSmrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
9999418810dSmrg	    | grep -q __ARM_EABI__
10009418810dSmrg	then
1001084f91ccSmrg	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
10029418810dSmrg	else
10030da4cdccSmrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
10040da4cdccSmrg		| grep -q __ARM_PCS_VFP
10050da4cdccSmrg	    then
1006084f91ccSmrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
10070da4cdccSmrg	    else
1008084f91ccSmrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
10090da4cdccSmrg	    fi
10109418810dSmrg	fi
1011084f91ccSmrg	;;
10129418810dSmrg    avr32*:Linux:*:*)
1013084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1014084f91ccSmrg	;;
10159bd41f2cSmrg    cris:Linux:*:*)
1016084f91ccSmrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1017084f91ccSmrg	;;
10189bd41f2cSmrg    crisv32:Linux:*:*)
1019084f91ccSmrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
1020084f91ccSmrg	;;
1021084f91ccSmrg    e2k:Linux:*:*)
1022084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1023084f91ccSmrg	;;
10249bd41f2cSmrg    frv:Linux:*:*)
1025084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1026084f91ccSmrg	;;
10270da4cdccSmrg    hexagon:Linux:*:*)
1028084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1029084f91ccSmrg	;;
10300da4cdccSmrg    i*86:Linux:*:*)
1031084f91ccSmrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
1032084f91ccSmrg	;;
10339bd41f2cSmrg    ia64:Linux:*:*)
1034084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1035084f91ccSmrg	;;
1036084f91ccSmrg    k1om:Linux:*:*)
1037084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1038084f91ccSmrg	;;
1039084f91ccSmrg    loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
1040084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1041084f91ccSmrg	;;
10429bd41f2cSmrg    m32r*:Linux:*:*)
1043084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1044084f91ccSmrg	;;
10459bd41f2cSmrg    m68*:Linux:*:*)
1046084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1047084f91ccSmrg	;;
10480da4cdccSmrg    mips:Linux:*:* | mips64:Linux:*:*)
1049084f91ccSmrg	set_cc_for_build
1050084f91ccSmrg	IS_GLIBC=0
1051084f91ccSmrg	test x"${LIBC}" = xgnu && IS_GLIBC=1
1052084f91ccSmrg	sed 's/^	//' << EOF > "$dummy.c"
1053c4f7863aSmrg	#undef CPU
1054084f91ccSmrg	#undef mips
1055084f91ccSmrg	#undef mipsel
1056084f91ccSmrg	#undef mips64
1057084f91ccSmrg	#undef mips64el
1058084f91ccSmrg	#if ${IS_GLIBC} && defined(_ABI64)
1059084f91ccSmrg	LIBCABI=gnuabi64
1060084f91ccSmrg	#else
1061084f91ccSmrg	#if ${IS_GLIBC} && defined(_ABIN32)
1062084f91ccSmrg	LIBCABI=gnuabin32
1063084f91ccSmrg	#else
1064084f91ccSmrg	LIBCABI=${LIBC}
1065084f91ccSmrg	#endif
1066084f91ccSmrg	#endif
1067084f91ccSmrg
1068084f91ccSmrg	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1069084f91ccSmrg	CPU=mipsisa64r6
1070084f91ccSmrg	#else
1071084f91ccSmrg	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1072084f91ccSmrg	CPU=mipsisa32r6
1073084f91ccSmrg	#else
1074084f91ccSmrg	#if defined(__mips64)
1075084f91ccSmrg	CPU=mips64
1076084f91ccSmrg	#else
1077084f91ccSmrg	CPU=mips
1078084f91ccSmrg	#endif
1079084f91ccSmrg	#endif
1080084f91ccSmrg	#endif
1081084f91ccSmrg
1082c4f7863aSmrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
1083084f91ccSmrg	MIPS_ENDIAN=el
1084c4f7863aSmrg	#else
1085c4f7863aSmrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
1086084f91ccSmrg	MIPS_ENDIAN=
1087c4f7863aSmrg	#else
1088084f91ccSmrg	MIPS_ENDIAN=
1089c4f7863aSmrg	#endif
1090c4f7863aSmrg	#endif
1091c4f7863aSmrgEOF
1092084f91ccSmrg	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
1093084f91ccSmrg	eval "$cc_set_vars"
1094084f91ccSmrg	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
1095084f91ccSmrg	;;
1096084f91ccSmrg    mips64el:Linux:*:*)
1097084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1098084f91ccSmrg	;;
1099084f91ccSmrg    openrisc*:Linux:*:*)
1100084f91ccSmrg	GUESS=or1k-unknown-linux-$LIBC
1101084f91ccSmrg	;;
1102084f91ccSmrg    or32:Linux:*:* | or1k*:Linux:*:*)
1103084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
11049bd41f2cSmrg	;;
11059418810dSmrg    padre:Linux:*:*)
1106084f91ccSmrg	GUESS=sparc-unknown-linux-$LIBC
1107084f91ccSmrg	;;
11080da4cdccSmrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
1109084f91ccSmrg	GUESS=hppa64-unknown-linux-$LIBC
1110084f91ccSmrg	;;
11119bd41f2cSmrg    parisc:Linux:*:* | hppa:Linux:*:*)
11129bd41f2cSmrg	# Look for CPU level
11139bd41f2cSmrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
1114084f91ccSmrg	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
1115084f91ccSmrg	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
1116084f91ccSmrg	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
11179bd41f2cSmrg	esac
1118084f91ccSmrg	;;
11190da4cdccSmrg    ppc64:Linux:*:*)
1120084f91ccSmrg	GUESS=powerpc64-unknown-linux-$LIBC
1121084f91ccSmrg	;;
11220da4cdccSmrg    ppc:Linux:*:*)
1123084f91ccSmrg	GUESS=powerpc-unknown-linux-$LIBC
1124084f91ccSmrg	;;
1125084f91ccSmrg    ppc64le:Linux:*:*)
1126084f91ccSmrg	GUESS=powerpc64le-unknown-linux-$LIBC
1127084f91ccSmrg	;;
1128084f91ccSmrg    ppcle:Linux:*:*)
1129084f91ccSmrg	GUESS=powerpcle-unknown-linux-$LIBC
1130084f91ccSmrg	;;
1131084f91ccSmrg    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
1132084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1133084f91ccSmrg	;;
11349bd41f2cSmrg    s390:Linux:*:* | s390x:Linux:*:*)
1135084f91ccSmrg	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
1136084f91ccSmrg	;;
11379bd41f2cSmrg    sh64*:Linux:*:*)
1138084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1139084f91ccSmrg	;;
11409bd41f2cSmrg    sh*:Linux:*:*)
1141084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1142084f91ccSmrg	;;
11439bd41f2cSmrg    sparc:Linux:*:* | sparc64:Linux:*:*)
1144084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1145084f91ccSmrg	;;
11460da4cdccSmrg    tile*:Linux:*:*)
1147084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1148084f91ccSmrg	;;
11499bd41f2cSmrg    vax:Linux:*:*)
1150084f91ccSmrg	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
1151084f91ccSmrg	;;
11529bd41f2cSmrg    x86_64:Linux:*:*)
1153084f91ccSmrg	set_cc_for_build
1154084f91ccSmrg	CPU=$UNAME_MACHINE
1155084f91ccSmrg	LIBCABI=$LIBC
1156084f91ccSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
1157084f91ccSmrg	    ABI=64
1158084f91ccSmrg	    sed 's/^	    //' << EOF > "$dummy.c"
1159084f91ccSmrg	    #ifdef __i386__
1160084f91ccSmrg	    ABI=x86
1161084f91ccSmrg	    #else
1162084f91ccSmrg	    #ifdef __ILP32__
1163084f91ccSmrg	    ABI=x32
1164084f91ccSmrg	    #endif
1165084f91ccSmrg	    #endif
1166084f91ccSmrgEOF
1167084f91ccSmrg	    cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'`
1168084f91ccSmrg	    eval "$cc_set_abi"
1169084f91ccSmrg	    case $ABI in
1170084f91ccSmrg		x86) CPU=i686 ;;
1171084f91ccSmrg		x32) LIBCABI=${LIBC}x32 ;;
1172084f91ccSmrg	    esac
1173084f91ccSmrg	fi
1174084f91ccSmrg	GUESS=$CPU-pc-linux-$LIBCABI
1175084f91ccSmrg	;;
11769418810dSmrg    xtensa*:Linux:*:*)
1177084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
1178084f91ccSmrg	;;
11799bd41f2cSmrg    i*86:DYNIX/ptx:4*:*)
11809bd41f2cSmrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
11819bd41f2cSmrg	# earlier versions are messed up and put the nodename in both
11829bd41f2cSmrg	# sysname and nodename.
1183084f91ccSmrg	GUESS=i386-sequent-sysv4
1184084f91ccSmrg	;;
11859bd41f2cSmrg    i*86:UNIX_SV:4.2MP:2.*)
11860da4cdccSmrg	# Unixware is an offshoot of SVR4, but it has its own version
11870da4cdccSmrg	# number series starting with 2...
11880da4cdccSmrg	# I am not positive that other SVR4 systems won't match this,
11899bd41f2cSmrg	# I just have to hope.  -- rms.
11900da4cdccSmrg	# Use sysv4.2uw... so that sysv4* matches it.
1191084f91ccSmrg	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
1192084f91ccSmrg	;;
11939bd41f2cSmrg    i*86:OS/2:*:*)
11949bd41f2cSmrg	# If we were able to find `uname', then EMX Unix compatibility
11959bd41f2cSmrg	# is probably installed.
1196084f91ccSmrg	GUESS=$UNAME_MACHINE-pc-os2-emx
1197084f91ccSmrg	;;
11989bd41f2cSmrg    i*86:XTS-300:*:STOP)
1199084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-stop
1200084f91ccSmrg	;;
12019bd41f2cSmrg    i*86:atheos:*:*)
1202084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-atheos
1203084f91ccSmrg	;;
12049bd41f2cSmrg    i*86:syllable:*:*)
1205084f91ccSmrg	GUESS=$UNAME_MACHINE-pc-syllable
1206084f91ccSmrg	;;
12070da4cdccSmrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1208084f91ccSmrg	GUESS=i386-unknown-lynxos$UNAME_RELEASE
1209084f91ccSmrg	;;
12109bd41f2cSmrg    i*86:*DOS:*:*)
1211084f91ccSmrg	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
1212084f91ccSmrg	;;
1213084f91ccSmrg    i*86:*:4.*:*)
1214084f91ccSmrg	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
12159bd41f2cSmrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1216084f91ccSmrg		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
12179bd41f2cSmrg	else
1218084f91ccSmrg		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
12199bd41f2cSmrg	fi
1220084f91ccSmrg	;;
12219bd41f2cSmrg    i*86:*:5:[678]*)
12220da4cdccSmrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
12239bd41f2cSmrg	case `/bin/uname -X | grep "^Machine"` in
12249bd41f2cSmrg	    *486*)	     UNAME_MACHINE=i486 ;;
12259bd41f2cSmrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
12269bd41f2cSmrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
12279bd41f2cSmrg	esac
1228084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1229084f91ccSmrg	;;
12309bd41f2cSmrg    i*86:*:3.2:*)
12319bd41f2cSmrg	if test -f /usr/options/cb.name; then
12329bd41f2cSmrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1233084f91ccSmrg		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
12349bd41f2cSmrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
12359bd41f2cSmrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
12369bd41f2cSmrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
12379bd41f2cSmrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
12389bd41f2cSmrg			&& UNAME_MACHINE=i586
12399bd41f2cSmrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
12409bd41f2cSmrg			&& UNAME_MACHINE=i686
12419bd41f2cSmrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
12429bd41f2cSmrg			&& UNAME_MACHINE=i686
1243084f91ccSmrg		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
12449bd41f2cSmrg	else
1245084f91ccSmrg		GUESS=$UNAME_MACHINE-pc-sysv32
12469bd41f2cSmrg	fi
1247084f91ccSmrg	;;
12489bd41f2cSmrg    pc:*:*:*)
12499bd41f2cSmrg	# Left here for compatibility:
12500da4cdccSmrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
12510da4cdccSmrg	# the processor, so we play safe by assuming i586.
12520da4cdccSmrg	# Note: whatever this is, it MUST be the same as what config.sub
1253084f91ccSmrg	# prints for the "djgpp" host, or else GDB configure will decide that
12540da4cdccSmrg	# this is a cross-build.
1255084f91ccSmrg	GUESS=i586-pc-msdosdjgpp
1256084f91ccSmrg	;;
12579bd41f2cSmrg    Intel:Mach:3*:*)
1258084f91ccSmrg	GUESS=i386-pc-mach3
1259084f91ccSmrg	;;
12609bd41f2cSmrg    paragon:*:*:*)
1261084f91ccSmrg	GUESS=i860-intel-osf1
1262084f91ccSmrg	;;
12639bd41f2cSmrg    i860:*:4.*:*) # i860-SVR4
12649bd41f2cSmrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1265084f91ccSmrg	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
12669bd41f2cSmrg	else # Add other i860-SVR4 vendors below as they are discovered.
1267084f91ccSmrg	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
12689bd41f2cSmrg	fi
1269084f91ccSmrg	;;
12709bd41f2cSmrg    mini*:CTIX:SYS*5:*)
12719bd41f2cSmrg	# "miniframe"
1272084f91ccSmrg	GUESS=m68010-convergent-sysv
1273084f91ccSmrg	;;
12749bd41f2cSmrg    mc68k:UNIX:SYSTEM5:3.51m)
1275084f91ccSmrg	GUESS=m68k-convergent-sysv
1276084f91ccSmrg	;;
12779bd41f2cSmrg    M680?0:D-NIX:5.3:*)
1278084f91ccSmrg	GUESS=m68k-diab-dnix
1279084f91ccSmrg	;;
12809bd41f2cSmrg    M68*:*:R3V[5678]*:*)
12819bd41f2cSmrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
12829bd41f2cSmrg    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)
12839bd41f2cSmrg	OS_REL=''
12849bd41f2cSmrg	test -r /etc/.relid \
12859bd41f2cSmrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
12869bd41f2cSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1287084f91ccSmrg	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
12889bd41f2cSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1289084f91ccSmrg	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
12909bd41f2cSmrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
12910da4cdccSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
12920da4cdccSmrg	  && { echo i486-ncr-sysv4; exit; } ;;
12930da4cdccSmrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
12940da4cdccSmrg	OS_REL='.3'
12950da4cdccSmrg	test -r /etc/.relid \
12960da4cdccSmrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
12970da4cdccSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1298084f91ccSmrg	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
12990da4cdccSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1300084f91ccSmrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
13010da4cdccSmrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1302084f91ccSmrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
13039bd41f2cSmrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1304084f91ccSmrg	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
1305084f91ccSmrg	;;
13069bd41f2cSmrg    mc68030:UNIX_System_V:4.*:*)
1307084f91ccSmrg	GUESS=m68k-atari-sysv4
1308084f91ccSmrg	;;
13099bd41f2cSmrg    TSUNAMI:LynxOS:2.*:*)
1310084f91ccSmrg	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
1311084f91ccSmrg	;;
13129bd41f2cSmrg    rs6000:LynxOS:2.*:*)
1313084f91ccSmrg	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
1314084f91ccSmrg	;;
13150da4cdccSmrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1316084f91ccSmrg	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
1317084f91ccSmrg	;;
13189bd41f2cSmrg    SM[BE]S:UNIX_SV:*:*)
1319084f91ccSmrg	GUESS=mips-dde-sysv$UNAME_RELEASE
1320084f91ccSmrg	;;
13219bd41f2cSmrg    RM*:ReliantUNIX-*:*:*)
1322084f91ccSmrg	GUESS=mips-sni-sysv4
1323084f91ccSmrg	;;
13249bd41f2cSmrg    RM*:SINIX-*:*:*)
1325084f91ccSmrg	GUESS=mips-sni-sysv4
1326084f91ccSmrg	;;
13279bd41f2cSmrg    *:SINIX-*:*:*)
13289bd41f2cSmrg	if uname -p 2>/dev/null >/dev/null ; then
13299bd41f2cSmrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1330084f91ccSmrg		GUESS=$UNAME_MACHINE-sni-sysv4
13319bd41f2cSmrg	else
1332084f91ccSmrg		GUESS=ns32k-sni-sysv
13339bd41f2cSmrg	fi
1334084f91ccSmrg	;;
13350da4cdccSmrg    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
13360da4cdccSmrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
1337084f91ccSmrg	GUESS=i586-unisys-sysv4
1338084f91ccSmrg	;;
13399bd41f2cSmrg    *:UNIX_System_V:4*:FTX*)
13409bd41f2cSmrg	# From Gerald Hewes <hewes@openmarket.com>.
13419bd41f2cSmrg	# How about differentiating between stratus architectures? -djm
1342084f91ccSmrg	GUESS=hppa1.1-stratus-sysv4
1343084f91ccSmrg	;;
13449bd41f2cSmrg    *:*:*:FTX*)
13459bd41f2cSmrg	# From seanf@swdc.stratus.com.
1346084f91ccSmrg	GUESS=i860-stratus-sysv4
1347084f91ccSmrg	;;
13489bd41f2cSmrg    i*86:VOS:*:*)
13499bd41f2cSmrg	# From Paul.Green@stratus.com.
1350084f91ccSmrg	GUESS=$UNAME_MACHINE-stratus-vos
1351084f91ccSmrg	;;
13529bd41f2cSmrg    *:VOS:*:*)
13539bd41f2cSmrg	# From Paul.Green@stratus.com.
1354084f91ccSmrg	GUESS=hppa1.1-stratus-vos
1355084f91ccSmrg	;;
13569bd41f2cSmrg    mc68*:A/UX:*:*)
1357084f91ccSmrg	GUESS=m68k-apple-aux$UNAME_RELEASE
1358084f91ccSmrg	;;
13599bd41f2cSmrg    news*:NEWS-OS:6*:*)
1360084f91ccSmrg	GUESS=mips-sony-newsos6
1361084f91ccSmrg	;;
13629bd41f2cSmrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1363084f91ccSmrg	if test -d /usr/nec; then
1364084f91ccSmrg		GUESS=mips-nec-sysv$UNAME_RELEASE
13659bd41f2cSmrg	else
1366084f91ccSmrg		GUESS=mips-unknown-sysv$UNAME_RELEASE
13679bd41f2cSmrg	fi
1368084f91ccSmrg	;;
13699bd41f2cSmrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1370084f91ccSmrg	GUESS=powerpc-be-beos
1371084f91ccSmrg	;;
13729bd41f2cSmrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1373084f91ccSmrg	GUESS=powerpc-apple-beos
1374084f91ccSmrg	;;
13759bd41f2cSmrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1376084f91ccSmrg	GUESS=i586-pc-beos
1377084f91ccSmrg	;;
13789418810dSmrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
1379084f91ccSmrg	GUESS=i586-pc-haiku
1380084f91ccSmrg	;;
1381084f91ccSmrg    x86_64:Haiku:*:*)
1382084f91ccSmrg	GUESS=x86_64-unknown-haiku
1383084f91ccSmrg	;;
13849bd41f2cSmrg    SX-4:SUPER-UX:*:*)
1385084f91ccSmrg	GUESS=sx4-nec-superux$UNAME_RELEASE
1386084f91ccSmrg	;;
13879bd41f2cSmrg    SX-5:SUPER-UX:*:*)
1388084f91ccSmrg	GUESS=sx5-nec-superux$UNAME_RELEASE
1389084f91ccSmrg	;;
13909bd41f2cSmrg    SX-6:SUPER-UX:*:*)
1391084f91ccSmrg	GUESS=sx6-nec-superux$UNAME_RELEASE
1392084f91ccSmrg	;;
13939418810dSmrg    SX-7:SUPER-UX:*:*)
1394084f91ccSmrg	GUESS=sx7-nec-superux$UNAME_RELEASE
1395084f91ccSmrg	;;
13969418810dSmrg    SX-8:SUPER-UX:*:*)
1397084f91ccSmrg	GUESS=sx8-nec-superux$UNAME_RELEASE
1398084f91ccSmrg	;;
13999418810dSmrg    SX-8R:SUPER-UX:*:*)
1400084f91ccSmrg	GUESS=sx8r-nec-superux$UNAME_RELEASE
1401084f91ccSmrg	;;
1402084f91ccSmrg    SX-ACE:SUPER-UX:*:*)
1403084f91ccSmrg	GUESS=sxace-nec-superux$UNAME_RELEASE
1404084f91ccSmrg	;;
14059bd41f2cSmrg    Power*:Rhapsody:*:*)
1406084f91ccSmrg	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
1407084f91ccSmrg	;;
14089bd41f2cSmrg    *:Rhapsody:*:*)
1409084f91ccSmrg	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
1410084f91ccSmrg	;;
1411084f91ccSmrg    arm64:Darwin:*:*)
1412084f91ccSmrg	GUESS=aarch64-apple-darwin$UNAME_RELEASE
1413084f91ccSmrg	;;
14149bd41f2cSmrg    *:Darwin:*:*)
1415084f91ccSmrg	UNAME_PROCESSOR=`uname -p`
14169bd41f2cSmrg	case $UNAME_PROCESSOR in
14179bd41f2cSmrg	    unknown) UNAME_PROCESSOR=powerpc ;;
14189bd41f2cSmrg	esac
1419084f91ccSmrg	if command -v xcode-select > /dev/null 2> /dev/null && \
1420084f91ccSmrg		! xcode-select --print-path > /dev/null 2> /dev/null ; then
1421084f91ccSmrg	    # Avoid executing cc if there is no toolchain installed as
1422084f91ccSmrg	    # cc will be a stub that puts up a graphical alert
1423084f91ccSmrg	    # prompting the user to install developer tools.
1424084f91ccSmrg	    CC_FOR_BUILD=no_compiler_found
1425084f91ccSmrg	else
1426084f91ccSmrg	    set_cc_for_build
1427084f91ccSmrg	fi
1428084f91ccSmrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
1429084f91ccSmrg	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1430084f91ccSmrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1431084f91ccSmrg		   grep IS_64BIT_ARCH >/dev/null
1432084f91ccSmrg	    then
1433084f91ccSmrg		case $UNAME_PROCESSOR in
1434084f91ccSmrg		    i386) UNAME_PROCESSOR=x86_64 ;;
1435084f91ccSmrg		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
1436084f91ccSmrg		esac
1437084f91ccSmrg	    fi
1438084f91ccSmrg	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
1439084f91ccSmrg	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
1440084f91ccSmrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1441084f91ccSmrg		   grep IS_PPC >/dev/null
1442084f91ccSmrg	    then
1443084f91ccSmrg		UNAME_PROCESSOR=powerpc
1444084f91ccSmrg	    fi
1445084f91ccSmrg	elif test "$UNAME_PROCESSOR" = i386 ; then
1446084f91ccSmrg	    # uname -m returns i386 or x86_64
1447084f91ccSmrg	    UNAME_PROCESSOR=$UNAME_MACHINE
1448084f91ccSmrg	fi
1449084f91ccSmrg	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
1450084f91ccSmrg	;;
14519bd41f2cSmrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
14529bd41f2cSmrg	UNAME_PROCESSOR=`uname -p`
1453084f91ccSmrg	if test "$UNAME_PROCESSOR" = x86; then
14549bd41f2cSmrg		UNAME_PROCESSOR=i386
14559bd41f2cSmrg		UNAME_MACHINE=pc
14569bd41f2cSmrg	fi
1457084f91ccSmrg	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
1458084f91ccSmrg	;;
14599bd41f2cSmrg    *:QNX:*:4*)
1460084f91ccSmrg	GUESS=i386-pc-qnx
1461084f91ccSmrg	;;
1462084f91ccSmrg    NEO-*:NONSTOP_KERNEL:*:*)
1463084f91ccSmrg	GUESS=neo-tandem-nsk$UNAME_RELEASE
1464084f91ccSmrg	;;
1465084f91ccSmrg    NSE-*:NONSTOP_KERNEL:*:*)
1466084f91ccSmrg	GUESS=nse-tandem-nsk$UNAME_RELEASE
1467084f91ccSmrg	;;
1468084f91ccSmrg    NSR-*:NONSTOP_KERNEL:*:*)
1469084f91ccSmrg	GUESS=nsr-tandem-nsk$UNAME_RELEASE
1470084f91ccSmrg	;;
1471084f91ccSmrg    NSV-*:NONSTOP_KERNEL:*:*)
1472084f91ccSmrg	GUESS=nsv-tandem-nsk$UNAME_RELEASE
1473084f91ccSmrg	;;
1474084f91ccSmrg    NSX-*:NONSTOP_KERNEL:*:*)
1475084f91ccSmrg	GUESS=nsx-tandem-nsk$UNAME_RELEASE
1476084f91ccSmrg	;;
14779bd41f2cSmrg    *:NonStop-UX:*:*)
1478084f91ccSmrg	GUESS=mips-compaq-nonstopux
1479084f91ccSmrg	;;
14809bd41f2cSmrg    BS2000:POSIX*:*:*)
1481084f91ccSmrg	GUESS=bs2000-siemens-sysv
1482084f91ccSmrg	;;
14839bd41f2cSmrg    DS/*:UNIX_System_V:*:*)
1484084f91ccSmrg	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
1485084f91ccSmrg	;;
14869bd41f2cSmrg    *:Plan9:*:*)
14879bd41f2cSmrg	# "uname -m" is not consistent, so use $cputype instead. 386
14889bd41f2cSmrg	# is converted to i386 for consistency with other x86
14899bd41f2cSmrg	# operating systems.
1490084f91ccSmrg	if test "${cputype-}" = 386; then
14919bd41f2cSmrg	    UNAME_MACHINE=i386
1492084f91ccSmrg	elif test "x${cputype-}" != x; then
1493084f91ccSmrg	    UNAME_MACHINE=$cputype
14949bd41f2cSmrg	fi
1495084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-plan9
1496084f91ccSmrg	;;
14979bd41f2cSmrg    *:TOPS-10:*:*)
1498084f91ccSmrg	GUESS=pdp10-unknown-tops10
1499084f91ccSmrg	;;
15009bd41f2cSmrg    *:TENEX:*:*)
1501084f91ccSmrg	GUESS=pdp10-unknown-tenex
1502084f91ccSmrg	;;
15039bd41f2cSmrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1504084f91ccSmrg	GUESS=pdp10-dec-tops20
1505084f91ccSmrg	;;
15069bd41f2cSmrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1507084f91ccSmrg	GUESS=pdp10-xkl-tops20
1508084f91ccSmrg	;;
15099bd41f2cSmrg    *:TOPS-20:*:*)
1510084f91ccSmrg	GUESS=pdp10-unknown-tops20
1511084f91ccSmrg	;;
15129bd41f2cSmrg    *:ITS:*:*)
1513084f91ccSmrg	GUESS=pdp10-unknown-its
1514084f91ccSmrg	;;
15159bd41f2cSmrg    SEI:*:*:SEIUX)
1516084f91ccSmrg	GUESS=mips-sei-seiux$UNAME_RELEASE
1517084f91ccSmrg	;;
15189bd41f2cSmrg    *:DragonFly:*:*)
1519084f91ccSmrg	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
1520084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
1521084f91ccSmrg	;;
15229bd41f2cSmrg    *:*VMS:*:*)
15230da4cdccSmrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
1524084f91ccSmrg	case $UNAME_MACHINE in
1525084f91ccSmrg	    A*) GUESS=alpha-dec-vms ;;
1526084f91ccSmrg	    I*) GUESS=ia64-dec-vms ;;
1527084f91ccSmrg	    V*) GUESS=vax-dec-vms ;;
15289bd41f2cSmrg	esac ;;
15299bd41f2cSmrg    *:XENIX:*:SysV)
1530084f91ccSmrg	GUESS=i386-pc-xenix
1531084f91ccSmrg	;;
15329bd41f2cSmrg    i*86:skyos:*:*)
1533084f91ccSmrg	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
1534084f91ccSmrg	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
1535084f91ccSmrg	;;
15369bd41f2cSmrg    i*86:rdos:*:*)
1537084f91ccSmrg	GUESS=$UNAME_MACHINE-pc-rdos
1538084f91ccSmrg	;;
1539084f91ccSmrg    i*86:Fiwix:*:*)
1540084f91ccSmrg	GUESS=$UNAME_MACHINE-pc-fiwix
1541084f91ccSmrg	;;
1542084f91ccSmrg    *:AROS:*:*)
1543084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-aros
1544084f91ccSmrg	;;
15450da4cdccSmrg    x86_64:VMkernel:*:*)
1546084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-esx
1547084f91ccSmrg	;;
1548084f91ccSmrg    amd64:Isilon\ OneFS:*:*)
1549084f91ccSmrg	GUESS=x86_64-unknown-onefs
1550084f91ccSmrg	;;
1551084f91ccSmrg    *:Unleashed:*:*)
1552084f91ccSmrg	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
1553084f91ccSmrg	;;
15549bd41f2cSmrgesac
15559bd41f2cSmrg
1556084f91ccSmrg# Do we have a guess based on uname results?
1557084f91ccSmrgif test "x$GUESS" != x; then
1558084f91ccSmrg    echo "$GUESS"
1559084f91ccSmrg    exit
1560084f91ccSmrgfi
15619bd41f2cSmrg
1562084f91ccSmrg# No uname command or uname output not recognized.
1563084f91ccSmrgset_cc_for_build
1564084f91ccSmrgcat > "$dummy.c" <<EOF
15659bd41f2cSmrg#ifdef _SEQUENT_
1566084f91ccSmrg#include <sys/types.h>
1567084f91ccSmrg#include <sys/utsname.h>
1568084f91ccSmrg#endif
1569084f91ccSmrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1570084f91ccSmrg#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1571084f91ccSmrg#include <signal.h>
1572084f91ccSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
1573084f91ccSmrg#include <sys/utsname.h>
1574084f91ccSmrg#endif
1575084f91ccSmrg#endif
15769bd41f2cSmrg#endif
15779bd41f2cSmrgmain ()
15789bd41f2cSmrg{
15799bd41f2cSmrg#if defined (sony)
15809bd41f2cSmrg#if defined (MIPSEB)
15819bd41f2cSmrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
15829bd41f2cSmrg     I don't know....  */
15839bd41f2cSmrg  printf ("mips-sony-bsd\n"); exit (0);
15849bd41f2cSmrg#else
15859bd41f2cSmrg#include <sys/param.h>
15869bd41f2cSmrg  printf ("m68k-sony-newsos%s\n",
15879bd41f2cSmrg#ifdef NEWSOS4
1588084f91ccSmrg  "4"
15899bd41f2cSmrg#else
1590084f91ccSmrg  ""
15919bd41f2cSmrg#endif
1592084f91ccSmrg  ); exit (0);
15939bd41f2cSmrg#endif
15949bd41f2cSmrg#endif
15959bd41f2cSmrg
15969bd41f2cSmrg#if defined (NeXT)
15979bd41f2cSmrg#if !defined (__ARCHITECTURE__)
15989bd41f2cSmrg#define __ARCHITECTURE__ "m68k"
15999bd41f2cSmrg#endif
16009bd41f2cSmrg  int version;
16019bd41f2cSmrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
16029bd41f2cSmrg  if (version < 4)
16039bd41f2cSmrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
16049bd41f2cSmrg  else
16059bd41f2cSmrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
16069bd41f2cSmrg  exit (0);
16079bd41f2cSmrg#endif
16089bd41f2cSmrg
16099bd41f2cSmrg#if defined (MULTIMAX) || defined (n16)
16109bd41f2cSmrg#if defined (UMAXV)
16119bd41f2cSmrg  printf ("ns32k-encore-sysv\n"); exit (0);
16129bd41f2cSmrg#else
16139bd41f2cSmrg#if defined (CMU)
16149bd41f2cSmrg  printf ("ns32k-encore-mach\n"); exit (0);
16159bd41f2cSmrg#else
16169bd41f2cSmrg  printf ("ns32k-encore-bsd\n"); exit (0);
16179bd41f2cSmrg#endif
16189bd41f2cSmrg#endif
16199bd41f2cSmrg#endif
16209bd41f2cSmrg
16219bd41f2cSmrg#if defined (__386BSD__)
16229bd41f2cSmrg  printf ("i386-pc-bsd\n"); exit (0);
16239bd41f2cSmrg#endif
16249bd41f2cSmrg
16259bd41f2cSmrg#if defined (sequent)
16269bd41f2cSmrg#if defined (i386)
16279bd41f2cSmrg  printf ("i386-sequent-dynix\n"); exit (0);
16289bd41f2cSmrg#endif
16299bd41f2cSmrg#if defined (ns32000)
16309bd41f2cSmrg  printf ("ns32k-sequent-dynix\n"); exit (0);
16319bd41f2cSmrg#endif
16329bd41f2cSmrg#endif
16339bd41f2cSmrg
16349bd41f2cSmrg#if defined (_SEQUENT_)
1635084f91ccSmrg  struct utsname un;
16369bd41f2cSmrg
1637084f91ccSmrg  uname(&un);
1638084f91ccSmrg  if (strncmp(un.version, "V2", 2) == 0) {
1639084f91ccSmrg    printf ("i386-sequent-ptx2\n"); exit (0);
1640084f91ccSmrg  }
1641084f91ccSmrg  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1642084f91ccSmrg    printf ("i386-sequent-ptx1\n"); exit (0);
1643084f91ccSmrg  }
1644084f91ccSmrg  printf ("i386-sequent-ptx\n"); exit (0);
16459bd41f2cSmrg#endif
16469bd41f2cSmrg
16479bd41f2cSmrg#if defined (vax)
1648084f91ccSmrg#if !defined (ultrix)
1649084f91ccSmrg#include <sys/param.h>
1650084f91ccSmrg#if defined (BSD)
1651084f91ccSmrg#if BSD == 43
1652084f91ccSmrg  printf ("vax-dec-bsd4.3\n"); exit (0);
1653084f91ccSmrg#else
1654084f91ccSmrg#if BSD == 199006
1655084f91ccSmrg  printf ("vax-dec-bsd4.3reno\n"); exit (0);
1656084f91ccSmrg#else
1657084f91ccSmrg  printf ("vax-dec-bsd\n"); exit (0);
1658084f91ccSmrg#endif
1659084f91ccSmrg#endif
1660084f91ccSmrg#else
1661084f91ccSmrg  printf ("vax-dec-bsd\n"); exit (0);
1662084f91ccSmrg#endif
1663084f91ccSmrg#else
1664084f91ccSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
1665084f91ccSmrg  struct utsname un;
1666084f91ccSmrg  uname (&un);
1667084f91ccSmrg  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
1668084f91ccSmrg#else
1669084f91ccSmrg  printf ("vax-dec-ultrix\n"); exit (0);
1670084f91ccSmrg#endif
1671084f91ccSmrg#endif
1672084f91ccSmrg#endif
1673084f91ccSmrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1674084f91ccSmrg#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1675084f91ccSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
1676084f91ccSmrg  struct utsname *un;
1677084f91ccSmrg  uname (&un);
1678084f91ccSmrg  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
1679084f91ccSmrg#else
1680084f91ccSmrg  printf ("mips-dec-ultrix\n"); exit (0);
1681084f91ccSmrg#endif
1682084f91ccSmrg#endif
16839bd41f2cSmrg#endif
16849bd41f2cSmrg
16859bd41f2cSmrg#if defined (alliant) && defined (i860)
16869bd41f2cSmrg  printf ("i860-alliant-bsd\n"); exit (0);
16879bd41f2cSmrg#endif
16889bd41f2cSmrg
16899bd41f2cSmrg  exit (1);
16909bd41f2cSmrg}
16919bd41f2cSmrgEOF
16929bd41f2cSmrg
1693084f91ccSmrg$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
16949bd41f2cSmrg	{ echo "$SYSTEM_NAME"; exit; }
16959bd41f2cSmrg
16969bd41f2cSmrg# Apollos put the system type in the environment.
1697084f91ccSmrgtest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
16989bd41f2cSmrg
1699084f91ccSmrgecho "$0: unable to guess system type" >&2
17009bd41f2cSmrg
1701084f91ccSmrgcase $UNAME_MACHINE:$UNAME_SYSTEM in
1702084f91ccSmrg    mips:Linux | mips64:Linux)
1703084f91ccSmrg	# If we got here on MIPS GNU/Linux, output extra information.
1704084f91ccSmrg	cat >&2 <<EOF
17059bd41f2cSmrg
1706084f91ccSmrgNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
1707084f91ccSmrgthe system type. Please install a C compiler and try again.
1708084f91ccSmrgEOF
1709084f91ccSmrg	;;
1710084f91ccSmrgesac
17119bd41f2cSmrg
17129bd41f2cSmrgcat >&2 <<EOF
17139bd41f2cSmrg
1714084f91ccSmrgThis script (version $timestamp), has failed to recognize the
1715084f91ccSmrgoperating system you are using. If your script is old, overwrite *all*
1716084f91ccSmrgcopies of config.guess and config.sub with the latest versions from:
17179bd41f2cSmrg
1718084f91ccSmrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
17199bd41f2cSmrgand
1720084f91ccSmrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
1721084f91ccSmrgEOF
17229bd41f2cSmrg
1723084f91ccSmrgour_year=`echo $timestamp | sed 's,-.*,,'`
1724084f91ccSmrgthisyear=`date +%Y`
1725084f91ccSmrg# shellcheck disable=SC2003
1726084f91ccSmrgscript_age=`expr "$thisyear" - "$our_year"`
1727084f91ccSmrgif test "$script_age" -lt 3 ; then
1728084f91ccSmrg   cat >&2 <<EOF
1729084f91ccSmrg
1730084f91ccSmrgIf $0 has already been updated, send the following data and any
1731084f91ccSmrginformation you think might be pertinent to config-patches@gnu.org to
1732084f91ccSmrgprovide the necessary information to handle your system.
17339bd41f2cSmrg
17349bd41f2cSmrgconfig.guess timestamp = $timestamp
17359bd41f2cSmrg
17369bd41f2cSmrguname -m = `(uname -m) 2>/dev/null || echo unknown`
17379bd41f2cSmrguname -r = `(uname -r) 2>/dev/null || echo unknown`
17389bd41f2cSmrguname -s = `(uname -s) 2>/dev/null || echo unknown`
17399bd41f2cSmrguname -v = `(uname -v) 2>/dev/null || echo unknown`
17409bd41f2cSmrg
17419bd41f2cSmrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
17429bd41f2cSmrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
17439bd41f2cSmrg
17449bd41f2cSmrghostinfo               = `(hostinfo) 2>/dev/null`
17459bd41f2cSmrg/bin/universe          = `(/bin/universe) 2>/dev/null`
17469bd41f2cSmrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
17479bd41f2cSmrg/bin/arch              = `(/bin/arch) 2>/dev/null`
17489bd41f2cSmrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
17499bd41f2cSmrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
17509bd41f2cSmrg
1751084f91ccSmrgUNAME_MACHINE = "$UNAME_MACHINE"
1752084f91ccSmrgUNAME_RELEASE = "$UNAME_RELEASE"
1753084f91ccSmrgUNAME_SYSTEM  = "$UNAME_SYSTEM"
1754084f91ccSmrgUNAME_VERSION = "$UNAME_VERSION"
17559bd41f2cSmrgEOF
1756084f91ccSmrgfi
17579bd41f2cSmrg
17589bd41f2cSmrgexit 1
17599bd41f2cSmrg
17609bd41f2cSmrg# Local variables:
1761084f91ccSmrg# eval: (add-hook 'before-save-hook 'time-stamp)
17629bd41f2cSmrg# time-stamp-start: "timestamp='"
17639bd41f2cSmrg# time-stamp-format: "%:y-%02m-%02d"
17649bd41f2cSmrg# time-stamp-end: "'"
17659bd41f2cSmrg# End:
1766