2 # Attempt to guess a canonical system name.
4 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
5 # Free Software Foundation, Inc.
7 # This file is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 # As a special exception to the GNU General Public License, if you
22 # distribute this file as part of a program that contains a
23 # configuration script generated by Autoconf, you may include it under
24 # the same distribution terms that you use for the rest of that program.
26 # Written by Per Bothner <bothner@cygnus.com>.
27 # Please send patches to <config-patches@gnu.org>.
29 # This script attempts to guess a canonical system name similar to
30 # config.sub. If it succeeds, it prints the system name on stdout, and
31 # exits with 0. Otherwise, it exits with 1.
33 # The plan is that this can be called by configure scripts if you
34 # don't specify an explicit system type (host/target name).
36 # Only a few systems have been added to this list; please add others
37 # (but try to keep the structure clean).
41 # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
42 # (ghazi@noc.rutgers.edu 8/24/94.)
43 if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
44 PATH=$PATH:/.attbin ; export PATH
47 UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
48 UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
49 UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
50 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
53 trap 'rm -f $dummy.c $dummy.o $dummy ${dummy}1.s ${dummy}2.c ; exit 1' 1 2 15
55 # Use $HOST_CC if defined. $CC may point to a cross-compiler
56 if test x"$CC_FOR_BUILD" = x; then
57 if test x"$HOST_CC" != x; then
58 CC_FOR_BUILD="$HOST_CC"
60 if test x"$CC" != x; then
63 echo 'dummy(){}' >$dummy.c
64 for c in cc c89 gcc; do
65 ($c $dummy.c -c) >/dev/null 2>&1
67 CC_FOR_BUILD="$c"; break
70 rm -f $dummy.c $dummy.o
71 if test x"$CC_FOR_BUILD" = x; then
72 CC_FOR_BUILD=no_compiler_found
79 # First make a best effort at recognizing x86 CPU type and leave it in X86CPU.
80 # If we fail, set X86CPU to UNAME_MACHINE
82 # DJGPP v2 (or 2.03 at least) always gives "pc" for uname -m, and the
83 # OEM for uname -s. Eg. pc:MS-DOS:6:2 on MS-DOS 6.21. The list of
84 # possible OEMs is in src/libc/dos/dos/getdos_v.c of djlsr203.zip, but
85 # just pc:*:*:* seems ok.
87 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
88 i?86:*:*:* | i86pc:*:*:* | pc:*:*:*)
89 case "${UNAME_MACHINE}" in
90 i86pc | pc) UNAME_MACHINE=i386 ;;
92 cat <<EOF >${dummy}1.s
110 cat <<EOF >${dummy}2.c
113 char vendor_string[13];
114 char dummy_string[12];
119 cpuid (vendor_string, 0);
120 vendor_string[12] = 0;
122 fms = cpuid (dummy_string, 1);
124 family = (fms >> 8) & 15;
125 model = (fms >> 4) & 15;
128 if (strcmp (vendor_string, "GenuineIntel") == 0)
134 modelstr = "pentium";
136 modelstr = "pentiummmx";
140 modelstr = "pentiumpro";
142 modelstr = "pentium2";
144 modelstr = "pentium3";
148 else if (strcmp (vendor_string, "AuthenticAMD") == 0)
167 else if (strcmp (vendor_string, "CyrixInstead") == 0)
169 /* Should recognize Cyrix' processors too. */
172 printf ("%s\n", modelstr);
176 $CC_FOR_BUILD ${dummy}1.s ${dummy}2.c -o $dummy >/dev/null 2>&1
177 if test "$?" = 0 ; then
182 # Default to believing uname -m if the program fails to compile or
183 # run. Will fail to run on 386 since cpuid was only added on 486.
186 X86CPU="$UNAME_MACHINE"
188 rm -f ${dummy}1.s ${dummy}2.c $dummy
192 # Note: order is significant - the case branches are not exclusive.
194 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
196 if test $UNAME_RELEASE = "V4.0"; then
197 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
199 # A Vn.n version is a released version.
200 # A Tn.n version is a released field test version.
201 # A Xn.n version is an unreleased experimental baselevel.
202 # 1.2 uses "1.2" for uname -r.
206 .byte 37,100,45,37,120,10,0 # "%d-%x\n"
213 .frame \$30,16,\$26,0
216 .long 0x47e03d80 # implver \$0
218 .long 0x47e20c21 # amask \$2,\$1
228 $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
229 if test "$?" = 0 ; then
232 UNAME_MACHINE="alpha"
235 UNAME_MACHINE="alphaev5"
238 UNAME_MACHINE="alphaev56"
241 UNAME_MACHINE="alphapca56"
244 UNAME_MACHINE="alphaev6"
247 UNAME_MACHINE="alphaev67"
251 rm -f $dummy.s $dummy
252 echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
254 alpha:NetBSD:*:* | alpha:FreeBSD:*:*)
261 .long 0x47e03d80 # implver $0
263 .long 0x47e20c21 # amask $2,$1
272 $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
273 if test "$?" = 0 ; then
277 UNAME_MACHINE="alpha"
280 UNAME_MACHINE="alphaev5"
283 UNAME_MACHINE="alphaev56"
286 UNAME_MACHINE="alphapca56"
289 UNAME_MACHINE="alphaev6"
293 rm -f $dummy.s $dummy
294 echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM}${UNAME_RELEASE} | sed -e 's/^[VTX]//' -e 's/[-(].*//' | tr [[A-Z]] [[a-z]]`
296 Alpha\ *:Windows_NT*:*)
297 # How do we know it's Interix rather than the generic POSIX subsystem?
298 # Should we change UNAME_MACHINE based on the output of uname instead
299 # of the specific Alpha model?
300 echo alpha-pc-interix
302 21064:Windows_NT:50:3)
303 echo alpha-dec-winnt3.5
305 Amiga*:UNIX_System_V:4.0:*)
309 echo m68k-cbm-netbsd${UNAME_RELEASE}
312 echo m68k-unknown-openbsd${UNAME_RELEASE}
314 *:[Aa]miga[Oo][Ss]:*:*)
315 echo ${UNAME_MACHINE}-unknown-amigaos
318 echo mips64el-unknown-openbsd${UNAME_RELEASE}
321 echo mipsel-unknown-openbsd${UNAME_RELEASE}
324 echo mips-unknown-openbsd${UNAME_RELEASE}
327 echo mipsel-unknown-openbsd${UNAME_RELEASE}
330 echo mips-unknown-openbsd${UNAME_RELEASE}
333 echo mipsel-unknown-openbsd${UNAME_RELEASE}
336 echo i370-ibm-openedition
338 arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
339 echo arm-acorn-riscix${UNAME_RELEASE}
342 echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
344 SR2?01:HI-UX/MPP:*:*)
345 echo hppa1.1-hitachi-hiuxmpp
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
352 echo pyramid-pyramid-bsd
356 echo pyramid-pyramid-svr4
359 echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
361 sun4[md]:SunOS:5.*:*)
362 echo sparcv8-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
365 echo sparcv9-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
367 sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
368 echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
371 echo ${X86CPU}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
374 case "`/usr/bin/arch -k`" in
376 UNAME_RELEASE=`uname -v`
379 # Japanese Language versions have a version number like `4.1.3-JL'.
380 echo sparcv8-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
383 case "`/usr/bin/arch -k`" in
385 UNAME_RELEASE=`uname -v`
388 # Japanese Language versions have a version number like `4.1.3-JL'.
389 echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
392 echo m68k-sun-sunos${UNAME_RELEASE}
395 UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
396 test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
397 case "`/bin/arch`" in
399 echo m68k-sun-sunos${UNAME_RELEASE}
402 echo sparc-sun-sunos${UNAME_RELEASE}
407 echo sparc-auspex-sunos${UNAME_RELEASE}
410 echo m68k-atari-netbsd${UNAME_RELEASE}
413 echo m68k-unknown-openbsd${UNAME_RELEASE}
415 # The situation for MiNT is a little confusing. The machine name
416 # can be virtually everything (everything which is not
417 # "atarist" or "atariste" at least should have a processor
418 # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
419 # to the lowercase version "mint" (or "freemint"). Finally
420 # the system name "TOS" denotes a system which is actually not
421 # MiNT. But MiNT is downward compatible to TOS, so this should
423 atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
424 echo m68k-atari-mint${UNAME_RELEASE}
426 atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
427 echo m68k-atari-mint${UNAME_RELEASE}
429 *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
430 echo m68k-atari-mint${UNAME_RELEASE}
432 milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
433 echo m68k-milan-mint${UNAME_RELEASE}
435 hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
436 echo m68k-hades-mint${UNAME_RELEASE}
438 *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
439 echo m68k-unknown-mint${UNAME_RELEASE}
442 echo m68k-sun-netbsd${UNAME_RELEASE}
445 echo m68k-unknown-openbsd${UNAME_RELEASE}
448 echo m68k-apple-netbsd${UNAME_RELEASE}
451 echo m68k-unknown-openbsd${UNAME_RELEASE}
454 echo powerpc-apple-netbsd${UNAME_RELEASE}
457 echo m68k-unknown-openbsd${UNAME_RELEASE}
460 echo m88k-unknown-openbsd${UNAME_RELEASE}
463 echo powerpc-apple-machten${UNAME_RELEASE}
466 echo mips-dec-mach_bsd4.3
469 echo mips-dec-ultrix${UNAME_RELEASE}
472 echo vax-dec-ultrix${UNAME_RELEASE}
474 2020:CLIX:*:* | 2430:CLIX:*:*)
475 echo clipper-intergraph-clix${UNAME_RELEASE}
477 mips:*:*:UMIPS | mips:*:*:RISCos)
478 sed 's/^ //' << EOF >$dummy.c
480 #include <stdio.h> /* for printf() prototype */
481 int main (int argc, char *argv[]) {
483 int main (argc, argv) int argc; char *argv[]; {
485 #if defined (host_mips) && defined (MIPSEB)
486 #if defined (SYSTYPE_SYSV)
487 printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
489 #if defined (SYSTYPE_SVR4)
490 printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
492 #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
493 printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
499 $CC_FOR_BUILD $dummy.c -o $dummy \
500 && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
501 && rm $dummy.c $dummy && exit 0
502 rm -f $dummy.c $dummy
503 echo mips-mips-riscos${UNAME_RELEASE}
505 Night_Hawk:Power_UNIX:*:*)
506 echo powerpc-harris-powerunix
509 echo m88k-harris-cxux7
512 echo m88k-motorola-sysv4
515 echo m88k-motorola-sysv3
518 # DG/UX returns AViiON for all architectures
519 UNAME_PROCESSOR=`/usr/bin/uname -p`
520 if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
522 if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
523 [ ${TARGET_BINARY_INTERFACE}x = x ]
525 echo m88k-dg-dgux${UNAME_RELEASE}
527 echo m88k-dg-dguxbcs${UNAME_RELEASE}
530 echo i586-dg-dgux${UNAME_RELEASE}
533 M88*:DolphinOS:*:*) # DolphinOS (SVR3)
534 echo m88k-dolphin-sysv3
537 # Delta 88k system running SVR3
538 echo m88k-motorola-sysv3
540 XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
541 echo m88k-tektronix-sysv3
543 Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
544 echo m68k-tektronix-bsd
547 echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
549 ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
550 echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
551 exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
556 if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
557 sed 's/^ //' << EOF >$dummy.c
558 #include <sys/systemcfg.h>
564 puts("powerpc-ibm-aix3.2.5");
568 $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
569 rm -f $dummy.c $dummy
570 echo rs6000-ibm-aix3.2.5
571 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
572 echo rs6000-ibm-aix3.2.4
574 echo rs6000-ibm-aix3.2
578 sed 's/^ //' << EOF >$dummy.c
580 #include <sys/systemcfg.h>
583 if (_system_configuration.architecture == POWER_RS
584 || _system_configuration.implementation == POWER_601)
588 if (_system_configuration.width == 64)
596 $CC_FOR_BUILD $dummy.c -o $dummy
598 rm -f $dummy.c $dummy
599 if [ -x /usr/bin/oslevel ] ; then
600 IBM_REV=`/usr/bin/oslevel`
602 IBM_REV=4.${UNAME_RELEASE}
604 echo ${IBM_ARCH}-ibm-aix${IBM_REV}
609 ibmrt:4.4BSD:*|romp-ibm:BSD:*)
612 ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
613 echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
614 exit 0 ;; # report: romp-ibm BSD 4.3
616 echo rs6000-bull-bosx
621 9000/[34]??:4.3bsd:1.*:*)
624 hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
627 9000/[34678]??:HP-UX:*:*)
628 case "${UNAME_MACHINE}" in
629 9000/31? ) HP_ARCH=m68000 ;;
630 9000/[34]?? ) HP_ARCH=m68k ;;
631 9000/[678][0-9][0-9])
632 sed 's/^ //' << EOF >$dummy.c
640 #if defined(_SC_KERNEL_BITS)
641 long bits = sysconf(_SC_KERNEL_BITS);
643 long cpu = sysconf (_SC_CPU_VERSION);
647 case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
648 case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
650 #if defined(_SC_KERNEL_BITS)
653 case 64: puts ("hppa2.0w"); break;
654 case 32: puts ("hppa2.0n"); break;
655 default: puts ("hppa2.0"); break;
657 #else /* !defined(_SC_KERNEL_BITS) */
658 puts ("hppa2.0"); break;
660 default: puts ("hppa1.0"); break;
665 (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
666 rm -f $dummy.c $dummy
668 HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
669 echo ${HP_ARCH}-hp-hpux${HPUX_REV}
672 sed 's/^ //' << EOF >$dummy.c
677 long cpu = sysconf (_SC_CPU_VERSION);
678 /* The order matters, because CPU_IS_HP_MC68K erroneously returns
679 true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
681 if (CPU_IS_PA_RISC (cpu))
685 case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
686 case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
687 case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
688 default: puts ("hppa-hitachi-hiuxwe2"); break;
691 else if (CPU_IS_HP_MC68K (cpu))
692 puts ("m68k-hitachi-hiuxwe2");
693 else puts ("unknown-hitachi-hiuxwe2");
697 $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
698 rm -f $dummy.c $dummy
699 echo unknown-hitachi-hiuxwe2
701 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
708 echo hppa1.0-hp-mpeix
710 hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
717 if [ -x /usr/sbin/sysversion ] ; then
718 echo ${UNAME_MACHINE}-unknown-osf1mk
720 echo ${UNAME_MACHINE}-unknown-osf1
724 echo hppa1.1-hp-lites
727 echo hppa-unknown-openbsd
729 C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
732 C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
733 if getsysinfo -f scalar_acc
734 then echo c32-convex-bsd
735 else echo c2-convex-bsd
738 C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
741 C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
744 C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
751 echo ymp-cray-unicos${UNAME_RELEASE}
754 echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
755 | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
756 -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
759 echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
762 echo alpha-cray-unicos
765 echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
768 echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
771 echo cray2-cray-unicos
773 F300:UNIX_System_V:*:*)
774 FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
775 FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
776 echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
778 F301:UNIX_System_V:*:*)
779 echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
781 hp3[0-9][05]:NetBSD:*:*)
782 echo m68k-hp-netbsd${UNAME_RELEASE}
785 echo m68k-unknown-openbsd${UNAME_RELEASE}
787 i?86:BSD/386:*:* | i?86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
788 echo ${X86CPU}-pc-bsdi${UNAME_RELEASE}
791 echo sparc-unknown-bsdi${UNAME_RELEASE}
794 echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
797 echo ${X86CPU}-pc-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
800 echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
803 echo ${X86CPU}-pc-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
806 echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
809 echo ${X86CPU}-pc-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
812 echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
815 echo ${X86CPU}-pc-cygwin
818 echo ${UNAME_MACHINE}-pc-mingw32
820 i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
821 # How do we know it's Interix rather than the generic POSIX subsystem?
822 # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
823 # UNAME_MACHINE based on the output of uname instead of i386?
827 echo ${UNAME_MACHINE}-pc-uwin
830 echo powerpcle-unknown-cygwin
833 echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
836 echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
840 # The BFD linker knows what the default object file format is, so
841 # first see if it will tell us. cd to the root directory to prevent
842 # problems with other programs or directories called `ld' in the path.
843 ld_help_string=`cd /; ld --help 2>&1`
844 ld_supported_emulations=`echo $ld_help_string \
845 | sed -ne '/supported emulations:/!d
847 s/.*supported emulations: *//
850 case "$ld_supported_emulations" in
852 echo "${UNAME_MACHINE}-unknown-linux"
856 echo "${X86CPU}-pc-linux-gnuaout"
860 echo "${X86CPU}-pc-linux-gnucoff"
864 echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
868 echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
872 echo "${UNAME_MACHINE}-unknown-linux-gnuoldld"
876 echo "${UNAME_MACHINE}-unknown-linux-gnu"
880 echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
883 elf32ppc | elf32ppclinux)
884 # Determine Lib Version
886 #include <features.h>
887 #if defined(__GLIBC__)
888 extern char __libc_version[];
889 extern char __libc_release[];
895 #if defined(__GLIBC__)
896 printf("%s %s\n", __libc_version, __libc_release);
904 $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
905 if test "$?" = 0 ; then
906 ./$dummy | grep 1\.99 > /dev/null
907 if test "$?" = 0 ; then
911 rm -f $dummy.c $dummy
912 echo powerpc-unknown-linux-gnu${LIBC}
917 if test "${UNAME_MACHINE}" = "alpha" ; then
921 .byte 37,100,45,37,120,10,0 # "%d-%x\n"
928 .frame \$30,16,\$26,0
931 .long 0x47e03d80 # implver \$0
933 .long 0x47e20c21 # amask \$2,\$1
944 $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
945 if test "$?" = 0 ; then
948 UNAME_MACHINE="alpha"
951 UNAME_MACHINE="alphaev5"
954 UNAME_MACHINE="alphaev56"
957 UNAME_MACHINE="alphapca56"
960 UNAME_MACHINE="alphaev6"
963 UNAME_MACHINE="alphaev67"
967 objdump --private-headers $dummy | \
968 grep ld.so.1 > /dev/null
969 if test "$?" = 0 ; then
973 rm -f $dummy.s $dummy
974 echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
975 elif test "${UNAME_MACHINE}" = "mips" ; then
978 #include <stdio.h> /* for printf() prototype */
979 int main (int argc, char *argv[]) {
981 int main (argc, argv) int argc; char *argv[]; {
984 printf ("%s-unknown-linux-gnu\n", argv[1]);
987 printf ("%sel-unknown-linux-gnu\n", argv[1]);
992 $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
993 rm -f $dummy.c $dummy
994 elif test "${UNAME_MACHINE}" = "s390"; then
995 echo s390-ibm-linux && exit 0
997 # Either a pre-BFD a.out linker (linux-gnuoldld)
998 # or one that does not give us useful --help.
999 # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
1000 # If ld does not provide *any* "supported emulations:"
1001 # that means it is gnuoldld.
1002 echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
1003 test $? != 0 && echo "${X86CPU}-pc-linux-gnuoldld" && exit 0
1005 case "${UNAME_MACHINE}" in
1008 UNAME_MACHINE=${X86CPU}
1014 # Determine whether the default compiler is a.out or elf
1016 #include <features.h>
1018 #include <stdio.h> /* for printf() prototype */
1019 int main (int argc, char *argv[]) {
1021 int main (argc, argv) int argc; char *argv[]; {
1026 printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
1028 printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
1031 printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
1034 printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
1039 $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
1040 rm -f $dummy.c $dummy
1042 # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
1043 # are messed up and put the nodename in both sysname and nodename.
1044 i?86:DYNIX/ptx:4*:*)
1045 echo i386-sequent-sysv4
1047 i?86:UNIX_SV:4.2MP:2.*)
1048 # Unixware is an offshoot of SVR4, but it has its own version
1049 # number series starting with 2...
1050 # I am not positive that other SVR4 systems won't match this,
1051 # I just have to hope. -- rms.
1052 # Use sysv4.2uw... so that sysv4* matches it.
1053 echo ${X86CPU}-pc-sysv4.2uw${UNAME_VERSION}
1055 i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
1056 UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
1057 if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1058 echo ${X86CPU}-univel-sysv${UNAME_REL}
1060 echo ${X86CPU}-pc-sysv${UNAME_REL}
1064 # Fixed at (any) Pentium or better
1066 if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then
1067 echo ${X86CPU}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION}
1069 echo ${X86CPU}-pc-sysv${UNAME_RELEASE}
1073 if test -f /usr/options/cb.name; then
1074 UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1075 echo ${X86CPU}-pc-isc$UNAME_REL
1076 elif /bin/uname -X 2>/dev/null >/dev/null ; then
1077 UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
1078 (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
1079 (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
1080 && UNAME_MACHINE=i586
1081 (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
1082 && UNAME_MACHINE=i686
1083 (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
1084 && UNAME_MACHINE=i686
1085 echo ${X86CPU}-pc-sco$UNAME_REL
1087 echo ${X86CPU}-pc-sysv32
1091 echo ${X86CPU}-pc-msdosdjgpp
1094 # Left here for compatibility:
1095 # uname -m prints for DJGPP always 'pc', but it prints nothing about
1096 # the processor, so we play safe by assuming i386.
1097 echo i386-pc-msdosdjgpp
1103 echo i860-intel-osf1
1105 i860:*:4.*:*) # i860-SVR4
1106 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1107 echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
1108 else # Add other i860-SVR4 vendors below as they are discovered.
1109 echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
1114 echo m68010-convergent-sysv
1117 test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
1118 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
1120 test -r /etc/.relid \
1121 && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1122 /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1123 && echo i486-ncr-sysv4.3${OS_REL} && exit 0
1124 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1125 && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
1126 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1127 /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1128 && echo i486-ncr-sysv4 && exit 0 ;;
1130 echo m68k-unknown-lynxos${UNAME_RELEASE}
1132 mc68030:UNIX_System_V:4.*:*)
1133 echo m68k-atari-sysv4
1135 i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*)
1136 echo i386-unknown-lynxos${UNAME_RELEASE}
1138 TSUNAMI:LynxOS:2.*:*)
1139 echo sparc-unknown-lynxos${UNAME_RELEASE}
1141 rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
1142 echo rs6000-unknown-lynxos${UNAME_RELEASE}
1144 SM[BE]S:UNIX_SV:*:*)
1145 echo mips-dde-sysv${UNAME_RELEASE}
1147 RM*:ReliantUNIX-*:*:*)
1154 if uname -p 2>/dev/null >/dev/null ; then
1155 UNAME_MACHINE=`(uname -p) 2>/dev/null`
1156 echo ${UNAME_MACHINE}-sni-sysv4
1161 PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1162 # says <Richard.M.Bartel@ccMail.Census.GOV>
1163 echo i586-unisys-sysv4
1165 *:UNIX_System_V:4*:FTX*)
1166 # From Gerald Hewes <hewes@openmarket.com>.
1167 # How about differentiating between stratus architectures? -djm
1168 echo hppa1.1-stratus-sysv4
1171 # From seanf@swdc.stratus.com.
1172 echo i860-stratus-sysv4
1175 echo m68k-apple-aux${UNAME_RELEASE}
1178 echo mips-sony-newsos6
1180 R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1181 if [ -d /usr/nec ]; then
1182 echo mips-nec-sysv${UNAME_RELEASE}
1184 echo mips-unknown-sysv${UNAME_RELEASE}
1187 BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
1188 echo powerpc-be-beos
1190 BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
1191 echo powerpc-apple-beos
1193 BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
1197 echo sx4-nec-superux${UNAME_RELEASE}
1200 echo sx5-nec-superux${UNAME_RELEASE}
1202 Power*:Rhapsody:*:*)
1203 echo powerpc-apple-rhapsody${UNAME_RELEASE}
1206 echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
1209 echo powerpc-apple-macos${UNAME_RELEASE}
1212 echo ${UNAME_MACHINE}-apple-macos${UNAME_RELEASE}
1215 echo `uname -p`-apple-darwin${UNAME_RELEASE}
1217 *:procnto*:*:* | *:QNX:[0123456789]*:*)
1218 if test "${UNAME_MACHINE}" = "x86pc"; then
1221 echo `uname -p`-${UNAME_MACHINE}-nto-qnx
1226 NSR-W:NONSTOP_KERNEL:*:*)
1227 echo nsr-tandem-nsk${UNAME_RELEASE}
1230 echo bs2000-siemens-sysv
1234 #echo '(No uname command or uname output not recognized.)' 1>&2
1235 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
1239 # include <sys/types.h>
1240 # include <sys/utsname.h>
1245 #if defined (MIPSEB)
1246 /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
1248 printf ("mips-sony-bsd\n"); exit (0);
1250 #include <sys/param.h>
1251 printf ("m68k-sony-newsos%s\n",
1261 #if defined (__arm) && defined (__acorn) && defined (__unix)
1262 printf ("arm-acorn-riscix"); exit (0);
1265 #if defined (hp300) && !defined (hpux)
1266 printf ("m68k-hp-bsd\n"); exit (0);
1270 #if !defined (__ARCHITECTURE__)
1271 #define __ARCHITECTURE__ "m68k"
1274 version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1276 printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1278 printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1282 #if defined (MULTIMAX) || defined (n16)
1284 printf ("ns32k-encore-sysv\n"); exit (0);
1287 printf ("ns32k-encore-mach\n"); exit (0);
1289 printf ("ns32k-encore-bsd\n"); exit (0);
1294 #if defined (__386BSD__)
1295 printf ("i386-pc-bsd\n"); exit (0);
1298 #if defined (sequent)
1300 printf ("i386-sequent-dynix\n"); exit (0);
1302 #if defined (ns32000)
1303 printf ("ns32k-sequent-dynix\n"); exit (0);
1307 #if defined (_SEQUENT_)
1312 if (strncmp(un.version, "V2", 2) == 0) {
1313 printf ("i386-sequent-ptx2\n"); exit (0);
1315 if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1316 printf ("i386-sequent-ptx1\n"); exit (0);
1318 printf ("i386-sequent-ptx\n"); exit (0);
1323 #if !defined (ultrix)
1324 printf ("vax-dec-bsd\n"); exit (0);
1326 printf ("vax-dec-ultrix\n"); exit (0);
1330 #if defined (alliant) && defined (i860)
1331 printf ("i860-alliant-bsd\n"); exit (0);
1338 $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0
1339 rm -f $dummy.c $dummy
1341 # Apollos put the system type in the environment.
1343 test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
1345 # Convex versions that predate uname can use getsysinfo(1)
1347 if [ -x /usr/convex/getsysinfo ]
1349 case `getsysinfo -f cpu_type` in
1354 if getsysinfo -f scalar_acc
1355 then echo c32-convex-bsd
1356 else echo c2-convex-bsd
1371 #echo '(Unable to guess system type)' 1>&2