Thu, 12 Sep 2013 12:29:17 -0700
8024265: Enable new build on AIX
Reviewed-by: ihse
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 | ;; |
simonis@971 | 117 | *aix*) |
simonis@971 | 118 | VAR_OS=aix |
simonis@971 | 119 | VAR_OS_API=posix |
simonis@971 | 120 | VAR_OS_ENV=aix |
simonis@971 | 121 | ;; |
ohair@425 | 122 | *) |
erikj@458 | 123 | AC_MSG_ERROR([unsupported operating system $1]) |
ohair@425 | 124 | ;; |
ohair@425 | 125 | esac |
ohair@425 | 126 | ]) |
ohair@425 | 127 | |
ohair@478 | 128 | # Expects $host_os $host_cpu $build_os and $build_cpu |
ohair@478 | 129 | # and $with_target_bits to have been setup! |
ohair@478 | 130 | # |
ohair@478 | 131 | # Translate the standard triplet(quadruplet) definition |
ohair@478 | 132 | # of the target/build system into OPENJDK_TARGET_OS, OPENJDK_TARGET_CPU, |
ohair@478 | 133 | # OPENJDK_BUILD_OS, etc. |
ohair@478 | 134 | AC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD], |
ohair@478 | 135 | [ |
ohair@478 | 136 | # Copy the autoconf trip/quadruplet verbatim to OPENJDK_TARGET_AUTOCONF_NAME |
ohair@478 | 137 | # (from the autoconf "host") and OPENJDK_BUILD_AUTOCONF_NAME |
ohair@478 | 138 | # Note that we might later on rewrite e.g. OPENJDK_TARGET_CPU due to reduced build, |
ohair@478 | 139 | # but this will not change the value of OPENJDK_TARGET_AUTOCONF_NAME. |
ohair@478 | 140 | OPENJDK_TARGET_AUTOCONF_NAME="$host" |
ohair@478 | 141 | OPENJDK_BUILD_AUTOCONF_NAME="$build" |
ohair@478 | 142 | AC_SUBST(OPENJDK_TARGET_AUTOCONF_NAME) |
ohair@478 | 143 | AC_SUBST(OPENJDK_BUILD_AUTOCONF_NAME) |
ohair@478 | 144 | |
ohair@478 | 145 | # Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables. |
ohair@494 | 146 | PLATFORM_EXTRACT_VARS_FROM_OS($build_os) |
ohair@494 | 147 | PLATFORM_EXTRACT_VARS_FROM_CPU($build_cpu) |
ohair@494 | 148 | # ..and setup our own variables. (Do this explicitely to facilitate searching) |
ohair@494 | 149 | OPENJDK_BUILD_OS="$VAR_OS" |
ohair@494 | 150 | OPENJDK_BUILD_OS_API="$VAR_OS_API" |
ohair@494 | 151 | OPENJDK_BUILD_OS_ENV="$VAR_OS_ENV" |
ohair@494 | 152 | OPENJDK_BUILD_CPU="$VAR_CPU" |
ohair@494 | 153 | OPENJDK_BUILD_CPU_ARCH="$VAR_CPU_ARCH" |
ohair@494 | 154 | OPENJDK_BUILD_CPU_BITS="$VAR_CPU_BITS" |
ohair@494 | 155 | OPENJDK_BUILD_CPU_ENDIAN="$VAR_CPU_ENDIAN" |
ohair@494 | 156 | AC_SUBST(OPENJDK_BUILD_OS) |
ohair@494 | 157 | AC_SUBST(OPENJDK_BUILD_OS_API) |
ohair@494 | 158 | AC_SUBST(OPENJDK_BUILD_CPU) |
ohair@494 | 159 | AC_SUBST(OPENJDK_BUILD_CPU_ARCH) |
ohair@494 | 160 | AC_SUBST(OPENJDK_BUILD_CPU_BITS) |
ohair@494 | 161 | AC_SUBST(OPENJDK_BUILD_CPU_ENDIAN) |
ohair@494 | 162 | |
ohair@494 | 163 | AC_MSG_CHECKING([openjdk-build os-cpu]) |
ohair@494 | 164 | AC_MSG_RESULT([$OPENJDK_BUILD_OS-$OPENJDK_BUILD_CPU]) |
ohair@494 | 165 | |
ohair@494 | 166 | # Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables. |
ohair@478 | 167 | PLATFORM_EXTRACT_VARS_FROM_OS($host_os) |
ohair@478 | 168 | PLATFORM_EXTRACT_VARS_FROM_CPU($host_cpu) |
ohair@478 | 169 | # ... and setup our own variables. (Do this explicitely to facilitate searching) |
ohair@478 | 170 | OPENJDK_TARGET_OS="$VAR_OS" |
ohair@478 | 171 | OPENJDK_TARGET_OS_API="$VAR_OS_API" |
ohair@494 | 172 | OPENJDK_TARGET_OS_ENV="$VAR_OS_ENV" |
ohair@478 | 173 | OPENJDK_TARGET_CPU="$VAR_CPU" |
ohair@478 | 174 | OPENJDK_TARGET_CPU_ARCH="$VAR_CPU_ARCH" |
ohair@478 | 175 | OPENJDK_TARGET_CPU_BITS="$VAR_CPU_BITS" |
ohair@478 | 176 | OPENJDK_TARGET_CPU_ENDIAN="$VAR_CPU_ENDIAN" |
ohair@478 | 177 | AC_SUBST(OPENJDK_TARGET_OS) |
ohair@478 | 178 | AC_SUBST(OPENJDK_TARGET_OS_API) |
ohair@478 | 179 | AC_SUBST(OPENJDK_TARGET_CPU) |
ohair@478 | 180 | AC_SUBST(OPENJDK_TARGET_CPU_ARCH) |
ohair@478 | 181 | AC_SUBST(OPENJDK_TARGET_CPU_BITS) |
ohair@478 | 182 | AC_SUBST(OPENJDK_TARGET_CPU_ENDIAN) |
ohair@478 | 183 | |
ohair@494 | 184 | AC_MSG_CHECKING([openjdk-target os-cpu]) |
ohair@494 | 185 | AC_MSG_RESULT([$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU]) |
ohair@478 | 186 | ]) |
ohair@478 | 187 | |
ohair@478 | 188 | # Check if a reduced build (32-bit on 64-bit platforms) is requested, and modify behaviour |
ohair@478 | 189 | # accordingly. Must be done after setting up build and target system, but before |
ohair@478 | 190 | # doing anything else with these values. |
ohair@478 | 191 | AC_DEFUN([PLATFORM_SETUP_TARGET_CPU_BITS], |
ohair@478 | 192 | [ |
ohair@478 | 193 | AC_ARG_WITH(target-bits, [AS_HELP_STRING([--with-target-bits], |
ohair@478 | 194 | [build 32-bit or 64-bit binaries (for platforms that support it), e.g. --with-target-bits=32 @<:@guessed@:>@])]) |
ohair@478 | 195 | |
ohair@478 | 196 | # We have three types of compiles: |
ohair@478 | 197 | # native == normal compilation, target system == build system |
ohair@478 | 198 | # cross == traditional cross compilation, target system != build system; special toolchain needed |
ohair@478 | 199 | # reduced == using native compilers, but with special flags (e.g. -m32) to produce 32-bit builds on 64-bit machines |
ohair@478 | 200 | # |
ohair@478 | 201 | if test "x$OPENJDK_BUILD_AUTOCONF_NAME" != "x$OPENJDK_TARGET_AUTOCONF_NAME"; then |
ohair@478 | 202 | # We're doing a proper cross-compilation |
ohair@478 | 203 | COMPILE_TYPE="cross" |
ohair@478 | 204 | else |
ohair@478 | 205 | COMPILE_TYPE="native" |
ohair@478 | 206 | fi |
ohair@478 | 207 | |
ohair@478 | 208 | if test "x$with_target_bits" != x; then |
ohair@478 | 209 | if test "x$COMPILE_TYPE" = "xcross"; then |
ohair@478 | 210 | AC_MSG_ERROR([It is not possible to combine --with-target-bits=X and proper cross-compilation. Choose either.]) |
ohair@478 | 211 | fi |
ohair@478 | 212 | |
ohair@478 | 213 | if test "x$with_target_bits" = x32 && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then |
ohair@478 | 214 | # A reduced build is requested |
ohair@478 | 215 | COMPILE_TYPE="reduced" |
ohair@478 | 216 | OPENJDK_TARGET_CPU_BITS=32 |
ohair@478 | 217 | if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86"; then |
ohair@478 | 218 | OPENJDK_TARGET_CPU=x86 |
ohair@478 | 219 | elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then |
ohair@478 | 220 | OPENJDK_TARGET_CPU=sparc |
ohair@478 | 221 | else |
ohair@478 | 222 | AC_MSG_ERROR([Reduced build (--with-target-bits=32) is only supported on x86_64 and sparcv9]) |
ohair@478 | 223 | fi |
ohair@478 | 224 | elif test "x$with_target_bits" = x64 && test "x$OPENJDK_TARGET_CPU_BITS" = x32; then |
ohair@478 | 225 | 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 | 226 | elif test "x$with_target_bits" = "x$OPENJDK_TARGET_CPU_BITS"; then |
ohair@478 | 227 | AC_MSG_NOTICE([--with-target-bits are set to build platform address size; argument has no meaning]) |
ohair@478 | 228 | else |
ohair@478 | 229 | AC_MSG_ERROR([--with-target-bits can only be 32 or 64, you specified $with_target_bits!]) |
ohair@478 | 230 | fi |
ohair@478 | 231 | fi |
ohair@478 | 232 | AC_SUBST(COMPILE_TYPE) |
ohair@478 | 233 | |
ohair@494 | 234 | AC_MSG_CHECKING([compilation type]) |
ohair@478 | 235 | AC_MSG_RESULT([$COMPILE_TYPE]) |
ohair@478 | 236 | ]) |
ohair@478 | 237 | |
ohair@478 | 238 | # Setup the legacy variables, for controlling the old makefiles. |
ohair@478 | 239 | # |
ohair@478 | 240 | AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS], |
ohair@478 | 241 | [ |
ohair@478 | 242 | # Also store the legacy naming of the cpu. |
ohair@478 | 243 | # Ie i586 and amd64 instead of x86 and x86_64 |
ohair@478 | 244 | OPENJDK_TARGET_CPU_LEGACY="$OPENJDK_TARGET_CPU" |
ohair@478 | 245 | if test "x$OPENJDK_TARGET_CPU" = xx86; then |
ohair@478 | 246 | OPENJDK_TARGET_CPU_LEGACY="i586" |
ohair@478 | 247 | elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then |
ohair@478 | 248 | # On all platforms except MacOSX replace x86_64 with amd64. |
ohair@478 | 249 | OPENJDK_TARGET_CPU_LEGACY="amd64" |
ohair@478 | 250 | fi |
ohair@478 | 251 | AC_SUBST(OPENJDK_TARGET_CPU_LEGACY) |
ohair@478 | 252 | |
ohair@478 | 253 | # And the second legacy naming of the cpu. |
ohair@478 | 254 | # Ie i386 and amd64 instead of x86 and x86_64. |
ohair@478 | 255 | OPENJDK_TARGET_CPU_LEGACY_LIB="$OPENJDK_TARGET_CPU" |
ohair@478 | 256 | if test "x$OPENJDK_TARGET_CPU" = xx86; then |
ohair@478 | 257 | OPENJDK_TARGET_CPU_LEGACY_LIB="i386" |
ohair@478 | 258 | elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then |
ohair@478 | 259 | OPENJDK_TARGET_CPU_LEGACY_LIB="amd64" |
ohair@478 | 260 | fi |
ohair@478 | 261 | AC_SUBST(OPENJDK_TARGET_CPU_LEGACY_LIB) |
ohair@478 | 262 | |
ohair@478 | 263 | # This is the name of the cpu (but using i386 and amd64 instead of |
ohair@478 | 264 | # x86 and x86_64, respectively), preceeded by a /, to be used when |
ohair@478 | 265 | # locating libraries. On macosx, it's empty, though. |
ohair@478 | 266 | OPENJDK_TARGET_CPU_LIBDIR="/$OPENJDK_TARGET_CPU_LEGACY_LIB" |
ohair@478 | 267 | if test "x$OPENJDK_TARGET_OS" = xmacosx; then |
ohair@478 | 268 | OPENJDK_TARGET_CPU_LIBDIR="" |
ohair@478 | 269 | fi |
ohair@478 | 270 | AC_SUBST(OPENJDK_TARGET_CPU_LIBDIR) |
ohair@478 | 271 | |
ohair@478 | 272 | # OPENJDK_TARGET_CPU_ISADIR is normally empty. On 64-bit Solaris systems, it is set to |
ohair@478 | 273 | # /amd64 or /sparcv9. This string is appended to some library paths, like this: |
ohair@478 | 274 | # /usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libexample.so |
ohair@478 | 275 | OPENJDK_TARGET_CPU_ISADIR="" |
ohair@478 | 276 | if test "x$OPENJDK_TARGET_OS" = xsolaris; then |
ohair@478 | 277 | if test "x$OPENJDK_TARGET_CPU" = xx86_64; then |
ohair@478 | 278 | OPENJDK_TARGET_CPU_ISADIR="/amd64" |
ohair@478 | 279 | elif test "x$OPENJDK_TARGET_CPU" = xsparcv9; then |
ohair@478 | 280 | OPENJDK_TARGET_CPU_ISADIR="/sparcv9" |
ohair@478 | 281 | fi |
ohair@478 | 282 | fi |
ohair@478 | 283 | AC_SUBST(OPENJDK_TARGET_CPU_ISADIR) |
ohair@478 | 284 | |
ohair@478 | 285 | # Setup OPENJDK_TARGET_CPU_OSARCH, which is used to set the os.arch Java system property |
ohair@478 | 286 | OPENJDK_TARGET_CPU_OSARCH="$OPENJDK_TARGET_CPU" |
ohair@478 | 287 | if test "x$OPENJDK_TARGET_OS" = xlinux && test "x$OPENJDK_TARGET_CPU" = xx86; then |
ohair@478 | 288 | # On linux only, we replace x86 with i386. |
ohair@478 | 289 | OPENJDK_TARGET_CPU_OSARCH="i386" |
ohair@478 | 290 | elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then |
ohair@478 | 291 | # On all platforms except macosx, we replace x86_64 with amd64. |
ohair@478 | 292 | OPENJDK_TARGET_CPU_OSARCH="amd64" |
ohair@478 | 293 | fi |
ohair@478 | 294 | AC_SUBST(OPENJDK_TARGET_CPU_OSARCH) |
ohair@478 | 295 | |
ohair@478 | 296 | OPENJDK_TARGET_CPU_JLI="$OPENJDK_TARGET_CPU" |
ohair@478 | 297 | if test "x$OPENJDK_TARGET_CPU" = xx86; then |
ohair@478 | 298 | OPENJDK_TARGET_CPU_JLI="i386" |
ohair@478 | 299 | elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then |
ohair@478 | 300 | # On all platforms except macosx, we replace x86_64 with amd64. |
ohair@478 | 301 | OPENJDK_TARGET_CPU_JLI="amd64" |
ohair@478 | 302 | fi |
ohair@478 | 303 | # Now setup the -D flags for building libjli. |
ohair@478 | 304 | OPENJDK_TARGET_CPU_JLI_CFLAGS="-DLIBARCHNAME='\"$OPENJDK_TARGET_CPU_JLI\"'" |
ohair@478 | 305 | if test "x$OPENJDK_TARGET_OS" = xsolaris; then |
ohair@478 | 306 | if test "x$OPENJDK_TARGET_CPU_ARCH" = xsparc; then |
ohair@478 | 307 | OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"sparc\"' -DLIBARCH64NAME='\"sparcv9\"'" |
ohair@478 | 308 | elif test "x$OPENJDK_TARGET_CPU_ARCH" = xx86; then |
ohair@478 | 309 | OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"i386\"' -DLIBARCH64NAME='\"amd64\"'" |
ohair@478 | 310 | fi |
ohair@478 | 311 | fi |
ohair@478 | 312 | AC_SUBST(OPENJDK_TARGET_CPU_JLI_CFLAGS) |
ohair@478 | 313 | |
ohair@478 | 314 | # Setup OPENJDK_TARGET_OS_API_DIR, used in source paths. |
ohair@478 | 315 | if test "x$OPENJDK_TARGET_OS_API" = xposix; then |
ohair@478 | 316 | OPENJDK_TARGET_OS_API_DIR="solaris" |
ohair@478 | 317 | fi |
ohair@478 | 318 | if test "x$OPENJDK_TARGET_OS_API" = xwinapi; then |
ohair@478 | 319 | OPENJDK_TARGET_OS_API_DIR="windows" |
ohair@478 | 320 | fi |
ohair@478 | 321 | AC_SUBST(OPENJDK_TARGET_OS_API_DIR) |
ohair@478 | 322 | |
ohair@478 | 323 | if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then |
ohair@478 | 324 | A_LP64="LP64:=" |
ohair@494 | 325 | # -D_LP64=1 is only set on linux and mac. Setting on windows causes diff in |
ohair@494 | 326 | # unpack200.exe |
ohair@494 | 327 | if test "x$OPENJDK_TARGET_OS" = xlinux || test "x$OPENJDK_TARGET_OS" = xmacosx; then |
ohair@494 | 328 | ADD_LP64="-D_LP64=1" |
ohair@494 | 329 | fi |
ohair@478 | 330 | fi |
ohair@478 | 331 | AC_SUBST(LP64,$A_LP64) |
ohair@478 | 332 | |
ohair@478 | 333 | if test "x$COMPILE_TYPE" = "xcross"; then |
ohair@478 | 334 | # FIXME: ... or should this include reduced builds..? |
ohair@478 | 335 | DEFINE_CROSS_COMPILE_ARCH="CROSS_COMPILE_ARCH:=$OPENJDK_TARGET_CPU_LEGACY" |
ohair@478 | 336 | else |
ohair@478 | 337 | DEFINE_CROSS_COMPILE_ARCH="" |
ohair@478 | 338 | fi |
ohair@478 | 339 | AC_SUBST(DEFINE_CROSS_COMPILE_ARCH) |
omajid@671 | 340 | |
omajid@671 | 341 | # ZERO_ARCHDEF is used to enable architecture-specific code |
omajid@671 | 342 | case "${OPENJDK_TARGET_CPU}" in |
omajid@671 | 343 | ppc*) ZERO_ARCHDEF=PPC ;; |
omajid@671 | 344 | s390*) ZERO_ARCHDEF=S390 ;; |
omajid@671 | 345 | sparc*) ZERO_ARCHDEF=SPARC ;; |
omajid@671 | 346 | x86_64*) ZERO_ARCHDEF=AMD64 ;; |
omajid@671 | 347 | x86) ZERO_ARCHDEF=IA32 ;; |
omajid@671 | 348 | *) ZERO_ARCHDEF=$(echo "${OPENJDK_TARGET_CPU_LEGACY_LIB}" | tr a-z A-Z) |
omajid@671 | 349 | esac |
omajid@671 | 350 | AC_SUBST(ZERO_ARCHDEF) |
omajid@671 | 351 | |
ohair@478 | 352 | ]) |
ohair@478 | 353 | |
erikj@458 | 354 | AC_DEFUN([PLATFORM_SET_RELEASE_FILE_OS_VALUES], |
ohair@425 | 355 | [ |
erikj@458 | 356 | if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then |
erikj@445 | 357 | REQUIRED_OS_NAME=SunOS |
erikj@445 | 358 | REQUIRED_OS_VERSION=5.10 |
erikj@445 | 359 | fi |
erikj@458 | 360 | if test "x$OPENJDK_TARGET_OS" = "xlinux"; then |
erikj@445 | 361 | REQUIRED_OS_NAME=Linux |
erikj@445 | 362 | REQUIRED_OS_VERSION=2.6 |
erikj@445 | 363 | fi |
erikj@458 | 364 | if test "x$OPENJDK_TARGET_OS" = "xwindows"; then |
erikj@445 | 365 | REQUIRED_OS_NAME=Windows |
ohair@478 | 366 | if test "x$OPENJDK_TARGET_CPU_BITS" = "x64"; then |
ohair@478 | 367 | REQUIRED_OS_VERSION=5.2 |
ohair@478 | 368 | else |
ohair@478 | 369 | REQUIRED_OS_VERSION=5.1 |
ohair@478 | 370 | fi |
erikj@445 | 371 | fi |
erikj@458 | 372 | if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then |
erikj@445 | 373 | REQUIRED_OS_NAME=Darwin |
erikj@445 | 374 | REQUIRED_OS_VERSION=11.2 |
erikj@445 | 375 | fi |
erikj@445 | 376 | |
erikj@445 | 377 | AC_SUBST(REQUIRED_OS_NAME) |
erikj@445 | 378 | AC_SUBST(REQUIRED_OS_VERSION) |
erikj@445 | 379 | ]) |
erikj@458 | 380 | |
erikj@458 | 381 | #%%% Build and target systems %%% |
erikj@458 | 382 | AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_AND_TARGET], |
erikj@458 | 383 | [ |
erikj@458 | 384 | # Figure out the build and target systems. # Note that in autoconf terminology, "build" is obvious, but "target" |
erikj@458 | 385 | # is confusing; it assumes you are cross-compiling a cross-compiler (!) and "target" is thus the target of the |
erikj@458 | 386 | # product you're building. The target of this build is called "host". Since this is confusing to most people, we |
erikj@458 | 387 | # have not adopted that system, but use "target" as the platform we are building for. In some places though we need |
erikj@458 | 388 | # to use the configure naming style. |
erikj@458 | 389 | AC_CANONICAL_BUILD |
erikj@458 | 390 | AC_CANONICAL_HOST |
erikj@458 | 391 | AC_CANONICAL_TARGET |
erikj@458 | 392 | |
ohair@478 | 393 | PLATFORM_EXTRACT_TARGET_AND_BUILD |
ohair@478 | 394 | PLATFORM_SETUP_TARGET_CPU_BITS |
ohair@478 | 395 | PLATFORM_SET_RELEASE_FILE_OS_VALUES |
ohair@478 | 396 | PLATFORM_SETUP_LEGACY_VARS |
erikj@458 | 397 | ]) |
erikj@458 | 398 | |
erikj@458 | 399 | AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_OS_VERSION], |
erikj@458 | 400 | [ |
erikj@458 | 401 | ############################################################################### |
erikj@458 | 402 | |
erikj@458 | 403 | # Note that this is the build platform OS version! |
erikj@458 | 404 | |
erikj@458 | 405 | OS_VERSION="`uname -r | ${SED} 's!\.! !g' | ${SED} 's!-! !g'`" |
erikj@458 | 406 | OS_VERSION_MAJOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 1 -d ' '`" |
erikj@458 | 407 | OS_VERSION_MINOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 2 -d ' '`" |
erikj@458 | 408 | OS_VERSION_MICRO="`${ECHO} ${OS_VERSION} | ${CUT} -f 3 -d ' '`" |
erikj@458 | 409 | AC_SUBST(OS_VERSION_MAJOR) |
erikj@458 | 410 | AC_SUBST(OS_VERSION_MINOR) |
erikj@458 | 411 | AC_SUBST(OS_VERSION_MICRO) |
erikj@458 | 412 | ]) |
erikj@458 | 413 | |
ohair@478 | 414 | # Support macro for PLATFORM_SETUP_OPENJDK_TARGET_BITS. |
ohair@478 | 415 | # Add -mX to various FLAGS variables. |
ohair@478 | 416 | AC_DEFUN([PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS], |
ohair@478 | 417 | [ |
ohair@478 | 418 | # keep track of c/cxx flags that we added outselves... |
ohair@478 | 419 | # to prevent emitting warning... |
simonis@971 | 420 | ADDED_CFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}" |
simonis@971 | 421 | ADDED_CXXFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}" |
simonis@971 | 422 | ADDED_LDFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}" |
ohair@478 | 423 | |
simonis@971 | 424 | CFLAGS="${CFLAGS}${ADDED_CFLAGS}" |
simonis@971 | 425 | CXXFLAGS="${CXXFLAGS}${ADDED_CXXFLAGS}" |
simonis@971 | 426 | LDFLAGS="${LDFLAGS}${ADDED_LDFLAGS}" |
ohair@478 | 427 | |
simonis@971 | 428 | CFLAGS_JDK="${CFLAGS_JDK}${ADDED_CFLAGS}" |
simonis@971 | 429 | CXXFLAGS_JDK="${CXXFLAGS_JDK}${ADDED_CXXFLAGS}" |
simonis@971 | 430 | LDFLAGS_JDK="${LDFLAGS_JDK}${ADDED_LDFLAGS}" |
ohair@478 | 431 | ]) |
ohair@478 | 432 | |
ohair@478 | 433 | AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS], |
erikj@458 | 434 | [ |
erikj@458 | 435 | ############################################################################### |
erikj@458 | 436 | # |
erikj@458 | 437 | # Now we check if libjvm.so will use 32 or 64 bit pointers for the C/C++ code. |
erikj@458 | 438 | # (The JVM can use 32 or 64 bit Java pointers but that decision |
erikj@458 | 439 | # is made at runtime.) |
erikj@458 | 440 | # |
omajid@695 | 441 | |
simonis@971 | 442 | if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xaix; then |
simonis@971 | 443 | # Always specify -m flag on Solaris |
simonis@971 | 444 | # And -q on AIX because otherwise the compiler produces 32-bit objects by default |
ohair@478 | 445 | PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS |
ohair@478 | 446 | elif test "x$COMPILE_TYPE" = xreduced; then |
ohair@478 | 447 | if test "x$OPENJDK_TARGET_OS" != xwindows; then |
ohair@478 | 448 | # Specify -m if running reduced on other Posix platforms |
ohair@478 | 449 | PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS |
ohair@478 | 450 | fi |
erikj@458 | 451 | fi |
ohair@478 | 452 | |
ohair@478 | 453 | # Make compilation sanity check |
ohair@478 | 454 | AC_CHECK_HEADERS([stdio.h], , [ |
ohair@478 | 455 | AC_MSG_NOTICE([Failed to compile stdio.h. This likely implies missing compile dependencies.]) |
ohair@478 | 456 | if test "x$COMPILE_TYPE" = xreduced; then |
ohair@478 | 457 | AC_MSG_NOTICE([You are doing a reduced build. Check that you have 32-bit libraries installed.]) |
ohair@478 | 458 | elif test "x$COMPILE_TYPE" = xcross; then |
ohair@478 | 459 | AC_MSG_NOTICE([You are doing a cross-compilation. Check that you have all target platform libraries installed.]) |
ohair@478 | 460 | fi |
ohair@478 | 461 | AC_MSG_ERROR([Cannot continue.]) |
ohair@478 | 462 | ]) |
ohair@478 | 463 | |
erikj@458 | 464 | AC_CHECK_SIZEOF([int *], [1111]) |
erikj@458 | 465 | |
simonis@971 | 466 | # AC_CHECK_SIZEOF defines 'ac_cv_sizeof_int_p' to hold the number of bytes used by an 'int*' |
simonis@971 | 467 | if test "x$ac_cv_sizeof_int_p" = x; then |
ohair@478 | 468 | # The test failed, lets stick to the assumed value. |
ohair@478 | 469 | AC_MSG_WARN([The number of bits in the target could not be determined, using $OPENJDK_TARGET_CPU_BITS.]) |
erikj@458 | 470 | else |
simonis@971 | 471 | TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p` |
erikj@458 | 472 | |
ohair@478 | 473 | if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then |
simonis@971 | 474 | # This situation may happen on 64-bit platforms where the compiler by default only generates 32-bit objects |
simonis@971 | 475 | # Let's try to implicitely set the compilers target architecture and retry the test |
simonis@971 | 476 | 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).]) |
simonis@971 | 477 | AC_MSG_NOTICE([I'll retry after setting the platforms compiler target bits flag to ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}]) |
simonis@971 | 478 | PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS |
simonis@971 | 479 | |
simonis@971 | 480 | # We have to unset 'ac_cv_sizeof_int_p' first, otherwise AC_CHECK_SIZEOF will use the previously cached value! |
simonis@971 | 481 | unset ac_cv_sizeof_int_p |
simonis@971 | 482 | # And we have to undef the definition of SIZEOF_INT_P in confdefs.h by the previous invocation of AC_CHECK_SIZEOF |
simonis@971 | 483 | cat >>confdefs.h <<_ACEOF |
simonis@971 | 484 | #undef SIZEOF_INT_P |
simonis@971 | 485 | _ACEOF |
simonis@971 | 486 | |
simonis@971 | 487 | AC_CHECK_SIZEOF([int *], [1111]) |
simonis@971 | 488 | |
simonis@971 | 489 | TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p` |
simonis@971 | 490 | |
simonis@971 | 491 | if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then |
simonis@971 | 492 | 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)]) |
simonis@971 | 493 | fi |
erikj@458 | 494 | fi |
erikj@458 | 495 | fi |
erikj@458 | 496 | |
erikj@458 | 497 | AC_MSG_CHECKING([for target address size]) |
ohair@478 | 498 | AC_MSG_RESULT([$OPENJDK_TARGET_CPU_BITS bits]) |
erikj@458 | 499 | ]) |
erikj@458 | 500 | |
erikj@458 | 501 | AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_ENDIANNESS], |
erikj@458 | 502 | [ |
erikj@458 | 503 | ############################################################################### |
erikj@458 | 504 | # |
erikj@458 | 505 | # Is the target little of big endian? |
erikj@458 | 506 | # |
erikj@458 | 507 | AC_C_BIGENDIAN([ENDIAN="big"],[ENDIAN="little"],[ENDIAN="unknown"],[ENDIAN="universal_endianness"]) |
erikj@458 | 508 | |
erikj@458 | 509 | if test "x$ENDIAN" = xuniversal_endianness; then |
erikj@458 | 510 | AC_MSG_ERROR([Building with both big and little endianness is not supported]) |
erikj@458 | 511 | fi |
ohair@478 | 512 | if test "x$ENDIAN" != "x$OPENJDK_TARGET_CPU_ENDIAN"; then |
ohair@478 | 513 | 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 | 514 | fi |
erikj@458 | 515 | ]) |