common/autoconf/platform.m4

Thu, 10 Oct 2013 14:58:19 +0200

author
ihse
date
Thu, 10 Oct 2013 14:58:19 +0200
changeset 839
174a54ce39c4
parent 798
ac3f5137f84d
child 872
3c48e11c3901
permissions
-rw-r--r--

8001931: The new build system whitespace cleanup
Reviewed-by: tbell, simonis, erikj

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

mercurial