common/autoconf/platform.m4

Thu, 31 Aug 2017 15:40:18 +0800

author
aoqi
date
Thu, 31 Aug 2017 15:40:18 +0800
changeset 1133
50aaf272884f
parent 985
d904a8b799d4
parent 0
75a576e87639
child 1482
8fb429038513
permissions
-rw-r--r--

merge

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

mercurial