Thu, 01 Aug 2013 17:24:26 -0700
Merge
ohair@425 | 1 | # |
ohair@425 | 2 | # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
ohair@425 | 3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ohair@425 | 4 | # |
ohair@425 | 5 | # This code is free software; you can redistribute it and/or modify it |
ohair@425 | 6 | # under the terms of the GNU General Public License version 2 only, as |
ohair@425 | 7 | # published by the Free Software Foundation. Oracle designates this |
ohair@425 | 8 | # particular file as subject to the "Classpath" exception as provided |
ohair@425 | 9 | # by Oracle in the LICENSE file that accompanied this code. |
ohair@425 | 10 | # |
ohair@425 | 11 | # This code is distributed in the hope that it will be useful, but WITHOUT |
ohair@425 | 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ohair@425 | 13 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ohair@425 | 14 | # version 2 for more details (a copy is included in the LICENSE file that |
ohair@425 | 15 | # accompanied this code). |
ohair@425 | 16 | # |
ohair@425 | 17 | # You should have received a copy of the GNU General Public License version |
ohair@425 | 18 | # 2 along with this work; if not, write to the Free Software Foundation, |
ohair@425 | 19 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ohair@425 | 20 | # |
ohair@425 | 21 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@425 | 22 | # or visit www.oracle.com if you need additional information or have any |
ohair@425 | 23 | # questions. |
ohair@425 | 24 | # |
ohair@425 | 25 | |
ohair@478 | 26 | # Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD. |
ohair@478 | 27 | # Converts autoconf style CPU name to OpenJDK style, into |
ohair@478 | 28 | # VAR_CPU, VAR_CPU_ARCH, VAR_CPU_BITS and VAR_CPU_ENDIAN. |
erikj@458 | 29 | AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU], |
ohair@425 | 30 | [ |
ohair@425 | 31 | # First argument is the cpu name from the trip/quad |
ohair@425 | 32 | case "$1" in |
ohair@425 | 33 | x86_64) |
ohair@478 | 34 | VAR_CPU=x86_64 |
ohair@425 | 35 | VAR_CPU_ARCH=x86 |
ohair@425 | 36 | VAR_CPU_BITS=64 |
ohair@425 | 37 | VAR_CPU_ENDIAN=little |
ohair@425 | 38 | ;; |
ohair@425 | 39 | i?86) |
ohair@478 | 40 | VAR_CPU=x86 |
ohair@425 | 41 | VAR_CPU_ARCH=x86 |
ohair@425 | 42 | VAR_CPU_BITS=32 |
ohair@425 | 43 | VAR_CPU_ENDIAN=little |
ohair@425 | 44 | ;; |
ohair@425 | 45 | arm*) |
ohair@425 | 46 | VAR_CPU=arm |
ohair@425 | 47 | VAR_CPU_ARCH=arm |
erikj@458 | 48 | VAR_CPU_BITS=32 |
erikj@458 | 49 | VAR_CPU_ENDIAN=little |
ohair@425 | 50 | ;; |
ohair@425 | 51 | powerpc) |
ohair@425 | 52 | VAR_CPU=ppc |
ohair@425 | 53 | VAR_CPU_ARCH=ppc |
ohair@425 | 54 | VAR_CPU_BITS=32 |
ohair@425 | 55 | VAR_CPU_ENDIAN=big |
ohair@425 | 56 | ;; |
ohair@425 | 57 | powerpc64) |
ohair@425 | 58 | VAR_CPU=ppc64 |
ohair@425 | 59 | VAR_CPU_ARCH=ppc |
ohair@425 | 60 | VAR_CPU_BITS=64 |
erikj@458 | 61 | VAR_CPU_ENDIAN=big |
ohair@425 | 62 | ;; |
ohair@425 | 63 | sparc) |
ohair@425 | 64 | VAR_CPU=sparc |
ohair@425 | 65 | VAR_CPU_ARCH=sparc |
ohair@425 | 66 | VAR_CPU_BITS=32 |
ohair@425 | 67 | VAR_CPU_ENDIAN=big |
ohair@425 | 68 | ;; |
ohair@478 | 69 | sparcv9) |
ohair@425 | 70 | VAR_CPU=sparcv9 |
ohair@425 | 71 | VAR_CPU_ARCH=sparc |
ohair@425 | 72 | VAR_CPU_BITS=64 |
ohair@425 | 73 | VAR_CPU_ENDIAN=big |
ohair@425 | 74 | ;; |
ohair@425 | 75 | *) |
erikj@445 | 76 | AC_MSG_ERROR([unsupported cpu $1]) |
ohair@425 | 77 | ;; |
ohair@425 | 78 | esac |
ohair@425 | 79 | ]) |
ohair@425 | 80 | |
ohair@478 | 81 | # Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD. |
ohair@478 | 82 | # Converts autoconf style OS name to OpenJDK style, into |
ohair@478 | 83 | # VAR_OS and VAR_OS_API. |
erikj@458 | 84 | AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_OS], |
ohair@425 | 85 | [ |
ohair@425 | 86 | case "$1" in |
ohair@425 | 87 | *linux*) |
ohair@425 | 88 | VAR_OS=linux |
ohair@425 | 89 | VAR_OS_API=posix |
ohair@494 | 90 | VAR_OS_ENV=linux |
ohair@425 | 91 | ;; |
ohair@425 | 92 | *solaris*) |
ohair@425 | 93 | VAR_OS=solaris |
ohair@425 | 94 | VAR_OS_API=posix |
ohair@494 | 95 | VAR_OS_ENV=solaris |
ohair@425 | 96 | ;; |
ohair@425 | 97 | *darwin*) |
ohair@425 | 98 | VAR_OS=macosx |
ohair@425 | 99 | VAR_OS_API=posix |
ohair@494 | 100 | VAR_OS_ENV=macosx |
ohair@425 | 101 | ;; |
ohair@425 | 102 | *bsd*) |
ohair@425 | 103 | VAR_OS=bsd |
ohair@425 | 104 | VAR_OS_API=posix |
ohair@494 | 105 | VAR_OS_ENV=bsd |
ohair@425 | 106 | ;; |
ohair@494 | 107 | *cygwin*) |
ohair@425 | 108 | VAR_OS=windows |
ohair@425 | 109 | VAR_OS_API=winapi |
ohair@494 | 110 | VAR_OS_ENV=windows.cygwin |
ohair@494 | 111 | ;; |
ohair@494 | 112 | *mingw*) |
ohair@494 | 113 | VAR_OS=windows |
ohair@494 | 114 | VAR_OS_API=winapi |
ohair@494 | 115 | VAR_OS_ENV=windows.msys |
ohair@425 | 116 | ;; |
ohair@425 | 117 | *) |
erikj@458 | 118 | AC_MSG_ERROR([unsupported operating system $1]) |
ohair@425 | 119 | ;; |
ohair@425 | 120 | esac |
ohair@425 | 121 | ]) |
ohair@425 | 122 | |
ohair@478 | 123 | # Expects $host_os $host_cpu $build_os and $build_cpu |
ohair@478 | 124 | # and $with_target_bits to have been setup! |
ohair@478 | 125 | # |
ohair@478 | 126 | # Translate the standard triplet(quadruplet) definition |
ohair@478 | 127 | # of the target/build system into OPENJDK_TARGET_OS, OPENJDK_TARGET_CPU, |
ohair@478 | 128 | # OPENJDK_BUILD_OS, etc. |
ohair@478 | 129 | AC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD], |
ohair@478 | 130 | [ |
ohair@478 | 131 | # Copy the autoconf trip/quadruplet verbatim to OPENJDK_TARGET_AUTOCONF_NAME |
ohair@478 | 132 | # (from the autoconf "host") and OPENJDK_BUILD_AUTOCONF_NAME |
ohair@478 | 133 | # Note that we might later on rewrite e.g. OPENJDK_TARGET_CPU due to reduced build, |
ohair@478 | 134 | # but this will not change the value of OPENJDK_TARGET_AUTOCONF_NAME. |
ohair@478 | 135 | OPENJDK_TARGET_AUTOCONF_NAME="$host" |
ohair@478 | 136 | OPENJDK_BUILD_AUTOCONF_NAME="$build" |
ohair@478 | 137 | AC_SUBST(OPENJDK_TARGET_AUTOCONF_NAME) |
ohair@478 | 138 | AC_SUBST(OPENJDK_BUILD_AUTOCONF_NAME) |
ohair@478 | 139 | |
ohair@478 | 140 | # Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables. |
ohair@494 | 141 | PLATFORM_EXTRACT_VARS_FROM_OS($build_os) |
ohair@494 | 142 | PLATFORM_EXTRACT_VARS_FROM_CPU($build_cpu) |
ohair@494 | 143 | # ..and setup our own variables. (Do this explicitely to facilitate searching) |
ohair@494 | 144 | OPENJDK_BUILD_OS="$VAR_OS" |
ohair@494 | 145 | OPENJDK_BUILD_OS_API="$VAR_OS_API" |
ohair@494 | 146 | OPENJDK_BUILD_OS_ENV="$VAR_OS_ENV" |
ohair@494 | 147 | OPENJDK_BUILD_CPU="$VAR_CPU" |
ohair@494 | 148 | OPENJDK_BUILD_CPU_ARCH="$VAR_CPU_ARCH" |
ohair@494 | 149 | OPENJDK_BUILD_CPU_BITS="$VAR_CPU_BITS" |
ohair@494 | 150 | OPENJDK_BUILD_CPU_ENDIAN="$VAR_CPU_ENDIAN" |
ohair@494 | 151 | AC_SUBST(OPENJDK_BUILD_OS) |
ohair@494 | 152 | AC_SUBST(OPENJDK_BUILD_OS_API) |
ohair@494 | 153 | AC_SUBST(OPENJDK_BUILD_CPU) |
ohair@494 | 154 | AC_SUBST(OPENJDK_BUILD_CPU_ARCH) |
ohair@494 | 155 | AC_SUBST(OPENJDK_BUILD_CPU_BITS) |
ohair@494 | 156 | AC_SUBST(OPENJDK_BUILD_CPU_ENDIAN) |
ohair@494 | 157 | |
ohair@494 | 158 | AC_MSG_CHECKING([openjdk-build os-cpu]) |
ohair@494 | 159 | AC_MSG_RESULT([$OPENJDK_BUILD_OS-$OPENJDK_BUILD_CPU]) |
ohair@494 | 160 | |
ohair@494 | 161 | # Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables. |
ohair@478 | 162 | PLATFORM_EXTRACT_VARS_FROM_OS($host_os) |
ohair@478 | 163 | PLATFORM_EXTRACT_VARS_FROM_CPU($host_cpu) |
ohair@478 | 164 | # ... and setup our own variables. (Do this explicitely to facilitate searching) |
ohair@478 | 165 | OPENJDK_TARGET_OS="$VAR_OS" |
ohair@478 | 166 | OPENJDK_TARGET_OS_API="$VAR_OS_API" |
ohair@494 | 167 | OPENJDK_TARGET_OS_ENV="$VAR_OS_ENV" |
ohair@478 | 168 | OPENJDK_TARGET_CPU="$VAR_CPU" |
ohair@478 | 169 | OPENJDK_TARGET_CPU_ARCH="$VAR_CPU_ARCH" |
ohair@478 | 170 | OPENJDK_TARGET_CPU_BITS="$VAR_CPU_BITS" |
ohair@478 | 171 | OPENJDK_TARGET_CPU_ENDIAN="$VAR_CPU_ENDIAN" |
ohair@478 | 172 | AC_SUBST(OPENJDK_TARGET_OS) |
ohair@478 | 173 | AC_SUBST(OPENJDK_TARGET_OS_API) |
ohair@478 | 174 | AC_SUBST(OPENJDK_TARGET_CPU) |
ohair@478 | 175 | AC_SUBST(OPENJDK_TARGET_CPU_ARCH) |
ohair@478 | 176 | AC_SUBST(OPENJDK_TARGET_CPU_BITS) |
ohair@478 | 177 | AC_SUBST(OPENJDK_TARGET_CPU_ENDIAN) |
ohair@478 | 178 | |
ohair@494 | 179 | AC_MSG_CHECKING([openjdk-target os-cpu]) |
ohair@494 | 180 | AC_MSG_RESULT([$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU]) |
ohair@478 | 181 | ]) |
ohair@478 | 182 | |
ohair@478 | 183 | # Check if a reduced build (32-bit on 64-bit platforms) is requested, and modify behaviour |
ohair@478 | 184 | # accordingly. Must be done after setting up build and target system, but before |
ohair@478 | 185 | # doing anything else with these values. |
ohair@478 | 186 | AC_DEFUN([PLATFORM_SETUP_TARGET_CPU_BITS], |
ohair@478 | 187 | [ |
ohair@478 | 188 | AC_ARG_WITH(target-bits, [AS_HELP_STRING([--with-target-bits], |
ohair@478 | 189 | [build 32-bit or 64-bit binaries (for platforms that support it), e.g. --with-target-bits=32 @<:@guessed@:>@])]) |
ohair@478 | 190 | |
ohair@478 | 191 | # We have three types of compiles: |
ohair@478 | 192 | # native == normal compilation, target system == build system |
ohair@478 | 193 | # cross == traditional cross compilation, target system != build system; special toolchain needed |
ohair@478 | 194 | # reduced == using native compilers, but with special flags (e.g. -m32) to produce 32-bit builds on 64-bit machines |
ohair@478 | 195 | # |
ohair@478 | 196 | if test "x$OPENJDK_BUILD_AUTOCONF_NAME" != "x$OPENJDK_TARGET_AUTOCONF_NAME"; then |
ohair@478 | 197 | # We're doing a proper cross-compilation |
ohair@478 | 198 | COMPILE_TYPE="cross" |
ohair@478 | 199 | else |
ohair@478 | 200 | COMPILE_TYPE="native" |
ohair@478 | 201 | fi |
ohair@478 | 202 | |
ohair@478 | 203 | if test "x$with_target_bits" != x; then |
ohair@478 | 204 | if test "x$COMPILE_TYPE" = "xcross"; then |
ohair@478 | 205 | AC_MSG_ERROR([It is not possible to combine --with-target-bits=X and proper cross-compilation. Choose either.]) |
ohair@478 | 206 | fi |
ohair@478 | 207 | |
ohair@478 | 208 | if test "x$with_target_bits" = x32 && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then |
ohair@478 | 209 | # A reduced build is requested |
ohair@478 | 210 | COMPILE_TYPE="reduced" |
ohair@478 | 211 | OPENJDK_TARGET_CPU_BITS=32 |
ohair@478 | 212 | if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86"; then |
ohair@478 | 213 | OPENJDK_TARGET_CPU=x86 |
ohair@478 | 214 | elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then |
ohair@478 | 215 | OPENJDK_TARGET_CPU=sparc |
ohair@478 | 216 | else |
ohair@478 | 217 | AC_MSG_ERROR([Reduced build (--with-target-bits=32) is only supported on x86_64 and sparcv9]) |
ohair@478 | 218 | fi |
ohair@478 | 219 | elif test "x$with_target_bits" = x64 && test "x$OPENJDK_TARGET_CPU_BITS" = x32; then |
ohair@478 | 220 | 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 | 221 | elif test "x$with_target_bits" = "x$OPENJDK_TARGET_CPU_BITS"; then |
ohair@478 | 222 | AC_MSG_NOTICE([--with-target-bits are set to build platform address size; argument has no meaning]) |
ohair@478 | 223 | else |
ohair@478 | 224 | AC_MSG_ERROR([--with-target-bits can only be 32 or 64, you specified $with_target_bits!]) |
ohair@478 | 225 | fi |
ohair@478 | 226 | fi |
ohair@478 | 227 | AC_SUBST(COMPILE_TYPE) |
ohair@478 | 228 | |
ohair@494 | 229 | AC_MSG_CHECKING([compilation type]) |
ohair@478 | 230 | AC_MSG_RESULT([$COMPILE_TYPE]) |
ohair@478 | 231 | ]) |
ohair@478 | 232 | |
ohair@478 | 233 | # Setup the legacy variables, for controlling the old makefiles. |
ohair@478 | 234 | # |
ohair@478 | 235 | AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS], |
ohair@478 | 236 | [ |
ohair@478 | 237 | # Also store the legacy naming of the cpu. |
ohair@478 | 238 | # Ie i586 and amd64 instead of x86 and x86_64 |
ohair@478 | 239 | OPENJDK_TARGET_CPU_LEGACY="$OPENJDK_TARGET_CPU" |
ohair@478 | 240 | if test "x$OPENJDK_TARGET_CPU" = xx86; then |
ohair@478 | 241 | OPENJDK_TARGET_CPU_LEGACY="i586" |
ohair@478 | 242 | elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then |
ohair@478 | 243 | # On all platforms except MacOSX replace x86_64 with amd64. |
ohair@478 | 244 | OPENJDK_TARGET_CPU_LEGACY="amd64" |
ohair@478 | 245 | fi |
ohair@478 | 246 | AC_SUBST(OPENJDK_TARGET_CPU_LEGACY) |
ohair@478 | 247 | |
ohair@478 | 248 | # And the second legacy naming of the cpu. |
ohair@478 | 249 | # Ie i386 and amd64 instead of x86 and x86_64. |
ohair@478 | 250 | OPENJDK_TARGET_CPU_LEGACY_LIB="$OPENJDK_TARGET_CPU" |
ohair@478 | 251 | if test "x$OPENJDK_TARGET_CPU" = xx86; then |
ohair@478 | 252 | OPENJDK_TARGET_CPU_LEGACY_LIB="i386" |
ohair@478 | 253 | elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then |
ohair@478 | 254 | OPENJDK_TARGET_CPU_LEGACY_LIB="amd64" |
ohair@478 | 255 | fi |
ohair@478 | 256 | AC_SUBST(OPENJDK_TARGET_CPU_LEGACY_LIB) |
ohair@478 | 257 | |
ohair@478 | 258 | # This is the name of the cpu (but using i386 and amd64 instead of |
ohair@478 | 259 | # x86 and x86_64, respectively), preceeded by a /, to be used when |
ohair@478 | 260 | # locating libraries. On macosx, it's empty, though. |
ohair@478 | 261 | OPENJDK_TARGET_CPU_LIBDIR="/$OPENJDK_TARGET_CPU_LEGACY_LIB" |
ohair@478 | 262 | if test "x$OPENJDK_TARGET_OS" = xmacosx; then |
ohair@478 | 263 | OPENJDK_TARGET_CPU_LIBDIR="" |
ohair@478 | 264 | fi |
ohair@478 | 265 | AC_SUBST(OPENJDK_TARGET_CPU_LIBDIR) |
ohair@478 | 266 | |
ohair@478 | 267 | # OPENJDK_TARGET_CPU_ISADIR is normally empty. On 64-bit Solaris systems, it is set to |
ohair@478 | 268 | # /amd64 or /sparcv9. This string is appended to some library paths, like this: |
ohair@478 | 269 | # /usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libexample.so |
ohair@478 | 270 | OPENJDK_TARGET_CPU_ISADIR="" |
ohair@478 | 271 | if test "x$OPENJDK_TARGET_OS" = xsolaris; then |
ohair@478 | 272 | if test "x$OPENJDK_TARGET_CPU" = xx86_64; then |
ohair@478 | 273 | OPENJDK_TARGET_CPU_ISADIR="/amd64" |
ohair@478 | 274 | elif test "x$OPENJDK_TARGET_CPU" = xsparcv9; then |
ohair@478 | 275 | OPENJDK_TARGET_CPU_ISADIR="/sparcv9" |
ohair@478 | 276 | fi |
ohair@478 | 277 | fi |
ohair@478 | 278 | AC_SUBST(OPENJDK_TARGET_CPU_ISADIR) |
ohair@478 | 279 | |
ohair@478 | 280 | # Setup OPENJDK_TARGET_CPU_OSARCH, which is used to set the os.arch Java system property |
ohair@478 | 281 | OPENJDK_TARGET_CPU_OSARCH="$OPENJDK_TARGET_CPU" |
ohair@478 | 282 | if test "x$OPENJDK_TARGET_OS" = xlinux && test "x$OPENJDK_TARGET_CPU" = xx86; then |
ohair@478 | 283 | # On linux only, we replace x86 with i386. |
ohair@478 | 284 | OPENJDK_TARGET_CPU_OSARCH="i386" |
ohair@478 | 285 | elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then |
ohair@478 | 286 | # On all platforms except macosx, we replace x86_64 with amd64. |
ohair@478 | 287 | OPENJDK_TARGET_CPU_OSARCH="amd64" |
ohair@478 | 288 | fi |
ohair@478 | 289 | AC_SUBST(OPENJDK_TARGET_CPU_OSARCH) |
ohair@478 | 290 | |
ohair@478 | 291 | OPENJDK_TARGET_CPU_JLI="$OPENJDK_TARGET_CPU" |
ohair@478 | 292 | if test "x$OPENJDK_TARGET_CPU" = xx86; then |
ohair@478 | 293 | OPENJDK_TARGET_CPU_JLI="i386" |
ohair@478 | 294 | elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then |
ohair@478 | 295 | # On all platforms except macosx, we replace x86_64 with amd64. |
ohair@478 | 296 | OPENJDK_TARGET_CPU_JLI="amd64" |
ohair@478 | 297 | fi |
ohair@478 | 298 | # Now setup the -D flags for building libjli. |
ohair@478 | 299 | OPENJDK_TARGET_CPU_JLI_CFLAGS="-DLIBARCHNAME='\"$OPENJDK_TARGET_CPU_JLI\"'" |
ohair@478 | 300 | if test "x$OPENJDK_TARGET_OS" = xsolaris; then |
ohair@478 | 301 | if test "x$OPENJDK_TARGET_CPU_ARCH" = xsparc; then |
ohair@478 | 302 | OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"sparc\"' -DLIBARCH64NAME='\"sparcv9\"'" |
ohair@478 | 303 | elif test "x$OPENJDK_TARGET_CPU_ARCH" = xx86; then |
ohair@478 | 304 | OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"i386\"' -DLIBARCH64NAME='\"amd64\"'" |
ohair@478 | 305 | fi |
ohair@478 | 306 | fi |
ohair@478 | 307 | AC_SUBST(OPENJDK_TARGET_CPU_JLI_CFLAGS) |
ohair@478 | 308 | |
ohair@478 | 309 | # Setup OPENJDK_TARGET_OS_API_DIR, used in source paths. |
ohair@478 | 310 | if test "x$OPENJDK_TARGET_OS_API" = xposix; then |
ohair@478 | 311 | OPENJDK_TARGET_OS_API_DIR="solaris" |
ohair@478 | 312 | fi |
ohair@478 | 313 | if test "x$OPENJDK_TARGET_OS_API" = xwinapi; then |
ohair@478 | 314 | OPENJDK_TARGET_OS_API_DIR="windows" |
ohair@478 | 315 | fi |
ohair@478 | 316 | AC_SUBST(OPENJDK_TARGET_OS_API_DIR) |
ohair@478 | 317 | |
ohair@478 | 318 | if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then |
ohair@478 | 319 | A_LP64="LP64:=" |
ohair@494 | 320 | # -D_LP64=1 is only set on linux and mac. Setting on windows causes diff in |
ohair@494 | 321 | # unpack200.exe |
ohair@494 | 322 | if test "x$OPENJDK_TARGET_OS" = xlinux || test "x$OPENJDK_TARGET_OS" = xmacosx; then |
ohair@494 | 323 | ADD_LP64="-D_LP64=1" |
ohair@494 | 324 | fi |
ohair@478 | 325 | fi |
ohair@478 | 326 | AC_SUBST(LP64,$A_LP64) |
ohair@478 | 327 | |
ohair@478 | 328 | if test "x$COMPILE_TYPE" = "xcross"; then |
ohair@478 | 329 | # FIXME: ... or should this include reduced builds..? |
ohair@478 | 330 | DEFINE_CROSS_COMPILE_ARCH="CROSS_COMPILE_ARCH:=$OPENJDK_TARGET_CPU_LEGACY" |
ohair@478 | 331 | else |
ohair@478 | 332 | DEFINE_CROSS_COMPILE_ARCH="" |
ohair@478 | 333 | fi |
ohair@478 | 334 | AC_SUBST(DEFINE_CROSS_COMPILE_ARCH) |
omajid@671 | 335 | |
omajid@671 | 336 | # ZERO_ARCHDEF is used to enable architecture-specific code |
omajid@671 | 337 | case "${OPENJDK_TARGET_CPU}" in |
omajid@671 | 338 | ppc*) ZERO_ARCHDEF=PPC ;; |
omajid@671 | 339 | s390*) ZERO_ARCHDEF=S390 ;; |
omajid@671 | 340 | sparc*) ZERO_ARCHDEF=SPARC ;; |
omajid@671 | 341 | x86_64*) ZERO_ARCHDEF=AMD64 ;; |
omajid@671 | 342 | x86) ZERO_ARCHDEF=IA32 ;; |
omajid@671 | 343 | *) ZERO_ARCHDEF=$(echo "${OPENJDK_TARGET_CPU_LEGACY_LIB}" | tr a-z A-Z) |
omajid@671 | 344 | esac |
omajid@671 | 345 | AC_SUBST(ZERO_ARCHDEF) |
omajid@671 | 346 | |
ohair@478 | 347 | ]) |
ohair@478 | 348 | |
erikj@458 | 349 | AC_DEFUN([PLATFORM_SET_RELEASE_FILE_OS_VALUES], |
ohair@425 | 350 | [ |
erikj@458 | 351 | if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then |
erikj@445 | 352 | REQUIRED_OS_NAME=SunOS |
erikj@445 | 353 | REQUIRED_OS_VERSION=5.10 |
erikj@445 | 354 | fi |
erikj@458 | 355 | if test "x$OPENJDK_TARGET_OS" = "xlinux"; then |
erikj@445 | 356 | REQUIRED_OS_NAME=Linux |
erikj@445 | 357 | REQUIRED_OS_VERSION=2.6 |
erikj@445 | 358 | fi |
erikj@458 | 359 | if test "x$OPENJDK_TARGET_OS" = "xwindows"; then |
erikj@445 | 360 | REQUIRED_OS_NAME=Windows |
ohair@478 | 361 | if test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then |
ohair@478 | 362 | REQUIRED_OS_VERSION=5.2 |
ohair@478 | 363 | else |
ohair@478 | 364 | REQUIRED_OS_VERSION=5.1 |
ohair@478 | 365 | fi |
erikj@445 | 366 | fi |
erikj@458 | 367 | if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then |
erikj@445 | 368 | REQUIRED_OS_NAME=Darwin |
erikj@445 | 369 | REQUIRED_OS_VERSION=11.2 |
erikj@445 | 370 | fi |
erikj@445 | 371 | |
erikj@445 | 372 | AC_SUBST(REQUIRED_OS_NAME) |
erikj@445 | 373 | AC_SUBST(REQUIRED_OS_VERSION) |
erikj@445 | 374 | ]) |
erikj@458 | 375 | |
erikj@458 | 376 | #%%% Build and target systems %%% |
erikj@458 | 377 | AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_AND_TARGET], |
erikj@458 | 378 | [ |
erikj@458 | 379 | # Figure out the build and target systems. # Note that in autoconf terminology, "build" is obvious, but "target" |
erikj@458 | 380 | # is confusing; it assumes you are cross-compiling a cross-compiler (!) and "target" is thus the target of the |
erikj@458 | 381 | # product you're building. The target of this build is called "host". Since this is confusing to most people, we |
erikj@458 | 382 | # have not adopted that system, but use "target" as the platform we are building for. In some places though we need |
erikj@458 | 383 | # to use the configure naming style. |
erikj@458 | 384 | AC_CANONICAL_BUILD |
erikj@458 | 385 | AC_CANONICAL_HOST |
erikj@458 | 386 | AC_CANONICAL_TARGET |
erikj@458 | 387 | |
ohair@478 | 388 | PLATFORM_EXTRACT_TARGET_AND_BUILD |
ohair@478 | 389 | PLATFORM_SETUP_TARGET_CPU_BITS |
ohair@478 | 390 | PLATFORM_SET_RELEASE_FILE_OS_VALUES |
ohair@478 | 391 | PLATFORM_SETUP_LEGACY_VARS |
erikj@458 | 392 | ]) |
erikj@458 | 393 | |
erikj@458 | 394 | AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_OS_VERSION], |
erikj@458 | 395 | [ |
erikj@458 | 396 | ############################################################################### |
erikj@458 | 397 | |
erikj@458 | 398 | # Note that this is the build platform OS version! |
erikj@458 | 399 | |
erikj@458 | 400 | OS_VERSION="`uname -r | ${SED} 's!\.! !g' | ${SED} 's!-! !g'`" |
erikj@458 | 401 | OS_VERSION_MAJOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 1 -d ' '`" |
erikj@458 | 402 | OS_VERSION_MINOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 2 -d ' '`" |
erikj@458 | 403 | OS_VERSION_MICRO="`${ECHO} ${OS_VERSION} | ${CUT} -f 3 -d ' '`" |
erikj@458 | 404 | AC_SUBST(OS_VERSION_MAJOR) |
erikj@458 | 405 | AC_SUBST(OS_VERSION_MINOR) |
erikj@458 | 406 | AC_SUBST(OS_VERSION_MICRO) |
erikj@458 | 407 | ]) |
erikj@458 | 408 | |
ohair@478 | 409 | # Support macro for PLATFORM_SETUP_OPENJDK_TARGET_BITS. |
ohair@478 | 410 | # Add -mX to various FLAGS variables. |
ohair@478 | 411 | AC_DEFUN([PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS], |
ohair@478 | 412 | [ |
ohair@478 | 413 | # keep track of c/cxx flags that we added outselves... |
ohair@478 | 414 | # to prevent emitting warning... |
ohair@478 | 415 | ADDED_CFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}" |
ohair@478 | 416 | ADDED_CXXFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}" |
ohair@478 | 417 | ADDED_LDFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}" |
ohair@478 | 418 | |
ohair@478 | 419 | CFLAGS="${CFLAGS}${ADDED_CFLAGS}" |
ohair@478 | 420 | CXXFLAGS="${CXXFLAGS}${ADDED_CXXFLAGS}" |
ohair@478 | 421 | LDFLAGS="${LDFLAGS}${ADDED_LDFLAGS}" |
ohair@478 | 422 | |
ohair@478 | 423 | CFLAGS_JDK="${CFLAGS_JDK}${ADDED_CFLAGS}" |
ohair@478 | 424 | CXXFLAGS_JDK="${CXXFLAGS_JDK}${ADDED_CXXFLAGS}" |
ohair@478 | 425 | LDFLAGS_JDK="${LDFLAGS_JDK}${ADDED_LDFLAGS}" |
ohair@478 | 426 | ]) |
ohair@478 | 427 | |
ohair@478 | 428 | AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS], |
erikj@458 | 429 | [ |
erikj@458 | 430 | ############################################################################### |
erikj@458 | 431 | # |
erikj@458 | 432 | # Now we check if libjvm.so will use 32 or 64 bit pointers for the C/C++ code. |
erikj@458 | 433 | # (The JVM can use 32 or 64 bit Java pointers but that decision |
erikj@458 | 434 | # is made at runtime.) |
erikj@458 | 435 | # |
omajid@695 | 436 | |
ohair@478 | 437 | if test "x$OPENJDK_TARGET_OS" = xsolaris; then |
ohair@478 | 438 | # Always specify -m flags on Solaris |
ohair@478 | 439 | PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS |
ohair@478 | 440 | elif test "x$COMPILE_TYPE" = xreduced; then |
ohair@478 | 441 | if test "x$OPENJDK_TARGET_OS" != xwindows; then |
ohair@478 | 442 | # Specify -m if running reduced on other Posix platforms |
ohair@478 | 443 | PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS |
ohair@478 | 444 | fi |
erikj@458 | 445 | fi |
ohair@478 | 446 | |
ohair@478 | 447 | # Make compilation sanity check |
ohair@478 | 448 | AC_CHECK_HEADERS([stdio.h], , [ |
ohair@478 | 449 | AC_MSG_NOTICE([Failed to compile stdio.h. This likely implies missing compile dependencies.]) |
ohair@478 | 450 | if test "x$COMPILE_TYPE" = xreduced; then |
ohair@478 | 451 | AC_MSG_NOTICE([You are doing a reduced build. Check that you have 32-bit libraries installed.]) |
ohair@478 | 452 | elif test "x$COMPILE_TYPE" = xcross; then |
ohair@478 | 453 | AC_MSG_NOTICE([You are doing a cross-compilation. Check that you have all target platform libraries installed.]) |
ohair@478 | 454 | fi |
ohair@478 | 455 | AC_MSG_ERROR([Cannot continue.]) |
ohair@478 | 456 | ]) |
ohair@478 | 457 | |
erikj@458 | 458 | AC_CHECK_SIZEOF([int *], [1111]) |
erikj@458 | 459 | |
ohair@478 | 460 | if test "x$SIZEOF_INT_P" != "x$ac_cv_sizeof_int_p"; then |
ohair@478 | 461 | # Workaround autoconf bug, see http://lists.gnu.org/archive/html/autoconf/2010-07/msg00004.html |
ohair@478 | 462 | SIZEOF_INT_P="$ac_cv_sizeof_int_p" |
ohair@478 | 463 | fi |
erikj@458 | 464 | |
ohair@478 | 465 | if test "x$SIZEOF_INT_P" = x; then |
ohair@478 | 466 | # The test failed, lets stick to the assumed value. |
ohair@478 | 467 | AC_MSG_WARN([The number of bits in the target could not be determined, using $OPENJDK_TARGET_CPU_BITS.]) |
erikj@458 | 468 | else |
ohair@478 | 469 | TESTED_TARGET_CPU_BITS=`expr 8 \* $SIZEOF_INT_P` |
erikj@458 | 470 | |
ohair@478 | 471 | if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then |
ohair@478 | 472 | 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)]) |
erikj@458 | 473 | fi |
erikj@458 | 474 | fi |
erikj@458 | 475 | |
erikj@458 | 476 | AC_MSG_CHECKING([for target address size]) |
ohair@478 | 477 | AC_MSG_RESULT([$OPENJDK_TARGET_CPU_BITS bits]) |
erikj@458 | 478 | ]) |
erikj@458 | 479 | |
erikj@458 | 480 | AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_ENDIANNESS], |
erikj@458 | 481 | [ |
erikj@458 | 482 | ############################################################################### |
erikj@458 | 483 | # |
erikj@458 | 484 | # Is the target little of big endian? |
erikj@458 | 485 | # |
erikj@458 | 486 | AC_C_BIGENDIAN([ENDIAN="big"],[ENDIAN="little"],[ENDIAN="unknown"],[ENDIAN="universal_endianness"]) |
erikj@458 | 487 | |
erikj@458 | 488 | if test "x$ENDIAN" = xuniversal_endianness; then |
erikj@458 | 489 | AC_MSG_ERROR([Building with both big and little endianness is not supported]) |
erikj@458 | 490 | fi |
ohair@478 | 491 | if test "x$ENDIAN" != "x$OPENJDK_TARGET_CPU_ENDIAN"; then |
ohair@478 | 492 | 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)]) |
erikj@458 | 493 | fi |
erikj@458 | 494 | ]) |