common/autoconf/boot-jdk.m4

Thu, 05 Jul 2012 18:27:07 -0700

author
erikj
date
Thu, 05 Jul 2012 18:27:07 -0700
changeset 459
3156dff953b1
child 478
2ba6f4da4bf3
permissions
-rw-r--r--

7182051: Update of latest build-infra Makefiles (missing files)
Reviewed-by: ohair

erikj@459 1 #
erikj@459 2 # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
erikj@459 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
erikj@459 4 #
erikj@459 5 # This code is free software; you can redistribute it and/or modify it
erikj@459 6 # under the terms of the GNU General Public License version 2 only, as
erikj@459 7 # published by the Free Software Foundation. Oracle designates this
erikj@459 8 # particular file as subject to the "Classpath" exception as provided
erikj@459 9 # by Oracle in the LICENSE file that accompanied this code.
erikj@459 10 #
erikj@459 11 # This code is distributed in the hope that it will be useful, but WITHOUT
erikj@459 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
erikj@459 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
erikj@459 14 # version 2 for more details (a copy is included in the LICENSE file that
erikj@459 15 # accompanied this code).
erikj@459 16 #
erikj@459 17 # You should have received a copy of the GNU General Public License version
erikj@459 18 # 2 along with this work; if not, write to the Free Software Foundation,
erikj@459 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
erikj@459 20 #
erikj@459 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
erikj@459 22 # or visit www.oracle.com if you need additional information or have any
erikj@459 23 # questions.
erikj@459 24 #
erikj@459 25
erikj@459 26 # Fixes paths on windows to be mixed mode short.
erikj@459 27 AC_DEFUN([BOOTJDK_WIN_FIX_PATH],
erikj@459 28 [
erikj@459 29 if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
erikj@459 30 AC_PATH_PROG(CYGPATH, cygpath)
erikj@459 31 tmp="[$]$1"
erikj@459 32 # Convert to C:/ mixed style path without spaces.
erikj@459 33 tmp=`$CYGPATH -s -m "$tmp"`
erikj@459 34 $1="$tmp"
erikj@459 35 fi
erikj@459 36 ])
erikj@459 37
erikj@459 38 AC_DEFUN([BOOTJDK_MISSING_ERROR],
erikj@459 39 [
erikj@459 40 AC_MSG_NOTICE([This might be fixed by explicitely setting --with-boot-jdk])
erikj@459 41 AC_MSG_ERROR([Cannot continue])
erikj@459 42 ])
erikj@459 43
erikj@459 44 ###############################################################################
erikj@459 45 #
erikj@459 46 # We need a Boot JDK to bootstrap the build.
erikj@459 47 #
erikj@459 48
erikj@459 49 AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK],
erikj@459 50 [
erikj@459 51 BOOT_JDK_FOUND=no
erikj@459 52 AC_ARG_WITH(boot-jdk, [AS_HELP_STRING([--with-boot-jdk],
erikj@459 53 [path to Boot JDK (used to bootstrap build) @<:@probed@:>@])])
erikj@459 54
erikj@459 55 if test "x$with_boot_jdk" != x; then
erikj@459 56 BOOT_JDK=$with_boot_jdk
erikj@459 57 BOOT_JDK_FOUND=yes
erikj@459 58 fi
erikj@459 59 if test "x$BOOT_JDK_FOUND" = xno; then
erikj@459 60 BDEPS_CHECK_MODULE(BOOT_JDK, boot-jdk, xxx, [BOOT_JDK_FOUND=yes], [BOOT_JDK_FOUND=no])
erikj@459 61 fi
erikj@459 62
erikj@459 63 if test "x$BOOT_JDK_FOUND" = xno; then
erikj@459 64 if test "x$JAVA_HOME" != x; then
erikj@459 65 if test ! -d "$JAVA_HOME"; then
erikj@459 66 AC_MSG_NOTICE([Your JAVA_HOME points to a non-existing directory!])
erikj@459 67 BOOTJDK_MISSING_ERROR
erikj@459 68 fi
erikj@459 69 # Aha, the user has set a JAVA_HOME
erikj@459 70 # let us use that as the Boot JDK.
erikj@459 71 BOOT_JDK="$JAVA_HOME"
erikj@459 72 BOOT_JDK_FOUND=yes
erikj@459 73 # To be on the safe side, lets check that it is a JDK.
erikj@459 74 if test -x "$BOOT_JDK/bin/javac" && test -x "$BOOT_JDK/bin/java"; then
erikj@459 75 JAVAC="$BOOT_JDK/bin/javac"
erikj@459 76 JAVA="$BOOT_JDK/bin/java"
erikj@459 77 BOOT_JDK_FOUND=yes
erikj@459 78 else
erikj@459 79 AC_MSG_NOTICE([Your JAVA_HOME points to a JRE! The build needs a JDK! Please point JAVA_HOME to a JDK. JAVA_HOME=[$]JAVA_HOME])
erikj@459 80 BOOTJDK_MISSING_ERROR
erikj@459 81 fi
erikj@459 82 fi
erikj@459 83 fi
erikj@459 84
erikj@459 85 if test "x$BOOT_JDK_FOUND" = xno; then
erikj@459 86 AC_PATH_PROG(JAVAC_CHECK, javac)
erikj@459 87 AC_PATH_PROG(JAVA_CHECK, java)
erikj@459 88 BINARY="$JAVAC_CHECK"
erikj@459 89 if test "x$JAVAC_CHECK" = x; then
erikj@459 90 BINARY="$JAVA_CHECK"
erikj@459 91 fi
erikj@459 92 if test "x$BINARY" != x; then
erikj@459 93 # So there is a java(c) binary, it might be part of a JDK.
erikj@459 94 # Lets find the JDK/JRE directory by following symbolic links.
erikj@459 95 # Linux/GNU systems often have links from /usr/bin/java to
erikj@459 96 # /etc/alternatives/java to the real JDK binary.
erikj@459 97 WHICHCMD_SPACESAFE(BINARY,[path to javac])
erikj@459 98 REMOVE_SYMBOLIC_LINKS(BINARY)
erikj@459 99 BOOT_JDK=`dirname $BINARY`
erikj@459 100 BOOT_JDK=`cd $BOOT_JDK/..; pwd`
erikj@459 101 if test -x $BOOT_JDK/bin/javac && test -x $BOOT_JDK/bin/java; then
erikj@459 102 JAVAC=$BOOT_JDK/bin/javac
erikj@459 103 JAVA=$BOOT_JDK/bin/java
erikj@459 104 BOOT_JDK_FOUND=yes
erikj@459 105 fi
erikj@459 106 fi
erikj@459 107 fi
erikj@459 108
erikj@459 109 if test "x$BOOT_JDK_FOUND" = xno; then
erikj@459 110 # Try the MacOSX way.
erikj@459 111 if test -x /usr/libexec/java_home; then
erikj@459 112 BOOT_JDK=`/usr/libexec/java_home`
erikj@459 113 if test -x $BOOT_JDK/bin/javac && test -x $BOOT_JDK/bin/java; then
erikj@459 114 JAVAC=$BOOT_JDK/bin/javac
erikj@459 115 JAVA=$BOOT_JDK/bin/java
erikj@459 116 BOOT_JDK_FOUND=yes
erikj@459 117 fi
erikj@459 118 fi
erikj@459 119 fi
erikj@459 120
erikj@459 121 if test "x$BOOT_JDK_FOUND" = xno; then
erikj@459 122 AC_PATH_PROG(JAVA_CHECK, java)
erikj@459 123 if test "x$JAVA_CHECK" != x; then
erikj@459 124 # There is a java in the path. But apparently we have not found a javac
erikj@459 125 # in the path, since that would have been tested earlier.
erikj@459 126 if test "x$OPENJDK_TARGET_OS" = xwindows; then
erikj@459 127 # Now if this is a windows platform. The default installation of a JDK
erikj@459 128 # actually puts the JRE in the path and keeps the JDK out of the path!
erikj@459 129 # Go look in the default installation location.
erikj@459 130 BOOT_JDK=/cygdrive/c/Program\ Files/Java/`ls /cygdrive/c/Program\ Files/Java | grep jdk | sort -r | head --lines 1`
erikj@459 131 if test -d "$BOOT_JDK"; then
erikj@459 132 BOOT_JDK_FOUND=yes
erikj@459 133 fi
erikj@459 134 fi
erikj@459 135 if test "x$BOOT_JDK_FOUND" = xno; then
erikj@459 136 HELP_MSG_MISSING_DEPENDENCY([openjdk])
erikj@459 137 AC_MSG_NOTICE([Found a JRE, not not a JDK! Please remove the JRE from your path and put a JDK there instead. $HELP_MSG])
erikj@459 138 BOOTJDK_MISSING_ERROR
erikj@459 139 fi
erikj@459 140 else
erikj@459 141 HELP_MSG_MISSING_DEPENDENCY([openjdk])
erikj@459 142 AC_MSG_NOTICE([Could not find a JDK. $HELP_MSG])
erikj@459 143 BOOTJDK_MISSING_ERROR
erikj@459 144 fi
erikj@459 145 fi
erikj@459 146
erikj@459 147 BOOTJDK_WIN_FIX_PATH(BOOT_JDK)
erikj@459 148
erikj@459 149 # Now see if we can find the rt.jar, or its nearest equivalent.
erikj@459 150 BOOT_RTJAR="$BOOT_JDK/jre/lib/rt.jar"
erikj@459 151 SPACESAFE(BOOT_RTJAR,[the path to the Boot JDK rt.jar (or nearest equivalent)])
erikj@459 152
erikj@459 153 BOOT_TOOLSJAR="$BOOT_JDK/lib/tools.jar"
erikj@459 154 SPACESAFE(BOOT_TOOLSJAR,[the path to the Boot JDK tools.jar (or nearest equivalent)])
erikj@459 155
erikj@459 156 if test ! -f $BOOT_RTJAR; then
erikj@459 157 # On MacOSX it is called classes.jar
erikj@459 158 BOOT_RTJAR=$BOOT_JDK/../Classes/classes.jar
erikj@459 159 if test ! -f $BOOT_RTJAR; then
erikj@459 160 AC_MSG_NOTICE([Cannot find the rt.jar or its equivalent!])
erikj@459 161 AC_MSG_NOTICE([This typically means that configure failed to automatically find a suitable Boot JDK])
erikj@459 162 BOOTJDK_MISSING_ERROR
erikj@459 163 fi
erikj@459 164 # Remove the ..
erikj@459 165 BOOT_RTJAR="`cd ${BOOT_RTJAR%/*} && pwd`/${BOOT_RTJAR##*/}"
erikj@459 166 # The tools.jar is part of classes.jar
erikj@459 167 BOOT_TOOLSJAR="$BOOT_RTJAR"
erikj@459 168 fi
erikj@459 169
erikj@459 170 AC_SUBST(BOOT_JDK)
erikj@459 171 AC_SUBST(BOOT_RTJAR)
erikj@459 172 AC_SUBST(BOOT_TOOLSJAR)
erikj@459 173 AC_MSG_CHECKING([for Boot JDK])
erikj@459 174 AC_MSG_RESULT([$BOOT_JDK])
erikj@459 175 AC_MSG_CHECKING([for Boot rt.jar])
erikj@459 176 AC_MSG_RESULT([$BOOT_RTJAR])
erikj@459 177 AC_MSG_CHECKING([for Boot tools.jar])
erikj@459 178 AC_MSG_RESULT([$BOOT_TOOLSJAR])
erikj@459 179
erikj@459 180 # Use the java tool from the Boot JDK.
erikj@459 181 AC_MSG_CHECKING([for java in Boot JDK])
erikj@459 182 JAVA=$BOOT_JDK/bin/java
erikj@459 183 if test ! -x $JAVA; then
erikj@459 184 AC_MSG_NOTICE([Could not find a working java])
erikj@459 185 BOOTJDK_MISSING_ERROR
erikj@459 186 fi
erikj@459 187 BOOT_JDK_VERSION=`$JAVA -version 2>&1 | head -n 1`
erikj@459 188 AC_MSG_RESULT([yes $BOOT_JDK_VERSION])
erikj@459 189 AC_SUBST(JAVA)
erikj@459 190
erikj@459 191 # Extra M4 quote needed to protect [] in grep expression.
erikj@459 192 [FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep '\"1\.[78]\.'`]
erikj@459 193 if test "x$FOUND_VERSION_78" = x; then
erikj@459 194 HELP_MSG_MISSING_DEPENDENCY([openjdk])
erikj@459 195 AC_MSG_NOTICE([Your boot-jdk must be version 7 or 8. $HELP_MSG])
erikj@459 196 BOOTJDK_MISSING_ERROR
erikj@459 197 fi
erikj@459 198
erikj@459 199 # When compiling code to be executed by the Boot JDK, force jdk7 compatibility.
erikj@459 200 BOOT_JDK_SOURCETARGET="-source 7 -target 7"
erikj@459 201 AC_SUBST(BOOT_JDK_SOURCETARGET)
erikj@459 202
erikj@459 203 # Use the javac tool from the Boot JDK.
erikj@459 204 AC_MSG_CHECKING([for javac in Boot JDK])
erikj@459 205 JAVAC=$BOOT_JDK/bin/javac
erikj@459 206 if test ! -x $JAVAC; then
erikj@459 207 AC_MSG_ERROR([Could not find a working javac])
erikj@459 208 fi
erikj@459 209 AC_MSG_RESULT(yes)
erikj@459 210 AC_SUBST(JAVAC)
erikj@459 211 AC_SUBST(JAVAC_FLAGS)
erikj@459 212
erikj@459 213 # Use the javah tool from the Boot JDK.
erikj@459 214 AC_MSG_CHECKING([for javah in Boot JDK])
erikj@459 215 JAVAH=$BOOT_JDK/bin/javah
erikj@459 216 if test ! -x $JAVAH; then
erikj@459 217 AC_MSG_NOTICE([Could not find a working javah])
erikj@459 218 BOOTJDK_MISSING_ERROR
erikj@459 219 fi
erikj@459 220 AC_MSG_RESULT(yes)
erikj@459 221 AC_SUBST(JAVAH)
erikj@459 222
erikj@459 223 # Use the jar tool from the Boot JDK.
erikj@459 224 AC_MSG_CHECKING([for jar in Boot JDK])
erikj@459 225 JAR=$BOOT_JDK/bin/jar
erikj@459 226 if test ! -x $JAR; then
erikj@459 227 AC_MSG_NOTICE([Could not find a working jar])
erikj@459 228 BOOTJDK_MISSING_ERROR
erikj@459 229 fi
erikj@459 230 AC_SUBST(JAR)
erikj@459 231 AC_MSG_RESULT(yes)
erikj@459 232
erikj@459 233 # Use the rmic tool from the Boot JDK.
erikj@459 234 AC_MSG_CHECKING([for rmic in Boot JDK])
erikj@459 235 RMIC=$BOOT_JDK/bin/rmic
erikj@459 236 if test ! -x $RMIC; then
erikj@459 237 AC_MSG_NOTICE([Could not find a working rmic])
erikj@459 238 BOOTJDK_MISSING_ERROR
erikj@459 239 fi
erikj@459 240 AC_SUBST(RMIC)
erikj@459 241 AC_MSG_RESULT(yes)
erikj@459 242
erikj@459 243 # Use the native2ascii tool from the Boot JDK.
erikj@459 244 AC_MSG_CHECKING([for native2ascii in Boot JDK])
erikj@459 245 NATIVE2ASCII=$BOOT_JDK/bin/native2ascii
erikj@459 246 if test ! -x $NATIVE2ASCII; then
erikj@459 247 AC_MSG_NOTICE([Could not find a working native2ascii])
erikj@459 248 BOOTJDK_MISSING_ERROR
erikj@459 249 fi
erikj@459 250 AC_MSG_RESULT(yes)
erikj@459 251 AC_SUBST(NATIVE2ASCII)
erikj@459 252 ])
erikj@459 253
erikj@459 254 AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK_ARGUMENTS],
erikj@459 255 [
erikj@459 256 ##############################################################################
erikj@459 257 #
erikj@459 258 # Specify options for anything that is run with the Boot JDK.
erikj@459 259 #
erikj@459 260 AC_ARG_WITH(boot-jdk-jvmargs, [AS_HELP_STRING([--with-boot-jdk-jvmargs],
erikj@459 261 [specify JVM arguments to be passed to all invocations of the Boot JDK, overriding the default values,
erikj@459 262 e.g --with-boot-jdk-jvmargs="-Xmx8G -enableassertions"])])
erikj@459 263
erikj@459 264 if test "x$with_boot_jdk_jvmargs" = x; then
erikj@459 265 # Not all JVM:s accept the same arguments on the command line.
erikj@459 266 # OpenJDK specific increase in thread stack for JDK build,
erikj@459 267 # well more specifically, when running javac.
erikj@459 268 if test "x$BUILD_NUM_BITS" = x32; then
erikj@459 269 STACK_SIZE=768
erikj@459 270 else
erikj@459 271 # Running Javac on a JVM on a 64-bit machine, the stack takes more space
erikj@459 272 # since 64-bit pointers are pushed on the stach. Apparently, we need
erikj@459 273 # to increase the stack space when javacing the JDK....
erikj@459 274 STACK_SIZE=1536
erikj@459 275 fi
erikj@459 276
erikj@459 277 # Minimum amount of heap memory.
erikj@459 278 ADD_JVM_ARG_IF_OK([-Xms64M],boot_jdk_jvmargs,[$JAVA])
erikj@459 279 if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
erikj@459 280 # Why does macosx need more heap? Its the huge JDK batch.
erikj@459 281 ADD_JVM_ARG_IF_OK([-Xmx1600M],boot_jdk_jvmargs,[$JAVA])
erikj@459 282 else
erikj@459 283 ADD_JVM_ARG_IF_OK([-Xmx1100M],boot_jdk_jvmargs,[$JAVA])
erikj@459 284 fi
erikj@459 285 # When is adding -client something that speeds up the JVM?
erikj@459 286 # ADD_JVM_ARG_IF_OK([-client],boot_jdk_jvmargs,[$JAVA])
erikj@459 287 ADD_JVM_ARG_IF_OK([-XX:PermSize=32m],boot_jdk_jvmargs,[$JAVA])
erikj@459 288 ADD_JVM_ARG_IF_OK([-XX:MaxPermSize=160m],boot_jdk_jvmargs,[$JAVA])
erikj@459 289 ADD_JVM_ARG_IF_OK([-XX:ThreadStackSize=$STACK_SIZE],boot_jdk_jvmargs,[$JAVA])
erikj@459 290 # Disable special log output when a debug build is used as Boot JDK...
erikj@459 291 ADD_JVM_ARG_IF_OK([-XX:-PrintVMOptions -XX:-UnlockDiagnosticVMOptions -XX:-LogVMOutput],boot_jdk_jvmargs,[$JAVA])
erikj@459 292 fi
erikj@459 293
erikj@459 294 AC_SUBST(BOOT_JDK_JVMARGS, $boot_jdk_jvmargs)
erikj@459 295 ])

mercurial