2012-04-10 15:18:28 +00:00
#
2024-11-13 09:41:57 +00:00
# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
2012-04-10 15:18:28 +00:00
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
2012-09-18 18:29:16 +00:00
# Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD.
# Converts autoconf style CPU name to OpenJDK style, into
# VAR_CPU, VAR_CPU_ARCH, VAR_CPU_BITS and VAR_CPU_ENDIAN.
2012-07-03 23:11:12 +00:00
AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU],
2012-04-10 15:18:28 +00:00
[
# First argument is the cpu name from the trip/quad
case "$1" in
2018-09-05 09:15:28 +00:00
x86_64*x32)
VAR_CPU=x32
VAR_CPU_ARCH=x86
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=little
;;
2012-04-10 15:18:28 +00:00
x86_64)
2012-09-18 18:29:16 +00:00
VAR_CPU=x86_64
2012-04-10 15:18:28 +00:00
VAR_CPU_ARCH=x86
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
;;
i?86)
2012-09-18 18:29:16 +00:00
VAR_CPU=x86
2012-04-10 15:18:28 +00:00
VAR_CPU_ARCH=x86
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=little
;;
2017-08-21 13:19:47 +00:00
alpha*)
VAR_CPU=alpha
VAR_CPU_ARCH=alpha
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
;;
2012-04-10 15:18:28 +00:00
arm*)
VAR_CPU=arm
VAR_CPU_ARCH=arm
2012-07-03 23:11:12 +00:00
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=little
2012-04-10 15:18:28 +00:00
;;
2014-11-21 19:24:55 +00:00
aarch64)
VAR_CPU=aarch64
VAR_CPU_ARCH=aarch64
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
;;
2018-03-26 08:03:31 +00:00
ia64)
VAR_CPU=ia64
VAR_CPU_ARCH=ia64
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
;;
2021-07-15 08:26:05 +00:00
loongarch64)
VAR_CPU=loongarch64
VAR_CPU_ARCH=loongarch
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
;;
2017-08-21 13:19:47 +00:00
m68k)
VAR_CPU=m68k
VAR_CPU_ARCH=m68k
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=big
;;
mips)
VAR_CPU=mips
VAR_CPU_ARCH=mips
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=big
;;
mipsel)
VAR_CPU=mipsel
VAR_CPU_ARCH=mipsel
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=little
;;
mips64)
VAR_CPU=mips64
VAR_CPU_ARCH=mips64
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=big
;;
mips64el)
VAR_CPU=mips64el
VAR_CPU_ARCH=mips64el
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
;;
2012-04-10 15:18:28 +00:00
powerpc)
VAR_CPU=ppc
VAR_CPU_ARCH=ppc
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=big
2013-10-10 12:58:19 +00:00
;;
2012-04-10 15:18:28 +00:00
powerpc64)
VAR_CPU=ppc64
VAR_CPU_ARCH=ppc
VAR_CPU_BITS=64
2012-07-03 23:11:12 +00:00
VAR_CPU_ENDIAN=big
2013-10-10 12:58:19 +00:00
;;
2014-04-02 18:28:32 +00:00
powerpc64le)
2015-12-11 18:45:46 +00:00
VAR_CPU=ppc64le
2014-04-02 18:28:32 +00:00
VAR_CPU_ARCH=ppc
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
;;
2022-04-21 07:35:32 +00:00
riscv32)
VAR_CPU=riscv32
VAR_CPU_ARCH=riscv
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=little
;;
2020-04-07 06:45:01 +00:00
riscv64)
VAR_CPU=riscv64
VAR_CPU_ARCH=riscv
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
;;
2013-09-11 16:08:34 +00:00
s390)
VAR_CPU=s390
VAR_CPU_ARCH=s390
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=big
2013-10-10 12:58:19 +00:00
;;
2013-09-11 16:08:34 +00:00
s390x)
VAR_CPU=s390x
VAR_CPU_ARCH=s390
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=big
2013-10-10 12:58:19 +00:00
;;
2017-08-21 13:19:47 +00:00
sh*eb)
VAR_CPU=sh
VAR_CPU_ARCH=sh
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=big
;;
sh*)
VAR_CPU=sh
VAR_CPU_ARCH=sh
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=little
;;
2012-04-10 15:18:28 +00:00
sparc)
VAR_CPU=sparc
VAR_CPU_ARCH=sparc
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=big
2013-10-10 12:58:19 +00:00
;;
2014-06-23 21:08:45 +00:00
sparcv9|sparc64)
2012-04-10 15:18:28 +00:00
VAR_CPU=sparcv9
VAR_CPU_ARCH=sparc
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=big
2013-10-10 12:58:19 +00:00
;;
8244224: Implementation of JEP 381: Remove the Solaris and SPARC Ports
Reviewed-by: alanb, bchristi, dcubed, dfuchs, eosterlund, erikj, glaubitz, ihse, iignatyev, jjiang, kbarrett, ksrini, kvn, naoto, prr, rriggs, serb, sspitsyn, stefank, tschatzl, valeriep, weijun, weijun
2020-05-21 00:33:37 +00:00
sparc)
VAR_CPU=sparc
VAR_CPU_ARCH=sparc
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=big
;;
sparcv9|sparc64)
VAR_CPU=sparcv9
VAR_CPU_ARCH=sparc
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=big
;;
2012-04-10 15:18:28 +00:00
*)
2012-06-08 03:25:06 +00:00
AC_MSG_ERROR([unsupported cpu $1])
2012-04-10 15:18:28 +00:00
;;
esac
])
2012-09-18 18:29:16 +00:00
# Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD.
# Converts autoconf style OS name to OpenJDK style, into
2014-11-21 15:05:46 +00:00
# VAR_OS, VAR_OS_TYPE and VAR_OS_ENV.
2012-07-03 23:11:12 +00:00
AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_OS],
2012-04-10 15:18:28 +00:00
[
case "$1" in
*linux*)
VAR_OS=linux
2014-11-21 15:05:46 +00:00
VAR_OS_TYPE=unix
2012-04-10 15:18:28 +00:00
;;
*darwin*)
VAR_OS=macosx
2014-11-21 15:05:46 +00:00
VAR_OS_TYPE=unix
2012-04-10 15:18:28 +00:00
;;
*bsd*)
VAR_OS=bsd
2014-11-21 15:05:46 +00:00
VAR_OS_TYPE=unix
2012-04-10 15:18:28 +00:00
;;
2012-10-26 21:29:57 +00:00
*cygwin*)
2012-04-10 15:18:28 +00:00
VAR_OS=windows
2012-10-26 21:29:57 +00:00
VAR_OS_ENV=windows.cygwin
;;
2019-01-02 11:59:26 +00:00
*wsl*)
VAR_OS=windows
VAR_OS_ENV=windows.wsl
;;
2022-06-02 12:49:35 +00:00
*msys* | *mingw*)
2012-10-26 21:29:57 +00:00
VAR_OS=windows
2020-12-07 15:55:53 +00:00
VAR_OS_ENV=windows.msys2
2012-04-10 15:18:28 +00:00
;;
2013-09-12 19:29:17 +00:00
*aix*)
VAR_OS=aix
2014-11-21 15:05:46 +00:00
VAR_OS_TYPE=unix
2013-09-12 19:29:17 +00:00
;;
2012-04-10 15:18:28 +00:00
*)
2012-07-03 23:11:12 +00:00
AC_MSG_ERROR([unsupported operating system $1])
2012-04-10 15:18:28 +00:00
;;
esac
])
2020-10-13 09:35:58 +00:00
# Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD.
# Converts autoconf style OS name to OpenJDK style, into
# VAR_LIBC.
AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_LIBC],
[
case "$1" in
*linux*-musl)
VAR_LIBC=musl
;;
*linux*-gnu)
VAR_LIBC=gnu
;;
*)
VAR_LIBC=default
;;
esac
])
2021-03-08 10:14:46 +00:00
# Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD.
# Converts autoconf style OS name to OpenJDK style, into
# VAR_ABI.
AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_ABI],
[
case "$1" in
*linux*-musl)
VAR_ABI=musl
;;
*linux*-gnu)
VAR_ABI=gnu
;;
*linux*-gnueabi)
VAR_ABI=gnueabi
;;
*linux*-gnueabihf)
VAR_ABI=gnueabihf
;;
*linux*-gnuabi64)
VAR_ABI=gnuabi64
;;
*)
VAR_ABI=default
;;
esac
])
2012-09-18 18:29:16 +00:00
# Expects $host_os $host_cpu $build_os and $build_cpu
# and $with_target_bits to have been setup!
#
# Translate the standard triplet(quadruplet) definition
# of the target/build system into OPENJDK_TARGET_OS, OPENJDK_TARGET_CPU,
# OPENJDK_BUILD_OS, etc.
AC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD],
[
2013-10-10 12:58:19 +00:00
# Copy the autoconf trip/quadruplet verbatim to OPENJDK_TARGET_AUTOCONF_NAME
# (from the autoconf "host") and OPENJDK_BUILD_AUTOCONF_NAME
# Note that we might later on rewrite e.g. OPENJDK_TARGET_CPU due to reduced build,
# but this will not change the value of OPENJDK_TARGET_AUTOCONF_NAME.
OPENJDK_TARGET_AUTOCONF_NAME="$host"
OPENJDK_BUILD_AUTOCONF_NAME="$build"
AC_SUBST(OPENJDK_TARGET_AUTOCONF_NAME)
AC_SUBST(OPENJDK_BUILD_AUTOCONF_NAME)
2020-10-13 09:35:58 +00:00
# Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU/LIBC variables.
2013-10-10 12:58:19 +00:00
PLATFORM_EXTRACT_VARS_FROM_OS($build_os)
PLATFORM_EXTRACT_VARS_FROM_CPU($build_cpu)
2020-10-13 09:35:58 +00:00
PLATFORM_EXTRACT_VARS_FROM_LIBC($build_os)
2021-03-08 10:14:46 +00:00
PLATFORM_EXTRACT_VARS_FROM_ABI($build_os)
2016-12-02 15:17:52 +00:00
# ..and setup our own variables. (Do this explicitly to facilitate searching)
2013-10-10 12:58:19 +00:00
OPENJDK_BUILD_OS="$VAR_OS"
2014-11-21 15:05:46 +00:00
if test "x$VAR_OS_TYPE" != x; then
OPENJDK_BUILD_OS_TYPE="$VAR_OS_TYPE"
else
OPENJDK_BUILD_OS_TYPE="$VAR_OS"
fi
if test "x$VAR_OS_ENV" != x; then
OPENJDK_BUILD_OS_ENV="$VAR_OS_ENV"
else
OPENJDK_BUILD_OS_ENV="$VAR_OS"
fi
2013-10-10 12:58:19 +00:00
OPENJDK_BUILD_CPU="$VAR_CPU"
OPENJDK_BUILD_CPU_ARCH="$VAR_CPU_ARCH"
OPENJDK_BUILD_CPU_BITS="$VAR_CPU_BITS"
OPENJDK_BUILD_CPU_ENDIAN="$VAR_CPU_ENDIAN"
2021-03-08 10:14:46 +00:00
OPENJDK_BUILD_CPU_AUTOCONF="$build_cpu"
2020-10-13 09:35:58 +00:00
OPENJDK_BUILD_LIBC="$VAR_LIBC"
2021-03-08 10:14:46 +00:00
OPENJDK_BUILD_ABI="$VAR_ABI"
2013-10-10 12:58:19 +00:00
AC_SUBST(OPENJDK_BUILD_OS)
2014-11-21 15:05:46 +00:00
AC_SUBST(OPENJDK_BUILD_OS_TYPE)
2014-08-19 11:43:40 +00:00
AC_SUBST(OPENJDK_BUILD_OS_ENV)
2013-10-10 12:58:19 +00:00
AC_SUBST(OPENJDK_BUILD_CPU)
AC_SUBST(OPENJDK_BUILD_CPU_ARCH)
AC_SUBST(OPENJDK_BUILD_CPU_BITS)
AC_SUBST(OPENJDK_BUILD_CPU_ENDIAN)
2021-03-08 10:14:46 +00:00
AC_SUBST(OPENJDK_BUILD_CPU_AUTOCONF)
2020-10-13 09:35:58 +00:00
AC_SUBST(OPENJDK_BUILD_LIBC)
2021-03-08 10:14:46 +00:00
AC_SUBST(OPENJDK_BUILD_ABI)
2013-10-10 12:58:19 +00:00
AC_MSG_CHECKING([openjdk-build os-cpu])
AC_MSG_RESULT([$OPENJDK_BUILD_OS-$OPENJDK_BUILD_CPU])
2020-10-13 09:35:58 +00:00
if test "x$OPENJDK_BUILD_OS" = "xlinux"; then
AC_MSG_CHECKING([openjdk-build C library])
AC_MSG_RESULT([$OPENJDK_BUILD_LIBC])
fi
# Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU/LIBC variables.
2013-10-10 12:58:19 +00:00
PLATFORM_EXTRACT_VARS_FROM_OS($host_os)
PLATFORM_EXTRACT_VARS_FROM_CPU($host_cpu)
2020-10-13 09:35:58 +00:00
PLATFORM_EXTRACT_VARS_FROM_LIBC($host_os)
2021-03-08 10:14:46 +00:00
PLATFORM_EXTRACT_VARS_FROM_ABI($host_os)
2016-12-02 15:17:52 +00:00
# ... and setup our own variables. (Do this explicitly to facilitate searching)
2013-10-10 12:58:19 +00:00
OPENJDK_TARGET_OS="$VAR_OS"
2014-11-21 15:05:46 +00:00
if test "x$VAR_OS_TYPE" != x; then
OPENJDK_TARGET_OS_TYPE="$VAR_OS_TYPE"
else
OPENJDK_TARGET_OS_TYPE="$VAR_OS"
fi
if test "x$VAR_OS_ENV" != x; then
OPENJDK_TARGET_OS_ENV="$VAR_OS_ENV"
else
OPENJDK_TARGET_OS_ENV="$VAR_OS"
fi
2013-10-10 12:58:19 +00:00
OPENJDK_TARGET_CPU="$VAR_CPU"
OPENJDK_TARGET_CPU_ARCH="$VAR_CPU_ARCH"
OPENJDK_TARGET_CPU_BITS="$VAR_CPU_BITS"
OPENJDK_TARGET_CPU_ENDIAN="$VAR_CPU_ENDIAN"
2021-03-08 10:14:46 +00:00
OPENJDK_TARGET_CPU_AUTOCONF="$host_cpu"
2018-03-28 19:00:09 +00:00
OPENJDK_TARGET_OS_UPPERCASE=`$ECHO $OPENJDK_TARGET_OS | $TR 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
2020-10-13 09:35:58 +00:00
OPENJDK_TARGET_LIBC="$VAR_LIBC"
2021-03-08 10:14:46 +00:00
OPENJDK_TARGET_ABI="$VAR_ABI"
2018-03-28 19:00:09 +00:00
2013-10-10 12:58:19 +00:00
AC_SUBST(OPENJDK_TARGET_OS)
2014-11-21 15:05:46 +00:00
AC_SUBST(OPENJDK_TARGET_OS_TYPE)
2014-08-19 11:43:40 +00:00
AC_SUBST(OPENJDK_TARGET_OS_ENV)
2018-03-28 19:00:09 +00:00
AC_SUBST(OPENJDK_TARGET_OS_UPPERCASE)
2013-10-10 12:58:19 +00:00
AC_SUBST(OPENJDK_TARGET_CPU)
AC_SUBST(OPENJDK_TARGET_CPU_ARCH)
AC_SUBST(OPENJDK_TARGET_CPU_BITS)
AC_SUBST(OPENJDK_TARGET_CPU_ENDIAN)
2021-03-08 10:14:46 +00:00
AC_SUBST(OPENJDK_TARGET_CPU_AUTOCONF)
2020-10-13 09:35:58 +00:00
AC_SUBST(OPENJDK_TARGET_LIBC)
2021-03-08 10:14:46 +00:00
AC_SUBST(OPENJDK_TARGET_ABI)
2013-10-10 12:58:19 +00:00
AC_MSG_CHECKING([openjdk-target os-cpu])
AC_MSG_RESULT([$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU])
2020-10-13 09:35:58 +00:00
if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
AC_MSG_CHECKING([openjdk-target C library])
AC_MSG_RESULT([$OPENJDK_TARGET_LIBC])
fi
2012-09-18 18:29:16 +00:00
])
2022-05-23 20:56:49 +00:00
# Check if a reduced build (32-bit on 64-bit platforms) is requested, and modify behavior
2012-09-18 18:29:16 +00:00
# accordingly. Must be done after setting up build and target system, but before
# doing anything else with these values.
AC_DEFUN([PLATFORM_SETUP_TARGET_CPU_BITS],
[
AC_ARG_WITH(target-bits, [AS_HELP_STRING([--with-target-bits],
2024-08-30 08:58:18 +00:00
[build 32-bit or 64-bit binaries (for platforms that support it), e.g. --with-target-bits=32 @<:@guessed@:>@])])
2012-09-18 18:29:16 +00:00
# We have three types of compiles:
# native == normal compilation, target system == build system
# cross == traditional cross compilation, target system != build system; special toolchain needed
# reduced == using native compilers, but with special flags (e.g. -m32) to produce 32-bit builds on 64-bit machines
#
if test "x$OPENJDK_BUILD_AUTOCONF_NAME" != "x$OPENJDK_TARGET_AUTOCONF_NAME"; then
# We're doing a proper cross-compilation
COMPILE_TYPE="cross"
else
COMPILE_TYPE="native"
fi
if test "x$with_target_bits" != x; then
if test "x$COMPILE_TYPE" = "xcross"; then
AC_MSG_ERROR([It is not possible to combine --with-target-bits=X and proper cross-compilation. Choose either.])
fi
if test "x$with_target_bits" = x32 && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
# A reduced build is requested
COMPILE_TYPE="reduced"
OPENJDK_TARGET_CPU_BITS=32
if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86"; then
OPENJDK_TARGET_CPU=x86
elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then
OPENJDK_TARGET_CPU=sparc
else
AC_MSG_ERROR([Reduced build (--with-target-bits=32) is only supported on x86_64 and sparcv9])
2013-10-10 12:58:19 +00:00
fi
2012-09-18 18:29:16 +00:00
elif test "x$with_target_bits" = x64 && test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
AC_MSG_ERROR([It is not possible to use --with-target-bits=64 on a 32 bit system. Use proper cross-compilation instead.])
elif test "x$with_target_bits" = "x$OPENJDK_TARGET_CPU_BITS"; then
AC_MSG_NOTICE([--with-target-bits are set to build platform address size; argument has no meaning])
else
AC_MSG_ERROR([--with-target-bits can only be 32 or 64, you specified $with_target_bits!])
fi
fi
AC_SUBST(COMPILE_TYPE)
2013-10-10 12:58:19 +00:00
AC_MSG_CHECKING([compilation type])
AC_MSG_RESULT([$COMPILE_TYPE])
2012-09-18 18:29:16 +00:00
])
2013-10-10 12:58:19 +00:00
# Setup the legacy variables, for controlling the old makefiles.
#
2012-09-18 18:29:16 +00:00
AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS],
[
2016-04-08 11:14:23 +00:00
PLATFORM_SETUP_LEGACY_VARS_HELPER([TARGET])
PLATFORM_SETUP_LEGACY_VARS_HELPER([BUILD])
])
2013-10-10 12:58:19 +00:00
2016-04-08 11:14:23 +00:00
# $1 - Either TARGET or BUILD to setup the variables for.
AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS_HELPER],
[
2016-03-17 19:03:53 +00:00
# Also store the legacy naming of the cpu.
# Ie i586 and amd64 instead of x86 and x86_64
2016-04-08 11:14:23 +00:00
OPENJDK_$1_CPU_LEGACY="$OPENJDK_$1_CPU"
if test "x$OPENJDK_$1_CPU" = xx86; then
OPENJDK_$1_CPU_LEGACY="i586"
elif test "x$OPENJDK_$1_OS" != xmacosx && test "x$OPENJDK_$1_CPU" = xx86_64; then
2016-03-17 19:03:53 +00:00
# On all platforms except MacOSX replace x86_64 with amd64.
2016-04-08 11:14:23 +00:00
OPENJDK_$1_CPU_LEGACY="amd64"
2017-08-31 13:47:12 +00:00
elif test "x$OPENJDK_$1_CPU" = xalpha; then
# Avoid name collisions with variables named alpha
OPENJDK_$1_CPU_LEGACY="_alpha_"
elif test "x$OPENJDK_$1_CPU" = xsh; then
# Avoid name collisions with variables named sh
OPENJDK_$1_CPU_LEGACY="_sh_"
2016-03-17 19:03:53 +00:00
fi
2016-04-08 11:14:23 +00:00
AC_SUBST(OPENJDK_$1_CPU_LEGACY)
2016-03-17 19:03:53 +00:00
# And the second legacy naming of the cpu.
# Ie i386 and amd64 instead of x86 and x86_64.
2016-04-08 11:14:23 +00:00
OPENJDK_$1_CPU_LEGACY_LIB="$OPENJDK_$1_CPU"
if test "x$OPENJDK_$1_CPU" = xx86; then
OPENJDK_$1_CPU_LEGACY_LIB="i386"
elif test "x$OPENJDK_$1_CPU" = xx86_64; then
OPENJDK_$1_CPU_LEGACY_LIB="amd64"
2016-03-17 19:03:53 +00:00
fi
2016-04-08 11:14:23 +00:00
AC_SUBST(OPENJDK_$1_CPU_LEGACY_LIB)
2016-03-17 19:03:53 +00:00
2016-04-08 11:14:23 +00:00
# Setup OPENJDK_$1_CPU_OSARCH, which is used to set the os.arch Java system property
OPENJDK_$1_CPU_OSARCH="$OPENJDK_$1_CPU"
if test "x$OPENJDK_$1_OS" = xlinux && test "x$OPENJDK_$1_CPU" = xx86; then
2013-10-10 12:58:19 +00:00
# On linux only, we replace x86 with i386.
2016-04-08 11:14:23 +00:00
OPENJDK_$1_CPU_OSARCH="i386"
elif test "x$OPENJDK_$1_OS" != xmacosx && test "x$OPENJDK_$1_CPU" = xx86_64; then
2013-10-10 12:58:19 +00:00
# On all platforms except macosx, we replace x86_64 with amd64.
2016-04-08 11:14:23 +00:00
OPENJDK_$1_CPU_OSARCH="amd64"
2013-10-10 12:58:19 +00:00
fi
2016-04-08 11:14:23 +00:00
AC_SUBST(OPENJDK_$1_CPU_OSARCH)
2012-09-18 18:29:16 +00:00
2016-04-08 11:14:23 +00:00
OPENJDK_$1_CPU_JLI="$OPENJDK_$1_CPU"
if test "x$OPENJDK_$1_CPU" = xx86; then
OPENJDK_$1_CPU_JLI="i386"
elif test "x$OPENJDK_$1_OS" != xmacosx && test "x$OPENJDK_$1_CPU" = xx86_64; then
2016-03-17 19:03:53 +00:00
# On all platforms except macosx, we replace x86_64 with amd64.
2016-04-08 11:14:23 +00:00
OPENJDK_$1_CPU_JLI="amd64"
2016-03-17 19:03:53 +00:00
fi
2016-05-04 13:29:01 +00:00
# The new version string in JDK 9 also defined new naming of OS and ARCH for bundles
2021-04-30 19:05:39 +00:00
# The macOS bundle name was revised in JDK 17
#
# macosx is macos and x86_64 is x64
2016-05-04 13:29:01 +00:00
if test "x$OPENJDK_$1_OS" = xmacosx; then
2021-04-30 19:05:39 +00:00
OPENJDK_$1_OS_BUNDLE="macos"
2016-05-04 13:29:01 +00:00
else
OPENJDK_$1_OS_BUNDLE="$OPENJDK_TARGET_OS"
fi
if test "x$OPENJDK_$1_CPU" = xx86_64; then
OPENJDK_$1_CPU_BUNDLE="x64"
else
OPENJDK_$1_CPU_BUNDLE="$OPENJDK_$1_CPU"
fi
2020-10-13 09:35:58 +00:00
OPENJDK_$1_LIBC_BUNDLE=""
if test "x$OPENJDK_$1_LIBC" = "xmusl"; then
OPENJDK_$1_LIBC_BUNDLE="-$OPENJDK_$1_LIBC"
fi
OPENJDK_$1_BUNDLE_PLATFORM="${OPENJDK_$1_OS_BUNDLE}-${OPENJDK_$1_CPU_BUNDLE}${OPENJDK_$1_LIBC_BUNDLE}"
2016-05-04 13:29:01 +00:00
AC_SUBST(OPENJDK_$1_BUNDLE_PLATFORM)
2013-10-10 12:58:19 +00:00
if test "x$COMPILE_TYPE" = "xcross"; then
# FIXME: ... or should this include reduced builds..?
2016-04-08 11:14:23 +00:00
DEFINE_CROSS_COMPILE_ARCH="CROSS_COMPILE_ARCH:=$OPENJDK_$1_CPU_LEGACY"
2013-10-10 12:58:19 +00:00
else
DEFINE_CROSS_COMPILE_ARCH=""
fi
AC_SUBST(DEFINE_CROSS_COMPILE_ARCH)
2016-04-08 11:14:23 +00:00
# Convert openjdk platform names to hotspot names
HOTSPOT_$1_OS=${OPENJDK_$1_OS}
if test "x$OPENJDK_$1_OS" = xmacosx; then
HOTSPOT_$1_OS=bsd
fi
AC_SUBST(HOTSPOT_$1_OS)
HOTSPOT_$1_OS_TYPE=${OPENJDK_$1_OS_TYPE}
if test "x$OPENJDK_$1_OS_TYPE" = xunix; then
HOTSPOT_$1_OS_TYPE=posix
fi
AC_SUBST(HOTSPOT_$1_OS_TYPE)
HOTSPOT_$1_CPU=${OPENJDK_$1_CPU}
if test "x$OPENJDK_$1_CPU" = xx86; then
HOTSPOT_$1_CPU=x86_32
elif test "x$OPENJDK_$1_CPU" = xsparcv9; then
HOTSPOT_$1_CPU=sparc
elif test "x$OPENJDK_$1_CPU" = xppc64; then
HOTSPOT_$1_CPU=ppc_64
2016-04-13 09:13:14 +00:00
elif test "x$OPENJDK_$1_CPU" = xppc64le; then
HOTSPOT_$1_CPU=ppc_64
2016-04-08 11:14:23 +00:00
fi
AC_SUBST(HOTSPOT_$1_CPU)
# This is identical with OPENJDK_*, but define anyway for consistency.
HOTSPOT_$1_CPU_ARCH=${OPENJDK_$1_CPU_ARCH}
AC_SUBST(HOTSPOT_$1_CPU_ARCH)
# Setup HOTSPOT_$1_CPU_DEFINE
if test "x$OPENJDK_$1_CPU" = xx86; then
HOTSPOT_$1_CPU_DEFINE=IA32
elif test "x$OPENJDK_$1_CPU" = xx86_64; then
HOTSPOT_$1_CPU_DEFINE=AMD64
2018-09-05 09:15:28 +00:00
elif test "x$OPENJDK_$1_CPU" = xx32; then
HOTSPOT_$1_CPU_DEFINE=X32
2016-04-08 11:14:23 +00:00
elif test "x$OPENJDK_$1_CPU" = xsparcv9; then
HOTSPOT_$1_CPU_DEFINE=SPARC
elif test "x$OPENJDK_$1_CPU" = xaarch64; then
HOTSPOT_$1_CPU_DEFINE=AARCH64
elif test "x$OPENJDK_$1_CPU" = xppc64; then
2016-04-13 09:13:14 +00:00
HOTSPOT_$1_CPU_DEFINE=PPC64
elif test "x$OPENJDK_$1_CPU" = xppc64le; then
2016-04-08 11:14:23 +00:00
HOTSPOT_$1_CPU_DEFINE=PPC64
2022-03-24 09:22:46 +00:00
elif test "x$OPENJDK_$1_CPU" = xriscv64; then
HOTSPOT_$1_CPU_DEFINE=RISCV64
2016-04-08 11:14:23 +00:00
# The cpu defines below are for zero, we don't support them directly.
elif test "x$OPENJDK_$1_CPU" = xsparc; then
HOTSPOT_$1_CPU_DEFINE=SPARC
elif test "x$OPENJDK_$1_CPU" = xppc; then
HOTSPOT_$1_CPU_DEFINE=PPC32
2023-08-28 11:10:53 +00:00
elif test "x$OPENJDK_$1_CPU" = xriscv32; then
HOTSPOT_$1_CPU_DEFINE=RISCV32
2016-04-08 11:14:23 +00:00
elif test "x$OPENJDK_$1_CPU" = xs390; then
HOTSPOT_$1_CPU_DEFINE=S390
2016-05-02 13:05:54 +00:00
elif test "x$OPENJDK_$1_CPU" = xs390x; then
2016-04-08 11:14:23 +00:00
HOTSPOT_$1_CPU_DEFINE=S390
2023-08-28 11:10:53 +00:00
elif test "x$OPENJDK_$1_CPU" = xloongarch64; then
HOTSPOT_$1_CPU_DEFINE=LOONGARCH64
2016-09-01 08:29:37 +00:00
elif test "x$OPENJDK_$1_CPU" != x; then
HOTSPOT_$1_CPU_DEFINE=$(echo $OPENJDK_$1_CPU | tr a-z A-Z)
2016-04-08 11:14:23 +00:00
fi
AC_SUBST(HOTSPOT_$1_CPU_DEFINE)
2020-10-13 09:35:58 +00:00
HOTSPOT_$1_LIBC=$OPENJDK_$1_LIBC
AC_SUBST(HOTSPOT_$1_LIBC)
2017-12-20 17:14:06 +00:00
# For historical reasons, the OS include directories have odd names.
OPENJDK_$1_OS_INCLUDE_SUBDIR="$OPENJDK_TARGET_OS"
if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
OPENJDK_$1_OS_INCLUDE_SUBDIR="win32"
elif test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
OPENJDK_$1_OS_INCLUDE_SUBDIR="darwin"
fi
AC_SUBST(OPENJDK_$1_OS_INCLUDE_SUBDIR)
2012-09-18 18:29:16 +00:00
])
2017-05-04 07:26:16 +00:00
AC_DEFUN([PLATFORM_SET_RELEASE_FILE_OS_VALUES],
[
if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
RELEASE_FILE_OS_NAME=Linux
fi
if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
RELEASE_FILE_OS_NAME=Windows
fi
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
RELEASE_FILE_OS_NAME="Darwin"
fi
if test "x$OPENJDK_TARGET_OS" = "xaix"; then
RELEASE_FILE_OS_NAME="AIX"
fi
RELEASE_FILE_OS_ARCH=${OPENJDK_TARGET_CPU}
2020-10-13 09:35:58 +00:00
RELEASE_FILE_LIBC=${OPENJDK_TARGET_LIBC}
2017-05-04 07:26:16 +00:00
AC_SUBST(RELEASE_FILE_OS_NAME)
AC_SUBST(RELEASE_FILE_OS_ARCH)
2020-10-13 09:35:58 +00:00
AC_SUBST(RELEASE_FILE_LIBC)
2017-05-04 07:26:16 +00:00
])
2017-04-20 15:00:18 +00:00
AC_DEFUN([PLATFORM_SET_MODULE_TARGET_OS_VALUES],
2012-06-08 03:25:06 +00:00
[
2017-04-20 15:00:18 +00:00
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
OPENJDK_MODULE_TARGET_OS_NAME="macos"
else
OPENJDK_MODULE_TARGET_OS_NAME="$OPENJDK_TARGET_OS"
2013-10-10 12:58:19 +00:00
fi
2017-04-20 15:00:18 +00:00
if test "x$OPENJDK_TARGET_CPU" = xx86_64; then
OPENJDK_MODULE_TARGET_OS_ARCH="amd64"
else
OPENJDK_MODULE_TARGET_OS_ARCH="$OPENJDK_TARGET_CPU"
2016-03-09 10:15:04 +00:00
fi
2012-06-08 03:25:06 +00:00
2017-05-04 07:26:16 +00:00
OPENJDK_MODULE_TARGET_PLATFORM="${OPENJDK_MODULE_TARGET_OS_NAME}-${OPENJDK_MODULE_TARGET_OS_ARCH}"
AC_SUBST(OPENJDK_MODULE_TARGET_PLATFORM)
2012-06-08 03:25:06 +00:00
])
2012-07-03 23:11:12 +00:00
#%%% Build and target systems %%%
2023-04-25 14:20:50 +00:00
# Make sure to only use tools set up in BASIC_SETUP_FUNDAMENTAL_TOOLS.
2012-07-03 23:11:12 +00:00
AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_AND_TARGET],
[
2013-10-10 12:58:19 +00:00
# Figure out the build and target systems. # Note that in autoconf terminology, "build" is obvious, but "target"
# is confusing; it assumes you are cross-compiling a cross-compiler (!) and "target" is thus the target of the
# product you're building. The target of this build is called "host". Since this is confusing to most people, we
# have not adopted that system, but use "target" as the platform we are building for. In some places though we need
# to use the configure naming style.
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
PLATFORM_EXTRACT_TARGET_AND_BUILD
PLATFORM_SETUP_TARGET_CPU_BITS
2017-04-20 15:00:18 +00:00
PLATFORM_SET_MODULE_TARGET_OS_VALUES
2017-05-04 07:26:16 +00:00
PLATFORM_SET_RELEASE_FILE_OS_VALUES
2013-10-10 12:58:19 +00:00
PLATFORM_SETUP_LEGACY_VARS
2023-05-22 15:44:52 +00:00
PLATFORM_CHECK_DEPRECATION
])
2023-06-14 13:26:54 +00:00
AC_DEFUN([PLATFORM_CHECK_DEPRECATION],
2023-05-22 15:44:52 +00:00
[
AC_ARG_ENABLE(deprecated-ports, [AS_HELP_STRING([--enable-deprecated-ports@<:@=yes/no@:>@],
2024-08-30 08:58:18 +00:00
[Suppress the error when configuring for a deprecated port @<:@no@:>@])])
2024-11-13 09:41:57 +00:00
# if test "x$OPENJDK_TARGET_CPU" = xx86; then
# if test "x$enable_deprecated_ports" = "xyes"; then
# AC_MSG_WARN([The x86 port is deprecated and may be removed in a future release.])
# else
# AC_MSG_ERROR(m4_normalize([The 32-bit x86 port is deprecated and may be removed in a future release.
# Use --enable-deprecated-ports=yes to suppress this error.]))
# fi
# fi
2012-07-03 23:11:12 +00:00
])
AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_OS_VERSION],
[
2024-09-03 15:31:09 +00:00
##############################################################################
2012-07-03 23:11:12 +00:00
2013-10-10 12:58:19 +00:00
# Note that this is the build platform OS version!
2012-07-03 23:11:12 +00:00
2013-10-10 12:58:19 +00:00
OS_VERSION="`uname -r | ${SED} 's!\.! !g' | ${SED} 's!-! !g'`"
OS_VERSION_MAJOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 1 -d ' '`"
OS_VERSION_MINOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 2 -d ' '`"
OS_VERSION_MICRO="`${ECHO} ${OS_VERSION} | ${CUT} -f 3 -d ' '`"
AC_SUBST(OS_VERSION_MAJOR)
AC_SUBST(OS_VERSION_MINOR)
AC_SUBST(OS_VERSION_MICRO)
2012-07-03 23:11:12 +00:00
])
2012-09-18 18:29:16 +00:00
AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS],
2012-07-03 23:11:12 +00:00
[
2024-09-03 15:31:09 +00:00
##############################################################################
2013-10-10 12:58:19 +00:00
#
# Now we check if libjvm.so will use 32 or 64 bit pointers for the C/C++ code.
# (The JVM can use 32 or 64 bit Java pointers but that decision
# is made at runtime.)
#
2013-04-29 16:34:30 +00:00
2013-10-10 12:58:19 +00:00
# Make compilation sanity check
AC_CHECK_HEADERS([stdio.h], , [
AC_MSG_NOTICE([Failed to compile stdio.h. This likely implies missing compile dependencies.])
if test "x$COMPILE_TYPE" = xreduced; then
2015-09-30 09:38:01 +00:00
HELP_MSG_MISSING_DEPENDENCY([reduced])
AC_MSG_NOTICE([You are doing a reduced build. Check that you have 32-bit libraries installed. $HELP_MSG])
2013-10-10 12:58:19 +00:00
elif test "x$COMPILE_TYPE" = xcross; then
AC_MSG_NOTICE([You are doing a cross-compilation. Check that you have all target platform libraries installed.])
fi
AC_MSG_ERROR([Cannot continue.])
])
AC_CHECK_SIZEOF([int *], [1111])
2012-07-03 23:11:12 +00:00
2013-11-06 01:33:48 +00:00
# AC_CHECK_SIZEOF defines 'ac_cv_sizeof_int_p' to hold the number of bytes used by an 'int*'
if test "x$ac_cv_sizeof_int_p" = x; then
2012-09-18 18:29:16 +00:00
# The test failed, lets stick to the assumed value.
AC_MSG_WARN([The number of bits in the target could not be determined, using $OPENJDK_TARGET_CPU_BITS.])
2013-10-10 12:58:19 +00:00
else
2013-09-12 19:29:17 +00:00
TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p`
2012-07-03 23:11:12 +00:00
2012-09-18 18:29:16 +00:00
if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then
2018-03-02 09:59:25 +00:00
AC_MSG_NOTICE([The tested number of bits in the target ($TESTED_TARGET_CPU_BITS) differs from the number of bits expected to be found in the target ($OPENJDK_TARGET_CPU_BITS)])
if test "x$COMPILE_TYPE" = xreduced; then
HELP_MSG_MISSING_DEPENDENCY([reduced])
AC_MSG_NOTICE([You are doing a reduced build. Check that you have 32-bit libraries installed. $HELP_MSG])
elif test "x$COMPILE_TYPE" = xcross; then
AC_MSG_NOTICE([You are doing a cross-compilation. Check that you have all target platform libraries installed.])
2013-11-06 01:33:48 +00:00
fi
2018-03-02 09:59:25 +00:00
AC_MSG_ERROR([Cannot continue.])
2012-09-18 18:29:16 +00:00
fi
2013-10-10 12:58:19 +00:00
fi
2012-07-03 23:11:12 +00:00
2013-10-10 12:58:19 +00:00
AC_MSG_CHECKING([for target address size])
AC_MSG_RESULT([$OPENJDK_TARGET_CPU_BITS bits])
2012-07-03 23:11:12 +00:00
])
AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_ENDIANNESS],
[
2024-09-03 15:31:09 +00:00
##############################################################################
2013-10-10 12:58:19 +00:00
#
2023-04-25 14:20:50 +00:00
# Is the target little or big endian?
2013-10-10 12:58:19 +00:00
#
AC_C_BIGENDIAN([ENDIAN="big"],[ENDIAN="little"],[ENDIAN="unknown"],[ENDIAN="universal_endianness"])
2012-07-03 23:11:12 +00:00
2013-10-10 12:58:19 +00:00
if test "x$ENDIAN" = xuniversal_endianness; then
2012-07-03 23:11:12 +00:00
AC_MSG_ERROR([Building with both big and little endianness is not supported])
2013-10-10 12:58:19 +00:00
fi
if test "x$ENDIAN" != "x$OPENJDK_TARGET_CPU_ENDIAN"; then
2012-09-18 18:29:16 +00:00
AC_MSG_ERROR([The tested endian in the target ($ENDIAN) differs from the endian expected to be found in the target ($OPENJDK_TARGET_CPU_ENDIAN)])
2013-10-10 12:58:19 +00:00
fi
2012-07-03 23:11:12 +00:00
])