common/autoconf/boot-jdk.m4
author alexsch
Tue, 22 Jul 2014 13:23:01 +0400
changeset 25793 56060390dd25
parent 24304 f51622799778
child 25854 98ce0879ab4c
permissions -rw-r--r--
8030051: Check class loaders usage in Swing classes Reviewed-by: serb, pchelko
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     1
#
22477
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
     2
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     4
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    10
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    15
# accompanied this code).
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    16
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    20
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    23
# questions.
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    24
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    25
22477
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
    26
########################################################################
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
    27
# This file handles detection of the Boot JDK. The Boot JDK detection 
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
    28
# process has been developed as a response to solve a complex real-world 
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
    29
# problem. Initially, it was simple, but it has grown as platform after 
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
    30
# platform, idiosyncracy after idiosyncracy has been supported.
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
    31
#
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
    32
# The basic idea is this:
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
    33
# 1) You need an acceptable *) JDK to use as a Boot JDK
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
    34
# 2) There are several ways to locate a JDK, that are mostly platform 
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
    35
#    dependent **)
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
    36
# 3) You can have multiple JDKs installed
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
    37
# 4) If possible, configure should try to dig out an acceptable JDK 
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
    38
#    automatically, without having to resort to command-line options
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
    39
#
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
    40
# *)  acceptable means e.g. JDK7 for building JDK8, a complete JDK (with 
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
    41
#     javac) and not a JRE, etc. 
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
    42
#
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
    43
# **) On Windows we typically use a well-known path. 
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
    44
#     On MacOSX we typically use the tool java_home.
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
    45
#     On Linux we typically find javac in the $PATH, and then follow a 
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
    46
#     chain of symlinks that often ends up in a real JDK. 
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
    47
#
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
    48
# This leads to the code where we check in different ways to locate a 
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
    49
# JDK, and if one is found, check if it is acceptable. If not, we print 
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
    50
# our reasons for rejecting it (useful when debugging non-working 
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
    51
# configure situations) and continue checking the next one. 
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
    52
########################################################################
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
    53
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    54
# Execute the check given as argument, and verify the result
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    55
# If the Boot JDK was previously found, do nothing
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    56
# $1 A command line (typically autoconf macro) to execute
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    57
AC_DEFUN([BOOTJDK_DO_CHECK],
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
    58
[
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    59
  if test "x$BOOT_JDK_FOUND" = xno; then
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    60
    # Now execute the test
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    61
    $1
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    62
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    63
    # If previous step claimed to have found a JDK, check it to see if it seems to be valid.
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    64
    if test "x$BOOT_JDK_FOUND" = xmaybe; then
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    65
      # Do we have a bin/java?
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    66
      if test ! -x "$BOOT_JDK/bin/java"; then
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    67
        AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    68
        BOOT_JDK_FOUND=no
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    69
      else
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    70
        # Do we have a bin/javac?
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    71
        if test ! -x "$BOOT_JDK/bin/javac"; then
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    72
          AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    73
          AC_MSG_NOTICE([(This might be an JRE instead of an JDK)])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    74
          BOOT_JDK_FOUND=no
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
    75
        else
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    76
          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    77
          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    78
            AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    79
            BOOT_JDK_FOUND=no
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    80
          else
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    81
            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    82
            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    83
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    84
            # Extra M4 quote needed to protect [] in grep expression.
23982
12e7bb480a6b 8030794: Update configure to require jdk8 as boot
erikj
parents: 23171
diff changeset
    85
            [FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`]
22477
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
    86
            if test "x$FOUND_CORRECT_VERSION" = x; then
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    87
              AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring])
23982
12e7bb480a6b 8030794: Update configure to require jdk8 as boot
erikj
parents: 23171
diff changeset
    88
              AC_MSG_NOTICE([(Your Boot JDK must be version 8 or 9)])
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    89
              BOOT_JDK_FOUND=no
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    90
            else
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    91
              # We're done! :-)
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    92
              BOOT_JDK_FOUND=yes
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    93
              BASIC_FIXUP_PATH(BOOT_JDK)
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    94
              AC_MSG_CHECKING([for Boot JDK])
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    95
              AC_MSG_RESULT([$BOOT_JDK])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    96
              AC_MSG_CHECKING([Boot JDK version])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    97
              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    98
              AC_MSG_RESULT([$BOOT_JDK_VERSION])
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
    99
            fi # end check jdk version
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   100
          fi # end check rt.jar
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   101
        fi # end check javac
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   102
      fi # end check java
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   103
    fi # end check boot jdk found
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   104
  fi
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   105
])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   106
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   107
# Test: Is bootjdk explicitely set by command line arguments?
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   108
AC_DEFUN([BOOTJDK_CHECK_ARGUMENTS],
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   109
[
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   110
  if test "x$with_boot_jdk" != x; then
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   111
    BOOT_JDK=$with_boot_jdk
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   112
    BOOT_JDK_FOUND=maybe
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   113
    AC_MSG_NOTICE([Found potential Boot JDK using configure arguments])
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   114
  fi
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   115
])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   116
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   117
# Test: Is bootjdk available from builddeps?
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   118
AC_DEFUN([BOOTJDK_CHECK_BUILDDEPS],
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   119
[
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   120
  BDEPS_CHECK_MODULE(BOOT_JDK, bootjdk, xxx, [BOOT_JDK_FOUND=maybe], [BOOT_JDK_FOUND=no])
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   121
])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   122
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   123
# Test: Is $JAVA_HOME set?
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   124
AC_DEFUN([BOOTJDK_CHECK_JAVA_HOME],
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   125
[
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   126
  if test "x$JAVA_HOME" != x; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   127
    JAVA_HOME_PROCESSED="$JAVA_HOME"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   128
    BASIC_FIXUP_PATH(JAVA_HOME_PROCESSED)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   129
    if test ! -d "$JAVA_HOME_PROCESSED"; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   130
      AC_MSG_NOTICE([Your JAVA_HOME points to a non-existing directory!])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   131
    else
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   132
      # Aha, the user has set a JAVA_HOME
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   133
      # let us use that as the Boot JDK.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   134
      BOOT_JDK="$JAVA_HOME_PROCESSED"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   135
      BOOT_JDK_FOUND=maybe
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   136
      AC_MSG_NOTICE([Found potential Boot JDK using JAVA_HOME])
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   137
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   138
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   139
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   140
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   141
# Test: Is there a java or javac in the PATH, which is a symlink to the JDK?
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   142
AC_DEFUN([BOOTJDK_CHECK_JAVA_IN_PATH_IS_SYMLINK],
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   143
[
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   144
  AC_PATH_PROG(JAVAC_CHECK, javac)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   145
  AC_PATH_PROG(JAVA_CHECK, java)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   146
  BINARY="$JAVAC_CHECK"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   147
  if test "x$JAVAC_CHECK" = x; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   148
    BINARY="$JAVA_CHECK"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   149
  fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   150
  if test "x$BINARY" != x; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   151
    # So there is a java(c) binary, it might be part of a JDK.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   152
    # Lets find the JDK/JRE directory by following symbolic links.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   153
    # Linux/GNU systems often have links from /usr/bin/java to
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   154
    # /etc/alternatives/java to the real JDK binary.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   155
    BASIC_REMOVE_SYMBOLIC_LINKS(BINARY)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   156
    BOOT_JDK=`dirname "$BINARY"`
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   157
    BOOT_JDK=`cd "$BOOT_JDK/.."; pwd`
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   158
    if test -x "$BOOT_JDK/bin/javac" && test -x "$BOOT_JDK/bin/java"; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   159
      # Looks like we found ourselves an JDK
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   160
      BOOT_JDK_FOUND=maybe
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   161
      AC_MSG_NOTICE([Found potential Boot JDK using java(c) in PATH])
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   162
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   163
  fi
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   164
])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   165
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   166
# Test: Is there a /usr/libexec/java_home? (Typically on MacOSX)
22477
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   167
# $1: Argument to the java_home binary (optional)
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   168
AC_DEFUN([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME],
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   169
[
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   170
  if test -x /usr/libexec/java_home; then
22477
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   171
    BOOT_JDK=`/usr/libexec/java_home $1`
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   172
    BOOT_JDK_FOUND=maybe
22477
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   173
    AC_MSG_NOTICE([Found potential Boot JDK using /usr/libexec/java_home $1])
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   174
  fi
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   175
])
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   176
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   177
# Test: On MacOS X, can we find a boot jdk using /usr/libexec/java_home?
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   178
AC_DEFUN([BOOTJDK_CHECK_MACOSX_JAVA_LOCATOR],
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   179
[
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   180
  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   181
    # First check at user selected default
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   182
    BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME()])
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   183
    # If that did not work out (e.g. too old), try explicit versions instead
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   184
    BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME([-v 1.9])])
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   185
    BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME([-v 1.8])])
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   186
    BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME([-v 1.7])])
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   187
  fi
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   188
])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   189
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   190
# Look for a jdk in the given path. If there are multiple, try to select the newest.
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   191
# If found, set BOOT_JDK and BOOT_JDK_FOUND.
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   192
# $1 = Path to directory containing jdk installations.
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   193
# $2 = String to append to the found JDK directory to get the proper JDK home
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   194
AC_DEFUN([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY],
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   195
[
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   196
  BOOT_JDK_PREFIX="$1"
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   197
  BOOT_JDK_SUFFIX="$2"
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   198
  ALL_JDKS_FOUND=`$LS "$BOOT_JDK_PREFIX" 2> /dev/null | $SORT -r`
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   199
  if test "x$ALL_JDKS_FOUND" != x; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   200
    for JDK_TO_TRY in $ALL_JDKS_FOUND ; do
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   201
      BOOTJDK_DO_CHECK([
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   202
        BOOT_JDK="${BOOT_JDK_PREFIX}/${JDK_TO_TRY}${BOOT_JDK_SUFFIX}"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   203
        if test -d "$BOOT_JDK"; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   204
          BOOT_JDK_FOUND=maybe
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   205
          AC_MSG_NOTICE([Found potential Boot JDK using well-known locations (in $BOOT_JDK_PREFIX/$JDK_TO_TRY)])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   206
        fi
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   207
      ])
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   208
    done
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   209
  fi
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   210
])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   211
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   212
# Call BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY, but use the given
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   213
# environmental variable as base for where to look.
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   214
# $1 Name of an environmal variable, assumed to point to the Program Files directory.
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   215
AC_DEFUN([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY],
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   216
[
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   217
  if test "x[$]$1" != x; then
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   218
    VIRTUAL_DIR="[$]$1/Java"
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   219
    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(VIRTUAL_DIR)
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   220
    BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY($VIRTUAL_DIR)
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   221
  fi
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   222
])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   223
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   224
# Test: Is there a JDK installed in default, well-known locations?
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   225
AC_DEFUN([BOOTJDK_CHECK_WELL_KNOWN_LOCATIONS],
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   226
[
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   227
  if test "x$OPENJDK_TARGET_OS" = xwindows; then
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   228
    BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY([ProgramW6432])])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   229
    BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY([PROGRAMW6432])])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   230
    BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY([PROGRAMFILES])])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   231
    BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY([ProgramFiles])])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   232
    BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY([/cygdrive/c/Program Files/Java])])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   233
  elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   234
    BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY([/Library/Java/JavaVirtualMachines],[/Contents/Home])])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   235
    BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY([/System/Library/Java/JavaVirtualMachines],[/Contents/Home])])
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   236
  elif test "x$OPENJDK_TARGET_OS" = xlinux; then
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   237
    BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY([/usr/lib/jvm])])
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   238
  fi
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   239
])
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   240
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   241
# Check that a command-line tool in the Boot JDK is correct
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   242
# $1 = name of variable to assign
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   243
# $2 = name of binary
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   244
AC_DEFUN([BOOTJDK_CHECK_TOOL_IN_BOOTJDK],
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   245
[
22477
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   246
  # Use user overridden value if available, otherwise locate tool in the Boot JDK.
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   247
  BASIC_SETUP_TOOL($1, 
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   248
    [
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   249
      AC_MSG_CHECKING([for $2 in Boot JDK])
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   250
      $1=$BOOT_JDK/bin/$2
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   251
      if test ! -x [$]$1; then
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   252
        AC_MSG_RESULT(not found)
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   253
        AC_MSG_NOTICE([Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk])
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   254
        AC_MSG_ERROR([Could not find $2 in the Boot JDK])
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   255
      fi
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   256
      AC_MSG_RESULT(ok)
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   257
      AC_SUBST($1)
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   258
    ])
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   259
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   260
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   261
###############################################################################
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   262
#
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   263
# We need a Boot JDK to bootstrap the build.
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   264
#
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   265
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   266
AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK],
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   267
[
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   268
  BOOT_JDK_FOUND=no
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   269
  AC_ARG_WITH(boot-jdk, [AS_HELP_STRING([--with-boot-jdk],
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   270
      [path to Boot JDK (used to bootstrap build) @<:@probed@:>@])])
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   271
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   272
  # We look for the Boot JDK through various means, going from more certain to
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   273
  # more of a guess-work. After each test, BOOT_JDK_FOUND is set to "yes" if
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   274
  # we detected something (if so, the path to the jdk is in BOOT_JDK). But we
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   275
  # must check if this is indeed valid; otherwise we'll continue looking.
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   276
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   277
  # Test: Is bootjdk explicitely set by command line arguments?
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   278
  BOOTJDK_DO_CHECK([BOOTJDK_CHECK_ARGUMENTS])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   279
  if test "x$with_boot_jdk" != x && test "x$BOOT_JDK_FOUND" = xno; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   280
    # Having specified an argument which is incorrect will produce an instant failure;
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   281
    # we should not go on looking
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   282
    AC_MSG_ERROR([The path given by --with-boot-jdk does not contain a valid Boot JDK])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   283
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   284
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   285
  # Test: Is bootjdk available from builddeps?
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   286
  BOOTJDK_DO_CHECK([BOOTJDK_CHECK_BUILDDEPS])
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   287
22477
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   288
  # Test: On MacOS X, can we find a boot jdk using /usr/libexec/java_home?
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   289
  BOOTJDK_DO_CHECK([BOOTJDK_CHECK_MACOSX_JAVA_LOCATOR])
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   290
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   291
  # Test: Is $JAVA_HOME set?
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   292
  BOOTJDK_DO_CHECK([BOOTJDK_CHECK_JAVA_HOME])
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   293
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   294
  # Test: Is there a java or javac in the PATH, which is a symlink to the JDK?
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   295
  BOOTJDK_DO_CHECK([BOOTJDK_CHECK_JAVA_IN_PATH_IS_SYMLINK])
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   296
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   297
  # Test: Is there a JDK installed in default, well-known locations?
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   298
  BOOTJDK_DO_CHECK([BOOTJDK_CHECK_WELL_KNOWN_LOCATIONS])
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   299
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   300
  # If we haven't found anything yet, we've truly lost. Give up.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   301
  if test "x$BOOT_JDK_FOUND" = xno; then
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   302
    HELP_MSG_MISSING_DEPENDENCY([openjdk])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   303
    AC_MSG_NOTICE([Could not find a valid Boot JDK. $HELP_MSG])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   304
    AC_MSG_NOTICE([This might be fixed by explicitely setting --with-boot-jdk])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   305
    AC_MSG_ERROR([Cannot continue])
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   306
  fi
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   307
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   308
  # Setup proper paths for what we found
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   309
  BOOT_RTJAR="$BOOT_JDK/jre/lib/rt.jar"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   310
  if test ! -f "$BOOT_RTJAR"; then
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   311
    # On MacOSX it is called classes.jar
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   312
    BOOT_RTJAR="$BOOT_JDK/../Classes/classes.jar"
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   313
    if test -f "$BOOT_RTJAR"; then
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   314
      # Remove the ..
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents: 13133
diff changeset
   315
      BOOT_RTJAR="`cd ${BOOT_RTJAR%/*} && pwd`/${BOOT_RTJAR##*/}"
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   316
    fi
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   317
  fi
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   318
  BOOT_TOOLSJAR="$BOOT_JDK/lib/tools.jar"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   319
  BOOT_JDK="$BOOT_JDK"
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   320
  AC_SUBST(BOOT_RTJAR)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   321
  AC_SUBST(BOOT_TOOLSJAR)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   322
  AC_SUBST(BOOT_JDK)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   323
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   324
  # Setup tools from the Boot JDK.
22477
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   325
  BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVA, java)
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   326
  BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAC, javac)
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   327
  BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAH, javah)
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   328
  BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAR, jar)
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   329
  BOOTJDK_CHECK_TOOL_IN_BOOTJDK(NATIVE2ASCII, native2ascii)
789f51111cb9 8033119: Improve and document boot-jdk.m4
ihse
parents: 22473
diff changeset
   330
  BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JARSIGNER, jarsigner)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   331
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   332
  # Finally, set some other options...
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   333
24304
f51622799778 8042932: Bump up the -source version for JDK 9 builds
coffeys
parents: 23982
diff changeset
   334
  # When compiling code to be executed by the Boot JDK, force jdk8 compatibility.
f51622799778 8042932: Bump up the -source version for JDK 9 builds
coffeys
parents: 23982
diff changeset
   335
  BOOT_JDK_SOURCETARGET="-source 8 -target 8"
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   336
  AC_SUBST(BOOT_JDK_SOURCETARGET)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   337
  AC_SUBST(JAVAC_FLAGS)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   338
])
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   339
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   340
AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK_ARGUMENTS],
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   341
[
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   342
  ##############################################################################
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   343
  #
22728
0a9d96bf2023 8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents: 22477
diff changeset
   344
  # Specify jvm options for anything that is run with the Boot JDK.
0a9d96bf2023 8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents: 22477
diff changeset
   345
  # Not all JVM:s accept the same arguments on the command line.
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   346
  #
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   347
  AC_ARG_WITH(boot-jdk-jvmargs, [AS_HELP_STRING([--with-boot-jdk-jvmargs],
22728
0a9d96bf2023 8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents: 22477
diff changeset
   348
  [specify JVM arguments to be passed to all java invocations of boot JDK, overriding the default values,
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   349
  e.g --with-boot-jdk-jvmargs="-Xmx8G -enableassertions"])])
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   350
22728
0a9d96bf2023 8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents: 22477
diff changeset
   351
  AC_MSG_CHECKING([flags for boot jdk java command] )
0a9d96bf2023 8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents: 22477
diff changeset
   352
23171
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   353
  # Disable special log output when a debug build is used as Boot JDK...
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   354
  ADD_JVM_ARG_IF_OK([-XX:-PrintVMOptions -XX:-UnlockDiagnosticVMOptions -XX:-LogVMOutput],boot_jdk_jvmargs,[$JAVA])
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   355
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   356
  # Apply user provided options.
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   357
  ADD_JVM_ARG_IF_OK([$with_boot_jdk_jvmargs],boot_jdk_jvmargs,[$JAVA])
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   358
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   359
  AC_MSG_RESULT([$boot_jdk_jvmargs])
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   360
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   361
  # For now, general JAVA_FLAGS are the same as the boot jdk jvmargs
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   362
  JAVA_FLAGS=$boot_jdk_jvmargs
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   363
  AC_SUBST(JAVA_FLAGS)
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   364
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   365
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   366
  AC_MSG_CHECKING([flags for boot jdk java command for big workloads])
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   367
22728
0a9d96bf2023 8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents: 22477
diff changeset
   368
  # Starting amount of heap memory.
23171
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   369
  ADD_JVM_ARG_IF_OK([-Xms64M],boot_jdk_jvmargs_big,[$JAVA])
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   370
22728
0a9d96bf2023 8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents: 22477
diff changeset
   371
  # Maximum amount of heap memory.
0a9d96bf2023 8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents: 22477
diff changeset
   372
  # Maximum stack size.
0a9d96bf2023 8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents: 22477
diff changeset
   373
  if test "x$BUILD_NUM_BITS" = x32; then
0a9d96bf2023 8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents: 22477
diff changeset
   374
    JVM_MAX_HEAP=1100M
0a9d96bf2023 8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents: 22477
diff changeset
   375
    STACK_SIZE=768
0a9d96bf2023 8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents: 22477
diff changeset
   376
  else
0a9d96bf2023 8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents: 22477
diff changeset
   377
    # Running Javac on a JVM on a 64-bit machine, takes more space since 64-bit
0a9d96bf2023 8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents: 22477
diff changeset
   378
    # pointers are used. Apparently, we need to increase the heap and stack
0a9d96bf2023 8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents: 22477
diff changeset
   379
    # space for the jvm. More specifically, when running javac to build huge
0a9d96bf2023 8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents: 22477
diff changeset
   380
    # jdk batch
0a9d96bf2023 8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents: 22477
diff changeset
   381
    JVM_MAX_HEAP=1600M
0a9d96bf2023 8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents: 22477
diff changeset
   382
    STACK_SIZE=1536
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 14111
diff changeset
   383
  fi
23171
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   384
  ADD_JVM_ARG_IF_OK([-Xmx$JVM_MAX_HEAP],boot_jdk_jvmargs_big,[$JAVA])
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   385
  ADD_JVM_ARG_IF_OK([-XX:ThreadStackSize=$STACK_SIZE],boot_jdk_jvmargs_big,[$JAVA])
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   386
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   387
  AC_MSG_RESULT([$boot_jdk_jvmargs_big])
22728
0a9d96bf2023 8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents: 22477
diff changeset
   388
23171
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   389
  JAVA_FLAGS_BIG=$boot_jdk_jvmargs_big
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   390
  AC_SUBST(JAVA_FLAGS_BIG)
22728
0a9d96bf2023 8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents: 22477
diff changeset
   391
23171
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   392
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   393
  AC_MSG_CHECKING([flags for boot jdk java command for small workloads])
22728
0a9d96bf2023 8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents: 22477
diff changeset
   394
23171
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   395
  # Use serial gc for small short lived tools if possible
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   396
  ADD_JVM_ARG_IF_OK([-XX:+UseSerialGC],boot_jdk_jvmargs_small,[$JAVA])
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   397
  ADD_JVM_ARG_IF_OK([-Xms32M],boot_jdk_jvmargs_small,[$JAVA])
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   398
  ADD_JVM_ARG_IF_OK([-Xmx512M],boot_jdk_jvmargs_small,[$JAVA])
22728
0a9d96bf2023 8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents: 22477
diff changeset
   399
23171
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   400
  AC_MSG_RESULT([$boot_jdk_jvmargs_small])
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   401
23171
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   402
  JAVA_FLAGS_SMALL=$boot_jdk_jvmargs_small
56a45cb104d1 8010767: Build fails on OEL6 with 16 cores
erikj
parents: 22728
diff changeset
   403
  AC_SUBST(JAVA_FLAGS_SMALL)
13133
701e61c32ece 7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff changeset
   404
])