common/autoconf/build-aux/config.guess

Mon, 04 Jun 2018 11:01:41 +0800

author
aoqi
date
Mon, 04 Jun 2018 11:01:41 +0800
changeset 2166
0c54636b64a4
parent 1133
50aaf272884f
permissions
-rw-r--r--

Backport of 8204091: Configure broken on MIPS when uname returns mipsel or mips64el

aoqi@0 1 #!/bin/sh
aoqi@0 2 #
aoqi@0 3 # Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
aoqi@0 4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 5 #
aoqi@0 6 # This code is free software; you can redistribute it and/or modify it
aoqi@0 7 # under the terms of the GNU General Public License version 2 only, as
aoqi@0 8 # published by the Free Software Foundation.
aoqi@0 9 #
aoqi@0 10 # This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 13 # version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 14 # accompanied this code).
aoqi@0 15 #
aoqi@0 16 # You should have received a copy of the GNU General Public License version
aoqi@0 17 # 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 19 #
aoqi@0 20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 21 # or visit www.oracle.com if you need additional information or have any
aoqi@0 22 # questions.
aoqi@0 23 #
aoqi@0 24
aoqi@0 25 # This is a wrapper for the config.guess from autoconf. The latter does not
aoqi@0 26 # properly detect 64 bit systems on all platforms. Instead of patching the
aoqi@0 27 # autoconf system (which might easily get lost in a future update), we wrap it
aoqi@0 28 # and fix the broken property, if needed.
aoqi@0 29
aoqi@0 30 DIR=`dirname $0`
aoqi@0 31 OUT=`. $DIR/autoconf-config.guess`
aoqi@0 32
aoqi@0 33 # Test and fix solaris on x86_64
aoqi@0 34 echo $OUT | grep i386-pc-solaris > /dev/null 2> /dev/null
aoqi@0 35 if test $? = 0; then
aoqi@0 36 # isainfo -n returns either i386 or amd64
aoqi@0 37 REAL_CPU=`isainfo -n`
aoqi@0 38 OUT=$REAL_CPU`echo $OUT | sed -e 's/[^-]*//'`
aoqi@0 39 fi
aoqi@0 40
aoqi@0 41 # Test and fix solaris on sparcv9
aoqi@0 42 echo $OUT | grep sparc-sun-solaris > /dev/null 2> /dev/null
aoqi@0 43 if test $? = 0; then
aoqi@0 44 # isainfo -n returns either sparc or sparcv9
aoqi@0 45 REAL_CPU=`isainfo -n`
aoqi@0 46 OUT=$REAL_CPU`echo $OUT | sed -e 's/[^-]*//'`
aoqi@0 47 fi
aoqi@0 48
aoqi@0 49 # Test and fix cygwin on x86_64
aoqi@0 50 echo $OUT | grep 86-pc-cygwin > /dev/null 2> /dev/null
aoqi@0 51 if test $? != 0; then
aoqi@0 52 echo $OUT | grep 86-pc-mingw > /dev/null 2> /dev/null
aoqi@0 53 fi
aoqi@0 54 if test $? = 0; then
aoqi@0 55 case `echo $PROCESSOR_IDENTIFIER | cut -f1 -d' '` in
aoqi@0 56 intel64|Intel64|INTEL64|em64t|EM64T|amd64|AMD64|8664|x86_64)
aoqi@0 57 REAL_CPU=x86_64
aoqi@0 58 OUT=$REAL_CPU`echo $OUT | sed -e 's/[^-]*//'`
aoqi@0 59 ;;
aoqi@0 60 esac
aoqi@0 61 fi
aoqi@0 62
aoqi@0 63 # Test and fix architecture string on AIX
aoqi@0 64 # On AIX 'config.guess' returns 'powerpc' as architecture but 'powerpc' is
aoqi@0 65 # implicitely handled as 32-bit architecture in 'platform.m4' so we check
aoqi@0 66 # for the kernel mode rewrite it to 'powerpc64' if we'Re running in 64-bit mode.
aoqi@0 67 # The check could also be done with `/usr/sbin/prtconf | grep "Kernel Type" | grep "64-bit"`
aoqi@0 68 echo $OUT | grep powerpc-ibm-aix > /dev/null 2> /dev/null
aoqi@0 69 if test $? = 0; then
aoqi@0 70 if [ -x /bin/getconf ] ; then
aoqi@0 71 KERNEL_BITMODE=`getconf KERNEL_BITMODE`
aoqi@0 72 if [ "$KERNEL_BITMODE" = "32" ]; then
aoqi@0 73 KERNEL_BITMODE=""
aoqi@0 74 fi
aoqi@0 75 fi
aoqi@0 76 OUT=powerpc$KERNEL_BITMODE`echo $OUT | sed -e 's/[^-]*//'`
aoqi@0 77 fi
aoqi@0 78
aoqi@0 79 # Test and fix little endian PowerPC64.
aoqi@0 80 # TODO: should be handled by autoconf-config.guess.
aoqi@0 81 if [ "x$OUT" = x ]; then
aoqi@0 82 if [ `uname -m` = ppc64le ]; then
aoqi@0 83 if [ `uname -s` = Linux ]; then
aoqi@0 84 OUT=powerpc64le-unknown-linux-gnu
aoqi@0 85 fi
aoqi@0 86 fi
aoqi@0 87 fi
aoqi@0 88
aoqi@2166 89 # Test and fix little endian MIPS.
aoqi@2166 90 if [ "x$OUT" = x ]; then
aoqi@2166 91 if [ `uname -s` = Linux ]; then
aoqi@2166 92 if [ `uname -m` = mipsel ]; then
aoqi@2166 93 OUT=mipsel-unknown-linux-gnu
aoqi@2166 94 elif [ `uname -m` = mips64el ]; then
aoqi@2166 95 OUT=mips64el-unknown-linux-gnu
aoqi@2166 96 fi
aoqi@2166 97 fi
aoqi@2166 98 fi
aoqi@2166 99
aoqi@0 100 echo $OUT

mercurial