config.guess revision 5ec34c4c
17a84e134Smrg#! /bin/sh
27a84e134Smrg# Attempt to guess a canonical system name.
35ec34c4cSmrg#   Copyright 1992-2020 Free Software Foundation, Inc.
47a84e134Smrg
55ec34c4cSmrgtimestamp='2020-04-26'
67a84e134Smrg
77a84e134Smrg# This file is free software; you can redistribute it and/or modify it
87a84e134Smrg# under the terms of the GNU General Public License as published by
9c889a3bfSmrg# the Free Software Foundation; either version 3 of the License, or
107a84e134Smrg# (at your option) any later version.
117a84e134Smrg#
127a84e134Smrg# This program is distributed in the hope that it will be useful, but
137a84e134Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
147a84e134Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
157a84e134Smrg# General Public License for more details.
167a84e134Smrg#
177a84e134Smrg# You should have received a copy of the GNU General Public License
185ec34c4cSmrg# along with this program; if not, see <https://www.gnu.org/licenses/>.
197a84e134Smrg#
207a84e134Smrg# As a special exception to the GNU General Public License, if you
217a84e134Smrg# distribute this file as part of a program that contains a
227a84e134Smrg# configuration script generated by Autoconf, you may include it under
23c889a3bfSmrg# the same distribution terms that you use for the rest of that
24c889a3bfSmrg# program.  This Exception is an additional permission under section 7
25c889a3bfSmrg# of the GNU General Public License, version 3 ("GPLv3").
267a84e134Smrg#
27c8571806Smrg# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
287a84e134Smrg#
29994689c1Smrg# You can get the latest version of this script from:
305ec34c4cSmrg# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
31c889a3bfSmrg#
32c8571806Smrg# Please send patches to <config-patches@gnu.org>.
33c889a3bfSmrg
347a84e134Smrg
357a84e134Smrgme=`echo "$0" | sed -e 's,.*/,,'`
367a84e134Smrg
377a84e134Smrgusage="\
387a84e134SmrgUsage: $0 [OPTION]
397a84e134Smrg
407a84e134SmrgOutput the configuration name of the system \`$me' is run on.
417a84e134Smrg
425ec34c4cSmrgOptions:
437a84e134Smrg  -h, --help         print this help, then exit
447a84e134Smrg  -t, --time-stamp   print date of last modification, then exit
457a84e134Smrg  -v, --version      print version number, then exit
467a84e134Smrg
477a84e134SmrgReport bugs and patches to <config-patches@gnu.org>."
487a84e134Smrg
497a84e134Smrgversion="\
507a84e134SmrgGNU config.guess ($timestamp)
517a84e134Smrg
527a84e134SmrgOriginally written by Per Bothner.
535ec34c4cSmrgCopyright 1992-2020 Free Software Foundation, Inc.
547a84e134Smrg
557a84e134SmrgThis is free software; see the source for copying conditions.  There is NO
567a84e134Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
577a84e134Smrg
587a84e134Smrghelp="
597a84e134SmrgTry \`$me --help' for more information."
607a84e134Smrg
617a84e134Smrg# Parse command line
627a84e134Smrgwhile test $# -gt 0 ; do
637a84e134Smrg  case $1 in
647a84e134Smrg    --time-stamp | --time* | -t )
657a84e134Smrg       echo "$timestamp" ; exit ;;
667a84e134Smrg    --version | -v )
677a84e134Smrg       echo "$version" ; exit ;;
687a84e134Smrg    --help | --h* | -h )
697a84e134Smrg       echo "$usage"; exit ;;
707a84e134Smrg    -- )     # Stop option processing
717a84e134Smrg       shift; break ;;
727a84e134Smrg    - )	# Use stdin as input.
737a84e134Smrg       break ;;
747a84e134Smrg    -* )
757a84e134Smrg       echo "$me: invalid option $1$help" >&2
767a84e134Smrg       exit 1 ;;
777a84e134Smrg    * )
787a84e134Smrg       break ;;
797a84e134Smrg  esac
807a84e134Smrgdone
817a84e134Smrg
827a84e134Smrgif test $# != 0; then
837a84e134Smrg  echo "$me: too many arguments$help" >&2
847a84e134Smrg  exit 1
857a84e134Smrgfi
867a84e134Smrg
877a84e134Smrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
887a84e134Smrg# compiler to aid in system detection is discouraged as it requires
897a84e134Smrg# temporary files to be created and, as you can see below, it is a
907a84e134Smrg# headache to deal with in a portable fashion.
917a84e134Smrg
927a84e134Smrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
937a84e134Smrg# use `HOST_CC' if defined, but it is deprecated.
947a84e134Smrg
957a84e134Smrg# Portable tmp directory creation inspired by the Autoconf team.
967a84e134Smrg
975ec34c4cSmrgtmp=
985ec34c4cSmrg# shellcheck disable=SC2172
995ec34c4cSmrgtrap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
1005ec34c4cSmrg
1015ec34c4cSmrgset_cc_for_build() {
1025ec34c4cSmrg    # prevent multiple calls if $tmp is already set
1035ec34c4cSmrg    test "$tmp" && return 0
1045ec34c4cSmrg    : "${TMPDIR=/tmp}"
1055ec34c4cSmrg    # shellcheck disable=SC2039
1065ec34c4cSmrg    { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
1075ec34c4cSmrg	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
1085ec34c4cSmrg	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
1095ec34c4cSmrg	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
1105ec34c4cSmrg    dummy=$tmp/dummy
1115ec34c4cSmrg    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
1125ec34c4cSmrg	,,)    echo "int x;" > "$dummy.c"
1135ec34c4cSmrg	       for driver in cc gcc c89 c99 ; do
1145ec34c4cSmrg		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
1155ec34c4cSmrg		       CC_FOR_BUILD="$driver"
1165ec34c4cSmrg		       break
1175ec34c4cSmrg		   fi
1185ec34c4cSmrg	       done
1195ec34c4cSmrg	       if test x"$CC_FOR_BUILD" = x ; then
1205ec34c4cSmrg		   CC_FOR_BUILD=no_compiler_found
1215ec34c4cSmrg	       fi
1225ec34c4cSmrg	       ;;
1235ec34c4cSmrg	,,*)   CC_FOR_BUILD=$CC ;;
1245ec34c4cSmrg	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
1255ec34c4cSmrg    esac
1265ec34c4cSmrg}
1277a84e134Smrg
1287a84e134Smrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
1297a84e134Smrg# (ghazi@noc.rutgers.edu 1994-08-24)
1305ec34c4cSmrgif test -f /.attbin/uname ; then
1317a84e134Smrg	PATH=$PATH:/.attbin ; export PATH
1327a84e134Smrgfi
1337a84e134Smrg
1347a84e134SmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
1357a84e134SmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
1367a84e134SmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
1377a84e134SmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
1387a84e134Smrg
1395ec34c4cSmrgcase "$UNAME_SYSTEM" in
140c889a3bfSmrgLinux|GNU|GNU/*)
141c889a3bfSmrg	# If the system lacks a compiler, then just pick glibc.
142c889a3bfSmrg	# We could probably try harder.
143c889a3bfSmrg	LIBC=gnu
144c889a3bfSmrg
1455ec34c4cSmrg	set_cc_for_build
1465ec34c4cSmrg	cat <<-EOF > "$dummy.c"
147c889a3bfSmrg	#include <features.h>
148c889a3bfSmrg	#if defined(__UCLIBC__)
149c889a3bfSmrg	LIBC=uclibc
150c889a3bfSmrg	#elif defined(__dietlibc__)
151c889a3bfSmrg	LIBC=dietlibc
152c889a3bfSmrg	#else
153c889a3bfSmrg	LIBC=gnu
154c889a3bfSmrg	#endif
155c889a3bfSmrg	EOF
1565ec34c4cSmrg	eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`"
1575ec34c4cSmrg
1585ec34c4cSmrg	# If ldd exists, use it to detect musl libc.
1595ec34c4cSmrg	if command -v ldd >/dev/null && \
1605ec34c4cSmrg		ldd --version 2>&1 | grep -q ^musl
1615ec34c4cSmrg	then
1625ec34c4cSmrg	    LIBC=musl
1635ec34c4cSmrg	fi
164c889a3bfSmrg	;;
165c889a3bfSmrgesac
166c889a3bfSmrg
1677a84e134Smrg# Note: order is significant - the case branches are not exclusive.
1687a84e134Smrg
1695ec34c4cSmrgcase "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
1707a84e134Smrg    *:NetBSD:*:*)
1717a84e134Smrg	# NetBSD (nbsd) targets should (where applicable) match one or
172c889a3bfSmrg	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
1737a84e134Smrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
1747a84e134Smrg	# switched to ELF, *-*-netbsd* would select the old
1757a84e134Smrg	# object file format.  This provides both forward
1767a84e134Smrg	# compatibility and a consistent mechanism for selecting the
1777a84e134Smrg	# object file format.
1787a84e134Smrg	#
1797a84e134Smrg	# Note: NetBSD doesn't particularly care about the vendor
1807a84e134Smrg	# portion of the name.  We always set it to "unknown".
1817a84e134Smrg	sysctl="sysctl -n hw.machine_arch"
1825ec34c4cSmrg	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
1835ec34c4cSmrg	    "/sbin/$sysctl" 2>/dev/null || \
1845ec34c4cSmrg	    "/usr/sbin/$sysctl" 2>/dev/null || \
1855ec34c4cSmrg	    echo unknown)`
1865ec34c4cSmrg	case "$UNAME_MACHINE_ARCH" in
1877a84e134Smrg	    armeb) machine=armeb-unknown ;;
1887a84e134Smrg	    arm*) machine=arm-unknown ;;
1897a84e134Smrg	    sh3el) machine=shl-unknown ;;
1907a84e134Smrg	    sh3eb) machine=sh-unknown ;;
191ab902922Smrg	    sh5el) machine=sh5le-unknown ;;
1925ec34c4cSmrg	    earmv*)
1935ec34c4cSmrg		arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
1945ec34c4cSmrg		endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
1955ec34c4cSmrg		machine="${arch}${endian}"-unknown
1965ec34c4cSmrg		;;
1975ec34c4cSmrg	    *) machine="$UNAME_MACHINE_ARCH"-unknown ;;
1987a84e134Smrg	esac
1997a84e134Smrg	# The Operating System including object format, if it has switched
2005ec34c4cSmrg	# to ELF recently (or will in the future) and ABI.
2015ec34c4cSmrg	case "$UNAME_MACHINE_ARCH" in
2025ec34c4cSmrg	    earm*)
2035ec34c4cSmrg		os=netbsdelf
2045ec34c4cSmrg		;;
2057a84e134Smrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
2065ec34c4cSmrg		set_cc_for_build
2077a84e134Smrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
208994689c1Smrg			| grep -q __ELF__
2097a84e134Smrg		then
2107a84e134Smrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
2117a84e134Smrg		    # Return netbsd for either.  FIX?
2127a84e134Smrg		    os=netbsd
2137a84e134Smrg		else
2147a84e134Smrg		    os=netbsdelf
2157a84e134Smrg		fi
2167a84e134Smrg		;;
2177a84e134Smrg	    *)
218421c997bSmrg		os=netbsd
2197a84e134Smrg		;;
2207a84e134Smrg	esac
2215ec34c4cSmrg	# Determine ABI tags.
2225ec34c4cSmrg	case "$UNAME_MACHINE_ARCH" in
2235ec34c4cSmrg	    earm*)
2245ec34c4cSmrg		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
2255ec34c4cSmrg		abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
2265ec34c4cSmrg		;;
2275ec34c4cSmrg	esac
2287a84e134Smrg	# The OS release
2297a84e134Smrg	# Debian GNU/NetBSD machines have a different userland, and
2307a84e134Smrg	# thus, need a distinct triplet. However, they do not need
2317a84e134Smrg	# kernel version information, so it can be replaced with a
2327a84e134Smrg	# suitable tag, in the style of linux-gnu.
2335ec34c4cSmrg	case "$UNAME_VERSION" in
2347a84e134Smrg	    Debian*)
2357a84e134Smrg		release='-gnu'
2367a84e134Smrg		;;
2377a84e134Smrg	    *)
2385ec34c4cSmrg		release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
2397a84e134Smrg		;;
2407a84e134Smrg	esac
2417a84e134Smrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
2427a84e134Smrg	# contains redundant information, the shorter form:
2437a84e134Smrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
2445ec34c4cSmrg	echo "$machine-${os}${release}${abi-}"
2457a84e134Smrg	exit ;;
246c889a3bfSmrg    *:Bitrig:*:*)
247c889a3bfSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
2485ec34c4cSmrg	echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE"
249c889a3bfSmrg	exit ;;
2507a84e134Smrg    *:OpenBSD:*:*)
2517a84e134Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
2525ec34c4cSmrg	echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE"
2535ec34c4cSmrg	exit ;;
2545ec34c4cSmrg    *:LibertyBSD:*:*)
2555ec34c4cSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
2565ec34c4cSmrg	echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE"
2575ec34c4cSmrg	exit ;;
2585ec34c4cSmrg    *:MidnightBSD:*:*)
2595ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE"
2607a84e134Smrg	exit ;;
2617a84e134Smrg    *:ekkoBSD:*:*)
2625ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE"
2637a84e134Smrg	exit ;;
264ab902922Smrg    *:SolidBSD:*:*)
2655ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE"
2665ec34c4cSmrg	exit ;;
2675ec34c4cSmrg    *:OS108:*:*)
2685ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE"
269ab902922Smrg	exit ;;
2707a84e134Smrg    macppc:MirBSD:*:*)
2715ec34c4cSmrg	echo powerpc-unknown-mirbsd"$UNAME_RELEASE"
2727a84e134Smrg	exit ;;
2737a84e134Smrg    *:MirBSD:*:*)
2745ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE"
2755ec34c4cSmrg	exit ;;
2765ec34c4cSmrg    *:Sortix:*:*)
2775ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-sortix
2785ec34c4cSmrg	exit ;;
2795ec34c4cSmrg    *:Twizzler:*:*)
2805ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-twizzler
2815ec34c4cSmrg	exit ;;
2825ec34c4cSmrg    *:Redox:*:*)
2835ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-redox
2845ec34c4cSmrg	exit ;;
2855ec34c4cSmrg    mips:OSF1:*.*)
2865ec34c4cSmrg	echo mips-dec-osf1
2877a84e134Smrg	exit ;;
2887a84e134Smrg    alpha:OSF1:*:*)
2897a84e134Smrg	case $UNAME_RELEASE in
2907a84e134Smrg	*4.0)
2917a84e134Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
2927a84e134Smrg		;;
2937a84e134Smrg	*5.*)
294421c997bSmrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
2957a84e134Smrg		;;
2967a84e134Smrg	esac
2977a84e134Smrg	# According to Compaq, /usr/sbin/psrinfo has been available on
2987a84e134Smrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
2997a84e134Smrg	# covers most systems running today.  This code pipes the CPU
3007a84e134Smrg	# types through head -n 1, so we only detect the type of CPU 0.
3017a84e134Smrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
3027a84e134Smrg	case "$ALPHA_CPU_TYPE" in
3037a84e134Smrg	    "EV4 (21064)")
3045ec34c4cSmrg		UNAME_MACHINE=alpha ;;
3057a84e134Smrg	    "EV4.5 (21064)")
3065ec34c4cSmrg		UNAME_MACHINE=alpha ;;
3077a84e134Smrg	    "LCA4 (21066/21068)")
3085ec34c4cSmrg		UNAME_MACHINE=alpha ;;
3097a84e134Smrg	    "EV5 (21164)")
3105ec34c4cSmrg		UNAME_MACHINE=alphaev5 ;;
3117a84e134Smrg	    "EV5.6 (21164A)")
3125ec34c4cSmrg		UNAME_MACHINE=alphaev56 ;;
3137a84e134Smrg	    "EV5.6 (21164PC)")
3145ec34c4cSmrg		UNAME_MACHINE=alphapca56 ;;
3157a84e134Smrg	    "EV5.7 (21164PC)")
3165ec34c4cSmrg		UNAME_MACHINE=alphapca57 ;;
3177a84e134Smrg	    "EV6 (21264)")
3185ec34c4cSmrg		UNAME_MACHINE=alphaev6 ;;
3197a84e134Smrg	    "EV6.7 (21264A)")
3205ec34c4cSmrg		UNAME_MACHINE=alphaev67 ;;
3217a84e134Smrg	    "EV6.8CB (21264C)")
3225ec34c4cSmrg		UNAME_MACHINE=alphaev68 ;;
3237a84e134Smrg	    "EV6.8AL (21264B)")
3245ec34c4cSmrg		UNAME_MACHINE=alphaev68 ;;
3257a84e134Smrg	    "EV6.8CX (21264D)")
3265ec34c4cSmrg		UNAME_MACHINE=alphaev68 ;;
3277a84e134Smrg	    "EV6.9A (21264/EV69A)")
3285ec34c4cSmrg		UNAME_MACHINE=alphaev69 ;;
3297a84e134Smrg	    "EV7 (21364)")
3305ec34c4cSmrg		UNAME_MACHINE=alphaev7 ;;
3317a84e134Smrg	    "EV7.9 (21364A)")
3325ec34c4cSmrg		UNAME_MACHINE=alphaev79 ;;
3337a84e134Smrg	esac
3347a84e134Smrg	# A Pn.n version is a patched version.
3357a84e134Smrg	# A Vn.n version is a released version.
3367a84e134Smrg	# A Tn.n version is a released field test version.
3377a84e134Smrg	# A Xn.n version is an unreleased experimental baselevel.
3387a84e134Smrg	# 1.2 uses "1.2" for uname -r.
3395ec34c4cSmrg	echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`"
340421c997bSmrg	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
341421c997bSmrg	exitcode=$?
342421c997bSmrg	trap '' 0
343421c997bSmrg	exit $exitcode ;;
3447a84e134Smrg    Amiga*:UNIX_System_V:4.0:*)
3457a84e134Smrg	echo m68k-unknown-sysv4
3467a84e134Smrg	exit ;;
3477a84e134Smrg    *:[Aa]miga[Oo][Ss]:*:*)
3485ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-amigaos
3497a84e134Smrg	exit ;;
3507a84e134Smrg    *:[Mm]orph[Oo][Ss]:*:*)
3515ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-morphos
3527a84e134Smrg	exit ;;
3537a84e134Smrg    *:OS/390:*:*)
3547a84e134Smrg	echo i370-ibm-openedition
3557a84e134Smrg	exit ;;
3567a84e134Smrg    *:z/VM:*:*)
3577a84e134Smrg	echo s390-ibm-zvmoe
3587a84e134Smrg	exit ;;
3597a84e134Smrg    *:OS400:*:*)
360421c997bSmrg	echo powerpc-ibm-os400
3617a84e134Smrg	exit ;;
3627a84e134Smrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
3635ec34c4cSmrg	echo arm-acorn-riscix"$UNAME_RELEASE"
3647a84e134Smrg	exit ;;
365c889a3bfSmrg    arm*:riscos:*:*|arm*:RISCOS:*:*)
3667a84e134Smrg	echo arm-unknown-riscos
3677a84e134Smrg	exit ;;
3687a84e134Smrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
3697a84e134Smrg	echo hppa1.1-hitachi-hiuxmpp
3707a84e134Smrg	exit ;;
3717a84e134Smrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
3727a84e134Smrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
3737a84e134Smrg	if test "`(/bin/universe) 2>/dev/null`" = att ; then
3747a84e134Smrg		echo pyramid-pyramid-sysv3
3757a84e134Smrg	else
3767a84e134Smrg		echo pyramid-pyramid-bsd
3777a84e134Smrg	fi
3787a84e134Smrg	exit ;;
3797a84e134Smrg    NILE*:*:*:dcosx)
3807a84e134Smrg	echo pyramid-pyramid-svr4
3817a84e134Smrg	exit ;;
3827a84e134Smrg    DRS?6000:unix:4.0:6*)
3837a84e134Smrg	echo sparc-icl-nx6
3847a84e134Smrg	exit ;;
3857a84e134Smrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
3867a84e134Smrg	case `/usr/bin/uname -p` in
3877a84e134Smrg	    sparc) echo sparc-icl-nx7; exit ;;
3887a84e134Smrg	esac ;;
389994689c1Smrg    s390x:SunOS:*:*)
3905ec34c4cSmrg	echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
391994689c1Smrg	exit ;;
3927a84e134Smrg    sun4H:SunOS:5.*:*)
3935ec34c4cSmrg	echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
3947a84e134Smrg	exit ;;
3957a84e134Smrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
3965ec34c4cSmrg	echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
3977a84e134Smrg	exit ;;
398994689c1Smrg    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
3995ec34c4cSmrg	echo i386-pc-auroraux"$UNAME_RELEASE"
400994689c1Smrg	exit ;;
401ab902922Smrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
4025ec34c4cSmrg	set_cc_for_build
4035ec34c4cSmrg	SUN_ARCH=i386
404994689c1Smrg	# If there is a compiler, see if it is configured for 64-bit objects.
405994689c1Smrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
406994689c1Smrg	# This test works for both compilers.
4075ec34c4cSmrg	if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
408994689c1Smrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
4095ec34c4cSmrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
410994689c1Smrg		grep IS_64BIT_ARCH >/dev/null
411994689c1Smrg	    then
4125ec34c4cSmrg		SUN_ARCH=x86_64
413994689c1Smrg	    fi
414994689c1Smrg	fi
4155ec34c4cSmrg	echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
4167a84e134Smrg	exit ;;
4177a84e134Smrg    sun4*:SunOS:6*:*)
4187a84e134Smrg	# According to config.sub, this is the proper way to canonicalize
4197a84e134Smrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
4207a84e134Smrg	# it's likely to be more like Solaris than SunOS4.
4215ec34c4cSmrg	echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
4227a84e134Smrg	exit ;;
4237a84e134Smrg    sun4*:SunOS:*:*)
4247a84e134Smrg	case "`/usr/bin/arch -k`" in
4257a84e134Smrg	    Series*|S4*)
4267a84e134Smrg		UNAME_RELEASE=`uname -v`
4277a84e134Smrg		;;
4287a84e134Smrg	esac
4297a84e134Smrg	# Japanese Language versions have a version number like `4.1.3-JL'.
4305ec34c4cSmrg	echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`"
4317a84e134Smrg	exit ;;
4327a84e134Smrg    sun3*:SunOS:*:*)
4335ec34c4cSmrg	echo m68k-sun-sunos"$UNAME_RELEASE"
4347a84e134Smrg	exit ;;
4357a84e134Smrg    sun*:*:4.2BSD:*)
4367a84e134Smrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
4375ec34c4cSmrg	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
4387a84e134Smrg	case "`/bin/arch`" in
4397a84e134Smrg	    sun3)
4405ec34c4cSmrg		echo m68k-sun-sunos"$UNAME_RELEASE"
4417a84e134Smrg		;;
4427a84e134Smrg	    sun4)
4435ec34c4cSmrg		echo sparc-sun-sunos"$UNAME_RELEASE"
4447a84e134Smrg		;;
4457a84e134Smrg	esac
4467a84e134Smrg	exit ;;
4477a84e134Smrg    aushp:SunOS:*:*)
4485ec34c4cSmrg	echo sparc-auspex-sunos"$UNAME_RELEASE"
4497a84e134Smrg	exit ;;
4507a84e134Smrg    # The situation for MiNT is a little confusing.  The machine name
4517a84e134Smrg    # can be virtually everything (everything which is not
4527a84e134Smrg    # "atarist" or "atariste" at least should have a processor
4537a84e134Smrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
4547a84e134Smrg    # to the lowercase version "mint" (or "freemint").  Finally
4557a84e134Smrg    # the system name "TOS" denotes a system which is actually not
4567a84e134Smrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
4577a84e134Smrg    # be no problem.
4587a84e134Smrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
4595ec34c4cSmrg	echo m68k-atari-mint"$UNAME_RELEASE"
4607a84e134Smrg	exit ;;
4617a84e134Smrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
4625ec34c4cSmrg	echo m68k-atari-mint"$UNAME_RELEASE"
463421c997bSmrg	exit ;;
4647a84e134Smrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
4655ec34c4cSmrg	echo m68k-atari-mint"$UNAME_RELEASE"
4667a84e134Smrg	exit ;;
4677a84e134Smrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
4685ec34c4cSmrg	echo m68k-milan-mint"$UNAME_RELEASE"
469421c997bSmrg	exit ;;
4707a84e134Smrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
4715ec34c4cSmrg	echo m68k-hades-mint"$UNAME_RELEASE"
472421c997bSmrg	exit ;;
4737a84e134Smrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
4745ec34c4cSmrg	echo m68k-unknown-mint"$UNAME_RELEASE"
475421c997bSmrg	exit ;;
4767a84e134Smrg    m68k:machten:*:*)
4775ec34c4cSmrg	echo m68k-apple-machten"$UNAME_RELEASE"
4787a84e134Smrg	exit ;;
4797a84e134Smrg    powerpc:machten:*:*)
4805ec34c4cSmrg	echo powerpc-apple-machten"$UNAME_RELEASE"
4817a84e134Smrg	exit ;;
4827a84e134Smrg    RISC*:Mach:*:*)
4837a84e134Smrg	echo mips-dec-mach_bsd4.3
4847a84e134Smrg	exit ;;
4857a84e134Smrg    RISC*:ULTRIX:*:*)
4865ec34c4cSmrg	echo mips-dec-ultrix"$UNAME_RELEASE"
4877a84e134Smrg	exit ;;
4887a84e134Smrg    VAX*:ULTRIX*:*:*)
4895ec34c4cSmrg	echo vax-dec-ultrix"$UNAME_RELEASE"
4907a84e134Smrg	exit ;;
4917a84e134Smrg    2020:CLIX:*:* | 2430:CLIX:*:*)
4925ec34c4cSmrg	echo clipper-intergraph-clix"$UNAME_RELEASE"
4937a84e134Smrg	exit ;;
4947a84e134Smrg    mips:*:*:UMIPS | mips:*:*:RISCos)
4955ec34c4cSmrg	set_cc_for_build
4965ec34c4cSmrg	sed 's/^	//' << EOF > "$dummy.c"
4977a84e134Smrg#ifdef __cplusplus
4987a84e134Smrg#include <stdio.h>  /* for printf() prototype */
4997a84e134Smrg	int main (int argc, char *argv[]) {
5007a84e134Smrg#else
5017a84e134Smrg	int main (argc, argv) int argc; char *argv[]; {
5027a84e134Smrg#endif
5037a84e134Smrg	#if defined (host_mips) && defined (MIPSEB)
5047a84e134Smrg	#if defined (SYSTYPE_SYSV)
5055ec34c4cSmrg	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
5067a84e134Smrg	#endif
5077a84e134Smrg	#if defined (SYSTYPE_SVR4)
5085ec34c4cSmrg	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
5097a84e134Smrg	#endif
5107a84e134Smrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
5115ec34c4cSmrg	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
5127a84e134Smrg	#endif
5137a84e134Smrg	#endif
5147a84e134Smrg	  exit (-1);
5157a84e134Smrg	}
5167a84e134SmrgEOF
5175ec34c4cSmrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
5185ec34c4cSmrg	  dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
5195ec34c4cSmrg	  SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
5207a84e134Smrg	    { echo "$SYSTEM_NAME"; exit; }
5215ec34c4cSmrg	echo mips-mips-riscos"$UNAME_RELEASE"
5227a84e134Smrg	exit ;;
5237a84e134Smrg    Motorola:PowerMAX_OS:*:*)
5247a84e134Smrg	echo powerpc-motorola-powermax
5257a84e134Smrg	exit ;;
5267a84e134Smrg    Motorola:*:4.3:PL8-*)
5277a84e134Smrg	echo powerpc-harris-powermax
5287a84e134Smrg	exit ;;
5297a84e134Smrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
5307a84e134Smrg	echo powerpc-harris-powermax
5317a84e134Smrg	exit ;;
5327a84e134Smrg    Night_Hawk:Power_UNIX:*:*)
5337a84e134Smrg	echo powerpc-harris-powerunix
5347a84e134Smrg	exit ;;
5357a84e134Smrg    m88k:CX/UX:7*:*)
5367a84e134Smrg	echo m88k-harris-cxux7
5377a84e134Smrg	exit ;;
5387a84e134Smrg    m88k:*:4*:R4*)
5397a84e134Smrg	echo m88k-motorola-sysv4
5407a84e134Smrg	exit ;;
5417a84e134Smrg    m88k:*:3*:R3*)
5427a84e134Smrg	echo m88k-motorola-sysv3
5437a84e134Smrg	exit ;;
5447a84e134Smrg    AViiON:dgux:*:*)
545421c997bSmrg	# DG/UX returns AViiON for all architectures
546421c997bSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
5475ec34c4cSmrg	if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ]
5487a84e134Smrg	then
5495ec34c4cSmrg	    if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \
5505ec34c4cSmrg	       [ "$TARGET_BINARY_INTERFACE"x = x ]
5517a84e134Smrg	    then
5525ec34c4cSmrg		echo m88k-dg-dgux"$UNAME_RELEASE"
5537a84e134Smrg	    else
5545ec34c4cSmrg		echo m88k-dg-dguxbcs"$UNAME_RELEASE"
5557a84e134Smrg	    fi
5567a84e134Smrg	else
5575ec34c4cSmrg	    echo i586-dg-dgux"$UNAME_RELEASE"
5587a84e134Smrg	fi
559421c997bSmrg	exit ;;
5607a84e134Smrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
5617a84e134Smrg	echo m88k-dolphin-sysv3
5627a84e134Smrg	exit ;;
5637a84e134Smrg    M88*:*:R3*:*)
5647a84e134Smrg	# Delta 88k system running SVR3
5657a84e134Smrg	echo m88k-motorola-sysv3
5667a84e134Smrg	exit ;;
5677a84e134Smrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
5687a84e134Smrg	echo m88k-tektronix-sysv3
5697a84e134Smrg	exit ;;
5707a84e134Smrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
5717a84e134Smrg	echo m68k-tektronix-bsd
5727a84e134Smrg	exit ;;
5737a84e134Smrg    *:IRIX*:*:*)
5745ec34c4cSmrg	echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`"
5757a84e134Smrg	exit ;;
5767a84e134Smrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
5777a84e134Smrg	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
5787a84e134Smrg	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
5797a84e134Smrg    i*86:AIX:*:*)
5807a84e134Smrg	echo i386-ibm-aix
5817a84e134Smrg	exit ;;
5827a84e134Smrg    ia64:AIX:*:*)
5837a84e134Smrg	if [ -x /usr/bin/oslevel ] ; then
5847a84e134Smrg		IBM_REV=`/usr/bin/oslevel`
5857a84e134Smrg	else
5865ec34c4cSmrg		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
5877a84e134Smrg	fi
5885ec34c4cSmrg	echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV"
5897a84e134Smrg	exit ;;
5907a84e134Smrg    *:AIX:2:3)
5917a84e134Smrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
5925ec34c4cSmrg		set_cc_for_build
5935ec34c4cSmrg		sed 's/^		//' << EOF > "$dummy.c"
5947a84e134Smrg		#include <sys/systemcfg.h>
5957a84e134Smrg
5967a84e134Smrg		main()
5977a84e134Smrg			{
5987a84e134Smrg			if (!__power_pc())
5997a84e134Smrg				exit(1);
6007a84e134Smrg			puts("powerpc-ibm-aix3.2.5");
6017a84e134Smrg			exit(0);
6027a84e134Smrg			}
6037a84e134SmrgEOF
6045ec34c4cSmrg		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
6057a84e134Smrg		then
6067a84e134Smrg			echo "$SYSTEM_NAME"
6077a84e134Smrg		else
6087a84e134Smrg			echo rs6000-ibm-aix3.2.5
6097a84e134Smrg		fi
6107a84e134Smrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
6117a84e134Smrg		echo rs6000-ibm-aix3.2.4
6127a84e134Smrg	else
6137a84e134Smrg		echo rs6000-ibm-aix3.2
6147a84e134Smrg	fi
6157a84e134Smrg	exit ;;
616994689c1Smrg    *:AIX:*:[4567])
6177a84e134Smrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
6185ec34c4cSmrg	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
6197a84e134Smrg		IBM_ARCH=rs6000
6207a84e134Smrg	else
6217a84e134Smrg		IBM_ARCH=powerpc
6227a84e134Smrg	fi
623c8571806Smrg	if [ -x /usr/bin/lslpp ] ; then
624c8571806Smrg		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
625c8571806Smrg			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
6267a84e134Smrg	else
6275ec34c4cSmrg		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
6287a84e134Smrg	fi
6295ec34c4cSmrg	echo "$IBM_ARCH"-ibm-aix"$IBM_REV"
6307a84e134Smrg	exit ;;
6317a84e134Smrg    *:AIX:*:*)
6327a84e134Smrg	echo rs6000-ibm-aix
6337a84e134Smrg	exit ;;
6345ec34c4cSmrg    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
6357a84e134Smrg	echo romp-ibm-bsd4.4
6367a84e134Smrg	exit ;;
6377a84e134Smrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
6385ec34c4cSmrg	echo romp-ibm-bsd"$UNAME_RELEASE"   # 4.3 with uname added to
6397a84e134Smrg	exit ;;                             # report: romp-ibm BSD 4.3
6407a84e134Smrg    *:BOSX:*:*)
6417a84e134Smrg	echo rs6000-bull-bosx
6427a84e134Smrg	exit ;;
6437a84e134Smrg    DPX/2?00:B.O.S.:*:*)
6447a84e134Smrg	echo m68k-bull-sysv3
6457a84e134Smrg	exit ;;
6467a84e134Smrg    9000/[34]??:4.3bsd:1.*:*)
6477a84e134Smrg	echo m68k-hp-bsd
6487a84e134Smrg	exit ;;
6497a84e134Smrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
6507a84e134Smrg	echo m68k-hp-bsd4.4
6517a84e134Smrg	exit ;;
6527a84e134Smrg    9000/[34678]??:HP-UX:*:*)
6535ec34c4cSmrg	HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
6545ec34c4cSmrg	case "$UNAME_MACHINE" in
6555ec34c4cSmrg	    9000/31?)            HP_ARCH=m68000 ;;
6565ec34c4cSmrg	    9000/[34]??)         HP_ARCH=m68k ;;
6577a84e134Smrg	    9000/[678][0-9][0-9])
6587a84e134Smrg		if [ -x /usr/bin/getconf ]; then
6597a84e134Smrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
660421c997bSmrg		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
6615ec34c4cSmrg		    case "$sc_cpu_version" in
6625ec34c4cSmrg		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
6635ec34c4cSmrg		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
664421c997bSmrg		      532)                      # CPU_PA_RISC2_0
6655ec34c4cSmrg			case "$sc_kernel_bits" in
6665ec34c4cSmrg			  32) HP_ARCH=hppa2.0n ;;
6675ec34c4cSmrg			  64) HP_ARCH=hppa2.0w ;;
6685ec34c4cSmrg			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
669421c997bSmrg			esac ;;
670421c997bSmrg		    esac
6717a84e134Smrg		fi
6725ec34c4cSmrg		if [ "$HP_ARCH" = "" ]; then
6735ec34c4cSmrg		    set_cc_for_build
6745ec34c4cSmrg		    sed 's/^		//' << EOF > "$dummy.c"
6757a84e134Smrg
676421c997bSmrg		#define _HPUX_SOURCE
677421c997bSmrg		#include <stdlib.h>
678421c997bSmrg		#include <unistd.h>
6797a84e134Smrg
680421c997bSmrg		int main ()
681421c997bSmrg		{
682421c997bSmrg		#if defined(_SC_KERNEL_BITS)
683421c997bSmrg		    long bits = sysconf(_SC_KERNEL_BITS);
684421c997bSmrg		#endif
685421c997bSmrg		    long cpu  = sysconf (_SC_CPU_VERSION);
6867a84e134Smrg
687421c997bSmrg		    switch (cpu)
688421c997bSmrg			{
689421c997bSmrg			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
690421c997bSmrg			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
691421c997bSmrg			case CPU_PA_RISC2_0:
692421c997bSmrg		#if defined(_SC_KERNEL_BITS)
693421c997bSmrg			    switch (bits)
694421c997bSmrg				{
695421c997bSmrg				case 64: puts ("hppa2.0w"); break;
696421c997bSmrg				case 32: puts ("hppa2.0n"); break;
697421c997bSmrg				default: puts ("hppa2.0"); break;
698421c997bSmrg				} break;
699421c997bSmrg		#else  /* !defined(_SC_KERNEL_BITS) */
700421c997bSmrg			    puts ("hppa2.0"); break;
701421c997bSmrg		#endif
702421c997bSmrg			default: puts ("hppa1.0"); break;
703421c997bSmrg			}
704421c997bSmrg		    exit (0);
705421c997bSmrg		}
7067a84e134SmrgEOF
7075ec34c4cSmrg		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
7087a84e134Smrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
7097a84e134Smrg		fi ;;
7107a84e134Smrg	esac
7115ec34c4cSmrg	if [ "$HP_ARCH" = hppa2.0w ]
7127a84e134Smrg	then
7135ec34c4cSmrg	    set_cc_for_build
7147a84e134Smrg
7157a84e134Smrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
7167a84e134Smrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
7177a84e134Smrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
7187a84e134Smrg	    #
7197a84e134Smrg	    # $ CC_FOR_BUILD=cc ./config.guess
7207a84e134Smrg	    # => hppa2.0w-hp-hpux11.23
7217a84e134Smrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
7227a84e134Smrg	    # => hppa64-hp-hpux11.23
7237a84e134Smrg
7245ec34c4cSmrg	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
725994689c1Smrg		grep -q __LP64__
7267a84e134Smrg	    then
7275ec34c4cSmrg		HP_ARCH=hppa2.0w
7287a84e134Smrg	    else
7295ec34c4cSmrg		HP_ARCH=hppa64
7307a84e134Smrg	    fi
7317a84e134Smrg	fi
7325ec34c4cSmrg	echo "$HP_ARCH"-hp-hpux"$HPUX_REV"
7337a84e134Smrg	exit ;;
7347a84e134Smrg    ia64:HP-UX:*:*)
7355ec34c4cSmrg	HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
7365ec34c4cSmrg	echo ia64-hp-hpux"$HPUX_REV"
7377a84e134Smrg	exit ;;
7387a84e134Smrg    3050*:HI-UX:*:*)
7395ec34c4cSmrg	set_cc_for_build
7405ec34c4cSmrg	sed 's/^	//' << EOF > "$dummy.c"
7417a84e134Smrg	#include <unistd.h>
7427a84e134Smrg	int
7437a84e134Smrg	main ()
7447a84e134Smrg	{
7457a84e134Smrg	  long cpu = sysconf (_SC_CPU_VERSION);
7467a84e134Smrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
7477a84e134Smrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
7487a84e134Smrg	     results, however.  */
7497a84e134Smrg	  if (CPU_IS_PA_RISC (cpu))
7507a84e134Smrg	    {
7517a84e134Smrg	      switch (cpu)
7527a84e134Smrg		{
7537a84e134Smrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
7547a84e134Smrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
7557a84e134Smrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
7567a84e134Smrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
7577a84e134Smrg		}
7587a84e134Smrg	    }
7597a84e134Smrg	  else if (CPU_IS_HP_MC68K (cpu))
7607a84e134Smrg	    puts ("m68k-hitachi-hiuxwe2");
7617a84e134Smrg	  else puts ("unknown-hitachi-hiuxwe2");
7627a84e134Smrg	  exit (0);
7637a84e134Smrg	}
7647a84e134SmrgEOF
7655ec34c4cSmrg	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
7667a84e134Smrg		{ echo "$SYSTEM_NAME"; exit; }
7677a84e134Smrg	echo unknown-hitachi-hiuxwe2
7687a84e134Smrg	exit ;;
7695ec34c4cSmrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
7707a84e134Smrg	echo hppa1.1-hp-bsd
7717a84e134Smrg	exit ;;
7727a84e134Smrg    9000/8??:4.3bsd:*:*)
7737a84e134Smrg	echo hppa1.0-hp-bsd
7747a84e134Smrg	exit ;;
7757a84e134Smrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
7767a84e134Smrg	echo hppa1.0-hp-mpeix
7777a84e134Smrg	exit ;;
7785ec34c4cSmrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
7797a84e134Smrg	echo hppa1.1-hp-osf
7807a84e134Smrg	exit ;;
7817a84e134Smrg    hp8??:OSF1:*:*)
7827a84e134Smrg	echo hppa1.0-hp-osf
7837a84e134Smrg	exit ;;
7847a84e134Smrg    i*86:OSF1:*:*)
7857a84e134Smrg	if [ -x /usr/sbin/sysversion ] ; then
7865ec34c4cSmrg	    echo "$UNAME_MACHINE"-unknown-osf1mk
7877a84e134Smrg	else
7885ec34c4cSmrg	    echo "$UNAME_MACHINE"-unknown-osf1
7897a84e134Smrg	fi
7907a84e134Smrg	exit ;;
7917a84e134Smrg    parisc*:Lites*:*:*)
7927a84e134Smrg	echo hppa1.1-hp-lites
7937a84e134Smrg	exit ;;
7947a84e134Smrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
7957a84e134Smrg	echo c1-convex-bsd
796421c997bSmrg	exit ;;
7977a84e134Smrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
7987a84e134Smrg	if getsysinfo -f scalar_acc
7997a84e134Smrg	then echo c32-convex-bsd
8007a84e134Smrg	else echo c2-convex-bsd
8017a84e134Smrg	fi
802421c997bSmrg	exit ;;
8037a84e134Smrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
8047a84e134Smrg	echo c34-convex-bsd
805421c997bSmrg	exit ;;
8067a84e134Smrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
8077a84e134Smrg	echo c38-convex-bsd
808421c997bSmrg	exit ;;
8097a84e134Smrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
8107a84e134Smrg	echo c4-convex-bsd
811421c997bSmrg	exit ;;
8127a84e134Smrg    CRAY*Y-MP:*:*:*)
8135ec34c4cSmrg	echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
8147a84e134Smrg	exit ;;
8157a84e134Smrg    CRAY*[A-Z]90:*:*:*)
8165ec34c4cSmrg	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
8177a84e134Smrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
8187a84e134Smrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
8197a84e134Smrg	      -e 's/\.[^.]*$/.X/'
8207a84e134Smrg	exit ;;
8217a84e134Smrg    CRAY*TS:*:*:*)
8225ec34c4cSmrg	echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
8237a84e134Smrg	exit ;;
8247a84e134Smrg    CRAY*T3E:*:*:*)
8255ec34c4cSmrg	echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
8267a84e134Smrg	exit ;;
8277a84e134Smrg    CRAY*SV1:*:*:*)
8285ec34c4cSmrg	echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
8297a84e134Smrg	exit ;;
8307a84e134Smrg    *:UNICOS/mp:*:*)
8315ec34c4cSmrg	echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
8327a84e134Smrg	exit ;;
8337a84e134Smrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
8345ec34c4cSmrg	FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
8355ec34c4cSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
8365ec34c4cSmrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
837421c997bSmrg	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
838421c997bSmrg	exit ;;
8397a84e134Smrg    5000:UNIX_System_V:4.*:*)
8405ec34c4cSmrg	FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
8415ec34c4cSmrg	FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
842421c997bSmrg	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
8437a84e134Smrg	exit ;;
8447a84e134Smrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
8455ec34c4cSmrg	echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE"
8467a84e134Smrg	exit ;;
8477a84e134Smrg    sparc*:BSD/OS:*:*)
8485ec34c4cSmrg	echo sparc-unknown-bsdi"$UNAME_RELEASE"
8497a84e134Smrg	exit ;;
8507a84e134Smrg    *:BSD/OS:*:*)
8515ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE"
8525ec34c4cSmrg	exit ;;
8535ec34c4cSmrg    arm:FreeBSD:*:*)
8545ec34c4cSmrg	UNAME_PROCESSOR=`uname -p`
8555ec34c4cSmrg	set_cc_for_build
8565ec34c4cSmrg	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
8575ec34c4cSmrg	    | grep -q __ARM_PCS_VFP
8585ec34c4cSmrg	then
8595ec34c4cSmrg	    echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabi
8605ec34c4cSmrg	else
8615ec34c4cSmrg	    echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabihf
8625ec34c4cSmrg	fi
8637a84e134Smrg	exit ;;
8647a84e134Smrg    *:FreeBSD:*:*)
865421c997bSmrg	UNAME_PROCESSOR=`/usr/bin/uname -p`
8665ec34c4cSmrg	case "$UNAME_PROCESSOR" in
867ab902922Smrg	    amd64)
8685ec34c4cSmrg		UNAME_PROCESSOR=x86_64 ;;
8695ec34c4cSmrg	    i386)
8705ec34c4cSmrg		UNAME_PROCESSOR=i586 ;;
871ab902922Smrg	esac
8725ec34c4cSmrg	echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
8737a84e134Smrg	exit ;;
8747a84e134Smrg    i*:CYGWIN*:*)
8755ec34c4cSmrg	echo "$UNAME_MACHINE"-pc-cygwin
8767a84e134Smrg	exit ;;
877c889a3bfSmrg    *:MINGW64*:*)
8785ec34c4cSmrg	echo "$UNAME_MACHINE"-pc-mingw64
879c889a3bfSmrg	exit ;;
880ab902922Smrg    *:MINGW*:*)
8815ec34c4cSmrg	echo "$UNAME_MACHINE"-pc-mingw32
8827a84e134Smrg	exit ;;
883c8571806Smrg    *:MSYS*:*)
8845ec34c4cSmrg	echo "$UNAME_MACHINE"-pc-msys
8857a84e134Smrg	exit ;;
8867a84e134Smrg    i*:PW*:*)
8875ec34c4cSmrg	echo "$UNAME_MACHINE"-pc-pw32
8887a84e134Smrg	exit ;;
889994689c1Smrg    *:Interix*:*)
8905ec34c4cSmrg	case "$UNAME_MACHINE" in
891ab902922Smrg	    x86)
8925ec34c4cSmrg		echo i586-pc-interix"$UNAME_RELEASE"
893ab902922Smrg		exit ;;
894994689c1Smrg	    authenticamd | genuineintel | EM64T)
8955ec34c4cSmrg		echo x86_64-unknown-interix"$UNAME_RELEASE"
896ab902922Smrg		exit ;;
897ab902922Smrg	    IA64)
8985ec34c4cSmrg		echo ia64-unknown-interix"$UNAME_RELEASE"
899ab902922Smrg		exit ;;
900ab902922Smrg	esac ;;
9017a84e134Smrg    i*:UWIN*:*)
9025ec34c4cSmrg	echo "$UNAME_MACHINE"-pc-uwin
9037a84e134Smrg	exit ;;
9047a84e134Smrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
9055ec34c4cSmrg	echo x86_64-pc-cygwin
9067a84e134Smrg	exit ;;
9077a84e134Smrg    prep*:SunOS:5.*:*)
9085ec34c4cSmrg	echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
9097a84e134Smrg	exit ;;
9107a84e134Smrg    *:GNU:*:*)
9117a84e134Smrg	# the GNU system
9125ec34c4cSmrg	echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`"
9137a84e134Smrg	exit ;;
9147a84e134Smrg    *:GNU/*:*:*)
9157a84e134Smrg	# other systems with GNU libc and userland
9165ec34c4cSmrg	echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC"
9177a84e134Smrg	exit ;;
9185ec34c4cSmrg    *:Minix:*:*)
9195ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-minix
9207a84e134Smrg	exit ;;
921c889a3bfSmrg    aarch64:Linux:*:*)
9225ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
923c889a3bfSmrg	exit ;;
924c889a3bfSmrg    aarch64_be:Linux:*:*)
925c889a3bfSmrg	UNAME_MACHINE=aarch64_be
9265ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
927c889a3bfSmrg	exit ;;
928994689c1Smrg    alpha:Linux:*:*)
9295ec34c4cSmrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
930994689c1Smrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
931994689c1Smrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
932994689c1Smrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
933994689c1Smrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
934994689c1Smrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
935994689c1Smrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
936994689c1Smrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
937421c997bSmrg	esac
938994689c1Smrg	objdump --private-headers /bin/sh | grep -q ld.so.1
9395ec34c4cSmrg	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
9405ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
941c889a3bfSmrg	exit ;;
942c889a3bfSmrg    arc:Linux:*:* | arceb:Linux:*:*)
9435ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
944994689c1Smrg	exit ;;
9457a84e134Smrg    arm*:Linux:*:*)
9465ec34c4cSmrg	set_cc_for_build
947ab902922Smrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
948ab902922Smrg	    | grep -q __ARM_EABI__
949ab902922Smrg	then
9505ec34c4cSmrg	    echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
951ab902922Smrg	else
952421c997bSmrg	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
953421c997bSmrg		| grep -q __ARM_PCS_VFP
954421c997bSmrg	    then
9555ec34c4cSmrg		echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi
956421c997bSmrg	    else
9575ec34c4cSmrg		echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf
958421c997bSmrg	    fi
959ab902922Smrg	fi
960ab902922Smrg	exit ;;
961ab902922Smrg    avr32*:Linux:*:*)
9625ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9637a84e134Smrg	exit ;;
9647a84e134Smrg    cris:Linux:*:*)
9655ec34c4cSmrg	echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
9667a84e134Smrg	exit ;;
9677a84e134Smrg    crisv32:Linux:*:*)
9685ec34c4cSmrg	echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
9695ec34c4cSmrg	exit ;;
9705ec34c4cSmrg    e2k:Linux:*:*)
9715ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9727a84e134Smrg	exit ;;
9737a84e134Smrg    frv:Linux:*:*)
9745ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
975421c997bSmrg	exit ;;
976421c997bSmrg    hexagon:Linux:*:*)
9775ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9787a84e134Smrg	exit ;;
979994689c1Smrg    i*86:Linux:*:*)
9805ec34c4cSmrg	echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
981994689c1Smrg	exit ;;
9827a84e134Smrg    ia64:Linux:*:*)
9835ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9845ec34c4cSmrg	exit ;;
9855ec34c4cSmrg    k1om:Linux:*:*)
9865ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9877a84e134Smrg	exit ;;
9887a84e134Smrg    m32r*:Linux:*:*)
9895ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9907a84e134Smrg	exit ;;
9917a84e134Smrg    m68*:Linux:*:*)
9925ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
9937a84e134Smrg	exit ;;
994994689c1Smrg    mips:Linux:*:* | mips64:Linux:*:*)
9955ec34c4cSmrg	set_cc_for_build
9965ec34c4cSmrg	IS_GLIBC=0
9975ec34c4cSmrg	test x"${LIBC}" = xgnu && IS_GLIBC=1
9985ec34c4cSmrg	sed 's/^	//' << EOF > "$dummy.c"
9997a84e134Smrg	#undef CPU
10005ec34c4cSmrg	#undef mips
10015ec34c4cSmrg	#undef mipsel
10025ec34c4cSmrg	#undef mips64
10035ec34c4cSmrg	#undef mips64el
10045ec34c4cSmrg	#if ${IS_GLIBC} && defined(_ABI64)
10055ec34c4cSmrg	LIBCABI=gnuabi64
10065ec34c4cSmrg	#else
10075ec34c4cSmrg	#if ${IS_GLIBC} && defined(_ABIN32)
10085ec34c4cSmrg	LIBCABI=gnuabin32
10095ec34c4cSmrg	#else
10105ec34c4cSmrg	LIBCABI=${LIBC}
10115ec34c4cSmrg	#endif
10125ec34c4cSmrg	#endif
10135ec34c4cSmrg
10145ec34c4cSmrg	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
10155ec34c4cSmrg	CPU=mipsisa64r6
10165ec34c4cSmrg	#else
10175ec34c4cSmrg	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
10185ec34c4cSmrg	CPU=mipsisa32r6
10195ec34c4cSmrg	#else
10205ec34c4cSmrg	#if defined(__mips64)
10215ec34c4cSmrg	CPU=mips64
10225ec34c4cSmrg	#else
10235ec34c4cSmrg	CPU=mips
10245ec34c4cSmrg	#endif
10255ec34c4cSmrg	#endif
10265ec34c4cSmrg	#endif
10275ec34c4cSmrg
10287a84e134Smrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
10295ec34c4cSmrg	MIPS_ENDIAN=el
10307a84e134Smrg	#else
10317a84e134Smrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
10325ec34c4cSmrg	MIPS_ENDIAN=
10337a84e134Smrg	#else
10345ec34c4cSmrg	MIPS_ENDIAN=
10357a84e134Smrg	#endif
10367a84e134Smrg	#endif
10377a84e134SmrgEOF
10385ec34c4cSmrg	eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`"
10395ec34c4cSmrg	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
10407a84e134Smrg	;;
10415ec34c4cSmrg    mips64el:Linux:*:*)
10425ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
10435ec34c4cSmrg	exit ;;
1044c8571806Smrg    openrisc*:Linux:*:*)
10455ec34c4cSmrg	echo or1k-unknown-linux-"$LIBC"
1046c889a3bfSmrg	exit ;;
1047c8571806Smrg    or32:Linux:*:* | or1k*:Linux:*:*)
10485ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
10497a84e134Smrg	exit ;;
1050994689c1Smrg    padre:Linux:*:*)
10515ec34c4cSmrg	echo sparc-unknown-linux-"$LIBC"
10527a84e134Smrg	exit ;;
1053994689c1Smrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
10545ec34c4cSmrg	echo hppa64-unknown-linux-"$LIBC"
10557a84e134Smrg	exit ;;
10567a84e134Smrg    parisc:Linux:*:* | hppa:Linux:*:*)
10577a84e134Smrg	# Look for CPU level
10587a84e134Smrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
10595ec34c4cSmrg	  PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;;
10605ec34c4cSmrg	  PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;;
10615ec34c4cSmrg	  *)    echo hppa-unknown-linux-"$LIBC" ;;
10627a84e134Smrg	esac
10637a84e134Smrg	exit ;;
1064994689c1Smrg    ppc64:Linux:*:*)
10655ec34c4cSmrg	echo powerpc64-unknown-linux-"$LIBC"
1066994689c1Smrg	exit ;;
1067994689c1Smrg    ppc:Linux:*:*)
10685ec34c4cSmrg	echo powerpc-unknown-linux-"$LIBC"
1069c889a3bfSmrg	exit ;;
1070c889a3bfSmrg    ppc64le:Linux:*:*)
10715ec34c4cSmrg	echo powerpc64le-unknown-linux-"$LIBC"
1072c889a3bfSmrg	exit ;;
1073c889a3bfSmrg    ppcle:Linux:*:*)
10745ec34c4cSmrg	echo powerpcle-unknown-linux-"$LIBC"
10755ec34c4cSmrg	exit ;;
10765ec34c4cSmrg    riscv32:Linux:*:* | riscv64:Linux:*:*)
10775ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
10787a84e134Smrg	exit ;;
10797a84e134Smrg    s390:Linux:*:* | s390x:Linux:*:*)
10805ec34c4cSmrg	echo "$UNAME_MACHINE"-ibm-linux-"$LIBC"
10817a84e134Smrg	exit ;;
10827a84e134Smrg    sh64*:Linux:*:*)
10835ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
10847a84e134Smrg	exit ;;
10857a84e134Smrg    sh*:Linux:*:*)
10865ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
10877a84e134Smrg	exit ;;
10887a84e134Smrg    sparc:Linux:*:* | sparc64:Linux:*:*)
10895ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
10907a84e134Smrg	exit ;;
1091994689c1Smrg    tile*:Linux:*:*)
10925ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1093994689c1Smrg	exit ;;
10947a84e134Smrg    vax:Linux:*:*)
10955ec34c4cSmrg	echo "$UNAME_MACHINE"-dec-linux-"$LIBC"
10967a84e134Smrg	exit ;;
10977a84e134Smrg    x86_64:Linux:*:*)
10985ec34c4cSmrg	set_cc_for_build
10995ec34c4cSmrg	LIBCABI=$LIBC
11005ec34c4cSmrg	if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
11015ec34c4cSmrg	    if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
11025ec34c4cSmrg		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
11035ec34c4cSmrg		grep IS_X32 >/dev/null
11045ec34c4cSmrg	    then
11055ec34c4cSmrg		LIBCABI="$LIBC"x32
11065ec34c4cSmrg	    fi
11075ec34c4cSmrg	fi
11085ec34c4cSmrg	echo "$UNAME_MACHINE"-pc-linux-"$LIBCABI"
11097a84e134Smrg	exit ;;
1110ab902922Smrg    xtensa*:Linux:*:*)
11115ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1112ab902922Smrg	exit ;;
11137a84e134Smrg    i*86:DYNIX/ptx:4*:*)
11147a84e134Smrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
11157a84e134Smrg	# earlier versions are messed up and put the nodename in both
11167a84e134Smrg	# sysname and nodename.
11177a84e134Smrg	echo i386-sequent-sysv4
11187a84e134Smrg	exit ;;
11197a84e134Smrg    i*86:UNIX_SV:4.2MP:2.*)
1120421c997bSmrg	# Unixware is an offshoot of SVR4, but it has its own version
1121421c997bSmrg	# number series starting with 2...
1122421c997bSmrg	# I am not positive that other SVR4 systems won't match this,
11237a84e134Smrg	# I just have to hope.  -- rms.
1124421c997bSmrg	# Use sysv4.2uw... so that sysv4* matches it.
11255ec34c4cSmrg	echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION"
11267a84e134Smrg	exit ;;
11277a84e134Smrg    i*86:OS/2:*:*)
11287a84e134Smrg	# If we were able to find `uname', then EMX Unix compatibility
11297a84e134Smrg	# is probably installed.
11305ec34c4cSmrg	echo "$UNAME_MACHINE"-pc-os2-emx
11317a84e134Smrg	exit ;;
11327a84e134Smrg    i*86:XTS-300:*:STOP)
11335ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-stop
11347a84e134Smrg	exit ;;
11357a84e134Smrg    i*86:atheos:*:*)
11365ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-atheos
11377a84e134Smrg	exit ;;
11387a84e134Smrg    i*86:syllable:*:*)
11395ec34c4cSmrg	echo "$UNAME_MACHINE"-pc-syllable
11407a84e134Smrg	exit ;;
1141994689c1Smrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
11425ec34c4cSmrg	echo i386-unknown-lynxos"$UNAME_RELEASE"
11437a84e134Smrg	exit ;;
11447a84e134Smrg    i*86:*DOS:*:*)
11455ec34c4cSmrg	echo "$UNAME_MACHINE"-pc-msdosdjgpp
11467a84e134Smrg	exit ;;
11475ec34c4cSmrg    i*86:*:4.*:*)
11485ec34c4cSmrg	UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
11497a84e134Smrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
11505ec34c4cSmrg		echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL"
11517a84e134Smrg	else
11525ec34c4cSmrg		echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL"
11537a84e134Smrg	fi
11547a84e134Smrg	exit ;;
11557a84e134Smrg    i*86:*:5:[678]*)
1156421c997bSmrg	# UnixWare 7.x, OpenUNIX and OpenServer 6.
11577a84e134Smrg	case `/bin/uname -X | grep "^Machine"` in
11587a84e134Smrg	    *486*)	     UNAME_MACHINE=i486 ;;
11597a84e134Smrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
11607a84e134Smrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
11617a84e134Smrg	esac
11625ec34c4cSmrg	echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}"
11637a84e134Smrg	exit ;;
11647a84e134Smrg    i*86:*:3.2:*)
11657a84e134Smrg	if test -f /usr/options/cb.name; then
11667a84e134Smrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
11675ec34c4cSmrg		echo "$UNAME_MACHINE"-pc-isc"$UNAME_REL"
11687a84e134Smrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
11697a84e134Smrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
11707a84e134Smrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
11717a84e134Smrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
11727a84e134Smrg			&& UNAME_MACHINE=i586
11737a84e134Smrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
11747a84e134Smrg			&& UNAME_MACHINE=i686
11757a84e134Smrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
11767a84e134Smrg			&& UNAME_MACHINE=i686
11775ec34c4cSmrg		echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL"
11787a84e134Smrg	else
11795ec34c4cSmrg		echo "$UNAME_MACHINE"-pc-sysv32
11807a84e134Smrg	fi
11817a84e134Smrg	exit ;;
11827a84e134Smrg    pc:*:*:*)
11837a84e134Smrg	# Left here for compatibility:
1184421c997bSmrg	# uname -m prints for DJGPP always 'pc', but it prints nothing about
1185421c997bSmrg	# the processor, so we play safe by assuming i586.
1186994689c1Smrg	# Note: whatever this is, it MUST be the same as what config.sub
11875ec34c4cSmrg	# prints for the "djgpp" host, or else GDB configure will decide that
1188994689c1Smrg	# this is a cross-build.
1189994689c1Smrg	echo i586-pc-msdosdjgpp
1190421c997bSmrg	exit ;;
11917a84e134Smrg    Intel:Mach:3*:*)
11927a84e134Smrg	echo i386-pc-mach3
11937a84e134Smrg	exit ;;
11947a84e134Smrg    paragon:*:*:*)
11957a84e134Smrg	echo i860-intel-osf1
11967a84e134Smrg	exit ;;
11977a84e134Smrg    i860:*:4.*:*) # i860-SVR4
11987a84e134Smrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
11995ec34c4cSmrg	  echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4
12007a84e134Smrg	else # Add other i860-SVR4 vendors below as they are discovered.
12015ec34c4cSmrg	  echo i860-unknown-sysv"$UNAME_RELEASE"  # Unknown i860-SVR4
12027a84e134Smrg	fi
12037a84e134Smrg	exit ;;
12047a84e134Smrg    mini*:CTIX:SYS*5:*)
12057a84e134Smrg	# "miniframe"
12067a84e134Smrg	echo m68010-convergent-sysv
12077a84e134Smrg	exit ;;
12087a84e134Smrg    mc68k:UNIX:SYSTEM5:3.51m)
12097a84e134Smrg	echo m68k-convergent-sysv
12107a84e134Smrg	exit ;;
12117a84e134Smrg    M680?0:D-NIX:5.3:*)
12127a84e134Smrg	echo m68k-diab-dnix
12137a84e134Smrg	exit ;;
12147a84e134Smrg    M68*:*:R3V[5678]*:*)
12157a84e134Smrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
12167a84e134Smrg    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)
12177a84e134Smrg	OS_REL=''
12187a84e134Smrg	test -r /etc/.relid \
12197a84e134Smrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
12207a84e134Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
12215ec34c4cSmrg	  && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
12227a84e134Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
12235ec34c4cSmrg	  && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
12247a84e134Smrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1225421c997bSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1226421c997bSmrg	  && { echo i486-ncr-sysv4; exit; } ;;
1227994689c1Smrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1228994689c1Smrg	OS_REL='.3'
1229994689c1Smrg	test -r /etc/.relid \
1230994689c1Smrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1231994689c1Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
12325ec34c4cSmrg	    && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1233994689c1Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
12345ec34c4cSmrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
1235994689c1Smrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
12365ec34c4cSmrg	    && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
12377a84e134Smrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
12385ec34c4cSmrg	echo m68k-unknown-lynxos"$UNAME_RELEASE"
12397a84e134Smrg	exit ;;
12407a84e134Smrg    mc68030:UNIX_System_V:4.*:*)
12417a84e134Smrg	echo m68k-atari-sysv4
12427a84e134Smrg	exit ;;
12437a84e134Smrg    TSUNAMI:LynxOS:2.*:*)
12445ec34c4cSmrg	echo sparc-unknown-lynxos"$UNAME_RELEASE"
12457a84e134Smrg	exit ;;
12467a84e134Smrg    rs6000:LynxOS:2.*:*)
12475ec34c4cSmrg	echo rs6000-unknown-lynxos"$UNAME_RELEASE"
12487a84e134Smrg	exit ;;
1249994689c1Smrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
12505ec34c4cSmrg	echo powerpc-unknown-lynxos"$UNAME_RELEASE"
12517a84e134Smrg	exit ;;
12527a84e134Smrg    SM[BE]S:UNIX_SV:*:*)
12535ec34c4cSmrg	echo mips-dde-sysv"$UNAME_RELEASE"
12547a84e134Smrg	exit ;;
12557a84e134Smrg    RM*:ReliantUNIX-*:*:*)
12567a84e134Smrg	echo mips-sni-sysv4
12577a84e134Smrg	exit ;;
12587a84e134Smrg    RM*:SINIX-*:*:*)
12597a84e134Smrg	echo mips-sni-sysv4
12607a84e134Smrg	exit ;;
12617a84e134Smrg    *:SINIX-*:*:*)
12627a84e134Smrg	if uname -p 2>/dev/null >/dev/null ; then
12637a84e134Smrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
12645ec34c4cSmrg		echo "$UNAME_MACHINE"-sni-sysv4
12657a84e134Smrg	else
12667a84e134Smrg		echo ns32k-sni-sysv
12677a84e134Smrg	fi
12687a84e134Smrg	exit ;;
1269421c997bSmrg    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1270421c997bSmrg			# says <Richard.M.Bartel@ccMail.Census.GOV>
1271421c997bSmrg	echo i586-unisys-sysv4
1272421c997bSmrg	exit ;;
12737a84e134Smrg    *:UNIX_System_V:4*:FTX*)
12747a84e134Smrg	# From Gerald Hewes <hewes@openmarket.com>.
12757a84e134Smrg	# How about differentiating between stratus architectures? -djm
12767a84e134Smrg	echo hppa1.1-stratus-sysv4
12777a84e134Smrg	exit ;;
12787a84e134Smrg    *:*:*:FTX*)
12797a84e134Smrg	# From seanf@swdc.stratus.com.
12807a84e134Smrg	echo i860-stratus-sysv4
12817a84e134Smrg	exit ;;
12827a84e134Smrg    i*86:VOS:*:*)
12837a84e134Smrg	# From Paul.Green@stratus.com.
12845ec34c4cSmrg	echo "$UNAME_MACHINE"-stratus-vos
12857a84e134Smrg	exit ;;
12867a84e134Smrg    *:VOS:*:*)
12877a84e134Smrg	# From Paul.Green@stratus.com.
12887a84e134Smrg	echo hppa1.1-stratus-vos
12897a84e134Smrg	exit ;;
12907a84e134Smrg    mc68*:A/UX:*:*)
12915ec34c4cSmrg	echo m68k-apple-aux"$UNAME_RELEASE"
12927a84e134Smrg	exit ;;
12937a84e134Smrg    news*:NEWS-OS:6*:*)
12947a84e134Smrg	echo mips-sony-newsos6
12957a84e134Smrg	exit ;;
12967a84e134Smrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
12977a84e134Smrg	if [ -d /usr/nec ]; then
12985ec34c4cSmrg		echo mips-nec-sysv"$UNAME_RELEASE"
12997a84e134Smrg	else
13005ec34c4cSmrg		echo mips-unknown-sysv"$UNAME_RELEASE"
13017a84e134Smrg	fi
1302421c997bSmrg	exit ;;
13037a84e134Smrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
13047a84e134Smrg	echo powerpc-be-beos
13057a84e134Smrg	exit ;;
13067a84e134Smrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
13077a84e134Smrg	echo powerpc-apple-beos
13087a84e134Smrg	exit ;;
13097a84e134Smrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
13107a84e134Smrg	echo i586-pc-beos
13117a84e134Smrg	exit ;;
1312994689c1Smrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
1313994689c1Smrg	echo i586-pc-haiku
1314994689c1Smrg	exit ;;
1315c889a3bfSmrg    x86_64:Haiku:*:*)
1316c889a3bfSmrg	echo x86_64-unknown-haiku
1317c889a3bfSmrg	exit ;;
13187a84e134Smrg    SX-4:SUPER-UX:*:*)
13195ec34c4cSmrg	echo sx4-nec-superux"$UNAME_RELEASE"
13207a84e134Smrg	exit ;;
13217a84e134Smrg    SX-5:SUPER-UX:*:*)
13225ec34c4cSmrg	echo sx5-nec-superux"$UNAME_RELEASE"
13237a84e134Smrg	exit ;;
13247a84e134Smrg    SX-6:SUPER-UX:*:*)
13255ec34c4cSmrg	echo sx6-nec-superux"$UNAME_RELEASE"
13267a84e134Smrg	exit ;;
1327ab902922Smrg    SX-7:SUPER-UX:*:*)
13285ec34c4cSmrg	echo sx7-nec-superux"$UNAME_RELEASE"
1329ab902922Smrg	exit ;;
1330ab902922Smrg    SX-8:SUPER-UX:*:*)
13315ec34c4cSmrg	echo sx8-nec-superux"$UNAME_RELEASE"
1332ab902922Smrg	exit ;;
1333ab902922Smrg    SX-8R:SUPER-UX:*:*)
13345ec34c4cSmrg	echo sx8r-nec-superux"$UNAME_RELEASE"
13355ec34c4cSmrg	exit ;;
13365ec34c4cSmrg    SX-ACE:SUPER-UX:*:*)
13375ec34c4cSmrg	echo sxace-nec-superux"$UNAME_RELEASE"
1338ab902922Smrg	exit ;;
13397a84e134Smrg    Power*:Rhapsody:*:*)
13405ec34c4cSmrg	echo powerpc-apple-rhapsody"$UNAME_RELEASE"
13417a84e134Smrg	exit ;;
13427a84e134Smrg    *:Rhapsody:*:*)
13435ec34c4cSmrg	echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE"
13447a84e134Smrg	exit ;;
13457a84e134Smrg    *:Darwin:*:*)
13465ec34c4cSmrg	UNAME_PROCESSOR=`uname -p`
13475ec34c4cSmrg	case $UNAME_PROCESSOR in
13485ec34c4cSmrg	    unknown) UNAME_PROCESSOR=powerpc ;;
13495ec34c4cSmrg	esac
13505ec34c4cSmrg	if command -v xcode-select > /dev/null 2> /dev/null && \
13515ec34c4cSmrg		! xcode-select --print-path > /dev/null 2> /dev/null ; then
13525ec34c4cSmrg	    # Avoid executing cc if there is no toolchain installed as
13535ec34c4cSmrg	    # cc will be a stub that puts up a graphical alert
13545ec34c4cSmrg	    # prompting the user to install developer tools.
13555ec34c4cSmrg	    CC_FOR_BUILD=no_compiler_found
13565ec34c4cSmrg	else
13575ec34c4cSmrg	    set_cc_for_build
1358c889a3bfSmrg	fi
13595ec34c4cSmrg	if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
13605ec34c4cSmrg	    if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
13615ec34c4cSmrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
13625ec34c4cSmrg		   grep IS_64BIT_ARCH >/dev/null
13635ec34c4cSmrg	    then
13645ec34c4cSmrg		case $UNAME_PROCESSOR in
13655ec34c4cSmrg		    i386) UNAME_PROCESSOR=x86_64 ;;
13665ec34c4cSmrg		    powerpc) UNAME_PROCESSOR=powerpc64 ;;
13675ec34c4cSmrg		esac
13685ec34c4cSmrg	    fi
13695ec34c4cSmrg	    # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
13705ec34c4cSmrg	    if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
13715ec34c4cSmrg		   (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
13725ec34c4cSmrg		   grep IS_PPC >/dev/null
13735ec34c4cSmrg	    then
13745ec34c4cSmrg		UNAME_PROCESSOR=powerpc
1375c889a3bfSmrg	    fi
1376c8571806Smrg	elif test "$UNAME_PROCESSOR" = i386 ; then
13775ec34c4cSmrg	    # uname -m returns i386 or x86_64
13785ec34c4cSmrg	    UNAME_PROCESSOR=$UNAME_MACHINE
1379c889a3bfSmrg	fi
13805ec34c4cSmrg	echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE"
13817a84e134Smrg	exit ;;
13827a84e134Smrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
13837a84e134Smrg	UNAME_PROCESSOR=`uname -p`
13845ec34c4cSmrg	if test "$UNAME_PROCESSOR" = x86; then
13857a84e134Smrg		UNAME_PROCESSOR=i386
13867a84e134Smrg		UNAME_MACHINE=pc
13877a84e134Smrg	fi
13885ec34c4cSmrg	echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE"
13897a84e134Smrg	exit ;;
13907a84e134Smrg    *:QNX:*:4*)
13917a84e134Smrg	echo i386-pc-qnx
13927a84e134Smrg	exit ;;
13935ec34c4cSmrg    NEO-*:NONSTOP_KERNEL:*:*)
13945ec34c4cSmrg	echo neo-tandem-nsk"$UNAME_RELEASE"
1395421c997bSmrg	exit ;;
1396c889a3bfSmrg    NSE-*:NONSTOP_KERNEL:*:*)
13975ec34c4cSmrg	echo nse-tandem-nsk"$UNAME_RELEASE"
13985ec34c4cSmrg	exit ;;
13995ec34c4cSmrg    NSR-*:NONSTOP_KERNEL:*:*)
14005ec34c4cSmrg	echo nsr-tandem-nsk"$UNAME_RELEASE"
14015ec34c4cSmrg	exit ;;
14025ec34c4cSmrg    NSV-*:NONSTOP_KERNEL:*:*)
14035ec34c4cSmrg	echo nsv-tandem-nsk"$UNAME_RELEASE"
14047a84e134Smrg	exit ;;
14055ec34c4cSmrg    NSX-*:NONSTOP_KERNEL:*:*)
14065ec34c4cSmrg	echo nsx-tandem-nsk"$UNAME_RELEASE"
14077a84e134Smrg	exit ;;
14087a84e134Smrg    *:NonStop-UX:*:*)
14097a84e134Smrg	echo mips-compaq-nonstopux
14107a84e134Smrg	exit ;;
14117a84e134Smrg    BS2000:POSIX*:*:*)
14127a84e134Smrg	echo bs2000-siemens-sysv
14137a84e134Smrg	exit ;;
14147a84e134Smrg    DS/*:UNIX_System_V:*:*)
14155ec34c4cSmrg	echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE"
14167a84e134Smrg	exit ;;
14177a84e134Smrg    *:Plan9:*:*)
14187a84e134Smrg	# "uname -m" is not consistent, so use $cputype instead. 386
14197a84e134Smrg	# is converted to i386 for consistency with other x86
14207a84e134Smrg	# operating systems.
14215ec34c4cSmrg	# shellcheck disable=SC2154
14225ec34c4cSmrg	if test "$cputype" = 386; then
14237a84e134Smrg	    UNAME_MACHINE=i386
14247a84e134Smrg	else
14257a84e134Smrg	    UNAME_MACHINE="$cputype"
14267a84e134Smrg	fi
14275ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-plan9
14287a84e134Smrg	exit ;;
14297a84e134Smrg    *:TOPS-10:*:*)
14307a84e134Smrg	echo pdp10-unknown-tops10
14317a84e134Smrg	exit ;;
14327a84e134Smrg    *:TENEX:*:*)
14337a84e134Smrg	echo pdp10-unknown-tenex
14347a84e134Smrg	exit ;;
14357a84e134Smrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
14367a84e134Smrg	echo pdp10-dec-tops20
14377a84e134Smrg	exit ;;
14387a84e134Smrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
14397a84e134Smrg	echo pdp10-xkl-tops20
14407a84e134Smrg	exit ;;
14417a84e134Smrg    *:TOPS-20:*:*)
14427a84e134Smrg	echo pdp10-unknown-tops20
14437a84e134Smrg	exit ;;
14447a84e134Smrg    *:ITS:*:*)
14457a84e134Smrg	echo pdp10-unknown-its
14467a84e134Smrg	exit ;;
14477a84e134Smrg    SEI:*:*:SEIUX)
14485ec34c4cSmrg	echo mips-sei-seiux"$UNAME_RELEASE"
14497a84e134Smrg	exit ;;
14507a84e134Smrg    *:DragonFly:*:*)
14515ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
14527a84e134Smrg	exit ;;
14537a84e134Smrg    *:*VMS:*:*)
1454421c997bSmrg	UNAME_MACHINE=`(uname -p) 2>/dev/null`
14555ec34c4cSmrg	case "$UNAME_MACHINE" in
14567a84e134Smrg	    A*) echo alpha-dec-vms ; exit ;;
14577a84e134Smrg	    I*) echo ia64-dec-vms ; exit ;;
14587a84e134Smrg	    V*) echo vax-dec-vms ; exit ;;
14597a84e134Smrg	esac ;;
14607a84e134Smrg    *:XENIX:*:SysV)
14617a84e134Smrg	echo i386-pc-xenix
14627a84e134Smrg	exit ;;
14637a84e134Smrg    i*86:skyos:*:*)
14645ec34c4cSmrg	echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`"
14657a84e134Smrg	exit ;;
14667a84e134Smrg    i*86:rdos:*:*)
14675ec34c4cSmrg	echo "$UNAME_MACHINE"-pc-rdos
14687a84e134Smrg	exit ;;
1469994689c1Smrg    i*86:AROS:*:*)
14705ec34c4cSmrg	echo "$UNAME_MACHINE"-pc-aros
1471994689c1Smrg	exit ;;
1472c889a3bfSmrg    x86_64:VMkernel:*:*)
14735ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-esx
14745ec34c4cSmrg	exit ;;
14755ec34c4cSmrg    amd64:Isilon\ OneFS:*:*)
14765ec34c4cSmrg	echo x86_64-unknown-onefs
14775ec34c4cSmrg	exit ;;
14785ec34c4cSmrg    *:Unleashed:*:*)
14795ec34c4cSmrg	echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE"
1480c889a3bfSmrg	exit ;;
14817a84e134Smrgesac
14827a84e134Smrg
14835ec34c4cSmrg# No uname command or uname output not recognized.
14845ec34c4cSmrgset_cc_for_build
14855ec34c4cSmrgcat > "$dummy.c" <<EOF
14865ec34c4cSmrg#ifdef _SEQUENT_
14875ec34c4cSmrg#include <sys/types.h>
14885ec34c4cSmrg#include <sys/utsname.h>
14895ec34c4cSmrg#endif
14905ec34c4cSmrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
14915ec34c4cSmrg#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
14925ec34c4cSmrg#include <signal.h>
14935ec34c4cSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
14945ec34c4cSmrg#include <sys/utsname.h>
14955ec34c4cSmrg#endif
14965ec34c4cSmrg#endif
14975ec34c4cSmrg#endif
14985ec34c4cSmrgmain ()
14995ec34c4cSmrg{
15005ec34c4cSmrg#if defined (sony)
15015ec34c4cSmrg#if defined (MIPSEB)
15025ec34c4cSmrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
15035ec34c4cSmrg     I don't know....  */
15045ec34c4cSmrg  printf ("mips-sony-bsd\n"); exit (0);
15055ec34c4cSmrg#else
15065ec34c4cSmrg#include <sys/param.h>
15075ec34c4cSmrg  printf ("m68k-sony-newsos%s\n",
15085ec34c4cSmrg#ifdef NEWSOS4
15095ec34c4cSmrg  "4"
15105ec34c4cSmrg#else
15115ec34c4cSmrg  ""
15125ec34c4cSmrg#endif
15135ec34c4cSmrg  ); exit (0);
15145ec34c4cSmrg#endif
15155ec34c4cSmrg#endif
15165ec34c4cSmrg
15175ec34c4cSmrg#if defined (NeXT)
15185ec34c4cSmrg#if !defined (__ARCHITECTURE__)
15195ec34c4cSmrg#define __ARCHITECTURE__ "m68k"
15205ec34c4cSmrg#endif
15215ec34c4cSmrg  int version;
15225ec34c4cSmrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
15235ec34c4cSmrg  if (version < 4)
15245ec34c4cSmrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
15255ec34c4cSmrg  else
15265ec34c4cSmrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
15275ec34c4cSmrg  exit (0);
15285ec34c4cSmrg#endif
15295ec34c4cSmrg
15305ec34c4cSmrg#if defined (MULTIMAX) || defined (n16)
15315ec34c4cSmrg#if defined (UMAXV)
15325ec34c4cSmrg  printf ("ns32k-encore-sysv\n"); exit (0);
15335ec34c4cSmrg#else
15345ec34c4cSmrg#if defined (CMU)
15355ec34c4cSmrg  printf ("ns32k-encore-mach\n"); exit (0);
15365ec34c4cSmrg#else
15375ec34c4cSmrg  printf ("ns32k-encore-bsd\n"); exit (0);
15385ec34c4cSmrg#endif
15395ec34c4cSmrg#endif
15405ec34c4cSmrg#endif
15415ec34c4cSmrg
15425ec34c4cSmrg#if defined (__386BSD__)
15435ec34c4cSmrg  printf ("i386-pc-bsd\n"); exit (0);
15445ec34c4cSmrg#endif
15455ec34c4cSmrg
15465ec34c4cSmrg#if defined (sequent)
15475ec34c4cSmrg#if defined (i386)
15485ec34c4cSmrg  printf ("i386-sequent-dynix\n"); exit (0);
15495ec34c4cSmrg#endif
15505ec34c4cSmrg#if defined (ns32000)
15515ec34c4cSmrg  printf ("ns32k-sequent-dynix\n"); exit (0);
15525ec34c4cSmrg#endif
15535ec34c4cSmrg#endif
15545ec34c4cSmrg
15555ec34c4cSmrg#if defined (_SEQUENT_)
15565ec34c4cSmrg  struct utsname un;
15575ec34c4cSmrg
15585ec34c4cSmrg  uname(&un);
15595ec34c4cSmrg  if (strncmp(un.version, "V2", 2) == 0) {
15605ec34c4cSmrg    printf ("i386-sequent-ptx2\n"); exit (0);
15615ec34c4cSmrg  }
15625ec34c4cSmrg  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
15635ec34c4cSmrg    printf ("i386-sequent-ptx1\n"); exit (0);
15645ec34c4cSmrg  }
15655ec34c4cSmrg  printf ("i386-sequent-ptx\n"); exit (0);
15665ec34c4cSmrg#endif
15675ec34c4cSmrg
15685ec34c4cSmrg#if defined (vax)
15695ec34c4cSmrg#if !defined (ultrix)
15705ec34c4cSmrg#include <sys/param.h>
15715ec34c4cSmrg#if defined (BSD)
15725ec34c4cSmrg#if BSD == 43
15735ec34c4cSmrg  printf ("vax-dec-bsd4.3\n"); exit (0);
15745ec34c4cSmrg#else
15755ec34c4cSmrg#if BSD == 199006
15765ec34c4cSmrg  printf ("vax-dec-bsd4.3reno\n"); exit (0);
15775ec34c4cSmrg#else
15785ec34c4cSmrg  printf ("vax-dec-bsd\n"); exit (0);
15795ec34c4cSmrg#endif
15805ec34c4cSmrg#endif
15815ec34c4cSmrg#else
15825ec34c4cSmrg  printf ("vax-dec-bsd\n"); exit (0);
15835ec34c4cSmrg#endif
15845ec34c4cSmrg#else
15855ec34c4cSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
15865ec34c4cSmrg  struct utsname un;
15875ec34c4cSmrg  uname (&un);
15885ec34c4cSmrg  printf ("vax-dec-ultrix%s\n", un.release); exit (0);
15895ec34c4cSmrg#else
15905ec34c4cSmrg  printf ("vax-dec-ultrix\n"); exit (0);
15915ec34c4cSmrg#endif
15925ec34c4cSmrg#endif
15935ec34c4cSmrg#endif
15945ec34c4cSmrg#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
15955ec34c4cSmrg#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
15965ec34c4cSmrg#if defined(_SIZE_T_) || defined(SIGLOST)
15975ec34c4cSmrg  struct utsname *un;
15985ec34c4cSmrg  uname (&un);
15995ec34c4cSmrg  printf ("mips-dec-ultrix%s\n", un.release); exit (0);
16005ec34c4cSmrg#else
16015ec34c4cSmrg  printf ("mips-dec-ultrix\n"); exit (0);
16025ec34c4cSmrg#endif
16035ec34c4cSmrg#endif
16045ec34c4cSmrg#endif
16055ec34c4cSmrg
16065ec34c4cSmrg#if defined (alliant) && defined (i860)
16075ec34c4cSmrg  printf ("i860-alliant-bsd\n"); exit (0);
16085ec34c4cSmrg#endif
16095ec34c4cSmrg
16105ec34c4cSmrg  exit (1);
16115ec34c4cSmrg}
16125ec34c4cSmrgEOF
16135ec34c4cSmrg
16145ec34c4cSmrg$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`$dummy` &&
16155ec34c4cSmrg	{ echo "$SYSTEM_NAME"; exit; }
16165ec34c4cSmrg
16175ec34c4cSmrg# Apollos put the system type in the environment.
16185ec34c4cSmrgtest -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
16195ec34c4cSmrg
16205ec34c4cSmrgecho "$0: unable to guess system type" >&2
16215ec34c4cSmrg
16225ec34c4cSmrgcase "$UNAME_MACHINE:$UNAME_SYSTEM" in
16235ec34c4cSmrg    mips:Linux | mips64:Linux)
16245ec34c4cSmrg	# If we got here on MIPS GNU/Linux, output extra information.
16255ec34c4cSmrg	cat >&2 <<EOF
16265ec34c4cSmrg
16275ec34c4cSmrgNOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
16285ec34c4cSmrgthe system type. Please install a C compiler and try again.
16295ec34c4cSmrgEOF
16305ec34c4cSmrg	;;
16315ec34c4cSmrgesac
16325ec34c4cSmrg
16337a84e134Smrgcat >&2 <<EOF
16347a84e134Smrg
16355ec34c4cSmrgThis script (version $timestamp), has failed to recognize the
16365ec34c4cSmrgoperating system you are using. If your script is old, overwrite *all*
16375ec34c4cSmrgcopies of config.guess and config.sub with the latest versions from:
16387a84e134Smrg
16395ec34c4cSmrg  https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
16407a84e134Smrgand
16415ec34c4cSmrg  https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
16425ec34c4cSmrgEOF
16435ec34c4cSmrg
16445ec34c4cSmrgyear=`echo $timestamp | sed 's,-.*,,'`
16455ec34c4cSmrg# shellcheck disable=SC2003
16465ec34c4cSmrgif test "`expr "\`date +%Y\`" - "$year"`" -lt 3 ; then
16475ec34c4cSmrg   cat >&2 <<EOF
16487a84e134Smrg
16495ec34c4cSmrgIf $0 has already been updated, send the following data and any
16505ec34c4cSmrginformation you think might be pertinent to config-patches@gnu.org to
16515ec34c4cSmrgprovide the necessary information to handle your system.
16527a84e134Smrg
16537a84e134Smrgconfig.guess timestamp = $timestamp
16547a84e134Smrg
16557a84e134Smrguname -m = `(uname -m) 2>/dev/null || echo unknown`
16567a84e134Smrguname -r = `(uname -r) 2>/dev/null || echo unknown`
16577a84e134Smrguname -s = `(uname -s) 2>/dev/null || echo unknown`
16587a84e134Smrguname -v = `(uname -v) 2>/dev/null || echo unknown`
16597a84e134Smrg
16607a84e134Smrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
16617a84e134Smrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
16627a84e134Smrg
16637a84e134Smrghostinfo               = `(hostinfo) 2>/dev/null`
16647a84e134Smrg/bin/universe          = `(/bin/universe) 2>/dev/null`
16657a84e134Smrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
16667a84e134Smrg/bin/arch              = `(/bin/arch) 2>/dev/null`
16677a84e134Smrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
16687a84e134Smrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
16697a84e134Smrg
16705ec34c4cSmrgUNAME_MACHINE = "$UNAME_MACHINE"
16715ec34c4cSmrgUNAME_RELEASE = "$UNAME_RELEASE"
16725ec34c4cSmrgUNAME_SYSTEM  = "$UNAME_SYSTEM"
16735ec34c4cSmrgUNAME_VERSION = "$UNAME_VERSION"
16747a84e134SmrgEOF
16755ec34c4cSmrgfi
16767a84e134Smrg
16777a84e134Smrgexit 1
16787a84e134Smrg
16797a84e134Smrg# Local variables:
16805ec34c4cSmrg# eval: (add-hook 'before-save-hook 'time-stamp)
16817a84e134Smrg# time-stamp-start: "timestamp='"
16827a84e134Smrg# time-stamp-format: "%:y-%02m-%02d"
16837a84e134Smrg# time-stamp-end: "'"
16847a84e134Smrg# End:
1685