common/autoconf/platform.m4

Mon, 29 Jun 2020 21:30:12 +0100

author
andrew
date
Mon, 29 Jun 2020 21:30:12 +0100
changeset 2537
a8da94d779b3
parent 2325
a5b23c21a665
child 2384
b45bf475c2ca
permissions
-rw-r--r--

Merge

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

mercurial