2 # Attempt to guess a canonical system name.
3 # Copyright (C) 1992, 1993, 1994, 1995, 1996 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 # Use $HOST_CC if defined. $CC may point to a cross-compiler
39 if test x"$CC_FOR_BUILD" = x; then
40 if test x"$HOST_CC" != x; then
41 CC_FOR_BUILD="$HOST_CC"
43 if test x"$CC" != x; then
51 # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
52 # (ghazi@noc.rutgers.edu 8/24/94.)
53 if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
54 PATH=$PATH:/.attbin ; export PATH
55 elif (test -f /usr/5bin/uname) >/dev/null 2>&1 ; then
59 UNAME=`(uname) 2>/dev/null` || UNAME=unknown
60 UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
61 UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
62 UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
63 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
65 RELEASE=`expr "$UNAME_RELEASE" : '[^0-9]*\([0-9]*\)'` # 4
68 *) RELEASE=`expr "$RELEASE" + 0` ;;
70 REL_LEVEL=`expr "$UNAME_RELEASE" : '[^0-9]*[0-9]*.\([0-9]*\)'` # 1
71 REL_SUBLEVEL=`expr "$UNAME_RELEASE" : '[^0-9]*[0-9]*.[0-9]*.\([0-9]*\)'` # 2
74 trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15
76 # Some versions of i386 SVR4.2 make `uname' equivalent to `uname -n', which
77 # is contrary to all other versions of uname
78 if [ -n "$UNAME" ] && [ "$UNAME_S" != "$UNAME" ] && [ "$UNAME_S" = UNIX_SV ]; then
82 # Note: order is significant - the case branches are not exclusive.
84 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
85 # Begin cases added for Bash
87 echo alpha-dec-netbsd${UNAME_RELEASE}
90 echo alpha-dec-openbsd${UNAME_RELEASE}
93 echo ${UNAME_MACHINE}-pc-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
96 echo ${UNAME_MACHINE}-pc-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
99 echo sparc-unknown-netbsd${UNAME_RELEASE}
102 echo sparc-unknown-openbsd${UNAME_RELEASE}
105 echo vax-dec-netbsd${UNAME_RELEASE}
108 echo vax-dec-openbsd${UNAME_RELEASE}
111 echo mac68k-apple-machten${UNAME_RELEASE}
114 if test "`(/bin/universe) 2>/dev/null`" = att ; then
115 echo concurrent-concurrent-sysv3
117 echo concurrent-concurrent-bsd
121 echo ppc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
124 echo sparc-unknown-sysv${UNAME_RELEASE}
127 echo mips-mips-sysv${UNAME_RELEASE}
133 echo mips-mips-bsd4.4
135 MIServer-S:SMP_DC.OSx:*:dcosx)
136 echo mips-pyramid-sysv4
139 echo mips-sony-newsos${UNAME_RELEASE}
142 echo i386-next-nextstep${RELEASE}
145 echo m68k-next-nextstep${RELEASE}
153 esa:OSF*1:*:* | ESA:OSF*:*:*)
163 echo i386-qssl-qnx`echo ${UNAME_VERSION}`
165 Alpha*:Windows:NT:*:SP*)
172 echo mips-compaq-nonstopux
174 # end cases added for Bash
176 # TEST CHANGED FOR BASH to handle `letter version' releases
177 UNAME_MAJOR=`echo "$UNAME_RELEASE" | sed -e 's/^.\([0-9]\).*/\1/'`
178 if test X"$UNAME_MAJOR" != X"" && test $UNAME_MAJOR = 4 ; then
179 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
180 elif test X"$UNAME_MAJOR" != X"" && test $UNAME_MAJOR -gt 4 ; then
181 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
183 # A Vn.n version is a released version.
184 # A Tn.n version is a released field test version.
185 # A Xn.n version is an unreleased experimental baselevel.
186 # 1.2 uses "1.2" for uname -r.
193 .long 0x47e03d80 # implver $0
195 .long 0x47e20c21 # amask $2,$1
204 $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
205 if test "$?" = 0 ; then
209 UNAME_MACHINE="alpha"
212 UNAME_MACHINE="alphaev5"
215 UNAME_MACHINE="alphaev56"
218 UNAME_MACHINE="alphapca56"
221 UNAME_MACHINE="alphaev6"
225 rm -f $dummy.s $dummy
226 echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
228 Alpha\ *:Windows_NT*:*)
229 # How do we know it's Interix rather than the generic POSIX subsystem?
230 # Should we change UNAME_MACHINE based on the output of uname instead
231 # of the specific Alpha model?
232 echo alpha-pc-interix
234 21064:Windows_NT:50:3)
235 echo alpha-dec-winnt3.5
237 Amiga*:UNIX_System_V:4.0:*)
241 echo m68k-cbm-netbsd${UNAME_RELEASE}
244 echo m68k-cbm-openbsd${UNAME_RELEASE}
246 *:[Aa]miga[Oo][Ss]:*:*)
247 echo ${UNAME_MACHINE}-unknown-amigaos
250 echo mips64el-unknown-openbsd${UNAME_RELEASE}
253 echo mipsel-unknown-openbsd${UNAME_RELEASE}
256 echo mips-unknown-openbsd${UNAME_RELEASE}
259 echo mipsel-unknown-openbsd${UNAME_RELEASE}
262 echo mips-unknown-openbsd${UNAME_RELEASE}
265 echo mipsel-unknown-openbsd${UNAME_RELEASE}
267 arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
268 echo arm-acorn-riscix${UNAME_RELEASE}
271 echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
273 SR2?01:HI-UX/MPP:*:*)
274 echo hppa1.1-hitachi-hiuxmpp
276 Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
277 # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
278 if test "`(/bin/universe) 2>/dev/null`" = att ; then
279 echo pyramid-pyramid-sysv3
281 echo pyramid-pyramid-bsd
285 echo pyramid-pyramid-svr4
288 echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
290 sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
291 echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
294 echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
297 # According to config.sub, this is the proper way to canonicalize
298 # SunOS6. Hard to guess exactly what SunOS6 will be like, but
299 # it's likely to be more like Solaris than SunOS4.
300 echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
303 case "`/usr/bin/arch -k`" in
305 UNAME_RELEASE=`uname -v`
308 # Japanese Language versions have a version number like `4.1.3-JL'.
309 echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
312 echo m68k-sun-sunos${UNAME_RELEASE}
315 UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
316 test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
317 case "`/bin/arch`" in
319 echo m68k-sun-sunos${UNAME_RELEASE}
322 echo sparc-sun-sunos${UNAME_RELEASE}
327 echo sparc-auspex-sunos${UNAME_RELEASE}
330 echo m68k-atari-netbsd${UNAME_RELEASE}
333 echo m68k-unknown-openbsd${UNAME_RELEASE}
335 # The situation for MiNT is a little confusing. The machine name
336 # can be virtually everything (everything which is not
337 # "atarist" or "atariste" at least should have a processor
338 # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
339 # to the lowercase version "mint" (or "freemint"). Finally
340 # the system name "TOS" denotes a system which is actually not
341 # MiNT. But MiNT is downward compatible to TOS, so this should
343 atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
344 echo m68k-atari-mint${UNAME_RELEASE}
346 atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
347 echo m68k-atari-mint${UNAME_RELEASE}
349 *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
350 echo m68k-atari-mint${UNAME_RELEASE}
352 milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
353 echo m68k-milan-mint${UNAME_RELEASE}
355 hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
356 echo m68k-hades-mint${UNAME_RELEASE}
358 *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
359 echo m68k-unknown-mint${UNAME_RELEASE}
362 echo m68k-sun-netbsd${UNAME_RELEASE}
365 echo m68k-unknown-openbsd${UNAME_RELEASE}
368 echo m68k-apple-netbsd${UNAME_RELEASE}
371 echo m68k-unknown-openbsd${UNAME_RELEASE}
374 echo m68k-unknown-openbsd${UNAME_RELEASE}
377 echo m88k-unknown-openbsd${UNAME_RELEASE}
380 echo `uname -p`-apple-macos${UNAME_RELEASE}
383 echo powerpc-apple-machten${UNAME_RELEASE}
386 echo powerpc-apple-netbsd${UNAME_RELEASE}
389 echo mips-dec-mach_bsd4.3
392 echo mips-dec-ultrix${UNAME_RELEASE}
395 echo vax-dec-ultrix${UNAME_RELEASE}
397 2020:CLIX:*:* | 2430:CLIX:*:*)
398 echo clipper-intergraph-clix${UNAME_RELEASE}
400 mips:*:*:UMIPS | mips:*:*:RISCos)
401 sed 's/^ //' << EOF >$dummy.c
403 int main (int argc, char *argv[]) {
405 int main (argc, argv) int argc; char *argv[]; {
407 #if defined (host_mips) && defined (MIPSEB)
408 #if defined (SYSTYPE_SYSV)
409 printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
411 #if defined (SYSTYPE_SVR4)
412 printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
414 #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
415 printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
421 $CC_FOR_BUILD $dummy.c -o $dummy \
422 && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
423 && rm $dummy.c $dummy && exit 0
424 rm -f $dummy.c $dummy
425 echo mips-mips-riscos${UNAME_RELEASE}
427 Night_Hawk:Power_UNIX:*:*)
428 echo powerpc-harris-powerunix
431 echo m88k-harris-cxux7
434 echo m88k-motorola-sysv4
437 echo m88k-motorola-sysv3
440 # DG/UX returns AViiON for all architectures
441 UNAME_PROCESSOR=`/usr/bin/uname -p`
442 if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
443 if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
444 -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
445 echo m88k-dg-dgux${UNAME_RELEASE}
447 echo m88k-dg-dguxbcs${UNAME_RELEASE}
450 echo i586-dg-dgux${UNAME_RELEASE}
453 M88*:DolphinOS:*:*) # DolphinOS (SVR3)
454 echo m88k-dolphin-sysv3
457 # Delta 88k system running SVR3
458 echo m88k-motorola-sysv3
460 XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
461 echo m88k-tektronix-sysv3
463 Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
464 echo m68k-tektronix-bsd
467 echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
469 ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
470 echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
471 exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
476 if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
477 sed 's/^ //' << EOF >$dummy.c
478 #include <sys/systemcfg.h>
484 puts("powerpc-ibm-aix3.2.5");
488 $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
489 rm -f $dummy.c $dummy
490 echo rs6000-ibm-aix3.2.5
491 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
492 echo rs6000-ibm-aix3.2.4
494 echo rs6000-ibm-aix3.2
498 IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
499 if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then
504 if [ -x /usr/bin/oslevel ] ; then
505 IBM_REV=`/usr/bin/oslevel`
506 elif grep bos410 /usr/include/stdio.h >/dev/null 2>&1; then
508 elif grep bos411 /usr/include/stdio.h >/dev/null 2>&1; then
511 IBM_REV=4.${UNAME_RELEASE}
513 echo ${IBM_ARCH}-ibm-aix${IBM_REV}
518 ibmrt:4.4BSD:*|romp-ibm:BSD:*)
521 ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
522 echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
523 exit 0 ;; # report: romp-ibm BSD 4.3
525 echo rs6000-bull-bosx
530 9000/[34]??:4.3bsd:1.*:*)
533 hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
536 9000/[34678]??:HP-UX:*:*)
537 case "${UNAME_MACHINE}" in
538 9000/31? ) HP_ARCH=m68000 ;;
539 9000/[34]?? ) HP_ARCH=m68k ;;
540 9000/[678][0-9][0-9])
541 sed 's/^ //' << EOF >$dummy.c
547 #if defined(_SC_KERNEL_BITS)
548 long bits = sysconf(_SC_KERNEL_BITS);
550 long cpu = sysconf (_SC_CPU_VERSION);
554 case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
555 case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
557 #if defined(_SC_KERNEL_BITS)
560 case 64: puts ("hppa2.0w"); break;
561 case 32: puts ("hppa2.0n"); break;
562 default: puts ("hppa2.0"); break;
564 #else /* !defined(_SC_KERNEL_BITS) */
565 puts ("hppa2.0"); break;
567 default: puts ("hppa1.0"); break;
572 ($CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
573 rm -f $dummy.c $dummy
575 HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
576 echo ${HP_ARCH}-hp-hpux${HPUX_REV}
579 sed 's/^ //' << EOF >$dummy.c
584 long cpu = sysconf (_SC_CPU_VERSION);
585 /* The order matters, because CPU_IS_HP_MC68K erroneously returns
586 true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
588 if (CPU_IS_PA_RISC (cpu))
592 case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
593 case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
594 case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
595 default: puts ("hppa-hitachi-hiuxwe2"); break;
598 else if (CPU_IS_HP_MC68K (cpu))
599 puts ("m68k-hitachi-hiuxwe2");
600 else puts ("unknown-hitachi-hiuxwe2");
604 $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
605 rm -f $dummy.c $dummy
606 echo unknown-hitachi-hiuxwe2
608 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
615 echo hppa1.0-hp-mpeix
617 hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
624 if [ -x /usr/sbin/sysversion ] ; then
625 echo ${UNAME_MACHINE}-unknown-osf1mk
627 echo ${UNAME_MACHINE}-unknown-osf1
631 echo hppa1.1-hp-lites
634 echo hppa-unknown-openbsd
636 C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
639 C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
640 if getsysinfo -f scalar_acc
641 then echo c32-convex-bsd
642 else echo c2-convex-bsd
645 C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
648 C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
651 C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
658 echo ymp-cray-unicos${UNAME_RELEASE}
661 echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
662 | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
663 -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
666 echo t90-cray-unicos${UNAME_RELEASE}
669 echo alpha-cray-unicosmk${UNAME_RELEASE}
672 echo cray2-cray-unicos
674 F300:UNIX_System_V:*:*)
675 FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
676 FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
677 echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
679 F301:UNIX_System_V:*:*)
680 echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
682 hp3[0-9][05]:NetBSD:*:*)
683 echo m68k-hp-netbsd${UNAME_RELEASE}
686 echo m68k-unknown-openbsd${UNAME_RELEASE}
688 i?86:BSD/386:*:* | i?86:BSD/OS:*:*)
689 echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
692 echo sparc-unknown-bsdi${UNAME_RELEASE}
695 echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
698 # if test -x /usr/bin/objformat; then
699 # if test "elf" = "`/usr/bin/objformat`"; then
700 # echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
704 echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-=(].*//'`
707 echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
710 echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
713 echo ${UNAME_MACHINE}-pc-cygwin
716 echo ${UNAME_MACHINE}-pc-mingw32
718 i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
719 # How do we know it's Interix rather than the generic POSIX subsystem?
720 # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
721 # UNAME_MACHINE based on the output of uname instead of i386?
725 echo ${UNAME_MACHINE}-pc-uwin
728 echo powerpcle-unknown-cygwin
731 echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
734 echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
737 # uname on the ARM produces all sorts of strangeness, and we need to
739 case "$UNAME_MACHINE" in
740 armv*) UNAME_MACHINE=$UNAME_MACHINE ;;
741 arm* | sa110*) UNAME_MACHINE="arm" ;;
744 # The BFD linker knows what the default object file format is, so
745 # first see if it will tell us. cd to the root directory to prevent
746 # problems with other programs or directories called `ld' in the path.
747 ld_help_string=`cd /; ld --help 2>&1`
748 ld_supported_emulations=`echo $ld_help_string \
749 | sed -ne '/supported emulations:/!d
751 s/.*supported emulations: *//
754 case "$ld_supported_emulations" in
755 *ia64) echo "${UNAME_MACHINE}-unknown-linux" ; exit 0 ;;
756 i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;;
757 i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;;
758 sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
759 armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
760 m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
761 elf32ppc | elf32ppclinux)
762 # Determine Lib Version
764 #include <features.h>
765 #if defined(__GLIBC__)
766 extern char __libc_version[];
767 extern char __libc_release[];
773 #if defined(__GLIBC__)
774 printf("%s %s\n", __libc_version, __libc_release);
782 $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
783 if test "$?" = 0 ; then
784 ./$dummy | grep 1\.99 > /dev/null
785 if test "$?" = 0 ; then
789 rm -f $dummy.c $dummy
790 echo powerpc-unknown-linux-gnu${LIBC} ; exit 0 ;;
793 if test "${UNAME_MACHINE}" = "alpha" ; then
794 sed 's/^ //' <<EOF >$dummy.s
800 .long 0x47e03d80 # implver $0
802 .long 0x47e20c21 # amask $2,$1
812 $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
813 if test "$?" = 0 ; then
817 UNAME_MACHINE="alpha"
820 UNAME_MACHINE="alphaev5"
823 UNAME_MACHINE="alphaev56"
826 UNAME_MACHINE="alphapca56"
829 UNAME_MACHINE="alphaev6"
833 objdump --private-headers $dummy | \
834 grep ld.so.1 > /dev/null
835 if test "$?" = 0 ; then
839 rm -f $dummy.s $dummy
840 echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
841 elif test "${UNAME_MACHINE}" = "mips" ; then
844 int main (int argc, char *argv[]) {
846 int main (argc, argv) int argc; char *argv[]; {
849 printf ("%s-unknown-linux-gnu\n", argv[1]);
852 printf ("%sel-unknown-linux-gnu\n", argv[1]);
857 $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
858 rm -f $dummy.c $dummy
860 # Either a pre-BFD a.out linker (linux-gnuoldld)
861 # or one that does not give us useful --help.
862 # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
863 # If ld does not provide *any* "supported emulations:"
864 # that means it is gnuoldld.
865 echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
866 test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
868 case "${UNAME_MACHINE}" in
876 # Determine whether the default compiler is a.out or elf
878 #include <features.h>
880 int main (int argc, char *argv[]) {
882 int main (argc, argv) int argc; char *argv[]; {
887 printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
889 printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
892 printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
895 printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
900 ${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
901 rm -f $dummy.c $dummy
903 # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
904 # are messed up and put the nodename in both sysname and nodename.
906 echo i386-sequent-sysv4
908 # added by chet for bash based on usenet posting from <hops@sco.com> and
909 # documentation on SCO's web site -- UnixWare 7 (SVR5)
910 # i?86:UnixWare:5*:*)
911 # echo ${UNAME_MACHINE}-pc-sysv5uw${UNAME_VERSION}
913 i?86:UNIX_SV:4.2MP:2.*)
914 # Unixware is an offshoot of SVR4, but it has its own version
915 # number series starting with 2...
916 # I am not positive that other SVR4 systems won't match this,
917 # I just have to hope. -- rms.
918 # Use sysv4.2uw... so that sysv4* matches it.
919 echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
921 i?86:*:4.*:* | i?86:SYSTEM_V:4.*:* | i?86:UNIX_SV:4.*:*)
922 if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
923 echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
925 echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
929 UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
930 (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
931 (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) && UNAME_MACHINE=i586
932 (/bin/uname -X|egrep '^Machine.*Pent.*II' >/dev/null) && UNAME_MACHINE=i686
933 (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) && UNAME_MACHINE=i585
934 echo ${UNAME_MACHINE}-${UNAME_SYSTEM}${UNAME_VERSION}-sysv${UNAME_RELEASE}
937 if test -f /usr/options/cb.name; then
938 UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
939 echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
940 elif /bin/uname -X 2>/dev/null >/dev/null ; then
941 UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
942 (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
943 (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
944 && UNAME_MACHINE=i586
945 (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
946 && UNAME_MACHINE=i686
947 (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
948 && UNAME_MACHINE=i686
949 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
951 echo ${UNAME_MACHINE}-pc-sysv32
955 # uname -m prints for DJGPP always 'pc', but it prints nothing about
956 # the processor, so we play safe by assuming i386.
957 echo i386-pc-msdosdjgpp
965 i860:*:4.*:*) # i860-SVR4
966 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
967 echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
968 else # Add other i860-SVR4 vendors below as they are discovered.
969 echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
974 echo m68010-convergent-sysv
977 test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
978 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
980 test -r /etc/.relid \
981 && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
982 /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
983 && echo i486-ncr-sysv4.3${OS_REL} && exit 0
984 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
985 && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
986 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
987 /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
988 && echo i486-ncr-sysv4 && exit 0 ;;
989 mc68030:UNIX_System_V:4.*:*)
990 echo m68k-atari-sysv4
993 echo m68k-unknown-lynxos${UNAME_RELEASE}
995 i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*)
996 echo i386-pc-lynxos${UNAME_RELEASE}
998 TSUNAMI:LynxOS:2.*:*)
999 echo sparc-unknown-lynxos${UNAME_RELEASE}
1001 rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
1002 echo rs6000-unknown-lynxos${UNAME_RELEASE}
1005 echo ${UNAME_MACHINE}-unknown-lynxos${UNAME_RELEASE}
1007 SM[BE]S:UNIX_SV:*:*)
1008 echo mips-dde-sysv${UNAME_RELEASE}
1010 RM*:SINIX-*:*:* | RM*:ReliantUNIX-*:*:*)
1014 if uname -p 2>/dev/null >/dev/null ; then
1015 UNAME_MACHINE=`(uname -p) 2>/dev/null`
1016 echo ${UNAME_MACHINE}-sni-sysv4
1021 PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1022 # says <Richard.M.Bartel@ccMail.Census.GOV>
1023 echo i586-unisys-sysv4
1025 *:UNIX_System_V:4*:FTX*)
1026 # From Gerald Hewes <hewes@openmarket.com>.
1027 # How about differentiating between stratus architectures? -djm
1028 echo hppa1.1-stratus-sysv4
1031 # From seanf@swdc.stratus.com.
1032 echo i860-stratus-sysv4
1035 echo m68k-apple-aux${UNAME_RELEASE}
1038 echo mips-sony-newsos6
1040 R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1041 if [ -d /usr/nec ]; then
1042 echo mips-nec-sysv${UNAME_RELEASE}
1044 echo mips-unknown-sysv${UNAME_RELEASE}
1047 BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
1048 echo powerpc-apple-beos
1051 echo powerpc-apple-beos
1057 echo sx4-nec-superux${UNAME_RELEASE}
1060 echo sx5-nec-superux${UNAME_RELEASE}
1062 Power*:Rhapsody:*:*)
1063 echo powerpc-apple-rhapsody${UNAME_RELEASE}
1066 echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
1069 echo powerpc-apple-darwin${UNAME_RELEASE}
1072 echo ${UNAME_MACHINE}-apple-darwin${UNAME_RELEASE}
1076 #echo '(No uname command or uname output not recognized.)' 1>&2
1077 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
1081 # include <sys/types.h>
1082 # include <sys/utsname.h>
1087 #if defined (MIPSEB)
1088 /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
1090 printf ("mips-sony-bsd\n"); exit (0);
1092 #include <sys/param.h>
1093 printf ("m68k-sony-newsos%s\n",
1103 #if defined (__arm) && defined (__acorn) && defined (__unix)
1104 printf ("arm-acorn-riscix\n"); exit (0);
1107 #if defined (hp9000) && !defined (hpux)
1108 printf ("m68k-hp-bsd\n"); exit (0);
1111 #if defined (hp300) && !defined (hpux)
1112 printf ("m68k-hp-bsd\n"); exit (0);
1116 #if !defined (__ARCHITECTURE__)
1117 #define __ARCHITECTURE__ "m68k"
1120 version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1122 printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1124 printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1128 #if defined (MULTIMAX) || defined (n16)
1130 printf ("ns32k-encore-sysv\n"); exit (0);
1133 printf ("ns32k-encore-mach\n"); exit (0);
1135 printf ("ns32k-encore-bsd\n"); exit (0);
1140 #if defined (__386BSD__)
1141 printf ("i386-pc-bsd\n"); exit (0);
1144 #if defined (sequent)
1146 printf ("i386-sequent-dynix\n"); exit (0);
1148 #if defined (ns32000)
1149 printf ("ns32k-sequent-dynix\n"); exit (0);
1153 #if defined (_SEQUENT_)
1158 if (strncmp(un.version, "V2", 2) == 0) {
1159 printf ("i386-sequent-ptx2\n"); exit (0);
1161 if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1162 printf ("i386-sequent-ptx1\n"); exit (0);
1164 printf ("i386-sequent-ptx\n"); exit (0);
1169 #if !defined (ultrix)
1170 printf ("vax-dec-bsd\n"); exit (0);
1172 printf ("vax-dec-ultrix\n"); exit (0);
1176 #if defined (alliant) && defined (i860)
1177 printf ("i860-alliant-bsd\n"); exit (0);
1180 /* Begin cases added for Bash */
1182 printf ("tahoe-cci-bsd\n"); exit (0);
1185 #if defined (nec_ews)
1186 # if defined (SYSTYPE_SYSV)
1187 printf ("ews4800-nec-sysv4\n"); exit 0;
1189 printf ("ews4800-nec-bsd\n"); exit (0);
1194 # if defined (SYSTYPE_SYSV)
1195 printf ("mips-sony-sysv4\n"); exit 0;
1197 printf ("mips-sony-bsd\n"); exit (0);
1201 #if defined (ardent)
1202 printf ("titan-ardent-bsd\n"); exit (0);
1205 #if defined (stardent)
1206 printf ("stardent-stardent-sysv\n"); exit (0);
1209 #if defined (ibm032)
1210 printf ("ibmrt-ibm-bsd4.3\n"); exit (0);
1213 #if defined (sequent) && defined (i386)
1214 printf ("i386-sequent-bsd\n"); exit (0);
1217 #if defined (qnx) && defined (i386)
1218 printf ("i386-pc-qnx\n"); exit (0);
1222 printf ("gould-gould-bsd\n"); exit (0);
1225 #if defined (unixpc)
1226 printf ("unixpc-att-sysv\n"); exit (0);
1229 #if defined (att386)
1230 printf ("i386-att-sysv3\n"); exit (0);
1233 #if defined (__m88k) && defined (__UMAXV__)
1234 printf ("m88k-encore-sysv3\n"); exit (0);
1237 #if defined (drs6000)
1238 printf ("drs6000-icl-sysv4.2\n"); exit (0);
1241 #if defined (clipper)
1242 printf ("clipper-orion-bsd\n"); exit (0);
1246 printf ("m68k-isi-bsd\n"); exit (0);
1249 #if defined (luna88k)
1250 printf ("luna88k-omron-bsd\n"); exit (0);
1253 #if defined (butterfly) && defined (BFLY1)
1254 printf ("butterfly-bbn-mach\n"); exit (0);
1257 #if defined (tower32)
1258 printf ("tower32-ncr-sysv4\n"); exit (0);
1261 #if defined (MagicStation)
1262 printf ("magicstation-unknown-bsd\n"); exit (0);
1266 printf ("symmetric-scs-bsd4.2\n"); exit (0);
1269 #if defined (tandem)
1270 printf ("tandem-tandem-sysv\n"); exit (0);
1273 #if defined (cadmus)
1274 printf ("cadmus-pcs-sysv\n"); exit (0);
1277 #if defined (masscomp)
1278 printf ("masscomp-masscomp-sysv3\n"); exit (0);
1281 #if defined (hbullx20)
1282 printf ("hbullx20-bull-sysv3\n"); exit (0);
1285 /* End cases added for Bash */
1291 ${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0
1292 rm -f $dummy.c $dummy
1294 # Apollos put the system type in the environment.
1296 test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
1298 # Convex versions that predate uname can use getsysinfo(1)
1300 if [ -x /usr/convex/getsysinfo ]
1302 case `getsysinfo -f cpu_type` in
1307 if getsysinfo -f scalar_acc
1308 then echo c32-convex-bsd
1309 else echo c2-convex-bsd
1324 # Begin cases added for Bash
1326 uts) echo uts-amdahl-sysv${UNAME_RELEASE}; exit 0 ;;
1329 if [ -d /usr/amiga ]; then
1330 echo m68k-cbm-sysv${UNAME_RELEASE}; exit 0;
1333 if [ -f /bin/fxc.info ]; then
1334 echo fxc-alliant-concentrix
1337 # end cases added for Bash
1339 #echo '(Unable to guess system type)' 1>&2