3
# Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
4
# Copyright (c) 2021, Azul Systems, Inc. All rights reserved.
5
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7
# This code is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License version 2 only, as
9
# published by the Free Software Foundation.
11
# This code is distributed in the hope that it will be useful, but WITHOUT
12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
# version 2 for more details (a copy is included in the LICENSE file that
15
# accompanied this code).
17
# You should have received a copy of the GNU General Public License version
18
# 2 along with this work; if not, write to the Free Software Foundation,
19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
# or visit www.oracle.com if you need additional information or have any
26
# This is a wrapper for the config.guess from autoconf. The latter does not
27
# properly detect 64 bit systems on all platforms. Instead of patching the
28
# autoconf system (which might easily get lost in a future update), we wrap it
29
# and fix the broken property, if needed.
32
OUT=`. $DIR/autoconf-config.guess 2> /dev/null`
34
# Handle some cases that autoconf-config.guess is not capable of
35
if [ "x$OUT" = x ]; then
36
if [ `uname -s` = Linux ]; then
37
# Test and fix little endian MIPS.
38
if [ `uname -m` = mipsel ]; then
39
OUT=mipsel-unknown-linux-gnu
41
# Test and fix cygwin machine arch .x86_64
42
elif [[ `uname -s` = CYGWIN* ]]; then
43
if [ `uname -m` = ".x86_64" ]; then
44
OUT=x86_64-unknown-cygwin
48
if [ "x$OUT" = x ]; then
49
# Run autoconf-config.guess again to get the error message.
50
. $DIR/autoconf-config.guess > /dev/null
52
printf "guessed by custom config.guess... " >&2
56
# Test and fix cygwin on x86_64
57
echo $OUT | grep 86-pc-cygwin > /dev/null 2> /dev/null
59
echo $OUT | grep 86-pc-mingw > /dev/null 2> /dev/null
62
case `echo $PROCESSOR_IDENTIFIER | cut -f1 -d' '` in
63
intel64|Intel64|INTEL64|em64t|EM64T|amd64|AMD64|8664|x86_64)
65
OUT=$REAL_CPU`echo $OUT | sed -e 's/[^-]*//'`
71
echo $OUT | grep '\(unknown\|pc\)-linux-gnu' > /dev/null 2> /dev/null
73
uname -r | grep -i microsoft > /dev/null 2> /dev/null
75
OUT=`echo $OUT | sed -e 's/\(unknown\|pc\)-linux-gnu/pc-wsl/'`
79
# Test and fix architecture string on AIX
80
# On AIX 'config.guess' returns 'powerpc' as architecture but 'powerpc' is
81
# implicitly handled as 32-bit architecture in 'platform.m4' so we check
82
# for the kernel mode rewrite it to 'powerpc64' if we'Re running in 64-bit mode.
83
# The check could also be done with `/usr/sbin/prtconf | grep "Kernel Type" | grep "64-bit"`
84
echo $OUT | grep powerpc-ibm-aix > /dev/null 2> /dev/null
86
if [ -x /bin/getconf ] ; then
87
KERNEL_BITMODE=`getconf KERNEL_BITMODE`
88
if [ "$KERNEL_BITMODE" = "32" ]; then
92
OUT=powerpc$KERNEL_BITMODE`echo $OUT | sed -e 's/[^-]*//'`
95
# Test and fix cpu on Macosx when C preprocessor is not on the path
96
echo $OUT | grep i386-apple-darwin > /dev/null 2> /dev/null
99
OUT=$REAL_CPU`echo $OUT | sed -e 's/[^-]*//'`