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