config.guess revision 1236:bebfcf0b68ea
1107120Sjulian#!/bin/sh 2107120Sjulian# 3107120Sjulian# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 4107120Sjulian# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5107120Sjulian# 6107120Sjulian# This code is free software; you can redistribute it and/or modify it 7107120Sjulian# under the terms of the GNU General Public License version 2 only, as 8107120Sjulian# published by the Free Software Foundation. 9107120Sjulian# 10107120Sjulian# This code is distributed in the hope that it will be useful, but WITHOUT 11107120Sjulian# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12107120Sjulian# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13107120Sjulian# version 2 for more details (a copy is included in the LICENSE file that 14107120Sjulian# accompanied this code). 15107120Sjulian# 16107120Sjulian# You should have received a copy of the GNU General Public License version 17107120Sjulian# 2 along with this work; if not, write to the Free Software Foundation, 18107120Sjulian# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19107120Sjulian# 20107120Sjulian# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21107120Sjulian# or visit www.oracle.com if you need additional information or have any 22107120Sjulian# questions. 23107120Sjulian# 24107120Sjulian 25107120Sjulian# This is a wrapper for the config.guess from autoconf. The latter does not 26107120Sjulian# properly detect 64 bit systems on all platforms. Instead of patching the 27107120Sjulian# autoconf system (which might easily get lost in a future update), we wrap it 28121054Semax# and fix the broken property, if needed. 29107120Sjulian 30107120SjulianDIR=`dirname $0` 31107120SjulianOUT=`. $DIR/autoconf-config.guess` 32121054Semax 33158834Smarkus# Test and fix solaris on x86_64 34107120Sjulianecho $OUT | grep i386-pc-solaris > /dev/null 2> /dev/null 35107120Sjulianif test $? = 0; then 36107120Sjulian # isainfo -n returns either i386 or amd64 37107120Sjulian REAL_CPU=`isainfo -n` 38158834Smarkus OUT=$REAL_CPU`echo $OUT | sed -e 's/[^-]*//'` 39107120Sjulianfi 40107120Sjulian 41107120Sjulian# Test and fix solaris on sparcv9 42107120Sjulianecho $OUT | grep sparc-sun-solaris > /dev/null 2> /dev/null 43107120Sjulianif test $? = 0; then 44107120Sjulian # isainfo -n returns either sparc or sparcv9 45107120Sjulian REAL_CPU=`isainfo -n` 46107120Sjulian OUT=$REAL_CPU`echo $OUT | sed -e 's/[^-]*//'` 47107120Sjulianfi 48158834Smarkus 49107120Sjulian# Test and fix cygwin on x86_64 50107120Sjulianecho $OUT | grep 86-pc-cygwin > /dev/null 2> /dev/null 51107120Sjulianif test $? != 0; then 52107120Sjulian echo $OUT | grep 86-pc-mingw > /dev/null 2> /dev/null 53107120Sjulianfi 54107120Sjulianif test $? = 0; then 55121054Semax case `echo $PROCESSOR_IDENTIFIER | cut -f1 -d' '` in 56107120Sjulian intel64|Intel64|INTEL64|em64t|EM64T|amd64|AMD64|8664|x86_64) 57107120Sjulian REAL_CPU=x86_64 58107120Sjulian OUT=$REAL_CPU`echo $OUT | sed -e 's/[^-]*//'` 59107120Sjulian ;; 60107120Sjulian esac 61107120Sjulianfi 62107120Sjulian 63107120Sjulian# Test and fix architecture string on AIX 64107120Sjulian# On AIX 'config.guess' returns 'powerpc' as architecture but 'powerpc' is 65121054Semax# implicitely handled as 32-bit architecture in 'platform.m4' so we check 66107120Sjulian# for the kernel mode rewrite it to 'powerpc64' if we'Re running in 64-bit mode. 67107120Sjulian# The check could also be done with `/usr/sbin/prtconf | grep "Kernel Type" | grep "64-bit"` 68107120Sjulianecho $OUT | grep powerpc-ibm-aix > /dev/null 2> /dev/null 69107120Sjulianif test $? = 0; then 70107120Sjulian if [ -x /bin/getconf ] ; then 71121054Semax KERNEL_BITMODE=`getconf KERNEL_BITMODE` 72121054Semax if [ "$KERNEL_BITMODE" = "32" ]; then 73121054Semax KERNEL_BITMODE="" 74121054Semax fi 75107120Sjulian fi 76107120Sjulian OUT=powerpc$KERNEL_BITMODE`echo $OUT | sed -e 's/[^-]*//'` 77107120Sjulianfi 78107120Sjulian 79114879Sjulian# Test and fix little endian PowerPC64. 80107120Sjulian# TODO: should be handled by autoconf-config.guess. 81107120Sjulianif [ "x$OUT" = x ]; then 82107120Sjulian if [ `uname -m` = ppc64le ]; then 83107120Sjulian if [ `uname -s` = Linux ]; then 84107120Sjulian OUT=powerpc64le-unknown-linux-gnu 85107120Sjulian fi 86107120Sjulian fi 87107120Sjulianfi 88107120Sjulian 89107120Sjulianecho $OUT 90107120Sjulian