erikj@459: # erikj@459: # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. erikj@459: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. erikj@459: # erikj@459: # This code is free software; you can redistribute it and/or modify it erikj@459: # under the terms of the GNU General Public License version 2 only, as erikj@459: # published by the Free Software Foundation. Oracle designates this erikj@459: # particular file as subject to the "Classpath" exception as provided erikj@459: # by Oracle in the LICENSE file that accompanied this code. erikj@459: # erikj@459: # This code is distributed in the hope that it will be useful, but WITHOUT erikj@459: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or erikj@459: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License erikj@459: # version 2 for more details (a copy is included in the LICENSE file that erikj@459: # accompanied this code). erikj@459: # erikj@459: # You should have received a copy of the GNU General Public License version erikj@459: # 2 along with this work; if not, write to the Free Software Foundation, erikj@459: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. erikj@459: # erikj@459: # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA erikj@459: # or visit www.oracle.com if you need additional information or have any erikj@459: # questions. erikj@459: # erikj@459: erikj@459: # Fixes paths on windows to be mixed mode short. erikj@459: AC_DEFUN([BOOTJDK_WIN_FIX_PATH], erikj@459: [ erikj@459: if test "x$OPENJDK_BUILD_OS" = "xwindows"; then erikj@459: AC_PATH_PROG(CYGPATH, cygpath) erikj@459: tmp="[$]$1" erikj@459: # Convert to C:/ mixed style path without spaces. erikj@459: tmp=`$CYGPATH -s -m "$tmp"` erikj@459: $1="$tmp" erikj@459: fi erikj@459: ]) erikj@459: erikj@459: AC_DEFUN([BOOTJDK_MISSING_ERROR], erikj@459: [ erikj@459: AC_MSG_NOTICE([This might be fixed by explicitely setting --with-boot-jdk]) erikj@459: AC_MSG_ERROR([Cannot continue]) erikj@459: ]) erikj@459: erikj@459: ############################################################################### erikj@459: # erikj@459: # We need a Boot JDK to bootstrap the build. erikj@459: # erikj@459: erikj@459: AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK], erikj@459: [ erikj@459: BOOT_JDK_FOUND=no erikj@459: AC_ARG_WITH(boot-jdk, [AS_HELP_STRING([--with-boot-jdk], erikj@459: [path to Boot JDK (used to bootstrap build) @<:@probed@:>@])]) erikj@459: erikj@459: if test "x$with_boot_jdk" != x; then erikj@459: BOOT_JDK=$with_boot_jdk erikj@459: BOOT_JDK_FOUND=yes erikj@459: fi erikj@459: if test "x$BOOT_JDK_FOUND" = xno; then erikj@459: BDEPS_CHECK_MODULE(BOOT_JDK, boot-jdk, xxx, [BOOT_JDK_FOUND=yes], [BOOT_JDK_FOUND=no]) erikj@459: fi erikj@459: erikj@459: if test "x$BOOT_JDK_FOUND" = xno; then erikj@459: if test "x$JAVA_HOME" != x; then erikj@459: if test ! -d "$JAVA_HOME"; then erikj@459: AC_MSG_NOTICE([Your JAVA_HOME points to a non-existing directory!]) erikj@459: BOOTJDK_MISSING_ERROR erikj@459: fi erikj@459: # Aha, the user has set a JAVA_HOME erikj@459: # let us use that as the Boot JDK. erikj@459: BOOT_JDK="$JAVA_HOME" erikj@459: BOOT_JDK_FOUND=yes erikj@459: # To be on the safe side, lets check that it is a JDK. erikj@459: if test -x "$BOOT_JDK/bin/javac" && test -x "$BOOT_JDK/bin/java"; then erikj@459: JAVAC="$BOOT_JDK/bin/javac" erikj@459: JAVA="$BOOT_JDK/bin/java" erikj@459: BOOT_JDK_FOUND=yes erikj@459: else erikj@459: 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: BOOTJDK_MISSING_ERROR erikj@459: fi erikj@459: fi erikj@459: fi erikj@459: erikj@459: if test "x$BOOT_JDK_FOUND" = xno; then erikj@459: AC_PATH_PROG(JAVAC_CHECK, javac) erikj@459: AC_PATH_PROG(JAVA_CHECK, java) erikj@459: BINARY="$JAVAC_CHECK" erikj@459: if test "x$JAVAC_CHECK" = x; then erikj@459: BINARY="$JAVA_CHECK" erikj@459: fi erikj@459: if test "x$BINARY" != x; then erikj@459: # So there is a java(c) binary, it might be part of a JDK. erikj@459: # Lets find the JDK/JRE directory by following symbolic links. erikj@459: # Linux/GNU systems often have links from /usr/bin/java to erikj@459: # /etc/alternatives/java to the real JDK binary. erikj@459: WHICHCMD_SPACESAFE(BINARY,[path to javac]) erikj@459: REMOVE_SYMBOLIC_LINKS(BINARY) erikj@459: BOOT_JDK=`dirname $BINARY` erikj@459: BOOT_JDK=`cd $BOOT_JDK/..; pwd` erikj@459: if test -x $BOOT_JDK/bin/javac && test -x $BOOT_JDK/bin/java; then erikj@459: JAVAC=$BOOT_JDK/bin/javac erikj@459: JAVA=$BOOT_JDK/bin/java erikj@459: BOOT_JDK_FOUND=yes erikj@459: fi erikj@459: fi erikj@459: fi erikj@459: erikj@459: if test "x$BOOT_JDK_FOUND" = xno; then erikj@459: # Try the MacOSX way. erikj@459: if test -x /usr/libexec/java_home; then erikj@459: BOOT_JDK=`/usr/libexec/java_home` erikj@459: if test -x $BOOT_JDK/bin/javac && test -x $BOOT_JDK/bin/java; then erikj@459: JAVAC=$BOOT_JDK/bin/javac erikj@459: JAVA=$BOOT_JDK/bin/java erikj@459: BOOT_JDK_FOUND=yes erikj@459: fi erikj@459: fi erikj@459: fi erikj@459: erikj@459: if test "x$BOOT_JDK_FOUND" = xno; then erikj@459: AC_PATH_PROG(JAVA_CHECK, java) erikj@459: if test "x$JAVA_CHECK" != x; then erikj@459: # There is a java in the path. But apparently we have not found a javac erikj@459: # in the path, since that would have been tested earlier. erikj@459: if test "x$OPENJDK_TARGET_OS" = xwindows; then erikj@459: # Now if this is a windows platform. The default installation of a JDK erikj@459: # actually puts the JRE in the path and keeps the JDK out of the path! erikj@459: # Go look in the default installation location. erikj@459: BOOT_JDK=/cygdrive/c/Program\ Files/Java/`ls /cygdrive/c/Program\ Files/Java | grep jdk | sort -r | head --lines 1` erikj@459: if test -d "$BOOT_JDK"; then erikj@459: BOOT_JDK_FOUND=yes erikj@459: fi erikj@459: fi erikj@459: if test "x$BOOT_JDK_FOUND" = xno; then erikj@459: HELP_MSG_MISSING_DEPENDENCY([openjdk]) erikj@459: 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: BOOTJDK_MISSING_ERROR erikj@459: fi erikj@459: else erikj@459: HELP_MSG_MISSING_DEPENDENCY([openjdk]) erikj@459: AC_MSG_NOTICE([Could not find a JDK. $HELP_MSG]) erikj@459: BOOTJDK_MISSING_ERROR erikj@459: fi erikj@459: fi erikj@459: erikj@459: BOOTJDK_WIN_FIX_PATH(BOOT_JDK) erikj@459: erikj@459: # Now see if we can find the rt.jar, or its nearest equivalent. erikj@459: BOOT_RTJAR="$BOOT_JDK/jre/lib/rt.jar" erikj@459: SPACESAFE(BOOT_RTJAR,[the path to the Boot JDK rt.jar (or nearest equivalent)]) erikj@459: erikj@459: BOOT_TOOLSJAR="$BOOT_JDK/lib/tools.jar" erikj@459: SPACESAFE(BOOT_TOOLSJAR,[the path to the Boot JDK tools.jar (or nearest equivalent)]) erikj@459: erikj@459: if test ! -f $BOOT_RTJAR; then erikj@459: # On MacOSX it is called classes.jar erikj@459: BOOT_RTJAR=$BOOT_JDK/../Classes/classes.jar erikj@459: if test ! -f $BOOT_RTJAR; then erikj@459: AC_MSG_NOTICE([Cannot find the rt.jar or its equivalent!]) erikj@459: AC_MSG_NOTICE([This typically means that configure failed to automatically find a suitable Boot JDK]) erikj@459: BOOTJDK_MISSING_ERROR erikj@459: fi erikj@459: # Remove the .. erikj@459: BOOT_RTJAR="`cd ${BOOT_RTJAR%/*} && pwd`/${BOOT_RTJAR##*/}" erikj@459: # The tools.jar is part of classes.jar erikj@459: BOOT_TOOLSJAR="$BOOT_RTJAR" erikj@459: fi erikj@459: erikj@459: AC_SUBST(BOOT_JDK) erikj@459: AC_SUBST(BOOT_RTJAR) erikj@459: AC_SUBST(BOOT_TOOLSJAR) erikj@459: AC_MSG_CHECKING([for Boot JDK]) erikj@459: AC_MSG_RESULT([$BOOT_JDK]) erikj@459: AC_MSG_CHECKING([for Boot rt.jar]) erikj@459: AC_MSG_RESULT([$BOOT_RTJAR]) erikj@459: AC_MSG_CHECKING([for Boot tools.jar]) erikj@459: AC_MSG_RESULT([$BOOT_TOOLSJAR]) erikj@459: erikj@459: # Use the java tool from the Boot JDK. erikj@459: AC_MSG_CHECKING([for java in Boot JDK]) erikj@459: JAVA=$BOOT_JDK/bin/java erikj@459: if test ! -x $JAVA; then erikj@459: AC_MSG_NOTICE([Could not find a working java]) erikj@459: BOOTJDK_MISSING_ERROR erikj@459: fi erikj@459: BOOT_JDK_VERSION=`$JAVA -version 2>&1 | head -n 1` erikj@459: AC_MSG_RESULT([yes $BOOT_JDK_VERSION]) erikj@459: AC_SUBST(JAVA) erikj@459: erikj@459: # Extra M4 quote needed to protect [] in grep expression. erikj@459: [FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep '\"1\.[78]\.'`] erikj@459: if test "x$FOUND_VERSION_78" = x; then erikj@459: HELP_MSG_MISSING_DEPENDENCY([openjdk]) erikj@459: AC_MSG_NOTICE([Your boot-jdk must be version 7 or 8. $HELP_MSG]) erikj@459: BOOTJDK_MISSING_ERROR erikj@459: fi erikj@459: erikj@459: # When compiling code to be executed by the Boot JDK, force jdk7 compatibility. erikj@459: BOOT_JDK_SOURCETARGET="-source 7 -target 7" erikj@459: AC_SUBST(BOOT_JDK_SOURCETARGET) erikj@459: erikj@459: # Use the javac tool from the Boot JDK. erikj@459: AC_MSG_CHECKING([for javac in Boot JDK]) erikj@459: JAVAC=$BOOT_JDK/bin/javac erikj@459: if test ! -x $JAVAC; then erikj@459: AC_MSG_ERROR([Could not find a working javac]) erikj@459: fi erikj@459: AC_MSG_RESULT(yes) erikj@459: AC_SUBST(JAVAC) erikj@459: AC_SUBST(JAVAC_FLAGS) erikj@459: erikj@459: # Use the javah tool from the Boot JDK. erikj@459: AC_MSG_CHECKING([for javah in Boot JDK]) erikj@459: JAVAH=$BOOT_JDK/bin/javah erikj@459: if test ! -x $JAVAH; then erikj@459: AC_MSG_NOTICE([Could not find a working javah]) erikj@459: BOOTJDK_MISSING_ERROR erikj@459: fi erikj@459: AC_MSG_RESULT(yes) erikj@459: AC_SUBST(JAVAH) erikj@459: erikj@459: # Use the jar tool from the Boot JDK. erikj@459: AC_MSG_CHECKING([for jar in Boot JDK]) erikj@459: JAR=$BOOT_JDK/bin/jar erikj@459: if test ! -x $JAR; then erikj@459: AC_MSG_NOTICE([Could not find a working jar]) erikj@459: BOOTJDK_MISSING_ERROR erikj@459: fi erikj@459: AC_SUBST(JAR) erikj@459: AC_MSG_RESULT(yes) erikj@459: erikj@459: # Use the rmic tool from the Boot JDK. erikj@459: AC_MSG_CHECKING([for rmic in Boot JDK]) erikj@459: RMIC=$BOOT_JDK/bin/rmic erikj@459: if test ! -x $RMIC; then erikj@459: AC_MSG_NOTICE([Could not find a working rmic]) erikj@459: BOOTJDK_MISSING_ERROR erikj@459: fi erikj@459: AC_SUBST(RMIC) erikj@459: AC_MSG_RESULT(yes) erikj@459: erikj@459: # Use the native2ascii tool from the Boot JDK. erikj@459: AC_MSG_CHECKING([for native2ascii in Boot JDK]) erikj@459: NATIVE2ASCII=$BOOT_JDK/bin/native2ascii erikj@459: if test ! -x $NATIVE2ASCII; then erikj@459: AC_MSG_NOTICE([Could not find a working native2ascii]) erikj@459: BOOTJDK_MISSING_ERROR erikj@459: fi erikj@459: AC_MSG_RESULT(yes) erikj@459: AC_SUBST(NATIVE2ASCII) erikj@459: ]) erikj@459: erikj@459: AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK_ARGUMENTS], erikj@459: [ erikj@459: ############################################################################## erikj@459: # erikj@459: # Specify options for anything that is run with the Boot JDK. erikj@459: # erikj@459: AC_ARG_WITH(boot-jdk-jvmargs, [AS_HELP_STRING([--with-boot-jdk-jvmargs], erikj@459: [specify JVM arguments to be passed to all invocations of the Boot JDK, overriding the default values, erikj@459: e.g --with-boot-jdk-jvmargs="-Xmx8G -enableassertions"])]) erikj@459: erikj@459: if test "x$with_boot_jdk_jvmargs" = x; then erikj@459: # Not all JVM:s accept the same arguments on the command line. erikj@459: # OpenJDK specific increase in thread stack for JDK build, erikj@459: # well more specifically, when running javac. erikj@459: if test "x$BUILD_NUM_BITS" = x32; then erikj@459: STACK_SIZE=768 erikj@459: else erikj@459: # Running Javac on a JVM on a 64-bit machine, the stack takes more space erikj@459: # since 64-bit pointers are pushed on the stach. Apparently, we need erikj@459: # to increase the stack space when javacing the JDK.... erikj@459: STACK_SIZE=1536 erikj@459: fi erikj@459: erikj@459: # Minimum amount of heap memory. erikj@459: ADD_JVM_ARG_IF_OK([-Xms64M],boot_jdk_jvmargs,[$JAVA]) erikj@459: if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then erikj@459: # Why does macosx need more heap? Its the huge JDK batch. erikj@459: ADD_JVM_ARG_IF_OK([-Xmx1600M],boot_jdk_jvmargs,[$JAVA]) erikj@459: else erikj@459: ADD_JVM_ARG_IF_OK([-Xmx1100M],boot_jdk_jvmargs,[$JAVA]) erikj@459: fi erikj@459: # When is adding -client something that speeds up the JVM? erikj@459: # ADD_JVM_ARG_IF_OK([-client],boot_jdk_jvmargs,[$JAVA]) erikj@459: ADD_JVM_ARG_IF_OK([-XX:PermSize=32m],boot_jdk_jvmargs,[$JAVA]) erikj@459: ADD_JVM_ARG_IF_OK([-XX:MaxPermSize=160m],boot_jdk_jvmargs,[$JAVA]) erikj@459: ADD_JVM_ARG_IF_OK([-XX:ThreadStackSize=$STACK_SIZE],boot_jdk_jvmargs,[$JAVA]) erikj@459: # Disable special log output when a debug build is used as Boot JDK... erikj@459: ADD_JVM_ARG_IF_OK([-XX:-PrintVMOptions -XX:-UnlockDiagnosticVMOptions -XX:-LogVMOutput],boot_jdk_jvmargs,[$JAVA]) erikj@459: fi erikj@459: erikj@459: AC_SUBST(BOOT_JDK_JVMARGS, $boot_jdk_jvmargs) erikj@459: ])