aoqi@0: # aoqi@0: # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. aoqi@0: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: # aoqi@0: # This code is free software; you can redistribute it and/or modify it aoqi@0: # under the terms of the GNU General Public License version 2 only, as aoqi@0: # published by the Free Software Foundation. Oracle designates this aoqi@0: # particular file as subject to the "Classpath" exception as provided aoqi@0: # by Oracle in the LICENSE file that accompanied this code. aoqi@0: # aoqi@0: # This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: # version 2 for more details (a copy is included in the LICENSE file that aoqi@0: # accompanied this code). aoqi@0: # aoqi@0: # You should have received a copy of the GNU General Public License version aoqi@0: # 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: # aoqi@0: # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: # or visit www.oracle.com if you need additional information or have any aoqi@0: # questions. aoqi@0: # aoqi@0: aoqi@0: # Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD. aoqi@0: # Converts autoconf style CPU name to OpenJDK style, into aoqi@0: # VAR_CPU, VAR_CPU_ARCH, VAR_CPU_BITS and VAR_CPU_ENDIAN. aoqi@0: AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU], aoqi@0: [ aoqi@0: # First argument is the cpu name from the trip/quad aoqi@0: case "$1" in aoqi@0: x86_64) aoqi@0: VAR_CPU=x86_64 aoqi@0: VAR_CPU_ARCH=x86 aoqi@0: VAR_CPU_BITS=64 aoqi@0: VAR_CPU_ENDIAN=little aoqi@0: ;; aoqi@0: i?86) aoqi@0: VAR_CPU=x86 aoqi@0: VAR_CPU_ARCH=x86 aoqi@0: VAR_CPU_BITS=32 aoqi@0: VAR_CPU_ENDIAN=little aoqi@0: ;; aoqi@0: arm*) aoqi@0: VAR_CPU=arm aoqi@0: VAR_CPU_ARCH=arm aoqi@0: VAR_CPU_BITS=32 aoqi@0: VAR_CPU_ENDIAN=little aoqi@0: ;; aoqi@0: powerpc) aoqi@0: VAR_CPU=ppc aoqi@0: VAR_CPU_ARCH=ppc aoqi@0: VAR_CPU_BITS=32 aoqi@0: VAR_CPU_ENDIAN=big aoqi@0: ;; aoqi@0: powerpc64) aoqi@0: VAR_CPU=ppc64 aoqi@0: VAR_CPU_ARCH=ppc aoqi@0: VAR_CPU_BITS=64 aoqi@0: VAR_CPU_ENDIAN=big aoqi@0: ;; aoqi@0: powerpc64le) aoqi@0: VAR_CPU=ppc64 aoqi@0: VAR_CPU_ARCH=ppc aoqi@0: VAR_CPU_BITS=64 aoqi@0: VAR_CPU_ENDIAN=little aoqi@0: ;; aoqi@0: s390) aoqi@0: VAR_CPU=s390 aoqi@0: VAR_CPU_ARCH=s390 aoqi@0: VAR_CPU_BITS=32 aoqi@0: VAR_CPU_ENDIAN=big aoqi@0: ;; aoqi@0: s390x) aoqi@0: VAR_CPU=s390x aoqi@0: VAR_CPU_ARCH=s390 aoqi@0: VAR_CPU_BITS=64 aoqi@0: VAR_CPU_ENDIAN=big aoqi@0: ;; aoqi@0: sparc) aoqi@0: VAR_CPU=sparc aoqi@0: VAR_CPU_ARCH=sparc aoqi@0: VAR_CPU_BITS=32 aoqi@0: VAR_CPU_ENDIAN=big aoqi@0: ;; aoqi@0: sparcv9) aoqi@0: VAR_CPU=sparcv9 aoqi@0: VAR_CPU_ARCH=sparc aoqi@0: VAR_CPU_BITS=64 aoqi@0: VAR_CPU_ENDIAN=big aoqi@0: ;; aoqi@0: *) aoqi@0: AC_MSG_ERROR([unsupported cpu $1]) aoqi@0: ;; aoqi@0: esac aoqi@0: ]) aoqi@0: aoqi@0: # Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD. aoqi@0: # Converts autoconf style OS name to OpenJDK style, into aoqi@0: # VAR_OS and VAR_OS_API. aoqi@0: AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_OS], aoqi@0: [ aoqi@0: case "$1" in aoqi@0: *linux*) aoqi@0: VAR_OS=linux aoqi@0: VAR_OS_API=posix aoqi@0: VAR_OS_ENV=linux aoqi@0: ;; aoqi@0: *solaris*) aoqi@0: VAR_OS=solaris aoqi@0: VAR_OS_API=posix aoqi@0: VAR_OS_ENV=solaris aoqi@0: ;; aoqi@0: *darwin*) aoqi@0: VAR_OS=macosx aoqi@0: VAR_OS_API=posix aoqi@0: VAR_OS_ENV=macosx aoqi@0: ;; aoqi@0: *bsd*) aoqi@0: VAR_OS=bsd aoqi@0: VAR_OS_API=posix aoqi@0: VAR_OS_ENV=bsd aoqi@0: ;; aoqi@0: *cygwin*) aoqi@0: VAR_OS=windows aoqi@0: VAR_OS_API=winapi aoqi@0: VAR_OS_ENV=windows.cygwin aoqi@0: ;; aoqi@0: *mingw*) aoqi@0: VAR_OS=windows aoqi@0: VAR_OS_API=winapi aoqi@0: VAR_OS_ENV=windows.msys aoqi@0: ;; aoqi@0: *aix*) aoqi@0: VAR_OS=aix aoqi@0: VAR_OS_API=posix aoqi@0: VAR_OS_ENV=aix aoqi@0: ;; aoqi@0: *) aoqi@0: AC_MSG_ERROR([unsupported operating system $1]) aoqi@0: ;; aoqi@0: esac aoqi@0: ]) aoqi@0: aoqi@0: # Expects $host_os $host_cpu $build_os and $build_cpu aoqi@0: # and $with_target_bits to have been setup! aoqi@0: # aoqi@0: # Translate the standard triplet(quadruplet) definition aoqi@0: # of the target/build system into OPENJDK_TARGET_OS, OPENJDK_TARGET_CPU, aoqi@0: # OPENJDK_BUILD_OS, etc. aoqi@0: AC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD], aoqi@0: [ aoqi@0: # Copy the autoconf trip/quadruplet verbatim to OPENJDK_TARGET_AUTOCONF_NAME aoqi@0: # (from the autoconf "host") and OPENJDK_BUILD_AUTOCONF_NAME aoqi@0: # Note that we might later on rewrite e.g. OPENJDK_TARGET_CPU due to reduced build, aoqi@0: # but this will not change the value of OPENJDK_TARGET_AUTOCONF_NAME. aoqi@0: OPENJDK_TARGET_AUTOCONF_NAME="$host" aoqi@0: OPENJDK_BUILD_AUTOCONF_NAME="$build" aoqi@0: AC_SUBST(OPENJDK_TARGET_AUTOCONF_NAME) aoqi@0: AC_SUBST(OPENJDK_BUILD_AUTOCONF_NAME) aoqi@0: aoqi@0: # Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables. aoqi@0: PLATFORM_EXTRACT_VARS_FROM_OS($build_os) aoqi@0: PLATFORM_EXTRACT_VARS_FROM_CPU($build_cpu) aoqi@0: # ..and setup our own variables. (Do this explicitely to facilitate searching) aoqi@0: OPENJDK_BUILD_OS="$VAR_OS" aoqi@0: OPENJDK_BUILD_OS_API="$VAR_OS_API" aoqi@0: OPENJDK_BUILD_OS_ENV="$VAR_OS_ENV" aoqi@0: OPENJDK_BUILD_CPU="$VAR_CPU" aoqi@0: OPENJDK_BUILD_CPU_ARCH="$VAR_CPU_ARCH" aoqi@0: OPENJDK_BUILD_CPU_BITS="$VAR_CPU_BITS" aoqi@0: OPENJDK_BUILD_CPU_ENDIAN="$VAR_CPU_ENDIAN" aoqi@0: AC_SUBST(OPENJDK_BUILD_OS) aoqi@0: AC_SUBST(OPENJDK_BUILD_OS_API) aoqi@0: AC_SUBST(OPENJDK_BUILD_CPU) aoqi@0: AC_SUBST(OPENJDK_BUILD_CPU_ARCH) aoqi@0: AC_SUBST(OPENJDK_BUILD_CPU_BITS) aoqi@0: AC_SUBST(OPENJDK_BUILD_CPU_ENDIAN) aoqi@0: aoqi@0: AC_MSG_CHECKING([openjdk-build os-cpu]) aoqi@0: AC_MSG_RESULT([$OPENJDK_BUILD_OS-$OPENJDK_BUILD_CPU]) aoqi@0: aoqi@0: # Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables. aoqi@0: PLATFORM_EXTRACT_VARS_FROM_OS($host_os) aoqi@0: PLATFORM_EXTRACT_VARS_FROM_CPU($host_cpu) aoqi@0: # ... and setup our own variables. (Do this explicitely to facilitate searching) aoqi@0: OPENJDK_TARGET_OS="$VAR_OS" aoqi@0: OPENJDK_TARGET_OS_API="$VAR_OS_API" aoqi@0: OPENJDK_TARGET_OS_ENV="$VAR_OS_ENV" aoqi@0: OPENJDK_TARGET_CPU="$VAR_CPU" aoqi@0: OPENJDK_TARGET_CPU_ARCH="$VAR_CPU_ARCH" aoqi@0: OPENJDK_TARGET_CPU_BITS="$VAR_CPU_BITS" aoqi@0: OPENJDK_TARGET_CPU_ENDIAN="$VAR_CPU_ENDIAN" aoqi@0: AC_SUBST(OPENJDK_TARGET_OS) aoqi@0: AC_SUBST(OPENJDK_TARGET_OS_API) aoqi@0: AC_SUBST(OPENJDK_TARGET_CPU) aoqi@0: AC_SUBST(OPENJDK_TARGET_CPU_ARCH) aoqi@0: AC_SUBST(OPENJDK_TARGET_CPU_BITS) aoqi@0: AC_SUBST(OPENJDK_TARGET_CPU_ENDIAN) aoqi@0: aoqi@0: AC_MSG_CHECKING([openjdk-target os-cpu]) aoqi@0: AC_MSG_RESULT([$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU]) aoqi@0: ]) aoqi@0: aoqi@0: # Check if a reduced build (32-bit on 64-bit platforms) is requested, and modify behaviour aoqi@0: # accordingly. Must be done after setting up build and target system, but before aoqi@0: # doing anything else with these values. aoqi@0: AC_DEFUN([PLATFORM_SETUP_TARGET_CPU_BITS], aoqi@0: [ aoqi@0: AC_ARG_WITH(target-bits, [AS_HELP_STRING([--with-target-bits], aoqi@0: [build 32-bit or 64-bit binaries (for platforms that support it), e.g. --with-target-bits=32 @<:@guessed@:>@])]) aoqi@0: aoqi@0: # We have three types of compiles: aoqi@0: # native == normal compilation, target system == build system aoqi@0: # cross == traditional cross compilation, target system != build system; special toolchain needed aoqi@0: # reduced == using native compilers, but with special flags (e.g. -m32) to produce 32-bit builds on 64-bit machines aoqi@0: # aoqi@0: if test "x$OPENJDK_BUILD_AUTOCONF_NAME" != "x$OPENJDK_TARGET_AUTOCONF_NAME"; then aoqi@0: # We're doing a proper cross-compilation aoqi@0: COMPILE_TYPE="cross" aoqi@0: else aoqi@0: COMPILE_TYPE="native" aoqi@0: fi aoqi@0: aoqi@0: if test "x$with_target_bits" != x; then aoqi@0: if test "x$COMPILE_TYPE" = "xcross"; then aoqi@0: AC_MSG_ERROR([It is not possible to combine --with-target-bits=X and proper cross-compilation. Choose either.]) aoqi@0: fi aoqi@0: aoqi@0: if test "x$with_target_bits" = x32 && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then aoqi@0: # A reduced build is requested aoqi@0: COMPILE_TYPE="reduced" aoqi@0: OPENJDK_TARGET_CPU_BITS=32 aoqi@0: if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86"; then aoqi@0: OPENJDK_TARGET_CPU=x86 aoqi@0: elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then aoqi@0: OPENJDK_TARGET_CPU=sparc aoqi@0: else aoqi@0: AC_MSG_ERROR([Reduced build (--with-target-bits=32) is only supported on x86_64 and sparcv9]) aoqi@0: fi aoqi@0: elif test "x$with_target_bits" = x64 && test "x$OPENJDK_TARGET_CPU_BITS" = x32; then aoqi@0: AC_MSG_ERROR([It is not possible to use --with-target-bits=64 on a 32 bit system. Use proper cross-compilation instead.]) aoqi@0: elif test "x$with_target_bits" = "x$OPENJDK_TARGET_CPU_BITS"; then aoqi@0: AC_MSG_NOTICE([--with-target-bits are set to build platform address size; argument has no meaning]) aoqi@0: else aoqi@0: AC_MSG_ERROR([--with-target-bits can only be 32 or 64, you specified $with_target_bits!]) aoqi@0: fi aoqi@0: fi aoqi@0: AC_SUBST(COMPILE_TYPE) aoqi@0: aoqi@0: AC_MSG_CHECKING([compilation type]) aoqi@0: AC_MSG_RESULT([$COMPILE_TYPE]) aoqi@0: ]) aoqi@0: aoqi@0: # Setup the legacy variables, for controlling the old makefiles. aoqi@0: # aoqi@0: AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS], aoqi@0: [ aoqi@0: # Also store the legacy naming of the cpu. aoqi@0: # Ie i586 and amd64 instead of x86 and x86_64 aoqi@0: OPENJDK_TARGET_CPU_LEGACY="$OPENJDK_TARGET_CPU" aoqi@0: if test "x$OPENJDK_TARGET_CPU" = xx86; then aoqi@0: OPENJDK_TARGET_CPU_LEGACY="i586" aoqi@0: elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then aoqi@0: # On all platforms except MacOSX replace x86_64 with amd64. aoqi@0: OPENJDK_TARGET_CPU_LEGACY="amd64" aoqi@0: fi aoqi@0: AC_SUBST(OPENJDK_TARGET_CPU_LEGACY) aoqi@0: aoqi@0: # And the second legacy naming of the cpu. aoqi@0: # Ie i386 and amd64 instead of x86 and x86_64. aoqi@0: OPENJDK_TARGET_CPU_LEGACY_LIB="$OPENJDK_TARGET_CPU" aoqi@0: if test "x$OPENJDK_TARGET_CPU" = xx86; then aoqi@0: OPENJDK_TARGET_CPU_LEGACY_LIB="i386" aoqi@0: elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then aoqi@0: OPENJDK_TARGET_CPU_LEGACY_LIB="amd64" aoqi@0: fi aoqi@0: AC_SUBST(OPENJDK_TARGET_CPU_LEGACY_LIB) aoqi@0: aoqi@0: # This is the name of the cpu (but using i386 and amd64 instead of aoqi@0: # x86 and x86_64, respectively), preceeded by a /, to be used when aoqi@0: # locating libraries. On macosx, it's empty, though. aoqi@0: OPENJDK_TARGET_CPU_LIBDIR="/$OPENJDK_TARGET_CPU_LEGACY_LIB" aoqi@0: if test "x$OPENJDK_TARGET_OS" = xmacosx; then aoqi@0: OPENJDK_TARGET_CPU_LIBDIR="" aoqi@0: fi aoqi@0: AC_SUBST(OPENJDK_TARGET_CPU_LIBDIR) aoqi@0: aoqi@0: # OPENJDK_TARGET_CPU_ISADIR is normally empty. On 64-bit Solaris systems, it is set to aoqi@0: # /amd64 or /sparcv9. This string is appended to some library paths, like this: aoqi@0: # /usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libexample.so aoqi@0: OPENJDK_TARGET_CPU_ISADIR="" aoqi@0: if test "x$OPENJDK_TARGET_OS" = xsolaris; then aoqi@0: if test "x$OPENJDK_TARGET_CPU" = xx86_64; then aoqi@0: OPENJDK_TARGET_CPU_ISADIR="/amd64" aoqi@0: elif test "x$OPENJDK_TARGET_CPU" = xsparcv9; then aoqi@0: OPENJDK_TARGET_CPU_ISADIR="/sparcv9" aoqi@0: fi aoqi@0: fi aoqi@0: AC_SUBST(OPENJDK_TARGET_CPU_ISADIR) aoqi@0: aoqi@0: # Setup OPENJDK_TARGET_CPU_OSARCH, which is used to set the os.arch Java system property aoqi@0: OPENJDK_TARGET_CPU_OSARCH="$OPENJDK_TARGET_CPU" aoqi@0: if test "x$OPENJDK_TARGET_OS" = xlinux && test "x$OPENJDK_TARGET_CPU" = xx86; then aoqi@0: # On linux only, we replace x86 with i386. aoqi@0: OPENJDK_TARGET_CPU_OSARCH="i386" aoqi@0: elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then aoqi@0: # On all platforms except macosx, we replace x86_64 with amd64. aoqi@0: OPENJDK_TARGET_CPU_OSARCH="amd64" aoqi@0: fi aoqi@0: AC_SUBST(OPENJDK_TARGET_CPU_OSARCH) aoqi@0: aoqi@0: OPENJDK_TARGET_CPU_JLI="$OPENJDK_TARGET_CPU" aoqi@0: if test "x$OPENJDK_TARGET_CPU" = xx86; then aoqi@0: OPENJDK_TARGET_CPU_JLI="i386" aoqi@0: elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then aoqi@0: # On all platforms except macosx, we replace x86_64 with amd64. aoqi@0: OPENJDK_TARGET_CPU_JLI="amd64" aoqi@0: fi aoqi@0: # Now setup the -D flags for building libjli. aoqi@0: OPENJDK_TARGET_CPU_JLI_CFLAGS="-DLIBARCHNAME='\"$OPENJDK_TARGET_CPU_JLI\"'" aoqi@0: if test "x$OPENJDK_TARGET_OS" = xsolaris; then aoqi@0: if test "x$OPENJDK_TARGET_CPU_ARCH" = xsparc; then aoqi@0: OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"sparc\"' -DLIBARCH64NAME='\"sparcv9\"'" aoqi@0: elif test "x$OPENJDK_TARGET_CPU_ARCH" = xx86; then aoqi@0: OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"i386\"' -DLIBARCH64NAME='\"amd64\"'" aoqi@0: fi aoqi@0: fi aoqi@0: AC_SUBST(OPENJDK_TARGET_CPU_JLI_CFLAGS) aoqi@0: aoqi@0: # Setup OPENJDK_TARGET_OS_API_DIR, used in source paths. aoqi@0: if test "x$OPENJDK_TARGET_OS_API" = xposix; then aoqi@0: OPENJDK_TARGET_OS_API_DIR="solaris" aoqi@0: fi aoqi@0: if test "x$OPENJDK_TARGET_OS_API" = xwinapi; then aoqi@0: OPENJDK_TARGET_OS_API_DIR="windows" aoqi@0: fi aoqi@0: AC_SUBST(OPENJDK_TARGET_OS_API_DIR) aoqi@0: aoqi@0: if test "x$OPENJDK_TARGET_OS" = xmacosx; then aoqi@0: OPENJDK_TARGET_OS_EXPORT_DIR=macosx aoqi@0: else aoqi@0: OPENJDK_TARGET_OS_EXPORT_DIR=${OPENJDK_TARGET_OS_API_DIR} aoqi@0: fi aoqi@0: AC_SUBST(OPENJDK_TARGET_OS_EXPORT_DIR) aoqi@0: aoqi@0: if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then aoqi@0: A_LP64="LP64:=" aoqi@0: # -D_LP64=1 is only set on linux and mac. Setting on windows causes diff in aoqi@0: # unpack200.exe aoqi@0: if test "x$OPENJDK_TARGET_OS" = xlinux || test "x$OPENJDK_TARGET_OS" = xmacosx; then aoqi@0: ADD_LP64="-D_LP64=1" aoqi@0: fi aoqi@0: fi aoqi@0: AC_SUBST(LP64,$A_LP64) aoqi@0: aoqi@0: if test "x$COMPILE_TYPE" = "xcross"; then aoqi@0: # FIXME: ... or should this include reduced builds..? aoqi@0: DEFINE_CROSS_COMPILE_ARCH="CROSS_COMPILE_ARCH:=$OPENJDK_TARGET_CPU_LEGACY" aoqi@0: else aoqi@0: DEFINE_CROSS_COMPILE_ARCH="" aoqi@0: fi aoqi@0: AC_SUBST(DEFINE_CROSS_COMPILE_ARCH) aoqi@0: aoqi@0: # ZERO_ARCHDEF is used to enable architecture-specific code aoqi@0: case "${OPENJDK_TARGET_CPU}" in aoqi@0: ppc*) ZERO_ARCHDEF=PPC ;; aoqi@0: s390*) ZERO_ARCHDEF=S390 ;; aoqi@0: sparc*) ZERO_ARCHDEF=SPARC ;; aoqi@0: x86_64*) ZERO_ARCHDEF=AMD64 ;; aoqi@0: x86) ZERO_ARCHDEF=IA32 ;; aoqi@0: *) ZERO_ARCHDEF=$(echo "${OPENJDK_TARGET_CPU_LEGACY_LIB}" | tr a-z A-Z) aoqi@0: esac aoqi@0: AC_SUBST(ZERO_ARCHDEF) aoqi@0: ]) aoqi@0: aoqi@0: AC_DEFUN([PLATFORM_SET_RELEASE_FILE_OS_VALUES], aoqi@0: [ aoqi@0: if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then aoqi@0: REQUIRED_OS_NAME=SunOS aoqi@0: REQUIRED_OS_VERSION=5.10 aoqi@0: fi aoqi@0: if test "x$OPENJDK_TARGET_OS" = "xlinux"; then aoqi@0: REQUIRED_OS_NAME=Linux aoqi@0: REQUIRED_OS_VERSION=2.6 aoqi@0: fi aoqi@0: if test "x$OPENJDK_TARGET_OS" = "xwindows"; then aoqi@0: REQUIRED_OS_NAME=Windows aoqi@0: if test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then aoqi@0: REQUIRED_OS_VERSION=5.2 aoqi@0: else aoqi@0: REQUIRED_OS_VERSION=5.1 aoqi@0: fi aoqi@0: fi aoqi@0: if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then aoqi@0: REQUIRED_OS_NAME=Darwin aoqi@0: REQUIRED_OS_VERSION=11.2 aoqi@0: fi aoqi@0: aoqi@0: AC_SUBST(REQUIRED_OS_NAME) aoqi@0: AC_SUBST(REQUIRED_OS_VERSION) aoqi@0: ]) aoqi@0: aoqi@0: #%%% Build and target systems %%% aoqi@0: AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_AND_TARGET], aoqi@0: [ aoqi@0: # Figure out the build and target systems. # Note that in autoconf terminology, "build" is obvious, but "target" aoqi@0: # is confusing; it assumes you are cross-compiling a cross-compiler (!) and "target" is thus the target of the aoqi@0: # product you're building. The target of this build is called "host". Since this is confusing to most people, we aoqi@0: # have not adopted that system, but use "target" as the platform we are building for. In some places though we need aoqi@0: # to use the configure naming style. aoqi@0: AC_CANONICAL_BUILD aoqi@0: AC_CANONICAL_HOST aoqi@0: AC_CANONICAL_TARGET aoqi@0: aoqi@0: PLATFORM_EXTRACT_TARGET_AND_BUILD aoqi@0: PLATFORM_SETUP_TARGET_CPU_BITS aoqi@0: PLATFORM_SET_RELEASE_FILE_OS_VALUES aoqi@0: PLATFORM_SETUP_LEGACY_VARS aoqi@0: ]) aoqi@0: aoqi@0: AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_OS_VERSION], aoqi@0: [ aoqi@0: ############################################################################### aoqi@0: aoqi@0: # Note that this is the build platform OS version! aoqi@0: aoqi@0: OS_VERSION="`uname -r | ${SED} 's!\.! !g' | ${SED} 's!-! !g'`" aoqi@0: OS_VERSION_MAJOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 1 -d ' '`" aoqi@0: OS_VERSION_MINOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 2 -d ' '`" aoqi@0: OS_VERSION_MICRO="`${ECHO} ${OS_VERSION} | ${CUT} -f 3 -d ' '`" aoqi@0: AC_SUBST(OS_VERSION_MAJOR) aoqi@0: AC_SUBST(OS_VERSION_MINOR) aoqi@0: AC_SUBST(OS_VERSION_MICRO) aoqi@0: ]) aoqi@0: aoqi@0: # Support macro for PLATFORM_SETUP_OPENJDK_TARGET_BITS. aoqi@0: # Add -mX to various FLAGS variables. aoqi@0: AC_DEFUN([PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS], aoqi@0: [ aoqi@0: # When we add flags to the "official" CFLAGS etc, we need to aoqi@0: # keep track of these additions in ADDED_CFLAGS etc. These aoqi@0: # will later be checked to make sure only controlled additions aoqi@0: # have been made to CFLAGS etc. aoqi@0: ADDED_CFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}" aoqi@0: ADDED_CXXFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}" aoqi@0: ADDED_LDFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}" aoqi@0: aoqi@0: CFLAGS="${CFLAGS}${ADDED_CFLAGS}" aoqi@0: CXXFLAGS="${CXXFLAGS}${ADDED_CXXFLAGS}" aoqi@0: LDFLAGS="${LDFLAGS}${ADDED_LDFLAGS}" aoqi@0: aoqi@0: CFLAGS_JDK="${CFLAGS_JDK}${ADDED_CFLAGS}" aoqi@0: CXXFLAGS_JDK="${CXXFLAGS_JDK}${ADDED_CXXFLAGS}" aoqi@0: LDFLAGS_JDK="${LDFLAGS_JDK}${ADDED_LDFLAGS}" aoqi@0: ]) aoqi@0: aoqi@0: AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS], aoqi@0: [ aoqi@0: ############################################################################### aoqi@0: # aoqi@0: # Now we check if libjvm.so will use 32 or 64 bit pointers for the C/C++ code. aoqi@0: # (The JVM can use 32 or 64 bit Java pointers but that decision aoqi@0: # is made at runtime.) aoqi@0: # aoqi@0: aoqi@0: if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xaix; then aoqi@0: # Always specify -m flag on Solaris aoqi@0: # And -q on AIX because otherwise the compiler produces 32-bit objects by default aoqi@0: PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS aoqi@0: elif test "x$COMPILE_TYPE" = xreduced; then aoqi@0: if test "x$OPENJDK_TARGET_OS" != xwindows; then aoqi@0: # Specify -m if running reduced on other Posix platforms aoqi@0: PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS aoqi@0: fi aoqi@0: fi aoqi@0: aoqi@0: # Make compilation sanity check aoqi@0: AC_CHECK_HEADERS([stdio.h], , [ aoqi@0: AC_MSG_NOTICE([Failed to compile stdio.h. This likely implies missing compile dependencies.]) aoqi@0: if test "x$COMPILE_TYPE" = xreduced; then aoqi@0: AC_MSG_NOTICE([You are doing a reduced build. Check that you have 32-bit libraries installed.]) aoqi@0: elif test "x$COMPILE_TYPE" = xcross; then aoqi@0: AC_MSG_NOTICE([You are doing a cross-compilation. Check that you have all target platform libraries installed.]) aoqi@0: fi aoqi@0: AC_MSG_ERROR([Cannot continue.]) aoqi@0: ]) aoqi@0: aoqi@0: AC_CHECK_SIZEOF([int *], [1111]) aoqi@0: aoqi@0: # AC_CHECK_SIZEOF defines 'ac_cv_sizeof_int_p' to hold the number of bytes used by an 'int*' aoqi@0: if test "x$ac_cv_sizeof_int_p" = x; then aoqi@0: # The test failed, lets stick to the assumed value. aoqi@0: AC_MSG_WARN([The number of bits in the target could not be determined, using $OPENJDK_TARGET_CPU_BITS.]) aoqi@0: else aoqi@0: TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p` aoqi@0: aoqi@0: if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then aoqi@0: # This situation may happen on 64-bit platforms where the compiler by default only generates 32-bit objects aoqi@0: # Let's try to implicitely set the compilers target architecture and retry the test aoqi@0: 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).]) aoqi@0: AC_MSG_NOTICE([I'll retry after setting the platforms compiler target bits flag to ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}]) aoqi@0: PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS aoqi@0: aoqi@0: # We have to unset 'ac_cv_sizeof_int_p' first, otherwise AC_CHECK_SIZEOF will use the previously cached value! aoqi@0: unset ac_cv_sizeof_int_p aoqi@0: # And we have to undef the definition of SIZEOF_INT_P in confdefs.h by the previous invocation of AC_CHECK_SIZEOF aoqi@0: cat >>confdefs.h <<_ACEOF aoqi@0: #undef SIZEOF_INT_P aoqi@0: _ACEOF aoqi@0: aoqi@0: AC_CHECK_SIZEOF([int *], [1111]) aoqi@0: aoqi@0: TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p` aoqi@0: aoqi@0: if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then aoqi@0: 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)]) aoqi@0: fi aoqi@0: fi aoqi@0: fi aoqi@0: aoqi@0: AC_MSG_CHECKING([for target address size]) aoqi@0: AC_MSG_RESULT([$OPENJDK_TARGET_CPU_BITS bits]) aoqi@0: ]) aoqi@0: aoqi@0: AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_ENDIANNESS], aoqi@0: [ aoqi@0: ############################################################################### aoqi@0: # aoqi@0: # Is the target little of big endian? aoqi@0: # aoqi@0: AC_C_BIGENDIAN([ENDIAN="big"],[ENDIAN="little"],[ENDIAN="unknown"],[ENDIAN="universal_endianness"]) aoqi@0: aoqi@0: if test "x$ENDIAN" = xuniversal_endianness; then aoqi@0: AC_MSG_ERROR([Building with both big and little endianness is not supported]) aoqi@0: fi aoqi@0: if test "x$ENDIAN" != "x$OPENJDK_TARGET_CPU_ENDIAN"; then aoqi@0: 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)]) aoqi@0: fi aoqi@0: ])