config.guess revision 9bd41f2c
19bd41f2cSmrg#! /bin/sh
29bd41f2cSmrg# Attempt to guess a canonical system name.
39bd41f2cSmrg#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
49bd41f2cSmrg#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
59bd41f2cSmrg#   Inc.
69bd41f2cSmrg
79bd41f2cSmrgtimestamp='2007-05-17'
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.
599bd41f2cSmrgCopyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
609bd41f2cSmrgFree 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} ;
1109bd41f2cSmrg { 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 ;;
1649bd41f2cSmrg	    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 ;;
2119bd41f2cSmrg    *:SolidBSD:*:*)
2129bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
2139bd41f2cSmrg	exit ;;
2149bd41f2cSmrg    macppc:MirBSD:*:*)
2159bd41f2cSmrg	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 ;;
3279bd41f2cSmrg    sun4H:SunOS:5.*:*)
3289bd41f2cSmrg	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3299bd41f2cSmrg	exit ;;
3309bd41f2cSmrg    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
3319bd41f2cSmrg	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3329bd41f2cSmrg	exit ;;
3339bd41f2cSmrg    i86pc:SunOS:5.*:* | ix86xen:SunOS:5.*:*)
3349bd41f2cSmrg	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3359bd41f2cSmrg	exit ;;
3369bd41f2cSmrg    sun4*:SunOS:6*:*)
3379bd41f2cSmrg	# According to config.sub, this is the proper way to canonicalize
3389bd41f2cSmrg	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
3399bd41f2cSmrg	# it's likely to be more like Solaris than SunOS4.
3409bd41f2cSmrg	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
3419bd41f2cSmrg	exit ;;
3429bd41f2cSmrg    sun4*:SunOS:*:*)
3439bd41f2cSmrg	case "`/usr/bin/arch -k`" in
3449bd41f2cSmrg	    Series*|S4*)
3459bd41f2cSmrg		UNAME_RELEASE=`uname -v`
3469bd41f2cSmrg		;;
3479bd41f2cSmrg	esac
3489bd41f2cSmrg	# Japanese Language versions have a version number like `4.1.3-JL'.
3499bd41f2cSmrg	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
3509bd41f2cSmrg	exit ;;
3519bd41f2cSmrg    sun3*:SunOS:*:*)
3529bd41f2cSmrg	echo m68k-sun-sunos${UNAME_RELEASE}
3539bd41f2cSmrg	exit ;;
3549bd41f2cSmrg    sun*:*:4.2BSD:*)
3559bd41f2cSmrg	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
3569bd41f2cSmrg	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
3579bd41f2cSmrg	case "`/bin/arch`" in
3589bd41f2cSmrg	    sun3)
3599bd41f2cSmrg		echo m68k-sun-sunos${UNAME_RELEASE}
3609bd41f2cSmrg		;;
3619bd41f2cSmrg	    sun4)
3629bd41f2cSmrg		echo sparc-sun-sunos${UNAME_RELEASE}
3639bd41f2cSmrg		;;
3649bd41f2cSmrg	esac
3659bd41f2cSmrg	exit ;;
3669bd41f2cSmrg    aushp:SunOS:*:*)
3679bd41f2cSmrg	echo sparc-auspex-sunos${UNAME_RELEASE}
3689bd41f2cSmrg	exit ;;
3699bd41f2cSmrg    # The situation for MiNT is a little confusing.  The machine name
3709bd41f2cSmrg    # can be virtually everything (everything which is not
3719bd41f2cSmrg    # "atarist" or "atariste" at least should have a processor
3729bd41f2cSmrg    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
3739bd41f2cSmrg    # to the lowercase version "mint" (or "freemint").  Finally
3749bd41f2cSmrg    # the system name "TOS" denotes a system which is actually not
3759bd41f2cSmrg    # MiNT.  But MiNT is downward compatible to TOS, so this should
3769bd41f2cSmrg    # be no problem.
3779bd41f2cSmrg    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
3789bd41f2cSmrg        echo m68k-atari-mint${UNAME_RELEASE}
3799bd41f2cSmrg	exit ;;
3809bd41f2cSmrg    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
3819bd41f2cSmrg	echo m68k-atari-mint${UNAME_RELEASE}
3829bd41f2cSmrg        exit ;;
3839bd41f2cSmrg    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
3849bd41f2cSmrg        echo m68k-atari-mint${UNAME_RELEASE}
3859bd41f2cSmrg	exit ;;
3869bd41f2cSmrg    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
3879bd41f2cSmrg        echo m68k-milan-mint${UNAME_RELEASE}
3889bd41f2cSmrg        exit ;;
3899bd41f2cSmrg    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
3909bd41f2cSmrg        echo m68k-hades-mint${UNAME_RELEASE}
3919bd41f2cSmrg        exit ;;
3929bd41f2cSmrg    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
3939bd41f2cSmrg        echo m68k-unknown-mint${UNAME_RELEASE}
3949bd41f2cSmrg        exit ;;
3959bd41f2cSmrg    m68k:machten:*:*)
3969bd41f2cSmrg	echo m68k-apple-machten${UNAME_RELEASE}
3979bd41f2cSmrg	exit ;;
3989bd41f2cSmrg    powerpc:machten:*:*)
3999bd41f2cSmrg	echo powerpc-apple-machten${UNAME_RELEASE}
4009bd41f2cSmrg	exit ;;
4019bd41f2cSmrg    RISC*:Mach:*:*)
4029bd41f2cSmrg	echo mips-dec-mach_bsd4.3
4039bd41f2cSmrg	exit ;;
4049bd41f2cSmrg    RISC*:ULTRIX:*:*)
4059bd41f2cSmrg	echo mips-dec-ultrix${UNAME_RELEASE}
4069bd41f2cSmrg	exit ;;
4079bd41f2cSmrg    VAX*:ULTRIX*:*:*)
4089bd41f2cSmrg	echo vax-dec-ultrix${UNAME_RELEASE}
4099bd41f2cSmrg	exit ;;
4109bd41f2cSmrg    2020:CLIX:*:* | 2430:CLIX:*:*)
4119bd41f2cSmrg	echo clipper-intergraph-clix${UNAME_RELEASE}
4129bd41f2cSmrg	exit ;;
4139bd41f2cSmrg    mips:*:*:UMIPS | mips:*:*:RISCos)
4149bd41f2cSmrg	eval $set_cc_for_build
4159bd41f2cSmrg	sed 's/^	//' << EOF >$dummy.c
4169bd41f2cSmrg#ifdef __cplusplus
4179bd41f2cSmrg#include <stdio.h>  /* for printf() prototype */
4189bd41f2cSmrg	int main (int argc, char *argv[]) {
4199bd41f2cSmrg#else
4209bd41f2cSmrg	int main (argc, argv) int argc; char *argv[]; {
4219bd41f2cSmrg#endif
4229bd41f2cSmrg	#if defined (host_mips) && defined (MIPSEB)
4239bd41f2cSmrg	#if defined (SYSTYPE_SYSV)
4249bd41f2cSmrg	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
4259bd41f2cSmrg	#endif
4269bd41f2cSmrg	#if defined (SYSTYPE_SVR4)
4279bd41f2cSmrg	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
4289bd41f2cSmrg	#endif
4299bd41f2cSmrg	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
4309bd41f2cSmrg	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
4319bd41f2cSmrg	#endif
4329bd41f2cSmrg	#endif
4339bd41f2cSmrg	  exit (-1);
4349bd41f2cSmrg	}
4359bd41f2cSmrgEOF
4369bd41f2cSmrg	$CC_FOR_BUILD -o $dummy $dummy.c &&
4379bd41f2cSmrg	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
4389bd41f2cSmrg	  SYSTEM_NAME=`$dummy $dummyarg` &&
4399bd41f2cSmrg	    { echo "$SYSTEM_NAME"; exit; }
4409bd41f2cSmrg	echo mips-mips-riscos${UNAME_RELEASE}
4419bd41f2cSmrg	exit ;;
4429bd41f2cSmrg    Motorola:PowerMAX_OS:*:*)
4439bd41f2cSmrg	echo powerpc-motorola-powermax
4449bd41f2cSmrg	exit ;;
4459bd41f2cSmrg    Motorola:*:4.3:PL8-*)
4469bd41f2cSmrg	echo powerpc-harris-powermax
4479bd41f2cSmrg	exit ;;
4489bd41f2cSmrg    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
4499bd41f2cSmrg	echo powerpc-harris-powermax
4509bd41f2cSmrg	exit ;;
4519bd41f2cSmrg    Night_Hawk:Power_UNIX:*:*)
4529bd41f2cSmrg	echo powerpc-harris-powerunix
4539bd41f2cSmrg	exit ;;
4549bd41f2cSmrg    m88k:CX/UX:7*:*)
4559bd41f2cSmrg	echo m88k-harris-cxux7
4569bd41f2cSmrg	exit ;;
4579bd41f2cSmrg    m88k:*:4*:R4*)
4589bd41f2cSmrg	echo m88k-motorola-sysv4
4599bd41f2cSmrg	exit ;;
4609bd41f2cSmrg    m88k:*:3*:R3*)
4619bd41f2cSmrg	echo m88k-motorola-sysv3
4629bd41f2cSmrg	exit ;;
4639bd41f2cSmrg    AViiON:dgux:*:*)
4649bd41f2cSmrg        # DG/UX returns AViiON for all architectures
4659bd41f2cSmrg        UNAME_PROCESSOR=`/usr/bin/uname -p`
4669bd41f2cSmrg	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
4679bd41f2cSmrg	then
4689bd41f2cSmrg	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
4699bd41f2cSmrg	       [ ${TARGET_BINARY_INTERFACE}x = x ]
4709bd41f2cSmrg	    then
4719bd41f2cSmrg		echo m88k-dg-dgux${UNAME_RELEASE}
4729bd41f2cSmrg	    else
4739bd41f2cSmrg		echo m88k-dg-dguxbcs${UNAME_RELEASE}
4749bd41f2cSmrg	    fi
4759bd41f2cSmrg	else
4769bd41f2cSmrg	    echo i586-dg-dgux${UNAME_RELEASE}
4779bd41f2cSmrg	fi
4789bd41f2cSmrg 	exit ;;
4799bd41f2cSmrg    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
4809bd41f2cSmrg	echo m88k-dolphin-sysv3
4819bd41f2cSmrg	exit ;;
4829bd41f2cSmrg    M88*:*:R3*:*)
4839bd41f2cSmrg	# Delta 88k system running SVR3
4849bd41f2cSmrg	echo m88k-motorola-sysv3
4859bd41f2cSmrg	exit ;;
4869bd41f2cSmrg    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
4879bd41f2cSmrg	echo m88k-tektronix-sysv3
4889bd41f2cSmrg	exit ;;
4899bd41f2cSmrg    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
4909bd41f2cSmrg	echo m68k-tektronix-bsd
4919bd41f2cSmrg	exit ;;
4929bd41f2cSmrg    *:IRIX*:*:*)
4939bd41f2cSmrg	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
4949bd41f2cSmrg	exit ;;
4959bd41f2cSmrg    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
4969bd41f2cSmrg	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
4979bd41f2cSmrg	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
4989bd41f2cSmrg    i*86:AIX:*:*)
4999bd41f2cSmrg	echo i386-ibm-aix
5009bd41f2cSmrg	exit ;;
5019bd41f2cSmrg    ia64:AIX:*:*)
5029bd41f2cSmrg	if [ -x /usr/bin/oslevel ] ; then
5039bd41f2cSmrg		IBM_REV=`/usr/bin/oslevel`
5049bd41f2cSmrg	else
5059bd41f2cSmrg		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
5069bd41f2cSmrg	fi
5079bd41f2cSmrg	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
5089bd41f2cSmrg	exit ;;
5099bd41f2cSmrg    *:AIX:2:3)
5109bd41f2cSmrg	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
5119bd41f2cSmrg		eval $set_cc_for_build
5129bd41f2cSmrg		sed 's/^		//' << EOF >$dummy.c
5139bd41f2cSmrg		#include <sys/systemcfg.h>
5149bd41f2cSmrg
5159bd41f2cSmrg		main()
5169bd41f2cSmrg			{
5179bd41f2cSmrg			if (!__power_pc())
5189bd41f2cSmrg				exit(1);
5199bd41f2cSmrg			puts("powerpc-ibm-aix3.2.5");
5209bd41f2cSmrg			exit(0);
5219bd41f2cSmrg			}
5229bd41f2cSmrgEOF
5239bd41f2cSmrg		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
5249bd41f2cSmrg		then
5259bd41f2cSmrg			echo "$SYSTEM_NAME"
5269bd41f2cSmrg		else
5279bd41f2cSmrg			echo rs6000-ibm-aix3.2.5
5289bd41f2cSmrg		fi
5299bd41f2cSmrg	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
5309bd41f2cSmrg		echo rs6000-ibm-aix3.2.4
5319bd41f2cSmrg	else
5329bd41f2cSmrg		echo rs6000-ibm-aix3.2
5339bd41f2cSmrg	fi
5349bd41f2cSmrg	exit ;;
5359bd41f2cSmrg    *:AIX:*:[45])
5369bd41f2cSmrg	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
5379bd41f2cSmrg	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
5389bd41f2cSmrg		IBM_ARCH=rs6000
5399bd41f2cSmrg	else
5409bd41f2cSmrg		IBM_ARCH=powerpc
5419bd41f2cSmrg	fi
5429bd41f2cSmrg	if [ -x /usr/bin/oslevel ] ; then
5439bd41f2cSmrg		IBM_REV=`/usr/bin/oslevel`
5449bd41f2cSmrg	else
5459bd41f2cSmrg		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
5469bd41f2cSmrg	fi
5479bd41f2cSmrg	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
5489bd41f2cSmrg	exit ;;
5499bd41f2cSmrg    *:AIX:*:*)
5509bd41f2cSmrg	echo rs6000-ibm-aix
5519bd41f2cSmrg	exit ;;
5529bd41f2cSmrg    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
5539bd41f2cSmrg	echo romp-ibm-bsd4.4
5549bd41f2cSmrg	exit ;;
5559bd41f2cSmrg    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
5569bd41f2cSmrg	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
5579bd41f2cSmrg	exit ;;                             # report: romp-ibm BSD 4.3
5589bd41f2cSmrg    *:BOSX:*:*)
5599bd41f2cSmrg	echo rs6000-bull-bosx
5609bd41f2cSmrg	exit ;;
5619bd41f2cSmrg    DPX/2?00:B.O.S.:*:*)
5629bd41f2cSmrg	echo m68k-bull-sysv3
5639bd41f2cSmrg	exit ;;
5649bd41f2cSmrg    9000/[34]??:4.3bsd:1.*:*)
5659bd41f2cSmrg	echo m68k-hp-bsd
5669bd41f2cSmrg	exit ;;
5679bd41f2cSmrg    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
5689bd41f2cSmrg	echo m68k-hp-bsd4.4
5699bd41f2cSmrg	exit ;;
5709bd41f2cSmrg    9000/[34678]??:HP-UX:*:*)
5719bd41f2cSmrg	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
5729bd41f2cSmrg	case "${UNAME_MACHINE}" in
5739bd41f2cSmrg	    9000/31? )            HP_ARCH=m68000 ;;
5749bd41f2cSmrg	    9000/[34]?? )         HP_ARCH=m68k ;;
5759bd41f2cSmrg	    9000/[678][0-9][0-9])
5769bd41f2cSmrg		if [ -x /usr/bin/getconf ]; then
5779bd41f2cSmrg		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
5789bd41f2cSmrg                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
5799bd41f2cSmrg                    case "${sc_cpu_version}" in
5809bd41f2cSmrg                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
5819bd41f2cSmrg                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
5829bd41f2cSmrg                      532)                      # CPU_PA_RISC2_0
5839bd41f2cSmrg                        case "${sc_kernel_bits}" in
5849bd41f2cSmrg                          32) HP_ARCH="hppa2.0n" ;;
5859bd41f2cSmrg                          64) HP_ARCH="hppa2.0w" ;;
5869bd41f2cSmrg			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
5879bd41f2cSmrg                        esac ;;
5889bd41f2cSmrg                    esac
5899bd41f2cSmrg		fi
5909bd41f2cSmrg		if [ "${HP_ARCH}" = "" ]; then
5919bd41f2cSmrg		    eval $set_cc_for_build
5929bd41f2cSmrg		    sed 's/^              //' << EOF >$dummy.c
5939bd41f2cSmrg
5949bd41f2cSmrg              #define _HPUX_SOURCE
5959bd41f2cSmrg              #include <stdlib.h>
5969bd41f2cSmrg              #include <unistd.h>
5979bd41f2cSmrg
5989bd41f2cSmrg              int main ()
5999bd41f2cSmrg              {
6009bd41f2cSmrg              #if defined(_SC_KERNEL_BITS)
6019bd41f2cSmrg                  long bits = sysconf(_SC_KERNEL_BITS);
6029bd41f2cSmrg              #endif
6039bd41f2cSmrg                  long cpu  = sysconf (_SC_CPU_VERSION);
6049bd41f2cSmrg
6059bd41f2cSmrg                  switch (cpu)
6069bd41f2cSmrg              	{
6079bd41f2cSmrg              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
6089bd41f2cSmrg              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
6099bd41f2cSmrg              	case CPU_PA_RISC2_0:
6109bd41f2cSmrg              #if defined(_SC_KERNEL_BITS)
6119bd41f2cSmrg              	    switch (bits)
6129bd41f2cSmrg              		{
6139bd41f2cSmrg              		case 64: puts ("hppa2.0w"); break;
6149bd41f2cSmrg              		case 32: puts ("hppa2.0n"); break;
6159bd41f2cSmrg              		default: puts ("hppa2.0"); break;
6169bd41f2cSmrg              		} break;
6179bd41f2cSmrg              #else  /* !defined(_SC_KERNEL_BITS) */
6189bd41f2cSmrg              	    puts ("hppa2.0"); break;
6199bd41f2cSmrg              #endif
6209bd41f2cSmrg              	default: puts ("hppa1.0"); break;
6219bd41f2cSmrg              	}
6229bd41f2cSmrg                  exit (0);
6239bd41f2cSmrg              }
6249bd41f2cSmrgEOF
6259bd41f2cSmrg		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
6269bd41f2cSmrg		    test -z "$HP_ARCH" && HP_ARCH=hppa
6279bd41f2cSmrg		fi ;;
6289bd41f2cSmrg	esac
6299bd41f2cSmrg	if [ ${HP_ARCH} = "hppa2.0w" ]
6309bd41f2cSmrg	then
6319bd41f2cSmrg	    eval $set_cc_for_build
6329bd41f2cSmrg
6339bd41f2cSmrg	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
6349bd41f2cSmrg	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
6359bd41f2cSmrg	    # generating 64-bit code.  GNU and HP use different nomenclature:
6369bd41f2cSmrg	    #
6379bd41f2cSmrg	    # $ CC_FOR_BUILD=cc ./config.guess
6389bd41f2cSmrg	    # => hppa2.0w-hp-hpux11.23
6399bd41f2cSmrg	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
6409bd41f2cSmrg	    # => hppa64-hp-hpux11.23
6419bd41f2cSmrg
6429bd41f2cSmrg	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
6439bd41f2cSmrg		grep __LP64__ >/dev/null
6449bd41f2cSmrg	    then
6459bd41f2cSmrg		HP_ARCH="hppa2.0w"
6469bd41f2cSmrg	    else
6479bd41f2cSmrg		HP_ARCH="hppa64"
6489bd41f2cSmrg	    fi
6499bd41f2cSmrg	fi
6509bd41f2cSmrg	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
6519bd41f2cSmrg	exit ;;
6529bd41f2cSmrg    ia64:HP-UX:*:*)
6539bd41f2cSmrg	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
6549bd41f2cSmrg	echo ia64-hp-hpux${HPUX_REV}
6559bd41f2cSmrg	exit ;;
6569bd41f2cSmrg    3050*:HI-UX:*:*)
6579bd41f2cSmrg	eval $set_cc_for_build
6589bd41f2cSmrg	sed 's/^	//' << EOF >$dummy.c
6599bd41f2cSmrg	#include <unistd.h>
6609bd41f2cSmrg	int
6619bd41f2cSmrg	main ()
6629bd41f2cSmrg	{
6639bd41f2cSmrg	  long cpu = sysconf (_SC_CPU_VERSION);
6649bd41f2cSmrg	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
6659bd41f2cSmrg	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
6669bd41f2cSmrg	     results, however.  */
6679bd41f2cSmrg	  if (CPU_IS_PA_RISC (cpu))
6689bd41f2cSmrg	    {
6699bd41f2cSmrg	      switch (cpu)
6709bd41f2cSmrg		{
6719bd41f2cSmrg		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
6729bd41f2cSmrg		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
6739bd41f2cSmrg		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
6749bd41f2cSmrg		  default: puts ("hppa-hitachi-hiuxwe2"); break;
6759bd41f2cSmrg		}
6769bd41f2cSmrg	    }
6779bd41f2cSmrg	  else if (CPU_IS_HP_MC68K (cpu))
6789bd41f2cSmrg	    puts ("m68k-hitachi-hiuxwe2");
6799bd41f2cSmrg	  else puts ("unknown-hitachi-hiuxwe2");
6809bd41f2cSmrg	  exit (0);
6819bd41f2cSmrg	}
6829bd41f2cSmrgEOF
6839bd41f2cSmrg	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
6849bd41f2cSmrg		{ echo "$SYSTEM_NAME"; exit; }
6859bd41f2cSmrg	echo unknown-hitachi-hiuxwe2
6869bd41f2cSmrg	exit ;;
6879bd41f2cSmrg    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
6889bd41f2cSmrg	echo hppa1.1-hp-bsd
6899bd41f2cSmrg	exit ;;
6909bd41f2cSmrg    9000/8??:4.3bsd:*:*)
6919bd41f2cSmrg	echo hppa1.0-hp-bsd
6929bd41f2cSmrg	exit ;;
6939bd41f2cSmrg    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
6949bd41f2cSmrg	echo hppa1.0-hp-mpeix
6959bd41f2cSmrg	exit ;;
6969bd41f2cSmrg    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
6979bd41f2cSmrg	echo hppa1.1-hp-osf
6989bd41f2cSmrg	exit ;;
6999bd41f2cSmrg    hp8??:OSF1:*:*)
7009bd41f2cSmrg	echo hppa1.0-hp-osf
7019bd41f2cSmrg	exit ;;
7029bd41f2cSmrg    i*86:OSF1:*:*)
7039bd41f2cSmrg	if [ -x /usr/sbin/sysversion ] ; then
7049bd41f2cSmrg	    echo ${UNAME_MACHINE}-unknown-osf1mk
7059bd41f2cSmrg	else
7069bd41f2cSmrg	    echo ${UNAME_MACHINE}-unknown-osf1
7079bd41f2cSmrg	fi
7089bd41f2cSmrg	exit ;;
7099bd41f2cSmrg    parisc*:Lites*:*:*)
7109bd41f2cSmrg	echo hppa1.1-hp-lites
7119bd41f2cSmrg	exit ;;
7129bd41f2cSmrg    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
7139bd41f2cSmrg	echo c1-convex-bsd
7149bd41f2cSmrg        exit ;;
7159bd41f2cSmrg    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
7169bd41f2cSmrg	if getsysinfo -f scalar_acc
7179bd41f2cSmrg	then echo c32-convex-bsd
7189bd41f2cSmrg	else echo c2-convex-bsd
7199bd41f2cSmrg	fi
7209bd41f2cSmrg        exit ;;
7219bd41f2cSmrg    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
7229bd41f2cSmrg	echo c34-convex-bsd
7239bd41f2cSmrg        exit ;;
7249bd41f2cSmrg    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
7259bd41f2cSmrg	echo c38-convex-bsd
7269bd41f2cSmrg        exit ;;
7279bd41f2cSmrg    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
7289bd41f2cSmrg	echo c4-convex-bsd
7299bd41f2cSmrg        exit ;;
7309bd41f2cSmrg    CRAY*Y-MP:*:*:*)
7319bd41f2cSmrg	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7329bd41f2cSmrg	exit ;;
7339bd41f2cSmrg    CRAY*[A-Z]90:*:*:*)
7349bd41f2cSmrg	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
7359bd41f2cSmrg	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
7369bd41f2cSmrg	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
7379bd41f2cSmrg	      -e 's/\.[^.]*$/.X/'
7389bd41f2cSmrg	exit ;;
7399bd41f2cSmrg    CRAY*TS:*:*:*)
7409bd41f2cSmrg	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7419bd41f2cSmrg	exit ;;
7429bd41f2cSmrg    CRAY*T3E:*:*:*)
7439bd41f2cSmrg	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7449bd41f2cSmrg	exit ;;
7459bd41f2cSmrg    CRAY*SV1:*:*:*)
7469bd41f2cSmrg	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7479bd41f2cSmrg	exit ;;
7489bd41f2cSmrg    *:UNICOS/mp:*:*)
7499bd41f2cSmrg	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
7509bd41f2cSmrg	exit ;;
7519bd41f2cSmrg    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
7529bd41f2cSmrg	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
7539bd41f2cSmrg        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
7549bd41f2cSmrg        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
7559bd41f2cSmrg        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
7569bd41f2cSmrg        exit ;;
7579bd41f2cSmrg    5000:UNIX_System_V:4.*:*)
7589bd41f2cSmrg        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
7599bd41f2cSmrg        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
7609bd41f2cSmrg        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
7619bd41f2cSmrg	exit ;;
7629bd41f2cSmrg    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
7639bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
7649bd41f2cSmrg	exit ;;
7659bd41f2cSmrg    sparc*:BSD/OS:*:*)
7669bd41f2cSmrg	echo sparc-unknown-bsdi${UNAME_RELEASE}
7679bd41f2cSmrg	exit ;;
7689bd41f2cSmrg    *:BSD/OS:*:*)
7699bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
7709bd41f2cSmrg	exit ;;
7719bd41f2cSmrg    *:FreeBSD:*:*)
7729bd41f2cSmrg	case ${UNAME_MACHINE} in
7739bd41f2cSmrg	    pc98)
7749bd41f2cSmrg		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
7759bd41f2cSmrg	    amd64)
7769bd41f2cSmrg		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
7779bd41f2cSmrg	    *)
7789bd41f2cSmrg		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
7799bd41f2cSmrg	esac
7809bd41f2cSmrg	exit ;;
7819bd41f2cSmrg    i*:CYGWIN*:*)
7829bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-cygwin
7839bd41f2cSmrg	exit ;;
7849bd41f2cSmrg    *:MINGW*:*)
7859bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-mingw32
7869bd41f2cSmrg	exit ;;
7879bd41f2cSmrg    i*:windows32*:*)
7889bd41f2cSmrg    	# uname -m includes "-pc" on this system.
7899bd41f2cSmrg    	echo ${UNAME_MACHINE}-mingw32
7909bd41f2cSmrg	exit ;;
7919bd41f2cSmrg    i*:PW*:*)
7929bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-pw32
7939bd41f2cSmrg	exit ;;
7949bd41f2cSmrg    *:Interix*:[3456]*)
7959bd41f2cSmrg    	case ${UNAME_MACHINE} in
7969bd41f2cSmrg	    x86) 
7979bd41f2cSmrg		echo i586-pc-interix${UNAME_RELEASE}
7989bd41f2cSmrg		exit ;;
7999bd41f2cSmrg	    EM64T | authenticamd)
8009bd41f2cSmrg		echo x86_64-unknown-interix${UNAME_RELEASE}
8019bd41f2cSmrg		exit ;;
8029bd41f2cSmrg	esac ;;
8039bd41f2cSmrg    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
8049bd41f2cSmrg	echo i${UNAME_MACHINE}-pc-mks
8059bd41f2cSmrg	exit ;;
8069bd41f2cSmrg    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
8079bd41f2cSmrg	# How do we know it's Interix rather than the generic POSIX subsystem?
8089bd41f2cSmrg	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
8099bd41f2cSmrg	# UNAME_MACHINE based on the output of uname instead of i386?
8109bd41f2cSmrg	echo i586-pc-interix
8119bd41f2cSmrg	exit ;;
8129bd41f2cSmrg    i*:UWIN*:*)
8139bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-uwin
8149bd41f2cSmrg	exit ;;
8159bd41f2cSmrg    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
8169bd41f2cSmrg	echo x86_64-unknown-cygwin
8179bd41f2cSmrg	exit ;;
8189bd41f2cSmrg    p*:CYGWIN*:*)
8199bd41f2cSmrg	echo powerpcle-unknown-cygwin
8209bd41f2cSmrg	exit ;;
8219bd41f2cSmrg    prep*:SunOS:5.*:*)
8229bd41f2cSmrg	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
8239bd41f2cSmrg	exit ;;
8249bd41f2cSmrg    *:GNU:*:*)
8259bd41f2cSmrg	# the GNU system
8269bd41f2cSmrg	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
8279bd41f2cSmrg	exit ;;
8289bd41f2cSmrg    *:GNU/*:*:*)
8299bd41f2cSmrg	# other systems with GNU libc and userland
8309bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
8319bd41f2cSmrg	exit ;;
8329bd41f2cSmrg    i*86:Minix:*:*)
8339bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-minix
8349bd41f2cSmrg	exit ;;
8359bd41f2cSmrg    arm*:Linux:*:*)
8369bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
8379bd41f2cSmrg	exit ;;
8389bd41f2cSmrg    avr32*:Linux:*:*)
8399bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
8409bd41f2cSmrg	exit ;;
8419bd41f2cSmrg    cris:Linux:*:*)
8429bd41f2cSmrg	echo cris-axis-linux-gnu
8439bd41f2cSmrg	exit ;;
8449bd41f2cSmrg    crisv32:Linux:*:*)
8459bd41f2cSmrg	echo crisv32-axis-linux-gnu
8469bd41f2cSmrg	exit ;;
8479bd41f2cSmrg    frv:Linux:*:*)
8489bd41f2cSmrg    	echo frv-unknown-linux-gnu
8499bd41f2cSmrg	exit ;;
8509bd41f2cSmrg    ia64:Linux:*:*)
8519bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
8529bd41f2cSmrg	exit ;;
8539bd41f2cSmrg    m32r*:Linux:*:*)
8549bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
8559bd41f2cSmrg	exit ;;
8569bd41f2cSmrg    m68*:Linux:*:*)
8579bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
8589bd41f2cSmrg	exit ;;
8599bd41f2cSmrg    mips:Linux:*:*)
8609bd41f2cSmrg	eval $set_cc_for_build
8619bd41f2cSmrg	sed 's/^	//' << EOF >$dummy.c
8629bd41f2cSmrg	#undef CPU
8639bd41f2cSmrg	#undef mips
8649bd41f2cSmrg	#undef mipsel
8659bd41f2cSmrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
8669bd41f2cSmrg	CPU=mipsel
8679bd41f2cSmrg	#else
8689bd41f2cSmrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
8699bd41f2cSmrg	CPU=mips
8709bd41f2cSmrg	#else
8719bd41f2cSmrg	CPU=
8729bd41f2cSmrg	#endif
8739bd41f2cSmrg	#endif
8749bd41f2cSmrgEOF
8759bd41f2cSmrg	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
8769bd41f2cSmrg	    /^CPU/{
8779bd41f2cSmrg		s: ::g
8789bd41f2cSmrg		p
8799bd41f2cSmrg	    }'`"
8809bd41f2cSmrg	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
8819bd41f2cSmrg	;;
8829bd41f2cSmrg    mips64:Linux:*:*)
8839bd41f2cSmrg	eval $set_cc_for_build
8849bd41f2cSmrg	sed 's/^	//' << EOF >$dummy.c
8859bd41f2cSmrg	#undef CPU
8869bd41f2cSmrg	#undef mips64
8879bd41f2cSmrg	#undef mips64el
8889bd41f2cSmrg	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
8899bd41f2cSmrg	CPU=mips64el
8909bd41f2cSmrg	#else
8919bd41f2cSmrg	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
8929bd41f2cSmrg	CPU=mips64
8939bd41f2cSmrg	#else
8949bd41f2cSmrg	CPU=
8959bd41f2cSmrg	#endif
8969bd41f2cSmrg	#endif
8979bd41f2cSmrgEOF
8989bd41f2cSmrg	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
8999bd41f2cSmrg	    /^CPU/{
9009bd41f2cSmrg		s: ::g
9019bd41f2cSmrg		p
9029bd41f2cSmrg	    }'`"
9039bd41f2cSmrg	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
9049bd41f2cSmrg	;;
9059bd41f2cSmrg    or32:Linux:*:*)
9069bd41f2cSmrg	echo or32-unknown-linux-gnu
9079bd41f2cSmrg	exit ;;
9089bd41f2cSmrg    ppc:Linux:*:*)
9099bd41f2cSmrg	echo powerpc-unknown-linux-gnu
9109bd41f2cSmrg	exit ;;
9119bd41f2cSmrg    ppc64:Linux:*:*)
9129bd41f2cSmrg	echo powerpc64-unknown-linux-gnu
9139bd41f2cSmrg	exit ;;
9149bd41f2cSmrg    alpha:Linux:*:*)
9159bd41f2cSmrg	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
9169bd41f2cSmrg	  EV5)   UNAME_MACHINE=alphaev5 ;;
9179bd41f2cSmrg	  EV56)  UNAME_MACHINE=alphaev56 ;;
9189bd41f2cSmrg	  PCA56) UNAME_MACHINE=alphapca56 ;;
9199bd41f2cSmrg	  PCA57) UNAME_MACHINE=alphapca56 ;;
9209bd41f2cSmrg	  EV6)   UNAME_MACHINE=alphaev6 ;;
9219bd41f2cSmrg	  EV67)  UNAME_MACHINE=alphaev67 ;;
9229bd41f2cSmrg	  EV68*) UNAME_MACHINE=alphaev68 ;;
9239bd41f2cSmrg        esac
9249bd41f2cSmrg	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
9259bd41f2cSmrg	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
9269bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
9279bd41f2cSmrg	exit ;;
9289bd41f2cSmrg    parisc:Linux:*:* | hppa:Linux:*:*)
9299bd41f2cSmrg	# Look for CPU level
9309bd41f2cSmrg	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
9319bd41f2cSmrg	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
9329bd41f2cSmrg	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
9339bd41f2cSmrg	  *)    echo hppa-unknown-linux-gnu ;;
9349bd41f2cSmrg	esac
9359bd41f2cSmrg	exit ;;
9369bd41f2cSmrg    parisc64:Linux:*:* | hppa64:Linux:*:*)
9379bd41f2cSmrg	echo hppa64-unknown-linux-gnu
9389bd41f2cSmrg	exit ;;
9399bd41f2cSmrg    s390:Linux:*:* | s390x:Linux:*:*)
9409bd41f2cSmrg	echo ${UNAME_MACHINE}-ibm-linux
9419bd41f2cSmrg	exit ;;
9429bd41f2cSmrg    sh64*:Linux:*:*)
9439bd41f2cSmrg    	echo ${UNAME_MACHINE}-unknown-linux-gnu
9449bd41f2cSmrg	exit ;;
9459bd41f2cSmrg    sh*:Linux:*:*)
9469bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
9479bd41f2cSmrg	exit ;;
9489bd41f2cSmrg    sparc:Linux:*:* | sparc64:Linux:*:*)
9499bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-linux-gnu
9509bd41f2cSmrg	exit ;;
9519bd41f2cSmrg    vax:Linux:*:*)
9529bd41f2cSmrg	echo ${UNAME_MACHINE}-dec-linux-gnu
9539bd41f2cSmrg	exit ;;
9549bd41f2cSmrg    x86_64:Linux:*:*)
9559bd41f2cSmrg	echo x86_64-unknown-linux-gnu
9569bd41f2cSmrg	exit ;;
9579bd41f2cSmrg    xtensa:Linux:*:*)
9589bd41f2cSmrg    	echo xtensa-unknown-linux-gnu
9599bd41f2cSmrg	exit ;;
9609bd41f2cSmrg    i*86:Linux:*:*)
9619bd41f2cSmrg	# The BFD linker knows what the default object file format is, so
9629bd41f2cSmrg	# first see if it will tell us. cd to the root directory to prevent
9639bd41f2cSmrg	# problems with other programs or directories called `ld' in the path.
9649bd41f2cSmrg	# Set LC_ALL=C to ensure ld outputs messages in English.
9659bd41f2cSmrg	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
9669bd41f2cSmrg			 | sed -ne '/supported targets:/!d
9679bd41f2cSmrg				    s/[ 	][ 	]*/ /g
9689bd41f2cSmrg				    s/.*supported targets: *//
9699bd41f2cSmrg				    s/ .*//
9709bd41f2cSmrg				    p'`
9719bd41f2cSmrg        case "$ld_supported_targets" in
9729bd41f2cSmrg	  elf32-i386)
9739bd41f2cSmrg		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
9749bd41f2cSmrg		;;
9759bd41f2cSmrg	  a.out-i386-linux)
9769bd41f2cSmrg		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
9779bd41f2cSmrg		exit ;;
9789bd41f2cSmrg	  coff-i386)
9799bd41f2cSmrg		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
9809bd41f2cSmrg		exit ;;
9819bd41f2cSmrg	  "")
9829bd41f2cSmrg		# Either a pre-BFD a.out linker (linux-gnuoldld) or
9839bd41f2cSmrg		# one that does not give us useful --help.
9849bd41f2cSmrg		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
9859bd41f2cSmrg		exit ;;
9869bd41f2cSmrg	esac
9879bd41f2cSmrg	# Determine whether the default compiler is a.out or elf
9889bd41f2cSmrg	eval $set_cc_for_build
9899bd41f2cSmrg	sed 's/^	//' << EOF >$dummy.c
9909bd41f2cSmrg	#include <features.h>
9919bd41f2cSmrg	#ifdef __ELF__
9929bd41f2cSmrg	# ifdef __GLIBC__
9939bd41f2cSmrg	#  if __GLIBC__ >= 2
9949bd41f2cSmrg	LIBC=gnu
9959bd41f2cSmrg	#  else
9969bd41f2cSmrg	LIBC=gnulibc1
9979bd41f2cSmrg	#  endif
9989bd41f2cSmrg	# else
9999bd41f2cSmrg	LIBC=gnulibc1
10009bd41f2cSmrg	# endif
10019bd41f2cSmrg	#else
10029bd41f2cSmrg	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
10039bd41f2cSmrg	LIBC=gnu
10049bd41f2cSmrg	#else
10059bd41f2cSmrg	LIBC=gnuaout
10069bd41f2cSmrg	#endif
10079bd41f2cSmrg	#endif
10089bd41f2cSmrg	#ifdef __dietlibc__
10099bd41f2cSmrg	LIBC=dietlibc
10109bd41f2cSmrg	#endif
10119bd41f2cSmrgEOF
10129bd41f2cSmrg	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
10139bd41f2cSmrg	    /^LIBC/{
10149bd41f2cSmrg		s: ::g
10159bd41f2cSmrg		p
10169bd41f2cSmrg	    }'`"
10179bd41f2cSmrg	test x"${LIBC}" != x && {
10189bd41f2cSmrg		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
10199bd41f2cSmrg		exit
10209bd41f2cSmrg	}
10219bd41f2cSmrg	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
10229bd41f2cSmrg	;;
10239bd41f2cSmrg    i*86:DYNIX/ptx:4*:*)
10249bd41f2cSmrg	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
10259bd41f2cSmrg	# earlier versions are messed up and put the nodename in both
10269bd41f2cSmrg	# sysname and nodename.
10279bd41f2cSmrg	echo i386-sequent-sysv4
10289bd41f2cSmrg	exit ;;
10299bd41f2cSmrg    i*86:UNIX_SV:4.2MP:2.*)
10309bd41f2cSmrg        # Unixware is an offshoot of SVR4, but it has its own version
10319bd41f2cSmrg        # number series starting with 2...
10329bd41f2cSmrg        # I am not positive that other SVR4 systems won't match this,
10339bd41f2cSmrg	# I just have to hope.  -- rms.
10349bd41f2cSmrg        # Use sysv4.2uw... so that sysv4* matches it.
10359bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
10369bd41f2cSmrg	exit ;;
10379bd41f2cSmrg    i*86:OS/2:*:*)
10389bd41f2cSmrg	# If we were able to find `uname', then EMX Unix compatibility
10399bd41f2cSmrg	# is probably installed.
10409bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-os2-emx
10419bd41f2cSmrg	exit ;;
10429bd41f2cSmrg    i*86:XTS-300:*:STOP)
10439bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-stop
10449bd41f2cSmrg	exit ;;
10459bd41f2cSmrg    i*86:atheos:*:*)
10469bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-atheos
10479bd41f2cSmrg	exit ;;
10489bd41f2cSmrg    i*86:syllable:*:*)
10499bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-syllable
10509bd41f2cSmrg	exit ;;
10519bd41f2cSmrg    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
10529bd41f2cSmrg	echo i386-unknown-lynxos${UNAME_RELEASE}
10539bd41f2cSmrg	exit ;;
10549bd41f2cSmrg    i*86:*DOS:*:*)
10559bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-msdosdjgpp
10569bd41f2cSmrg	exit ;;
10579bd41f2cSmrg    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
10589bd41f2cSmrg	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
10599bd41f2cSmrg	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
10609bd41f2cSmrg		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
10619bd41f2cSmrg	else
10629bd41f2cSmrg		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
10639bd41f2cSmrg	fi
10649bd41f2cSmrg	exit ;;
10659bd41f2cSmrg    i*86:*:5:[678]*)
10669bd41f2cSmrg    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
10679bd41f2cSmrg	case `/bin/uname -X | grep "^Machine"` in
10689bd41f2cSmrg	    *486*)	     UNAME_MACHINE=i486 ;;
10699bd41f2cSmrg	    *Pentium)	     UNAME_MACHINE=i586 ;;
10709bd41f2cSmrg	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
10719bd41f2cSmrg	esac
10729bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
10739bd41f2cSmrg	exit ;;
10749bd41f2cSmrg    i*86:*:3.2:*)
10759bd41f2cSmrg	if test -f /usr/options/cb.name; then
10769bd41f2cSmrg		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
10779bd41f2cSmrg		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
10789bd41f2cSmrg	elif /bin/uname -X 2>/dev/null >/dev/null ; then
10799bd41f2cSmrg		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
10809bd41f2cSmrg		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
10819bd41f2cSmrg		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
10829bd41f2cSmrg			&& UNAME_MACHINE=i586
10839bd41f2cSmrg		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
10849bd41f2cSmrg			&& UNAME_MACHINE=i686
10859bd41f2cSmrg		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
10869bd41f2cSmrg			&& UNAME_MACHINE=i686
10879bd41f2cSmrg		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
10889bd41f2cSmrg	else
10899bd41f2cSmrg		echo ${UNAME_MACHINE}-pc-sysv32
10909bd41f2cSmrg	fi
10919bd41f2cSmrg	exit ;;
10929bd41f2cSmrg    pc:*:*:*)
10939bd41f2cSmrg	# Left here for compatibility:
10949bd41f2cSmrg        # uname -m prints for DJGPP always 'pc', but it prints nothing about
10959bd41f2cSmrg        # the processor, so we play safe by assuming i386.
10969bd41f2cSmrg	echo i386-pc-msdosdjgpp
10979bd41f2cSmrg        exit ;;
10989bd41f2cSmrg    Intel:Mach:3*:*)
10999bd41f2cSmrg	echo i386-pc-mach3
11009bd41f2cSmrg	exit ;;
11019bd41f2cSmrg    paragon:*:*:*)
11029bd41f2cSmrg	echo i860-intel-osf1
11039bd41f2cSmrg	exit ;;
11049bd41f2cSmrg    i860:*:4.*:*) # i860-SVR4
11059bd41f2cSmrg	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
11069bd41f2cSmrg	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
11079bd41f2cSmrg	else # Add other i860-SVR4 vendors below as they are discovered.
11089bd41f2cSmrg	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
11099bd41f2cSmrg	fi
11109bd41f2cSmrg	exit ;;
11119bd41f2cSmrg    mini*:CTIX:SYS*5:*)
11129bd41f2cSmrg	# "miniframe"
11139bd41f2cSmrg	echo m68010-convergent-sysv
11149bd41f2cSmrg	exit ;;
11159bd41f2cSmrg    mc68k:UNIX:SYSTEM5:3.51m)
11169bd41f2cSmrg	echo m68k-convergent-sysv
11179bd41f2cSmrg	exit ;;
11189bd41f2cSmrg    M680?0:D-NIX:5.3:*)
11199bd41f2cSmrg	echo m68k-diab-dnix
11209bd41f2cSmrg	exit ;;
11219bd41f2cSmrg    M68*:*:R3V[5678]*:*)
11229bd41f2cSmrg	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
11239bd41f2cSmrg    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)
11249bd41f2cSmrg	OS_REL=''
11259bd41f2cSmrg	test -r /etc/.relid \
11269bd41f2cSmrg	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
11279bd41f2cSmrg	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
11289bd41f2cSmrg	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
11299bd41f2cSmrg	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
11309bd41f2cSmrg	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
11319bd41f2cSmrg    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
11329bd41f2cSmrg        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
11339bd41f2cSmrg          && { echo i486-ncr-sysv4; exit; } ;;
11349bd41f2cSmrg    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
11359bd41f2cSmrg	echo m68k-unknown-lynxos${UNAME_RELEASE}
11369bd41f2cSmrg	exit ;;
11379bd41f2cSmrg    mc68030:UNIX_System_V:4.*:*)
11389bd41f2cSmrg	echo m68k-atari-sysv4
11399bd41f2cSmrg	exit ;;
11409bd41f2cSmrg    TSUNAMI:LynxOS:2.*:*)
11419bd41f2cSmrg	echo sparc-unknown-lynxos${UNAME_RELEASE}
11429bd41f2cSmrg	exit ;;
11439bd41f2cSmrg    rs6000:LynxOS:2.*:*)
11449bd41f2cSmrg	echo rs6000-unknown-lynxos${UNAME_RELEASE}
11459bd41f2cSmrg	exit ;;
11469bd41f2cSmrg    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
11479bd41f2cSmrg	echo powerpc-unknown-lynxos${UNAME_RELEASE}
11489bd41f2cSmrg	exit ;;
11499bd41f2cSmrg    SM[BE]S:UNIX_SV:*:*)
11509bd41f2cSmrg	echo mips-dde-sysv${UNAME_RELEASE}
11519bd41f2cSmrg	exit ;;
11529bd41f2cSmrg    RM*:ReliantUNIX-*:*:*)
11539bd41f2cSmrg	echo mips-sni-sysv4
11549bd41f2cSmrg	exit ;;
11559bd41f2cSmrg    RM*:SINIX-*:*:*)
11569bd41f2cSmrg	echo mips-sni-sysv4
11579bd41f2cSmrg	exit ;;
11589bd41f2cSmrg    *:SINIX-*:*:*)
11599bd41f2cSmrg	if uname -p 2>/dev/null >/dev/null ; then
11609bd41f2cSmrg		UNAME_MACHINE=`(uname -p) 2>/dev/null`
11619bd41f2cSmrg		echo ${UNAME_MACHINE}-sni-sysv4
11629bd41f2cSmrg	else
11639bd41f2cSmrg		echo ns32k-sni-sysv
11649bd41f2cSmrg	fi
11659bd41f2cSmrg	exit ;;
11669bd41f2cSmrg    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
11679bd41f2cSmrg                      # says <Richard.M.Bartel@ccMail.Census.GOV>
11689bd41f2cSmrg        echo i586-unisys-sysv4
11699bd41f2cSmrg        exit ;;
11709bd41f2cSmrg    *:UNIX_System_V:4*:FTX*)
11719bd41f2cSmrg	# From Gerald Hewes <hewes@openmarket.com>.
11729bd41f2cSmrg	# How about differentiating between stratus architectures? -djm
11739bd41f2cSmrg	echo hppa1.1-stratus-sysv4
11749bd41f2cSmrg	exit ;;
11759bd41f2cSmrg    *:*:*:FTX*)
11769bd41f2cSmrg	# From seanf@swdc.stratus.com.
11779bd41f2cSmrg	echo i860-stratus-sysv4
11789bd41f2cSmrg	exit ;;
11799bd41f2cSmrg    i*86:VOS:*:*)
11809bd41f2cSmrg	# From Paul.Green@stratus.com.
11819bd41f2cSmrg	echo ${UNAME_MACHINE}-stratus-vos
11829bd41f2cSmrg	exit ;;
11839bd41f2cSmrg    *:VOS:*:*)
11849bd41f2cSmrg	# From Paul.Green@stratus.com.
11859bd41f2cSmrg	echo hppa1.1-stratus-vos
11869bd41f2cSmrg	exit ;;
11879bd41f2cSmrg    mc68*:A/UX:*:*)
11889bd41f2cSmrg	echo m68k-apple-aux${UNAME_RELEASE}
11899bd41f2cSmrg	exit ;;
11909bd41f2cSmrg    news*:NEWS-OS:6*:*)
11919bd41f2cSmrg	echo mips-sony-newsos6
11929bd41f2cSmrg	exit ;;
11939bd41f2cSmrg    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
11949bd41f2cSmrg	if [ -d /usr/nec ]; then
11959bd41f2cSmrg	        echo mips-nec-sysv${UNAME_RELEASE}
11969bd41f2cSmrg	else
11979bd41f2cSmrg	        echo mips-unknown-sysv${UNAME_RELEASE}
11989bd41f2cSmrg	fi
11999bd41f2cSmrg        exit ;;
12009bd41f2cSmrg    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
12019bd41f2cSmrg	echo powerpc-be-beos
12029bd41f2cSmrg	exit ;;
12039bd41f2cSmrg    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
12049bd41f2cSmrg	echo powerpc-apple-beos
12059bd41f2cSmrg	exit ;;
12069bd41f2cSmrg    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
12079bd41f2cSmrg	echo i586-pc-beos
12089bd41f2cSmrg	exit ;;
12099bd41f2cSmrg    SX-4:SUPER-UX:*:*)
12109bd41f2cSmrg	echo sx4-nec-superux${UNAME_RELEASE}
12119bd41f2cSmrg	exit ;;
12129bd41f2cSmrg    SX-5:SUPER-UX:*:*)
12139bd41f2cSmrg	echo sx5-nec-superux${UNAME_RELEASE}
12149bd41f2cSmrg	exit ;;
12159bd41f2cSmrg    SX-6:SUPER-UX:*:*)
12169bd41f2cSmrg	echo sx6-nec-superux${UNAME_RELEASE}
12179bd41f2cSmrg	exit ;;
12189bd41f2cSmrg    SX-7:SUPER-UX:*:*)
12199bd41f2cSmrg	echo sx7-nec-superux${UNAME_RELEASE}
12209bd41f2cSmrg	exit ;;
12219bd41f2cSmrg    SX-8:SUPER-UX:*:*)
12229bd41f2cSmrg	echo sx8-nec-superux${UNAME_RELEASE}
12239bd41f2cSmrg	exit ;;
12249bd41f2cSmrg    SX-8R:SUPER-UX:*:*)
12259bd41f2cSmrg	echo sx8r-nec-superux${UNAME_RELEASE}
12269bd41f2cSmrg	exit ;;
12279bd41f2cSmrg    Power*:Rhapsody:*:*)
12289bd41f2cSmrg	echo powerpc-apple-rhapsody${UNAME_RELEASE}
12299bd41f2cSmrg	exit ;;
12309bd41f2cSmrg    *:Rhapsody:*:*)
12319bd41f2cSmrg	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
12329bd41f2cSmrg	exit ;;
12339bd41f2cSmrg    *:Darwin:*:*)
12349bd41f2cSmrg	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
12359bd41f2cSmrg	case $UNAME_PROCESSOR in
12369bd41f2cSmrg	    unknown) UNAME_PROCESSOR=powerpc ;;
12379bd41f2cSmrg	esac
12389bd41f2cSmrg	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
12399bd41f2cSmrg	exit ;;
12409bd41f2cSmrg    *:procnto*:*:* | *:QNX:[0123456789]*:*)
12419bd41f2cSmrg	UNAME_PROCESSOR=`uname -p`
12429bd41f2cSmrg	if test "$UNAME_PROCESSOR" = "x86"; then
12439bd41f2cSmrg		UNAME_PROCESSOR=i386
12449bd41f2cSmrg		UNAME_MACHINE=pc
12459bd41f2cSmrg	fi
12469bd41f2cSmrg	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
12479bd41f2cSmrg	exit ;;
12489bd41f2cSmrg    *:QNX:*:4*)
12499bd41f2cSmrg	echo i386-pc-qnx
12509bd41f2cSmrg	exit ;;
12519bd41f2cSmrg    NSE-?:NONSTOP_KERNEL:*:*)
12529bd41f2cSmrg	echo nse-tandem-nsk${UNAME_RELEASE}
12539bd41f2cSmrg	exit ;;
12549bd41f2cSmrg    NSR-?:NONSTOP_KERNEL:*:*)
12559bd41f2cSmrg	echo nsr-tandem-nsk${UNAME_RELEASE}
12569bd41f2cSmrg	exit ;;
12579bd41f2cSmrg    *:NonStop-UX:*:*)
12589bd41f2cSmrg	echo mips-compaq-nonstopux
12599bd41f2cSmrg	exit ;;
12609bd41f2cSmrg    BS2000:POSIX*:*:*)
12619bd41f2cSmrg	echo bs2000-siemens-sysv
12629bd41f2cSmrg	exit ;;
12639bd41f2cSmrg    DS/*:UNIX_System_V:*:*)
12649bd41f2cSmrg	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
12659bd41f2cSmrg	exit ;;
12669bd41f2cSmrg    *:Plan9:*:*)
12679bd41f2cSmrg	# "uname -m" is not consistent, so use $cputype instead. 386
12689bd41f2cSmrg	# is converted to i386 for consistency with other x86
12699bd41f2cSmrg	# operating systems.
12709bd41f2cSmrg	if test "$cputype" = "386"; then
12719bd41f2cSmrg	    UNAME_MACHINE=i386
12729bd41f2cSmrg	else
12739bd41f2cSmrg	    UNAME_MACHINE="$cputype"
12749bd41f2cSmrg	fi
12759bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-plan9
12769bd41f2cSmrg	exit ;;
12779bd41f2cSmrg    *:TOPS-10:*:*)
12789bd41f2cSmrg	echo pdp10-unknown-tops10
12799bd41f2cSmrg	exit ;;
12809bd41f2cSmrg    *:TENEX:*:*)
12819bd41f2cSmrg	echo pdp10-unknown-tenex
12829bd41f2cSmrg	exit ;;
12839bd41f2cSmrg    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
12849bd41f2cSmrg	echo pdp10-dec-tops20
12859bd41f2cSmrg	exit ;;
12869bd41f2cSmrg    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
12879bd41f2cSmrg	echo pdp10-xkl-tops20
12889bd41f2cSmrg	exit ;;
12899bd41f2cSmrg    *:TOPS-20:*:*)
12909bd41f2cSmrg	echo pdp10-unknown-tops20
12919bd41f2cSmrg	exit ;;
12929bd41f2cSmrg    *:ITS:*:*)
12939bd41f2cSmrg	echo pdp10-unknown-its
12949bd41f2cSmrg	exit ;;
12959bd41f2cSmrg    SEI:*:*:SEIUX)
12969bd41f2cSmrg        echo mips-sei-seiux${UNAME_RELEASE}
12979bd41f2cSmrg	exit ;;
12989bd41f2cSmrg    *:DragonFly:*:*)
12999bd41f2cSmrg	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
13009bd41f2cSmrg	exit ;;
13019bd41f2cSmrg    *:*VMS:*:*)
13029bd41f2cSmrg    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
13039bd41f2cSmrg	case "${UNAME_MACHINE}" in
13049bd41f2cSmrg	    A*) echo alpha-dec-vms ; exit ;;
13059bd41f2cSmrg	    I*) echo ia64-dec-vms ; exit ;;
13069bd41f2cSmrg	    V*) echo vax-dec-vms ; exit ;;
13079bd41f2cSmrg	esac ;;
13089bd41f2cSmrg    *:XENIX:*:SysV)
13099bd41f2cSmrg	echo i386-pc-xenix
13109bd41f2cSmrg	exit ;;
13119bd41f2cSmrg    i*86:skyos:*:*)
13129bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
13139bd41f2cSmrg	exit ;;
13149bd41f2cSmrg    i*86:rdos:*:*)
13159bd41f2cSmrg	echo ${UNAME_MACHINE}-pc-rdos
13169bd41f2cSmrg	exit ;;
13179bd41f2cSmrgesac
13189bd41f2cSmrg
13199bd41f2cSmrg#echo '(No uname command or uname output not recognized.)' 1>&2
13209bd41f2cSmrg#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
13219bd41f2cSmrg
13229bd41f2cSmrgeval $set_cc_for_build
13239bd41f2cSmrgcat >$dummy.c <<EOF
13249bd41f2cSmrg#ifdef _SEQUENT_
13259bd41f2cSmrg# include <sys/types.h>
13269bd41f2cSmrg# include <sys/utsname.h>
13279bd41f2cSmrg#endif
13289bd41f2cSmrgmain ()
13299bd41f2cSmrg{
13309bd41f2cSmrg#if defined (sony)
13319bd41f2cSmrg#if defined (MIPSEB)
13329bd41f2cSmrg  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
13339bd41f2cSmrg     I don't know....  */
13349bd41f2cSmrg  printf ("mips-sony-bsd\n"); exit (0);
13359bd41f2cSmrg#else
13369bd41f2cSmrg#include <sys/param.h>
13379bd41f2cSmrg  printf ("m68k-sony-newsos%s\n",
13389bd41f2cSmrg#ifdef NEWSOS4
13399bd41f2cSmrg          "4"
13409bd41f2cSmrg#else
13419bd41f2cSmrg	  ""
13429bd41f2cSmrg#endif
13439bd41f2cSmrg         ); exit (0);
13449bd41f2cSmrg#endif
13459bd41f2cSmrg#endif
13469bd41f2cSmrg
13479bd41f2cSmrg#if defined (__arm) && defined (__acorn) && defined (__unix)
13489bd41f2cSmrg  printf ("arm-acorn-riscix\n"); exit (0);
13499bd41f2cSmrg#endif
13509bd41f2cSmrg
13519bd41f2cSmrg#if defined (hp300) && !defined (hpux)
13529bd41f2cSmrg  printf ("m68k-hp-bsd\n"); exit (0);
13539bd41f2cSmrg#endif
13549bd41f2cSmrg
13559bd41f2cSmrg#if defined (NeXT)
13569bd41f2cSmrg#if !defined (__ARCHITECTURE__)
13579bd41f2cSmrg#define __ARCHITECTURE__ "m68k"
13589bd41f2cSmrg#endif
13599bd41f2cSmrg  int version;
13609bd41f2cSmrg  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
13619bd41f2cSmrg  if (version < 4)
13629bd41f2cSmrg    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
13639bd41f2cSmrg  else
13649bd41f2cSmrg    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
13659bd41f2cSmrg  exit (0);
13669bd41f2cSmrg#endif
13679bd41f2cSmrg
13689bd41f2cSmrg#if defined (MULTIMAX) || defined (n16)
13699bd41f2cSmrg#if defined (UMAXV)
13709bd41f2cSmrg  printf ("ns32k-encore-sysv\n"); exit (0);
13719bd41f2cSmrg#else
13729bd41f2cSmrg#if defined (CMU)
13739bd41f2cSmrg  printf ("ns32k-encore-mach\n"); exit (0);
13749bd41f2cSmrg#else
13759bd41f2cSmrg  printf ("ns32k-encore-bsd\n"); exit (0);
13769bd41f2cSmrg#endif
13779bd41f2cSmrg#endif
13789bd41f2cSmrg#endif
13799bd41f2cSmrg
13809bd41f2cSmrg#if defined (__386BSD__)
13819bd41f2cSmrg  printf ("i386-pc-bsd\n"); exit (0);
13829bd41f2cSmrg#endif
13839bd41f2cSmrg
13849bd41f2cSmrg#if defined (sequent)
13859bd41f2cSmrg#if defined (i386)
13869bd41f2cSmrg  printf ("i386-sequent-dynix\n"); exit (0);
13879bd41f2cSmrg#endif
13889bd41f2cSmrg#if defined (ns32000)
13899bd41f2cSmrg  printf ("ns32k-sequent-dynix\n"); exit (0);
13909bd41f2cSmrg#endif
13919bd41f2cSmrg#endif
13929bd41f2cSmrg
13939bd41f2cSmrg#if defined (_SEQUENT_)
13949bd41f2cSmrg    struct utsname un;
13959bd41f2cSmrg
13969bd41f2cSmrg    uname(&un);
13979bd41f2cSmrg
13989bd41f2cSmrg    if (strncmp(un.version, "V2", 2) == 0) {
13999bd41f2cSmrg	printf ("i386-sequent-ptx2\n"); exit (0);
14009bd41f2cSmrg    }
14019bd41f2cSmrg    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
14029bd41f2cSmrg	printf ("i386-sequent-ptx1\n"); exit (0);
14039bd41f2cSmrg    }
14049bd41f2cSmrg    printf ("i386-sequent-ptx\n"); exit (0);
14059bd41f2cSmrg
14069bd41f2cSmrg#endif
14079bd41f2cSmrg
14089bd41f2cSmrg#if defined (vax)
14099bd41f2cSmrg# if !defined (ultrix)
14109bd41f2cSmrg#  include <sys/param.h>
14119bd41f2cSmrg#  if defined (BSD)
14129bd41f2cSmrg#   if BSD == 43
14139bd41f2cSmrg      printf ("vax-dec-bsd4.3\n"); exit (0);
14149bd41f2cSmrg#   else
14159bd41f2cSmrg#    if BSD == 199006
14169bd41f2cSmrg      printf ("vax-dec-bsd4.3reno\n"); exit (0);
14179bd41f2cSmrg#    else
14189bd41f2cSmrg      printf ("vax-dec-bsd\n"); exit (0);
14199bd41f2cSmrg#    endif
14209bd41f2cSmrg#   endif
14219bd41f2cSmrg#  else
14229bd41f2cSmrg    printf ("vax-dec-bsd\n"); exit (0);
14239bd41f2cSmrg#  endif
14249bd41f2cSmrg# else
14259bd41f2cSmrg    printf ("vax-dec-ultrix\n"); exit (0);
14269bd41f2cSmrg# endif
14279bd41f2cSmrg#endif
14289bd41f2cSmrg
14299bd41f2cSmrg#if defined (alliant) && defined (i860)
14309bd41f2cSmrg  printf ("i860-alliant-bsd\n"); exit (0);
14319bd41f2cSmrg#endif
14329bd41f2cSmrg
14339bd41f2cSmrg  exit (1);
14349bd41f2cSmrg}
14359bd41f2cSmrgEOF
14369bd41f2cSmrg
14379bd41f2cSmrg$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
14389bd41f2cSmrg	{ echo "$SYSTEM_NAME"; exit; }
14399bd41f2cSmrg
14409bd41f2cSmrg# Apollos put the system type in the environment.
14419bd41f2cSmrg
14429bd41f2cSmrgtest -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
14439bd41f2cSmrg
14449bd41f2cSmrg# Convex versions that predate uname can use getsysinfo(1)
14459bd41f2cSmrg
14469bd41f2cSmrgif [ -x /usr/convex/getsysinfo ]
14479bd41f2cSmrgthen
14489bd41f2cSmrg    case `getsysinfo -f cpu_type` in
14499bd41f2cSmrg    c1*)
14509bd41f2cSmrg	echo c1-convex-bsd
14519bd41f2cSmrg	exit ;;
14529bd41f2cSmrg    c2*)
14539bd41f2cSmrg	if getsysinfo -f scalar_acc
14549bd41f2cSmrg	then echo c32-convex-bsd
14559bd41f2cSmrg	else echo c2-convex-bsd
14569bd41f2cSmrg	fi
14579bd41f2cSmrg	exit ;;
14589bd41f2cSmrg    c34*)
14599bd41f2cSmrg	echo c34-convex-bsd
14609bd41f2cSmrg	exit ;;
14619bd41f2cSmrg    c38*)
14629bd41f2cSmrg	echo c38-convex-bsd
14639bd41f2cSmrg	exit ;;
14649bd41f2cSmrg    c4*)
14659bd41f2cSmrg	echo c4-convex-bsd
14669bd41f2cSmrg	exit ;;
14679bd41f2cSmrg    esac
14689bd41f2cSmrgfi
14699bd41f2cSmrg
14709bd41f2cSmrgcat >&2 <<EOF
14719bd41f2cSmrg$0: unable to guess system type
14729bd41f2cSmrg
14739bd41f2cSmrgThis script, last modified $timestamp, has failed to recognize
14749bd41f2cSmrgthe operating system you are using. It is advised that you
14759bd41f2cSmrgdownload the most up to date version of the config scripts from
14769bd41f2cSmrg
14779bd41f2cSmrg  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
14789bd41f2cSmrgand
14799bd41f2cSmrg  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
14809bd41f2cSmrg
14819bd41f2cSmrgIf the version you run ($0) is already up to date, please
14829bd41f2cSmrgsend the following data and any information you think might be
14839bd41f2cSmrgpertinent to <config-patches@gnu.org> in order to provide the needed
14849bd41f2cSmrginformation to handle your system.
14859bd41f2cSmrg
14869bd41f2cSmrgconfig.guess timestamp = $timestamp
14879bd41f2cSmrg
14889bd41f2cSmrguname -m = `(uname -m) 2>/dev/null || echo unknown`
14899bd41f2cSmrguname -r = `(uname -r) 2>/dev/null || echo unknown`
14909bd41f2cSmrguname -s = `(uname -s) 2>/dev/null || echo unknown`
14919bd41f2cSmrguname -v = `(uname -v) 2>/dev/null || echo unknown`
14929bd41f2cSmrg
14939bd41f2cSmrg/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
14949bd41f2cSmrg/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
14959bd41f2cSmrg
14969bd41f2cSmrghostinfo               = `(hostinfo) 2>/dev/null`
14979bd41f2cSmrg/bin/universe          = `(/bin/universe) 2>/dev/null`
14989bd41f2cSmrg/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
14999bd41f2cSmrg/bin/arch              = `(/bin/arch) 2>/dev/null`
15009bd41f2cSmrg/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
15019bd41f2cSmrg/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
15029bd41f2cSmrg
15039bd41f2cSmrgUNAME_MACHINE = ${UNAME_MACHINE}
15049bd41f2cSmrgUNAME_RELEASE = ${UNAME_RELEASE}
15059bd41f2cSmrgUNAME_SYSTEM  = ${UNAME_SYSTEM}
15069bd41f2cSmrgUNAME_VERSION = ${UNAME_VERSION}
15079bd41f2cSmrgEOF
15089bd41f2cSmrg
15099bd41f2cSmrgexit 1
15109bd41f2cSmrg
15119bd41f2cSmrg# Local variables:
15129bd41f2cSmrg# eval: (add-hook 'write-file-hooks 'time-stamp)
15139bd41f2cSmrg# time-stamp-start: "timestamp='"
15149bd41f2cSmrg# time-stamp-format: "%:y-%02m-%02d"
15159bd41f2cSmrg# time-stamp-end: "'"
15169bd41f2cSmrg# End:
1517