Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/compiler/build/scripts/guess-platform.sh
6004 views
1
# Copyright (c) 2000, 2021 IBM Corp. and others
2
#
3
# This program and the accompanying materials are made available under
4
# the terms of the Eclipse Public License 2.0 which accompanies this
5
# distribution and is available at https://www.eclipse.org/legal/epl-2.0/
6
# or the Apache License, Version 2.0 which accompanies this distribution and
7
# is available at https://www.apache.org/licenses/LICENSE-2.0.
8
#
9
# This Source Code may also be made available under the following
10
# Secondary Licenses when the conditions for such availability set
11
# forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
12
# General Public License, version 2 with the GNU Classpath
13
# Exception [1] and GNU General Public License, version 2 with the
14
# OpenJDK Assembly Exception [2].
15
#
16
# [1] https://www.gnu.org/software/classpath/license.html
17
# [2] http://openjdk.java.net/legal/assembly-exception.html
18
#
19
# 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-exception
20
21
thirty_two_bit=0
22
23
usage() {
24
echo "usage: guess-platform.sh [--32|--64]" >&2
25
echo "Outputs the value that can be assigned to the PLATFORM variable in" >&2
26
echo "the jit makefiles. If neither --32 or --64 is provided, --64 is " >&2
27
echo "assumed." >&2
28
exit 1
29
}
30
31
error() {
32
echo "$0: $1" >&2
33
exit 1
34
}
35
36
# chooseplatform 32bit_platform 64bit_platform
37
chooseplatform() {
38
if [ $thirty_two_bit -eq 1 ] ; then
39
platform=$1
40
else
41
platform=$2
42
fi
43
}
44
45
if [ $# -eq 0 ] ; then
46
arg="--64"
47
elif [ $# -eq 1 ] ; then
48
arg=$1
49
else
50
usage
51
fi
52
53
case $arg in
54
--32)
55
thirty_two_bit=1
56
;;
57
--64)
58
thirty_two_bit=0
59
;;
60
*)
61
usage
62
;;
63
esac
64
65
system=$(uname -s)
66
case $system in
67
AIX)
68
chooseplatform "ppc-aix-vacpp" "ppc64-aix-vacpp"
69
;;
70
OS/390)
71
chooseplatform "s390-zos-vacpp" "s390-zos64-vacpp"
72
;;
73
CYGWIN*)
74
chooseplatform "ia32-win32-mvs" "amd64-win64-mvs"
75
;;
76
Darwin)
77
platform="amd64-osx-clang"
78
;;
79
Linux)
80
p=$(uname -m)
81
case $p in
82
i[456]86)
83
platform="ia32-linux-gcc"
84
;;
85
x86_64)
86
chooseplatform "amd64-linux-gcc" "amd64-linux64-gcc"
87
;;
88
ppc64)
89
chooseplatform "ppc-linux-gcc" "ppc64-linux64-gcc"
90
;;
91
ppc64le)
92
platform="ppc64le-linux64-gcc"
93
;;
94
s390x)
95
chooseplatform "s390-linux-gcc" "s390-linux64-gcc"
96
;;
97
*)
98
error "$0: uname -m returns unknown result \"$p\""
99
;;
100
esac
101
;;
102
*)
103
error "$0: uname -s returns unknown result \"$system\""
104
;;
105
esac
106
107
echo $platform
108
109