common/autoconf/platform.m4

Tue, 18 Sep 2012 11:29:16 -0700

author
ohair
date
Tue, 18 Sep 2012 11:29:16 -0700
changeset 478
2ba6f4da4bf3
parent 458
c8d320b48626
child 494
e64f2cb57d05
permissions
-rw-r--r--

7197849: Update new build-infra makefiles
Reviewed-by: ihse, erikj, ohrstrom, tbell

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

mercurial