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, 2012, 2013 Free Software Foundation, Inc.
3
# Copyright 1992-2015 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
26
24
# program. This Exception is an additional permission under section 7
27
25
# of the GNU General Public License, version 3 ("GPLv3").
29
# Originally written by Per Bothner.
27
# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
31
29
# You can get the latest version of this script from:
32
30
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
34
# Please send patches with a ChangeLog entry to config-patches@gnu.org.
32
# Please send patches to <config-patches@gnu.org>.
37
35
me=`echo "$0" | sed -e 's,.*/,,'`
52
50
GNU config.guess ($timestamp)
54
52
Originally written by Per Bothner.
55
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
56
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
57
2012, 2013 Free Software Foundation, Inc.
53
Copyright 1992-2015 Free Software Foundation, Inc.
59
55
This is free software; see the source for copying conditions. There is NO
60
56
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
136
132
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
137
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'`
139
156
# Note: order is significant - the case branches are not exclusive.
141
158
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
565
if [ -x /usr/bin/oslevel ] ; then
566
IBM_REV=`/usr/bin/oslevel`
582
if [ -x /usr/bin/lslpp ] ; then
583
IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
584
awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
568
586
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
860
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
878
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
863
881
# other systems with GNU libc and userland
864
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
882
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
867
885
echo ${UNAME_MACHINE}-pc-minix
869
887
aarch64:Linux:*:*)
870
echo ${UNAME_MACHINE}-unknown-linux-gnu
888
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
872
890
aarch64_be:Linux:*:*)
873
891
UNAME_MACHINE=aarch64_be
874
echo ${UNAME_MACHINE}-unknown-linux-gnu
892
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
877
895
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
884
902
EV68*) UNAME_MACHINE=alphaev68 ;;
886
904
objdump --private-headers /bin/sh | grep -q ld.so.1
887
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
888
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
905
if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
906
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
908
arc:Linux:*:* | arceb:Linux:*:*)
909
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
891
912
eval $set_cc_for_build
892
913
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
893
914
| grep -q __ARM_EABI__
895
echo ${UNAME_MACHINE}-unknown-linux-gnu
916
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
897
918
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
898
919
| grep -q __ARM_PCS_VFP
900
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
921
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
902
echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
923
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
906
927
avr32*:Linux:*:*)
907
echo ${UNAME_MACHINE}-unknown-linux-gnu
928
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
910
echo ${UNAME_MACHINE}-axis-linux-gnu
931
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
912
933
crisv32:Linux:*:*)
913
echo ${UNAME_MACHINE}-axis-linux-gnu
934
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
916
echo ${UNAME_MACHINE}-unknown-linux-gnu
937
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
918
939
hexagon:Linux:*:*)
919
echo ${UNAME_MACHINE}-unknown-linux-gnu
940
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
923
eval $set_cc_for_build
924
sed 's/^ //' << EOF >$dummy.c
929
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
930
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
943
echo ${UNAME_MACHINE}-pc-linux-${LIBC}
933
echo ${UNAME_MACHINE}-unknown-linux-gnu
946
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
936
echo ${UNAME_MACHINE}-unknown-linux-gnu
949
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
939
echo ${UNAME_MACHINE}-unknown-linux-gnu
952
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
941
954
mips:Linux:*:* | mips64:Linux:*:*)
942
955
eval $set_cc_for_build
957
970
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
958
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
971
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
961
echo ${UNAME_MACHINE}-unknown-linux-gnu
974
echo or1k-unknown-linux-${LIBC}
976
or32:Linux:*:* | or1k*:Linux:*:*)
977
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
964
echo sparc-unknown-linux-gnu
980
echo sparc-unknown-linux-${LIBC}
966
982
parisc64:Linux:*:* | hppa64:Linux:*:*)
967
echo hppa64-unknown-linux-gnu
983
echo hppa64-unknown-linux-${LIBC}
969
985
parisc:Linux:*:* | hppa:Linux:*:*)
970
986
# Look for CPU level
971
987
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
972
PA7*) echo hppa1.1-unknown-linux-gnu ;;
973
PA8*) echo hppa2.0-unknown-linux-gnu ;;
974
*) echo hppa-unknown-linux-gnu ;;
988
PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
989
PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
990
*) echo hppa-unknown-linux-${LIBC} ;;
978
echo powerpc64-unknown-linux-gnu
994
echo powerpc64-unknown-linux-${LIBC}
981
echo powerpc-unknown-linux-gnu
997
echo powerpc-unknown-linux-${LIBC}
1000
echo powerpc64le-unknown-linux-${LIBC}
1003
echo powerpcle-unknown-linux-${LIBC}
983
1005
s390:Linux:*:* | s390x:Linux:*:*)
984
echo ${UNAME_MACHINE}-ibm-linux
1006
echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
986
1008
sh64*:Linux:*:*)
987
echo ${UNAME_MACHINE}-unknown-linux-gnu
1009
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
990
echo ${UNAME_MACHINE}-unknown-linux-gnu
1012
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
992
1014
sparc:Linux:*:* | sparc64:Linux:*:*)
993
echo ${UNAME_MACHINE}-unknown-linux-gnu
1015
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
995
1017
tile*:Linux:*:*)
996
echo ${UNAME_MACHINE}-unknown-linux-gnu
1018
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
999
echo ${UNAME_MACHINE}-dec-linux-gnu
1021
echo ${UNAME_MACHINE}-dec-linux-${LIBC}
1001
1023
x86_64:Linux:*:*)
1002
echo ${UNAME_MACHINE}-unknown-linux-gnu
1024
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1004
1026
xtensa*:Linux:*:*)
1005
echo ${UNAME_MACHINE}-unknown-linux-gnu
1027
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1007
1029
i*86:DYNIX/ptx:4*:*)
1008
1030
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1237
1259
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1238
case $UNAME_PROCESSOR in
1240
eval $set_cc_for_build
1241
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
1242
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1243
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
1244
grep IS_64BIT_ARCH >/dev/null
1246
UNAME_PROCESSOR="x86_64"
1249
unknown) UNAME_PROCESSOR=powerpc ;;
1260
eval $set_cc_for_build
1261
if test "$UNAME_PROCESSOR" = unknown ; then
1262
UNAME_PROCESSOR=powerpc
1264
if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
1265
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
1266
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1267
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
1268
grep IS_64BIT_ARCH >/dev/null
1270
case $UNAME_PROCESSOR in
1271
i386) UNAME_PROCESSOR=x86_64 ;;
1272
powerpc) UNAME_PROCESSOR=powerpc64 ;;
1276
elif test "$UNAME_PROCESSOR" = i386 ; then
1277
# Avoid executing cc on OS X 10.9, as it ships with a stub
1278
# that puts up a graphical alert prompting to install
1279
# developer tools. Any system running Mac OS X 10.7 or
1280
# later (Darwin 11 and later) is required to have a 64-bit
1281
# processor. This is not true of the ARM version of Darwin
1282
# that Apple uses in portable devices.
1283
UNAME_PROCESSOR=x86_64
1251
1285
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
1253
1287
*:procnto*:*:* | *:QNX:[0123456789]*:*)
1341
eval $set_cc_for_build
1344
# include <sys/types.h>
1345
# include <sys/utsname.h>
1350
#if defined (MIPSEB)
1351
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
1353
printf ("mips-sony-bsd\n"); exit (0);
1355
#include <sys/param.h>
1356
printf ("m68k-sony-newsos%s\n",
1366
#if defined (__arm) && defined (__acorn) && defined (__unix)
1367
printf ("arm-acorn-riscix\n"); exit (0);
1370
#if defined (hp300) && !defined (hpux)
1371
printf ("m68k-hp-bsd\n"); exit (0);
1375
#if !defined (__ARCHITECTURE__)
1376
#define __ARCHITECTURE__ "m68k"
1379
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1381
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1383
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1387
#if defined (MULTIMAX) || defined (n16)
1389
printf ("ns32k-encore-sysv\n"); exit (0);
1392
printf ("ns32k-encore-mach\n"); exit (0);
1394
printf ("ns32k-encore-bsd\n"); exit (0);
1399
#if defined (__386BSD__)
1400
printf ("i386-pc-bsd\n"); exit (0);
1403
#if defined (sequent)
1405
printf ("i386-sequent-dynix\n"); exit (0);
1407
#if defined (ns32000)
1408
printf ("ns32k-sequent-dynix\n"); exit (0);
1412
#if defined (_SEQUENT_)
1417
if (strncmp(un.version, "V2", 2) == 0) {
1418
printf ("i386-sequent-ptx2\n"); exit (0);
1420
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1421
printf ("i386-sequent-ptx1\n"); exit (0);
1423
printf ("i386-sequent-ptx\n"); exit (0);
1428
# if !defined (ultrix)
1429
# include <sys/param.h>
1432
printf ("vax-dec-bsd4.3\n"); exit (0);
1435
printf ("vax-dec-bsd4.3reno\n"); exit (0);
1437
printf ("vax-dec-bsd\n"); exit (0);
1441
printf ("vax-dec-bsd\n"); exit (0);
1444
printf ("vax-dec-ultrix\n"); exit (0);
1448
#if defined (alliant) && defined (i860)
1449
printf ("i860-alliant-bsd\n"); exit (0);
1456
$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
1457
{ echo "$SYSTEM_NAME"; exit; }
1459
# Apollos put the system type in the environment.
1461
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
1463
# Convex versions that predate uname can use getsysinfo(1)
1465
if [ -x /usr/convex/getsysinfo ]
1467
case `getsysinfo -f cpu_type` in
1472
if getsysinfo -f scalar_acc
1473
then echo c32-convex-bsd
1474
else echo c2-convex-bsd
1490
1376
$0: unable to guess system type