Home | History | Annotate | Download | only in Python-2.7.3
      1 diff -urN a/config.guess b/config.guess
      2 --- a/config.guess	1970-01-01 01:00:00.000000000 +0100
      3 +++ b/config.guess	2012-06-25 19:39:10.609815624 +0100
      4 @@ -0,0 +1,1530 @@
      5 +#! /bin/sh
      6 +# Attempt to guess a canonical system name.
      7 +#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
      8 +#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
      9 +#   2011, 2012 Free Software Foundation, Inc.
     10 +
     11 +timestamp='2012-02-10'
     12 +
     13 +# This file is free software; you can redistribute it and/or modify it
     14 +# under the terms of the GNU General Public License as published by
     15 +# the Free Software Foundation; either version 2 of the License, or
     16 +# (at your option) any later version.
     17 +#
     18 +# This program is distributed in the hope that it will be useful, but
     19 +# WITHOUT ANY WARRANTY; without even the implied warranty of
     20 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     21 +# General Public License for more details.
     22 +#
     23 +# You should have received a copy of the GNU General Public License
     24 +# along with this program; if not, see <http://www.gnu.org/licenses/>.
     25 +#
     26 +# As a special exception to the GNU General Public License, if you
     27 +# distribute this file as part of a program that contains a
     28 +# configuration script generated by Autoconf, you may include it under
     29 +# the same distribution terms that you use for the rest of that program.
     30 +
     31 +
     32 +# Originally written by Per Bothner.  Please send patches (context
     33 +# diff format) to <config-patches (a] gnu.org> and include a ChangeLog
     34 +# entry.
     35 +#
     36 +# This script attempts to guess a canonical system name similar to
     37 +# config.sub.  If it succeeds, it prints the system name on stdout, and
     38 +# exits with 0.  Otherwise, it exits with 1.
     39 +#
     40 +# You can get the latest version of this script from:
     41 +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
     42 +
     43 +me=`echo "$0" | sed -e 's,.*/,,'`
     44 +
     45 +usage="\
     46 +Usage: $0 [OPTION]
     47 +
     48 +Output the configuration name of the system \`$me' is run on.
     49 +
     50 +Operation modes:
     51 +  -h, --help         print this help, then exit
     52 +  -t, --time-stamp   print date of last modification, then exit
     53 +  -v, --version      print version number, then exit
     54 +
     55 +Report bugs and patches to <config-patches (a] gnu.org>."
     56 +
     57 +version="\
     58 +GNU config.guess ($timestamp)
     59 +
     60 +Originally written by Per Bothner.
     61 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
     62 +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
     63 +Free Software Foundation, Inc.
     64 +
     65 +This is free software; see the source for copying conditions.  There is NO
     66 +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
     67 +
     68 +help="
     69 +Try \`$me --help' for more information."
     70 +
     71 +# Parse command line
     72 +while test $# -gt 0 ; do
     73 +  case $1 in
     74 +    --time-stamp | --time* | -t )
     75 +       echo "$timestamp" ; exit ;;
     76 +    --version | -v )
     77 +       echo "$version" ; exit ;;
     78 +    --help | --h* | -h )
     79 +       echo "$usage"; exit ;;
     80 +    -- )     # Stop option processing
     81 +       shift; break ;;
     82 +    - )	# Use stdin as input.
     83 +       break ;;
     84 +    -* )
     85 +       echo "$me: invalid option $1$help" >&2
     86 +       exit 1 ;;
     87 +    * )
     88 +       break ;;
     89 +  esac
     90 +done
     91 +
     92 +if test $# != 0; then
     93 +  echo "$me: too many arguments$help" >&2
     94 +  exit 1
     95 +fi
     96 +
     97 +trap 'exit 1' 1 2 15
     98 +
     99 +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
    100 +# compiler to aid in system detection is discouraged as it requires
    101 +# temporary files to be created and, as you can see below, it is a
    102 +# headache to deal with in a portable fashion.
    103 +
    104 +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
    105 +# use `HOST_CC' if defined, but it is deprecated.
    106 +
    107 +# Portable tmp directory creation inspired by the Autoconf team.
    108 +
    109 +set_cc_for_build='
    110 +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
    111 +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
    112 +: ${TMPDIR=/tmp} ;
    113 + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
    114 + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
    115 + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
    116 + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
    117 +dummy=$tmp/dummy ;
    118 +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
    119 +case $CC_FOR_BUILD,$HOST_CC,$CC in
    120 + ,,)    echo "int x;" > $dummy.c ;
    121 +	for c in cc gcc c89 c99 ; do
    122 +	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
    123 +	     CC_FOR_BUILD="$c"; break ;
    124 +	  fi ;
    125 +	done ;
    126 +	if test x"$CC_FOR_BUILD" = x ; then
    127 +	  CC_FOR_BUILD=no_compiler_found ;
    128 +	fi
    129 +	;;
    130 + ,,*)   CC_FOR_BUILD=$CC ;;
    131 + ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
    132 +esac ; set_cc_for_build= ;'
    133 +
    134 +# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
    135 +# (ghazi (a] noc.rutgers.edu 1994-08-24)
    136 +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
    137 +	PATH=$PATH:/.attbin ; export PATH
    138 +fi
    139 +
    140 +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
    141 +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
    142 +UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
    143 +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
    144 +
    145 +# Note: order is significant - the case branches are not exclusive.
    146 +
    147 +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
    148 +    *:NetBSD:*:*)
    149 +	# NetBSD (nbsd) targets should (where applicable) match one or
    150 +	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
    151 +	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
    152 +	# switched to ELF, *-*-netbsd* would select the old
    153 +	# object file format.  This provides both forward
    154 +	# compatibility and a consistent mechanism for selecting the
    155 +	# object file format.
    156 +	#
    157 +	# Note: NetBSD doesn't particularly care about the vendor
    158 +	# portion of the name.  We always set it to "unknown".
    159 +	sysctl="sysctl -n hw.machine_arch"
    160 +	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
    161 +	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
    162 +	case "${UNAME_MACHINE_ARCH}" in
    163 +	    armeb) machine=armeb-unknown ;;
    164 +	    arm*) machine=arm-unknown ;;
    165 +	    sh3el) machine=shl-unknown ;;
    166 +	    sh3eb) machine=sh-unknown ;;
    167 +	    sh5el) machine=sh5le-unknown ;;
    168 +	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
    169 +	esac
    170 +	# The Operating System including object format, if it has switched
    171 +	# to ELF recently, or will in the future.
    172 +	case "${UNAME_MACHINE_ARCH}" in
    173 +	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
    174 +		eval $set_cc_for_build
    175 +		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
    176 +			| grep -q __ELF__
    177 +		then
    178 +		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
    179 +		    # Return netbsd for either.  FIX?
    180 +		    os=netbsd
    181 +		else
    182 +		    os=netbsdelf
    183 +		fi
    184 +		;;
    185 +	    *)
    186 +		os=netbsd
    187 +		;;
    188 +	esac
    189 +	# The OS release
    190 +	# Debian GNU/NetBSD machines have a different userland, and
    191 +	# thus, need a distinct triplet. However, they do not need
    192 +	# kernel version information, so it can be replaced with a
    193 +	# suitable tag, in the style of linux-gnu.
    194 +	case "${UNAME_VERSION}" in
    195 +	    Debian*)
    196 +		release='-gnu'
    197 +		;;
    198 +	    *)
    199 +		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
    200 +		;;
    201 +	esac
    202 +	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
    203 +	# contains redundant information, the shorter form:
    204 +	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
    205 +	echo "${machine}-${os}${release}"
    206 +	exit ;;
    207 +    *:OpenBSD:*:*)
    208 +	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
    209 +	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
    210 +	exit ;;
    211 +    *:ekkoBSD:*:*)
    212 +	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
    213 +	exit ;;
    214 +    *:SolidBSD:*:*)
    215 +	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
    216 +	exit ;;
    217 +    macppc:MirBSD:*:*)
    218 +	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
    219 +	exit ;;
    220 +    *:MirBSD:*:*)
    221 +	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
    222 +	exit ;;
    223 +    alpha:OSF1:*:*)
    224 +	case $UNAME_RELEASE in
    225 +	*4.0)
    226 +		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
    227 +		;;
    228 +	*5.*)
    229 +		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
    230 +		;;
    231 +	esac
    232 +	# According to Compaq, /usr/sbin/psrinfo has been available on
    233 +	# OSF/1 and Tru64 systems produced since 1995.  I hope that
    234 +	# covers most systems running today.  This code pipes the CPU
    235 +	# types through head -n 1, so we only detect the type of CPU 0.
    236 +	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
    237 +	case "$ALPHA_CPU_TYPE" in
    238 +	    "EV4 (21064)")
    239 +		UNAME_MACHINE="alpha" ;;
    240 +	    "EV4.5 (21064)")
    241 +		UNAME_MACHINE="alpha" ;;
    242 +	    "LCA4 (21066/21068)")
    243 +		UNAME_MACHINE="alpha" ;;
    244 +	    "EV5 (21164)")
    245 +		UNAME_MACHINE="alphaev5" ;;
    246 +	    "EV5.6 (21164A)")
    247 +		UNAME_MACHINE="alphaev56" ;;
    248 +	    "EV5.6 (21164PC)")
    249 +		UNAME_MACHINE="alphapca56" ;;
    250 +	    "EV5.7 (21164PC)")
    251 +		UNAME_MACHINE="alphapca57" ;;
    252 +	    "EV6 (21264)")
    253 +		UNAME_MACHINE="alphaev6" ;;
    254 +	    "EV6.7 (21264A)")
    255 +		UNAME_MACHINE="alphaev67" ;;
    256 +	    "EV6.8CB (21264C)")
    257 +		UNAME_MACHINE="alphaev68" ;;
    258 +	    "EV6.8AL (21264B)")
    259 +		UNAME_MACHINE="alphaev68" ;;
    260 +	    "EV6.8CX (21264D)")
    261 +		UNAME_MACHINE="alphaev68" ;;
    262 +	    "EV6.9A (21264/EV69A)")
    263 +		UNAME_MACHINE="alphaev69" ;;
    264 +	    "EV7 (21364)")
    265 +		UNAME_MACHINE="alphaev7" ;;
    266 +	    "EV7.9 (21364A)")
    267 +		UNAME_MACHINE="alphaev79" ;;
    268 +	esac
    269 +	# A Pn.n version is a patched version.
    270 +	# A Vn.n version is a released version.
    271 +	# A Tn.n version is a released field test version.
    272 +	# A Xn.n version is an unreleased experimental baselevel.
    273 +	# 1.2 uses "1.2" for uname -r.
    274 +	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
    275 +	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
    276 +	exitcode=$?
    277 +	trap '' 0
    278 +	exit $exitcode ;;
    279 +    Alpha\ *:Windows_NT*:*)
    280 +	# How do we know it's Interix rather than the generic POSIX subsystem?
    281 +	# Should we change UNAME_MACHINE based on the output of uname instead
    282 +	# of the specific Alpha model?
    283 +	echo alpha-pc-interix
    284 +	exit ;;
    285 +    21064:Windows_NT:50:3)
    286 +	echo alpha-dec-winnt3.5
    287 +	exit ;;
    288 +    Amiga*:UNIX_System_V:4.0:*)
    289 +	echo m68k-unknown-sysv4
    290 +	exit ;;
    291 +    *:[Aa]miga[Oo][Ss]:*:*)
    292 +	echo ${UNAME_MACHINE}-unknown-amigaos
    293 +	exit ;;
    294 +    *:[Mm]orph[Oo][Ss]:*:*)
    295 +	echo ${UNAME_MACHINE}-unknown-morphos
    296 +	exit ;;
    297 +    *:OS/390:*:*)
    298 +	echo i370-ibm-openedition
    299 +	exit ;;
    300 +    *:z/VM:*:*)
    301 +	echo s390-ibm-zvmoe
    302 +	exit ;;
    303 +    *:OS400:*:*)
    304 +	echo powerpc-ibm-os400
    305 +	exit ;;
    306 +    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
    307 +	echo arm-acorn-riscix${UNAME_RELEASE}
    308 +	exit ;;
    309 +    arm:riscos:*:*|arm:RISCOS:*:*)
    310 +	echo arm-unknown-riscos
    311 +	exit ;;
    312 +    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
    313 +	echo hppa1.1-hitachi-hiuxmpp
    314 +	exit ;;
    315 +    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
    316 +	# akee (a] wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
    317 +	if test "`(/bin/universe) 2>/dev/null`" = att ; then
    318 +		echo pyramid-pyramid-sysv3
    319 +	else
    320 +		echo pyramid-pyramid-bsd
    321 +	fi
    322 +	exit ;;
    323 +    NILE*:*:*:dcosx)
    324 +	echo pyramid-pyramid-svr4
    325 +	exit ;;
    326 +    DRS?6000:unix:4.0:6*)
    327 +	echo sparc-icl-nx6
    328 +	exit ;;
    329 +    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
    330 +	case `/usr/bin/uname -p` in
    331 +	    sparc) echo sparc-icl-nx7; exit ;;
    332 +	esac ;;
    333 +    s390x:SunOS:*:*)
    334 +	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
    335 +	exit ;;
    336 +    sun4H:SunOS:5.*:*)
    337 +	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
    338 +	exit ;;
    339 +    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
    340 +	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
    341 +	exit ;;
    342 +    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
    343 +	echo i386-pc-auroraux${UNAME_RELEASE}
    344 +	exit ;;
    345 +    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
    346 +	eval $set_cc_for_build
    347 +	SUN_ARCH="i386"
    348 +	# If there is a compiler, see if it is configured for 64-bit objects.
    349 +	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
    350 +	# This test works for both compilers.
    351 +	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
    352 +	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
    353 +		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
    354 +		grep IS_64BIT_ARCH >/dev/null
    355 +	    then
    356 +		SUN_ARCH="x86_64"
    357 +	    fi
    358 +	fi
    359 +	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
    360 +	exit ;;
    361 +    sun4*:SunOS:6*:*)
    362 +	# According to config.sub, this is the proper way to canonicalize
    363 +	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
    364 +	# it's likely to be more like Solaris than SunOS4.
    365 +	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
    366 +	exit ;;
    367 +    sun4*:SunOS:*:*)
    368 +	case "`/usr/bin/arch -k`" in
    369 +	    Series*|S4*)
    370 +		UNAME_RELEASE=`uname -v`
    371 +		;;
    372 +	esac
    373 +	# Japanese Language versions have a version number like `4.1.3-JL'.
    374 +	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
    375 +	exit ;;
    376 +    sun3*:SunOS:*:*)
    377 +	echo m68k-sun-sunos${UNAME_RELEASE}
    378 +	exit ;;
    379 +    sun*:*:4.2BSD:*)
    380 +	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
    381 +	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
    382 +	case "`/bin/arch`" in
    383 +	    sun3)
    384 +		echo m68k-sun-sunos${UNAME_RELEASE}
    385 +		;;
    386 +	    sun4)
    387 +		echo sparc-sun-sunos${UNAME_RELEASE}
    388 +		;;
    389 +	esac
    390 +	exit ;;
    391 +    aushp:SunOS:*:*)
    392 +	echo sparc-auspex-sunos${UNAME_RELEASE}
    393 +	exit ;;
    394 +    # The situation for MiNT is a little confusing.  The machine name
    395 +    # can be virtually everything (everything which is not
    396 +    # "atarist" or "atariste" at least should have a processor
    397 +    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
    398 +    # to the lowercase version "mint" (or "freemint").  Finally
    399 +    # the system name "TOS" denotes a system which is actually not
    400 +    # MiNT.  But MiNT is downward compatible to TOS, so this should
    401 +    # be no problem.
    402 +    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
    403 +	echo m68k-atari-mint${UNAME_RELEASE}
    404 +	exit ;;
    405 +    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
    406 +	echo m68k-atari-mint${UNAME_RELEASE}
    407 +	exit ;;
    408 +    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
    409 +	echo m68k-atari-mint${UNAME_RELEASE}
    410 +	exit ;;
    411 +    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
    412 +	echo m68k-milan-mint${UNAME_RELEASE}
    413 +	exit ;;
    414 +    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
    415 +	echo m68k-hades-mint${UNAME_RELEASE}
    416 +	exit ;;
    417 +    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
    418 +	echo m68k-unknown-mint${UNAME_RELEASE}
    419 +	exit ;;
    420 +    m68k:machten:*:*)
    421 +	echo m68k-apple-machten${UNAME_RELEASE}
    422 +	exit ;;
    423 +    powerpc:machten:*:*)
    424 +	echo powerpc-apple-machten${UNAME_RELEASE}
    425 +	exit ;;
    426 +    RISC*:Mach:*:*)
    427 +	echo mips-dec-mach_bsd4.3
    428 +	exit ;;
    429 +    RISC*:ULTRIX:*:*)
    430 +	echo mips-dec-ultrix${UNAME_RELEASE}
    431 +	exit ;;
    432 +    VAX*:ULTRIX*:*:*)
    433 +	echo vax-dec-ultrix${UNAME_RELEASE}
    434 +	exit ;;
    435 +    2020:CLIX:*:* | 2430:CLIX:*:*)
    436 +	echo clipper-intergraph-clix${UNAME_RELEASE}
    437 +	exit ;;
    438 +    mips:*:*:UMIPS | mips:*:*:RISCos)
    439 +	eval $set_cc_for_build
    440 +	sed 's/^	//' << EOF >$dummy.c
    441 +#ifdef __cplusplus
    442 +#include <stdio.h>  /* for printf() prototype */
    443 +	int main (int argc, char *argv[]) {
    444 +#else
    445 +	int main (argc, argv) int argc; char *argv[]; {
    446 +#endif
    447 +	#if defined (host_mips) && defined (MIPSEB)
    448 +	#if defined (SYSTYPE_SYSV)
    449 +	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
    450 +	#endif
    451 +	#if defined (SYSTYPE_SVR4)
    452 +	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
    453 +	#endif
    454 +	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
    455 +	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
    456 +	#endif
    457 +	#endif
    458 +	  exit (-1);
    459 +	}
    460 +EOF
    461 +	$CC_FOR_BUILD -o $dummy $dummy.c &&
    462 +	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
    463 +	  SYSTEM_NAME=`$dummy $dummyarg` &&
    464 +	    { echo "$SYSTEM_NAME"; exit; }
    465 +	echo mips-mips-riscos${UNAME_RELEASE}
    466 +	exit ;;
    467 +    Motorola:PowerMAX_OS:*:*)
    468 +	echo powerpc-motorola-powermax
    469 +	exit ;;
    470 +    Motorola:*:4.3:PL8-*)
    471 +	echo powerpc-harris-powermax
    472 +	exit ;;
    473 +    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
    474 +	echo powerpc-harris-powermax
    475 +	exit ;;
    476 +    Night_Hawk:Power_UNIX:*:*)
    477 +	echo powerpc-harris-powerunix
    478 +	exit ;;
    479 +    m88k:CX/UX:7*:*)
    480 +	echo m88k-harris-cxux7
    481 +	exit ;;
    482 +    m88k:*:4*:R4*)
    483 +	echo m88k-motorola-sysv4
    484 +	exit ;;
    485 +    m88k:*:3*:R3*)
    486 +	echo m88k-motorola-sysv3
    487 +	exit ;;
    488 +    AViiON:dgux:*:*)
    489 +	# DG/UX returns AViiON for all architectures
    490 +	UNAME_PROCESSOR=`/usr/bin/uname -p`
    491 +	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
    492 +	then
    493 +	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
    494 +	       [ ${TARGET_BINARY_INTERFACE}x = x ]
    495 +	    then
    496 +		echo m88k-dg-dgux${UNAME_RELEASE}
    497 +	    else
    498 +		echo m88k-dg-dguxbcs${UNAME_RELEASE}
    499 +	    fi
    500 +	else
    501 +	    echo i586-dg-dgux${UNAME_RELEASE}
    502 +	fi
    503 +	exit ;;
    504 +    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
    505 +	echo m88k-dolphin-sysv3
    506 +	exit ;;
    507 +    M88*:*:R3*:*)
    508 +	# Delta 88k system running SVR3
    509 +	echo m88k-motorola-sysv3
    510 +	exit ;;
    511 +    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
    512 +	echo m88k-tektronix-sysv3
    513 +	exit ;;
    514 +    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
    515 +	echo m68k-tektronix-bsd
    516 +	exit ;;
    517 +    *:IRIX*:*:*)
    518 +	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
    519 +	exit ;;
    520 +    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
    521 +	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
    522 +	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
    523 +    i*86:AIX:*:*)
    524 +	echo i386-ibm-aix
    525 +	exit ;;
    526 +    ia64:AIX:*:*)
    527 +	if [ -x /usr/bin/oslevel ] ; then
    528 +		IBM_REV=`/usr/bin/oslevel`
    529 +	else
    530 +		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
    531 +	fi
    532 +	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
    533 +	exit ;;
    534 +    *:AIX:2:3)
    535 +	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
    536 +		eval $set_cc_for_build
    537 +		sed 's/^		//' << EOF >$dummy.c
    538 +		#include <sys/systemcfg.h>
    539 +
    540 +		main()
    541 +			{
    542 +			if (!__power_pc())
    543 +				exit(1);
    544 +			puts("powerpc-ibm-aix3.2.5");
    545 +			exit(0);
    546 +			}
    547 +EOF
    548 +		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
    549 +		then
    550 +			echo "$SYSTEM_NAME"
    551 +		else
    552 +			echo rs6000-ibm-aix3.2.5
    553 +		fi
    554 +	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
    555 +		echo rs6000-ibm-aix3.2.4
    556 +	else
    557 +		echo rs6000-ibm-aix3.2
    558 +	fi
    559 +	exit ;;
    560 +    *:AIX:*:[4567])
    561 +	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
    562 +	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
    563 +		IBM_ARCH=rs6000
    564 +	else
    565 +		IBM_ARCH=powerpc
    566 +	fi
    567 +	if [ -x /usr/bin/oslevel ] ; then
    568 +		IBM_REV=`/usr/bin/oslevel`
    569 +	else
    570 +		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
    571 +	fi
    572 +	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
    573 +	exit ;;
    574 +    *:AIX:*:*)
    575 +	echo rs6000-ibm-aix
    576 +	exit ;;
    577 +    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
    578 +	echo romp-ibm-bsd4.4
    579 +	exit ;;
    580 +    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
    581 +	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
    582 +	exit ;;                             # report: romp-ibm BSD 4.3
    583 +    *:BOSX:*:*)
    584 +	echo rs6000-bull-bosx
    585 +	exit ;;
    586 +    DPX/2?00:B.O.S.:*:*)
    587 +	echo m68k-bull-sysv3
    588 +	exit ;;
    589 +    9000/[34]??:4.3bsd:1.*:*)
    590 +	echo m68k-hp-bsd
    591 +	exit ;;
    592 +    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
    593 +	echo m68k-hp-bsd4.4
    594 +	exit ;;
    595 +    9000/[34678]??:HP-UX:*:*)
    596 +	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
    597 +	case "${UNAME_MACHINE}" in
    598 +	    9000/31? )            HP_ARCH=m68000 ;;
    599 +	    9000/[34]?? )         HP_ARCH=m68k ;;
    600 +	    9000/[678][0-9][0-9])
    601 +		if [ -x /usr/bin/getconf ]; then
    602 +		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
    603 +		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
    604 +		    case "${sc_cpu_version}" in
    605 +		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
    606 +		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
    607 +		      532)                      # CPU_PA_RISC2_0
    608 +			case "${sc_kernel_bits}" in
    609 +			  32) HP_ARCH="hppa2.0n" ;;
    610 +			  64) HP_ARCH="hppa2.0w" ;;
    611 +			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
    612 +			esac ;;
    613 +		    esac
    614 +		fi
    615 +		if [ "${HP_ARCH}" = "" ]; then
    616 +		    eval $set_cc_for_build
    617 +		    sed 's/^		//' << EOF >$dummy.c
    618 +
    619 +		#define _HPUX_SOURCE
    620 +		#include <stdlib.h>
    621 +		#include <unistd.h>
    622 +
    623 +		int main ()
    624 +		{
    625 +		#if defined(_SC_KERNEL_BITS)
    626 +		    long bits = sysconf(_SC_KERNEL_BITS);
    627 +		#endif
    628 +		    long cpu  = sysconf (_SC_CPU_VERSION);
    629 +
    630 +		    switch (cpu)
    631 +			{
    632 +			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
    633 +			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
    634 +			case CPU_PA_RISC2_0:
    635 +		#if defined(_SC_KERNEL_BITS)
    636 +			    switch (bits)
    637 +				{
    638 +				case 64: puts ("hppa2.0w"); break;
    639 +				case 32: puts ("hppa2.0n"); break;
    640 +				default: puts ("hppa2.0"); break;
    641 +				} break;
    642 +		#else  /* !defined(_SC_KERNEL_BITS) */
    643 +			    puts ("hppa2.0"); break;
    644 +		#endif
    645 +			default: puts ("hppa1.0"); break;
    646 +			}
    647 +		    exit (0);
    648 +		}
    649 +EOF
    650 +		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
    651 +		    test -z "$HP_ARCH" && HP_ARCH=hppa
    652 +		fi ;;
    653 +	esac
    654 +	if [ ${HP_ARCH} = "hppa2.0w" ]
    655 +	then
    656 +	    eval $set_cc_for_build
    657 +
    658 +	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
    659 +	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
    660 +	    # generating 64-bit code.  GNU and HP use different nomenclature:
    661 +	    #
    662 +	    # $ CC_FOR_BUILD=cc ./config.guess
    663 +	    # => hppa2.0w-hp-hpux11.23
    664 +	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
    665 +	    # => hppa64-hp-hpux11.23
    666 +
    667 +	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
    668 +		grep -q __LP64__
    669 +	    then
    670 +		HP_ARCH="hppa2.0w"
    671 +	    else
    672 +		HP_ARCH="hppa64"
    673 +	    fi
    674 +	fi
    675 +	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
    676 +	exit ;;
    677 +    ia64:HP-UX:*:*)
    678 +	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
    679 +	echo ia64-hp-hpux${HPUX_REV}
    680 +	exit ;;
    681 +    3050*:HI-UX:*:*)
    682 +	eval $set_cc_for_build
    683 +	sed 's/^	//' << EOF >$dummy.c
    684 +	#include <unistd.h>
    685 +	int
    686 +	main ()
    687 +	{
    688 +	  long cpu = sysconf (_SC_CPU_VERSION);
    689 +	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
    690 +	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
    691 +	     results, however.  */
    692 +	  if (CPU_IS_PA_RISC (cpu))
    693 +	    {
    694 +	      switch (cpu)
    695 +		{
    696 +		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
    697 +		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
    698 +		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
    699 +		  default: puts ("hppa-hitachi-hiuxwe2"); break;
    700 +		}
    701 +	    }
    702 +	  else if (CPU_IS_HP_MC68K (cpu))
    703 +	    puts ("m68k-hitachi-hiuxwe2");
    704 +	  else puts ("unknown-hitachi-hiuxwe2");
    705 +	  exit (0);
    706 +	}
    707 +EOF
    708 +	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
    709 +		{ echo "$SYSTEM_NAME"; exit; }
    710 +	echo unknown-hitachi-hiuxwe2
    711 +	exit ;;
    712 +    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
    713 +	echo hppa1.1-hp-bsd
    714 +	exit ;;
    715 +    9000/8??:4.3bsd:*:*)
    716 +	echo hppa1.0-hp-bsd
    717 +	exit ;;
    718 +    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
    719 +	echo hppa1.0-hp-mpeix
    720 +	exit ;;
    721 +    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
    722 +	echo hppa1.1-hp-osf
    723 +	exit ;;
    724 +    hp8??:OSF1:*:*)
    725 +	echo hppa1.0-hp-osf
    726 +	exit ;;
    727 +    i*86:OSF1:*:*)
    728 +	if [ -x /usr/sbin/sysversion ] ; then
    729 +	    echo ${UNAME_MACHINE}-unknown-osf1mk
    730 +	else
    731 +	    echo ${UNAME_MACHINE}-unknown-osf1
    732 +	fi
    733 +	exit ;;
    734 +    parisc*:Lites*:*:*)
    735 +	echo hppa1.1-hp-lites
    736 +	exit ;;
    737 +    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
    738 +	echo c1-convex-bsd
    739 +	exit ;;
    740 +    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
    741 +	if getsysinfo -f scalar_acc
    742 +	then echo c32-convex-bsd
    743 +	else echo c2-convex-bsd
    744 +	fi
    745 +	exit ;;
    746 +    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
    747 +	echo c34-convex-bsd
    748 +	exit ;;
    749 +    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
    750 +	echo c38-convex-bsd
    751 +	exit ;;
    752 +    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
    753 +	echo c4-convex-bsd
    754 +	exit ;;
    755 +    CRAY*Y-MP:*:*:*)
    756 +	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
    757 +	exit ;;
    758 +    CRAY*[A-Z]90:*:*:*)
    759 +	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
    760 +	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
    761 +	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
    762 +	      -e 's/\.[^.]*$/.X/'
    763 +	exit ;;
    764 +    CRAY*TS:*:*:*)
    765 +	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
    766 +	exit ;;
    767 +    CRAY*T3E:*:*:*)
    768 +	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
    769 +	exit ;;
    770 +    CRAY*SV1:*:*:*)
    771 +	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
    772 +	exit ;;
    773 +    *:UNICOS/mp:*:*)
    774 +	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
    775 +	exit ;;
    776 +    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
    777 +	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
    778 +	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
    779 +	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
    780 +	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
    781 +	exit ;;
    782 +    5000:UNIX_System_V:4.*:*)
    783 +	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
    784 +	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
    785 +	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
    786 +	exit ;;
    787 +    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
    788 +	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
    789 +	exit ;;
    790 +    sparc*:BSD/OS:*:*)
    791 +	echo sparc-unknown-bsdi${UNAME_RELEASE}
    792 +	exit ;;
    793 +    *:BSD/OS:*:*)
    794 +	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
    795 +	exit ;;
    796 +    *:FreeBSD:*:*)
    797 +	UNAME_PROCESSOR=`/usr/bin/uname -p`
    798 +	case ${UNAME_PROCESSOR} in
    799 +	    amd64)
    800 +		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
    801 +	    *)
    802 +		echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
    803 +	esac
    804 +	exit ;;
    805 +    i*:CYGWIN*:*)
    806 +	echo ${UNAME_MACHINE}-pc-cygwin
    807 +	exit ;;
    808 +    *:MINGW*:*)
    809 +	echo ${UNAME_MACHINE}-pc-mingw32
    810 +	exit ;;
    811 +    i*:MSYS*:*)
    812 +	echo ${UNAME_MACHINE}-pc-msys
    813 +	exit ;;
    814 +    i*:windows32*:*)
    815 +	# uname -m includes "-pc" on this system.
    816 +	echo ${UNAME_MACHINE}-mingw32
    817 +	exit ;;
    818 +    i*:PW*:*)
    819 +	echo ${UNAME_MACHINE}-pc-pw32
    820 +	exit ;;
    821 +    *:Interix*:*)
    822 +	case ${UNAME_MACHINE} in
    823 +	    x86)
    824 +		echo i586-pc-interix${UNAME_RELEASE}
    825 +		exit ;;
    826 +	    authenticamd | genuineintel | EM64T)
    827 +		echo x86_64-unknown-interix${UNAME_RELEASE}
    828 +		exit ;;
    829 +	    IA64)
    830 +		echo ia64-unknown-interix${UNAME_RELEASE}
    831 +		exit ;;
    832 +	esac ;;
    833 +    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
    834 +	echo i${UNAME_MACHINE}-pc-mks
    835 +	exit ;;
    836 +    8664:Windows_NT:*)
    837 +	echo x86_64-pc-mks
    838 +	exit ;;
    839 +    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
    840 +	# How do we know it's Interix rather than the generic POSIX subsystem?
    841 +	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
    842 +	# UNAME_MACHINE based on the output of uname instead of i386?
    843 +	echo i586-pc-interix
    844 +	exit ;;
    845 +    i*:UWIN*:*)
    846 +	echo ${UNAME_MACHINE}-pc-uwin
    847 +	exit ;;
    848 +    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
    849 +	echo x86_64-unknown-cygwin
    850 +	exit ;;
    851 +    p*:CYGWIN*:*)
    852 +	echo powerpcle-unknown-cygwin
    853 +	exit ;;
    854 +    prep*:SunOS:5.*:*)
    855 +	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
    856 +	exit ;;
    857 +    *:GNU:*:*)
    858 +	# the GNU system
    859 +	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
    860 +	exit ;;
    861 +    *:GNU/*:*:*)
    862 +	# other systems with GNU libc and userland
    863 +	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
    864 +	exit ;;
    865 +    i*86:Minix:*:*)
    866 +	echo ${UNAME_MACHINE}-pc-minix
    867 +	exit ;;
    868 +    aarch64:Linux:*:*)
    869 +	echo ${UNAME_MACHINE}-unknown-linux-gnu
    870 +	exit ;;
    871 +    aarch64_be:Linux:*:*)
    872 +	UNAME_MACHINE=aarch64_be
    873 +	echo ${UNAME_MACHINE}-unknown-linux-gnu
    874 +	exit ;;
    875 +    alpha:Linux:*:*)
    876 +	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
    877 +	  EV5)   UNAME_MACHINE=alphaev5 ;;
    878 +	  EV56)  UNAME_MACHINE=alphaev56 ;;
    879 +	  PCA56) UNAME_MACHINE=alphapca56 ;;
    880 +	  PCA57) UNAME_MACHINE=alphapca56 ;;
    881 +	  EV6)   UNAME_MACHINE=alphaev6 ;;
    882 +	  EV67)  UNAME_MACHINE=alphaev67 ;;
    883 +	  EV68*) UNAME_MACHINE=alphaev68 ;;
    884 +	esac
    885 +	objdump --private-headers /bin/sh | grep -q ld.so.1
    886 +	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
    887 +	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
    888 +	exit ;;
    889 +    arm*:Linux:*:*)
    890 +	eval $set_cc_for_build
    891 +	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
    892 +	    | grep -q __ARM_EABI__
    893 +	then
    894 +	    echo ${UNAME_MACHINE}-unknown-linux-gnu
    895 +	else
    896 +	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
    897 +		| grep -q __ARM_PCS_VFP
    898 +	    then
    899 +		echo ${UNAME_MACHINE}-unknown-linux-gnueabi
    900 +	    else
    901 +		echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
    902 +	    fi
    903 +	fi
    904 +	exit ;;
    905 +    avr32*:Linux:*:*)
    906 +	echo ${UNAME_MACHINE}-unknown-linux-gnu
    907 +	exit ;;
    908 +    cris:Linux:*:*)
    909 +	echo ${UNAME_MACHINE}-axis-linux-gnu
    910 +	exit ;;
    911 +    crisv32:Linux:*:*)
    912 +	echo ${UNAME_MACHINE}-axis-linux-gnu
    913 +	exit ;;
    914 +    frv:Linux:*:*)
    915 +	echo ${UNAME_MACHINE}-unknown-linux-gnu
    916 +	exit ;;
    917 +    hexagon:Linux:*:*)
    918 +	echo ${UNAME_MACHINE}-unknown-linux-gnu
    919 +	exit ;;
    920 +    i*86:Linux:*:*)
    921 +	LIBC=gnu
    922 +	eval $set_cc_for_build
    923 +	sed 's/^	//' << EOF >$dummy.c
    924 +	#ifdef __dietlibc__
    925 +	LIBC=dietlibc
    926 +	#endif
    927 +EOF
    928 +	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
    929 +	echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
    930 +	exit ;;
    931 +    ia64:Linux:*:*)
    932 +	echo ${UNAME_MACHINE}-unknown-linux-gnu
    933 +	exit ;;
    934 +    m32r*:Linux:*:*)
    935 +	echo ${UNAME_MACHINE}-unknown-linux-gnu
    936 +	exit ;;
    937 +    m68*:Linux:*:*)
    938 +	echo ${UNAME_MACHINE}-unknown-linux-gnu
    939 +	exit ;;
    940 +    mips:Linux:*:* | mips64:Linux:*:*)
    941 +	eval $set_cc_for_build
    942 +	sed 's/^	//' << EOF >$dummy.c
    943 +	#undef CPU
    944 +	#undef ${UNAME_MACHINE}
    945 +	#undef ${UNAME_MACHINE}el
    946 +	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
    947 +	CPU=${UNAME_MACHINE}el
    948 +	#else
    949 +	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
    950 +	CPU=${UNAME_MACHINE}
    951 +	#else
    952 +	CPU=
    953 +	#endif
    954 +	#endif
    955 +EOF
    956 +	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
    957 +	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
    958 +	;;
    959 +    or32:Linux:*:*)
    960 +	echo ${UNAME_MACHINE}-unknown-linux-gnu
    961 +	exit ;;
    962 +    padre:Linux:*:*)
    963 +	echo sparc-unknown-linux-gnu
    964 +	exit ;;
    965 +    parisc64:Linux:*:* | hppa64:Linux:*:*)
    966 +	echo hppa64-unknown-linux-gnu
    967 +	exit ;;
    968 +    parisc:Linux:*:* | hppa:Linux:*:*)
    969 +	# Look for CPU level
    970 +	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
    971 +	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
    972 +	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
    973 +	  *)    echo hppa-unknown-linux-gnu ;;
    974 +	esac
    975 +	exit ;;
    976 +    ppc64:Linux:*:*)
    977 +	echo powerpc64-unknown-linux-gnu
    978 +	exit ;;
    979 +    ppc:Linux:*:*)
    980 +	echo powerpc-unknown-linux-gnu
    981 +	exit ;;
    982 +    s390:Linux:*:* | s390x:Linux:*:*)
    983 +	echo ${UNAME_MACHINE}-ibm-linux
    984 +	exit ;;
    985 +    sh64*:Linux:*:*)
    986 +	echo ${UNAME_MACHINE}-unknown-linux-gnu
    987 +	exit ;;
    988 +    sh*:Linux:*:*)
    989 +	echo ${UNAME_MACHINE}-unknown-linux-gnu
    990 +	exit ;;
    991 +    sparc:Linux:*:* | sparc64:Linux:*:*)
    992 +	echo ${UNAME_MACHINE}-unknown-linux-gnu
    993 +	exit ;;
    994 +    tile*:Linux:*:*)
    995 +	echo ${UNAME_MACHINE}-unknown-linux-gnu
    996 +	exit ;;
    997 +    vax:Linux:*:*)
    998 +	echo ${UNAME_MACHINE}-dec-linux-gnu
    999 +	exit ;;
   1000 +    x86_64:Linux:*:*)
   1001 +	echo ${UNAME_MACHINE}-unknown-linux-gnu
   1002 +	exit ;;
   1003 +    xtensa*:Linux:*:*)
   1004 +	echo ${UNAME_MACHINE}-unknown-linux-gnu
   1005 +	exit ;;
   1006 +    i*86:DYNIX/ptx:4*:*)
   1007 +	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
   1008 +	# earlier versions are messed up and put the nodename in both
   1009 +	# sysname and nodename.
   1010 +	echo i386-sequent-sysv4
   1011 +	exit ;;
   1012 +    i*86:UNIX_SV:4.2MP:2.*)
   1013 +	# Unixware is an offshoot of SVR4, but it has its own version
   1014 +	# number series starting with 2...
   1015 +	# I am not positive that other SVR4 systems won't match this,
   1016 +	# I just have to hope.  -- rms.
   1017 +	# Use sysv4.2uw... so that sysv4* matches it.
   1018 +	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
   1019 +	exit ;;
   1020 +    i*86:OS/2:*:*)
   1021 +	# If we were able to find `uname', then EMX Unix compatibility
   1022 +	# is probably installed.
   1023 +	echo ${UNAME_MACHINE}-pc-os2-emx
   1024 +	exit ;;
   1025 +    i*86:XTS-300:*:STOP)
   1026 +	echo ${UNAME_MACHINE}-unknown-stop
   1027 +	exit ;;
   1028 +    i*86:atheos:*:*)
   1029 +	echo ${UNAME_MACHINE}-unknown-atheos
   1030 +	exit ;;
   1031 +    i*86:syllable:*:*)
   1032 +	echo ${UNAME_MACHINE}-pc-syllable
   1033 +	exit ;;
   1034 +    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
   1035 +	echo i386-unknown-lynxos${UNAME_RELEASE}
   1036 +	exit ;;
   1037 +    i*86:*DOS:*:*)
   1038 +	echo ${UNAME_MACHINE}-pc-msdosdjgpp
   1039 +	exit ;;
   1040 +    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
   1041 +	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
   1042 +	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
   1043 +		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
   1044 +	else
   1045 +		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
   1046 +	fi
   1047 +	exit ;;
   1048 +    i*86:*:5:[678]*)
   1049 +	# UnixWare 7.x, OpenUNIX and OpenServer 6.
   1050 +	case `/bin/uname -X | grep "^Machine"` in
   1051 +	    *486*)	     UNAME_MACHINE=i486 ;;
   1052 +	    *Pentium)	     UNAME_MACHINE=i586 ;;
   1053 +	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
   1054 +	esac
   1055 +	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
   1056 +	exit ;;
   1057 +    i*86:*:3.2:*)
   1058 +	if test -f /usr/options/cb.name; then
   1059 +		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
   1060 +		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
   1061 +	elif /bin/uname -X 2>/dev/null >/dev/null ; then
   1062 +		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
   1063 +		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
   1064 +		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
   1065 +			&& UNAME_MACHINE=i586
   1066 +		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
   1067 +			&& UNAME_MACHINE=i686
   1068 +		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
   1069 +			&& UNAME_MACHINE=i686
   1070 +		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
   1071 +	else
   1072 +		echo ${UNAME_MACHINE}-pc-sysv32
   1073 +	fi
   1074 +	exit ;;
   1075 +    pc:*:*:*)
   1076 +	# Left here for compatibility:
   1077 +	# uname -m prints for DJGPP always 'pc', but it prints nothing about
   1078 +	# the processor, so we play safe by assuming i586.
   1079 +	# Note: whatever this is, it MUST be the same as what config.sub
   1080 +	# prints for the "djgpp" host, or else GDB configury will decide that
   1081 +	# this is a cross-build.
   1082 +	echo i586-pc-msdosdjgpp
   1083 +	exit ;;
   1084 +    Intel:Mach:3*:*)
   1085 +	echo i386-pc-mach3
   1086 +	exit ;;
   1087 +    paragon:*:*:*)
   1088 +	echo i860-intel-osf1
   1089 +	exit ;;
   1090 +    i860:*:4.*:*) # i860-SVR4
   1091 +	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
   1092 +	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
   1093 +	else # Add other i860-SVR4 vendors below as they are discovered.
   1094 +	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
   1095 +	fi
   1096 +	exit ;;
   1097 +    mini*:CTIX:SYS*5:*)
   1098 +	# "miniframe"
   1099 +	echo m68010-convergent-sysv
   1100 +	exit ;;
   1101 +    mc68k:UNIX:SYSTEM5:3.51m)
   1102 +	echo m68k-convergent-sysv
   1103 +	exit ;;
   1104 +    M680?0:D-NIX:5.3:*)
   1105 +	echo m68k-diab-dnix
   1106 +	exit ;;
   1107 +    M68*:*:R3V[5678]*:*)
   1108 +	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
   1109 +    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)
   1110 +	OS_REL=''
   1111 +	test -r /etc/.relid \
   1112 +	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
   1113 +	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
   1114 +	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
   1115 +	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
   1116 +	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
   1117 +    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
   1118 +	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
   1119 +	  && { echo i486-ncr-sysv4; exit; } ;;
   1120 +    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
   1121 +	OS_REL='.3'
   1122 +	test -r /etc/.relid \
   1123 +	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
   1124 +	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
   1125 +	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
   1126 +	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
   1127 +	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
   1128 +	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
   1129 +	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
   1130 +    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
   1131 +	echo m68k-unknown-lynxos${UNAME_RELEASE}
   1132 +	exit ;;
   1133 +    mc68030:UNIX_System_V:4.*:*)
   1134 +	echo m68k-atari-sysv4
   1135 +	exit ;;
   1136 +    TSUNAMI:LynxOS:2.*:*)
   1137 +	echo sparc-unknown-lynxos${UNAME_RELEASE}
   1138 +	exit ;;
   1139 +    rs6000:LynxOS:2.*:*)
   1140 +	echo rs6000-unknown-lynxos${UNAME_RELEASE}
   1141 +	exit ;;
   1142 +    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
   1143 +	echo powerpc-unknown-lynxos${UNAME_RELEASE}
   1144 +	exit ;;
   1145 +    SM[BE]S:UNIX_SV:*:*)
   1146 +	echo mips-dde-sysv${UNAME_RELEASE}
   1147 +	exit ;;
   1148 +    RM*:ReliantUNIX-*:*:*)
   1149 +	echo mips-sni-sysv4
   1150 +	exit ;;
   1151 +    RM*:SINIX-*:*:*)
   1152 +	echo mips-sni-sysv4
   1153 +	exit ;;
   1154 +    *:SINIX-*:*:*)
   1155 +	if uname -p 2>/dev/null >/dev/null ; then
   1156 +		UNAME_MACHINE=`(uname -p) 2>/dev/null`
   1157 +		echo ${UNAME_MACHINE}-sni-sysv4
   1158 +	else
   1159 +		echo ns32k-sni-sysv
   1160 +	fi
   1161 +	exit ;;
   1162 +    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
   1163 +			# says <Richard.M.Bartel (a] ccMail.Census.GOV>
   1164 +	echo i586-unisys-sysv4
   1165 +	exit ;;
   1166 +    *:UNIX_System_V:4*:FTX*)
   1167 +	# From Gerald Hewes <hewes (a] openmarket.com>.
   1168 +	# How about differentiating between stratus architectures? -djm
   1169 +	echo hppa1.1-stratus-sysv4
   1170 +	exit ;;
   1171 +    *:*:*:FTX*)
   1172 +	# From seanf (a] swdc.stratus.com.
   1173 +	echo i860-stratus-sysv4
   1174 +	exit ;;
   1175 +    i*86:VOS:*:*)
   1176 +	# From Paul.Green (a] stratus.com.
   1177 +	echo ${UNAME_MACHINE}-stratus-vos
   1178 +	exit ;;
   1179 +    *:VOS:*:*)
   1180 +	# From Paul.Green (a] stratus.com.
   1181 +	echo hppa1.1-stratus-vos
   1182 +	exit ;;
   1183 +    mc68*:A/UX:*:*)
   1184 +	echo m68k-apple-aux${UNAME_RELEASE}
   1185 +	exit ;;
   1186 +    news*:NEWS-OS:6*:*)
   1187 +	echo mips-sony-newsos6
   1188 +	exit ;;
   1189 +    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
   1190 +	if [ -d /usr/nec ]; then
   1191 +		echo mips-nec-sysv${UNAME_RELEASE}
   1192 +	else
   1193 +		echo mips-unknown-sysv${UNAME_RELEASE}
   1194 +	fi
   1195 +	exit ;;
   1196 +    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
   1197 +	echo powerpc-be-beos
   1198 +	exit ;;
   1199 +    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
   1200 +	echo powerpc-apple-beos
   1201 +	exit ;;
   1202 +    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
   1203 +	echo i586-pc-beos
   1204 +	exit ;;
   1205 +    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
   1206 +	echo i586-pc-haiku
   1207 +	exit ;;
   1208 +    SX-4:SUPER-UX:*:*)
   1209 +	echo sx4-nec-superux${UNAME_RELEASE}
   1210 +	exit ;;
   1211 +    SX-5:SUPER-UX:*:*)
   1212 +	echo sx5-nec-superux${UNAME_RELEASE}
   1213 +	exit ;;
   1214 +    SX-6:SUPER-UX:*:*)
   1215 +	echo sx6-nec-superux${UNAME_RELEASE}
   1216 +	exit ;;
   1217 +    SX-7:SUPER-UX:*:*)
   1218 +	echo sx7-nec-superux${UNAME_RELEASE}
   1219 +	exit ;;
   1220 +    SX-8:SUPER-UX:*:*)
   1221 +	echo sx8-nec-superux${UNAME_RELEASE}
   1222 +	exit ;;
   1223 +    SX-8R:SUPER-UX:*:*)
   1224 +	echo sx8r-nec-superux${UNAME_RELEASE}
   1225 +	exit ;;
   1226 +    Power*:Rhapsody:*:*)
   1227 +	echo powerpc-apple-rhapsody${UNAME_RELEASE}
   1228 +	exit ;;
   1229 +    *:Rhapsody:*:*)
   1230 +	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
   1231 +	exit ;;
   1232 +    *:Darwin:*:*)
   1233 +	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
   1234 +	case $UNAME_PROCESSOR in
   1235 +	    i386)
   1236 +		eval $set_cc_for_build
   1237 +		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
   1238 +		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
   1239 +		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
   1240 +		      grep IS_64BIT_ARCH >/dev/null
   1241 +		  then
   1242 +		      UNAME_PROCESSOR="x86_64"
   1243 +		  fi
   1244 +		fi ;;
   1245 +	    unknown) UNAME_PROCESSOR=powerpc ;;
   1246 +	esac
   1247 +	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
   1248 +	exit ;;
   1249 +    *:procnto*:*:* | *:QNX:[0123456789]*:*)
   1250 +	UNAME_PROCESSOR=`uname -p`
   1251 +	if test "$UNAME_PROCESSOR" = "x86"; then
   1252 +		UNAME_PROCESSOR=i386
   1253 +		UNAME_MACHINE=pc
   1254 +	fi
   1255 +	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
   1256 +	exit ;;
   1257 +    *:QNX:*:4*)
   1258 +	echo i386-pc-qnx
   1259 +	exit ;;
   1260 +    NEO-?:NONSTOP_KERNEL:*:*)
   1261 +	echo neo-tandem-nsk${UNAME_RELEASE}
   1262 +	exit ;;
   1263 +    NSE-?:NONSTOP_KERNEL:*:*)
   1264 +	echo nse-tandem-nsk${UNAME_RELEASE}
   1265 +	exit ;;
   1266 +    NSR-?:NONSTOP_KERNEL:*:*)
   1267 +	echo nsr-tandem-nsk${UNAME_RELEASE}
   1268 +	exit ;;
   1269 +    *:NonStop-UX:*:*)
   1270 +	echo mips-compaq-nonstopux
   1271 +	exit ;;
   1272 +    BS2000:POSIX*:*:*)
   1273 +	echo bs2000-siemens-sysv
   1274 +	exit ;;
   1275 +    DS/*:UNIX_System_V:*:*)
   1276 +	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
   1277 +	exit ;;
   1278 +    *:Plan9:*:*)
   1279 +	# "uname -m" is not consistent, so use $cputype instead. 386
   1280 +	# is converted to i386 for consistency with other x86
   1281 +	# operating systems.
   1282 +	if test "$cputype" = "386"; then
   1283 +	    UNAME_MACHINE=i386
   1284 +	else
   1285 +	    UNAME_MACHINE="$cputype"
   1286 +	fi
   1287 +	echo ${UNAME_MACHINE}-unknown-plan9
   1288 +	exit ;;
   1289 +    *:TOPS-10:*:*)
   1290 +	echo pdp10-unknown-tops10
   1291 +	exit ;;
   1292 +    *:TENEX:*:*)
   1293 +	echo pdp10-unknown-tenex
   1294 +	exit ;;
   1295 +    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
   1296 +	echo pdp10-dec-tops20
   1297 +	exit ;;
   1298 +    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
   1299 +	echo pdp10-xkl-tops20
   1300 +	exit ;;
   1301 +    *:TOPS-20:*:*)
   1302 +	echo pdp10-unknown-tops20
   1303 +	exit ;;
   1304 +    *:ITS:*:*)
   1305 +	echo pdp10-unknown-its
   1306 +	exit ;;
   1307 +    SEI:*:*:SEIUX)
   1308 +	echo mips-sei-seiux${UNAME_RELEASE}
   1309 +	exit ;;
   1310 +    *:DragonFly:*:*)
   1311 +	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
   1312 +	exit ;;
   1313 +    *:*VMS:*:*)
   1314 +	UNAME_MACHINE=`(uname -p) 2>/dev/null`
   1315 +	case "${UNAME_MACHINE}" in
   1316 +	    A*) echo alpha-dec-vms ; exit ;;
   1317 +	    I*) echo ia64-dec-vms ; exit ;;
   1318 +	    V*) echo vax-dec-vms ; exit ;;
   1319 +	esac ;;
   1320 +    *:XENIX:*:SysV)
   1321 +	echo i386-pc-xenix
   1322 +	exit ;;
   1323 +    i*86:skyos:*:*)
   1324 +	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
   1325 +	exit ;;
   1326 +    i*86:rdos:*:*)
   1327 +	echo ${UNAME_MACHINE}-pc-rdos
   1328 +	exit ;;
   1329 +    i*86:AROS:*:*)
   1330 +	echo ${UNAME_MACHINE}-pc-aros
   1331 +	exit ;;
   1332 +    x86_64:VMkernel:*:*)
   1333 +	echo ${UNAME_MACHINE}-unknown-esx
   1334 +	exit ;;
   1335 +esac
   1336 +
   1337 +#echo '(No uname command or uname output not recognized.)' 1>&2
   1338 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
   1339 +
   1340 +eval $set_cc_for_build
   1341 +cat >$dummy.c <<EOF
   1342 +#ifdef _SEQUENT_
   1343 +# include <sys/types.h>
   1344 +# include <sys/utsname.h>
   1345 +#endif
   1346 +main ()
   1347 +{
   1348 +#if defined (sony)
   1349 +#if defined (MIPSEB)
   1350 +  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
   1351 +     I don't know....  */
   1352 +  printf ("mips-sony-bsd\n"); exit (0);
   1353 +#else
   1354 +#include <sys/param.h>
   1355 +  printf ("m68k-sony-newsos%s\n",
   1356 +#ifdef NEWSOS4
   1357 +	"4"
   1358 +#else
   1359 +	""
   1360 +#endif
   1361 +	); exit (0);
   1362 +#endif
   1363 +#endif
   1364 +
   1365 +#if defined (__arm) && defined (__acorn) && defined (__unix)
   1366 +  printf ("arm-acorn-riscix\n"); exit (0);
   1367 +#endif
   1368 +
   1369 +#if defined (hp300) && !defined (hpux)
   1370 +  printf ("m68k-hp-bsd\n"); exit (0);
   1371 +#endif
   1372 +
   1373 +#if defined (NeXT)
   1374 +#if !defined (__ARCHITECTURE__)
   1375 +#define __ARCHITECTURE__ "m68k"
   1376 +#endif
   1377 +  int version;
   1378 +  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
   1379 +  if (version < 4)
   1380 +    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
   1381 +  else
   1382 +    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
   1383 +  exit (0);
   1384 +#endif
   1385 +
   1386 +#if defined (MULTIMAX) || defined (n16)
   1387 +#if defined (UMAXV)
   1388 +  printf ("ns32k-encore-sysv\n"); exit (0);
   1389 +#else
   1390 +#if defined (CMU)
   1391 +  printf ("ns32k-encore-mach\n"); exit (0);
   1392 +#else
   1393 +  printf ("ns32k-encore-bsd\n"); exit (0);
   1394 +#endif
   1395 +#endif
   1396 +#endif
   1397 +
   1398 +#if defined (__386BSD__)
   1399 +  printf ("i386-pc-bsd\n"); exit (0);
   1400 +#endif
   1401 +
   1402 +#if defined (sequent)
   1403 +#if defined (i386)
   1404 +  printf ("i386-sequent-dynix\n"); exit (0);
   1405 +#endif
   1406 +#if defined (ns32000)
   1407 +  printf ("ns32k-sequent-dynix\n"); exit (0);
   1408 +#endif
   1409 +#endif
   1410 +
   1411 +#if defined (_SEQUENT_)
   1412 +    struct utsname un;
   1413 +
   1414 +    uname(&un);
   1415 +
   1416 +    if (strncmp(un.version, "V2", 2) == 0) {
   1417 +	printf ("i386-sequent-ptx2\n"); exit (0);
   1418 +    }
   1419 +    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
   1420 +	printf ("i386-sequent-ptx1\n"); exit (0);
   1421 +    }
   1422 +    printf ("i386-sequent-ptx\n"); exit (0);
   1423 +
   1424 +#endif
   1425 +
   1426 +#if defined (vax)
   1427 +# if !defined (ultrix)
   1428 +#  include <sys/param.h>
   1429 +#  if defined (BSD)
   1430 +#   if BSD == 43
   1431 +      printf ("vax-dec-bsd4.3\n"); exit (0);
   1432 +#   else
   1433 +#    if BSD == 199006
   1434 +      printf ("vax-dec-bsd4.3reno\n"); exit (0);
   1435 +#    else
   1436 +      printf ("vax-dec-bsd\n"); exit (0);
   1437 +#    endif
   1438 +#   endif
   1439 +#  else
   1440 +    printf ("vax-dec-bsd\n"); exit (0);
   1441 +#  endif
   1442 +# else
   1443 +    printf ("vax-dec-ultrix\n"); exit (0);
   1444 +# endif
   1445 +#endif
   1446 +
   1447 +#if defined (alliant) && defined (i860)
   1448 +  printf ("i860-alliant-bsd\n"); exit (0);
   1449 +#endif
   1450 +
   1451 +  exit (1);
   1452 +}
   1453 +EOF
   1454 +
   1455 +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
   1456 +	{ echo "$SYSTEM_NAME"; exit; }
   1457 +
   1458 +# Apollos put the system type in the environment.
   1459 +
   1460 +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
   1461 +
   1462 +# Convex versions that predate uname can use getsysinfo(1)
   1463 +
   1464 +if [ -x /usr/convex/getsysinfo ]
   1465 +then
   1466 +    case `getsysinfo -f cpu_type` in
   1467 +    c1*)
   1468 +	echo c1-convex-bsd
   1469 +	exit ;;
   1470 +    c2*)
   1471 +	if getsysinfo -f scalar_acc
   1472 +	then echo c32-convex-bsd
   1473 +	else echo c2-convex-bsd
   1474 +	fi
   1475 +	exit ;;
   1476 +    c34*)
   1477 +	echo c34-convex-bsd
   1478 +	exit ;;
   1479 +    c38*)
   1480 +	echo c38-convex-bsd
   1481 +	exit ;;
   1482 +    c4*)
   1483 +	echo c4-convex-bsd
   1484 +	exit ;;
   1485 +    esac
   1486 +fi
   1487 +
   1488 +cat >&2 <<EOF
   1489 +$0: unable to guess system type
   1490 +
   1491 +This script, last modified $timestamp, has failed to recognize
   1492 +the operating system you are using. It is advised that you
   1493 +download the most up to date version of the config scripts from
   1494 +
   1495 +  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
   1496 +and
   1497 +  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
   1498 +
   1499 +If the version you run ($0) is already up to date, please
   1500 +send the following data and any information you think might be
   1501 +pertinent to <config-patches (a] gnu.org> in order to provide the needed
   1502 +information to handle your system.
   1503 +
   1504 +config.guess timestamp = $timestamp
   1505 +
   1506 +uname -m = `(uname -m) 2>/dev/null || echo unknown`
   1507 +uname -r = `(uname -r) 2>/dev/null || echo unknown`
   1508 +uname -s = `(uname -s) 2>/dev/null || echo unknown`
   1509 +uname -v = `(uname -v) 2>/dev/null || echo unknown`
   1510 +
   1511 +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
   1512 +/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
   1513 +
   1514 +hostinfo               = `(hostinfo) 2>/dev/null`
   1515 +/bin/universe          = `(/bin/universe) 2>/dev/null`
   1516 +/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
   1517 +/bin/arch              = `(/bin/arch) 2>/dev/null`
   1518 +/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
   1519 +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
   1520 +
   1521 +UNAME_MACHINE = ${UNAME_MACHINE}
   1522 +UNAME_RELEASE = ${UNAME_RELEASE}
   1523 +UNAME_SYSTEM  = ${UNAME_SYSTEM}
   1524 +UNAME_VERSION = ${UNAME_VERSION}
   1525 +EOF
   1526 +
   1527 +exit 1
   1528 +
   1529 +# Local variables:
   1530 +# eval: (add-hook 'write-file-hooks 'time-stamp)
   1531 +# time-stamp-start: "timestamp='"
   1532 +# time-stamp-format: "%:y-%02m-%02d"
   1533 +# time-stamp-end: "'"
   1534 +# End:
   1535 diff -urN a/config.sub b/config.sub
   1536 --- a/config.sub	1970-01-01 01:00:00.000000000 +0100
   1537 +++ b/config.sub	2012-06-25 19:39:10.609815624 +0100
   1538 @@ -0,0 +1,1773 @@
   1539 +#! /bin/sh
   1540 +# Configuration validation subroutine script.
   1541 +#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
   1542 +#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
   1543 +#   2011, 2012 Free Software Foundation, Inc.
   1544 +
   1545 +timestamp='2012-02-10'
   1546 +
   1547 +# This file is (in principle) common to ALL GNU software.
   1548 +# The presence of a machine in this file suggests that SOME GNU software
   1549 +# can handle that machine.  It does not imply ALL GNU software can.
   1550 +#
   1551 +# This file is free software; you can redistribute it and/or modify
   1552 +# it under the terms of the GNU General Public License as published by
   1553 +# the Free Software Foundation; either version 2 of the License, or
   1554 +# (at your option) any later version.
   1555 +#
   1556 +# This program is distributed in the hope that it will be useful,
   1557 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
   1558 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   1559 +# GNU General Public License for more details.
   1560 +#
   1561 +# You should have received a copy of the GNU General Public License
   1562 +# along with this program; if not, see <http://www.gnu.org/licenses/>.
   1563 +#
   1564 +# As a special exception to the GNU General Public License, if you
   1565 +# distribute this file as part of a program that contains a
   1566 +# configuration script generated by Autoconf, you may include it under
   1567 +# the same distribution terms that you use for the rest of that program.
   1568 +
   1569 +
   1570 +# Please send patches to <config-patches (a] gnu.org>.  Submit a context
   1571 +# diff and a properly formatted GNU ChangeLog entry.
   1572 +#
   1573 +# Configuration subroutine to validate and canonicalize a configuration type.
   1574 +# Supply the specified configuration type as an argument.
   1575 +# If it is invalid, we print an error message on stderr and exit with code 1.
   1576 +# Otherwise, we print the canonical config type on stdout and succeed.
   1577 +
   1578 +# You can get the latest version of this script from:
   1579 +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
   1580 +
   1581 +# This file is supposed to be the same for all GNU packages
   1582 +# and recognize all the CPU types, system types and aliases
   1583 +# that are meaningful with *any* GNU software.
   1584 +# Each package is responsible for reporting which valid configurations
   1585 +# it does not support.  The user should be able to distinguish
   1586 +# a failure to support a valid configuration from a meaningless
   1587 +# configuration.
   1588 +
   1589 +# The goal of this file is to map all the various variations of a given
   1590 +# machine specification into a single specification in the form:
   1591 +#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
   1592 +# or in some cases, the newer four-part form:
   1593 +#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
   1594 +# It is wrong to echo any other type of specification.
   1595 +
   1596 +me=`echo "$0" | sed -e 's,.*/,,'`
   1597 +
   1598 +usage="\
   1599 +Usage: $0 [OPTION] CPU-MFR-OPSYS
   1600 +       $0 [OPTION] ALIAS
   1601 +
   1602 +Canonicalize a configuration name.
   1603 +
   1604 +Operation modes:
   1605 +  -h, --help         print this help, then exit
   1606 +  -t, --time-stamp   print date of last modification, then exit
   1607 +  -v, --version      print version number, then exit
   1608 +
   1609 +Report bugs and patches to <config-patches (a] gnu.org>."
   1610 +
   1611 +version="\
   1612 +GNU config.sub ($timestamp)
   1613 +
   1614 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
   1615 +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
   1616 +Free Software Foundation, Inc.
   1617 +
   1618 +This is free software; see the source for copying conditions.  There is NO
   1619 +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
   1620 +
   1621 +help="
   1622 +Try \`$me --help' for more information."
   1623 +
   1624 +# Parse command line
   1625 +while test $# -gt 0 ; do
   1626 +  case $1 in
   1627 +    --time-stamp | --time* | -t )
   1628 +       echo "$timestamp" ; exit ;;
   1629 +    --version | -v )
   1630 +       echo "$version" ; exit ;;
   1631 +    --help | --h* | -h )
   1632 +       echo "$usage"; exit ;;
   1633 +    -- )     # Stop option processing
   1634 +       shift; break ;;
   1635 +    - )	# Use stdin as input.
   1636 +       break ;;
   1637 +    -* )
   1638 +       echo "$me: invalid option $1$help"
   1639 +       exit 1 ;;
   1640 +
   1641 +    *local*)
   1642 +       # First pass through any local machine types.
   1643 +       echo $1
   1644 +       exit ;;
   1645 +
   1646 +    * )
   1647 +       break ;;
   1648 +  esac
   1649 +done
   1650 +
   1651 +case $# in
   1652 + 0) echo "$me: missing argument$help" >&2
   1653 +    exit 1;;
   1654 + 1) ;;
   1655 + *) echo "$me: too many arguments$help" >&2
   1656 +    exit 1;;
   1657 +esac
   1658 +
   1659 +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
   1660 +# Here we must recognize all the valid KERNEL-OS combinations.
   1661 +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
   1662 +case $maybe_os in
   1663 +  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
   1664 +  linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
   1665 +  knetbsd*-gnu* | netbsd*-gnu* | \
   1666 +  kopensolaris*-gnu* | \
   1667 +  storm-chaos* | os2-emx* | rtmk-nova*)
   1668 +    os=-$maybe_os
   1669 +    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
   1670 +    ;;
   1671 +  android-linux)
   1672 +    os=-linux-android
   1673 +    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
   1674 +    ;;
   1675 +  *)
   1676 +    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
   1677 +    if [ $basic_machine != $1 ]
   1678 +    then os=`echo $1 | sed 's/.*-/-/'`
   1679 +    else os=; fi
   1680 +    ;;
   1681 +esac
   1682 +
   1683 +### Let's recognize common machines as not being operating systems so
   1684 +### that things like config.sub decstation-3100 work.  We also
   1685 +### recognize some manufacturers as not being operating systems, so we
   1686 +### can provide default operating systems below.
   1687 +case $os in
   1688 +	-sun*os*)
   1689 +		# Prevent following clause from handling this invalid input.
   1690 +		;;
   1691 +	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
   1692 +	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
   1693 +	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
   1694 +	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
   1695 +	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
   1696 +	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
   1697 +	-apple | -axis | -knuth | -cray | -microblaze)
   1698 +		os=
   1699 +		basic_machine=$1
   1700 +		;;
   1701 +	-bluegene*)
   1702 +		os=-cnk
   1703 +		;;
   1704 +	-sim | -cisco | -oki | -wec | -winbond)
   1705 +		os=
   1706 +		basic_machine=$1
   1707 +		;;
   1708 +	-scout)
   1709 +		;;
   1710 +	-wrs)
   1711 +		os=-vxworks
   1712 +		basic_machine=$1
   1713 +		;;
   1714 +	-chorusos*)
   1715 +		os=-chorusos
   1716 +		basic_machine=$1
   1717 +		;;
   1718 +	-chorusrdb)
   1719 +		os=-chorusrdb
   1720 +		basic_machine=$1
   1721 +		;;
   1722 +	-hiux*)
   1723 +		os=-hiuxwe2
   1724 +		;;
   1725 +	-sco6)
   1726 +		os=-sco5v6
   1727 +		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
   1728 +		;;
   1729 +	-sco5)
   1730 +		os=-sco3.2v5
   1731 +		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
   1732 +		;;
   1733 +	-sco4)
   1734 +		os=-sco3.2v4
   1735 +		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
   1736 +		;;
   1737 +	-sco3.2.[4-9]*)
   1738 +		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
   1739 +		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
   1740 +		;;
   1741 +	-sco3.2v[4-9]*)
   1742 +		# Don't forget version if it is 3.2v4 or newer.
   1743 +		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
   1744 +		;;
   1745 +	-sco5v6*)
   1746 +		# Don't forget version if it is 3.2v4 or newer.
   1747 +		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
   1748 +		;;
   1749 +	-sco*)
   1750 +		os=-sco3.2v2
   1751 +		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
   1752 +		;;
   1753 +	-udk*)
   1754 +		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
   1755 +		;;
   1756 +	-isc)
   1757 +		os=-isc2.2
   1758 +		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
   1759 +		;;
   1760 +	-clix*)
   1761 +		basic_machine=clipper-intergraph
   1762 +		;;
   1763 +	-isc*)
   1764 +		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
   1765 +		;;
   1766 +	-lynx*)
   1767 +		os=-lynxos
   1768 +		;;
   1769 +	-ptx*)
   1770 +		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
   1771 +		;;
   1772 +	-windowsnt*)
   1773 +		os=`echo $os | sed -e 's/windowsnt/winnt/'`
   1774 +		;;
   1775 +	-psos*)
   1776 +		os=-psos
   1777 +		;;
   1778 +	-mint | -mint[0-9]*)
   1779 +		basic_machine=m68k-atari
   1780 +		os=-mint
   1781 +		;;
   1782 +esac
   1783 +
   1784 +# Decode aliases for certain CPU-COMPANY combinations.
   1785 +case $basic_machine in
   1786 +	# Recognize the basic CPU types without company name.
   1787 +	# Some are omitted here because they have special meanings below.
   1788 +	1750a | 580 \
   1789 +	| a29k \
   1790 +	| aarch64 | aarch64_be \
   1791 +	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
   1792 +	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
   1793 +	| am33_2.0 \
   1794 +	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
   1795 +        | be32 | be64 \
   1796 +	| bfin \
   1797 +	| c4x | clipper \
   1798 +	| d10v | d30v | dlx | dsp16xx \
   1799 +	| epiphany \
   1800 +	| fido | fr30 | frv \
   1801 +	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
   1802 +	| hexagon \
   1803 +	| i370 | i860 | i960 | ia64 \
   1804 +	| ip2k | iq2000 \
   1805 +	| le32 | le64 \
   1806 +	| lm32 \
   1807 +	| m32c | m32r | m32rle | m68000 | m68k | m88k \
   1808 +	| maxq | mb | microblaze | mcore | mep | metag \
   1809 +	| mips | mipsbe | mipseb | mipsel | mipsle \
   1810 +	| mips16 \
   1811 +	| mips64 | mips64el \
   1812 +	| mips64octeon | mips64octeonel \
   1813 +	| mips64orion | mips64orionel \
   1814 +	| mips64r5900 | mips64r5900el \
   1815 +	| mips64vr | mips64vrel \
   1816 +	| mips64vr4100 | mips64vr4100el \
   1817 +	| mips64vr4300 | mips64vr4300el \
   1818 +	| mips64vr5000 | mips64vr5000el \
   1819 +	| mips64vr5900 | mips64vr5900el \
   1820 +	| mipsisa32 | mipsisa32el \
   1821 +	| mipsisa32r2 | mipsisa32r2el \
   1822 +	| mipsisa64 | mipsisa64el \
   1823 +	| mipsisa64r2 | mipsisa64r2el \
   1824 +	| mipsisa64sb1 | mipsisa64sb1el \
   1825 +	| mipsisa64sr71k | mipsisa64sr71kel \
   1826 +	| mipstx39 | mipstx39el \
   1827 +	| mn10200 | mn10300 \
   1828 +	| moxie \
   1829 +	| mt \
   1830 +	| msp430 \
   1831 +	| nds32 | nds32le | nds32be \
   1832 +	| nios | nios2 \
   1833 +	| ns16k | ns32k \
   1834 +	| open8 \
   1835 +	| or32 \
   1836 +	| pdp10 | pdp11 | pj | pjl \
   1837 +	| powerpc | powerpc64 | powerpc64le | powerpcle \
   1838 +	| pyramid \
   1839 +	| rl78 | rx \
   1840 +	| score \
   1841 +	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
   1842 +	| sh64 | sh64le \
   1843 +	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
   1844 +	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
   1845 +	| spu \
   1846 +	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
   1847 +	| ubicom32 \
   1848 +	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
   1849 +	| we32k \
   1850 +	| x86 | xc16x | xstormy16 | xtensa \
   1851 +	| z8k | z80)
   1852 +		basic_machine=$basic_machine-unknown
   1853 +		;;
   1854 +	c54x)
   1855 +		basic_machine=tic54x-unknown
   1856 +		;;
   1857 +	c55x)
   1858 +		basic_machine=tic55x-unknown
   1859 +		;;
   1860 +	c6x)
   1861 +		basic_machine=tic6x-unknown
   1862 +		;;
   1863 +	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
   1864 +		basic_machine=$basic_machine-unknown
   1865 +		os=-none
   1866 +		;;
   1867 +	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
   1868 +		;;
   1869 +	ms1)
   1870 +		basic_machine=mt-unknown
   1871 +		;;
   1872 +
   1873 +	strongarm | thumb | xscale)
   1874 +		basic_machine=arm-unknown
   1875 +		;;
   1876 +	xgate)
   1877 +		basic_machine=$basic_machine-unknown
   1878 +		os=-none
   1879 +		;;
   1880 +	xscaleeb)
   1881 +		basic_machine=armeb-unknown
   1882 +		;;
   1883 +
   1884 +	xscaleel)
   1885 +		basic_machine=armel-unknown
   1886 +		;;
   1887 +
   1888 +	# We use `pc' rather than `unknown'
   1889 +	# because (1) that's what they normally are, and
   1890 +	# (2) the word "unknown" tends to confuse beginning users.
   1891 +	i*86 | x86_64)
   1892 +	  basic_machine=$basic_machine-pc
   1893 +	  ;;
   1894 +	# Object if more than one company name word.
   1895 +	*-*-*)
   1896 +		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
   1897 +		exit 1
   1898 +		;;
   1899 +	# Recognize the basic CPU types with company name.
   1900 +	580-* \
   1901 +	| a29k-* \
   1902 +	| aarch64-* | aarch64_be-* \
   1903 +	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
   1904 +	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
   1905 +	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
   1906 +	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
   1907 +	| avr-* | avr32-* \
   1908 +	| be32-* | be64-* \
   1909 +	| bfin-* | bs2000-* \
   1910 +	| c[123]* | c30-* | [cjt]90-* | c4x-* \
   1911 +	| clipper-* | craynv-* | cydra-* \
   1912 +	| d10v-* | d30v-* | dlx-* \
   1913 +	| elxsi-* \
   1914 +	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
   1915 +	| h8300-* | h8500-* \
   1916 +	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
   1917 +	| hexagon-* \
   1918 +	| i*86-* | i860-* | i960-* | ia64-* \
   1919 +	| ip2k-* | iq2000-* \
   1920 +	| le32-* | le64-* \
   1921 +	| lm32-* \
   1922 +	| m32c-* | m32r-* | m32rle-* \
   1923 +	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
   1924 +	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
   1925 +	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
   1926 +	| mips16-* \
   1927 +	| mips64-* | mips64el-* \
   1928 +	| mips64octeon-* | mips64octeonel-* \
   1929 +	| mips64orion-* | mips64orionel-* \
   1930 +	| mips64r5900-* | mips64r5900el-* \
   1931 +	| mips64vr-* | mips64vrel-* \
   1932 +	| mips64vr4100-* | mips64vr4100el-* \
   1933 +	| mips64vr4300-* | mips64vr4300el-* \
   1934 +	| mips64vr5000-* | mips64vr5000el-* \
   1935 +	| mips64vr5900-* | mips64vr5900el-* \
   1936 +	| mipsisa32-* | mipsisa32el-* \
   1937 +	| mipsisa32r2-* | mipsisa32r2el-* \
   1938 +	| mipsisa64-* | mipsisa64el-* \
   1939 +	| mipsisa64r2-* | mipsisa64r2el-* \
   1940 +	| mipsisa64sb1-* | mipsisa64sb1el-* \
   1941 +	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
   1942 +	| mipstx39-* | mipstx39el-* \
   1943 +	| mmix-* \
   1944 +	| mt-* \
   1945 +	| msp430-* \
   1946 +	| nds32-* | nds32le-* | nds32be-* \
   1947 +	| nios-* | nios2-* \
   1948 +	| none-* | np1-* | ns16k-* | ns32k-* \
   1949 +	| open8-* \
   1950 +	| orion-* \
   1951 +	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
   1952 +	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
   1953 +	| pyramid-* \
   1954 +	| rl78-* | romp-* | rs6000-* | rx-* \
   1955 +	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
   1956 +	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
   1957 +	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
   1958 +	| sparclite-* \
   1959 +	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
   1960 +	| tahoe-* \
   1961 +	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
   1962 +	| tile*-* \
   1963 +	| tron-* \
   1964 +	| ubicom32-* \
   1965 +	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
   1966 +	| vax-* \
   1967 +	| we32k-* \
   1968 +	| x86-* | x86_64-* | xc16x-* | xps100-* \
   1969 +	| xstormy16-* | xtensa*-* \
   1970 +	| ymp-* \
   1971 +	| z8k-* | z80-*)
   1972 +		;;
   1973 +	# Recognize the basic CPU types without company name, with glob match.
   1974 +	xtensa*)
   1975 +		basic_machine=$basic_machine-unknown
   1976 +		;;
   1977 +	# Recognize the various machine names and aliases which stand
   1978 +	# for a CPU type and a company and sometimes even an OS.
   1979 +	386bsd)
   1980 +		basic_machine=i386-unknown
   1981 +		os=-bsd
   1982 +		;;
   1983 +	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
   1984 +		basic_machine=m68000-att
   1985 +		;;
   1986 +	3b*)
   1987 +		basic_machine=we32k-att
   1988 +		;;
   1989 +	a29khif)
   1990 +		basic_machine=a29k-amd
   1991 +		os=-udi
   1992 +		;;
   1993 +	abacus)
   1994 +		basic_machine=abacus-unknown
   1995 +		;;
   1996 +	adobe68k)
   1997 +		basic_machine=m68010-adobe
   1998 +		os=-scout
   1999 +		;;
   2000 +	alliant | fx80)
   2001 +		basic_machine=fx80-alliant
   2002 +		;;
   2003 +	altos | altos3068)
   2004 +		basic_machine=m68k-altos
   2005 +		;;
   2006 +	am29k)
   2007 +		basic_machine=a29k-none
   2008 +		os=-bsd
   2009 +		;;
   2010 +	amd64)
   2011 +		basic_machine=x86_64-pc
   2012 +		;;
   2013 +	amd64-*)
   2014 +		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
   2015 +		;;
   2016 +	amdahl)
   2017 +		basic_machine=580-amdahl
   2018 +		os=-sysv
   2019 +		;;
   2020 +	amiga | amiga-*)
   2021 +		basic_machine=m68k-unknown
   2022 +		;;
   2023 +	amigaos | amigados)
   2024 +		basic_machine=m68k-unknown
   2025 +		os=-amigaos
   2026 +		;;
   2027 +	amigaunix | amix)
   2028 +		basic_machine=m68k-unknown
   2029 +		os=-sysv4
   2030 +		;;
   2031 +	apollo68)
   2032 +		basic_machine=m68k-apollo
   2033 +		os=-sysv
   2034 +		;;
   2035 +	apollo68bsd)
   2036 +		basic_machine=m68k-apollo
   2037 +		os=-bsd
   2038 +		;;
   2039 +	aros)
   2040 +		basic_machine=i386-pc
   2041 +		os=-aros
   2042 +		;;
   2043 +	aux)
   2044 +		basic_machine=m68k-apple
   2045 +		os=-aux
   2046 +		;;
   2047 +	balance)
   2048 +		basic_machine=ns32k-sequent
   2049 +		os=-dynix
   2050 +		;;
   2051 +	blackfin)
   2052 +		basic_machine=bfin-unknown
   2053 +		os=-linux
   2054 +		;;
   2055 +	blackfin-*)
   2056 +		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
   2057 +		os=-linux
   2058 +		;;
   2059 +	bluegene*)
   2060 +		basic_machine=powerpc-ibm
   2061 +		os=-cnk
   2062 +		;;
   2063 +	c54x-*)
   2064 +		basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
   2065 +		;;
   2066 +	c55x-*)
   2067 +		basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
   2068 +		;;
   2069 +	c6x-*)
   2070 +		basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
   2071 +		;;
   2072 +	c90)
   2073 +		basic_machine=c90-cray
   2074 +		os=-unicos
   2075 +		;;
   2076 +	cegcc)
   2077 +		basic_machine=arm-unknown
   2078 +		os=-cegcc
   2079 +		;;
   2080 +	convex-c1)
   2081 +		basic_machine=c1-convex
   2082 +		os=-bsd
   2083 +		;;
   2084 +	convex-c2)
   2085 +		basic_machine=c2-convex
   2086 +		os=-bsd
   2087 +		;;
   2088 +	convex-c32)
   2089 +		basic_machine=c32-convex
   2090 +		os=-bsd
   2091 +		;;
   2092 +	convex-c34)
   2093 +		basic_machine=c34-convex
   2094 +		os=-bsd
   2095 +		;;
   2096 +	convex-c38)
   2097 +		basic_machine=c38-convex
   2098 +		os=-bsd
   2099 +		;;
   2100 +	cray | j90)
   2101 +		basic_machine=j90-cray
   2102 +		os=-unicos
   2103 +		;;
   2104 +	craynv)
   2105 +		basic_machine=craynv-cray
   2106 +		os=-unicosmp
   2107 +		;;
   2108 +	cr16 | cr16-*)
   2109 +		basic_machine=cr16-unknown
   2110 +		os=-elf
   2111 +		;;
   2112 +	crds | unos)
   2113 +		basic_machine=m68k-crds
   2114 +		;;
   2115 +	crisv32 | crisv32-* | etraxfs*)
   2116 +		basic_machine=crisv32-axis
   2117 +		;;
   2118 +	cris | cris-* | etrax*)
   2119 +		basic_machine=cris-axis
   2120 +		;;
   2121 +	crx)
   2122 +		basic_machine=crx-unknown
   2123 +		os=-elf
   2124 +		;;
   2125 +	da30 | da30-*)
   2126 +		basic_machine=m68k-da30
   2127 +		;;
   2128 +	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
   2129 +		basic_machine=mips-dec
   2130 +		;;
   2131 +	decsystem10* | dec10*)
   2132 +		basic_machine=pdp10-dec
   2133 +		os=-tops10
   2134 +		;;
   2135 +	decsystem20* | dec20*)
   2136 +		basic_machine=pdp10-dec
   2137 +		os=-tops20
   2138 +		;;
   2139 +	delta | 3300 | motorola-3300 | motorola-delta \
   2140 +	      | 3300-motorola | delta-motorola)
   2141 +		basic_machine=m68k-motorola
   2142 +		;;
   2143 +	delta88)
   2144 +		basic_machine=m88k-motorola
   2145 +		os=-sysv3
   2146 +		;;
   2147 +	dicos)
   2148 +		basic_machine=i686-pc
   2149 +		os=-dicos
   2150 +		;;
   2151 +	djgpp)
   2152 +		basic_machine=i586-pc
   2153 +		os=-msdosdjgpp
   2154 +		;;
   2155 +	dpx20 | dpx20-*)
   2156 +		basic_machine=rs6000-bull
   2157 +		os=-bosx
   2158 +		;;
   2159 +	dpx2* | dpx2*-bull)
   2160 +		basic_machine=m68k-bull
   2161 +		os=-sysv3
   2162 +		;;
   2163 +	ebmon29k)
   2164 +		basic_machine=a29k-amd
   2165 +		os=-ebmon
   2166 +		;;
   2167 +	elxsi)
   2168 +		basic_machine=elxsi-elxsi
   2169 +		os=-bsd
   2170 +		;;
   2171 +	encore | umax | mmax)
   2172 +		basic_machine=ns32k-encore
   2173 +		;;
   2174 +	es1800 | OSE68k | ose68k | ose | OSE)
   2175 +		basic_machine=m68k-ericsson
   2176 +		os=-ose
   2177 +		;;
   2178 +	fx2800)
   2179 +		basic_machine=i860-alliant
   2180 +		;;
   2181 +	genix)
   2182 +		basic_machine=ns32k-ns
   2183 +		;;
   2184 +	gmicro)
   2185 +		basic_machine=tron-gmicro
   2186 +		os=-sysv
   2187 +		;;
   2188 +	go32)
   2189 +		basic_machine=i386-pc
   2190 +		os=-go32
   2191 +		;;
   2192 +	h3050r* | hiux*)
   2193 +		basic_machine=hppa1.1-hitachi
   2194 +		os=-hiuxwe2
   2195 +		;;
   2196 +	h8300hms)
   2197 +		basic_machine=h8300-hitachi
   2198 +		os=-hms
   2199 +		;;
   2200 +	h8300xray)
   2201 +		basic_machine=h8300-hitachi
   2202 +		os=-xray
   2203 +		;;
   2204 +	h8500hms)
   2205 +		basic_machine=h8500-hitachi
   2206 +		os=-hms
   2207 +		;;
   2208 +	harris)
   2209 +		basic_machine=m88k-harris
   2210 +		os=-sysv3
   2211 +		;;
   2212 +	hp300-*)
   2213 +		basic_machine=m68k-hp
   2214 +		;;
   2215 +	hp300bsd)
   2216 +		basic_machine=m68k-hp
   2217 +		os=-bsd
   2218 +		;;
   2219 +	hp300hpux)
   2220 +		basic_machine=m68k-hp
   2221 +		os=-hpux
   2222 +		;;
   2223 +	hp3k9[0-9][0-9] | hp9[0-9][0-9])
   2224 +		basic_machine=hppa1.0-hp
   2225 +		;;
   2226 +	hp9k2[0-9][0-9] | hp9k31[0-9])
   2227 +		basic_machine=m68000-hp
   2228 +		;;
   2229 +	hp9k3[2-9][0-9])
   2230 +		basic_machine=m68k-hp
   2231 +		;;
   2232 +	hp9k6[0-9][0-9] | hp6[0-9][0-9])
   2233 +		basic_machine=hppa1.0-hp
   2234 +		;;
   2235 +	hp9k7[0-79][0-9] | hp7[0-79][0-9])
   2236 +		basic_machine=hppa1.1-hp
   2237 +		;;
   2238 +	hp9k78[0-9] | hp78[0-9])
   2239 +		# FIXME: really hppa2.0-hp
   2240 +		basic_machine=hppa1.1-hp
   2241 +		;;
   2242 +	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
   2243 +		# FIXME: really hppa2.0-hp
   2244 +		basic_machine=hppa1.1-hp
   2245 +		;;
   2246 +	hp9k8[0-9][13679] | hp8[0-9][13679])
   2247 +		basic_machine=hppa1.1-hp
   2248 +		;;
   2249 +	hp9k8[0-9][0-9] | hp8[0-9][0-9])
   2250 +		basic_machine=hppa1.0-hp
   2251 +		;;
   2252 +	hppa-next)
   2253 +		os=-nextstep3
   2254 +		;;
   2255 +	hppaosf)
   2256 +		basic_machine=hppa1.1-hp
   2257 +		os=-osf
   2258 +		;;
   2259 +	hppro)
   2260 +		basic_machine=hppa1.1-hp
   2261 +		os=-proelf
   2262 +		;;
   2263 +	i370-ibm* | ibm*)
   2264 +		basic_machine=i370-ibm
   2265 +		;;
   2266 +	i*86v32)
   2267 +		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
   2268 +		os=-sysv32
   2269 +		;;
   2270 +	i*86v4*)
   2271 +		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
   2272 +		os=-sysv4
   2273 +		;;
   2274 +	i*86v)
   2275 +		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
   2276 +		os=-sysv
   2277 +		;;
   2278 +	i*86sol2)
   2279 +		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
   2280 +		os=-solaris2
   2281 +		;;
   2282 +	i386mach)
   2283 +		basic_machine=i386-mach
   2284 +		os=-mach
   2285 +		;;
   2286 +	i386-vsta | vsta)
   2287 +		basic_machine=i386-unknown
   2288 +		os=-vsta
   2289 +		;;
   2290 +	iris | iris4d)
   2291 +		basic_machine=mips-sgi
   2292 +		case $os in
   2293 +		    -irix*)
   2294 +			;;
   2295 +		    *)
   2296 +			os=-irix4
   2297 +			;;
   2298 +		esac
   2299 +		;;
   2300 +	isi68 | isi)
   2301 +		basic_machine=m68k-isi
   2302 +		os=-sysv
   2303 +		;;
   2304 +	m68knommu)
   2305 +		basic_machine=m68k-unknown
   2306 +		os=-linux
   2307 +		;;
   2308 +	m68knommu-*)
   2309 +		basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
   2310 +		os=-linux
   2311 +		;;
   2312 +	m88k-omron*)
   2313 +		basic_machine=m88k-omron
   2314 +		;;
   2315 +	magnum | m3230)
   2316 +		basic_machine=mips-mips
   2317 +		os=-sysv
   2318 +		;;
   2319 +	merlin)
   2320 +		basic_machine=ns32k-utek
   2321 +		os=-sysv
   2322 +		;;
   2323 +	microblaze)
   2324 +		basic_machine=microblaze-xilinx
   2325 +		;;
   2326 +	mingw32)
   2327 +		basic_machine=i386-pc
   2328 +		os=-mingw32
   2329 +		;;
   2330 +	mingw32ce)
   2331 +		basic_machine=arm-unknown
   2332 +		os=-mingw32ce
   2333 +		;;
   2334 +	miniframe)
   2335 +		basic_machine=m68000-convergent
   2336 +		;;
   2337 +	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
   2338 +		basic_machine=m68k-atari
   2339 +		os=-mint
   2340 +		;;
   2341 +	mips3*-*)
   2342 +		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
   2343 +		;;
   2344 +	mips3*)
   2345 +		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
   2346 +		;;
   2347 +	monitor)
   2348 +		basic_machine=m68k-rom68k
   2349 +		os=-coff
   2350 +		;;
   2351 +	morphos)
   2352 +		basic_machine=powerpc-unknown
   2353 +		os=-morphos
   2354 +		;;
   2355 +	msdos)
   2356 +		basic_machine=i386-pc
   2357 +		os=-msdos
   2358 +		;;
   2359 +	ms1-*)
   2360 +		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
   2361 +		;;
   2362 +	msys)
   2363 +		basic_machine=i386-pc
   2364 +		os=-msys
   2365 +		;;
   2366 +	mvs)
   2367 +		basic_machine=i370-ibm
   2368 +		os=-mvs
   2369 +		;;
   2370 +	nacl)
   2371 +		basic_machine=le32-unknown
   2372 +		os=-nacl
   2373 +		;;
   2374 +	ncr3000)
   2375 +		basic_machine=i486-ncr
   2376 +		os=-sysv4
   2377 +		;;
   2378 +	netbsd386)
   2379 +		basic_machine=i386-unknown
   2380 +		os=-netbsd
   2381 +		;;
   2382 +	netwinder)
   2383 +		basic_machine=armv4l-rebel
   2384 +		os=-linux
   2385 +		;;
   2386 +	news | news700 | news800 | news900)
   2387 +		basic_machine=m68k-sony
   2388 +		os=-newsos
   2389 +		;;
   2390 +	news1000)
   2391 +		basic_machine=m68030-sony
   2392 +		os=-newsos
   2393 +		;;
   2394 +	news-3600 | risc-news)
   2395 +		basic_machine=mips-sony
   2396 +		os=-newsos
   2397 +		;;
   2398 +	necv70)
   2399 +		basic_machine=v70-nec
   2400 +		os=-sysv
   2401 +		;;
   2402 +	next | m*-next )
   2403 +		basic_machine=m68k-next
   2404 +		case $os in
   2405 +		    -nextstep* )
   2406 +			;;
   2407 +		    -ns2*)
   2408 +		      os=-nextstep2
   2409 +			;;
   2410 +		    *)
   2411 +		      os=-nextstep3
   2412 +			;;
   2413 +		esac
   2414 +		;;
   2415 +	nh3000)
   2416 +		basic_machine=m68k-harris
   2417 +		os=-cxux
   2418 +		;;
   2419 +	nh[45]000)
   2420 +		basic_machine=m88k-harris
   2421 +		os=-cxux
   2422 +		;;
   2423 +	nindy960)
   2424 +		basic_machine=i960-intel
   2425 +		os=-nindy
   2426 +		;;
   2427 +	mon960)
   2428 +		basic_machine=i960-intel
   2429 +		os=-mon960
   2430 +		;;
   2431 +	nonstopux)
   2432 +		basic_machine=mips-compaq
   2433 +		os=-nonstopux
   2434 +		;;
   2435 +	np1)
   2436 +		basic_machine=np1-gould
   2437 +		;;
   2438 +	neo-tandem)
   2439 +		basic_machine=neo-tandem
   2440 +		;;
   2441 +	nse-tandem)
   2442 +		basic_machine=nse-tandem
   2443 +		;;
   2444 +	nsr-tandem)
   2445 +		basic_machine=nsr-tandem
   2446 +		;;
   2447 +	op50n-* | op60c-*)
   2448 +		basic_machine=hppa1.1-oki
   2449 +		os=-proelf
   2450 +		;;
   2451 +	openrisc | openrisc-*)
   2452 +		basic_machine=or32-unknown
   2453 +		;;
   2454 +	os400)
   2455 +		basic_machine=powerpc-ibm
   2456 +		os=-os400
   2457 +		;;
   2458 +	OSE68000 | ose68000)
   2459 +		basic_machine=m68000-ericsson
   2460 +		os=-ose
   2461 +		;;
   2462 +	os68k)
   2463 +		basic_machine=m68k-none
   2464 +		os=-os68k
   2465 +		;;
   2466 +	pa-hitachi)
   2467 +		basic_machine=hppa1.1-hitachi
   2468 +		os=-hiuxwe2
   2469 +		;;
   2470 +	paragon)
   2471 +		basic_machine=i860-intel
   2472 +		os=-osf
   2473 +		;;
   2474 +	parisc)
   2475 +		basic_machine=hppa-unknown
   2476 +		os=-linux
   2477 +		;;
   2478 +	parisc-*)
   2479 +		basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
   2480 +		os=-linux
   2481 +		;;
   2482 +	pbd)
   2483 +		basic_machine=sparc-tti
   2484 +		;;
   2485 +	pbb)
   2486 +		basic_machine=m68k-tti
   2487 +		;;
   2488 +	pc532 | pc532-*)
   2489 +		basic_machine=ns32k-pc532
   2490 +		;;
   2491 +	pc98)
   2492 +		basic_machine=i386-pc
   2493 +		;;
   2494 +	pc98-*)
   2495 +		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
   2496 +		;;
   2497 +	pentium | p5 | k5 | k6 | nexgen | viac3)
   2498 +		basic_machine=i586-pc
   2499 +		;;
   2500 +	pentiumpro | p6 | 6x86 | athlon | athlon_*)
   2501 +		basic_machine=i686-pc
   2502 +		;;
   2503 +	pentiumii | pentium2 | pentiumiii | pentium3)
   2504 +		basic_machine=i686-pc
   2505 +		;;
   2506 +	pentium4)
   2507 +		basic_machine=i786-pc
   2508 +		;;
   2509 +	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
   2510 +		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
   2511 +		;;
   2512 +	pentiumpro-* | p6-* | 6x86-* | athlon-*)
   2513 +		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
   2514 +		;;
   2515 +	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
   2516 +		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
   2517 +		;;
   2518 +	pentium4-*)
   2519 +		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
   2520 +		;;
   2521 +	pn)
   2522 +		basic_machine=pn-gould
   2523 +		;;
   2524 +	power)	basic_machine=power-ibm
   2525 +		;;
   2526 +	ppc | ppcbe)	basic_machine=powerpc-unknown
   2527 +		;;
   2528 +	ppc-* | ppcbe-*)
   2529 +		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
   2530 +		;;
   2531 +	ppcle | powerpclittle | ppc-le | powerpc-little)
   2532 +		basic_machine=powerpcle-unknown
   2533 +		;;
   2534 +	ppcle-* | powerpclittle-*)
   2535 +		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
   2536 +		;;
   2537 +	ppc64)	basic_machine=powerpc64-unknown
   2538 +		;;
   2539 +	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
   2540 +		;;
   2541 +	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
   2542 +		basic_machine=powerpc64le-unknown
   2543 +		;;
   2544 +	ppc64le-* | powerpc64little-*)
   2545 +		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
   2546 +		;;
   2547 +	ps2)
   2548 +		basic_machine=i386-ibm
   2549 +		;;
   2550 +	pw32)
   2551 +		basic_machine=i586-unknown
   2552 +		os=-pw32
   2553 +		;;
   2554 +	rdos)
   2555 +		basic_machine=i386-pc
   2556 +		os=-rdos
   2557 +		;;
   2558 +	rom68k)
   2559 +		basic_machine=m68k-rom68k
   2560 +		os=-coff
   2561 +		;;
   2562 +	rm[46]00)
   2563 +		basic_machine=mips-siemens
   2564 +		;;
   2565 +	rtpc | rtpc-*)
   2566 +		basic_machine=romp-ibm
   2567 +		;;
   2568 +	s390 | s390-*)
   2569 +		basic_machine=s390-ibm
   2570 +		;;
   2571 +	s390x | s390x-*)
   2572 +		basic_machine=s390x-ibm
   2573 +		;;
   2574 +	sa29200)
   2575 +		basic_machine=a29k-amd
   2576 +		os=-udi
   2577 +		;;
   2578 +	sb1)
   2579 +		basic_machine=mipsisa64sb1-unknown
   2580 +		;;
   2581 +	sb1el)
   2582 +		basic_machine=mipsisa64sb1el-unknown
   2583 +		;;
   2584 +	sde)
   2585 +		basic_machine=mipsisa32-sde
   2586 +		os=-elf
   2587 +		;;
   2588 +	sei)
   2589 +		basic_machine=mips-sei
   2590 +		os=-seiux
   2591 +		;;
   2592 +	sequent)
   2593 +		basic_machine=i386-sequent
   2594 +		;;
   2595 +	sh)
   2596 +		basic_machine=sh-hitachi
   2597 +		os=-hms
   2598 +		;;
   2599 +	sh5el)
   2600 +		basic_machine=sh5le-unknown
   2601 +		;;
   2602 +	sh64)
   2603 +		basic_machine=sh64-unknown
   2604 +		;;
   2605 +	sparclite-wrs | simso-wrs)
   2606 +		basic_machine=sparclite-wrs
   2607 +		os=-vxworks
   2608 +		;;
   2609 +	sps7)
   2610 +		basic_machine=m68k-bull
   2611 +		os=-sysv2
   2612 +		;;
   2613 +	spur)
   2614 +		basic_machine=spur-unknown
   2615 +		;;
   2616 +	st2000)
   2617 +		basic_machine=m68k-tandem
   2618 +		;;
   2619 +	stratus)
   2620 +		basic_machine=i860-stratus
   2621 +		os=-sysv4
   2622 +		;;
   2623 +	strongarm-* | thumb-*)
   2624 +		basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
   2625 +		;;
   2626 +	sun2)
   2627 +		basic_machine=m68000-sun
   2628 +		;;
   2629 +	sun2os3)
   2630 +		basic_machine=m68000-sun
   2631 +		os=-sunos3
   2632 +		;;
   2633 +	sun2os4)
   2634 +		basic_machine=m68000-sun
   2635 +		os=-sunos4
   2636 +		;;
   2637 +	sun3os3)
   2638 +		basic_machine=m68k-sun
   2639 +		os=-sunos3
   2640 +		;;
   2641 +	sun3os4)
   2642 +		basic_machine=m68k-sun
   2643 +		os=-sunos4
   2644 +		;;
   2645 +	sun4os3)
   2646 +		basic_machine=sparc-sun
   2647 +		os=-sunos3
   2648 +		;;
   2649 +	sun4os4)
   2650 +		basic_machine=sparc-sun
   2651 +		os=-sunos4
   2652 +		;;
   2653 +	sun4sol2)
   2654 +		basic_machine=sparc-sun
   2655 +		os=-solaris2
   2656 +		;;
   2657 +	sun3 | sun3-*)
   2658 +		basic_machine=m68k-sun
   2659 +		;;
   2660 +	sun4)
   2661 +		basic_machine=sparc-sun
   2662 +		;;
   2663 +	sun386 | sun386i | roadrunner)
   2664 +		basic_machine=i386-sun
   2665 +		;;
   2666 +	sv1)
   2667 +		basic_machine=sv1-cray
   2668 +		os=-unicos
   2669 +		;;
   2670 +	symmetry)
   2671 +		basic_machine=i386-sequent
   2672 +		os=-dynix
   2673 +		;;
   2674 +	t3e)
   2675 +		basic_machine=alphaev5-cray
   2676 +		os=-unicos
   2677 +		;;
   2678 +	t90)
   2679 +		basic_machine=t90-cray
   2680 +		os=-unicos
   2681 +		;;
   2682 +	tile*)
   2683 +		basic_machine=$basic_machine-unknown
   2684 +		os=-linux-gnu
   2685 +		;;
   2686 +	tx39)
   2687 +		basic_machine=mipstx39-unknown
   2688 +		;;
   2689 +	tx39el)
   2690 +		basic_machine=mipstx39el-unknown
   2691 +		;;
   2692 +	toad1)
   2693 +		basic_machine=pdp10-xkl
   2694 +		os=-tops20
   2695 +		;;
   2696 +	tower | tower-32)
   2697 +		basic_machine=m68k-ncr
   2698 +		;;
   2699 +	tpf)
   2700 +		basic_machine=s390x-ibm
   2701 +		os=-tpf
   2702 +		;;
   2703 +	udi29k)
   2704 +		basic_machine=a29k-amd
   2705 +		os=-udi
   2706 +		;;
   2707 +	ultra3)
   2708 +		basic_machine=a29k-nyu
   2709 +		os=-sym1
   2710 +		;;
   2711 +	v810 | necv810)
   2712 +		basic_machine=v810-nec
   2713 +		os=-none
   2714 +		;;
   2715 +	vaxv)
   2716 +		basic_machine=vax-dec
   2717 +		os=-sysv
   2718 +		;;
   2719 +	vms)
   2720 +		basic_machine=vax-dec
   2721 +		os=-vms
   2722 +		;;
   2723 +	vpp*|vx|vx-*)
   2724 +		basic_machine=f301-fujitsu
   2725 +		;;
   2726 +	vxworks960)
   2727 +		basic_machine=i960-wrs
   2728 +		os=-vxworks
   2729 +		;;
   2730 +	vxworks68)
   2731 +		basic_machine=m68k-wrs
   2732 +		os=-vxworks
   2733 +		;;
   2734 +	vxworks29k)
   2735 +		basic_machine=a29k-wrs
   2736 +		os=-vxworks
   2737 +		;;
   2738 +	w65*)
   2739 +		basic_machine=w65-wdc
   2740 +		os=-none
   2741 +		;;
   2742 +	w89k-*)
   2743 +		basic_machine=hppa1.1-winbond
   2744 +		os=-proelf
   2745 +		;;
   2746 +	xbox)
   2747 +		basic_machine=i686-pc
   2748 +		os=-mingw32
   2749 +		;;
   2750 +	xps | xps100)
   2751 +		basic_machine=xps100-honeywell
   2752 +		;;
   2753 +	xscale-* | xscalee[bl]-*)
   2754 +		basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
   2755 +		;;
   2756 +	ymp)
   2757 +		basic_machine=ymp-cray
   2758 +		os=-unicos
   2759 +		;;
   2760 +	z8k-*-coff)
   2761 +		basic_machine=z8k-unknown
   2762 +		os=-sim
   2763 +		;;
   2764 +	z80-*-coff)
   2765 +		basic_machine=z80-unknown
   2766 +		os=-sim
   2767 +		;;
   2768 +	none)
   2769 +		basic_machine=none-none
   2770 +		os=-none
   2771 +		;;
   2772 +
   2773 +# Here we handle the default manufacturer of certain CPU types.  It is in
   2774 +# some cases the only manufacturer, in others, it is the most popular.
   2775 +	w89k)
   2776 +		basic_machine=hppa1.1-winbond
   2777 +		;;
   2778 +	op50n)
   2779 +		basic_machine=hppa1.1-oki
   2780 +		;;
   2781 +	op60c)
   2782 +		basic_machine=hppa1.1-oki
   2783 +		;;
   2784 +	romp)
   2785 +		basic_machine=romp-ibm
   2786 +		;;
   2787 +	mmix)
   2788 +		basic_machine=mmix-knuth
   2789 +		;;
   2790 +	rs6000)
   2791 +		basic_machine=rs6000-ibm
   2792 +		;;
   2793 +	vax)
   2794 +		basic_machine=vax-dec
   2795 +		;;
   2796 +	pdp10)
   2797 +		# there are many clones, so DEC is not a safe bet
   2798 +		basic_machine=pdp10-unknown
   2799 +		;;
   2800 +	pdp11)
   2801 +		basic_machine=pdp11-dec
   2802 +		;;
   2803 +	we32k)
   2804 +		basic_machine=we32k-att
   2805 +		;;
   2806 +	sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
   2807 +		basic_machine=sh-unknown
   2808 +		;;
   2809 +	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
   2810 +		basic_machine=sparc-sun
   2811 +		;;
   2812 +	cydra)
   2813 +		basic_machine=cydra-cydrome
   2814 +		;;
   2815 +	orion)
   2816 +		basic_machine=orion-highlevel
   2817 +		;;
   2818 +	orion105)
   2819 +		basic_machine=clipper-highlevel
   2820 +		;;
   2821 +	mac | mpw | mac-mpw)
   2822 +		basic_machine=m68k-apple
   2823 +		;;
   2824 +	pmac | pmac-mpw)
   2825 +		basic_machine=powerpc-apple
   2826 +		;;
   2827 +	*-unknown)
   2828 +		# Make sure to match an already-canonicalized machine name.
   2829 +		;;
   2830 +	*)
   2831 +		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
   2832 +		exit 1
   2833 +		;;
   2834 +esac
   2835 +
   2836 +# Here we canonicalize certain aliases for manufacturers.
   2837 +case $basic_machine in
   2838 +	*-digital*)
   2839 +		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
   2840 +		;;
   2841 +	*-commodore*)
   2842 +		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
   2843 +		;;
   2844 +	*)
   2845 +		;;
   2846 +esac
   2847 +
   2848 +# Decode manufacturer-specific aliases for certain operating systems.
   2849 +
   2850 +if [ x"$os" != x"" ]
   2851 +then
   2852 +case $os in
   2853 +	# First match some system type aliases
   2854 +	# that might get confused with valid system types.
   2855 +	# -solaris* is a basic system type, with this one exception.
   2856 +	-auroraux)
   2857 +		os=-auroraux
   2858 +		;;
   2859 +	-solaris1 | -solaris1.*)
   2860 +		os=`echo $os | sed -e 's|solaris1|sunos4|'`
   2861 +		;;
   2862 +	-solaris)
   2863 +		os=-solaris2
   2864 +		;;
   2865 +	-svr4*)
   2866 +		os=-sysv4
   2867 +		;;
   2868 +	-unixware*)
   2869 +		os=-sysv4.2uw
   2870 +		;;
   2871 +	-gnu/linux*)
   2872 +		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
   2873 +		;;
   2874 +	# First accept the basic system types.
   2875 +	# The portable systems comes first.
   2876 +	# Each alternative MUST END IN A *, to match a version number.
   2877 +	# -sysv* is not here because it comes later, after sysvr4.
   2878 +	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
   2879 +	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
   2880 +	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
   2881 +	      | -sym* | -kopensolaris* \
   2882 +	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
   2883 +	      | -aos* | -aros* \
   2884 +	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
   2885 +	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
   2886 +	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
   2887 +	      | -openbsd* | -solidbsd* \
   2888 +	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
   2889 +	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
   2890 +	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
   2891 +	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
   2892 +	      | -chorusos* | -chorusrdb* | -cegcc* \
   2893 +	      | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
   2894 +	      | -mingw32* | -linux-gnu* | -linux-android* \
   2895 +	      | -linux-newlib* | -linux-uclibc* \
   2896 +	      | -uxpv* | -beos* | -mpeix* | -udk* \
   2897 +	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
   2898 +	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
   2899 +	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
   2900 +	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
   2901 +	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
   2902 +	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
   2903 +	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
   2904 +	# Remember, each alternative MUST END IN *, to match a version number.
   2905 +		;;
   2906 +	-qnx*)
   2907 +		case $basic_machine in
   2908 +		    x86-* | i*86-*)
   2909 +			;;
   2910 +		    *)
   2911 +			os=-nto$os
   2912 +			;;
   2913 +		esac
   2914 +		;;
   2915 +	-nto-qnx*)
   2916 +		;;
   2917 +	-nto*)
   2918 +		os=`echo $os | sed -e 's|nto|nto-qnx|'`
   2919 +		;;
   2920 +	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
   2921 +	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
   2922 +	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
   2923 +		;;
   2924 +	-mac*)
   2925 +		os=`echo $os | sed -e 's|mac|macos|'`
   2926 +		;;
   2927 +	-linux-dietlibc)
   2928 +		os=-linux-dietlibc
   2929 +		;;
   2930 +	-linux*)
   2931 +		os=`echo $os | sed -e 's|linux|linux-gnu|'`
   2932 +		;;
   2933 +	-sunos5*)
   2934 +		os=`echo $os | sed -e 's|sunos5|solaris2|'`
   2935 +		;;
   2936 +	-sunos6*)
   2937 +		os=`echo $os | sed -e 's|sunos6|solaris3|'`
   2938 +		;;
   2939 +	-opened*)
   2940 +		os=-openedition
   2941 +		;;
   2942 +	-os400*)
   2943 +		os=-os400
   2944 +		;;
   2945 +	-wince*)
   2946 +		os=-wince
   2947 +		;;
   2948 +	-osfrose*)
   2949 +		os=-osfrose
   2950 +		;;
   2951 +	-osf*)
   2952 +		os=-osf
   2953 +		;;
   2954 +	-utek*)
   2955 +		os=-bsd
   2956 +		;;
   2957 +	-dynix*)
   2958 +		os=-bsd
   2959 +		;;
   2960 +	-acis*)
   2961 +		os=-aos
   2962 +		;;
   2963 +	-atheos*)
   2964 +		os=-atheos
   2965 +		;;
   2966 +	-syllable*)
   2967 +		os=-syllable
   2968 +		;;
   2969 +	-386bsd)
   2970 +		os=-bsd
   2971 +		;;
   2972 +	-ctix* | -uts*)
   2973 +		os=-sysv
   2974 +		;;
   2975 +	-nova*)
   2976 +		os=-rtmk-nova
   2977 +		;;
   2978 +	-ns2 )
   2979 +		os=-nextstep2
   2980 +		;;
   2981 +	-nsk*)
   2982 +		os=-nsk
   2983 +		;;
   2984 +	# Preserve the version number of sinix5.
   2985 +	-sinix5.*)
   2986 +		os=`echo $os | sed -e 's|sinix|sysv|'`
   2987 +		;;
   2988 +	-sinix*)
   2989 +		os=-sysv4
   2990 +		;;
   2991 +	-tpf*)
   2992 +		os=-tpf
   2993 +		;;
   2994 +	-triton*)
   2995 +		os=-sysv3
   2996 +		;;
   2997 +	-oss*)
   2998 +		os=-sysv3
   2999 +		;;
   3000 +	-svr4)
   3001 +		os=-sysv4
   3002 +		;;
   3003 +	-svr3)
   3004 +		os=-sysv3
   3005 +		;;
   3006 +	-sysvr4)
   3007 +		os=-sysv4
   3008 +		;;
   3009 +	# This must come after -sysvr4.
   3010 +	-sysv*)
   3011 +		;;
   3012 +	-ose*)
   3013 +		os=-ose
   3014 +		;;
   3015 +	-es1800*)
   3016 +		os=-ose
   3017 +		;;
   3018 +	-xenix)
   3019 +		os=-xenix
   3020 +		;;
   3021 +	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
   3022 +		os=-mint
   3023 +		;;
   3024 +	-aros*)
   3025 +		os=-aros
   3026 +		;;
   3027 +	-kaos*)
   3028 +		os=-kaos
   3029 +		;;
   3030 +	-zvmoe)
   3031 +		os=-zvmoe
   3032 +		;;
   3033 +	-dicos*)
   3034 +		os=-dicos
   3035 +		;;
   3036 +	-nacl*)
   3037 +		;;
   3038 +	-none)
   3039 +		;;
   3040 +	*)
   3041 +		# Get rid of the `-' at the beginning of $os.
   3042 +		os=`echo $os | sed 's/[^-]*-//'`
   3043 +		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
   3044 +		exit 1
   3045 +		;;
   3046 +esac
   3047 +else
   3048 +
   3049 +# Here we handle the default operating systems that come with various machines.
   3050 +# The value should be what the vendor currently ships out the door with their
   3051 +# machine or put another way, the most popular os provided with the machine.
   3052 +
   3053 +# Note that if you're going to try to match "-MANUFACTURER" here (say,
   3054 +# "-sun"), then you have to tell the case statement up towards the top
   3055 +# that MANUFACTURER isn't an operating system.  Otherwise, code above
   3056 +# will signal an error saying that MANUFACTURER isn't an operating
   3057 +# system, and we'll never get to this point.
   3058 +
   3059 +case $basic_machine in
   3060 +	score-*)
   3061 +		os=-elf
   3062 +		;;
   3063 +	spu-*)
   3064 +		os=-elf
   3065 +		;;
   3066 +	*-acorn)
   3067 +		os=-riscix1.2
   3068 +		;;
   3069 +	arm*-rebel)
   3070 +		os=-linux
   3071 +		;;
   3072 +	arm*-semi)
   3073 +		os=-aout
   3074 +		;;
   3075 +	c4x-* | tic4x-*)
   3076 +		os=-coff
   3077 +		;;
   3078 +	tic54x-*)
   3079 +		os=-coff
   3080 +		;;
   3081 +	tic55x-*)
   3082 +		os=-coff
   3083 +		;;
   3084 +	tic6x-*)
   3085 +		os=-coff
   3086 +		;;
   3087 +	# This must come before the *-dec entry.
   3088 +	pdp10-*)
   3089 +		os=-tops20
   3090 +		;;
   3091 +	pdp11-*)
   3092 +		os=-none
   3093 +		;;
   3094 +	*-dec | vax-*)
   3095 +		os=-ultrix4.2
   3096 +		;;
   3097 +	m68*-apollo)
   3098 +		os=-domain
   3099 +		;;
   3100 +	i386-sun)
   3101 +		os=-sunos4.0.2
   3102 +		;;
   3103 +	m68000-sun)
   3104 +		os=-sunos3
   3105 +		;;
   3106 +	m68*-cisco)
   3107 +		os=-aout
   3108 +		;;
   3109 +	mep-*)
   3110 +		os=-elf
   3111 +		;;
   3112 +	mips*-cisco)
   3113 +		os=-elf
   3114 +		;;
   3115 +	mips*-*)
   3116 +		os=-elf
   3117 +		;;
   3118 +	or32-*)
   3119 +		os=-coff
   3120 +		;;
   3121 +	*-tti)	# must be before sparc entry or we get the wrong os.
   3122 +		os=-sysv3
   3123 +		;;
   3124 +	sparc-* | *-sun)
   3125 +		os=-sunos4.1.1
   3126 +		;;
   3127 +	*-be)
   3128 +		os=-beos
   3129 +		;;
   3130 +	*-haiku)
   3131 +		os=-haiku
   3132 +		;;
   3133 +	*-ibm)
   3134 +		os=-aix
   3135 +		;;
   3136 +	*-knuth)
   3137 +		os=-mmixware
   3138 +		;;
   3139 +	*-wec)
   3140 +		os=-proelf
   3141 +		;;
   3142 +	*-winbond)
   3143 +		os=-proelf
   3144 +		;;
   3145 +	*-oki)
   3146 +		os=-proelf
   3147 +		;;
   3148 +	*-hp)
   3149 +		os=-hpux
   3150 +		;;
   3151 +	*-hitachi)
   3152 +		os=-hiux
   3153 +		;;
   3154 +	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
   3155 +		os=-sysv
   3156 +		;;
   3157 +	*-cbm)
   3158 +		os=-amigaos
   3159 +		;;
   3160 +	*-dg)
   3161 +		os=-dgux
   3162 +		;;
   3163 +	*-dolphin)
   3164 +		os=-sysv3
   3165 +		;;
   3166 +	m68k-ccur)
   3167 +		os=-rtu
   3168 +		;;
   3169 +	m88k-omron*)
   3170 +		os=-luna
   3171 +		;;
   3172 +	*-next )
   3173 +		os=-nextstep
   3174 +		;;
   3175 +	*-sequent)
   3176 +		os=-ptx
   3177 +		;;
   3178 +	*-crds)
   3179 +		os=-unos
   3180 +		;;
   3181 +	*-ns)
   3182 +		os=-genix
   3183 +		;;
   3184 +	i370-*)
   3185 +		os=-mvs
   3186 +		;;
   3187 +	*-next)
   3188 +		os=-nextstep3
   3189 +		;;
   3190 +	*-gould)
   3191 +		os=-sysv
   3192 +		;;
   3193 +	*-highlevel)
   3194 +		os=-bsd
   3195 +		;;
   3196 +	*-encore)
   3197 +		os=-bsd
   3198 +		;;
   3199 +	*-sgi)
   3200 +		os=-irix
   3201 +		;;
   3202 +	*-siemens)
   3203 +		os=-sysv4
   3204 +		;;
   3205 +	*-masscomp)
   3206 +		os=-rtu
   3207 +		;;
   3208 +	f30[01]-fujitsu | f700-fujitsu)
   3209 +		os=-uxpv
   3210 +		;;
   3211 +	*-rom68k)
   3212 +		os=-coff
   3213 +		;;
   3214 +	*-*bug)
   3215 +		os=-coff
   3216 +		;;
   3217 +	*-apple)
   3218 +		os=-macos
   3219 +		;;
   3220 +	*-atari*)
   3221 +		os=-mint
   3222 +		;;
   3223 +	*)
   3224 +		os=-none
   3225 +		;;
   3226 +esac
   3227 +fi
   3228 +
   3229 +# Here we handle the case where we know the os, and the CPU type, but not the
   3230 +# manufacturer.  We pick the logical manufacturer.
   3231 +vendor=unknown
   3232 +case $basic_machine in
   3233 +	*-unknown)
   3234 +		case $os in
   3235 +			-riscix*)
   3236 +				vendor=acorn
   3237 +				;;
   3238 +			-sunos*)
   3239 +				vendor=sun
   3240 +				;;
   3241 +			-cnk*|-aix*)
   3242 +				vendor=ibm
   3243 +				;;
   3244 +			-beos*)
   3245 +				vendor=be
   3246 +				;;
   3247 +			-hpux*)
   3248 +				vendor=hp
   3249 +				;;
   3250 +			-mpeix*)
   3251 +				vendor=hp
   3252 +				;;
   3253 +			-hiux*)
   3254 +				vendor=hitachi
   3255 +				;;
   3256 +			-unos*)
   3257 +				vendor=crds
   3258 +				;;
   3259 +			-dgux*)
   3260 +				vendor=dg
   3261 +				;;
   3262 +			-luna*)
   3263 +				vendor=omron
   3264 +				;;
   3265 +			-genix*)
   3266 +				vendor=ns
   3267 +				;;
   3268 +			-mvs* | -opened*)
   3269 +				vendor=ibm
   3270 +				;;
   3271 +			-os400*)
   3272 +				vendor=ibm
   3273 +				;;
   3274 +			-ptx*)
   3275 +				vendor=sequent
   3276 +				;;
   3277 +			-tpf*)
   3278 +				vendor=ibm
   3279 +				;;
   3280 +			-vxsim* | -vxworks* | -windiss*)
   3281 +				vendor=wrs
   3282 +				;;
   3283 +			-aux*)
   3284 +				vendor=apple
   3285 +				;;
   3286 +			-hms*)
   3287 +				vendor=hitachi
   3288 +				;;
   3289 +			-mpw* | -macos*)
   3290 +				vendor=apple
   3291 +				;;
   3292 +			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
   3293 +				vendor=atari
   3294 +				;;
   3295 +			-vos*)
   3296 +				vendor=stratus
   3297 +				;;
   3298 +		esac
   3299 +		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
   3300 +		;;
   3301 +esac
   3302 +
   3303 +echo $basic_machine$os
   3304 +exit
   3305 +
   3306 +# Local variables:
   3307 +# eval: (add-hook 'write-file-hooks 'time-stamp)
   3308 +# time-stamp-start: "timestamp='"
   3309 +# time-stamp-format: "%:y-%02m-%02d"
   3310 +# time-stamp-end: "'"
   3311 +# End:
   3312 diff -urN a/configure.in b/configure.in
   3313 --- a/configure.in	2012-04-10 00:07:36.000000000 +0100
   3314 +++ b/configure.in	2012-06-25 19:39:10.610815313 +0100
   3315 @@ -11,6 +11,7 @@
   3316  AC_INIT(python, PYTHON_VERSION, http://bugs.python.org/)
   3317  AC_CONFIG_SRCDIR([Include/object.h])
   3318  AC_CONFIG_HEADER(pyconfig.h)
   3319 +AC_CANONICAL_HOST
   3320  
   3321  dnl Ensure that if prefix is specified, it does not end in a slash. If
   3322  dnl it does, we get path names containing '//' which is both ugly and
   3323 @@ -42,6 +43,46 @@
   3324  rm confdefs.h
   3325  mv confdefs.h.new confdefs.h
   3326  
   3327 +dnl makefile conditional (for future use)
   3328 +if test "x$cross_compiling" = xyes; then
   3329 +  CROSS_ON=''
   3330 +  CROSS_OFF='#'
   3331 +else
   3332 +  CROSS_ON='#'
   3333 +  CROSS_OFF=''
   3334 +fi
   3335 +AC_SUBST(CROSS_ON)
   3336 +AC_SUBST(CROSS_OFF)
   3337 +
   3338 +AC_PROG_LN_S
   3339 +if test "x$cross_compiling" = xyes; then
   3340 +  AC_MSG_WARN([cross-compilation is incomplete])
   3341 +
   3342 +  dnl In cross-compilation environment we need python from
   3343 +  dnl the build system (for future use)
   3344 +  AC_PATH_PROG(SYSPYTHON, python, [none],
   3345 +    [$PATH:/usr/local/bin]
   3346 +  )
   3347 +  if test "x$SYSPYTHON" = xnone; then
   3348 +    AC_MSG_ERROR([python program is required in cross-compilation environment])
   3349 +  fi
   3350 +  SYSPYOSNAME=`${SYSPYTHON} -c "import os; print os.name"`
   3351 +  case $SYSPYOSNAME in
   3352 +  posix)
   3353 +    dnl On posix distutils read variables from installed makefile.
   3354 +    dnl We will do some hacks based on distutils internals to overcome
   3355 +    dnl this limitation:
   3356 +    dnl - we link system python in build directory so that it will
   3357 +    dnl   read generated file.
   3358 +    dnl As result from sysconfig.get_config_vars we will get our
   3359 +    dnl setting (for the host system) like SO, CFLAGS, CPPFLAGS,
   3360 +    dnl LDFLAGS instead those for the build system.
   3361 +    rm -f syspython
   3362 +    ${LN_S} ${SYSPYTHON} syspython
   3363 +    SYSPYTHON=./syspython
   3364 +  esac
   3365 +fi
   3366 +
   3367  AC_SUBST(VERSION)
   3368  VERSION=PYTHON_VERSION
   3369  
   3370 @@ -275,8 +316,35 @@
   3371  ##                           [Use (OpenStep|Rhapsody) dynamic linker]))
   3372  ##
   3373  # Set name for machine-dependent library files
   3374 +dnl Now configure script support cross-compilation and detection of host
   3375 +dnl system based on value of $ac_sys_system and/or $ac_sys_release
   3376 +dnl has to be avoided. It is superseded by "host triplet"(cpu-verdor-os).
   3377 +dnl FIXME: replace all cases based on $ac_sys_system and/or $ac_sys_release
   3378 +dnl with case based on $host ("host triplet") or $host_os.
   3379 +dnl Also cases with MACHDEP may be replaces by $host or $host_os. Note
   3380 +dnl script may not set this variable if cross compiling.
   3381 +
   3382 +dnl Next two variables are intended to be passed through makefile to other
   3383 +dnl scripts. As example setup.py check for CPU(machine) and OS(platform).
   3384 +HOST_CPU=$host_cpu
   3385 +AC_SUBST(HOST_CPU)
   3386 +HOST_OS=$host_os
   3387 +AC_SUBST(HOST_OS)
   3388 +
   3389  AC_SUBST(MACHDEP)
   3390 +if test "x$cross_compiling" = xyes; then
   3391 +AC_MSG_WARN([
   3392 +  May be value of MACHDEP isn't correct if cross-compiling.
   3393 +  You may tweak configure script for you host system: $host])
   3394 +fi
   3395  AC_MSG_CHECKING(MACHDEP)
   3396 +dnl Note that $host_os cann't be translated directly into python
   3397 +dnl specific $MACHDEP. As example on linux (kernel 2.x) the script below
   3398 +dnl will set MACHDEP to "linux2" but $host_os is only "linux".
   3399 +dnl Another point is in cross-compilation environment we cannot distinguish
   3400 +dnl linux with 1.x(if someone still use it) and 2.x host kernels.
   3401 +dnl As example setup.py check for linux2(get from sys.platform) and will
   3402 +dnl install some host plaform specific files into subdirectory "plat-linux2".
   3403  if test -z "$MACHDEP"
   3404  then
   3405  	ac_sys_system=`uname -s`
   3406 @@ -292,12 +360,19 @@
   3407  			   tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
   3408  	MACHDEP="$ac_md_system$ac_md_release"
   3409  
   3410 +	dnl override MACHDEP only on certain host systems
   3411 +	case $host in
   3412 +	*-*-cygwin*) MACHDEP="cygwin";;
   3413 +	*-*-darwin*) MACHDEP="darwin";;
   3414 +	*-*-atheos*) MACHDEP="atheos";;
   3415 +	esac
   3416 +
   3417  	case $MACHDEP in
   3418  	linux*) MACHDEP="linux2";;
   3419  	cygwin*) MACHDEP="cygwin";;
   3420  	darwin*) MACHDEP="darwin";;
   3421  	atheos*) MACHDEP="atheos";;
   3422 -        irix646) MACHDEP="irix6";;
   3423 +	irix646) MACHDEP="irix6";;
   3424  	'')	MACHDEP="unknown";;
   3425  	esac
   3426  fi
   3427 @@ -446,10 +521,6 @@
   3428  CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
   3429  EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
   3430  
   3431 -AC_MSG_CHECKING(machine type as reported by uname -m)
   3432 -ac_sys_machine=`uname -m`
   3433 -AC_MSG_RESULT($ac_sys_machine)
   3434 -
   3435  # checks for alternative programs
   3436  
   3437  # compiler flags are generated in two sets, BASECFLAGS and OPT.  OPT is just
   3438 @@ -575,6 +646,13 @@
   3439  AC_USE_SYSTEM_EXTENSIONS
   3440  
   3441  # Check for unsupported systems
   3442 +case $host in
   3443 +  *-*-beos*)
   3444 +    AC_MSG_WARN([
   3445 +  Support for BeOS is deprecated as of Python 2.6.
   3446 +  See PEP 11 for the gory details.
   3447 +  ]);;
   3448 +esac
   3449  case $ac_sys_system/$ac_sys_release in
   3450  atheos*|Linux*/1*)
   3451     echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported.
   3452 @@ -728,22 +806,23 @@
   3453  
   3454  AC_MSG_CHECKING(for --enable-profiling)
   3455  AC_ARG_ENABLE(profiling,
   3456 -              AS_HELP_STRING([--enable-profiling], [enable C-level code profiling]),
   3457 -[ac_save_cc="$CC"
   3458 - CC="$CC -pg"
   3459 - AC_RUN_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
   3460 -   [ac_enable_profiling="yes"],
   3461 -   [ac_enable_profiling="no"],
   3462 -   [ac_enable_profiling="no"])
   3463 - CC="$ac_save_cc"])
   3464 -AC_MSG_RESULT($ac_enable_profiling)
   3465 -
   3466 -case "$ac_enable_profiling" in
   3467 -    "yes")
   3468 -	BASECFLAGS="-pg $BASECFLAGS"
   3469 -	LDFLAGS="-pg $LDFLAGS"
   3470 -    ;;
   3471 -esac
   3472 +              AS_HELP_STRING([--enable-profiling], [enable C-level code profiling]))
   3473 +if test "x$enable_profiling" = xyes; then
   3474 +  py_save_CFLAGS="$CFLAGS"
   3475 +  CFLAGS="$CFLAGS -pg"
   3476 +  AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])],
   3477 +    [],
   3478 +    [enable_profiling=no])
   3479 +  CFLAGS="$py_save_CFLAGS"
   3480 +else
   3481 +  enable_profiling=no
   3482 +fi
   3483 +AC_MSG_RESULT($enable_profiling)
   3484 +
   3485 +if test "x$enable_profiling" = xyes; then
   3486 +  BASECFLAGS="-pg $BASECFLAGS"
   3487 +  LDFLAGS="-pg $LDFLAGS"
   3488 +fi
   3489  
   3490  AC_MSG_CHECKING(LDLIBRARY)
   3491  
   3492 @@ -835,8 +914,7 @@
   3493  AC_MSG_RESULT($LDLIBRARY)
   3494  
   3495  AC_PROG_RANLIB
   3496 -AC_SUBST(AR)
   3497 -AC_CHECK_PROGS(AR, ar aal, ar)
   3498 +AC_CHECK_TOOLS(AR, ar aal, ar)
   3499  
   3500  # tweak ARFLAGS only if the user didn't set it on the command line
   3501  AC_SUBST(ARFLAGS)
   3502 @@ -995,7 +1073,7 @@
   3503      # if using gcc on alpha, use -mieee to get (near) full IEEE 754
   3504      # support.  Without this, treatment of subnormals doesn't follow
   3505      # the standard.
   3506 -    case $ac_sys_machine in
   3507 +    case $host in
   3508           alpha*)
   3509                  BASECFLAGS="$BASECFLAGS -mieee"
   3510                  ;;
   3511 @@ -2717,7 +2795,11 @@
   3512  else
   3513  	MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs"
   3514  fi
   3515 -AC_MSG_RESULT(MACHDEP_OBJS)
   3516 +if test -z "$MACHDEP_OBJS"; then
   3517 +  AC_MSG_RESULT([none])
   3518 +else
   3519 +  AC_MSG_RESULT([$MACHDEP_OBJS])
   3520 +fi
   3521  
   3522  # checks for library functions
   3523  AC_CHECK_FUNCS(alarm setitimer getitimer bind_textdomain_codeset chown \
   3524 @@ -3139,7 +3221,7 @@
   3525  
   3526  AC_MSG_RESULT($ac_cv_buggy_getaddrinfo)
   3527  
   3528 -if test $have_getaddrinfo = no -o "$ac_cv_buggy_getaddrinfo" = yes
   3529 +if test $have_getaddrinfo = no || test "$ac_cv_buggy_getaddrinfo" = yes
   3530  then
   3531  	if test $ipv6 = yes
   3532  	then
   3533 @@ -3648,6 +3730,7 @@
   3534  fi
   3535  
   3536  # Multiprocessing check for broken sem_getvalue
   3537 +if test $ac_cv_func_sem_getvalue = yes; then
   3538  AC_MSG_CHECKING(for broken sem_getvalue)
   3539  AC_CACHE_VAL(ac_cv_broken_sem_getvalue,
   3540  AC_RUN_IFELSE([AC_LANG_SOURCE([[
   3541 @@ -3682,6 +3765,7 @@
   3542    AC_DEFINE(HAVE_BROKEN_SEM_GETVALUE, 1,
   3543    [define to 1 if your sem_getvalue is broken.])
   3544  fi
   3545 +fi
   3546  
   3547  # determine what size digit to use for Python's longs
   3548  AC_MSG_CHECKING([digit size for Python's longs])
   3549 @@ -3865,7 +3949,7 @@
   3550  # with setup.py.
   3551  py_cv_lib_readline=no
   3552  AC_MSG_CHECKING([how to link readline libs])
   3553 -for py_libtermcap in "" ncursesw ncurses curses termcap; do
   3554 +for py_libtermcap in "" tinfo ncursesw ncurses curses termcap; do
   3555    if test -z "$py_libtermcap"; then
   3556      READLINE_LIBS="-lreadline"
   3557    else
   3558 @@ -3878,9 +3962,9 @@
   3559    if test $py_cv_lib_readline = yes; then
   3560      break
   3561    fi
   3562 +  READLINE_LIBS=
   3563  done
   3564 -# Uncomment this line if you want to use READINE_LIBS in Makefile or scripts
   3565 -#AC_SUBST([READLINE_LIBS])
   3566 +AC_SUBST([READLINE_LIBS])
   3567  if test $py_cv_lib_readline = no; then
   3568    AC_MSG_RESULT([none])
   3569  else
   3570 @@ -4163,26 +4247,34 @@
   3571    [AC_MSG_RESULT(no)]
   3572  )
   3573  
   3574 -AC_MSG_CHECKING(for /dev/ptmx)
   3575 +AC_MSG_NOTICE([checking for device files])
   3576  
   3577 -if test -r /dev/ptmx
   3578 -then
   3579 -  AC_MSG_RESULT(yes)
   3580 -  AC_DEFINE(HAVE_DEV_PTMX, 1,
   3581 -  [Define if we have /dev/ptmx.])
   3582 -else
   3583 -  AC_MSG_RESULT(no)
   3584 +dnl NOTE: Inform user how to proceed with files when cross compiling.
   3585 +if test "x$cross_compiling" = xyes; then
   3586 +  if test "${ac_cv_file__dev_ptmx+set}" != set; then
   3587 +    AC_MSG_CHECKING([for /dev/ptmx])
   3588 +    AC_MSG_RESULT([not set])
   3589 +    AC_MSG_ERROR([set ac_cv_file__dev_ptmx to yes/no in your CONFIG_SITE file when cross compiling])
   3590 +  fi
   3591 +  if test "${ac_cv_file__dev_ptc+set}" != set; then
   3592 +    AC_MSG_CHECKING([for /dev/ptc])
   3593 +    AC_MSG_RESULT([not set])
   3594 +    AC_MSG_ERROR([set ac_cv_file__dev_ptc to yes/no in your CONFIG_SITE file when cross compiling])
   3595 +  fi
   3596  fi
   3597  
   3598 -AC_MSG_CHECKING(for /dev/ptc)
   3599 -
   3600 -if test -r /dev/ptc
   3601 -then
   3602 -  AC_MSG_RESULT(yes)
   3603 +# FIXME: autoconf macro AC_CHECK_FILES is better but require additional
   3604 +# changes in posixmodule.c : 's/HAVE_DEV_/HAVE__DEV_/g'
   3605 +# To keep patch minimal I left defines as before.
   3606 +AC_CHECK_FILE(/dev/ptmx, [], [])
   3607 +if test "x$ac_cv_file__dev_ptmx" = xyes; then
   3608 +  AC_DEFINE(HAVE_DEV_PTMX, 1,
   3609 +  [Define to 1 if you have the /dev/ptmx device file.])
   3610 +fi
   3611 +AC_CHECK_FILE(/dev/ptc, [], [])
   3612 +if test "x$ac_cv_file__dev_ptc" = xyes; then
   3613    AC_DEFINE(HAVE_DEV_PTC, 1,
   3614 -  [Define if we have /dev/ptc.])
   3615 -else
   3616 -  AC_MSG_RESULT(no)
   3617 +  [Define to 1 if you have the /dev/ptc device file.])
   3618  fi
   3619  
   3620  if test "$have_long_long" = yes
   3621 @@ -4320,36 +4412,28 @@
   3622  AC_MSG_RESULT(done)
   3623  
   3624  # generate output files
   3625 -AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc)
   3626 -AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix])
   3627 -AC_OUTPUT
   3628 +AC_CONFIG_COMMANDS_PRE([
   3629 +AC_MSG_NOTICE([creating Modules/Setup])
   3630  
   3631 -echo "creating Modules/Setup"
   3632  if test ! -f Modules/Setup
   3633  then
   3634  	cp $srcdir/Modules/Setup.dist Modules/Setup
   3635  fi
   3636  
   3637 -echo "creating Modules/Setup.local"
   3638 +AC_MSG_NOTICE([creating Modules/Setup.local])
   3639  if test ! -f Modules/Setup.local
   3640  then
   3641  	echo "# Edit this file for local setup changes" >Modules/Setup.local
   3642 -fi
   3643 +fi])
   3644  
   3645 -echo "creating Makefile"
   3646 -$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
   3647 +AC_CONFIG_COMMANDS([Makefile],
   3648 +[$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \
   3649  			-s Modules Modules/Setup.config \
   3650  			Modules/Setup.local Modules/Setup
   3651  
   3652 -case $ac_sys_system in
   3653 -BeOS)
   3654 -        AC_MSG_WARN([
   3655 -
   3656 -  Support for BeOS is deprecated as of Python 2.6.
   3657 -  See PEP 11 for the gory details.
   3658 -  ])
   3659 -  ;;
   3660 -*) ;;
   3661 -esac
   3662  
   3663 -mv config.c Modules
   3664 +mv config.c Modules])
   3665 +AC_CONFIG_FILES([setup_info])
   3666 +AC_CONFIG_FILES([Makefile.pre Modules/Setup.config Misc/python.pc])
   3667 +AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix])
   3668 +AC_OUTPUT
   3669 diff -urN a/Lib/distutils/README b/Lib/distutils/README
   3670 --- a/Lib/distutils/README	2012-04-10 00:07:29.000000000 +0100
   3671 +++ b/Lib/distutils/README	2012-06-25 19:39:10.611815002 +0100
   3672 @@ -9,5 +9,10 @@
   3673      http://www.python.org/sigs/distutils-sig/
   3674  
   3675  WARNING : Distutils must remain compatible with 2.3
   3676 +NOTE: After "Revision 77704 : taking sysconfig out of distutils"
   3677 +Distutils package is not compatible with versions before 2.7a3.
   3678 +Although "Revision 77759 : reintroduced the names in Distutils for APIs
   3679 +that were relocated"(i.e. API is backward compatibile) to cross compile
   3680 +python on build system has to be at least version 2.7a3.
   3681  
   3682  $Id$
   3683 diff -urN a/Lib/sysconfig.py b/Lib/sysconfig.py
   3684 --- a/Lib/sysconfig.py	2012-04-10 00:07:31.000000000 +0100
   3685 +++ b/Lib/sysconfig.py	2012-06-25 19:39:10.611815002 +0100
   3686 @@ -3,7 +3,15 @@
   3687  """
   3688  import sys
   3689  import os
   3690 -from os.path import pardir, realpath
   3691 +# revert patch from issue 7880 :
   3692 +#  - the test case (from issue 7880) works for me
   3693 +#  - realpath break cross compilation
   3694 +# => so lets use abspath again ;)
   3695 +# NOTE "Issue #6612: Fix site and sysconfig to catch os.getcwd() error,
   3696 +# eg. if the current directory was deleted." replase all occurrence of
   3697 +# realpath with _safe_realpath. Instead to update _safe_realpath to use
   3698 +# abspath the cross-compilation revert all!
   3699 +from os.path import pardir, abspath
   3700  
   3701  _INSTALL_SCHEMES = {
   3702      'posix_prefix': {
   3703 @@ -94,27 +102,21 @@
   3704  _CONFIG_VARS = None
   3705  _USER_BASE = None
   3706  
   3707 -def _safe_realpath(path):
   3708 -    try:
   3709 -        return realpath(path)
   3710 -    except OSError:
   3711 -        return path
   3712 -
   3713  if sys.executable:
   3714 -    _PROJECT_BASE = os.path.dirname(_safe_realpath(sys.executable))
   3715 +    _PROJECT_BASE = os.path.dirname(abspath(sys.executable))
   3716  else:
   3717      # sys.executable can be empty if argv[0] has been changed and Python is
   3718      # unable to retrieve the real program name
   3719 -    _PROJECT_BASE = _safe_realpath(os.getcwd())
   3720 +    _PROJECT_BASE = abspath(os.getcwd())
   3721  
   3722  if os.name == "nt" and "pcbuild" in _PROJECT_BASE[-8:].lower():
   3723 -    _PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir))
   3724 +    _PROJECT_BASE = abspath(os.path.join(_PROJECT_BASE, pardir))
   3725  # PC/VS7.1
   3726  if os.name == "nt" and "\\pc\\v" in _PROJECT_BASE[-10:].lower():
   3727 -    _PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir, pardir))
   3728 +    _PROJECT_BASE = abspath(os.path.join(_PROJECT_BASE, pardir, pardir))
   3729  # PC/AMD64
   3730  if os.name == "nt" and "\\pcbuild\\amd64" in _PROJECT_BASE[-14:].lower():
   3731 -    _PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir, pardir))
   3732 +    _PROJECT_BASE = abspath(os.path.join(_PROJECT_BASE, pardir, pardir))
   3733  
   3734  def is_python_build():
   3735      for fn in ("Setup.dist", "Setup.local"):
   3736 @@ -313,7 +315,7 @@
   3737      vars['SO'] = '.pyd'
   3738      vars['EXE'] = '.exe'
   3739      vars['VERSION'] = _PY_VERSION_SHORT_NO_DOT
   3740 -    vars['BINDIR'] = os.path.dirname(_safe_realpath(sys.executable))
   3741 +    vars['BINDIR'] = os.path.dirname(abspath(sys.executable))
   3742  
   3743  #
   3744  # public APIs
   3745 diff -urN a/Makefile.pre.in b/Makefile.pre.in
   3746 --- a/Makefile.pre.in	2012-04-10 00:07:33.000000000 +0100
   3747 +++ b/Makefile.pre.in	2012-06-25 19:39:10.612814691 +0100
   3748 @@ -187,6 +187,10 @@
   3749  PROFILE_TASK=	$(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
   3750  #PROFILE_TASK=	$(srcdir)/Lib/test/regrtest.py
   3751  
   3752 +# Don't define HOST_OS as makefile macro !
   3753 +@CROSS_ON@RUNPYTHON=	HOST_OS=@HOST_OS@ @SYSPYTHON@
   3754 +@CROSS_OFF@RUNPYTHON=	$(RUNSHARED) ./$(BUILDPYTHON)
   3755 +
   3756  # === Definitions added by makesetup ===
   3757  
   3758  
   3759 @@ -402,14 +406,14 @@
   3760  			$(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
   3761  
   3762  platform: $(BUILDPYTHON)
   3763 -	$(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from sysconfig import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
   3764 +	$(RUNPYTHON) -E -c 'import sys ; from sysconfig import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform
   3765  
   3766  
   3767  # Build the shared modules
   3768  sharedmods: $(BUILDPYTHON)
   3769  	@case $$MAKEFLAGS in \
   3770 -	*s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
   3771 -	*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
   3772 +	*s*) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(RUNPYTHON) -E $(srcdir)/setup.py -q build;; \
   3773 +	*) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(RUNPYTHON) -E $(srcdir)/setup.py build;; \
   3774  	esac
   3775  
   3776  # Build static library
   3777 @@ -426,10 +430,10 @@
   3778  
   3779  libpython$(VERSION).so: $(LIBRARY_OBJS)
   3780  	if test $(INSTSONAME) != $(LDLIBRARY); then \
   3781 -		$(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
   3782 +		$(LDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
   3783  		$(LN) -f $(INSTSONAME) $@; \
   3784  	else \
   3785 -		$(BLDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
   3786 +		$(LDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
   3787  	fi
   3788  
   3789  libpython$(VERSION).dylib: $(LIBRARY_OBJS)
   3790 @@ -485,18 +489,17 @@
   3791  oldsharedmods: $(SHAREDMODS)
   3792  
   3793  
   3794 +setup_info: setup_info.in config.status
   3795 +	$(SHELL) ./config.status $@
   3796 +
   3797 +
   3798  Makefile Modules/config.c: Makefile.pre \
   3799  				$(srcdir)/Modules/config.c.in \
   3800  				$(MAKESETUP) \
   3801  				Modules/Setup.config \
   3802  				Modules/Setup \
   3803  				Modules/Setup.local
   3804 -	$(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \
   3805 -				-s Modules \
   3806 -				Modules/Setup.config \
   3807 -				Modules/Setup.local \
   3808 -				Modules/Setup
   3809 -	@mv config.c Modules
   3810 +	$(SHELL) ./config.status Makefile
   3811  	@echo "The Makefile was updated, you may need to re-run make."
   3812  
   3813  
   3814 @@ -539,6 +542,7 @@
   3815  	$(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
   3816  
   3817  
   3818 +# FIXME: next may fail in cross-compilation environment
   3819  # Use a stamp file to prevent make -j invoking pgen twice
   3820  $(GRAMMAR_H) $(GRAMMAR_C): Parser/pgen.stamp
   3821  Parser/pgen.stamp: $(PGEN) $(GRAMMAR_INPUT)
   3822 @@ -708,6 +712,7 @@
   3823  
   3824  TESTOPTS=	-l $(EXTRATESTOPTS)
   3825  TESTPROG=	$(srcdir)/Lib/test/regrtest.py
   3826 +# FIXME: next test may fail in cross-compilation environment
   3827  TESTPYTHON=	$(RUNSHARED) ./$(BUILDPYTHON) -Wd -3 -E -tt $(TESTPYTHONOPTS)
   3828  test:		all platform
   3829  		-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f
   3830 @@ -938,26 +943,26 @@
   3831  		$(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
   3832  			$(DESTDIR)$(LIBDEST)/distutils/tests ; \
   3833  	fi
   3834 -	PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
   3835 -		./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
   3836 +	PYTHONPATH=$(DESTDIR)$(LIBDEST) \
   3837 +		$(RUNPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
   3838  		-d $(LIBDEST) -f \
   3839  		-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
   3840  		$(DESTDIR)$(LIBDEST)
   3841 -	PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
   3842 -		./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
   3843 +	PYTHONPATH=$(DESTDIR)$(LIBDEST) \
   3844 +		$(RUNPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
   3845  		-d $(LIBDEST) -f \
   3846  		-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
   3847  		$(DESTDIR)$(LIBDEST)
   3848 -	-PYTHONPATH=$(DESTDIR)$(LIBDEST)  $(RUNSHARED) \
   3849 -		./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
   3850 +	-PYTHONPATH=$(DESTDIR)$(LIBDEST) \
   3851 +		$(RUNPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
   3852  		-d $(LIBDEST)/site-packages -f \
   3853  		-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
   3854 -	-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
   3855 -		./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
   3856 +	-PYTHONPATH=$(DESTDIR)$(LIBDEST) \
   3857 +		$(RUNPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
   3858  		-d $(LIBDEST)/site-packages -f \
   3859  		-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
   3860 -	-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
   3861 -		./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
   3862 +	-PYTHONPATH=$(DESTDIR)$(LIBDEST) \
   3863 +		$(RUNPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"
   3864  
   3865  # Create the PLATDIR source directory, if one wasn't distributed..
   3866  $(srcdir)/Lib/$(PLATDIR):
   3867 @@ -1062,7 +1067,7 @@
   3868  # Install the dynamically loadable modules
   3869  # This goes into $(exec_prefix)
   3870  sharedinstall: sharedmods
   3871 -	$(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
   3872 +	$(RUNPYTHON) -E $(srcdir)/setup.py install \
   3873  	   	--prefix=$(prefix) \
   3874  		--install-scripts=$(BINDIR) \
   3875  		--install-platlib=$(DESTSHARED) \
   3876 @@ -1100,7 +1105,7 @@
   3877  		fi; \
   3878  	done
   3879  	$(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers
   3880 -	sed 's/%VERSION%/'"`$(RUNSHARED) ./$(BUILDPYTHON) -c 'import platform; print platform.python_version()'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(prefix)/Resources/Info.plist
   3881 +	sed 's/%VERSION%/'"`$(RUNPYTHON) -c 'import platform; print platform.python_version()'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(prefix)/Resources/Info.plist
   3882  	$(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current
   3883  	$(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/$(PYTHONFRAMEWORK)
   3884  	$(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers
   3885 @@ -1134,20 +1139,19 @@
   3886  
   3887  # This installs a few of the useful scripts in Tools/scripts
   3888  scriptsinstall:
   3889 -	SRCDIR=$(srcdir) $(RUNSHARED) \
   3890 -	./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \
   3891 +	SRCDIR=$(srcdir) \
   3892 +	$(RUNPYTHON) $(srcdir)/Tools/scripts/setup.py install \
   3893  	--prefix=$(prefix) \
   3894  	--install-scripts=$(BINDIR) \
   3895  	--root=$(DESTDIR)/
   3896  
   3897  # Build the toplevel Makefile
   3898  Makefile.pre: Makefile.pre.in config.status
   3899 -	CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status
   3900 -	$(MAKE) -f Makefile.pre Makefile
   3901 +	$(SHELL) ./config.status $@
   3902  
   3903  # Run the configure script.
   3904  config.status:	$(srcdir)/configure
   3905 -	$(SHELL) $(srcdir)/configure $(CONFIG_ARGS)
   3906 +	$(SHELL) ./config.status --recheck
   3907  
   3908  .PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
   3909  
   3910 @@ -1162,8 +1166,8 @@
   3911  # Rerun configure with the same options as it was run last time,
   3912  # provided the config.status script exists
   3913  recheck:
   3914 -	$(SHELL) config.status --recheck
   3915 -	$(SHELL) config.status
   3916 +	$(SHELL) ./config.status --recheck
   3917 +	$(SHELL) ./config.status
   3918  
   3919  # Rebuild the configure script from configure.in; also rebuild pyconfig.h.in
   3920  autoconf:
   3921 @@ -1260,7 +1264,7 @@
   3922  
   3923  # Perform some verification checks on any modified files.
   3924  patchcheck:
   3925 -	$(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
   3926 +	$(RUNPYTHON) $(srcdir)/Tools/scripts/patchcheck.py
   3927  
   3928  # Dependencies
   3929  
   3930 diff -urN a/pyconfig.h.in b/pyconfig.h.in
   3931 --- a/pyconfig.h.in	2012-04-10 00:07:36.000000000 +0100
   3932 +++ b/pyconfig.h.in	2012-06-25 19:39:10.612814691 +0100
   3933 @@ -161,10 +161,10 @@
   3934  /* Define to 1 if you have the device macros. */
   3935  #undef HAVE_DEVICE_MACROS
   3936  
   3937 -/* Define if we have /dev/ptc. */
   3938 +/* Define to 1 if you have the /dev/ptc device file. */
   3939  #undef HAVE_DEV_PTC
   3940  
   3941 -/* Define if we have /dev/ptmx. */
   3942 +/* Define to 1 if you have the /dev/ptmx device file. */
   3943  #undef HAVE_DEV_PTMX
   3944  
   3945  /* Define to 1 if you have the <direct.h> header file. */
   3946 diff -urN a/setup_info.in b/setup_info.in
   3947 --- a/setup_info.in	1970-01-01 01:00:00.000000000 +0100
   3948 +++ b/setup_info.in	2012-06-25 19:39:10.612814691 +0100
   3949 @@ -0,0 +1,3 @@
   3950 +# file with data from configure file
   3951 +
   3952 +READLINE_LIBS=@READLINE_LIBS@
   3953 diff -urN a/setup.py b/setup.py
   3954 --- a/setup.py	2012-04-10 00:07:36.000000000 +0100
   3955 +++ b/setup.py	2012-06-25 19:42:29.000000000 +0100
   3956 @@ -17,6 +17,22 @@
   3957  from distutils.command.install_lib import install_lib
   3958  from distutils.spawn import find_executable
   3959  
   3960 +
   3961 +def _get_platform():
   3962 +    # Get value of host platform (set only if cross-compile)
   3963 +    # otherwise value of sys.platform
   3964 +    host_platform = os.environ.get('HOST_OS')
   3965 +    if host_platform is None:
   3966 +        host_platform = sys.platform
   3967 +    for platform in ['cygwin', 'beos', 'darwin', 'atheos', 'osf1']:
   3968 +        if host_platform.startswith(platform):
   3969 +            return platform
   3970 +    return host_platform
   3971 +
   3972 +host_platform = _get_platform()
   3973 +cross_compiling = (not os.environ.get('HOST_OS') is None)
   3974 +
   3975 +
   3976  # Were we compiled --with-pydebug or with #define Py_DEBUG?
   3977  COMPILED_WITH_PYDEBUG = hasattr(sys, 'gettotalrefcount')
   3978  
   3979 @@ -60,7 +76,7 @@
   3980      'paths' is a list of additional locations to check; if the file is
   3981          found in one of them, the resulting list will contain the directory.
   3982      """
   3983 -    if sys.platform == 'darwin':
   3984 +    if host_platform == 'darwin':
   3985          # Honor the MacOSX SDK setting when one was specified.
   3986          # An SDK is a directory with the same structure as a real
   3987          # system, but with only header files and libraries.
   3988 @@ -70,7 +86,7 @@
   3989      for dir in std_dirs:
   3990          f = os.path.join(dir, filename)
   3991  
   3992 -        if sys.platform == 'darwin' and is_macosx_sdk_path(dir):
   3993 +        if host_platform == 'darwin' and is_macosx_sdk_path(dir):
   3994              f = os.path.join(sysroot, dir[1:], filename)
   3995  
   3996          if os.path.exists(f): return []
   3997 @@ -79,7 +95,7 @@
   3998      for dir in paths:
   3999          f = os.path.join(dir, filename)
   4000  
   4001 -        if sys.platform == 'darwin' and is_macosx_sdk_path(dir):
   4002 +        if host_platform == 'darwin' and is_macosx_sdk_path(dir):
   4003              f = os.path.join(sysroot, dir[1:], filename)
   4004  
   4005          if os.path.exists(f):
   4006 @@ -93,7 +109,7 @@
   4007      if result is None:
   4008          return None
   4009  
   4010 -    if sys.platform == 'darwin':
   4011 +    if host_platform == 'darwin':
   4012          sysroot = macosx_sdk_root()
   4013  
   4014      # Check whether the found file is in one of the standard directories
   4015 @@ -102,7 +118,7 @@
   4016          # Ensure path doesn't end with path separator
   4017          p = p.rstrip(os.sep)
   4018  
   4019 -        if sys.platform == 'darwin' and is_macosx_sdk_path(p):
   4020 +        if host_platform == 'darwin' and is_macosx_sdk_path(p):
   4021              if os.path.join(sysroot, p[1:]) == dirname:
   4022                  return [ ]
   4023  
   4024 @@ -115,7 +131,7 @@
   4025          # Ensure path doesn't end with path separator
   4026          p = p.rstrip(os.sep)
   4027  
   4028 -        if sys.platform == 'darwin' and is_macosx_sdk_path(p):
   4029 +        if host_platform == 'darwin' and is_macosx_sdk_path(p):
   4030              if os.path.join(sysroot, p[1:]) == dirname:
   4031                  return [ p ]
   4032  
   4033 @@ -172,8 +188,7 @@
   4034  
   4035          # Platform-dependent module source and include directories
   4036          incdirlist = []
   4037 -        platform = self.get_platform()
   4038 -        if platform == 'darwin' and ("--disable-toolbox-glue" not in
   4039 +        if host_platform == 'darwin' and ("--disable-toolbox-glue" not in
   4040              sysconfig.get_config_var("CONFIG_ARGS")):
   4041              # Mac OS X also includes some mac-specific modules
   4042              macmoddir = os.path.join(srcdir, 'Mac/Modules')
   4043 @@ -286,7 +301,7 @@
   4044                  ext.name)
   4045              return
   4046  
   4047 -        if self.get_platform() == 'darwin' and (
   4048 +        if host_platform == 'darwin' and (
   4049                  sys.maxint > 2**32 and '-arch' in ext.extra_link_args):
   4050              # Don't bother doing an import check when an extension was
   4051              # build with an explicit '-arch' flag on OSX. That's currently
   4052 @@ -300,10 +315,14 @@
   4053  
   4054          # Workaround for Cygwin: Cygwin currently has fork issues when many
   4055          # modules have been imported
   4056 -        if self.get_platform() == 'cygwin':
   4057 +        if host_platform == 'cygwin':
   4058              self.announce('WARNING: skipping import check for Cygwin-based "%s"'
   4059                  % ext.name)
   4060              return
   4061 +        if cross_compiling:
   4062 +            self.announce('WARNING: skipping import check for cross-compiled "%s"'
   4063 +                % ext.name)
   4064 +            return
   4065          ext_filename = os.path.join(
   4066              self.build_lib,
   4067              self.get_ext_filename(self.get_ext_fullname(ext.name)))
   4068 @@ -338,13 +357,6 @@
   4069                            level=3)
   4070              self.failed.append(ext.name)
   4071  
   4072 -    def get_platform(self):
   4073 -        # Get value of sys.platform
   4074 -        for platform in ['cygwin', 'beos', 'darwin', 'atheos', 'osf1']:
   4075 -            if sys.platform.startswith(platform):
   4076 -                return platform
   4077 -        return sys.platform
   4078 -
   4079      def add_multiarch_paths(self):
   4080          # Debian/Ubuntu multiarch support.
   4081          # https://wiki.ubuntu.com/MultiarchSpec
   4082 @@ -368,9 +380,13 @@
   4083              os.unlink(tmpfile)
   4084  
   4085      def detect_modules(self):
   4086 -        # Ensure that /usr/local is always used
   4087 -        add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
   4088 -        add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
   4089 +        pyconfig_h_data = open('pyconfig.h').read()
   4090 +        setup_info_data = open('setup_info').read()
   4091 +
   4092 +        if not cross_compiling:
   4093 +            # Ensure that /usr/local is always used
   4094 +            add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
   4095 +            add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
   4096          self.add_multiarch_paths()
   4097  
   4098          # Add paths specified in the environment variables LDFLAGS and
   4099 @@ -379,6 +395,9 @@
   4100          # directly since an inconsistently reproducible issue comes up where
   4101          # the environment variable is not set even though the value were passed
   4102          # into configure and stored in the Makefile (issue found on OS X 10.3).
   4103 +        # NOTE: In cross-compilation environment python for build system
   4104 +        # is linked in top build directory under name syspython to get
   4105 +        # above to work (distutils hack).
   4106          for env_var, arg_name, dir_list in (
   4107                  ('LDFLAGS', '-R', self.compiler.runtime_library_dirs),
   4108                  ('LDFLAGS', '-L', self.compiler.library_dirs),
   4109 @@ -423,35 +442,37 @@
   4110          except NameError:
   4111              have_unicode = 0
   4112  
   4113 -        # lib_dirs and inc_dirs are used to search for files;
   4114 -        # if a file is found in one of those directories, it can
   4115 -        # be assumed that no additional -I,-L directives are needed.
   4116 -        lib_dirs = self.compiler.library_dirs + [
   4117 -            '/lib64', '/usr/lib64',
   4118 -            '/lib', '/usr/lib',
   4119 -            ]
   4120 -        inc_dirs = self.compiler.include_dirs + ['/usr/include']
   4121 +        lib_dirs = self.compiler.library_dirs
   4122 +        inc_dirs = self.compiler.include_dirs
   4123 +        if not cross_compiling:
   4124 +            # lib_dirs and inc_dirs are used to search for files;
   4125 +            # if a file is found in one of those directories, it can
   4126 +            # be assumed that no additional -I,-L directives are needed.
   4127 +            lib_dirs += [
   4128 +                '/lib64', '/usr/lib64',
   4129 +                '/lib', '/usr/lib',
   4130 +                ]
   4131 +            inc_dirs += ['/usr/include']
   4132          exts = []
   4133          missing = []
   4134  
   4135          config_h = sysconfig.get_config_h_filename()
   4136          config_h_vars = sysconfig.parse_config_h(open(config_h))
   4137  
   4138 -        platform = self.get_platform()
   4139          srcdir = sysconfig.get_config_var('srcdir')
   4140  
   4141          # Check for AtheOS which has libraries in non-standard locations
   4142 -        if platform == 'atheos':
   4143 +        if host_platform == 'atheos':
   4144              lib_dirs += ['/system/libs', '/atheos/autolnk/lib']
   4145              lib_dirs += os.getenv('LIBRARY_PATH', '').split(os.pathsep)
   4146              inc_dirs += ['/system/include', '/atheos/autolnk/include']
   4147              inc_dirs += os.getenv('C_INCLUDE_PATH', '').split(os.pathsep)
   4148  
   4149          # OSF/1 and Unixware have some stuff in /usr/ccs/lib (like -ldb)
   4150 -        if platform in ['osf1', 'unixware7', 'openunix8']:
   4151 +        if host_platform in ['osf1', 'unixware7', 'openunix8']:
   4152              lib_dirs += ['/usr/ccs/lib']
   4153  
   4154 -        if platform == 'darwin':
   4155 +        if host_platform == 'darwin':
   4156              # This should work on any unixy platform ;-)
   4157              # If the user has bothered specifying additional -I and -L flags
   4158              # in OPT and LDFLAGS we might as well use them here.
   4159 @@ -470,7 +491,7 @@
   4160  
   4161          # Check for MacOS X, which doesn't need libm.a at all
   4162          math_libs = ['m']
   4163 -        if platform in ['darwin', 'beos']:
   4164 +        if host_platform in ['darwin', 'beos']:
   4165              math_libs = []
   4166  
   4167          # XXX Omitted modules: gl, pure, dl, SGI-specific modules
   4168 @@ -536,13 +557,12 @@
   4169          else:
   4170              missing.append('unicodedata')
   4171          # access to ISO C locale support
   4172 -        data = open('pyconfig.h').read()
   4173 -        m = re.search(r"#s*define\s+WITH_LIBINTL\s+1\s*", data)
   4174 +        m = re.search(r"#s*define\s+WITH_LIBINTL\s+1\s*", pyconfig_h_data)
   4175          if m is not None:
   4176              locale_libs = ['intl']
   4177          else:
   4178              locale_libs = []
   4179 -        if platform == 'darwin':
   4180 +        if host_platform == 'darwin':
   4181              locale_extra_link_args = ['-framework', 'CoreFoundation']
   4182          else:
   4183              locale_extra_link_args = []
   4184 @@ -584,7 +604,7 @@
   4185          exts.append( Extension('cPickle', ['cPickle.c']) )
   4186  
   4187          # Memory-mapped files (also works on Win32).
   4188 -        if platform not in ['atheos']:
   4189 +        if host_platform not in ['atheos']:
   4190              exts.append( Extension('mmap', ['mmapmodule.c']) )
   4191          else:
   4192              missing.append('mmap')
   4193 @@ -620,12 +640,32 @@
   4194              missing.extend(['imageop'])
   4195  
   4196          # readline
   4197 -        do_readline = self.compiler.find_library_file(lib_dirs, 'readline')
   4198 +        do_readline = re.search(r"#s*define\s+HAVE_LIBREADLINE\s+1\s*", pyconfig_h_data)
   4199 +
   4200          readline_termcap_library = ""
   4201          curses_library = ""
   4202 +
   4203          # Determine if readline is already linked against curses or tinfo.
   4204 -        if do_readline and find_executable('ldd'):
   4205 -            fp = os.popen("ldd %s" % do_readline)
   4206 +        # NOTE readline_termcap_library is flag used only if cannot determine readline libs
   4207 +        readline_conf = False
   4208 +        readline_conf_termcap = ""
   4209 +        if do_readline:
   4210 +            m = re.search(r"\s*READLINE_LIBS\s*=\s*(?P<rl>-l.*)", setup_info_data)
   4211 +            if m:
   4212 +                readline_conf = True
   4213 +                ln = m.group('rl')
   4214 +                if 'curses' in ln:
   4215 +                    readline_conf_termcap = re.sub(
   4216 +                        r'.*-l(n?cursesw?).*', r'\1', ln
   4217 +                    ).rstrip()
   4218 +                elif 'tinfo' in ln: # termcap interface split out from ncurses
   4219 +                    readline_conf_termcap = 'tinfo'
   4220 +                else: # may be readline is linked with termcap interface library
   4221 +                    readline_conf = False
   4222 +
   4223 +        if do_readline and not readline_conf and find_executable('ldd'):
   4224 +            rl_lib = self.compiler.find_library_file(lib_dirs, 'readline')
   4225 +            fp = os.popen("ldd %s" % rl_lib)
   4226              ldd_output = fp.readlines()
   4227              ret = fp.close()
   4228              if ret is None or ret >> 8 == 0:
   4229 @@ -640,7 +680,9 @@
   4230                          break
   4231          # Issue 7384: If readline is already linked against curses,
   4232          # use the same library for the readline and curses modules.
   4233 -        if 'curses' in readline_termcap_library:
   4234 +        if 'curses' in readline_conf_termcap:
   4235 +            curses_library = readline_conf_termcap
   4236 +        elif 'curses' in readline_termcap_library:
   4237              curses_library = readline_termcap_library
   4238          elif self.compiler.find_library_file(lib_dirs, 'ncursesw'):
   4239              curses_library = 'ncursesw'
   4240 @@ -649,7 +691,7 @@
   4241          elif self.compiler.find_library_file(lib_dirs, 'curses'):
   4242              curses_library = 'curses'
   4243  
   4244 -        if platform == 'darwin':
   4245 +        if host_platform == 'darwin':
   4246              os_release = int(os.uname()[2].split('.')[0])
   4247              dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
   4248              if dep_target and dep_target.split('.') < ['10', '5']:
   4249 @@ -661,7 +703,7 @@
   4250                  if find_file('readline/rlconf.h', inc_dirs, []) is None:
   4251                      do_readline = False
   4252          if do_readline:
   4253 -            if platform == 'darwin' and os_release < 9:
   4254 +            if host_platform == 'darwin' and os_release < 9:
   4255                  # In every directory on the search path search for a dynamic
   4256                  # library and then a static library, instead of first looking
   4257                  # for dynamic libraries on the entiry path.
   4258 @@ -739,7 +781,7 @@
   4259                  inc_dirs + search_for_ssl_incs_in)
   4260          if opensslv_h:
   4261              name = os.path.join(opensslv_h[0], 'openssl/opensslv.h')
   4262 -            if sys.platform == 'darwin' and is_macosx_sdk_path(name):
   4263 +            if host_platform == 'darwin' and is_macosx_sdk_path(name):
   4264                  name = os.path.join(macosx_sdk_root(), name[1:])
   4265              try:
   4266                  incfile = open(name, 'r')
   4267 @@ -883,7 +925,7 @@
   4268  
   4269          db_ver_inc_map = {}
   4270  
   4271 -        if sys.platform == 'darwin':
   4272 +        if host_platform == 'darwin':
   4273              sysroot = macosx_sdk_root()
   4274  
   4275          class db_found(Exception): pass
   4276 @@ -893,7 +935,7 @@
   4277              for d in inc_dirs + db_inc_paths:
   4278                  f = os.path.join(d, "db.h")
   4279  
   4280 -                if sys.platform == 'darwin' and is_macosx_sdk_path(d):
   4281 +                if host_platform == 'darwin' and is_macosx_sdk_path(d):
   4282                      f = os.path.join(sysroot, d[1:], "db.h")
   4283  
   4284                  if db_setup_debug: print "db: looking for db.h in", f
   4285 @@ -943,7 +985,7 @@
   4286                      db_incdir.replace("include", 'lib'),
   4287                  ]
   4288  
   4289 -                if sys.platform != 'darwin':
   4290 +                if host_platform != 'darwin':
   4291                      db_dirs_to_check = filter(os.path.isdir, db_dirs_to_check)
   4292  
   4293                  else:
   4294 @@ -1018,13 +1060,13 @@
   4295          # Scan the default include directories before the SQLite specific
   4296          # ones. This allows one to override the copy of sqlite on OSX,
   4297          # where /usr/include contains an old version of sqlite.
   4298 -        if sys.platform == 'darwin':
   4299 +        if host_platform == 'darwin':
   4300              sysroot = macosx_sdk_root()
   4301  
   4302          for d in inc_dirs + sqlite_inc_paths:
   4303              f = os.path.join(d, "sqlite3.h")
   4304  
   4305 -            if sys.platform == 'darwin' and is_macosx_sdk_path(d):
   4306 +            if host_platform == 'darwin' and is_macosx_sdk_path(d):
   4307                  f = os.path.join(sysroot, d[1:], "sqlite3.h")
   4308  
   4309              if os.path.exists(f):
   4310 @@ -1073,7 +1115,7 @@
   4311                  '_sqlite/util.c', ]
   4312  
   4313              sqlite_defines = []
   4314 -            if sys.platform != "win32":
   4315 +            if host_platform != "win32":
   4316                  sqlite_defines.append(('MODULE_NAME', '"sqlite3"'))
   4317              else:
   4318                  sqlite_defines.append(('MODULE_NAME', '\\"sqlite3\\"'))
   4319 @@ -1081,7 +1123,7 @@
   4320              # Comment this out if you want the sqlite3 module to be able to load extensions.
   4321              sqlite_defines.append(("SQLITE_OMIT_LOAD_EXTENSION", "1"))
   4322  
   4323 -            if sys.platform == 'darwin':
   4324 +            if host_platform == 'darwin':
   4325                  # In every directory on the search path search for a dynamic
   4326                  # library and then a static library, instead of first looking
   4327                  # for dynamic libraries on the entire path.
   4328 @@ -1115,7 +1157,7 @@
   4329          # when attempting to compile and it will fail.
   4330          f = "/usr/include/db.h"
   4331  
   4332 -        if sys.platform == 'darwin':
   4333 +        if host_platform == 'darwin':
   4334              if is_macosx_sdk_path(f):
   4335                  sysroot = macosx_sdk_root()
   4336                  f = os.path.join(sysroot, f[1:])
   4337 @@ -1128,7 +1170,7 @@
   4338                  ### XXX this should be fixed to not be platform-dependent
   4339                  ### but I don't have direct access to an osf1 platform and
   4340                  ### seemed to be muffing the search somehow
   4341 -                libraries = platform == "osf1" and ['db'] or None
   4342 +                libraries = host_platform == "osf1" and ['db'] or None
   4343                  if libraries is not None:
   4344                      exts.append(Extension('bsddb185', ['bsddbmodule.c'],
   4345                                            libraries=libraries))
   4346 @@ -1141,7 +1183,7 @@
   4347  
   4348          dbm_order = ['gdbm']
   4349          # The standard Unix dbm module:
   4350 -        if platform not in ['cygwin']:
   4351 +        if host_platform not in ['cygwin']:
   4352              config_args = [arg.strip("'")
   4353                             for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
   4354              dbm_args = [arg for arg in config_args
   4355 @@ -1219,17 +1261,17 @@
   4356              missing.append('gdbm')
   4357  
   4358          # Unix-only modules
   4359 -        if platform not in ['win32']:
   4360 +        if host_platform not in ['win32']:
   4361              # Steen Lumholt's termios module
   4362              exts.append( Extension('termios', ['termios.c']) )
   4363              # Jeremy Hylton's rlimit interface
   4364 -            if platform not in ['atheos']:
   4365 +            if host_platform not in ['atheos']:
   4366                  exts.append( Extension('resource', ['resource.c']) )
   4367              else:
   4368                  missing.append('resource')
   4369  
   4370              # Sun yellow pages. Some systems have the functions in libc.
   4371 -            if (platform not in ['cygwin', 'atheos', 'qnx6'] and
   4372 +            if (host_platform not in ['cygwin', 'atheos', 'qnx6'] and
   4373                  find_file('rpcsvc/yp_prot.h', inc_dirs, []) is not None):
   4374                  if (self.compiler.find_library_file(lib_dirs, 'nsl')):
   4375                      libs = ['nsl']
   4376 @@ -1253,7 +1295,7 @@
   4377              curses_libs = [curses_library]
   4378              exts.append( Extension('_curses', ['_cursesmodule.c'],
   4379                                     libraries = curses_libs) )
   4380 -        elif curses_library == 'curses' and platform != 'darwin':
   4381 +        elif curses_library == 'curses' and host_platform != 'darwin':
   4382                  # OSX has an old Berkeley curses, not good enough for
   4383                  # the _curses module.
   4384              if (self.compiler.find_library_file(lib_dirs, 'terminfo')):
   4385 @@ -1304,7 +1346,7 @@
   4386                      break
   4387              if version >= version_req:
   4388                  if (self.compiler.find_library_file(lib_dirs, 'z')):
   4389 -                    if sys.platform == "darwin":
   4390 +                    if host_platform == "darwin":
   4391                          zlib_extra_link_args = ('-Wl,-search_paths_first',)
   4392                      else:
   4393                          zlib_extra_link_args = ()
   4394 @@ -1336,7 +1378,7 @@
   4395  
   4396          # Gustavo Niemeyer's bz2 module.
   4397          if (self.compiler.find_library_file(lib_dirs, 'bz2')):
   4398 -            if sys.platform == "darwin":
   4399 +            if host_platform == "darwin":
   4400                  bz2_extra_link_args = ('-Wl,-search_paths_first',)
   4401              else:
   4402                  bz2_extra_link_args = ()
   4403 @@ -1409,7 +1451,7 @@
   4404          if sys.maxint == 0x7fffffff:
   4405              # This requires sizeof(int) == sizeof(long) == sizeof(char*)
   4406              dl_inc = find_file('dlfcn.h', [], inc_dirs)
   4407 -            if (dl_inc is not None) and (platform not in ['atheos']):
   4408 +            if (dl_inc is not None) and (host_platform not in ['atheos']):
   4409                  exts.append( Extension('dl', ['dlmodule.c']) )
   4410              else:
   4411                  missing.append('dl')
   4412 @@ -1420,29 +1462,29 @@
   4413          self.detect_ctypes(inc_dirs, lib_dirs)
   4414  
   4415          # Richard Oudkerk's multiprocessing module
   4416 -        if platform == 'win32':             # Windows
   4417 +        if host_platform == 'win32':
   4418              macros = dict()
   4419              libraries = ['ws2_32']
   4420  
   4421 -        elif platform == 'darwin':          # Mac OSX
   4422 +        elif host_platform == 'darwin':
   4423              macros = dict()
   4424              libraries = []
   4425  
   4426 -        elif platform == 'cygwin':          # Cygwin
   4427 +        elif host_platform == 'cygwin':
   4428              macros = dict()
   4429              libraries = []
   4430  
   4431 -        elif platform in ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8'):
   4432 +        elif host_platform in ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8'):
   4433              # FreeBSD's P1003.1b semaphore support is very experimental
   4434              # and has many known problems. (as of June 2008)
   4435              macros = dict()
   4436              libraries = []
   4437  
   4438 -        elif platform.startswith('openbsd'):
   4439 +        elif host_platform.startswith('openbsd'):
   4440              macros = dict()
   4441              libraries = []
   4442  
   4443 -        elif platform.startswith('netbsd'):
   4444 +        elif host_platform.startswith('netbsd'):
   4445              macros = dict()
   4446              libraries = []
   4447  
   4448 @@ -1450,7 +1492,7 @@
   4449              macros = dict()
   4450              libraries = ['rt']
   4451  
   4452 -        if platform == 'win32':
   4453 +        if host_platform == 'win32':
   4454              multiprocessing_srcs = [ '_multiprocessing/multiprocessing.c',
   4455                                       '_multiprocessing/semaphore.c',
   4456                                       '_multiprocessing/pipe_connection.c',
   4457 @@ -1477,26 +1519,26 @@
   4458  
   4459  
   4460          # Platform-specific libraries
   4461 -        if platform == 'linux2':
   4462 +        if host_platform == 'linux2':
   4463              # Linux-specific modules
   4464              exts.append( Extension('linuxaudiodev', ['linuxaudiodev.c']) )
   4465          else:
   4466              missing.append('linuxaudiodev')
   4467  
   4468 -        if (platform in ('linux2', 'freebsd4', 'freebsd5', 'freebsd6',
   4469 +        if (host_platform in ('linux2', 'freebsd4', 'freebsd5', 'freebsd6',
   4470                          'freebsd7', 'freebsd8')
   4471 -            or platform.startswith("gnukfreebsd")):
   4472 +            or host_platform.startswith("gnukfreebsd")):
   4473              exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) )
   4474          else:
   4475              missing.append('ossaudiodev')
   4476  
   4477 -        if platform == 'sunos5':
   4478 +        if host_platform == 'sunos5':
   4479              # SunOS specific modules
   4480              exts.append( Extension('sunaudiodev', ['sunaudiodev.c']) )
   4481          else:
   4482              missing.append('sunaudiodev')
   4483  
   4484 -        if platform == 'darwin':
   4485 +        if host_platform == 'darwin':
   4486              # _scproxy
   4487              exts.append(Extension("_scproxy", [os.path.join(srcdir, "Mac/Modules/_scproxy.c")],
   4488                  extra_link_args= [
   4489 @@ -1505,7 +1547,7 @@
   4490                  ]))
   4491  
   4492  
   4493 -        if platform == 'darwin' and ("--disable-toolbox-glue" not in
   4494 +        if host_platform == 'darwin' and ("--disable-toolbox-glue" not in
   4495                  sysconfig.get_config_var("CONFIG_ARGS")):
   4496  
   4497              if int(os.uname()[2].split('.')[0]) >= 8:
   4498 @@ -1701,8 +1743,7 @@
   4499          # Rather than complicate the code below, detecting and building
   4500          # AquaTk is a separate method. Only one Tkinter will be built on
   4501          # Darwin - either AquaTk, if it is found, or X11 based Tk.
   4502 -        platform = self.get_platform()
   4503 -        if (platform == 'darwin' and
   4504 +        if (host_platform == 'darwin' and
   4505              self.detect_tkinter_darwin(inc_dirs, lib_dirs)):
   4506              return
   4507  
   4508 @@ -1725,7 +1766,7 @@
   4509              # Check for the include files on Debian and {Free,Open}BSD, where
   4510              # they're put in /usr/include/{tcl,tk}X.Y
   4511              dotversion = version
   4512 -            if '.' not in dotversion and "bsd" in sys.platform.lower():
   4513 +            if '.' not in dotversion and "bsd" in host_platform.lower():
   4514                  # OpenBSD and FreeBSD use Tcl/Tk library names like libtcl83.a,
   4515                  # but the include subdirs are named like .../include/tcl8.3.
   4516                  dotversion = dotversion[:-1] + '.' + dotversion[-1]
   4517 @@ -1751,7 +1792,7 @@
   4518                  include_dirs.append(dir)
   4519  
   4520          # Check for various platform-specific directories
   4521 -        if platform == 'sunos5':
   4522 +        if host_platform == 'sunos5':
   4523              include_dirs.append('/usr/openwin/include')
   4524              added_lib_dirs.append('/usr/openwin/lib')
   4525          elif os.path.exists('/usr/X11R6/include'):
   4526 @@ -1767,7 +1808,7 @@
   4527              added_lib_dirs.append('/usr/X11/lib')
   4528  
   4529          # If Cygwin, then verify that X is installed before proceeding
   4530 -        if platform == 'cygwin':
   4531 +        if host_platform == 'cygwin':
   4532              x11_inc = find_file('X11/Xlib.h', [], include_dirs)
   4533              if x11_inc is None:
   4534                  return
   4535 @@ -1786,11 +1827,11 @@
   4536          libs.append('tk'+ version)
   4537          libs.append('tcl'+ version)
   4538  
   4539 -        if platform in ['aix3', 'aix4']:
   4540 +        if host_platform in ['aix3', 'aix4']:
   4541              libs.append('ld')
   4542  
   4543          # Finally, link with the X11 libraries (not appropriate on cygwin)
   4544 -        if platform != "cygwin":
   4545 +        if host_platform != "cygwin":
   4546              libs.append('X11')
   4547  
   4548          ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
   4549 @@ -1842,7 +1883,7 @@
   4550  
   4551      def configure_ctypes(self, ext):
   4552          if not self.use_system_libffi:
   4553 -            if sys.platform == 'darwin':
   4554 +            if host_platform == 'darwin':
   4555                  return self.configure_ctypes_darwin(ext)
   4556  
   4557              srcdir = sysconfig.get_config_var('srcdir')
   4558 @@ -1860,12 +1901,17 @@
   4559                                           ffi_configfile):
   4560                  from distutils.dir_util import mkpath
   4561                  mkpath(ffi_builddir)
   4562 -                config_args = []
   4563 +                #NOTE: best solution is to add to configure script
   4564 +                # as config subdirectory and to exclude darwin
   4565 +                # (see configure_ctypes_darwin).
   4566 +                #FIXME: lets for now pass all top configure arguments
   4567 +                #and do not modify configure script.
   4568 +                config_args = sysconfig.get_config_var("CONFIG_ARGS")
   4569  
   4570                  # Pass empty CFLAGS because we'll just append the resulting
   4571                  # CFLAGS to Python's; -g or -O2 is to be avoided.
   4572 -                cmd = "cd %s && env CFLAGS='' '%s/configure' %s" \
   4573 -                      % (ffi_builddir, ffi_srcdir, " ".join(config_args))
   4574 +                cmd = "cd %s && env CFLAGS='' '%s/configure' %s --srcdir='%s'" \
   4575 +                      % (ffi_builddir, ffi_srcdir, config_args, ffi_srcdir)
   4576  
   4577                  res = os.system(cmd)
   4578                  if res or not os.path.exists(ffi_configfile):
   4579 @@ -1902,7 +1948,7 @@
   4580                     '_ctypes/cfield.c']
   4581          depends = ['_ctypes/ctypes.h']
   4582  
   4583 -        if sys.platform == 'darwin':
   4584 +        if host_platform == 'darwin':
   4585              sources.append('_ctypes/malloc_closure.c')
   4586              sources.append('_ctypes/darwin/dlfcn_simple.c')
   4587              extra_compile_args.append('-DMACOSX')
   4588 @@ -1910,7 +1956,7 @@
   4589  # XXX Is this still needed?
   4590  ##            extra_link_args.extend(['-read_only_relocs', 'warning'])
   4591  
   4592 -        elif sys.platform == 'sunos5':
   4593 +        elif host_platform == 'sunos5':
   4594              # XXX This shouldn't be necessary; it appears that some
   4595              # of the assembler code is non-PIC (i.e. it has relocations
   4596              # when it shouldn't. The proper fix would be to rewrite
   4597 @@ -1921,7 +1967,7 @@
   4598              # finding some -z option for the Sun compiler.
   4599              extra_link_args.append('-mimpure-text')
   4600  
   4601 -        elif sys.platform.startswith('hp-ux'):
   4602 +        elif host_platform.startswith('hp-ux'):
   4603              extra_link_args.append('-fPIC')
   4604  
   4605          ext = Extension('_ctypes',
   4606 @@ -1938,7 +1984,7 @@
   4607          if not '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS"):
   4608              return
   4609  
   4610 -        if sys.platform == 'darwin':
   4611 +        if host_platform == 'darwin':
   4612              # OS X 10.5 comes with libffi.dylib; the include files are
   4613              # in /usr/include/ffi
   4614              inc_dirs.append('/usr/include/ffi')
   4615