Daily bump.
[official-gcc.git] / config.guess
blob5b1e6191ce6bd390fcdbad01485c776fe87913a5
1 #! /bin/sh
2 # Attempt to guess a canonical system name.
3 # Copyright (C) 1992, 93, 94, 95, 96, 97, 1998, 1999 Free Software Foundation, Inc.
5 # This file is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 # As a special exception to the GNU General Public License, if you
20 # distribute this file as part of a program that contains a
21 # configuration script generated by Autoconf, you may include it under
22 # the same distribution terms that you use for the rest of that program.
24 # Written by Per Bothner <bothner@cygnus.com>.
25 # The master version of this file is at the FSF in /home/gd/gnu/lib.
27 # This script attempts to guess a canonical system name similar to
28 # config.sub. If it succeeds, it prints the system name on stdout, and
29 # exits with 0. Otherwise, it exits with 1.
31 # The plan is that this can be called by configure scripts if you
32 # don't specify an explicit system type (host/target name).
34 # Only a few systems have been added to this list; please add others
35 # (but try to keep the structure clean).
38 # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
39 # (ghazi@noc.rutgers.edu 8/24/94.)
40 if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
41 PATH=$PATH:/.attbin ; export PATH
44 UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
45 UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
46 UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
47 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
49 trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
51 # Note: order is significant - the case branches are not exclusive.
53 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
54 alpha:OSF1:*:*)
55 if test $UNAME_RELEASE = "V4.0"; then
56 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
58 # A Vn.n version is a released version.
59 # A Tn.n version is a released field test version.
60 # A Xn.n version is an unreleased experimental baselevel.
61 # 1.2 uses "1.2" for uname -r.
62 cat <<EOF >dummy.s
63 .globl main
64 .ent main
65 main:
66 .frame \$30,0,\$26,0
67 .prologue 0
68 .long 0x47e03d80 # implver $0
69 lda \$2,259
70 .long 0x47e20c21 # amask $2,$1
71 srl \$1,8,\$2
72 sll \$2,2,\$2
73 sll \$0,3,\$0
74 addl \$1,\$0,\$0
75 addl \$2,\$0,\$0
76 ret \$31,(\$26),1
77 .end main
78 EOF
79 ${CC-cc} dummy.s -o dummy 2>/dev/null
80 if test "$?" = 0 ; then
81 ./dummy
82 case "$?" in
84 UNAME_MACHINE="alpha"
86 15)
87 UNAME_MACHINE="alphaev5"
89 14)
90 UNAME_MACHINE="alphaev56"
92 10)
93 UNAME_MACHINE="alphapca56"
95 16)
96 UNAME_MACHINE="alphaev6"
98 esac
100 rm -f dummy.s dummy
101 echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
102 exit 0 ;;
103 Alpha\ *:Windows_NT*:*)
104 # How do we know it's Interix rather than generic posix subsystem?
105 # Should we change UNAME_MACHINE based on the output of uname
106 # instead of the specific alpha model.
107 echo alpha-pc-interix
108 exit 0;;
109 21064:Windows_NT:50:3)
110 echo alpha-dec-winnt3.5
111 exit 0 ;;
112 Amiga*:UNIX_System_V:4.0:*)
113 echo m68k-cbm-sysv4
114 exit 0;;
115 amiga:NetBSD:*:*)
116 echo m68k-cbm-netbsd${UNAME_RELEASE}
117 exit 0 ;;
118 amiga:OpenBSD:*:*)
119 echo m68k-unknown-openbsd${UNAME_RELEASE}
120 exit 0 ;;
121 *:[Aa]miga[Oo][Ss]:*:*)
122 echo ${UNAME_MACHINE}-unknown-amigaos
123 exit 0 ;;
124 arc64:OpenBSD:*:*)
125 echo mips64el-unknown-openbsd${UNAME_RELEASE}
126 exit 0 ;;
127 arc:OpenBSD:*:*)
128 echo mipsel-unknown-openbsd${UNAME_RELEASE}
129 exit 0 ;;
130 hkmips:OpenBSD:*:*)
131 echo mips-unknown-openbsd${UNAME_RELEASE}
132 exit 0 ;;
133 pmax:OpenBSD:*:*)
134 echo mipsel-unknown-openbsd${UNAME_RELEASE}
135 exit 0 ;;
136 sgi:OpenBSD:*:*)
137 echo mips-unknown-openbsd${UNAME_RELEASE}
138 exit 0 ;;
139 wgrisc:OpenBSD:*:*)
140 echo mipsel-unknown-openbsd${UNAME_RELEASE}
141 exit 0 ;;
142 arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
143 echo arm-acorn-riscix${UNAME_RELEASE}
144 exit 0;;
145 arm32:NetBSD:*:*)
146 echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
147 exit 0 ;;
148 SR2?01:HI-UX/MPP:*:*)
149 echo hppa1.1-hitachi-hiuxmpp
150 exit 0;;
151 Pyramid*:OSx*:*:*|MIS*:OSx*:*:*)
152 # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
153 if test "`(/bin/universe) 2>/dev/null`" = att ; then
154 echo pyramid-pyramid-sysv3
155 else
156 echo pyramid-pyramid-bsd
158 exit 0 ;;
159 NILE:*:*:dcosx)
160 echo pyramid-pyramid-svr4
161 exit 0 ;;
162 sun4H:SunOS:5.*:*)
163 echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
164 exit 0 ;;
165 sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
166 echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
167 exit 0 ;;
168 i86pc:SunOS:5.*:*)
169 echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
170 exit 0 ;;
171 sun4*:SunOS:6*:*)
172 # According to config.sub, this is the proper way to canonicalize
173 # SunOS6. Hard to guess exactly what SunOS6 will be like, but
174 # it's likely to be more like Solaris than SunOS4.
175 echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
176 exit 0 ;;
177 sun4*:SunOS:*:*)
178 case "`/usr/bin/arch -k`" in
179 Series*|S4*)
180 UNAME_RELEASE=`uname -v`
182 esac
183 # Japanese Language versions have a version number like `4.1.3-JL'.
184 echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
185 exit 0 ;;
186 sun3*:SunOS:*:*)
187 echo m68k-sun-sunos${UNAME_RELEASE}
188 exit 0 ;;
189 sun*:*:4.2BSD:*)
190 UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
191 test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
192 case "`/bin/arch`" in
193 sun3)
194 echo m68k-sun-sunos${UNAME_RELEASE}
196 sun4)
197 echo sparc-sun-sunos${UNAME_RELEASE}
199 esac
200 exit 0 ;;
201 aushp:SunOS:*:*)
202 echo sparc-auspex-sunos${UNAME_RELEASE}
203 exit 0 ;;
204 atari*:NetBSD:*:*)
205 echo m68k-atari-netbsd${UNAME_RELEASE}
206 exit 0 ;;
207 atari*:OpenBSD:*:*)
208 echo m68k-unknown-openbsd${UNAME_RELEASE}
209 exit 0 ;;
210 sun3*:NetBSD:*:*)
211 echo m68k-sun-netbsd${UNAME_RELEASE}
212 exit 0 ;;
213 sun3*:OpenBSD:*:*)
214 echo m68k-unknown-openbsd${UNAME_RELEASE}
215 exit 0 ;;
216 mac68k:NetBSD:*:*)
217 echo m68k-apple-netbsd${UNAME_RELEASE}
218 exit 0 ;;
219 mac68k:OpenBSD:*:*)
220 echo m68k-unknown-openbsd${UNAME_RELEASE}
221 exit 0 ;;
222 mvme68k:OpenBSD:*:*)
223 echo m68k-unknown-openbsd${UNAME_RELEASE}
224 exit 0 ;;
225 mvme88k:OpenBSD:*:*)
226 echo m88k-unknown-openbsd${UNAME_RELEASE}
227 exit 0 ;;
228 powerpc:machten:*:*)
229 echo powerpc-apple-machten${UNAME_RELEASE}
230 exit 0 ;;
231 RISC*:Mach:*:*)
232 echo mips-dec-mach_bsd4.3
233 exit 0 ;;
234 RISC*:ULTRIX:*:*)
235 echo mips-dec-ultrix${UNAME_RELEASE}
236 exit 0 ;;
237 VAX*:ULTRIX*:*:*)
238 echo vax-dec-ultrix${UNAME_RELEASE}
239 exit 0 ;;
240 2020:CLIX:*:*)
241 echo clipper-intergraph-clix${UNAME_RELEASE}
242 exit 0 ;;
243 mips:*:*:UMIPS | mips:*:*:RISCos)
244 sed 's/^ //' << EOF >dummy.c
245 int main (argc, argv) int argc; char **argv; {
246 #if defined (host_mips) && defined (MIPSEB)
247 #if defined (SYSTYPE_SYSV)
248 printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
249 #endif
250 #if defined (SYSTYPE_SVR4)
251 printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
252 #endif
253 #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
254 printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
255 #endif
256 #endif
257 exit (-1);
260 ${CC-cc} dummy.c -o dummy \
261 && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
262 && rm dummy.c dummy && exit 0
263 rm -f dummy.c dummy
264 echo mips-mips-riscos${UNAME_RELEASE}
265 exit 0 ;;
266 Night_Hawk:Power_UNIX:*:*)
267 echo powerpc-harris-powerunix
268 exit 0 ;;
269 m88k:CX/UX:7*:*)
270 echo m88k-harris-cxux7
271 exit 0 ;;
272 m88k:*:4*:R4*)
273 echo m88k-motorola-sysv4
274 exit 0 ;;
275 m88k:*:3*:R3*)
276 echo m88k-motorola-sysv3
277 exit 0 ;;
278 AViiON:dgux:*:*)
279 # DG/UX returns AViiON for all architectures
280 UNAME_PROCESSOR=`/usr/bin/uname -p`
281 if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
282 if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
283 -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
284 echo m88k-dg-dgux${UNAME_RELEASE}
285 else
286 echo m88k-dg-dguxbcs${UNAME_RELEASE}
288 else echo i586-dg-dgux${UNAME_RELEASE}
290 exit 0 ;;
291 M88*:DolphinOS:*:*) # DolphinOS (SVR3)
292 echo m88k-dolphin-sysv3
293 exit 0 ;;
294 M88*:*:R3*:*)
295 # Delta 88k system running SVR3
296 echo m88k-motorola-sysv3
297 exit 0 ;;
298 XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
299 echo m88k-tektronix-sysv3
300 exit 0 ;;
301 Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
302 echo m68k-tektronix-bsd
303 exit 0 ;;
304 *:IRIX*:*:*)
305 echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
306 exit 0 ;;
307 ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
308 echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
309 exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
310 i?86:AIX:*:*)
311 echo i386-ibm-aix
312 exit 0 ;;
313 *:AIX:2:3)
314 if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
315 sed 's/^ //' << EOF >dummy.c
316 #include <sys/systemcfg.h>
318 main()
320 if (!__power_pc())
321 exit(1);
322 puts("powerpc-ibm-aix3.2.5");
323 exit(0);
326 ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
327 rm -f dummy.c dummy
328 echo rs6000-ibm-aix3.2.5
329 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
330 echo rs6000-ibm-aix3.2.4
331 else
332 echo rs6000-ibm-aix3.2
334 exit 0 ;;
335 *:AIX:*:4)
336 if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
337 IBM_ARCH=rs6000
338 else
339 IBM_ARCH=powerpc
341 if [ -x /usr/bin/oslevel ] ; then
342 IBM_REV=`/usr/bin/oslevel`
343 else
344 IBM_REV=4.${UNAME_RELEASE}
346 echo ${IBM_ARCH}-ibm-aix${IBM_REV}
347 exit 0 ;;
348 *:AIX:*:*)
349 echo rs6000-ibm-aix
350 exit 0 ;;
351 ibmrt:4.4BSD:*|romp-ibm:BSD:*)
352 echo romp-ibm-bsd4.4
353 exit 0 ;;
354 ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
355 echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
356 exit 0 ;; # report: romp-ibm BSD 4.3
357 *:BOSX:*:*)
358 echo rs6000-bull-bosx
359 exit 0 ;;
360 DPX/2?00:B.O.S.:*:*)
361 echo m68k-bull-sysv3
362 exit 0 ;;
363 9000/[34]??:4.3bsd:1.*:*)
364 echo m68k-hp-bsd
365 exit 0 ;;
366 hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
367 echo m68k-hp-bsd4.4
368 exit 0 ;;
369 *9??*:MPE/iX:*:*)
370 echo hppa1.0-hp-mpeix
371 exit 0 ;;
372 9000/[34678]??:HP-UX:*:*)
373 case "${UNAME_MACHINE}" in
374 9000/31? ) HP_ARCH=m68000 ;;
375 9000/[34]?? ) HP_ARCH=m68k ;;
376 9000/[678][0-9][0-9] )
378 sed 's/^ //' << EOF >dummy.c
379 #include <stdlib.h>
380 #include <unistd.h>
382 int main ()
384 #if defined(_SC_KERNEL_BITS)
385 long bits = sysconf(_SC_KERNEL_BITS);
386 #endif
387 long cpu = sysconf (_SC_CPU_VERSION);
389 switch (cpu)
391 case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
392 case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
393 case CPU_PA_RISC2_0:
394 #if defined(_SC_KERNEL_BITS)
395 switch (bits)
397 case 64: puts ("hppa2.0w"); break;
398 case 32: puts ("hppa2.0n"); break;
399 default: puts ("hppa2.0"); break;
400 } break;
401 #else /* !defined(_SC_KERNEL_BITS) */
402 puts ("hppa2.0"); break;
403 #endif
404 default: puts ("hppa1.0"); break;
406 exit (0);
409 (${CC-cc} dummy.c -o dummy 2>/dev/null ) && HP_ARCH=`./dummy`
410 rm -f dummy.c dummy
411 esac
412 HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
413 echo ${HP_ARCH}-hp-hpux${HPUX_REV}
414 exit 0 ;;
415 3050*:HI-UX:*:*)
416 sed 's/^ //' << EOF >dummy.c
417 #include <unistd.h>
419 main ()
421 long cpu = sysconf (_SC_CPU_VERSION);
422 /* The order matters, because CPU_IS_HP_MC68K erroneously returns
423 true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
424 results, however. */
425 if (CPU_IS_PA_RISC (cpu))
427 switch (cpu)
429 case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
430 case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
431 case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
432 default: puts ("hppa-hitachi-hiuxwe2"); break;
435 else if (CPU_IS_HP_MC68K (cpu))
436 puts ("m68k-hitachi-hiuxwe2");
437 else puts ("unknown-hitachi-hiuxwe2");
438 exit (0);
441 ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
442 rm -f dummy.c dummy
443 echo unknown-hitachi-hiuxwe2
444 exit 0 ;;
445 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
446 echo hppa1.1-hp-bsd
447 exit 0 ;;
448 9000/8??:4.3bsd:*:*)
449 echo hppa1.0-hp-bsd
450 exit 0 ;;
451 hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
452 echo hppa1.1-hp-osf
453 exit 0 ;;
454 hp8??:OSF1:*:*)
455 echo hppa1.0-hp-osf
456 exit 0 ;;
457 i?86:OSF1:*:*)
458 if [ -x /usr/sbin/sysversion ] ; then
459 echo ${UNAME_MACHINE}-unknown-osf1mk
460 else
461 echo ${UNAME_MACHINE}-unknown-osf1
463 exit 0 ;;
464 parisc*:Lites*:*:*)
465 echo hppa1.1-hp-lites
466 exit 0 ;;
467 hppa*:OpenBSD:*:*)
468 echo hppa-unknown-openbsd
469 exit 0 ;;
470 C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
471 echo c1-convex-bsd
472 exit 0 ;;
473 C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
474 if getsysinfo -f scalar_acc
475 then echo c32-convex-bsd
476 else echo c2-convex-bsd
478 exit 0 ;;
479 C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
480 echo c34-convex-bsd
481 exit 0 ;;
482 C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
483 echo c38-convex-bsd
484 exit 0 ;;
485 C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
486 echo c4-convex-bsd
487 exit 0 ;;
488 CRAY*X-MP:*:*:*)
489 echo xmp-cray-unicos
490 exit 0 ;;
491 CRAY*Y-MP:*:*:*)
492 echo ymp-cray-unicos${UNAME_RELEASE}
493 exit 0 ;;
494 CRAY*[A-Z]90:*:*:*)
495 echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
496 | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
497 -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
498 exit 0 ;;
499 CRAY*TS:*:*:*)
500 echo t90-cray-unicos${UNAME_RELEASE}
501 exit 0 ;;
502 CRAY-2:*:*:*)
503 echo cray2-cray-unicos
504 exit 0 ;;
505 F300:UNIX_System_V:*:*)
506 FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
507 FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
508 echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
509 exit 0 ;;
510 F301:UNIX_System_V:*:*)
511 echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
512 exit 0 ;;
513 hp3[0-9][05]:NetBSD:*:*)
514 echo m68k-hp-netbsd${UNAME_RELEASE}
515 exit 0 ;;
516 hp300:OpenBSD:*:*)
517 echo m68k-unknown-openbsd${UNAME_RELEASE}
518 exit 0 ;;
519 i?86:BSD/386:*:* | *:BSD/OS:*:*)
520 echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
521 exit 0 ;;
522 *:FreeBSD:*:*)
523 if test -x /usr/bin/objformat -a "elf" = "`/usr/bin/objformat`"; then
524 echo ${UNAME_MACHINE}-unknown-freebsdelf
525 else
526 echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
528 exit 0 ;;
529 *:NetBSD:*:*)
530 echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
531 exit 0 ;;
532 *:OpenBSD:*:*)
533 echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
534 exit 0 ;;
535 i*:CYGWIN*:*)
536 echo ${UNAME_MACHINE}-pc-cygwin32
537 exit 0 ;;
538 i*:MINGW*:*)
539 echo ${UNAME_MACHINE}-pc-mingw32
540 exit 0 ;;
541 i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
542 # How do we know it's Interix rather than generic posix subsystem?
543 # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
544 # change UNAME_MACHINE based on the output of uname instead of
545 # i386?
546 echo i386-pc-interix
547 exit 0 ;;
548 i*:UWIN*:*)
549 echo ${UNAME_MACHINE}-pc-uwin
550 exit 0 ;;
551 p*:CYGWIN*:*)
552 echo powerpcle-unknown-cygwin32
553 exit 0 ;;
554 prep*:SunOS:5.*:*)
555 echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
556 exit 0 ;;
557 *:GNU:*:*)
558 echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
559 exit 0 ;;
560 *:Linux:*:*)
561 # uname on the ARM produces all sorts of strangeness, and we need to
562 # filter it out.
563 case "$UNAME_MACHINE" in
564 armv*) UNAME_MACHINE=$UNAME_MACHINE ;;
565 arm* | sa110*) UNAME_MACHINE="arm" ;;
566 esac
568 # The BFD linker knows what the default object file format is, so
569 # first see if it will tell us.
570 ld_help_string=`ld --help 2>&1`
571 ld_supported_emulations=`echo $ld_help_string \
572 | sed -ne '/supported emulations:/!d
573 s/[ ][ ]*/ /g
574 s/.*supported emulations: *//
575 s/ .*//
577 case "$ld_supported_emulations" in
578 i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;;
579 i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;;
580 sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
581 armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
582 m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
583 elf32ppc | elf32ppclinux)
584 # Determine Lib Version
585 cat >dummy.c <<EOF
586 #include <features.h>
587 #if defined(__GLIBC__)
588 extern char __libc_version[];
589 extern char __libc_release[];
590 #endif
591 main(argc, argv)
592 int argc;
593 char *argv[];
595 #if defined(__GLIBC__)
596 printf("%s %s\n", __libc_version, __libc_release);
597 #else
598 printf("unkown\n");
599 #endif
600 return 0;
603 LIBC=""
604 ${CC-cc} dummy.c -o dummy 2>/dev/null
605 if test "$?" = 0 ; then
606 ./dummy | grep 1\.99 > /dev/null
607 if test "$?" = 0 ; then
608 LIBC="libc1"
611 rm -f dummy.c dummy
612 echo powerpc-unknown-linux-gnu${LIBC} ; exit 0 ;;
613 esac
615 if test "${UNAME_MACHINE}" = "alpha" ; then
616 sed 's/^ //' <<EOF >dummy.s
617 .globl main
618 .ent main
619 main:
620 .frame \$30,0,\$26,0
621 .prologue 0
622 .long 0x47e03d80 # implver $0
623 lda \$2,259
624 .long 0x47e20c21 # amask $2,$1
625 srl \$1,8,\$2
626 sll \$2,2,\$2
627 sll \$0,3,\$0
628 addl \$1,\$0,\$0
629 addl \$2,\$0,\$0
630 ret \$31,(\$26),1
631 .end main
633 LIBC=""
634 ${CC-cc} dummy.s -o dummy 2>/dev/null
635 if test "$?" = 0 ; then
636 ./dummy
637 case "$?" in
639 UNAME_MACHINE="alpha"
642 UNAME_MACHINE="alphaev5"
645 UNAME_MACHINE="alphaev56"
648 UNAME_MACHINE="alphapca56"
651 UNAME_MACHINE="alphaev6"
653 esac
655 objdump --private-headers dummy | \
656 grep ld.so.1 > /dev/null
657 if test "$?" = 0 ; then
658 LIBC="libc1"
661 rm -f dummy.s dummy
662 echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
663 elif test "${UNAME_MACHINE}" = "mips" ; then
664 cat >dummy.c <<EOF
665 main(argc, argv)
666 int argc;
667 char *argv[];
669 #ifdef __MIPSEB__
670 printf ("%s-unknown-linux-gnu\n", argv[1]);
671 #endif
672 #ifdef __MIPSEL__
673 printf ("%sel-unknown-linux-gnu\n", argv[1]);
674 #endif
675 return 0;
678 ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
679 rm -f dummy.c dummy
680 else
681 # Either a pre-BFD a.out linker (linux-gnuoldld)
682 # or one that does not give us useful --help.
683 # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
684 # If ld does not provide *any* "supported emulations:"
685 # that means it is gnuoldld.
686 echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
687 test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
689 case "${UNAME_MACHINE}" in
690 i?86)
691 VENDOR=pc;
694 VENDOR=unknown;
696 esac
697 # Determine whether the default compiler is a.out or elf
698 cat >dummy.c <<EOF
699 #include <features.h>
700 main(argc, argv)
701 int argc;
702 char *argv[];
704 #ifdef __ELF__
705 # ifdef __GLIBC__
706 # if __GLIBC__ >= 2
707 printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
708 # else
709 printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
710 # endif
711 # else
712 printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
713 # endif
714 #else
715 printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
716 #endif
717 return 0;
720 ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
721 rm -f dummy.c dummy
722 fi ;;
723 # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
724 # are messed up and put the nodename in both sysname and nodename.
725 i?86:DYNIX/ptx:4*:*)
726 echo i386-sequent-sysv4
727 exit 0 ;;
728 i?86:UNIX_SV:4.2MP:2.*)
729 # Unixware is an offshoot of SVR4, but it has its own version
730 # number series starting with 2...
731 # I am not positive that other SVR4 systems won't match this,
732 # I just have to hope. -- rms.
733 # Use sysv4.2uw... so that sysv4* matches it.
734 echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
735 exit 0 ;;
736 i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
737 if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
738 echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
739 else
740 echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
742 exit 0 ;;
743 i?86:*:5:7*)
744 UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
745 (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
746 (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
747 && UNAME_MACHINE=i586
748 # 5.0.4c returns "Pent II". 5.0.5 returns PentII
749 (/bin/uname -X|egrep '^Machine.*Pent.*II' >/dev/null) \
750 && UNAME_MACHINE=i686
751 (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
752 && UNAME_MACHINE=i686
753 echo ${UNAME_MACHINE}-${UNAME_SYSTEM}${UNAME_VERSION}-sysv${UNAME_RELEASE}
754 exit 0 ;;
755 i?86:*:3.2:*)
756 if test -f /usr/options/cb.name; then
757 UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
758 echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
759 elif /bin/uname -X 2>/dev/null >/dev/null ; then
760 UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
761 (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
762 (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
763 && UNAME_MACHINE=i586
764 (/bin/uname -X|egrep '^Machine.*PentII' >/dev/null) \
765 && UNAME_MACHINE=i686
766 (/bin/uname -X|egrep '^Machine.*Pent II' >/dev/null) \
767 && UNAME_MACHINE=i686
768 (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
769 && UNAME_MACHINE=i686
770 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
771 else
772 echo ${UNAME_MACHINE}-pc-sysv32
774 exit 0 ;;
775 pc:*:*:*)
776 # uname -m prints for DJGPP always 'pc', but it prints nothing about
777 # the processor, so we play safe by assuming i386.
778 echo i386-pc-msdosdjgpp
779 exit 0 ;;
780 Intel:Mach:3*:*)
781 echo i386-pc-mach3
782 exit 0 ;;
783 paragon:*:*:*)
784 echo i860-intel-osf1
785 exit 0 ;;
786 i860:*:4.*:*) # i860-SVR4
787 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
788 echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
789 else # Add other i860-SVR4 vendors below as they are discovered.
790 echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
792 exit 0 ;;
793 mini*:CTIX:SYS*5:*)
794 # "miniframe"
795 echo m68010-convergent-sysv
796 exit 0 ;;
797 M68*:*:R3V[567]*:*)
798 test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
799 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
800 OS_REL=''
801 test -r /etc/.relid \
802 && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
803 /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
804 && echo i486-ncr-sysv4.3${OS_REL} && exit 0
805 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
806 && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
807 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
808 /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
809 && echo i486-ncr-sysv4 && exit 0 ;;
810 m68*:LynxOS:2.*:*)
811 echo m68k-unknown-lynxos${UNAME_RELEASE}
812 exit 0 ;;
813 mc68030:UNIX_System_V:4.*:*)
814 echo m68k-atari-sysv4
815 exit 0 ;;
816 i?86:LynxOS:2.*:*)
817 echo i386-unknown-lynxos${UNAME_RELEASE}
818 exit 0 ;;
819 TSUNAMI:LynxOS:2.*:*)
820 echo sparc-unknown-lynxos${UNAME_RELEASE}
821 exit 0 ;;
822 rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
823 echo rs6000-unknown-lynxos${UNAME_RELEASE}
824 exit 0 ;;
825 SM[BE]S:UNIX_SV:*:*)
826 echo mips-dde-sysv${UNAME_RELEASE}
827 exit 0 ;;
828 RM*:SINIX-*:*:*)
829 echo mips-sni-sysv4
830 exit 0 ;;
831 RM*:ReliantUNIX-*:*:*)
832 echo mips-sni-sysv4
833 exit 0 ;;
834 *:SINIX-*:*:*)
835 if uname -p 2>/dev/null >/dev/null ; then
836 UNAME_MACHINE=`(uname -p) 2>/dev/null`
837 echo ${UNAME_MACHINE}-sni-sysv4
838 else
839 echo ns32k-sni-sysv
841 exit 0 ;;
842 PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
843 # says <Richard.M.Bartel@ccMail.Census.GOV>
844 echo i586-unisys-sysv4
845 exit 0 ;;
846 *:UNIX_System_V:4*:FTX*)
847 # From Gerald Hewes <hewes@openmarket.com>.
848 # How about differentiating between stratus architectures? -djm
849 echo hppa1.1-stratus-sysv4
850 exit 0 ;;
851 *:*:*:FTX*)
852 # From seanf@swdc.stratus.com.
853 echo i860-stratus-sysv4
854 exit 0 ;;
855 mc68*:A/UX:*:*)
856 echo m68k-apple-aux${UNAME_RELEASE}
857 exit 0 ;;
858 news*:NEWS-OS:*:6*)
859 echo mips-sony-newsos6
860 exit 0 ;;
861 R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*)
862 if [ -d /usr/nec ]; then
863 echo mips-nec-sysv${UNAME_RELEASE}
864 else
865 echo mips-unknown-sysv${UNAME_RELEASE}
867 exit 0 ;;
868 BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
869 echo powerpc-be-beos
870 exit 0 ;;
871 BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
872 echo powerpc-apple-beos
873 exit 0 ;;
874 BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
875 echo i586-pc-beos
876 exit 0 ;;
877 esac
879 #echo '(No uname command or uname output not recognized.)' 1>&2
880 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
882 cat >dummy.c <<EOF
883 #ifdef _SEQUENT_
884 # include <sys/types.h>
885 # include <sys/utsname.h>
886 #endif
887 main ()
889 #if defined (sony)
890 #if defined (MIPSEB)
891 /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
892 I don't know.... */
893 printf ("mips-sony-bsd\n"); exit (0);
894 #else
895 #include <sys/param.h>
896 printf ("m68k-sony-newsos%s\n",
897 #ifdef NEWSOS4
899 #else
901 #endif
902 ); exit (0);
903 #endif
904 #endif
906 #if defined (__arm) && defined (__acorn) && defined (__unix)
907 printf ("arm-acorn-riscix"); exit (0);
908 #endif
910 #if defined (hp300) && !defined (hpux)
911 printf ("m68k-hp-bsd\n"); exit (0);
912 #endif
914 #if defined (NeXT)
915 #if !defined (__ARCHITECTURE__)
916 #define __ARCHITECTURE__ "m68k"
917 #endif
918 int version;
919 version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
920 printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
921 exit (0);
922 #endif
924 #if defined (MULTIMAX) || defined (n16)
925 #if defined (UMAXV)
926 printf ("ns32k-encore-sysv\n"); exit (0);
927 #else
928 #if defined (CMU)
929 printf ("ns32k-encore-mach\n"); exit (0);
930 #else
931 printf ("ns32k-encore-bsd\n"); exit (0);
932 #endif
933 #endif
934 #endif
936 #if defined (__386BSD__)
937 printf ("i386-pc-bsd\n"); exit (0);
938 #endif
940 #if defined (sequent)
941 #if defined (i386)
942 printf ("i386-sequent-dynix\n"); exit (0);
943 #endif
944 #if defined (ns32000)
945 printf ("ns32k-sequent-dynix\n"); exit (0);
946 #endif
947 #endif
949 #if defined (_SEQUENT_)
950 struct utsname un;
952 uname(&un);
954 if (strncmp(un.version, "V2", 2) == 0) {
955 printf ("i386-sequent-ptx2\n"); exit (0);
957 if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
958 printf ("i386-sequent-ptx1\n"); exit (0);
960 printf ("i386-sequent-ptx\n"); exit (0);
962 #endif
964 #if defined (vax)
965 #if !defined (ultrix)
966 printf ("vax-dec-bsd\n"); exit (0);
967 #else
968 printf ("vax-dec-ultrix\n"); exit (0);
969 #endif
970 #endif
972 #if defined (alliant) && defined (i860)
973 printf ("i860-alliant-bsd\n"); exit (0);
974 #endif
976 exit (1);
980 ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
981 rm -f dummy.c dummy
983 # Apollos put the system type in the environment.
985 test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
987 # Convex versions that predate uname can use getsysinfo(1)
989 if [ -x /usr/convex/getsysinfo ]
990 then
991 case `getsysinfo -f cpu_type` in
992 c1*)
993 echo c1-convex-bsd
994 exit 0 ;;
995 c2*)
996 if getsysinfo -f scalar_acc
997 then echo c32-convex-bsd
998 else echo c2-convex-bsd
1000 exit 0 ;;
1001 c34*)
1002 echo c34-convex-bsd
1003 exit 0 ;;
1004 c38*)
1005 echo c38-convex-bsd
1006 exit 0 ;;
1007 c4*)
1008 echo c4-convex-bsd
1009 exit 0 ;;
1010 esac
1013 #echo '(Unable to guess system type)' 1>&2
1015 exit 1