2
2
# Attempt to guess a canonical system name.
3
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
5
# 2011 Free Software Foundation, Inc.
3
# Copyright 1992-2014 Free Software Foundation, Inc.
9
7
# This file is free software; you can redistribute it and/or modify it
10
8
# under the terms of the GNU General Public License as published by
11
# the Free Software Foundation; either version 2 of the License, or
9
# the Free Software Foundation; either version 3 of the License, or
12
10
# (at your option) any later version.
14
12
# This program is distributed in the hope that it will be useful, but
17
15
# General Public License for more details.
19
17
# You should have received a copy of the GNU General Public License
20
# along with this program; if not, write to the Free Software
21
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
18
# along with this program; if not, see <http://www.gnu.org/licenses/>.
24
20
# As a special exception to the GNU General Public License, if you
25
21
# distribute this file as part of a program that contains a
26
22
# configuration script generated by Autoconf, you may include it under
27
# the same distribution terms that you use for the rest of that program.
30
# Originally written by Per Bothner. Please send patches (context
31
# diff format) to <config-patches@gnu.org> and include a ChangeLog
23
# the same distribution terms that you use for the rest of that
24
# program. This Exception is an additional permission under section 7
25
# of the GNU General Public License, version 3 ("GPLv3").
34
# This script attempts to guess a canonical system name similar to
35
# config.sub. If it succeeds, it prints the system name on stdout, and
36
# exits with 0. Otherwise, it exits with 1.
27
# Originally written by Per Bothner.
38
29
# You can get the latest version of this script from:
39
30
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
32
# Please send patches with a ChangeLog entry to config-patches@gnu.org.
41
35
me=`echo "$0" | sed -e 's,.*/,,'`
56
50
GNU config.guess ($timestamp)
58
52
Originally written by Per Bothner.
59
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
60
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free
61
Software Foundation, Inc.
53
Copyright 1992-2014 Free Software Foundation, Inc.
63
55
This is free software; see the source for copying conditions. There is NO
64
56
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
140
132
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
141
133
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
135
case "${UNAME_SYSTEM}" in
137
# If the system lacks a compiler, then just pick glibc.
138
# We could probably try harder.
141
eval $set_cc_for_build
142
cat <<-EOF > $dummy.c
143
#include <features.h>
144
#if defined(__UCLIBC__)
146
#elif defined(__dietlibc__)
152
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
143
156
# Note: order is significant - the case branches are not exclusive.
145
158
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
147
160
# NetBSD (nbsd) targets should (where applicable) match one or
148
# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
161
# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
149
162
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
150
163
# switched to ELF, *-*-netbsd* would select the old
151
164
# object file format. This provides both forward
857
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
877
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
860
880
# other systems with GNU libc and userland
861
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
881
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
864
884
echo ${UNAME_MACHINE}-pc-minix
887
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
889
aarch64_be:Linux:*:*)
890
UNAME_MACHINE=aarch64_be
891
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
867
894
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
868
895
EV5) UNAME_MACHINE=alphaev5 ;;
874
901
EV68*) UNAME_MACHINE=alphaev68 ;;
876
903
objdump --private-headers /bin/sh | grep -q ld.so.1
877
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
878
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
904
if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
905
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
907
arc:Linux:*:* | arceb:Linux:*:*)
908
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
881
911
eval $set_cc_for_build
882
912
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
883
913
| grep -q __ARM_EABI__
885
echo ${UNAME_MACHINE}-unknown-linux-gnu
915
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
887
917
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
888
918
| grep -q __ARM_PCS_VFP
890
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
920
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
892
echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
922
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
896
926
avr32*:Linux:*:*)
897
echo ${UNAME_MACHINE}-unknown-linux-gnu
927
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
900
echo cris-axis-linux-gnu
930
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
902
932
crisv32:Linux:*:*)
903
echo crisv32-axis-linux-gnu
933
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
906
echo frv-unknown-linux-gnu
936
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
908
938
hexagon:Linux:*:*)
909
echo hexagon-unknown-linux-gnu
939
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
913
eval $set_cc_for_build
914
sed 's/^ //' << EOF >$dummy.c
919
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
920
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
942
echo ${UNAME_MACHINE}-pc-linux-${LIBC}
923
echo ${UNAME_MACHINE}-unknown-linux-gnu
945
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
926
echo ${UNAME_MACHINE}-unknown-linux-gnu
948
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
929
echo ${UNAME_MACHINE}-unknown-linux-gnu
951
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
931
953
mips:Linux:*:* | mips64:Linux:*:*)
932
954
eval $set_cc_for_build
947
969
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
948
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
970
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
973
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
951
echo or32-unknown-linux-gnu
976
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
954
echo sparc-unknown-linux-gnu
979
echo sparc-unknown-linux-${LIBC}
956
981
parisc64:Linux:*:* | hppa64:Linux:*:*)
957
echo hppa64-unknown-linux-gnu
982
echo hppa64-unknown-linux-${LIBC}
959
984
parisc:Linux:*:* | hppa:Linux:*:*)
960
985
# Look for CPU level
961
986
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
962
PA7*) echo hppa1.1-unknown-linux-gnu ;;
963
PA8*) echo hppa2.0-unknown-linux-gnu ;;
964
*) echo hppa-unknown-linux-gnu ;;
987
PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
988
PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
989
*) echo hppa-unknown-linux-${LIBC} ;;
968
echo powerpc64-unknown-linux-gnu
993
echo powerpc64-unknown-linux-${LIBC}
971
echo powerpc-unknown-linux-gnu
996
echo powerpc-unknown-linux-${LIBC}
999
echo powerpc64le-unknown-linux-${LIBC}
1002
echo powerpcle-unknown-linux-${LIBC}
973
1004
s390:Linux:*:* | s390x:Linux:*:*)
974
echo ${UNAME_MACHINE}-ibm-linux
1005
echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
976
1007
sh64*:Linux:*:*)
977
echo ${UNAME_MACHINE}-unknown-linux-gnu
1008
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
980
echo ${UNAME_MACHINE}-unknown-linux-gnu
1011
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
982
1013
sparc:Linux:*:* | sparc64:Linux:*:*)
983
echo ${UNAME_MACHINE}-unknown-linux-gnu
1014
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
985
1016
tile*:Linux:*:*)
986
echo ${UNAME_MACHINE}-unknown-linux-gnu
1017
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
989
echo ${UNAME_MACHINE}-dec-linux-gnu
1020
echo ${UNAME_MACHINE}-dec-linux-${LIBC}
991
1022
x86_64:Linux:*:*)
992
echo x86_64-unknown-linux-gnu
1023
eval $set_cc_for_build
1025
# If there is a compiler, see if it is configured for 32-bit objects.
1026
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
1027
if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
1028
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
1029
grep IS_X32 >/dev/null
1034
echo x86_64-unknown-linux-gnu${X86_64_ABI}
994
1036
xtensa*:Linux:*:*)
995
echo ${UNAME_MACHINE}-unknown-linux-gnu
1037
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
997
1039
i*86:DYNIX/ptx:4*:*)
998
1040
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1224
1269
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1225
case $UNAME_PROCESSOR in
1227
eval $set_cc_for_build
1228
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
1229
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1230
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
1231
grep IS_64BIT_ARCH >/dev/null
1233
UNAME_PROCESSOR="x86_64"
1236
unknown) UNAME_PROCESSOR=powerpc ;;
1270
eval $set_cc_for_build
1271
if test "$UNAME_PROCESSOR" = unknown ; then
1272
UNAME_PROCESSOR=powerpc
1274
if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
1275
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
1276
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1277
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
1278
grep IS_64BIT_ARCH >/dev/null
1280
case $UNAME_PROCESSOR in
1281
i386) UNAME_PROCESSOR=x86_64 ;;
1282
powerpc) UNAME_PROCESSOR=powerpc64 ;;
1286
elif test "$UNAME_PROCESSOR" = i386 ; then
1287
# Avoid executing cc on OS X 10.9, as it ships with a stub
1288
# that puts up a graphical alert prompting to install
1289
# developer tools. Any system running Mac OS X 10.7 or
1290
# later (Darwin 11 and later) is required to have a 64-bit
1291
# processor. This is not true of the ARM version of Darwin
1292
# that Apple uses in portable devices.
1293
UNAME_PROCESSOR=x86_64
1238
1295
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
1240
1297
*:procnto*:*:* | *:QNX:[0123456789]*:*)
1321
1378
echo ${UNAME_MACHINE}-pc-aros
1380
x86_64:VMkernel:*:*)
1381
echo ${UNAME_MACHINE}-unknown-esx
1325
#echo '(No uname command or uname output not recognized.)' 1>&2
1326
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
1328
eval $set_cc_for_build
1331
# include <sys/types.h>
1332
# include <sys/utsname.h>
1337
#if defined (MIPSEB)
1338
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
1340
printf ("mips-sony-bsd\n"); exit (0);
1342
#include <sys/param.h>
1343
printf ("m68k-sony-newsos%s\n",
1353
#if defined (__arm) && defined (__acorn) && defined (__unix)
1354
printf ("arm-acorn-riscix\n"); exit (0);
1357
#if defined (hp300) && !defined (hpux)
1358
printf ("m68k-hp-bsd\n"); exit (0);
1362
#if !defined (__ARCHITECTURE__)
1363
#define __ARCHITECTURE__ "m68k"
1366
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1368
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1370
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1374
#if defined (MULTIMAX) || defined (n16)
1376
printf ("ns32k-encore-sysv\n"); exit (0);
1379
printf ("ns32k-encore-mach\n"); exit (0);
1381
printf ("ns32k-encore-bsd\n"); exit (0);
1386
#if defined (__386BSD__)
1387
printf ("i386-pc-bsd\n"); exit (0);
1390
#if defined (sequent)
1392
printf ("i386-sequent-dynix\n"); exit (0);
1394
#if defined (ns32000)
1395
printf ("ns32k-sequent-dynix\n"); exit (0);
1399
#if defined (_SEQUENT_)
1404
if (strncmp(un.version, "V2", 2) == 0) {
1405
printf ("i386-sequent-ptx2\n"); exit (0);
1407
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1408
printf ("i386-sequent-ptx1\n"); exit (0);
1410
printf ("i386-sequent-ptx\n"); exit (0);
1415
# if !defined (ultrix)
1416
# include <sys/param.h>
1419
printf ("vax-dec-bsd4.3\n"); exit (0);
1422
printf ("vax-dec-bsd4.3reno\n"); exit (0);
1424
printf ("vax-dec-bsd\n"); exit (0);
1428
printf ("vax-dec-bsd\n"); exit (0);
1431
printf ("vax-dec-ultrix\n"); exit (0);
1435
#if defined (alliant) && defined (i860)
1436
printf ("i860-alliant-bsd\n"); exit (0);
1443
$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
1444
{ echo "$SYSTEM_NAME"; exit; }
1446
# Apollos put the system type in the environment.
1448
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
1450
# Convex versions that predate uname can use getsysinfo(1)
1452
if [ -x /usr/convex/getsysinfo ]
1454
case `getsysinfo -f cpu_type` in
1459
if getsysinfo -f scalar_acc
1460
then echo c32-convex-bsd
1461
else echo c2-convex-bsd
1477
1386
$0: unable to guess system type