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