config.guess revision 123e2cc7
17da8b7e3Smrg#! /bin/sh
27da8b7e3Smrg# Attempt to guess a canonical system name.
37da8b7e3Smrg#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4123e2cc7Smrg#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
5123e2cc7Smrg#   Free Software Foundation, Inc.
67da8b7e3Smrg
7123e2cc7Smrgtimestamp='2009-04-27'
87da8b7e3Smrg
97da8b7e3Smrg# This file is free software; you can redistribute it and/or modify it
107da8b7e3Smrg# under the terms of the GNU General Public License as published by
117da8b7e3Smrg# the Free Software Foundation; either version 2 of the License, or
127da8b7e3Smrg# (at your option) any later version.
137da8b7e3Smrg#
147da8b7e3Smrg# This program is distributed in the hope that it will be useful, but
157da8b7e3Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
167da8b7e3Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
177da8b7e3Smrg# General Public License for more details.
187da8b7e3Smrg#
197da8b7e3Smrg# You should have received a copy of the GNU General Public License
207da8b7e3Smrg# along with this program; if not, write to the Free Software
217da8b7e3Smrg# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
227da8b7e3Smrg# 02110-1301, USA.
237da8b7e3Smrg#
247da8b7e3Smrg# As a special exception to the GNU General Public License, if you
257da8b7e3Smrg# distribute this file as part of a program that contains a
267da8b7e3Smrg# configuration script generated by Autoconf, you may include it under
277da8b7e3Smrg# the same distribution terms that you use for the rest of that program.
287da8b7e3Smrg
297da8b7e3Smrg
307da8b7e3Smrg# Originally written by Per Bothner <per@bothner.com>.
317da8b7e3Smrg# Please send patches to <config-patches@gnu.org>.  Submit a context
327da8b7e3Smrg# diff and a properly formatted ChangeLog entry.
337da8b7e3Smrg#
347da8b7e3Smrg# This script attempts to guess a canonical system name similar to
357da8b7e3Smrg# config.sub.  If it succeeds, it prints the system name on stdout, and
367da8b7e3Smrg# exits with 0.  Otherwise, it exits with 1.
377da8b7e3Smrg#
387da8b7e3Smrg# The plan is that this can be called by configure scripts if you
397da8b7e3Smrg# don't specify an explicit build system type.
407da8b7e3Smrg
417da8b7e3Smrgme=`echo "$0" | sed -e 's,.*/,,'`
427da8b7e3Smrg
437da8b7e3Smrgusage="\
447da8b7e3SmrgUsage: $0 [OPTION]
457da8b7e3Smrg
467da8b7e3SmrgOutput the configuration name of the system \`$me' is run on.
477da8b7e3Smrg
487da8b7e3SmrgOperation modes:
497da8b7e3Smrg  -h, --help         print this help, then exit
507da8b7e3Smrg  -t, --time-stamp   print date of last modification, then exit
517da8b7e3Smrg  -v, --version      print version number, then exit
527da8b7e3Smrg
537da8b7e3SmrgReport bugs and patches to <config-patches@gnu.org>."
547da8b7e3Smrg
557da8b7e3Smrgversion="\
567da8b7e3SmrgGNU config.guess ($timestamp)
577da8b7e3Smrg
587da8b7e3SmrgOriginally written by Per Bothner.
59123e2cc7SmrgCopyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
60123e2cc7Smrg2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
617da8b7e3Smrg
627da8b7e3SmrgThis is free software; see the source for copying conditions.  There is NO
637da8b7e3Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
647da8b7e3Smrg
657da8b7e3Smrghelp="
667da8b7e3SmrgTry \`$me --help' for more information."
677da8b7e3Smrg
687da8b7e3Smrg# Parse command line
697da8b7e3Smrgwhile test $# -gt 0 ; do
707da8b7e3Smrg  case $1 in
717da8b7e3Smrg    --time-stamp | --time* | -t )
727da8b7e3Smrg       echo "$timestamp" ; exit ;;
737da8b7e3Smrg    --version | -v )
747da8b7e3Smrg       echo "$version" ; exit ;;
757da8b7e3Smrg    --help | --h* | -h )
767da8b7e3Smrg       echo "$usage"; exit ;;
777da8b7e3Smrg    -- )     # Stop option processing
787da8b7e3Smrg       shift; break ;;
797da8b7e3Smrg    - )	# Use stdin as input.
807da8b7e3Smrg       break ;;
817da8b7e3Smrg    -* )
827da8b7e3Smrg       echo "$me: invalid option $1$help" >&2
837da8b7e3Smrg       exit 1 ;;
847da8b7e3Smrg    * )
857da8b7e3Smrg       break ;;
867da8b7e3Smrg  esac
877da8b7e3Smrgdone
887da8b7e3Smrg
897da8b7e3Smrgif test $# != 0; then
907da8b7e3Smrg  echo "$me: too many arguments$help" >&2
917da8b7e3Smrg  exit 1
927da8b7e3Smrgfi
937da8b7e3Smrg
947da8b7e3Smrgtrap 'exit 1' 1 2 15
957da8b7e3Smrg
967da8b7e3Smrg# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
977da8b7e3Smrg# compiler to aid in system detection is discouraged as it requires
987da8b7e3Smrg# temporary files to be created and, as you can see below, it is a
997da8b7e3Smrg# headache to deal with in a portable fashion.
1007da8b7e3Smrg
1017da8b7e3Smrg# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
1027da8b7e3Smrg# use `HOST_CC' if defined, but it is deprecated.
1037da8b7e3Smrg
1047da8b7e3Smrg# Portable tmp directory creation inspired by the Autoconf team.
1057da8b7e3Smrg
1067da8b7e3Smrgset_cc_for_build='
1077da8b7e3Smrgtrap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
1087da8b7e3Smrgtrap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
1097da8b7e3Smrg: ${TMPDIR=/tmp} ;
110123e2cc7Smrg { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
1117da8b7e3Smrg { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
1127da8b7e3Smrg { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
1137da8b7e3Smrg { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
1147da8b7e3Smrgdummy=$tmp/dummy ;
1157da8b7e3Smrgtmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
1167da8b7e3Smrgcase $CC_FOR_BUILD,$HOST_CC,$CC in
1177da8b7e3Smrg ,,)    echo "int x;" > $dummy.c ;
1187da8b7e3Smrg	for c in cc gcc c89 c99 ; do
1197da8b7e3Smrg	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
1207da8b7e3Smrg	     CC_FOR_BUILD="$c"; break ;
1217da8b7e3Smrg	  fi ;
1227da8b7e3Smrg	done ;
1237da8b7e3Smrg	if test x"$CC_FOR_BUILD" = x ; then
1247da8b7e3Smrg	  CC_FOR_BUILD=no_compiler_found ;
1257da8b7e3Smrg	fi
1267da8b7e3Smrg	;;
1277da8b7e3Smrg ,,*)   CC_FOR_BUILD=$CC ;;
1287da8b7e3Smrg ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
1297da8b7e3Smrgesac ; set_cc_for_build= ;'
1307da8b7e3Smrg
1317da8b7e3Smrg# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
1327da8b7e3Smrg# (ghazi@noc.rutgers.edu 1994-08-24)
1337da8b7e3Smrgif (test -f /.attbin/uname) >/dev/null 2>&1 ; then
1347da8b7e3Smrg	PATH=$PATH:/.attbin ; export PATH
1357da8b7e3Smrgfi
1367da8b7e3Smrg
1377da8b7e3SmrgUNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
1387da8b7e3SmrgUNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
1397da8b7e3SmrgUNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
1407da8b7e3SmrgUNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
1417da8b7e3Smrg
1427da8b7e3Smrg# Note: order is significant - the case branches are not exclusive.
1437da8b7e3Smrg
1447da8b7e3Smrgcase "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
1457da8b7e3Smrg    *:NetBSD:*:*)
1467da8b7e3Smrg	# NetBSD (nbsd) targets should (where applicable) match one or
1477da8b7e3Smrg	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
1487da8b7e3Smrg	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
1497da8b7e3Smrg	# switched to ELF, *-*-netbsd* would select the old
1507da8b7e3Smrg	# object file format.  This provides both forward
1517da8b7e3Smrg	# compatibility and a consistent mechanism for selecting the
1527da8b7e3Smrg	# object file format.
1537da8b7e3Smrg	#
1547da8b7e3Smrg	# Note: NetBSD doesn't particularly care about the vendor
1557da8b7e3Smrg	# portion of the name.  We always set it to "unknown".
1567da8b7e3Smrg	sysctl="sysctl -n hw.machine_arch"
1577da8b7e3Smrg	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
1587da8b7e3Smrg	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
1597da8b7e3Smrg	case "${UNAME_MACHINE_ARCH}" in
1607da8b7e3Smrg	    armeb) machine=armeb-unknown ;;
1617da8b7e3Smrg	    arm*) machine=arm-unknown ;;
1627da8b7e3Smrg	    sh3el) machine=shl-unknown ;;
1637da8b7e3Smrg	    sh3eb) machine=sh-unknown ;;
164123e2cc7Smrg	    sh5el) machine=sh5le-unknown ;;
1657da8b7e3Smrg	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
1667da8b7e3Smrg	esac
1677da8b7e3Smrg	# The Operating System including object format, if it has switched
1687da8b7e3Smrg	# to ELF recently, or will in the future.
1697da8b7e3Smrg	case "${UNAME_MACHINE_ARCH}" in
1707da8b7e3Smrg	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
1717da8b7e3Smrg		eval $set_cc_for_build
1727da8b7e3Smrg		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
1737da8b7e3Smrg			| grep __ELF__ >/dev/null
1747da8b7e3Smrg		then
1757da8b7e3Smrg		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
1767da8b7e3Smrg		    # Return netbsd for either.  FIX?
1777da8b7e3Smrg		    os=netbsd
1787da8b7e3Smrg		else
1797da8b7e3Smrg		    os=netbsdelf
1807da8b7e3Smrg		fi
1817da8b7e3Smrg		;;
1827da8b7e3Smrg	    *)
1837da8b7e3Smrg	        os=netbsd
1847da8b7e3Smrg		;;
1857da8b7e3Smrg	esac
1867da8b7e3Smrg	# The OS release
1877da8b7e3Smrg	# Debian GNU/NetBSD machines have a different userland, and
1887da8b7e3Smrg	# thus, need a distinct triplet. However, they do not need
1897da8b7e3Smrg	# kernel version information, so it can be replaced with a
1907da8b7e3Smrg	# suitable tag, in the style of linux-gnu.
1917da8b7e3Smrg	case "${UNAME_VERSION}" in
1927da8b7e3Smrg	    Debian*)
1937da8b7e3Smrg		release='-gnu'
1947da8b7e3Smrg		;;
1957da8b7e3Smrg	    *)
1967da8b7e3Smrg		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
1977da8b7e3Smrg		;;
1987da8b7e3Smrg	esac
1997da8b7e3Smrg	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
2007da8b7e3Smrg	# contains redundant information, the shorter form:
2017da8b7e3Smrg	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
2027da8b7e3Smrg	echo "${machine}-${os}${release}"
2037da8b7e3Smrg	exit ;;
2047da8b7e3Smrg    *:OpenBSD:*:*)
2057da8b7e3Smrg	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
2067da8b7e3Smrg	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
2077da8b7e3Smrg	exit ;;
2087da8b7e3Smrg    *:ekkoBSD:*:*)
2097da8b7e3Smrg	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
2107da8b7e3Smrg	exit ;;
211123e2cc7Smrg    *:SolidBSD:*:*)
212123e2cc7Smrg	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
213123e2cc7Smrg	exit ;;
2147da8b7e3Smrg    macppc:MirBSD:*:*)
215123e2cc7Smrg	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
2167da8b7e3Smrg	exit ;;
2177da8b7e3Smrg    *:MirBSD:*:*)
2187da8b7e3Smrg	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
2197da8b7e3Smrg	exit ;;
2207da8b7e3Smrg    alpha:OSF1:*:*)
2217da8b7e3Smrg	case $UNAME_RELEASE in
2227da8b7e3Smrg	*4.0)
2237da8b7e3Smrg		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
2247da8b7e3Smrg		;;
2257da8b7e3Smrg	*5.*)
2267da8b7e3Smrg	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
2277da8b7e3Smrg		;;
2287da8b7e3Smrg	esac
2297da8b7e3Smrg	# According to Compaq, /usr/sbin/psrinfo has been available on
2307da8b7e3Smrg	# OSF/1 and Tru64 systems produced since 1995.  I hope that
2317da8b7e3Smrg	# covers most systems running today.  This code pipes the CPU
2327da8b7e3Smrg	# types through head -n 1, so we only detect the type of CPU 0.
2337da8b7e3Smrg	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
2347da8b7e3Smrg	case "$ALPHA_CPU_TYPE" in
2357da8b7e3Smrg	    "EV4 (21064)")
2367da8b7e3Smrg		UNAME_MACHINE="alpha" ;;
2377da8b7e3Smrg	    "EV4.5 (21064)")
2387da8b7e3Smrg		UNAME_MACHINE="alpha" ;;
2397da8b7e3Smrg	    "LCA4 (21066/21068)")
2407da8b7e3Smrg		UNAME_MACHINE="alpha" ;;
2417da8b7e3Smrg	    "EV5 (21164)")
2427da8b7e3Smrg		UNAME_MACHINE="alphaev5" ;;
2437da8b7e3Smrg	    "EV5.6 (21164A)")
2447da8b7e3Smrg		UNAME_MACHINE="alphaev56" ;;
2457da8b7e3Smrg	    "EV5.6 (21164PC)")
2467da8b7e3Smrg		UNAME_MACHINE="alphapca56" ;;
2477da8b7e3Smrg	    "EV5.7 (21164PC)")
2487da8b7e3Smrg		UNAME_MACHINE="alphapca57" ;;
2497da8b7e3Smrg	    "EV6 (21264)")
2507da8b7e3Smrg		UNAME_MACHINE="alphaev6" ;;
2517da8b7e3Smrg	    "EV6.7 (21264A)")
2527da8b7e3Smrg		UNAME_MACHINE="alphaev67" ;;
2537da8b7e3Smrg	    "EV6.8CB (21264C)")
2547da8b7e3Smrg		UNAME_MACHINE="alphaev68" ;;
2557da8b7e3Smrg	    "EV6.8AL (21264B)")
2567da8b7e3Smrg		UNAME_MACHINE="alphaev68" ;;
2577da8b7e3Smrg	    "EV6.8CX (21264D)")
2587da8b7e3Smrg		UNAME_MACHINE="alphaev68" ;;
2597da8b7e3Smrg	    "EV6.9A (21264/EV69A)")
2607da8b7e3Smrg		UNAME_MACHINE="alphaev69" ;;
2617da8b7e3Smrg	    "EV7 (21364)")
2627da8b7e3Smrg		UNAME_MACHINE="alphaev7" ;;
2637da8b7e3Smrg	    "EV7.9 (21364A)")
2647da8b7e3Smrg		UNAME_MACHINE="alphaev79" ;;
2657da8b7e3Smrg	esac
2667da8b7e3Smrg	# A Pn.n version is a patched version.
2677da8b7e3Smrg	# A Vn.n version is a released version.
2687da8b7e3Smrg	# A Tn.n version is a released field test version.
2697da8b7e3Smrg	# A Xn.n version is an unreleased experimental baselevel.
2707da8b7e3Smrg	# 1.2 uses "1.2" for uname -r.
2717da8b7e3Smrg	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
2727da8b7e3Smrg	exit ;;
2737da8b7e3Smrg    Alpha\ *:Windows_NT*:*)
2747da8b7e3Smrg	# How do we know it's Interix rather than the generic POSIX subsystem?
2757da8b7e3Smrg	# Should we change UNAME_MACHINE based on the output of uname instead
2767da8b7e3Smrg	# of the specific Alpha model?
2777da8b7e3Smrg	echo alpha-pc-interix
2787da8b7e3Smrg	exit ;;
2797da8b7e3Smrg    21064:Windows_NT:50:3)
2807da8b7e3Smrg	echo alpha-dec-winnt3.5
2817da8b7e3Smrg	exit ;;
2827da8b7e3Smrg    Amiga*:UNIX_System_V:4.0:*)
2837da8b7e3Smrg	echo m68k-unknown-sysv4
2847da8b7e3Smrg	exit ;;
2857da8b7e3Smrg    *:[Aa]miga[Oo][Ss]:*:*)
2867da8b7e3Smrg	echo ${UNAME_MACHINE}-unknown-amigaos
2877da8b7e3Smrg	exit ;;
2887da8b7e3Smrg    *:[Mm]orph[Oo][Ss]:*:*)
2897da8b7e3Smrg	echo ${UNAME_MACHINE}-unknown-morphos
2907da8b7e3Smrg	exit ;;
2917da8b7e3Smrg    *:OS/390:*:*)
2927da8b7e3Smrg	echo i370-ibm-openedition
2937da8b7e3Smrg	exit ;;
2947da8b7e3Smrg    *:z/VM:*:*)
2957da8b7e3Smrg	echo s390-ibm-zvmoe
2967da8b7e3Smrg	exit ;;
2977da8b7e3Smrg    *:OS400:*:*)
2987da8b7e3Smrg        echo powerpc-ibm-os400
2997da8b7e3Smrg	exit ;;
3007da8b7e3Smrg    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
3017da8b7e3Smrg	echo arm-acorn-riscix${UNAME_RELEASE}
3027da8b7e3Smrg	exit ;;
3037da8b7e3Smrg    arm:riscos:*:*|arm:RISCOS:*:*)
3047da8b7e3Smrg	echo arm-unknown-riscos
3057da8b7e3Smrg	exit ;;
3067da8b7e3Smrg    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
3077da8b7e3Smrg	echo hppa1.1-hitachi-hiuxmpp
3087da8b7e3Smrg	exit ;;
3097da8b7e3Smrg    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
3107da8b7e3Smrg	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
3117da8b7e3Smrg	if test "`(/bin/universe) 2>/dev/null`" = att ; then
3127da8b7e3Smrg		echo pyramid-pyramid-sysv3
3137da8b7e3Smrg	else
3147da8b7e3Smrg		echo pyramid-pyramid-bsd
3157da8b7e3Smrg	fi
3167da8b7e3Smrg	exit ;;
3177da8b7e3Smrg    NILE*:*:*:dcosx)
3187da8b7e3Smrg	echo pyramid-pyramid-svr4
3197da8b7e3Smrg	exit ;;
3207da8b7e3Smrg    DRS?6000:unix:4.0:6*)
3217da8b7e3Smrg	echo sparc-icl-nx6
3227da8b7e3Smrg	exit ;;
3237da8b7e3Smrg    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
3247da8b7e3Smrg	case `/usr/bin/uname -p` in
3257da8b7e3Smrg	    sparc) echo sparc-icl-nx7; exit ;;
3267da8b7e3Smrg	esac ;;
327123e2cc7Smrg    s390x:SunOS:*:*)
328123e2cc7Smrg	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
329123e2cc7Smrg	exit ;;
3307da8b7e3Smrg    sun4H:SunOS:5.*:*)
3317da8b7e3Smrg	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3327da8b7e3Smrg	exit ;;
3337da8b7e3Smrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
3347da8b7e3Smrg	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3357da8b7e3Smrg	exit ;;
336123e2cc7Smrg    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
337123e2cc7Smrg	eval $set_cc_for_build
338123e2cc7Smrg	SUN_ARCH="i386"
339123e2cc7Smrg	# If there is a compiler, see if it is configured for 64-bit objects.
340123e2cc7Smrg	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
341123e2cc7Smrg	# This test works for both compilers.
342123e2cc7Smrg	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
343123e2cc7Smrg	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
344123e2cc7Smrg		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
345123e2cc7Smrg		grep IS_64BIT_ARCH >/dev/null
346123e2cc7Smrg	    then
347123e2cc7Smrg		SUN_ARCH="x86_64"
348123e2cc7Smrg	    fi
349123e2cc7Smrg	fi
350123e2cc7Smrg	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3517da8b7e3Smrg	exit ;;
3527da8b7e3Smrg    sun4*:SunOS:6*:*)
3537da8b7e3Smrg	# According to config.sub, this is the proper way to canonicalize
3547da8b7e3Smrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
3557da8b7e3Smrg	# it's likely to be more like Solaris than SunOS4.
3567da8b7e3Smrg	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3577da8b7e3Smrg	exit ;;
3587da8b7e3Smrg    sun4*:SunOS:*:*)
3597da8b7e3Smrg	case "`/usr/bin/arch -k`" in
3607da8b7e3Smrg	    Series*|S4*)
3617da8b7e3Smrg		UNAME_RELEASE=`uname -v`
3627da8b7e3Smrg		;;
3637da8b7e3Smrg	esac
3647da8b7e3Smrg	# Japanese Language versions have a version number like `4.1.3-JL'.
3657da8b7e3Smrg	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
3667da8b7e3Smrg	exit ;;
3677da8b7e3Smrg    sun3*:SunOS:*:*)
3687da8b7e3Smrg	echo m68k-sun-sunos${UNAME_RELEASE}
3697da8b7e3Smrg	exit ;;
3707da8b7e3Smrg    sun*:*:4.2BSD:*)
3717da8b7e3Smrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
3727da8b7e3Smrg	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
3737da8b7e3Smrg	case "`/bin/arch`" in
3747da8b7e3Smrg	    sun3)
3757da8b7e3Smrg		echo m68k-sun-sunos${UNAME_RELEASE}
3767da8b7e3Smrg		;;
3777da8b7e3Smrg	    sun4)
3787da8b7e3Smrg		echo sparc-sun-sunos${UNAME_RELEASE}
3797da8b7e3Smrg		;;
3807da8b7e3Smrg	esac
3817da8b7e3Smrg	exit ;;
3827da8b7e3Smrg    aushp:SunOS:*:*)
3837da8b7e3Smrg	echo sparc-auspex-sunos${UNAME_RELEASE}
3847da8b7e3Smrg	exit ;;
3857da8b7e3Smrg    # The situation for MiNT is a little confusing.  The machine name
3867da8b7e3Smrg    # can be virtually everything (everything which is not
3877da8b7e3Smrg    # "atarist" or "atariste" at least should have a processor
3887da8b7e3Smrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
3897da8b7e3Smrg    # to the lowercase version "mint" (or "freemint").  Finally
3907da8b7e3Smrg    # the system name "TOS" denotes a system which is actually not
3917da8b7e3Smrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
3927da8b7e3Smrg    # be no problem.
3937da8b7e3Smrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
3947da8b7e3Smrg        echo m68k-atari-mint${UNAME_RELEASE}
3957da8b7e3Smrg	exit ;;
3967da8b7e3Smrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
3977da8b7e3Smrg	echo m68k-atari-mint${UNAME_RELEASE}
3987da8b7e3Smrg        exit ;;
3997da8b7e3Smrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
4007da8b7e3Smrg        echo m68k-atari-mint${UNAME_RELEASE}
4017da8b7e3Smrg	exit ;;
4027da8b7e3Smrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
4037da8b7e3Smrg        echo m68k-milan-mint${UNAME_RELEASE}
4047da8b7e3Smrg        exit ;;
4057da8b7e3Smrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
4067da8b7e3Smrg        echo m68k-hades-mint${UNAME_RELEASE}
4077da8b7e3Smrg        exit ;;
4087da8b7e3Smrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
4097da8b7e3Smrg        echo m68k-unknown-mint${UNAME_RELEASE}
4107da8b7e3Smrg        exit ;;
4117da8b7e3Smrg    m68k:machten:*:*)
4127da8b7e3Smrg	echo m68k-apple-machten${UNAME_RELEASE}
4137da8b7e3Smrg	exit ;;
4147da8b7e3Smrg    powerpc:machten:*:*)
4157da8b7e3Smrg	echo powerpc-apple-machten${UNAME_RELEASE}
4167da8b7e3Smrg	exit ;;
4177da8b7e3Smrg    RISC*:Mach:*:*)
4187da8b7e3Smrg	echo mips-dec-mach_bsd4.3
4197da8b7e3Smrg	exit ;;
4207da8b7e3Smrg    RISC*:ULTRIX:*:*)
4217da8b7e3Smrg	echo mips-dec-ultrix${UNAME_RELEASE}
4227da8b7e3Smrg	exit ;;
4237da8b7e3Smrg    VAX*:ULTRIX*:*:*)
4247da8b7e3Smrg	echo vax-dec-ultrix${UNAME_RELEASE}
4257da8b7e3Smrg	exit ;;
4267da8b7e3Smrg    2020:CLIX:*:* | 2430:CLIX:*:*)
4277da8b7e3Smrg	echo clipper-intergraph-clix${UNAME_RELEASE}
4287da8b7e3Smrg	exit ;;
4297da8b7e3Smrg    mips:*:*:UMIPS | mips:*:*:RISCos)
4307da8b7e3Smrg	eval $set_cc_for_build
4317da8b7e3Smrg	sed 's/^	//' << EOF >$dummy.c
4327da8b7e3Smrg#ifdef __cplusplus
4337da8b7e3Smrg#include <stdio.h>  /* for printf() prototype */
4347da8b7e3Smrg	int main (int argc, char *argv[]) {
4357da8b7e3Smrg#else
4367da8b7e3Smrg	int main (argc, argv) int argc; char *argv[]; {
4377da8b7e3Smrg#endif
4387da8b7e3Smrg	#if defined (host_mips) && defined (MIPSEB)
4397da8b7e3Smrg	#if defined (SYSTYPE_SYSV)
4407da8b7e3Smrg	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
4417da8b7e3Smrg	#endif
4427da8b7e3Smrg	#if defined (SYSTYPE_SVR4)
4437da8b7e3Smrg	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
4447da8b7e3Smrg	#endif
4457da8b7e3Smrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
4467da8b7e3Smrg	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
4477da8b7e3Smrg	#endif
4487da8b7e3Smrg	#endif
4497da8b7e3Smrg	  exit (-1);
4507da8b7e3Smrg	}
4517da8b7e3SmrgEOF
4527da8b7e3Smrg	$CC_FOR_BUILD -o $dummy $dummy.c &&
4537da8b7e3Smrg	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
4547da8b7e3Smrg	  SYSTEM_NAME=`$dummy $dummyarg` &&
4557da8b7e3Smrg	    { echo "$SYSTEM_NAME"; exit; }
4567da8b7e3Smrg	echo mips-mips-riscos${UNAME_RELEASE}
4577da8b7e3Smrg	exit ;;
4587da8b7e3Smrg    Motorola:PowerMAX_OS:*:*)
4597da8b7e3Smrg	echo powerpc-motorola-powermax
4607da8b7e3Smrg	exit ;;
4617da8b7e3Smrg    Motorola:*:4.3:PL8-*)
4627da8b7e3Smrg	echo powerpc-harris-powermax
4637da8b7e3Smrg	exit ;;
4647da8b7e3Smrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
4657da8b7e3Smrg	echo powerpc-harris-powermax
4667da8b7e3Smrg	exit ;;
4677da8b7e3Smrg    Night_Hawk:Power_UNIX:*:*)
4687da8b7e3Smrg	echo powerpc-harris-powerunix
4697da8b7e3Smrg	exit ;;
4707da8b7e3Smrg    m88k:CX/UX:7*:*)
4717da8b7e3Smrg	echo m88k-harris-cxux7
4727da8b7e3Smrg	exit ;;
4737da8b7e3Smrg    m88k:*:4*:R4*)
4747da8b7e3Smrg	echo m88k-motorola-sysv4
4757da8b7e3Smrg	exit ;;
4767da8b7e3Smrg    m88k:*:3*:R3*)
4777da8b7e3Smrg	echo m88k-motorola-sysv3
4787da8b7e3Smrg	exit ;;
4797da8b7e3Smrg    AViiON:dgux:*:*)
4807da8b7e3Smrg        # DG/UX returns AViiON for all architectures
4817da8b7e3Smrg        UNAME_PROCESSOR=`/usr/bin/uname -p`
4827da8b7e3Smrg	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
4837da8b7e3Smrg	then
4847da8b7e3Smrg	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
4857da8b7e3Smrg	       [ ${TARGET_BINARY_INTERFACE}x = x ]
4867da8b7e3Smrg	    then
4877da8b7e3Smrg		echo m88k-dg-dgux${UNAME_RELEASE}
4887da8b7e3Smrg	    else
4897da8b7e3Smrg		echo m88k-dg-dguxbcs${UNAME_RELEASE}
4907da8b7e3Smrg	    fi
4917da8b7e3Smrg	else
4927da8b7e3Smrg	    echo i586-dg-dgux${UNAME_RELEASE}
4937da8b7e3Smrg	fi
4947da8b7e3Smrg 	exit ;;
4957da8b7e3Smrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
4967da8b7e3Smrg	echo m88k-dolphin-sysv3
4977da8b7e3Smrg	exit ;;
4987da8b7e3Smrg    M88*:*:R3*:*)
4997da8b7e3Smrg	# Delta 88k system running SVR3
5007da8b7e3Smrg	echo m88k-motorola-sysv3
5017da8b7e3Smrg	exit ;;
5027da8b7e3Smrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
5037da8b7e3Smrg	echo m88k-tektronix-sysv3
5047da8b7e3Smrg	exit ;;
5057da8b7e3Smrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
5067da8b7e3Smrg	echo m68k-tektronix-bsd
5077da8b7e3Smrg	exit ;;
5087da8b7e3Smrg    *:IRIX*:*:*)
5097da8b7e3Smrg	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
5107da8b7e3Smrg	exit ;;
5117da8b7e3Smrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
5127da8b7e3Smrg	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
5137da8b7e3Smrg	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
5147da8b7e3Smrg    i*86:AIX:*:*)
5157da8b7e3Smrg	echo i386-ibm-aix
5167da8b7e3Smrg	exit ;;
5177da8b7e3Smrg    ia64:AIX:*:*)
5187da8b7e3Smrg	if [ -x /usr/bin/oslevel ] ; then
5197da8b7e3Smrg		IBM_REV=`/usr/bin/oslevel`
5207da8b7e3Smrg	else
5217da8b7e3Smrg		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
5227da8b7e3Smrg	fi
5237da8b7e3Smrg	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
5247da8b7e3Smrg	exit ;;
5257da8b7e3Smrg    *:AIX:2:3)
5267da8b7e3Smrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
5277da8b7e3Smrg		eval $set_cc_for_build
5287da8b7e3Smrg		sed 's/^		//' << EOF >$dummy.c
5297da8b7e3Smrg		#include <sys/systemcfg.h>
5307da8b7e3Smrg
5317da8b7e3Smrg		main()
5327da8b7e3Smrg			{
5337da8b7e3Smrg			if (!__power_pc())
5347da8b7e3Smrg				exit(1);
5357da8b7e3Smrg			puts("powerpc-ibm-aix3.2.5");
5367da8b7e3Smrg			exit(0);
5377da8b7e3Smrg			}
5387da8b7e3SmrgEOF
5397da8b7e3Smrg		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
5407da8b7e3Smrg		then
5417da8b7e3Smrg			echo "$SYSTEM_NAME"
5427da8b7e3Smrg		else
5437da8b7e3Smrg			echo rs6000-ibm-aix3.2.5
5447da8b7e3Smrg		fi
5457da8b7e3Smrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
5467da8b7e3Smrg		echo rs6000-ibm-aix3.2.4
5477da8b7e3Smrg	else
5487da8b7e3Smrg		echo rs6000-ibm-aix3.2
5497da8b7e3Smrg	fi
5507da8b7e3Smrg	exit ;;
551123e2cc7Smrg    *:AIX:*:[456])
5527da8b7e3Smrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
5537da8b7e3Smrg	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
5547da8b7e3Smrg		IBM_ARCH=rs6000
5557da8b7e3Smrg	else
5567da8b7e3Smrg		IBM_ARCH=powerpc
5577da8b7e3Smrg	fi
5587da8b7e3Smrg	if [ -x /usr/bin/oslevel ] ; then
5597da8b7e3Smrg		IBM_REV=`/usr/bin/oslevel`
5607da8b7e3Smrg	else
5617da8b7e3Smrg		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
5627da8b7e3Smrg	fi
5637da8b7e3Smrg	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
5647da8b7e3Smrg	exit ;;
5657da8b7e3Smrg    *:AIX:*:*)
5667da8b7e3Smrg	echo rs6000-ibm-aix
5677da8b7e3Smrg	exit ;;
5687da8b7e3Smrg    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
5697da8b7e3Smrg	echo romp-ibm-bsd4.4
5707da8b7e3Smrg	exit ;;
5717da8b7e3Smrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
5727da8b7e3Smrg	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
5737da8b7e3Smrg	exit ;;                             # report: romp-ibm BSD 4.3
5747da8b7e3Smrg    *:BOSX:*:*)
5757da8b7e3Smrg	echo rs6000-bull-bosx
5767da8b7e3Smrg	exit ;;
5777da8b7e3Smrg    DPX/2?00:B.O.S.:*:*)
5787da8b7e3Smrg	echo m68k-bull-sysv3
5797da8b7e3Smrg	exit ;;
5807da8b7e3Smrg    9000/[34]??:4.3bsd:1.*:*)
5817da8b7e3Smrg	echo m68k-hp-bsd
5827da8b7e3Smrg	exit ;;
5837da8b7e3Smrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
5847da8b7e3Smrg	echo m68k-hp-bsd4.4
5857da8b7e3Smrg	exit ;;
5867da8b7e3Smrg    9000/[34678]??:HP-UX:*:*)
5877da8b7e3Smrg	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
5887da8b7e3Smrg	case "${UNAME_MACHINE}" in
5897da8b7e3Smrg	    9000/31? )            HP_ARCH=m68000 ;;
5907da8b7e3Smrg	    9000/[34]?? )         HP_ARCH=m68k ;;
5917da8b7e3Smrg	    9000/[678][0-9][0-9])
5927da8b7e3Smrg		if [ -x /usr/bin/getconf ]; then
5937da8b7e3Smrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
5947da8b7e3Smrg                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
5957da8b7e3Smrg                    case "${sc_cpu_version}" in
5967da8b7e3Smrg                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
5977da8b7e3Smrg                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
5987da8b7e3Smrg                      532)                      # CPU_PA_RISC2_0
5997da8b7e3Smrg                        case "${sc_kernel_bits}" in
6007da8b7e3Smrg                          32) HP_ARCH="hppa2.0n" ;;
6017da8b7e3Smrg                          64) HP_ARCH="hppa2.0w" ;;
6027da8b7e3Smrg			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
6037da8b7e3Smrg                        esac ;;
6047da8b7e3Smrg                    esac
6057da8b7e3Smrg		fi
6067da8b7e3Smrg		if [ "${HP_ARCH}" = "" ]; then
6077da8b7e3Smrg		    eval $set_cc_for_build
6087da8b7e3Smrg		    sed 's/^              //' << EOF >$dummy.c
6097da8b7e3Smrg
6107da8b7e3Smrg              #define _HPUX_SOURCE
6117da8b7e3Smrg              #include <stdlib.h>
6127da8b7e3Smrg              #include <unistd.h>
6137da8b7e3Smrg
6147da8b7e3Smrg              int main ()
6157da8b7e3Smrg              {
6167da8b7e3Smrg              #if defined(_SC_KERNEL_BITS)
6177da8b7e3Smrg                  long bits = sysconf(_SC_KERNEL_BITS);
6187da8b7e3Smrg              #endif
6197da8b7e3Smrg                  long cpu  = sysconf (_SC_CPU_VERSION);
6207da8b7e3Smrg
6217da8b7e3Smrg                  switch (cpu)
6227da8b7e3Smrg              	{
6237da8b7e3Smrg              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
6247da8b7e3Smrg              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
6257da8b7e3Smrg              	case CPU_PA_RISC2_0:
6267da8b7e3Smrg              #if defined(_SC_KERNEL_BITS)
6277da8b7e3Smrg              	    switch (bits)
6287da8b7e3Smrg              		{
6297da8b7e3Smrg              		case 64: puts ("hppa2.0w"); break;
6307da8b7e3Smrg              		case 32: puts ("hppa2.0n"); break;
6317da8b7e3Smrg              		default: puts ("hppa2.0"); break;
6327da8b7e3Smrg              		} break;
6337da8b7e3Smrg              #else  /* !defined(_SC_KERNEL_BITS) */
6347da8b7e3Smrg              	    puts ("hppa2.0"); break;
6357da8b7e3Smrg              #endif
6367da8b7e3Smrg              	default: puts ("hppa1.0"); break;
6377da8b7e3Smrg              	}
6387da8b7e3Smrg                  exit (0);
6397da8b7e3Smrg              }
6407da8b7e3SmrgEOF
6417da8b7e3Smrg		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
6427da8b7e3Smrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
6437da8b7e3Smrg		fi ;;
6447da8b7e3Smrg	esac
6457da8b7e3Smrg	if [ ${HP_ARCH} = "hppa2.0w" ]
6467da8b7e3Smrg	then
6477da8b7e3Smrg	    eval $set_cc_for_build
6487da8b7e3Smrg
6497da8b7e3Smrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
6507da8b7e3Smrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
6517da8b7e3Smrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
6527da8b7e3Smrg	    #
6537da8b7e3Smrg	    # $ CC_FOR_BUILD=cc ./config.guess
6547da8b7e3Smrg	    # => hppa2.0w-hp-hpux11.23
6557da8b7e3Smrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
6567da8b7e3Smrg	    # => hppa64-hp-hpux11.23
6577da8b7e3Smrg
6587da8b7e3Smrg	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
6597da8b7e3Smrg		grep __LP64__ >/dev/null
6607da8b7e3Smrg	    then
6617da8b7e3Smrg		HP_ARCH="hppa2.0w"
6627da8b7e3Smrg	    else
6637da8b7e3Smrg		HP_ARCH="hppa64"
6647da8b7e3Smrg	    fi
6657da8b7e3Smrg	fi
6667da8b7e3Smrg	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
6677da8b7e3Smrg	exit ;;
6687da8b7e3Smrg    ia64:HP-UX:*:*)
6697da8b7e3Smrg	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
6707da8b7e3Smrg	echo ia64-hp-hpux${HPUX_REV}
6717da8b7e3Smrg	exit ;;
6727da8b7e3Smrg    3050*:HI-UX:*:*)
6737da8b7e3Smrg	eval $set_cc_for_build
6747da8b7e3Smrg	sed 's/^	//' << EOF >$dummy.c
6757da8b7e3Smrg	#include <unistd.h>
6767da8b7e3Smrg	int
6777da8b7e3Smrg	main ()
6787da8b7e3Smrg	{
6797da8b7e3Smrg	  long cpu = sysconf (_SC_CPU_VERSION);
6807da8b7e3Smrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
6817da8b7e3Smrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
6827da8b7e3Smrg	     results, however.  */
6837da8b7e3Smrg	  if (CPU_IS_PA_RISC (cpu))
6847da8b7e3Smrg	    {
6857da8b7e3Smrg	      switch (cpu)
6867da8b7e3Smrg		{
6877da8b7e3Smrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
6887da8b7e3Smrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
6897da8b7e3Smrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
6907da8b7e3Smrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
6917da8b7e3Smrg		}
6927da8b7e3Smrg	    }
6937da8b7e3Smrg	  else if (CPU_IS_HP_MC68K (cpu))
6947da8b7e3Smrg	    puts ("m68k-hitachi-hiuxwe2");
6957da8b7e3Smrg	  else puts ("unknown-hitachi-hiuxwe2");
6967da8b7e3Smrg	  exit (0);
6977da8b7e3Smrg	}
6987da8b7e3SmrgEOF
6997da8b7e3Smrg	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
7007da8b7e3Smrg		{ echo "$SYSTEM_NAME"; exit; }
7017da8b7e3Smrg	echo unknown-hitachi-hiuxwe2
7027da8b7e3Smrg	exit ;;
7037da8b7e3Smrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
7047da8b7e3Smrg	echo hppa1.1-hp-bsd
7057da8b7e3Smrg	exit ;;
7067da8b7e3Smrg    9000/8??:4.3bsd:*:*)
7077da8b7e3Smrg	echo hppa1.0-hp-bsd
7087da8b7e3Smrg	exit ;;
7097da8b7e3Smrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
7107da8b7e3Smrg	echo hppa1.0-hp-mpeix
7117da8b7e3Smrg	exit ;;
7127da8b7e3Smrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
7137da8b7e3Smrg	echo hppa1.1-hp-osf
7147da8b7e3Smrg	exit ;;
7157da8b7e3Smrg    hp8??:OSF1:*:*)
7167da8b7e3Smrg	echo hppa1.0-hp-osf
7177da8b7e3Smrg	exit ;;
7187da8b7e3Smrg    i*86:OSF1:*:*)
7197da8b7e3Smrg	if [ -x /usr/sbin/sysversion ] ; then
7207da8b7e3Smrg	    echo ${UNAME_MACHINE}-unknown-osf1mk
7217da8b7e3Smrg	else
7227da8b7e3Smrg	    echo ${UNAME_MACHINE}-unknown-osf1
7237da8b7e3Smrg	fi
7247da8b7e3Smrg	exit ;;
7257da8b7e3Smrg    parisc*:Lites*:*:*)
7267da8b7e3Smrg	echo hppa1.1-hp-lites
7277da8b7e3Smrg	exit ;;
7287da8b7e3Smrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
7297da8b7e3Smrg	echo c1-convex-bsd
7307da8b7e3Smrg        exit ;;
7317da8b7e3Smrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
7327da8b7e3Smrg	if getsysinfo -f scalar_acc
7337da8b7e3Smrg	then echo c32-convex-bsd
7347da8b7e3Smrg	else echo c2-convex-bsd
7357da8b7e3Smrg	fi
7367da8b7e3Smrg        exit ;;
7377da8b7e3Smrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
7387da8b7e3Smrg	echo c34-convex-bsd
7397da8b7e3Smrg        exit ;;
7407da8b7e3Smrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
7417da8b7e3Smrg	echo c38-convex-bsd
7427da8b7e3Smrg        exit ;;
7437da8b7e3Smrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
7447da8b7e3Smrg	echo c4-convex-bsd
7457da8b7e3Smrg        exit ;;
7467da8b7e3Smrg    CRAY*Y-MP:*:*:*)
7477da8b7e3Smrg	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7487da8b7e3Smrg	exit ;;
7497da8b7e3Smrg    CRAY*[A-Z]90:*:*:*)
7507da8b7e3Smrg	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
7517da8b7e3Smrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
7527da8b7e3Smrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
7537da8b7e3Smrg	      -e 's/\.[^.]*$/.X/'
7547da8b7e3Smrg	exit ;;
7557da8b7e3Smrg    CRAY*TS:*:*:*)
7567da8b7e3Smrg	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7577da8b7e3Smrg	exit ;;
7587da8b7e3Smrg    CRAY*T3E:*:*:*)
7597da8b7e3Smrg	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7607da8b7e3Smrg	exit ;;
7617da8b7e3Smrg    CRAY*SV1:*:*:*)
7627da8b7e3Smrg	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7637da8b7e3Smrg	exit ;;
7647da8b7e3Smrg    *:UNICOS/mp:*:*)
7657da8b7e3Smrg	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7667da8b7e3Smrg	exit ;;
7677da8b7e3Smrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
7687da8b7e3Smrg	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
7697da8b7e3Smrg        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
7707da8b7e3Smrg        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
7717da8b7e3Smrg        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
7727da8b7e3Smrg        exit ;;
7737da8b7e3Smrg    5000:UNIX_System_V:4.*:*)
7747da8b7e3Smrg        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
7757da8b7e3Smrg        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
7767da8b7e3Smrg        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
7777da8b7e3Smrg	exit ;;
7787da8b7e3Smrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
7797da8b7e3Smrg	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
7807da8b7e3Smrg	exit ;;
7817da8b7e3Smrg    sparc*:BSD/OS:*:*)
7827da8b7e3Smrg	echo sparc-unknown-bsdi${UNAME_RELEASE}
7837da8b7e3Smrg	exit ;;
7847da8b7e3Smrg    *:BSD/OS:*:*)
7857da8b7e3Smrg	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
7867da8b7e3Smrg	exit ;;
7877da8b7e3Smrg    *:FreeBSD:*:*)
788123e2cc7Smrg	case ${UNAME_MACHINE} in
789123e2cc7Smrg	    pc98)
790123e2cc7Smrg		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
791123e2cc7Smrg	    amd64)
792123e2cc7Smrg		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
793123e2cc7Smrg	    *)
794123e2cc7Smrg		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
795123e2cc7Smrg	esac
7967da8b7e3Smrg	exit ;;
7977da8b7e3Smrg    i*:CYGWIN*:*)
7987da8b7e3Smrg	echo ${UNAME_MACHINE}-pc-cygwin
7997da8b7e3Smrg	exit ;;
800123e2cc7Smrg    *:MINGW*:*)
8017da8b7e3Smrg	echo ${UNAME_MACHINE}-pc-mingw32
8027da8b7e3Smrg	exit ;;
8037da8b7e3Smrg    i*:windows32*:*)
8047da8b7e3Smrg    	# uname -m includes "-pc" on this system.
8057da8b7e3Smrg    	echo ${UNAME_MACHINE}-mingw32
8067da8b7e3Smrg	exit ;;
8077da8b7e3Smrg    i*:PW*:*)
8087da8b7e3Smrg	echo ${UNAME_MACHINE}-pc-pw32
8097da8b7e3Smrg	exit ;;
810123e2cc7Smrg    *:Interix*:[3456]*)
811123e2cc7Smrg    	case ${UNAME_MACHINE} in
812123e2cc7Smrg	    x86)
813123e2cc7Smrg		echo i586-pc-interix${UNAME_RELEASE}
814123e2cc7Smrg		exit ;;
815123e2cc7Smrg	    EM64T | authenticamd | genuineintel)
816123e2cc7Smrg		echo x86_64-unknown-interix${UNAME_RELEASE}
817123e2cc7Smrg		exit ;;
818123e2cc7Smrg	    IA64)
819123e2cc7Smrg		echo ia64-unknown-interix${UNAME_RELEASE}
820123e2cc7Smrg		exit ;;
821123e2cc7Smrg	esac ;;
8227da8b7e3Smrg    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
8237da8b7e3Smrg	echo i${UNAME_MACHINE}-pc-mks
8247da8b7e3Smrg	exit ;;
8257da8b7e3Smrg    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
8267da8b7e3Smrg	# How do we know it's Interix rather than the generic POSIX subsystem?
8277da8b7e3Smrg	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
8287da8b7e3Smrg	# UNAME_MACHINE based on the output of uname instead of i386?
8297da8b7e3Smrg	echo i586-pc-interix
8307da8b7e3Smrg	exit ;;
8317da8b7e3Smrg    i*:UWIN*:*)
8327da8b7e3Smrg	echo ${UNAME_MACHINE}-pc-uwin
8337da8b7e3Smrg	exit ;;
834123e2cc7Smrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
8357da8b7e3Smrg	echo x86_64-unknown-cygwin
8367da8b7e3Smrg	exit ;;
8377da8b7e3Smrg    p*:CYGWIN*:*)
8387da8b7e3Smrg	echo powerpcle-unknown-cygwin
8397da8b7e3Smrg	exit ;;
8407da8b7e3Smrg    prep*:SunOS:5.*:*)
8417da8b7e3Smrg	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
8427da8b7e3Smrg	exit ;;
8437da8b7e3Smrg    *:GNU:*:*)
8447da8b7e3Smrg	# the GNU system
8457da8b7e3Smrg	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
8467da8b7e3Smrg	exit ;;
8477da8b7e3Smrg    *:GNU/*:*:*)
8487da8b7e3Smrg	# other systems with GNU libc and userland
8497da8b7e3Smrg	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
8507da8b7e3Smrg	exit ;;
8517da8b7e3Smrg    i*86:Minix:*:*)
8527da8b7e3Smrg	echo ${UNAME_MACHINE}-pc-minix
8537da8b7e3Smrg	exit ;;
8547da8b7e3Smrg    arm*:Linux:*:*)
855123e2cc7Smrg	eval $set_cc_for_build
856123e2cc7Smrg	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
857123e2cc7Smrg	    | grep -q __ARM_EABI__
858123e2cc7Smrg	then
859123e2cc7Smrg	    echo ${UNAME_MACHINE}-unknown-linux-gnu
860123e2cc7Smrg	else
861123e2cc7Smrg	    echo ${UNAME_MACHINE}-unknown-linux-gnueabi
862123e2cc7Smrg	fi
863123e2cc7Smrg	exit ;;
864123e2cc7Smrg    avr32*:Linux:*:*)
8657da8b7e3Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
8667da8b7e3Smrg	exit ;;
8677da8b7e3Smrg    cris:Linux:*:*)
8687da8b7e3Smrg	echo cris-axis-linux-gnu
8697da8b7e3Smrg	exit ;;
8707da8b7e3Smrg    crisv32:Linux:*:*)
8717da8b7e3Smrg	echo crisv32-axis-linux-gnu
8727da8b7e3Smrg	exit ;;
8737da8b7e3Smrg    frv:Linux:*:*)
8747da8b7e3Smrg    	echo frv-unknown-linux-gnu
8757da8b7e3Smrg	exit ;;
8767da8b7e3Smrg    ia64:Linux:*:*)
8777da8b7e3Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
8787da8b7e3Smrg	exit ;;
8797da8b7e3Smrg    m32r*:Linux:*:*)
8807da8b7e3Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
8817da8b7e3Smrg	exit ;;
8827da8b7e3Smrg    m68*:Linux:*:*)
8837da8b7e3Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
8847da8b7e3Smrg	exit ;;
8857da8b7e3Smrg    mips:Linux:*:*)
8867da8b7e3Smrg	eval $set_cc_for_build
8877da8b7e3Smrg	sed 's/^	//' << EOF >$dummy.c
8887da8b7e3Smrg	#undef CPU
8897da8b7e3Smrg	#undef mips
8907da8b7e3Smrg	#undef mipsel
8917da8b7e3Smrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
8927da8b7e3Smrg	CPU=mipsel
8937da8b7e3Smrg	#else
8947da8b7e3Smrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
8957da8b7e3Smrg	CPU=mips
8967da8b7e3Smrg	#else
8977da8b7e3Smrg	CPU=
8987da8b7e3Smrg	#endif
8997da8b7e3Smrg	#endif
9007da8b7e3SmrgEOF
901123e2cc7Smrg	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
902123e2cc7Smrg	    /^CPU/{
903123e2cc7Smrg		s: ::g
904123e2cc7Smrg		p
905123e2cc7Smrg	    }'`"
9067da8b7e3Smrg	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
9077da8b7e3Smrg	;;
9087da8b7e3Smrg    mips64:Linux:*:*)
9097da8b7e3Smrg	eval $set_cc_for_build
9107da8b7e3Smrg	sed 's/^	//' << EOF >$dummy.c
9117da8b7e3Smrg	#undef CPU
9127da8b7e3Smrg	#undef mips64
9137da8b7e3Smrg	#undef mips64el
9147da8b7e3Smrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
9157da8b7e3Smrg	CPU=mips64el
9167da8b7e3Smrg	#else
9177da8b7e3Smrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
9187da8b7e3Smrg	CPU=mips64
9197da8b7e3Smrg	#else
9207da8b7e3Smrg	CPU=
9217da8b7e3Smrg	#endif
9227da8b7e3Smrg	#endif
9237da8b7e3SmrgEOF
924123e2cc7Smrg	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
925123e2cc7Smrg	    /^CPU/{
926123e2cc7Smrg		s: ::g
927123e2cc7Smrg		p
928123e2cc7Smrg	    }'`"
9297da8b7e3Smrg	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
9307da8b7e3Smrg	;;
931123e2cc7Smrg    or32:Linux:*:*)
932123e2cc7Smrg	echo or32-unknown-linux-gnu
933123e2cc7Smrg	exit ;;
9347da8b7e3Smrg    ppc:Linux:*:*)
9357da8b7e3Smrg	echo powerpc-unknown-linux-gnu
9367da8b7e3Smrg	exit ;;
9377da8b7e3Smrg    ppc64:Linux:*:*)
9387da8b7e3Smrg	echo powerpc64-unknown-linux-gnu
9397da8b7e3Smrg	exit ;;
9407da8b7e3Smrg    alpha:Linux:*:*)
9417da8b7e3Smrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
9427da8b7e3Smrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
9437da8b7e3Smrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
9447da8b7e3Smrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
9457da8b7e3Smrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
9467da8b7e3Smrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
9477da8b7e3Smrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
9487da8b7e3Smrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
9497da8b7e3Smrg        esac
9507da8b7e3Smrg	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
9517da8b7e3Smrg	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
9527da8b7e3Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
9537da8b7e3Smrg	exit ;;
954123e2cc7Smrg    padre:Linux:*:*)
955123e2cc7Smrg	echo sparc-unknown-linux-gnu
956123e2cc7Smrg	exit ;;
9577da8b7e3Smrg    parisc:Linux:*:* | hppa:Linux:*:*)
9587da8b7e3Smrg	# Look for CPU level
9597da8b7e3Smrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
9607da8b7e3Smrg	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
9617da8b7e3Smrg	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
9627da8b7e3Smrg	  *)    echo hppa-unknown-linux-gnu ;;
9637da8b7e3Smrg	esac
9647da8b7e3Smrg	exit ;;
9657da8b7e3Smrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
9667da8b7e3Smrg	echo hppa64-unknown-linux-gnu
9677da8b7e3Smrg	exit ;;
9687da8b7e3Smrg    s390:Linux:*:* | s390x:Linux:*:*)
9697da8b7e3Smrg	echo ${UNAME_MACHINE}-ibm-linux
9707da8b7e3Smrg	exit ;;
9717da8b7e3Smrg    sh64*:Linux:*:*)
9727da8b7e3Smrg    	echo ${UNAME_MACHINE}-unknown-linux-gnu
9737da8b7e3Smrg	exit ;;
9747da8b7e3Smrg    sh*:Linux:*:*)
9757da8b7e3Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
9767da8b7e3Smrg	exit ;;
9777da8b7e3Smrg    sparc:Linux:*:* | sparc64:Linux:*:*)
9787da8b7e3Smrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
9797da8b7e3Smrg	exit ;;
980123e2cc7Smrg    vax:Linux:*:*)
981123e2cc7Smrg	echo ${UNAME_MACHINE}-dec-linux-gnu
982123e2cc7Smrg	exit ;;
9837da8b7e3Smrg    x86_64:Linux:*:*)
9847da8b7e3Smrg	echo x86_64-unknown-linux-gnu
9857da8b7e3Smrg	exit ;;
986123e2cc7Smrg    xtensa*:Linux:*:*)
987123e2cc7Smrg    	echo ${UNAME_MACHINE}-unknown-linux-gnu
988123e2cc7Smrg	exit ;;
9897da8b7e3Smrg    i*86:Linux:*:*)
9907da8b7e3Smrg	# The BFD linker knows what the default object file format is, so
9917da8b7e3Smrg	# first see if it will tell us. cd to the root directory to prevent
9927da8b7e3Smrg	# problems with other programs or directories called `ld' in the path.
9937da8b7e3Smrg	# Set LC_ALL=C to ensure ld outputs messages in English.
9947da8b7e3Smrg	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
9957da8b7e3Smrg			 | sed -ne '/supported targets:/!d
9967da8b7e3Smrg				    s/[ 	][ 	]*/ /g
9977da8b7e3Smrg				    s/.*supported targets: *//
9987da8b7e3Smrg				    s/ .*//
9997da8b7e3Smrg				    p'`
10007da8b7e3Smrg        case "$ld_supported_targets" in
10017da8b7e3Smrg	  elf32-i386)
10027da8b7e3Smrg		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
10037da8b7e3Smrg		;;
10047da8b7e3Smrg	  a.out-i386-linux)
10057da8b7e3Smrg		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
10067da8b7e3Smrg		exit ;;
10077da8b7e3Smrg	  "")
10087da8b7e3Smrg		# Either a pre-BFD a.out linker (linux-gnuoldld) or
10097da8b7e3Smrg		# one that does not give us useful --help.
10107da8b7e3Smrg		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
10117da8b7e3Smrg		exit ;;
10127da8b7e3Smrg	esac
10137da8b7e3Smrg	# Determine whether the default compiler is a.out or elf
10147da8b7e3Smrg	eval $set_cc_for_build
10157da8b7e3Smrg	sed 's/^	//' << EOF >$dummy.c
10167da8b7e3Smrg	#include <features.h>
10177da8b7e3Smrg	#ifdef __ELF__
10187da8b7e3Smrg	# ifdef __GLIBC__
10197da8b7e3Smrg	#  if __GLIBC__ >= 2
10207da8b7e3Smrg	LIBC=gnu
10217da8b7e3Smrg	#  else
10227da8b7e3Smrg	LIBC=gnulibc1
10237da8b7e3Smrg	#  endif
10247da8b7e3Smrg	# else
10257da8b7e3Smrg	LIBC=gnulibc1
10267da8b7e3Smrg	# endif
10277da8b7e3Smrg	#else
1028123e2cc7Smrg	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
10297da8b7e3Smrg	LIBC=gnu
10307da8b7e3Smrg	#else
10317da8b7e3Smrg	LIBC=gnuaout
10327da8b7e3Smrg	#endif
10337da8b7e3Smrg	#endif
10347da8b7e3Smrg	#ifdef __dietlibc__
10357da8b7e3Smrg	LIBC=dietlibc
10367da8b7e3Smrg	#endif
10377da8b7e3SmrgEOF
1038123e2cc7Smrg	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
1039123e2cc7Smrg	    /^LIBC/{
1040123e2cc7Smrg		s: ::g
1041123e2cc7Smrg		p
1042123e2cc7Smrg	    }'`"
10437da8b7e3Smrg	test x"${LIBC}" != x && {
10447da8b7e3Smrg		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
10457da8b7e3Smrg		exit
10467da8b7e3Smrg	}
10477da8b7e3Smrg	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
10487da8b7e3Smrg	;;
10497da8b7e3Smrg    i*86:DYNIX/ptx:4*:*)
10507da8b7e3Smrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
10517da8b7e3Smrg	# earlier versions are messed up and put the nodename in both
10527da8b7e3Smrg	# sysname and nodename.
10537da8b7e3Smrg	echo i386-sequent-sysv4
10547da8b7e3Smrg	exit ;;
10557da8b7e3Smrg    i*86:UNIX_SV:4.2MP:2.*)
10567da8b7e3Smrg        # Unixware is an offshoot of SVR4, but it has its own version
10577da8b7e3Smrg        # number series starting with 2...
10587da8b7e3Smrg        # I am not positive that other SVR4 systems won't match this,
10597da8b7e3Smrg	# I just have to hope.  -- rms.
10607da8b7e3Smrg        # Use sysv4.2uw... so that sysv4* matches it.
10617da8b7e3Smrg	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
10627da8b7e3Smrg	exit ;;
10637da8b7e3Smrg    i*86:OS/2:*:*)
10647da8b7e3Smrg	# If we were able to find `uname', then EMX Unix compatibility
10657da8b7e3Smrg	# is probably installed.
10667da8b7e3Smrg	echo ${UNAME_MACHINE}-pc-os2-emx
10677da8b7e3Smrg	exit ;;
10687da8b7e3Smrg    i*86:XTS-300:*:STOP)
10697da8b7e3Smrg	echo ${UNAME_MACHINE}-unknown-stop
10707da8b7e3Smrg	exit ;;
10717da8b7e3Smrg    i*86:atheos:*:*)
10727da8b7e3Smrg	echo ${UNAME_MACHINE}-unknown-atheos
10737da8b7e3Smrg	exit ;;
10747da8b7e3Smrg    i*86:syllable:*:*)
10757da8b7e3Smrg	echo ${UNAME_MACHINE}-pc-syllable
10767da8b7e3Smrg	exit ;;
10777da8b7e3Smrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
10787da8b7e3Smrg	echo i386-unknown-lynxos${UNAME_RELEASE}
10797da8b7e3Smrg	exit ;;
10807da8b7e3Smrg    i*86:*DOS:*:*)
10817da8b7e3Smrg	echo ${UNAME_MACHINE}-pc-msdosdjgpp
10827da8b7e3Smrg	exit ;;
10837da8b7e3Smrg    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
10847da8b7e3Smrg	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
10857da8b7e3Smrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
10867da8b7e3Smrg		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
10877da8b7e3Smrg	else
10887da8b7e3Smrg		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
10897da8b7e3Smrg	fi
10907da8b7e3Smrg	exit ;;
10917da8b7e3Smrg    i*86:*:5:[678]*)
10927da8b7e3Smrg    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
10937da8b7e3Smrg	case `/bin/uname -X | grep "^Machine"` in
10947da8b7e3Smrg	    *486*)	     UNAME_MACHINE=i486 ;;
10957da8b7e3Smrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
10967da8b7e3Smrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
10977da8b7e3Smrg	esac
10987da8b7e3Smrg	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
10997da8b7e3Smrg	exit ;;
11007da8b7e3Smrg    i*86:*:3.2:*)
11017da8b7e3Smrg	if test -f /usr/options/cb.name; then
11027da8b7e3Smrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
11037da8b7e3Smrg		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
11047da8b7e3Smrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
11057da8b7e3Smrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
11067da8b7e3Smrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
11077da8b7e3Smrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
11087da8b7e3Smrg			&& UNAME_MACHINE=i586
11097da8b7e3Smrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
11107da8b7e3Smrg			&& UNAME_MACHINE=i686
11117da8b7e3Smrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
11127da8b7e3Smrg			&& UNAME_MACHINE=i686
11137da8b7e3Smrg		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
11147da8b7e3Smrg	else
11157da8b7e3Smrg		echo ${UNAME_MACHINE}-pc-sysv32
11167da8b7e3Smrg	fi
11177da8b7e3Smrg	exit ;;
11187da8b7e3Smrg    pc:*:*:*)
11197da8b7e3Smrg	# Left here for compatibility:
11207da8b7e3Smrg        # uname -m prints for DJGPP always 'pc', but it prints nothing about
1121123e2cc7Smrg        # the processor, so we play safe by assuming i586.
1122123e2cc7Smrg	# Note: whatever this is, it MUST be the same as what config.sub
1123123e2cc7Smrg	# prints for the "djgpp" host, or else GDB configury will decide that
1124123e2cc7Smrg	# this is a cross-build.
1125123e2cc7Smrg	echo i586-pc-msdosdjgpp
11267da8b7e3Smrg        exit ;;
11277da8b7e3Smrg    Intel:Mach:3*:*)
11287da8b7e3Smrg	echo i386-pc-mach3
11297da8b7e3Smrg	exit ;;
11307da8b7e3Smrg    paragon:*:*:*)
11317da8b7e3Smrg	echo i860-intel-osf1
11327da8b7e3Smrg	exit ;;
11337da8b7e3Smrg    i860:*:4.*:*) # i860-SVR4
11347da8b7e3Smrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
11357da8b7e3Smrg	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
11367da8b7e3Smrg	else # Add other i860-SVR4 vendors below as they are discovered.
11377da8b7e3Smrg	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
11387da8b7e3Smrg	fi
11397da8b7e3Smrg	exit ;;
11407da8b7e3Smrg    mini*:CTIX:SYS*5:*)
11417da8b7e3Smrg	# "miniframe"
11427da8b7e3Smrg	echo m68010-convergent-sysv
11437da8b7e3Smrg	exit ;;
11447da8b7e3Smrg    mc68k:UNIX:SYSTEM5:3.51m)
11457da8b7e3Smrg	echo m68k-convergent-sysv
11467da8b7e3Smrg	exit ;;
11477da8b7e3Smrg    M680?0:D-NIX:5.3:*)
11487da8b7e3Smrg	echo m68k-diab-dnix
11497da8b7e3Smrg	exit ;;
11507da8b7e3Smrg    M68*:*:R3V[5678]*:*)
11517da8b7e3Smrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
11527da8b7e3Smrg    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)
11537da8b7e3Smrg	OS_REL=''
11547da8b7e3Smrg	test -r /etc/.relid \
11557da8b7e3Smrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
11567da8b7e3Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
11577da8b7e3Smrg	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
11587da8b7e3Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
11597da8b7e3Smrg	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
11607da8b7e3Smrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
11617da8b7e3Smrg        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
11627da8b7e3Smrg          && { echo i486-ncr-sysv4; exit; } ;;
1163123e2cc7Smrg    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1164123e2cc7Smrg	OS_REL='.3'
1165123e2cc7Smrg	test -r /etc/.relid \
1166123e2cc7Smrg	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1167123e2cc7Smrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1168123e2cc7Smrg	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1169123e2cc7Smrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1170123e2cc7Smrg	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
1171123e2cc7Smrg	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1172123e2cc7Smrg	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
11737da8b7e3Smrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
11747da8b7e3Smrg	echo m68k-unknown-lynxos${UNAME_RELEASE}
11757da8b7e3Smrg	exit ;;
11767da8b7e3Smrg    mc68030:UNIX_System_V:4.*:*)
11777da8b7e3Smrg	echo m68k-atari-sysv4
11787da8b7e3Smrg	exit ;;
11797da8b7e3Smrg    TSUNAMI:LynxOS:2.*:*)
11807da8b7e3Smrg	echo sparc-unknown-lynxos${UNAME_RELEASE}
11817da8b7e3Smrg	exit ;;
11827da8b7e3Smrg    rs6000:LynxOS:2.*:*)
11837da8b7e3Smrg	echo rs6000-unknown-lynxos${UNAME_RELEASE}
11847da8b7e3Smrg	exit ;;
11857da8b7e3Smrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
11867da8b7e3Smrg	echo powerpc-unknown-lynxos${UNAME_RELEASE}
11877da8b7e3Smrg	exit ;;
11887da8b7e3Smrg    SM[BE]S:UNIX_SV:*:*)
11897da8b7e3Smrg	echo mips-dde-sysv${UNAME_RELEASE}
11907da8b7e3Smrg	exit ;;
11917da8b7e3Smrg    RM*:ReliantUNIX-*:*:*)
11927da8b7e3Smrg	echo mips-sni-sysv4
11937da8b7e3Smrg	exit ;;
11947da8b7e3Smrg    RM*:SINIX-*:*:*)
11957da8b7e3Smrg	echo mips-sni-sysv4
11967da8b7e3Smrg	exit ;;
11977da8b7e3Smrg    *:SINIX-*:*:*)
11987da8b7e3Smrg	if uname -p 2>/dev/null >/dev/null ; then
11997da8b7e3Smrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
12007da8b7e3Smrg		echo ${UNAME_MACHINE}-sni-sysv4
12017da8b7e3Smrg	else
12027da8b7e3Smrg		echo ns32k-sni-sysv
12037da8b7e3Smrg	fi
12047da8b7e3Smrg	exit ;;
12057da8b7e3Smrg    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
12067da8b7e3Smrg                      # says <Richard.M.Bartel@ccMail.Census.GOV>
12077da8b7e3Smrg        echo i586-unisys-sysv4
12087da8b7e3Smrg        exit ;;
12097da8b7e3Smrg    *:UNIX_System_V:4*:FTX*)
12107da8b7e3Smrg	# From Gerald Hewes <hewes@openmarket.com>.
12117da8b7e3Smrg	# How about differentiating between stratus architectures? -djm
12127da8b7e3Smrg	echo hppa1.1-stratus-sysv4
12137da8b7e3Smrg	exit ;;
12147da8b7e3Smrg    *:*:*:FTX*)
12157da8b7e3Smrg	# From seanf@swdc.stratus.com.
12167da8b7e3Smrg	echo i860-stratus-sysv4
12177da8b7e3Smrg	exit ;;
12187da8b7e3Smrg    i*86:VOS:*:*)
12197da8b7e3Smrg	# From Paul.Green@stratus.com.
12207da8b7e3Smrg	echo ${UNAME_MACHINE}-stratus-vos
12217da8b7e3Smrg	exit ;;
12227da8b7e3Smrg    *:VOS:*:*)
12237da8b7e3Smrg	# From Paul.Green@stratus.com.
12247da8b7e3Smrg	echo hppa1.1-stratus-vos
12257da8b7e3Smrg	exit ;;
12267da8b7e3Smrg    mc68*:A/UX:*:*)
12277da8b7e3Smrg	echo m68k-apple-aux${UNAME_RELEASE}
12287da8b7e3Smrg	exit ;;
12297da8b7e3Smrg    news*:NEWS-OS:6*:*)
12307da8b7e3Smrg	echo mips-sony-newsos6
12317da8b7e3Smrg	exit ;;
12327da8b7e3Smrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
12337da8b7e3Smrg	if [ -d /usr/nec ]; then
12347da8b7e3Smrg	        echo mips-nec-sysv${UNAME_RELEASE}
12357da8b7e3Smrg	else
12367da8b7e3Smrg	        echo mips-unknown-sysv${UNAME_RELEASE}
12377da8b7e3Smrg	fi
12387da8b7e3Smrg        exit ;;
12397da8b7e3Smrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
12407da8b7e3Smrg	echo powerpc-be-beos
12417da8b7e3Smrg	exit ;;
12427da8b7e3Smrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
12437da8b7e3Smrg	echo powerpc-apple-beos
12447da8b7e3Smrg	exit ;;
12457da8b7e3Smrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
12467da8b7e3Smrg	echo i586-pc-beos
12477da8b7e3Smrg	exit ;;
1248123e2cc7Smrg    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
1249123e2cc7Smrg	echo i586-pc-haiku
1250123e2cc7Smrg	exit ;;
12517da8b7e3Smrg    SX-4:SUPER-UX:*:*)
12527da8b7e3Smrg	echo sx4-nec-superux${UNAME_RELEASE}
12537da8b7e3Smrg	exit ;;
12547da8b7e3Smrg    SX-5:SUPER-UX:*:*)
12557da8b7e3Smrg	echo sx5-nec-superux${UNAME_RELEASE}
12567da8b7e3Smrg	exit ;;
12577da8b7e3Smrg    SX-6:SUPER-UX:*:*)
12587da8b7e3Smrg	echo sx6-nec-superux${UNAME_RELEASE}
12597da8b7e3Smrg	exit ;;
1260123e2cc7Smrg    SX-7:SUPER-UX:*:*)
1261123e2cc7Smrg	echo sx7-nec-superux${UNAME_RELEASE}
1262123e2cc7Smrg	exit ;;
1263123e2cc7Smrg    SX-8:SUPER-UX:*:*)
1264123e2cc7Smrg	echo sx8-nec-superux${UNAME_RELEASE}
1265123e2cc7Smrg	exit ;;
1266123e2cc7Smrg    SX-8R:SUPER-UX:*:*)
1267123e2cc7Smrg	echo sx8r-nec-superux${UNAME_RELEASE}
1268123e2cc7Smrg	exit ;;
12697da8b7e3Smrg    Power*:Rhapsody:*:*)
12707da8b7e3Smrg	echo powerpc-apple-rhapsody${UNAME_RELEASE}
12717da8b7e3Smrg	exit ;;
12727da8b7e3Smrg    *:Rhapsody:*:*)
12737da8b7e3Smrg	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
12747da8b7e3Smrg	exit ;;
12757da8b7e3Smrg    *:Darwin:*:*)
12767da8b7e3Smrg	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
12777da8b7e3Smrg	case $UNAME_PROCESSOR in
12787da8b7e3Smrg	    unknown) UNAME_PROCESSOR=powerpc ;;
12797da8b7e3Smrg	esac
12807da8b7e3Smrg	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
12817da8b7e3Smrg	exit ;;
12827da8b7e3Smrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
12837da8b7e3Smrg	UNAME_PROCESSOR=`uname -p`
12847da8b7e3Smrg	if test "$UNAME_PROCESSOR" = "x86"; then
12857da8b7e3Smrg		UNAME_PROCESSOR=i386
12867da8b7e3Smrg		UNAME_MACHINE=pc
12877da8b7e3Smrg	fi
12887da8b7e3Smrg	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
12897da8b7e3Smrg	exit ;;
12907da8b7e3Smrg    *:QNX:*:4*)
12917da8b7e3Smrg	echo i386-pc-qnx
12927da8b7e3Smrg	exit ;;
12937da8b7e3Smrg    NSE-?:NONSTOP_KERNEL:*:*)
12947da8b7e3Smrg	echo nse-tandem-nsk${UNAME_RELEASE}
12957da8b7e3Smrg	exit ;;
12967da8b7e3Smrg    NSR-?:NONSTOP_KERNEL:*:*)
12977da8b7e3Smrg	echo nsr-tandem-nsk${UNAME_RELEASE}
12987da8b7e3Smrg	exit ;;
12997da8b7e3Smrg    *:NonStop-UX:*:*)
13007da8b7e3Smrg	echo mips-compaq-nonstopux
13017da8b7e3Smrg	exit ;;
13027da8b7e3Smrg    BS2000:POSIX*:*:*)
13037da8b7e3Smrg	echo bs2000-siemens-sysv
13047da8b7e3Smrg	exit ;;
13057da8b7e3Smrg    DS/*:UNIX_System_V:*:*)
13067da8b7e3Smrg	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
13077da8b7e3Smrg	exit ;;
13087da8b7e3Smrg    *:Plan9:*:*)
13097da8b7e3Smrg	# "uname -m" is not consistent, so use $cputype instead. 386
13107da8b7e3Smrg	# is converted to i386 for consistency with other x86
13117da8b7e3Smrg	# operating systems.
13127da8b7e3Smrg	if test "$cputype" = "386"; then
13137da8b7e3Smrg	    UNAME_MACHINE=i386
13147da8b7e3Smrg	else
13157da8b7e3Smrg	    UNAME_MACHINE="$cputype"
13167da8b7e3Smrg	fi
13177da8b7e3Smrg	echo ${UNAME_MACHINE}-unknown-plan9
13187da8b7e3Smrg	exit ;;
13197da8b7e3Smrg    *:TOPS-10:*:*)
13207da8b7e3Smrg	echo pdp10-unknown-tops10
13217da8b7e3Smrg	exit ;;
13227da8b7e3Smrg    *:TENEX:*:*)
13237da8b7e3Smrg	echo pdp10-unknown-tenex
13247da8b7e3Smrg	exit ;;
13257da8b7e3Smrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
13267da8b7e3Smrg	echo pdp10-dec-tops20
13277da8b7e3Smrg	exit ;;
13287da8b7e3Smrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
13297da8b7e3Smrg	echo pdp10-xkl-tops20
13307da8b7e3Smrg	exit ;;
13317da8b7e3Smrg    *:TOPS-20:*:*)
13327da8b7e3Smrg	echo pdp10-unknown-tops20
13337da8b7e3Smrg	exit ;;
13347da8b7e3Smrg    *:ITS:*:*)
13357da8b7e3Smrg	echo pdp10-unknown-its
13367da8b7e3Smrg	exit ;;
13377da8b7e3Smrg    SEI:*:*:SEIUX)
13387da8b7e3Smrg        echo mips-sei-seiux${UNAME_RELEASE}
13397da8b7e3Smrg	exit ;;
13407da8b7e3Smrg    *:DragonFly:*:*)
13417da8b7e3Smrg	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
13427da8b7e3Smrg	exit ;;
13437da8b7e3Smrg    *:*VMS:*:*)
13447da8b7e3Smrg    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
13457da8b7e3Smrg	case "${UNAME_MACHINE}" in
13467da8b7e3Smrg	    A*) echo alpha-dec-vms ; exit ;;
13477da8b7e3Smrg	    I*) echo ia64-dec-vms ; exit ;;
13487da8b7e3Smrg	    V*) echo vax-dec-vms ; exit ;;
13497da8b7e3Smrg	esac ;;
13507da8b7e3Smrg    *:XENIX:*:SysV)
13517da8b7e3Smrg	echo i386-pc-xenix
13527da8b7e3Smrg	exit ;;
13537da8b7e3Smrg    i*86:skyos:*:*)
13547da8b7e3Smrg	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
13557da8b7e3Smrg	exit ;;
1356123e2cc7Smrg    i*86:rdos:*:*)
1357123e2cc7Smrg	echo ${UNAME_MACHINE}-pc-rdos
1358123e2cc7Smrg	exit ;;
1359123e2cc7Smrg    i*86:AROS:*:*)
1360123e2cc7Smrg	echo ${UNAME_MACHINE}-pc-aros
1361123e2cc7Smrg	exit ;;
13627da8b7e3Smrgesac
13637da8b7e3Smrg
13647da8b7e3Smrg#echo '(No uname command or uname output not recognized.)' 1>&2
13657da8b7e3Smrg#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
13667da8b7e3Smrg
13677da8b7e3Smrgeval $set_cc_for_build
13687da8b7e3Smrgcat >$dummy.c <<EOF
13697da8b7e3Smrg#ifdef _SEQUENT_
13707da8b7e3Smrg# include <sys/types.h>
13717da8b7e3Smrg# include <sys/utsname.h>
13727da8b7e3Smrg#endif
13737da8b7e3Smrgmain ()
13747da8b7e3Smrg{
13757da8b7e3Smrg#if defined (sony)
13767da8b7e3Smrg#if defined (MIPSEB)
13777da8b7e3Smrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
13787da8b7e3Smrg     I don't know....  */
13797da8b7e3Smrg  printf ("mips-sony-bsd\n"); exit (0);
13807da8b7e3Smrg#else
13817da8b7e3Smrg#include <sys/param.h>
13827da8b7e3Smrg  printf ("m68k-sony-newsos%s\n",
13837da8b7e3Smrg#ifdef NEWSOS4
13847da8b7e3Smrg          "4"
13857da8b7e3Smrg#else
13867da8b7e3Smrg	  ""
13877da8b7e3Smrg#endif
13887da8b7e3Smrg         ); exit (0);
13897da8b7e3Smrg#endif
13907da8b7e3Smrg#endif
13917da8b7e3Smrg
13927da8b7e3Smrg#if defined (__arm) && defined (__acorn) && defined (__unix)
13937da8b7e3Smrg  printf ("arm-acorn-riscix\n"); exit (0);
13947da8b7e3Smrg#endif
13957da8b7e3Smrg
13967da8b7e3Smrg#if defined (hp300) && !defined (hpux)
13977da8b7e3Smrg  printf ("m68k-hp-bsd\n"); exit (0);
13987da8b7e3Smrg#endif
13997da8b7e3Smrg
14007da8b7e3Smrg#if defined (NeXT)
14017da8b7e3Smrg#if !defined (__ARCHITECTURE__)
14027da8b7e3Smrg#define __ARCHITECTURE__ "m68k"
14037da8b7e3Smrg#endif
14047da8b7e3Smrg  int version;
14057da8b7e3Smrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
14067da8b7e3Smrg  if (version < 4)
14077da8b7e3Smrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
14087da8b7e3Smrg  else
14097da8b7e3Smrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
14107da8b7e3Smrg  exit (0);
14117da8b7e3Smrg#endif
14127da8b7e3Smrg
14137da8b7e3Smrg#if defined (MULTIMAX) || defined (n16)
14147da8b7e3Smrg#if defined (UMAXV)
14157da8b7e3Smrg  printf ("ns32k-encore-sysv\n"); exit (0);
14167da8b7e3Smrg#else
14177da8b7e3Smrg#if defined (CMU)
14187da8b7e3Smrg  printf ("ns32k-encore-mach\n"); exit (0);
14197da8b7e3Smrg#else
14207da8b7e3Smrg  printf ("ns32k-encore-bsd\n"); exit (0);
14217da8b7e3Smrg#endif
14227da8b7e3Smrg#endif
14237da8b7e3Smrg#endif
14247da8b7e3Smrg
14257da8b7e3Smrg#if defined (__386BSD__)
14267da8b7e3Smrg  printf ("i386-pc-bsd\n"); exit (0);
14277da8b7e3Smrg#endif
14287da8b7e3Smrg
14297da8b7e3Smrg#if defined (sequent)
14307da8b7e3Smrg#if defined (i386)
14317da8b7e3Smrg  printf ("i386-sequent-dynix\n"); exit (0);
14327da8b7e3Smrg#endif
14337da8b7e3Smrg#if defined (ns32000)
14347da8b7e3Smrg  printf ("ns32k-sequent-dynix\n"); exit (0);
14357da8b7e3Smrg#endif
14367da8b7e3Smrg#endif
14377da8b7e3Smrg
14387da8b7e3Smrg#if defined (_SEQUENT_)
14397da8b7e3Smrg    struct utsname un;
14407da8b7e3Smrg
14417da8b7e3Smrg    uname(&un);
14427da8b7e3Smrg
14437da8b7e3Smrg    if (strncmp(un.version, "V2", 2) == 0) {
14447da8b7e3Smrg	printf ("i386-sequent-ptx2\n"); exit (0);
14457da8b7e3Smrg    }
14467da8b7e3Smrg    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
14477da8b7e3Smrg	printf ("i386-sequent-ptx1\n"); exit (0);
14487da8b7e3Smrg    }
14497da8b7e3Smrg    printf ("i386-sequent-ptx\n"); exit (0);
14507da8b7e3Smrg
14517da8b7e3Smrg#endif
14527da8b7e3Smrg
14537da8b7e3Smrg#if defined (vax)
14547da8b7e3Smrg# if !defined (ultrix)
14557da8b7e3Smrg#  include <sys/param.h>
14567da8b7e3Smrg#  if defined (BSD)
14577da8b7e3Smrg#   if BSD == 43
14587da8b7e3Smrg      printf ("vax-dec-bsd4.3\n"); exit (0);
14597da8b7e3Smrg#   else
14607da8b7e3Smrg#    if BSD == 199006
14617da8b7e3Smrg      printf ("vax-dec-bsd4.3reno\n"); exit (0);
14627da8b7e3Smrg#    else
14637da8b7e3Smrg      printf ("vax-dec-bsd\n"); exit (0);
14647da8b7e3Smrg#    endif
14657da8b7e3Smrg#   endif
14667da8b7e3Smrg#  else
14677da8b7e3Smrg    printf ("vax-dec-bsd\n"); exit (0);
14687da8b7e3Smrg#  endif
14697da8b7e3Smrg# else
14707da8b7e3Smrg    printf ("vax-dec-ultrix\n"); exit (0);
14717da8b7e3Smrg# endif
14727da8b7e3Smrg#endif
14737da8b7e3Smrg
14747da8b7e3Smrg#if defined (alliant) && defined (i860)
14757da8b7e3Smrg  printf ("i860-alliant-bsd\n"); exit (0);
14767da8b7e3Smrg#endif
14777da8b7e3Smrg
14787da8b7e3Smrg  exit (1);
14797da8b7e3Smrg}
14807da8b7e3SmrgEOF
14817da8b7e3Smrg
14827da8b7e3Smrg$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
14837da8b7e3Smrg	{ echo "$SYSTEM_NAME"; exit; }
14847da8b7e3Smrg
14857da8b7e3Smrg# Apollos put the system type in the environment.
14867da8b7e3Smrg
14877da8b7e3Smrgtest -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
14887da8b7e3Smrg
14897da8b7e3Smrg# Convex versions that predate uname can use getsysinfo(1)
14907da8b7e3Smrg
14917da8b7e3Smrgif [ -x /usr/convex/getsysinfo ]
14927da8b7e3Smrgthen
14937da8b7e3Smrg    case `getsysinfo -f cpu_type` in
14947da8b7e3Smrg    c1*)
14957da8b7e3Smrg	echo c1-convex-bsd
14967da8b7e3Smrg	exit ;;
14977da8b7e3Smrg    c2*)
14987da8b7e3Smrg	if getsysinfo -f scalar_acc
14997da8b7e3Smrg	then echo c32-convex-bsd
15007da8b7e3Smrg	else echo c2-convex-bsd
15017da8b7e3Smrg	fi
15027da8b7e3Smrg	exit ;;
15037da8b7e3Smrg    c34*)
15047da8b7e3Smrg	echo c34-convex-bsd
15057da8b7e3Smrg	exit ;;
15067da8b7e3Smrg    c38*)
15077da8b7e3Smrg	echo c38-convex-bsd
15087da8b7e3Smrg	exit ;;
15097da8b7e3Smrg    c4*)
15107da8b7e3Smrg	echo c4-convex-bsd
15117da8b7e3Smrg	exit ;;
15127da8b7e3Smrg    esac
15137da8b7e3Smrgfi
15147da8b7e3Smrg
15157da8b7e3Smrgcat >&2 <<EOF
15167da8b7e3Smrg$0: unable to guess system type
15177da8b7e3Smrg
15187da8b7e3SmrgThis script, last modified $timestamp, has failed to recognize
15197da8b7e3Smrgthe operating system you are using. It is advised that you
15207da8b7e3Smrgdownload the most up to date version of the config scripts from
15217da8b7e3Smrg
1522123e2cc7Smrg  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
15237da8b7e3Smrgand
1524123e2cc7Smrg  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
15257da8b7e3Smrg
15267da8b7e3SmrgIf the version you run ($0) is already up to date, please
15277da8b7e3Smrgsend the following data and any information you think might be
15287da8b7e3Smrgpertinent to <config-patches@gnu.org> in order to provide the needed
15297da8b7e3Smrginformation to handle your system.
15307da8b7e3Smrg
15317da8b7e3Smrgconfig.guess timestamp = $timestamp
15327da8b7e3Smrg
15337da8b7e3Smrguname -m = `(uname -m) 2>/dev/null || echo unknown`
15347da8b7e3Smrguname -r = `(uname -r) 2>/dev/null || echo unknown`
15357da8b7e3Smrguname -s = `(uname -s) 2>/dev/null || echo unknown`
15367da8b7e3Smrguname -v = `(uname -v) 2>/dev/null || echo unknown`
15377da8b7e3Smrg
15387da8b7e3Smrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
15397da8b7e3Smrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
15407da8b7e3Smrg
15417da8b7e3Smrghostinfo               = `(hostinfo) 2>/dev/null`
15427da8b7e3Smrg/bin/universe          = `(/bin/universe) 2>/dev/null`
15437da8b7e3Smrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
15447da8b7e3Smrg/bin/arch              = `(/bin/arch) 2>/dev/null`
15457da8b7e3Smrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
15467da8b7e3Smrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
15477da8b7e3Smrg
15487da8b7e3SmrgUNAME_MACHINE = ${UNAME_MACHINE}
15497da8b7e3SmrgUNAME_RELEASE = ${UNAME_RELEASE}
15507da8b7e3SmrgUNAME_SYSTEM  = ${UNAME_SYSTEM}
15517da8b7e3SmrgUNAME_VERSION = ${UNAME_VERSION}
15527da8b7e3SmrgEOF
15537da8b7e3Smrg
15547da8b7e3Smrgexit 1
15557da8b7e3Smrg
15567da8b7e3Smrg# Local variables:
15577da8b7e3Smrg# eval: (add-hook 'write-file-hooks 'time-stamp)
15587da8b7e3Smrg# time-stamp-start: "timestamp='"
15597da8b7e3Smrg# time-stamp-format: "%:y-%02m-%02d"
15607da8b7e3Smrg# time-stamp-end: "'"
15617da8b7e3Smrg# End:
1562