config.guess revision fadff096
10eb10989Smrg#! /bin/sh
20eb10989Smrg# Attempt to guess a canonical system name.
3fadff096Smrg#   Copyright 1992-2023 Free Software Foundation, Inc.
40eb10989Smrg
574901992Smrg# shellcheck disable=SC2006,SC2268 # see below for rationale
674901992Smrg
7fadff096Smrgtimestamp='2023-01-01'
80eb10989Smrg
90eb10989Smrg# This file is free software; you can redistribute it and/or modify it
100eb10989Smrg# under the terms of the GNU General Public License as published by
11fadff096Smrg# the Free Software Foundation, either version 3 of the License, or
120eb10989Smrg# (at your option) any later version.
130eb10989Smrg#
140eb10989Smrg# This program is distributed in the hope that it will be useful, but
150eb10989Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
160eb10989Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
170eb10989Smrg# General Public License for more details.
180eb10989Smrg#
190eb10989Smrg# You should have received a copy of the GNU General Public License
20b2f5b1dbSmrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
210eb10989Smrg#
220eb10989Smrg# As a special exception to the GNU General Public License, if you
230eb10989Smrg# distribute this file as part of a program that contains a
240eb10989Smrg# configuration script generated by Autoconf, you may include it under
25079e7944Smrg# the same distribution terms that you use for the rest of that
26079e7944Smrg# program.  This Exception is an additional permission under section 7
27079e7944Smrg# of the GNU General Public License, version 3 ("GPLv3").
280eb10989Smrg#
29b2f5b1dbSmrg# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
300eb10989Smrg#
31e4c0bf4dSmrg# You can get the latest version of this script from:
3274901992Smrg# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
33079e7944Smrg#
34b2f5b1dbSmrg# Please send patches to <config-patches@gnu.org>.
35079e7944Smrg
360eb10989Smrg
3774901992Smrg# The "shellcheck disable" line above the timestamp inhibits complaints
3874901992Smrg# about features and limitations of the classic Bourne shell that were
3974901992Smrg# superseded or lifted in POSIX.  However, this script identifies a wide
4074901992Smrg# variety of pre-POSIX systems that do not have POSIX shells at all, and
4174901992Smrg# even some reasonably current systems (Solaris 10 as case-in-point) still
4274901992Smrg# have a pre-POSIX /bin/sh.
4374901992Smrg
4474901992Smrg
450eb10989Smrgme=`echo "$0" | sed -e 's,.*/,,'`
460eb10989Smrg
470eb10989Smrgusage="\
480eb10989SmrgUsage: $0 [OPTION]
490eb10989Smrg
500eb10989SmrgOutput the configuration name of the system \`$me' is run on.
510eb10989Smrg
52b2f5b1dbSmrgOptions:
530eb10989Smrg  -h, --help         print this help, then exit
540eb10989Smrg  -t, --time-stamp   print date of last modification, then exit
550eb10989Smrg  -v, --version      print version number, then exit
560eb10989Smrg
570eb10989SmrgReport bugs and patches to <config-patches@gnu.org>."
580eb10989Smrg
590eb10989Smrgversion="\
600eb10989SmrgGNU config.guess ($timestamp)
610eb10989Smrg
620eb10989SmrgOriginally written by Per Bothner.
63fadff096SmrgCopyright 1992-2023 Free Software Foundation, Inc.
640eb10989Smrg
650eb10989SmrgThis is free software; see the source for copying conditions.  There is NO
660eb10989Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
670eb10989Smrg
680eb10989Smrghelp="
690eb10989SmrgTry \`$me --help' for more information."
700eb10989Smrg
710eb10989Smrg# Parse command line
720eb10989Smrgwhile test $# -gt 0 ; do
730eb10989Smrg  case $1 in
740eb10989Smrg    --time-stamp | --time* | -t )
7563165362Smrg       echo "$timestamp" ; exit ;;
760eb10989Smrg    --version | -v )
7763165362Smrg       echo "$version" ; exit ;;
780eb10989Smrg    --help | --h* | -h )
7963165362Smrg       echo "$usage"; exit ;;
800eb10989Smrg    -- )     # Stop option processing
810eb10989Smrg       shift; break ;;
820eb10989Smrg    - )	# Use stdin as input.
830eb10989Smrg       break ;;
840eb10989Smrg    -* )
850eb10989Smrg       echo "$me: invalid option $1$help" >&2
860eb10989Smrg       exit 1 ;;
870eb10989Smrg    * )
880eb10989Smrg       break ;;
890eb10989Smrg  esac
900eb10989Smrgdone
910eb10989Smrg
920eb10989Smrgif test $# != 0; then
930eb10989Smrg  echo "$me: too many arguments$help" >&2
940eb10989Smrg  exit 1
950eb10989Smrgfi
960eb10989Smrg
9774901992Smrg# Just in case it came from the environment.
9874901992SmrgGUESS=
990eb10989Smrg
1000eb10989Smrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
1010eb10989Smrg# compiler to aid in system detection is discouraged as it requires
1020eb10989Smrg# temporary files to be created and, as you can see below, it is a
1030eb10989Smrg# headache to deal with in a portable fashion.
1040eb10989Smrg
1050eb10989Smrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
1060eb10989Smrg# use `HOST_CC' if defined, but it is deprecated.
1070eb10989Smrg
1080eb10989Smrg# Portable tmp directory creation inspired by the Autoconf team.
1090eb10989Smrg
11074901992Smrgtmp=
11174901992Smrg# shellcheck disable=SC2172
11274901992Smrgtrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
11374901992Smrg
11474901992Smrgset_cc_for_build() {
11574901992Smrg    # prevent multiple calls if $tmp is already set
11674901992Smrg    test "$tmp" && return 0
11774901992Smrg    : "${TMPDIR=/tmp}"
11874901992Smrg    # shellcheck disable=SC2039,SC3028
11974901992Smrg    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
12074901992Smrg	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
12174901992Smrg	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
12274901992Smrg	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
12374901992Smrg    dummy=$tmp/dummy
12474901992Smrg    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
12574901992Smrg	,,)    echo "int x;" > "$dummy.c"
12674901992Smrg	       for driver in cc gcc c89 c99 ; do
12774901992Smrg		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
12874901992Smrg		       CC_FOR_BUILD=$driver
12974901992Smrg		       break
13074901992Smrg		   fi
13174901992Smrg	       done
13274901992Smrg	       if test x"$CC_FOR_BUILD" = x ; then
13374901992Smrg		   CC_FOR_BUILD=no_compiler_found
13474901992Smrg	       fi
13574901992Smrg	       ;;
13674901992Smrg	,,*)   CC_FOR_BUILD=$CC ;;
13774901992Smrg	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
13874901992Smrg    esac
13974901992Smrg}
1400eb10989Smrg
1410eb10989Smrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
1420eb10989Smrg# (ghazi@noc.rutgers.edu 1994-08-24)
14374901992Smrgif test -f /.attbin/uname ; then
1440eb10989Smrg	PATH=$PATH:/.attbin ; export PATH
1450eb10989Smrgfi
1460eb10989Smrg
1470eb10989SmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
1480eb10989SmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
14974901992SmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
1500eb10989SmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
1510eb10989Smrg
15274901992Smrgcase $UNAME_SYSTEM in
153079e7944SmrgLinux|GNU|GNU/*)
15474901992Smrg	LIBC=unknown
155079e7944Smrg
15674901992Smrg	set_cc_for_build
157b2f5b1dbSmrg	cat <<-EOF > "$dummy.c"
158079e7944Smrg	#include <features.h>
159079e7944Smrg	#if defined(__UCLIBC__)
160079e7944Smrg	LIBC=uclibc
161079e7944Smrg	#elif defined(__dietlibc__)
162079e7944Smrg	LIBC=dietlibc
16374901992Smrg	#elif defined(__GLIBC__)
164079e7944Smrg	LIBC=gnu
16574901992Smrg	#else
16674901992Smrg	#include <stdarg.h>
16774901992Smrg	/* First heuristic to detect musl libc.  */
16874901992Smrg	#ifdef __DEFINED_va_list
16974901992Smrg	LIBC=musl
17074901992Smrg	#endif
171079e7944Smrg	#endif
172079e7944Smrg	EOF
17374901992Smrg	cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
17474901992Smrg	eval "$cc_set_libc"
175b2f5b1dbSmrg
17674901992Smrg	# Second heuristic to detect musl libc.
17774901992Smrg	if [ "$LIBC" = unknown ] &&
17874901992Smrg	   command -v ldd >/dev/null &&
17974901992Smrg	   ldd --version 2>&1 | grep -q ^musl; then
18074901992Smrg		LIBC=musl
18174901992Smrg	fi
18274901992Smrg
18374901992Smrg	# If the system lacks a compiler, then just pick glibc.
18474901992Smrg	# We could probably try harder.
18574901992Smrg	if [ "$LIBC" = unknown ]; then
18674901992Smrg		LIBC=gnu
187b2f5b1dbSmrg	fi
188079e7944Smrg	;;
189079e7944Smrgesac
190079e7944Smrg
1910eb10989Smrg# Note: order is significant - the case branches are not exclusive.
1920eb10989Smrg
19374901992Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
1940eb10989Smrg    *:NetBSD:*:*)
1950eb10989Smrg	# NetBSD (nbsd) targets should (where applicable) match one or
196079e7944Smrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
1970eb10989Smrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
1980eb10989Smrg	# switched to ELF, *-*-netbsd* would select the old
1990eb10989Smrg	# object file format.  This provides both forward
2000eb10989Smrg	# compatibility and a consistent mechanism for selecting the
2010eb10989Smrg	# object file format.
2020eb10989Smrg	#
2030eb10989Smrg	# Note: NetBSD doesn't particularly care about the vendor
2040eb10989Smrg	# portion of the name.  We always set it to "unknown".
205b2f5b1dbSmrg	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
20674901992Smrg	    /sbin/sysctl -n hw.machine_arch 2>/dev/null || \
20774901992Smrg	    /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \
208b2f5b1dbSmrg	    echo unknown)`
20974901992Smrg	case $UNAME_MACHINE_ARCH in
21074901992Smrg	    aarch64eb) machine=aarch64_be-unknown ;;
2110eb10989Smrg	    armeb) machine=armeb-unknown ;;
2120eb10989Smrg	    arm*) machine=arm-unknown ;;
2130eb10989Smrg	    sh3el) machine=shl-unknown ;;
2140eb10989Smrg	    sh3eb) machine=sh-unknown ;;
2150eb10989Smrg	    sh5el) machine=sh5le-unknown ;;
216b2f5b1dbSmrg	    earmv*)
217b2f5b1dbSmrg		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
218b2f5b1dbSmrg		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
21974901992Smrg		machine=${arch}${endian}-unknown
220b2f5b1dbSmrg		;;
22174901992Smrg	    *) machine=$UNAME_MACHINE_ARCH-unknown ;;
2220eb10989Smrg	esac
2230eb10989Smrg	# The Operating System including object format, if it has switched
224b2f5b1dbSmrg	# to ELF recently (or will in the future) and ABI.
22574901992Smrg	case $UNAME_MACHINE_ARCH in
226b2f5b1dbSmrg	    earm*)
227b2f5b1dbSmrg		os=netbsdelf
228b2f5b1dbSmrg		;;
2290eb10989Smrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
23074901992Smrg		set_cc_for_build
2310eb10989Smrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
232e4c0bf4dSmrg			| grep -q __ELF__
2330eb10989Smrg		then
2340eb10989Smrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
2350eb10989Smrg		    # Return netbsd for either.  FIX?
2360eb10989Smrg		    os=netbsd
2370eb10989Smrg		else
2380eb10989Smrg		    os=netbsdelf
2390eb10989Smrg		fi
2400eb10989Smrg		;;
2410eb10989Smrg	    *)
242079e7944Smrg		os=netbsd
2430eb10989Smrg		;;
2440eb10989Smrg	esac
245b2f5b1dbSmrg	# Determine ABI tags.
24674901992Smrg	case $UNAME_MACHINE_ARCH in
247b2f5b1dbSmrg	    earm*)
248b2f5b1dbSmrg		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
249b2f5b1dbSmrg		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
250b2f5b1dbSmrg		;;
251b2f5b1dbSmrg	esac
2520eb10989Smrg	# The OS release
2530eb10989Smrg	# Debian GNU/NetBSD machines have a different userland, and
2540eb10989Smrg	# thus, need a distinct triplet. However, they do not need
2550eb10989Smrg	# kernel version information, so it can be replaced with a
2560eb10989Smrg	# suitable tag, in the style of linux-gnu.
25774901992Smrg	case $UNAME_VERSION in
2580eb10989Smrg	    Debian*)
2590eb10989Smrg		release='-gnu'
2600eb10989Smrg		;;
2610eb10989Smrg	    *)
262b2f5b1dbSmrg		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
2630eb10989Smrg		;;
2640eb10989Smrg	esac
2650eb10989Smrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
2660eb10989Smrg	# contains redundant information, the shorter form:
2670eb10989Smrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
26874901992Smrg	GUESS=$machine-${os}${release}${abi-}
26974901992Smrg	;;
270079e7944Smrg    *:Bitrig:*:*)
271079e7944Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
27274901992Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE
27374901992Smrg	;;
2740eb10989Smrg    *:OpenBSD:*:*)
27563165362Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
27674901992Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE
27774901992Smrg	;;
27874901992Smrg    *:SecBSD:*:*)
27974901992Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'`
28074901992Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE
28174901992Smrg	;;
282b2f5b1dbSmrg    *:LibertyBSD:*:*)
283b2f5b1dbSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
28474901992Smrg	GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE
28574901992Smrg	;;
286b2f5b1dbSmrg    *:MidnightBSD:*:*)
28774901992Smrg	GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE
28874901992Smrg	;;
2890eb10989Smrg    *:ekkoBSD:*:*)
29074901992Smrg	GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE
29174901992Smrg	;;
29263165362Smrg    *:SolidBSD:*:*)
29374901992Smrg	GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE
29474901992Smrg	;;
29574901992Smrg    *:OS108:*:*)
29674901992Smrg	GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE
29774901992Smrg	;;
2980eb10989Smrg    macppc:MirBSD:*:*)
29974901992Smrg	GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE
30074901992Smrg	;;
3010eb10989Smrg    *:MirBSD:*:*)
30274901992Smrg	GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE
30374901992Smrg	;;
304b2f5b1dbSmrg    *:Sortix:*:*)
30574901992Smrg	GUESS=$UNAME_MACHINE-unknown-sortix
30674901992Smrg	;;
30774901992Smrg    *:Twizzler:*:*)
30874901992Smrg	GUESS=$UNAME_MACHINE-unknown-twizzler
30974901992Smrg	;;
310b2f5b1dbSmrg    *:Redox:*:*)
31174901992Smrg	GUESS=$UNAME_MACHINE-unknown-redox
31274901992Smrg	;;
313b2f5b1dbSmrg    mips:OSF1:*.*)
31474901992Smrg	GUESS=mips-dec-osf1
31574901992Smrg	;;
3160eb10989Smrg    alpha:OSF1:*:*)
31774901992Smrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
31874901992Smrg	trap '' 0
3190eb10989Smrg	case $UNAME_RELEASE in
3200eb10989Smrg	*4.0)
3210eb10989Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
3220eb10989Smrg		;;
3230eb10989Smrg	*5.*)
324079e7944Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
3250eb10989Smrg		;;
3260eb10989Smrg	esac
3270eb10989Smrg	# According to Compaq, /usr/sbin/psrinfo has been available on
3280eb10989Smrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
3290eb10989Smrg	# covers most systems running today.  This code pipes the CPU
3300eb10989Smrg	# types through head -n 1, so we only detect the type of CPU 0.
3310eb10989Smrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
33274901992Smrg	case $ALPHA_CPU_TYPE in
3330eb10989Smrg	    "EV4 (21064)")
334b2f5b1dbSmrg		UNAME_MACHINE=alpha ;;
3350eb10989Smrg	    "EV4.5 (21064)")
336b2f5b1dbSmrg		UNAME_MACHINE=alpha ;;
3370eb10989Smrg	    "LCA4 (21066/21068)")
338b2f5b1dbSmrg		UNAME_MACHINE=alpha ;;
3390eb10989Smrg	    "EV5 (21164)")
340b2f5b1dbSmrg		UNAME_MACHINE=alphaev5 ;;
3410eb10989Smrg	    "EV5.6 (21164A)")
342b2f5b1dbSmrg		UNAME_MACHINE=alphaev56 ;;
3430eb10989Smrg	    "EV5.6 (21164PC)")
344b2f5b1dbSmrg		UNAME_MACHINE=alphapca56 ;;
3450eb10989Smrg	    "EV5.7 (21164PC)")
346b2f5b1dbSmrg		UNAME_MACHINE=alphapca57 ;;
3470eb10989Smrg	    "EV6 (21264)")
348b2f5b1dbSmrg		UNAME_MACHINE=alphaev6 ;;
3490eb10989Smrg	    "EV6.7 (21264A)")
350b2f5b1dbSmrg		UNAME_MACHINE=alphaev67 ;;
3510eb10989Smrg	    "EV6.8CB (21264C)")
352b2f5b1dbSmrg		UNAME_MACHINE=alphaev68 ;;
3530eb10989Smrg	    "EV6.8AL (21264B)")
354b2f5b1dbSmrg		UNAME_MACHINE=alphaev68 ;;
3550eb10989Smrg	    "EV6.8CX (21264D)")
356b2f5b1dbSmrg		UNAME_MACHINE=alphaev68 ;;
3570eb10989Smrg	    "EV6.9A (21264/EV69A)")
358b2f5b1dbSmrg		UNAME_MACHINE=alphaev69 ;;
3590eb10989Smrg	    "EV7 (21364)")
360b2f5b1dbSmrg		UNAME_MACHINE=alphaev7 ;;
3610eb10989Smrg	    "EV7.9 (21364A)")
362b2f5b1dbSmrg		UNAME_MACHINE=alphaev79 ;;
3630eb10989Smrg	esac
3640eb10989Smrg	# A Pn.n version is a patched version.
3650eb10989Smrg	# A Vn.n version is a released version.
3660eb10989Smrg	# A Tn.n version is a released field test version.
3670eb10989Smrg	# A Xn.n version is an unreleased experimental baselevel.
3680eb10989Smrg	# 1.2 uses "1.2" for uname -r.
36974901992Smrg	OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
37074901992Smrg	GUESS=$UNAME_MACHINE-dec-osf$OSF_REL
37174901992Smrg	;;
3720eb10989Smrg    Amiga*:UNIX_System_V:4.0:*)
37374901992Smrg	GUESS=m68k-unknown-sysv4
37474901992Smrg	;;
3750eb10989Smrg    *:[Aa]miga[Oo][Ss]:*:*)
37674901992Smrg	GUESS=$UNAME_MACHINE-unknown-amigaos
37774901992Smrg	;;
3780eb10989Smrg    *:[Mm]orph[Oo][Ss]:*:*)
37974901992Smrg	GUESS=$UNAME_MACHINE-unknown-morphos
38074901992Smrg	;;
3810eb10989Smrg    *:OS/390:*:*)
38274901992Smrg	GUESS=i370-ibm-openedition
38374901992Smrg	;;
38463165362Smrg    *:z/VM:*:*)
38574901992Smrg	GUESS=s390-ibm-zvmoe
38674901992Smrg	;;
3870eb10989Smrg    *:OS400:*:*)
38874901992Smrg	GUESS=powerpc-ibm-os400
38974901992Smrg	;;
3900eb10989Smrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
39174901992Smrg	GUESS=arm-acorn-riscix$UNAME_RELEASE
39274901992Smrg	;;
393079e7944Smrg    arm*:riscos:*:*|arm*:RISCOS:*:*)
39474901992Smrg	GUESS=arm-unknown-riscos
39574901992Smrg	;;
3960eb10989Smrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
39774901992Smrg	GUESS=hppa1.1-hitachi-hiuxmpp
39874901992Smrg	;;
3990eb10989Smrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
4000eb10989Smrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
40174901992Smrg	case `(/bin/universe) 2>/dev/null` in
40274901992Smrg	    att) GUESS=pyramid-pyramid-sysv3 ;;
40374901992Smrg	    *)   GUESS=pyramid-pyramid-bsd   ;;
40474901992Smrg	esac
40574901992Smrg	;;
4060eb10989Smrg    NILE*:*:*:dcosx)
40774901992Smrg	GUESS=pyramid-pyramid-svr4
40874901992Smrg	;;
4090eb10989Smrg    DRS?6000:unix:4.0:6*)
41074901992Smrg	GUESS=sparc-icl-nx6
41174901992Smrg	;;
41263165362Smrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
4130eb10989Smrg	case `/usr/bin/uname -p` in
41474901992Smrg	    sparc) GUESS=sparc-icl-nx7 ;;
41574901992Smrg	esac
41674901992Smrg	;;
41763165362Smrg    s390x:SunOS:*:*)
41874901992Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
41974901992Smrg	GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL
42074901992Smrg	;;
4210eb10989Smrg    sun4H:SunOS:5.*:*)
42274901992Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
42374901992Smrg	GUESS=sparc-hal-solaris2$SUN_REL
42474901992Smrg	;;
4250eb10989Smrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
42674901992Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
42774901992Smrg	GUESS=sparc-sun-solaris2$SUN_REL
42874901992Smrg	;;
429e4c0bf4dSmrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
43074901992Smrg	GUESS=i386-pc-auroraux$UNAME_RELEASE
43174901992Smrg	;;
43263165362Smrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
43374901992Smrg	set_cc_for_build
434b2f5b1dbSmrg	SUN_ARCH=i386
43563165362Smrg	# If there is a compiler, see if it is configured for 64-bit objects.
43663165362Smrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
43763165362Smrg	# This test works for both compilers.
43874901992Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
43963165362Smrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
440fadff096Smrg		(CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \
44163165362Smrg		grep IS_64BIT_ARCH >/dev/null
44263165362Smrg	    then
443b2f5b1dbSmrg		SUN_ARCH=x86_64
44463165362Smrg	    fi
44563165362Smrg	fi
44674901992Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
44774901992Smrg	GUESS=$SUN_ARCH-pc-solaris2$SUN_REL
44874901992Smrg	;;
4490eb10989Smrg    sun4*:SunOS:6*:*)
4500eb10989Smrg	# According to config.sub, this is the proper way to canonicalize
4510eb10989Smrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
4520eb10989Smrg	# it's likely to be more like Solaris than SunOS4.
45374901992Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
45474901992Smrg	GUESS=sparc-sun-solaris3$SUN_REL
45574901992Smrg	;;
4560eb10989Smrg    sun4*:SunOS:*:*)
45774901992Smrg	case `/usr/bin/arch -k` in
4580eb10989Smrg	    Series*|S4*)
4590eb10989Smrg		UNAME_RELEASE=`uname -v`
4600eb10989Smrg		;;
4610eb10989Smrg	esac
4620eb10989Smrg	# Japanese Language versions have a version number like `4.1.3-JL'.
46374901992Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'`
46474901992Smrg	GUESS=sparc-sun-sunos$SUN_REL
46574901992Smrg	;;
4660eb10989Smrg    sun3*:SunOS:*:*)
46774901992Smrg	GUESS=m68k-sun-sunos$UNAME_RELEASE
46874901992Smrg	;;
4690eb10989Smrg    sun*:*:4.2BSD:*)
4700eb10989Smrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
471b2f5b1dbSmrg	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
47274901992Smrg	case `/bin/arch` in
4730eb10989Smrg	    sun3)
47474901992Smrg		GUESS=m68k-sun-sunos$UNAME_RELEASE
4750eb10989Smrg		;;
4760eb10989Smrg	    sun4)
47774901992Smrg		GUESS=sparc-sun-sunos$UNAME_RELEASE
4780eb10989Smrg		;;
4790eb10989Smrg	esac
48074901992Smrg	;;
4810eb10989Smrg    aushp:SunOS:*:*)
48274901992Smrg	GUESS=sparc-auspex-sunos$UNAME_RELEASE
48374901992Smrg	;;
4840eb10989Smrg    # The situation for MiNT is a little confusing.  The machine name
4850eb10989Smrg    # can be virtually everything (everything which is not
4860eb10989Smrg    # "atarist" or "atariste" at least should have a processor
4870eb10989Smrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
4880eb10989Smrg    # to the lowercase version "mint" (or "freemint").  Finally
4890eb10989Smrg    # the system name "TOS" denotes a system which is actually not
4900eb10989Smrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
4910eb10989Smrg    # be no problem.
4920eb10989Smrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
49374901992Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
49474901992Smrg	;;
4950eb10989Smrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
49674901992Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
49774901992Smrg	;;
4980eb10989Smrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
49974901992Smrg	GUESS=m68k-atari-mint$UNAME_RELEASE
50074901992Smrg	;;
5010eb10989Smrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
50274901992Smrg	GUESS=m68k-milan-mint$UNAME_RELEASE
50374901992Smrg	;;
5040eb10989Smrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
50574901992Smrg	GUESS=m68k-hades-mint$UNAME_RELEASE
50674901992Smrg	;;
5070eb10989Smrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
50874901992Smrg	GUESS=m68k-unknown-mint$UNAME_RELEASE
50974901992Smrg	;;
5100eb10989Smrg    m68k:machten:*:*)
51174901992Smrg	GUESS=m68k-apple-machten$UNAME_RELEASE
51274901992Smrg	;;
5130eb10989Smrg    powerpc:machten:*:*)
51474901992Smrg	GUESS=powerpc-apple-machten$UNAME_RELEASE
51574901992Smrg	;;
5160eb10989Smrg    RISC*:Mach:*:*)
51774901992Smrg	GUESS=mips-dec-mach_bsd4.3
51874901992Smrg	;;
5190eb10989Smrg    RISC*:ULTRIX:*:*)
52074901992Smrg	GUESS=mips-dec-ultrix$UNAME_RELEASE
52174901992Smrg	;;
5220eb10989Smrg    VAX*:ULTRIX*:*:*)
52374901992Smrg	GUESS=vax-dec-ultrix$UNAME_RELEASE
52474901992Smrg	;;
5250eb10989Smrg    2020:CLIX:*:* | 2430:CLIX:*:*)
52674901992Smrg	GUESS=clipper-intergraph-clix$UNAME_RELEASE
52774901992Smrg	;;
5280eb10989Smrg    mips:*:*:UMIPS | mips:*:*:RISCos)
52974901992Smrg	set_cc_for_build
530b2f5b1dbSmrg	sed 's/^	//' << EOF > "$dummy.c"
5310eb10989Smrg#ifdef __cplusplus
5320eb10989Smrg#include <stdio.h>  /* for printf() prototype */
5330eb10989Smrg	int main (int argc, char *argv[]) {
5340eb10989Smrg#else
5350eb10989Smrg	int main (argc, argv) int argc; char *argv[]; {
5360eb10989Smrg#endif
5370eb10989Smrg	#if defined (host_mips) && defined (MIPSEB)
5380eb10989Smrg	#if defined (SYSTYPE_SYSV)
539b2f5b1dbSmrg	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
5400eb10989Smrg	#endif
5410eb10989Smrg	#if defined (SYSTYPE_SVR4)
542b2f5b1dbSmrg	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
5430eb10989Smrg	#endif
5440eb10989Smrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
545b2f5b1dbSmrg	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
5460eb10989Smrg	#endif
5470eb10989Smrg	#endif
5480eb10989Smrg	  exit (-1);
5490eb10989Smrg	}
5500eb10989SmrgEOF
551b2f5b1dbSmrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
552b2f5b1dbSmrg	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
553b2f5b1dbSmrg	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
55463165362Smrg	    { echo "$SYSTEM_NAME"; exit; }
55574901992Smrg	GUESS=mips-mips-riscos$UNAME_RELEASE
55674901992Smrg	;;
5570eb10989Smrg    Motorola:PowerMAX_OS:*:*)
55874901992Smrg	GUESS=powerpc-motorola-powermax
55974901992Smrg	;;
5600eb10989Smrg    Motorola:*:4.3:PL8-*)
56174901992Smrg	GUESS=powerpc-harris-powermax
56274901992Smrg	;;
5630eb10989Smrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
56474901992Smrg	GUESS=powerpc-harris-powermax
56574901992Smrg	;;
5660eb10989Smrg    Night_Hawk:Power_UNIX:*:*)
56774901992Smrg	GUESS=powerpc-harris-powerunix
56874901992Smrg	;;
5690eb10989Smrg    m88k:CX/UX:7*:*)
57074901992Smrg	GUESS=m88k-harris-cxux7
57174901992Smrg	;;
5720eb10989Smrg    m88k:*:4*:R4*)
57374901992Smrg	GUESS=m88k-motorola-sysv4
57474901992Smrg	;;
5750eb10989Smrg    m88k:*:3*:R3*)
57674901992Smrg	GUESS=m88k-motorola-sysv3
57774901992Smrg	;;
5780eb10989Smrg    AViiON:dgux:*:*)
579079e7944Smrg	# DG/UX returns AViiON for all architectures
580079e7944Smrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
58174901992Smrg	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
5820eb10989Smrg	then
58374901992Smrg	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
58474901992Smrg	       test "$TARGET_BINARY_INTERFACE"x = x
5850eb10989Smrg	    then
58674901992Smrg		GUESS=m88k-dg-dgux$UNAME_RELEASE
5870eb10989Smrg	    else
58874901992Smrg		GUESS=m88k-dg-dguxbcs$UNAME_RELEASE
5890eb10989Smrg	    fi
5900eb10989Smrg	else
59174901992Smrg	    GUESS=i586-dg-dgux$UNAME_RELEASE
5920eb10989Smrg	fi
59374901992Smrg	;;
5940eb10989Smrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
59574901992Smrg	GUESS=m88k-dolphin-sysv3
59674901992Smrg	;;
5970eb10989Smrg    M88*:*:R3*:*)
5980eb10989Smrg	# Delta 88k system running SVR3
59974901992Smrg	GUESS=m88k-motorola-sysv3
60074901992Smrg	;;
6010eb10989Smrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
60274901992Smrg	GUESS=m88k-tektronix-sysv3
60374901992Smrg	;;
6040eb10989Smrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
60574901992Smrg	GUESS=m68k-tektronix-bsd
60674901992Smrg	;;
6070eb10989Smrg    *:IRIX*:*:*)
60874901992Smrg	IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'`
60974901992Smrg	GUESS=mips-sgi-irix$IRIX_REL
61074901992Smrg	;;
6110eb10989Smrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
61274901992Smrg	GUESS=romp-ibm-aix    # uname -m gives an 8 hex-code CPU id
61374901992Smrg	;;                    # Note that: echo "'`uname -s`'" gives 'AIX '
6140eb10989Smrg    i*86:AIX:*:*)
61574901992Smrg	GUESS=i386-ibm-aix
61674901992Smrg	;;
6170eb10989Smrg    ia64:AIX:*:*)
61874901992Smrg	if test -x /usr/bin/oslevel ; then
6190eb10989Smrg		IBM_REV=`/usr/bin/oslevel`
6200eb10989Smrg	else
62174901992Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
6220eb10989Smrg	fi
62374901992Smrg	GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV
62474901992Smrg	;;
6250eb10989Smrg    *:AIX:2:3)
6260eb10989Smrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
62774901992Smrg		set_cc_for_build
628b2f5b1dbSmrg		sed 's/^		//' << EOF > "$dummy.c"
6290eb10989Smrg		#include <sys/systemcfg.h>
6300eb10989Smrg
6310eb10989Smrg		main()
6320eb10989Smrg			{
6330eb10989Smrg			if (!__power_pc())
6340eb10989Smrg				exit(1);
6350eb10989Smrg			puts("powerpc-ibm-aix3.2.5");
6360eb10989Smrg			exit(0);
6370eb10989Smrg			}
6380eb10989SmrgEOF
639b2f5b1dbSmrg		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
64063165362Smrg		then
64174901992Smrg			GUESS=$SYSTEM_NAME
64263165362Smrg		else
64374901992Smrg			GUESS=rs6000-ibm-aix3.2.5
64463165362Smrg		fi
6450eb10989Smrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
64674901992Smrg		GUESS=rs6000-ibm-aix3.2.4
6470eb10989Smrg	else
64874901992Smrg		GUESS=rs6000-ibm-aix3.2
6490eb10989Smrg	fi
65074901992Smrg	;;
651d43532a6Smrg    *:AIX:*:[4567])
6520eb10989Smrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
653b2f5b1dbSmrg	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
6540eb10989Smrg		IBM_ARCH=rs6000
6550eb10989Smrg	else
6560eb10989Smrg		IBM_ARCH=powerpc
6570eb10989Smrg	fi
65874901992Smrg	if test -x /usr/bin/lslpp ; then
65974901992Smrg		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \
660b2f5b1dbSmrg			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
6610eb10989Smrg	else
66274901992Smrg		IBM_REV=$UNAME_VERSION.$UNAME_RELEASE
6630eb10989Smrg	fi
66474901992Smrg	GUESS=$IBM_ARCH-ibm-aix$IBM_REV
66574901992Smrg	;;
6660eb10989Smrg    *:AIX:*:*)
66774901992Smrg	GUESS=rs6000-ibm-aix
66874901992Smrg	;;
669b2f5b1dbSmrg    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
67074901992Smrg	GUESS=romp-ibm-bsd4.4
67174901992Smrg	;;
6720eb10989Smrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
67374901992Smrg	GUESS=romp-ibm-bsd$UNAME_RELEASE    # 4.3 with uname added to
67474901992Smrg	;;                                  # report: romp-ibm BSD 4.3
6750eb10989Smrg    *:BOSX:*:*)
67674901992Smrg	GUESS=rs6000-bull-bosx
67774901992Smrg	;;
6780eb10989Smrg    DPX/2?00:B.O.S.:*:*)
67974901992Smrg	GUESS=m68k-bull-sysv3
68074901992Smrg	;;
6810eb10989Smrg    9000/[34]??:4.3bsd:1.*:*)
68274901992Smrg	GUESS=m68k-hp-bsd
68374901992Smrg	;;
6840eb10989Smrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
68574901992Smrg	GUESS=m68k-hp-bsd4.4
68674901992Smrg	;;
6870eb10989Smrg    9000/[34678]??:HP-UX:*:*)
68874901992Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
68974901992Smrg	case $UNAME_MACHINE in
690b2f5b1dbSmrg	    9000/31?)            HP_ARCH=m68000 ;;
691b2f5b1dbSmrg	    9000/[34]??)         HP_ARCH=m68k ;;
6920eb10989Smrg	    9000/[678][0-9][0-9])
69374901992Smrg		if test -x /usr/bin/getconf; then
6940eb10989Smrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
695079e7944Smrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
69674901992Smrg		    case $sc_cpu_version in
697b2f5b1dbSmrg		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
698b2f5b1dbSmrg		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
699079e7944Smrg		      532)                      # CPU_PA_RISC2_0
70074901992Smrg			case $sc_kernel_bits in
701b2f5b1dbSmrg			  32) HP_ARCH=hppa2.0n ;;
702b2f5b1dbSmrg			  64) HP_ARCH=hppa2.0w ;;
703b2f5b1dbSmrg			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
704079e7944Smrg			esac ;;
705079e7944Smrg		    esac
7060eb10989Smrg		fi
70774901992Smrg		if test "$HP_ARCH" = ""; then
70874901992Smrg		    set_cc_for_build
709b2f5b1dbSmrg		    sed 's/^		//' << EOF > "$dummy.c"
7100eb10989Smrg
711079e7944Smrg		#define _HPUX_SOURCE
712079e7944Smrg		#include <stdlib.h>
713079e7944Smrg		#include <unistd.h>
7140eb10989Smrg
715079e7944Smrg		int main ()
716079e7944Smrg		{
717079e7944Smrg		#if defined(_SC_KERNEL_BITS)
718079e7944Smrg		    long bits = sysconf(_SC_KERNEL_BITS);
719079e7944Smrg		#endif
720079e7944Smrg		    long cpu  = sysconf (_SC_CPU_VERSION);
7210eb10989Smrg
722079e7944Smrg		    switch (cpu)
723079e7944Smrg			{
724079e7944Smrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
725079e7944Smrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
726079e7944Smrg			case CPU_PA_RISC2_0:
727079e7944Smrg		#if defined(_SC_KERNEL_BITS)
728079e7944Smrg			    switch (bits)
729079e7944Smrg				{
730079e7944Smrg				case 64: puts ("hppa2.0w"); break;
731079e7944Smrg				case 32: puts ("hppa2.0n"); break;
732079e7944Smrg				default: puts ("hppa2.0"); break;
733079e7944Smrg				} break;
734079e7944Smrg		#else  /* !defined(_SC_KERNEL_BITS) */
735079e7944Smrg			    puts ("hppa2.0"); break;
736079e7944Smrg		#endif
737079e7944Smrg			default: puts ("hppa1.0"); break;
738079e7944Smrg			}
739079e7944Smrg		    exit (0);
740079e7944Smrg		}
7410eb10989SmrgEOF
742b2f5b1dbSmrg		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
7430eb10989Smrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
7440eb10989Smrg		fi ;;
7450eb10989Smrg	esac
74674901992Smrg	if test "$HP_ARCH" = hppa2.0w
7470eb10989Smrg	then
74874901992Smrg	    set_cc_for_build
74963165362Smrg
75063165362Smrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
75163165362Smrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
75263165362Smrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
75363165362Smrg	    #
75463165362Smrg	    # $ CC_FOR_BUILD=cc ./config.guess
75563165362Smrg	    # => hppa2.0w-hp-hpux11.23
75663165362Smrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
75763165362Smrg	    # => hppa64-hp-hpux11.23
75863165362Smrg
759b2f5b1dbSmrg	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
760e4c0bf4dSmrg		grep -q __LP64__
7610eb10989Smrg	    then
762b2f5b1dbSmrg		HP_ARCH=hppa2.0w
7630eb10989Smrg	    else
764b2f5b1dbSmrg		HP_ARCH=hppa64
7650eb10989Smrg	    fi
7660eb10989Smrg	fi
76774901992Smrg	GUESS=$HP_ARCH-hp-hpux$HPUX_REV
76874901992Smrg	;;
7690eb10989Smrg    ia64:HP-UX:*:*)
77074901992Smrg	HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'`
77174901992Smrg	GUESS=ia64-hp-hpux$HPUX_REV
77274901992Smrg	;;
7730eb10989Smrg    3050*:HI-UX:*:*)
77474901992Smrg	set_cc_for_build
775b2f5b1dbSmrg	sed 's/^	//' << EOF > "$dummy.c"
7760eb10989Smrg	#include <unistd.h>
7770eb10989Smrg	int
7780eb10989Smrg	main ()
7790eb10989Smrg	{
7800eb10989Smrg	  long cpu = sysconf (_SC_CPU_VERSION);
7810eb10989Smrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
7820eb10989Smrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
7830eb10989Smrg	     results, however.  */
7840eb10989Smrg	  if (CPU_IS_PA_RISC (cpu))
7850eb10989Smrg	    {
7860eb10989Smrg	      switch (cpu)
7870eb10989Smrg		{
7880eb10989Smrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
7890eb10989Smrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
7900eb10989Smrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
7910eb10989Smrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
7920eb10989Smrg		}
7930eb10989Smrg	    }
7940eb10989Smrg	  else if (CPU_IS_HP_MC68K (cpu))
7950eb10989Smrg	    puts ("m68k-hitachi-hiuxwe2");
7960eb10989Smrg	  else puts ("unknown-hitachi-hiuxwe2");
7970eb10989Smrg	  exit (0);
7980eb10989Smrg	}
7990eb10989SmrgEOF
800b2f5b1dbSmrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
80163165362Smrg		{ echo "$SYSTEM_NAME"; exit; }
80274901992Smrg	GUESS=unknown-hitachi-hiuxwe2
80374901992Smrg	;;
804b2f5b1dbSmrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
80574901992Smrg	GUESS=hppa1.1-hp-bsd
80674901992Smrg	;;
8070eb10989Smrg    9000/8??:4.3bsd:*:*)
80874901992Smrg	GUESS=hppa1.0-hp-bsd
80974901992Smrg	;;
8100eb10989Smrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
81174901992Smrg	GUESS=hppa1.0-hp-mpeix
81274901992Smrg	;;
813b2f5b1dbSmrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
81474901992Smrg	GUESS=hppa1.1-hp-osf
81574901992Smrg	;;
8160eb10989Smrg    hp8??:OSF1:*:*)
81774901992Smrg	GUESS=hppa1.0-hp-osf
81874901992Smrg	;;
8190eb10989Smrg    i*86:OSF1:*:*)
82074901992Smrg	if test -x /usr/sbin/sysversion ; then
82174901992Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1mk
8220eb10989Smrg	else
82374901992Smrg	    GUESS=$UNAME_MACHINE-unknown-osf1
8240eb10989Smrg	fi
82574901992Smrg	;;
8260eb10989Smrg    parisc*:Lites*:*:*)
82774901992Smrg	GUESS=hppa1.1-hp-lites
82874901992Smrg	;;
8290eb10989Smrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
83074901992Smrg	GUESS=c1-convex-bsd
83174901992Smrg	;;
8320eb10989Smrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
8330eb10989Smrg	if getsysinfo -f scalar_acc
8340eb10989Smrg	then echo c32-convex-bsd
8350eb10989Smrg	else echo c2-convex-bsd
8360eb10989Smrg	fi
837079e7944Smrg	exit ;;
8380eb10989Smrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
83974901992Smrg	GUESS=c34-convex-bsd
84074901992Smrg	;;
8410eb10989Smrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
84274901992Smrg	GUESS=c38-convex-bsd
84374901992Smrg	;;
8440eb10989Smrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
84574901992Smrg	GUESS=c4-convex-bsd
84674901992Smrg	;;
8470eb10989Smrg    CRAY*Y-MP:*:*:*)
84874901992Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
84974901992Smrg	GUESS=ymp-cray-unicos$CRAY_REL
85074901992Smrg	;;
8510eb10989Smrg    CRAY*[A-Z]90:*:*:*)
852b2f5b1dbSmrg	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
8530eb10989Smrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
8540eb10989Smrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
8550eb10989Smrg	      -e 's/\.[^.]*$/.X/'
85663165362Smrg	exit ;;
8570eb10989Smrg    CRAY*TS:*:*:*)
85874901992Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
85974901992Smrg	GUESS=t90-cray-unicos$CRAY_REL
86074901992Smrg	;;
8610eb10989Smrg    CRAY*T3E:*:*:*)
86274901992Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
86374901992Smrg	GUESS=alphaev5-cray-unicosmk$CRAY_REL
86474901992Smrg	;;
8650eb10989Smrg    CRAY*SV1:*:*:*)
86674901992Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
86774901992Smrg	GUESS=sv1-cray-unicos$CRAY_REL
86874901992Smrg	;;
8690eb10989Smrg    *:UNICOS/mp:*:*)
87074901992Smrg	CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'`
87174901992Smrg	GUESS=craynv-cray-unicosmp$CRAY_REL
87274901992Smrg	;;
8730eb10989Smrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
874b2f5b1dbSmrg	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
875b2f5b1dbSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
876b2f5b1dbSmrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
87774901992Smrg	GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
87874901992Smrg	;;
8790eb10989Smrg    5000:UNIX_System_V:4.*:*)
880b2f5b1dbSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
881b2f5b1dbSmrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
88274901992Smrg	GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}
88374901992Smrg	;;
8840eb10989Smrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
88574901992Smrg	GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE
88674901992Smrg	;;
8870eb10989Smrg    sparc*:BSD/OS:*:*)
88874901992Smrg	GUESS=sparc-unknown-bsdi$UNAME_RELEASE
88974901992Smrg	;;
8900eb10989Smrg    *:BSD/OS:*:*)
89174901992Smrg	GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE
89274901992Smrg	;;
89374901992Smrg    arm:FreeBSD:*:*)
89474901992Smrg	UNAME_PROCESSOR=`uname -p`
89574901992Smrg	set_cc_for_build
89674901992Smrg	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
89774901992Smrg	    | grep -q __ARM_PCS_VFP
89874901992Smrg	then
89974901992Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
90074901992Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi
90174901992Smrg	else
90274901992Smrg	    FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
90374901992Smrg	    GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf
90474901992Smrg	fi
90574901992Smrg	;;
9060eb10989Smrg    *:FreeBSD:*:*)
907079e7944Smrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
90874901992Smrg	case $UNAME_PROCESSOR in
90963165362Smrg	    amd64)
910b2f5b1dbSmrg		UNAME_PROCESSOR=x86_64 ;;
911b2f5b1dbSmrg	    i386)
912b2f5b1dbSmrg		UNAME_PROCESSOR=i586 ;;
91363165362Smrg	esac
91474901992Smrg	FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
91574901992Smrg	GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL
91674901992Smrg	;;
9170eb10989Smrg    i*:CYGWIN*:*)
91874901992Smrg	GUESS=$UNAME_MACHINE-pc-cygwin
91974901992Smrg	;;
920079e7944Smrg    *:MINGW64*:*)
92174901992Smrg	GUESS=$UNAME_MACHINE-pc-mingw64
92274901992Smrg	;;
92363165362Smrg    *:MINGW*:*)
92474901992Smrg	GUESS=$UNAME_MACHINE-pc-mingw32
92574901992Smrg	;;
926b2f5b1dbSmrg    *:MSYS*:*)
92774901992Smrg	GUESS=$UNAME_MACHINE-pc-msys
92874901992Smrg	;;
9290eb10989Smrg    i*:PW*:*)
93074901992Smrg	GUESS=$UNAME_MACHINE-pc-pw32
93174901992Smrg	;;
932fadff096Smrg    *:SerenityOS:*:*)
933fadff096Smrg        GUESS=$UNAME_MACHINE-pc-serenity
934fadff096Smrg        ;;
935e4c0bf4dSmrg    *:Interix*:*)
93674901992Smrg	case $UNAME_MACHINE in
93763165362Smrg	    x86)
93874901992Smrg		GUESS=i586-pc-interix$UNAME_RELEASE
93974901992Smrg		;;
940e4c0bf4dSmrg	    authenticamd | genuineintel | EM64T)
94174901992Smrg		GUESS=x86_64-unknown-interix$UNAME_RELEASE
94274901992Smrg		;;
94363165362Smrg	    IA64)
94474901992Smrg		GUESS=ia64-unknown-interix$UNAME_RELEASE
94574901992Smrg		;;
94663165362Smrg	esac ;;
9470eb10989Smrg    i*:UWIN*:*)
94874901992Smrg	GUESS=$UNAME_MACHINE-pc-uwin
94974901992Smrg	;;
95063165362Smrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
95174901992Smrg	GUESS=x86_64-pc-cygwin
95274901992Smrg	;;
9530eb10989Smrg    prep*:SunOS:5.*:*)
95474901992Smrg	SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`
95574901992Smrg	GUESS=powerpcle-unknown-solaris2$SUN_REL
95674901992Smrg	;;
9570eb10989Smrg    *:GNU:*:*)
9580eb10989Smrg	# the GNU system
95974901992Smrg	GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'`
96074901992Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'`
96174901992Smrg	GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL
96274901992Smrg	;;
9630eb10989Smrg    *:GNU/*:*:*)
9640eb10989Smrg	# other systems with GNU libc and userland
96574901992Smrg	GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"`
96674901992Smrg	GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
96774901992Smrg	GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC
96874901992Smrg	;;
969fadff096Smrg    x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*)
970fadff096Smrg	GUESS="$UNAME_MACHINE-pc-managarm-mlibc"
971fadff096Smrg	;;
972fadff096Smrg    *:[Mm]anagarm:*:*)
973fadff096Smrg	GUESS="$UNAME_MACHINE-unknown-managarm-mlibc"
974fadff096Smrg	;;
97574901992Smrg    *:Minix:*:*)
97674901992Smrg	GUESS=$UNAME_MACHINE-unknown-minix
97774901992Smrg	;;
978079e7944Smrg    aarch64:Linux:*:*)
97974901992Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
98074901992Smrg	;;
981079e7944Smrg    aarch64_be:Linux:*:*)
982079e7944Smrg	UNAME_MACHINE=aarch64_be
98374901992Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
98474901992Smrg	;;
985e4c0bf4dSmrg    alpha:Linux:*:*)
98674901992Smrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
987e4c0bf4dSmrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
988e4c0bf4dSmrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
989e4c0bf4dSmrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
990e4c0bf4dSmrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
991e4c0bf4dSmrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
992e4c0bf4dSmrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
993e4c0bf4dSmrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
994079e7944Smrg	esac
995e4c0bf4dSmrg	objdump --private-headers /bin/sh | grep -q ld.so.1
996b2f5b1dbSmrg	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
99774901992Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
99874901992Smrg	;;
99974901992Smrg    arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*)
100074901992Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
100174901992Smrg	;;
10020eb10989Smrg    arm*:Linux:*:*)
100374901992Smrg	set_cc_for_build
100463165362Smrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
100563165362Smrg	    | grep -q __ARM_EABI__
100663165362Smrg	then
100774901992Smrg	    GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
100863165362Smrg	else
1009079e7944Smrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
1010079e7944Smrg		| grep -q __ARM_PCS_VFP
1011079e7944Smrg	    then
101274901992Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi
1013079e7944Smrg	    else
101474901992Smrg		GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf
1015079e7944Smrg	    fi
101663165362Smrg	fi
101774901992Smrg	;;
101863165362Smrg    avr32*:Linux:*:*)
101974901992Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
102074901992Smrg	;;
10210eb10989Smrg    cris:Linux:*:*)
102274901992Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
102374901992Smrg	;;
102463165362Smrg    crisv32:Linux:*:*)
102574901992Smrg	GUESS=$UNAME_MACHINE-axis-linux-$LIBC
102674901992Smrg	;;
1027b2f5b1dbSmrg    e2k:Linux:*:*)
102874901992Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
102974901992Smrg	;;
103063165362Smrg    frv:Linux:*:*)
103174901992Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
103274901992Smrg	;;
1033079e7944Smrg    hexagon:Linux:*:*)
103474901992Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
103574901992Smrg	;;
1036e4c0bf4dSmrg    i*86:Linux:*:*)
103774901992Smrg	GUESS=$UNAME_MACHINE-pc-linux-$LIBC
103874901992Smrg	;;
10390eb10989Smrg    ia64:Linux:*:*)
104074901992Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
104174901992Smrg	;;
1042b2f5b1dbSmrg    k1om:Linux:*:*)
104374901992Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
104474901992Smrg	;;
1045fadff096Smrg    loongarch32:Linux:*:* | loongarch64:Linux:*:*)
104674901992Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
104774901992Smrg	;;
10480eb10989Smrg    m32r*:Linux:*:*)
104974901992Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
105074901992Smrg	;;
10510eb10989Smrg    m68*:Linux:*:*)
105274901992Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
105374901992Smrg	;;
1054e4c0bf4dSmrg    mips:Linux:*:* | mips64:Linux:*:*)
105574901992Smrg	set_cc_for_build
105674901992Smrg	IS_GLIBC=0
105774901992Smrg	test x"${LIBC}" = xgnu && IS_GLIBC=1
1058b2f5b1dbSmrg	sed 's/^	//' << EOF > "$dummy.c"
10590eb10989Smrg	#undef CPU
106074901992Smrg	#undef mips
106174901992Smrg	#undef mipsel
106274901992Smrg	#undef mips64
106374901992Smrg	#undef mips64el
106474901992Smrg	#if ${IS_GLIBC} && defined(_ABI64)
106574901992Smrg	LIBCABI=gnuabi64
106674901992Smrg	#else
106774901992Smrg	#if ${IS_GLIBC} && defined(_ABIN32)
106874901992Smrg	LIBCABI=gnuabin32
106974901992Smrg	#else
107074901992Smrg	LIBCABI=${LIBC}
107174901992Smrg	#endif
107274901992Smrg	#endif
107374901992Smrg
107474901992Smrg	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
107574901992Smrg	CPU=mipsisa64r6
107674901992Smrg	#else
107774901992Smrg	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
107874901992Smrg	CPU=mipsisa32r6
107974901992Smrg	#else
108074901992Smrg	#if defined(__mips64)
108174901992Smrg	CPU=mips64
108274901992Smrg	#else
108374901992Smrg	CPU=mips
108474901992Smrg	#endif
108574901992Smrg	#endif
108674901992Smrg	#endif
108774901992Smrg
10880eb10989Smrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
108974901992Smrg	MIPS_ENDIAN=el
10900eb10989Smrg	#else
10910eb10989Smrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
109274901992Smrg	MIPS_ENDIAN=
10930eb10989Smrg	#else
109474901992Smrg	MIPS_ENDIAN=
10950eb10989Smrg	#endif
10960eb10989Smrg	#endif
10970eb10989SmrgEOF
109874901992Smrg	cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`
109974901992Smrg	eval "$cc_set_vars"
110074901992Smrg	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
11010eb10989Smrg	;;
1102b2f5b1dbSmrg    mips64el:Linux:*:*)
110374901992Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
110474901992Smrg	;;
1105b2f5b1dbSmrg    openrisc*:Linux:*:*)
110674901992Smrg	GUESS=or1k-unknown-linux-$LIBC
110774901992Smrg	;;
1108b2f5b1dbSmrg    or32:Linux:*:* | or1k*:Linux:*:*)
110974901992Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
111074901992Smrg	;;
111163165362Smrg    padre:Linux:*:*)
111274901992Smrg	GUESS=sparc-unknown-linux-$LIBC
111374901992Smrg	;;
1114e4c0bf4dSmrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
111574901992Smrg	GUESS=hppa64-unknown-linux-$LIBC
111674901992Smrg	;;
11170eb10989Smrg    parisc:Linux:*:* | hppa:Linux:*:*)
11180eb10989Smrg	# Look for CPU level
11190eb10989Smrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
112074901992Smrg	  PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;;
112174901992Smrg	  PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;;
112274901992Smrg	  *)    GUESS=hppa-unknown-linux-$LIBC ;;
11230eb10989Smrg	esac
112474901992Smrg	;;
1125e4c0bf4dSmrg    ppc64:Linux:*:*)
112674901992Smrg	GUESS=powerpc64-unknown-linux-$LIBC
112774901992Smrg	;;
1128e4c0bf4dSmrg    ppc:Linux:*:*)
112974901992Smrg	GUESS=powerpc-unknown-linux-$LIBC
113074901992Smrg	;;
1131079e7944Smrg    ppc64le:Linux:*:*)
113274901992Smrg	GUESS=powerpc64le-unknown-linux-$LIBC
113374901992Smrg	;;
1134079e7944Smrg    ppcle:Linux:*:*)
113574901992Smrg	GUESS=powerpcle-unknown-linux-$LIBC
113674901992Smrg	;;
113774901992Smrg    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
113874901992Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
113974901992Smrg	;;
11400eb10989Smrg    s390:Linux:*:* | s390x:Linux:*:*)
114174901992Smrg	GUESS=$UNAME_MACHINE-ibm-linux-$LIBC
114274901992Smrg	;;
11430eb10989Smrg    sh64*:Linux:*:*)
114474901992Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
114574901992Smrg	;;
11460eb10989Smrg    sh*:Linux:*:*)
114774901992Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
114874901992Smrg	;;
11490eb10989Smrg    sparc:Linux:*:* | sparc64:Linux:*:*)
115074901992Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
115174901992Smrg	;;
1152d43532a6Smrg    tile*:Linux:*:*)
115374901992Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
115474901992Smrg	;;
115563165362Smrg    vax:Linux:*:*)
115674901992Smrg	GUESS=$UNAME_MACHINE-dec-linux-$LIBC
115774901992Smrg	;;
11580eb10989Smrg    x86_64:Linux:*:*)
115974901992Smrg	set_cc_for_build
1160fadff096Smrg	CPU=$UNAME_MACHINE
116174901992Smrg	LIBCABI=$LIBC
116274901992Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
1163fadff096Smrg	    ABI=64
1164fadff096Smrg	    sed 's/^	    //' << EOF > "$dummy.c"
1165fadff096Smrg	    #ifdef __i386__
1166fadff096Smrg	    ABI=x86
1167fadff096Smrg	    #else
1168fadff096Smrg	    #ifdef __ILP32__
1169fadff096Smrg	    ABI=x32
1170fadff096Smrg	    #endif
1171fadff096Smrg	    #endif
1172fadff096SmrgEOF
1173fadff096Smrg	    cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'`
1174fadff096Smrg	    eval "$cc_set_abi"
1175fadff096Smrg	    case $ABI in
1176fadff096Smrg		x86) CPU=i686 ;;
1177fadff096Smrg		x32) LIBCABI=${LIBC}x32 ;;
1178fadff096Smrg	    esac
117974901992Smrg	fi
1180fadff096Smrg	GUESS=$CPU-pc-linux-$LIBCABI
118174901992Smrg	;;
118263165362Smrg    xtensa*:Linux:*:*)
118374901992Smrg	GUESS=$UNAME_MACHINE-unknown-linux-$LIBC
118474901992Smrg	;;
11850eb10989Smrg    i*86:DYNIX/ptx:4*:*)
11860eb10989Smrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
11870eb10989Smrg	# earlier versions are messed up and put the nodename in both
11880eb10989Smrg	# sysname and nodename.
118974901992Smrg	GUESS=i386-sequent-sysv4
119074901992Smrg	;;
11910eb10989Smrg    i*86:UNIX_SV:4.2MP:2.*)
1192079e7944Smrg	# Unixware is an offshoot of SVR4, but it has its own version
1193079e7944Smrg	# number series starting with 2...
1194079e7944Smrg	# I am not positive that other SVR4 systems won't match this,
11950eb10989Smrg	# I just have to hope.  -- rms.
1196079e7944Smrg	# Use sysv4.2uw... so that sysv4* matches it.
119774901992Smrg	GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION
119874901992Smrg	;;
11990eb10989Smrg    i*86:OS/2:*:*)
12000eb10989Smrg	# If we were able to find `uname', then EMX Unix compatibility
12010eb10989Smrg	# is probably installed.
120274901992Smrg	GUESS=$UNAME_MACHINE-pc-os2-emx
120374901992Smrg	;;
12040eb10989Smrg    i*86:XTS-300:*:STOP)
120574901992Smrg	GUESS=$UNAME_MACHINE-unknown-stop
120674901992Smrg	;;
12070eb10989Smrg    i*86:atheos:*:*)
120874901992Smrg	GUESS=$UNAME_MACHINE-unknown-atheos
120974901992Smrg	;;
121063165362Smrg    i*86:syllable:*:*)
121174901992Smrg	GUESS=$UNAME_MACHINE-pc-syllable
121274901992Smrg	;;
1213e4c0bf4dSmrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
121474901992Smrg	GUESS=i386-unknown-lynxos$UNAME_RELEASE
121574901992Smrg	;;
12160eb10989Smrg    i*86:*DOS:*:*)
121774901992Smrg	GUESS=$UNAME_MACHINE-pc-msdosdjgpp
121874901992Smrg	;;
1219b2f5b1dbSmrg    i*86:*:4.*:*)
1220b2f5b1dbSmrg	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
12210eb10989Smrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
122274901992Smrg		GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL
12230eb10989Smrg	else
122474901992Smrg		GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL
12250eb10989Smrg	fi
122674901992Smrg	;;
122763165362Smrg    i*86:*:5:[678]*)
1228079e7944Smrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
12290eb10989Smrg	case `/bin/uname -X | grep "^Machine"` in
12300eb10989Smrg	    *486*)	     UNAME_MACHINE=i486 ;;
12310eb10989Smrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
12320eb10989Smrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
12330eb10989Smrg	esac
123474901992Smrg	GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
123574901992Smrg	;;
12360eb10989Smrg    i*86:*:3.2:*)
12370eb10989Smrg	if test -f /usr/options/cb.name; then
12380eb10989Smrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
123974901992Smrg		GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL
12400eb10989Smrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
12410eb10989Smrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
12420eb10989Smrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
12430eb10989Smrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
12440eb10989Smrg			&& UNAME_MACHINE=i586
12450eb10989Smrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
12460eb10989Smrg			&& UNAME_MACHINE=i686
12470eb10989Smrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
12480eb10989Smrg			&& UNAME_MACHINE=i686
124974901992Smrg		GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL
12500eb10989Smrg	else
125174901992Smrg		GUESS=$UNAME_MACHINE-pc-sysv32
12520eb10989Smrg	fi
125374901992Smrg	;;
12540eb10989Smrg    pc:*:*:*)
12550eb10989Smrg	# Left here for compatibility:
1256079e7944Smrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
1257079e7944Smrg	# the processor, so we play safe by assuming i586.
125863165362Smrg	# Note: whatever this is, it MUST be the same as what config.sub
1259b2f5b1dbSmrg	# prints for the "djgpp" host, or else GDB configure will decide that
126063165362Smrg	# this is a cross-build.
126174901992Smrg	GUESS=i586-pc-msdosdjgpp
126274901992Smrg	;;
12630eb10989Smrg    Intel:Mach:3*:*)
126474901992Smrg	GUESS=i386-pc-mach3
126574901992Smrg	;;
12660eb10989Smrg    paragon:*:*:*)
126774901992Smrg	GUESS=i860-intel-osf1
126874901992Smrg	;;
12690eb10989Smrg    i860:*:4.*:*) # i860-SVR4
12700eb10989Smrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
127174901992Smrg	  GUESS=i860-stardent-sysv$UNAME_RELEASE    # Stardent Vistra i860-SVR4
12720eb10989Smrg	else # Add other i860-SVR4 vendors below as they are discovered.
127374901992Smrg	  GUESS=i860-unknown-sysv$UNAME_RELEASE     # Unknown i860-SVR4
12740eb10989Smrg	fi
127574901992Smrg	;;
12760eb10989Smrg    mini*:CTIX:SYS*5:*)
12770eb10989Smrg	# "miniframe"
127874901992Smrg	GUESS=m68010-convergent-sysv
127974901992Smrg	;;
12800eb10989Smrg    mc68k:UNIX:SYSTEM5:3.51m)
128174901992Smrg	GUESS=m68k-convergent-sysv
128274901992Smrg	;;
12830eb10989Smrg    M680?0:D-NIX:5.3:*)
128474901992Smrg	GUESS=m68k-diab-dnix
128574901992Smrg	;;
12860eb10989Smrg    M68*:*:R3V[5678]*:*)
128763165362Smrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
128863165362Smrg    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)
12890eb10989Smrg	OS_REL=''
12900eb10989Smrg	test -r /etc/.relid \
12910eb10989Smrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
12920eb10989Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1293b2f5b1dbSmrg	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
12940eb10989Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1295b2f5b1dbSmrg	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
12960eb10989Smrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1297079e7944Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1298079e7944Smrg	  && { echo i486-ncr-sysv4; exit; } ;;
129963165362Smrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
130063165362Smrg	OS_REL='.3'
130163165362Smrg	test -r /etc/.relid \
130263165362Smrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
130363165362Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1304b2f5b1dbSmrg	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
130563165362Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1306b2f5b1dbSmrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
130763165362Smrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1308b2f5b1dbSmrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
13090eb10989Smrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
131074901992Smrg	GUESS=m68k-unknown-lynxos$UNAME_RELEASE
131174901992Smrg	;;
13120eb10989Smrg    mc68030:UNIX_System_V:4.*:*)
131374901992Smrg	GUESS=m68k-atari-sysv4
131474901992Smrg	;;
13150eb10989Smrg    TSUNAMI:LynxOS:2.*:*)
131674901992Smrg	GUESS=sparc-unknown-lynxos$UNAME_RELEASE
131774901992Smrg	;;
13180eb10989Smrg    rs6000:LynxOS:2.*:*)
131974901992Smrg	GUESS=rs6000-unknown-lynxos$UNAME_RELEASE
132074901992Smrg	;;
1321e4c0bf4dSmrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
132274901992Smrg	GUESS=powerpc-unknown-lynxos$UNAME_RELEASE
132374901992Smrg	;;
13240eb10989Smrg    SM[BE]S:UNIX_SV:*:*)
132574901992Smrg	GUESS=mips-dde-sysv$UNAME_RELEASE
132674901992Smrg	;;
13270eb10989Smrg    RM*:ReliantUNIX-*:*:*)
132874901992Smrg	GUESS=mips-sni-sysv4
132974901992Smrg	;;
13300eb10989Smrg    RM*:SINIX-*:*:*)
133174901992Smrg	GUESS=mips-sni-sysv4
133274901992Smrg	;;
13330eb10989Smrg    *:SINIX-*:*:*)
13340eb10989Smrg	if uname -p 2>/dev/null >/dev/null ; then
13350eb10989Smrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
133674901992Smrg		GUESS=$UNAME_MACHINE-sni-sysv4
13370eb10989Smrg	else
133874901992Smrg		GUESS=ns32k-sni-sysv
13390eb10989Smrg	fi
134074901992Smrg	;;
1341079e7944Smrg    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1342079e7944Smrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
134374901992Smrg	GUESS=i586-unisys-sysv4
134474901992Smrg	;;
13450eb10989Smrg    *:UNIX_System_V:4*:FTX*)
13460eb10989Smrg	# From Gerald Hewes <hewes@openmarket.com>.
13470eb10989Smrg	# How about differentiating between stratus architectures? -djm
134874901992Smrg	GUESS=hppa1.1-stratus-sysv4
134974901992Smrg	;;
13500eb10989Smrg    *:*:*:FTX*)
13510eb10989Smrg	# From seanf@swdc.stratus.com.
135274901992Smrg	GUESS=i860-stratus-sysv4
135374901992Smrg	;;
135463165362Smrg    i*86:VOS:*:*)
135563165362Smrg	# From Paul.Green@stratus.com.
135674901992Smrg	GUESS=$UNAME_MACHINE-stratus-vos
135774901992Smrg	;;
13580eb10989Smrg    *:VOS:*:*)
13590eb10989Smrg	# From Paul.Green@stratus.com.
136074901992Smrg	GUESS=hppa1.1-stratus-vos
136174901992Smrg	;;
13620eb10989Smrg    mc68*:A/UX:*:*)
136374901992Smrg	GUESS=m68k-apple-aux$UNAME_RELEASE
136474901992Smrg	;;
13650eb10989Smrg    news*:NEWS-OS:6*:*)
136674901992Smrg	GUESS=mips-sony-newsos6
136774901992Smrg	;;
13680eb10989Smrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
136974901992Smrg	if test -d /usr/nec; then
137074901992Smrg		GUESS=mips-nec-sysv$UNAME_RELEASE
13710eb10989Smrg	else
137274901992Smrg		GUESS=mips-unknown-sysv$UNAME_RELEASE
13730eb10989Smrg	fi
137474901992Smrg	;;
13750eb10989Smrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
137674901992Smrg	GUESS=powerpc-be-beos
137774901992Smrg	;;
13780eb10989Smrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
137974901992Smrg	GUESS=powerpc-apple-beos
138074901992Smrg	;;
13810eb10989Smrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
138274901992Smrg	GUESS=i586-pc-beos
138374901992Smrg	;;
138463165362Smrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
138574901992Smrg	GUESS=i586-pc-haiku
138674901992Smrg	;;
1387fadff096Smrg    ppc:Haiku:*:*)	# Haiku running on Apple PowerPC
1388fadff096Smrg	GUESS=powerpc-apple-haiku
1389fadff096Smrg	;;
1390fadff096Smrg    *:Haiku:*:*)	# Haiku modern gcc (not bound by BeOS compat)
1391fadff096Smrg	GUESS=$UNAME_MACHINE-unknown-haiku
139274901992Smrg	;;
13930eb10989Smrg    SX-4:SUPER-UX:*:*)
139474901992Smrg	GUESS=sx4-nec-superux$UNAME_RELEASE
139574901992Smrg	;;
13960eb10989Smrg    SX-5:SUPER-UX:*:*)
139774901992Smrg	GUESS=sx5-nec-superux$UNAME_RELEASE
139874901992Smrg	;;
13990eb10989Smrg    SX-6:SUPER-UX:*:*)
140074901992Smrg	GUESS=sx6-nec-superux$UNAME_RELEASE
140174901992Smrg	;;
140263165362Smrg    SX-7:SUPER-UX:*:*)
140374901992Smrg	GUESS=sx7-nec-superux$UNAME_RELEASE
140474901992Smrg	;;
140563165362Smrg    SX-8:SUPER-UX:*:*)
140674901992Smrg	GUESS=sx8-nec-superux$UNAME_RELEASE
140774901992Smrg	;;
140863165362Smrg    SX-8R:SUPER-UX:*:*)
140974901992Smrg	GUESS=sx8r-nec-superux$UNAME_RELEASE
141074901992Smrg	;;
1411b2f5b1dbSmrg    SX-ACE:SUPER-UX:*:*)
141274901992Smrg	GUESS=sxace-nec-superux$UNAME_RELEASE
141374901992Smrg	;;
14140eb10989Smrg    Power*:Rhapsody:*:*)
141574901992Smrg	GUESS=powerpc-apple-rhapsody$UNAME_RELEASE
141674901992Smrg	;;
14170eb10989Smrg    *:Rhapsody:*:*)
141874901992Smrg	GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE
141974901992Smrg	;;
142074901992Smrg    arm64:Darwin:*:*)
142174901992Smrg	GUESS=aarch64-apple-darwin$UNAME_RELEASE
142274901992Smrg	;;
14230eb10989Smrg    *:Darwin:*:*)
142474901992Smrg	UNAME_PROCESSOR=`uname -p`
142574901992Smrg	case $UNAME_PROCESSOR in
142674901992Smrg	    unknown) UNAME_PROCESSOR=powerpc ;;
142774901992Smrg	esac
142874901992Smrg	if command -v xcode-select > /dev/null 2> /dev/null && \
142974901992Smrg		! xcode-select --print-path > /dev/null 2> /dev/null ; then
143074901992Smrg	    # Avoid executing cc if there is no toolchain installed as
143174901992Smrg	    # cc will be a stub that puts up a graphical alert
143274901992Smrg	    # prompting the user to install developer tools.
143374901992Smrg	    CC_FOR_BUILD=no_compiler_found
143474901992Smrg	else
143574901992Smrg	    set_cc_for_build
1436079e7944Smrg	fi
143774901992Smrg	if test "$CC_FOR_BUILD" != no_compiler_found; then
143874901992Smrg	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
143974901992Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
144074901992Smrg		   grep IS_64BIT_ARCH >/dev/null
144174901992Smrg	    then
144274901992Smrg		case $UNAME_PROCESSOR in
144374901992Smrg		    i386) UNAME_PROCESSOR=x86_64 ;;
144474901992Smrg		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
144574901992Smrg		esac
144674901992Smrg	    fi
144774901992Smrg	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
144874901992Smrg	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
144974901992Smrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
145074901992Smrg		   grep IS_PPC >/dev/null
145174901992Smrg	    then
145274901992Smrg		UNAME_PROCESSOR=powerpc
1453079e7944Smrg	    fi
1454b2f5b1dbSmrg	elif test "$UNAME_PROCESSOR" = i386 ; then
145574901992Smrg	    # uname -m returns i386 or x86_64
145674901992Smrg	    UNAME_PROCESSOR=$UNAME_MACHINE
1457079e7944Smrg	fi
145874901992Smrg	GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE
145974901992Smrg	;;
14600eb10989Smrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
14610eb10989Smrg	UNAME_PROCESSOR=`uname -p`
1462b2f5b1dbSmrg	if test "$UNAME_PROCESSOR" = x86; then
14630eb10989Smrg		UNAME_PROCESSOR=i386
14640eb10989Smrg		UNAME_MACHINE=pc
14650eb10989Smrg	fi
146674901992Smrg	GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE
146774901992Smrg	;;
14680eb10989Smrg    *:QNX:*:4*)
146974901992Smrg	GUESS=i386-pc-qnx
147074901992Smrg	;;
1471b2f5b1dbSmrg    NEO-*:NONSTOP_KERNEL:*:*)
147274901992Smrg	GUESS=neo-tandem-nsk$UNAME_RELEASE
147374901992Smrg	;;
1474079e7944Smrg    NSE-*:NONSTOP_KERNEL:*:*)
147574901992Smrg	GUESS=nse-tandem-nsk$UNAME_RELEASE
147674901992Smrg	;;
1477b2f5b1dbSmrg    NSR-*:NONSTOP_KERNEL:*:*)
147874901992Smrg	GUESS=nsr-tandem-nsk$UNAME_RELEASE
147974901992Smrg	;;
1480b2f5b1dbSmrg    NSV-*:NONSTOP_KERNEL:*:*)
148174901992Smrg	GUESS=nsv-tandem-nsk$UNAME_RELEASE
148274901992Smrg	;;
1483b2f5b1dbSmrg    NSX-*:NONSTOP_KERNEL:*:*)
148474901992Smrg	GUESS=nsx-tandem-nsk$UNAME_RELEASE
148574901992Smrg	;;
14860eb10989Smrg    *:NonStop-UX:*:*)
148774901992Smrg	GUESS=mips-compaq-nonstopux
148874901992Smrg	;;
14890eb10989Smrg    BS2000:POSIX*:*:*)
149074901992Smrg	GUESS=bs2000-siemens-sysv
149174901992Smrg	;;
14920eb10989Smrg    DS/*:UNIX_System_V:*:*)
149374901992Smrg	GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE
149474901992Smrg	;;
14950eb10989Smrg    *:Plan9:*:*)
14960eb10989Smrg	# "uname -m" is not consistent, so use $cputype instead. 386
14970eb10989Smrg	# is converted to i386 for consistency with other x86
14980eb10989Smrg	# operating systems.
149974901992Smrg	if test "${cputype-}" = 386; then
15000eb10989Smrg	    UNAME_MACHINE=i386
150174901992Smrg	elif test "x${cputype-}" != x; then
150274901992Smrg	    UNAME_MACHINE=$cputype
15030eb10989Smrg	fi
150474901992Smrg	GUESS=$UNAME_MACHINE-unknown-plan9
150574901992Smrg	;;
15060eb10989Smrg    *:TOPS-10:*:*)
150774901992Smrg	GUESS=pdp10-unknown-tops10
150874901992Smrg	;;
15090eb10989Smrg    *:TENEX:*:*)
151074901992Smrg	GUESS=pdp10-unknown-tenex
151174901992Smrg	;;
15120eb10989Smrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
151374901992Smrg	GUESS=pdp10-dec-tops20
151474901992Smrg	;;
15150eb10989Smrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
151674901992Smrg	GUESS=pdp10-xkl-tops20
151774901992Smrg	;;
15180eb10989Smrg    *:TOPS-20:*:*)
151974901992Smrg	GUESS=pdp10-unknown-tops20
152074901992Smrg	;;
15210eb10989Smrg    *:ITS:*:*)
152274901992Smrg	GUESS=pdp10-unknown-its
152374901992Smrg	;;
15240eb10989Smrg    SEI:*:*:SEIUX)
152574901992Smrg	GUESS=mips-sei-seiux$UNAME_RELEASE
152674901992Smrg	;;
15270eb10989Smrg    *:DragonFly:*:*)
152874901992Smrg	DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'`
152974901992Smrg	GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL
153074901992Smrg	;;
153163165362Smrg    *:*VMS:*:*)
1532079e7944Smrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
153374901992Smrg	case $UNAME_MACHINE in
153474901992Smrg	    A*) GUESS=alpha-dec-vms ;;
153574901992Smrg	    I*) GUESS=ia64-dec-vms ;;
153674901992Smrg	    V*) GUESS=vax-dec-vms ;;
153763165362Smrg	esac ;;
153863165362Smrg    *:XENIX:*:SysV)
153974901992Smrg	GUESS=i386-pc-xenix
154074901992Smrg	;;
154163165362Smrg    i*86:skyos:*:*)
154274901992Smrg	SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`
154374901992Smrg	GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL
154474901992Smrg	;;
154563165362Smrg    i*86:rdos:*:*)
154674901992Smrg	GUESS=$UNAME_MACHINE-pc-rdos
154774901992Smrg	;;
1548fadff096Smrg    i*86:Fiwix:*:*)
1549fadff096Smrg	GUESS=$UNAME_MACHINE-pc-fiwix
1550fadff096Smrg	;;
155174901992Smrg    *:AROS:*:*)
155274901992Smrg	GUESS=$UNAME_MACHINE-unknown-aros
155374901992Smrg	;;
1554079e7944Smrg    x86_64:VMkernel:*:*)
155574901992Smrg	GUESS=$UNAME_MACHINE-unknown-esx
155674901992Smrg	;;
1557b2f5b1dbSmrg    amd64:Isilon\ OneFS:*:*)
155874901992Smrg	GUESS=x86_64-unknown-onefs
155974901992Smrg	;;
156074901992Smrg    *:Unleashed:*:*)
156174901992Smrg	GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE
156274901992Smrg	;;
15630eb10989Smrgesac
15640eb10989Smrg
156574901992Smrg# Do we have a guess based on uname results?
156674901992Smrgif test "x$GUESS" != x; then
156774901992Smrg    echo "$GUESS"
156874901992Smrg    exit
156974901992Smrgfi
157074901992Smrg
157174901992Smrg# No uname command or uname output not recognized.
157274901992Smrgset_cc_for_build
157374901992Smrgcat > "$dummy.c" <<EOF
157474901992Smrg#ifdef _SEQUENT_
157574901992Smrg#include <sys/types.h>
157674901992Smrg#include <sys/utsname.h>
157774901992Smrg#endif
157874901992Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
157974901992Smrg#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
158074901992Smrg#include <signal.h>
158174901992Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
158274901992Smrg#include <sys/utsname.h>
158374901992Smrg#endif
158474901992Smrg#endif
158574901992Smrg#endif
158674901992Smrgmain ()
158774901992Smrg{
158874901992Smrg#if defined (sony)
158974901992Smrg#if defined (MIPSEB)
159074901992Smrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
159174901992Smrg     I don't know....  */
159274901992Smrg  printf ("mips-sony-bsd\n"); exit (0);
159374901992Smrg#else
159474901992Smrg#include <sys/param.h>
159574901992Smrg  printf ("m68k-sony-newsos%s\n",
159674901992Smrg#ifdef NEWSOS4
159774901992Smrg  "4"
159874901992Smrg#else
159974901992Smrg  ""
160074901992Smrg#endif
160174901992Smrg  ); exit (0);
160274901992Smrg#endif
160374901992Smrg#endif
160474901992Smrg
160574901992Smrg#if defined (NeXT)
160674901992Smrg#if !defined (__ARCHITECTURE__)
160774901992Smrg#define __ARCHITECTURE__ "m68k"
160874901992Smrg#endif
160974901992Smrg  int version;
161074901992Smrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
161174901992Smrg  if (version < 4)
161274901992Smrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
161374901992Smrg  else
161474901992Smrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
161574901992Smrg  exit (0);
161674901992Smrg#endif
161774901992Smrg
161874901992Smrg#if defined (MULTIMAX) || defined (n16)
161974901992Smrg#if defined (UMAXV)
162074901992Smrg  printf ("ns32k-encore-sysv\n"); exit (0);
162174901992Smrg#else
162274901992Smrg#if defined (CMU)
162374901992Smrg  printf ("ns32k-encore-mach\n"); exit (0);
162474901992Smrg#else
162574901992Smrg  printf ("ns32k-encore-bsd\n"); exit (0);
162674901992Smrg#endif
162774901992Smrg#endif
162874901992Smrg#endif
162974901992Smrg
163074901992Smrg#if defined (__386BSD__)
163174901992Smrg  printf ("i386-pc-bsd\n"); exit (0);
163274901992Smrg#endif
163374901992Smrg
163474901992Smrg#if defined (sequent)
163574901992Smrg#if defined (i386)
163674901992Smrg  printf ("i386-sequent-dynix\n"); exit (0);
163774901992Smrg#endif
163874901992Smrg#if defined (ns32000)
163974901992Smrg  printf ("ns32k-sequent-dynix\n"); exit (0);
164074901992Smrg#endif
164174901992Smrg#endif
164274901992Smrg
164374901992Smrg#if defined (_SEQUENT_)
164474901992Smrg  struct utsname un;
164574901992Smrg
164674901992Smrg  uname(&un);
164774901992Smrg  if (strncmp(un.version, "V2", 2) == 0) {
164874901992Smrg    printf ("i386-sequent-ptx2\n"); exit (0);
164974901992Smrg  }
165074901992Smrg  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
165174901992Smrg    printf ("i386-sequent-ptx1\n"); exit (0);
165274901992Smrg  }
165374901992Smrg  printf ("i386-sequent-ptx\n"); exit (0);
165474901992Smrg#endif
165574901992Smrg
165674901992Smrg#if defined (vax)
165774901992Smrg#if !defined (ultrix)
165874901992Smrg#include <sys/param.h>
165974901992Smrg#if defined (BSD)
166074901992Smrg#if BSD == 43
166174901992Smrg  printf ("vax-dec-bsd4.3\n"); exit (0);
166274901992Smrg#else
166374901992Smrg#if BSD == 199006
166474901992Smrg  printf ("vax-dec-bsd4.3reno\n"); exit (0);
166574901992Smrg#else
166674901992Smrg  printf ("vax-dec-bsd\n"); exit (0);
166774901992Smrg#endif
166874901992Smrg#endif
166974901992Smrg#else
167074901992Smrg  printf ("vax-dec-bsd\n"); exit (0);
167174901992Smrg#endif
167274901992Smrg#else
167374901992Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
167474901992Smrg  struct utsname un;
167574901992Smrg  uname (&un);
167674901992Smrg  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
167774901992Smrg#else
167874901992Smrg  printf ("vax-dec-ultrix\n"); exit (0);
167974901992Smrg#endif
168074901992Smrg#endif
168174901992Smrg#endif
168274901992Smrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
168374901992Smrg#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
168474901992Smrg#if defined(_SIZE_T_) || defined(SIGLOST)
168574901992Smrg  struct utsname *un;
168674901992Smrg  uname (&un);
168774901992Smrg  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
168874901992Smrg#else
168974901992Smrg  printf ("mips-dec-ultrix\n"); exit (0);
169074901992Smrg#endif
169174901992Smrg#endif
169274901992Smrg#endif
169374901992Smrg
169474901992Smrg#if defined (alliant) && defined (i860)
169574901992Smrg  printf ("i860-alliant-bsd\n"); exit (0);
169674901992Smrg#endif
169774901992Smrg
169874901992Smrg  exit (1);
169974901992Smrg}
170074901992SmrgEOF
170174901992Smrg
170274901992Smrg$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` &&
170374901992Smrg	{ echo "$SYSTEM_NAME"; exit; }
170474901992Smrg
170574901992Smrg# Apollos put the system type in the environment.
170674901992Smrgtest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
170774901992Smrg
1708b2f5b1dbSmrgecho "$0: unable to guess system type" >&2
17090eb10989Smrg
171074901992Smrgcase $UNAME_MACHINE:$UNAME_SYSTEM in
1711b2f5b1dbSmrg    mips:Linux | mips64:Linux)
1712b2f5b1dbSmrg	# If we got here on MIPS GNU/Linux, output extra information.
1713b2f5b1dbSmrg	cat >&2 <<EOF
17140eb10989Smrg
1715b2f5b1dbSmrgNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
1716b2f5b1dbSmrgthe system type. Please install a C compiler and try again.
17170eb10989SmrgEOF
1718b2f5b1dbSmrg	;;
1719b2f5b1dbSmrgesac
17200eb10989Smrg
17210eb10989Smrgcat >&2 <<EOF
17220eb10989Smrg
1723b2f5b1dbSmrgThis script (version $timestamp), has failed to recognize the
1724b2f5b1dbSmrgoperating system you are using. If your script is old, overwrite *all*
1725b2f5b1dbSmrgcopies of config.guess and config.sub with the latest versions from:
17260eb10989Smrg
172774901992Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
172863165362Smrgand
172974901992Smrg  https://git.savannah.gnu.org/cgit/config.git/plain/config.sub
173074901992SmrgEOF
173174901992Smrg
173274901992Smrgour_year=`echo $timestamp | sed 's,-.*,,'`
173374901992Smrgthisyear=`date +%Y`
173474901992Smrg# shellcheck disable=SC2003
173574901992Smrgscript_age=`expr "$thisyear" - "$our_year"`
173674901992Smrgif test "$script_age" -lt 3 ; then
173774901992Smrg   cat >&2 <<EOF
17380eb10989Smrg
1739b2f5b1dbSmrgIf $0 has already been updated, send the following data and any
1740b2f5b1dbSmrginformation you think might be pertinent to config-patches@gnu.org to
1741b2f5b1dbSmrgprovide the necessary information to handle your system.
17420eb10989Smrg
17430eb10989Smrgconfig.guess timestamp = $timestamp
17440eb10989Smrg
17450eb10989Smrguname -m = `(uname -m) 2>/dev/null || echo unknown`
17460eb10989Smrguname -r = `(uname -r) 2>/dev/null || echo unknown`
17470eb10989Smrguname -s = `(uname -s) 2>/dev/null || echo unknown`
17480eb10989Smrguname -v = `(uname -v) 2>/dev/null || echo unknown`
17490eb10989Smrg
17500eb10989Smrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
17510eb10989Smrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
17520eb10989Smrg
17530eb10989Smrghostinfo               = `(hostinfo) 2>/dev/null`
17540eb10989Smrg/bin/universe          = `(/bin/universe) 2>/dev/null`
17550eb10989Smrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
17560eb10989Smrg/bin/arch              = `(/bin/arch) 2>/dev/null`
17570eb10989Smrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
17580eb10989Smrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
17590eb10989Smrg
1760b2f5b1dbSmrgUNAME_MACHINE = "$UNAME_MACHINE"
1761b2f5b1dbSmrgUNAME_RELEASE = "$UNAME_RELEASE"
1762b2f5b1dbSmrgUNAME_SYSTEM  = "$UNAME_SYSTEM"
1763b2f5b1dbSmrgUNAME_VERSION = "$UNAME_VERSION"
17640eb10989SmrgEOF
176574901992Smrgfi
17660eb10989Smrg
17670eb10989Smrgexit 1
17680eb10989Smrg
17690eb10989Smrg# Local variables:
177074901992Smrg# eval: (add-hook 'before-save-hook 'time-stamp)
17710eb10989Smrg# time-stamp-start: "timestamp='"
17720eb10989Smrg# time-stamp-format: "%:y-%02m-%02d"
17730eb10989Smrg# time-stamp-end: "'"
17740eb10989Smrg# End:
1775