platform.m4 revision 2024:cc16e2a24f94
1310419Sdelphij# 2275970Scy# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. 3275970Scy# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4275970Scy# 5275970Scy# This code is free software; you can redistribute it and/or modify it 6310419Sdelphij# under the terms of the GNU General Public License version 2 only, as 7275970Scy# published by the Free Software Foundation. Oracle designates this 8275970Scy# particular file as subject to the "Classpath" exception as provided 9275970Scy# by Oracle in the LICENSE file that accompanied this code. 10275970Scy# 11275970Scy# This code is distributed in the hope that it will be useful, but WITHOUT 12275970Scy# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13275970Scy# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14275970Scy# version 2 for more details (a copy is included in the LICENSE file that 15275970Scy# accompanied this code). 16275970Scy# 17275970Scy# You should have received a copy of the GNU General Public License version 18275970Scy# 2 along with this work; if not, write to the Free Software Foundation, 19275970Scy# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20275970Scy# 21275970Scy# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22275970Scy# or visit www.oracle.com if you need additional information or have any 23275970Scy# questions. 24275970Scy# 25275970Scy 26275970Scy# Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD. 27275970Scy# Converts autoconf style CPU name to OpenJDK style, into 28275970Scy# VAR_CPU, VAR_CPU_ARCH, VAR_CPU_BITS and VAR_CPU_ENDIAN. 29275970ScyAC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU], 30275970Scy[ 31275970Scy # First argument is the cpu name from the trip/quad 32275970Scy case "$1" in 33275970Scy x86_64) 34275970Scy VAR_CPU=x86_64 35275970Scy VAR_CPU_ARCH=x86 36275970Scy VAR_CPU_BITS=64 37275970Scy VAR_CPU_ENDIAN=little 38275970Scy ;; 39275970Scy i?86) 40275970Scy VAR_CPU=x86 41275970Scy VAR_CPU_ARCH=x86 42275970Scy VAR_CPU_BITS=32 43275970Scy VAR_CPU_ENDIAN=little 44275970Scy ;; 45275970Scy arm*) 46275970Scy VAR_CPU=arm 47275970Scy VAR_CPU_ARCH=arm 48275970Scy VAR_CPU_BITS=32 49275970Scy VAR_CPU_ENDIAN=little 50275970Scy ;; 51275970Scy aarch64) 52275970Scy VAR_CPU=aarch64 53275970Scy VAR_CPU_ARCH=aarch64 54275970Scy VAR_CPU_BITS=64 55275970Scy VAR_CPU_ENDIAN=little 56275970Scy ;; 57275970Scy powerpc) 58275970Scy VAR_CPU=ppc 59275970Scy VAR_CPU_ARCH=ppc 60275970Scy VAR_CPU_BITS=32 61275970Scy VAR_CPU_ENDIAN=big 62275970Scy ;; 63275970Scy powerpc64) 64275970Scy VAR_CPU=ppc64 65275970Scy VAR_CPU_ARCH=ppc 66275970Scy VAR_CPU_BITS=64 67275970Scy VAR_CPU_ENDIAN=big 68275970Scy ;; 69275970Scy powerpc64le) 70275970Scy VAR_CPU=ppc64le 71275970Scy VAR_CPU_ARCH=ppc 72275970Scy VAR_CPU_BITS=64 73275970Scy VAR_CPU_ENDIAN=little 74275970Scy ;; 75275970Scy s390) 76275970Scy VAR_CPU=s390 77275970Scy VAR_CPU_ARCH=s390 78275970Scy VAR_CPU_BITS=32 79275970Scy VAR_CPU_ENDIAN=big 80275970Scy ;; 81275970Scy s390x) 82275970Scy VAR_CPU=s390x 83275970Scy VAR_CPU_ARCH=s390 84275970Scy VAR_CPU_BITS=64 85275970Scy VAR_CPU_ENDIAN=big 86275970Scy ;; 87275970Scy sparc) 88275970Scy VAR_CPU=sparc 89275970Scy VAR_CPU_ARCH=sparc 90275970Scy VAR_CPU_BITS=32 91275970Scy VAR_CPU_ENDIAN=big 92275970Scy ;; 93275970Scy sparcv9|sparc64) 94275970Scy VAR_CPU=sparcv9 95275970Scy VAR_CPU_ARCH=sparc 96275970Scy VAR_CPU_BITS=64 97275970Scy VAR_CPU_ENDIAN=big 98275970Scy ;; 99275970Scy *) 100275970Scy AC_MSG_ERROR([unsupported cpu $1]) 101275970Scy ;; 102275970Scy esac 103275970Scy]) 104275970Scy 105275970Scy# Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD. 106275970Scy# Converts autoconf style OS name to OpenJDK style, into 107275970Scy# VAR_OS, VAR_OS_TYPE and VAR_OS_ENV. 108275970ScyAC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_OS], 109275970Scy[ 110275970Scy case "$1" in 111275970Scy *linux*) 112275970Scy VAR_OS=linux 113275970Scy VAR_OS_TYPE=unix 114298770Sdelphij ;; 115298770Sdelphij *solaris*) 116298770Sdelphij VAR_OS=solaris 117298770Sdelphij VAR_OS_TYPE=unix 118298770Sdelphij ;; 119298770Sdelphij *darwin*) 120298770Sdelphij VAR_OS=macosx 121298770Sdelphij VAR_OS_TYPE=unix 122275970Scy ;; 123275970Scy *bsd*) 124275970Scy VAR_OS=bsd 125275970Scy VAR_OS_TYPE=unix 126275970Scy ;; 127275970Scy *cygwin*) 128275970Scy VAR_OS=windows 129275970Scy VAR_OS_ENV=windows.cygwin 130275970Scy ;; 131275970Scy *mingw*) 132275970Scy VAR_OS=windows 133275970Scy VAR_OS_ENV=windows.msys 134275970Scy ;; 135275970Scy *aix*) 136275970Scy VAR_OS=aix 137275970Scy VAR_OS_TYPE=unix 138275970Scy ;; 139275970Scy *) 140275970Scy AC_MSG_ERROR([unsupported operating system $1]) 141275970Scy ;; 142275970Scy esac 143275970Scy]) 144275970Scy 145275970Scy# Expects $host_os $host_cpu $build_os and $build_cpu 146275970Scy# and $with_target_bits to have been setup! 147275970Scy# 148275970Scy# Translate the standard triplet(quadruplet) definition 149275970Scy# of the target/build system into OPENJDK_TARGET_OS, OPENJDK_TARGET_CPU, 150275970Scy# OPENJDK_BUILD_OS, etc. 151275970ScyAC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD], 152275970Scy[ 153275970Scy # Copy the autoconf trip/quadruplet verbatim to OPENJDK_TARGET_AUTOCONF_NAME 154275970Scy # (from the autoconf "host") and OPENJDK_BUILD_AUTOCONF_NAME 155275970Scy # Note that we might later on rewrite e.g. OPENJDK_TARGET_CPU due to reduced build, 156298770Sdelphij # but this will not change the value of OPENJDK_TARGET_AUTOCONF_NAME. 157275970Scy OPENJDK_TARGET_AUTOCONF_NAME="$host" 158275970Scy OPENJDK_BUILD_AUTOCONF_NAME="$build" 159275970Scy AC_SUBST(OPENJDK_TARGET_AUTOCONF_NAME) 160275970Scy AC_SUBST(OPENJDK_BUILD_AUTOCONF_NAME) 161275970Scy 162275970Scy # Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables. 163275970Scy PLATFORM_EXTRACT_VARS_FROM_OS($build_os) 164298770Sdelphij PLATFORM_EXTRACT_VARS_FROM_CPU($build_cpu) 165298770Sdelphij # ..and setup our own variables. (Do this explicitely to facilitate searching) 166275970Scy OPENJDK_BUILD_OS="$VAR_OS" 167275970Scy if test "x$VAR_OS_TYPE" != x; then 168275970Scy OPENJDK_BUILD_OS_TYPE="$VAR_OS_TYPE" 169275970Scy else 170275970Scy OPENJDK_BUILD_OS_TYPE="$VAR_OS" 171275970Scy fi 172275970Scy if test "x$VAR_OS_ENV" != x; then 173298770Sdelphij OPENJDK_BUILD_OS_ENV="$VAR_OS_ENV" 174275970Scy else 175275970Scy OPENJDK_BUILD_OS_ENV="$VAR_OS" 176275970Scy fi 177275970Scy OPENJDK_BUILD_CPU="$VAR_CPU" 178275970Scy OPENJDK_BUILD_CPU_ARCH="$VAR_CPU_ARCH" 179275970Scy OPENJDK_BUILD_CPU_BITS="$VAR_CPU_BITS" 180275970Scy OPENJDK_BUILD_CPU_ENDIAN="$VAR_CPU_ENDIAN" 181275970Scy AC_SUBST(OPENJDK_BUILD_OS) 182275970Scy AC_SUBST(OPENJDK_BUILD_OS_TYPE) 183275970Scy AC_SUBST(OPENJDK_BUILD_OS_ENV) 184275970Scy AC_SUBST(OPENJDK_BUILD_CPU) 185275970Scy AC_SUBST(OPENJDK_BUILD_CPU_ARCH) 186275970Scy AC_SUBST(OPENJDK_BUILD_CPU_BITS) 187275970Scy AC_SUBST(OPENJDK_BUILD_CPU_ENDIAN) 188275970Scy 189275970Scy AC_MSG_CHECKING([openjdk-build os-cpu]) 190275970Scy AC_MSG_RESULT([$OPENJDK_BUILD_OS-$OPENJDK_BUILD_CPU]) 191275970Scy 192275970Scy # Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables. 193275970Scy PLATFORM_EXTRACT_VARS_FROM_OS($host_os) 194275970Scy PLATFORM_EXTRACT_VARS_FROM_CPU($host_cpu) 195275970Scy # ... and setup our own variables. (Do this explicitely to facilitate searching) 196275970Scy OPENJDK_TARGET_OS="$VAR_OS" 197275970Scy if test "x$VAR_OS_TYPE" != x; then 198275970Scy OPENJDK_TARGET_OS_TYPE="$VAR_OS_TYPE" 199275970Scy else 200275970Scy OPENJDK_TARGET_OS_TYPE="$VAR_OS" 201275970Scy fi 202275970Scy if test "x$VAR_OS_ENV" != x; then 203275970Scy OPENJDK_TARGET_OS_ENV="$VAR_OS_ENV" 204275970Scy else 205275970Scy OPENJDK_TARGET_OS_ENV="$VAR_OS" 206275970Scy fi 207275970Scy OPENJDK_TARGET_CPU="$VAR_CPU" 208275970Scy OPENJDK_TARGET_CPU_ARCH="$VAR_CPU_ARCH" 209275970Scy OPENJDK_TARGET_CPU_BITS="$VAR_CPU_BITS" 210275970Scy OPENJDK_TARGET_CPU_ENDIAN="$VAR_CPU_ENDIAN" 211275970Scy AC_SUBST(OPENJDK_TARGET_OS) 212275970Scy AC_SUBST(OPENJDK_TARGET_OS_TYPE) 213275970Scy AC_SUBST(OPENJDK_TARGET_OS_ENV) 214275970Scy AC_SUBST(OPENJDK_TARGET_CPU) 215275970Scy AC_SUBST(OPENJDK_TARGET_CPU_ARCH) 216275970Scy AC_SUBST(OPENJDK_TARGET_CPU_BITS) 217275970Scy AC_SUBST(OPENJDK_TARGET_CPU_ENDIAN) 218275970Scy 219275970Scy AC_MSG_CHECKING([openjdk-target os-cpu]) 220275970Scy AC_MSG_RESULT([$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU]) 221275970Scy]) 222275970Scy 223275970Scy# Check if a reduced build (32-bit on 64-bit platforms) is requested, and modify behaviour 224275970Scy# accordingly. Must be done after setting up build and target system, but before 225275970Scy# doing anything else with these values. 226275970ScyAC_DEFUN([PLATFORM_SETUP_TARGET_CPU_BITS], 227275970Scy[ 228275970Scy AC_ARG_WITH(target-bits, [AS_HELP_STRING([--with-target-bits], 229275970Scy [build 32-bit or 64-bit binaries (for platforms that support it), e.g. --with-target-bits=32 @<:@guessed@:>@])]) 230275970Scy 231275970Scy # We have three types of compiles: 232275970Scy # native == normal compilation, target system == build system 233275970Scy # cross == traditional cross compilation, target system != build system; special toolchain needed 234275970Scy # reduced == using native compilers, but with special flags (e.g. -m32) to produce 32-bit builds on 64-bit machines 235275970Scy # 236275970Scy if test "x$OPENJDK_BUILD_AUTOCONF_NAME" != "x$OPENJDK_TARGET_AUTOCONF_NAME"; then 237275970Scy # We're doing a proper cross-compilation 238275970Scy COMPILE_TYPE="cross" 239275970Scy else 240275970Scy COMPILE_TYPE="native" 241275970Scy fi 242275970Scy 243275970Scy if test "x$with_target_bits" != x; then 244275970Scy if test "x$COMPILE_TYPE" = "xcross"; then 245275970Scy AC_MSG_ERROR([It is not possible to combine --with-target-bits=X and proper cross-compilation. Choose either.]) 246275970Scy fi 247275970Scy 248275970Scy if test "x$with_target_bits" = x32 && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then 249275970Scy # A reduced build is requested 250275970Scy COMPILE_TYPE="reduced" 251275970Scy OPENJDK_TARGET_CPU_BITS=32 252275970Scy if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86"; then 253275970Scy OPENJDK_TARGET_CPU=x86 254275970Scy elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then 255275970Scy OPENJDK_TARGET_CPU=sparc 256275970Scy else 257275970Scy AC_MSG_ERROR([Reduced build (--with-target-bits=32) is only supported on x86_64 and sparcv9]) 258275970Scy fi 259275970Scy elif test "x$with_target_bits" = x64 && test "x$OPENJDK_TARGET_CPU_BITS" = x32; then 260275970Scy AC_MSG_ERROR([It is not possible to use --with-target-bits=64 on a 32 bit system. Use proper cross-compilation instead.]) 261275970Scy elif test "x$with_target_bits" = "x$OPENJDK_TARGET_CPU_BITS"; then 262275970Scy AC_MSG_NOTICE([--with-target-bits are set to build platform address size; argument has no meaning]) 263275970Scy else 264275970Scy AC_MSG_ERROR([--with-target-bits can only be 32 or 64, you specified $with_target_bits!]) 265275970Scy fi 266275970Scy fi 267275970Scy AC_SUBST(COMPILE_TYPE) 268275970Scy 269275970Scy AC_MSG_CHECKING([compilation type]) 270275970Scy AC_MSG_RESULT([$COMPILE_TYPE]) 271275970Scy]) 272275970Scy 273275970Scy# Setup the legacy variables, for controlling the old makefiles. 274275970Scy# 275275970ScyAC_DEFUN([PLATFORM_SETUP_LEGACY_VARS], 276275970Scy[ 277275970Scy PLATFORM_SETUP_LEGACY_VARS_HELPER([TARGET]) 278275970Scy PLATFORM_SETUP_LEGACY_VARS_HELPER([BUILD]) 279275970Scy 280275970Scy # ZERO_ARCHDEF is used to enable architecture-specific code. 281275970Scy # This is used in legacy hotspot build. 282275970Scy ZERO_ARCHDEF="$HOTSPOT_TARGET_CPU_DEFINE" 283275970Scy AC_SUBST(ZERO_ARCHDEF) 284275970Scy 285275970Scy]) 286275970Scy 287275970Scy# $1 - Either TARGET or BUILD to setup the variables for. 288275970ScyAC_DEFUN([PLATFORM_SETUP_LEGACY_VARS_HELPER], 289275970Scy[ 290275970Scy # Also store the legacy naming of the cpu. 291275970Scy # Ie i586 and amd64 instead of x86 and x86_64 292275970Scy OPENJDK_$1_CPU_LEGACY="$OPENJDK_$1_CPU" 293275970Scy if test "x$OPENJDK_$1_CPU" = xx86; then 294275970Scy OPENJDK_$1_CPU_LEGACY="i586" 295275970Scy elif test "x$OPENJDK_$1_OS" != xmacosx && test "x$OPENJDK_$1_CPU" = xx86_64; then 296275970Scy # On all platforms except MacOSX replace x86_64 with amd64. 297275970Scy OPENJDK_$1_CPU_LEGACY="amd64" 298275970Scy fi 299298770Sdelphij AC_SUBST(OPENJDK_$1_CPU_LEGACY) 300298770Sdelphij 301298770Sdelphij # And the second legacy naming of the cpu. 302275970Scy # Ie i386 and amd64 instead of x86 and x86_64. 303275970Scy OPENJDK_$1_CPU_LEGACY_LIB="$OPENJDK_$1_CPU" 304275970Scy if test "x$OPENJDK_$1_CPU" = xx86; then 305275970Scy OPENJDK_$1_CPU_LEGACY_LIB="i386" 306275970Scy elif test "x$OPENJDK_$1_CPU" = xx86_64; then 307275970Scy OPENJDK_$1_CPU_LEGACY_LIB="amd64" 308275970Scy fi 309275970Scy AC_SUBST(OPENJDK_$1_CPU_LEGACY_LIB) 310275970Scy 311275970Scy # This is the name of the cpu (but using i386 and amd64 instead of 312298770Sdelphij # x86 and x86_64, respectively), preceeded by a /, to be used when 313298770Sdelphij # locating libraries. On macosx, it's empty, though. 314298770Sdelphij OPENJDK_$1_CPU_LIBDIR="/$OPENJDK_$1_CPU_LEGACY_LIB" 315275970Scy if test "x$OPENJDK_$1_OS" = xmacosx; then 316275970Scy OPENJDK_$1_CPU_LIBDIR="" 317275970Scy fi 318275970Scy AC_SUBST(OPENJDK_$1_CPU_LIBDIR) 319275970Scy 320275970Scy # OPENJDK_$1_CPU_ISADIR is normally empty. On 64-bit Solaris systems, it is set to 321275970Scy # /amd64 or /sparcv9. This string is appended to some library paths, like this: 322275970Scy # /usr/lib${OPENJDK_$1_CPU_ISADIR}/libexample.so 323275970Scy OPENJDK_$1_CPU_ISADIR="" 324275970Scy if test "x$OPENJDK_$1_OS" = xsolaris; then 325275970Scy if test "x$OPENJDK_$1_CPU" = xx86_64; then 326275970Scy OPENJDK_$1_CPU_ISADIR="/amd64" 327275970Scy elif test "x$OPENJDK_$1_CPU" = xsparcv9; then 328275970Scy OPENJDK_$1_CPU_ISADIR="/sparcv9" 329275970Scy fi 330275970Scy fi 331275970Scy AC_SUBST(OPENJDK_$1_CPU_ISADIR) 332275970Scy 333275970Scy # Setup OPENJDK_$1_CPU_OSARCH, which is used to set the os.arch Java system property 334275970Scy OPENJDK_$1_CPU_OSARCH="$OPENJDK_$1_CPU" 335275970Scy if test "x$OPENJDK_$1_OS" = xlinux && test "x$OPENJDK_$1_CPU" = xx86; then 336275970Scy # On linux only, we replace x86 with i386. 337275970Scy OPENJDK_$1_CPU_OSARCH="i386" 338275970Scy elif test "x$OPENJDK_$1_OS" != xmacosx && test "x$OPENJDK_$1_CPU" = xx86_64; then 339275970Scy # On all platforms except macosx, we replace x86_64 with amd64. 340275970Scy OPENJDK_$1_CPU_OSARCH="amd64" 341275970Scy fi 342275970Scy AC_SUBST(OPENJDK_$1_CPU_OSARCH) 343275970Scy 344275970Scy OPENJDK_$1_CPU_JLI="$OPENJDK_$1_CPU" 345275970Scy if test "x$OPENJDK_$1_CPU" = xx86; then 346275970Scy OPENJDK_$1_CPU_JLI="i386" 347298770Sdelphij elif test "x$OPENJDK_$1_OS" != xmacosx && test "x$OPENJDK_$1_CPU" = xx86_64; then 348298770Sdelphij # On all platforms except macosx, we replace x86_64 with amd64. 349298770Sdelphij OPENJDK_$1_CPU_JLI="amd64" 350298770Sdelphij fi 351298770Sdelphij # Now setup the -D flags for building libjli. 352275970Scy OPENJDK_$1_CPU_JLI_CFLAGS="-DLIBARCHNAME='\"$OPENJDK_$1_CPU_JLI\"'" 353275970Scy if test "x$OPENJDK_$1_OS" = xsolaris; then 354275970Scy if test "x$OPENJDK_$1_CPU_ARCH" = xsparc; then 355275970Scy OPENJDK_$1_CPU_JLI_CFLAGS="$OPENJDK_$1_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"sparc\"' -DLIBARCH64NAME='\"sparcv9\"'" 356275970Scy elif test "x$OPENJDK_$1_CPU_ARCH" = xx86; then 357275970Scy OPENJDK_$1_CPU_JLI_CFLAGS="$OPENJDK_$1_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"i386\"' -DLIBARCH64NAME='\"amd64\"'" 358275970Scy fi 359275970Scy fi 360275970Scy AC_SUBST(OPENJDK_$1_CPU_JLI_CFLAGS) 361275970Scy 362275970Scy if test "x$OPENJDK_$1_OS" = xmacosx; then 363275970Scy OPENJDK_$1_OS_EXPORT_DIR=macosx 364298770Sdelphij else 365298770Sdelphij OPENJDK_$1_OS_EXPORT_DIR=${OPENJDK_$1_OS_TYPE} 366298770Sdelphij fi 367298770Sdelphij AC_SUBST(OPENJDK_$1_OS_EXPORT_DIR) 368298770Sdelphij 369275970Scy if test "x$OPENJDK_$1_CPU_BITS" = x64; then 370275970Scy A_LP64="LP64:=" 371275970Scy # -D_LP64=1 is only set on linux and mac. Setting on windows causes diff in 372275970Scy # unpack200.exe 373275970Scy if test "x$OPENJDK_$1_OS" = xlinux || test "x$OPENJDK_$1_OS" = xmacosx; then 374275970Scy OPENJDK_$1_ADD_LP64="-D_LP64=1" 375275970Scy fi 376275970Scy fi 377275970Scy AC_SUBST(LP64,$A_LP64) 378275970Scy 379275970Scy if test "x$COMPILE_TYPE" = "xcross"; then 380275970Scy # FIXME: ... or should this include reduced builds..? 381275970Scy DEFINE_CROSS_COMPILE_ARCH="CROSS_COMPILE_ARCH:=$OPENJDK_$1_CPU_LEGACY" 382275970Scy else 383275970Scy DEFINE_CROSS_COMPILE_ARCH="" 384275970Scy fi 385275970Scy AC_SUBST(DEFINE_CROSS_COMPILE_ARCH) 386275970Scy 387298770Sdelphij # Convert openjdk platform names to hotspot names 388298770Sdelphij 389298770Sdelphij HOTSPOT_$1_OS=${OPENJDK_$1_OS} 390298770Sdelphij if test "x$OPENJDK_$1_OS" = xmacosx; then 391298770Sdelphij HOTSPOT_$1_OS=bsd 392298770Sdelphij fi 393275970Scy AC_SUBST(HOTSPOT_$1_OS) 394275970Scy 395275970Scy HOTSPOT_$1_OS_TYPE=${OPENJDK_$1_OS_TYPE} 396275970Scy if test "x$OPENJDK_$1_OS_TYPE" = xunix; then 397275970Scy HOTSPOT_$1_OS_TYPE=posix 398275970Scy fi 399275970Scy AC_SUBST(HOTSPOT_$1_OS_TYPE) 400275970Scy 401275970Scy HOTSPOT_$1_CPU=${OPENJDK_$1_CPU} 402275970Scy if test "x$OPENJDK_$1_CPU" = xx86; then 403275970Scy HOTSPOT_$1_CPU=x86_32 404275970Scy elif test "x$OPENJDK_$1_CPU" = xsparcv9; then 405275970Scy HOTSPOT_$1_CPU=sparc 406275970Scy elif test "x$OPENJDK_$1_CPU" = xppc64; then 407275970Scy HOTSPOT_$1_CPU=ppc_64 408275970Scy fi 409275970Scy AC_SUBST(HOTSPOT_$1_CPU) 410275970Scy 411275970Scy # This is identical with OPENJDK_*, but define anyway for consistency. 412275970Scy HOTSPOT_$1_CPU_ARCH=${OPENJDK_$1_CPU_ARCH} 413275970Scy AC_SUBST(HOTSPOT_$1_CPU_ARCH) 414275970Scy 415275970Scy # Setup HOTSPOT_$1_CPU_DEFINE 416275970Scy if test "x$OPENJDK_$1_CPU" = xx86; then 417275970Scy HOTSPOT_$1_CPU_DEFINE=IA32 418275970Scy elif test "x$OPENJDK_$1_CPU" = xx86_64; then 419275970Scy HOTSPOT_$1_CPU_DEFINE=AMD64 420275970Scy elif test "x$OPENJDK_$1_CPU" = xsparcv9; then 421275970Scy HOTSPOT_$1_CPU_DEFINE=SPARC 422275970Scy elif test "x$OPENJDK_$1_CPU" = xaarch64; then 423275970Scy HOTSPOT_$1_CPU_DEFINE=AARCH64 424275970Scy elif test "x$OPENJDK_$1_CPU" = xppc64; then 425275970Scy HOTSPOT_$1_CPU_DEFINE=PPC64 426275970Scy 427275970Scy # The cpu defines below are for zero, we don't support them directly. 428275970Scy elif test "x$OPENJDK_$1_CPU" = xsparc; then 429275970Scy HOTSPOT_$1_CPU_DEFINE=SPARC 430275970Scy elif test "x$OPENJDK_$1_CPU" = xppc; then 431275970Scy HOTSPOT_$1_CPU_DEFINE=PPC32 432275970Scy elif test "x$OPENJDK_$1_CPU" = xs390; then 433275970Scy HOTSPOT_$1_CPU_DEFINE=S390 434275970Scy elif test "x$OPENJDK_$1_CPU" = ss390x; then 435280849Scy HOTSPOT_$1_CPU_DEFINE=S390 436280849Scy fi 437280849Scy AC_SUBST(HOTSPOT_$1_CPU_DEFINE) 438280849Scy 439280849Scy]) 440280849Scy 441280849ScyAC_DEFUN([PLATFORM_SET_RELEASE_FILE_OS_VALUES], 442280849Scy[ 443280849Scy if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then 444280849Scy REQUIRED_OS_NAME=SunOS 445280849Scy REQUIRED_OS_VERSION=5.10 446280849Scy fi 447280849Scy if test "x$OPENJDK_TARGET_OS" = "xlinux"; then 448280849Scy REQUIRED_OS_NAME=Linux 449275970Scy REQUIRED_OS_VERSION=2.6 450275970Scy fi 451275970Scy if test "x$OPENJDK_TARGET_OS" = "xwindows"; then 452275970Scy REQUIRED_OS_NAME=Windows 453275970Scy if test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then 454275970Scy REQUIRED_OS_VERSION=5.2 455275970Scy else 456275970Scy REQUIRED_OS_VERSION=5.1 457275970Scy fi 458275970Scy fi 459275970Scy if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then 460275970Scy REQUIRED_OS_NAME=Darwin 461275970Scy REQUIRED_OS_VERSION=11.2 462275970Scy fi 463275970Scy if test "x$OPENJDK_TARGET_OS" = "xaix"; then 464275970Scy REQUIRED_OS_NAME=AIX 465275970Scy REQUIRED_OS_VERSION=7.1 466275970Scy fi 467275970Scy 468275970Scy AC_SUBST(REQUIRED_OS_NAME) 469275970Scy AC_SUBST(REQUIRED_OS_VERSION) 470275970Scy]) 471275970Scy 472275970Scy#%%% Build and target systems %%% 473275970ScyAC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_AND_TARGET], 474275970Scy[ 475275970Scy # Figure out the build and target systems. # Note that in autoconf terminology, "build" is obvious, but "target" 476275970Scy # is confusing; it assumes you are cross-compiling a cross-compiler (!) and "target" is thus the target of the 477275970Scy # product you're building. The target of this build is called "host". Since this is confusing to most people, we 478275970Scy # have not adopted that system, but use "target" as the platform we are building for. In some places though we need 479275970Scy # to use the configure naming style. 480275970Scy AC_CANONICAL_BUILD 481275970Scy AC_CANONICAL_HOST 482275970Scy AC_CANONICAL_TARGET 483275970Scy 484275970Scy PLATFORM_EXTRACT_TARGET_AND_BUILD 485275970Scy PLATFORM_SETUP_TARGET_CPU_BITS 486275970Scy PLATFORM_SET_RELEASE_FILE_OS_VALUES 487275970Scy PLATFORM_SETUP_LEGACY_VARS 488275970Scy]) 489275970Scy 490275970ScyAC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_OS_VERSION], 491275970Scy[ 492275970Scy ############################################################################### 493275970Scy 494275970Scy # Note that this is the build platform OS version! 495275970Scy 496275970Scy OS_VERSION="`uname -r | ${SED} 's!\.! !g' | ${SED} 's!-! !g'`" 497275970Scy OS_VERSION_MAJOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 1 -d ' '`" 498275970Scy OS_VERSION_MINOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 2 -d ' '`" 499275970Scy OS_VERSION_MICRO="`${ECHO} ${OS_VERSION} | ${CUT} -f 3 -d ' '`" 500275970Scy AC_SUBST(OS_VERSION_MAJOR) 501275970Scy AC_SUBST(OS_VERSION_MINOR) 502275970Scy AC_SUBST(OS_VERSION_MICRO) 503275970Scy]) 504275970Scy 505275970Scy# Support macro for PLATFORM_SETUP_OPENJDK_TARGET_BITS. 506275970Scy# Add -mX to various FLAGS variables. 507275970ScyAC_DEFUN([PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS], 508275970Scy[ 509275970Scy # When we add flags to the "official" CFLAGS etc, we need to 510275970Scy # keep track of these additions in ADDED_CFLAGS etc. These 511275970Scy # will later be checked to make sure only controlled additions 512275970Scy # have been made to CFLAGS etc. 513275970Scy ADDED_CFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}" 514275970Scy ADDED_CXXFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}" 515275970Scy ADDED_LDFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}" 516275970Scy 517275970Scy CFLAGS="${CFLAGS}${ADDED_CFLAGS}" 518275970Scy CXXFLAGS="${CXXFLAGS}${ADDED_CXXFLAGS}" 519275970Scy LDFLAGS="${LDFLAGS}${ADDED_LDFLAGS}" 520275970Scy 521275970Scy CFLAGS_JDK="${CFLAGS_JDK}${ADDED_CFLAGS}" 522275970Scy CXXFLAGS_JDK="${CXXFLAGS_JDK}${ADDED_CXXFLAGS}" 523275970Scy LDFLAGS_JDK="${LDFLAGS_JDK}${ADDED_LDFLAGS}" 524275970Scy 525275970Scy JVM_CFLAGS="$JVM_CFLAGS $ADDED_CFLAGS" 526275970Scy JVM_LDFLAGS="$JVM_LDFLAGS $ADDED_LDFLAGS" 527275970Scy JVM_ASFLAGS="$JVM_ASFLAGS $ADDED_CFLAGS" 528275970Scy]) 529275970Scy 530275970ScyAC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS], 531275970Scy[ 532275970Scy ############################################################################### 533275970Scy # 534275970Scy # Now we check if libjvm.so will use 32 or 64 bit pointers for the C/C++ code. 535275970Scy # (The JVM can use 32 or 64 bit Java pointers but that decision 536275970Scy # is made at runtime.) 537275970Scy # 538298770Sdelphij 539275970Scy if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xaix; then 540275970Scy # Always specify -m flag on Solaris 541275970Scy # And -q on AIX because otherwise the compiler produces 32-bit objects by default 542275970Scy PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS 543275970Scy elif test "x$COMPILE_TYPE" = xreduced; then 544275970Scy if test "x$OPENJDK_TARGET_OS_TYPE" = xunix; then 545275970Scy # Specify -m if running reduced on unix platforms 546275970Scy PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS 547275970Scy fi 548275970Scy fi 549275970Scy if test "x$OPENJDK_TARGET_OS" = xmacosx; then 550275970Scy JVM_CFLAGS="$JVM_CFLAGS ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}" 551275970Scy JVM_LDFLAGS="$JVM_LDFLAGS ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}" 552275970Scy JVM_ASFLAGS="$JVM_ASFLAGS ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}" 553275970Scy fi 554275970Scy 555275970Scy # Make compilation sanity check 556275970Scy AC_CHECK_HEADERS([stdio.h], , [ 557275970Scy AC_MSG_NOTICE([Failed to compile stdio.h. This likely implies missing compile dependencies.]) 558275970Scy if test "x$COMPILE_TYPE" = xreduced; then 559275970Scy HELP_MSG_MISSING_DEPENDENCY([reduced]) 560275970Scy AC_MSG_NOTICE([You are doing a reduced build. Check that you have 32-bit libraries installed. $HELP_MSG]) 561275970Scy elif test "x$COMPILE_TYPE" = xcross; then 562275970Scy AC_MSG_NOTICE([You are doing a cross-compilation. Check that you have all target platform libraries installed.]) 563275970Scy fi 564275970Scy AC_MSG_ERROR([Cannot continue.]) 565275970Scy ]) 566275970Scy 567275970Scy AC_CHECK_SIZEOF([int *], [1111]) 568275970Scy 569275970Scy # AC_CHECK_SIZEOF defines 'ac_cv_sizeof_int_p' to hold the number of bytes used by an 'int*' 570275970Scy if test "x$ac_cv_sizeof_int_p" = x; then 571275970Scy # The test failed, lets stick to the assumed value. 572275970Scy AC_MSG_WARN([The number of bits in the target could not be determined, using $OPENJDK_TARGET_CPU_BITS.]) 573275970Scy else 574275970Scy TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p` 575275970Scy 576275970Scy if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then 577275970Scy # This situation may happen on 64-bit platforms where the compiler by default only generates 32-bit objects 578275970Scy # Let's try to implicitely set the compilers target architecture and retry the test 579275970Scy 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).]) 580275970Scy AC_MSG_NOTICE([Retrying with platforms compiler target bits flag to ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}]) 581275970Scy PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS 582275970Scy 583275970Scy # We have to unset 'ac_cv_sizeof_int_p' first, otherwise AC_CHECK_SIZEOF will use the previously cached value! 584275970Scy unset ac_cv_sizeof_int_p 585275970Scy # And we have to undef the definition of SIZEOF_INT_P in confdefs.h by the previous invocation of AC_CHECK_SIZEOF 586275970Scy cat >>confdefs.h <<_ACEOF 587275970Scy#undef SIZEOF_INT_P 588275970Scy_ACEOF 589275970Scy 590275970Scy AC_CHECK_SIZEOF([int *], [1111]) 591275970Scy 592275970Scy TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p` 593275970Scy 594275970Scy if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then 595275970Scy 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)]) 596275970Scy if test "x$COMPILE_TYPE" = xreduced; then 597275970Scy HELP_MSG_MISSING_DEPENDENCY([reduced]) 598275970Scy AC_MSG_NOTICE([You are doing a reduced build. Check that you have 32-bit libraries installed. $HELP_MSG]) 599275970Scy elif test "x$COMPILE_TYPE" = xcross; then 600275970Scy AC_MSG_NOTICE([You are doing a cross-compilation. Check that you have all target platform libraries installed.]) 601275970Scy fi 602275970Scy AC_MSG_ERROR([Cannot continue.]) 603275970Scy fi 604275970Scy fi 605275970Scy fi 606275970Scy 607275970Scy AC_MSG_CHECKING([for target address size]) 608275970Scy AC_MSG_RESULT([$OPENJDK_TARGET_CPU_BITS bits]) 609275970Scy]) 610275970Scy 611275970ScyAC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_ENDIANNESS], 612275970Scy[ 613275970Scy ############################################################################### 614275970Scy # 615275970Scy # Is the target little of big endian? 616275970Scy # 617275970Scy AC_C_BIGENDIAN([ENDIAN="big"],[ENDIAN="little"],[ENDIAN="unknown"],[ENDIAN="universal_endianness"]) 618275970Scy 619275970Scy if test "x$ENDIAN" = xuniversal_endianness; then 620275970Scy AC_MSG_ERROR([Building with both big and little endianness is not supported]) 621275970Scy fi 622275970Scy if test "x$ENDIAN" != "x$OPENJDK_TARGET_CPU_ENDIAN"; then 623275970Scy 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)]) 624275970Scy fi 625275970Scy]) 626275970Scy