1 #
   2 # Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any
  23 # questions.
  24 #
  25 
  26 # Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD.
  27 # Converts autoconf style CPU name to OpenJDK style, into
  28 # VAR_CPU, VAR_CPU_ARCH, VAR_CPU_BITS and VAR_CPU_ENDIAN.
  29 AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU],
  30 [
  31   echo "LOOKING UP CPU ARCH $1"
  32   # First argument is the cpu name from the trip/quad
  33   case "$1" in
  34     x86_64)
  35       VAR_CPU=x86_64
  36       VAR_CPU_ARCH=x86
  37       VAR_CPU_BITS=64
  38       VAR_CPU_ENDIAN=little
  39       ;;
  40     i?86)
  41       VAR_CPU=x86
  42       VAR_CPU_ARCH=x86
  43       VAR_CPU_BITS=32
  44       VAR_CPU_ENDIAN=little
  45       ;;
  46     alpha*)
  47       VAR_CPU=alpha
  48       VAR_CPU_ARCH=alpha
  49       VAR_CPU_BITS=64
  50       VAR_CPU_ENDIAN=little
  51       ;;
  52     arm*)
  53       VAR_CPU=arm
  54       VAR_CPU_ARCH=arm
  55       VAR_CPU_BITS=32
  56       VAR_CPU_ENDIAN=little
  57       ;;
  58     aarch32)
  59       VAR_CPU=aarch32
  60       VAR_CPU_ARCH=aarch32
  61       VAR_CPU_BITS=32
  62       VAR_CPU_ENDIAN=little
  63       ;;
  64     aarch64)
  65       VAR_CPU=aarch64
  66       VAR_CPU_ARCH=aarch64
  67       VAR_CPU_BITS=64
  68       VAR_CPU_ENDIAN=little
  69       ;;
  70     ia64)
  71       VAR_CPU=ia64
  72       VAR_CPU_ARCH=ia64
  73       VAR_CPU_BITS=64
  74       VAR_CPU_ENDIAN=little
  75       ;;
  76     m68k)
  77       VAR_CPU=m68k
  78       VAR_CPU_ARCH=m68k
  79       VAR_CPU_BITS=32
  80       VAR_CPU_ENDIAN=big
  81       ;;
  82     mips)
  83       VAR_CPU=mips
  84       VAR_CPU_ARCH=mips
  85       VAR_CPU_BITS=32
  86       VAR_CPU_ENDIAN=big
  87       ;;
  88     mipsel)
  89       VAR_CPU=mipsel
  90       VAR_CPU_ARCH=mipsel
  91       VAR_CPU_BITS=32
  92       VAR_CPU_ENDIAN=little
  93       ;;
  94     mips64)
  95       VAR_CPU=mips64
  96       VAR_CPU_ARCH=mips64
  97       VAR_CPU_BITS=64
  98       VAR_CPU_ENDIAN=big
  99       ;;
 100     mips64el)
 101       VAR_CPU=mips64el
 102       VAR_CPU_ARCH=mips64el
 103       VAR_CPU_BITS=64
 104       VAR_CPU_ENDIAN=little
 105       ;;
 106     powerpc)
 107       VAR_CPU=ppc
 108       VAR_CPU_ARCH=ppc
 109       VAR_CPU_BITS=32
 110       VAR_CPU_ENDIAN=big
 111       ;;
 112     powerpc64)
 113       VAR_CPU=ppc64
 114       VAR_CPU_ARCH=ppc
 115       VAR_CPU_BITS=64
 116       VAR_CPU_ENDIAN=big
 117       ;;
 118     powerpc64le)
 119       VAR_CPU=ppc64le
 120       VAR_CPU_ARCH=ppc
 121       VAR_CPU_BITS=64
 122       VAR_CPU_ENDIAN=little
 123       ;;
 124     s390)
 125       VAR_CPU=s390
 126       VAR_CPU_ARCH=s390
 127       VAR_CPU_BITS=32
 128       VAR_CPU_ENDIAN=big
 129       ;;
 130     s390x)
 131       VAR_CPU=s390x
 132       VAR_CPU_ARCH=s390
 133       VAR_CPU_BITS=64
 134       VAR_CPU_ENDIAN=big
 135       ;;
 136     sh*eb)
 137       VAR_CPU=sh
 138       VAR_CPU_ARCH=sh
 139       VAR_CPU_BITS=32
 140       VAR_CPU_ENDIAN=big
 141       ;;
 142     sh*)
 143       VAR_CPU=sh
 144       VAR_CPU_ARCH=sh
 145       VAR_CPU_BITS=32
 146       VAR_CPU_ENDIAN=little
 147       ;;
 148     sparc)
 149       VAR_CPU=sparc
 150       VAR_CPU_ARCH=sparc
 151       VAR_CPU_BITS=32
 152       VAR_CPU_ENDIAN=big
 153       ;;
 154     sparcv9|sparc64)
 155       VAR_CPU=sparcv9
 156       VAR_CPU_ARCH=sparc
 157       VAR_CPU_BITS=64
 158       VAR_CPU_ENDIAN=big
 159       ;;
 160     *)
 161       AC_MSG_ERROR([unsupported cpu $1])
 162       ;;
 163   esac
 164 ])
 165 
 166 # Support macro for PLATFORM_EXTRACT_TARGET_AND_BUILD.
 167 # Converts autoconf style OS name to OpenJDK style, into
 168 # VAR_OS, VAR_OS_TYPE and VAR_OS_ENV.
 169 AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_OS],
 170 [
 171   case "$1" in
 172     *linux*)
 173       VAR_OS=linux
 174       VAR_OS_TYPE=unix
 175       ;;
 176     *solaris*)
 177       VAR_OS=solaris
 178       VAR_OS_TYPE=unix
 179       ;;
 180     *darwin*)
 181       VAR_OS=macosx
 182       VAR_OS_TYPE=unix
 183       ;;
 184     *bsd*)
 185       VAR_OS=bsd
 186       VAR_OS_TYPE=unix
 187       ;;
 188     *cygwin*)
 189       VAR_OS=windows
 190       VAR_OS_ENV=windows.cygwin
 191       ;;
 192     *mingw*)
 193       VAR_OS=windows
 194       VAR_OS_ENV=windows.msys
 195       ;;
 196     *aix*)
 197       VAR_OS=aix
 198       VAR_OS_TYPE=unix
 199       ;;
 200     *)
 201       AC_MSG_ERROR([unsupported operating system $1])
 202       ;;
 203   esac
 204 ])
 205 
 206 # Expects $host_os $host_cpu $build_os and $build_cpu
 207 # and $with_target_bits to have been setup!
 208 #
 209 # Translate the standard triplet(quadruplet) definition
 210 # of the target/build system into OPENJDK_TARGET_OS, OPENJDK_TARGET_CPU,
 211 # OPENJDK_BUILD_OS, etc.
 212 AC_DEFUN([PLATFORM_EXTRACT_TARGET_AND_BUILD],
 213 [
 214   # Copy the autoconf trip/quadruplet verbatim to OPENJDK_TARGET_AUTOCONF_NAME
 215   # (from the autoconf "host") and OPENJDK_BUILD_AUTOCONF_NAME
 216   # Note that we might later on rewrite e.g. OPENJDK_TARGET_CPU due to reduced build,
 217   # but this will not change the value of OPENJDK_TARGET_AUTOCONF_NAME.
 218   OPENJDK_TARGET_AUTOCONF_NAME="$host"
 219   OPENJDK_BUILD_AUTOCONF_NAME="$build"
 220   AC_SUBST(OPENJDK_TARGET_AUTOCONF_NAME)
 221   AC_SUBST(OPENJDK_BUILD_AUTOCONF_NAME)
 222 
 223   # Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables.
 224   PLATFORM_EXTRACT_VARS_FROM_OS($build_os)
 225   PLATFORM_EXTRACT_VARS_FROM_CPU($build_cpu)
 226   # ..and setup our own variables. (Do this explicitly to facilitate searching)
 227   OPENJDK_BUILD_OS="$VAR_OS"
 228   if test "x$VAR_OS_TYPE" != x; then
 229     OPENJDK_BUILD_OS_TYPE="$VAR_OS_TYPE"
 230   else
 231     OPENJDK_BUILD_OS_TYPE="$VAR_OS"
 232   fi
 233   if test "x$VAR_OS_ENV" != x; then
 234     OPENJDK_BUILD_OS_ENV="$VAR_OS_ENV"
 235   else
 236     OPENJDK_BUILD_OS_ENV="$VAR_OS"
 237   fi
 238   OPENJDK_BUILD_CPU="$VAR_CPU"
 239   OPENJDK_BUILD_CPU_ARCH="$VAR_CPU_ARCH"
 240   OPENJDK_BUILD_CPU_BITS="$VAR_CPU_BITS"
 241   OPENJDK_BUILD_CPU_ENDIAN="$VAR_CPU_ENDIAN"
 242   AC_SUBST(OPENJDK_BUILD_OS)
 243   AC_SUBST(OPENJDK_BUILD_OS_TYPE)
 244   AC_SUBST(OPENJDK_BUILD_OS_ENV)
 245   AC_SUBST(OPENJDK_BUILD_CPU)
 246   AC_SUBST(OPENJDK_BUILD_CPU_ARCH)
 247   AC_SUBST(OPENJDK_BUILD_CPU_BITS)
 248   AC_SUBST(OPENJDK_BUILD_CPU_ENDIAN)
 249 
 250   AC_MSG_CHECKING([openjdk-build os-cpu])
 251   AC_MSG_RESULT([$OPENJDK_BUILD_OS-$OPENJDK_BUILD_CPU])
 252 
 253   # Convert the autoconf OS/CPU value to our own data, into the VAR_OS/CPU variables.
 254   PLATFORM_EXTRACT_VARS_FROM_OS($host_os)
 255   PLATFORM_EXTRACT_VARS_FROM_CPU($host_cpu)
 256   # ... and setup our own variables. (Do this explicitly to facilitate searching)
 257   OPENJDK_TARGET_OS="$VAR_OS"
 258   if test "x$VAR_OS_TYPE" != x; then
 259     OPENJDK_TARGET_OS_TYPE="$VAR_OS_TYPE"
 260   else
 261     OPENJDK_TARGET_OS_TYPE="$VAR_OS"
 262   fi
 263   if test "x$VAR_OS_ENV" != x; then
 264     OPENJDK_TARGET_OS_ENV="$VAR_OS_ENV"
 265   else
 266     OPENJDK_TARGET_OS_ENV="$VAR_OS"
 267   fi
 268   OPENJDK_TARGET_CPU="$VAR_CPU"
 269   OPENJDK_TARGET_CPU_ARCH="$VAR_CPU_ARCH"
 270   OPENJDK_TARGET_CPU_BITS="$VAR_CPU_BITS"
 271   OPENJDK_TARGET_CPU_ENDIAN="$VAR_CPU_ENDIAN"
 272   OPENJDK_TARGET_OS_UPPERCASE=`$ECHO $OPENJDK_TARGET_OS | $TR 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
 273 
 274   AC_SUBST(OPENJDK_TARGET_OS)
 275   AC_SUBST(OPENJDK_TARGET_OS_TYPE)
 276   AC_SUBST(OPENJDK_TARGET_OS_ENV)
 277   AC_SUBST(OPENJDK_TARGET_OS_UPPERCASE)
 278   AC_SUBST(OPENJDK_TARGET_CPU)
 279   AC_SUBST(OPENJDK_TARGET_CPU_ARCH)
 280   AC_SUBST(OPENJDK_TARGET_CPU_BITS)
 281   AC_SUBST(OPENJDK_TARGET_CPU_ENDIAN)
 282 
 283   AC_MSG_CHECKING([openjdk-target os-cpu])
 284   AC_MSG_RESULT([$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU])
 285 ])
 286 
 287 # Check if a reduced build (32-bit on 64-bit platforms) is requested, and modify behaviour
 288 # accordingly. Must be done after setting up build and target system, but before
 289 # doing anything else with these values.
 290 AC_DEFUN([PLATFORM_SETUP_TARGET_CPU_BITS],
 291 [
 292   AC_ARG_WITH(target-bits, [AS_HELP_STRING([--with-target-bits],
 293        [build 32-bit or 64-bit binaries (for platforms that support it), e.g. --with-target-bits=32 @<:@guessed@:>@])])
 294 
 295   # We have three types of compiles:
 296   # native  == normal compilation, target system == build system
 297   # cross   == traditional cross compilation, target system != build system; special toolchain needed
 298   # reduced == using native compilers, but with special flags (e.g. -m32) to produce 32-bit builds on 64-bit machines
 299   #
 300   if test "x$OPENJDK_BUILD_AUTOCONF_NAME" != "x$OPENJDK_TARGET_AUTOCONF_NAME"; then
 301     # We're doing a proper cross-compilation
 302     COMPILE_TYPE="cross"
 303   else
 304     COMPILE_TYPE="native"
 305   fi
 306 
 307   if test "x$with_target_bits" != x; then
 308     if test "x$COMPILE_TYPE" = "xcross"; then
 309       AC_MSG_ERROR([It is not possible to combine --with-target-bits=X and proper cross-compilation. Choose either.])
 310     fi
 311 
 312     if test "x$with_target_bits" = x32 && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
 313       # A reduced build is requested
 314       COMPILE_TYPE="reduced"
 315       OPENJDK_TARGET_CPU_BITS=32
 316       if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86"; then
 317         OPENJDK_TARGET_CPU=x86
 318       elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then
 319         OPENJDK_TARGET_CPU=sparc
 320       else
 321         AC_MSG_ERROR([Reduced build (--with-target-bits=32) is only supported on x86_64 and sparcv9])
 322       fi
 323     elif test "x$with_target_bits" = x64 && test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
 324       AC_MSG_ERROR([It is not possible to use --with-target-bits=64 on a 32 bit system. Use proper cross-compilation instead.])
 325     elif test "x$with_target_bits" = "x$OPENJDK_TARGET_CPU_BITS"; then
 326       AC_MSG_NOTICE([--with-target-bits are set to build platform address size; argument has no meaning])
 327     else
 328       AC_MSG_ERROR([--with-target-bits can only be 32 or 64, you specified $with_target_bits!])
 329     fi
 330   fi
 331   AC_SUBST(COMPILE_TYPE)
 332 
 333   AC_MSG_CHECKING([compilation type])
 334   AC_MSG_RESULT([$COMPILE_TYPE])
 335 ])
 336 
 337 # Setup the legacy variables, for controlling the old makefiles.
 338 #
 339 AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS],
 340 [
 341   PLATFORM_SETUP_LEGACY_VARS_HELPER([TARGET])
 342   PLATFORM_SETUP_LEGACY_VARS_HELPER([BUILD])
 343 ])
 344 
 345 # $1 - Either TARGET or BUILD to setup the variables for.
 346 AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS_HELPER],
 347 [
 348   # Also store the legacy naming of the cpu.
 349   # Ie i586 and amd64 instead of x86 and x86_64
 350   OPENJDK_$1_CPU_LEGACY="$OPENJDK_$1_CPU"
 351   if test "x$OPENJDK_$1_CPU" = xx86; then
 352     OPENJDK_$1_CPU_LEGACY="i586"
 353   elif test "x$OPENJDK_$1_OS" != xmacosx && test "x$OPENJDK_$1_CPU" = xx86_64; then
 354     # On all platforms except MacOSX replace x86_64 with amd64.
 355     OPENJDK_$1_CPU_LEGACY="amd64"
 356   elif test "x$OPENJDK_$1_CPU" = xalpha; then
 357     # Avoid name collisions with variables named alpha
 358     OPENJDK_$1_CPU_LEGACY="_alpha_"
 359   elif test "x$OPENJDK_$1_CPU" = xsh; then
 360     # Avoid name collisions with variables named sh
 361     OPENJDK_$1_CPU_LEGACY="_sh_"
 362   fi
 363   AC_SUBST(OPENJDK_$1_CPU_LEGACY)
 364 
 365   # And the second legacy naming of the cpu.
 366   # Ie i386 and amd64 instead of x86 and x86_64.
 367   OPENJDK_$1_CPU_LEGACY_LIB="$OPENJDK_$1_CPU"
 368   if test "x$OPENJDK_$1_CPU" = xx86; then
 369     OPENJDK_$1_CPU_LEGACY_LIB="i386"
 370   elif test "x$OPENJDK_$1_CPU" = xx86_64; then
 371     OPENJDK_$1_CPU_LEGACY_LIB="amd64"
 372   fi
 373   AC_SUBST(OPENJDK_$1_CPU_LEGACY_LIB)
 374 
 375   # OPENJDK_$1_CPU_ISADIR is normally empty. On 64-bit Solaris systems, it is set to
 376   # /amd64 or /sparcv9. This string is appended to some library paths, like this:
 377   # /usr/lib${OPENJDK_$1_CPU_ISADIR}/libexample.so
 378   OPENJDK_$1_CPU_ISADIR=""
 379   if test "x$OPENJDK_$1_OS" = xsolaris; then
 380     if test "x$OPENJDK_$1_CPU" = xx86_64; then
 381       OPENJDK_$1_CPU_ISADIR="/amd64"
 382     elif test "x$OPENJDK_$1_CPU" = xsparcv9; then
 383       OPENJDK_$1_CPU_ISADIR="/sparcv9"
 384     fi
 385   fi
 386   AC_SUBST(OPENJDK_$1_CPU_ISADIR)
 387 
 388   # Setup OPENJDK_$1_CPU_OSARCH, which is used to set the os.arch Java system property
 389   OPENJDK_$1_CPU_OSARCH="$OPENJDK_$1_CPU"
 390   if test "x$OPENJDK_$1_OS" = xlinux && test "x$OPENJDK_$1_CPU" = xx86; then
 391     # On linux only, we replace x86 with i386.
 392     OPENJDK_$1_CPU_OSARCH="i386"
 393   elif test "x$OPENJDK_$1_OS" != xmacosx && test "x$OPENJDK_$1_CPU" = xx86_64; then
 394     # On all platforms except macosx, we replace x86_64 with amd64.
 395     OPENJDK_$1_CPU_OSARCH="amd64"
 396   elif test "x$OPENJDK_$1_CPU" = xaarch32; then
 397     OPENJDK_$1_CPU_OSARCH="arm"
 398   fi
 399   AC_SUBST(OPENJDK_$1_CPU_OSARCH)
 400 
 401   OPENJDK_$1_CPU_JLI="$OPENJDK_$1_CPU"
 402   if test "x$OPENJDK_$1_CPU" = xx86; then
 403     OPENJDK_$1_CPU_JLI="i386"
 404   elif test "x$OPENJDK_$1_OS" != xmacosx && test "x$OPENJDK_$1_CPU" = xx86_64; then
 405     # On all platforms except macosx, we replace x86_64 with amd64.
 406     OPENJDK_$1_CPU_JLI="amd64"
 407   fi
 408 
 409   # The new version string in JDK 9 also defined new naming of OS and ARCH for bundles
 410   # Macosx is osx and x86_64 is x64
 411   if test "x$OPENJDK_$1_OS" = xmacosx; then
 412     OPENJDK_$1_OS_BUNDLE="osx"
 413   else
 414     OPENJDK_$1_OS_BUNDLE="$OPENJDK_TARGET_OS"
 415   fi
 416   if test "x$OPENJDK_$1_CPU" = xx86_64; then
 417     OPENJDK_$1_CPU_BUNDLE="x64"
 418   else
 419     OPENJDK_$1_CPU_BUNDLE="$OPENJDK_$1_CPU"
 420   fi
 421   OPENJDK_$1_BUNDLE_PLATFORM="${OPENJDK_$1_OS_BUNDLE}-${OPENJDK_$1_CPU_BUNDLE}"
 422   AC_SUBST(OPENJDK_$1_BUNDLE_PLATFORM)
 423 
 424   if test "x$COMPILE_TYPE" = "xcross"; then
 425     # FIXME: ... or should this include reduced builds..?
 426     DEFINE_CROSS_COMPILE_ARCH="CROSS_COMPILE_ARCH:=$OPENJDK_$1_CPU_LEGACY"
 427   else
 428     DEFINE_CROSS_COMPILE_ARCH=""
 429   fi
 430   AC_SUBST(DEFINE_CROSS_COMPILE_ARCH)
 431 
 432   # Convert openjdk platform names to hotspot names
 433 
 434   HOTSPOT_$1_OS=${OPENJDK_$1_OS}
 435   if test "x$OPENJDK_$1_OS" = xmacosx; then
 436     HOTSPOT_$1_OS=bsd
 437   fi
 438   AC_SUBST(HOTSPOT_$1_OS)
 439 
 440   HOTSPOT_$1_OS_TYPE=${OPENJDK_$1_OS_TYPE}
 441   if test "x$OPENJDK_$1_OS_TYPE" = xunix; then
 442     HOTSPOT_$1_OS_TYPE=posix
 443   fi
 444   AC_SUBST(HOTSPOT_$1_OS_TYPE)
 445 
 446   HOTSPOT_$1_CPU=${OPENJDK_$1_CPU}
 447   if test "x$OPENJDK_$1_CPU" = xx86; then
 448     HOTSPOT_$1_CPU=x86_32
 449   elif test "x$OPENJDK_$1_CPU" = xsparcv9; then
 450     HOTSPOT_$1_CPU=sparc
 451   elif test "x$OPENJDK_$1_CPU" = xppc64; then
 452     HOTSPOT_$1_CPU=ppc_64
 453   elif test "x$OPENJDK_$1_CPU" = xppc64le; then
 454     HOTSPOT_$1_CPU=ppc_64
 455   fi
 456   AC_SUBST(HOTSPOT_$1_CPU)
 457 
 458   # This is identical with OPENJDK_*, but define anyway for consistency.
 459   HOTSPOT_$1_CPU_ARCH=${OPENJDK_$1_CPU_ARCH}
 460   AC_SUBST(HOTSPOT_$1_CPU_ARCH)
 461 
 462   # Setup HOTSPOT_$1_CPU_DEFINE
 463   if test "x$OPENJDK_$1_CPU" = xx86; then
 464     HOTSPOT_$1_CPU_DEFINE=IA32
 465   elif test "x$OPENJDK_$1_CPU" = xx86_64; then
 466     HOTSPOT_$1_CPU_DEFINE=AMD64
 467   elif test "x$OPENJDK_$1_CPU" = xsparcv9; then
 468     HOTSPOT_$1_CPU_DEFINE=SPARC
 469   elif test "x$OPENJDK_$1_CPU" = xaarch64; then
 470     HOTSPOT_$1_CPU_DEFINE=AARCH64
 471   elif test "x$OPENJDK_$1_CPU" = xppc64; then
 472     HOTSPOT_$1_CPU_DEFINE=PPC64
 473   elif test "x$OPENJDK_$1_CPU" = xppc64le; then
 474     HOTSPOT_$1_CPU_DEFINE=PPC64
 475 
 476   # The cpu defines below are for zero, we don't support them directly.
 477   elif test "x$OPENJDK_$1_CPU" = xsparc; then
 478     HOTSPOT_$1_CPU_DEFINE=SPARC
 479   elif test "x$OPENJDK_$1_CPU" = xppc; then
 480     HOTSPOT_$1_CPU_DEFINE=PPC32
 481   elif test "x$OPENJDK_$1_CPU" = xs390; then
 482     HOTSPOT_$1_CPU_DEFINE=S390
 483   elif test "x$OPENJDK_$1_CPU" = xs390x; then
 484     HOTSPOT_$1_CPU_DEFINE=S390
 485   elif test "x$OPENJDK_$1_CPU" != x; then
 486     HOTSPOT_$1_CPU_DEFINE=$(echo $OPENJDK_$1_CPU | tr a-z A-Z)
 487   fi
 488   AC_SUBST(HOTSPOT_$1_CPU_DEFINE)
 489 
 490   # For historical reasons, the OS include directories have odd names.
 491   OPENJDK_$1_OS_INCLUDE_SUBDIR="$OPENJDK_TARGET_OS"
 492   if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
 493     OPENJDK_$1_OS_INCLUDE_SUBDIR="win32"
 494   elif test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
 495     OPENJDK_$1_OS_INCLUDE_SUBDIR="darwin"
 496   fi
 497   AC_SUBST(OPENJDK_$1_OS_INCLUDE_SUBDIR)
 498 ])
 499 
 500 AC_DEFUN([PLATFORM_SET_RELEASE_FILE_OS_VALUES],
 501 [
 502   if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
 503     RELEASE_FILE_OS_NAME=SunOS
 504   fi
 505   if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
 506     RELEASE_FILE_OS_NAME=Linux
 507   fi
 508   if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
 509     RELEASE_FILE_OS_NAME=Windows
 510   fi
 511   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
 512     RELEASE_FILE_OS_NAME="Darwin"
 513   fi
 514   if test "x$OPENJDK_TARGET_OS" = "xaix"; then
 515     RELEASE_FILE_OS_NAME="AIX"
 516   fi
 517   RELEASE_FILE_OS_ARCH=${OPENJDK_TARGET_CPU}
 518 
 519   AC_SUBST(RELEASE_FILE_OS_NAME)
 520   AC_SUBST(RELEASE_FILE_OS_ARCH)
 521 ])
 522 
 523 AC_DEFUN([PLATFORM_SET_MODULE_TARGET_OS_VALUES],
 524 [
 525   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
 526     OPENJDK_MODULE_TARGET_OS_NAME="macos"
 527   else
 528     OPENJDK_MODULE_TARGET_OS_NAME="$OPENJDK_TARGET_OS"
 529   fi
 530 
 531   if test "x$OPENJDK_TARGET_CPU" = xx86_64; then
 532     OPENJDK_MODULE_TARGET_OS_ARCH="amd64"
 533   else
 534     OPENJDK_MODULE_TARGET_OS_ARCH="$OPENJDK_TARGET_CPU"
 535   fi
 536 
 537   OPENJDK_MODULE_TARGET_PLATFORM="${OPENJDK_MODULE_TARGET_OS_NAME}-${OPENJDK_MODULE_TARGET_OS_ARCH}"
 538   AC_SUBST(OPENJDK_MODULE_TARGET_PLATFORM)
 539 ])
 540 
 541 #%%% Build and target systems %%%
 542 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_AND_TARGET],
 543 [
 544   # Figure out the build and target systems. # Note that in autoconf terminology, "build" is obvious, but "target"
 545   # is confusing; it assumes you are cross-compiling a cross-compiler (!)  and "target" is thus the target of the
 546   # product you're building. The target of this build is called "host". Since this is confusing to most people, we
 547   # have not adopted that system, but use "target" as the platform we are building for. In some places though we need
 548   # to use the configure naming style.
 549   AC_CANONICAL_BUILD
 550   AC_CANONICAL_HOST
 551   AC_CANONICAL_TARGET
 552 
 553   PLATFORM_EXTRACT_TARGET_AND_BUILD
 554   PLATFORM_SETUP_TARGET_CPU_BITS
 555   PLATFORM_SET_MODULE_TARGET_OS_VALUES
 556   PLATFORM_SET_RELEASE_FILE_OS_VALUES
 557   PLATFORM_SETUP_LEGACY_VARS
 558 ])
 559 
 560 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_OS_VERSION],
 561 [
 562   ###############################################################################
 563 
 564   # Note that this is the build platform OS version!
 565 
 566   OS_VERSION="`uname -r | ${SED} 's!\.! !g' | ${SED} 's!-! !g'`"
 567   OS_VERSION_MAJOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 1 -d ' '`"
 568   OS_VERSION_MINOR="`${ECHO} ${OS_VERSION} | ${CUT} -f 2 -d ' '`"
 569   OS_VERSION_MICRO="`${ECHO} ${OS_VERSION} | ${CUT} -f 3 -d ' '`"
 570   AC_SUBST(OS_VERSION_MAJOR)
 571   AC_SUBST(OS_VERSION_MINOR)
 572   AC_SUBST(OS_VERSION_MICRO)
 573 ])
 574 
 575 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS],
 576 [
 577   ###############################################################################
 578   #
 579   # Now we check if libjvm.so will use 32 or 64 bit pointers for the C/C++ code.
 580   # (The JVM can use 32 or 64 bit Java pointers but that decision
 581   # is made at runtime.)
 582   #
 583 
 584   # Make compilation sanity check
 585   AC_CHECK_HEADERS([stdio.h], , [
 586     AC_MSG_NOTICE([Failed to compile stdio.h. This likely implies missing compile dependencies.])
 587     if test "x$COMPILE_TYPE" = xreduced; then
 588       HELP_MSG_MISSING_DEPENDENCY([reduced])
 589       AC_MSG_NOTICE([You are doing a reduced build. Check that you have 32-bit libraries installed. $HELP_MSG])
 590     elif test "x$COMPILE_TYPE" = xcross; then
 591       AC_MSG_NOTICE([You are doing a cross-compilation. Check that you have all target platform libraries installed.])
 592     fi
 593     AC_MSG_ERROR([Cannot continue.])
 594   ])
 595 
 596   AC_CHECK_SIZEOF([int *], [1111])
 597 
 598   # AC_CHECK_SIZEOF defines 'ac_cv_sizeof_int_p' to hold the number of bytes used by an 'int*'
 599   if test "x$ac_cv_sizeof_int_p" = x; then
 600     # The test failed, lets stick to the assumed value.
 601     AC_MSG_WARN([The number of bits in the target could not be determined, using $OPENJDK_TARGET_CPU_BITS.])
 602   else
 603     TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p`
 604 
 605     if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then
 606       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)])
 607       if test "x$COMPILE_TYPE" = xreduced; then
 608         HELP_MSG_MISSING_DEPENDENCY([reduced])
 609         AC_MSG_NOTICE([You are doing a reduced build. Check that you have 32-bit libraries installed. $HELP_MSG])
 610       elif test "x$COMPILE_TYPE" = xcross; then
 611         AC_MSG_NOTICE([You are doing a cross-compilation. Check that you have all target platform libraries installed.])
 612       fi
 613       AC_MSG_ERROR([Cannot continue.])
 614     fi
 615   fi
 616 
 617   AC_MSG_CHECKING([for target address size])
 618   AC_MSG_RESULT([$OPENJDK_TARGET_CPU_BITS bits])
 619 ])
 620 
 621 AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_ENDIANNESS],
 622 [
 623   ###############################################################################
 624   #
 625   # Is the target little of big endian?
 626   #
 627   AC_C_BIGENDIAN([ENDIAN="big"],[ENDIAN="little"],[ENDIAN="unknown"],[ENDIAN="universal_endianness"])
 628 
 629   if test "x$ENDIAN" = xuniversal_endianness; then
 630     AC_MSG_ERROR([Building with both big and little endianness is not supported])
 631   fi
 632   if test "x$ENDIAN" != "x$OPENJDK_TARGET_CPU_ENDIAN"; then
 633     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)])
 634   fi
 635 ])