config.guess revision 9418810d
19bd41f2cSmrg#! /bin/sh
29bd41f2cSmrg# Attempt to guess a canonical system name.
39bd41f2cSmrg#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
49418810dSmrg#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
59418810dSmrg#   Free Software Foundation, Inc.
69bd41f2cSmrg
79418810dSmrgtimestamp='2009-04-27'
89bd41f2cSmrg
99bd41f2cSmrg# This file is free software; you can redistribute it and/or modify it
109bd41f2cSmrg# under the terms of the GNU General Public License as published by
119bd41f2cSmrg# the Free Software Foundation; either version 2 of the License, or
129bd41f2cSmrg# (at your option) any later version.
139bd41f2cSmrg#
149bd41f2cSmrg# This program is distributed in the hope that it will be useful, but
159bd41f2cSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
169bd41f2cSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
179bd41f2cSmrg# General Public License for more details.
189bd41f2cSmrg#
199bd41f2cSmrg# You should have received a copy of the GNU General Public License
209bd41f2cSmrg# along with this program; if not, write to the Free Software
219bd41f2cSmrg# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
229bd41f2cSmrg# 02110-1301, USA.
239bd41f2cSmrg#
249bd41f2cSmrg# As a special exception to the GNU General Public License, if you
259bd41f2cSmrg# distribute this file as part of a program that contains a
269bd41f2cSmrg# configuration script generated by Autoconf, you may include it under
279bd41f2cSmrg# the same distribution terms that you use for the rest of that program.
289bd41f2cSmrg
299bd41f2cSmrg
309bd41f2cSmrg# Originally written by Per Bothner <per@bothner.com>.
319bd41f2cSmrg# Please send patches to <config-patches@gnu.org>.  Submit a context
329bd41f2cSmrg# diff and a properly formatted ChangeLog entry.
339bd41f2cSmrg#
349bd41f2cSmrg# This script attempts to guess a canonical system name similar to
359bd41f2cSmrg# config.sub.  If it succeeds, it prints the system name on stdout, and
369bd41f2cSmrg# exits with 0.  Otherwise, it exits with 1.
379bd41f2cSmrg#
389bd41f2cSmrg# The plan is that this can be called by configure scripts if you
399bd41f2cSmrg# don't specify an explicit build system type.
409bd41f2cSmrg
419bd41f2cSmrgme=`echo "$0" | sed -e 's,.*/,,'`
429bd41f2cSmrg
439bd41f2cSmrgusage="\
449bd41f2cSmrgUsage: $0 [OPTION]
459bd41f2cSmrg
469bd41f2cSmrgOutput the configuration name of the system \`$me' is run on.
479bd41f2cSmrg
489bd41f2cSmrgOperation modes:
499bd41f2cSmrg  -h, --help         print this help, then exit
509bd41f2cSmrg  -t, --time-stamp   print date of last modification, then exit
519bd41f2cSmrg  -v, --version      print version number, then exit
529bd41f2cSmrg
539bd41f2cSmrgReport bugs and patches to <config-patches@gnu.org>."
549bd41f2cSmrg
559bd41f2cSmrgversion="\
569bd41f2cSmrgGNU config.guess ($timestamp)
579bd41f2cSmrg
589bd41f2cSmrgOriginally written by Per Bothner.
599418810dSmrgCopyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
609418810dSmrg2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
619bd41f2cSmrg
629bd41f2cSmrgThis is free software; see the source for copying conditions.  There is NO
639bd41f2cSmrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
649bd41f2cSmrg
659bd41f2cSmrghelp="
669bd41f2cSmrgTry \`$me --help' for more information."
679bd41f2cSmrg
689bd41f2cSmrg# Parse command line
699bd41f2cSmrgwhile test $# -gt 0 ; do
709bd41f2cSmrg  case $1 in
719bd41f2cSmrg    --time-stamp | --time* | -t )
729bd41f2cSmrg       echo "$timestamp" ; exit ;;
739bd41f2cSmrg    --version | -v )
749bd41f2cSmrg       echo "$version" ; exit ;;
759bd41f2cSmrg    --help | --h* | -h )
769bd41f2cSmrg       echo "$usage"; exit ;;
779bd41f2cSmrg    -- )     # Stop option processing
789bd41f2cSmrg       shift; break ;;
799bd41f2cSmrg    - )	# Use stdin as input.
809bd41f2cSmrg       break ;;
819bd41f2cSmrg    -* )
829bd41f2cSmrg       echo "$me: invalid option $1$help" >&2
839bd41f2cSmrg       exit 1 ;;
849bd41f2cSmrg    * )
859bd41f2cSmrg       break ;;
869bd41f2cSmrg  esac
879bd41f2cSmrgdone
889bd41f2cSmrg
899bd41f2cSmrgif test $# != 0; then
909bd41f2cSmrg  echo "$me: too many arguments$help" >&2
919bd41f2cSmrg  exit 1
929bd41f2cSmrgfi
939bd41f2cSmrg
949bd41f2cSmrgtrap 'exit 1' 1 2 15
959bd41f2cSmrg
969bd41f2cSmrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
979bd41f2cSmrg# compiler to aid in system detection is discouraged as it requires
989bd41f2cSmrg# temporary files to be created and, as you can see below, it is a
999bd41f2cSmrg# headache to deal with in a portable fashion.
1009bd41f2cSmrg
1019bd41f2cSmrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
1029bd41f2cSmrg# use `HOST_CC' if defined, but it is deprecated.
1039bd41f2cSmrg
1049bd41f2cSmrg# Portable tmp directory creation inspired by the Autoconf team.
1059bd41f2cSmrg
1069bd41f2cSmrgset_cc_for_build='
1079bd41f2cSmrgtrap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
1089bd41f2cSmrgtrap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
1099bd41f2cSmrg: ${TMPDIR=/tmp} ;
1109418810dSmrg { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
1119bd41f2cSmrg { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
1129bd41f2cSmrg { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
1139bd41f2cSmrg { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
1149bd41f2cSmrgdummy=$tmp/dummy ;
1159bd41f2cSmrgtmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
1169bd41f2cSmrgcase $CC_FOR_BUILD,$HOST_CC,$CC in
1179bd41f2cSmrg ,,)    echo "int x;" > $dummy.c ;
1189bd41f2cSmrg	for c in cc gcc c89 c99 ; do
1199bd41f2cSmrg	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
1209bd41f2cSmrg	     CC_FOR_BUILD="$c"; break ;
1219bd41f2cSmrg	  fi ;
1229bd41f2cSmrg	done ;
1239bd41f2cSmrg	if test x"$CC_FOR_BUILD" = x ; then
1249bd41f2cSmrg	  CC_FOR_BUILD=no_compiler_found ;
1259bd41f2cSmrg	fi
1269bd41f2cSmrg	;;
1279bd41f2cSmrg ,,*)   CC_FOR_BUILD=$CC ;;
1289bd41f2cSmrg ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
1299bd41f2cSmrgesac ; set_cc_for_build= ;'
1309bd41f2cSmrg
1319bd41f2cSmrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
1329bd41f2cSmrg# (ghazi@noc.rutgers.edu 1994-08-24)
1339bd41f2cSmrgif (test -f /.attbin/uname) >/dev/null 2>&1 ; then
1349bd41f2cSmrg	PATH=$PATH:/.attbin ; export PATH
1359bd41f2cSmrgfi
1369bd41f2cSmrg
1379bd41f2cSmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
1389bd41f2cSmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
1399bd41f2cSmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
1409bd41f2cSmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
1419bd41f2cSmrg
1429bd41f2cSmrg# Note: order is significant - the case branches are not exclusive.
1439bd41f2cSmrg
1449bd41f2cSmrgcase "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
1459bd41f2cSmrg    *:NetBSD:*:*)
1469bd41f2cSmrg	# NetBSD (nbsd) targets should (where applicable) match one or
1479bd41f2cSmrg	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
1489bd41f2cSmrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
1499bd41f2cSmrg	# switched to ELF, *-*-netbsd* would select the old
1509bd41f2cSmrg	# object file format.  This provides both forward
1519bd41f2cSmrg	# compatibility and a consistent mechanism for selecting the
1529bd41f2cSmrg	# object file format.
1539bd41f2cSmrg	#
1549bd41f2cSmrg	# Note: NetBSD doesn't particularly care about the vendor
1559bd41f2cSmrg	# portion of the name.  We always set it to "unknown".
1569bd41f2cSmrg	sysctl="sysctl -n hw.machine_arch"
1579bd41f2cSmrg	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
1589bd41f2cSmrg	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
1599bd41f2cSmrg	case "${UNAME_MACHINE_ARCH}" in
1609bd41f2cSmrg	    armeb) machine=armeb-unknown ;;
1619bd41f2cSmrg	    arm*) machine=arm-unknown ;;
1629bd41f2cSmrg	    sh3el) machine=shl-unknown ;;
1639bd41f2cSmrg	    sh3eb) machine=sh-unknown ;;
1649418810dSmrg	    sh5el) machine=sh5le-unknown ;;
1659bd41f2cSmrg	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
1669bd41f2cSmrg	esac
1679bd41f2cSmrg	# The Operating System including object format, if it has switched
1689bd41f2cSmrg	# to ELF recently, or will in the future.
1699bd41f2cSmrg	case "${UNAME_MACHINE_ARCH}" in
1709bd41f2cSmrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
1719bd41f2cSmrg		eval $set_cc_for_build
1729bd41f2cSmrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
1739bd41f2cSmrg			| grep __ELF__ >/dev/null
1749bd41f2cSmrg		then
1759bd41f2cSmrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
1769bd41f2cSmrg		    # Return netbsd for either.  FIX?
1779bd41f2cSmrg		    os=netbsd
1789bd41f2cSmrg		else
1799bd41f2cSmrg		    os=netbsdelf
1809bd41f2cSmrg		fi
1819bd41f2cSmrg		;;
1829bd41f2cSmrg	    *)
1839bd41f2cSmrg	        os=netbsd
1849bd41f2cSmrg		;;
1859bd41f2cSmrg	esac
1869bd41f2cSmrg	# The OS release
1879bd41f2cSmrg	# Debian GNU/NetBSD machines have a different userland, and
1889bd41f2cSmrg	# thus, need a distinct triplet. However, they do not need
1899bd41f2cSmrg	# kernel version information, so it can be replaced with a
1909bd41f2cSmrg	# suitable tag, in the style of linux-gnu.
1919bd41f2cSmrg	case "${UNAME_VERSION}" in
1929bd41f2cSmrg	    Debian*)
1939bd41f2cSmrg		release='-gnu'
1949bd41f2cSmrg		;;
1959bd41f2cSmrg	    *)
1969bd41f2cSmrg		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
1979bd41f2cSmrg		;;
1989bd41f2cSmrg	esac
1999bd41f2cSmrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
2009bd41f2cSmrg	# contains redundant information, the shorter form:
2019bd41f2cSmrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
2029bd41f2cSmrg	echo "${machine}-${os}${release}"
2039bd41f2cSmrg	exit ;;
2049bd41f2cSmrg    *:OpenBSD:*:*)
2059bd41f2cSmrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
2069bd41f2cSmrg	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
2079bd41f2cSmrg	exit ;;
2089bd41f2cSmrg    *:ekkoBSD:*:*)
2099bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
2109bd41f2cSmrg	exit ;;
2119418810dSmrg    *:SolidBSD:*:*)
2129418810dSmrg	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
2139418810dSmrg	exit ;;
2149bd41f2cSmrg    macppc:MirBSD:*:*)
2159418810dSmrg	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
2169bd41f2cSmrg	exit ;;
2179bd41f2cSmrg    *:MirBSD:*:*)
2189bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
2199bd41f2cSmrg	exit ;;
2209bd41f2cSmrg    alpha:OSF1:*:*)
2219bd41f2cSmrg	case $UNAME_RELEASE in
2229bd41f2cSmrg	*4.0)
2239bd41f2cSmrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
2249bd41f2cSmrg		;;
2259bd41f2cSmrg	*5.*)
2269bd41f2cSmrg	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
2279bd41f2cSmrg		;;
2289bd41f2cSmrg	esac
2299bd41f2cSmrg	# According to Compaq, /usr/sbin/psrinfo has been available on
2309bd41f2cSmrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
2319bd41f2cSmrg	# covers most systems running today.  This code pipes the CPU
2329bd41f2cSmrg	# types through head -n 1, so we only detect the type of CPU 0.
2339bd41f2cSmrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
2349bd41f2cSmrg	case "$ALPHA_CPU_TYPE" in
2359bd41f2cSmrg	    "EV4 (21064)")
2369bd41f2cSmrg		UNAME_MACHINE="alpha" ;;
2379bd41f2cSmrg	    "EV4.5 (21064)")
2389bd41f2cSmrg		UNAME_MACHINE="alpha" ;;
2399bd41f2cSmrg	    "LCA4 (21066/21068)")
2409bd41f2cSmrg		UNAME_MACHINE="alpha" ;;
2419bd41f2cSmrg	    "EV5 (21164)")
2429bd41f2cSmrg		UNAME_MACHINE="alphaev5" ;;
2439bd41f2cSmrg	    "EV5.6 (21164A)")
2449bd41f2cSmrg		UNAME_MACHINE="alphaev56" ;;
2459bd41f2cSmrg	    "EV5.6 (21164PC)")
2469bd41f2cSmrg		UNAME_MACHINE="alphapca56" ;;
2479bd41f2cSmrg	    "EV5.7 (21164PC)")
2489bd41f2cSmrg		UNAME_MACHINE="alphapca57" ;;
2499bd41f2cSmrg	    "EV6 (21264)")
2509bd41f2cSmrg		UNAME_MACHINE="alphaev6" ;;
2519bd41f2cSmrg	    "EV6.7 (21264A)")
2529bd41f2cSmrg		UNAME_MACHINE="alphaev67" ;;
2539bd41f2cSmrg	    "EV6.8CB (21264C)")
2549bd41f2cSmrg		UNAME_MACHINE="alphaev68" ;;
2559bd41f2cSmrg	    "EV6.8AL (21264B)")
2569bd41f2cSmrg		UNAME_MACHINE="alphaev68" ;;
2579bd41f2cSmrg	    "EV6.8CX (21264D)")
2589bd41f2cSmrg		UNAME_MACHINE="alphaev68" ;;
2599bd41f2cSmrg	    "EV6.9A (21264/EV69A)")
2609bd41f2cSmrg		UNAME_MACHINE="alphaev69" ;;
2619bd41f2cSmrg	    "EV7 (21364)")
2629bd41f2cSmrg		UNAME_MACHINE="alphaev7" ;;
2639bd41f2cSmrg	    "EV7.9 (21364A)")
2649bd41f2cSmrg		UNAME_MACHINE="alphaev79" ;;
2659bd41f2cSmrg	esac
2669bd41f2cSmrg	# A Pn.n version is a patched version.
2679bd41f2cSmrg	# A Vn.n version is a released version.
2689bd41f2cSmrg	# A Tn.n version is a released field test version.
2699bd41f2cSmrg	# A Xn.n version is an unreleased experimental baselevel.
2709bd41f2cSmrg	# 1.2 uses "1.2" for uname -r.
2719bd41f2cSmrg	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
2729bd41f2cSmrg	exit ;;
2739bd41f2cSmrg    Alpha\ *:Windows_NT*:*)
2749bd41f2cSmrg	# How do we know it's Interix rather than the generic POSIX subsystem?
2759bd41f2cSmrg	# Should we change UNAME_MACHINE based on the output of uname instead
2769bd41f2cSmrg	# of the specific Alpha model?
2779bd41f2cSmrg	echo alpha-pc-interix
2789bd41f2cSmrg	exit ;;
2799bd41f2cSmrg    21064:Windows_NT:50:3)
2809bd41f2cSmrg	echo alpha-dec-winnt3.5
2819bd41f2cSmrg	exit ;;
2829bd41f2cSmrg    Amiga*:UNIX_System_V:4.0:*)
2839bd41f2cSmrg	echo m68k-unknown-sysv4
2849bd41f2cSmrg	exit ;;
2859bd41f2cSmrg    *:[Aa]miga[Oo][Ss]:*:*)
2869bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-amigaos
2879bd41f2cSmrg	exit ;;
2889bd41f2cSmrg    *:[Mm]orph[Oo][Ss]:*:*)
2899bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-morphos
2909bd41f2cSmrg	exit ;;
2919bd41f2cSmrg    *:OS/390:*:*)
2929bd41f2cSmrg	echo i370-ibm-openedition
2939bd41f2cSmrg	exit ;;
2949bd41f2cSmrg    *:z/VM:*:*)
2959bd41f2cSmrg	echo s390-ibm-zvmoe
2969bd41f2cSmrg	exit ;;
2979bd41f2cSmrg    *:OS400:*:*)
2989bd41f2cSmrg        echo powerpc-ibm-os400
2999bd41f2cSmrg	exit ;;
3009bd41f2cSmrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
3019bd41f2cSmrg	echo arm-acorn-riscix${UNAME_RELEASE}
3029bd41f2cSmrg	exit ;;
3039bd41f2cSmrg    arm:riscos:*:*|arm:RISCOS:*:*)
3049bd41f2cSmrg	echo arm-unknown-riscos
3059bd41f2cSmrg	exit ;;
3069bd41f2cSmrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
3079bd41f2cSmrg	echo hppa1.1-hitachi-hiuxmpp
3089bd41f2cSmrg	exit ;;
3099bd41f2cSmrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
3109bd41f2cSmrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
3119bd41f2cSmrg	if test "`(/bin/universe) 2>/dev/null`" = att ; then
3129bd41f2cSmrg		echo pyramid-pyramid-sysv3
3139bd41f2cSmrg	else
3149bd41f2cSmrg		echo pyramid-pyramid-bsd
3159bd41f2cSmrg	fi
3169bd41f2cSmrg	exit ;;
3179bd41f2cSmrg    NILE*:*:*:dcosx)
3189bd41f2cSmrg	echo pyramid-pyramid-svr4
3199bd41f2cSmrg	exit ;;
3209bd41f2cSmrg    DRS?6000:unix:4.0:6*)
3219bd41f2cSmrg	echo sparc-icl-nx6
3229bd41f2cSmrg	exit ;;
3239bd41f2cSmrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
3249bd41f2cSmrg	case `/usr/bin/uname -p` in
3259bd41f2cSmrg	    sparc) echo sparc-icl-nx7; exit ;;
3269bd41f2cSmrg	esac ;;
3279418810dSmrg    s390x:SunOS:*:*)
3289418810dSmrg	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3299418810dSmrg	exit ;;
3309bd41f2cSmrg    sun4H:SunOS:5.*:*)
3319bd41f2cSmrg	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3329bd41f2cSmrg	exit ;;
3339bd41f2cSmrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
3349bd41f2cSmrg	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3359bd41f2cSmrg	exit ;;
3369418810dSmrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
3379418810dSmrg	eval $set_cc_for_build
3389418810dSmrg	SUN_ARCH="i386"
3399418810dSmrg	# If there is a compiler, see if it is configured for 64-bit objects.
3409418810dSmrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
3419418810dSmrg	# This test works for both compilers.
3429418810dSmrg	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
3439418810dSmrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
3449418810dSmrg		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
3459418810dSmrg		grep IS_64BIT_ARCH >/dev/null
3469418810dSmrg	    then
3479418810dSmrg		SUN_ARCH="x86_64"
3489418810dSmrg	    fi
3499418810dSmrg	fi
3509418810dSmrg	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3519bd41f2cSmrg	exit ;;
3529bd41f2cSmrg    sun4*:SunOS:6*:*)
3539bd41f2cSmrg	# According to config.sub, this is the proper way to canonicalize
3549bd41f2cSmrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
3559bd41f2cSmrg	# it's likely to be more like Solaris than SunOS4.
3569bd41f2cSmrg	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3579bd41f2cSmrg	exit ;;
3589bd41f2cSmrg    sun4*:SunOS:*:*)
3599bd41f2cSmrg	case "`/usr/bin/arch -k`" in
3609bd41f2cSmrg	    Series*|S4*)
3619bd41f2cSmrg		UNAME_RELEASE=`uname -v`
3629bd41f2cSmrg		;;
3639bd41f2cSmrg	esac
3649bd41f2cSmrg	# Japanese Language versions have a version number like `4.1.3-JL'.
3659bd41f2cSmrg	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
3669bd41f2cSmrg	exit ;;
3679bd41f2cSmrg    sun3*:SunOS:*:*)
3689bd41f2cSmrg	echo m68k-sun-sunos${UNAME_RELEASE}
3699bd41f2cSmrg	exit ;;
3709bd41f2cSmrg    sun*:*:4.2BSD:*)
3719bd41f2cSmrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
3729bd41f2cSmrg	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
3739bd41f2cSmrg	case "`/bin/arch`" in
3749bd41f2cSmrg	    sun3)
3759bd41f2cSmrg		echo m68k-sun-sunos${UNAME_RELEASE}
3769bd41f2cSmrg		;;
3779bd41f2cSmrg	    sun4)
3789bd41f2cSmrg		echo sparc-sun-sunos${UNAME_RELEASE}
3799bd41f2cSmrg		;;
3809bd41f2cSmrg	esac
3819bd41f2cSmrg	exit ;;
3829bd41f2cSmrg    aushp:SunOS:*:*)
3839bd41f2cSmrg	echo sparc-auspex-sunos${UNAME_RELEASE}
3849bd41f2cSmrg	exit ;;
3859bd41f2cSmrg    # The situation for MiNT is a little confusing.  The machine name
3869bd41f2cSmrg    # can be virtually everything (everything which is not
3879bd41f2cSmrg    # "atarist" or "atariste" at least should have a processor
3889bd41f2cSmrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
3899bd41f2cSmrg    # to the lowercase version "mint" (or "freemint").  Finally
3909bd41f2cSmrg    # the system name "TOS" denotes a system which is actually not
3919bd41f2cSmrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
3929bd41f2cSmrg    # be no problem.
3939bd41f2cSmrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
3949bd41f2cSmrg        echo m68k-atari-mint${UNAME_RELEASE}
3959bd41f2cSmrg	exit ;;
3969bd41f2cSmrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
3979bd41f2cSmrg	echo m68k-atari-mint${UNAME_RELEASE}
3989bd41f2cSmrg        exit ;;
3999bd41f2cSmrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
4009bd41f2cSmrg        echo m68k-atari-mint${UNAME_RELEASE}
4019bd41f2cSmrg	exit ;;
4029bd41f2cSmrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
4039bd41f2cSmrg        echo m68k-milan-mint${UNAME_RELEASE}
4049bd41f2cSmrg        exit ;;
4059bd41f2cSmrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
4069bd41f2cSmrg        echo m68k-hades-mint${UNAME_RELEASE}
4079bd41f2cSmrg        exit ;;
4089bd41f2cSmrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
4099bd41f2cSmrg        echo m68k-unknown-mint${UNAME_RELEASE}
4109bd41f2cSmrg        exit ;;
4119bd41f2cSmrg    m68k:machten:*:*)
4129bd41f2cSmrg	echo m68k-apple-machten${UNAME_RELEASE}
4139bd41f2cSmrg	exit ;;
4149bd41f2cSmrg    powerpc:machten:*:*)
4159bd41f2cSmrg	echo powerpc-apple-machten${UNAME_RELEASE}
4169bd41f2cSmrg	exit ;;
4179bd41f2cSmrg    RISC*:Mach:*:*)
4189bd41f2cSmrg	echo mips-dec-mach_bsd4.3
4199bd41f2cSmrg	exit ;;
4209bd41f2cSmrg    RISC*:ULTRIX:*:*)
4219bd41f2cSmrg	echo mips-dec-ultrix${UNAME_RELEASE}
4229bd41f2cSmrg	exit ;;
4239bd41f2cSmrg    VAX*:ULTRIX*:*:*)
4249bd41f2cSmrg	echo vax-dec-ultrix${UNAME_RELEASE}
4259bd41f2cSmrg	exit ;;
4269bd41f2cSmrg    2020:CLIX:*:* | 2430:CLIX:*:*)
4279bd41f2cSmrg	echo clipper-intergraph-clix${UNAME_RELEASE}
4289bd41f2cSmrg	exit ;;
4299bd41f2cSmrg    mips:*:*:UMIPS | mips:*:*:RISCos)
4309bd41f2cSmrg	eval $set_cc_for_build
4319bd41f2cSmrg	sed 's/^	//' << EOF >$dummy.c
4329bd41f2cSmrg#ifdef __cplusplus
4339bd41f2cSmrg#include <stdio.h>  /* for printf() prototype */
4349bd41f2cSmrg	int main (int argc, char *argv[]) {
4359bd41f2cSmrg#else
4369bd41f2cSmrg	int main (argc, argv) int argc; char *argv[]; {
4379bd41f2cSmrg#endif
4389bd41f2cSmrg	#if defined (host_mips) && defined (MIPSEB)
4399bd41f2cSmrg	#if defined (SYSTYPE_SYSV)
4409bd41f2cSmrg	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
4419bd41f2cSmrg	#endif
4429bd41f2cSmrg	#if defined (SYSTYPE_SVR4)
4439bd41f2cSmrg	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
4449bd41f2cSmrg	#endif
4459bd41f2cSmrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
4469bd41f2cSmrg	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
4479bd41f2cSmrg	#endif
4489bd41f2cSmrg	#endif
4499bd41f2cSmrg	  exit (-1);
4509bd41f2cSmrg	}
4519bd41f2cSmrgEOF
4529bd41f2cSmrg	$CC_FOR_BUILD -o $dummy $dummy.c &&
4539bd41f2cSmrg	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
4549bd41f2cSmrg	  SYSTEM_NAME=`$dummy $dummyarg` &&
4559bd41f2cSmrg	    { echo "$SYSTEM_NAME"; exit; }
4569bd41f2cSmrg	echo mips-mips-riscos${UNAME_RELEASE}
4579bd41f2cSmrg	exit ;;
4589bd41f2cSmrg    Motorola:PowerMAX_OS:*:*)
4599bd41f2cSmrg	echo powerpc-motorola-powermax
4609bd41f2cSmrg	exit ;;
4619bd41f2cSmrg    Motorola:*:4.3:PL8-*)
4629bd41f2cSmrg	echo powerpc-harris-powermax
4639bd41f2cSmrg	exit ;;
4649bd41f2cSmrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
4659bd41f2cSmrg	echo powerpc-harris-powermax
4669bd41f2cSmrg	exit ;;
4679bd41f2cSmrg    Night_Hawk:Power_UNIX:*:*)
4689bd41f2cSmrg	echo powerpc-harris-powerunix
4699bd41f2cSmrg	exit ;;
4709bd41f2cSmrg    m88k:CX/UX:7*:*)
4719bd41f2cSmrg	echo m88k-harris-cxux7
4729bd41f2cSmrg	exit ;;
4739bd41f2cSmrg    m88k:*:4*:R4*)
4749bd41f2cSmrg	echo m88k-motorola-sysv4
4759bd41f2cSmrg	exit ;;
4769bd41f2cSmrg    m88k:*:3*:R3*)
4779bd41f2cSmrg	echo m88k-motorola-sysv3
4789bd41f2cSmrg	exit ;;
4799bd41f2cSmrg    AViiON:dgux:*:*)
4809bd41f2cSmrg        # DG/UX returns AViiON for all architectures
4819bd41f2cSmrg        UNAME_PROCESSOR=`/usr/bin/uname -p`
4829bd41f2cSmrg	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
4839bd41f2cSmrg	then
4849bd41f2cSmrg	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
4859bd41f2cSmrg	       [ ${TARGET_BINARY_INTERFACE}x = x ]
4869bd41f2cSmrg	    then
4879bd41f2cSmrg		echo m88k-dg-dgux${UNAME_RELEASE}
4889bd41f2cSmrg	    else
4899bd41f2cSmrg		echo m88k-dg-dguxbcs${UNAME_RELEASE}
4909bd41f2cSmrg	    fi
4919bd41f2cSmrg	else
4929bd41f2cSmrg	    echo i586-dg-dgux${UNAME_RELEASE}
4939bd41f2cSmrg	fi
4949bd41f2cSmrg 	exit ;;
4959bd41f2cSmrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
4969bd41f2cSmrg	echo m88k-dolphin-sysv3
4979bd41f2cSmrg	exit ;;
4989bd41f2cSmrg    M88*:*:R3*:*)
4999bd41f2cSmrg	# Delta 88k system running SVR3
5009bd41f2cSmrg	echo m88k-motorola-sysv3
5019bd41f2cSmrg	exit ;;
5029bd41f2cSmrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
5039bd41f2cSmrg	echo m88k-tektronix-sysv3
5049bd41f2cSmrg	exit ;;
5059bd41f2cSmrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
5069bd41f2cSmrg	echo m68k-tektronix-bsd
5079bd41f2cSmrg	exit ;;
5089bd41f2cSmrg    *:IRIX*:*:*)
5099bd41f2cSmrg	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
5109bd41f2cSmrg	exit ;;
5119bd41f2cSmrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
5129bd41f2cSmrg	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
5139bd41f2cSmrg	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
5149bd41f2cSmrg    i*86:AIX:*:*)
5159bd41f2cSmrg	echo i386-ibm-aix
5169bd41f2cSmrg	exit ;;
5179bd41f2cSmrg    ia64:AIX:*:*)
5189bd41f2cSmrg	if [ -x /usr/bin/oslevel ] ; then
5199bd41f2cSmrg		IBM_REV=`/usr/bin/oslevel`
5209bd41f2cSmrg	else
5219bd41f2cSmrg		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
5229bd41f2cSmrg	fi
5239bd41f2cSmrg	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
5249bd41f2cSmrg	exit ;;
5259bd41f2cSmrg    *:AIX:2:3)
5269bd41f2cSmrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
5279bd41f2cSmrg		eval $set_cc_for_build
5289bd41f2cSmrg		sed 's/^		//' << EOF >$dummy.c
5299bd41f2cSmrg		#include <sys/systemcfg.h>
5309bd41f2cSmrg
5319bd41f2cSmrg		main()
5329bd41f2cSmrg			{
5339bd41f2cSmrg			if (!__power_pc())
5349bd41f2cSmrg				exit(1);
5359bd41f2cSmrg			puts("powerpc-ibm-aix3.2.5");
5369bd41f2cSmrg			exit(0);
5379bd41f2cSmrg			}
5389bd41f2cSmrgEOF
5399bd41f2cSmrg		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
5409bd41f2cSmrg		then
5419bd41f2cSmrg			echo "$SYSTEM_NAME"
5429bd41f2cSmrg		else
5439bd41f2cSmrg			echo rs6000-ibm-aix3.2.5
5449bd41f2cSmrg		fi
5459bd41f2cSmrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
5469bd41f2cSmrg		echo rs6000-ibm-aix3.2.4
5479bd41f2cSmrg	else
5489bd41f2cSmrg		echo rs6000-ibm-aix3.2
5499bd41f2cSmrg	fi
5509bd41f2cSmrg	exit ;;
5519418810dSmrg    *:AIX:*:[456])
5529bd41f2cSmrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
5539bd41f2cSmrg	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
5549bd41f2cSmrg		IBM_ARCH=rs6000
5559bd41f2cSmrg	else
5569bd41f2cSmrg		IBM_ARCH=powerpc
5579bd41f2cSmrg	fi
5589bd41f2cSmrg	if [ -x /usr/bin/oslevel ] ; then
5599bd41f2cSmrg		IBM_REV=`/usr/bin/oslevel`
5609bd41f2cSmrg	else
5619bd41f2cSmrg		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
5629bd41f2cSmrg	fi
5639bd41f2cSmrg	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
5649bd41f2cSmrg	exit ;;
5659bd41f2cSmrg    *:AIX:*:*)
5669bd41f2cSmrg	echo rs6000-ibm-aix
5679bd41f2cSmrg	exit ;;
5689bd41f2cSmrg    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
5699bd41f2cSmrg	echo romp-ibm-bsd4.4
5709bd41f2cSmrg	exit ;;
5719bd41f2cSmrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
5729bd41f2cSmrg	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
5739bd41f2cSmrg	exit ;;                             # report: romp-ibm BSD 4.3
5749bd41f2cSmrg    *:BOSX:*:*)
5759bd41f2cSmrg	echo rs6000-bull-bosx
5769bd41f2cSmrg	exit ;;
5779bd41f2cSmrg    DPX/2?00:B.O.S.:*:*)
5789bd41f2cSmrg	echo m68k-bull-sysv3
5799bd41f2cSmrg	exit ;;
5809bd41f2cSmrg    9000/[34]??:4.3bsd:1.*:*)
5819bd41f2cSmrg	echo m68k-hp-bsd
5829bd41f2cSmrg	exit ;;
5839bd41f2cSmrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
5849bd41f2cSmrg	echo m68k-hp-bsd4.4
5859bd41f2cSmrg	exit ;;
5869bd41f2cSmrg    9000/[34678]??:HP-UX:*:*)
5879bd41f2cSmrg	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
5889bd41f2cSmrg	case "${UNAME_MACHINE}" in
5899bd41f2cSmrg	    9000/31? )            HP_ARCH=m68000 ;;
5909bd41f2cSmrg	    9000/[34]?? )         HP_ARCH=m68k ;;
5919bd41f2cSmrg	    9000/[678][0-9][0-9])
5929bd41f2cSmrg		if [ -x /usr/bin/getconf ]; then
5939bd41f2cSmrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
5949bd41f2cSmrg                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
5959bd41f2cSmrg                    case "${sc_cpu_version}" in
5969bd41f2cSmrg                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
5979bd41f2cSmrg                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
5989bd41f2cSmrg                      532)                      # CPU_PA_RISC2_0
5999bd41f2cSmrg                        case "${sc_kernel_bits}" in
6009bd41f2cSmrg                          32) HP_ARCH="hppa2.0n" ;;
6019bd41f2cSmrg                          64) HP_ARCH="hppa2.0w" ;;
6029bd41f2cSmrg			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
6039bd41f2cSmrg                        esac ;;
6049bd41f2cSmrg                    esac
6059bd41f2cSmrg		fi
6069bd41f2cSmrg		if [ "${HP_ARCH}" = "" ]; then
6079bd41f2cSmrg		    eval $set_cc_for_build
6089bd41f2cSmrg		    sed 's/^              //' << EOF >$dummy.c
6099bd41f2cSmrg
6109bd41f2cSmrg              #define _HPUX_SOURCE
6119bd41f2cSmrg              #include <stdlib.h>
6129bd41f2cSmrg              #include <unistd.h>
6139bd41f2cSmrg
6149bd41f2cSmrg              int main ()
6159bd41f2cSmrg              {
6169bd41f2cSmrg              #if defined(_SC_KERNEL_BITS)
6179bd41f2cSmrg                  long bits = sysconf(_SC_KERNEL_BITS);
6189bd41f2cSmrg              #endif
6199bd41f2cSmrg                  long cpu  = sysconf (_SC_CPU_VERSION);
6209bd41f2cSmrg
6219bd41f2cSmrg                  switch (cpu)
6229bd41f2cSmrg              	{
6239bd41f2cSmrg              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
6249bd41f2cSmrg              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
6259bd41f2cSmrg              	case CPU_PA_RISC2_0:
6269bd41f2cSmrg              #if defined(_SC_KERNEL_BITS)
6279bd41f2cSmrg              	    switch (bits)
6289bd41f2cSmrg              		{
6299bd41f2cSmrg              		case 64: puts ("hppa2.0w"); break;
6309bd41f2cSmrg              		case 32: puts ("hppa2.0n"); break;
6319bd41f2cSmrg              		default: puts ("hppa2.0"); break;
6329bd41f2cSmrg              		} break;
6339bd41f2cSmrg              #else  /* !defined(_SC_KERNEL_BITS) */
6349bd41f2cSmrg              	    puts ("hppa2.0"); break;
6359bd41f2cSmrg              #endif
6369bd41f2cSmrg              	default: puts ("hppa1.0"); break;
6379bd41f2cSmrg              	}
6389bd41f2cSmrg                  exit (0);
6399bd41f2cSmrg              }
6409bd41f2cSmrgEOF
6419bd41f2cSmrg		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
6429bd41f2cSmrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
6439bd41f2cSmrg		fi ;;
6449bd41f2cSmrg	esac
6459bd41f2cSmrg	if [ ${HP_ARCH} = "hppa2.0w" ]
6469bd41f2cSmrg	then
6479bd41f2cSmrg	    eval $set_cc_for_build
6489bd41f2cSmrg
6499bd41f2cSmrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
6509bd41f2cSmrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
6519bd41f2cSmrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
6529bd41f2cSmrg	    #
6539bd41f2cSmrg	    # $ CC_FOR_BUILD=cc ./config.guess
6549bd41f2cSmrg	    # => hppa2.0w-hp-hpux11.23
6559bd41f2cSmrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
6569bd41f2cSmrg	    # => hppa64-hp-hpux11.23
6579bd41f2cSmrg
6589bd41f2cSmrg	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
6599bd41f2cSmrg		grep __LP64__ >/dev/null
6609bd41f2cSmrg	    then
6619bd41f2cSmrg		HP_ARCH="hppa2.0w"
6629bd41f2cSmrg	    else
6639bd41f2cSmrg		HP_ARCH="hppa64"
6649bd41f2cSmrg	    fi
6659bd41f2cSmrg	fi
6669bd41f2cSmrg	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
6679bd41f2cSmrg	exit ;;
6689bd41f2cSmrg    ia64:HP-UX:*:*)
6699bd41f2cSmrg	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
6709bd41f2cSmrg	echo ia64-hp-hpux${HPUX_REV}
6719bd41f2cSmrg	exit ;;
6729bd41f2cSmrg    3050*:HI-UX:*:*)
6739bd41f2cSmrg	eval $set_cc_for_build
6749bd41f2cSmrg	sed 's/^	//' << EOF >$dummy.c
6759bd41f2cSmrg	#include <unistd.h>
6769bd41f2cSmrg	int
6779bd41f2cSmrg	main ()
6789bd41f2cSmrg	{
6799bd41f2cSmrg	  long cpu = sysconf (_SC_CPU_VERSION);
6809bd41f2cSmrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
6819bd41f2cSmrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
6829bd41f2cSmrg	     results, however.  */
6839bd41f2cSmrg	  if (CPU_IS_PA_RISC (cpu))
6849bd41f2cSmrg	    {
6859bd41f2cSmrg	      switch (cpu)
6869bd41f2cSmrg		{
6879bd41f2cSmrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
6889bd41f2cSmrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
6899bd41f2cSmrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
6909bd41f2cSmrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
6919bd41f2cSmrg		}
6929bd41f2cSmrg	    }
6939bd41f2cSmrg	  else if (CPU_IS_HP_MC68K (cpu))
6949bd41f2cSmrg	    puts ("m68k-hitachi-hiuxwe2");
6959bd41f2cSmrg	  else puts ("unknown-hitachi-hiuxwe2");
6969bd41f2cSmrg	  exit (0);
6979bd41f2cSmrg	}
6989bd41f2cSmrgEOF
6999bd41f2cSmrg	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
7009bd41f2cSmrg		{ echo "$SYSTEM_NAME"; exit; }
7019bd41f2cSmrg	echo unknown-hitachi-hiuxwe2
7029bd41f2cSmrg	exit ;;
7039bd41f2cSmrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
7049bd41f2cSmrg	echo hppa1.1-hp-bsd
7059bd41f2cSmrg	exit ;;
7069bd41f2cSmrg    9000/8??:4.3bsd:*:*)
7079bd41f2cSmrg	echo hppa1.0-hp-bsd
7089bd41f2cSmrg	exit ;;
7099bd41f2cSmrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
7109bd41f2cSmrg	echo hppa1.0-hp-mpeix
7119bd41f2cSmrg	exit ;;
7129bd41f2cSmrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
7139bd41f2cSmrg	echo hppa1.1-hp-osf
7149bd41f2cSmrg	exit ;;
7159bd41f2cSmrg    hp8??:OSF1:*:*)
7169bd41f2cSmrg	echo hppa1.0-hp-osf
7179bd41f2cSmrg	exit ;;
7189bd41f2cSmrg    i*86:OSF1:*:*)
7199bd41f2cSmrg	if [ -x /usr/sbin/sysversion ] ; then
7209bd41f2cSmrg	    echo ${UNAME_MACHINE}-unknown-osf1mk
7219bd41f2cSmrg	else
7229bd41f2cSmrg	    echo ${UNAME_MACHINE}-unknown-osf1
7239bd41f2cSmrg	fi
7249bd41f2cSmrg	exit ;;
7259bd41f2cSmrg    parisc*:Lites*:*:*)
7269bd41f2cSmrg	echo hppa1.1-hp-lites
7279bd41f2cSmrg	exit ;;
7289bd41f2cSmrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
7299bd41f2cSmrg	echo c1-convex-bsd
7309bd41f2cSmrg        exit ;;
7319bd41f2cSmrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
7329bd41f2cSmrg	if getsysinfo -f scalar_acc
7339bd41f2cSmrg	then echo c32-convex-bsd
7349bd41f2cSmrg	else echo c2-convex-bsd
7359bd41f2cSmrg	fi
7369bd41f2cSmrg        exit ;;
7379bd41f2cSmrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
7389bd41f2cSmrg	echo c34-convex-bsd
7399bd41f2cSmrg        exit ;;
7409bd41f2cSmrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
7419bd41f2cSmrg	echo c38-convex-bsd
7429bd41f2cSmrg        exit ;;
7439bd41f2cSmrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
7449bd41f2cSmrg	echo c4-convex-bsd
7459bd41f2cSmrg        exit ;;
7469bd41f2cSmrg    CRAY*Y-MP:*:*:*)
7479bd41f2cSmrg	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7489bd41f2cSmrg	exit ;;
7499bd41f2cSmrg    CRAY*[A-Z]90:*:*:*)
7509bd41f2cSmrg	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
7519bd41f2cSmrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
7529bd41f2cSmrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
7539bd41f2cSmrg	      -e 's/\.[^.]*$/.X/'
7549bd41f2cSmrg	exit ;;
7559bd41f2cSmrg    CRAY*TS:*:*:*)
7569bd41f2cSmrg	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7579bd41f2cSmrg	exit ;;
7589bd41f2cSmrg    CRAY*T3E:*:*:*)
7599bd41f2cSmrg	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7609bd41f2cSmrg	exit ;;
7619bd41f2cSmrg    CRAY*SV1:*:*:*)
7629bd41f2cSmrg	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7639bd41f2cSmrg	exit ;;
7649bd41f2cSmrg    *:UNICOS/mp:*:*)
7659bd41f2cSmrg	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7669bd41f2cSmrg	exit ;;
7679bd41f2cSmrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
7689bd41f2cSmrg	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
7699bd41f2cSmrg        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
7709bd41f2cSmrg        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
7719bd41f2cSmrg        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
7729bd41f2cSmrg        exit ;;
7739bd41f2cSmrg    5000:UNIX_System_V:4.*:*)
7749bd41f2cSmrg        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
7759bd41f2cSmrg        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
7769bd41f2cSmrg        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
7779bd41f2cSmrg	exit ;;
7789bd41f2cSmrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
7799bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
7809bd41f2cSmrg	exit ;;
7819bd41f2cSmrg    sparc*:BSD/OS:*:*)
7829bd41f2cSmrg	echo sparc-unknown-bsdi${UNAME_RELEASE}
7839bd41f2cSmrg	exit ;;
7849bd41f2cSmrg    *:BSD/OS:*:*)
7859bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
7869bd41f2cSmrg	exit ;;
7879bd41f2cSmrg    *:FreeBSD:*:*)
7889418810dSmrg	case ${UNAME_MACHINE} in
7899418810dSmrg	    pc98)
7909418810dSmrg		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
7919418810dSmrg	    amd64)
7929418810dSmrg		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
7939418810dSmrg	    *)
7949418810dSmrg		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
7959418810dSmrg	esac
7969bd41f2cSmrg	exit ;;
7979bd41f2cSmrg    i*:CYGWIN*:*)
7989bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-cygwin
7999bd41f2cSmrg	exit ;;
8009418810dSmrg    *:MINGW*:*)
8019bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-mingw32
8029bd41f2cSmrg	exit ;;
8039bd41f2cSmrg    i*:windows32*:*)
8049bd41f2cSmrg    	# uname -m includes "-pc" on this system.
8059bd41f2cSmrg    	echo ${UNAME_MACHINE}-mingw32
8069bd41f2cSmrg	exit ;;
8079bd41f2cSmrg    i*:PW*:*)
8089bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-pw32
8099bd41f2cSmrg	exit ;;
8109418810dSmrg    *:Interix*:[3456]*)
8119418810dSmrg    	case ${UNAME_MACHINE} in
8129418810dSmrg	    x86)
8139418810dSmrg		echo i586-pc-interix${UNAME_RELEASE}
8149418810dSmrg		exit ;;
8159418810dSmrg	    EM64T | authenticamd | genuineintel)
8169418810dSmrg		echo x86_64-unknown-interix${UNAME_RELEASE}
8179418810dSmrg		exit ;;
8189418810dSmrg	    IA64)
8199418810dSmrg		echo ia64-unknown-interix${UNAME_RELEASE}
8209418810dSmrg		exit ;;
8219418810dSmrg	esac ;;
8229bd41f2cSmrg    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
8239bd41f2cSmrg	echo i${UNAME_MACHINE}-pc-mks
8249bd41f2cSmrg	exit ;;
8259bd41f2cSmrg    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
8269bd41f2cSmrg	# How do we know it's Interix rather than the generic POSIX subsystem?
8279bd41f2cSmrg	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
8289bd41f2cSmrg	# UNAME_MACHINE based on the output of uname instead of i386?
8299bd41f2cSmrg	echo i586-pc-interix
8309bd41f2cSmrg	exit ;;
8319bd41f2cSmrg    i*:UWIN*:*)
8329bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-uwin
8339bd41f2cSmrg	exit ;;
8349bd41f2cSmrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
8359bd41f2cSmrg	echo x86_64-unknown-cygwin
8369bd41f2cSmrg	exit ;;
8379bd41f2cSmrg    p*:CYGWIN*:*)
8389bd41f2cSmrg	echo powerpcle-unknown-cygwin
8399bd41f2cSmrg	exit ;;
8409bd41f2cSmrg    prep*:SunOS:5.*:*)
8419bd41f2cSmrg	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
8429bd41f2cSmrg	exit ;;
8439bd41f2cSmrg    *:GNU:*:*)
8449bd41f2cSmrg	# the GNU system
8459bd41f2cSmrg	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
8469bd41f2cSmrg	exit ;;
8479bd41f2cSmrg    *:GNU/*:*:*)
8489bd41f2cSmrg	# other systems with GNU libc and userland
8499bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
8509bd41f2cSmrg	exit ;;
8519bd41f2cSmrg    i*86:Minix:*:*)
8529bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-minix
8539bd41f2cSmrg	exit ;;
8549bd41f2cSmrg    arm*:Linux:*:*)
8559418810dSmrg	eval $set_cc_for_build
8569418810dSmrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
8579418810dSmrg	    | grep -q __ARM_EABI__
8589418810dSmrg	then
8599418810dSmrg	    echo ${UNAME_MACHINE}-unknown-linux-gnu
8609418810dSmrg	else
8619418810dSmrg	    echo ${UNAME_MACHINE}-unknown-linux-gnueabi
8629418810dSmrg	fi
8639418810dSmrg	exit ;;
8649418810dSmrg    avr32*:Linux:*:*)
8659bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
8669bd41f2cSmrg	exit ;;
8679bd41f2cSmrg    cris:Linux:*:*)
8689bd41f2cSmrg	echo cris-axis-linux-gnu
8699bd41f2cSmrg	exit ;;
8709bd41f2cSmrg    crisv32:Linux:*:*)
8719bd41f2cSmrg	echo crisv32-axis-linux-gnu
8729bd41f2cSmrg	exit ;;
8739bd41f2cSmrg    frv:Linux:*:*)
8749bd41f2cSmrg    	echo frv-unknown-linux-gnu
8759bd41f2cSmrg	exit ;;
8769bd41f2cSmrg    ia64:Linux:*:*)
8779bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
8789bd41f2cSmrg	exit ;;
8799bd41f2cSmrg    m32r*:Linux:*:*)
8809bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
8819bd41f2cSmrg	exit ;;
8829bd41f2cSmrg    m68*:Linux:*:*)
8839bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
8849bd41f2cSmrg	exit ;;
8859bd41f2cSmrg    mips:Linux:*:*)
8869bd41f2cSmrg	eval $set_cc_for_build
8879bd41f2cSmrg	sed 's/^	//' << EOF >$dummy.c
8889bd41f2cSmrg	#undef CPU
8899bd41f2cSmrg	#undef mips
8909bd41f2cSmrg	#undef mipsel
8919bd41f2cSmrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
8929bd41f2cSmrg	CPU=mipsel
8939bd41f2cSmrg	#else
8949bd41f2cSmrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
8959bd41f2cSmrg	CPU=mips
8969bd41f2cSmrg	#else
8979bd41f2cSmrg	CPU=
8989bd41f2cSmrg	#endif
8999bd41f2cSmrg	#endif
9009bd41f2cSmrgEOF
9019418810dSmrg	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
9029418810dSmrg	    /^CPU/{
9039418810dSmrg		s: ::g
9049418810dSmrg		p
9059418810dSmrg	    }'`"
9069bd41f2cSmrg	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
9079bd41f2cSmrg	;;
9089bd41f2cSmrg    mips64:Linux:*:*)
9099bd41f2cSmrg	eval $set_cc_for_build
9109bd41f2cSmrg	sed 's/^	//' << EOF >$dummy.c
9119bd41f2cSmrg	#undef CPU
9129bd41f2cSmrg	#undef mips64
9139bd41f2cSmrg	#undef mips64el
9149bd41f2cSmrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
9159bd41f2cSmrg	CPU=mips64el
9169bd41f2cSmrg	#else
9179bd41f2cSmrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
9189bd41f2cSmrg	CPU=mips64
9199bd41f2cSmrg	#else
9209bd41f2cSmrg	CPU=
9219bd41f2cSmrg	#endif
9229bd41f2cSmrg	#endif
9239bd41f2cSmrgEOF
9249418810dSmrg	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
9259418810dSmrg	    /^CPU/{
9269418810dSmrg		s: ::g
9279418810dSmrg		p
9289418810dSmrg	    }'`"
9299bd41f2cSmrg	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
9309bd41f2cSmrg	;;
9319bd41f2cSmrg    or32:Linux:*:*)
9329bd41f2cSmrg	echo or32-unknown-linux-gnu
9339bd41f2cSmrg	exit ;;
9349bd41f2cSmrg    ppc:Linux:*:*)
9359bd41f2cSmrg	echo powerpc-unknown-linux-gnu
9369bd41f2cSmrg	exit ;;
9379bd41f2cSmrg    ppc64:Linux:*:*)
9389bd41f2cSmrg	echo powerpc64-unknown-linux-gnu
9399bd41f2cSmrg	exit ;;
9409bd41f2cSmrg    alpha:Linux:*:*)
9419bd41f2cSmrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
9429bd41f2cSmrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
9439bd41f2cSmrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
9449bd41f2cSmrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
9459bd41f2cSmrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
9469bd41f2cSmrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
9479bd41f2cSmrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
9489bd41f2cSmrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
9499bd41f2cSmrg        esac
9509bd41f2cSmrg	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
9519bd41f2cSmrg	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
9529bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
9539bd41f2cSmrg	exit ;;
9549418810dSmrg    padre:Linux:*:*)
9559418810dSmrg	echo sparc-unknown-linux-gnu
9569418810dSmrg	exit ;;
9579bd41f2cSmrg    parisc:Linux:*:* | hppa:Linux:*:*)
9589bd41f2cSmrg	# Look for CPU level
9599bd41f2cSmrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
9609bd41f2cSmrg	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
9619bd41f2cSmrg	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
9629bd41f2cSmrg	  *)    echo hppa-unknown-linux-gnu ;;
9639bd41f2cSmrg	esac
9649bd41f2cSmrg	exit ;;
9659bd41f2cSmrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
9669bd41f2cSmrg	echo hppa64-unknown-linux-gnu
9679bd41f2cSmrg	exit ;;
9689bd41f2cSmrg    s390:Linux:*:* | s390x:Linux:*:*)
9699bd41f2cSmrg	echo ${UNAME_MACHINE}-ibm-linux
9709bd41f2cSmrg	exit ;;
9719bd41f2cSmrg    sh64*:Linux:*:*)
9729bd41f2cSmrg    	echo ${UNAME_MACHINE}-unknown-linux-gnu
9739bd41f2cSmrg	exit ;;
9749bd41f2cSmrg    sh*:Linux:*:*)
9759bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
9769bd41f2cSmrg	exit ;;
9779bd41f2cSmrg    sparc:Linux:*:* | sparc64:Linux:*:*)
9789bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
9799bd41f2cSmrg	exit ;;
9809bd41f2cSmrg    vax:Linux:*:*)
9819bd41f2cSmrg	echo ${UNAME_MACHINE}-dec-linux-gnu
9829bd41f2cSmrg	exit ;;
9839bd41f2cSmrg    x86_64:Linux:*:*)
9849bd41f2cSmrg	echo x86_64-unknown-linux-gnu
9859bd41f2cSmrg	exit ;;
9869418810dSmrg    xtensa*:Linux:*:*)
9879418810dSmrg    	echo ${UNAME_MACHINE}-unknown-linux-gnu
9889418810dSmrg	exit ;;
9899bd41f2cSmrg    i*86:Linux:*:*)
9909bd41f2cSmrg	# The BFD linker knows what the default object file format is, so
9919bd41f2cSmrg	# first see if it will tell us. cd to the root directory to prevent
9929bd41f2cSmrg	# problems with other programs or directories called `ld' in the path.
9939bd41f2cSmrg	# Set LC_ALL=C to ensure ld outputs messages in English.
9949bd41f2cSmrg	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
9959bd41f2cSmrg			 | sed -ne '/supported targets:/!d
9969bd41f2cSmrg				    s/[ 	][ 	]*/ /g
9979bd41f2cSmrg				    s/.*supported targets: *//
9989bd41f2cSmrg				    s/ .*//
9999bd41f2cSmrg				    p'`
10009bd41f2cSmrg        case "$ld_supported_targets" in
10019bd41f2cSmrg	  elf32-i386)
10029bd41f2cSmrg		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
10039bd41f2cSmrg		;;
10049bd41f2cSmrg	  a.out-i386-linux)
10059bd41f2cSmrg		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
10069bd41f2cSmrg		exit ;;
10079bd41f2cSmrg	  "")
10089bd41f2cSmrg		# Either a pre-BFD a.out linker (linux-gnuoldld) or
10099bd41f2cSmrg		# one that does not give us useful --help.
10109bd41f2cSmrg		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
10119bd41f2cSmrg		exit ;;
10129bd41f2cSmrg	esac
10139bd41f2cSmrg	# Determine whether the default compiler is a.out or elf
10149bd41f2cSmrg	eval $set_cc_for_build
10159bd41f2cSmrg	sed 's/^	//' << EOF >$dummy.c
10169bd41f2cSmrg	#include <features.h>
10179bd41f2cSmrg	#ifdef __ELF__
10189bd41f2cSmrg	# ifdef __GLIBC__
10199bd41f2cSmrg	#  if __GLIBC__ >= 2
10209bd41f2cSmrg	LIBC=gnu
10219bd41f2cSmrg	#  else
10229bd41f2cSmrg	LIBC=gnulibc1
10239bd41f2cSmrg	#  endif
10249bd41f2cSmrg	# else
10259bd41f2cSmrg	LIBC=gnulibc1
10269bd41f2cSmrg	# endif
10279bd41f2cSmrg	#else
10289418810dSmrg	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
10299bd41f2cSmrg	LIBC=gnu
10309bd41f2cSmrg	#else
10319bd41f2cSmrg	LIBC=gnuaout
10329bd41f2cSmrg	#endif
10339bd41f2cSmrg	#endif
10349bd41f2cSmrg	#ifdef __dietlibc__
10359bd41f2cSmrg	LIBC=dietlibc
10369bd41f2cSmrg	#endif
10379bd41f2cSmrgEOF
10389418810dSmrg	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
10399418810dSmrg	    /^LIBC/{
10409418810dSmrg		s: ::g
10419418810dSmrg		p
10429418810dSmrg	    }'`"
10439bd41f2cSmrg	test x"${LIBC}" != x && {
10449bd41f2cSmrg		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
10459bd41f2cSmrg		exit
10469bd41f2cSmrg	}
10479bd41f2cSmrg	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
10489bd41f2cSmrg	;;
10499bd41f2cSmrg    i*86:DYNIX/ptx:4*:*)
10509bd41f2cSmrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
10519bd41f2cSmrg	# earlier versions are messed up and put the nodename in both
10529bd41f2cSmrg	# sysname and nodename.
10539bd41f2cSmrg	echo i386-sequent-sysv4
10549bd41f2cSmrg	exit ;;
10559bd41f2cSmrg    i*86:UNIX_SV:4.2MP:2.*)
10569bd41f2cSmrg        # Unixware is an offshoot of SVR4, but it has its own version
10579bd41f2cSmrg        # number series starting with 2...
10589bd41f2cSmrg        # I am not positive that other SVR4 systems won't match this,
10599bd41f2cSmrg	# I just have to hope.  -- rms.
10609bd41f2cSmrg        # Use sysv4.2uw... so that sysv4* matches it.
10619bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
10629bd41f2cSmrg	exit ;;
10639bd41f2cSmrg    i*86:OS/2:*:*)
10649bd41f2cSmrg	# If we were able to find `uname', then EMX Unix compatibility
10659bd41f2cSmrg	# is probably installed.
10669bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-os2-emx
10679bd41f2cSmrg	exit ;;
10689bd41f2cSmrg    i*86:XTS-300:*:STOP)
10699bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-stop
10709bd41f2cSmrg	exit ;;
10719bd41f2cSmrg    i*86:atheos:*:*)
10729bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-atheos
10739bd41f2cSmrg	exit ;;
10749bd41f2cSmrg    i*86:syllable:*:*)
10759bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-syllable
10769bd41f2cSmrg	exit ;;
10779bd41f2cSmrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
10789bd41f2cSmrg	echo i386-unknown-lynxos${UNAME_RELEASE}
10799bd41f2cSmrg	exit ;;
10809bd41f2cSmrg    i*86:*DOS:*:*)
10819bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-msdosdjgpp
10829bd41f2cSmrg	exit ;;
10839bd41f2cSmrg    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
10849bd41f2cSmrg	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
10859bd41f2cSmrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
10869bd41f2cSmrg		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
10879bd41f2cSmrg	else
10889bd41f2cSmrg		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
10899bd41f2cSmrg	fi
10909bd41f2cSmrg	exit ;;
10919bd41f2cSmrg    i*86:*:5:[678]*)
10929bd41f2cSmrg    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
10939bd41f2cSmrg	case `/bin/uname -X | grep "^Machine"` in
10949bd41f2cSmrg	    *486*)	     UNAME_MACHINE=i486 ;;
10959bd41f2cSmrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
10969bd41f2cSmrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
10979bd41f2cSmrg	esac
10989bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
10999bd41f2cSmrg	exit ;;
11009bd41f2cSmrg    i*86:*:3.2:*)
11019bd41f2cSmrg	if test -f /usr/options/cb.name; then
11029bd41f2cSmrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
11039bd41f2cSmrg		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
11049bd41f2cSmrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
11059bd41f2cSmrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
11069bd41f2cSmrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
11079bd41f2cSmrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
11089bd41f2cSmrg			&& UNAME_MACHINE=i586
11099bd41f2cSmrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
11109bd41f2cSmrg			&& UNAME_MACHINE=i686
11119bd41f2cSmrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
11129bd41f2cSmrg			&& UNAME_MACHINE=i686
11139bd41f2cSmrg		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
11149bd41f2cSmrg	else
11159bd41f2cSmrg		echo ${UNAME_MACHINE}-pc-sysv32
11169bd41f2cSmrg	fi
11179bd41f2cSmrg	exit ;;
11189bd41f2cSmrg    pc:*:*:*)
11199bd41f2cSmrg	# Left here for compatibility:
11209bd41f2cSmrg        # uname -m prints for DJGPP always 'pc', but it prints nothing about
11219418810dSmrg        # the processor, so we play safe by assuming i586.
11229418810dSmrg	# Note: whatever this is, it MUST be the same as what config.sub
11239418810dSmrg	# prints for the "djgpp" host, or else GDB configury will decide that
11249418810dSmrg	# this is a cross-build.
11259418810dSmrg	echo i586-pc-msdosdjgpp
11269bd41f2cSmrg        exit ;;
11279bd41f2cSmrg    Intel:Mach:3*:*)
11289bd41f2cSmrg	echo i386-pc-mach3
11299bd41f2cSmrg	exit ;;
11309bd41f2cSmrg    paragon:*:*:*)
11319bd41f2cSmrg	echo i860-intel-osf1
11329bd41f2cSmrg	exit ;;
11339bd41f2cSmrg    i860:*:4.*:*) # i860-SVR4
11349bd41f2cSmrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
11359bd41f2cSmrg	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
11369bd41f2cSmrg	else # Add other i860-SVR4 vendors below as they are discovered.
11379bd41f2cSmrg	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
11389bd41f2cSmrg	fi
11399bd41f2cSmrg	exit ;;
11409bd41f2cSmrg    mini*:CTIX:SYS*5:*)
11419bd41f2cSmrg	# "miniframe"
11429bd41f2cSmrg	echo m68010-convergent-sysv
11439bd41f2cSmrg	exit ;;
11449bd41f2cSmrg    mc68k:UNIX:SYSTEM5:3.51m)
11459bd41f2cSmrg	echo m68k-convergent-sysv
11469bd41f2cSmrg	exit ;;
11479bd41f2cSmrg    M680?0:D-NIX:5.3:*)
11489bd41f2cSmrg	echo m68k-diab-dnix
11499bd41f2cSmrg	exit ;;
11509bd41f2cSmrg    M68*:*:R3V[5678]*:*)
11519bd41f2cSmrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
11529bd41f2cSmrg    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)
11539bd41f2cSmrg	OS_REL=''
11549bd41f2cSmrg	test -r /etc/.relid \
11559bd41f2cSmrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
11569bd41f2cSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
11579bd41f2cSmrg	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
11589bd41f2cSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
11599bd41f2cSmrg	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
11609bd41f2cSmrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
11619bd41f2cSmrg        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
11629bd41f2cSmrg          && { echo i486-ncr-sysv4; exit; } ;;
11639418810dSmrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
11649418810dSmrg	OS_REL='.3'
11659418810dSmrg	test -r /etc/.relid \
11669418810dSmrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
11679418810dSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
11689418810dSmrg	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
11699418810dSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
11709418810dSmrg	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
11719418810dSmrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
11729418810dSmrg	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
11739bd41f2cSmrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
11749bd41f2cSmrg	echo m68k-unknown-lynxos${UNAME_RELEASE}
11759bd41f2cSmrg	exit ;;
11769bd41f2cSmrg    mc68030:UNIX_System_V:4.*:*)
11779bd41f2cSmrg	echo m68k-atari-sysv4
11789bd41f2cSmrg	exit ;;
11799bd41f2cSmrg    TSUNAMI:LynxOS:2.*:*)
11809bd41f2cSmrg	echo sparc-unknown-lynxos${UNAME_RELEASE}
11819bd41f2cSmrg	exit ;;
11829bd41f2cSmrg    rs6000:LynxOS:2.*:*)
11839bd41f2cSmrg	echo rs6000-unknown-lynxos${UNAME_RELEASE}
11849bd41f2cSmrg	exit ;;
11859bd41f2cSmrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
11869bd41f2cSmrg	echo powerpc-unknown-lynxos${UNAME_RELEASE}
11879bd41f2cSmrg	exit ;;
11889bd41f2cSmrg    SM[BE]S:UNIX_SV:*:*)
11899bd41f2cSmrg	echo mips-dde-sysv${UNAME_RELEASE}
11909bd41f2cSmrg	exit ;;
11919bd41f2cSmrg    RM*:ReliantUNIX-*:*:*)
11929bd41f2cSmrg	echo mips-sni-sysv4
11939bd41f2cSmrg	exit ;;
11949bd41f2cSmrg    RM*:SINIX-*:*:*)
11959bd41f2cSmrg	echo mips-sni-sysv4
11969bd41f2cSmrg	exit ;;
11979bd41f2cSmrg    *:SINIX-*:*:*)
11989bd41f2cSmrg	if uname -p 2>/dev/null >/dev/null ; then
11999bd41f2cSmrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
12009bd41f2cSmrg		echo ${UNAME_MACHINE}-sni-sysv4
12019bd41f2cSmrg	else
12029bd41f2cSmrg		echo ns32k-sni-sysv
12039bd41f2cSmrg	fi
12049bd41f2cSmrg	exit ;;
12059bd41f2cSmrg    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
12069bd41f2cSmrg                      # says <Richard.M.Bartel@ccMail.Census.GOV>
12079bd41f2cSmrg        echo i586-unisys-sysv4
12089bd41f2cSmrg        exit ;;
12099bd41f2cSmrg    *:UNIX_System_V:4*:FTX*)
12109bd41f2cSmrg	# From Gerald Hewes <hewes@openmarket.com>.
12119bd41f2cSmrg	# How about differentiating between stratus architectures? -djm
12129bd41f2cSmrg	echo hppa1.1-stratus-sysv4
12139bd41f2cSmrg	exit ;;
12149bd41f2cSmrg    *:*:*:FTX*)
12159bd41f2cSmrg	# From seanf@swdc.stratus.com.
12169bd41f2cSmrg	echo i860-stratus-sysv4
12179bd41f2cSmrg	exit ;;
12189bd41f2cSmrg    i*86:VOS:*:*)
12199bd41f2cSmrg	# From Paul.Green@stratus.com.
12209bd41f2cSmrg	echo ${UNAME_MACHINE}-stratus-vos
12219bd41f2cSmrg	exit ;;
12229bd41f2cSmrg    *:VOS:*:*)
12239bd41f2cSmrg	# From Paul.Green@stratus.com.
12249bd41f2cSmrg	echo hppa1.1-stratus-vos
12259bd41f2cSmrg	exit ;;
12269bd41f2cSmrg    mc68*:A/UX:*:*)
12279bd41f2cSmrg	echo m68k-apple-aux${UNAME_RELEASE}
12289bd41f2cSmrg	exit ;;
12299bd41f2cSmrg    news*:NEWS-OS:6*:*)
12309bd41f2cSmrg	echo mips-sony-newsos6
12319bd41f2cSmrg	exit ;;
12329bd41f2cSmrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
12339bd41f2cSmrg	if [ -d /usr/nec ]; then
12349bd41f2cSmrg	        echo mips-nec-sysv${UNAME_RELEASE}
12359bd41f2cSmrg	else
12369bd41f2cSmrg	        echo mips-unknown-sysv${UNAME_RELEASE}
12379bd41f2cSmrg	fi
12389bd41f2cSmrg        exit ;;
12399bd41f2cSmrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
12409bd41f2cSmrg	echo powerpc-be-beos
12419bd41f2cSmrg	exit ;;
12429bd41f2cSmrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
12439bd41f2cSmrg	echo powerpc-apple-beos
12449bd41f2cSmrg	exit ;;
12459bd41f2cSmrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
12469bd41f2cSmrg	echo i586-pc-beos
12479bd41f2cSmrg	exit ;;
12489418810dSmrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
12499418810dSmrg	echo i586-pc-haiku
12509418810dSmrg	exit ;;
12519bd41f2cSmrg    SX-4:SUPER-UX:*:*)
12529bd41f2cSmrg	echo sx4-nec-superux${UNAME_RELEASE}
12539bd41f2cSmrg	exit ;;
12549bd41f2cSmrg    SX-5:SUPER-UX:*:*)
12559bd41f2cSmrg	echo sx5-nec-superux${UNAME_RELEASE}
12569bd41f2cSmrg	exit ;;
12579bd41f2cSmrg    SX-6:SUPER-UX:*:*)
12589bd41f2cSmrg	echo sx6-nec-superux${UNAME_RELEASE}
12599bd41f2cSmrg	exit ;;
12609418810dSmrg    SX-7:SUPER-UX:*:*)
12619418810dSmrg	echo sx7-nec-superux${UNAME_RELEASE}
12629418810dSmrg	exit ;;
12639418810dSmrg    SX-8:SUPER-UX:*:*)
12649418810dSmrg	echo sx8-nec-superux${UNAME_RELEASE}
12659418810dSmrg	exit ;;
12669418810dSmrg    SX-8R:SUPER-UX:*:*)
12679418810dSmrg	echo sx8r-nec-superux${UNAME_RELEASE}
12689418810dSmrg	exit ;;
12699bd41f2cSmrg    Power*:Rhapsody:*:*)
12709bd41f2cSmrg	echo powerpc-apple-rhapsody${UNAME_RELEASE}
12719bd41f2cSmrg	exit ;;
12729bd41f2cSmrg    *:Rhapsody:*:*)
12739bd41f2cSmrg	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
12749bd41f2cSmrg	exit ;;
12759bd41f2cSmrg    *:Darwin:*:*)
12769bd41f2cSmrg	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
12779bd41f2cSmrg	case $UNAME_PROCESSOR in
12789bd41f2cSmrg	    unknown) UNAME_PROCESSOR=powerpc ;;
12799bd41f2cSmrg	esac
12809bd41f2cSmrg	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
12819bd41f2cSmrg	exit ;;
12829bd41f2cSmrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
12839bd41f2cSmrg	UNAME_PROCESSOR=`uname -p`
12849bd41f2cSmrg	if test "$UNAME_PROCESSOR" = "x86"; then
12859bd41f2cSmrg		UNAME_PROCESSOR=i386
12869bd41f2cSmrg		UNAME_MACHINE=pc
12879bd41f2cSmrg	fi
12889bd41f2cSmrg	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
12899bd41f2cSmrg	exit ;;
12909bd41f2cSmrg    *:QNX:*:4*)
12919bd41f2cSmrg	echo i386-pc-qnx
12929bd41f2cSmrg	exit ;;
12939bd41f2cSmrg    NSE-?:NONSTOP_KERNEL:*:*)
12949bd41f2cSmrg	echo nse-tandem-nsk${UNAME_RELEASE}
12959bd41f2cSmrg	exit ;;
12969bd41f2cSmrg    NSR-?:NONSTOP_KERNEL:*:*)
12979bd41f2cSmrg	echo nsr-tandem-nsk${UNAME_RELEASE}
12989bd41f2cSmrg	exit ;;
12999bd41f2cSmrg    *:NonStop-UX:*:*)
13009bd41f2cSmrg	echo mips-compaq-nonstopux
13019bd41f2cSmrg	exit ;;
13029bd41f2cSmrg    BS2000:POSIX*:*:*)
13039bd41f2cSmrg	echo bs2000-siemens-sysv
13049bd41f2cSmrg	exit ;;
13059bd41f2cSmrg    DS/*:UNIX_System_V:*:*)
13069bd41f2cSmrg	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
13079bd41f2cSmrg	exit ;;
13089bd41f2cSmrg    *:Plan9:*:*)
13099bd41f2cSmrg	# "uname -m" is not consistent, so use $cputype instead. 386
13109bd41f2cSmrg	# is converted to i386 for consistency with other x86
13119bd41f2cSmrg	# operating systems.
13129bd41f2cSmrg	if test "$cputype" = "386"; then
13139bd41f2cSmrg	    UNAME_MACHINE=i386
13149bd41f2cSmrg	else
13159bd41f2cSmrg	    UNAME_MACHINE="$cputype"
13169bd41f2cSmrg	fi
13179bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-plan9
13189bd41f2cSmrg	exit ;;
13199bd41f2cSmrg    *:TOPS-10:*:*)
13209bd41f2cSmrg	echo pdp10-unknown-tops10
13219bd41f2cSmrg	exit ;;
13229bd41f2cSmrg    *:TENEX:*:*)
13239bd41f2cSmrg	echo pdp10-unknown-tenex
13249bd41f2cSmrg	exit ;;
13259bd41f2cSmrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
13269bd41f2cSmrg	echo pdp10-dec-tops20
13279bd41f2cSmrg	exit ;;
13289bd41f2cSmrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
13299bd41f2cSmrg	echo pdp10-xkl-tops20
13309bd41f2cSmrg	exit ;;
13319bd41f2cSmrg    *:TOPS-20:*:*)
13329bd41f2cSmrg	echo pdp10-unknown-tops20
13339bd41f2cSmrg	exit ;;
13349bd41f2cSmrg    *:ITS:*:*)
13359bd41f2cSmrg	echo pdp10-unknown-its
13369bd41f2cSmrg	exit ;;
13379bd41f2cSmrg    SEI:*:*:SEIUX)
13389bd41f2cSmrg        echo mips-sei-seiux${UNAME_RELEASE}
13399bd41f2cSmrg	exit ;;
13409bd41f2cSmrg    *:DragonFly:*:*)
13419bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
13429bd41f2cSmrg	exit ;;
13439bd41f2cSmrg    *:*VMS:*:*)
13449bd41f2cSmrg    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
13459bd41f2cSmrg	case "${UNAME_MACHINE}" in
13469bd41f2cSmrg	    A*) echo alpha-dec-vms ; exit ;;
13479bd41f2cSmrg	    I*) echo ia64-dec-vms ; exit ;;
13489bd41f2cSmrg	    V*) echo vax-dec-vms ; exit ;;
13499bd41f2cSmrg	esac ;;
13509bd41f2cSmrg    *:XENIX:*:SysV)
13519bd41f2cSmrg	echo i386-pc-xenix
13529bd41f2cSmrg	exit ;;
13539bd41f2cSmrg    i*86:skyos:*:*)
13549bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
13559bd41f2cSmrg	exit ;;
13569bd41f2cSmrg    i*86:rdos:*:*)
13579bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-rdos
13589bd41f2cSmrg	exit ;;
13599418810dSmrg    i*86:AROS:*:*)
13609418810dSmrg	echo ${UNAME_MACHINE}-pc-aros
13619418810dSmrg	exit ;;
13629bd41f2cSmrgesac
13639bd41f2cSmrg
13649bd41f2cSmrg#echo '(No uname command or uname output not recognized.)' 1>&2
13659bd41f2cSmrg#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
13669bd41f2cSmrg
13679bd41f2cSmrgeval $set_cc_for_build
13689bd41f2cSmrgcat >$dummy.c <<EOF
13699bd41f2cSmrg#ifdef _SEQUENT_
13709bd41f2cSmrg# include <sys/types.h>
13719bd41f2cSmrg# include <sys/utsname.h>
13729bd41f2cSmrg#endif
13739bd41f2cSmrgmain ()
13749bd41f2cSmrg{
13759bd41f2cSmrg#if defined (sony)
13769bd41f2cSmrg#if defined (MIPSEB)
13779bd41f2cSmrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
13789bd41f2cSmrg     I don't know....  */
13799bd41f2cSmrg  printf ("mips-sony-bsd\n"); exit (0);
13809bd41f2cSmrg#else
13819bd41f2cSmrg#include <sys/param.h>
13829bd41f2cSmrg  printf ("m68k-sony-newsos%s\n",
13839bd41f2cSmrg#ifdef NEWSOS4
13849bd41f2cSmrg          "4"
13859bd41f2cSmrg#else
13869bd41f2cSmrg	  ""
13879bd41f2cSmrg#endif
13889bd41f2cSmrg         ); exit (0);
13899bd41f2cSmrg#endif
13909bd41f2cSmrg#endif
13919bd41f2cSmrg
13929bd41f2cSmrg#if defined (__arm) && defined (__acorn) && defined (__unix)
13939bd41f2cSmrg  printf ("arm-acorn-riscix\n"); exit (0);
13949bd41f2cSmrg#endif
13959bd41f2cSmrg
13969bd41f2cSmrg#if defined (hp300) && !defined (hpux)
13979bd41f2cSmrg  printf ("m68k-hp-bsd\n"); exit (0);
13989bd41f2cSmrg#endif
13999bd41f2cSmrg
14009bd41f2cSmrg#if defined (NeXT)
14019bd41f2cSmrg#if !defined (__ARCHITECTURE__)
14029bd41f2cSmrg#define __ARCHITECTURE__ "m68k"
14039bd41f2cSmrg#endif
14049bd41f2cSmrg  int version;
14059bd41f2cSmrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
14069bd41f2cSmrg  if (version < 4)
14079bd41f2cSmrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
14089bd41f2cSmrg  else
14099bd41f2cSmrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
14109bd41f2cSmrg  exit (0);
14119bd41f2cSmrg#endif
14129bd41f2cSmrg
14139bd41f2cSmrg#if defined (MULTIMAX) || defined (n16)
14149bd41f2cSmrg#if defined (UMAXV)
14159bd41f2cSmrg  printf ("ns32k-encore-sysv\n"); exit (0);
14169bd41f2cSmrg#else
14179bd41f2cSmrg#if defined (CMU)
14189bd41f2cSmrg  printf ("ns32k-encore-mach\n"); exit (0);
14199bd41f2cSmrg#else
14209bd41f2cSmrg  printf ("ns32k-encore-bsd\n"); exit (0);
14219bd41f2cSmrg#endif
14229bd41f2cSmrg#endif
14239bd41f2cSmrg#endif
14249bd41f2cSmrg
14259bd41f2cSmrg#if defined (__386BSD__)
14269bd41f2cSmrg  printf ("i386-pc-bsd\n"); exit (0);
14279bd41f2cSmrg#endif
14289bd41f2cSmrg
14299bd41f2cSmrg#if defined (sequent)
14309bd41f2cSmrg#if defined (i386)
14319bd41f2cSmrg  printf ("i386-sequent-dynix\n"); exit (0);
14329bd41f2cSmrg#endif
14339bd41f2cSmrg#if defined (ns32000)
14349bd41f2cSmrg  printf ("ns32k-sequent-dynix\n"); exit (0);
14359bd41f2cSmrg#endif
14369bd41f2cSmrg#endif
14379bd41f2cSmrg
14389bd41f2cSmrg#if defined (_SEQUENT_)
14399bd41f2cSmrg    struct utsname un;
14409bd41f2cSmrg
14419bd41f2cSmrg    uname(&un);
14429bd41f2cSmrg
14439bd41f2cSmrg    if (strncmp(un.version, "V2", 2) == 0) {
14449bd41f2cSmrg	printf ("i386-sequent-ptx2\n"); exit (0);
14459bd41f2cSmrg    }
14469bd41f2cSmrg    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
14479bd41f2cSmrg	printf ("i386-sequent-ptx1\n"); exit (0);
14489bd41f2cSmrg    }
14499bd41f2cSmrg    printf ("i386-sequent-ptx\n"); exit (0);
14509bd41f2cSmrg
14519bd41f2cSmrg#endif
14529bd41f2cSmrg
14539bd41f2cSmrg#if defined (vax)
14549bd41f2cSmrg# if !defined (ultrix)
14559bd41f2cSmrg#  include <sys/param.h>
14569bd41f2cSmrg#  if defined (BSD)
14579bd41f2cSmrg#   if BSD == 43
14589bd41f2cSmrg      printf ("vax-dec-bsd4.3\n"); exit (0);
14599bd41f2cSmrg#   else
14609bd41f2cSmrg#    if BSD == 199006
14619bd41f2cSmrg      printf ("vax-dec-bsd4.3reno\n"); exit (0);
14629bd41f2cSmrg#    else
14639bd41f2cSmrg      printf ("vax-dec-bsd\n"); exit (0);
14649bd41f2cSmrg#    endif
14659bd41f2cSmrg#   endif
14669bd41f2cSmrg#  else
14679bd41f2cSmrg    printf ("vax-dec-bsd\n"); exit (0);
14689bd41f2cSmrg#  endif
14699bd41f2cSmrg# else
14709bd41f2cSmrg    printf ("vax-dec-ultrix\n"); exit (0);
14719bd41f2cSmrg# endif
14729bd41f2cSmrg#endif
14739bd41f2cSmrg
14749bd41f2cSmrg#if defined (alliant) && defined (i860)
14759bd41f2cSmrg  printf ("i860-alliant-bsd\n"); exit (0);
14769bd41f2cSmrg#endif
14779bd41f2cSmrg
14789bd41f2cSmrg  exit (1);
14799bd41f2cSmrg}
14809bd41f2cSmrgEOF
14819bd41f2cSmrg
14829bd41f2cSmrg$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
14839bd41f2cSmrg	{ echo "$SYSTEM_NAME"; exit; }
14849bd41f2cSmrg
14859bd41f2cSmrg# Apollos put the system type in the environment.
14869bd41f2cSmrg
14879bd41f2cSmrgtest -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
14889bd41f2cSmrg
14899bd41f2cSmrg# Convex versions that predate uname can use getsysinfo(1)
14909bd41f2cSmrg
14919bd41f2cSmrgif [ -x /usr/convex/getsysinfo ]
14929bd41f2cSmrgthen
14939bd41f2cSmrg    case `getsysinfo -f cpu_type` in
14949bd41f2cSmrg    c1*)
14959bd41f2cSmrg	echo c1-convex-bsd
14969bd41f2cSmrg	exit ;;
14979bd41f2cSmrg    c2*)
14989bd41f2cSmrg	if getsysinfo -f scalar_acc
14999bd41f2cSmrg	then echo c32-convex-bsd
15009bd41f2cSmrg	else echo c2-convex-bsd
15019bd41f2cSmrg	fi
15029bd41f2cSmrg	exit ;;
15039bd41f2cSmrg    c34*)
15049bd41f2cSmrg	echo c34-convex-bsd
15059bd41f2cSmrg	exit ;;
15069bd41f2cSmrg    c38*)
15079bd41f2cSmrg	echo c38-convex-bsd
15089bd41f2cSmrg	exit ;;
15099bd41f2cSmrg    c4*)
15109bd41f2cSmrg	echo c4-convex-bsd
15119bd41f2cSmrg	exit ;;
15129bd41f2cSmrg    esac
15139bd41f2cSmrgfi
15149bd41f2cSmrg
15159bd41f2cSmrgcat >&2 <<EOF
15169bd41f2cSmrg$0: unable to guess system type
15179bd41f2cSmrg
15189bd41f2cSmrgThis script, last modified $timestamp, has failed to recognize
15199bd41f2cSmrgthe operating system you are using. It is advised that you
15209bd41f2cSmrgdownload the most up to date version of the config scripts from
15219bd41f2cSmrg
15229418810dSmrg  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
15239bd41f2cSmrgand
15249418810dSmrg  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
15259bd41f2cSmrg
15269bd41f2cSmrgIf the version you run ($0) is already up to date, please
15279bd41f2cSmrgsend the following data and any information you think might be
15289bd41f2cSmrgpertinent to <config-patches@gnu.org> in order to provide the needed
15299bd41f2cSmrginformation to handle your system.
15309bd41f2cSmrg
15319bd41f2cSmrgconfig.guess timestamp = $timestamp
15329bd41f2cSmrg
15339bd41f2cSmrguname -m = `(uname -m) 2>/dev/null || echo unknown`
15349bd41f2cSmrguname -r = `(uname -r) 2>/dev/null || echo unknown`
15359bd41f2cSmrguname -s = `(uname -s) 2>/dev/null || echo unknown`
15369bd41f2cSmrguname -v = `(uname -v) 2>/dev/null || echo unknown`
15379bd41f2cSmrg
15389bd41f2cSmrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
15399bd41f2cSmrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
15409bd41f2cSmrg
15419bd41f2cSmrghostinfo               = `(hostinfo) 2>/dev/null`
15429bd41f2cSmrg/bin/universe          = `(/bin/universe) 2>/dev/null`
15439bd41f2cSmrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
15449bd41f2cSmrg/bin/arch              = `(/bin/arch) 2>/dev/null`
15459bd41f2cSmrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
15469bd41f2cSmrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
15479bd41f2cSmrg
15489bd41f2cSmrgUNAME_MACHINE = ${UNAME_MACHINE}
15499bd41f2cSmrgUNAME_RELEASE = ${UNAME_RELEASE}
15509bd41f2cSmrgUNAME_SYSTEM  = ${UNAME_SYSTEM}
15519bd41f2cSmrgUNAME_VERSION = ${UNAME_VERSION}
15529bd41f2cSmrgEOF
15539bd41f2cSmrg
15549bd41f2cSmrgexit 1
15559bd41f2cSmrg
15569bd41f2cSmrg# Local variables:
15579bd41f2cSmrg# eval: (add-hook 'write-file-hooks 'time-stamp)
15589bd41f2cSmrg# time-stamp-start: "timestamp='"
15599bd41f2cSmrg# time-stamp-format: "%:y-%02m-%02d"
15609bd41f2cSmrg# time-stamp-end: "'"
15619bd41f2cSmrg# End:
1562