common/autoconf/platform.m4

Thu, 24 May 2018 17:10:45 +0800

author
aoqi
date
Thu, 24 May 2018 17:10:45 +0800
changeset 1859
8b0588603185
parent 1586
86fa734a1c14
parent 1482
8fb429038513
child 2161
e50b76885c16
permissions
-rw-r--r--

Merge

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

mercurial