Mon, 29 Apr 2013 12:34:30 -0400
8013480: fix zero build on arm
Reviewed-by: erikj
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 | # Some Zero and Shark settings. |
omajid@671 | 337 | # ZERO_ARCHFLAG tells the compiler which mode to build for |
omajid@671 | 338 | case "${OPENJDK_TARGET_CPU}" in |
omajid@671 | 339 | s390) |
omajid@671 | 340 | ZERO_ARCHFLAG="-m31" |
omajid@671 | 341 | ;; |
omajid@671 | 342 | *) |
omajid@671 | 343 | ZERO_ARCHFLAG="-m${OPENJDK_TARGET_CPU_BITS}" |
omajid@671 | 344 | esac |
omajid@695 | 345 | PLATFORM_COMPILER_CHECK_ARGUMENTS([$ZERO_ARCHFLAG], [], [ZERO_ARCHFLAG=""]) |
omajid@671 | 346 | AC_SUBST(ZERO_ARCHFLAG) |
omajid@671 | 347 | |
omajid@671 | 348 | # ZERO_ARCHDEF is used to enable architecture-specific code |
omajid@671 | 349 | case "${OPENJDK_TARGET_CPU}" in |
omajid@671 | 350 | ppc*) ZERO_ARCHDEF=PPC ;; |
omajid@671 | 351 | s390*) ZERO_ARCHDEF=S390 ;; |
omajid@671 | 352 | sparc*) ZERO_ARCHDEF=SPARC ;; |
omajid@671 | 353 | x86_64*) ZERO_ARCHDEF=AMD64 ;; |
omajid@671 | 354 | x86) ZERO_ARCHDEF=IA32 ;; |
omajid@671 | 355 | *) ZERO_ARCHDEF=$(echo "${OPENJDK_TARGET_CPU_LEGACY_LIB}" | tr a-z A-Z) |
omajid@671 | 356 | esac |
omajid@671 | 357 | AC_SUBST(ZERO_ARCHDEF) |
omajid@671 | 358 | |
ohair@478 | 359 | ]) |
ohair@478 | 360 | |
erikj@458 | 361 | AC_DEFUN([PLATFORM_SET_RELEASE_FILE_OS_VALUES], |
ohair@425 | 362 | [ |
erikj@458 | 363 | if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then |
erikj@445 | 364 | REQUIRED_OS_NAME=SunOS |
erikj@445 | 365 | REQUIRED_OS_VERSION=5.10 |
erikj@445 | 366 | fi |
erikj@458 | 367 | if test "x$OPENJDK_TARGET_OS" = "xlinux"; then |
erikj@445 | 368 | REQUIRED_OS_NAME=Linux |
erikj@445 | 369 | REQUIRED_OS_VERSION=2.6 |
erikj@445 | 370 | fi |
erikj@458 | 371 | if test "x$OPENJDK_TARGET_OS" = "xwindows"; then |
erikj@445 | 372 | REQUIRED_OS_NAME=Windows |
ohair@478 | 373 | if test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then |
ohair@478 | 374 | REQUIRED_OS_VERSION=5.2 |
ohair@478 | 375 | else |
ohair@478 | 376 | REQUIRED_OS_VERSION=5.1 |
ohair@478 | 377 | fi |
erikj@445 | 378 | fi |
erikj@458 | 379 | if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then |
erikj@445 | 380 | REQUIRED_OS_NAME=Darwin |
erikj@445 | 381 | REQUIRED_OS_VERSION=11.2 |
erikj@445 | 382 | fi |
erikj@445 | 383 | |
erikj@445 | 384 | AC_SUBST(REQUIRED_OS_NAME) |
erikj@445 | 385 | AC_SUBST(REQUIRED_OS_VERSION) |
erikj@445 | 386 | ]) |
erikj@458 | 387 | |
erikj@458 | 388 | #%%% Build and target systems %%% |
erikj@458 | 389 | AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_AND_TARGET], |
erikj@458 | 390 | [ |
erikj@458 | 391 | # Figure out the build and target systems. # Note that in autoconf terminology, "build" is obvious, but "target" |
erikj@458 | 392 | # is confusing; it assumes you are cross-compiling a cross-compiler (!) and "target" is thus the target of the |
erikj@458 | 393 | # product you're building. The target of this build is called "host". Since this is confusing to most people, we |
erikj@458 | 394 | # have not adopted that system, but use "target" as the platform we are building for. In some places though we need |
erikj@458 | 395 | # to use the configure naming style. |
erikj@458 | 396 | AC_CANONICAL_BUILD |
erikj@458 | 397 | AC_CANONICAL_HOST |
erikj@458 | 398 | AC_CANONICAL_TARGET |
erikj@458 | 399 | |
ohair@478 | 400 | PLATFORM_EXTRACT_TARGET_AND_BUILD |
ohair@478 | 401 | PLATFORM_SETUP_TARGET_CPU_BITS |
ohair@478 | 402 | PLATFORM_SET_RELEASE_FILE_OS_VALUES |
ohair@478 | 403 | PLATFORM_SETUP_LEGACY_VARS |
erikj@458 | 404 | ]) |
erikj@458 | 405 | |
erikj@458 | 406 | AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_OS_VERSION], |
erikj@458 | 407 | [ |
erikj@458 | 408 | ############################################################################### |
erikj@458 | 409 | |
erikj@458 | 410 | # Note that this is the build platform OS version! |
erikj@458 | 411 | |
erikj@458 | 412 | OS_VERSION="`uname -r | ${SED} 's!\.! !g' | ${SED} 's!-! !g'`" |
erikj@458 | 413 | OS_VERSION_MAJOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 1 -d ' '`" |
erikj@458 | 414 | OS_VERSION_MINOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 2 -d ' '`" |
erikj@458 | 415 | OS_VERSION_MICRO="`${ECHO} ${OS_VERSION} | ${CUT} -f 3 -d ' '`" |
erikj@458 | 416 | AC_SUBST(OS_VERSION_MAJOR) |
erikj@458 | 417 | AC_SUBST(OS_VERSION_MINOR) |
erikj@458 | 418 | AC_SUBST(OS_VERSION_MICRO) |
erikj@458 | 419 | ]) |
erikj@458 | 420 | |
omajid@695 | 421 | # PLATFORM_COMPILER_CHECK_ARGUMENTS([ARGUMENT], [RUN-IF-TRUE], |
omajid@695 | 422 | # [RUN-IF-FALSE]) |
omajid@695 | 423 | # ------------------------------------------------------------ |
omajid@695 | 424 | # Check that the c and c++ compilers support an argument |
omajid@695 | 425 | AC_DEFUN([PLATFORM_COMPILER_CHECK_ARGUMENTS], |
omajid@695 | 426 | [ |
omajid@695 | 427 | AC_MSG_CHECKING([if compiler supports "$1"]) |
omajid@695 | 428 | supports=yes |
omajid@695 | 429 | |
omajid@695 | 430 | saved_cflags="$CFLAGS" |
omajid@695 | 431 | CFLAGS="$CFLAGS $1" |
omajid@695 | 432 | AC_LANG_PUSH([C]) |
omajid@695 | 433 | AC_COMPILE_IFELSE([ |
omajid@695 | 434 | AC_LANG_SOURCE([[int i;]]) |
omajid@695 | 435 | ], [], [supports=no]) |
omajid@695 | 436 | AC_LANG_POP([C]) |
omajid@695 | 437 | CFLAGS="$saved_cflags" |
omajid@695 | 438 | |
omajid@695 | 439 | saved_cxxflags="$CXXFLAGS" |
omajid@695 | 440 | CXXFLAGS="$CXXFLAG $1" |
omajid@695 | 441 | AC_LANG_PUSH([C++]) |
omajid@695 | 442 | AC_COMPILE_IFELSE([ |
omajid@695 | 443 | AC_LANG_SOURCE([[int i;]]) |
omajid@695 | 444 | ], [], [supports=no]) |
omajid@695 | 445 | AC_LANG_POP([C++]) |
omajid@695 | 446 | CXXFLAGS="$saved_cxxflags" |
omajid@695 | 447 | |
omajid@695 | 448 | AC_MSG_RESULT([$supports]) |
omajid@695 | 449 | if test "x$supports" = "xyes" ; then |
omajid@695 | 450 | m4_ifval([$2], [$2], [:]) |
omajid@695 | 451 | else |
omajid@695 | 452 | m4_ifval([$3], [$3], [:]) |
omajid@695 | 453 | fi |
omajid@695 | 454 | ]) |
omajid@695 | 455 | |
omajid@695 | 456 | # Check that the compiler supports -mX flags |
omajid@695 | 457 | # Set COMPILER_SUPPORTS_TARGET_BITS_FLAG to 'true' if it does |
omajid@695 | 458 | AC_DEFUN([PLATFORM_CHECK_COMPILER_TARGET_BITS_FLAGS], |
omajid@695 | 459 | [ |
omajid@695 | 460 | PLATFORM_COMPILER_CHECK_ARGUMENTS([-m${OPENJDK_TARGET_CPU_BITS}], |
omajid@695 | 461 | [COMPILER_SUPPORTS_TARGET_BITS_FLAG=true], |
omajid@695 | 462 | [COMPILER_SUPPORTS_TARGET_BITS_FLAG=false]) |
omajid@695 | 463 | AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG) |
omajid@695 | 464 | ]) |
omajid@695 | 465 | |
ohair@478 | 466 | # Support macro for PLATFORM_SETUP_OPENJDK_TARGET_BITS. |
ohair@478 | 467 | # Add -mX to various FLAGS variables. |
ohair@478 | 468 | AC_DEFUN([PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS], |
ohair@478 | 469 | [ |
ohair@478 | 470 | # keep track of c/cxx flags that we added outselves... |
ohair@478 | 471 | # to prevent emitting warning... |
ohair@478 | 472 | ADDED_CFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}" |
ohair@478 | 473 | ADDED_CXXFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}" |
ohair@478 | 474 | ADDED_LDFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}" |
ohair@478 | 475 | |
ohair@478 | 476 | CFLAGS="${CFLAGS}${ADDED_CFLAGS}" |
ohair@478 | 477 | CXXFLAGS="${CXXFLAGS}${ADDED_CXXFLAGS}" |
ohair@478 | 478 | LDFLAGS="${LDFLAGS}${ADDED_LDFLAGS}" |
ohair@478 | 479 | |
ohair@478 | 480 | CFLAGS_JDK="${CFLAGS_JDK}${ADDED_CFLAGS}" |
ohair@478 | 481 | CXXFLAGS_JDK="${CXXFLAGS_JDK}${ADDED_CXXFLAGS}" |
ohair@478 | 482 | LDFLAGS_JDK="${LDFLAGS_JDK}${ADDED_LDFLAGS}" |
ohair@478 | 483 | ]) |
ohair@478 | 484 | |
ohair@478 | 485 | AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS], |
erikj@458 | 486 | [ |
erikj@458 | 487 | ############################################################################### |
erikj@458 | 488 | # |
erikj@458 | 489 | # Now we check if libjvm.so will use 32 or 64 bit pointers for the C/C++ code. |
erikj@458 | 490 | # (The JVM can use 32 or 64 bit Java pointers but that decision |
erikj@458 | 491 | # is made at runtime.) |
erikj@458 | 492 | # |
omajid@695 | 493 | |
omajid@695 | 494 | PLATFORM_CHECK_COMPILER_TARGET_BITS_FLAGS |
omajid@695 | 495 | |
ohair@478 | 496 | if test "x$OPENJDK_TARGET_OS" = xsolaris; then |
ohair@478 | 497 | # Always specify -m flags on Solaris |
ohair@478 | 498 | PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS |
ohair@478 | 499 | elif test "x$COMPILE_TYPE" = xreduced; then |
ohair@478 | 500 | if test "x$OPENJDK_TARGET_OS" != xwindows; then |
ohair@478 | 501 | # Specify -m if running reduced on other Posix platforms |
ohair@478 | 502 | PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS |
ohair@478 | 503 | fi |
erikj@458 | 504 | fi |
ohair@478 | 505 | |
ohair@478 | 506 | # Make compilation sanity check |
ohair@478 | 507 | AC_CHECK_HEADERS([stdio.h], , [ |
ohair@478 | 508 | AC_MSG_NOTICE([Failed to compile stdio.h. This likely implies missing compile dependencies.]) |
ohair@478 | 509 | if test "x$COMPILE_TYPE" = xreduced; then |
ohair@478 | 510 | AC_MSG_NOTICE([You are doing a reduced build. Check that you have 32-bit libraries installed.]) |
ohair@478 | 511 | elif test "x$COMPILE_TYPE" = xcross; then |
ohair@478 | 512 | AC_MSG_NOTICE([You are doing a cross-compilation. Check that you have all target platform libraries installed.]) |
ohair@478 | 513 | fi |
ohair@478 | 514 | AC_MSG_ERROR([Cannot continue.]) |
ohair@478 | 515 | ]) |
ohair@478 | 516 | |
erikj@458 | 517 | AC_CHECK_SIZEOF([int *], [1111]) |
erikj@458 | 518 | |
ohair@478 | 519 | if test "x$SIZEOF_INT_P" != "x$ac_cv_sizeof_int_p"; then |
ohair@478 | 520 | # Workaround autoconf bug, see http://lists.gnu.org/archive/html/autoconf/2010-07/msg00004.html |
ohair@478 | 521 | SIZEOF_INT_P="$ac_cv_sizeof_int_p" |
ohair@478 | 522 | fi |
erikj@458 | 523 | |
ohair@478 | 524 | if test "x$SIZEOF_INT_P" = x; then |
ohair@478 | 525 | # The test failed, lets stick to the assumed value. |
ohair@478 | 526 | AC_MSG_WARN([The number of bits in the target could not be determined, using $OPENJDK_TARGET_CPU_BITS.]) |
erikj@458 | 527 | else |
ohair@478 | 528 | TESTED_TARGET_CPU_BITS=`expr 8 \* $SIZEOF_INT_P` |
erikj@458 | 529 | |
ohair@478 | 530 | if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then |
ohair@478 | 531 | 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 | 532 | fi |
erikj@458 | 533 | fi |
erikj@458 | 534 | |
erikj@458 | 535 | AC_MSG_CHECKING([for target address size]) |
ohair@478 | 536 | AC_MSG_RESULT([$OPENJDK_TARGET_CPU_BITS bits]) |
erikj@458 | 537 | ]) |
erikj@458 | 538 | |
erikj@458 | 539 | AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_ENDIANNESS], |
erikj@458 | 540 | [ |
erikj@458 | 541 | ############################################################################### |
erikj@458 | 542 | # |
erikj@458 | 543 | # Is the target little of big endian? |
erikj@458 | 544 | # |
erikj@458 | 545 | AC_C_BIGENDIAN([ENDIAN="big"],[ENDIAN="little"],[ENDIAN="unknown"],[ENDIAN="universal_endianness"]) |
erikj@458 | 546 | |
erikj@458 | 547 | if test "x$ENDIAN" = xuniversal_endianness; then |
erikj@458 | 548 | AC_MSG_ERROR([Building with both big and little endianness is not supported]) |
erikj@458 | 549 | fi |
ohair@478 | 550 | if test "x$ENDIAN" != "x$OPENJDK_TARGET_CPU_ENDIAN"; then |
ohair@478 | 551 | 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 | 552 | fi |
erikj@458 | 553 | ]) |