xref: /openbsd/gnu/usr.bin/binutils/config.guess (revision 404b540a)
1#! /bin/sh
2# Attempt to guess a canonical system name.
3#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4#   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
5
6timestamp='2004-02-16'
7
8# This file is free software; you can redistribute it and/or modify it
9# under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 2 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful, but
14# WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16# General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program; if not, write to the Free Software
20# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21#
22# As a special exception to the GNU General Public License, if you
23# distribute this file as part of a program that contains a
24# configuration script generated by Autoconf, you may include it under
25# the same distribution terms that you use for the rest of that program.
26
27# Originally written by Per Bothner <per@bothner.com>.
28# Please send patches to <config-patches@gnu.org>.  Submit a context
29# diff and a properly formatted ChangeLog entry.
30#
31# This script attempts to guess a canonical system name similar to
32# config.sub.  If it succeeds, it prints the system name on stdout, and
33# exits with 0.  Otherwise, it exits with 1.
34#
35# The plan is that this can be called by configure scripts if you
36# don't specify an explicit build system type.
37
38me=`echo "$0" | sed -e 's,.*/,,'`
39
40usage="\
41Usage: $0 [OPTION]
42
43Output the configuration name of the system \`$me' is run on.
44
45Operation modes:
46  -h, --help         print this help, then exit
47  -t, --time-stamp   print date of last modification, then exit
48  -v, --version      print version number, then exit
49
50Report bugs and patches to <config-patches@gnu.org>."
51
52version="\
53GNU config.guess ($timestamp)
54
55Originally written by Per Bothner.
56Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
57Free Software Foundation, Inc.
58
59This is free software; see the source for copying conditions.  There is NO
60warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
61
62help="
63Try \`$me --help' for more information."
64
65# Parse command line
66while test $# -gt 0 ; do
67  case $1 in
68    --time-stamp | --time* | -t )
69       echo "$timestamp" ; exit 0 ;;
70    --version | -v )
71       echo "$version" ; exit 0 ;;
72    --help | --h* | -h )
73       echo "$usage"; exit 0 ;;
74    -- )     # Stop option processing
75       shift; break ;;
76    - )	# Use stdin as input.
77       break ;;
78    -* )
79       echo "$me: invalid option $1$help" >&2
80       exit 1 ;;
81    * )
82       break ;;
83  esac
84done
85
86if test $# != 0; then
87  echo "$me: too many arguments$help" >&2
88  exit 1
89fi
90
91trap 'exit 1' 1 2 15
92
93# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
94# compiler to aid in system detection is discouraged as it requires
95# temporary files to be created and, as you can see below, it is a
96# headache to deal with in a portable fashion.
97
98# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
99# use `HOST_CC' if defined, but it is deprecated.
100
101# Portable tmp directory creation inspired by the Autoconf team.
102
103set_cc_for_build='
104trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
105trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
106: ${TMPDIR=/tmp} ;
107 { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
108 { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
109 { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
110 { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
111dummy=$tmp/dummy ;
112tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
113case $CC_FOR_BUILD,$HOST_CC,$CC in
114 ,,)    echo "int x;" > $dummy.c ;
115	for c in cc gcc c89 c99 ; do
116	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
117	     CC_FOR_BUILD="$c"; break ;
118	  fi ;
119	done ;
120	if test x"$CC_FOR_BUILD" = x ; then
121	  CC_FOR_BUILD=no_compiler_found ;
122	fi
123	;;
124 ,,*)   CC_FOR_BUILD=$CC ;;
125 ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
126esac ;'
127
128# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
129# (ghazi@noc.rutgers.edu 1994-08-24)
130if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
131	PATH=$PATH:/.attbin ; export PATH
132fi
133
134UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
135UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
136UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
137UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
138
139# Note: order is significant - the case branches are not exclusive.
140
141case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
142    *:NetBSD:*:*)
143	# NetBSD (nbsd) targets should (where applicable) match one or
144	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
145	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
146	# switched to ELF, *-*-netbsd* would select the old
147	# object file format.  This provides both forward
148	# compatibility and a consistent mechanism for selecting the
149	# object file format.
150	#
151	# Note: NetBSD doesn't particularly care about the vendor
152	# portion of the name.  We always set it to "unknown".
153	sysctl="sysctl -n hw.machine_arch"
154	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
155	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
156	case "${UNAME_MACHINE_ARCH}" in
157	    armeb) machine=armeb-unknown ;;
158	    arm*) machine=arm-unknown ;;
159	    sh3el) machine=shl-unknown ;;
160	    sh3eb) machine=sh-unknown ;;
161	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
162	esac
163	# The Operating System including object format, if it has switched
164	# to ELF recently, or will in the future.
165	case "${UNAME_MACHINE_ARCH}" in
166	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
167		eval $set_cc_for_build
168		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
169			| grep __ELF__ >/dev/null
170		then
171		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
172		    # Return netbsd for either.  FIX?
173		    os=netbsd
174		else
175		    os=netbsdelf
176		fi
177		;;
178	    *)
179	        os=netbsd
180		;;
181	esac
182	# The OS release
183	# Debian GNU/NetBSD machines have a different userland, and
184	# thus, need a distinct triplet. However, they do not need
185	# kernel version information, so it can be replaced with a
186	# suitable tag, in the style of linux-gnu.
187	case "${UNAME_VERSION}" in
188	    Debian*)
189		release='-gnu'
190		;;
191	    *)
192		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
193		;;
194	esac
195	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
196	# contains redundant information, the shorter form:
197	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
198	echo "${machine}-${os}${release}"
199	exit 0 ;;
200    *:OpenBSD:*:*)
201	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
202	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
203	exit 0 ;;
204    *:ekkoBSD:*:*)
205	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
206	exit 0 ;;
207    macppc:MirBSD:*:*)
208	echo powerppc-unknown-mirbsd${UNAME_RELEASE}
209	exit 0 ;;
210    *:MirBSD:*:*)
211	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
212	exit 0 ;;
213    alpha:OSF1:*:*)
214	if test $UNAME_RELEASE = "V4.0"; then
215		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
216	fi
217	# According to Compaq, /usr/sbin/psrinfo has been available on
218	# OSF/1 and Tru64 systems produced since 1995.  I hope that
219	# covers most systems running today.  This code pipes the CPU
220	# types through head -n 1, so we only detect the type of CPU 0.
221	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
222	case "$ALPHA_CPU_TYPE" in
223	    "EV4 (21064)")
224		UNAME_MACHINE="alpha" ;;
225	    "EV4.5 (21064)")
226		UNAME_MACHINE="alpha" ;;
227	    "LCA4 (21066/21068)")
228		UNAME_MACHINE="alpha" ;;
229	    "EV5 (21164)")
230		UNAME_MACHINE="alphaev5" ;;
231	    "EV5.6 (21164A)")
232		UNAME_MACHINE="alphaev56" ;;
233	    "EV5.6 (21164PC)")
234		UNAME_MACHINE="alphapca56" ;;
235	    "EV5.7 (21164PC)")
236		UNAME_MACHINE="alphapca57" ;;
237	    "EV6 (21264)")
238		UNAME_MACHINE="alphaev6" ;;
239	    "EV6.7 (21264A)")
240		UNAME_MACHINE="alphaev67" ;;
241	    "EV6.8CB (21264C)")
242		UNAME_MACHINE="alphaev68" ;;
243	    "EV6.8AL (21264B)")
244		UNAME_MACHINE="alphaev68" ;;
245	    "EV6.8CX (21264D)")
246		UNAME_MACHINE="alphaev68" ;;
247	    "EV6.9A (21264/EV69A)")
248		UNAME_MACHINE="alphaev69" ;;
249	    "EV7 (21364)")
250		UNAME_MACHINE="alphaev7" ;;
251	    "EV7.9 (21364A)")
252		UNAME_MACHINE="alphaev79" ;;
253	esac
254	# A Vn.n version is a released version.
255	# A Tn.n version is a released field test version.
256	# A Xn.n version is an unreleased experimental baselevel.
257	# 1.2 uses "1.2" for uname -r.
258	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
259	exit 0 ;;
260    Alpha*:OpenVMS:*:*)
261	echo alpha-hp-vms
262	exit 0 ;;
263    Alpha\ *:Windows_NT*:*)
264	# How do we know it's Interix rather than the generic POSIX subsystem?
265	# Should we change UNAME_MACHINE based on the output of uname instead
266	# of the specific Alpha model?
267	echo alpha-pc-interix
268	exit 0 ;;
269    21064:Windows_NT:50:3)
270	echo alpha-dec-winnt3.5
271	exit 0 ;;
272    Amiga*:UNIX_System_V:4.0:*)
273	echo m68k-unknown-sysv4
274	exit 0;;
275    *:[Aa]miga[Oo][Ss]:*:*)
276	echo ${UNAME_MACHINE}-unknown-amigaos
277	exit 0 ;;
278    *:[Mm]orph[Oo][Ss]:*:*)
279	echo ${UNAME_MACHINE}-unknown-morphos
280	exit 0 ;;
281    *:OS/390:*:*)
282	echo i370-ibm-openedition
283	exit 0 ;;
284    *:OS400:*:*)
285        echo powerpc-ibm-os400
286	exit 0 ;;
287    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
288	echo arm-acorn-riscix${UNAME_RELEASE}
289	exit 0;;
290    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
291	echo hppa1.1-hitachi-hiuxmpp
292	exit 0;;
293    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
294	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
295	if test "`(/bin/universe) 2>/dev/null`" = att ; then
296		echo pyramid-pyramid-sysv3
297	else
298		echo pyramid-pyramid-bsd
299	fi
300	exit 0 ;;
301    NILE*:*:*:dcosx)
302	echo pyramid-pyramid-svr4
303	exit 0 ;;
304    DRS?6000:unix:4.0:6*)
305	echo sparc-icl-nx6
306	exit 0 ;;
307    DRS?6000:UNIX_SV:4.2*:7*)
308	case `/usr/bin/uname -p` in
309	    sparc) echo sparc-icl-nx7 && exit 0 ;;
310	esac ;;
311    sun4H:SunOS:5.*:*)
312	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
313	exit 0 ;;
314    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
315	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
316	exit 0 ;;
317    i86pc:SunOS:5.*:*)
318	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
319	exit 0 ;;
320    sun4*:SunOS:6*:*)
321	# According to config.sub, this is the proper way to canonicalize
322	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
323	# it's likely to be more like Solaris than SunOS4.
324	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
325	exit 0 ;;
326    sun4*:SunOS:*:*)
327	case "`/usr/bin/arch -k`" in
328	    Series*|S4*)
329		UNAME_RELEASE=`uname -v`
330		;;
331	esac
332	# Japanese Language versions have a version number like `4.1.3-JL'.
333	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
334	exit 0 ;;
335    sun3*:SunOS:*:*)
336	echo m68k-sun-sunos${UNAME_RELEASE}
337	exit 0 ;;
338    sun*:*:4.2BSD:*)
339	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
340	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
341	case "`/bin/arch`" in
342	    sun3)
343		echo m68k-sun-sunos${UNAME_RELEASE}
344		;;
345	    sun4)
346		echo sparc-sun-sunos${UNAME_RELEASE}
347		;;
348	esac
349	exit 0 ;;
350    aushp:SunOS:*:*)
351	echo sparc-auspex-sunos${UNAME_RELEASE}
352	exit 0 ;;
353    # The situation for MiNT is a little confusing.  The machine name
354    # can be virtually everything (everything which is not
355    # "atarist" or "atariste" at least should have a processor
356    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
357    # to the lowercase version "mint" (or "freemint").  Finally
358    # the system name "TOS" denotes a system which is actually not
359    # MiNT.  But MiNT is downward compatible to TOS, so this should
360    # be no problem.
361    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
362        echo m68k-atari-mint${UNAME_RELEASE}
363	exit 0 ;;
364    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
365	echo m68k-atari-mint${UNAME_RELEASE}
366        exit 0 ;;
367    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
368        echo m68k-atari-mint${UNAME_RELEASE}
369	exit 0 ;;
370    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
371        echo m68k-milan-mint${UNAME_RELEASE}
372        exit 0 ;;
373    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
374        echo m68k-hades-mint${UNAME_RELEASE}
375        exit 0 ;;
376    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
377        echo m68k-unknown-mint${UNAME_RELEASE}
378        exit 0 ;;
379    m68k:machten:*:*)
380	echo m68k-apple-machten${UNAME_RELEASE}
381	exit 0 ;;
382    powerpc:machten:*:*)
383	echo powerpc-apple-machten${UNAME_RELEASE}
384	exit 0 ;;
385    RISC*:Mach:*:*)
386	echo mips-dec-mach_bsd4.3
387	exit 0 ;;
388    RISC*:ULTRIX:*:*)
389	echo mips-dec-ultrix${UNAME_RELEASE}
390	exit 0 ;;
391    VAX*:ULTRIX*:*:*)
392	echo vax-dec-ultrix${UNAME_RELEASE}
393	exit 0 ;;
394    2020:CLIX:*:* | 2430:CLIX:*:*)
395	echo clipper-intergraph-clix${UNAME_RELEASE}
396	exit 0 ;;
397    mips:*:*:UMIPS | mips:*:*:RISCos)
398	eval $set_cc_for_build
399	sed 's/^	//' << EOF >$dummy.c
400#ifdef __cplusplus
401#include <stdio.h>  /* for printf() prototype */
402	int main (int argc, char *argv[]) {
403#else
404	int main (argc, argv) int argc; char *argv[]; {
405#endif
406	#if defined (host_mips) && defined (MIPSEB)
407	#if defined (SYSTYPE_SYSV)
408	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
409	#endif
410	#if defined (SYSTYPE_SVR4)
411	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
412	#endif
413	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
414	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
415	#endif
416	#endif
417	  exit (-1);
418	}
419EOF
420	$CC_FOR_BUILD -o $dummy $dummy.c \
421	  && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
422	  && exit 0
423	echo mips-mips-riscos${UNAME_RELEASE}
424	exit 0 ;;
425    Motorola:PowerMAX_OS:*:*)
426	echo powerpc-motorola-powermax
427	exit 0 ;;
428    Motorola:*:4.3:PL8-*)
429	echo powerpc-harris-powermax
430	exit 0 ;;
431    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
432	echo powerpc-harris-powermax
433	exit 0 ;;
434    Night_Hawk:Power_UNIX:*:*)
435	echo powerpc-harris-powerunix
436	exit 0 ;;
437    m88k:CX/UX:7*:*)
438	echo m88k-harris-cxux7
439	exit 0 ;;
440    m88k:*:4*:R4*)
441	echo m88k-motorola-sysv4
442	exit 0 ;;
443    m88k:*:3*:R3*)
444	echo m88k-motorola-sysv3
445	exit 0 ;;
446    AViiON:dgux:*:*)
447        # DG/UX returns AViiON for all architectures
448        UNAME_PROCESSOR=`/usr/bin/uname -p`
449	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
450	then
451	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
452	       [ ${TARGET_BINARY_INTERFACE}x = x ]
453	    then
454		echo m88k-dg-dgux${UNAME_RELEASE}
455	    else
456		echo m88k-dg-dguxbcs${UNAME_RELEASE}
457	    fi
458	else
459	    echo i586-dg-dgux${UNAME_RELEASE}
460	fi
461 	exit 0 ;;
462    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
463	echo m88k-dolphin-sysv3
464	exit 0 ;;
465    M88*:*:R3*:*)
466	# Delta 88k system running SVR3
467	echo m88k-motorola-sysv3
468	exit 0 ;;
469    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
470	echo m88k-tektronix-sysv3
471	exit 0 ;;
472    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
473	echo m68k-tektronix-bsd
474	exit 0 ;;
475    *:IRIX*:*:*)
476	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
477	exit 0 ;;
478    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
479	echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
480	exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
481    i*86:AIX:*:*)
482	echo i386-ibm-aix
483	exit 0 ;;
484    ia64:AIX:*:*)
485	if [ -x /usr/bin/oslevel ] ; then
486		IBM_REV=`/usr/bin/oslevel`
487	else
488		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
489	fi
490	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
491	exit 0 ;;
492    *:AIX:2:3)
493	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
494		eval $set_cc_for_build
495		sed 's/^		//' << EOF >$dummy.c
496		#include <sys/systemcfg.h>
497
498		main()
499			{
500			if (!__power_pc())
501				exit(1);
502			puts("powerpc-ibm-aix3.2.5");
503			exit(0);
504			}
505EOF
506		$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
507		echo rs6000-ibm-aix3.2.5
508	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
509		echo rs6000-ibm-aix3.2.4
510	else
511		echo rs6000-ibm-aix3.2
512	fi
513	exit 0 ;;
514    *:AIX:*:[45])
515	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
516	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
517		IBM_ARCH=rs6000
518	else
519		IBM_ARCH=powerpc
520	fi
521	if [ -x /usr/bin/oslevel ] ; then
522		IBM_REV=`/usr/bin/oslevel`
523	else
524		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
525	fi
526	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
527	exit 0 ;;
528    *:AIX:*:*)
529	echo rs6000-ibm-aix
530	exit 0 ;;
531    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
532	echo romp-ibm-bsd4.4
533	exit 0 ;;
534    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
535	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
536	exit 0 ;;                           # report: romp-ibm BSD 4.3
537    *:BOSX:*:*)
538	echo rs6000-bull-bosx
539	exit 0 ;;
540    DPX/2?00:B.O.S.:*:*)
541	echo m68k-bull-sysv3
542	exit 0 ;;
543    9000/[34]??:4.3bsd:1.*:*)
544	echo m68k-hp-bsd
545	exit 0 ;;
546    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
547	echo m68k-hp-bsd4.4
548	exit 0 ;;
549    9000/[34678]??:HP-UX:*:*)
550	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
551	case "${UNAME_MACHINE}" in
552	    9000/31? )            HP_ARCH=m68000 ;;
553	    9000/[34]?? )         HP_ARCH=m68k ;;
554	    9000/[678][0-9][0-9])
555		if [ -x /usr/bin/getconf ]; then
556		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
557                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
558                    case "${sc_cpu_version}" in
559                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
560                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
561                      532)                      # CPU_PA_RISC2_0
562                        case "${sc_kernel_bits}" in
563                          32) HP_ARCH="hppa2.0n" ;;
564                          64) HP_ARCH="hppa2.0w" ;;
565			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
566                        esac ;;
567                    esac
568		fi
569		if [ "${HP_ARCH}" = "" ]; then
570		    eval $set_cc_for_build
571		    sed 's/^              //' << EOF >$dummy.c
572
573              #define _HPUX_SOURCE
574              #include <stdlib.h>
575              #include <unistd.h>
576
577              int main ()
578              {
579              #if defined(_SC_KERNEL_BITS)
580                  long bits = sysconf(_SC_KERNEL_BITS);
581              #endif
582                  long cpu  = sysconf (_SC_CPU_VERSION);
583
584                  switch (cpu)
585              	{
586              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
587              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
588              	case CPU_PA_RISC2_0:
589              #if defined(_SC_KERNEL_BITS)
590              	    switch (bits)
591              		{
592              		case 64: puts ("hppa2.0w"); break;
593              		case 32: puts ("hppa2.0n"); break;
594              		default: puts ("hppa2.0"); break;
595              		} break;
596              #else  /* !defined(_SC_KERNEL_BITS) */
597              	    puts ("hppa2.0"); break;
598              #endif
599              	default: puts ("hppa1.0"); break;
600              	}
601                  exit (0);
602              }
603EOF
604		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
605		    test -z "$HP_ARCH" && HP_ARCH=hppa
606		fi ;;
607	esac
608	if [ ${HP_ARCH} = "hppa2.0w" ]
609	then
610	    # avoid double evaluation of $set_cc_for_build
611	    test -n "$CC_FOR_BUILD" || eval $set_cc_for_build
612	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null
613	    then
614		HP_ARCH="hppa2.0w"
615	    else
616		HP_ARCH="hppa64"
617	    fi
618	fi
619	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
620	exit 0 ;;
621    ia64:HP-UX:*:*)
622	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
623	echo ia64-hp-hpux${HPUX_REV}
624	exit 0 ;;
625    3050*:HI-UX:*:*)
626	eval $set_cc_for_build
627	sed 's/^	//' << EOF >$dummy.c
628	#include <unistd.h>
629	int
630	main ()
631	{
632	  long cpu = sysconf (_SC_CPU_VERSION);
633	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
634	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
635	     results, however.  */
636	  if (CPU_IS_PA_RISC (cpu))
637	    {
638	      switch (cpu)
639		{
640		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
641		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
642		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
643		  default: puts ("hppa-hitachi-hiuxwe2"); break;
644		}
645	    }
646	  else if (CPU_IS_HP_MC68K (cpu))
647	    puts ("m68k-hitachi-hiuxwe2");
648	  else puts ("unknown-hitachi-hiuxwe2");
649	  exit (0);
650	}
651EOF
652	$CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0
653	echo unknown-hitachi-hiuxwe2
654	exit 0 ;;
655    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
656	echo hppa1.1-hp-bsd
657	exit 0 ;;
658    9000/8??:4.3bsd:*:*)
659	echo hppa1.0-hp-bsd
660	exit 0 ;;
661    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
662	echo hppa1.0-hp-mpeix
663	exit 0 ;;
664    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
665	echo hppa1.1-hp-osf
666	exit 0 ;;
667    hp8??:OSF1:*:*)
668	echo hppa1.0-hp-osf
669	exit 0 ;;
670    i*86:OSF1:*:*)
671	if [ -x /usr/sbin/sysversion ] ; then
672	    echo ${UNAME_MACHINE}-unknown-osf1mk
673	else
674	    echo ${UNAME_MACHINE}-unknown-osf1
675	fi
676	exit 0 ;;
677    parisc*:Lites*:*:*)
678	echo hppa1.1-hp-lites
679	exit 0 ;;
680    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
681	echo c1-convex-bsd
682        exit 0 ;;
683    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
684	if getsysinfo -f scalar_acc
685	then echo c32-convex-bsd
686	else echo c2-convex-bsd
687	fi
688        exit 0 ;;
689    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
690	echo c34-convex-bsd
691        exit 0 ;;
692    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
693	echo c38-convex-bsd
694        exit 0 ;;
695    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
696	echo c4-convex-bsd
697        exit 0 ;;
698    CRAY*Y-MP:*:*:*)
699	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
700	exit 0 ;;
701    CRAY*[A-Z]90:*:*:*)
702	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
703	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
704	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
705	      -e 's/\.[^.]*$/.X/'
706	exit 0 ;;
707    CRAY*TS:*:*:*)
708	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
709	exit 0 ;;
710    CRAY*T3E:*:*:*)
711	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
712	exit 0 ;;
713    CRAY*SV1:*:*:*)
714	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
715	exit 0 ;;
716    *:UNICOS/mp:*:*)
717	echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
718	exit 0 ;;
719    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
720	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
721        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
722        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
723        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
724        exit 0 ;;
725    5000:UNIX_System_V:4.*:*)
726        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
727        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
728        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
729	exit 0 ;;
730    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
731	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
732	exit 0 ;;
733    sparc*:BSD/OS:*:*)
734	echo sparc-unknown-bsdi${UNAME_RELEASE}
735	exit 0 ;;
736    *:BSD/OS:*:*)
737	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
738	exit 0 ;;
739    *:FreeBSD:*:*)
740	# Determine whether the default compiler uses glibc.
741	eval $set_cc_for_build
742	sed 's/^	//' << EOF >$dummy.c
743	#include <features.h>
744	#if __GLIBC__ >= 2
745	LIBC=gnu
746	#else
747	LIBC=
748	#endif
749EOF
750	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
751	# GNU/KFreeBSD systems have a "k" prefix to indicate we are using
752	# FreeBSD's kernel, but not the complete OS.
753	case ${LIBC} in gnu) kernel_only='k' ;; esac
754	echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
755	exit 0 ;;
756    i*:CYGWIN*:*)
757	echo ${UNAME_MACHINE}-pc-cygwin
758	exit 0 ;;
759    i*:MINGW*:*)
760	echo ${UNAME_MACHINE}-pc-mingw32
761	exit 0 ;;
762    i*:PW*:*)
763	echo ${UNAME_MACHINE}-pc-pw32
764	exit 0 ;;
765    x86:Interix*:[34]*)
766	echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
767	exit 0 ;;
768    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
769	echo i${UNAME_MACHINE}-pc-mks
770	exit 0 ;;
771    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
772	# How do we know it's Interix rather than the generic POSIX subsystem?
773	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
774	# UNAME_MACHINE based on the output of uname instead of i386?
775	echo i586-pc-interix
776	exit 0 ;;
777    i*:UWIN*:*)
778	echo ${UNAME_MACHINE}-pc-uwin
779	exit 0 ;;
780    p*:CYGWIN*:*)
781	echo powerpcle-unknown-cygwin
782	exit 0 ;;
783    prep*:SunOS:5.*:*)
784	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
785	exit 0 ;;
786    *:GNU:*:*)
787	# the GNU system
788	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
789	exit 0 ;;
790    *:GNU/*:*:*)
791	# other systems with GNU libc and userland
792	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
793	exit 0 ;;
794    i*86:Minix:*:*)
795	echo ${UNAME_MACHINE}-pc-minix
796	exit 0 ;;
797    arm*:Linux:*:*)
798	echo ${UNAME_MACHINE}-unknown-linux-gnu
799	exit 0 ;;
800    cris:Linux:*:*)
801	echo cris-axis-linux-gnu
802	exit 0 ;;
803    ia64:Linux:*:*)
804	echo ${UNAME_MACHINE}-unknown-linux-gnu
805	exit 0 ;;
806    m68*:Linux:*:*)
807	echo ${UNAME_MACHINE}-unknown-linux-gnu
808	exit 0 ;;
809    mips:Linux:*:*)
810	eval $set_cc_for_build
811	sed 's/^	//' << EOF >$dummy.c
812	#undef CPU
813	#undef mips
814	#undef mipsel
815	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
816	CPU=mipsel
817	#else
818	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
819	CPU=mips
820	#else
821	CPU=
822	#endif
823	#endif
824EOF
825	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
826	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
827	;;
828    mips64:Linux:*:*)
829	eval $set_cc_for_build
830	sed 's/^	//' << EOF >$dummy.c
831	#undef CPU
832	#undef mips64
833	#undef mips64el
834	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
835	CPU=mips64el
836	#else
837	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
838	CPU=mips64
839	#else
840	CPU=
841	#endif
842	#endif
843EOF
844	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
845	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
846	;;
847    ppc:Linux:*:*)
848	echo powerpc-unknown-linux-gnu
849	exit 0 ;;
850    ppc64:Linux:*:*)
851	echo powerpc64-unknown-linux-gnu
852	exit 0 ;;
853    alpha:Linux:*:*)
854	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
855	  EV5)   UNAME_MACHINE=alphaev5 ;;
856	  EV56)  UNAME_MACHINE=alphaev56 ;;
857	  PCA56) UNAME_MACHINE=alphapca56 ;;
858	  PCA57) UNAME_MACHINE=alphapca56 ;;
859	  EV6)   UNAME_MACHINE=alphaev6 ;;
860	  EV67)  UNAME_MACHINE=alphaev67 ;;
861	  EV68*) UNAME_MACHINE=alphaev68 ;;
862        esac
863	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
864	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
865	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
866	exit 0 ;;
867    parisc:Linux:*:* | hppa:Linux:*:*)
868	# Look for CPU level
869	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
870	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
871	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
872	  *)    echo hppa-unknown-linux-gnu ;;
873	esac
874	exit 0 ;;
875    parisc64:Linux:*:* | hppa64:Linux:*:*)
876	echo hppa64-unknown-linux-gnu
877	exit 0 ;;
878    s390:Linux:*:* | s390x:Linux:*:*)
879	echo ${UNAME_MACHINE}-ibm-linux
880	exit 0 ;;
881    sh64*:Linux:*:*)
882    	echo ${UNAME_MACHINE}-unknown-linux-gnu
883	exit 0 ;;
884    sh*:Linux:*:*)
885	echo ${UNAME_MACHINE}-unknown-linux-gnu
886	exit 0 ;;
887    sparc:Linux:*:* | sparc64:Linux:*:*)
888	echo ${UNAME_MACHINE}-unknown-linux-gnu
889	exit 0 ;;
890    x86_64:Linux:*:*)
891	echo x86_64-unknown-linux-gnu
892	exit 0 ;;
893    i*86:Linux:*:*)
894	# The BFD linker knows what the default object file format is, so
895	# first see if it will tell us. cd to the root directory to prevent
896	# problems with other programs or directories called `ld' in the path.
897	# Set LC_ALL=C to ensure ld outputs messages in English.
898	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
899			 | sed -ne '/supported targets:/!d
900				    s/[ 	][ 	]*/ /g
901				    s/.*supported targets: *//
902				    s/ .*//
903				    p'`
904        case "$ld_supported_targets" in
905	  elf32-i386)
906		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
907		;;
908	  a.out-i386-linux)
909		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
910		exit 0 ;;
911	  coff-i386)
912		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
913		exit 0 ;;
914	  "")
915		# Either a pre-BFD a.out linker (linux-gnuoldld) or
916		# one that does not give us useful --help.
917		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
918		exit 0 ;;
919	esac
920	# Determine whether the default compiler is a.out or elf
921	eval $set_cc_for_build
922	sed 's/^	//' << EOF >$dummy.c
923	#include <features.h>
924	#ifdef __ELF__
925	# ifdef __GLIBC__
926	#  if __GLIBC__ >= 2
927	LIBC=gnu
928	#  else
929	LIBC=gnulibc1
930	#  endif
931	# else
932	LIBC=gnulibc1
933	# endif
934	#else
935	#ifdef __INTEL_COMPILER
936	LIBC=gnu
937	#else
938	LIBC=gnuaout
939	#endif
940	#endif
941	#ifdef __dietlibc__
942	LIBC=dietlibc
943	#endif
944EOF
945	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
946	test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
947	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
948	;;
949    i*86:DYNIX/ptx:4*:*)
950	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
951	# earlier versions are messed up and put the nodename in both
952	# sysname and nodename.
953	echo i386-sequent-sysv4
954	exit 0 ;;
955    i*86:UNIX_SV:4.2MP:2.*)
956        # Unixware is an offshoot of SVR4, but it has its own version
957        # number series starting with 2...
958        # I am not positive that other SVR4 systems won't match this,
959	# I just have to hope.  -- rms.
960        # Use sysv4.2uw... so that sysv4* matches it.
961	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
962	exit 0 ;;
963    i*86:OS/2:*:*)
964	# If we were able to find `uname', then EMX Unix compatibility
965	# is probably installed.
966	echo ${UNAME_MACHINE}-pc-os2-emx
967	exit 0 ;;
968    i*86:XTS-300:*:STOP)
969	echo ${UNAME_MACHINE}-unknown-stop
970	exit 0 ;;
971    i*86:atheos:*:*)
972	echo ${UNAME_MACHINE}-unknown-atheos
973	exit 0 ;;
974	i*86:syllable:*:*)
975	echo ${UNAME_MACHINE}-pc-syllable
976	exit 0 ;;
977    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
978	echo i386-unknown-lynxos${UNAME_RELEASE}
979	exit 0 ;;
980    i*86:*DOS:*:*)
981	echo ${UNAME_MACHINE}-pc-msdosdjgpp
982	exit 0 ;;
983    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
984	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
985	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
986		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
987	else
988		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
989	fi
990	exit 0 ;;
991    i*86:*:5:[78]*)
992	case `/bin/uname -X | grep "^Machine"` in
993	    *486*)	     UNAME_MACHINE=i486 ;;
994	    *Pentium)	     UNAME_MACHINE=i586 ;;
995	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
996	esac
997	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
998	exit 0 ;;
999    i*86:*:3.2:*)
1000	if test -f /usr/options/cb.name; then
1001		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1002		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
1003	elif /bin/uname -X 2>/dev/null >/dev/null ; then
1004		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1005		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1006		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1007			&& UNAME_MACHINE=i586
1008		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1009			&& UNAME_MACHINE=i686
1010		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1011			&& UNAME_MACHINE=i686
1012		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
1013	else
1014		echo ${UNAME_MACHINE}-pc-sysv32
1015	fi
1016	exit 0 ;;
1017    pc:*:*:*)
1018	# Left here for compatibility:
1019        # uname -m prints for DJGPP always 'pc', but it prints nothing about
1020        # the processor, so we play safe by assuming i386.
1021	echo i386-pc-msdosdjgpp
1022        exit 0 ;;
1023    Intel:Mach:3*:*)
1024	echo i386-pc-mach3
1025	exit 0 ;;
1026    paragon:*:*:*)
1027	echo i860-intel-osf1
1028	exit 0 ;;
1029    i860:*:4.*:*) # i860-SVR4
1030	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1031	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
1032	else # Add other i860-SVR4 vendors below as they are discovered.
1033	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
1034	fi
1035	exit 0 ;;
1036    mini*:CTIX:SYS*5:*)
1037	# "miniframe"
1038	echo m68010-convergent-sysv
1039	exit 0 ;;
1040    mc68k:UNIX:SYSTEM5:3.51m)
1041	echo m68k-convergent-sysv
1042	exit 0 ;;
1043    M680?0:D-NIX:5.3:*)
1044	echo m68k-diab-dnix
1045	exit 0 ;;
1046    M68*:*:R3V[567]*:*)
1047	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
1048    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)
1049	OS_REL=''
1050	test -r /etc/.relid \
1051	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1052	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1053	  && echo i486-ncr-sysv4.3${OS_REL} && exit 0
1054	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1055	  && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
1056    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1057        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1058          && echo i486-ncr-sysv4 && exit 0 ;;
1059    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1060	echo m68k-unknown-lynxos${UNAME_RELEASE}
1061	exit 0 ;;
1062    mc68030:UNIX_System_V:4.*:*)
1063	echo m68k-atari-sysv4
1064	exit 0 ;;
1065    TSUNAMI:LynxOS:2.*:*)
1066	echo sparc-unknown-lynxos${UNAME_RELEASE}
1067	exit 0 ;;
1068    rs6000:LynxOS:2.*:*)
1069	echo rs6000-unknown-lynxos${UNAME_RELEASE}
1070	exit 0 ;;
1071    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
1072	echo powerpc-unknown-lynxos${UNAME_RELEASE}
1073	exit 0 ;;
1074    SM[BE]S:UNIX_SV:*:*)
1075	echo mips-dde-sysv${UNAME_RELEASE}
1076	exit 0 ;;
1077    RM*:ReliantUNIX-*:*:*)
1078	echo mips-sni-sysv4
1079	exit 0 ;;
1080    RM*:SINIX-*:*:*)
1081	echo mips-sni-sysv4
1082	exit 0 ;;
1083    *:SINIX-*:*:*)
1084	if uname -p 2>/dev/null >/dev/null ; then
1085		UNAME_MACHINE=`(uname -p) 2>/dev/null`
1086		echo ${UNAME_MACHINE}-sni-sysv4
1087	else
1088		echo ns32k-sni-sysv
1089	fi
1090	exit 0 ;;
1091    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1092                      # says <Richard.M.Bartel@ccMail.Census.GOV>
1093        echo i586-unisys-sysv4
1094        exit 0 ;;
1095    *:UNIX_System_V:4*:FTX*)
1096	# From Gerald Hewes <hewes@openmarket.com>.
1097	# How about differentiating between stratus architectures? -djm
1098	echo hppa1.1-stratus-sysv4
1099	exit 0 ;;
1100    *:*:*:FTX*)
1101	# From seanf@swdc.stratus.com.
1102	echo i860-stratus-sysv4
1103	exit 0 ;;
1104    *:VOS:*:*)
1105	# From Paul.Green@stratus.com.
1106	echo hppa1.1-stratus-vos
1107	exit 0 ;;
1108    mc68*:A/UX:*:*)
1109	echo m68k-apple-aux${UNAME_RELEASE}
1110	exit 0 ;;
1111    news*:NEWS-OS:6*:*)
1112	echo mips-sony-newsos6
1113	exit 0 ;;
1114    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1115	if [ -d /usr/nec ]; then
1116	        echo mips-nec-sysv${UNAME_RELEASE}
1117	else
1118	        echo mips-unknown-sysv${UNAME_RELEASE}
1119	fi
1120        exit 0 ;;
1121    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
1122	echo powerpc-be-beos
1123	exit 0 ;;
1124    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
1125	echo powerpc-apple-beos
1126	exit 0 ;;
1127    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
1128	echo i586-pc-beos
1129	exit 0 ;;
1130    SX-4:SUPER-UX:*:*)
1131	echo sx4-nec-superux${UNAME_RELEASE}
1132	exit 0 ;;
1133    SX-5:SUPER-UX:*:*)
1134	echo sx5-nec-superux${UNAME_RELEASE}
1135	exit 0 ;;
1136    SX-6:SUPER-UX:*:*)
1137	echo sx6-nec-superux${UNAME_RELEASE}
1138	exit 0 ;;
1139    Power*:Rhapsody:*:*)
1140	echo powerpc-apple-rhapsody${UNAME_RELEASE}
1141	exit 0 ;;
1142    *:Rhapsody:*:*)
1143	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
1144	exit 0 ;;
1145    *:Darwin:*:*)
1146	case `uname -p` in
1147	    *86) UNAME_PROCESSOR=i686 ;;
1148	    powerpc) UNAME_PROCESSOR=powerpc ;;
1149	esac
1150	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
1151	exit 0 ;;
1152    *:procnto*:*:* | *:QNX:[0123456789]*:*)
1153	UNAME_PROCESSOR=`uname -p`
1154	if test "$UNAME_PROCESSOR" = "x86"; then
1155		UNAME_PROCESSOR=i386
1156		UNAME_MACHINE=pc
1157	fi
1158	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
1159	exit 0 ;;
1160    *:QNX:*:4*)
1161	echo i386-pc-qnx
1162	exit 0 ;;
1163    NSR-?:NONSTOP_KERNEL:*:*)
1164	echo nsr-tandem-nsk${UNAME_RELEASE}
1165	exit 0 ;;
1166    *:NonStop-UX:*:*)
1167	echo mips-compaq-nonstopux
1168	exit 0 ;;
1169    BS2000:POSIX*:*:*)
1170	echo bs2000-siemens-sysv
1171	exit 0 ;;
1172    DS/*:UNIX_System_V:*:*)
1173	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
1174	exit 0 ;;
1175    *:Plan9:*:*)
1176	# "uname -m" is not consistent, so use $cputype instead. 386
1177	# is converted to i386 for consistency with other x86
1178	# operating systems.
1179	if test "$cputype" = "386"; then
1180	    UNAME_MACHINE=i386
1181	else
1182	    UNAME_MACHINE="$cputype"
1183	fi
1184	echo ${UNAME_MACHINE}-unknown-plan9
1185	exit 0 ;;
1186    *:TOPS-10:*:*)
1187	echo pdp10-unknown-tops10
1188	exit 0 ;;
1189    *:TENEX:*:*)
1190	echo pdp10-unknown-tenex
1191	exit 0 ;;
1192    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1193	echo pdp10-dec-tops20
1194	exit 0 ;;
1195    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1196	echo pdp10-xkl-tops20
1197	exit 0 ;;
1198    *:TOPS-20:*:*)
1199	echo pdp10-unknown-tops20
1200	exit 0 ;;
1201    *:ITS:*:*)
1202	echo pdp10-unknown-its
1203	exit 0 ;;
1204    SEI:*:*:SEIUX)
1205        echo mips-sei-seiux${UNAME_RELEASE}
1206	exit 0 ;;
1207    *:DragonFly:*:*)
1208	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
1209	exit 0 ;;
1210esac
1211
1212#echo '(No uname command or uname output not recognized.)' 1>&2
1213#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
1214
1215eval $set_cc_for_build
1216cat >$dummy.c <<EOF
1217#ifdef _SEQUENT_
1218# include <sys/types.h>
1219# include <sys/utsname.h>
1220#endif
1221main ()
1222{
1223#if defined (sony)
1224#if defined (MIPSEB)
1225  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
1226     I don't know....  */
1227  printf ("mips-sony-bsd\n"); exit (0);
1228#else
1229#include <sys/param.h>
1230  printf ("m68k-sony-newsos%s\n",
1231#ifdef NEWSOS4
1232          "4"
1233#else
1234	  ""
1235#endif
1236         ); exit (0);
1237#endif
1238#endif
1239
1240#if defined (__arm) && defined (__acorn) && defined (__unix)
1241  printf ("arm-acorn-riscix"); exit (0);
1242#endif
1243
1244#if defined (hp300) && !defined (hpux)
1245  printf ("m68k-hp-bsd\n"); exit (0);
1246#endif
1247
1248#if defined (NeXT)
1249#if !defined (__ARCHITECTURE__)
1250#define __ARCHITECTURE__ "m68k"
1251#endif
1252  int version;
1253  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1254  if (version < 4)
1255    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1256  else
1257    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1258  exit (0);
1259#endif
1260
1261#if defined (MULTIMAX) || defined (n16)
1262#if defined (UMAXV)
1263  printf ("ns32k-encore-sysv\n"); exit (0);
1264#else
1265#if defined (CMU)
1266  printf ("ns32k-encore-mach\n"); exit (0);
1267#else
1268  printf ("ns32k-encore-bsd\n"); exit (0);
1269#endif
1270#endif
1271#endif
1272
1273#if defined (__386BSD__)
1274  printf ("i386-pc-bsd\n"); exit (0);
1275#endif
1276
1277#if defined (sequent)
1278#if defined (i386)
1279  printf ("i386-sequent-dynix\n"); exit (0);
1280#endif
1281#if defined (ns32000)
1282  printf ("ns32k-sequent-dynix\n"); exit (0);
1283#endif
1284#endif
1285
1286#if defined (_SEQUENT_)
1287    struct utsname un;
1288
1289    uname(&un);
1290
1291    if (strncmp(un.version, "V2", 2) == 0) {
1292	printf ("i386-sequent-ptx2\n"); exit (0);
1293    }
1294    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1295	printf ("i386-sequent-ptx1\n"); exit (0);
1296    }
1297    printf ("i386-sequent-ptx\n"); exit (0);
1298
1299#endif
1300
1301#if defined (vax)
1302# if !defined (ultrix)
1303#  include <sys/param.h>
1304#  if defined (BSD)
1305#   if BSD == 43
1306      printf ("vax-dec-bsd4.3\n"); exit (0);
1307#   else
1308#    if BSD == 199006
1309      printf ("vax-dec-bsd4.3reno\n"); exit (0);
1310#    else
1311      printf ("vax-dec-bsd\n"); exit (0);
1312#    endif
1313#   endif
1314#  else
1315    printf ("vax-dec-bsd\n"); exit (0);
1316#  endif
1317# else
1318    printf ("vax-dec-ultrix\n"); exit (0);
1319# endif
1320#endif
1321
1322#if defined (alliant) && defined (i860)
1323  printf ("i860-alliant-bsd\n"); exit (0);
1324#endif
1325
1326  exit (1);
1327}
1328EOF
1329
1330$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0
1331
1332# Apollos put the system type in the environment.
1333
1334test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
1335
1336# Convex versions that predate uname can use getsysinfo(1)
1337
1338if [ -x /usr/convex/getsysinfo ]
1339then
1340    case `getsysinfo -f cpu_type` in
1341    c1*)
1342	echo c1-convex-bsd
1343	exit 0 ;;
1344    c2*)
1345	if getsysinfo -f scalar_acc
1346	then echo c32-convex-bsd
1347	else echo c2-convex-bsd
1348	fi
1349	exit 0 ;;
1350    c34*)
1351	echo c34-convex-bsd
1352	exit 0 ;;
1353    c38*)
1354	echo c38-convex-bsd
1355	exit 0 ;;
1356    c4*)
1357	echo c4-convex-bsd
1358	exit 0 ;;
1359    esac
1360fi
1361
1362cat >&2 <<EOF
1363$0: unable to guess system type
1364
1365This script, last modified $timestamp, has failed to recognize
1366the operating system you are using. It is advised that you
1367download the most up to date version of the config scripts from
1368
1369    ftp://ftp.gnu.org/pub/gnu/config/
1370
1371If the version you run ($0) is already up to date, please
1372send the following data and any information you think might be
1373pertinent to <config-patches@gnu.org> in order to provide the needed
1374information to handle your system.
1375
1376config.guess timestamp = $timestamp
1377
1378uname -m = `(uname -m) 2>/dev/null || echo unknown`
1379uname -r = `(uname -r) 2>/dev/null || echo unknown`
1380uname -s = `(uname -s) 2>/dev/null || echo unknown`
1381uname -v = `(uname -v) 2>/dev/null || echo unknown`
1382
1383/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1384/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
1385
1386hostinfo               = `(hostinfo) 2>/dev/null`
1387/bin/universe          = `(/bin/universe) 2>/dev/null`
1388/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
1389/bin/arch              = `(/bin/arch) 2>/dev/null`
1390/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
1391/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1392
1393UNAME_MACHINE = ${UNAME_MACHINE}
1394UNAME_RELEASE = ${UNAME_RELEASE}
1395UNAME_SYSTEM  = ${UNAME_SYSTEM}
1396UNAME_VERSION = ${UNAME_VERSION}
1397EOF
1398
1399exit 1
1400
1401# Local variables:
1402# eval: (add-hook 'write-file-hooks 'time-stamp)
1403# time-stamp-start: "timestamp='"
1404# time-stamp-format: "%:y-%02m-%02d"
1405# time-stamp-end: "'"
1406# End:
1407