Added MacOS, gcc, and clang support. Preliminary crappy autoconf scripts of course.
Added MacOS, gcc, and clang support. Preliminary crappy autoconf scripts of course.
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/build/autoconf/config.guess Mon Jul 02 23:37:12 2012 -0700
1.3 @@ -0,0 +1,1537 @@
1.4 +#! /bin/sh
1.5 +# Attempt to guess a canonical system name.
1.6 +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
1.7 +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
1.8 +# Free Software Foundation, Inc.
1.9 +
1.10 +timestamp='2009-08-19'
1.11 +
1.12 +# This file is free software; you can redistribute it and/or modify it
1.13 +# under the terms of the GNU General Public License as published by
1.14 +# the Free Software Foundation; either version 2 of the License, or
1.15 +# (at your option) any later version.
1.16 +#
1.17 +# This program is distributed in the hope that it will be useful, but
1.18 +# WITHOUT ANY WARRANTY; without even the implied warranty of
1.19 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1.20 +# General Public License for more details.
1.21 +#
1.22 +# You should have received a copy of the GNU General Public License
1.23 +# along with this program; if not, write to the Free Software
1.24 +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
1.25 +# 02110-1301, USA.
1.26 +#
1.27 +# As a special exception to the GNU General Public License, if you
1.28 +# distribute this file as part of a program that contains a
1.29 +# configuration script generated by Autoconf, you may include it under
1.30 +# the same distribution terms that you use for the rest of that program.
1.31 +
1.32 +
1.33 +# Originally written by Per Bothner. Please send patches (context
1.34 +# diff format) to <[email protected]> and include a ChangeLog
1.35 +# entry.
1.36 +#
1.37 +# This script attempts to guess a canonical system name similar to
1.38 +# config.sub. If it succeeds, it prints the system name on stdout, and
1.39 +# exits with 0. Otherwise, it exits with 1.
1.40 +#
1.41 +# You can get the latest version of this script from:
1.42 +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
1.43 +
1.44 +me=`echo "$0" | sed -e 's,.*/,,'`
1.45 +
1.46 +usage="\
1.47 +Usage: $0 [OPTION]
1.48 +
1.49 +Output the configuration name of the system \`$me' is run on.
1.50 +
1.51 +Operation modes:
1.52 + -h, --help print this help, then exit
1.53 + -t, --time-stamp print date of last modification, then exit
1.54 + -v, --version print version number, then exit
1.55 +
1.56 +Report bugs and patches to <[email protected]>."
1.57 +
1.58 +version="\
1.59 +GNU config.guess ($timestamp)
1.60 +
1.61 +Originally written by Per Bothner.
1.62 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
1.63 +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
1.64 +
1.65 +This is free software; see the source for copying conditions. There is NO
1.66 +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
1.67 +
1.68 +help="
1.69 +Try \`$me --help' for more information."
1.70 +
1.71 +# Parse command line
1.72 +while test $# -gt 0 ; do
1.73 + case $1 in
1.74 + --time-stamp | --time* | -t )
1.75 + echo "$timestamp" ; exit ;;
1.76 + --version | -v )
1.77 + echo "$version" ; exit ;;
1.78 + --help | --h* | -h )
1.79 + echo "$usage"; exit ;;
1.80 + -- ) # Stop option processing
1.81 + shift; break ;;
1.82 + - ) # Use stdin as input.
1.83 + break ;;
1.84 + -* )
1.85 + echo "$me: invalid option $1$help" >&2
1.86 + exit 1 ;;
1.87 + * )
1.88 + break ;;
1.89 + esac
1.90 +done
1.91 +
1.92 +if test $# != 0; then
1.93 + echo "$me: too many arguments$help" >&2
1.94 + exit 1
1.95 +fi
1.96 +
1.97 +trap 'exit 1' 1 2 15
1.98 +
1.99 +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
1.100 +# compiler to aid in system detection is discouraged as it requires
1.101 +# temporary files to be created and, as you can see below, it is a
1.102 +# headache to deal with in a portable fashion.
1.103 +
1.104 +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
1.105 +# use `HOST_CC' if defined, but it is deprecated.
1.106 +
1.107 +# Portable tmp directory creation inspired by the Autoconf team.
1.108 +
1.109 +set_cc_for_build='
1.110 +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
1.111 +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
1.112 +: ${TMPDIR=/tmp} ;
1.113 + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
1.114 + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
1.115 + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
1.116 + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
1.117 +dummy=$tmp/dummy ;
1.118 +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
1.119 +case $CC_FOR_BUILD,$HOST_CC,$CC in
1.120 + ,,) echo "int x;" > $dummy.c ;
1.121 + for c in cc gcc c89 c99 ; do
1.122 + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
1.123 + CC_FOR_BUILD="$c"; break ;
1.124 + fi ;
1.125 + done ;
1.126 + if test x"$CC_FOR_BUILD" = x ; then
1.127 + CC_FOR_BUILD=no_compiler_found ;
1.128 + fi
1.129 + ;;
1.130 + ,,*) CC_FOR_BUILD=$CC ;;
1.131 + ,*,*) CC_FOR_BUILD=$HOST_CC ;;
1.132 +esac ; set_cc_for_build= ;'
1.133 +
1.134 +# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
1.135 +# ([email protected] 1994-08-24)
1.136 +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
1.137 + PATH=$PATH:/.attbin ; export PATH
1.138 +fi
1.139 +
1.140 +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
1.141 +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
1.142 +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
1.143 +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
1.144 +
1.145 +# Note: order is significant - the case branches are not exclusive.
1.146 +
1.147 +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
1.148 + *:NetBSD:*:*)
1.149 + # NetBSD (nbsd) targets should (where applicable) match one or
1.150 + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
1.151 + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
1.152 + # switched to ELF, *-*-netbsd* would select the old
1.153 + # object file format. This provides both forward
1.154 + # compatibility and a consistent mechanism for selecting the
1.155 + # object file format.
1.156 + #
1.157 + # Note: NetBSD doesn't particularly care about the vendor
1.158 + # portion of the name. We always set it to "unknown".
1.159 + sysctl="sysctl -n hw.machine_arch"
1.160 + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
1.161 + /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
1.162 + case "${UNAME_MACHINE_ARCH}" in
1.163 + armeb) machine=armeb-unknown ;;
1.164 + arm*) machine=arm-unknown ;;
1.165 + sh3el) machine=shl-unknown ;;
1.166 + sh3eb) machine=sh-unknown ;;
1.167 + sh5el) machine=sh5le-unknown ;;
1.168 + *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
1.169 + esac
1.170 + # The Operating System including object format, if it has switched
1.171 + # to ELF recently, or will in the future.
1.172 + case "${UNAME_MACHINE_ARCH}" in
1.173 + arm*|i386|m68k|ns32k|sh3*|sparc|vax)
1.174 + eval $set_cc_for_build
1.175 + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
1.176 + | grep -q __ELF__
1.177 + then
1.178 + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
1.179 + # Return netbsd for either. FIX?
1.180 + os=netbsd
1.181 + else
1.182 + os=netbsdelf
1.183 + fi
1.184 + ;;
1.185 + *)
1.186 + os=netbsd
1.187 + ;;
1.188 + esac
1.189 + # The OS release
1.190 + # Debian GNU/NetBSD machines have a different userland, and
1.191 + # thus, need a distinct triplet. However, they do not need
1.192 + # kernel version information, so it can be replaced with a
1.193 + # suitable tag, in the style of linux-gnu.
1.194 + case "${UNAME_VERSION}" in
1.195 + Debian*)
1.196 + release='-gnu'
1.197 + ;;
1.198 + *)
1.199 + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
1.200 + ;;
1.201 + esac
1.202 + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
1.203 + # contains redundant information, the shorter form:
1.204 + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
1.205 + echo "${machine}-${os}${release}"
1.206 + exit ;;
1.207 + *:OpenBSD:*:*)
1.208 + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
1.209 + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
1.210 + exit ;;
1.211 + *:ekkoBSD:*:*)
1.212 + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
1.213 + exit ;;
1.214 + *:SolidBSD:*:*)
1.215 + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
1.216 + exit ;;
1.217 + macppc:MirBSD:*:*)
1.218 + echo powerpc-unknown-mirbsd${UNAME_RELEASE}
1.219 + exit ;;
1.220 + *:MirBSD:*:*)
1.221 + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
1.222 + exit ;;
1.223 + alpha:OSF1:*:*)
1.224 + case $UNAME_RELEASE in
1.225 + *4.0)
1.226 + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
1.227 + ;;
1.228 + *5.*)
1.229 + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
1.230 + ;;
1.231 + esac
1.232 + # According to Compaq, /usr/sbin/psrinfo has been available on
1.233 + # OSF/1 and Tru64 systems produced since 1995. I hope that
1.234 + # covers most systems running today. This code pipes the CPU
1.235 + # types through head -n 1, so we only detect the type of CPU 0.
1.236 + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
1.237 + case "$ALPHA_CPU_TYPE" in
1.238 + "EV4 (21064)")
1.239 + UNAME_MACHINE="alpha" ;;
1.240 + "EV4.5 (21064)")
1.241 + UNAME_MACHINE="alpha" ;;
1.242 + "LCA4 (21066/21068)")
1.243 + UNAME_MACHINE="alpha" ;;
1.244 + "EV5 (21164)")
1.245 + UNAME_MACHINE="alphaev5" ;;
1.246 + "EV5.6 (21164A)")
1.247 + UNAME_MACHINE="alphaev56" ;;
1.248 + "EV5.6 (21164PC)")
1.249 + UNAME_MACHINE="alphapca56" ;;
1.250 + "EV5.7 (21164PC)")
1.251 + UNAME_MACHINE="alphapca57" ;;
1.252 + "EV6 (21264)")
1.253 + UNAME_MACHINE="alphaev6" ;;
1.254 + "EV6.7 (21264A)")
1.255 + UNAME_MACHINE="alphaev67" ;;
1.256 + "EV6.8CB (21264C)")
1.257 + UNAME_MACHINE="alphaev68" ;;
1.258 + "EV6.8AL (21264B)")
1.259 + UNAME_MACHINE="alphaev68" ;;
1.260 + "EV6.8CX (21264D)")
1.261 + UNAME_MACHINE="alphaev68" ;;
1.262 + "EV6.9A (21264/EV69A)")
1.263 + UNAME_MACHINE="alphaev69" ;;
1.264 + "EV7 (21364)")
1.265 + UNAME_MACHINE="alphaev7" ;;
1.266 + "EV7.9 (21364A)")
1.267 + UNAME_MACHINE="alphaev79" ;;
1.268 + esac
1.269 + # A Pn.n version is a patched version.
1.270 + # A Vn.n version is a released version.
1.271 + # A Tn.n version is a released field test version.
1.272 + # A Xn.n version is an unreleased experimental baselevel.
1.273 + # 1.2 uses "1.2" for uname -r.
1.274 + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
1.275 + exit ;;
1.276 + Alpha\ *:Windows_NT*:*)
1.277 + # How do we know it's Interix rather than the generic POSIX subsystem?
1.278 + # Should we change UNAME_MACHINE based on the output of uname instead
1.279 + # of the specific Alpha model?
1.280 + echo alpha-pc-interix
1.281 + exit ;;
1.282 + 21064:Windows_NT:50:3)
1.283 + echo alpha-dec-winnt3.5
1.284 + exit ;;
1.285 + Amiga*:UNIX_System_V:4.0:*)
1.286 + echo m68k-unknown-sysv4
1.287 + exit ;;
1.288 + *:[Aa]miga[Oo][Ss]:*:*)
1.289 + echo ${UNAME_MACHINE}-unknown-amigaos
1.290 + exit ;;
1.291 + *:[Mm]orph[Oo][Ss]:*:*)
1.292 + echo ${UNAME_MACHINE}-unknown-morphos
1.293 + exit ;;
1.294 + *:OS/390:*:*)
1.295 + echo i370-ibm-openedition
1.296 + exit ;;
1.297 + *:z/VM:*:*)
1.298 + echo s390-ibm-zvmoe
1.299 + exit ;;
1.300 + *:OS400:*:*)
1.301 + echo powerpc-ibm-os400
1.302 + exit ;;
1.303 + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
1.304 + echo arm-acorn-riscix${UNAME_RELEASE}
1.305 + exit ;;
1.306 + arm:riscos:*:*|arm:RISCOS:*:*)
1.307 + echo arm-unknown-riscos
1.308 + exit ;;
1.309 + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
1.310 + echo hppa1.1-hitachi-hiuxmpp
1.311 + exit ;;
1.312 + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
1.313 + # [email protected] (Earle F. Ake) contributed MIS and NILE.
1.314 + if test "`(/bin/universe) 2>/dev/null`" = att ; then
1.315 + echo pyramid-pyramid-sysv3
1.316 + else
1.317 + echo pyramid-pyramid-bsd
1.318 + fi
1.319 + exit ;;
1.320 + NILE*:*:*:dcosx)
1.321 + echo pyramid-pyramid-svr4
1.322 + exit ;;
1.323 + DRS?6000:unix:4.0:6*)
1.324 + echo sparc-icl-nx6
1.325 + exit ;;
1.326 + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
1.327 + case `/usr/bin/uname -p` in
1.328 + sparc) echo sparc-icl-nx7; exit ;;
1.329 + esac ;;
1.330 + s390x:SunOS:*:*)
1.331 + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
1.332 + exit ;;
1.333 + sun4H:SunOS:5.*:*)
1.334 + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
1.335 + exit ;;
1.336 + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
1.337 + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
1.338 + exit ;;
1.339 + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
1.340 + eval $set_cc_for_build
1.341 + SUN_ARCH="i386"
1.342 + # If there is a compiler, see if it is configured for 64-bit objects.
1.343 + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
1.344 + # This test works for both compilers.
1.345 + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
1.346 + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
1.347 + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
1.348 + grep IS_64BIT_ARCH >/dev/null
1.349 + then
1.350 + SUN_ARCH="x86_64"
1.351 + fi
1.352 + fi
1.353 + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
1.354 + exit ;;
1.355 + sun4*:SunOS:6*:*)
1.356 + # According to config.sub, this is the proper way to canonicalize
1.357 + # SunOS6. Hard to guess exactly what SunOS6 will be like, but
1.358 + # it's likely to be more like Solaris than SunOS4.
1.359 + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
1.360 + exit ;;
1.361 + sun4*:SunOS:*:*)
1.362 + case "`/usr/bin/arch -k`" in
1.363 + Series*|S4*)
1.364 + UNAME_RELEASE=`uname -v`
1.365 + ;;
1.366 + esac
1.367 + # Japanese Language versions have a version number like `4.1.3-JL'.
1.368 + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
1.369 + exit ;;
1.370 + sun3*:SunOS:*:*)
1.371 + echo m68k-sun-sunos${UNAME_RELEASE}
1.372 + exit ;;
1.373 + sun*:*:4.2BSD:*)
1.374 + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
1.375 + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
1.376 + case "`/bin/arch`" in
1.377 + sun3)
1.378 + echo m68k-sun-sunos${UNAME_RELEASE}
1.379 + ;;
1.380 + sun4)
1.381 + echo sparc-sun-sunos${UNAME_RELEASE}
1.382 + ;;
1.383 + esac
1.384 + exit ;;
1.385 + aushp:SunOS:*:*)
1.386 + echo sparc-auspex-sunos${UNAME_RELEASE}
1.387 + exit ;;
1.388 + # The situation for MiNT is a little confusing. The machine name
1.389 + # can be virtually everything (everything which is not
1.390 + # "atarist" or "atariste" at least should have a processor
1.391 + # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
1.392 + # to the lowercase version "mint" (or "freemint"). Finally
1.393 + # the system name "TOS" denotes a system which is actually not
1.394 + # MiNT. But MiNT is downward compatible to TOS, so this should
1.395 + # be no problem.
1.396 + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
1.397 + echo m68k-atari-mint${UNAME_RELEASE}
1.398 + exit ;;
1.399 + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
1.400 + echo m68k-atari-mint${UNAME_RELEASE}
1.401 + exit ;;
1.402 + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
1.403 + echo m68k-atari-mint${UNAME_RELEASE}
1.404 + exit ;;
1.405 + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
1.406 + echo m68k-milan-mint${UNAME_RELEASE}
1.407 + exit ;;
1.408 + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
1.409 + echo m68k-hades-mint${UNAME_RELEASE}
1.410 + exit ;;
1.411 + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
1.412 + echo m68k-unknown-mint${UNAME_RELEASE}
1.413 + exit ;;
1.414 + m68k:machten:*:*)
1.415 + echo m68k-apple-machten${UNAME_RELEASE}
1.416 + exit ;;
1.417 + powerpc:machten:*:*)
1.418 + echo powerpc-apple-machten${UNAME_RELEASE}
1.419 + exit ;;
1.420 + RISC*:Mach:*:*)
1.421 + echo mips-dec-mach_bsd4.3
1.422 + exit ;;
1.423 + RISC*:ULTRIX:*:*)
1.424 + echo mips-dec-ultrix${UNAME_RELEASE}
1.425 + exit ;;
1.426 + VAX*:ULTRIX*:*:*)
1.427 + echo vax-dec-ultrix${UNAME_RELEASE}
1.428 + exit ;;
1.429 + 2020:CLIX:*:* | 2430:CLIX:*:*)
1.430 + echo clipper-intergraph-clix${UNAME_RELEASE}
1.431 + exit ;;
1.432 + mips:*:*:UMIPS | mips:*:*:RISCos)
1.433 + eval $set_cc_for_build
1.434 + sed 's/^ //' << EOF >$dummy.c
1.435 +#ifdef __cplusplus
1.436 +#include <stdio.h> /* for printf() prototype */
1.437 + int main (int argc, char *argv[]) {
1.438 +#else
1.439 + int main (argc, argv) int argc; char *argv[]; {
1.440 +#endif
1.441 + #if defined (host_mips) && defined (MIPSEB)
1.442 + #if defined (SYSTYPE_SYSV)
1.443 + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
1.444 + #endif
1.445 + #if defined (SYSTYPE_SVR4)
1.446 + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
1.447 + #endif
1.448 + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
1.449 + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
1.450 + #endif
1.451 + #endif
1.452 + exit (-1);
1.453 + }
1.454 +EOF
1.455 + $CC_FOR_BUILD -o $dummy $dummy.c &&
1.456 + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
1.457 + SYSTEM_NAME=`$dummy $dummyarg` &&
1.458 + { echo "$SYSTEM_NAME"; exit; }
1.459 + echo mips-mips-riscos${UNAME_RELEASE}
1.460 + exit ;;
1.461 + Motorola:PowerMAX_OS:*:*)
1.462 + echo powerpc-motorola-powermax
1.463 + exit ;;
1.464 + Motorola:*:4.3:PL8-*)
1.465 + echo powerpc-harris-powermax
1.466 + exit ;;
1.467 + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
1.468 + echo powerpc-harris-powermax
1.469 + exit ;;
1.470 + Night_Hawk:Power_UNIX:*:*)
1.471 + echo powerpc-harris-powerunix
1.472 + exit ;;
1.473 + m88k:CX/UX:7*:*)
1.474 + echo m88k-harris-cxux7
1.475 + exit ;;
1.476 + m88k:*:4*:R4*)
1.477 + echo m88k-motorola-sysv4
1.478 + exit ;;
1.479 + m88k:*:3*:R3*)
1.480 + echo m88k-motorola-sysv3
1.481 + exit ;;
1.482 + AViiON:dgux:*:*)
1.483 + # DG/UX returns AViiON for all architectures
1.484 + UNAME_PROCESSOR=`/usr/bin/uname -p`
1.485 + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
1.486 + then
1.487 + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
1.488 + [ ${TARGET_BINARY_INTERFACE}x = x ]
1.489 + then
1.490 + echo m88k-dg-dgux${UNAME_RELEASE}
1.491 + else
1.492 + echo m88k-dg-dguxbcs${UNAME_RELEASE}
1.493 + fi
1.494 + else
1.495 + echo i586-dg-dgux${UNAME_RELEASE}
1.496 + fi
1.497 + exit ;;
1.498 + M88*:DolphinOS:*:*) # DolphinOS (SVR3)
1.499 + echo m88k-dolphin-sysv3
1.500 + exit ;;
1.501 + M88*:*:R3*:*)
1.502 + # Delta 88k system running SVR3
1.503 + echo m88k-motorola-sysv3
1.504 + exit ;;
1.505 + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
1.506 + echo m88k-tektronix-sysv3
1.507 + exit ;;
1.508 + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
1.509 + echo m68k-tektronix-bsd
1.510 + exit ;;
1.511 + *:IRIX*:*:*)
1.512 + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
1.513 + exit ;;
1.514 + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
1.515 + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
1.516 + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
1.517 + i*86:AIX:*:*)
1.518 + echo i386-ibm-aix
1.519 + exit ;;
1.520 + ia64:AIX:*:*)
1.521 + if [ -x /usr/bin/oslevel ] ; then
1.522 + IBM_REV=`/usr/bin/oslevel`
1.523 + else
1.524 + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
1.525 + fi
1.526 + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
1.527 + exit ;;
1.528 + *:AIX:2:3)
1.529 + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
1.530 + eval $set_cc_for_build
1.531 + sed 's/^ //' << EOF >$dummy.c
1.532 + #include <sys/systemcfg.h>
1.533 +
1.534 + main()
1.535 + {
1.536 + if (!__power_pc())
1.537 + exit(1);
1.538 + puts("powerpc-ibm-aix3.2.5");
1.539 + exit(0);
1.540 + }
1.541 +EOF
1.542 + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
1.543 + then
1.544 + echo "$SYSTEM_NAME"
1.545 + else
1.546 + echo rs6000-ibm-aix3.2.5
1.547 + fi
1.548 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
1.549 + echo rs6000-ibm-aix3.2.4
1.550 + else
1.551 + echo rs6000-ibm-aix3.2
1.552 + fi
1.553 + exit ;;
1.554 + *:AIX:*:[456])
1.555 + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
1.556 + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
1.557 + IBM_ARCH=rs6000
1.558 + else
1.559 + IBM_ARCH=powerpc
1.560 + fi
1.561 + if [ -x /usr/bin/oslevel ] ; then
1.562 + IBM_REV=`/usr/bin/oslevel`
1.563 + else
1.564 + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
1.565 + fi
1.566 + echo ${IBM_ARCH}-ibm-aix${IBM_REV}
1.567 + exit ;;
1.568 + *:AIX:*:*)
1.569 + echo rs6000-ibm-aix
1.570 + exit ;;
1.571 + ibmrt:4.4BSD:*|romp-ibm:BSD:*)
1.572 + echo romp-ibm-bsd4.4
1.573 + exit ;;
1.574 + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
1.575 + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
1.576 + exit ;; # report: romp-ibm BSD 4.3
1.577 + *:BOSX:*:*)
1.578 + echo rs6000-bull-bosx
1.579 + exit ;;
1.580 + DPX/2?00:B.O.S.:*:*)
1.581 + echo m68k-bull-sysv3
1.582 + exit ;;
1.583 + 9000/[34]??:4.3bsd:1.*:*)
1.584 + echo m68k-hp-bsd
1.585 + exit ;;
1.586 + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
1.587 + echo m68k-hp-bsd4.4
1.588 + exit ;;
1.589 + 9000/[34678]??:HP-UX:*:*)
1.590 + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
1.591 + case "${UNAME_MACHINE}" in
1.592 + 9000/31? ) HP_ARCH=m68000 ;;
1.593 + 9000/[34]?? ) HP_ARCH=m68k ;;
1.594 + 9000/[678][0-9][0-9])
1.595 + if [ -x /usr/bin/getconf ]; then
1.596 + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
1.597 + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
1.598 + case "${sc_cpu_version}" in
1.599 + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
1.600 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
1.601 + 532) # CPU_PA_RISC2_0
1.602 + case "${sc_kernel_bits}" in
1.603 + 32) HP_ARCH="hppa2.0n" ;;
1.604 + 64) HP_ARCH="hppa2.0w" ;;
1.605 + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
1.606 + esac ;;
1.607 + esac
1.608 + fi
1.609 + if [ "${HP_ARCH}" = "" ]; then
1.610 + eval $set_cc_for_build
1.611 + sed 's/^ //' << EOF >$dummy.c
1.612 +
1.613 + #define _HPUX_SOURCE
1.614 + #include <stdlib.h>
1.615 + #include <unistd.h>
1.616 +
1.617 + int main ()
1.618 + {
1.619 + #if defined(_SC_KERNEL_BITS)
1.620 + long bits = sysconf(_SC_KERNEL_BITS);
1.621 + #endif
1.622 + long cpu = sysconf (_SC_CPU_VERSION);
1.623 +
1.624 + switch (cpu)
1.625 + {
1.626 + case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
1.627 + case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
1.628 + case CPU_PA_RISC2_0:
1.629 + #if defined(_SC_KERNEL_BITS)
1.630 + switch (bits)
1.631 + {
1.632 + case 64: puts ("hppa2.0w"); break;
1.633 + case 32: puts ("hppa2.0n"); break;
1.634 + default: puts ("hppa2.0"); break;
1.635 + } break;
1.636 + #else /* !defined(_SC_KERNEL_BITS) */
1.637 + puts ("hppa2.0"); break;
1.638 + #endif
1.639 + default: puts ("hppa1.0"); break;
1.640 + }
1.641 + exit (0);
1.642 + }
1.643 +EOF
1.644 + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
1.645 + test -z "$HP_ARCH" && HP_ARCH=hppa
1.646 + fi ;;
1.647 + esac
1.648 + if [ ${HP_ARCH} = "hppa2.0w" ]
1.649 + then
1.650 + eval $set_cc_for_build
1.651 +
1.652 + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
1.653 + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
1.654 + # generating 64-bit code. GNU and HP use different nomenclature:
1.655 + #
1.656 + # $ CC_FOR_BUILD=cc ./config.guess
1.657 + # => hppa2.0w-hp-hpux11.23
1.658 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
1.659 + # => hppa64-hp-hpux11.23
1.660 +
1.661 + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
1.662 + grep -q __LP64__
1.663 + then
1.664 + HP_ARCH="hppa2.0w"
1.665 + else
1.666 + HP_ARCH="hppa64"
1.667 + fi
1.668 + fi
1.669 + echo ${HP_ARCH}-hp-hpux${HPUX_REV}
1.670 + exit ;;
1.671 + ia64:HP-UX:*:*)
1.672 + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
1.673 + echo ia64-hp-hpux${HPUX_REV}
1.674 + exit ;;
1.675 + 3050*:HI-UX:*:*)
1.676 + eval $set_cc_for_build
1.677 + sed 's/^ //' << EOF >$dummy.c
1.678 + #include <unistd.h>
1.679 + int
1.680 + main ()
1.681 + {
1.682 + long cpu = sysconf (_SC_CPU_VERSION);
1.683 + /* The order matters, because CPU_IS_HP_MC68K erroneously returns
1.684 + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
1.685 + results, however. */
1.686 + if (CPU_IS_PA_RISC (cpu))
1.687 + {
1.688 + switch (cpu)
1.689 + {
1.690 + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
1.691 + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
1.692 + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
1.693 + default: puts ("hppa-hitachi-hiuxwe2"); break;
1.694 + }
1.695 + }
1.696 + else if (CPU_IS_HP_MC68K (cpu))
1.697 + puts ("m68k-hitachi-hiuxwe2");
1.698 + else puts ("unknown-hitachi-hiuxwe2");
1.699 + exit (0);
1.700 + }
1.701 +EOF
1.702 + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
1.703 + { echo "$SYSTEM_NAME"; exit; }
1.704 + echo unknown-hitachi-hiuxwe2
1.705 + exit ;;
1.706 + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
1.707 + echo hppa1.1-hp-bsd
1.708 + exit ;;
1.709 + 9000/8??:4.3bsd:*:*)
1.710 + echo hppa1.0-hp-bsd
1.711 + exit ;;
1.712 + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
1.713 + echo hppa1.0-hp-mpeix
1.714 + exit ;;
1.715 + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
1.716 + echo hppa1.1-hp-osf
1.717 + exit ;;
1.718 + hp8??:OSF1:*:*)
1.719 + echo hppa1.0-hp-osf
1.720 + exit ;;
1.721 + i*86:OSF1:*:*)
1.722 + if [ -x /usr/sbin/sysversion ] ; then
1.723 + echo ${UNAME_MACHINE}-unknown-osf1mk
1.724 + else
1.725 + echo ${UNAME_MACHINE}-unknown-osf1
1.726 + fi
1.727 + exit ;;
1.728 + parisc*:Lites*:*:*)
1.729 + echo hppa1.1-hp-lites
1.730 + exit ;;
1.731 + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
1.732 + echo c1-convex-bsd
1.733 + exit ;;
1.734 + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
1.735 + if getsysinfo -f scalar_acc
1.736 + then echo c32-convex-bsd
1.737 + else echo c2-convex-bsd
1.738 + fi
1.739 + exit ;;
1.740 + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
1.741 + echo c34-convex-bsd
1.742 + exit ;;
1.743 + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
1.744 + echo c38-convex-bsd
1.745 + exit ;;
1.746 + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
1.747 + echo c4-convex-bsd
1.748 + exit ;;
1.749 + CRAY*Y-MP:*:*:*)
1.750 + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
1.751 + exit ;;
1.752 + CRAY*[A-Z]90:*:*:*)
1.753 + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
1.754 + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
1.755 + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
1.756 + -e 's/\.[^.]*$/.X/'
1.757 + exit ;;
1.758 + CRAY*TS:*:*:*)
1.759 + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
1.760 + exit ;;
1.761 + CRAY*T3E:*:*:*)
1.762 + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
1.763 + exit ;;
1.764 + CRAY*SV1:*:*:*)
1.765 + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
1.766 + exit ;;
1.767 + *:UNICOS/mp:*:*)
1.768 + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
1.769 + exit ;;
1.770 + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
1.771 + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
1.772 + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
1.773 + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
1.774 + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
1.775 + exit ;;
1.776 + 5000:UNIX_System_V:4.*:*)
1.777 + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
1.778 + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
1.779 + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
1.780 + exit ;;
1.781 + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
1.782 + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
1.783 + exit ;;
1.784 + sparc*:BSD/OS:*:*)
1.785 + echo sparc-unknown-bsdi${UNAME_RELEASE}
1.786 + exit ;;
1.787 + *:BSD/OS:*:*)
1.788 + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
1.789 + exit ;;
1.790 + *:FreeBSD:*:*)
1.791 + case ${UNAME_MACHINE} in
1.792 + pc98)
1.793 + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
1.794 + amd64)
1.795 + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
1.796 + *)
1.797 + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
1.798 + esac
1.799 + exit ;;
1.800 + i*:CYGWIN*:*)
1.801 + echo ${UNAME_MACHINE}-pc-cygwin
1.802 + exit ;;
1.803 + *:MINGW*:*)
1.804 + echo ${UNAME_MACHINE}-pc-mingw32
1.805 + exit ;;
1.806 + i*:windows32*:*)
1.807 + # uname -m includes "-pc" on this system.
1.808 + echo ${UNAME_MACHINE}-mingw32
1.809 + exit ;;
1.810 + i*:PW*:*)
1.811 + echo ${UNAME_MACHINE}-pc-pw32
1.812 + exit ;;
1.813 + *:Interix*:[3456]*)
1.814 + case ${UNAME_MACHINE} in
1.815 + x86)
1.816 + echo i586-pc-interix${UNAME_RELEASE}
1.817 + exit ;;
1.818 + EM64T | authenticamd | genuineintel)
1.819 + echo x86_64-unknown-interix${UNAME_RELEASE}
1.820 + exit ;;
1.821 + IA64)
1.822 + echo ia64-unknown-interix${UNAME_RELEASE}
1.823 + exit ;;
1.824 + esac ;;
1.825 + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
1.826 + echo i${UNAME_MACHINE}-pc-mks
1.827 + exit ;;
1.828 + 8664:Windows_NT:*)
1.829 + echo x86_64-pc-mks
1.830 + exit ;;
1.831 + i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
1.832 + # How do we know it's Interix rather than the generic POSIX subsystem?
1.833 + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
1.834 + # UNAME_MACHINE based on the output of uname instead of i386?
1.835 + echo i586-pc-interix
1.836 + exit ;;
1.837 + i*:UWIN*:*)
1.838 + echo ${UNAME_MACHINE}-pc-uwin
1.839 + exit ;;
1.840 + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
1.841 + echo x86_64-unknown-cygwin
1.842 + exit ;;
1.843 + p*:CYGWIN*:*)
1.844 + echo powerpcle-unknown-cygwin
1.845 + exit ;;
1.846 + prep*:SunOS:5.*:*)
1.847 + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
1.848 + exit ;;
1.849 + *:GNU:*:*)
1.850 + # the GNU system
1.851 + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
1.852 + exit ;;
1.853 + *:GNU/*:*:*)
1.854 + # other systems with GNU libc and userland
1.855 + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
1.856 + exit ;;
1.857 + i*86:Minix:*:*)
1.858 + echo ${UNAME_MACHINE}-pc-minix
1.859 + exit ;;
1.860 + arm*:Linux:*:*)
1.861 + eval $set_cc_for_build
1.862 + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
1.863 + | grep -q __ARM_EABI__
1.864 + then
1.865 + echo ${UNAME_MACHINE}-unknown-linux-gnu
1.866 + else
1.867 + echo ${UNAME_MACHINE}-unknown-linux-gnueabi
1.868 + fi
1.869 + exit ;;
1.870 + avr32*:Linux:*:*)
1.871 + echo ${UNAME_MACHINE}-unknown-linux-gnu
1.872 + exit ;;
1.873 + cris:Linux:*:*)
1.874 + echo cris-axis-linux-gnu
1.875 + exit ;;
1.876 + crisv32:Linux:*:*)
1.877 + echo crisv32-axis-linux-gnu
1.878 + exit ;;
1.879 + frv:Linux:*:*)
1.880 + echo frv-unknown-linux-gnu
1.881 + exit ;;
1.882 + ia64:Linux:*:*)
1.883 + echo ${UNAME_MACHINE}-unknown-linux-gnu
1.884 + exit ;;
1.885 + m32r*:Linux:*:*)
1.886 + echo ${UNAME_MACHINE}-unknown-linux-gnu
1.887 + exit ;;
1.888 + m68*:Linux:*:*)
1.889 + echo ${UNAME_MACHINE}-unknown-linux-gnu
1.890 + exit ;;
1.891 + mips:Linux:*:* | mips64:Linux:*:*)
1.892 + eval $set_cc_for_build
1.893 + sed 's/^ //' << EOF >$dummy.c
1.894 + #undef CPU
1.895 + #undef ${UNAME_MACHINE}
1.896 + #undef ${UNAME_MACHINE}el
1.897 + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
1.898 + CPU=${UNAME_MACHINE}el
1.899 + #else
1.900 + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
1.901 + CPU=${UNAME_MACHINE}
1.902 + #else
1.903 + CPU=
1.904 + #endif
1.905 + #endif
1.906 +EOF
1.907 + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
1.908 + /^CPU/{
1.909 + s: ::g
1.910 + p
1.911 + }'`"
1.912 + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
1.913 + ;;
1.914 + or32:Linux:*:*)
1.915 + echo or32-unknown-linux-gnu
1.916 + exit ;;
1.917 + ppc:Linux:*:*)
1.918 + echo powerpc-unknown-linux-gnu
1.919 + exit ;;
1.920 + ppc64:Linux:*:*)
1.921 + echo powerpc64-unknown-linux-gnu
1.922 + exit ;;
1.923 + alpha:Linux:*:*)
1.924 + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
1.925 + EV5) UNAME_MACHINE=alphaev5 ;;
1.926 + EV56) UNAME_MACHINE=alphaev56 ;;
1.927 + PCA56) UNAME_MACHINE=alphapca56 ;;
1.928 + PCA57) UNAME_MACHINE=alphapca56 ;;
1.929 + EV6) UNAME_MACHINE=alphaev6 ;;
1.930 + EV67) UNAME_MACHINE=alphaev67 ;;
1.931 + EV68*) UNAME_MACHINE=alphaev68 ;;
1.932 + esac
1.933 + objdump --private-headers /bin/sh | grep -q ld.so.1
1.934 + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
1.935 + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
1.936 + exit ;;
1.937 + padre:Linux:*:*)
1.938 + echo sparc-unknown-linux-gnu
1.939 + exit ;;
1.940 + parisc:Linux:*:* | hppa:Linux:*:*)
1.941 + # Look for CPU level
1.942 + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
1.943 + PA7*) echo hppa1.1-unknown-linux-gnu ;;
1.944 + PA8*) echo hppa2.0-unknown-linux-gnu ;;
1.945 + *) echo hppa-unknown-linux-gnu ;;
1.946 + esac
1.947 + exit ;;
1.948 + parisc64:Linux:*:* | hppa64:Linux:*:*)
1.949 + echo hppa64-unknown-linux-gnu
1.950 + exit ;;
1.951 + s390:Linux:*:* | s390x:Linux:*:*)
1.952 + echo ${UNAME_MACHINE}-ibm-linux
1.953 + exit ;;
1.954 + sh64*:Linux:*:*)
1.955 + echo ${UNAME_MACHINE}-unknown-linux-gnu
1.956 + exit ;;
1.957 + sh*:Linux:*:*)
1.958 + echo ${UNAME_MACHINE}-unknown-linux-gnu
1.959 + exit ;;
1.960 + sparc:Linux:*:* | sparc64:Linux:*:*)
1.961 + echo ${UNAME_MACHINE}-unknown-linux-gnu
1.962 + exit ;;
1.963 + vax:Linux:*:*)
1.964 + echo ${UNAME_MACHINE}-dec-linux-gnu
1.965 + exit ;;
1.966 + x86_64:Linux:*:*)
1.967 + echo x86_64-unknown-linux-gnu
1.968 + exit ;;
1.969 + xtensa*:Linux:*:*)
1.970 + echo ${UNAME_MACHINE}-unknown-linux-gnu
1.971 + exit ;;
1.972 + i*86:Linux:*:*)
1.973 + # The BFD linker knows what the default object file format is, so
1.974 + # first see if it will tell us. cd to the root directory to prevent
1.975 + # problems with other programs or directories called `ld' in the path.
1.976 + # Set LC_ALL=C to ensure ld outputs messages in English.
1.977 + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
1.978 + | sed -ne '/supported targets:/!d
1.979 + s/[ ][ ]*/ /g
1.980 + s/.*supported targets: *//
1.981 + s/ .*//
1.982 + p'`
1.983 + case "$ld_supported_targets" in
1.984 + elf32-i386)
1.985 + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
1.986 + ;;
1.987 + esac
1.988 + # Determine whether the default compiler is a.out or elf
1.989 + eval $set_cc_for_build
1.990 + sed 's/^ //' << EOF >$dummy.c
1.991 + #include <features.h>
1.992 + #ifdef __ELF__
1.993 + # ifdef __GLIBC__
1.994 + # if __GLIBC__ >= 2
1.995 + LIBC=gnu
1.996 + # else
1.997 + LIBC=gnulibc1
1.998 + # endif
1.999 + # else
1.1000 + LIBC=gnulibc1
1.1001 + # endif
1.1002 + #else
1.1003 + #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
1.1004 + LIBC=gnu
1.1005 + #else
1.1006 + LIBC=gnuaout
1.1007 + #endif
1.1008 + #endif
1.1009 + #ifdef __dietlibc__
1.1010 + LIBC=dietlibc
1.1011 + #endif
1.1012 +EOF
1.1013 + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
1.1014 + /^LIBC/{
1.1015 + s: ::g
1.1016 + p
1.1017 + }'`"
1.1018 + test x"${LIBC}" != x && {
1.1019 + echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
1.1020 + exit
1.1021 + }
1.1022 + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
1.1023 + ;;
1.1024 + i*86:DYNIX/ptx:4*:*)
1.1025 + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1.1026 + # earlier versions are messed up and put the nodename in both
1.1027 + # sysname and nodename.
1.1028 + echo i386-sequent-sysv4
1.1029 + exit ;;
1.1030 + i*86:UNIX_SV:4.2MP:2.*)
1.1031 + # Unixware is an offshoot of SVR4, but it has its own version
1.1032 + # number series starting with 2...
1.1033 + # I am not positive that other SVR4 systems won't match this,
1.1034 + # I just have to hope. -- rms.
1.1035 + # Use sysv4.2uw... so that sysv4* matches it.
1.1036 + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
1.1037 + exit ;;
1.1038 + i*86:OS/2:*:*)
1.1039 + # If we were able to find `uname', then EMX Unix compatibility
1.1040 + # is probably installed.
1.1041 + echo ${UNAME_MACHINE}-pc-os2-emx
1.1042 + exit ;;
1.1043 + i*86:XTS-300:*:STOP)
1.1044 + echo ${UNAME_MACHINE}-unknown-stop
1.1045 + exit ;;
1.1046 + i*86:atheos:*:*)
1.1047 + echo ${UNAME_MACHINE}-unknown-atheos
1.1048 + exit ;;
1.1049 + i*86:syllable:*:*)
1.1050 + echo ${UNAME_MACHINE}-pc-syllable
1.1051 + exit ;;
1.1052 + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1.1053 + echo i386-unknown-lynxos${UNAME_RELEASE}
1.1054 + exit ;;
1.1055 + i*86:*DOS:*:*)
1.1056 + echo ${UNAME_MACHINE}-pc-msdosdjgpp
1.1057 + exit ;;
1.1058 + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
1.1059 + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
1.1060 + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1.1061 + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
1.1062 + else
1.1063 + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
1.1064 + fi
1.1065 + exit ;;
1.1066 + i*86:*:5:[678]*)
1.1067 + # UnixWare 7.x, OpenUNIX and OpenServer 6.
1.1068 + case `/bin/uname -X | grep "^Machine"` in
1.1069 + *486*) UNAME_MACHINE=i486 ;;
1.1070 + *Pentium) UNAME_MACHINE=i586 ;;
1.1071 + *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1.1072 + esac
1.1073 + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1.1074 + exit ;;
1.1075 + i*86:*:3.2:*)
1.1076 + if test -f /usr/options/cb.name; then
1.1077 + UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1.1078 + echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
1.1079 + elif /bin/uname -X 2>/dev/null >/dev/null ; then
1.1080 + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1.1081 + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1.1082 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1.1083 + && UNAME_MACHINE=i586
1.1084 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1.1085 + && UNAME_MACHINE=i686
1.1086 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1.1087 + && UNAME_MACHINE=i686
1.1088 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
1.1089 + else
1.1090 + echo ${UNAME_MACHINE}-pc-sysv32
1.1091 + fi
1.1092 + exit ;;
1.1093 + pc:*:*:*)
1.1094 + # Left here for compatibility:
1.1095 + # uname -m prints for DJGPP always 'pc', but it prints nothing about
1.1096 + # the processor, so we play safe by assuming i586.
1.1097 + # Note: whatever this is, it MUST be the same as what config.sub
1.1098 + # prints for the "djgpp" host, or else GDB configury will decide that
1.1099 + # this is a cross-build.
1.1100 + echo i586-pc-msdosdjgpp
1.1101 + exit ;;
1.1102 + Intel:Mach:3*:*)
1.1103 + echo i386-pc-mach3
1.1104 + exit ;;
1.1105 + paragon:*:*:*)
1.1106 + echo i860-intel-osf1
1.1107 + exit ;;
1.1108 + i860:*:4.*:*) # i860-SVR4
1.1109 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1.1110 + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
1.1111 + else # Add other i860-SVR4 vendors below as they are discovered.
1.1112 + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
1.1113 + fi
1.1114 + exit ;;
1.1115 + mini*:CTIX:SYS*5:*)
1.1116 + # "miniframe"
1.1117 + echo m68010-convergent-sysv
1.1118 + exit ;;
1.1119 + mc68k:UNIX:SYSTEM5:3.51m)
1.1120 + echo m68k-convergent-sysv
1.1121 + exit ;;
1.1122 + M680?0:D-NIX:5.3:*)
1.1123 + echo m68k-diab-dnix
1.1124 + exit ;;
1.1125 + M68*:*:R3V[5678]*:*)
1.1126 + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1.1127 + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
1.1128 + OS_REL=''
1.1129 + test -r /etc/.relid \
1.1130 + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1.1131 + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1.1132 + && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1.1133 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1.1134 + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1.1135 + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1.1136 + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1.1137 + && { echo i486-ncr-sysv4; exit; } ;;
1.1138 + NCR*:*:4.2:* | MPRAS*:*:4.2:*)
1.1139 + OS_REL='.3'
1.1140 + test -r /etc/.relid \
1.1141 + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1.1142 + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1.1143 + && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1.1144 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1.1145 + && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
1.1146 + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1.1147 + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1.1148 + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1.1149 + echo m68k-unknown-lynxos${UNAME_RELEASE}
1.1150 + exit ;;
1.1151 + mc68030:UNIX_System_V:4.*:*)
1.1152 + echo m68k-atari-sysv4
1.1153 + exit ;;
1.1154 + TSUNAMI:LynxOS:2.*:*)
1.1155 + echo sparc-unknown-lynxos${UNAME_RELEASE}
1.1156 + exit ;;
1.1157 + rs6000:LynxOS:2.*:*)
1.1158 + echo rs6000-unknown-lynxos${UNAME_RELEASE}
1.1159 + exit ;;
1.1160 + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1.1161 + echo powerpc-unknown-lynxos${UNAME_RELEASE}
1.1162 + exit ;;
1.1163 + SM[BE]S:UNIX_SV:*:*)
1.1164 + echo mips-dde-sysv${UNAME_RELEASE}
1.1165 + exit ;;
1.1166 + RM*:ReliantUNIX-*:*:*)
1.1167 + echo mips-sni-sysv4
1.1168 + exit ;;
1.1169 + RM*:SINIX-*:*:*)
1.1170 + echo mips-sni-sysv4
1.1171 + exit ;;
1.1172 + *:SINIX-*:*:*)
1.1173 + if uname -p 2>/dev/null >/dev/null ; then
1.1174 + UNAME_MACHINE=`(uname -p) 2>/dev/null`
1.1175 + echo ${UNAME_MACHINE}-sni-sysv4
1.1176 + else
1.1177 + echo ns32k-sni-sysv
1.1178 + fi
1.1179 + exit ;;
1.1180 + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1.1181 + # says <[email protected]>
1.1182 + echo i586-unisys-sysv4
1.1183 + exit ;;
1.1184 + *:UNIX_System_V:4*:FTX*)
1.1185 + # From Gerald Hewes <[email protected]>.
1.1186 + # How about differentiating between stratus architectures? -djm
1.1187 + echo hppa1.1-stratus-sysv4
1.1188 + exit ;;
1.1189 + *:*:*:FTX*)
1.1190 + # From [email protected].
1.1191 + echo i860-stratus-sysv4
1.1192 + exit ;;
1.1193 + i*86:VOS:*:*)
1.1194 + # From [email protected].
1.1195 + echo ${UNAME_MACHINE}-stratus-vos
1.1196 + exit ;;
1.1197 + *:VOS:*:*)
1.1198 + # From [email protected].
1.1199 + echo hppa1.1-stratus-vos
1.1200 + exit ;;
1.1201 + mc68*:A/UX:*:*)
1.1202 + echo m68k-apple-aux${UNAME_RELEASE}
1.1203 + exit ;;
1.1204 + news*:NEWS-OS:6*:*)
1.1205 + echo mips-sony-newsos6
1.1206 + exit ;;
1.1207 + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1.1208 + if [ -d /usr/nec ]; then
1.1209 + echo mips-nec-sysv${UNAME_RELEASE}
1.1210 + else
1.1211 + echo mips-unknown-sysv${UNAME_RELEASE}
1.1212 + fi
1.1213 + exit ;;
1.1214 + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
1.1215 + echo powerpc-be-beos
1.1216 + exit ;;
1.1217 + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
1.1218 + echo powerpc-apple-beos
1.1219 + exit ;;
1.1220 + BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
1.1221 + echo i586-pc-beos
1.1222 + exit ;;
1.1223 + BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
1.1224 + echo i586-pc-haiku
1.1225 + exit ;;
1.1226 + SX-4:SUPER-UX:*:*)
1.1227 + echo sx4-nec-superux${UNAME_RELEASE}
1.1228 + exit ;;
1.1229 + SX-5:SUPER-UX:*:*)
1.1230 + echo sx5-nec-superux${UNAME_RELEASE}
1.1231 + exit ;;
1.1232 + SX-6:SUPER-UX:*:*)
1.1233 + echo sx6-nec-superux${UNAME_RELEASE}
1.1234 + exit ;;
1.1235 + SX-7:SUPER-UX:*:*)
1.1236 + echo sx7-nec-superux${UNAME_RELEASE}
1.1237 + exit ;;
1.1238 + SX-8:SUPER-UX:*:*)
1.1239 + echo sx8-nec-superux${UNAME_RELEASE}
1.1240 + exit ;;
1.1241 + SX-8R:SUPER-UX:*:*)
1.1242 + echo sx8r-nec-superux${UNAME_RELEASE}
1.1243 + exit ;;
1.1244 + Power*:Rhapsody:*:*)
1.1245 + echo powerpc-apple-rhapsody${UNAME_RELEASE}
1.1246 + exit ;;
1.1247 + *:Rhapsody:*:*)
1.1248 + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
1.1249 + exit ;;
1.1250 + *:Darwin:*:*)
1.1251 + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1.1252 + case $UNAME_PROCESSOR in
1.1253 + i386) eval $set_cc_for_build
1.1254 + if $CC_FOR_BUILD -E -dM -x c /dev/null | grep __LP64__>/dev/null 2>&1 ; then
1.1255 + UNAME_PROCESSOR=x86_64
1.1256 + fi ;;
1.1257 + unknown) UNAME_PROCESSOR=powerpc ;;
1.1258 + esac
1.1259 + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
1.1260 + exit ;;
1.1261 + *:procnto*:*:* | *:QNX:[0123456789]*:*)
1.1262 + UNAME_PROCESSOR=`uname -p`
1.1263 + if test "$UNAME_PROCESSOR" = "x86"; then
1.1264 + UNAME_PROCESSOR=i386
1.1265 + UNAME_MACHINE=pc
1.1266 + fi
1.1267 + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
1.1268 + exit ;;
1.1269 + *:QNX:*:4*)
1.1270 + echo i386-pc-qnx
1.1271 + exit ;;
1.1272 + NSE-?:NONSTOP_KERNEL:*:*)
1.1273 + echo nse-tandem-nsk${UNAME_RELEASE}
1.1274 + exit ;;
1.1275 + NSR-?:NONSTOP_KERNEL:*:*)
1.1276 + echo nsr-tandem-nsk${UNAME_RELEASE}
1.1277 + exit ;;
1.1278 + *:NonStop-UX:*:*)
1.1279 + echo mips-compaq-nonstopux
1.1280 + exit ;;
1.1281 + BS2000:POSIX*:*:*)
1.1282 + echo bs2000-siemens-sysv
1.1283 + exit ;;
1.1284 + DS/*:UNIX_System_V:*:*)
1.1285 + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
1.1286 + exit ;;
1.1287 + *:Plan9:*:*)
1.1288 + # "uname -m" is not consistent, so use $cputype instead. 386
1.1289 + # is converted to i386 for consistency with other x86
1.1290 + # operating systems.
1.1291 + if test "$cputype" = "386"; then
1.1292 + UNAME_MACHINE=i386
1.1293 + else
1.1294 + UNAME_MACHINE="$cputype"
1.1295 + fi
1.1296 + echo ${UNAME_MACHINE}-unknown-plan9
1.1297 + exit ;;
1.1298 + *:TOPS-10:*:*)
1.1299 + echo pdp10-unknown-tops10
1.1300 + exit ;;
1.1301 + *:TENEX:*:*)
1.1302 + echo pdp10-unknown-tenex
1.1303 + exit ;;
1.1304 + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1.1305 + echo pdp10-dec-tops20
1.1306 + exit ;;
1.1307 + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1.1308 + echo pdp10-xkl-tops20
1.1309 + exit ;;
1.1310 + *:TOPS-20:*:*)
1.1311 + echo pdp10-unknown-tops20
1.1312 + exit ;;
1.1313 + *:ITS:*:*)
1.1314 + echo pdp10-unknown-its
1.1315 + exit ;;
1.1316 + SEI:*:*:SEIUX)
1.1317 + echo mips-sei-seiux${UNAME_RELEASE}
1.1318 + exit ;;
1.1319 + *:DragonFly:*:*)
1.1320 + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
1.1321 + exit ;;
1.1322 + *:*VMS:*:*)
1.1323 + UNAME_MACHINE=`(uname -p) 2>/dev/null`
1.1324 + case "${UNAME_MACHINE}" in
1.1325 + A*) echo alpha-dec-vms ; exit ;;
1.1326 + I*) echo ia64-dec-vms ; exit ;;
1.1327 + V*) echo vax-dec-vms ; exit ;;
1.1328 + esac ;;
1.1329 + *:XENIX:*:SysV)
1.1330 + echo i386-pc-xenix
1.1331 + exit ;;
1.1332 + i*86:skyos:*:*)
1.1333 + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
1.1334 + exit ;;
1.1335 + i*86:rdos:*:*)
1.1336 + echo ${UNAME_MACHINE}-pc-rdos
1.1337 + exit ;;
1.1338 + i*86:AROS:*:*)
1.1339 + echo ${UNAME_MACHINE}-pc-aros
1.1340 + exit ;;
1.1341 +esac
1.1342 +
1.1343 +#echo '(No uname command or uname output not recognized.)' 1>&2
1.1344 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
1.1345 +
1.1346 +eval $set_cc_for_build
1.1347 +cat >$dummy.c <<EOF
1.1348 +#ifdef _SEQUENT_
1.1349 +# include <sys/types.h>
1.1350 +# include <sys/utsname.h>
1.1351 +#endif
1.1352 +main ()
1.1353 +{
1.1354 +#if defined (sony)
1.1355 +#if defined (MIPSEB)
1.1356 + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
1.1357 + I don't know.... */
1.1358 + printf ("mips-sony-bsd\n"); exit (0);
1.1359 +#else
1.1360 +#include <sys/param.h>
1.1361 + printf ("m68k-sony-newsos%s\n",
1.1362 +#ifdef NEWSOS4
1.1363 + "4"
1.1364 +#else
1.1365 + ""
1.1366 +#endif
1.1367 + ); exit (0);
1.1368 +#endif
1.1369 +#endif
1.1370 +
1.1371 +#if defined (__arm) && defined (__acorn) && defined (__unix)
1.1372 + printf ("arm-acorn-riscix\n"); exit (0);
1.1373 +#endif
1.1374 +
1.1375 +#if defined (hp300) && !defined (hpux)
1.1376 + printf ("m68k-hp-bsd\n"); exit (0);
1.1377 +#endif
1.1378 +
1.1379 +#if defined (NeXT)
1.1380 +#if !defined (__ARCHITECTURE__)
1.1381 +#define __ARCHITECTURE__ "m68k"
1.1382 +#endif
1.1383 + int version;
1.1384 + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1.1385 + if (version < 4)
1.1386 + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1.1387 + else
1.1388 + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1.1389 + exit (0);
1.1390 +#endif
1.1391 +
1.1392 +#if defined (MULTIMAX) || defined (n16)
1.1393 +#if defined (UMAXV)
1.1394 + printf ("ns32k-encore-sysv\n"); exit (0);
1.1395 +#else
1.1396 +#if defined (CMU)
1.1397 + printf ("ns32k-encore-mach\n"); exit (0);
1.1398 +#else
1.1399 + printf ("ns32k-encore-bsd\n"); exit (0);
1.1400 +#endif
1.1401 +#endif
1.1402 +#endif
1.1403 +
1.1404 +#if defined (__386BSD__)
1.1405 + printf ("i386-pc-bsd\n"); exit (0);
1.1406 +#endif
1.1407 +
1.1408 +#if defined (sequent)
1.1409 +#if defined (i386)
1.1410 + printf ("i386-sequent-dynix\n"); exit (0);
1.1411 +#endif
1.1412 +#if defined (ns32000)
1.1413 + printf ("ns32k-sequent-dynix\n"); exit (0);
1.1414 +#endif
1.1415 +#endif
1.1416 +
1.1417 +#if defined (_SEQUENT_)
1.1418 + struct utsname un;
1.1419 +
1.1420 + uname(&un);
1.1421 +
1.1422 + if (strncmp(un.version, "V2", 2) == 0) {
1.1423 + printf ("i386-sequent-ptx2\n"); exit (0);
1.1424 + }
1.1425 + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1.1426 + printf ("i386-sequent-ptx1\n"); exit (0);
1.1427 + }
1.1428 + printf ("i386-sequent-ptx\n"); exit (0);
1.1429 +
1.1430 +#endif
1.1431 +
1.1432 +#if defined (vax)
1.1433 +# if !defined (ultrix)
1.1434 +# include <sys/param.h>
1.1435 +# if defined (BSD)
1.1436 +# if BSD == 43
1.1437 + printf ("vax-dec-bsd4.3\n"); exit (0);
1.1438 +# else
1.1439 +# if BSD == 199006
1.1440 + printf ("vax-dec-bsd4.3reno\n"); exit (0);
1.1441 +# else
1.1442 + printf ("vax-dec-bsd\n"); exit (0);
1.1443 +# endif
1.1444 +# endif
1.1445 +# else
1.1446 + printf ("vax-dec-bsd\n"); exit (0);
1.1447 +# endif
1.1448 +# else
1.1449 + printf ("vax-dec-ultrix\n"); exit (0);
1.1450 +# endif
1.1451 +#endif
1.1452 +
1.1453 +#if defined (alliant) && defined (i860)
1.1454 + printf ("i860-alliant-bsd\n"); exit (0);
1.1455 +#endif
1.1456 +
1.1457 + exit (1);
1.1458 +}
1.1459 +EOF
1.1460 +
1.1461 +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
1.1462 + { echo "$SYSTEM_NAME"; exit; }
1.1463 +
1.1464 +# Apollos put the system type in the environment.
1.1465 +
1.1466 +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
1.1467 +
1.1468 +# Convex versions that predate uname can use getsysinfo(1)
1.1469 +
1.1470 +if [ -x /usr/convex/getsysinfo ]
1.1471 +then
1.1472 + case `getsysinfo -f cpu_type` in
1.1473 + c1*)
1.1474 + echo c1-convex-bsd
1.1475 + exit ;;
1.1476 + c2*)
1.1477 + if getsysinfo -f scalar_acc
1.1478 + then echo c32-convex-bsd
1.1479 + else echo c2-convex-bsd
1.1480 + fi
1.1481 + exit ;;
1.1482 + c34*)
1.1483 + echo c34-convex-bsd
1.1484 + exit ;;
1.1485 + c38*)
1.1486 + echo c38-convex-bsd
1.1487 + exit ;;
1.1488 + c4*)
1.1489 + echo c4-convex-bsd
1.1490 + exit ;;
1.1491 + esac
1.1492 +fi
1.1493 +
1.1494 +cat >&2 <<EOF
1.1495 +$0: unable to guess system type
1.1496 +
1.1497 +This script, last modified $timestamp, has failed to recognize
1.1498 +the operating system you are using. It is advised that you
1.1499 +download the most up to date version of the config scripts from
1.1500 +
1.1501 + http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
1.1502 +and
1.1503 + http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
1.1504 +
1.1505 +If the version you run ($0) is already up to date, please
1.1506 +send the following data and any information you think might be
1.1507 +pertinent to <[email protected]> in order to provide the needed
1.1508 +information to handle your system.
1.1509 +
1.1510 +config.guess timestamp = $timestamp
1.1511 +
1.1512 +uname -m = `(uname -m) 2>/dev/null || echo unknown`
1.1513 +uname -r = `(uname -r) 2>/dev/null || echo unknown`
1.1514 +uname -s = `(uname -s) 2>/dev/null || echo unknown`
1.1515 +uname -v = `(uname -v) 2>/dev/null || echo unknown`
1.1516 +
1.1517 +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1.1518 +/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
1.1519 +
1.1520 +hostinfo = `(hostinfo) 2>/dev/null`
1.1521 +/bin/universe = `(/bin/universe) 2>/dev/null`
1.1522 +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
1.1523 +/bin/arch = `(/bin/arch) 2>/dev/null`
1.1524 +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
1.1525 +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1.1526 +
1.1527 +UNAME_MACHINE = ${UNAME_MACHINE}
1.1528 +UNAME_RELEASE = ${UNAME_RELEASE}
1.1529 +UNAME_SYSTEM = ${UNAME_SYSTEM}
1.1530 +UNAME_VERSION = ${UNAME_VERSION}
1.1531 +EOF
1.1532 +
1.1533 +exit 1
1.1534 +
1.1535 +# Local variables:
1.1536 +# eval: (add-hook 'write-file-hooks 'time-stamp)
1.1537 +# time-stamp-start: "timestamp='"
1.1538 +# time-stamp-format: "%:y-%02m-%02d"
1.1539 +# time-stamp-end: "'"
1.1540 +# End:
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/build/autoconf/config.sub Mon Jul 02 23:37:12 2012 -0700
2.3 @@ -0,0 +1,1702 @@
2.4 +#! /bin/sh
2.5 +# Configuration validation subroutine script.
2.6 +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2.7 +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
2.8 +# Free Software Foundation, Inc.
2.9 +
2.10 +timestamp='2009-12-04'
2.11 +
2.12 +# This file is (in principle) common to ALL GNU software.
2.13 +# The presence of a machine in this file suggests that SOME GNU software
2.14 +# can handle that machine. It does not imply ALL GNU software can.
2.15 +#
2.16 +# This file is free software; you can redistribute it and/or modify
2.17 +# it under the terms of the GNU General Public License as published by
2.18 +# the Free Software Foundation; either version 2 of the License, or
2.19 +# (at your option) any later version.
2.20 +#
2.21 +# This program is distributed in the hope that it will be useful,
2.22 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
2.23 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2.24 +# GNU General Public License for more details.
2.25 +#
2.26 +# You should have received a copy of the GNU General Public License
2.27 +# along with this program; if not, write to the Free Software
2.28 +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
2.29 +# 02110-1301, USA.
2.30 +#
2.31 +# As a special exception to the GNU General Public License, if you
2.32 +# distribute this file as part of a program that contains a
2.33 +# configuration script generated by Autoconf, you may include it under
2.34 +# the same distribution terms that you use for the rest of that program.
2.35 +
2.36 +
2.37 +# Please send patches to <[email protected]>. Submit a context
2.38 +# diff and a properly formatted GNU ChangeLog entry.
2.39 +#
2.40 +# Configuration subroutine to validate and canonicalize a configuration type.
2.41 +# Supply the specified configuration type as an argument.
2.42 +# If it is invalid, we print an error message on stderr and exit with code 1.
2.43 +# Otherwise, we print the canonical config type on stdout and succeed.
2.44 +
2.45 +# You can get the latest version of this script from:
2.46 +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
2.47 +
2.48 +# This file is supposed to be the same for all GNU packages
2.49 +# and recognize all the CPU types, system types and aliases
2.50 +# that are meaningful with *any* GNU software.
2.51 +# Each package is responsible for reporting which valid configurations
2.52 +# it does not support. The user should be able to distinguish
2.53 +# a failure to support a valid configuration from a meaningless
2.54 +# configuration.
2.55 +
2.56 +# The goal of this file is to map all the various variations of a given
2.57 +# machine specification into a single specification in the form:
2.58 +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
2.59 +# or in some cases, the newer four-part form:
2.60 +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
2.61 +# It is wrong to echo any other type of specification.
2.62 +
2.63 +me=`echo "$0" | sed -e 's,.*/,,'`
2.64 +
2.65 +usage="\
2.66 +Usage: $0 [OPTION] CPU-MFR-OPSYS
2.67 + $0 [OPTION] ALIAS
2.68 +
2.69 +Canonicalize a configuration name.
2.70 +
2.71 +Operation modes:
2.72 + -h, --help print this help, then exit
2.73 + -t, --time-stamp print date of last modification, then exit
2.74 + -v, --version print version number, then exit
2.75 +
2.76 +Report bugs and patches to <[email protected]>."
2.77 +
2.78 +version="\
2.79 +GNU config.sub ($timestamp)
2.80 +
2.81 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2.82 +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
2.83 +
2.84 +This is free software; see the source for copying conditions. There is NO
2.85 +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
2.86 +
2.87 +help="
2.88 +Try \`$me --help' for more information."
2.89 +
2.90 +# Parse command line
2.91 +while test $# -gt 0 ; do
2.92 + case $1 in
2.93 + --time-stamp | --time* | -t )
2.94 + echo "$timestamp" ; exit ;;
2.95 + --version | -v )
2.96 + echo "$version" ; exit ;;
2.97 + --help | --h* | -h )
2.98 + echo "$usage"; exit ;;
2.99 + -- ) # Stop option processing
2.100 + shift; break ;;
2.101 + - ) # Use stdin as input.
2.102 + break ;;
2.103 + -* )
2.104 + echo "$me: invalid option $1$help"
2.105 + exit 1 ;;
2.106 +
2.107 + *local*)
2.108 + # First pass through any local machine types.
2.109 + echo $1
2.110 + exit ;;
2.111 +
2.112 + * )
2.113 + break ;;
2.114 + esac
2.115 +done
2.116 +
2.117 +case $# in
2.118 + 0) echo "$me: missing argument$help" >&2
2.119 + exit 1;;
2.120 + 1) ;;
2.121 + *) echo "$me: too many arguments$help" >&2
2.122 + exit 1;;
2.123 +esac
2.124 +
2.125 +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
2.126 +# Here we must recognize all the valid KERNEL-OS combinations.
2.127 +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
2.128 +case $maybe_os in
2.129 + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
2.130 + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
2.131 + kopensolaris*-gnu* | \
2.132 + storm-chaos* | os2-emx* | rtmk-nova* | wince-winmo*)
2.133 + os=-$maybe_os
2.134 + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
2.135 + ;;
2.136 + *)
2.137 + basic_machine=`echo $1 | sed 's/-[^-]*$//'`
2.138 + if [ $basic_machine != $1 ]
2.139 + then os=`echo $1 | sed 's/.*-/-/'`
2.140 + else os=; fi
2.141 + ;;
2.142 +esac
2.143 +
2.144 +### Let's recognize common machines as not being operating systems so
2.145 +### that things like config.sub decstation-3100 work. We also
2.146 +### recognize some manufacturers as not being operating systems, so we
2.147 +### can provide default operating systems below.
2.148 +case $os in
2.149 + -sun*os*)
2.150 + # Prevent following clause from handling this invalid input.
2.151 + ;;
2.152 + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
2.153 + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
2.154 + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
2.155 + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
2.156 + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
2.157 + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
2.158 + -apple | -axis | -knuth | -cray | -microblaze)
2.159 + os=
2.160 + basic_machine=$1
2.161 + ;;
2.162 + -bluegene*)
2.163 + os=-cnk
2.164 + ;;
2.165 + -sim | -cisco | -oki | -wec | -winbond)
2.166 + os=
2.167 + basic_machine=$1
2.168 + ;;
2.169 + -scout)
2.170 + ;;
2.171 + -wrs)
2.172 + os=-vxworks
2.173 + basic_machine=$1
2.174 + ;;
2.175 + -chorusos*)
2.176 + os=-chorusos
2.177 + basic_machine=$1
2.178 + ;;
2.179 + -chorusrdb)
2.180 + os=-chorusrdb
2.181 + basic_machine=$1
2.182 + ;;
2.183 + -hiux*)
2.184 + os=-hiuxwe2
2.185 + ;;
2.186 + -sco6)
2.187 + os=-sco5v6
2.188 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
2.189 + ;;
2.190 + -sco5)
2.191 + os=-sco3.2v5
2.192 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
2.193 + ;;
2.194 + -sco4)
2.195 + os=-sco3.2v4
2.196 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
2.197 + ;;
2.198 + -sco3.2.[4-9]*)
2.199 + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
2.200 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
2.201 + ;;
2.202 + -sco3.2v[4-9]*)
2.203 + # Don't forget version if it is 3.2v4 or newer.
2.204 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
2.205 + ;;
2.206 + -sco5v6*)
2.207 + # Don't forget version if it is 3.2v4 or newer.
2.208 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
2.209 + ;;
2.210 + -sco*)
2.211 + os=-sco3.2v2
2.212 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
2.213 + ;;
2.214 + -udk*)
2.215 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
2.216 + ;;
2.217 + -isc)
2.218 + os=-isc2.2
2.219 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
2.220 + ;;
2.221 + -clix*)
2.222 + basic_machine=clipper-intergraph
2.223 + ;;
2.224 + -isc*)
2.225 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
2.226 + ;;
2.227 + -lynx*)
2.228 + os=-lynxos
2.229 + ;;
2.230 + -ptx*)
2.231 + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
2.232 + ;;
2.233 + -windowsnt*)
2.234 + os=`echo $os | sed -e 's/windowsnt/winnt/'`
2.235 + ;;
2.236 + -psos*)
2.237 + os=-psos
2.238 + ;;
2.239 + -mint | -mint[0-9]*)
2.240 + basic_machine=m68k-atari
2.241 + os=-mint
2.242 + ;;
2.243 +esac
2.244 +
2.245 +# Decode aliases for certain CPU-COMPANY combinations.
2.246 +case $basic_machine in
2.247 + # Recognize the basic CPU types without company name.
2.248 + # Some are omitted here because they have special meanings below.
2.249 + 1750a | 580 \
2.250 + | a29k \
2.251 + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
2.252 + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
2.253 + | am33_2.0 \
2.254 + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
2.255 + | bfin \
2.256 + | c4x | clipper \
2.257 + | d10v | d30v | dlx | dsp16xx \
2.258 + | fido | fr30 | frv \
2.259 + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
2.260 + | i370 | i860 | i960 | ia64 \
2.261 + | ip2k | iq2000 \
2.262 + | lm32 \
2.263 + | m32c | m32r | m32rle | m68000 | m68k | m88k \
2.264 + | maxq | mb | microblaze | mcore | mep | metag \
2.265 + | mips | mipsbe | mipseb | mipsel | mipsle \
2.266 + | mips16 \
2.267 + | mips64 | mips64el \
2.268 + | mips64octeon | mips64octeonel \
2.269 + | mips64orion | mips64orionel \
2.270 + | mips64r5900 | mips64r5900el \
2.271 + | mips64vr | mips64vrel \
2.272 + | mips64vr4100 | mips64vr4100el \
2.273 + | mips64vr4300 | mips64vr4300el \
2.274 + | mips64vr5000 | mips64vr5000el \
2.275 + | mips64vr5900 | mips64vr5900el \
2.276 + | mipsisa32 | mipsisa32el \
2.277 + | mipsisa32r2 | mipsisa32r2el \
2.278 + | mipsisa64 | mipsisa64el \
2.279 + | mipsisa64r2 | mipsisa64r2el \
2.280 + | mipsisa64sb1 | mipsisa64sb1el \
2.281 + | mipsisa64sr71k | mipsisa64sr71kel \
2.282 + | mipstx39 | mipstx39el \
2.283 + | mn10200 | mn10300 \
2.284 + | moxie \
2.285 + | mt \
2.286 + | msp430 \
2.287 + | nios | nios2 \
2.288 + | ns16k | ns32k \
2.289 + | or32 \
2.290 + | pdp10 | pdp11 | pj | pjl \
2.291 + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
2.292 + | pyramid \
2.293 + | score \
2.294 + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
2.295 + | sh64 | sh64le \
2.296 + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
2.297 + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
2.298 + | spu | strongarm \
2.299 + | tahoe | thumb | tic4x | tic80 | tron \
2.300 + | v850 | v850e \
2.301 + | we32k \
2.302 + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
2.303 + | z8k | z80)
2.304 + basic_machine=$basic_machine-unknown
2.305 + ;;
2.306 + m6811 | m68hc11 | m6812 | m68hc12)
2.307 + # Motorola 68HC11/12.
2.308 + basic_machine=$basic_machine-unknown
2.309 + os=-none
2.310 + ;;
2.311 + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
2.312 + ;;
2.313 + ms1)
2.314 + basic_machine=mt-unknown
2.315 + ;;
2.316 +
2.317 + # We use `pc' rather than `unknown'
2.318 + # because (1) that's what they normally are, and
2.319 + # (2) the word "unknown" tends to confuse beginning users.
2.320 + i*86 | x86_64)
2.321 + basic_machine=$basic_machine-pc
2.322 + ;;
2.323 + # Object if more than one company name word.
2.324 + *-*-*)
2.325 + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
2.326 + exit 1
2.327 + ;;
2.328 + # Recognize the basic CPU types with company name.
2.329 + 580-* \
2.330 + | a29k-* \
2.331 + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
2.332 + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
2.333 + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
2.334 + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
2.335 + | avr-* | avr32-* \
2.336 + | bfin-* | bs2000-* \
2.337 + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
2.338 + | clipper-* | craynv-* | cydra-* \
2.339 + | d10v-* | d30v-* | dlx-* \
2.340 + | elxsi-* \
2.341 + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
2.342 + | h8300-* | h8500-* \
2.343 + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
2.344 + | i*86-* | i860-* | i960-* | ia64-* \
2.345 + | ip2k-* | iq2000-* \
2.346 + | lm32-* \
2.347 + | m32c-* | m32r-* | m32rle-* \
2.348 + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
2.349 + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
2.350 + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
2.351 + | mips16-* \
2.352 + | mips64-* | mips64el-* \
2.353 + | mips64octeon-* | mips64octeonel-* \
2.354 + | mips64orion-* | mips64orionel-* \
2.355 + | mips64r5900-* | mips64r5900el-* \
2.356 + | mips64vr-* | mips64vrel-* \
2.357 + | mips64vr4100-* | mips64vr4100el-* \
2.358 + | mips64vr4300-* | mips64vr4300el-* \
2.359 + | mips64vr5000-* | mips64vr5000el-* \
2.360 + | mips64vr5900-* | mips64vr5900el-* \
2.361 + | mipsisa32-* | mipsisa32el-* \
2.362 + | mipsisa32r2-* | mipsisa32r2el-* \
2.363 + | mipsisa64-* | mipsisa64el-* \
2.364 + | mipsisa64r2-* | mipsisa64r2el-* \
2.365 + | mipsisa64sb1-* | mipsisa64sb1el-* \
2.366 + | mipsisa64sr71k-* | mipsisa64sr71kel-* \
2.367 + | mipstx39-* | mipstx39el-* \
2.368 + | mmix-* \
2.369 + | mt-* \
2.370 + | msp430-* \
2.371 + | nios-* | nios2-* \
2.372 + | none-* | np1-* | ns16k-* | ns32k-* \
2.373 + | orion-* \
2.374 + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
2.375 + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
2.376 + | pyramid-* \
2.377 + | romp-* | rs6000-* \
2.378 + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
2.379 + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
2.380 + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
2.381 + | sparclite-* \
2.382 + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
2.383 + | tahoe-* | thumb-* \
2.384 + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
2.385 + | tron-* \
2.386 + | v850-* | v850e-* | vax-* \
2.387 + | we32k-* \
2.388 + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
2.389 + | xstormy16-* | xtensa*-* \
2.390 + | ymp-* \
2.391 + | z8k-* | z80-*)
2.392 + ;;
2.393 + # Recognize the basic CPU types without company name, with glob match.
2.394 + xtensa*)
2.395 + basic_machine=$basic_machine-unknown
2.396 + ;;
2.397 + # Recognize the various machine names and aliases which stand
2.398 + # for a CPU type and a company and sometimes even an OS.
2.399 + 386bsd)
2.400 + basic_machine=i386-unknown
2.401 + os=-bsd
2.402 + ;;
2.403 + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
2.404 + basic_machine=m68000-att
2.405 + ;;
2.406 + 3b*)
2.407 + basic_machine=we32k-att
2.408 + ;;
2.409 + a29khif)
2.410 + basic_machine=a29k-amd
2.411 + os=-udi
2.412 + ;;
2.413 + abacus)
2.414 + basic_machine=abacus-unknown
2.415 + ;;
2.416 + adobe68k)
2.417 + basic_machine=m68010-adobe
2.418 + os=-scout
2.419 + ;;
2.420 + alliant | fx80)
2.421 + basic_machine=fx80-alliant
2.422 + ;;
2.423 + altos | altos3068)
2.424 + basic_machine=m68k-altos
2.425 + ;;
2.426 + am29k)
2.427 + basic_machine=a29k-none
2.428 + os=-bsd
2.429 + ;;
2.430 + amd64)
2.431 + basic_machine=x86_64-pc
2.432 + ;;
2.433 + amd64-*)
2.434 + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
2.435 + ;;
2.436 + amdahl)
2.437 + basic_machine=580-amdahl
2.438 + os=-sysv
2.439 + ;;
2.440 + amiga | amiga-*)
2.441 + basic_machine=m68k-unknown
2.442 + ;;
2.443 + amigaos | amigados)
2.444 + basic_machine=m68k-unknown
2.445 + os=-amigaos
2.446 + ;;
2.447 + amigaunix | amix)
2.448 + basic_machine=m68k-unknown
2.449 + os=-sysv4
2.450 + ;;
2.451 + apollo68)
2.452 + basic_machine=m68k-apollo
2.453 + os=-sysv
2.454 + ;;
2.455 + apollo68bsd)
2.456 + basic_machine=m68k-apollo
2.457 + os=-bsd
2.458 + ;;
2.459 + aros)
2.460 + basic_machine=i386-pc
2.461 + os=-aros
2.462 + ;;
2.463 + aux)
2.464 + basic_machine=m68k-apple
2.465 + os=-aux
2.466 + ;;
2.467 + balance)
2.468 + basic_machine=ns32k-sequent
2.469 + os=-dynix
2.470 + ;;
2.471 + blackfin)
2.472 + basic_machine=bfin-unknown
2.473 + os=-linux
2.474 + ;;
2.475 + blackfin-*)
2.476 + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
2.477 + os=-linux
2.478 + ;;
2.479 + bluegene*)
2.480 + basic_machine=powerpc-ibm
2.481 + os=-cnk
2.482 + ;;
2.483 + c90)
2.484 + basic_machine=c90-cray
2.485 + os=-unicos
2.486 + ;;
2.487 + cegcc)
2.488 + basic_machine=arm-unknown
2.489 + os=-cegcc
2.490 + ;;
2.491 + convex-c1)
2.492 + basic_machine=c1-convex
2.493 + os=-bsd
2.494 + ;;
2.495 + convex-c2)
2.496 + basic_machine=c2-convex
2.497 + os=-bsd
2.498 + ;;
2.499 + convex-c32)
2.500 + basic_machine=c32-convex
2.501 + os=-bsd
2.502 + ;;
2.503 + convex-c34)
2.504 + basic_machine=c34-convex
2.505 + os=-bsd
2.506 + ;;
2.507 + convex-c38)
2.508 + basic_machine=c38-convex
2.509 + os=-bsd
2.510 + ;;
2.511 + cray | j90)
2.512 + basic_machine=j90-cray
2.513 + os=-unicos
2.514 + ;;
2.515 + craynv)
2.516 + basic_machine=craynv-cray
2.517 + os=-unicosmp
2.518 + ;;
2.519 + cr16)
2.520 + basic_machine=cr16-unknown
2.521 + os=-elf
2.522 + ;;
2.523 + crds | unos)
2.524 + basic_machine=m68k-crds
2.525 + ;;
2.526 + crisv32 | crisv32-* | etraxfs*)
2.527 + basic_machine=crisv32-axis
2.528 + ;;
2.529 + cris | cris-* | etrax*)
2.530 + basic_machine=cris-axis
2.531 + ;;
2.532 + crx)
2.533 + basic_machine=crx-unknown
2.534 + os=-elf
2.535 + ;;
2.536 + da30 | da30-*)
2.537 + basic_machine=m68k-da30
2.538 + ;;
2.539 + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
2.540 + basic_machine=mips-dec
2.541 + ;;
2.542 + decsystem10* | dec10*)
2.543 + basic_machine=pdp10-dec
2.544 + os=-tops10
2.545 + ;;
2.546 + decsystem20* | dec20*)
2.547 + basic_machine=pdp10-dec
2.548 + os=-tops20
2.549 + ;;
2.550 + delta | 3300 | motorola-3300 | motorola-delta \
2.551 + | 3300-motorola | delta-motorola)
2.552 + basic_machine=m68k-motorola
2.553 + ;;
2.554 + delta88)
2.555 + basic_machine=m88k-motorola
2.556 + os=-sysv3
2.557 + ;;
2.558 + dicos)
2.559 + basic_machine=i686-pc
2.560 + os=-dicos
2.561 + ;;
2.562 + djgpp)
2.563 + basic_machine=i586-pc
2.564 + os=-msdosdjgpp
2.565 + ;;
2.566 + dpx20 | dpx20-*)
2.567 + basic_machine=rs6000-bull
2.568 + os=-bosx
2.569 + ;;
2.570 + dpx2* | dpx2*-bull)
2.571 + basic_machine=m68k-bull
2.572 + os=-sysv3
2.573 + ;;
2.574 + ebmon29k)
2.575 + basic_machine=a29k-amd
2.576 + os=-ebmon
2.577 + ;;
2.578 + elxsi)
2.579 + basic_machine=elxsi-elxsi
2.580 + os=-bsd
2.581 + ;;
2.582 + encore | umax | mmax)
2.583 + basic_machine=ns32k-encore
2.584 + ;;
2.585 + es1800 | OSE68k | ose68k | ose | OSE)
2.586 + basic_machine=m68k-ericsson
2.587 + os=-ose
2.588 + ;;
2.589 + fx2800)
2.590 + basic_machine=i860-alliant
2.591 + ;;
2.592 + genix)
2.593 + basic_machine=ns32k-ns
2.594 + ;;
2.595 + gmicro)
2.596 + basic_machine=tron-gmicro
2.597 + os=-sysv
2.598 + ;;
2.599 + go32)
2.600 + basic_machine=i386-pc
2.601 + os=-go32
2.602 + ;;
2.603 + h3050r* | hiux*)
2.604 + basic_machine=hppa1.1-hitachi
2.605 + os=-hiuxwe2
2.606 + ;;
2.607 + h8300hms)
2.608 + basic_machine=h8300-hitachi
2.609 + os=-hms
2.610 + ;;
2.611 + h8300xray)
2.612 + basic_machine=h8300-hitachi
2.613 + os=-xray
2.614 + ;;
2.615 + h8500hms)
2.616 + basic_machine=h8500-hitachi
2.617 + os=-hms
2.618 + ;;
2.619 + harris)
2.620 + basic_machine=m88k-harris
2.621 + os=-sysv3
2.622 + ;;
2.623 + hp300-*)
2.624 + basic_machine=m68k-hp
2.625 + ;;
2.626 + hp300bsd)
2.627 + basic_machine=m68k-hp
2.628 + os=-bsd
2.629 + ;;
2.630 + hp300hpux)
2.631 + basic_machine=m68k-hp
2.632 + os=-hpux
2.633 + ;;
2.634 + hp3k9[0-9][0-9] | hp9[0-9][0-9])
2.635 + basic_machine=hppa1.0-hp
2.636 + ;;
2.637 + hp9k2[0-9][0-9] | hp9k31[0-9])
2.638 + basic_machine=m68000-hp
2.639 + ;;
2.640 + hp9k3[2-9][0-9])
2.641 + basic_machine=m68k-hp
2.642 + ;;
2.643 + hp9k6[0-9][0-9] | hp6[0-9][0-9])
2.644 + basic_machine=hppa1.0-hp
2.645 + ;;
2.646 + hp9k7[0-79][0-9] | hp7[0-79][0-9])
2.647 + basic_machine=hppa1.1-hp
2.648 + ;;
2.649 + hp9k78[0-9] | hp78[0-9])
2.650 + # FIXME: really hppa2.0-hp
2.651 + basic_machine=hppa1.1-hp
2.652 + ;;
2.653 + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
2.654 + # FIXME: really hppa2.0-hp
2.655 + basic_machine=hppa1.1-hp
2.656 + ;;
2.657 + hp9k8[0-9][13679] | hp8[0-9][13679])
2.658 + basic_machine=hppa1.1-hp
2.659 + ;;
2.660 + hp9k8[0-9][0-9] | hp8[0-9][0-9])
2.661 + basic_machine=hppa1.0-hp
2.662 + ;;
2.663 + hppa-next)
2.664 + os=-nextstep3
2.665 + ;;
2.666 + hppaosf)
2.667 + basic_machine=hppa1.1-hp
2.668 + os=-osf
2.669 + ;;
2.670 + hppro)
2.671 + basic_machine=hppa1.1-hp
2.672 + os=-proelf
2.673 + ;;
2.674 + i370-ibm* | ibm*)
2.675 + basic_machine=i370-ibm
2.676 + ;;
2.677 +# I'm not sure what "Sysv32" means. Should this be sysv3.2?
2.678 + i*86v32)
2.679 + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
2.680 + os=-sysv32
2.681 + ;;
2.682 + i*86v4*)
2.683 + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
2.684 + os=-sysv4
2.685 + ;;
2.686 + i*86v)
2.687 + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
2.688 + os=-sysv
2.689 + ;;
2.690 + i*86sol2)
2.691 + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
2.692 + os=-solaris2
2.693 + ;;
2.694 + i386mach)
2.695 + basic_machine=i386-mach
2.696 + os=-mach
2.697 + ;;
2.698 + i386-vsta | vsta)
2.699 + basic_machine=i386-unknown
2.700 + os=-vsta
2.701 + ;;
2.702 + iris | iris4d)
2.703 + basic_machine=mips-sgi
2.704 + case $os in
2.705 + -irix*)
2.706 + ;;
2.707 + *)
2.708 + os=-irix4
2.709 + ;;
2.710 + esac
2.711 + ;;
2.712 + isi68 | isi)
2.713 + basic_machine=m68k-isi
2.714 + os=-sysv
2.715 + ;;
2.716 + m68knommu)
2.717 + basic_machine=m68k-unknown
2.718 + os=-linux
2.719 + ;;
2.720 + m68knommu-*)
2.721 + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
2.722 + os=-linux
2.723 + ;;
2.724 + m88k-omron*)
2.725 + basic_machine=m88k-omron
2.726 + ;;
2.727 + magnum | m3230)
2.728 + basic_machine=mips-mips
2.729 + os=-sysv
2.730 + ;;
2.731 + merlin)
2.732 + basic_machine=ns32k-utek
2.733 + os=-sysv
2.734 + ;;
2.735 + microblaze)
2.736 + basic_machine=microblaze-xilinx
2.737 + ;;
2.738 + mingw32)
2.739 + basic_machine=i386-pc
2.740 + os=-mingw32
2.741 + ;;
2.742 + mingw32ce)
2.743 + basic_machine=arm-unknown
2.744 + os=-mingw32ce
2.745 + ;;
2.746 + miniframe)
2.747 + basic_machine=m68000-convergent
2.748 + ;;
2.749 + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
2.750 + basic_machine=m68k-atari
2.751 + os=-mint
2.752 + ;;
2.753 + mips3*-*)
2.754 + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
2.755 + ;;
2.756 + mips3*)
2.757 + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
2.758 + ;;
2.759 + monitor)
2.760 + basic_machine=m68k-rom68k
2.761 + os=-coff
2.762 + ;;
2.763 + morphos)
2.764 + basic_machine=powerpc-unknown
2.765 + os=-morphos
2.766 + ;;
2.767 + msdos)
2.768 + basic_machine=i386-pc
2.769 + os=-msdos
2.770 + ;;
2.771 + ms1-*)
2.772 + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
2.773 + ;;
2.774 + mvs)
2.775 + basic_machine=i370-ibm
2.776 + os=-mvs
2.777 + ;;
2.778 + ncr3000)
2.779 + basic_machine=i486-ncr
2.780 + os=-sysv4
2.781 + ;;
2.782 + netbsd386)
2.783 + basic_machine=i386-unknown
2.784 + os=-netbsd
2.785 + ;;
2.786 + netwinder)
2.787 + basic_machine=armv4l-rebel
2.788 + os=-linux
2.789 + ;;
2.790 + news | news700 | news800 | news900)
2.791 + basic_machine=m68k-sony
2.792 + os=-newsos
2.793 + ;;
2.794 + news1000)
2.795 + basic_machine=m68030-sony
2.796 + os=-newsos
2.797 + ;;
2.798 + news-3600 | risc-news)
2.799 + basic_machine=mips-sony
2.800 + os=-newsos
2.801 + ;;
2.802 + necv70)
2.803 + basic_machine=v70-nec
2.804 + os=-sysv
2.805 + ;;
2.806 + next | m*-next )
2.807 + basic_machine=m68k-next
2.808 + case $os in
2.809 + -nextstep* )
2.810 + ;;
2.811 + -ns2*)
2.812 + os=-nextstep2
2.813 + ;;
2.814 + *)
2.815 + os=-nextstep3
2.816 + ;;
2.817 + esac
2.818 + ;;
2.819 + nh3000)
2.820 + basic_machine=m68k-harris
2.821 + os=-cxux
2.822 + ;;
2.823 + nh[45]000)
2.824 + basic_machine=m88k-harris
2.825 + os=-cxux
2.826 + ;;
2.827 + nindy960)
2.828 + basic_machine=i960-intel
2.829 + os=-nindy
2.830 + ;;
2.831 + mon960)
2.832 + basic_machine=i960-intel
2.833 + os=-mon960
2.834 + ;;
2.835 + nonstopux)
2.836 + basic_machine=mips-compaq
2.837 + os=-nonstopux
2.838 + ;;
2.839 + np1)
2.840 + basic_machine=np1-gould
2.841 + ;;
2.842 + nsr-tandem)
2.843 + basic_machine=nsr-tandem
2.844 + ;;
2.845 + op50n-* | op60c-*)
2.846 + basic_machine=hppa1.1-oki
2.847 + os=-proelf
2.848 + ;;
2.849 + openrisc | openrisc-*)
2.850 + basic_machine=or32-unknown
2.851 + ;;
2.852 + os400)
2.853 + basic_machine=powerpc-ibm
2.854 + os=-os400
2.855 + ;;
2.856 + OSE68000 | ose68000)
2.857 + basic_machine=m68000-ericsson
2.858 + os=-ose
2.859 + ;;
2.860 + os68k)
2.861 + basic_machine=m68k-none
2.862 + os=-os68k
2.863 + ;;
2.864 + pa-hitachi)
2.865 + basic_machine=hppa1.1-hitachi
2.866 + os=-hiuxwe2
2.867 + ;;
2.868 + paragon)
2.869 + basic_machine=i860-intel
2.870 + os=-osf
2.871 + ;;
2.872 + parisc)
2.873 + basic_machine=hppa-unknown
2.874 + os=-linux
2.875 + ;;
2.876 + parisc-*)
2.877 + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
2.878 + os=-linux
2.879 + ;;
2.880 + pbd)
2.881 + basic_machine=sparc-tti
2.882 + ;;
2.883 + pbb)
2.884 + basic_machine=m68k-tti
2.885 + ;;
2.886 + pc532 | pc532-*)
2.887 + basic_machine=ns32k-pc532
2.888 + ;;
2.889 + pc98)
2.890 + basic_machine=i386-pc
2.891 + ;;
2.892 + pc98-*)
2.893 + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
2.894 + ;;
2.895 + pentium | p5 | k5 | k6 | nexgen | viac3)
2.896 + basic_machine=i586-pc
2.897 + ;;
2.898 + pentiumpro | p6 | 6x86 | athlon | athlon_*)
2.899 + basic_machine=i686-pc
2.900 + ;;
2.901 + pentiumii | pentium2 | pentiumiii | pentium3)
2.902 + basic_machine=i686-pc
2.903 + ;;
2.904 + pentium4)
2.905 + basic_machine=i786-pc
2.906 + ;;
2.907 + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
2.908 + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
2.909 + ;;
2.910 + pentiumpro-* | p6-* | 6x86-* | athlon-*)
2.911 + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
2.912 + ;;
2.913 + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
2.914 + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
2.915 + ;;
2.916 + pentium4-*)
2.917 + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
2.918 + ;;
2.919 + pn)
2.920 + basic_machine=pn-gould
2.921 + ;;
2.922 + power) basic_machine=power-ibm
2.923 + ;;
2.924 + ppc) basic_machine=powerpc-unknown
2.925 + ;;
2.926 + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
2.927 + ;;
2.928 + ppcle | powerpclittle | ppc-le | powerpc-little)
2.929 + basic_machine=powerpcle-unknown
2.930 + ;;
2.931 + ppcle-* | powerpclittle-*)
2.932 + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
2.933 + ;;
2.934 + ppc64) basic_machine=powerpc64-unknown
2.935 + ;;
2.936 + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
2.937 + ;;
2.938 + ppc64le | powerpc64little | ppc64-le | powerpc64-little)
2.939 + basic_machine=powerpc64le-unknown
2.940 + ;;
2.941 + ppc64le-* | powerpc64little-*)
2.942 + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
2.943 + ;;
2.944 + ps2)
2.945 + basic_machine=i386-ibm
2.946 + ;;
2.947 + pw32)
2.948 + basic_machine=i586-unknown
2.949 + os=-pw32
2.950 + ;;
2.951 + rdos)
2.952 + basic_machine=i386-pc
2.953 + os=-rdos
2.954 + ;;
2.955 + rom68k)
2.956 + basic_machine=m68k-rom68k
2.957 + os=-coff
2.958 + ;;
2.959 + rm[46]00)
2.960 + basic_machine=mips-siemens
2.961 + ;;
2.962 + rtpc | rtpc-*)
2.963 + basic_machine=romp-ibm
2.964 + ;;
2.965 + s390 | s390-*)
2.966 + basic_machine=s390-ibm
2.967 + ;;
2.968 + s390x | s390x-*)
2.969 + basic_machine=s390x-ibm
2.970 + ;;
2.971 + sa29200)
2.972 + basic_machine=a29k-amd
2.973 + os=-udi
2.974 + ;;
2.975 + sb1)
2.976 + basic_machine=mipsisa64sb1-unknown
2.977 + ;;
2.978 + sb1el)
2.979 + basic_machine=mipsisa64sb1el-unknown
2.980 + ;;
2.981 + sde)
2.982 + basic_machine=mipsisa32-sde
2.983 + os=-elf
2.984 + ;;
2.985 + sei)
2.986 + basic_machine=mips-sei
2.987 + os=-seiux
2.988 + ;;
2.989 + sequent)
2.990 + basic_machine=i386-sequent
2.991 + ;;
2.992 + sh)
2.993 + basic_machine=sh-hitachi
2.994 + os=-hms
2.995 + ;;
2.996 + sh5el)
2.997 + basic_machine=sh5le-unknown
2.998 + ;;
2.999 + sh64)
2.1000 + basic_machine=sh64-unknown
2.1001 + ;;
2.1002 + sparclite-wrs | simso-wrs)
2.1003 + basic_machine=sparclite-wrs
2.1004 + os=-vxworks
2.1005 + ;;
2.1006 + sps7)
2.1007 + basic_machine=m68k-bull
2.1008 + os=-sysv2
2.1009 + ;;
2.1010 + spur)
2.1011 + basic_machine=spur-unknown
2.1012 + ;;
2.1013 + st2000)
2.1014 + basic_machine=m68k-tandem
2.1015 + ;;
2.1016 + stratus)
2.1017 + basic_machine=i860-stratus
2.1018 + os=-sysv4
2.1019 + ;;
2.1020 + sun2)
2.1021 + basic_machine=m68000-sun
2.1022 + ;;
2.1023 + sun2os3)
2.1024 + basic_machine=m68000-sun
2.1025 + os=-sunos3
2.1026 + ;;
2.1027 + sun2os4)
2.1028 + basic_machine=m68000-sun
2.1029 + os=-sunos4
2.1030 + ;;
2.1031 + sun3os3)
2.1032 + basic_machine=m68k-sun
2.1033 + os=-sunos3
2.1034 + ;;
2.1035 + sun3os4)
2.1036 + basic_machine=m68k-sun
2.1037 + os=-sunos4
2.1038 + ;;
2.1039 + sun4os3)
2.1040 + basic_machine=sparc-sun
2.1041 + os=-sunos3
2.1042 + ;;
2.1043 + sun4os4)
2.1044 + basic_machine=sparc-sun
2.1045 + os=-sunos4
2.1046 + ;;
2.1047 + sun4sol2)
2.1048 + basic_machine=sparc-sun
2.1049 + os=-solaris2
2.1050 + ;;
2.1051 + sun3 | sun3-*)
2.1052 + basic_machine=m68k-sun
2.1053 + ;;
2.1054 + sun4)
2.1055 + basic_machine=sparc-sun
2.1056 + ;;
2.1057 + sun386 | sun386i | roadrunner)
2.1058 + basic_machine=i386-sun
2.1059 + ;;
2.1060 + sv1)
2.1061 + basic_machine=sv1-cray
2.1062 + os=-unicos
2.1063 + ;;
2.1064 + symmetry)
2.1065 + basic_machine=i386-sequent
2.1066 + os=-dynix
2.1067 + ;;
2.1068 + t3e)
2.1069 + basic_machine=alphaev5-cray
2.1070 + os=-unicos
2.1071 + ;;
2.1072 + t90)
2.1073 + basic_machine=t90-cray
2.1074 + os=-unicos
2.1075 + ;;
2.1076 + tic54x | c54x*)
2.1077 + basic_machine=tic54x-unknown
2.1078 + os=-coff
2.1079 + ;;
2.1080 + tic55x | c55x*)
2.1081 + basic_machine=tic55x-unknown
2.1082 + os=-coff
2.1083 + ;;
2.1084 + tic6x | c6x*)
2.1085 + basic_machine=tic6x-unknown
2.1086 + os=-coff
2.1087 + ;;
2.1088 + tile*)
2.1089 + basic_machine=tile-unknown
2.1090 + os=-linux-gnu
2.1091 + ;;
2.1092 + tx39)
2.1093 + basic_machine=mipstx39-unknown
2.1094 + ;;
2.1095 + tx39el)
2.1096 + basic_machine=mipstx39el-unknown
2.1097 + ;;
2.1098 + toad1)
2.1099 + basic_machine=pdp10-xkl
2.1100 + os=-tops20
2.1101 + ;;
2.1102 + tower | tower-32)
2.1103 + basic_machine=m68k-ncr
2.1104 + ;;
2.1105 + tpf)
2.1106 + basic_machine=s390x-ibm
2.1107 + os=-tpf
2.1108 + ;;
2.1109 + udi29k)
2.1110 + basic_machine=a29k-amd
2.1111 + os=-udi
2.1112 + ;;
2.1113 + ultra3)
2.1114 + basic_machine=a29k-nyu
2.1115 + os=-sym1
2.1116 + ;;
2.1117 + v810 | necv810)
2.1118 + basic_machine=v810-nec
2.1119 + os=-none
2.1120 + ;;
2.1121 + vaxv)
2.1122 + basic_machine=vax-dec
2.1123 + os=-sysv
2.1124 + ;;
2.1125 + vms)
2.1126 + basic_machine=vax-dec
2.1127 + os=-vms
2.1128 + ;;
2.1129 + vpp*|vx|vx-*)
2.1130 + basic_machine=f301-fujitsu
2.1131 + ;;
2.1132 + vxworks960)
2.1133 + basic_machine=i960-wrs
2.1134 + os=-vxworks
2.1135 + ;;
2.1136 + vxworks68)
2.1137 + basic_machine=m68k-wrs
2.1138 + os=-vxworks
2.1139 + ;;
2.1140 + vxworks29k)
2.1141 + basic_machine=a29k-wrs
2.1142 + os=-vxworks
2.1143 + ;;
2.1144 + w65*)
2.1145 + basic_machine=w65-wdc
2.1146 + os=-none
2.1147 + ;;
2.1148 + w89k-*)
2.1149 + basic_machine=hppa1.1-winbond
2.1150 + os=-proelf
2.1151 + ;;
2.1152 + xbox)
2.1153 + basic_machine=i686-pc
2.1154 + os=-mingw32
2.1155 + ;;
2.1156 + xps | xps100)
2.1157 + basic_machine=xps100-honeywell
2.1158 + ;;
2.1159 + ymp)
2.1160 + basic_machine=ymp-cray
2.1161 + os=-unicos
2.1162 + ;;
2.1163 + z8k-*-coff)
2.1164 + basic_machine=z8k-unknown
2.1165 + os=-sim
2.1166 + ;;
2.1167 + z80-*-coff)
2.1168 + basic_machine=z80-unknown
2.1169 + os=-sim
2.1170 + ;;
2.1171 + none)
2.1172 + basic_machine=none-none
2.1173 + os=-none
2.1174 + ;;
2.1175 +
2.1176 +# Here we handle the default manufacturer of certain CPU types. It is in
2.1177 +# some cases the only manufacturer, in others, it is the most popular.
2.1178 + w89k)
2.1179 + basic_machine=hppa1.1-winbond
2.1180 + ;;
2.1181 + op50n)
2.1182 + basic_machine=hppa1.1-oki
2.1183 + ;;
2.1184 + op60c)
2.1185 + basic_machine=hppa1.1-oki
2.1186 + ;;
2.1187 + romp)
2.1188 + basic_machine=romp-ibm
2.1189 + ;;
2.1190 + mmix)
2.1191 + basic_machine=mmix-knuth
2.1192 + ;;
2.1193 + rs6000)
2.1194 + basic_machine=rs6000-ibm
2.1195 + ;;
2.1196 + vax)
2.1197 + basic_machine=vax-dec
2.1198 + ;;
2.1199 + pdp10)
2.1200 + # there are many clones, so DEC is not a safe bet
2.1201 + basic_machine=pdp10-unknown
2.1202 + ;;
2.1203 + pdp11)
2.1204 + basic_machine=pdp11-dec
2.1205 + ;;
2.1206 + we32k)
2.1207 + basic_machine=we32k-att
2.1208 + ;;
2.1209 + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
2.1210 + basic_machine=sh-unknown
2.1211 + ;;
2.1212 + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
2.1213 + basic_machine=sparc-sun
2.1214 + ;;
2.1215 + cydra)
2.1216 + basic_machine=cydra-cydrome
2.1217 + ;;
2.1218 + orion)
2.1219 + basic_machine=orion-highlevel
2.1220 + ;;
2.1221 + orion105)
2.1222 + basic_machine=clipper-highlevel
2.1223 + ;;
2.1224 + mac | mpw | mac-mpw)
2.1225 + basic_machine=m68k-apple
2.1226 + ;;
2.1227 + pmac | pmac-mpw)
2.1228 + basic_machine=powerpc-apple
2.1229 + ;;
2.1230 + *-unknown)
2.1231 + # Make sure to match an already-canonicalized machine name.
2.1232 + ;;
2.1233 + *)
2.1234 + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
2.1235 + exit 1
2.1236 + ;;
2.1237 +esac
2.1238 +
2.1239 +# Here we canonicalize certain aliases for manufacturers.
2.1240 +case $basic_machine in
2.1241 + *-digital*)
2.1242 + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
2.1243 + ;;
2.1244 + *-commodore*)
2.1245 + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
2.1246 + ;;
2.1247 + *)
2.1248 + ;;
2.1249 +esac
2.1250 +
2.1251 +# Decode manufacturer-specific aliases for certain operating systems.
2.1252 +
2.1253 +if [ x"$os" != x"" ]
2.1254 +then
2.1255 +case $os in
2.1256 + # First match some system type aliases
2.1257 + # that might get confused with valid system types.
2.1258 + # -solaris* is a basic system type, with this one exception.
2.1259 + -solaris1 | -solaris1.*)
2.1260 + os=`echo $os | sed -e 's|solaris1|sunos4|'`
2.1261 + ;;
2.1262 + -solaris)
2.1263 + os=-solaris2
2.1264 + ;;
2.1265 + -svr4*)
2.1266 + os=-sysv4
2.1267 + ;;
2.1268 + -unixware*)
2.1269 + os=-sysv4.2uw
2.1270 + ;;
2.1271 + -gnu/linux*)
2.1272 + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
2.1273 + ;;
2.1274 + # First accept the basic system types.
2.1275 + # The portable systems comes first.
2.1276 + # Each alternative MUST END IN A *, to match a version number.
2.1277 + # -sysv* is not here because it comes later, after sysvr4.
2.1278 + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
2.1279 + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
2.1280 + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
2.1281 + | -kopensolaris* \
2.1282 + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
2.1283 + | -aos* | -aros* \
2.1284 + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
2.1285 + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
2.1286 + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
2.1287 + | -openbsd* | -solidbsd* \
2.1288 + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
2.1289 + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
2.1290 + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
2.1291 + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
2.1292 + | -chorusos* | -chorusrdb* | -cegcc* \
2.1293 + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
2.1294 + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
2.1295 + | -uxpv* | -beos* | -mpeix* | -udk* \
2.1296 + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
2.1297 + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
2.1298 + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
2.1299 + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
2.1300 + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
2.1301 + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
2.1302 + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -winmo*)
2.1303 + # Remember, each alternative MUST END IN *, to match a version number.
2.1304 + ;;
2.1305 + -qnx*)
2.1306 + case $basic_machine in
2.1307 + x86-* | i*86-*)
2.1308 + ;;
2.1309 + *)
2.1310 + os=-nto$os
2.1311 + ;;
2.1312 + esac
2.1313 + ;;
2.1314 + -nto-qnx*)
2.1315 + ;;
2.1316 + -nto*)
2.1317 + os=`echo $os | sed -e 's|nto|nto-qnx|'`
2.1318 + ;;
2.1319 + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
2.1320 + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
2.1321 + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
2.1322 + ;;
2.1323 + -mac*)
2.1324 + os=`echo $os | sed -e 's|mac|macos|'`
2.1325 + ;;
2.1326 + -linux-dietlibc)
2.1327 + os=-linux-dietlibc
2.1328 + ;;
2.1329 + -linux*)
2.1330 + os=`echo $os | sed -e 's|linux|linux-gnu|'`
2.1331 + ;;
2.1332 + -sunos5*)
2.1333 + os=`echo $os | sed -e 's|sunos5|solaris2|'`
2.1334 + ;;
2.1335 + -sunos6*)
2.1336 + os=`echo $os | sed -e 's|sunos6|solaris3|'`
2.1337 + ;;
2.1338 + -opened*)
2.1339 + os=-openedition
2.1340 + ;;
2.1341 + -os400*)
2.1342 + os=-os400
2.1343 + ;;
2.1344 + -wince-winmo*)
2.1345 + os=-wince-winmo
2.1346 + ;;
2.1347 + -wince*)
2.1348 + os=-wince
2.1349 + ;;
2.1350 + -osfrose*)
2.1351 + os=-osfrose
2.1352 + ;;
2.1353 + -osf*)
2.1354 + os=-osf
2.1355 + ;;
2.1356 + -utek*)
2.1357 + os=-bsd
2.1358 + ;;
2.1359 + -dynix*)
2.1360 + os=-bsd
2.1361 + ;;
2.1362 + -acis*)
2.1363 + os=-aos
2.1364 + ;;
2.1365 + -atheos*)
2.1366 + os=-atheos
2.1367 + ;;
2.1368 + -syllable*)
2.1369 + os=-syllable
2.1370 + ;;
2.1371 + -386bsd)
2.1372 + os=-bsd
2.1373 + ;;
2.1374 + -ctix* | -uts*)
2.1375 + os=-sysv
2.1376 + ;;
2.1377 + -nova*)
2.1378 + os=-rtmk-nova
2.1379 + ;;
2.1380 + -ns2 )
2.1381 + os=-nextstep2
2.1382 + ;;
2.1383 + -nsk*)
2.1384 + os=-nsk
2.1385 + ;;
2.1386 + # Preserve the version number of sinix5.
2.1387 + -sinix5.*)
2.1388 + os=`echo $os | sed -e 's|sinix|sysv|'`
2.1389 + ;;
2.1390 + -sinix*)
2.1391 + os=-sysv4
2.1392 + ;;
2.1393 + -tpf*)
2.1394 + os=-tpf
2.1395 + ;;
2.1396 + -triton*)
2.1397 + os=-sysv3
2.1398 + ;;
2.1399 + -oss*)
2.1400 + os=-sysv3
2.1401 + ;;
2.1402 + -svr4)
2.1403 + os=-sysv4
2.1404 + ;;
2.1405 + -svr3)
2.1406 + os=-sysv3
2.1407 + ;;
2.1408 + -sysvr4)
2.1409 + os=-sysv4
2.1410 + ;;
2.1411 + # This must come after -sysvr4.
2.1412 + -sysv*)
2.1413 + ;;
2.1414 + -ose*)
2.1415 + os=-ose
2.1416 + ;;
2.1417 + -es1800*)
2.1418 + os=-ose
2.1419 + ;;
2.1420 + -xenix)
2.1421 + os=-xenix
2.1422 + ;;
2.1423 + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
2.1424 + os=-mint
2.1425 + ;;
2.1426 + -aros*)
2.1427 + os=-aros
2.1428 + ;;
2.1429 + -kaos*)
2.1430 + os=-kaos
2.1431 + ;;
2.1432 + -zvmoe)
2.1433 + os=-zvmoe
2.1434 + ;;
2.1435 + -dicos*)
2.1436 + os=-dicos
2.1437 + ;;
2.1438 + -none)
2.1439 + ;;
2.1440 + *)
2.1441 + # Get rid of the `-' at the beginning of $os.
2.1442 + os=`echo $os | sed 's/[^-]*-//'`
2.1443 + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
2.1444 + exit 1
2.1445 + ;;
2.1446 +esac
2.1447 +else
2.1448 +
2.1449 +# Here we handle the default operating systems that come with various machines.
2.1450 +# The value should be what the vendor currently ships out the door with their
2.1451 +# machine or put another way, the most popular os provided with the machine.
2.1452 +
2.1453 +# Note that if you're going to try to match "-MANUFACTURER" here (say,
2.1454 +# "-sun"), then you have to tell the case statement up towards the top
2.1455 +# that MANUFACTURER isn't an operating system. Otherwise, code above
2.1456 +# will signal an error saying that MANUFACTURER isn't an operating
2.1457 +# system, and we'll never get to this point.
2.1458 +
2.1459 +case $basic_machine in
2.1460 + score-*)
2.1461 + os=-elf
2.1462 + ;;
2.1463 + spu-*)
2.1464 + os=-elf
2.1465 + ;;
2.1466 + *-acorn)
2.1467 + os=-riscix1.2
2.1468 + ;;
2.1469 + arm*-rebel)
2.1470 + os=-linux
2.1471 + ;;
2.1472 + arm*-semi)
2.1473 + os=-aout
2.1474 + ;;
2.1475 + c4x-* | tic4x-*)
2.1476 + os=-coff
2.1477 + ;;
2.1478 + # This must come before the *-dec entry.
2.1479 + pdp10-*)
2.1480 + os=-tops20
2.1481 + ;;
2.1482 + pdp11-*)
2.1483 + os=-none
2.1484 + ;;
2.1485 + *-dec | vax-*)
2.1486 + os=-ultrix4.2
2.1487 + ;;
2.1488 + m68*-apollo)
2.1489 + os=-domain
2.1490 + ;;
2.1491 + i386-sun)
2.1492 + os=-sunos4.0.2
2.1493 + ;;
2.1494 + m68000-sun)
2.1495 + os=-sunos3
2.1496 + # This also exists in the configure program, but was not the
2.1497 + # default.
2.1498 + # os=-sunos4
2.1499 + ;;
2.1500 + m68*-cisco)
2.1501 + os=-aout
2.1502 + ;;
2.1503 + mep-*)
2.1504 + os=-elf
2.1505 + ;;
2.1506 + mips*-cisco)
2.1507 + os=-elf
2.1508 + ;;
2.1509 + mips*-*)
2.1510 + os=-elf
2.1511 + ;;
2.1512 + or32-*)
2.1513 + os=-coff
2.1514 + ;;
2.1515 + *-tti) # must be before sparc entry or we get the wrong os.
2.1516 + os=-sysv3
2.1517 + ;;
2.1518 + sparc-* | *-sun)
2.1519 + os=-sunos4.1.1
2.1520 + ;;
2.1521 + *-be)
2.1522 + os=-beos
2.1523 + ;;
2.1524 + *-haiku)
2.1525 + os=-haiku
2.1526 + ;;
2.1527 + *-ibm)
2.1528 + os=-aix
2.1529 + ;;
2.1530 + *-knuth)
2.1531 + os=-mmixware
2.1532 + ;;
2.1533 + *-wec)
2.1534 + os=-proelf
2.1535 + ;;
2.1536 + *-winbond)
2.1537 + os=-proelf
2.1538 + ;;
2.1539 + *-oki)
2.1540 + os=-proelf
2.1541 + ;;
2.1542 + *-hp)
2.1543 + os=-hpux
2.1544 + ;;
2.1545 + *-hitachi)
2.1546 + os=-hiux
2.1547 + ;;
2.1548 + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
2.1549 + os=-sysv
2.1550 + ;;
2.1551 + *-cbm)
2.1552 + os=-amigaos
2.1553 + ;;
2.1554 + *-dg)
2.1555 + os=-dgux
2.1556 + ;;
2.1557 + *-dolphin)
2.1558 + os=-sysv3
2.1559 + ;;
2.1560 + m68k-ccur)
2.1561 + os=-rtu
2.1562 + ;;
2.1563 + m88k-omron*)
2.1564 + os=-luna
2.1565 + ;;
2.1566 + *-next )
2.1567 + os=-nextstep
2.1568 + ;;
2.1569 + *-sequent)
2.1570 + os=-ptx
2.1571 + ;;
2.1572 + *-crds)
2.1573 + os=-unos
2.1574 + ;;
2.1575 + *-ns)
2.1576 + os=-genix
2.1577 + ;;
2.1578 + i370-*)
2.1579 + os=-mvs
2.1580 + ;;
2.1581 + *-next)
2.1582 + os=-nextstep3
2.1583 + ;;
2.1584 + *-gould)
2.1585 + os=-sysv
2.1586 + ;;
2.1587 + *-highlevel)
2.1588 + os=-bsd
2.1589 + ;;
2.1590 + *-encore)
2.1591 + os=-bsd
2.1592 + ;;
2.1593 + *-sgi)
2.1594 + os=-irix
2.1595 + ;;
2.1596 + *-siemens)
2.1597 + os=-sysv4
2.1598 + ;;
2.1599 + *-masscomp)
2.1600 + os=-rtu
2.1601 + ;;
2.1602 + f30[01]-fujitsu | f700-fujitsu)
2.1603 + os=-uxpv
2.1604 + ;;
2.1605 + *-rom68k)
2.1606 + os=-coff
2.1607 + ;;
2.1608 + *-*bug)
2.1609 + os=-coff
2.1610 + ;;
2.1611 + *-apple)
2.1612 + os=-macos
2.1613 + ;;
2.1614 + *-atari*)
2.1615 + os=-mint
2.1616 + ;;
2.1617 + *)
2.1618 + os=-none
2.1619 + ;;
2.1620 +esac
2.1621 +fi
2.1622 +
2.1623 +# Here we handle the case where we know the os, and the CPU type, but not the
2.1624 +# manufacturer. We pick the logical manufacturer.
2.1625 +vendor=unknown
2.1626 +case $basic_machine in
2.1627 + *-unknown)
2.1628 + case $os in
2.1629 + -riscix*)
2.1630 + vendor=acorn
2.1631 + ;;
2.1632 + -sunos*)
2.1633 + vendor=sun
2.1634 + ;;
2.1635 + -cnk*|-aix*)
2.1636 + vendor=ibm
2.1637 + ;;
2.1638 + -beos*)
2.1639 + vendor=be
2.1640 + ;;
2.1641 + -hpux*)
2.1642 + vendor=hp
2.1643 + ;;
2.1644 + -mpeix*)
2.1645 + vendor=hp
2.1646 + ;;
2.1647 + -hiux*)
2.1648 + vendor=hitachi
2.1649 + ;;
2.1650 + -unos*)
2.1651 + vendor=crds
2.1652 + ;;
2.1653 + -dgux*)
2.1654 + vendor=dg
2.1655 + ;;
2.1656 + -luna*)
2.1657 + vendor=omron
2.1658 + ;;
2.1659 + -genix*)
2.1660 + vendor=ns
2.1661 + ;;
2.1662 + -mvs* | -opened*)
2.1663 + vendor=ibm
2.1664 + ;;
2.1665 + -os400*)
2.1666 + vendor=ibm
2.1667 + ;;
2.1668 + -ptx*)
2.1669 + vendor=sequent
2.1670 + ;;
2.1671 + -tpf*)
2.1672 + vendor=ibm
2.1673 + ;;
2.1674 + -vxsim* | -vxworks* | -windiss*)
2.1675 + vendor=wrs
2.1676 + ;;
2.1677 + -aux*)
2.1678 + vendor=apple
2.1679 + ;;
2.1680 + -hms*)
2.1681 + vendor=hitachi
2.1682 + ;;
2.1683 + -mpw* | -macos*)
2.1684 + vendor=apple
2.1685 + ;;
2.1686 + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
2.1687 + vendor=atari
2.1688 + ;;
2.1689 + -vos*)
2.1690 + vendor=stratus
2.1691 + ;;
2.1692 + esac
2.1693 + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
2.1694 + ;;
2.1695 +esac
2.1696 +
2.1697 +echo $basic_machine$os
2.1698 +exit
2.1699 +
2.1700 +# Local variables:
2.1701 +# eval: (add-hook 'write-file-hooks 'time-stamp)
2.1702 +# time-stamp-start: "timestamp='"
2.1703 +# time-stamp-format: "%:y-%02m-%02d"
2.1704 +# time-stamp-end: "'"
2.1705 +# End:
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/build/autoconf/install-sh Mon Jul 02 23:37:12 2012 -0700
3.3 @@ -0,0 +1,119 @@
3.4 +#!/bin/sh
3.5 +
3.6 +#
3.7 +# install - install a program, script, or datafile
3.8 +# This comes from X11R5; it is not part of GNU.
3.9 +#
3.10 +# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $
3.11 +#
3.12 +# This script is compatible with the BSD install script, but was written
3.13 +# from scratch.
3.14 +#
3.15 +
3.16 +
3.17 +# set DOITPROG to echo to test this script
3.18 +
3.19 +# Don't use :- since 4.3BSD and earlier shells don't like it.
3.20 +doit="${DOITPROG-}"
3.21 +
3.22 +
3.23 +# put in absolute paths if you don't have them in your path; or use env. vars.
3.24 +
3.25 +mvprog="${MVPROG-mv}"
3.26 +cpprog="${CPPROG-cp}"
3.27 +chmodprog="${CHMODPROG-chmod}"
3.28 +chownprog="${CHOWNPROG-chown}"
3.29 +chgrpprog="${CHGRPPROG-chgrp}"
3.30 +stripprog="${STRIPPROG-strip}"
3.31 +rmprog="${RMPROG-rm}"
3.32 +
3.33 +instcmd="$mvprog"
3.34 +chmodcmd=""
3.35 +chowncmd=""
3.36 +chgrpcmd=""
3.37 +stripcmd=""
3.38 +rmcmd="$rmprog -f"
3.39 +mvcmd="$mvprog"
3.40 +src=""
3.41 +dst=""
3.42 +
3.43 +while [ x"$1" != x ]; do
3.44 + case $1 in
3.45 + -c) instcmd="$cpprog"
3.46 + shift
3.47 + continue;;
3.48 +
3.49 + -m) chmodcmd="$chmodprog $2"
3.50 + shift
3.51 + shift
3.52 + continue;;
3.53 +
3.54 + -o) chowncmd="$chownprog $2"
3.55 + shift
3.56 + shift
3.57 + continue;;
3.58 +
3.59 + -g) chgrpcmd="$chgrpprog $2"
3.60 + shift
3.61 + shift
3.62 + continue;;
3.63 +
3.64 + -s) stripcmd="$stripprog"
3.65 + shift
3.66 + continue;;
3.67 +
3.68 + *) if [ x"$src" = x ]
3.69 + then
3.70 + src=$1
3.71 + else
3.72 + dst=$1
3.73 + fi
3.74 + shift
3.75 + continue;;
3.76 + esac
3.77 +done
3.78 +
3.79 +if [ x"$src" = x ]
3.80 +then
3.81 + echo "install: no input file specified"
3.82 + exit 1
3.83 +fi
3.84 +
3.85 +if [ x"$dst" = x ]
3.86 +then
3.87 + echo "install: no destination specified"
3.88 + exit 1
3.89 +fi
3.90 +
3.91 +
3.92 +# If destination is a directory, append the input filename; if your system
3.93 +# does not like double slashes in filenames, you may need to add some logic
3.94 +
3.95 +if [ -d $dst ]
3.96 +then
3.97 + dst="$dst"/`basename $src`
3.98 +fi
3.99 +
3.100 +# Make a temp file name in the proper directory.
3.101 +
3.102 +dstdir=`dirname $dst`
3.103 +dsttmp=$dstdir/#inst.$$#
3.104 +
3.105 +# Move or copy the file name to the temp name
3.106 +
3.107 +$doit $instcmd $src $dsttmp
3.108 +
3.109 +# and set any options; do chmod last to preserve setuid bits
3.110 +
3.111 +if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi
3.112 +if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi
3.113 +if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi
3.114 +if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi
3.115 +
3.116 +# Now rename the file to the real destination.
3.117 +
3.118 +$doit $rmcmd $dst
3.119 +$doit $mvcmd $dsttmp $dst
3.120 +
3.121 +
3.122 +exit 0
4.1 --- a/jitcraft/AST.h Mon Jul 02 14:04:29 2012 -0700
4.2 +++ b/jitcraft/AST.h Mon Jul 02 23:37:12 2012 -0700
4.3 @@ -167,8 +167,8 @@
4.4 ExpressionList *postDimensions, Expression *initialization)
4.5 : Statement(pos),
4.6 variable_(var),
4.7 + initialization_(initialization),
4.8 postDimensions_(postDimensions),
4.9 - initialization_(initialization),
4.10 tag_(tag)
4.11 {
4.12 }
4.13 @@ -324,9 +324,9 @@
4.14 public:
4.15 BinaryExpression(const SourcePosition &pos, TokenKind token, Expression *left, Expression *right)
4.16 : Expression(pos),
4.17 - token_(token),
4.18 left_(left),
4.19 - right_(right)
4.20 + right_(right),
4.21 + token_(token)
4.22 {
4.23 }
4.24
5.1 --- a/jitcraft/Barriers.h Mon Jul 02 14:04:29 2012 -0700
5.2 +++ b/jitcraft/Barriers.h Mon Jul 02 23:37:12 2012 -0700
5.3 @@ -1,32 +1,32 @@
5.4 -/*
5.5 - * Copyright (C) 2012 David Anderson
5.6 - *
5.7 - * This file is part of JITCraft.
5.8 - *
5.9 - * JITCraft is free software: you can redistribute it and/or modify it under
5.10 - * the terms of the GNU General Public License as published by the Free
5.11 - * Software Foundation, either version 3 of the License, or (at your option)
5.12 - * any later version.
5.13 - *
5.14 - * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY
5.15 - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
5.16 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
5.17 - *
5.18 - * You should have received a copy of the GNU General Public License along with
5.19 - * JITCraft. If not, see http://www.gnu.org/licenses/.
5.20 - */
5.21 -#ifndef _include_jitcraft_barriers_h_
5.22 -#define _include_jitcraft_barriers_h_
5.23 -
5.24 -class Object;
5.25 -
5.26 -namespace jc {
5.27 -
5.28 +/*
5.29 + * Copyright (C) 2012 David Anderson
5.30 + *
5.31 + * This file is part of JITCraft.
5.32 + *
5.33 + * JITCraft is free software: you can redistribute it and/or modify it under
5.34 + * the terms of the GNU General Public License as published by the Free
5.35 + * Software Foundation, either version 3 of the License, or (at your option)
5.36 + * any later version.
5.37 + *
5.38 + * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY
5.39 + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
5.40 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
5.41 + *
5.42 + * You should have received a copy of the GNU General Public License along with
5.43 + * JITCraft. If not, see http://www.gnu.org/licenses/.
5.44 + */
5.45 +#ifndef _include_jitcraft_barriers_h_
5.46 +#define _include_jitcraft_barriers_h_
5.47 +
5.48 +class Object;
5.49 +
5.50 +namespace jc {
5.51 +
5.52 // Used to store unbarriered heap locations.
5.53 template <typename T>
5.54 class Unbarriered
5.55 {
5.56 - Object *obj_;
5.57 + T *obj_;
5.58
5.59 public:
5.60 Unbarriered()
5.61 @@ -53,13 +53,13 @@
5.62 operator T*() const {
5.63 return static_cast<T *>(obj_);
5.64 }
5.65 -};
5.66 -
5.67 +};
5.68 +
5.69 // Used to store unbarriered heap locations.
5.70 template <typename T>
5.71 class Barriered
5.72 {
5.73 - Object *obj_;
5.74 + T *obj_;
5.75
5.76 public:
5.77 Barriered()
5.78 @@ -86,8 +86,8 @@
5.79 operator T*() const {
5.80 return static_cast<T *>(obj_);
5.81 }
5.82 -};
5.83 -
5.84 -}
5.85 -
5.86 -#endif // _include_jitcraft_barriers_h_
5.87 +};
5.88 +
5.89 +}
5.90 +
5.91 +#endif // _include_jitcraft_barriers_h_
6.1 --- a/jitcraft/BytecodeCompiler.cpp Mon Jul 02 14:04:29 2012 -0700
6.2 +++ b/jitcraft/BytecodeCompiler.cpp Mon Jul 02 23:37:12 2012 -0700
6.3 @@ -1,4 +1,5 @@
6.4 -/*
6.5 +/* vim: set ts=4 sw=4 tw=99 et:
6.6 + *
6.7 * Copyright (C) 2012 David Anderson
6.8 *
6.9 * This file is part of JITCraft.
6.10 @@ -31,9 +32,10 @@
6.11
6.12 BytecodeCompiler::BytecodeCompiler(ParseTree *tree, Module *module)
6.13 : tree_(tree),
6.14 + module_(module),
6.15 + locals_(NULL),
6.16 scope_(NULL),
6.17 - loop_(NULL),
6.18 - module_(module)
6.19 + loop_(NULL)
6.20 {
6.21 }
6.22
6.23 @@ -62,11 +64,10 @@
6.24 return OP_JGE;
6.25 case TOK_LT:
6.26 return OP_JL;
6.27 - case TOK_LE:
6.28 + default:
6.29 + assert(kind == TOK_LE);
6.30 return OP_JLE;
6.31 }
6.32 - assert(false);
6.33 - return OP_NOP;
6.34 }
6.35
6.36 static inline Opcode
6.37 @@ -91,11 +92,10 @@
6.38 return OP_BITAND;
6.39 case TOK_BITOR:
6.40 return OP_BITOR;
6.41 - case TOK_BITXOR:
6.42 + default:
6.43 + assert(kind == TOK_BITXOR);
6.44 return OP_BITXOR;
6.45 }
6.46 - assert(false);
6.47 - return OP_NOP;
6.48 }
6.49
6.50 void
6.51 @@ -566,10 +566,10 @@
6.52 Variable *var = node->variable();
6.53 assert(var->location() == Variable::STACK);
6.54
6.55 - Type *type = var->type();
6.56 + Local<Type> type(ZONE(), var->type());
6.57 if (type->isArray()) {
6.58 // :TODO: use Local
6.59 - ArrayMap *map = BuildArrayMap(ZONE(), type);
6.60 + Local<ArrayMap> map(ZONE(), BuildArrayMap(ZONE(), type));
6.61 __ newarray_lifo(map);
6.62
6.63 if (node->initialization()) {
6.64 @@ -593,8 +593,6 @@
6.65 void
6.66 BytecodeCompiler::visit(CallExpression *node)
6.67 {
6.68 - NameProxy *fun = node->callee()->toNameProxy();
6.69 -
6.70 // :TODO: use Local
6.71 Type *funType = node->callee()->type();
6.72
7.1 --- a/jitcraft/BytecodeEmitter.cpp Mon Jul 02 14:04:29 2012 -0700
7.2 +++ b/jitcraft/BytecodeEmitter.cpp Mon Jul 02 23:37:12 2012 -0700
7.3 @@ -27,8 +27,8 @@
7.4 buffer_pos_(buffer_),
7.5 buffer_end_(buffer_pos_ + ARRAY_LENGTH(inline_buffer_)),
7.6 oom_(false),
7.7 - stackDepth_(0),
7.8 - maxStackDepth_(0)
7.9 + maxStackDepth_(0),
7.10 + stackDepth_(0)
7.11 {
7.12 }
7.13
8.1 --- a/jitcraft/FixedArray.cpp Mon Jul 02 14:04:29 2012 -0700
8.2 +++ b/jitcraft/FixedArray.cpp Mon Jul 02 23:37:12 2012 -0700
8.3 @@ -18,6 +18,7 @@
8.4 #include <limits.h>
8.5 #include "FixedArray.h"
8.6 #include "Zone.h"
8.7 +#include "Heap-inl.h"
8.8
8.9 using namespace jc;
8.10
9.1 --- a/jitcraft/Functions.h Mon Jul 02 14:04:29 2012 -0700
9.2 +++ b/jitcraft/Functions.h Mon Jul 02 23:37:12 2012 -0700
9.3 @@ -57,7 +57,7 @@
9.4 }
9.5
9.6 static inline Function *cast(Object *obj) {
9.7 - assert(obj->is(MapKind_Function));
9.8 + assert(!obj || obj->is(MapKind_Function));
9.9 return reinterpret_cast<Function *>(obj);
9.10 }
9.11 };
10.1 --- a/jitcraft/Handles.h Mon Jul 02 14:04:29 2012 -0700
10.2 +++ b/jitcraft/Handles.h Mon Jul 02 23:37:12 2012 -0700
10.3 @@ -1,29 +1,29 @@
10.4 -/*
10.5 - * Copyright (C) 2012 David Anderson
10.6 - *
10.7 - * This file is part of JITCraft.
10.8 - *
10.9 - * JITCraft is free software: you can redistribute it and/or modify it under
10.10 - * the terms of the GNU General Public License as published by the Free
10.11 - * Software Foundation, either version 3 of the License, or (at your option)
10.12 - * any later version.
10.13 - *
10.14 - * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY
10.15 - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10.16 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
10.17 - *
10.18 - * You should have received a copy of the GNU General Public License along with
10.19 - * JITCraft. If not, see http://www.gnu.org/licenses/.
10.20 - */
10.21 -#ifndef _include_jitcraft_rooting_h_
10.22 -#define _include_jitcraft_rooting_h_
10.23 -
10.24 -#include "Heap.h"
10.25 -
10.26 -namespace jc {
10.27 -
10.28 -class Zone;
10.29 -
10.30 +/*
10.31 + * Copyright (C) 2012 David Anderson
10.32 + *
10.33 + * This file is part of JITCraft.
10.34 + *
10.35 + * JITCraft is free software: you can redistribute it and/or modify it under
10.36 + * the terms of the GNU General Public License as published by the Free
10.37 + * Software Foundation, either version 3 of the License, or (at your option)
10.38 + * any later version.
10.39 + *
10.40 + * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY
10.41 + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10.42 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
10.43 + *
10.44 + * You should have received a copy of the GNU General Public License along with
10.45 + * JITCraft. If not, see http://www.gnu.org/licenses/.
10.46 + */
10.47 +#ifndef _include_jitcraft_rooting_h_
10.48 +#define _include_jitcraft_rooting_h_
10.49 +
10.50 +#include "Objects.h"
10.51 +
10.52 +namespace jc {
10.53 +
10.54 +class Zone;
10.55 +
10.56 template <typename T> class Local;
10.57 template <typename T> class ScopedRoot;
10.58
10.59 @@ -35,7 +35,7 @@
10.60 public:
10.61 template <typename S> Handle(const Handle<S> &handle) {
10.62 typeCheck<S>();
10.63 - thingp_ = reinterpret_cast<const T **>(handle.thingp_);
10.64 + thingp_ = reinterpret_cast<T * const *>(handle.address());
10.65 }
10.66 template <typename S> inline Handle(const Local<S> &local);
10.67 template <typename S> inline Handle(const ScopedRoot<S> &root);
10.68 @@ -47,11 +47,11 @@
10.69 T *operator *() {
10.70 return *thingp_;
10.71 }
10.72 - operator T() { return *thingp_; }
10.73 + operator T *() { return *thingp_; }
10.74 operator bool() const {
10.75 return thingp_ && *thingp_;
10.76 }
10.77 - T **addr() const {
10.78 + T * const *address() const {
10.79 return thingp_;
10.80 }
10.81
10.82 @@ -65,16 +65,16 @@
10.83 (void)v1;
10.84 #endif
10.85 }
10.86 -};
10.87 -
10.88 +};
10.89 +
10.90 template <typename T>
10.91 class Local
10.92 {
10.93 friend class Zone;
10.94
10.95 Zone *zone_;
10.96 + T *thing_;
10.97 Local<Object> *prev_;
10.98 - T *thing_;
10.99
10.100 Local<Object> *prev() {
10.101 return prev_;
10.102 @@ -84,8 +84,7 @@
10.103 }
10.104
10.105 public:
10.106 - inline explicit Local(Zone *zone);
10.107 - inline explicit Local(Zone *zone, T *thing);
10.108 + inline explicit Local(Zone *zone, T *thing = NULL);
10.109 inline ~Local();
10.110
10.111 const Local &operator =(T *thing) {
10.112 @@ -102,10 +101,10 @@
10.113 return !!thing_;
10.114 }
10.115
10.116 - Object **addr() {
10.117 + Object **address() {
10.118 return (Object **)&thing_;
10.119 }
10.120 - Object * const *addr() const {
10.121 + Object * const *address() const {
10.122 return (Object * const *)&thing_;
10.123 }
10.124 operator T *() {
10.125 @@ -120,8 +119,8 @@
10.126 // Disallow copy construction.
10.127 Local(const Local<T> &other);
10.128 Local &operator =(const Local &other);
10.129 -};
10.130 -
10.131 +};
10.132 +
10.133 // A ScopedRoot is a special kind of handle for storing references on the
10.134 // heap in bulk.
10.135 template <typename T>
10.136 @@ -155,47 +154,47 @@
10.137 return operator *();
10.138 }
10.139 T *operator *() const {
10.140 - return thing_;
10.141 + return thingp_;
10.142 }
10.143 operator bool () const {
10.144 - return !!thing_;
10.145 + return !!thingp_;
10.146 }
10.147 -};
10.148 -
10.149 +};
10.150 +
10.151 template <typename T> template <typename S> inline
10.152 Handle<T>::Handle(const Local<S> &local)
10.153 {
10.154 typeCheck<S>();
10.155 - thingp_ = reinterpret_cast<T * const*>(local.addr());
10.156 -}
10.157 -
10.158 -// A RootScope is necessary for using ScopedRoot<>.
10.159 -class RootScope
10.160 -{
10.161 - friend class Zone;
10.162 -
10.163 - struct Block
10.164 - {
10.165 - static const size_t kItemsPerBlock = 4096 / sizeof(Object *);
10.166 -
10.167 - Object **base;
10.168 - Object **ptr;
10.169 - Object **end;
10.170 - Block *prev;
10.171 -
10.172 - Block(Block *prev, Object **base)
10.173 - : base(base),
10.174 - ptr(base),
10.175 - end(base + kItemsPerBlock),
10.176 - prev(prev)
10.177 - {
10.178 - }
10.179 - };
10.180 -
10.181 - private:
10.182 -
10.183 -};
10.184 -
10.185 -}
10.186 -
10.187 -#endif // _include_jitcraft_rooting_h_
10.188 + thingp_ = reinterpret_cast<T * const*>(local.address());
10.189 +}
10.190 +
10.191 +// A RootScope is necessary for using ScopedRoot<>.
10.192 +class RootScope
10.193 +{
10.194 + friend class Zone;
10.195 +
10.196 + struct Block
10.197 + {
10.198 + static const size_t kItemsPerBlock = 4096 / sizeof(Object *);
10.199 +
10.200 + Object **base;
10.201 + Object **ptr;
10.202 + Object **end;
10.203 + Block *prev;
10.204 +
10.205 + Block(Block *prev, Object **base)
10.206 + : base(base),
10.207 + ptr(base),
10.208 + end(base + kItemsPerBlock),
10.209 + prev(prev)
10.210 + {
10.211 + }
10.212 + };
10.213 +
10.214 + private:
10.215 +
10.216 +};
10.217 +
10.218 +}
10.219 +
10.220 +#endif // _include_jitcraft_rooting_h_
11.1 --- a/jitcraft/Heap-inl.h Mon Jul 02 14:04:29 2012 -0700
11.2 +++ b/jitcraft/Heap-inl.h Mon Jul 02 23:37:12 2012 -0700
11.3 @@ -1,28 +1,28 @@
11.4 -/*
11.5 - * Copyright (C) 2012 David Anderson
11.6 - *
11.7 - * This file is part of JITCraft.
11.8 - *
11.9 - * JITCraft is free software: you can redistribute it and/or modify it under
11.10 - * the terms of the GNU General Public License as published by the Free
11.11 - * Software Foundation, either version 3 of the License, or (at your option)
11.12 - * any later version.
11.13 - *
11.14 - * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY
11.15 - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11.16 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
11.17 - *
11.18 - * You should have received a copy of the GNU General Public License along with
11.19 - * JITCraft. If not, see http://www.gnu.org/licenses/.
11.20 - */
11.21 -#ifndef _include_jitcraft_heap_inl_h_
11.22 -#define _include_jitcraft_heap_inl_h_
11.23 -
11.24 -#include "Heap.h"
11.25 -#include "Spaces-inl.h"
11.26 -
11.27 -namespace jc {
11.28 -
11.29 +/*
11.30 + * Copyright (C) 2012 David Anderson
11.31 + *
11.32 + * This file is part of JITCraft.
11.33 + *
11.34 + * JITCraft is free software: you can redistribute it and/or modify it under
11.35 + * the terms of the GNU General Public License as published by the Free
11.36 + * Software Foundation, either version 3 of the License, or (at your option)
11.37 + * any later version.
11.38 + *
11.39 + * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY
11.40 + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11.41 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
11.42 + *
11.43 + * You should have received a copy of the GNU General Public License along with
11.44 + * JITCraft. If not, see http://www.gnu.org/licenses/.
11.45 + */
11.46 +#ifndef _include_jitcraft_heap_inl_h_
11.47 +#define _include_jitcraft_heap_inl_h_
11.48 +
11.49 +#include "Heap.h"
11.50 +#include "Spaces-inl.h"
11.51 +
11.52 +namespace jc {
11.53 +
11.54 static inline Object *
11.55 InitAddressIntoObject(Address address, Map *map)
11.56 {
11.57 @@ -32,8 +32,8 @@
11.58 Object *obj = reinterpret_cast<Object *>(address);
11.59 obj->init(map);
11.60 return obj;
11.61 -}
11.62 -
11.63 +}
11.64 +
11.65 inline Address
11.66 Heap::newObject(size_t bytes, Tenure age)
11.67 {
11.68 @@ -72,18 +72,6 @@
11.69 }
11.70
11.71 inline Object *
11.72 -Heap::allocate(Map *map, size_t bytes, Tenure age)
11.73 -{
11.74 - size_t actualBytes = Align(bytes, kObjectAlignment);
11.75 - Address address = newObject(actualBytes, age);
11.76 - if (!address) {
11.77 - assert(false);
11.78 - return NULL;
11.79 - }
11.80 - return InitAddressIntoObject(address, map);
11.81 -}
11.82 -
11.83 -inline Object *
11.84 Heap::allocate(Handle<Map> map, size_t bytes, Tenure age)
11.85 {
11.86 size_t actualBytes = Align(bytes, kObjectAlignment);
11.87 @@ -93,22 +81,22 @@
11.88 return NULL;
11.89 }
11.90 return InitAddressIntoObject(address, map);
11.91 -}
11.92 -
11.93 -inline Address
11.94 -Heap::newStackObject(size_t bytes)
11.95 -{
11.96 - return lifoSpace_.allocate(bytes);
11.97 -}
11.98 -
11.99 +}
11.100 +
11.101 +inline Address
11.102 +Heap::newStackObject(size_t bytes)
11.103 +{
11.104 + return lifoSpace_.allocate(bytes);
11.105 +}
11.106 +
11.107
11.108 inline void
11.109 Object::write(Zone *zone, Object **ptr, Object *obj)
11.110 {
11.111 *ptr = obj;
11.112 }
11.113 -
11.114 -}
11.115 -
11.116 -#endif // _include_jitcraft_heap_inl_h_
11.117 -
11.118 +
11.119 +}
11.120 +
11.121 +#endif // _include_jitcraft_heap_inl_h_
11.122 +
12.1 --- a/jitcraft/Heap.h Mon Jul 02 14:04:29 2012 -0700
12.2 +++ b/jitcraft/Heap.h Mon Jul 02 23:37:12 2012 -0700
12.3 @@ -1,181 +1,81 @@
12.4 -/*
12.5 - * Copyright (C) 2012 David Anderson
12.6 - *
12.7 - * This file is part of JITCraft.
12.8 - *
12.9 - * JITCraft is free software: you can redistribute it and/or modify it under
12.10 - * the terms of the GNU General Public License as published by the Free
12.11 - * Software Foundation, either version 3 of the License, or (at your option)
12.12 - * any later version.
12.13 - *
12.14 - * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY
12.15 - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12.16 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12.17 - *
12.18 - * You should have received a copy of the GNU General Public License along with
12.19 - * JITCraft. If not, see http://www.gnu.org/licenses/.
12.20 - */
12.21 -#ifndef _include_jitcraft_objects_h_
12.22 -#define _include_jitcraft_objects_h_
12.23 -
12.24 -#include "Utility.h"
12.25 -#include "Spaces.h"
12.26 -#include "Barriers.h"
12.27 -
12.28 -namespace jc {
12.29 -
12.30 -class Zone;
12.31 -
12.32 -// Macros for laying out objects.
12.33 -#define OBJECT_FIELD(Type, name) \
12.34 - Type fld_##name##_;
12.35 -
12.36 -// :TODO: refactor these now that objects are no longer tagged.
12.37 -#define RAW_FIELD_ADDRESS(ptr) \
12.38 - (reinterpret_cast<uintptr_t>(ptr))
12.39 -#define TYPED_FIELD_ADDRESS(Type, ptr) \
12.40 - (reinterpret_cast<Type *>(RAW_FIELD_ADDRESS(ptr)))
12.41 -#define OBJ_FIELD_OFFSET(obj, ptr) \
12.42 - (reinterpret_cast<uintptr_t>(ptr) - reinterpret_cast<uintptr_t>(obj))
12.43 -#define READ_FIELD(name) \
12.44 - read(&fld_##name##_)
12.45 -#define WRITE_FIELD(name, val) \
12.46 - write(&fld_##name##_, val)
12.47 -#define READ_FIELD_OBJ(name) \
12.48 - read(reinterpret_cast<Object **>(&fld_##name##_))
12.49 -#define WRITE_FIELD_OBJ(env, name, val) \
12.50 - write(env, reinterpret_cast<Object **>(&fld_##name##_), val)
12.51 -#define WRITE_FIELD_OBJ_NO_BARRIER(name, val) \
12.52 - writeNoBarrier(reinterpret_cast<Object **>(&fld_##name##_), val)
12.53 -
12.54 -// Garbage-collection objects require a header to describe their layout. This
12.55 -// header is called a "map". The different kinds of maps are enumerated below.
12.56 -class Map;
12.57 -
12.58 -enum MapKind
12.59 -{
12.60 - // Represents Type objects.
12.61 - MapKind_Type,
12.62 -
12.63 - // Represents basic data structures. When adding to this, don't forget
12.64 - // to update Zone::initialize(), or you'll get a NULL crash trying to
12.65 - // allocate, since these maps are cached.
12.66 - MapKind_FixedArray,
12.67 - MapKind_ByteArray,
12.68 - MapKind_Code,
12.69 - MapKind_Reference,
12.70 - MapKind_Module,
12.71 - MapKind_Function,
12.72 -
12.73 - // Used to represent Arrays. This does not have a canonical map.
12.74 - MapKind_Array,
12.75 -
12.76 - // These represent special Map subclasses that require special tracing.
12.77 - MapKinds_Special,
12.78 - MapKind_Meta, // (default map class)
12.79 - MapKind_MetaArray, // ArrayMap instances
12.80 - MapKinds_EndSpecial,
12.81 -
12.82 - MapKinds_Total
12.83 -};
12.84 -
12.85 -typedef void * VoidPtr;
12.86 -
12.87 -// All garbage collected objects must inherit from GCObject. Note that using
12.88 -// virtual functions is illegal, as the |map| field would be displaced.
12.89 -class Object
12.90 -{
12.91 - Barriered<Map> map_;
12.92 -
12.93 +/*
12.94 + * Copyright (C) 2012 David Anderson
12.95 + *
12.96 + * This file is part of JITCraft.
12.97 + *
12.98 + * JITCraft is free software: you can redistribute it and/or modify it under
12.99 + * the terms of the GNU General Public License as published by the Free
12.100 + * Software Foundation, either version 3 of the License, or (at your option)
12.101 + * any later version.
12.102 + *
12.103 + * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY
12.104 + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12.105 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12.106 + *
12.107 + * You should have received a copy of the GNU General Public License along with
12.108 + * JITCraft. If not, see http://www.gnu.org/licenses/.
12.109 + */
12.110 +#ifndef _include_jitcraft_heap_h_
12.111 +#define _include_jitcraft_heap_h_
12.112 +
12.113 +#include "Utility.h"
12.114 +#include "Spaces.h"
12.115 +#include "Barriers.h"
12.116 +#include "Objects.h"
12.117 +#include "Handles.h"
12.118 +
12.119 +namespace jc {
12.120 +
12.121 +class Zone;
12.122 +
12.123 +// Heap-allocated objects go here. Heaps are thread-local.
12.124 +class Heap
12.125 +{
12.126 + Zone *zone_;
12.127 + HeapStack lifoSpace_;
12.128 + OldSpace mapSpace_;
12.129 + OldSpace oldSpace_;
12.130 +
12.131 + Map *metaMap_;
12.132 +
12.133 public:
12.134 - void init(Map *map) {
12.135 - map_ = map;
12.136 - }
12.137 + enum Tenure {
12.138 + // Default, objects go into the nursery.
12.139 + Tenure_Default,
12.140 +
12.141 + // If objects are proven to not escape the stack, they can go into
12.142 + // a LIFO arena. Allocation on the LIFO arena is not guaranteed to
12.143 + // succeed; thus, objects may still be allocated in other arenas.
12.144 + Tenure_Stack,
12.145 +
12.146 + // Objects that should not go into the nursery (i.e. are expected
12.147 + // to be long-living) go here.
12.148 + Tenure_Old
12.149 + };
12.150 +
12.151 + private:
12.152 + Address newOldObject(size_t bytes);
12.153 + inline Address newStackObject(size_t bytes);
12.154 + inline Address newObject(size_t bytes, Tenure pretenure);
12.155
12.156 - Map *map() {
12.157 - return map_;
12.158 - }
12.159 - inline bool is(MapKind map);
12.160 -
12.161 - inline void write(Zone *zone, Object **ptr, Object *value);
12.162 -};
12.163 -
12.164 -// Maps describe the layout of GCObjects. Every GCObject requires a map.
12.165 -class Map : public Object
12.166 -{
12.167 - MapKind kind_;
12.168 -
12.169 - public:
12.170 - void setKind(MapKind kind) {
12.171 - kind_ = kind;
12.172 - }
12.173 - MapKind kind() {
12.174 - return kind_;
12.175 - }
12.176 -
12.177 - static inline Map *cast(Object *obj) {
12.178 - // Note that ArrayMap is a map, but a special one: since it is non-
12.179 - assert(obj->map()->kind() > MapKinds_Special &&
12.180 - obj->map()->kind() < MapKinds_EndSpecial);
12.181 - return reinterpret_cast<Map *>(obj);
12.182 - }
12.183 -};
12.184 -
12.185 -// Heap-allocated objects go here. Heaps are thread-local.
12.186 -class Heap
12.187 -{
12.188 - Zone *zone_;
12.189 - HeapStack lifoSpace_;
12.190 - OldSpace mapSpace_;
12.191 - OldSpace oldSpace_;
12.192 -
12.193 - Map *metaMap_;
12.194 -
12.195 - public:
12.196 - enum Tenure {
12.197 - // Default, objects go into the nursery.
12.198 - Tenure_Default,
12.199 -
12.200 - // If objects are proven to not escape the stack, they can go into
12.201 - // a LIFO arena. Allocation on the LIFO arena is not guaranteed to
12.202 - // succeed; thus, objects may still be allocated in other arenas.
12.203 - Tenure_Stack,
12.204 -
12.205 - // Objects that should not go into the nursery (i.e. are expected
12.206 - // to be long-living) go here.
12.207 - Tenure_Old
12.208 - };
12.209 -
12.210 - private:
12.211 - Address newOldObject(size_t bytes);
12.212 - inline Address newStackObject(size_t bytes);
12.213 - inline Address newObject(size_t bytes, Tenure pretenure);
12.214 -
12.215 - public:
12.216 - Heap(Zone *zone);
12.217 - bool initialize();
12.218 -
12.219 - inline Object *allocate(Map *map, size_t byes, Tenure pretenure);
12.220 - inline Object *allocate(Handle<Map> map, size_t byes, Tenure pretenure);
12.221 - Map *allocateMap(MapKind kind, size_t bytes);
12.222 -
12.223 - Map *metaMap() {
12.224 - return metaMap_;
12.225 - }
12.226 - inline Address lifoPosition() const {
12.227 - return lifoSpace_.position();
12.228 - }
12.229 - inline void unwindLifo(Address to) {
12.230 - lifoSpace_.unwind(to);
12.231 - }
12.232 -};
12.233 -
12.234 -inline bool
12.235 -Object::is(MapKind kind)
12.236 -{
12.237 - return map()->kind() == kind;
12.238 -}
12.239 -
12.240 -}
12.241 -
12.242 -#endif //_include_jitcraft_objects_h_
12.243 + public:
12.244 + Heap(Zone *zone);
12.245 + bool initialize();
12.246 +
12.247 + inline Object *allocate(Handle<Map> map, size_t byes, Tenure pretenure);
12.248 + Map *allocateMap(MapKind kind, size_t bytes);
12.249 +
12.250 + Map *metaMap() {
12.251 + return metaMap_;
12.252 + }
12.253 + inline Address lifoPosition() const {
12.254 + return lifoSpace_.position();
12.255 + }
12.256 + inline void unwindLifo(Address to) {
12.257 + lifoSpace_.unwind(to);
12.258 + }
12.259 +};
12.260 +
12.261 +}
12.262 +
12.263 +#endif //_include_jitcraft_heap_h_
13.1 --- a/jitcraft/Interpreter.cpp Mon Jul 02 14:04:29 2012 -0700
13.2 +++ b/jitcraft/Interpreter.cpp Mon Jul 02 23:37:12 2012 -0700
13.3 @@ -21,6 +21,7 @@
13.4 #include "Types.h"
13.5 #include "Array.h"
13.6 #include "Reference.h"
13.7 +#include "Heap-inl.h"
13.8
13.9 using namespace jc;
13.10
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
14.2 +++ b/jitcraft/Makefile.in Mon Jul 02 23:37:12 2012 -0700
14.3 @@ -0,0 +1,95 @@
14.4 +#vim: set ft=make:
14.5 +
14.6 +CXX=@CXX@
14.7 +CXXFLAGS=@CXXFLAGS@
14.8 +srcdir=@srcdir@
14.9 +VPATH=${srcdir}
14.10 +TOOLS=${srcdir}/../build
14.11 +CXXVENDOR=@CXXVENDOR@
14.12 +PLATFORM="@PLATFORM@"
14.13 +NULL =
14.14 +
14.15 +INCLUDES += -I${srcdir}
14.16 +CXXFLAGS += $(INCLUDES)
14.17 +BASECXXFLAGS = -Wall -Werror -Wno-null-arithmetic
14.18 +
14.19 +CPPSRCS = \
14.20 + Array.cpp \
14.21 + BytecodeCompiler.cpp \
14.22 + BytecodeEmitter.cpp \
14.23 + CompileContext.cpp \
14.24 + Exception.cpp \
14.25 + FixedArray.cpp \
14.26 + Functions.cpp \
14.27 + Heap.cpp \
14.28 + Interpreter.cpp \
14.29 + Modules.cpp \
14.30 + NameBinding.cpp \
14.31 + Parser.cpp \
14.32 + Opcodes.cpp \
14.33 + PoolAllocator.cpp \
14.34 + Reference.cpp \
14.35 + Scanner.cpp \
14.36 + Scopes.cpp \
14.37 + SemanticAnalysis.cpp \
14.38 + Spaces.cpp \
14.39 + Stack.cpp \
14.40 + TypeManager.cpp \
14.41 + Types.cpp \
14.42 + Zone.cpp \
14.43 + main.cpp \
14.44 + $(NULL)
14.45 +
14.46 +ifeq ("darwin", $(PLATFORM))
14.47 +CPPSRCS += \
14.48 + Platform-Posix.cpp \
14.49 + $(NULL)
14.50 +endif
14.51 +ifeq ("linux", $(PLATFORM))
14.52 +CPPSRCS += \
14.53 + Platform-Posix.cpp \
14.54 + $(NULL)
14.55 +endif
14.56 +
14.57 +default: all
14.58 +
14.59 +OBJECTS := $(CPPSRCS:%.cpp=%.o)
14.60 +
14.61 +ifeq ($(CXXVENDOR), microsoft)
14.62 +
14.63 +CXXFLAGS += /DWIN32 /D_WINDOWS
14.64 +
14.65 +%.o: %.cpp
14.66 + $(CXX) $(CXXFLAGS) /Fo$@ /c /TP /nologo $<
14.67 +else
14.68 +
14.69 +%.o: %.cpp
14.70 + $(CXX) $(BASECXXFLAGS) $(CXXFLAGS) -c -o $@ -Wp,-MD,.deps/$(patsubst %.o,%.d,$@) $<
14.71 +
14.72 +endif
14.73 +
14.74 +#$(CXX) $(BASECXXFLAGS) $(CXXFLAGS) -c -o $@ -Wp,-MD,.deps/$(basename $(@F)).pp $<
14.75 +
14.76 +DEPEND_FILES := $(strip $(wildcard .deps/*.d))
14.77 +
14.78 +ifneq (,$(DEPEND_FILES))
14.79 +DEPEND_RESULTS = $(shell $(TOOLS)/mddepend.pl - $(DEPEND_FILES))
14.80 +$(eval $(DEPEND_RESULTS))
14.81 +endif
14.82 +
14.83 +all: foobar
14.84 +
14.85 +foobar: libfoobar.a main.o
14.86 + $(CXX) main.o libfoobar.a -lpthread -o foobar
14.87 +
14.88 +libfoobar.a: $(OBJECTS)
14.89 + $(AR) -crs libfoobar.a $(OBJECTS)
14.90 +
14.91 +FORCE:
14.92 +
14.93 +clean:
14.94 + rm -f .deps/*.d
14.95 + rm -f *.o
14.96 + rm -f libfoobar.a
14.97 + rm -f foobar
14.98 +
15.1 --- a/jitcraft/NameBinding.h Mon Jul 02 14:04:29 2012 -0700
15.2 +++ b/jitcraft/NameBinding.h Mon Jul 02 23:37:12 2012 -0700
15.3 @@ -34,8 +34,8 @@
15.4
15.5 class BoundName : public PoolObject
15.6 {
15.7 + Scope *scope_;
15.8 Name *name_;
15.9 - Scope *scope_;
15.10 Type *type_;
15.11 SourcePosition pos_;
15.12
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
16.2 +++ b/jitcraft/Objects.h Mon Jul 02 23:37:12 2012 -0700
16.3 @@ -0,0 +1,110 @@
16.4 +/*
16.5 + * Copyright (C) 2012 David Anderson
16.6 + *
16.7 + * This file is part of JITCraft.
16.8 + *
16.9 + * JITCraft is free software: you can redistribute it and/or modify it under
16.10 + * the terms of the GNU General Public License as published by the Free
16.11 + * Software Foundation, either version 3 of the License, or (at your option)
16.12 + * any later version.
16.13 + *
16.14 + * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY
16.15 + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16.16 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16.17 + *
16.18 + * You should have received a copy of the GNU General Public License along with
16.19 + * JITCraft. If not, see http://www.gnu.org/licenses/.
16.20 + */
16.21 +#ifndef _include_jitcraft_objects_h_
16.22 +#define _include_jitcraft_objects_h_
16.23 +
16.24 +#include "Utility.h"
16.25 +#include "Spaces.h"
16.26 +#include "Barriers.h"
16.27 +
16.28 +namespace jc {
16.29 +
16.30 +class Zone;
16.31 +
16.32 +// Garbage-collection objects require a header to describe their layout. This
16.33 +// header is called a "map". The different kinds of maps are enumerated below.
16.34 +class Map;
16.35 +
16.36 +enum MapKind
16.37 +{
16.38 + // Represents Type objects.
16.39 + MapKind_Type,
16.40 +
16.41 + // Represents basic data structures. When adding to this, don't forget
16.42 + // to update Zone::initialize(), or you'll get a NULL crash trying to
16.43 + // allocate, since these maps are cached.
16.44 + MapKind_FixedArray,
16.45 + MapKind_ByteArray,
16.46 + MapKind_Code,
16.47 + MapKind_Reference,
16.48 + MapKind_Module,
16.49 + MapKind_Function,
16.50 +
16.51 + // Used to represent Arrays. This does not have a canonical map.
16.52 + MapKind_Array,
16.53 +
16.54 + // These represent special Map subclasses that require special tracing.
16.55 + MapKinds_Special,
16.56 + MapKind_Meta, // (default map class)
16.57 + MapKind_MetaArray, // ArrayMap instances
16.58 + MapKinds_EndSpecial,
16.59 +
16.60 + MapKinds_Total
16.61 +};
16.62 +
16.63 +typedef void * VoidPtr;
16.64 +
16.65 +// All garbage collected objects must inherit from GCObject. Note that using
16.66 +// virtual functions is illegal, as the |map| field would be displaced.
16.67 +class Object
16.68 +{
16.69 + Barriered<Map> map_;
16.70 +
16.71 + public:
16.72 + void init(Map *map) {
16.73 + map_ = map;
16.74 + }
16.75 +
16.76 + Map *map() {
16.77 + return map_;
16.78 + }
16.79 + inline bool is(MapKind map);
16.80 +
16.81 + inline void write(Zone *zone, Object **ptr, Object *value);
16.82 +};
16.83 +
16.84 +// Maps describe the layout of GCObjects. Every GCObject requires a map.
16.85 +class Map : public Object
16.86 +{
16.87 + MapKind kind_;
16.88 +
16.89 + public:
16.90 + void setKind(MapKind kind) {
16.91 + kind_ = kind;
16.92 + }
16.93 + MapKind kind() {
16.94 + return kind_;
16.95 + }
16.96 +
16.97 + static inline Map *cast(Object *obj) {
16.98 + // Note that ArrayMap is a map, but a special one: since it is non-
16.99 + assert(obj->map()->kind() > MapKinds_Special &&
16.100 + obj->map()->kind() < MapKinds_EndSpecial);
16.101 + return reinterpret_cast<Map *>(obj);
16.102 + }
16.103 +};
16.104 +
16.105 +inline bool
16.106 +Object::is(MapKind kind)
16.107 +{
16.108 + return map()->kind() == kind;
16.109 +}
16.110 +
16.111 +}
16.112 +
16.113 +#endif //_include_jitcraft_objects_h_
17.1 --- a/jitcraft/Opcodes.h Mon Jul 02 14:04:29 2012 -0700
17.2 +++ b/jitcraft/Opcodes.h Mon Jul 02 23:37:12 2012 -0700
17.3 @@ -63,11 +63,10 @@
17.4 return OP_JL;
17.5 case OP_JL:
17.6 return OP_JGE;
17.7 - case OP_JLE:
17.8 + default:
17.9 + assert(op == OP_JLE);
17.10 return OP_JG;
17.11 }
17.12 - assert(false);
17.13 - return OP_NOP;
17.14 }
17.15
17.16 static inline int
18.1 --- a/jitcraft/Parser.cpp Mon Jul 02 14:04:29 2012 -0700
18.2 +++ b/jitcraft/Parser.cpp Mon Jul 02 23:37:12 2012 -0700
18.3 @@ -250,6 +250,8 @@
18.4
18.5 return new (pool_) IncDecExpression(pos, token, expr, false);
18.6 }
18.7 + default:
18.8 + break;
18.9 }
18.10
18.11
18.12 @@ -316,7 +318,7 @@
18.13 }
18.14
18.15 Expression *
18.16 -Parser::bitand()
18.17 +Parser::bitand_()
18.18 {
18.19 Expression *left = shift();
18.20 while (left) {
18.21 @@ -334,7 +336,7 @@
18.22 Expression *
18.23 Parser::bitxor()
18.24 {
18.25 - Expression *left = bitand();
18.26 + Expression *left = bitand_();
18.27 while (left) {
18.28 if (!match(TOK_BITXOR))
18.29 break;
18.30 @@ -348,7 +350,7 @@
18.31 }
18.32
18.33 Expression *
18.34 -Parser::bitor()
18.35 +Parser::bitor_()
18.36 {
18.37 Expression *left = bitxor();
18.38 while (left) {
18.39 @@ -366,7 +368,7 @@
18.40 Expression *
18.41 Parser::relational()
18.42 {
18.43 - Expression *left = bitor();
18.44 + Expression *left = bitor_();
18.45 while (left) {
18.46 TokenKind kind = scanner_.peek();
18.47 if (kind < TOK_LT || kind > TOK_GE)
18.48 @@ -651,7 +653,7 @@
18.49 }
18.50
18.51 if (!expect(TOK_IF))
18.52 - return false;
18.53 + return NULL;
18.54
18.55 SourcePosition pos = scanner_.begin();
18.56 if (!expect(TOK_LPAREN))
18.57 @@ -726,6 +728,9 @@
18.58
18.59 case TOK_LBRACE:
18.60 return block();
18.61 +
18.62 + default:
18.63 + break;
18.64 }
18.65
18.66 if (!statement) {
19.1 --- a/jitcraft/Parser.h Mon Jul 02 14:04:29 2012 -0700
19.2 +++ b/jitcraft/Parser.h Mon Jul 02 23:37:12 2012 -0700
19.3 @@ -56,9 +56,9 @@
19.4 Expression *multiplication();
19.5 Expression *addition();
19.6 Expression *shift();
19.7 - Expression *bitand();
19.8 + Expression *bitand_();
19.9 Expression *bitxor();
19.10 - Expression *bitor();
19.11 + Expression *bitor_();
19.12 Expression *relational();
19.13 Expression *equals();
19.14 Expression *assignment();
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
20.2 +++ b/jitcraft/Platform-Posix.cpp Mon Jul 02 23:37:12 2012 -0700
20.3 @@ -0,0 +1,101 @@
20.4 +/* vim: set ts=4 sw=4 tw=99 et:
20.5 + *
20.6 + * Copyright (C) 2012 David Anderson
20.7 + *
20.8 + * This file is part of JITCraft.
20.9 + *
20.10 + * JITCraft is free software: you can redistribute it and/or modify it under
20.11 + * the terms of the GNU General Public License as published by the Free
20.12 + * Software Foundation, either version 3 of the License, or (at your option)
20.13 + * any later version.
20.14 + *
20.15 + * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY
20.16 + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20.17 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
20.18 + *
20.19 + * You should have received a copy of the GNU General Public License along with
20.20 + * JITCraft. If not, see http://www.gnu.org/licenses/.
20.21 + */
20.22 +#include <sys/mman.h>
20.23 +#include "Platform.h"
20.24 +
20.25 +using namespace jc;
20.26 +
20.27 +static inline int
20.28 +ToProtBits(OS::Protection prot)
20.29 +{
20.30 + switch (prot) {
20.31 + case OS::Prot_ReadWrite:
20.32 + return PROT_READ | PROT_WRITE;
20.33 + case OS::Prot_ReadWriteExecute:
20.34 + return PROT_READ | PROT_WRITE | PROT_EXEC;
20.35 + default:
20.36 + assert(prot == OS::Prot_ReadExecute);
20.37 + return PROT_READ | PROT_EXEC;
20.38 + }
20.39 +}
20.40 +
20.41 +Address
20.42 +OS::MapMemory(size_t amount, MapMode mode, Protection prot_)
20.43 +{
20.44 + int prot = ToProtBits(prot_);
20.45 + void *addr = mmap(NULL, amount, prot, MAP_ANON | MAP_PRIVATE, -1, 0);
20.46 + if (addr == MAP_FAILED)
20.47 + return NULL;
20.48 +
20.49 + return Address(addr);
20.50 +}
20.51 +
20.52 +bool
20.53 +OS::CommitMemory(Address address, size_t amount, Protection prot_)
20.54 +{
20.55 + return true;
20.56 +}
20.57 +
20.58 +void
20.59 +OS::UnmapMemory(Address address, size_t size)
20.60 +{
20.61 + munmap(address, size);
20.62 +}
20.63 +
20.64 +OS::AlignableMapping
20.65 +OS::MapAlignedMemory(size_t amount, size_t alignment, MapMode mode)
20.66 +{
20.67 + assert(amount >= alignment);
20.68 + assert(IsPowerOfTwo(alignment));
20.69 +
20.70 + if (alignment == kPageAlignment) {
20.71 + Address address = MapMemory(amount, mode, Prot_ReadWrite);
20.72 + if (!address)
20.73 + return AlignableMapping();
20.74 + return AlignableMapping(address, alignment, amount);
20.75 + }
20.76 +
20.77 + size_t requested = Min(amount * 2, amount + 2 * alignment);
20.78 + Address address = MapMemory(amount, mode, Prot_ReadWrite);
20.79 + if (!address)
20.80 + return AlignableMapping();
20.81 +
20.82 + size_t begin = 0;
20.83 + Address aligned = AlignedBase(address, alignment);
20.84 + if (!IsAligned(address, alignment)) {
20.85 + // Shave off the first part of the unaligned region.
20.86 + aligned += alignment;
20.87 + begin = size_t(aligned - address);
20.88 + UnmapAlignedMemory(address, begin);
20.89 + }
20.90 +
20.91 + if (requested - begin > amount) {
20.92 + // Shave off the last part of the unaligned region.
20.93 + UnmapAlignedMemory(address + amount, requested - amount - begin);
20.94 + }
20.95 +
20.96 + return AlignableMapping(aligned, alignment, amount);
20.97 +}
20.98 +
20.99 +void
20.100 +OS::UnmapAlignedMemory(Address address, size_t size)
20.101 +{
20.102 + OS::UnmapMemory(address, size);
20.103 +}
20.104 +
21.1 --- a/jitcraft/Platform-Windows.cpp Mon Jul 02 14:04:29 2012 -0700
21.2 +++ b/jitcraft/Platform-Windows.cpp Mon Jul 02 23:37:12 2012 -0700
21.3 @@ -1,19 +1,20 @@
21.4 -/*
21.5 - * Copyright (C) 2012 David Anderson
21.6 - *
21.7 - * This file is part of JITCraft.
21.8 - *
21.9 - * JITCraft is free software: you can redistribute it and/or modify it under
21.10 - * the terms of the GNU General Public License as published by the Free
21.11 - * Software Foundation, either version 3 of the License, or (at your option)
21.12 - * any later version.
21.13 - *
21.14 - * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY
21.15 - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
21.16 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
21.17 - *
21.18 - * You should have received a copy of the GNU General Public License along with
21.19 - * JITCraft. If not, see http://www.gnu.org/licenses/.
21.20 +/* vim: set ts=4 sw=4 tw=99 et:
21.21 + *
21.22 + * Copyright (C) 2012 David Anderson
21.23 + *
21.24 + * This file is part of JITCraft.
21.25 + *
21.26 + * JITCraft is free software: you can redistribute it and/or modify it under
21.27 + * the terms of the GNU General Public License as published by the Free
21.28 + * Software Foundation, either version 3 of the License, or (at your option)
21.29 + * any later version.
21.30 + *
21.31 + * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY
21.32 + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
21.33 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
21.34 + *
21.35 + * You should have received a copy of the GNU General Public License along with
21.36 + * JITCraft. If not, see http://www.gnu.org/licenses/.
21.37 */
21.38
21.39 // :TODO: move into utility-style include
21.40 @@ -27,7 +28,7 @@
21.41 ToProtBits(OS::Protection prot)
21.42 {
21.43 switch (prot) {
21.44 - case OS::Prot_ReadWrite:
21.45 + case OS::Prot_ReadWrite:
21.46 return PAGE_READWRITE;
21.47 case OS::Prot_ReadWriteExecute:
21.48 return PAGE_EXECUTE_READWRITE;
21.49 @@ -61,6 +62,22 @@
21.50 VirtualFree(address, 0, MEM_RELEASE);
21.51 }
21.52
21.53 +static Address
21.54 +MapMemoryAt(Address address, size_t amount, MapMode mode, Protection prot_)
21.55 +{
21.56 + DWORD bits = ToProtBits(prot_);
21.57 + DWORD flags = MEM_RESERVE;
21.58 + if (mode == Map_Commit)
21.59 + flags |= MEM_COMMIT;
21.60 +
21.61 + Address x = (Address)VirtualAlloc((LPVOID)address, amount, flags, bits);
21.62 + if (!x) {
21.63 + DWORD err = GetLastError();
21.64 + return x;
21.65 + }
21.66 + return x;
21.67 +}
21.68 +
21.69 OS::AlignableMapping
21.70 OS::MapAlignedMemory(size_t amount, size_t alignment, MapMode mode)
21.71 {
21.72 @@ -92,22 +109,6 @@
21.73 return AlignableMapping(addr, alignment, amount);
21.74 }
21.75
21.76 -Address
21.77 -OS::MapMemoryAt(Address address, size_t amount, MapMode mode, Protection prot_)
21.78 -{
21.79 - DWORD bits = ToProtBits(prot_);
21.80 - DWORD flags = MEM_RESERVE;
21.81 - if (mode == Map_Commit)
21.82 - flags |= MEM_COMMIT;
21.83 -
21.84 - Address x = (Address)VirtualAlloc((LPVOID)address, amount, flags, bits);
21.85 - if (!x) {
21.86 - DWORD err = GetLastError();
21.87 - return x;
21.88 - }
21.89 - return x;
21.90 -}
21.91 -
21.92 void
21.93 OS::UnmapAlignedMemory(Address address, size_t size)
21.94 {
22.1 --- a/jitcraft/Platform.h Mon Jul 02 14:04:29 2012 -0700
22.2 +++ b/jitcraft/Platform.h Mon Jul 02 23:37:12 2012 -0700
22.3 @@ -1,27 +1,28 @@
22.4 -/*
22.5 - * Copyright (C) 2012 David Anderson
22.6 - *
22.7 - * This file is part of JITCraft.
22.8 - *
22.9 - * JITCraft is free software: you can redistribute it and/or modify it under
22.10 - * the terms of the GNU General Public License as published by the Free
22.11 - * Software Foundation, either version 3 of the License, or (at your option)
22.12 - * any later version.
22.13 - *
22.14 - * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY
22.15 - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
22.16 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
22.17 - *
22.18 - * You should have received a copy of the GNU General Public License along with
22.19 - * JITCraft. If not, see http://www.gnu.org/licenses/.
22.20 - */
22.21 -#ifndef _include_jitcraft_platform_h_
22.22 -#define _include_jitcraft_platform_h_
22.23 -
22.24 -#include "Utility.h"
22.25 -
22.26 -namespace jc {
22.27 -
22.28 +/* vim: set ts=4 sw=4 tw=99 et:
22.29 + *
22.30 + * Copyright (C) 2012 David Anderson
22.31 + *
22.32 + * This file is part of JITCraft.
22.33 + *
22.34 + * JITCraft is free software: you can redistribute it and/or modify it under
22.35 + * the terms of the GNU General Public License as published by the Free
22.36 + * Software Foundation, either version 3 of the License, or (at your option)
22.37 + * any later version.
22.38 + *
22.39 + * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY
22.40 + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
22.41 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
22.42 + *
22.43 + * You should have received a copy of the GNU General Public License along with
22.44 + * JITCraft. If not, see http://www.gnu.org/licenses/.
22.45 + */
22.46 +#ifndef _include_jitcraft_platform_h_
22.47 +#define _include_jitcraft_platform_h_
22.48 +
22.49 +#include "Utility.h"
22.50 +
22.51 +namespace jc {
22.52 +
22.53 namespace OS {
22.54 enum Protection {
22.55 Prot_ReadWrite, // rw-, for the heap
22.56 @@ -77,16 +78,13 @@
22.57 // The default alignment of memory returned via MapMemory().
22.58 // :TODO: better ifdefs
22.59 #ifdef _MSC_VER
22.60 - static const size_t kMapAlignment = 64 * kKB;
22.61 + static const size_t kPageAlignment = 64 * kKB;
22.62 #else
22.63 - static const size_t kMapAlignment = 4 * kKB;
22.64 + static const size_t kPageAlignment = 4 * kKB;
22.65 #endif
22.66
22.67 - // Internal OS:: use only.
22.68 - Address MapMemoryAt(Address address, size_t amount, MapMode mode, Protection prot);
22.69 - AlignableMapping Shared_MapAlignableMemory(size_t amount, size_t alignment, MapMode mode);
22.70 -}
22.71 -
22.72 -}
22.73 -
22.74 -#endif // _include_jitcraft_platform_h_
22.75 +}
22.76 +
22.77 +}
22.78 +
22.79 +#endif // _include_jitcraft_platform_h_
23.1 --- a/jitcraft/Scanner.cpp Mon Jul 02 14:04:29 2012 -0700
23.2 +++ b/jitcraft/Scanner.cpp Mon Jul 02 23:37:12 2012 -0700
23.3 @@ -17,6 +17,7 @@
23.4 */
23.5 #include <assert.h>
23.6 #include <ctype.h>
23.7 +#include <math.h>
23.8 #include "Scanner.h"
23.9 #include "Utility.h"
23.10
24.1 --- a/jitcraft/Scopes.cpp Mon Jul 02 14:04:29 2012 -0700
24.2 +++ b/jitcraft/Scopes.cpp Mon Jul 02 23:37:12 2012 -0700
24.3 @@ -24,12 +24,12 @@
24.4
24.5 Scope::Scope(PoolAllocator &pool, Kind kind, Scope *enclosing)
24.6 : pool_(pool),
24.7 - kind_(kind),
24.8 - enclosing_(enclosing),
24.9 locals_(0),
24.10 maxContainedLocals_(0),
24.11 numFunctions_(0),
24.12 - lifoSlot_(NULL)
24.13 + lifoSlot_(NULL),
24.14 + kind_(kind),
24.15 + enclosing_(enclosing)
24.16 {
24.17 }
24.18
24.19 @@ -143,7 +143,7 @@
24.20 for (size_t i = 0; i < names_.size(); i++) {
24.21 BoundName *name = names_[i];
24.22
24.23 - if (name->kind() == FUNCTION) {
24.24 + if (name->kind() == BoundName::FUNCTION) {
24.25 NamedFunction *fun = name->toNamedFunction();
24.26 fun->allocate(numFunctions_++);
24.27 }
25.1 --- a/jitcraft/SemanticAnalysis.cpp Mon Jul 02 14:04:29 2012 -0700
25.2 +++ b/jitcraft/SemanticAnalysis.cpp Mon Jul 02 23:37:12 2012 -0700
25.3 @@ -20,6 +20,7 @@
25.4 #include "Zone.h"
25.5 #include "TypeManager.h"
25.6 #include "Scopes.h"
25.7 +#include "Heap-inl.h"
25.8
25.9 using namespace jc;
25.10
25.11 @@ -47,9 +48,10 @@
25.12 case TOK_SHL:
25.13 *out = BoxedPrimitive::Int(left.toInt() << right.toInt());
25.14 return true;
25.15 +
25.16 + default:
25.17 + return false;
25.18 }
25.19 -
25.20 - return true;
25.21 }
25.22
25.23 static bool
25.24 @@ -199,7 +201,7 @@
25.25 Type *floatType = left->isFloat() ? left : right;
25.26 Type *other = left->isFloat() ? right : left;
25.27 if (other->isFloat() || (other->isInt32() && !other->tag()))
25.28 - return other;
25.29 + return floatType;
25.30 }
25.31 }
25.32
26.1 --- a/jitcraft/Stack.cpp Mon Jul 02 14:04:29 2012 -0700
26.2 +++ b/jitcraft/Stack.cpp Mon Jul 02 23:37:12 2012 -0700
26.3 @@ -25,8 +25,8 @@
26.4
26.5 Stack::Stack()
26.6 : buffer_(NULL),
26.7 - top_(NULL),
26.8 - end_(NULL)
26.9 + end_(NULL),
26.10 + top_(NULL)
26.11 {
26.12 }
26.13
27.1 --- a/jitcraft/Utility.h Mon Jul 02 14:04:29 2012 -0700
27.2 +++ b/jitcraft/Utility.h Mon Jul 02 23:37:12 2012 -0700
27.3 @@ -1,135 +1,151 @@
27.4 -/*
27.5 - * Copyright (C) 2012 David Anderson
27.6 - *
27.7 - * This file is part of JITCraft.
27.8 - *
27.9 - * JITCraft is free software: you can redistribute it and/or modify it under
27.10 - * the terms of the GNU General Public License as published by the Free
27.11 - * Software Foundation, either version 3 of the License, or (at your option)
27.12 - * any later version.
27.13 - *
27.14 - * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY
27.15 - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
27.16 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
27.17 - *
27.18 - * You should have received a copy of the GNU General Public License along with
27.19 - * JITCraft. If not, see http://www.gnu.org/licenses/.
27.20 - */
27.21 -#ifndef _include_jitcraft_utility_h_
27.22 -#define _include_jitcraft_utility_h_
27.23 -
27.24 -#include <assert.h>
27.25 -#include <intrin.h>
27.26 -#include <stdint.h>
27.27 -
27.28 -#ifdef _MSC_VER
27.29 -# pragma warning(disable:4355)
27.30 -#endif
27.31 -
27.32 -namespace jc {
27.33 -
27.34 -static const size_t kMallocAlignment = sizeof(void *) * 2;
27.35 -
27.36 -typedef uint8_t uint8;
27.37 -typedef int32_t int32;
27.38 -typedef uint32_t uint32;
27.39 -
27.40 -typedef uint8 * Address;
27.41 -
27.42 -static const size_t kKB = 1024;
27.43 -static const size_t kMB = 1024 * kKB;
27.44 -static const size_t kGB = 1024 * kMB;
27.45 -
27.46 -template <typename T>
27.47 -class AutoVec
27.48 -{
27.49 - T *t_;
27.50 -
27.51 - public:
27.52 - AutoVec()
27.53 - : t_(NULL)
27.54 - {
27.55 - }
27.56 - AutoVec(T *t)
27.57 - : t_(t)
27.58 - {
27.59 - }
27.60 - ~AutoVec() {
27.61 - delete [] t_;
27.62 - }
27.63 - operator T *() {
27.64 - return t_;
27.65 - }
27.66 - void operator =(T *t) {
27.67 - if (t_)
27.68 - delete [] t_;
27.69 - t_ = t;
27.70 - }
27.71 -};
27.72 -
27.73 -static inline size_t
27.74 -Log2(size_t number)
27.75 -{
27.76 - assert(number != 0);
27.77 -
27.78 - unsigned long rval;
27.79 - _BitScanReverse(&rval, number);
27.80 - return rval;
27.81 -}
27.82 -
27.83 -static inline bool
27.84 -IsPowerOfTwo(size_t value)
27.85 -{
27.86 - if (value == 0)
27.87 - return false;
27.88 - return !(value & (value - 1));
27.89 -}
27.90 -
27.91 -static inline size_t
27.92 -Align(size_t count, size_t alignment)
27.93 -{
27.94 - assert(IsPowerOfTwo(alignment));
27.95 - return count + (alignment - (count % alignment)) % alignment;
27.96 -}
27.97 -
27.98 -static inline bool
27.99 -IsUint32AddSafe(unsigned a, unsigned b)
27.100 -{
27.101 - unsigned log2_a = Log2(a);
27.102 - unsigned log2_b = Log2(b);
27.103 - return (log2_a < sizeof(unsigned) * 8) &&
27.104 - (log2_b < sizeof(unsigned) * 8);
27.105 -}
27.106 -
27.107 -static inline bool
27.108 -IsUint32MultiplySafe(unsigned a, unsigned b)
27.109 -{
27.110 - if (a <= 1 || b <= 1)
27.111 - return true;
27.112 -
27.113 - unsigned log2_a = Log2(a);
27.114 - unsigned log2_b = Log2(b);
27.115 - return log2_a + log2_b <= sizeof(unsigned) * 8;
27.116 -}
27.117 -
27.118 -#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
27.119 -#define STATIC_ASSERT(cond) extern int static_assert_f(int a[(cond) ? 1 : -1])
27.120 -
27.121 +/*
27.122 + * Copyright (C) 2012 David Anderson
27.123 + *
27.124 + * This file is part of JITCraft.
27.125 + *
27.126 + * JITCraft is free software: you can redistribute it and/or modify it under
27.127 + * the terms of the GNU General Public License as published by the Free
27.128 + * Software Foundation, either version 3 of the License, or (at your option)
27.129 + * any later version.
27.130 + *
27.131 + * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY
27.132 + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
27.133 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
27.134 + *
27.135 + * You should have received a copy of the GNU General Public License along with
27.136 + * JITCraft. If not, see http://www.gnu.org/licenses/.
27.137 + */
27.138 +#ifndef _include_jitcraft_utility_h_
27.139 +#define _include_jitcraft_utility_h_
27.140 +
27.141 +#include <assert.h>
27.142 +#include <stdint.h>
27.143 +#ifdef _MSC_VER
27.144 +# include <intrin.h>
27.145 +#endif
27.146 +
27.147 +#ifdef _MSC_VER
27.148 +# pragma warning(disable:4355)
27.149 +#endif
27.150 +
27.151 +namespace jc {
27.152 +
27.153 +static const size_t kMallocAlignment = sizeof(void *) * 2;
27.154 +
27.155 +typedef uint8_t uint8;
27.156 +typedef int32_t int32;
27.157 +typedef uint32_t uint32;
27.158 +
27.159 +typedef uint8 * Address;
27.160 +
27.161 +static const size_t kKB = 1024;
27.162 +static const size_t kMB = 1024 * kKB;
27.163 +static const size_t kGB = 1024 * kMB;
27.164 +
27.165 +template <typename T>
27.166 +class AutoVec
27.167 +{
27.168 + T *t_;
27.169 +
27.170 + public:
27.171 + AutoVec()
27.172 + : t_(NULL)
27.173 + {
27.174 + }
27.175 + AutoVec(T *t)
27.176 + : t_(t)
27.177 + {
27.178 + }
27.179 + ~AutoVec() {
27.180 + delete [] t_;
27.181 + }
27.182 + operator T *() {
27.183 + return t_;
27.184 + }
27.185 + void operator =(T *t) {
27.186 + if (t_)
27.187 + delete [] t_;
27.188 + t_ = t;
27.189 + }
27.190 +};
27.191 +
27.192 +static inline size_t
27.193 +Log2(size_t number)
27.194 +{
27.195 + assert(number != 0);
27.196 +
27.197 +#ifdef MSC_VER
27.198 + unsigned long rval;
27.199 + _BitScanReverse(&rval, number);
27.200 + return rval;
27.201 +#else
27.202 + size_t bit;
27.203 + asm("bsr %1, %0\n"
27.204 + : "=r" (bit)
27.205 + : "rm" (number));
27.206 + return bit;
27.207 +#endif
27.208 +}
27.209 +
27.210 +static inline bool
27.211 +IsPowerOfTwo(size_t value)
27.212 +{
27.213 + if (value == 0)
27.214 + return false;
27.215 + return !(value & (value - 1));
27.216 +}
27.217 +
27.218 +static inline size_t
27.219 +Align(size_t count, size_t alignment)
27.220 +{
27.221 + assert(IsPowerOfTwo(alignment));
27.222 + return count + (alignment - (count % alignment)) % alignment;
27.223 +}
27.224 +
27.225 +static inline bool
27.226 +IsUint32AddSafe(unsigned a, unsigned b)
27.227 +{
27.228 + unsigned log2_a = Log2(a);
27.229 + unsigned log2_b = Log2(b);
27.230 + return (log2_a < sizeof(unsigned) * 8) &&
27.231 + (log2_b < sizeof(unsigned) * 8);
27.232 +}
27.233 +
27.234 +static inline bool
27.235 +IsUint32MultiplySafe(unsigned a, unsigned b)
27.236 +{
27.237 + if (a <= 1 || b <= 1)
27.238 + return true;
27.239 +
27.240 + unsigned log2_a = Log2(a);
27.241 + unsigned log2_b = Log2(b);
27.242 + return log2_a + log2_b <= sizeof(unsigned) * 8;
27.243 +}
27.244 +
27.245 +#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
27.246 +#define STATIC_ASSERT(cond) extern int static_assert_f(int a[(cond) ? 1 : -1])
27.247 +
27.248 template <typename T>
27.249 static inline bool
27.250 IsAligned(T addr, size_t alignment)
27.251 {
27.252 assert(IsPowerOfTwo(alignment));
27.253 return !(uintptr_t(addr) & (alignment - 1));
27.254 -}
27.255 -
27.256 +}
27.257 +
27.258 static inline Address
27.259 AlignedBase(Address addr, size_t alignment)
27.260 {
27.261 assert(IsPowerOfTwo(alignment));
27.262 return Address(uintptr_t(addr) & ~(alignment - 1));
27.263 -}
27.264 -
27.265 -}
27.266 -
27.267 -#endif // _include_jitcraft_utility_h_
27.268 +}
27.269 +
27.270 +template <typename T> static inline T
27.271 +Min(const T &t1, const T &t2)
27.272 +{
27.273 + return t1 < t2 ? t1 : t2;
27.274 +}
27.275 +
27.276 +}
27.277 +
27.278 +#endif // _include_jitcraft_utility_h_
28.1 --- a/jitcraft/Zone.h Mon Jul 02 14:04:29 2012 -0700
28.2 +++ b/jitcraft/Zone.h Mon Jul 02 23:37:12 2012 -0700
28.3 @@ -1,4 +1,5 @@
28.4 -/*
28.5 +/* vim: set ts=4 sw=4 tw=99 et:
28.6 + *
28.7 * Copyright (C) 2012 David Anderson
28.8 *
28.9 * This file is part of JITCraft.
28.10 @@ -40,7 +41,7 @@
28.11 TypeManager *types_;
28.12
28.13 // Root list.
28.14 - Local<Object> *lastThingLocal_;
28.15 + Local<Object> *lastLocalRoot_;
28.16
28.17 public:
28.18 Zone();
28.19 @@ -57,11 +58,8 @@
28.20 }
28.21 Object *allocate(MapKind kind, size_t bytes, Heap::Tenure tenure = Heap::Tenure_Default) {
28.22 assert(maps_[kind]);
28.23 - return allocate(maps_[kind], bytes, tenure);
28.24 - }
28.25 - // :TODO: handle
28.26 - Object *allocate(Map *map, size_t bytes, Heap::Tenure tenure = Heap::Tenure_Default) {
28.27 - return heap_.allocate(map, bytes, tenure);
28.28 + Local<Map> map(this, maps_[kind]);
28.29 + return allocate(map, bytes, tenure);
28.30 }
28.31 Object *allocate(Handle<Map> map, size_t bytes, Heap::Tenure tenure = Heap::Tenure_Default) {
28.32 return heap_.allocate(map, bytes, tenure);
28.33 @@ -70,6 +68,10 @@
28.34 TypeManager *types() const {
28.35 return types_;
28.36 }
28.37 +
28.38 + Local<Object> **lastLocalRoot() {
28.39 + return &lastLocalRoot_;
28.40 + }
28.41 };
28.42
28.43 // In a multi-threaded system, this would be a TLS variable.
28.44 @@ -83,8 +85,8 @@
28.45
28.46 class LocalTop
28.47 {
28.48 + Top &mine_;
28.49 Top *prev_;
28.50 - Top &mine_;
28.51
28.52 public:
28.53 LocalTop(Top &mine)
28.54 @@ -100,6 +102,22 @@
28.55 }
28.56 };
28.57
28.58 +template <typename T>
28.59 +Local<T>::Local(Zone *zone, T *thing)
28.60 + : zone_(zone),
28.61 + thing_(thing),
28.62 + prev_(*zone->lastLocalRoot())
28.63 +{
28.64 + *zone->lastLocalRoot() = toRaw();
28.65 }
28.66
28.67 -#endif // _include_jitcraft_thread_h_
28.68 \ No newline at end of file
28.69 +template <typename T>
28.70 +Local<T>::~Local()
28.71 +{
28.72 + assert(*zone_->lastLocalRoot() == toRaw());
28.73 + *zone_->lastLocalRoot() = prev_;
28.74 +}
28.75 +
28.76 +}
28.77 +
28.78 +#endif // _include_jitcraft_thread_h_
29.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
29.2 +++ b/jitcraft/configure.in Mon Jul 02 23:37:12 2012 -0700
29.3 @@ -0,0 +1,47 @@
29.4 +# -*- Autoconf -*-
29.5 +# Process this file with autoconf to produce a configure script.
29.6 +
29.7 +AC_PREREQ([2.61])
29.8 +AC_INIT(foobar, 0.1, https://bugs.alliedmods.net/)
29.9 +AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
29.10 +AC_CONFIG_SRCDIR([Heap.cpp])
29.11 +AC_LANG(C++)
29.12 +AC_CANONICAL_HOST
29.13 +
29.14 +# Checks for programs.
29.15 +AC_PROG_CXX
29.16 +
29.17 +# Checks for libraries.
29.18 +
29.19 +# Checks for header files.
29.20 +AC_CHECK_HEADERS([limits.h stddef.h stdint.h stdlib.h string.h sys/time.h unistd.h])
29.21 +
29.22 +# Checks for typedefs, structures, and compiler characteristics.
29.23 +AC_C_INLINE
29.24 +
29.25 +# Checks for library functions.
29.26 +AC_FUNC_MALLOC
29.27 +AC_FUNC_REALLOC
29.28 +AC_CHECK_FUNCS([gettimeofday memset strchr])
29.29 +
29.30 +mkdir -p .deps
29.31 +touch .deps/
29.32 +
29.33 +#AX_COMPILER_VENDOR
29.34 +
29.35 +CXXVENDOR=$ax_cv_cxx_compiler_vendor
29.36 +AC_SUBST(CXXVENDOR)
29.37 +
29.38 +case "$host" in
29.39 + *-linux*)
29.40 + PLATFORM="linux"
29.41 + ;;
29.42 + *-darwin*)
29.43 + PLATFORM="darwin"
29.44 + ;;
29.45 +esac
29.46 +
29.47 +AC_SUBST(PLATFORM)
29.48 +
29.49 +AC_OUTPUT(Makefile)
29.50 +