platform.m4 revision 696:e404d321abc6
133965Sjdp# 2218822Sdim# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. 389857Sobrien# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 433965Sjdp# 538889Sjdp# This code is free software; you can redistribute it and/or modify it 633965Sjdp# under the terms of the GNU General Public License version 2 only, as 738889Sjdp# published by the Free Software Foundation. Oracle designates this 838889Sjdp# particular file as subject to the "Classpath" exception as provided 938889Sjdp# by Oracle in the LICENSE file that accompanied this code. 1038889Sjdp# 1133965Sjdp# This code is distributed in the hope that it will be useful, but WITHOUT 1238889Sjdp# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1338889Sjdp# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1438889Sjdp# version 2 for more details (a copy is included in the LICENSE file that 1538889Sjdp# accompanied this code). 1633965Sjdp# 1738889Sjdp# You should have received a copy of the GNU General Public License version 1838889Sjdp# 2 along with this work; if not, write to the Free Software Foundation, 19218822Sdim# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20218822Sdim# 2133965Sjdp# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2233965Sjdp# or visit www.oracle.com if you need additional information or have any 2333965Sjdp# questions. 2433965Sjdp# 2533965Sjdp 2689857Sobrien# Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD. 2733965Sjdp# Converts autoconf style CPU name to OpenJDK style, into 28218822Sdim# VAR_CPU, VAR_CPU_ARCH, VAR_CPU_BITS and VAR_CPU_ENDIAN. 2933965SjdpAC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU], 3089857Sobrien[ 31104834Sobrien # First argument is the cpu name from the trip/quad 32104834Sobrien case "$1" in 33218822Sdim x86_64) 3433965Sjdp VAR_CPU=x86_64 3533965Sjdp VAR_CPU_ARCH=x86 3633965Sjdp VAR_CPU_BITS=64 3733965Sjdp VAR_CPU_ENDIAN=little 3833965Sjdp ;; 3938889Sjdp i?86) 4033965Sjdp VAR_CPU=x86 4133965Sjdp VAR_CPU_ARCH=x86 42130561Sobrien VAR_CPU_BITS=32 43130561Sobrien VAR_CPU_ENDIAN=little 44130561Sobrien ;; 45130561Sobrien arm*) 46130561Sobrien VAR_CPU=arm 47130561Sobrien VAR_CPU_ARCH=arm 48130561Sobrien VAR_CPU_BITS=32 49130561Sobrien VAR_CPU_ENDIAN=little 50130561Sobrien ;; 51130561Sobrien powerpc) 52130561Sobrien VAR_CPU=ppc 53130561Sobrien VAR_CPU_ARCH=ppc 54130561Sobrien VAR_CPU_BITS=32 5589857Sobrien VAR_CPU_ENDIAN=big 56130561Sobrien ;; 5789857Sobrien powerpc64) 58218822Sdim VAR_CPU=ppc64 59130561Sobrien VAR_CPU_ARCH=ppc 6033965Sjdp VAR_CPU_BITS=64 6133965Sjdp VAR_CPU_ENDIAN=big 6233965Sjdp ;; 6333965Sjdp sparc) 6489857Sobrien VAR_CPU=sparc 6533965Sjdp VAR_CPU_ARCH=sparc 6689857Sobrien VAR_CPU_BITS=32 6733965Sjdp VAR_CPU_ENDIAN=big 6833965Sjdp ;; 6933965Sjdp sparcv9) 7089857Sobrien VAR_CPU=sparcv9 7133965Sjdp VAR_CPU_ARCH=sparc 7233965Sjdp VAR_CPU_BITS=64 7333965Sjdp VAR_CPU_ENDIAN=big 7433965Sjdp ;; 7533965Sjdp *) 7633965Sjdp AC_MSG_ERROR([unsupported cpu $1]) 7733965Sjdp ;; 7833965Sjdp esac 7989857Sobrien]) 8033965Sjdp 8133965Sjdp# Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD. 8233965Sjdp# Converts autoconf style OS name to OpenJDK style, into 8333965Sjdp# VAR_OS and VAR_OS_API. 84130561SobrienAC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_OS], 8533965Sjdp[ 8633965Sjdp case "$1" in 8733965Sjdp *linux*) 8833965Sjdp VAR_OS=linux 8933965Sjdp VAR_OS_API=posix 9033965Sjdp VAR_OS_ENV=linux 9133965Sjdp ;; 9233965Sjdp *solaris*) 9333965Sjdp VAR_OS=solaris 9433965Sjdp VAR_OS_API=posix 9533965Sjdp VAR_OS_ENV=solaris 96104834Sobrien ;; 9733965Sjdp *darwin*) 98104834Sobrien VAR_OS=macosx 99104834Sobrien VAR_OS_API=posix 10033965Sjdp VAR_OS_ENV=macosx 10133965Sjdp ;; 10233965Sjdp *bsd*) 10333965Sjdp VAR_OS=bsd 10433965Sjdp VAR_OS_API=posix 10589857Sobrien VAR_OS_ENV=bsd 10633965Sjdp ;; 10733965Sjdp *cygwin*) 10833965Sjdp VAR_OS=windows 10933965Sjdp VAR_OS_API=winapi 11089857Sobrien VAR_OS_ENV=windows.cygwin 11133965Sjdp ;; 11233965Sjdp *mingw*) 11333965Sjdp VAR_OS=windows 11433965Sjdp VAR_OS_API=winapi 115218822Sdim VAR_OS_ENV=windows.msys 116218822Sdim ;; 11733965Sjdp *) 11833965Sjdp AC_MSG_ERROR([unsupported operating system $1]) 11933965Sjdp ;; 12033965Sjdp esac 12189857Sobrien]) 12233965Sjdp 12333965Sjdp# Expects $host_os $host_cpu $build_os and $build_cpu 12433965Sjdp# and $with_target_bits to have been setup! 12589857Sobrien# 12633965Sjdp# Translate the standard triplet(quadruplet) definition 12789857Sobrien# of the target/build system into OPENJDK_TARGET_OS, OPENJDK_TARGET_CPU, 12833965Sjdp# OPENJDK_BUILD_OS, etc. 12933965SjdpAC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD], 13089857Sobrien[ 13189857Sobrien # Copy the autoconf trip/quadruplet verbatim to OPENJDK_TARGET_AUTOCONF_NAME 13233965Sjdp # (from the autoconf "host") and OPENJDK_BUILD_AUTOCONF_NAME 13333965Sjdp # Note that we might later on rewrite e.g. OPENJDK_TARGET_CPU due to reduced build, 13433965Sjdp # but this will not change the value of OPENJDK_TARGET_AUTOCONF_NAME. 13533965Sjdp OPENJDK_TARGET_AUTOCONF_NAME="$host" 13633965Sjdp OPENJDK_BUILD_AUTOCONF_NAME="$build" 13733965Sjdp AC_SUBST(OPENJDK_TARGET_AUTOCONF_NAME) 138218822Sdim AC_SUBST(OPENJDK_BUILD_AUTOCONF_NAME) 139130561Sobrien 140130561Sobrien # Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables. 14133965Sjdp PLATFORM_EXTRACT_VARS_FROM_OS($build_os) 14233965Sjdp PLATFORM_EXTRACT_VARS_FROM_CPU($build_cpu) 14333965Sjdp # ..and setup our own variables. (Do this explicitely to facilitate searching) 14433965Sjdp OPENJDK_BUILD_OS="$VAR_OS" 14533965Sjdp OPENJDK_BUILD_OS_API="$VAR_OS_API" 14689857Sobrien OPENJDK_BUILD_OS_ENV="$VAR_OS_ENV" 14733965Sjdp OPENJDK_BUILD_CPU="$VAR_CPU" 14833965Sjdp OPENJDK_BUILD_CPU_ARCH="$VAR_CPU_ARCH" 14989857Sobrien OPENJDK_BUILD_CPU_BITS="$VAR_CPU_BITS" 15033965Sjdp OPENJDK_BUILD_CPU_ENDIAN="$VAR_CPU_ENDIAN" 15189857Sobrien AC_SUBST(OPENJDK_BUILD_OS) 15289857Sobrien AC_SUBST(OPENJDK_BUILD_OS_API) 15333965Sjdp AC_SUBST(OPENJDK_BUILD_CPU) 15433965Sjdp AC_SUBST(OPENJDK_BUILD_CPU_ARCH) 15533965Sjdp AC_SUBST(OPENJDK_BUILD_CPU_BITS) 156218822Sdim AC_SUBST(OPENJDK_BUILD_CPU_ENDIAN) 157130561Sobrien 15833965Sjdp AC_MSG_CHECKING([openjdk-build os-cpu]) 15933965Sjdp AC_MSG_RESULT([$OPENJDK_BUILD_OS-$OPENJDK_BUILD_CPU]) 16033965Sjdp 16133965Sjdp # Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables. 16233965Sjdp PLATFORM_EXTRACT_VARS_FROM_OS($host_os) 16389857Sobrien PLATFORM_EXTRACT_VARS_FROM_CPU($host_cpu) 16489857Sobrien # ... and setup our own variables. (Do this explicitely to facilitate searching) 16533965Sjdp OPENJDK_TARGET_OS="$VAR_OS" 16638889Sjdp OPENJDK_TARGET_OS_API="$VAR_OS_API" 16789857Sobrien OPENJDK_TARGET_OS_ENV="$VAR_OS_ENV" 16833965Sjdp OPENJDK_TARGET_CPU="$VAR_CPU" 16933965Sjdp OPENJDK_TARGET_CPU_ARCH="$VAR_CPU_ARCH" 17089857Sobrien OPENJDK_TARGET_CPU_BITS="$VAR_CPU_BITS" 17133965Sjdp OPENJDK_TARGET_CPU_ENDIAN="$VAR_CPU_ENDIAN" 17233965Sjdp AC_SUBST(OPENJDK_TARGET_OS) 17333965Sjdp AC_SUBST(OPENJDK_TARGET_OS_API) 17433965Sjdp AC_SUBST(OPENJDK_TARGET_CPU) 17533965Sjdp AC_SUBST(OPENJDK_TARGET_CPU_ARCH) 17633965Sjdp AC_SUBST(OPENJDK_TARGET_CPU_BITS) 17733965Sjdp AC_SUBST(OPENJDK_TARGET_CPU_ENDIAN) 17833965Sjdp 17933965Sjdp AC_MSG_CHECKING([openjdk-target os-cpu]) 18033965Sjdp AC_MSG_RESULT([$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU]) 18133965Sjdp]) 18233965Sjdp 18333965Sjdp# Check if a reduced build (32-bit on 64-bit platforms) is requested, and modify behaviour 18433965Sjdp# accordingly. Must be done after setting up build and target system, but before 18533965Sjdp# doing anything else with these values. 18633965SjdpAC_DEFUN([PLATFORM_SETUP_TARGET_CPU_BITS], 18789857Sobrien[ 18833965Sjdp AC_ARG_WITH(target-bits, [AS_HELP_STRING([--with-target-bits], 18933965Sjdp [build 32-bit or 64-bit binaries (for platforms that support it), e.g. --with-target-bits=32 @<:@guessed@:>@])]) 19033965Sjdp 19133965Sjdp # We have three types of compiles: 192218822Sdim # native == normal compilation, target system == build system 193218822Sdim # cross == traditional cross compilation, target system != build system; special toolchain needed 19433965Sjdp # reduced == using native compilers, but with special flags (e.g. -m32) to produce 32-bit builds on 64-bit machines 19533965Sjdp # 19633965Sjdp if test "x$OPENJDK_BUILD_AUTOCONF_NAME" != "x$OPENJDK_TARGET_AUTOCONF_NAME"; then 19733965Sjdp # We're doing a proper cross-compilation 19838889Sjdp COMPILE_TYPE="cross" 19938889Sjdp else 20038889Sjdp COMPILE_TYPE="native" 20133965Sjdp fi 20233965Sjdp 20333965Sjdp if test "x$with_target_bits" != x; then 20433965Sjdp if test "x$COMPILE_TYPE" = "xcross"; then 20533965Sjdp AC_MSG_ERROR([It is not possible to combine --with-target-bits=X and proper cross-compilation. Choose either.]) 20633965Sjdp fi 207130561Sobrien 20833965Sjdp if test "x$with_target_bits" = x32 && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then 20933965Sjdp # A reduced build is requested 21033965Sjdp COMPILE_TYPE="reduced" 21133965Sjdp OPENJDK_TARGET_CPU_BITS=32 21233965Sjdp if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86"; then 21389857Sobrien OPENJDK_TARGET_CPU=x86 21433965Sjdp elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then 215130561Sobrien OPENJDK_TARGET_CPU=sparc 21633965Sjdp else 21733965Sjdp AC_MSG_ERROR([Reduced build (--with-target-bits=32) is only supported on x86_64 and sparcv9]) 21889857Sobrien fi 21933965Sjdp elif test "x$with_target_bits" = x64 && test "x$OPENJDK_TARGET_CPU_BITS" = x32; then 22089857Sobrien AC_MSG_ERROR([It is not possible to use --with-target-bits=64 on a 32 bit system. Use proper cross-compilation instead.]) 22189857Sobrien elif test "x$with_target_bits" = "x$OPENJDK_TARGET_CPU_BITS"; then 22233965Sjdp AC_MSG_NOTICE([--with-target-bits are set to build platform address size; argument has no meaning]) 22333965Sjdp else 22433965Sjdp AC_MSG_ERROR([--with-target-bits can only be 32 or 64, you specified $with_target_bits!]) 22533965Sjdp fi 226130561Sobrien fi 22733965Sjdp AC_SUBST(COMPILE_TYPE) 22833965Sjdp 22933965SjdpAC_MSG_CHECKING([compilation type]) 23033965SjdpAC_MSG_RESULT([$COMPILE_TYPE]) 23133965Sjdp]) 232130561Sobrien 23333965Sjdp # Setup the legacy variables, for controlling the old makefiles. 23433965Sjdp # 23589857SobrienAC_DEFUN([PLATFORM_SETUP_LEGACY_VARS], 23633965Sjdp[ 23789857Sobrien # Also store the legacy naming of the cpu. 23833965Sjdp # Ie i586 and amd64 instead of x86 and x86_64 23989857Sobrien OPENJDK_TARGET_CPU_LEGACY="$OPENJDK_TARGET_CPU" 24089857Sobrien if test "x$OPENJDK_TARGET_CPU" = xx86; then 24189857Sobrien OPENJDK_TARGET_CPU_LEGACY="i586" 24233965Sjdp elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then 24333965Sjdp # On all platforms except MacOSX replace x86_64 with amd64. 24433965Sjdp OPENJDK_TARGET_CPU_LEGACY="amd64" 24533965Sjdp fi 24633965Sjdp AC_SUBST(OPENJDK_TARGET_CPU_LEGACY) 24733965Sjdp 24833965Sjdp # And the second legacy naming of the cpu. 24933965Sjdp # Ie i386 and amd64 instead of x86 and x86_64. 25089857Sobrien OPENJDK_TARGET_CPU_LEGACY_LIB="$OPENJDK_TARGET_CPU" 25189857Sobrien if test "x$OPENJDK_TARGET_CPU" = xx86; then 25289857Sobrien OPENJDK_TARGET_CPU_LEGACY_LIB="i386" 25389857Sobrien elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then 25433965Sjdp OPENJDK_TARGET_CPU_LEGACY_LIB="amd64" 25533965Sjdp fi 25689857Sobrien AC_SUBST(OPENJDK_TARGET_CPU_LEGACY_LIB) 257218822Sdim 258130561Sobrien # This is the name of the cpu (but using i386 and amd64 instead of 25933965Sjdp # x86 and x86_64, respectively), preceeded by a /, to be used when 260218822Sdim # locating libraries. On macosx, it's empty, though. 26133965Sjdp OPENJDK_TARGET_CPU_LIBDIR="/$OPENJDK_TARGET_CPU_LEGACY_LIB" 26289857Sobrien if test "x$OPENJDK_TARGET_OS" = xmacosx; then 26389857Sobrien OPENJDK_TARGET_CPU_LIBDIR="" 26433965Sjdp fi 26533965Sjdp AC_SUBST(OPENJDK_TARGET_CPU_LIBDIR) 266218822Sdim 267130561Sobrien # OPENJDK_TARGET_CPU_ISADIR is normally empty. On 64-bit Solaris systems, it is set to 26833965Sjdp # /amd64 or /sparcv9. This string is appended to some library paths, like this: 26989857Sobrien # /usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libexample.so 27033965Sjdp OPENJDK_TARGET_CPU_ISADIR="" 27133965Sjdp if test "x$OPENJDK_TARGET_OS" = xsolaris; then 27233965Sjdp if test "x$OPENJDK_TARGET_CPU" = xx86_64; then 273130561Sobrien OPENJDK_TARGET_CPU_ISADIR="/amd64" 27433965Sjdp elif test "x$OPENJDK_TARGET_CPU" = xsparcv9; then 27533965Sjdp OPENJDK_TARGET_CPU_ISADIR="/sparcv9" 27689857Sobrien fi 27733965Sjdp fi 27833965Sjdp AC_SUBST(OPENJDK_TARGET_CPU_ISADIR) 27933965Sjdp 28033965Sjdp # Setup OPENJDK_TARGET_CPU_OSARCH, which is used to set the os.arch Java system property 28133965Sjdp OPENJDK_TARGET_CPU_OSARCH="$OPENJDK_TARGET_CPU" 28233965Sjdp if test "x$OPENJDK_TARGET_OS" = xlinux && test "x$OPENJDK_TARGET_CPU" = xx86; then 28333965Sjdp # On linux only, we replace x86 with i386. 28433965Sjdp OPENJDK_TARGET_CPU_OSARCH="i386" 28533965Sjdp elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then 28633965Sjdp # On all platforms except macosx, we replace x86_64 with amd64. 28733965Sjdp OPENJDK_TARGET_CPU_OSARCH="amd64" 28833965Sjdp fi 28933965Sjdp AC_SUBST(OPENJDK_TARGET_CPU_OSARCH) 29033965Sjdp 29133965Sjdp OPENJDK_TARGET_CPU_JLI="$OPENJDK_TARGET_CPU" 29233965Sjdp if test "x$OPENJDK_TARGET_CPU" = xx86; then 29333965Sjdp OPENJDK_TARGET_CPU_JLI="i386" 29489857Sobrien elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then 29533965Sjdp # On all platforms except macosx, we replace x86_64 with amd64. 29633965Sjdp OPENJDK_TARGET_CPU_JLI="amd64" 29733965Sjdp fi 29833965Sjdp # Now setup the -D flags for building libjli. 29933965Sjdp OPENJDK_TARGET_CPU_JLI_CFLAGS="-DLIBARCHNAME='\"$OPENJDK_TARGET_CPU_JLI\"'" 30033965Sjdp if test "x$OPENJDK_TARGET_OS" = xsolaris; then 30133965Sjdp if test "x$OPENJDK_TARGET_CPU_ARCH" = xsparc; then 30289857Sobrien OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"sparc\"' -DLIBARCH64NAME='\"sparcv9\"'" 30333965Sjdp elif test "x$OPENJDK_TARGET_CPU_ARCH" = xx86; then 30433965Sjdp OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"i386\"' -DLIBARCH64NAME='\"amd64\"'" 30533965Sjdp fi 30633965Sjdp fi 30738889Sjdp AC_SUBST(OPENJDK_TARGET_CPU_JLI_CFLAGS) 30833965Sjdp 30933965Sjdp # Setup OPENJDK_TARGET_OS_API_DIR, used in source paths. 31033965Sjdp if test "x$OPENJDK_TARGET_OS_API" = xposix; then 31189857Sobrien OPENJDK_TARGET_OS_API_DIR="solaris" 31233965Sjdp fi 31333965Sjdp if test "x$OPENJDK_TARGET_OS_API" = xwinapi; then 31433965Sjdp OPENJDK_TARGET_OS_API_DIR="windows" 31533965Sjdp fi 31633965Sjdp AC_SUBST(OPENJDK_TARGET_OS_API_DIR) 31733965Sjdp 31833965Sjdp if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then 31989857Sobrien A_LP64="LP64:=" 32033965Sjdp # -D_LP64=1 is only set on linux and mac. Setting on windows causes diff in 32133965Sjdp # unpack200.exe 32233965Sjdp if test "x$OPENJDK_TARGET_OS" = xlinux || test "x$OPENJDK_TARGET_OS" = xmacosx; then 32333965Sjdp ADD_LP64="-D_LP64=1" 32433965Sjdp fi 32533965Sjdp fi 32633965Sjdp AC_SUBST(LP64,$A_LP64) 32789857Sobrien 32833965Sjdp if test "x$COMPILE_TYPE" = "xcross"; then 32933965Sjdp # FIXME: ... or should this include reduced builds..? 33033965Sjdp DEFINE_CROSS_COMPILE_ARCH="CROSS_COMPILE_ARCH:=$OPENJDK_TARGET_CPU_LEGACY" 33133965Sjdp else 33233965Sjdp DEFINE_CROSS_COMPILE_ARCH="" 33333965Sjdp fi 33433965Sjdp AC_SUBST(DEFINE_CROSS_COMPILE_ARCH) 33589857Sobrien 33633965Sjdp # ZERO_ARCHDEF is used to enable architecture-specific code 33733965Sjdp case "${OPENJDK_TARGET_CPU}" in 33833965Sjdp ppc*) ZERO_ARCHDEF=PPC ;; 33933965Sjdp s390*) ZERO_ARCHDEF=S390 ;; 34033965Sjdp sparc*) ZERO_ARCHDEF=SPARC ;; 34133965Sjdp x86_64*) ZERO_ARCHDEF=AMD64 ;; 34233965Sjdp x86) ZERO_ARCHDEF=IA32 ;; 34389857Sobrien *) ZERO_ARCHDEF=$(echo "${OPENJDK_TARGET_CPU_LEGACY_LIB}" | tr a-z A-Z) 34433965Sjdp esac 34533965Sjdp AC_SUBST(ZERO_ARCHDEF) 34633965Sjdp 34733965Sjdp]) 34833965Sjdp 34933965SjdpAC_DEFUN([PLATFORM_SET_RELEASE_FILE_OS_VALUES], 35033965Sjdp[ 35189857Sobrien if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then 35233965Sjdp REQUIRED_OS_NAME=SunOS 35333965Sjdp REQUIRED_OS_VERSION=5.10 35433965Sjdp fi 35533965Sjdp if test "x$OPENJDK_TARGET_OS" = "xlinux"; then 35633965Sjdp REQUIRED_OS_NAME=Linux 35733965Sjdp REQUIRED_OS_VERSION=2.6 35833965Sjdp fi 35989857Sobrien if test "x$OPENJDK_TARGET_OS" = "xwindows"; then 36033965Sjdp REQUIRED_OS_NAME=Windows 36133965Sjdp if test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then 36233965Sjdp REQUIRED_OS_VERSION=5.2 36333965Sjdp else 36433965Sjdp REQUIRED_OS_VERSION=5.1 36533965Sjdp fi 36633965Sjdp fi 36789857Sobrien if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then 36833965Sjdp REQUIRED_OS_NAME=Darwin 36933965Sjdp REQUIRED_OS_VERSION=11.2 37033965Sjdp fi 37133965Sjdp 37233965Sjdp AC_SUBST(REQUIRED_OS_NAME) 37333965Sjdp AC_SUBST(REQUIRED_OS_VERSION) 37433965Sjdp]) 37589857Sobrien 37633965Sjdp#%%% Build and target systems %%% 37733965SjdpAC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_AND_TARGET], 37833965Sjdp[ 37933965Sjdp# Figure out the build and target systems. # Note that in autoconf terminology, "build" is obvious, but "target" 38033965Sjdp# is confusing; it assumes you are cross-compiling a cross-compiler (!) and "target" is thus the target of the 38133965Sjdp# product you're building. The target of this build is called "host". Since this is confusing to most people, we 38233965Sjdp# have not adopted that system, but use "target" as the platform we are building for. In some places though we need 38389857Sobrien# to use the configure naming style. 38433965SjdpAC_CANONICAL_BUILD 38533965SjdpAC_CANONICAL_HOST 38633965SjdpAC_CANONICAL_TARGET 38733965Sjdp 38833965SjdpPLATFORM_EXTRACT_TARGET_AND_BUILD 38933965SjdpPLATFORM_SETUP_TARGET_CPU_BITS 39033965SjdpPLATFORM_SET_RELEASE_FILE_OS_VALUES 39189857SobrienPLATFORM_SETUP_LEGACY_VARS 39233965Sjdp]) 39333965Sjdp 39433965SjdpAC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_OS_VERSION], 39533965Sjdp[ 39633965Sjdp############################################################################### 39733965Sjdp 39833965Sjdp# Note that this is the build platform OS version! 39989857Sobrien 40033965SjdpOS_VERSION="`uname -r | ${SED} 's!\.! !g' | ${SED} 's!-! !g'`" 40133965SjdpOS_VERSION_MAJOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 1 -d ' '`" 40233965SjdpOS_VERSION_MINOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 2 -d ' '`" 40333965SjdpOS_VERSION_MICRO="`${ECHO} ${OS_VERSION} | ${CUT} -f 3 -d ' '`" 40433965SjdpAC_SUBST(OS_VERSION_MAJOR) 40533965SjdpAC_SUBST(OS_VERSION_MINOR) 40633965SjdpAC_SUBST(OS_VERSION_MICRO) 40789857Sobrien]) 40833965Sjdp 40933965Sjdp# Support macro for PLATFORM_SETUP_OPENJDK_TARGET_BITS. 41033965Sjdp# Add -mX to various FLAGS variables. 41133965SjdpAC_DEFUN([PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS], 41233965Sjdp[ 41333965Sjdp # keep track of c/cxx flags that we added outselves... 41433965Sjdp # to prevent emitting warning... 41589857Sobrien ADDED_CFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}" 41633965Sjdp ADDED_CXXFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}" 41733965Sjdp ADDED_LDFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}" 41833965Sjdp 41933965Sjdp CFLAGS="${CFLAGS}${ADDED_CFLAGS}" 42033965Sjdp CXXFLAGS="${CXXFLAGS}${ADDED_CXXFLAGS}" 42133965Sjdp LDFLAGS="${LDFLAGS}${ADDED_LDFLAGS}" 42233965Sjdp 42389857Sobrien CFLAGS_JDK="${CFLAGS_JDK}${ADDED_CFLAGS}" 42433965Sjdp CXXFLAGS_JDK="${CXXFLAGS_JDK}${ADDED_CXXFLAGS}" 42533965Sjdp LDFLAGS_JDK="${LDFLAGS_JDK}${ADDED_LDFLAGS}" 42633965Sjdp]) 42733965Sjdp 42833965SjdpAC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS], 42933965Sjdp[ 43033965Sjdp############################################################################### 43189857Sobrien# 43233965Sjdp# Now we check if libjvm.so will use 32 or 64 bit pointers for the C/C++ code. 43333965Sjdp# (The JVM can use 32 or 64 bit Java pointers but that decision 43433965Sjdp# is made at runtime.) 43533965Sjdp# 43633965Sjdp 43733965Sjdpif test "x$OPENJDK_TARGET_OS" = xsolaris; then 43833965Sjdp # Always specify -m flags on Solaris 43933965Sjdp PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS 44089857Sobrienelif test "x$COMPILE_TYPE" = xreduced; then 44133965Sjdp if test "x$OPENJDK_TARGET_OS" != xwindows; then 44233965Sjdp # Specify -m if running reduced on other Posix platforms 44333965Sjdp PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS 44433965Sjdp fi 44533965Sjdpfi 44633965Sjdp 44733965Sjdp# Make compilation sanity check 44889857SobrienAC_CHECK_HEADERS([stdio.h], , [ 44933965Sjdp AC_MSG_NOTICE([Failed to compile stdio.h. This likely implies missing compile dependencies.]) 45033965Sjdp if test "x$COMPILE_TYPE" = xreduced; then 45133965Sjdp AC_MSG_NOTICE([You are doing a reduced build. Check that you have 32-bit libraries installed.]) 45233965Sjdp elif test "x$COMPILE_TYPE" = xcross; then 45333965Sjdp AC_MSG_NOTICE([You are doing a cross-compilation. Check that you have all target platform libraries installed.]) 45433965Sjdp fi 45533965Sjdp AC_MSG_ERROR([Cannot continue.]) 45689857Sobrien]) 45733965Sjdp 45833965SjdpAC_CHECK_SIZEOF([int *], [1111]) 45933965Sjdp 46033965Sjdpif test "x$SIZEOF_INT_P" != "x$ac_cv_sizeof_int_p"; then 46133965Sjdp # Workaround autoconf bug, see http://lists.gnu.org/archive/html/autoconf/2010-07/msg00004.html 46233965Sjdp SIZEOF_INT_P="$ac_cv_sizeof_int_p" 46333965Sjdpfi 46489857Sobrien 46533965Sjdpif test "x$SIZEOF_INT_P" = x; then 46633965Sjdp # The test failed, lets stick to the assumed value. 46733965Sjdp AC_MSG_WARN([The number of bits in the target could not be determined, using $OPENJDK_TARGET_CPU_BITS.]) 46833965Sjdpelse 46933965Sjdp TESTED_TARGET_CPU_BITS=`expr 8 \* $SIZEOF_INT_P` 47033965Sjdp 47133965Sjdp if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then 47289857Sobrien AC_MSG_ERROR([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)]) 47333965Sjdp fi 47433965Sjdpfi 47533965Sjdp 47633965SjdpAC_MSG_CHECKING([for target address size]) 47733965SjdpAC_MSG_RESULT([$OPENJDK_TARGET_CPU_BITS bits]) 47833965Sjdp]) 47933965Sjdp 48089857SobrienAC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_ENDIANNESS], 48133965Sjdp[ 48289857Sobrien############################################################################### 48389857Sobrien# 48433965Sjdp# Is the target little of big endian? 48589857Sobrien# 48633965SjdpAC_C_BIGENDIAN([ENDIAN="big"],[ENDIAN="little"],[ENDIAN="unknown"],[ENDIAN="universal_endianness"]) 48733965Sjdp 48833965Sjdpif test "x$ENDIAN" = xuniversal_endianness; then 48989857Sobrien AC_MSG_ERROR([Building with both big and little endianness is not supported]) 49033965Sjdpfi 49133965Sjdpif test "x$ENDIAN" != "x$OPENJDK_TARGET_CPU_ENDIAN"; then 49233965Sjdp 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)]) 49333965Sjdpfi 49489857Sobrien]) 49533965Sjdp