platform.m4 revision 2396:c14f9a7b4cab
11553Srgrimes# 21553Srgrimes# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. 31553Srgrimes# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 41553Srgrimes# 51553Srgrimes# This code is free software; you can redistribute it and/or modify it 61553Srgrimes# under the terms of the GNU General Public License version 2 only, as 71553Srgrimes# published by the Free Software Foundation. Oracle designates this 81553Srgrimes# particular file as subject to the "Classpath" exception as provided 91553Srgrimes# by Oracle in the LICENSE file that accompanied this code. 101553Srgrimes# 111553Srgrimes# This code is distributed in the hope that it will be useful, but WITHOUT 121553Srgrimes# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 131553Srgrimes# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 141553Srgrimes# version 2 for more details (a copy is included in the LICENSE file that 151553Srgrimes# accompanied this code). 161553Srgrimes# 171553Srgrimes# You should have received a copy of the GNU General Public License version 181553Srgrimes# 2 along with this work; if not, write to the Free Software Foundation, 191553Srgrimes# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 201553Srgrimes# 211553Srgrimes# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 221553Srgrimes# or visit www.oracle.com if you need additional information or have any 231553Srgrimes# questions. 241553Srgrimes# 251553Srgrimes 261553Srgrimes# Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD. 271553Srgrimes# Converts autoconf style CPU name to OpenJDK style, into 281553Srgrimes# VAR_CPU, VAR_CPU_ARCH, VAR_CPU_BITS and VAR_CPU_ENDIAN. 291553SrgrimesAC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU], 301553Srgrimes[ 3111448Swollman # First argument is the cpu name from the trip/quad 321553Srgrimes case "$1" in 331553Srgrimes x86_64) 3430603Scharnier VAR_CPU=x86_64 3530603Scharnier VAR_CPU_ARCH=x86 3630603Scharnier VAR_CPU_BITS=64 3730603Scharnier VAR_CPU_ENDIAN=little 381553Srgrimes ;; 3930603Scharnier i?86) 401553Srgrimes VAR_CPU=x86 411553Srgrimes VAR_CPU_ARCH=x86 4293078Sdes VAR_CPU_BITS=32 4393078Sdes VAR_CPU_ENDIAN=little 4493078Sdes ;; 451553Srgrimes arm*) 461553Srgrimes VAR_CPU=arm 471553Srgrimes VAR_CPU_ARCH=arm 481553Srgrimes VAR_CPU_BITS=32 491553Srgrimes VAR_CPU_ENDIAN=little 501553Srgrimes ;; 511553Srgrimes aarch64) 521553Srgrimes VAR_CPU=aarch64 531553Srgrimes VAR_CPU_ARCH=aarch64 541553Srgrimes VAR_CPU_BITS=64 551553Srgrimes VAR_CPU_ENDIAN=little 561553Srgrimes ;; 571553Srgrimes powerpc) 58129851Sdwmalone VAR_CPU=ppc 591553Srgrimes VAR_CPU_ARCH=ppc 601553Srgrimes VAR_CPU_BITS=32 611553Srgrimes VAR_CPU_ENDIAN=big 621553Srgrimes ;; 631553Srgrimes powerpc64) 641553Srgrimes VAR_CPU=ppc64 655278Swollman VAR_CPU_ARCH=ppc 665278Swollman VAR_CPU_BITS=64 6737820Sphk VAR_CPU_ENDIAN=big 6837820Sphk ;; 691553Srgrimes powerpc64le) 701553Srgrimes VAR_CPU=ppc64le 711553Srgrimes VAR_CPU_ARCH=ppc 721553Srgrimes VAR_CPU_BITS=64 73174316Sobrien VAR_CPU_ENDIAN=little 74174316Sobrien ;; 75174316Sobrien s390) 76174316Sobrien VAR_CPU=s390 771553Srgrimes VAR_CPU_ARCH=s390 781553Srgrimes VAR_CPU_BITS=32 791553Srgrimes VAR_CPU_ENDIAN=big 80199804Sattilio ;; 811553Srgrimes s390x) 821553Srgrimes VAR_CPU=s390x 831553Srgrimes VAR_CPU_ARCH=s390 8422984Sjoerg VAR_CPU_BITS=64 851553Srgrimes VAR_CPU_ENDIAN=big 861553Srgrimes ;; 871553Srgrimes sparc) 881553Srgrimes VAR_CPU=sparc 895278Swollman VAR_CPU_ARCH=sparc 90115108Sgshapiro VAR_CPU_BITS=32 911553Srgrimes VAR_CPU_ENDIAN=big 921553Srgrimes ;; 931553Srgrimes sparcv9|sparc64) 941553Srgrimes VAR_CPU=sparcv9 951553Srgrimes VAR_CPU_ARCH=sparc 961553Srgrimes VAR_CPU_BITS=64 9730603Scharnier VAR_CPU_ENDIAN=big 981553Srgrimes ;; 991553Srgrimes *) 100115108Sgshapiro AC_MSG_ERROR([unsupported cpu $1]) 101106054Swollman ;; 10293078Sdes esac 1031553Srgrimes]) 1041553Srgrimes 1051553Srgrimes# Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD. 1061553Srgrimes# Converts autoconf style OS name to OpenJDK style, into 10725437Sjoerg# VAR_OS, VAR_OS_TYPE and VAR_OS_ENV. 1081553SrgrimesAC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_OS], 109202206Sed[ 11083243Sdd case "$1" in 1111553Srgrimes *linux*) 11283243Sdd VAR_OS=linux 1131553Srgrimes VAR_OS_TYPE=unix 1141553Srgrimes ;; 1151553Srgrimes *solaris*) 11619224Sjoerg VAR_OS=solaris 11711448Swollman VAR_OS_TYPE=unix 11811448Swollman ;; 11911448Swollman *darwin*) 1201553Srgrimes VAR_OS=macosx 1211553Srgrimes VAR_OS_TYPE=unix 1221553Srgrimes ;; 123174316Sobrien *bsd*) 1241553Srgrimes VAR_OS=bsd 125137232Sglebius VAR_OS_TYPE=unix 126137232Sglebius ;; 127137233Sglebius *cygwin*) 128137857Skeramida VAR_OS=windows 129137232Sglebius VAR_OS_ENV=windows.cygwin 130137232Sglebius ;; 131137232Sglebius *mingw*) 132186331Sdelphij VAR_OS=windows 133137232Sglebius VAR_OS_ENV=windows.msys 134137232Sglebius ;; 135137232Sglebius *aix*) 136137233Sglebius VAR_OS=aix 137137233Sglebius VAR_OS_TYPE=unix 138137232Sglebius ;; 139137233Sglebius *) 14037156Sguido AC_MSG_ERROR([unsupported operating system $1]) 141137232Sglebius ;; 142137233Sglebius esac 14337156Sguido]) 1441553Srgrimes 1451553Srgrimes# Expects $host_os $host_cpu $build_os and $build_cpu 1461553Srgrimes# and $with_target_bits to have been setup! 1471553Srgrimes# 148174316Sobrien# Translate the standard triplet(quadruplet) definition 149174316Sobrien# of the target/build system into OPENJDK_TARGET_OS, OPENJDK_TARGET_CPU, 150174316Sobrien# OPENJDK_BUILD_OS, etc. 151174316SobrienAC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD], 152174316Sobrien[ 1531553Srgrimes # Copy the autoconf trip/quadruplet verbatim to OPENJDK_TARGET_AUTOCONF_NAME 1541553Srgrimes # (from the autoconf "host") and OPENJDK_BUILD_AUTOCONF_NAME 1551553Srgrimes # Note that we might later on rewrite e.g. OPENJDK_TARGET_CPU due to reduced build, 1561553Srgrimes # but this will not change the value of OPENJDK_TARGET_AUTOCONF_NAME. 157129855Sdwmalone OPENJDK_TARGET_AUTOCONF_NAME="$host" 158129855Sdwmalone OPENJDK_BUILD_AUTOCONF_NAME="$build" 1591553Srgrimes AC_SUBST(OPENJDK_TARGET_AUTOCONF_NAME) 1601553Srgrimes AC_SUBST(OPENJDK_BUILD_AUTOCONF_NAME) 1611553Srgrimes 1621553Srgrimes # Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables. 1631553Srgrimes PLATFORM_EXTRACT_VARS_FROM_OS($build_os) 1641553Srgrimes PLATFORM_EXTRACT_VARS_FROM_CPU($build_cpu) 1651553Srgrimes # ..and setup our own variables. (Do this explicitely to facilitate searching) 16663795Sdwmalone OPENJDK_BUILD_OS="$VAR_OS" 1671553Srgrimes if test "x$VAR_OS_TYPE" != x; then 16837820Sphk OPENJDK_BUILD_OS_TYPE="$VAR_OS_TYPE" 16937820Sphk else 17037820Sphk OPENJDK_BUILD_OS_TYPE="$VAR_OS" 17137820Sphk fi 1725278Swollman if test "x$VAR_OS_ENV" != x; then 1731553Srgrimes OPENJDK_BUILD_OS_ENV="$VAR_OS_ENV" 174200954Sed else 1751553Srgrimes OPENJDK_BUILD_OS_ENV="$VAR_OS" 17674053Sbrian fi 17770099Sume OPENJDK_BUILD_CPU="$VAR_CPU" 17870099Sume OPENJDK_BUILD_CPU_ARCH="$VAR_CPU_ARCH" 1791553Srgrimes OPENJDK_BUILD_CPU_BITS="$VAR_CPU_BITS" 1801553Srgrimes OPENJDK_BUILD_CPU_ENDIAN="$VAR_CPU_ENDIAN" 18122984Sjoerg AC_SUBST(OPENJDK_BUILD_OS) 18222984Sjoerg AC_SUBST(OPENJDK_BUILD_OS_TYPE) 18322984Sjoerg AC_SUBST(OPENJDK_BUILD_OS_ENV) 18422984Sjoerg AC_SUBST(OPENJDK_BUILD_CPU) 1851553Srgrimes AC_SUBST(OPENJDK_BUILD_CPU_ARCH) 1861553Srgrimes AC_SUBST(OPENJDK_BUILD_CPU_BITS) 1871553Srgrimes AC_SUBST(OPENJDK_BUILD_CPU_ENDIAN) 18874053Sbrian 1891553Srgrimes AC_MSG_CHECKING([openjdk-build os-cpu]) 1901553Srgrimes AC_MSG_RESULT([$OPENJDK_BUILD_OS-$OPENJDK_BUILD_CPU]) 1911553Srgrimes 19283243Sdd # Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables. 193129865Sdwmalone PLATFORM_EXTRACT_VARS_FROM_OS($host_os) 194174316Sobrien PLATFORM_EXTRACT_VARS_FROM_CPU($host_cpu) 195174316Sobrien # ... and setup our own variables. (Do this explicitely to facilitate searching) 1961553Srgrimes OPENJDK_TARGET_OS="$VAR_OS" 1971553Srgrimes if test "x$VAR_OS_TYPE" != x; then 1981553Srgrimes OPENJDK_TARGET_OS_TYPE="$VAR_OS_TYPE" 19922984Sjoerg else 20022984Sjoerg OPENJDK_TARGET_OS_TYPE="$VAR_OS" 20122984Sjoerg fi 20260938Sjake if test "x$VAR_OS_ENV" != x; then 20322984Sjoerg OPENJDK_TARGET_OS_ENV="$VAR_OS_ENV" 20422984Sjoerg else 20522984Sjoerg OPENJDK_TARGET_OS_ENV="$VAR_OS" 20622984Sjoerg fi 20722984Sjoerg OPENJDK_TARGET_CPU="$VAR_CPU" 20860938Sjake OPENJDK_TARGET_CPU_ARCH="$VAR_CPU_ARCH" 20922984Sjoerg OPENJDK_TARGET_CPU_BITS="$VAR_CPU_BITS" 21022984Sjoerg OPENJDK_TARGET_CPU_ENDIAN="$VAR_CPU_ENDIAN" 21122984Sjoerg AC_SUBST(OPENJDK_TARGET_OS) 21222984Sjoerg AC_SUBST(OPENJDK_TARGET_OS_TYPE) 21322984Sjoerg AC_SUBST(OPENJDK_TARGET_OS_ENV) 21422984Sjoerg AC_SUBST(OPENJDK_TARGET_CPU) 21522984Sjoerg AC_SUBST(OPENJDK_TARGET_CPU_ARCH) 21622984Sjoerg AC_SUBST(OPENJDK_TARGET_CPU_BITS) 217174316Sobrien AC_SUBST(OPENJDK_TARGET_CPU_ENDIAN) 21822984Sjoerg 21922984Sjoerg AC_MSG_CHECKING([openjdk-target os-cpu]) 22022984Sjoerg AC_MSG_RESULT([$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU]) 22122984Sjoerg]) 22222984Sjoerg 22325437Sjoerg# Check if a reduced build (32-bit on 64-bit platforms) is requested, and modify behaviour 22425437Sjoerg# accordingly. Must be done after setting up build and target system, but before 22525437Sjoerg# doing anything else with these values. 22625437SjoergAC_DEFUN([PLATFORM_SETUP_TARGET_CPU_BITS], 22725437Sjoerg[ 22825437Sjoerg AC_ARG_WITH(target-bits, [AS_HELP_STRING([--with-target-bits], 22925437Sjoerg [build 32-bit or 64-bit binaries (for platforms that support it), e.g. --with-target-bits=32 @<:@guessed@:>@])]) 23025437Sjoerg 23170099Sume # We have three types of compiles: 23270099Sume # native == normal compilation, target system == build system 23325437Sjoerg # cross == traditional cross compilation, target system != build system; special toolchain needed 23425437Sjoerg # reduced == using native compilers, but with special flags (e.g. -m32) to produce 32-bit builds on 64-bit machines 23525437Sjoerg # 23625437Sjoerg if test "x$OPENJDK_BUILD_AUTOCONF_NAME" != "x$OPENJDK_TARGET_AUTOCONF_NAME"; then 23725437Sjoerg # We're doing a proper cross-compilation 23825437Sjoerg COMPILE_TYPE="cross" 23925437Sjoerg else 24025437Sjoerg COMPILE_TYPE="native" 24125437Sjoerg fi 24225437Sjoerg 2431553Srgrimes if test "x$with_target_bits" != x; then 2441553Srgrimes if test "x$COMPILE_TYPE" = "xcross"; then 2451553Srgrimes AC_MSG_ERROR([It is not possible to combine --with-target-bits=X and proper cross-compilation. Choose either.]) 2461553Srgrimes fi 2471553Srgrimes 2481553Srgrimes if test "x$with_target_bits" = x32 && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then 2491553Srgrimes # A reduced build is requested 2501553Srgrimes COMPILE_TYPE="reduced" 2511553Srgrimes OPENJDK_TARGET_CPU_BITS=32 2521553Srgrimes if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86"; then 2531553Srgrimes OPENJDK_TARGET_CPU=x86 2541553Srgrimes elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then 2551553Srgrimes OPENJDK_TARGET_CPU=sparc 2561553Srgrimes else 2571553Srgrimes AC_MSG_ERROR([Reduced build (--with-target-bits=32) is only supported on x86_64 and sparcv9]) 2581553Srgrimes fi 2591553Srgrimes elif test "x$with_target_bits" = x64 && test "x$OPENJDK_TARGET_CPU_BITS" = x32; then 2601553Srgrimes AC_MSG_ERROR([It is not possible to use --with-target-bits=64 on a 32 bit system. Use proper cross-compilation instead.]) 2611553Srgrimes elif test "x$with_target_bits" = "x$OPENJDK_TARGET_CPU_BITS"; then 26222984Sjoerg AC_MSG_NOTICE([--with-target-bits are set to build platform address size; argument has no meaning]) 2631553Srgrimes else 26483243Sdd AC_MSG_ERROR([--with-target-bits can only be 32 or 64, you specified $with_target_bits!]) 2651553Srgrimes fi 26622984Sjoerg fi 2671553Srgrimes AC_SUBST(COMPILE_TYPE) 2681553Srgrimes 26993078Sdes AC_MSG_CHECKING([compilation type]) 27093078Sdes AC_MSG_RESULT([$COMPILE_TYPE]) 2711553Srgrimes]) 27293078Sdes 27393078Sdes# Setup the legacy variables, for controlling the old makefiles. 27493078Sdes# 275129756SdwmaloneAC_DEFUN([PLATFORM_SETUP_LEGACY_VARS], 27693078Sdes[ 27793078Sdes PLATFORM_SETUP_LEGACY_VARS_HELPER([TARGET]) 27893078Sdes PLATFORM_SETUP_LEGACY_VARS_HELPER([BUILD]) 27993078Sdes 28093078Sdes # ZERO_ARCHDEF is used to enable architecture-specific code. 281224002Sdelphij # This is used in legacy hotspot build. 28293078Sdes ZERO_ARCHDEF="$HOTSPOT_TARGET_CPU_DEFINE" 28370099Sume AC_SUBST(ZERO_ARCHDEF) 28493078Sdes 28570099Sume]) 28693078Sdes 28770099Sume# $1 - Either TARGET or BUILD to setup the variables for. 288178986SbrianAC_DEFUN([PLATFORM_SETUP_LEGACY_VARS_HELPER], 28993078Sdes[ 29093078Sdes # Also store the legacy naming of the cpu. 29193078Sdes # Ie i586 and amd64 instead of x86 and x86_64 292156339Spjd OPENJDK_$1_CPU_LEGACY="$OPENJDK_$1_CPU" 29317245Spst if test "x$OPENJDK_$1_CPU" = xx86; then 29493078Sdes OPENJDK_$1_CPU_LEGACY="i586" 2951553Srgrimes elif test "x$OPENJDK_$1_OS" != xmacosx && test "x$OPENJDK_$1_CPU" = xx86_64; then 29693078Sdes # On all platforms except MacOSX replace x86_64 with amd64. 29793078Sdes OPENJDK_$1_CPU_LEGACY="amd64" 298183347Sdwmalone fi 29925437Sjoerg AC_SUBST(OPENJDK_$1_CPU_LEGACY) 30093078Sdes 30193078Sdes # And the second legacy naming of the cpu. 30237820Sphk # Ie i386 and amd64 instead of x86 and x86_64. 30393078Sdes OPENJDK_$1_CPU_LEGACY_LIB="$OPENJDK_$1_CPU" 304131589Scperciva if test "x$OPENJDK_$1_CPU" = xx86; then 305149425Spjd OPENJDK_$1_CPU_LEGACY_LIB="i386" 30637820Sphk elif test "x$OPENJDK_$1_CPU" = xx86_64; then 30782724Skris OPENJDK_$1_CPU_LEGACY_LIB="amd64" 30882724Skris fi 30993078Sdes AC_SUBST(OPENJDK_$1_CPU_LEGACY_LIB) 31093078Sdes 31193078Sdes # OPENJDK_$1_CPU_ISADIR is normally empty. On 64-bit Solaris systems, it is set to 31293078Sdes # /amd64 or /sparcv9. This string is appended to some library paths, like this: 31393078Sdes # /usr/lib${OPENJDK_$1_CPU_ISADIR}/libexample.so 31493078Sdes OPENJDK_$1_CPU_ISADIR="" 31593078Sdes if test "x$OPENJDK_$1_OS" = xsolaris; then 31693078Sdes if test "x$OPENJDK_$1_CPU" = xx86_64; then 31793078Sdes OPENJDK_$1_CPU_ISADIR="/amd64" 318131591Scperciva elif test "x$OPENJDK_$1_CPU" = xsparcv9; then 31993078Sdes OPENJDK_$1_CPU_ISADIR="/sparcv9" 32093078Sdes fi 321211023Solli fi 32293078Sdes AC_SUBST(OPENJDK_$1_CPU_ISADIR) 32393078Sdes 32493078Sdes # Setup OPENJDK_$1_CPU_OSARCH, which is used to set the os.arch Java system property 32593078Sdes OPENJDK_$1_CPU_OSARCH="$OPENJDK_$1_CPU" 32693078Sdes if test "x$OPENJDK_$1_OS" = xlinux && test "x$OPENJDK_$1_CPU" = xx86; then 327114676Sgshapiro # On linux only, we replace x86 with i386. 328183347Sdwmalone OPENJDK_$1_CPU_OSARCH="i386" 32993078Sdes elif test "x$OPENJDK_$1_OS" != xmacosx && test "x$OPENJDK_$1_CPU" = xx86_64; then 33093078Sdes # On all platforms except macosx, we replace x86_64 with amd64. 33193078Sdes OPENJDK_$1_CPU_OSARCH="amd64" 33293078Sdes fi 33393077Sdes AC_SUBST(OPENJDK_$1_CPU_OSARCH) 33493078Sdes 33593077Sdes OPENJDK_$1_CPU_JLI="$OPENJDK_$1_CPU" 336186234Sobrien if test "x$OPENJDK_$1_CPU" = xx86; then 33793078Sdes OPENJDK_$1_CPU_JLI="i386" 33893078Sdes elif test "x$OPENJDK_$1_OS" != xmacosx && test "x$OPENJDK_$1_CPU" = xx86_64; then 339137568Sglebius # On all platforms except macosx, we replace x86_64 with amd64. 3401553Srgrimes OPENJDK_$1_CPU_JLI="amd64" 3411553Srgrimes fi 34293078Sdes 3431553Srgrimes if test "x$OPENJDK_$1_OS" = xmacosx; then 34482724Skris OPENJDK_$1_OS_EXPORT_DIR=macosx 3451553Srgrimes else 34670099Sume OPENJDK_$1_OS_EXPORT_DIR=${OPENJDK_$1_OS_TYPE} 34782724Skris fi 34883243Sdd AC_SUBST(OPENJDK_$1_OS_EXPORT_DIR) 349211023Solli 350211023Solli # The new version string in JDK 9 also defined new naming of OS and ARCH for bundles 35118710Speter # Macosx is osx and x86_64 is x64 35257558Sjoerg if test "x$OPENJDK_$1_OS" = xmacosx; then 353137232Sglebius OPENJDK_$1_OS_BUNDLE="osx" 35457558Sjoerg else 355149425Spjd OPENJDK_$1_OS_BUNDLE="$OPENJDK_TARGET_OS" 35655971Sdes fi 3571553Srgrimes if test "x$OPENJDK_$1_CPU" = xx86_64; then 358199804Sattilio OPENJDK_$1_CPU_BUNDLE="x64" 359199804Sattilio else 360199804Sattilio OPENJDK_$1_CPU_BUNDLE="$OPENJDK_$1_CPU" 36182728Sdd fi 362224002Sdelphij OPENJDK_$1_BUNDLE_PLATFORM="${OPENJDK_$1_OS_BUNDLE}-${OPENJDK_$1_CPU_BUNDLE}" 363183347Sdwmalone AC_SUBST(OPENJDK_$1_OS_BUNDLE) 36464195Sdwmalone AC_SUBST(OPENJDK_$1_CPU_BUNDLE) 36570099Sume AC_SUBST(OPENJDK_$1_BUNDLE_PLATFORM) 36670099Sume 36770099Sume if test "x$OPENJDK_$1_CPU_BITS" = x64; then 36870099Sume A_LP64="LP64:=" 36970099Sume # -D_LP64=1 is only set on linux and mac. Setting on windows causes diff in 37070099Sume # unpack200.exe 37170099Sume if test "x$OPENJDK_$1_OS" = xlinux || test "x$OPENJDK_$1_OS" = xmacosx; then 37270099Sume OPENJDK_$1_ADD_LP64="-D_LP64=1" 373178986Sbrian fi 374178986Sbrian fi 375178986Sbrian AC_SUBST(LP64,$A_LP64) 37670099Sume 37770099Sume if test "x$COMPILE_TYPE" = "xcross"; then 37870099Sume # FIXME: ... or should this include reduced builds..? 37925437Sjoerg DEFINE_CROSS_COMPILE_ARCH="CROSS_COMPILE_ARCH:=$OPENJDK_$1_CPU_LEGACY" 38025437Sjoerg else 38125437Sjoerg DEFINE_CROSS_COMPILE_ARCH="" 38225437Sjoerg fi 38382728Sdd AC_SUBST(DEFINE_CROSS_COMPILE_ARCH) 38482728Sdd 38582728Sdd # Convert openjdk platform names to hotspot names 38688897Sarchie 38788897Sarchie HOTSPOT_$1_OS=${OPENJDK_$1_OS} 38888897Sarchie if test "x$OPENJDK_$1_OS" = xmacosx; then 389156339Spjd HOTSPOT_$1_OS=bsd 390156339Spjd fi 391156339Spjd AC_SUBST(HOTSPOT_$1_OS) 39264195Sdwmalone 39364195Sdwmalone HOTSPOT_$1_OS_TYPE=${OPENJDK_$1_OS_TYPE} 39464195Sdwmalone if test "x$OPENJDK_$1_OS_TYPE" = xunix; then 3951553Srgrimes HOTSPOT_$1_OS_TYPE=posix 3961553Srgrimes fi 3971553Srgrimes AC_SUBST(HOTSPOT_$1_OS_TYPE) 39867249Sdwmalone 39967249Sdwmalone HOTSPOT_$1_CPU=${OPENJDK_$1_CPU} 40067249Sdwmalone if test "x$OPENJDK_$1_CPU" = xx86; then 40164195Sdwmalone HOTSPOT_$1_CPU=x86_32 402137232Sglebius elif test "x$OPENJDK_$1_CPU" = xsparcv9; then 403137232Sglebius HOTSPOT_$1_CPU=sparc 404137232Sglebius elif test "x$OPENJDK_$1_CPU" = xppc64; then 405137232Sglebius HOTSPOT_$1_CPU=ppc_64 406137232Sglebius elif test "x$OPENJDK_$1_CPU" = xppc64le; then 407137232Sglebius HOTSPOT_$1_CPU=ppc_64 408137232Sglebius fi 409137232Sglebius AC_SUBST(HOTSPOT_$1_CPU) 410137232Sglebius 411137232Sglebius # This is identical with OPENJDK_*, but define anyway for consistency. 412137232Sglebius HOTSPOT_$1_CPU_ARCH=${OPENJDK_$1_CPU_ARCH} 413137232Sglebius AC_SUBST(HOTSPOT_$1_CPU_ARCH) 414137232Sglebius 415137232Sglebius # Setup HOTSPOT_$1_CPU_DEFINE 416137232Sglebius if test "x$OPENJDK_$1_CPU" = xx86; then 417137232Sglebius HOTSPOT_$1_CPU_DEFINE=IA32 418137232Sglebius elif test "x$OPENJDK_$1_CPU" = xx86_64; then 419137232Sglebius HOTSPOT_$1_CPU_DEFINE=AMD64 420137232Sglebius elif test "x$OPENJDK_$1_CPU" = xsparcv9; then 421137232Sglebius HOTSPOT_$1_CPU_DEFINE=SPARC 422137232Sglebius elif test "x$OPENJDK_$1_CPU" = xaarch64; then 423137232Sglebius HOTSPOT_$1_CPU_DEFINE=AARCH64 424137232Sglebius elif test "x$OPENJDK_$1_CPU" = xppc64; then 425137232Sglebius HOTSPOT_$1_CPU_DEFINE=PPC64 426137232Sglebius elif test "x$OPENJDK_$1_CPU" = xppc64le; then 427137232Sglebius HOTSPOT_$1_CPU_DEFINE=PPC64 428137232Sglebius 429137232Sglebius # The cpu defines below are for zero, we don't support them directly. 430137232Sglebius elif test "x$OPENJDK_$1_CPU" = xsparc; then 431137232Sglebius HOTSPOT_$1_CPU_DEFINE=SPARC 432137232Sglebius elif test "x$OPENJDK_$1_CPU" = xppc; then 433137232Sglebius HOTSPOT_$1_CPU_DEFINE=PPC32 434137232Sglebius elif test "x$OPENJDK_$1_CPU" = xs390; then 435137232Sglebius HOTSPOT_$1_CPU_DEFINE=S390 43664195Sdwmalone elif test "x$OPENJDK_$1_CPU" = xs390x; then 437137232Sglebius HOTSPOT_$1_CPU_DEFINE=S390 4381553Srgrimes elif test "x$OPENJDK_$1_CPU" != x; then 4391553Srgrimes HOTSPOT_$1_CPU_DEFINE=$(echo $OPENJDK_$1_CPU | tr a-z A-Z) 4401553Srgrimes fi 441224002Sdelphij AC_SUBST(HOTSPOT_$1_CPU_DEFINE) 442224002Sdelphij 443224002Sdelphij]) 444224002Sdelphij 44563997SpsAC_DEFUN([PLATFORM_SET_RELEASE_FILE_OS_VALUES], 44663997Sps[ 44763997Sps if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then 44887000Sdd REQUIRED_OS_NAME=SunOS 44987000Sdd REQUIRED_OS_VERSION=5.10 45087000Sdd fi 4511553Srgrimes if test "x$OPENJDK_TARGET_OS" = "xlinux"; then 452129853Sdwmalone REQUIRED_OS_NAME=Linux 453129853Sdwmalone REQUIRED_OS_VERSION=2.6 454137232Sglebius fi 4551553Srgrimes if test "x$OPENJDK_TARGET_OS" = "xwindows"; then 45676431Sdwmalone REQUIRED_OS_NAME=Windows 45776431Sdwmalone if test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then 45876431Sdwmalone REQUIRED_OS_VERSION=5.2 45917245Spst else 46017245Spst REQUIRED_OS_VERSION=5.1 46117245Spst fi 462144984Shrs fi 463144984Shrs if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then 464144984Shrs REQUIRED_OS_NAME=Darwin 465144984Shrs REQUIRED_OS_VERSION=11.2 466144984Shrs fi 467183347Sdwmalone if test "x$OPENJDK_TARGET_OS" = "xaix"; then 468183347Sdwmalone REQUIRED_OS_NAME=AIX 469183347Sdwmalone REQUIRED_OS_VERSION=7.1 47037820Sphk fi 471137569Sglebius 47237820Sphk AC_SUBST(REQUIRED_OS_NAME) 47337820Sphk AC_SUBST(REQUIRED_OS_VERSION) 47437820Sphk]) 47537820Sphk 4761553Srgrimes#%%% Build and target systems %%% 4771553SrgrimesAC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_AND_TARGET], 4781553Srgrimes[ 4791553Srgrimes # Figure out the build and target systems. # Note that in autoconf terminology, "build" is obvious, but "target" 4801553Srgrimes # is confusing; it assumes you are cross-compiling a cross-compiler (!) and "target" is thus the target of the 4811553Srgrimes # product you're building. The target of this build is called "host". Since this is confusing to most people, we 482149425Spjd # have not adopted that system, but use "target" as the platform we are building for. In some places though we need 483149425Spjd # to use the configure naming style. 484149425Spjd AC_CANONICAL_BUILD 485149425Spjd AC_CANONICAL_HOST 486149425Spjd AC_CANONICAL_TARGET 487149425Spjd 488149425Spjd PLATFORM_EXTRACT_TARGET_AND_BUILD 48918710Speter PLATFORM_SETUP_TARGET_CPU_BITS 49018710Speter PLATFORM_SET_RELEASE_FILE_OS_VALUES 491149425Spjd PLATFORM_SETUP_LEGACY_VARS 492149425Spjd]) 493149425Spjd 494149425SpjdAC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_OS_VERSION], 495149425Spjd[ 49693080Sdes ############################################################################### 4971553Srgrimes 49893080Sdes # Note that this is the build platform OS version! 4991553Srgrimes 50025437Sjoerg OS_VERSION="`uname -r | ${SED} 's!\.! !g' | ${SED} 's!-! !g'`" 50125437Sjoerg OS_VERSION_MAJOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 1 -d ' '`" 50225437Sjoerg OS_VERSION_MINOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 2 -d ' '`" 5031553Srgrimes OS_VERSION_MICRO="`${ECHO} ${OS_VERSION} | ${CUT} -f 3 -d ' '`" 50482724Skris AC_SUBST(OS_VERSION_MAJOR) 50582724Skris AC_SUBST(OS_VERSION_MINOR) 50682724Skris AC_SUBST(OS_VERSION_MICRO) 50782724Skris]) 50882724Skris 50982724Skris# Support macro for PLATFORM_SETUP_OPENJDK_TARGET_BITS. 51057558Sjoerg# Add -mX to various FLAGS variables. 51157558SjoergAC_DEFUN([PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS], 51257558Sjoerg[ 51357558Sjoerg # When we add flags to the "official" CFLAGS etc, we need to 51457558Sjoerg # keep track of these additions in ADDED_CFLAGS etc. These 51557558Sjoerg # will later be checked to make sure only controlled additions 51657558Sjoerg # have been made to CFLAGS etc. 51757558Sjoerg ADDED_CFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}" 51857558Sjoerg ADDED_CXXFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}" 51957558Sjoerg ADDED_LDFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}" 52057609Sjoerg 52157558Sjoerg CFLAGS="${CFLAGS}${ADDED_CFLAGS}" 5221553Srgrimes CXXFLAGS="${CXXFLAGS}${ADDED_CXXFLAGS}" 52322984Sjoerg LDFLAGS="${LDFLAGS}${ADDED_LDFLAGS}" 5241553Srgrimes 5251553Srgrimes CFLAGS_JDK="${CFLAGS_JDK}${ADDED_CFLAGS}" 52625154Spst CXXFLAGS_JDK="${CXXFLAGS_JDK}${ADDED_CXXFLAGS}" 52725154Spst LDFLAGS_JDK="${LDFLAGS_JDK}${ADDED_LDFLAGS}" 5281553Srgrimes 5291553Srgrimes JVM_CFLAGS="$JVM_CFLAGS $ADDED_CFLAGS" 5301553Srgrimes JVM_LDFLAGS="$JVM_LDFLAGS $ADDED_LDFLAGS" 531137232Sglebius JVM_ASFLAGS="$JVM_ASFLAGS $ADDED_CFLAGS" 532137232Sglebius]) 53337156Sguido 534176427SdwmaloneAC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS], 535137232Sglebius[ 536176427Sdwmalone ############################################################################### 537137232Sglebius # 538137232Sglebius # Now we check if libjvm.so will use 32 or 64 bit pointers for the C/C++ code. 539137232Sglebius # (The JVM can use 32 or 64 bit Java pointers but that decision 54093080Sdes # is made at runtime.) 541137232Sglebius # 54237156Sguido 543137232Sglebius if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xaix; then 544137233Sglebius # Always specify -m flag on Solaris 54537156Sguido # And -q on AIX because otherwise the compiler produces 32-bit objects by default 546137568Sglebius PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS 547137232Sglebius elif test "x$COMPILE_TYPE" = xreduced; then 548137568Sglebius if test "x$OPENJDK_TARGET_OS_TYPE" = xunix; then 549137568Sglebius # Specify -m if running reduced on unix platforms 550137568Sglebius PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS 55137156Sguido fi 55237156Sguido fi 55346428Sdes if test "x$OPENJDK_TARGET_OS" = xmacosx; then 55482728Sdd JVM_CFLAGS="$JVM_CFLAGS ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}" 5551553Srgrimes JVM_LDFLAGS="$JVM_LDFLAGS ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}" 55670099Sume JVM_ASFLAGS="$JVM_ASFLAGS ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}" 55770099Sume fi 55870099Sume 55970099Sume # Make compilation sanity check 56070099Sume AC_CHECK_HEADERS([stdio.h], , [ 56170099Sume AC_MSG_NOTICE([Failed to compile stdio.h. This likely implies missing compile dependencies.]) 56270099Sume if test "x$COMPILE_TYPE" = xreduced; then 56370099Sume HELP_MSG_MISSING_DEPENDENCY([reduced]) 56470099Sume AC_MSG_NOTICE([You are doing a reduced build. Check that you have 32-bit libraries installed. $HELP_MSG]) 56593080Sdes elif test "x$COMPILE_TYPE" = xcross; then 56670099Sume AC_MSG_NOTICE([You are doing a cross-compilation. Check that you have all target platform libraries installed.]) 56793080Sdes fi 56870099Sume AC_MSG_ERROR([Cannot continue.]) 5691553Srgrimes ]) 57035428Sphk 57146299Sdt AC_CHECK_SIZEOF([int *], [1111]) 57246299Sdt 57346299Sdt # AC_CHECK_SIZEOF defines 'ac_cv_sizeof_int_p' to hold the number of bytes used by an 'int*' 57446299Sdt if test "x$ac_cv_sizeof_int_p" = x; then 5751553Srgrimes # The test failed, lets stick to the assumed value. 5761553Srgrimes AC_MSG_WARN([The number of bits in the target could not be determined, using $OPENJDK_TARGET_CPU_BITS.]) 5771553Srgrimes else 578149425Spjd TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p` 5791553Srgrimes 5801553Srgrimes if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then 5811553Srgrimes # This situation may happen on 64-bit platforms where the compiler by default only generates 32-bit objects 5821553Srgrimes # Let's try to implicitely set the compilers target architecture and retry the test 58357558Sjoerg 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).]) 58457558Sjoerg AC_MSG_NOTICE([Retrying with platforms compiler target bits flag to ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}]) 58557558Sjoerg PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS 58657558Sjoerg 58757558Sjoerg # We have to unset 'ac_cv_sizeof_int_p' first, otherwise AC_CHECK_SIZEOF will use the previously cached value! 58857609Sjoerg unset ac_cv_sizeof_int_p 58957558Sjoerg # And we have to undef the definition of SIZEOF_INT_P in confdefs.h by the previous invocation of AC_CHECK_SIZEOF 5901553Srgrimes cat >>confdefs.h <<_ACEOF 59118710Speter#undef SIZEOF_INT_P 59218710Speter_ACEOF 59318710Speter 59482724Skris AC_CHECK_SIZEOF([int *], [1111]) 59582724Skris 59682724Skris TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p` 59782724Skris 59882724Skris if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then 59982724Skris 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)]) 60082724Skris if test "x$COMPILE_TYPE" = xreduced; then 60182724Skris HELP_MSG_MISSING_DEPENDENCY([reduced]) 602137232Sglebius AC_MSG_NOTICE([You are doing a reduced build. Check that you have 32-bit libraries installed. $HELP_MSG]) 603137232Sglebius elif test "x$COMPILE_TYPE" = xcross; then 604137232Sglebius AC_MSG_NOTICE([You are doing a cross-compilation. Check that you have all target platform libraries installed.]) 60582724Skris fi 60682724Skris AC_MSG_ERROR([Cannot continue.]) 60782724Skris fi 60882724Skris fi 60982724Skris fi 61082724Skris 6111553Srgrimes AC_MSG_CHECKING([for target address size]) 61282724Skris AC_MSG_RESULT([$OPENJDK_TARGET_CPU_BITS bits]) 61382724Skris]) 61482724Skris 61582724SkrisAC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_ENDIANNESS], 6161553Srgrimes[ 61782724Skris ############################################################################### 61882724Skris # 61982724Skris # Is the target little of big endian? 62082724Skris # 62182724Skris AC_C_BIGENDIAN([ENDIAN="big"],[ENDIAN="little"],[ENDIAN="unknown"],[ENDIAN="universal_endianness"]) 62270099Sume 62370099Sume if test "x$ENDIAN" = xuniversal_endianness; then 62482724Skris AC_MSG_ERROR([Building with both big and little endianness is not supported]) 62582724Skris fi 62670099Sume if test "x$ENDIAN" != "x$OPENJDK_TARGET_CPU_ENDIAN"; then 62737156Sguido 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)]) 628137232Sglebius fi 629137232Sglebius]) 63037156Sguido