1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/common/autoconf/boot-jdk.m4 Thu Jul 05 18:27:07 2012 -0700 1.3 @@ -0,0 +1,295 @@ 1.4 +# 1.5 +# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. 1.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 +# 1.8 +# This code is free software; you can redistribute it and/or modify it 1.9 +# under the terms of the GNU General Public License version 2 only, as 1.10 +# published by the Free Software Foundation. Oracle designates this 1.11 +# particular file as subject to the "Classpath" exception as provided 1.12 +# by Oracle in the LICENSE file that accompanied this code. 1.13 +# 1.14 +# This code is distributed in the hope that it will be useful, but WITHOUT 1.15 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 +# version 2 for more details (a copy is included in the LICENSE file that 1.18 +# accompanied this code). 1.19 +# 1.20 +# You should have received a copy of the GNU General Public License version 1.21 +# 2 along with this work; if not, write to the Free Software Foundation, 1.22 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 +# 1.24 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.25 +# or visit www.oracle.com if you need additional information or have any 1.26 +# questions. 1.27 +# 1.28 + 1.29 +# Fixes paths on windows to be mixed mode short. 1.30 +AC_DEFUN([BOOTJDK_WIN_FIX_PATH], 1.31 +[ 1.32 + if test "x$OPENJDK_BUILD_OS" = "xwindows"; then 1.33 + AC_PATH_PROG(CYGPATH, cygpath) 1.34 + tmp="[$]$1" 1.35 + # Convert to C:/ mixed style path without spaces. 1.36 + tmp=`$CYGPATH -s -m "$tmp"` 1.37 + $1="$tmp" 1.38 + fi 1.39 +]) 1.40 + 1.41 +AC_DEFUN([BOOTJDK_MISSING_ERROR], 1.42 +[ 1.43 + AC_MSG_NOTICE([This might be fixed by explicitely setting --with-boot-jdk]) 1.44 + AC_MSG_ERROR([Cannot continue]) 1.45 +]) 1.46 + 1.47 +############################################################################### 1.48 +# 1.49 +# We need a Boot JDK to bootstrap the build. 1.50 +# 1.51 + 1.52 +AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK], 1.53 +[ 1.54 +BOOT_JDK_FOUND=no 1.55 +AC_ARG_WITH(boot-jdk, [AS_HELP_STRING([--with-boot-jdk], 1.56 + [path to Boot JDK (used to bootstrap build) @<:@probed@:>@])]) 1.57 + 1.58 +if test "x$with_boot_jdk" != x; then 1.59 + BOOT_JDK=$with_boot_jdk 1.60 + BOOT_JDK_FOUND=yes 1.61 +fi 1.62 +if test "x$BOOT_JDK_FOUND" = xno; then 1.63 + BDEPS_CHECK_MODULE(BOOT_JDK, boot-jdk, xxx, [BOOT_JDK_FOUND=yes], [BOOT_JDK_FOUND=no]) 1.64 +fi 1.65 + 1.66 +if test "x$BOOT_JDK_FOUND" = xno; then 1.67 + if test "x$JAVA_HOME" != x; then 1.68 + if test ! -d "$JAVA_HOME"; then 1.69 + AC_MSG_NOTICE([Your JAVA_HOME points to a non-existing directory!]) 1.70 + BOOTJDK_MISSING_ERROR 1.71 + fi 1.72 + # Aha, the user has set a JAVA_HOME 1.73 + # let us use that as the Boot JDK. 1.74 + BOOT_JDK="$JAVA_HOME" 1.75 + BOOT_JDK_FOUND=yes 1.76 + # To be on the safe side, lets check that it is a JDK. 1.77 + if test -x "$BOOT_JDK/bin/javac" && test -x "$BOOT_JDK/bin/java"; then 1.78 + JAVAC="$BOOT_JDK/bin/javac" 1.79 + JAVA="$BOOT_JDK/bin/java" 1.80 + BOOT_JDK_FOUND=yes 1.81 + else 1.82 + 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]) 1.83 + BOOTJDK_MISSING_ERROR 1.84 + fi 1.85 + fi 1.86 +fi 1.87 + 1.88 +if test "x$BOOT_JDK_FOUND" = xno; then 1.89 + AC_PATH_PROG(JAVAC_CHECK, javac) 1.90 + AC_PATH_PROG(JAVA_CHECK, java) 1.91 + BINARY="$JAVAC_CHECK" 1.92 + if test "x$JAVAC_CHECK" = x; then 1.93 + BINARY="$JAVA_CHECK" 1.94 + fi 1.95 + if test "x$BINARY" != x; then 1.96 + # So there is a java(c) binary, it might be part of a JDK. 1.97 + # Lets find the JDK/JRE directory by following symbolic links. 1.98 + # Linux/GNU systems often have links from /usr/bin/java to 1.99 + # /etc/alternatives/java to the real JDK binary. 1.100 + WHICHCMD_SPACESAFE(BINARY,[path to javac]) 1.101 + REMOVE_SYMBOLIC_LINKS(BINARY) 1.102 + BOOT_JDK=`dirname $BINARY` 1.103 + BOOT_JDK=`cd $BOOT_JDK/..; pwd` 1.104 + if test -x $BOOT_JDK/bin/javac && test -x $BOOT_JDK/bin/java; then 1.105 + JAVAC=$BOOT_JDK/bin/javac 1.106 + JAVA=$BOOT_JDK/bin/java 1.107 + BOOT_JDK_FOUND=yes 1.108 + fi 1.109 + fi 1.110 +fi 1.111 + 1.112 +if test "x$BOOT_JDK_FOUND" = xno; then 1.113 + # Try the MacOSX way. 1.114 + if test -x /usr/libexec/java_home; then 1.115 + BOOT_JDK=`/usr/libexec/java_home` 1.116 + if test -x $BOOT_JDK/bin/javac && test -x $BOOT_JDK/bin/java; then 1.117 + JAVAC=$BOOT_JDK/bin/javac 1.118 + JAVA=$BOOT_JDK/bin/java 1.119 + BOOT_JDK_FOUND=yes 1.120 + fi 1.121 + fi 1.122 +fi 1.123 + 1.124 +if test "x$BOOT_JDK_FOUND" = xno; then 1.125 + AC_PATH_PROG(JAVA_CHECK, java) 1.126 + if test "x$JAVA_CHECK" != x; then 1.127 + # There is a java in the path. But apparently we have not found a javac 1.128 + # in the path, since that would have been tested earlier. 1.129 + if test "x$OPENJDK_TARGET_OS" = xwindows; then 1.130 + # Now if this is a windows platform. The default installation of a JDK 1.131 + # actually puts the JRE in the path and keeps the JDK out of the path! 1.132 + # Go look in the default installation location. 1.133 + BOOT_JDK=/cygdrive/c/Program\ Files/Java/`ls /cygdrive/c/Program\ Files/Java | grep jdk | sort -r | head --lines 1` 1.134 + if test -d "$BOOT_JDK"; then 1.135 + BOOT_JDK_FOUND=yes 1.136 + fi 1.137 + fi 1.138 + if test "x$BOOT_JDK_FOUND" = xno; then 1.139 + HELP_MSG_MISSING_DEPENDENCY([openjdk]) 1.140 + 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]) 1.141 + BOOTJDK_MISSING_ERROR 1.142 + fi 1.143 + else 1.144 + HELP_MSG_MISSING_DEPENDENCY([openjdk]) 1.145 + AC_MSG_NOTICE([Could not find a JDK. $HELP_MSG]) 1.146 + BOOTJDK_MISSING_ERROR 1.147 + fi 1.148 +fi 1.149 + 1.150 +BOOTJDK_WIN_FIX_PATH(BOOT_JDK) 1.151 + 1.152 +# Now see if we can find the rt.jar, or its nearest equivalent. 1.153 +BOOT_RTJAR="$BOOT_JDK/jre/lib/rt.jar" 1.154 +SPACESAFE(BOOT_RTJAR,[the path to the Boot JDK rt.jar (or nearest equivalent)]) 1.155 + 1.156 +BOOT_TOOLSJAR="$BOOT_JDK/lib/tools.jar" 1.157 +SPACESAFE(BOOT_TOOLSJAR,[the path to the Boot JDK tools.jar (or nearest equivalent)]) 1.158 + 1.159 +if test ! -f $BOOT_RTJAR; then 1.160 + # On MacOSX it is called classes.jar 1.161 + BOOT_RTJAR=$BOOT_JDK/../Classes/classes.jar 1.162 + if test ! -f $BOOT_RTJAR; then 1.163 + AC_MSG_NOTICE([Cannot find the rt.jar or its equivalent!]) 1.164 + AC_MSG_NOTICE([This typically means that configure failed to automatically find a suitable Boot JDK]) 1.165 + BOOTJDK_MISSING_ERROR 1.166 + fi 1.167 + # Remove the .. 1.168 + BOOT_RTJAR="`cd ${BOOT_RTJAR%/*} && pwd`/${BOOT_RTJAR##*/}" 1.169 + # The tools.jar is part of classes.jar 1.170 + BOOT_TOOLSJAR="$BOOT_RTJAR" 1.171 +fi 1.172 + 1.173 +AC_SUBST(BOOT_JDK) 1.174 +AC_SUBST(BOOT_RTJAR) 1.175 +AC_SUBST(BOOT_TOOLSJAR) 1.176 +AC_MSG_CHECKING([for Boot JDK]) 1.177 +AC_MSG_RESULT([$BOOT_JDK]) 1.178 +AC_MSG_CHECKING([for Boot rt.jar]) 1.179 +AC_MSG_RESULT([$BOOT_RTJAR]) 1.180 +AC_MSG_CHECKING([for Boot tools.jar]) 1.181 +AC_MSG_RESULT([$BOOT_TOOLSJAR]) 1.182 + 1.183 +# Use the java tool from the Boot JDK. 1.184 +AC_MSG_CHECKING([for java in Boot JDK]) 1.185 +JAVA=$BOOT_JDK/bin/java 1.186 +if test ! -x $JAVA; then 1.187 + AC_MSG_NOTICE([Could not find a working java]) 1.188 + BOOTJDK_MISSING_ERROR 1.189 +fi 1.190 +BOOT_JDK_VERSION=`$JAVA -version 2>&1 | head -n 1` 1.191 +AC_MSG_RESULT([yes $BOOT_JDK_VERSION]) 1.192 +AC_SUBST(JAVA) 1.193 + 1.194 +# Extra M4 quote needed to protect [] in grep expression. 1.195 +[FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep '\"1\.[78]\.'`] 1.196 +if test "x$FOUND_VERSION_78" = x; then 1.197 + HELP_MSG_MISSING_DEPENDENCY([openjdk]) 1.198 + AC_MSG_NOTICE([Your boot-jdk must be version 7 or 8. $HELP_MSG]) 1.199 + BOOTJDK_MISSING_ERROR 1.200 +fi 1.201 + 1.202 +# When compiling code to be executed by the Boot JDK, force jdk7 compatibility. 1.203 +BOOT_JDK_SOURCETARGET="-source 7 -target 7" 1.204 +AC_SUBST(BOOT_JDK_SOURCETARGET) 1.205 + 1.206 +# Use the javac tool from the Boot JDK. 1.207 +AC_MSG_CHECKING([for javac in Boot JDK]) 1.208 +JAVAC=$BOOT_JDK/bin/javac 1.209 +if test ! -x $JAVAC; then 1.210 + AC_MSG_ERROR([Could not find a working javac]) 1.211 +fi 1.212 +AC_MSG_RESULT(yes) 1.213 +AC_SUBST(JAVAC) 1.214 +AC_SUBST(JAVAC_FLAGS) 1.215 + 1.216 +# Use the javah tool from the Boot JDK. 1.217 +AC_MSG_CHECKING([for javah in Boot JDK]) 1.218 +JAVAH=$BOOT_JDK/bin/javah 1.219 +if test ! -x $JAVAH; then 1.220 + AC_MSG_NOTICE([Could not find a working javah]) 1.221 + BOOTJDK_MISSING_ERROR 1.222 +fi 1.223 +AC_MSG_RESULT(yes) 1.224 +AC_SUBST(JAVAH) 1.225 + 1.226 +# Use the jar tool from the Boot JDK. 1.227 +AC_MSG_CHECKING([for jar in Boot JDK]) 1.228 +JAR=$BOOT_JDK/bin/jar 1.229 +if test ! -x $JAR; then 1.230 + AC_MSG_NOTICE([Could not find a working jar]) 1.231 + BOOTJDK_MISSING_ERROR 1.232 +fi 1.233 +AC_SUBST(JAR) 1.234 +AC_MSG_RESULT(yes) 1.235 + 1.236 +# Use the rmic tool from the Boot JDK. 1.237 +AC_MSG_CHECKING([for rmic in Boot JDK]) 1.238 +RMIC=$BOOT_JDK/bin/rmic 1.239 +if test ! -x $RMIC; then 1.240 + AC_MSG_NOTICE([Could not find a working rmic]) 1.241 + BOOTJDK_MISSING_ERROR 1.242 +fi 1.243 +AC_SUBST(RMIC) 1.244 +AC_MSG_RESULT(yes) 1.245 + 1.246 +# Use the native2ascii tool from the Boot JDK. 1.247 +AC_MSG_CHECKING([for native2ascii in Boot JDK]) 1.248 +NATIVE2ASCII=$BOOT_JDK/bin/native2ascii 1.249 +if test ! -x $NATIVE2ASCII; then 1.250 + AC_MSG_NOTICE([Could not find a working native2ascii]) 1.251 + BOOTJDK_MISSING_ERROR 1.252 +fi 1.253 +AC_MSG_RESULT(yes) 1.254 +AC_SUBST(NATIVE2ASCII) 1.255 +]) 1.256 + 1.257 +AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK_ARGUMENTS], 1.258 +[ 1.259 +############################################################################## 1.260 +# 1.261 +# Specify options for anything that is run with the Boot JDK. 1.262 +# 1.263 +AC_ARG_WITH(boot-jdk-jvmargs, [AS_HELP_STRING([--with-boot-jdk-jvmargs], 1.264 + [specify JVM arguments to be passed to all invocations of the Boot JDK, overriding the default values, 1.265 + e.g --with-boot-jdk-jvmargs="-Xmx8G -enableassertions"])]) 1.266 + 1.267 +if test "x$with_boot_jdk_jvmargs" = x; then 1.268 + # Not all JVM:s accept the same arguments on the command line. 1.269 + # OpenJDK specific increase in thread stack for JDK build, 1.270 + # well more specifically, when running javac. 1.271 + if test "x$BUILD_NUM_BITS" = x32; then 1.272 + STACK_SIZE=768 1.273 + else 1.274 + # Running Javac on a JVM on a 64-bit machine, the stack takes more space 1.275 + # since 64-bit pointers are pushed on the stach. Apparently, we need 1.276 + # to increase the stack space when javacing the JDK.... 1.277 + STACK_SIZE=1536 1.278 + fi 1.279 + 1.280 + # Minimum amount of heap memory. 1.281 + ADD_JVM_ARG_IF_OK([-Xms64M],boot_jdk_jvmargs,[$JAVA]) 1.282 + if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then 1.283 + # Why does macosx need more heap? Its the huge JDK batch. 1.284 + ADD_JVM_ARG_IF_OK([-Xmx1600M],boot_jdk_jvmargs,[$JAVA]) 1.285 + else 1.286 + ADD_JVM_ARG_IF_OK([-Xmx1100M],boot_jdk_jvmargs,[$JAVA]) 1.287 + fi 1.288 + # When is adding -client something that speeds up the JVM? 1.289 + # ADD_JVM_ARG_IF_OK([-client],boot_jdk_jvmargs,[$JAVA]) 1.290 + ADD_JVM_ARG_IF_OK([-XX:PermSize=32m],boot_jdk_jvmargs,[$JAVA]) 1.291 + ADD_JVM_ARG_IF_OK([-XX:MaxPermSize=160m],boot_jdk_jvmargs,[$JAVA]) 1.292 + ADD_JVM_ARG_IF_OK([-XX:ThreadStackSize=$STACK_SIZE],boot_jdk_jvmargs,[$JAVA]) 1.293 + # Disable special log output when a debug build is used as Boot JDK... 1.294 + ADD_JVM_ARG_IF_OK([-XX:-PrintVMOptions -XX:-UnlockDiagnosticVMOptions -XX:-LogVMOutput],boot_jdk_jvmargs,[$JAVA]) 1.295 +fi 1.296 + 1.297 +AC_SUBST(BOOT_JDK_JVMARGS, $boot_jdk_jvmargs) 1.298 +])