annotate make/autoconf/platform.m4 @ 49497:cb442a8273cb

Merge
author mikael
date Fri, 30 Mar 2018 21:19:21 -0700
parents 07531d66c761 bf53d82a51e5
children e5bc7886e2f1
rev   line source
ohair@12258 1 #
ihse@49121 2 # Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
ohair@12258 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ohair@12258 4 #
ohair@12258 5 # This code is free software; you can redistribute it and/or modify it
ohair@12258 6 # under the terms of the GNU General Public License version 2 only, as
ohair@12258 7 # published by the Free Software Foundation. Oracle designates this
ohair@12258 8 # particular file as subject to the "Classpath" exception as provided
ohair@12258 9 # by Oracle in the LICENSE file that accompanied this code.
ohair@12258 10 #
ohair@12258 11 # This code is distributed in the hope that it will be useful, but WITHOUT
ohair@12258 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ohair@12258 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ohair@12258 14 # version 2 for more details (a copy is included in the LICENSE file that
ohair@12258 15 # accompanied this code).
ohair@12258 16 #
ohair@12258 17 # You should have received a copy of the GNU General Public License version
ohair@12258 18 # 2 along with this work; if not, write to the Free Software Foundation,
ohair@12258 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ohair@12258 20 #
ohair@12258 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@12258 22 # or visit www.oracle.com if you need additional information or have any
ohair@12258 23 # questions.
ohair@12258 24 #
ohair@12258 25
ohair@13697 26 # Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD.
ohair@13697 27 # Converts autoconf style CPU name to OpenJDK style, into
ohair@13697 28 # VAR_CPU, VAR_CPU_ARCH, VAR_CPU_BITS and VAR_CPU_ENDIAN.
erikj@13132 29 AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU],
ohair@12258 30 [
ohair@12258 31 # First argument is the cpu name from the trip/quad
ohair@12258 32 case "$1" in
ohair@12258 33 x86_64)
ohair@13697 34 VAR_CPU=x86_64
ohair@12258 35 VAR_CPU_ARCH=x86
ohair@12258 36 VAR_CPU_BITS=64
ohair@12258 37 VAR_CPU_ENDIAN=little
ohair@12258 38 ;;
ohair@12258 39 i?86)
ohair@13697 40 VAR_CPU=x86
ohair@12258 41 VAR_CPU_ARCH=x86
ohair@12258 42 VAR_CPU_BITS=32
ohair@12258 43 VAR_CPU_ENDIAN=little
ohair@12258 44 ;;
glaubitz@46932 45 alpha*)
glaubitz@46932 46 VAR_CPU=alpha
glaubitz@46932 47 VAR_CPU_ARCH=alpha
glaubitz@46932 48 VAR_CPU_BITS=64
glaubitz@46932 49 VAR_CPU_ENDIAN=little
glaubitz@46932 50 ;;
ohair@12258 51 arm*)
ohair@12258 52 VAR_CPU=arm
ohair@12258 53 VAR_CPU_ARCH=arm
erikj@13132 54 VAR_CPU_BITS=32
erikj@13132 55 VAR_CPU_ENDIAN=little
ohair@12258 56 ;;
aph@29161 57 aarch64)
aph@29161 58 VAR_CPU=aarch64
aph@29161 59 VAR_CPU_ARCH=aarch64
aph@29161 60 VAR_CPU_BITS=64
aph@29161 61 VAR_CPU_ENDIAN=little
aph@29161 62 ;;
glaubitz@46932 63 m68k)
glaubitz@46932 64 VAR_CPU=m68k
glaubitz@46932 65 VAR_CPU_ARCH=m68k
glaubitz@46932 66 VAR_CPU_BITS=32
glaubitz@46932 67 VAR_CPU_ENDIAN=big
glaubitz@46932 68 ;;
glaubitz@46932 69 mips)
glaubitz@46932 70 VAR_CPU=mips
glaubitz@46932 71 VAR_CPU_ARCH=mips
glaubitz@46932 72 VAR_CPU_BITS=32
glaubitz@46932 73 VAR_CPU_ENDIAN=big
glaubitz@46932 74 ;;
glaubitz@46932 75 mipsel)
glaubitz@46932 76 VAR_CPU=mipsel
glaubitz@46932 77 VAR_CPU_ARCH=mipsel
glaubitz@46932 78 VAR_CPU_BITS=32
glaubitz@46932 79 VAR_CPU_ENDIAN=little
glaubitz@46932 80 ;;
glaubitz@46932 81 mips64)
glaubitz@46932 82 VAR_CPU=mips64
glaubitz@46932 83 VAR_CPU_ARCH=mips64
glaubitz@46932 84 VAR_CPU_BITS=64
glaubitz@46932 85 VAR_CPU_ENDIAN=big
glaubitz@46932 86 ;;
glaubitz@46932 87 mips64el)
glaubitz@46932 88 VAR_CPU=mips64el
glaubitz@46932 89 VAR_CPU_ARCH=mips64el
glaubitz@46932 90 VAR_CPU_BITS=64
glaubitz@46932 91 VAR_CPU_ENDIAN=little
glaubitz@46932 92 ;;
ohair@12258 93 powerpc)
ohair@12258 94 VAR_CPU=ppc
ohair@12258 95 VAR_CPU_ARCH=ppc
ohair@12258 96 VAR_CPU_BITS=32
ohair@12258 97 VAR_CPU_ENDIAN=big
ihse@20363 98 ;;
ohair@12258 99 powerpc64)
ohair@12258 100 VAR_CPU=ppc64
ohair@12258 101 VAR_CPU_ARCH=ppc
ohair@12258 102 VAR_CPU_BITS=64
erikj@13132 103 VAR_CPU_ENDIAN=big
ihse@20363 104 ;;
kvn@23437 105 powerpc64le)
asmundak@35011 106 VAR_CPU=ppc64le
kvn@23437 107 VAR_CPU_ARCH=ppc
kvn@23437 108 VAR_CPU_BITS=64
kvn@23437 109 VAR_CPU_ENDIAN=little
kvn@23437 110 ;;
omajid@19676 111 s390)
omajid@19676 112 VAR_CPU=s390
omajid@19676 113 VAR_CPU_ARCH=s390
omajid@19676 114 VAR_CPU_BITS=32
omajid@19676 115 VAR_CPU_ENDIAN=big
ihse@20363 116 ;;
omajid@19676 117 s390x)
omajid@19676 118 VAR_CPU=s390x
omajid@19676 119 VAR_CPU_ARCH=s390
omajid@19676 120 VAR_CPU_BITS=64
omajid@19676 121 VAR_CPU_ENDIAN=big
ihse@20363 122 ;;
glaubitz@46932 123 sh*eb)
glaubitz@46932 124 VAR_CPU=sh
glaubitz@46932 125 VAR_CPU_ARCH=sh
glaubitz@46932 126 VAR_CPU_BITS=32
glaubitz@46932 127 VAR_CPU_ENDIAN=big
glaubitz@46932 128 ;;
glaubitz@46932 129 sh*)
glaubitz@46932 130 VAR_CPU=sh
glaubitz@46932 131 VAR_CPU_ARCH=sh
glaubitz@46932 132 VAR_CPU_BITS=32
glaubitz@46932 133 VAR_CPU_ENDIAN=little
glaubitz@46932 134 ;;
ohair@12258 135 sparc)
ohair@12258 136 VAR_CPU=sparc
ohair@12258 137 VAR_CPU_ARCH=sparc
ohair@12258 138 VAR_CPU_BITS=32
ohair@12258 139 VAR_CPU_ENDIAN=big
ihse@20363 140 ;;
mikael@25040 141 sparcv9|sparc64)
ohair@12258 142 VAR_CPU=sparcv9
ohair@12258 143 VAR_CPU_ARCH=sparc
ohair@12258 144 VAR_CPU_BITS=64
ohair@12258 145 VAR_CPU_ENDIAN=big
ihse@20363 146 ;;
ohair@12258 147 *)
erikj@12801 148 AC_MSG_ERROR([unsupported cpu $1])
ohair@12258 149 ;;
ohair@12258 150 esac
ohair@12258 151 ])
ohair@12258 152
ohair@13697 153 # Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD.
ohair@13697 154 # Converts autoconf style OS name to OpenJDK style, into
ihse@27586 155 # VAR_OS, VAR_OS_TYPE and VAR_OS_ENV.
erikj@13132 156 AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_OS],
ohair@12258 157 [
ohair@12258 158 case "$1" in
ohair@12258 159 *linux*)
ohair@12258 160 VAR_OS=linux
ihse@27586 161 VAR_OS_TYPE=unix
ohair@12258 162 ;;
ohair@12258 163 *solaris*)
ohair@12258 164 VAR_OS=solaris
ihse@27586 165 VAR_OS_TYPE=unix
ohair@12258 166 ;;
ohair@12258 167 *darwin*)
ohair@12258 168 VAR_OS=macosx
ihse@27586 169 VAR_OS_TYPE=unix
ohair@12258 170 ;;
ohair@12258 171 *bsd*)
ohair@12258 172 VAR_OS=bsd
ihse@27586 173 VAR_OS_TYPE=unix
ohair@12258 174 ;;
ohair@14111 175 *cygwin*)
ohair@12258 176 VAR_OS=windows
ohair@14111 177 VAR_OS_ENV=windows.cygwin
ohair@14111 178 ;;
ohair@14111 179 *mingw*)
ohair@14111 180 VAR_OS=windows
ohair@14111 181 VAR_OS_ENV=windows.msys
ohair@12258 182 ;;
simonis@22466 183 *aix*)
simonis@22466 184 VAR_OS=aix
ihse@27586 185 VAR_OS_TYPE=unix
simonis@22466 186 ;;
ohair@12258 187 *)
erikj@13132 188 AC_MSG_ERROR([unsupported operating system $1])
ohair@12258 189 ;;
ohair@12258 190 esac
mikael@48071 191
mikael@48071 192 case "$1" in
mikael@48071 193 *linux*-musl)
mikael@48071 194 VAR_LIBC=musl
mikael@48071 195 ;;
mikael@48071 196 *linux*-gnu)
mikael@48071 197 VAR_LIBC=gnu
mikael@48071 198 ;;
mikael@48071 199 *)
mikael@48071 200 VAR_LIBC=default
mikael@48071 201 ;;
mikael@48071 202 esac
ohair@12258 203 ])
ohair@12258 204
ohair@13697 205 # Expects $host_os $host_cpu $build_os and $build_cpu
ohair@13697 206 # and $with_target_bits to have been setup!
ohair@13697 207 #
ohair@13697 208 # Translate the standard triplet(quadruplet) definition
ohair@13697 209 # of the target/build system into OPENJDK_TARGET_OS, OPENJDK_TARGET_CPU,
ohair@13697 210 # OPENJDK_BUILD_OS, etc.
ohair@13697 211 AC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD],
ohair@13697 212 [
ihse@20363 213 # Copy the autoconf trip/quadruplet verbatim to OPENJDK_TARGET_AUTOCONF_NAME
ihse@20363 214 # (from the autoconf "host") and OPENJDK_BUILD_AUTOCONF_NAME
ihse@20363 215 # Note that we might later on rewrite e.g. OPENJDK_TARGET_CPU due to reduced build,
ihse@20363 216 # but this will not change the value of OPENJDK_TARGET_AUTOCONF_NAME.
ihse@20363 217 OPENJDK_TARGET_AUTOCONF_NAME="$host"
ihse@20363 218 OPENJDK_BUILD_AUTOCONF_NAME="$build"
ihse@20363 219 AC_SUBST(OPENJDK_TARGET_AUTOCONF_NAME)
ihse@20363 220 AC_SUBST(OPENJDK_BUILD_AUTOCONF_NAME)
ohair@13697 221
ihse@20363 222 # Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables.
ihse@20363 223 PLATFORM_EXTRACT_VARS_FROM_OS($build_os)
ihse@20363 224 PLATFORM_EXTRACT_VARS_FROM_CPU($build_cpu)
ihse@42300 225 # ..and setup our own variables. (Do this explicitly to facilitate searching)
ihse@20363 226 OPENJDK_BUILD_OS="$VAR_OS"
ihse@27586 227 if test "x$VAR_OS_TYPE" != x; then
ihse@27586 228 OPENJDK_BUILD_OS_TYPE="$VAR_OS_TYPE"
ihse@27586 229 else
ihse@27586 230 OPENJDK_BUILD_OS_TYPE="$VAR_OS"
ihse@27586 231 fi
ihse@27586 232 if test "x$VAR_OS_ENV" != x; then
ihse@27586 233 OPENJDK_BUILD_OS_ENV="$VAR_OS_ENV"
ihse@27586 234 else
ihse@27586 235 OPENJDK_BUILD_OS_ENV="$VAR_OS"
ihse@27586 236 fi
ihse@20363 237 OPENJDK_BUILD_CPU="$VAR_CPU"
ihse@20363 238 OPENJDK_BUILD_CPU_ARCH="$VAR_CPU_ARCH"
ihse@20363 239 OPENJDK_BUILD_CPU_BITS="$VAR_CPU_BITS"
ihse@20363 240 OPENJDK_BUILD_CPU_ENDIAN="$VAR_CPU_ENDIAN"
mikael@48071 241 OPENJDK_BUILD_LIBC="$VAR_LIBC"
ihse@20363 242 AC_SUBST(OPENJDK_BUILD_OS)
ihse@27586 243 AC_SUBST(OPENJDK_BUILD_OS_TYPE)
erikj@25882 244 AC_SUBST(OPENJDK_BUILD_OS_ENV)
ihse@20363 245 AC_SUBST(OPENJDK_BUILD_CPU)
ihse@20363 246 AC_SUBST(OPENJDK_BUILD_CPU_ARCH)
ihse@20363 247 AC_SUBST(OPENJDK_BUILD_CPU_BITS)
ihse@20363 248 AC_SUBST(OPENJDK_BUILD_CPU_ENDIAN)
mikael@48071 249 AC_SUBST(OPENJDK_BUILD_LIBC)
ohair@14111 250
ihse@20363 251 AC_MSG_CHECKING([openjdk-build os-cpu])
ihse@20363 252 AC_MSG_RESULT([$OPENJDK_BUILD_OS-$OPENJDK_BUILD_CPU])
ohair@14111 253
mikael@48071 254 if test "x$OPENJDK_BUILD_OS" = "xlinux"; then
mikael@48071 255 AC_MSG_CHECKING([openjdk-build C library])
mikael@48071 256 AC_MSG_RESULT([$OPENJDK_BUILD_LIBC])
mikael@48071 257 fi
mikael@48071 258
ihse@20363 259 # Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables.
ihse@20363 260 PLATFORM_EXTRACT_VARS_FROM_OS($host_os)
ihse@20363 261 PLATFORM_EXTRACT_VARS_FROM_CPU($host_cpu)
ihse@42300 262 # ... and setup our own variables. (Do this explicitly to facilitate searching)
ihse@20363 263 OPENJDK_TARGET_OS="$VAR_OS"
ihse@27586 264 if test "x$VAR_OS_TYPE" != x; then
ihse@27586 265 OPENJDK_TARGET_OS_TYPE="$VAR_OS_TYPE"
ihse@27586 266 else
ihse@27586 267 OPENJDK_TARGET_OS_TYPE="$VAR_OS"
ihse@27586 268 fi
ihse@27586 269 if test "x$VAR_OS_ENV" != x; then
ihse@27586 270 OPENJDK_TARGET_OS_ENV="$VAR_OS_ENV"
ihse@27586 271 else
ihse@27586 272 OPENJDK_TARGET_OS_ENV="$VAR_OS"
ihse@27586 273 fi
ihse@20363 274 OPENJDK_TARGET_CPU="$VAR_CPU"
ihse@20363 275 OPENJDK_TARGET_CPU_ARCH="$VAR_CPU_ARCH"
ihse@20363 276 OPENJDK_TARGET_CPU_BITS="$VAR_CPU_BITS"
ihse@20363 277 OPENJDK_TARGET_CPU_ENDIAN="$VAR_CPU_ENDIAN"
ihse@49444 278 OPENJDK_TARGET_OS_UPPERCASE=`$ECHO $OPENJDK_TARGET_OS | $TR 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
mikael@48071 279 OPENJDK_TARGET_LIBC="$VAR_LIBC"
ihse@49444 280
ihse@20363 281 AC_SUBST(OPENJDK_TARGET_OS)
ihse@27586 282 AC_SUBST(OPENJDK_TARGET_OS_TYPE)
erikj@25882 283 AC_SUBST(OPENJDK_TARGET_OS_ENV)
ihse@49444 284 AC_SUBST(OPENJDK_TARGET_OS_UPPERCASE)
ihse@20363 285 AC_SUBST(OPENJDK_TARGET_CPU)
ihse@20363 286 AC_SUBST(OPENJDK_TARGET_CPU_ARCH)
ihse@20363 287 AC_SUBST(OPENJDK_TARGET_CPU_BITS)
ihse@20363 288 AC_SUBST(OPENJDK_TARGET_CPU_ENDIAN)
mikael@48071 289 AC_SUBST(OPENJDK_TARGET_LIBC)
ohair@13697 290
ihse@20363 291 AC_MSG_CHECKING([openjdk-target os-cpu])
ihse@20363 292 AC_MSG_RESULT([$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU])
mikael@48071 293
mikael@48071 294 if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
mikael@48071 295 AC_MSG_CHECKING([openjdk-target C library])
mikael@48071 296 AC_MSG_RESULT([$OPENJDK_TARGET_LIBC])
mikael@48071 297 fi
ohair@13697 298 ])
ohair@13697 299
ohair@13697 300 # Check if a reduced build (32-bit on 64-bit platforms) is requested, and modify behaviour
ohair@13697 301 # accordingly. Must be done after setting up build and target system, but before
ohair@13697 302 # doing anything else with these values.
ohair@13697 303 AC_DEFUN([PLATFORM_SETUP_TARGET_CPU_BITS],
ohair@13697 304 [
ohair@13697 305 AC_ARG_WITH(target-bits, [AS_HELP_STRING([--with-target-bits],
ihse@20363 306 [build 32-bit or 64-bit binaries (for platforms that support it), e.g. --with-target-bits=32 @<:@guessed@:>@])])
ohair@13697 307
ohair@13697 308 # We have three types of compiles:
ohair@13697 309 # native == normal compilation, target system == build system
ohair@13697 310 # cross == traditional cross compilation, target system != build system; special toolchain needed
ohair@13697 311 # reduced == using native compilers, but with special flags (e.g. -m32) to produce 32-bit builds on 64-bit machines
ohair@13697 312 #
ohair@13697 313 if test "x$OPENJDK_BUILD_AUTOCONF_NAME" != "x$OPENJDK_TARGET_AUTOCONF_NAME"; then
ohair@13697 314 # We're doing a proper cross-compilation
ohair@13697 315 COMPILE_TYPE="cross"
ohair@13697 316 else
ohair@13697 317 COMPILE_TYPE="native"
ohair@13697 318 fi
ohair@13697 319
ohair@13697 320 if test "x$with_target_bits" != x; then
ohair@13697 321 if test "x$COMPILE_TYPE" = "xcross"; then
ohair@13697 322 AC_MSG_ERROR([It is not possible to combine --with-target-bits=X and proper cross-compilation. Choose either.])
ohair@13697 323 fi
ohair@13697 324
ohair@13697 325 if test "x$with_target_bits" = x32 && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
ohair@13697 326 # A reduced build is requested
ohair@13697 327 COMPILE_TYPE="reduced"
ohair@13697 328 OPENJDK_TARGET_CPU_BITS=32
ohair@13697 329 if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86"; then
ohair@13697 330 OPENJDK_TARGET_CPU=x86
ohair@13697 331 elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then
ohair@13697 332 OPENJDK_TARGET_CPU=sparc
ohair@13697 333 else
ohair@13697 334 AC_MSG_ERROR([Reduced build (--with-target-bits=32) is only supported on x86_64 and sparcv9])
ihse@20363 335 fi
ohair@13697 336 elif test "x$with_target_bits" = x64 && test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
ohair@13697 337 AC_MSG_ERROR([It is not possible to use --with-target-bits=64 on a 32 bit system. Use proper cross-compilation instead.])
ohair@13697 338 elif test "x$with_target_bits" = "x$OPENJDK_TARGET_CPU_BITS"; then
ohair@13697 339 AC_MSG_NOTICE([--with-target-bits are set to build platform address size; argument has no meaning])
ohair@13697 340 else
ohair@13697 341 AC_MSG_ERROR([--with-target-bits can only be 32 or 64, you specified $with_target_bits!])
ohair@13697 342 fi
ohair@13697 343 fi
ohair@13697 344 AC_SUBST(COMPILE_TYPE)
ohair@13697 345
ihse@20363 346 AC_MSG_CHECKING([compilation type])
ihse@20363 347 AC_MSG_RESULT([$COMPILE_TYPE])
ohair@13697 348 ])
ohair@13697 349
ihse@20363 350 # Setup the legacy variables, for controlling the old makefiles.
ihse@20363 351 #
ohair@13697 352 AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS],
ohair@13697 353 [
erikj@37402 354 PLATFORM_SETUP_LEGACY_VARS_HELPER([TARGET])
erikj@37402 355 PLATFORM_SETUP_LEGACY_VARS_HELPER([BUILD])
erikj@37402 356 ])
erikj@37402 357
erikj@37402 358 # $1 - Either TARGET or BUILD to setup the variables for.
erikj@37402 359 AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS_HELPER],
erikj@37402 360 [
ihse@20363 361 # Also store the legacy naming of the cpu.
ihse@20363 362 # Ie i586 and amd64 instead of x86 and x86_64
erikj@37402 363 OPENJDK_$1_CPU_LEGACY="$OPENJDK_$1_CPU"
erikj@37402 364 if test "x$OPENJDK_$1_CPU" = xx86; then
erikj@37402 365 OPENJDK_$1_CPU_LEGACY="i586"
erikj@37402 366 elif test "x$OPENJDK_$1_OS" != xmacosx && test "x$OPENJDK_$1_CPU" = xx86_64; then
ihse@20363 367 # On all platforms except MacOSX replace x86_64 with amd64.
erikj@37402 368 OPENJDK_$1_CPU_LEGACY="amd64"
glaubitz@46938 369 elif test "x$OPENJDK_$1_CPU" = xalpha; then
glaubitz@46938 370 # Avoid name collisions with variables named alpha
glaubitz@46938 371 OPENJDK_$1_CPU_LEGACY="_alpha_"
glaubitz@46938 372 elif test "x$OPENJDK_$1_CPU" = xsh; then
glaubitz@46938 373 # Avoid name collisions with variables named sh
glaubitz@46938 374 OPENJDK_$1_CPU_LEGACY="_sh_"
ihse@20363 375 fi
erikj@37402 376 AC_SUBST(OPENJDK_$1_CPU_LEGACY)
ihse@20363 377
ihse@20363 378 # And the second legacy naming of the cpu.
ihse@20363 379 # Ie i386 and amd64 instead of x86 and x86_64.
erikj@37402 380 OPENJDK_$1_CPU_LEGACY_LIB="$OPENJDK_$1_CPU"
erikj@37402 381 if test "x$OPENJDK_$1_CPU" = xx86; then
erikj@37402 382 OPENJDK_$1_CPU_LEGACY_LIB="i386"
erikj@37402 383 elif test "x$OPENJDK_$1_CPU" = xx86_64; then
erikj@37402 384 OPENJDK_$1_CPU_LEGACY_LIB="amd64"
ihse@20363 385 fi
erikj@37402 386 AC_SUBST(OPENJDK_$1_CPU_LEGACY_LIB)
ihse@20363 387
erikj@37402 388 # OPENJDK_$1_CPU_ISADIR is normally empty. On 64-bit Solaris systems, it is set to
ihse@20363 389 # /amd64 or /sparcv9. This string is appended to some library paths, like this:
erikj@37402 390 # /usr/lib${OPENJDK_$1_CPU_ISADIR}/libexample.so
erikj@37402 391 OPENJDK_$1_CPU_ISADIR=""
erikj@37402 392 if test "x$OPENJDK_$1_OS" = xsolaris; then
erikj@37402 393 if test "x$OPENJDK_$1_CPU" = xx86_64; then
erikj@37402 394 OPENJDK_$1_CPU_ISADIR="/amd64"
erikj@37402 395 elif test "x$OPENJDK_$1_CPU" = xsparcv9; then
erikj@37402 396 OPENJDK_$1_CPU_ISADIR="/sparcv9"
ohair@13697 397 fi
ihse@20363 398 fi
erikj@37402 399 AC_SUBST(OPENJDK_$1_CPU_ISADIR)
ohair@13697 400
erikj@37402 401 # Setup OPENJDK_$1_CPU_OSARCH, which is used to set the os.arch Java system property
erikj@37402 402 OPENJDK_$1_CPU_OSARCH="$OPENJDK_$1_CPU"
erikj@37402 403 if test "x$OPENJDK_$1_OS" = xlinux && test "x$OPENJDK_$1_CPU" = xx86; then
ihse@20363 404 # On linux only, we replace x86 with i386.
erikj@37402 405 OPENJDK_$1_CPU_OSARCH="i386"
erikj@37402 406 elif test "x$OPENJDK_$1_OS" != xmacosx && test "x$OPENJDK_$1_CPU" = xx86_64; then
ihse@20363 407 # On all platforms except macosx, we replace x86_64 with amd64.
erikj@37402 408 OPENJDK_$1_CPU_OSARCH="amd64"
ihse@20363 409 fi
erikj@37402 410 AC_SUBST(OPENJDK_$1_CPU_OSARCH)
ihse@20363 411
erikj@37402 412 OPENJDK_$1_CPU_JLI="$OPENJDK_$1_CPU"
erikj@37402 413 if test "x$OPENJDK_$1_CPU" = xx86; then
erikj@37402 414 OPENJDK_$1_CPU_JLI="i386"
erikj@37402 415 elif test "x$OPENJDK_$1_OS" != xmacosx && test "x$OPENJDK_$1_CPU" = xx86_64; then
ihse@20363 416 # On all platforms except macosx, we replace x86_64 with amd64.
erikj@37402 417 OPENJDK_$1_CPU_JLI="amd64"
ihse@20363 418 fi
ohair@13697 419
erikj@37972 420 # The new version string in JDK 9 also defined new naming of OS and ARCH for bundles
erikj@37972 421 # Macosx is osx and x86_64 is x64
erikj@37972 422 if test "x$OPENJDK_$1_OS" = xmacosx; then
erikj@37972 423 OPENJDK_$1_OS_BUNDLE="osx"
erikj@37972 424 else
erikj@37972 425 OPENJDK_$1_OS_BUNDLE="$OPENJDK_TARGET_OS"
erikj@37972 426 fi
erikj@37972 427 if test "x$OPENJDK_$1_CPU" = xx86_64; then
erikj@37972 428 OPENJDK_$1_CPU_BUNDLE="x64"
erikj@37972 429 else
erikj@37972 430 OPENJDK_$1_CPU_BUNDLE="$OPENJDK_$1_CPU"
erikj@37972 431 fi
mikael@48071 432
mikael@48071 433 OPENJDK_$1_LIBC_BUNDLE=""
mikael@48071 434 if test "x$OPENJDK_$1_LIBC" = "xmusl"; then
mikael@48071 435 OPENJDK_$1_LIBC_BUNDLE="-$OPENJDK_$1_LIBC"
mikael@48071 436 fi
mikael@48071 437
mikael@48071 438 OPENJDK_$1_BUNDLE_PLATFORM="${OPENJDK_$1_OS_BUNDLE}-${OPENJDK_$1_CPU_BUNDLE}${OPENJDK_$1_LIBC_BUNDLE}"
erikj@37972 439 AC_SUBST(OPENJDK_$1_BUNDLE_PLATFORM)
erikj@37972 440
ihse@20363 441 if test "x$COMPILE_TYPE" = "xcross"; then
ihse@20363 442 # FIXME: ... or should this include reduced builds..?
erikj@37402 443 DEFINE_CROSS_COMPILE_ARCH="CROSS_COMPILE_ARCH:=$OPENJDK_$1_CPU_LEGACY"
ihse@20363 444 else
ihse@20363 445 DEFINE_CROSS_COMPILE_ARCH=""
ihse@20363 446 fi
ihse@20363 447 AC_SUBST(DEFINE_CROSS_COMPILE_ARCH)
ohair@13697 448
erikj@37402 449 # Convert openjdk platform names to hotspot names
erikj@37402 450
erikj@37402 451 HOTSPOT_$1_OS=${OPENJDK_$1_OS}
erikj@37402 452 if test "x$OPENJDK_$1_OS" = xmacosx; then
erikj@37402 453 HOTSPOT_$1_OS=bsd
erikj@37402 454 fi
erikj@37402 455 AC_SUBST(HOTSPOT_$1_OS)
erikj@37402 456
erikj@37402 457 HOTSPOT_$1_OS_TYPE=${OPENJDK_$1_OS_TYPE}
erikj@37402 458 if test "x$OPENJDK_$1_OS_TYPE" = xunix; then
erikj@37402 459 HOTSPOT_$1_OS_TYPE=posix
erikj@37402 460 fi
erikj@37402 461 AC_SUBST(HOTSPOT_$1_OS_TYPE)
erikj@37402 462
erikj@37402 463 HOTSPOT_$1_CPU=${OPENJDK_$1_CPU}
erikj@37402 464 if test "x$OPENJDK_$1_CPU" = xx86; then
erikj@37402 465 HOTSPOT_$1_CPU=x86_32
erikj@37402 466 elif test "x$OPENJDK_$1_CPU" = xsparcv9; then
erikj@37402 467 HOTSPOT_$1_CPU=sparc
erikj@37402 468 elif test "x$OPENJDK_$1_CPU" = xppc64; then
erikj@37402 469 HOTSPOT_$1_CPU=ppc_64
simonis@37404 470 elif test "x$OPENJDK_$1_CPU" = xppc64le; then
simonis@37404 471 HOTSPOT_$1_CPU=ppc_64
erikj@37402 472 fi
erikj@37402 473 AC_SUBST(HOTSPOT_$1_CPU)
erikj@37402 474
erikj@37402 475 # This is identical with OPENJDK_*, but define anyway for consistency.
erikj@37402 476 HOTSPOT_$1_CPU_ARCH=${OPENJDK_$1_CPU_ARCH}
erikj@37402 477 AC_SUBST(HOTSPOT_$1_CPU_ARCH)
erikj@37402 478
erikj@37402 479 # Setup HOTSPOT_$1_CPU_DEFINE
erikj@37402 480 if test "x$OPENJDK_$1_CPU" = xx86; then
erikj@37402 481 HOTSPOT_$1_CPU_DEFINE=IA32
erikj@37402 482 elif test "x$OPENJDK_$1_CPU" = xx86_64; then
erikj@37402 483 HOTSPOT_$1_CPU_DEFINE=AMD64
erikj@37402 484 elif test "x$OPENJDK_$1_CPU" = xsparcv9; then
erikj@37402 485 HOTSPOT_$1_CPU_DEFINE=SPARC
erikj@37402 486 elif test "x$OPENJDK_$1_CPU" = xaarch64; then
erikj@37402 487 HOTSPOT_$1_CPU_DEFINE=AARCH64
erikj@37402 488 elif test "x$OPENJDK_$1_CPU" = xppc64; then
erikj@37402 489 HOTSPOT_$1_CPU_DEFINE=PPC64
simonis@37404 490 elif test "x$OPENJDK_$1_CPU" = xppc64le; then
simonis@37404 491 HOTSPOT_$1_CPU_DEFINE=PPC64
erikj@37402 492
erikj@37402 493 # The cpu defines below are for zero, we don't support them directly.
erikj@37402 494 elif test "x$OPENJDK_$1_CPU" = xsparc; then
erikj@37402 495 HOTSPOT_$1_CPU_DEFINE=SPARC
erikj@37402 496 elif test "x$OPENJDK_$1_CPU" = xppc; then
erikj@37402 497 HOTSPOT_$1_CPU_DEFINE=PPC32
erikj@37402 498 elif test "x$OPENJDK_$1_CPU" = xs390; then
erikj@37402 499 HOTSPOT_$1_CPU_DEFINE=S390
erikj@37658 500 elif test "x$OPENJDK_$1_CPU" = xs390x; then
erikj@37402 501 HOTSPOT_$1_CPU_DEFINE=S390
erikj@40619 502 elif test "x$OPENJDK_$1_CPU" != x; then
erikj@40619 503 HOTSPOT_$1_CPU_DEFINE=$(echo $OPENJDK_$1_CPU | tr a-z A-Z)
erikj@37402 504 fi
erikj@37402 505 AC_SUBST(HOTSPOT_$1_CPU_DEFINE)
erikj@37402 506
mikael@48071 507 if test "x$OPENJDK_$1_LIBC" = "xmusl"; then
mikael@48071 508 HOTSPOT_$1_LIBC=$OPENJDK_$1_LIBC
mikael@48071 509 else
mikael@48071 510 HOTSPOT_$1_LIBC=""
mikael@48071 511 fi
mikael@48071 512 AC_SUBST(HOTSPOT_$1_LIBC)
mikael@49261 513
psandoz@48356 514 # For historical reasons, the OS include directories have odd names.
psandoz@48356 515 OPENJDK_$1_OS_INCLUDE_SUBDIR="$OPENJDK_TARGET_OS"
psandoz@48356 516 if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
psandoz@48356 517 OPENJDK_$1_OS_INCLUDE_SUBDIR="win32"
psandoz@48356 518 elif test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
psandoz@48356 519 OPENJDK_$1_OS_INCLUDE_SUBDIR="darwin"
psandoz@48356 520 fi
psandoz@48356 521 AC_SUBST(OPENJDK_$1_OS_INCLUDE_SUBDIR)
ohair@13697 522 ])
ohair@13697 523
alanb@44985 524 AC_DEFUN([PLATFORM_SET_RELEASE_FILE_OS_VALUES],
alanb@44985 525 [
alanb@44985 526 if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
alanb@44985 527 RELEASE_FILE_OS_NAME=SunOS
alanb@44985 528 fi
alanb@44985 529 if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
alanb@44985 530 RELEASE_FILE_OS_NAME=Linux
alanb@44985 531 fi
alanb@44985 532 if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
alanb@44985 533 RELEASE_FILE_OS_NAME=Windows
alanb@44985 534 fi
alanb@44985 535 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
alanb@44985 536 RELEASE_FILE_OS_NAME="Darwin"
alanb@44985 537 fi
alanb@44985 538 if test "x$OPENJDK_TARGET_OS" = "xaix"; then
alanb@44985 539 RELEASE_FILE_OS_NAME="AIX"
alanb@44985 540 fi
alanb@44985 541 RELEASE_FILE_OS_ARCH=${OPENJDK_TARGET_CPU}
alanb@44985 542
alanb@44985 543 AC_SUBST(RELEASE_FILE_OS_NAME)
alanb@44985 544 AC_SUBST(RELEASE_FILE_OS_ARCH)
alanb@44985 545 ])
alanb@44985 546
mchung@44729 547 AC_DEFUN([PLATFORM_SET_MODULE_TARGET_OS_VALUES],
ohair@12258 548 [
mchung@44729 549 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
mchung@44729 550 OPENJDK_MODULE_TARGET_OS_NAME="macos"
mchung@44729 551 else
mchung@44729 552 OPENJDK_MODULE_TARGET_OS_NAME="$OPENJDK_TARGET_OS"
ihse@20363 553 fi
mchung@44729 554
mchung@44729 555 if test "x$OPENJDK_TARGET_CPU" = xx86_64; then
mchung@44729 556 OPENJDK_MODULE_TARGET_OS_ARCH="amd64"
mchung@44729 557 else
mchung@44729 558 OPENJDK_MODULE_TARGET_OS_ARCH="$OPENJDK_TARGET_CPU"
ihse@20363 559 fi
erikj@12801 560
alanb@44985 561 OPENJDK_MODULE_TARGET_PLATFORM="${OPENJDK_MODULE_TARGET_OS_NAME}-${OPENJDK_MODULE_TARGET_OS_ARCH}"
alanb@44985 562 AC_SUBST(OPENJDK_MODULE_TARGET_PLATFORM)
erikj@12801 563 ])
erikj@13132 564
erikj@13132 565 #%%% Build and target systems %%%
erikj@13132 566 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_AND_TARGET],
erikj@13132 567 [
ihse@20363 568 # Figure out the build and target systems. # Note that in autoconf terminology, "build" is obvious, but "target"
ihse@20363 569 # is confusing; it assumes you are cross-compiling a cross-compiler (!) and "target" is thus the target of the
ihse@20363 570 # product you're building. The target of this build is called "host". Since this is confusing to most people, we
ihse@20363 571 # have not adopted that system, but use "target" as the platform we are building for. In some places though we need
ihse@20363 572 # to use the configure naming style.
ihse@20363 573 AC_CANONICAL_BUILD
ihse@20363 574 AC_CANONICAL_HOST
ihse@20363 575 AC_CANONICAL_TARGET
erikj@13132 576
ihse@20363 577 PLATFORM_EXTRACT_TARGET_AND_BUILD
ihse@20363 578 PLATFORM_SETUP_TARGET_CPU_BITS
mchung@44729 579 PLATFORM_SET_MODULE_TARGET_OS_VALUES
alanb@44985 580 PLATFORM_SET_RELEASE_FILE_OS_VALUES
ihse@20363 581 PLATFORM_SETUP_LEGACY_VARS
erikj@13132 582 ])
erikj@13132 583
erikj@13132 584 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_OS_VERSION],
erikj@13132 585 [
ihse@20363 586 ###############################################################################
erikj@13132 587
ihse@20363 588 # Note that this is the build platform OS version!
erikj@13132 589
ihse@20363 590 OS_VERSION="`uname -r | ${SED} 's!\.! !g' | ${SED} 's!-! !g'`"
ihse@20363 591 OS_VERSION_MAJOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 1 -d ' '`"
ihse@20363 592 OS_VERSION_MINOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 2 -d ' '`"
ihse@20363 593 OS_VERSION_MICRO="`${ECHO} ${OS_VERSION} | ${CUT} -f 3 -d ' '`"
ihse@20363 594 AC_SUBST(OS_VERSION_MAJOR)
ihse@20363 595 AC_SUBST(OS_VERSION_MINOR)
ihse@20363 596 AC_SUBST(OS_VERSION_MICRO)
erikj@13132 597 ])
erikj@13132 598
ohair@13697 599 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS],
erikj@13132 600 [
ihse@20363 601 ###############################################################################
ihse@20363 602 #
ihse@20363 603 # Now we check if libjvm.so will use 32 or 64 bit pointers for the C/C++ code.
ihse@20363 604 # (The JVM can use 32 or 64 bit Java pointers but that decision
ihse@20363 605 # is made at runtime.)
ihse@20363 606 #
omajid@16984 607
ihse@20363 608 # Make compilation sanity check
ihse@20363 609 AC_CHECK_HEADERS([stdio.h], , [
ihse@20363 610 AC_MSG_NOTICE([Failed to compile stdio.h. This likely implies missing compile dependencies.])
ihse@20363 611 if test "x$COMPILE_TYPE" = xreduced; then
ihse@32809 612 HELP_MSG_MISSING_DEPENDENCY([reduced])
ihse@32809 613 AC_MSG_NOTICE([You are doing a reduced build. Check that you have 32-bit libraries installed. $HELP_MSG])
ihse@20363 614 elif test "x$COMPILE_TYPE" = xcross; then
ihse@20363 615 AC_MSG_NOTICE([You are doing a cross-compilation. Check that you have all target platform libraries installed.])
ihse@20363 616 fi
ihse@20363 617 AC_MSG_ERROR([Cannot continue.])
ihse@20363 618 ])
ihse@20363 619
ihse@20363 620 AC_CHECK_SIZEOF([int *], [1111])
ihse@20363 621
kvn@22467 622 # AC_CHECK_SIZEOF defines 'ac_cv_sizeof_int_p' to hold the number of bytes used by an 'int*'
kvn@22467 623 if test "x$ac_cv_sizeof_int_p" = x; then
ohair@13697 624 # The test failed, lets stick to the assumed value.
ohair@13697 625 AC_MSG_WARN([The number of bits in the target could not be determined, using $OPENJDK_TARGET_CPU_BITS.])
ihse@20363 626 else
simonis@22466 627 TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p`
erikj@13132 628
ohair@13697 629 if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then
ihse@49121 630 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)])
ihse@49121 631 if test "x$COMPILE_TYPE" = xreduced; then
ihse@49121 632 HELP_MSG_MISSING_DEPENDENCY([reduced])
ihse@49121 633 AC_MSG_NOTICE([You are doing a reduced build. Check that you have 32-bit libraries installed. $HELP_MSG])
ihse@49121 634 elif test "x$COMPILE_TYPE" = xcross; then
ihse@49121 635 AC_MSG_NOTICE([You are doing a cross-compilation. Check that you have all target platform libraries installed.])
kvn@22467 636 fi
ihse@49121 637 AC_MSG_ERROR([Cannot continue.])
erikj@13132 638 fi
ihse@20363 639 fi
erikj@13132 640
ihse@20363 641 AC_MSG_CHECKING([for target address size])
ihse@20363 642 AC_MSG_RESULT([$OPENJDK_TARGET_CPU_BITS bits])
erikj@13132 643 ])
erikj@13132 644
erikj@13132 645 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_ENDIANNESS],
erikj@13132 646 [
ihse@20363 647 ###############################################################################
ihse@20363 648 #
ihse@20363 649 # Is the target little of big endian?
ihse@20363 650 #
ihse@20363 651 AC_C_BIGENDIAN([ENDIAN="big"],[ENDIAN="little"],[ENDIAN="unknown"],[ENDIAN="universal_endianness"])
erikj@13132 652
ihse@20363 653 if test "x$ENDIAN" = xuniversal_endianness; then
erikj@13132 654 AC_MSG_ERROR([Building with both big and little endianness is not supported])
ihse@20363 655 fi
ihse@20363 656 if test "x$ENDIAN" != "x$OPENJDK_TARGET_CPU_ENDIAN"; then
ohair@13697 657 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@20363 658 fi
erikj@13132 659 ])