aoqi@0: #!/bin/sh aoqi@0: # aoqi@0: # Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. aoqi@0: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: # aoqi@0: # This code is free software; you can redistribute it and/or modify it aoqi@0: # under the terms of the GNU General Public License version 2 only, as aoqi@0: # published by the Free Software Foundation. aoqi@0: # aoqi@0: # This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: # version 2 for more details (a copy is included in the LICENSE file that aoqi@0: # accompanied this code). aoqi@0: # aoqi@0: # You should have received a copy of the GNU General Public License version aoqi@0: # 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: # aoqi@0: # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: # or visit www.oracle.com if you need additional information or have any aoqi@0: # questions. aoqi@0: # aoqi@0: aoqi@0: # This is a wrapper for the config.guess from autoconf. The latter does not aoqi@0: # properly detect 64 bit systems on all platforms. Instead of patching the aoqi@0: # autoconf system (which might easily get lost in a future update), we wrap it aoqi@0: # and fix the broken property, if needed. aoqi@0: aoqi@0: DIR=`dirname $0` aoqi@0: OUT=`. $DIR/autoconf-config.guess` aoqi@0: aoqi@0: # Test and fix solaris on x86_64 aoqi@0: echo $OUT | grep i386-pc-solaris > /dev/null 2> /dev/null aoqi@0: if test $? = 0; then aoqi@0: # isainfo -n returns either i386 or amd64 aoqi@0: REAL_CPU=`isainfo -n` aoqi@0: OUT=$REAL_CPU`echo $OUT | sed -e 's/[^-]*//'` aoqi@0: fi aoqi@0: aoqi@0: # Test and fix solaris on sparcv9 aoqi@0: echo $OUT | grep sparc-sun-solaris > /dev/null 2> /dev/null aoqi@0: if test $? = 0; then aoqi@0: # isainfo -n returns either sparc or sparcv9 aoqi@0: REAL_CPU=`isainfo -n` aoqi@0: OUT=$REAL_CPU`echo $OUT | sed -e 's/[^-]*//'` aoqi@0: fi aoqi@0: aoqi@0: # Test and fix cygwin on x86_64 aoqi@0: echo $OUT | grep 86-pc-cygwin > /dev/null 2> /dev/null aoqi@0: if test $? != 0; then aoqi@0: echo $OUT | grep 86-pc-mingw > /dev/null 2> /dev/null aoqi@0: fi aoqi@0: if test $? = 0; then aoqi@0: case `echo $PROCESSOR_IDENTIFIER | cut -f1 -d' '` in aoqi@0: intel64|Intel64|INTEL64|em64t|EM64T|amd64|AMD64|8664|x86_64) aoqi@0: REAL_CPU=x86_64 aoqi@0: OUT=$REAL_CPU`echo $OUT | sed -e 's/[^-]*//'` aoqi@0: ;; aoqi@0: esac aoqi@0: fi aoqi@0: aoqi@0: # Test and fix architecture string on AIX aoqi@0: # On AIX 'config.guess' returns 'powerpc' as architecture but 'powerpc' is aoqi@0: # implicitely handled as 32-bit architecture in 'platform.m4' so we check aoqi@0: # for the kernel mode rewrite it to 'powerpc64' if we'Re running in 64-bit mode. aoqi@0: # The check could also be done with `/usr/sbin/prtconf | grep "Kernel Type" | grep "64-bit"` aoqi@0: echo $OUT | grep powerpc-ibm-aix > /dev/null 2> /dev/null aoqi@0: if test $? = 0; then aoqi@0: if [ -x /bin/getconf ] ; then aoqi@0: KERNEL_BITMODE=`getconf KERNEL_BITMODE` aoqi@0: if [ "$KERNEL_BITMODE" = "32" ]; then aoqi@0: KERNEL_BITMODE="" aoqi@0: fi aoqi@0: fi aoqi@0: OUT=powerpc$KERNEL_BITMODE`echo $OUT | sed -e 's/[^-]*//'` aoqi@0: fi aoqi@0: aoqi@0: # Test and fix little endian PowerPC64. aoqi@0: # TODO: should be handled by autoconf-config.guess. aoqi@0: if [ "x$OUT" = x ]; then aoqi@0: if [ `uname -m` = ppc64le ]; then aoqi@0: if [ `uname -s` = Linux ]; then aoqi@0: OUT=powerpc64le-unknown-linux-gnu aoqi@0: fi aoqi@0: fi aoqi@0: fi aoqi@0: aoqi@2166: # Test and fix little endian MIPS. aoqi@2166: if [ "x$OUT" = x ]; then aoqi@2166: if [ `uname -s` = Linux ]; then aoqi@2166: if [ `uname -m` = mipsel ]; then aoqi@2166: OUT=mipsel-unknown-linux-gnu aoqi@2166: elif [ `uname -m` = mips64el ]; then aoqi@2166: OUT=mips64el-unknown-linux-gnu aoqi@2166: fi aoqi@2166: fi aoqi@2166: fi aoqi@2166: aoqi@0: echo $OUT