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