2
2
# Attempt to guess a canonical system name.
3
3
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
4
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
5
5
# Free Software Foundation, Inc.
9
9
# This file is free software; you can redistribute it and/or modify it
10
10
# under the terms of the GNU General Public License as published by
27
27
# the same distribution terms that you use for the rest of that program.
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.
30
# Originally written by Per Bothner. Please send patches (context
31
# diff format) to <config-patches@gnu.org> and include a ChangeLog
34
34
# This script attempts to guess a canonical system name similar to
35
35
# config.sub. If it succeeds, it prints the system name on stdout, and
36
36
# exits with 0. Otherwise, it exits with 1.
38
# The plan is that this can be called by configure scripts if you
39
# don't specify an explicit build system type.
38
# You can get the latest version of this script from:
39
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
41
41
me=`echo "$0" | sed -e 's,.*/,,'`
324
334
case `/usr/bin/uname -p` in
325
335
sparc) echo sparc-icl-nx7; exit ;;
338
echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
327
340
sun4H:SunOS:5.*:*)
328
341
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
330
343
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
331
344
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
346
i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
347
echo i386-pc-auroraux${UNAME_RELEASE}
333
349
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
334
echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
350
eval $set_cc_for_build
352
# If there is a compiler, see if it is configured for 64-bit objects.
353
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
354
# This test works for both compilers.
355
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
356
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
357
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
358
grep IS_64BIT_ARCH >/dev/null
363
echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
336
365
sun4*:SunOS:6*:*)
337
366
# According to config.sub, this is the proper way to canonicalize
816
848
echo ${UNAME_MACHINE}-pc-uwin
818
850
amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
819
echo x86_64-unknown-cygwin
851
echo x86_64-${VENDOR}-cygwin
822
echo powerpcle-unknown-cygwin
854
echo powerpcle-${VENDOR}-cygwin
824
856
prep*:SunOS:5.*:*)
825
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
857
echo powerpcle-${VENDOR}-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
829
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
861
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-${VENDOR}-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
832
864
# other systems with GNU libc and userland
833
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
865
echo ${UNAME_MACHINE}-${VENDOR}-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
836
868
echo ${UNAME_MACHINE}-pc-minix
871
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
872
EV5) UNAME_MACHINE=alphaev5 ;;
873
EV56) UNAME_MACHINE=alphaev56 ;;
874
PCA56) UNAME_MACHINE=alphapca56 ;;
875
PCA57) UNAME_MACHINE=alphapca56 ;;
876
EV6) UNAME_MACHINE=alphaev6 ;;
877
EV67) UNAME_MACHINE=alphaev67 ;;
878
EV68*) UNAME_MACHINE=alphaev68 ;;
880
objdump --private-headers /bin/sh | grep -q ld.so.1
881
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
882
echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu${LIBC}
839
885
eval $set_cc_for_build
840
886
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
841
887
| grep -q __ARM_EABI__
843
echo ${UNAME_MACHINE}-unknown-linux-gnu
889
echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
845
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
891
echo ${UNAME_MACHINE}-${VENDOR}-linux-gnueabi
848
894
avr32*:Linux:*:*)
849
echo ${UNAME_MACHINE}-unknown-linux-gnu
895
echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
852
898
echo cris-axis-linux-gnu
855
901
echo crisv32-axis-linux-gnu
858
echo frv-unknown-linux-gnu
904
echo frv-${VENDOR}-linux-gnu
908
eval $set_cc_for_build
909
sed 's/^ //' << EOF >$dummy.c
914
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
915
echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}"
861
echo ${UNAME_MACHINE}-unknown-linux-gnu
918
echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
864
echo ${UNAME_MACHINE}-unknown-linux-gnu
921
echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
867
echo ${UNAME_MACHINE}-unknown-linux-gnu
924
echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
870
eval $set_cc_for_build
871
sed 's/^ //' << EOF >$dummy.c
875
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
878
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
885
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
890
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
893
eval $set_cc_for_build
894
sed 's/^ //' << EOF >$dummy.c
898
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
901
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
908
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
913
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
926
mips:Linux:*:* | mips64:Linux:*:*)
927
eval $set_cc_for_build
928
sed 's/^ //' << EOF >$dummy.c
930
#undef ${UNAME_MACHINE}
931
#undef ${UNAME_MACHINE}el
932
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
933
CPU=${UNAME_MACHINE}el
935
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
942
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
943
test x"${CPU}" != x && { echo "${CPU}-${VENDOR}-linux-gnu"; exit; }
916
echo or32-unknown-linux-gnu
919
echo powerpc-unknown-linux-gnu
922
echo powerpc64-unknown-linux-gnu
925
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
926
EV5) UNAME_MACHINE=alphaev5 ;;
927
EV56) UNAME_MACHINE=alphaev56 ;;
928
PCA56) UNAME_MACHINE=alphapca56 ;;
929
PCA57) UNAME_MACHINE=alphapca56 ;;
930
EV6) UNAME_MACHINE=alphaev6 ;;
931
EV67) UNAME_MACHINE=alphaev67 ;;
932
EV68*) UNAME_MACHINE=alphaev68 ;;
934
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
935
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
936
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
946
echo or32-${VENDOR}-linux-gnu
949
echo sparc-${VENDOR}-linux-gnu
951
parisc64:Linux:*:* | hppa64:Linux:*:*)
952
echo hppa64-${VENDOR}-linux-gnu
938
954
parisc:Linux:*:* | hppa:Linux:*:*)
939
955
# Look for CPU level
940
956
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
941
PA7*) echo hppa1.1-unknown-linux-gnu ;;
942
PA8*) echo hppa2.0-unknown-linux-gnu ;;
943
*) echo hppa-unknown-linux-gnu ;;
957
PA7*) echo hppa1.1-${VENDOR}-linux-gnu ;;
958
PA8*) echo hppa2.0-${VENDOR}-linux-gnu ;;
959
*) echo hppa-${VENDOR}-linux-gnu ;;
946
parisc64:Linux:*:* | hppa64:Linux:*:*)
947
echo hppa64-unknown-linux-gnu
963
echo powerpc64-${VENDOR}-linux-gnu
966
echo powerpc-${VENDOR}-linux-gnu
949
968
s390:Linux:*:* | s390x:Linux:*:*)
950
969
echo ${UNAME_MACHINE}-ibm-linux
953
echo ${UNAME_MACHINE}-unknown-linux-gnu
972
echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
956
echo ${UNAME_MACHINE}-unknown-linux-gnu
975
echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
958
977
sparc:Linux:*:* | sparc64:Linux:*:*)
959
echo ${UNAME_MACHINE}-unknown-linux-gnu
978
echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
962
981
echo ${UNAME_MACHINE}-dec-linux-gnu
964
983
x86_64:Linux:*:*)
965
echo x86_64-unknown-linux-gnu
984
echo x86_64-${VENDOR}-linux-gnu
967
986
xtensa*:Linux:*:*)
968
echo ${UNAME_MACHINE}-unknown-linux-gnu
987
echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
971
# The BFD linker knows what the default object file format is, so
972
# first see if it will tell us. cd to the root directory to prevent
973
# problems with other programs or directories called `ld' in the path.
974
# Set LC_ALL=C to ensure ld outputs messages in English.
975
ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
976
| sed -ne '/supported targets:/!d
978
s/.*supported targets: *//
981
case "$ld_supported_targets" in
983
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
986
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
989
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
992
# Either a pre-BFD a.out linker (linux-gnuoldld) or
993
# one that does not give us useful --help.
994
echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
997
# Determine whether the default compiler is a.out or elf
998
eval $set_cc_for_build
999
sed 's/^ //' << EOF >$dummy.c
1000
#include <features.h>
1012
#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
1022
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
1027
test x"${LIBC}" != x && {
1028
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
1031
test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
1033
989
i*86:DYNIX/ptx:4*:*)
1034
990
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1035
991
# earlier versions are messed up and put the nodename in both
1141
1100
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1142
1101
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1143
1102
&& { echo i486-ncr-sysv4; exit; } ;;
1103
NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1105
test -r /etc/.relid \
1106
&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1107
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1108
&& { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1109
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1110
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; }
1111
/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1112
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1144
1113
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1145
echo m68k-unknown-lynxos${UNAME_RELEASE}
1114
echo m68k-${VENDOR}-lynxos${UNAME_RELEASE}
1147
1116
mc68030:UNIX_System_V:4.*:*)
1148
1117
echo m68k-atari-sysv4
1150
1119
TSUNAMI:LynxOS:2.*:*)
1151
echo sparc-unknown-lynxos${UNAME_RELEASE}
1120
echo sparc-${VENDOR}-lynxos${UNAME_RELEASE}
1153
1122
rs6000:LynxOS:2.*:*)
1154
echo rs6000-unknown-lynxos${UNAME_RELEASE}
1123
echo rs6000-${VENDOR}-lynxos${UNAME_RELEASE}
1156
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
1157
echo powerpc-unknown-lynxos${UNAME_RELEASE}
1125
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1126
echo powerpc-${VENDOR}-lynxos${UNAME_RELEASE}
1159
1128
SM[BE]S:UNIX_SV:*:*)
1160
1129
echo mips-dde-sysv${UNAME_RELEASE}