| [206] | 1 | #! /bin/sh
|
|---|
| 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 Free Software Foundation, Inc.
|
|---|
| 5 |
|
|---|
| 6 | timestamp='2005-09-19'
|
|---|
| 7 |
|
|---|
| 8 | # This file is free software; you can redistribute it and/or modify it
|
|---|
| 9 | # under the terms of the GNU General Public License as published by
|
|---|
| 10 | # the Free Software Foundation; either version 3 of the License, or
|
|---|
| 11 | # (at your option) any later version.
|
|---|
| 12 | #
|
|---|
| 13 | # This program is distributed in the hope that it will be useful, but
|
|---|
| 14 | # WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|---|
| 16 | # General Public License for more details.
|
|---|
| 17 | #
|
|---|
| 18 | # You should have received a copy of the GNU General Public License
|
|---|
| 19 | # along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|---|
| 20 | #
|
|---|
| 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.
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 | # Originally written by Per Bothner <[email protected]>.
|
|---|
| 28 | # Please send patches to <[email protected]>. Submit a context
|
|---|
| 29 | # diff and a properly formatted ChangeLog entry.
|
|---|
| 30 | #
|
|---|
| 31 | # This script attempts to guess a canonical system name similar to
|
|---|
| 32 | # config.sub. If it succeeds, it prints the system name on stdout, and
|
|---|
| 33 | # exits with 0. Otherwise, it exits with 1.
|
|---|
| 34 | #
|
|---|
| 35 | # The plan is that this can be called by configure scripts if you
|
|---|
| 36 | # don't specify an explicit build system type.
|
|---|
| 37 |
|
|---|
| 38 | me=`echo "$0" | sed -e 's,.*/,,'`
|
|---|
| 39 |
|
|---|
| 40 | usage="\
|
|---|
| 41 | Usage: $0 [OPTION]
|
|---|
| 42 |
|
|---|
| 43 | Output the configuration name of the system \`$me' is run on.
|
|---|
| 44 |
|
|---|
| 45 | Operation modes:
|
|---|
| 46 | -h, --help print this help, then exit
|
|---|
| 47 | -t, --time-stamp print date of last modification, then exit
|
|---|
| 48 | -v, --version print version number, then exit
|
|---|
| 49 |
|
|---|
| 50 | Report bugs and patches to <[email protected]>."
|
|---|
| 51 |
|
|---|
| 52 | version="\
|
|---|
| 53 | GNU config.guess ($timestamp)
|
|---|
| 54 |
|
|---|
| 55 | Originally written by Per Bothner.
|
|---|
| 56 | Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
|---|
| 57 | Free Software Foundation, Inc.
|
|---|
| 58 |
|
|---|
| 59 | This is free software; see the source for copying conditions. There is NO
|
|---|
| 60 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
|---|
| 61 |
|
|---|
| 62 | help="
|
|---|
| 63 | Try \`$me --help' for more information."
|
|---|
| 64 |
|
|---|
| 65 | # Parse command line
|
|---|
| 66 | while test $# -gt 0 ; do
|
|---|
| 67 | case $1 in
|
|---|
| 68 | --time-stamp | --time* | -t )
|
|---|
| 69 | echo "$timestamp" ; exit ;;
|
|---|
| 70 | --version | -v )
|
|---|
| 71 | echo "$version" ; exit ;;
|
|---|
| 72 | --help | --h* | -h )
|
|---|
| 73 | echo "$usage"; exit ;;
|
|---|
| 74 | -- ) # Stop option processing
|
|---|
| 75 | shift; break ;;
|
|---|
| 76 | - ) # Use stdin as input.
|
|---|
| 77 | break ;;
|
|---|
| 78 | -* )
|
|---|
| 79 | echo "$me: invalid option $1$help" >&2
|
|---|
| 80 | exit 1 ;;
|
|---|
| 81 | * )
|
|---|
| 82 | break ;;
|
|---|
| 83 | esac
|
|---|
| 84 | done
|
|---|
| 85 |
|
|---|
| 86 | if test $# != 0; then
|
|---|
| 87 | echo "$me: too many arguments$help" >&2
|
|---|
| 88 | exit 1
|
|---|
| 89 | fi
|
|---|
| 90 |
|
|---|
| 91 | trap 'exit 1' 1 2 15
|
|---|
| 92 |
|
|---|
| 93 | # CC_FOR_BUILD -- compiler used by this script. Note that the use of a
|
|---|
| 94 | # compiler to aid in system detection is discouraged as it requires
|
|---|
| 95 | # temporary files to be created and, as you can see below, it is a
|
|---|
| 96 | # headache to deal with in a portable fashion.
|
|---|
| 97 |
|
|---|
| 98 | # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
|
|---|
| 99 | # use `HOST_CC' if defined, but it is deprecated.
|
|---|
| 100 |
|
|---|
| 101 | # Portable tmp directory creation inspired by the Autoconf team.
|
|---|
| 102 |
|
|---|
| 103 | set_cc_for_build='
|
|---|
| 104 | trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
|
|---|
| 105 | trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
|
|---|
| 106 | : ${TMPDIR=/tmp} ;
|
|---|
| 107 | { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
|
|---|
| 108 | { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
|
|---|
| 109 | { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
|
|---|
| 110 | { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
|
|---|
| 111 | dummy=$tmp/dummy ;
|
|---|
| 112 | tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
|
|---|
| 113 | case $CC_FOR_BUILD,$HOST_CC,$CC in
|
|---|
| 114 | ,,) echo "int x;" > $dummy.c ;
|
|---|
| 115 | for c in cc gcc c89 c99 ; do
|
|---|
| 116 | if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
|
|---|
| 117 | CC_FOR_BUILD="$c"; break ;
|
|---|
| 118 | fi ;
|
|---|
| 119 | done ;
|
|---|
| 120 | if test x"$CC_FOR_BUILD" = x ; then
|
|---|
| 121 | CC_FOR_BUILD=no_compiler_found ;
|
|---|
| 122 | fi
|
|---|
| 123 | ;;
|
|---|
| 124 | ,,*) CC_FOR_BUILD=$CC ;;
|
|---|
| 125 | ,*,*) CC_FOR_BUILD=$HOST_CC ;;
|
|---|
| 126 | esac ; set_cc_for_build= ;'
|
|---|
| 127 |
|
|---|
| 128 | # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
|
|---|
| 129 | # ([email protected] 1994-08-24)
|
|---|
| 130 | if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
|
|---|
| 131 | PATH=$PATH:/.attbin ; export PATH
|
|---|
| 132 | fi
|
|---|
| 133 |
|
|---|
| 134 | UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
|
|---|
| 135 | UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
|
|---|
| 136 | UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
|
|---|
| 137 | UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
|
|---|
| 138 |
|
|---|
| 139 | # Note: order is significant - the case branches are not exclusive.
|
|---|
| 140 |
|
|---|
| 141 | case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
|---|
| 142 | *:NetBSD:*:*)
|
|---|
| 143 | # NetBSD (nbsd) targets should (where applicable) match one or
|
|---|
| 144 | # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
|
|---|
| 145 | # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
|
|---|
| 146 | # switched to ELF, *-*-netbsd* would select the old
|
|---|
| 147 | # object file format. This provides both forward
|
|---|
| 148 | # compatibility and a consistent mechanism for selecting the
|
|---|
| 149 | # object file format.
|
|---|
| 150 | #
|
|---|
| 151 | # Note: NetBSD doesn't particularly care about the vendor
|
|---|
| 152 | # portion of the name. We always set it to "unknown".
|
|---|
| 153 | sysctl="sysctl -n hw.machine_arch"
|
|---|
| 154 | UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
|
|---|
| 155 | /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
|
|---|
| 156 | case "${UNAME_MACHINE_ARCH}" in
|
|---|
| 157 | armeb) machine=armeb-unknown ;;
|
|---|
| 158 | arm*) machine=arm-unknown ;;
|
|---|
| 159 | sh3el) machine=shl-unknown ;;
|
|---|
| 160 | sh3eb) machine=sh-unknown ;;
|
|---|
| 161 | *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
|
|---|
| 162 | esac
|
|---|
| 163 | # The Operating System including object format, if it has switched
|
|---|
| 164 | # to ELF recently, or will in the future.
|
|---|
| 165 | case "${UNAME_MACHINE_ARCH}" in
|
|---|
| 166 | arm*|i386|m68k|ns32k|sh3*|sparc|vax)
|
|---|
| 167 | eval $set_cc_for_build
|
|---|
| 168 | if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
|---|
| 169 | | grep __ELF__ >/dev/null
|
|---|
| 170 | then
|
|---|
| 171 | # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
|
|---|
| 172 | # Return netbsd for either. FIX?
|
|---|
| 173 | os=netbsd
|
|---|
| 174 | else
|
|---|
| 175 | os=netbsdelf
|
|---|
| 176 | fi
|
|---|
| 177 | ;;
|
|---|
| 178 | *)
|
|---|
| 179 | os=netbsd
|
|---|
| 180 | ;;
|
|---|
| 181 | esac
|
|---|
| 182 | # The OS release
|
|---|
| 183 | # Debian GNU/NetBSD machines have a different userland, and
|
|---|
| 184 | # thus, need a distinct triplet. However, they do not need
|
|---|
| 185 | # kernel version information, so it can be replaced with a
|
|---|
| 186 | # suitable tag, in the style of linux-gnu.
|
|---|
| 187 | case "${UNAME_VERSION}" in
|
|---|
| 188 | Debian*)
|
|---|
| 189 | release='-gnu'
|
|---|
| 190 | ;;
|
|---|
| 191 | *)
|
|---|
| 192 | release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
|---|
| 193 | ;;
|
|---|
| 194 | esac
|
|---|
| 195 | # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
|
|---|
| 196 | # contains redundant information, the shorter form:
|
|---|
| 197 | # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
|
|---|
| 198 | echo "${machine}-${os}${release}"
|
|---|
| 199 | exit ;;
|
|---|
| 200 | *:OpenBSD:*:*)
|
|---|
| 201 | UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
|
|---|
| 202 | echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
|
|---|
| 203 | exit ;;
|
|---|
| 204 | *:ekkoBSD:*:*)
|
|---|
| 205 | echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
|
|---|
| 206 | exit ;;
|
|---|
| 207 | macppc:MirBSD:*:*)
|
|---|
| 208 | echo powerppc-unknown-mirbsd${UNAME_RELEASE}
|
|---|
| 209 | exit ;;
|
|---|
| 210 | *:MirBSD:*:*)
|
|---|
| 211 | echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
|
|---|
| 212 | exit ;;
|
|---|
| 213 | alpha:OSF1:*:*)
|
|---|
| 214 | case $UNAME_RELEASE in
|
|---|
| 215 | *4.0)
|
|---|
| 216 | UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
|
|---|
| 217 | ;;
|
|---|
| 218 | *5.*)
|
|---|
| 219 | UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
|
|---|
| 220 | ;;
|
|---|
| 221 | esac
|
|---|
| 222 | # According to Compaq, /usr/sbin/psrinfo has been available on
|
|---|
| 223 | # OSF/1 and Tru64 systems produced since 1995. I hope that
|
|---|
| 224 | # covers most systems running today. This code pipes the CPU
|
|---|
| 225 | # types through head -n 1, so we only detect the type of CPU 0.
|
|---|
| 226 | ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
|
|---|
| 227 | case "$ALPHA_CPU_TYPE" in
|
|---|
| 228 | "EV4 (21064)")
|
|---|
| 229 | UNAME_MACHINE="alpha" ;;
|
|---|
| 230 | "EV4.5 (21064)")
|
|---|
| 231 | UNAME_MACHINE="alpha" ;;
|
|---|
| 232 | "LCA4 (21066/21068)")
|
|---|
| 233 | UNAME_MACHINE="alpha" ;;
|
|---|
| 234 | "EV5 (21164)")
|
|---|
| 235 | UNAME_MACHINE="alphaev5" ;;
|
|---|
| 236 | "EV5.6 (21164A)")
|
|---|
| 237 | UNAME_MACHINE="alphaev56" ;;
|
|---|
| 238 | "EV5.6 (21164PC)")
|
|---|
| 239 | UNAME_MACHINE="alphapca56" ;;
|
|---|
| 240 | "EV5.7 (21164PC)")
|
|---|
| 241 | UNAME_MACHINE="alphapca57" ;;
|
|---|
| 242 | "EV6 (21264)")
|
|---|
| 243 | UNAME_MACHINE="alphaev6" ;;
|
|---|
| 244 | "EV6.7 (21264A)")
|
|---|
| 245 | UNAME_MACHINE="alphaev67" ;;
|
|---|
| 246 | "EV6.8CB (21264C)")
|
|---|
| 247 | UNAME_MACHINE="alphaev68" ;;
|
|---|
| 248 | "EV6.8AL (21264B)")
|
|---|
| 249 | UNAME_MACHINE="alphaev68" ;;
|
|---|
| 250 | "EV6.8CX (21264D)")
|
|---|
| 251 | UNAME_MACHINE="alphaev68" ;;
|
|---|
| 252 | "EV6.9A (21264/EV69A)")
|
|---|
| 253 | UNAME_MACHINE="alphaev69" ;;
|
|---|
| 254 | "EV7 (21364)")
|
|---|
| 255 | UNAME_MACHINE="alphaev7" ;;
|
|---|
| 256 | "EV7.9 (21364A)")
|
|---|
| 257 | UNAME_MACHINE="alphaev79" ;;
|
|---|
| 258 | esac
|
|---|
| 259 | # A Pn.n version is a patched version.
|
|---|
| 260 | # A Vn.n version is a released version.
|
|---|
| 261 | # A Tn.n version is a released field test version.
|
|---|
| 262 | # A Xn.n version is an unreleased experimental baselevel.
|
|---|
| 263 | # 1.2 uses "1.2" for uname -r.
|
|---|
| |
|---|