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