Path: blob/master/runtime/compiler/build/scripts/guess-platform.sh
6004 views
# Copyright (c) 2000, 2021 IBM Corp. and others1#2# This program and the accompanying materials are made available under3# the terms of the Eclipse Public License 2.0 which accompanies this4# distribution and is available at https://www.eclipse.org/legal/epl-2.0/5# or the Apache License, Version 2.0 which accompanies this distribution and6# is available at https://www.apache.org/licenses/LICENSE-2.0.7#8# This Source Code may also be made available under the following9# Secondary Licenses when the conditions for such availability set10# forth in the Eclipse Public License, v. 2.0 are satisfied: GNU11# General Public License, version 2 with the GNU Classpath12# Exception [1] and GNU General Public License, version 2 with the13# OpenJDK Assembly Exception [2].14#15# [1] https://www.gnu.org/software/classpath/license.html16# [2] http://openjdk.java.net/legal/assembly-exception.html17#18# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception1920thirty_two_bit=02122usage() {23echo "usage: guess-platform.sh [--32|--64]" >&224echo "Outputs the value that can be assigned to the PLATFORM variable in" >&225echo "the jit makefiles. If neither --32 or --64 is provided, --64 is " >&226echo "assumed." >&227exit 128}2930error() {31echo "$0: $1" >&232exit 133}3435# chooseplatform 32bit_platform 64bit_platform36chooseplatform() {37if [ $thirty_two_bit -eq 1 ] ; then38platform=$139else40platform=$241fi42}4344if [ $# -eq 0 ] ; then45arg="--64"46elif [ $# -eq 1 ] ; then47arg=$148else49usage50fi5152case $arg in53--32)54thirty_two_bit=155;;56--64)57thirty_two_bit=058;;59*)60usage61;;62esac6364system=$(uname -s)65case $system in66AIX)67chooseplatform "ppc-aix-vacpp" "ppc64-aix-vacpp"68;;69OS/390)70chooseplatform "s390-zos-vacpp" "s390-zos64-vacpp"71;;72CYGWIN*)73chooseplatform "ia32-win32-mvs" "amd64-win64-mvs"74;;75Darwin)76platform="amd64-osx-clang"77;;78Linux)79p=$(uname -m)80case $p in81i[456]86)82platform="ia32-linux-gcc"83;;84x86_64)85chooseplatform "amd64-linux-gcc" "amd64-linux64-gcc"86;;87ppc64)88chooseplatform "ppc-linux-gcc" "ppc64-linux64-gcc"89;;90ppc64le)91platform="ppc64le-linux64-gcc"92;;93s390x)94chooseplatform "s390-linux-gcc" "s390-linux64-gcc"95;;96*)97error "$0: uname -m returns unknown result \"$p\""98;;99esac100;;101*)102error "$0: uname -s returns unknown result \"$system\""103;;104esac105106echo $platform107108109