提交 5f981024 编写于 作者: D duke

Merge

......@@ -244,3 +244,4 @@ a4afb0a8d55ef75aef5b0d77b434070468fb89f8 jdk8-b117
cd3825b2983045784d6fc6d1729c799b08215752 jdk8-b120
1e1f86d5d4e22c15a9bf9f1581acddb8c59abae2 jdk9-b00
50669e45cec4491de0d921d3118a3fe2e767020a jdk9-b01
135f0c7af57ebace31383d8877f47e32172759ff jdk9-b02
......@@ -236,35 +236,119 @@ AC_DEFUN_ONCE([BASIC_INIT],
# Test that variable $1 denoting a program is not empty. If empty, exit with an error.
# $1: variable to check
# $2: executable name to print in warning (optional)
AC_DEFUN([BASIC_CHECK_NONEMPTY],
[
if test "x[$]$1" = x; then
if test "x$2" = x; then
PROG_NAME=translit($1,A-Z,a-z)
AC_MSG_ERROR([Could not find required tool for $1])
fi
])
# Check that there are no unprocessed overridden variables left.
# If so, they are an incorrect argument and we will exit with an error.
AC_DEFUN([BASIC_CHECK_LEFTOVER_OVERRIDDEN],
[
if test "x$CONFIGURE_OVERRIDDEN_VARIABLES" != x; then
# Replace the separating ! with spaces before presenting for end user.
unknown_variables=${CONFIGURE_OVERRIDDEN_VARIABLES//!/ }
AC_MSG_WARN([The following variables might be unknown to configure: $unknown_variables])
fi
])
# Setup a tool for the given variable. If correctly specified by the user,
# use that value, otherwise search for the tool using the supplied code snippet.
# $1: variable to set
# $2: code snippet to call to look for the tool
AC_DEFUN([BASIC_SETUP_TOOL],
[
# Publish this variable in the help.
AC_ARG_VAR($1, [Override default value for $1])
if test "x[$]$1" = x; then
# The variable is not set by user, try to locate tool using the code snippet
$2
else
# The variable is set, but is it from the command line or the environment?
# Try to remove the string !$1! from our list.
try_remove_var=${CONFIGURE_OVERRIDDEN_VARIABLES//!$1!/}
if test "x$try_remove_var" = "x$CONFIGURE_OVERRIDDEN_VARIABLES"; then
# If it failed, the variable was not from the command line. Ignore it,
# but warn the user (except for BASH, which is always set by the calling BASH).
if test "x$1" != xBASH; then
AC_MSG_WARN([Ignoring value of $1 from the environment. Use command line variables instead.])
fi
# Try to locate tool using the code snippet
$2
else
PROG_NAME=$2
# If it succeeded, then it was overridden by the user. We will use it
# for the tool.
# First remove it from the list of overridden variables, so we can test
# for unknown variables in the end.
CONFIGURE_OVERRIDDEN_VARIABLES="$try_remove_var"
# Check if the provided tool contains a complete path.
tool_specified="[$]$1"
tool_basename="${tool_specified##*/}"
if test "x$tool_basename" = "x$tool_specified"; then
# A command without a complete path is provided, search $PATH.
AC_MSG_NOTICE([Will search for user supplied tool $1=$tool_basename])
AC_PATH_PROG($1, $tool_basename)
if test "x[$]$1" = x; then
AC_MSG_ERROR([User supplied tool $tool_basename could not be found])
fi
else
# Otherwise we believe it is a complete path. Use it as it is.
AC_MSG_NOTICE([Will use user supplied tool $1=$tool_specified])
AC_MSG_CHECKING([for $1])
if test ! -x "$tool_specified"; then
AC_MSG_RESULT([not found])
AC_MSG_ERROR([User supplied tool $1=$tool_specified does not exist or is not executable])
fi
AC_MSG_RESULT([$tool_specified])
fi
fi
AC_MSG_NOTICE([Could not find $PROG_NAME!])
AC_MSG_ERROR([Cannot continue])
fi
])
# Does AC_PATH_PROG followed by BASIC_CHECK_NONEMPTY.
# Arguments as AC_PATH_PROG:
# Call BASIC_SETUP_TOOL with AC_PATH_PROGS to locate the tool
# $1: variable to set
# $2: executable name to look for
AC_DEFUN([BASIC_REQUIRE_PROG],
# $2: executable name (or list of names) to look for
AC_DEFUN([BASIC_PATH_PROGS],
[
AC_PATH_PROGS($1, $2)
BASIC_CHECK_NONEMPTY($1, $2)
BASIC_SETUP_TOOL($1, [AC_PATH_PROGS($1, $2)])
])
# Call BASIC_SETUP_TOOL with AC_CHECK_TOOLS to locate the tool
# $1: variable to set
# $2: executable name (or list of names) to look for
AC_DEFUN([BASIC_CHECK_TOOLS],
[
BASIC_SETUP_TOOL($1, [AC_CHECK_TOOLS($1, $2)])
])
# Like BASIC_PATH_PROGS but fails if no tool was found.
# $1: variable to set
# $2: executable name (or list of names) to look for
AC_DEFUN([BASIC_REQUIRE_PROGS],
[
BASIC_PATH_PROGS($1, $2)
BASIC_CHECK_NONEMPTY($1)
])
# Like BASIC_SETUP_TOOL but fails if no tool was found.
# $1: variable to set
# $2: autoconf macro to call to look for the special tool
AC_DEFUN([BASIC_REQUIRE_SPECIAL],
[
BASIC_SETUP_TOOL($1, [$2])
BASIC_CHECK_NONEMPTY($1)
])
# Setup the most fundamental tools that relies on not much else to set up,
# but is used by much of the early bootstrap code.
AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS],
[
# Start with tools that do not need have cross compilation support
# and can be expected to be found in the default PATH. These tools are
# used by configure. Nor are these tools expected to be found in the
......@@ -272,57 +356,50 @@ AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS],
# needed to download the devkit.
# First are all the simple required tools.
BASIC_REQUIRE_PROG(BASENAME, basename)
BASIC_REQUIRE_PROG(BASH, bash)
BASIC_REQUIRE_PROG(CAT, cat)
BASIC_REQUIRE_PROG(CHMOD, chmod)
BASIC_REQUIRE_PROG(CMP, cmp)
BASIC_REQUIRE_PROG(COMM, comm)
BASIC_REQUIRE_PROG(CP, cp)
BASIC_REQUIRE_PROG(CPIO, cpio)
BASIC_REQUIRE_PROG(CUT, cut)
BASIC_REQUIRE_PROG(DATE, date)
BASIC_REQUIRE_PROG(DIFF, [gdiff diff])
BASIC_REQUIRE_PROG(DIRNAME, dirname)
BASIC_REQUIRE_PROG(ECHO, echo)
BASIC_REQUIRE_PROG(EXPR, expr)
BASIC_REQUIRE_PROG(FILE, file)
BASIC_REQUIRE_PROG(FIND, find)
BASIC_REQUIRE_PROG(HEAD, head)
BASIC_REQUIRE_PROG(LN, ln)
BASIC_REQUIRE_PROG(LS, ls)
BASIC_REQUIRE_PROG(MKDIR, mkdir)
BASIC_REQUIRE_PROG(MKTEMP, mktemp)
BASIC_REQUIRE_PROG(MV, mv)
BASIC_REQUIRE_PROG(PRINTF, printf)
BASIC_REQUIRE_PROG(RM, rm)
BASIC_REQUIRE_PROG(SH, sh)
BASIC_REQUIRE_PROG(SORT, sort)
BASIC_REQUIRE_PROG(TAIL, tail)
BASIC_REQUIRE_PROG(TAR, tar)
BASIC_REQUIRE_PROG(TEE, tee)
BASIC_REQUIRE_PROG(TOUCH, touch)
BASIC_REQUIRE_PROG(TR, tr)
BASIC_REQUIRE_PROG(UNAME, uname)
BASIC_REQUIRE_PROG(UNIQ, uniq)
BASIC_REQUIRE_PROG(WC, wc)
BASIC_REQUIRE_PROG(WHICH, which)
BASIC_REQUIRE_PROG(XARGS, xargs)
BASIC_REQUIRE_PROGS(BASENAME, basename)
BASIC_REQUIRE_PROGS(BASH, bash)
BASIC_REQUIRE_PROGS(CAT, cat)
BASIC_REQUIRE_PROGS(CHMOD, chmod)
BASIC_REQUIRE_PROGS(CMP, cmp)
BASIC_REQUIRE_PROGS(COMM, comm)
BASIC_REQUIRE_PROGS(CP, cp)
BASIC_REQUIRE_PROGS(CPIO, cpio)
BASIC_REQUIRE_PROGS(CUT, cut)
BASIC_REQUIRE_PROGS(DATE, date)
BASIC_REQUIRE_PROGS(DIFF, [gdiff diff])
BASIC_REQUIRE_PROGS(DIRNAME, dirname)
BASIC_REQUIRE_PROGS(ECHO, echo)
BASIC_REQUIRE_PROGS(EXPR, expr)
BASIC_REQUIRE_PROGS(FILE, file)
BASIC_REQUIRE_PROGS(FIND, find)
BASIC_REQUIRE_PROGS(HEAD, head)
BASIC_REQUIRE_PROGS(LN, ln)
BASIC_REQUIRE_PROGS(LS, ls)
BASIC_REQUIRE_PROGS(MKDIR, mkdir)
BASIC_REQUIRE_PROGS(MKTEMP, mktemp)
BASIC_REQUIRE_PROGS(MV, mv)
BASIC_REQUIRE_PROGS(NAWK, [nawk gawk awk])
BASIC_REQUIRE_PROGS(PRINTF, printf)
BASIC_REQUIRE_PROGS(RM, rm)
BASIC_REQUIRE_PROGS(SH, sh)
BASIC_REQUIRE_PROGS(SORT, sort)
BASIC_REQUIRE_PROGS(TAIL, tail)
BASIC_REQUIRE_PROGS(TAR, tar)
BASIC_REQUIRE_PROGS(TEE, tee)
BASIC_REQUIRE_PROGS(TOUCH, touch)
BASIC_REQUIRE_PROGS(TR, tr)
BASIC_REQUIRE_PROGS(UNAME, uname)
BASIC_REQUIRE_PROGS(UNIQ, uniq)
BASIC_REQUIRE_PROGS(WC, wc)
BASIC_REQUIRE_PROGS(WHICH, which)
BASIC_REQUIRE_PROGS(XARGS, xargs)
# Then required tools that require some special treatment.
AC_PROG_AWK
BASIC_CHECK_NONEMPTY(AWK)
AC_PROG_GREP
BASIC_CHECK_NONEMPTY(GREP)
AC_PROG_EGREP
BASIC_CHECK_NONEMPTY(EGREP)
AC_PROG_FGREP
BASIC_CHECK_NONEMPTY(FGREP)
AC_PROG_SED
BASIC_CHECK_NONEMPTY(SED)
AC_PATH_PROGS(NAWK, [nawk gawk awk])
BASIC_CHECK_NONEMPTY(NAWK)
BASIC_REQUIRE_SPECIAL(AWK, [AC_PROG_AWK])
BASIC_REQUIRE_SPECIAL(GREP, [AC_PROG_GREP])
BASIC_REQUIRE_SPECIAL(EGREP, [AC_PROG_EGREP])
BASIC_REQUIRE_SPECIAL(FGREP, [AC_PROG_FGREP])
BASIC_REQUIRE_SPECIAL(SED, [AC_PROG_SED])
# Always force rm.
RM="$RM -f"
......@@ -332,10 +409,10 @@ AC_DEFUN_ONCE([BASIC_SETUP_FUNDAMENTAL_TOOLS],
THEPWDCMD=pwd
# These are not required on all platforms
AC_PATH_PROG(CYGPATH, cygpath)
AC_PATH_PROG(READLINK, readlink)
AC_PATH_PROG(DF, df)
AC_PATH_PROG(SETFILE, SetFile)
BASIC_PATH_PROGS(CYGPATH, cygpath)
BASIC_PATH_PROGS(READLINK, [greadlink readlink])
BASIC_PATH_PROGS(DF, df)
BASIC_PATH_PROGS(SETFILE, SetFile)
])
# Setup basic configuration paths, and platform-specific stuff related to PATHs.
......@@ -622,26 +699,26 @@ AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS],
# These tools might not be installed by default,
# need hint on how to install them.
BASIC_REQUIRE_PROG(UNZIP, unzip)
BASIC_REQUIRE_PROG(ZIP, zip)
BASIC_REQUIRE_PROGS(UNZIP, unzip)
BASIC_REQUIRE_PROGS(ZIP, zip)
# Non-required basic tools
AC_PATH_PROG(LDD, ldd)
BASIC_PATH_PROGS(LDD, ldd)
if test "x$LDD" = "x"; then
# List shared lib dependencies is used for
# debug output and checking for forbidden dependencies.
# We can build without it.
LDD="true"
fi
AC_PATH_PROG(OTOOL, otool)
BASIC_PATH_PROGS(OTOOL, otool)
if test "x$OTOOL" = "x"; then
OTOOL="true"
fi
AC_PATH_PROGS(READELF, [readelf greadelf])
AC_PATH_PROG(HG, hg)
AC_PATH_PROG(STAT, stat)
AC_PATH_PROG(TIME, time)
BASIC_PATH_PROGS(READELF, [greadelf readelf])
BASIC_PATH_PROGS(HG, hg)
BASIC_PATH_PROGS(STAT, stat)
BASIC_PATH_PROGS(TIME, time)
# Check if it's GNU time
IS_GNU_TIME=`$TIME --version 2>&1 | $GREP 'GNU time'`
if test "x$IS_GNU_TIME" != x; then
......@@ -652,13 +729,13 @@ AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS],
AC_SUBST(IS_GNU_TIME)
if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
BASIC_REQUIRE_PROG(COMM, comm)
BASIC_REQUIRE_PROGS(COMM, comm)
fi
if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
BASIC_REQUIRE_PROG(DSYMUTIL, dsymutil)
BASIC_REQUIRE_PROG(XATTR, xattr)
AC_PATH_PROG(CODESIGN, codesign)
BASIC_REQUIRE_PROGS(DSYMUTIL, dsymutil)
BASIC_REQUIRE_PROGS(XATTR, xattr)
BASIC_PATH_PROGS(CODESIGN, codesign)
if test "x$CODESIGN" != "x"; then
# Verify that the openjdk_codesign certificate is present
AC_MSG_CHECKING([if openjdk_codesign certificate is present])
......@@ -720,6 +797,9 @@ AC_DEFUN_ONCE([BASIC_CHECK_SRC_PERMS],
AC_DEFUN_ONCE([BASIC_TEST_USABILITY_ISSUES],
[
# Did user specify any unknown variables?
BASIC_CHECK_LEFTOVER_OVERRIDDEN
AC_MSG_CHECKING([if build directory is on local disk])
BASIC_CHECK_DIR_ON_LOCAL_DISK($OUTPUT_ROOT,
[OUTPUT_DIR_IS_LOCAL="yes"],
......@@ -738,12 +818,4 @@ AC_DEFUN_ONCE([BASIC_TEST_USABILITY_ISSUES],
else
IS_RECONFIGURE=no
fi
if test -e $SRC_ROOT/build/.hide-configure-performance-hints; then
HIDE_PERFORMANCE_HINTS=yes
else
HIDE_PERFORMANCE_HINTS=no
# Hide it the next time around...
$TOUCH $SRC_ROOT/build/.hide-configure-performance-hints > /dev/null 2>&1
fi
])
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
......@@ -23,6 +23,34 @@
# questions.
#
########################################################################
# This file handles detection of the Boot JDK. The Boot JDK detection
# process has been developed as a response to solve a complex real-world
# problem. Initially, it was simple, but it has grown as platform after
# platform, idiosyncracy after idiosyncracy has been supported.
#
# The basic idea is this:
# 1) You need an acceptable *) JDK to use as a Boot JDK
# 2) There are several ways to locate a JDK, that are mostly platform
# dependent **)
# 3) You can have multiple JDKs installed
# 4) If possible, configure should try to dig out an acceptable JDK
# automatically, without having to resort to command-line options
#
# *) acceptable means e.g. JDK7 for building JDK8, a complete JDK (with
# javac) and not a JRE, etc.
#
# **) On Windows we typically use a well-known path.
# On MacOSX we typically use the tool java_home.
# On Linux we typically find javac in the $PATH, and then follow a
# chain of symlinks that often ends up in a real JDK.
#
# This leads to the code where we check in different ways to locate a
# JDK, and if one is found, check if it is acceptable. If not, we print
# our reasons for rejecting it (useful when debugging non-working
# configure situations) and continue checking the next one.
########################################################################
# Execute the check given as argument, and verify the result
# If the Boot JDK was previously found, do nothing
# $1 A command line (typically autoconf macro) to execute
......@@ -54,10 +82,10 @@ AC_DEFUN([BOOTJDK_DO_CHECK],
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
# Extra M4 quote needed to protect [] in grep expression.
[FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep '\"1\.[78]\.'`]
if test "x$FOUND_VERSION_78" = x; then
[FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[789]\.'`]
if test "x$FOUND_CORRECT_VERSION" = x; then
AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring])
AC_MSG_NOTICE([(Your Boot JDK must be version 7 or 8)])
AC_MSG_NOTICE([(Your Boot JDK must be version 7, 8 or 9)])
BOOT_JDK_FOUND=no
else
# We're done! :-)
......@@ -136,12 +164,26 @@ AC_DEFUN([BOOTJDK_CHECK_JAVA_IN_PATH_IS_SYMLINK],
])
# Test: Is there a /usr/libexec/java_home? (Typically on MacOSX)
# $1: Argument to the java_home binary (optional)
AC_DEFUN([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME],
[
if test -x /usr/libexec/java_home; then
BOOT_JDK=`/usr/libexec/java_home`
BOOT_JDK=`/usr/libexec/java_home $1`
BOOT_JDK_FOUND=maybe
AC_MSG_NOTICE([Found potential Boot JDK using /usr/libexec/java_home])
AC_MSG_NOTICE([Found potential Boot JDK using /usr/libexec/java_home $1])
fi
])
# Test: On MacOS X, can we find a boot jdk using /usr/libexec/java_home?
AC_DEFUN([BOOTJDK_CHECK_MACOSX_JAVA_LOCATOR],
[
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
# First check at user selected default
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME()])
# If that did not work out (e.g. too old), try explicit versions instead
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME([-v 1.9])])
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME([-v 1.8])])
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME([-v 1.7])])
fi
])
......@@ -201,14 +243,19 @@ AC_DEFUN([BOOTJDK_CHECK_WELL_KNOWN_LOCATIONS],
# $2 = name of binary
AC_DEFUN([BOOTJDK_CHECK_TOOL_IN_BOOTJDK],
[
AC_MSG_CHECKING([for $2 in Boot JDK])
$1=$BOOT_JDK/bin/$2
if test ! -x [$]$1; then
AC_MSG_RESULT(not found)
AC_MSG_NOTICE([Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk])
AC_MSG_ERROR([Could not find $2 in the Boot JDK])
fi
AC_MSG_RESULT(ok)
# Use user overridden value if available, otherwise locate tool in the Boot JDK.
BASIC_SETUP_TOOL($1,
[
AC_MSG_CHECKING([for $2 in Boot JDK])
$1=$BOOT_JDK/bin/$2
if test ! -x [$]$1; then
AC_MSG_RESULT(not found)
AC_MSG_NOTICE([Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk])
AC_MSG_ERROR([Could not find $2 in the Boot JDK])
fi
AC_MSG_RESULT(ok)
AC_SUBST($1)
])
])
###############################################################################
......@@ -238,12 +285,12 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK],
# Test: Is bootjdk available from builddeps?
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_BUILDDEPS])
# Test: On MacOS X, can we find a boot jdk using /usr/libexec/java_home?
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_MACOSX_JAVA_LOCATOR])
# Test: Is $JAVA_HOME set?
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_JAVA_HOME])
# Test: Is there a /usr/libexec/java_home? (Typically on MacOSX)
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME])
# Test: Is there a java or javac in the PATH, which is a symlink to the JDK?
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_JAVA_IN_PATH_IS_SYMLINK])
......@@ -275,13 +322,12 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK],
AC_SUBST(BOOT_JDK)
# Setup tools from the Boot JDK.
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVA,java)
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAC,javac)
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAH,javah)
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAP,javap)
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAR,jar)
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(RMIC,rmic)
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(NATIVE2ASCII,native2ascii)
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVA, java)
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAC, javac)
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAH, javah)
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAR, jar)
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(NATIVE2ASCII, native2ascii)
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JARSIGNER, jarsigner)
# Finally, set some other options...
......@@ -316,7 +362,7 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK_ARGUMENTS],
# Minimum amount of heap memory.
ADD_JVM_ARG_IF_OK([-Xms64M],boot_jdk_jvmargs,[$JAVA])
if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
if test "x$OPENJDK_TARGET_OS" = "xmacosx" || test "x$OPENJDK_TARGET_CPU" = "xppc64" ; then
# Why does macosx need more heap? Its the huge JDK batch.
ADD_JVM_ARG_IF_OK([-Xmx1600M],boot_jdk_jvmargs,[$JAVA])
else
......
......@@ -60,4 +60,20 @@ if test $? = 0; then
esac
fi
# Test and fix architecture string on AIX
# On AIX 'config.guess' returns 'powerpc' as architecture but 'powerpc' is
# implicitely handled as 32-bit architecture in 'platform.m4' so we check
# for the kernel mode rewrite it to 'powerpc64' if we'Re running in 64-bit mode.
# The check could also be done with `/usr/sbin/prtconf | grep "Kernel Type" | grep "64-bit"`
echo $OUT | grep powerpc-ibm-aix > /dev/null 2> /dev/null
if test $? = 0; then
if [ -x /bin/getconf ] ; then
KERNEL_BITMODE=`getconf KERNEL_BITMODE`
if [ "$KERNEL_BITMODE" = "32" ]; then
KERNEL_BITMODE=""
fi
fi
OUT=powerpc$KERNEL_BITMODE`echo $OUT | sed -e 's/[^-]*//'`
fi
echo $OUT
......@@ -41,6 +41,9 @@ AC_DEFUN([BPERF_CHECK_CORES],
# Looks like a MacOSX system
NUM_CORES=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep 'Cores' | awk '{print [$]5}'`
FOUND_CORES=yes
elif test "x$OPENJDK_BUILD_OS" = xaix ; then
NUM_CORES=`/usr/sbin/prtconf | grep "^Number Of Processors" | awk '{ print [$]4 }'`
FOUND_CORES=yes
elif test -n "$NUMBER_OF_PROCESSORS"; then
# On windows, look in the env
NUM_CORES=$NUMBER_OF_PROCESSORS
......@@ -68,8 +71,8 @@ AC_DEFUN([BPERF_CHECK_MEMORY_SIZE],
MEMORY_SIZE=`expr $MEMORY_SIZE / 1024`
FOUND_MEM=yes
elif test -x /usr/sbin/prtconf; then
# Looks like a Solaris system
MEMORY_SIZE=`/usr/sbin/prtconf | grep "Memory size" | awk '{ print [$]3 }'`
# Looks like a Solaris or AIX system
MEMORY_SIZE=`/usr/sbin/prtconf | grep "^Memory [[Ss]]ize" | awk '{ print [$]3 }'`
FOUND_MEM=yes
elif test -x /usr/sbin/system_profiler; then
# Looks like a MacOSX system
......@@ -157,20 +160,28 @@ AC_DEFUN_ONCE([BPERF_SETUP_BUILD_JOBS],
AC_DEFUN([BPERF_SETUP_CCACHE],
[
AC_ARG_ENABLE([ccache],
[AS_HELP_STRING([--disable-ccache],
[disable using ccache to speed up recompilations @<:@enabled@:>@])],
[ENABLE_CCACHE=${enable_ccache}], [ENABLE_CCACHE=yes])
if test "x$ENABLE_CCACHE" = xyes; then
[AS_HELP_STRING([--enable-ccache],
[enable using ccache to speed up recompilations @<:@disabled@:>@])])
CCACHE=
AC_MSG_CHECKING([is ccache enabled])
ENABLE_CCACHE=$enable_ccache
if test "x$enable_ccache" = xyes; then
AC_MSG_RESULT([yes])
OLD_PATH="$PATH"
if test "x$TOOLS_DIR" != x; then
PATH=$TOOLS_DIR:$PATH
fi
AC_PATH_PROG(CCACHE, ccache)
BASIC_REQUIRE_PROGS(CCACHE, ccache)
CCACHE_STATUS="enabled"
PATH="$OLD_PATH"
elif test "x$enable_ccache" = xno; then
AC_MSG_RESULT([no, explicitly disabled])
elif test "x$enable_ccache" = x; then
AC_MSG_RESULT([no])
else
AC_MSG_CHECKING([for ccache])
AC_MSG_RESULT([explicitly disabled])
CCACHE=
AC_MSG_RESULT([unknown])
AC_MSG_ERROR([--enable-ccache does not accept any parameters])
fi
AC_SUBST(CCACHE)
......@@ -182,8 +193,11 @@ AC_DEFUN([BPERF_SETUP_CCACHE],
# When using a non home ccache directory, assume the use is to share ccache files
# with other users. Thus change the umask.
SET_CCACHE_DIR="CCACHE_DIR=$with_ccache_dir CCACHE_UMASK=002"
if test "x$CCACHE" = x; then
AC_MSG_WARN([--with-ccache-dir has no meaning when ccache is not enabled])
fi
fi
CCACHE_FOUND=""
if test "x$CCACHE" != x; then
BPERF_SETUP_CCACHE_USAGE
fi
......@@ -192,7 +206,6 @@ AC_DEFUN([BPERF_SETUP_CCACHE],
AC_DEFUN([BPERF_SETUP_CCACHE_USAGE],
[
if test "x$CCACHE" != x; then
CCACHE_FOUND="true"
# Only use ccache if it is 3.1.4 or later, which supports
# precompiled headers.
AC_MSG_CHECKING([if ccache supports precompiled headers])
......@@ -200,6 +213,7 @@ AC_DEFUN([BPERF_SETUP_CCACHE_USAGE],
if test "x$HAS_GOOD_CCACHE" = x; then
AC_MSG_RESULT([no, disabling ccache])
CCACHE=
CCACHE_STATUS="disabled"
else
AC_MSG_RESULT([yes])
AC_MSG_CHECKING([if C-compiler supports ccache precompiled headers])
......@@ -212,6 +226,7 @@ AC_DEFUN([BPERF_SETUP_CCACHE_USAGE],
else
AC_MSG_RESULT([no, disabling ccaching of precompiled headers])
CCACHE=
CCACHE_STATUS="disabled"
fi
fi
fi
......
......@@ -121,15 +121,23 @@ do
case $conf_option in
--openjdk-target=*)
conf_openjdk_target=`expr "X$conf_option" : '[^=]*=\(.*\)'`
continue ;;
;;
--debug-configure)
if test "x$conf_debug_configure" != xrecursive; then
conf_debug_configure=true
export conf_debug_configure
fi
continue ;;
;;
[^-]*=*)
# Add name of variable to CONFIGURE_OVERRIDDEN_VARIABLES list inside !...!.
conf_env_var=`expr "x$conf_option" : 'x\([^=]*\)='`
CONFIGURE_OVERRIDDEN_VARIABLES="$CONFIGURE_OVERRIDDEN_VARIABLES!$conf_env_var!"
# ... and then process argument as usual
conf_processed_arguments=("${conf_processed_arguments[@]}" "$conf_option")
;;
*)
conf_processed_arguments=("${conf_processed_arguments[@]}" "$conf_option") ;;
conf_processed_arguments=("${conf_processed_arguments[@]}" "$conf_option")
;;
esac
case $conf_option in
......@@ -212,6 +220,9 @@ Additional (non-autoconf) OpenJDK Options:
Please be aware that, when cross-compiling, the OpenJDK configure script will
generally use 'target' where autoconf traditionally uses 'host'.
Also note that variables must be passed on the command line. Variables in the
environment will generally be ignored, unlike traditional autoconf scripts.
EOT
fi
else
......
......@@ -88,6 +88,7 @@ JDKOPT_SETUP_OPEN_OR_CUSTOM
# These are needed to be able to create a configuration name (and thus the output directory)
JDKOPT_SETUP_JDK_VARIANT
JDKOPT_SETUP_JVM_INTERPRETER
JDKOPT_SETUP_JVM_VARIANTS
JDKOPT_SETUP_DEBUG_LEVEL
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -52,8 +52,6 @@ AC_DEFUN([HELP_MSG_MISSING_DEPENDENCY],
pkgutil_help $MISSING_DEPENDENCY ;;
pkgadd)
pkgadd_help $MISSING_DEPENDENCY ;;
* )
break ;;
esac
if test "x$PKGHANDLER_COMMAND" != x; then
......@@ -92,8 +90,6 @@ http://www.freetype.org/
If you put the resulting build in \"C:\Program Files\GnuWin32\", it will be found automatically."
fi
;;
* )
break ;;
esac
}
......@@ -119,8 +115,6 @@ apt_help() {
PKGHANDLER_COMMAND="sudo apt-get install libX11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev" ;;
ccache)
PKGHANDLER_COMMAND="sudo apt-get install ccache" ;;
* )
break ;;
esac
}
......@@ -142,8 +136,6 @@ yum_help() {
PKGHANDLER_COMMAND="sudo yum install libXtst-devel libXt-devel libXrender-devel" ;;
ccache)
PKGHANDLER_COMMAND="sudo yum install ccache" ;;
* )
break ;;
esac
}
......@@ -163,22 +155,6 @@ AC_DEFUN_ONCE([HELP_PRINT_SUMMARY_AND_WARNINGS],
[
# Finally output some useful information to the user
if test "x$CCACHE_FOUND" != x; then
if test "x$HAS_GOOD_CCACHE" = x; then
CCACHE_STATUS="installed, but disabled (version older than 3.1.4)"
CCACHE_HELP_MSG="You have ccache installed, but it is a version prior to 3.1.4. Try upgrading."
else
CCACHE_STATUS="installed and in use"
fi
else
if test "x$GCC" = xyes; then
CCACHE_STATUS="not installed (consider installing)"
CCACHE_HELP_MSG="You do not have ccache installed. Try installing it."
else
CCACHE_STATUS="not available for your system"
fi
fi
printf "\n"
printf "====================================================\n"
printf "A new configuration has been successfully created in\n"
......@@ -209,16 +185,10 @@ AC_DEFUN_ONCE([HELP_PRINT_SUMMARY_AND_WARNINGS],
printf "Build performance summary:\n"
printf "* Cores to use: $JOBS\n"
printf "* Memory limit: $MEMORY_SIZE MB\n"
printf "* ccache status: $CCACHE_STATUS\n"
printf "\n"
if test "x$CCACHE_HELP_MSG" != x && test "x$HIDE_PERFORMANCE_HINTS" = "xno"; then
printf "Build performance tip: ccache gives a tremendous speedup for C++ recompilations.\n"
printf "$CCACHE_HELP_MSG\n"
HELP_MSG_MISSING_DEPENDENCY([ccache])
printf "$HELP_MSG\n"
printf "\n"
if test "x$CCACHE_STATUS" != "x"; then
printf "* ccache status: $CCACHE_STATUS\n"
fi
printf "\n"
if test "x$BUILDING_MULTIPLE_JVM_VARIANTS" = "xyes"; then
printf "NOTE: You have requested to build more than one version of the JVM, which\n"
......
......@@ -91,6 +91,11 @@ LLVM_LDFLAGS=@LLVM_LDFLAGS@
ALT_OUTPUTDIR=$(HOTSPOT_OUTPUTDIR)
ALT_EXPORT_PATH=$(HOTSPOT_DIST)
JVM_INTERPRETER:=@JVM_INTERPRETER@
ifeq ($(JVM_INTERPRETER), cpp)
CC_INTERP=true
endif
HOTSPOT_MAKE_ARGS:=@HOTSPOT_MAKE_ARGS@ @STATIC_CXX_SETTING@
# This is used from the libjvm build for C/C++ code.
HOTSPOT_BUILD_JOBS:=$(JOBS)
......
......@@ -51,6 +51,33 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_VARIANT],
AC_MSG_RESULT([$JDK_VARIANT])
])
AC_DEFUN_ONCE([JDKOPT_SETUP_JVM_INTERPRETER],
[
###############################################################################
#
# Check which interpreter of the JVM we want to build.
# Currently we have:
# template: Template interpreter (the default)
# cpp : C++ interpreter
AC_MSG_CHECKING([which interpreter of the JVM to build])
AC_ARG_WITH([jvm-interpreter], [AS_HELP_STRING([--with-jvm-interpreter],
[JVM interpreter to build (template, cpp) @<:@template@:>@])])
if test "x$with_jvm_interpreter" = x; then
with_jvm_interpreter="template"
fi
JVM_INTERPRETER="$with_jvm_interpreter"
if test "x$JVM_INTERPRETER" != xtemplate && test "x$JVM_INTERPRETER" != xcpp; then
AC_MSG_ERROR([The available JVM interpreters are: template, cpp])
fi
AC_SUBST(JVM_INTERPRETER)
AC_MSG_RESULT([$with_jvm_interpreter])
])
AC_DEFUN_ONCE([JDKOPT_SETUP_JVM_VARIANTS],
[
......@@ -65,19 +92,20 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JVM_VARIANTS],
# ie normal interpreter and C1, only the serial GC, kernel jvmti etc
# zero: no machine code interpreter, no compiler
# zeroshark: zero interpreter and shark/llvm compiler backend
# core: interpreter only, no compiler (only works on some platforms)
AC_MSG_CHECKING([which variants of the JVM to build])
AC_ARG_WITH([jvm-variants], [AS_HELP_STRING([--with-jvm-variants],
[JVM variants (separated by commas) to build (server, client, minimal1, kernel, zero, zeroshark) @<:@server@:>@])])
[JVM variants (separated by commas) to build (server, client, minimal1, kernel, zero, zeroshark, core) @<:@server@:>@])])
if test "x$with_jvm_variants" = x; then
with_jvm_variants="server"
fi
JVM_VARIANTS=",$with_jvm_variants,"
TEST_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,//' -e 's/client,//' -e 's/minimal1,//' -e 's/kernel,//' -e 's/zero,//' -e 's/zeroshark,//'`
TEST_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,//' -e 's/client,//' -e 's/minimal1,//' -e 's/kernel,//' -e 's/zero,//' -e 's/zeroshark,//' -e 's/core,//'`
if test "x$TEST_VARIANTS" != "x,"; then
AC_MSG_ERROR([The available JVM variants are: server, client, minimal1, kernel, zero, zeroshark])
AC_MSG_ERROR([The available JVM variants are: server, client, minimal1, kernel, zero, zeroshark, core])
fi
AC_MSG_RESULT([$with_jvm_variants])
......@@ -87,6 +115,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JVM_VARIANTS],
JVM_VARIANT_KERNEL=`$ECHO "$JVM_VARIANTS" | $SED -e '/,kernel,/!s/.*/false/g' -e '/,kernel,/s/.*/true/g'`
JVM_VARIANT_ZERO=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zero,/!s/.*/false/g' -e '/,zero,/s/.*/true/g'`
JVM_VARIANT_ZEROSHARK=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zeroshark,/!s/.*/false/g' -e '/,zeroshark,/s/.*/true/g'`
JVM_VARIANT_CORE=`$ECHO "$JVM_VARIANTS" | $SED -e '/,core,/!s/.*/false/g' -e '/,core,/s/.*/true/g'`
if test "x$JVM_VARIANT_CLIENT" = xtrue; then
if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
......@@ -106,7 +135,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JVM_VARIANTS],
# Replace the commas with AND for use in the build directory name.
ANDED_JVM_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/^,//' -e 's/,$//' -e 's/,/AND/g'`
COUNT_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,/1/' -e 's/client,/1/' -e 's/minimal1,/1/' -e 's/kernel,/1/' -e 's/zero,/1/' -e 's/zeroshark,/1/'`
COUNT_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,/1/' -e 's/client,/1/' -e 's/minimal1,/1/' -e 's/kernel,/1/' -e 's/zero,/1/' -e 's/zeroshark,/1/' -e 's/core,/1/'`
if test "x$COUNT_VARIANTS" != "x,1"; then
BUILDING_MULTIPLE_JVM_VARIANTS=yes
else
......@@ -120,6 +149,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JVM_VARIANTS],
AC_SUBST(JVM_VARIANT_KERNEL)
AC_SUBST(JVM_VARIANT_ZERO)
AC_SUBST(JVM_VARIANT_ZEROSHARK)
AC_SUBST(JVM_VARIANT_CORE)
INCLUDE_SA=true
if test "x$JVM_VARIANT_ZERO" = xtrue ; then
......@@ -128,6 +158,9 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JVM_VARIANTS],
if test "x$JVM_VARIANT_ZEROSHARK" = xtrue ; then
INCLUDE_SA=false
fi
if test "x$VAR_CPU" = xppc64 ; then
INCLUDE_SA=false
fi
AC_SUBST(INCLUDE_SA)
if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
......@@ -236,6 +269,10 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_LEVEL],
HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}shark "
fi
if test "x$JVM_VARIANT_CORE" = xtrue; then
HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}core "
fi
HOTSPOT_TARGET="$HOTSPOT_TARGET docs export_$HOTSPOT_EXPORT"
# On Macosx universal binaries are produced, but they only contain
......
......@@ -43,6 +43,14 @@ AC_DEFUN_ONCE([LIB_SETUP_INIT],
AC_MSG_RESULT([alsa pulse])
fi
if test "x$OPENJDK_TARGET_OS" = xaix; then
AC_MSG_CHECKING([what is not needed on AIX?])
ALSA_NOT_NEEDED=yes
PULSE_NOT_NEEDED=yes
AC_MSG_RESULT([alsa pulse])
fi
if test "x$OPENJDK_TARGET_OS" = xwindows; then
AC_MSG_CHECKING([what is not needed on Windows?])
CUPS_NOT_NEEDED=yes
......
......@@ -126,6 +126,11 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_OS],
VAR_OS_API=winapi
VAR_OS_ENV=windows.msys
;;
*aix*)
VAR_OS=aix
VAR_OS_API=posix
VAR_OS_ENV=aix
;;
*)
AC_MSG_ERROR([unsupported operating system $1])
;;
......@@ -432,9 +437,9 @@ AC_DEFUN([PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS],
# keep track of these additions in ADDED_CFLAGS etc. These
# will later be checked to make sure only controlled additions
# have been made to CFLAGS etc.
ADDED_CFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}"
ADDED_CXXFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}"
ADDED_LDFLAGS=" -m${OPENJDK_TARGET_CPU_BITS}"
ADDED_CFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
ADDED_CXXFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
ADDED_LDFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
CFLAGS="${CFLAGS}${ADDED_CFLAGS}"
CXXFLAGS="${CXXFLAGS}${ADDED_CXXFLAGS}"
......@@ -454,8 +459,9 @@ AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS],
# is made at runtime.)
#
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
# Always specify -m flags on Solaris
if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xaix; then
# Always specify -m flag on Solaris
# And -q on AIX because otherwise the compiler produces 32-bit objects by default
PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS
elif test "x$COMPILE_TYPE" = xreduced; then
if test "x$OPENJDK_TARGET_OS" != xwindows; then
......@@ -477,19 +483,34 @@ AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS],
AC_CHECK_SIZEOF([int *], [1111])
if test "x$SIZEOF_INT_P" != "x$ac_cv_sizeof_int_p"; then
# Workaround autoconf bug, see http://lists.gnu.org/archive/html/autoconf/2010-07/msg00004.html
SIZEOF_INT_P="$ac_cv_sizeof_int_p"
fi
if test "x$SIZEOF_INT_P" = x; then
# AC_CHECK_SIZEOF defines 'ac_cv_sizeof_int_p' to hold the number of bytes used by an 'int*'
if test "x$ac_cv_sizeof_int_p" = x; then
# The test failed, lets stick to the assumed value.
AC_MSG_WARN([The number of bits in the target could not be determined, using $OPENJDK_TARGET_CPU_BITS.])
else
TESTED_TARGET_CPU_BITS=`expr 8 \* $SIZEOF_INT_P`
TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p`
if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then
AC_MSG_ERROR([The tested number of bits in the target ($TESTED_TARGET_CPU_BITS) differs from the number of bits expected to be found in the target ($OPENJDK_TARGET_CPU_BITS)])
# This situation may happen on 64-bit platforms where the compiler by default only generates 32-bit objects
# Let's try to implicitely set the compilers target architecture and retry the test
AC_MSG_NOTICE([The tested number of bits in the target ($TESTED_TARGET_CPU_BITS) differs from the number of bits expected to be found in the target ($OPENJDK_TARGET_CPU_BITS).])
AC_MSG_NOTICE([I'll retry after setting the platforms compiler target bits flag to ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}])
PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS
# We have to unset 'ac_cv_sizeof_int_p' first, otherwise AC_CHECK_SIZEOF will use the previously cached value!
unset ac_cv_sizeof_int_p
# And we have to undef the definition of SIZEOF_INT_P in confdefs.h by the previous invocation of AC_CHECK_SIZEOF
cat >>confdefs.h <<_ACEOF
#undef SIZEOF_INT_P
_ACEOF
AC_CHECK_SIZEOF([int *], [1111])
TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p`
if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then
AC_MSG_ERROR([The tested number of bits in the target ($TESTED_TARGET_CPU_BITS) differs from the number of bits expected to be found in the target ($OPENJDK_TARGET_CPU_BITS)])
fi
fi
fi
......
#
# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
......@@ -37,6 +37,8 @@ X:=
SPACE:=$(X) $(X)
COMMA:=,
HASH:=\#
LEFT_PAREN:=(
RIGHT_PAREN:=)
SQUOTE:='
#'
DQUOTE:="
......@@ -208,6 +210,7 @@ JVM_VARIANT_MINIMAL1:=@JVM_VARIANT_MINIMAL1@
JVM_VARIANT_KERNEL:=@JVM_VARIANT_KERNEL@
JVM_VARIANT_ZERO:=@JVM_VARIANT_ZERO@
JVM_VARIANT_ZEROSHARK:=@JVM_VARIANT_ZEROSHARK@
JVM_VARIANT_CORE:=@JVM_VARIANT_CORE@
# Universal binaries on macosx
MACOSX_UNIVERSAL=@MACOSX_UNIVERSAL@
......@@ -297,6 +300,8 @@ MACOSX_VERSION_MIN=@MACOSX_VERSION_MIN@
COMPILER_TYPE:=@COMPILER_TYPE@
COMPILER_NAME:=@COMPILER_NAME@
# Option used to tell the compiler whether to create 32- or 64-bit executables
COMPILER_TARGET_BITS_FLAG:=@COMPILER_TARGET_BITS_FLAG@
COMPILER_SUPPORTS_TARGET_BITS_FLAG=@COMPILER_SUPPORTS_TARGET_BITS_FLAG@
CC_OUT_OPTION:=@CC_OUT_OPTION@
......@@ -340,6 +345,11 @@ CPP:=@FIXPATH@ @CPP@
# The linker can be gcc or ld on posix systems, or link.exe on windows systems.
LD:=@FIXPATH@ @LD@
# The linker on older SuSE distros (e.g. on SLES 10) complains with:
# "Invalid version tag `SUNWprivate_1.1'. Only anonymous version tag is allowed in executable."
# if feeded with a version script which contains named tags.
USING_BROKEN_SUSE_LD:=@USING_BROKEN_SUSE_LD@
# LDFLAGS used to link the jdk native libraries (C-code)
LDFLAGS_JDKLIB:=@LDFLAGS_JDKLIB@
LDFLAGS_JDKLIB_SUFFIX:=@LDFLAGS_JDKLIB_SUFFIX@
......@@ -430,28 +440,29 @@ POST_MCS_CMD:=@POST_MCS_CMD@
JAVA_FLAGS:=@BOOT_JDK_JVMARGS@
JAVA=@FIXPATH@ $(BOOT_JDK)/bin/java $(JAVA_FLAGS)
JAVA=@FIXPATH@ @JAVA@ $(JAVA_FLAGS)
JAVAC=@FIXPATH@ $(BOOT_JDK)/bin/javac
JAVAC:=@FIXPATH@ @JAVAC@
# Hotspot sets this variable before reading the SPEC when compiling sa-jdi.jar. Avoid
# overriding that value by using ?=.
JAVAC_FLAGS?=@JAVAC_FLAGS@
JAVAH=@FIXPATH@ $(BOOT_JDK)/bin/javah
JAR=@FIXPATH@ $(BOOT_JDK)/bin/jar
JAVAH:=@FIXPATH@ @JAVAH@
RMIC=@FIXPATH@ $(BOOT_JDK)/bin/rmic
JAR:=@FIXPATH@ @JAR@
NATIVE2ASCII=@FIXPATH@ $(BOOT_JDK)/bin/native2ascii
NATIVE2ASCII:=@FIXPATH@ @NATIVE2ASCII@
JARSIGNER=@FIXPATH@ $(BOOT_JDK)/bin/jarsigner
JARSIGNER:=@FIXPATH@ @JARSIGNER@
# You run the new javac using the boot jdk with $(BOOT_JDK)/bin/java $(NEW_JAVAC) ...
BOOTSTRAP_JAVAC_JAR:=$(LANGTOOLS_OUTPUTDIR)/dist/bootstrap/lib/javac.jar
BOOTSTRAP_JAVAC_ARGS:="-Xbootclasspath/p:$(BOOTSTRAP_JAVAC_JAR)" -cp $(BOOTSTRAP_JAVAC_JAR)
NEW_JAVAC = $(BOOTSTRAP_JAVAC_ARGS) com.sun.tools.javac.Main
NEW_JAVADOC = $(BOOTSTRAP_JAVAC_ARGS) com.sun.tools.javadoc.Main
INTERIM_LANGTOOLS_JAR := $(LANGTOOLS_OUTPUTDIR)/dist/interim_langtools.jar
INTERIM_LANGTOOLS_ARGS := "-Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR)" -cp $(INTERIM_LANGTOOLS_JAR)
NEW_JAVAC = $(INTERIM_LANGTOOLS_ARGS) com.sun.tools.javac.Main
NEW_JAVADOC = $(INTERIM_LANGTOOLS_ARGS) com.sun.tools.javadoc.Main
# The interim corba jar is needed for running rmic
INTERIM_CORBA_JAR := $(CORBA_OUTPUTDIR)/dist/interim_corba.jar
# Base flags for RC
# Guarding this against resetting value. Legacy make files include spec multiple
......
......@@ -44,6 +44,15 @@ AC_DEFUN([TOOLCHAIN_CHECK_COMPILER_VERSION],
COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.*@<:@ ,\t@:>@$COMPILER_NAME@<:@ ,\t@:>@\(@<:@1-9@:>@\.@<:@0-9@:>@@<:@0-9@:>@*\).*/\1/p"`
COMPILER_VENDOR="Sun Studio"
fi
elif test "x$OPENJDK_TARGET_OS" = xaix; then
COMPILER_VERSION_TEST=`$COMPILER -qversion 2>&1 | $TAIL -n 1`
$ECHO $COMPILER_VERSION_TEST | $GREP "^Version: " > /dev/null
if test $? -ne 0; then
AC_MSG_ERROR([Failed to detect the compiler version of $COMPILER ....])
else
COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n 's/Version: \([0-9][0-9]\.[0-9][0-9]*\).*/\1/p'`
COMPILER_VENDOR='IBM'
fi
elif test "x$OPENJDK_TARGET_OS" = xwindows; then
# First line typically looks something like:
# Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
......@@ -113,34 +122,62 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_SYSROOT_AND_OUT_OPTIONS],
AC_DEFUN([TOOLCHAIN_FIND_COMPILER],
[
COMPILER_NAME=$2
SEARCH_LIST="$3"
if test "x[$]$1" != x; then
# User has supplied compiler name already, always let that override.
AC_MSG_NOTICE([Will use user supplied compiler $1=[$]$1])
if test "x`basename [$]$1`" = "x[$]$1"; then
# A command without a complete path is provided, search $PATH.
AC_PATH_PROGS(POTENTIAL_$1, [$]$1)
if test "x$POTENTIAL_$1" != x; then
$1=$POTENTIAL_$1
else
AC_MSG_ERROR([User supplied compiler $1=[$]$1 could not be found])
fi
else
# Otherwise it might already be a complete path
if test ! -x "[$]$1"; then
AC_MSG_ERROR([User supplied compiler $1=[$]$1 does not exist])
fi
fi
else
# No user supplied value. Locate compiler ourselves
$1=
# If TOOLS_DIR is set, check for all compiler names in there first
# before checking the rest of the PATH.
if test -n "$TOOLS_DIR"; then
PATH_save="$PATH"
PATH="$TOOLS_DIR"
AC_PATH_PROGS(TOOLS_DIR_$1, $SEARCH_LIST)
$1=$TOOLS_DIR_$1
PATH="$PATH_save"
fi
$1=
# If TOOLS_DIR is set, check for all compiler names in there first
# before checking the rest of the PATH.
if test -n "$TOOLS_DIR"; then
PATH_save="$PATH"
PATH="$TOOLS_DIR"
AC_PATH_PROGS(TOOLS_DIR_$1, $3)
$1=$TOOLS_DIR_$1
PATH="$PATH_save"
fi
# AC_PATH_PROGS can't be run multiple times with the same variable,
# so create a new name for this run.
if test "x[$]$1" = x; then
AC_PATH_PROGS(POTENTIAL_$1, $SEARCH_LIST)
$1=$POTENTIAL_$1
fi
# AC_PATH_PROGS can't be run multiple times with the same variable,
# so create a new name for this run.
if test "x[$]$1" = x; then
AC_PATH_PROGS(POTENTIAL_$1, $3)
$1=$POTENTIAL_$1
if test "x[$]$1" = x; then
HELP_MSG_MISSING_DEPENDENCY([devkit])
AC_MSG_ERROR([Could not find a $COMPILER_NAME compiler. $HELP_MSG])
fi
fi
if test "x[$]$1" = x; then
HELP_MSG_MISSING_DEPENDENCY([devkit])
AC_MSG_ERROR([Could not find a $COMPILER_NAME compiler. $HELP_MSG])
fi
# Now we have a compiler binary in $1. Make sure it's okay.
BASIC_FIXUP_EXECUTABLE($1)
AC_MSG_CHECKING([resolved symbolic links for $1])
TEST_COMPILER="[$]$1"
BASIC_REMOVE_SYMBOLIC_LINKS(TEST_COMPILER)
AC_MSG_RESULT([$TEST_COMPILER])
# Don't remove symbolic links on AIX because 'xlc_r' and 'xlC_r' may all be links
# to 'xlc' but it is crucial that we invoke the compiler with the right name!
if test "x$OPENJDK_BUILD_OS" != xaix; then
AC_MSG_CHECKING([resolved symbolic links for $1])
BASIC_REMOVE_SYMBOLIC_LINKS(TEST_COMPILER)
AC_MSG_RESULT([$TEST_COMPILER])
fi
AC_MSG_CHECKING([if $1 is disguised ccache])
COMPILER_BASENAME=`$BASENAME "$TEST_COMPILER"`
......@@ -201,11 +238,11 @@ AC_DEFUN([TOOLCHAIN_SETUP_PATHS],
# otherwise we might pick up cross-compilers which don't use standard naming.
# Otherwise, we'll set the BUILD_tools to the native tools, but that'll have
# to wait until they are properly discovered.
AC_PATH_PROGS(BUILD_CC, [cl cc gcc])
BASIC_PATH_PROGS(BUILD_CC, [cl cc gcc])
BASIC_FIXUP_EXECUTABLE(BUILD_CC)
AC_PATH_PROGS(BUILD_CXX, [cl CC g++])
BASIC_PATH_PROGS(BUILD_CXX, [cl CC g++])
BASIC_FIXUP_EXECUTABLE(BUILD_CXX)
AC_PATH_PROG(BUILD_LD, ld)
BASIC_PATH_PROGS(BUILD_LD, ld)
BASIC_FIXUP_EXECUTABLE(BUILD_LD)
fi
AC_SUBST(BUILD_CC)
......@@ -248,12 +285,13 @@ AC_DEFUN([TOOLCHAIN_SETUP_PATHS],
# On Solaris, cc is preferred to gcc.
# Elsewhere, gcc is preferred to cc.
if test "x$CC" != x; then
COMPILER_CHECK_LIST="$CC"
elif test "x$OPENJDK_TARGET_OS" = "xwindows"; then
if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
COMPILER_CHECK_LIST="cl"
elif test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
COMPILER_CHECK_LIST="cc gcc"
elif test "x$OPENJDK_TARGET_OS" = "xaix"; then
# Do not probe for cc on AIX.
COMPILER_CHECK_LIST="xlc_r"
else
COMPILER_CHECK_LIST="gcc cc"
fi
......@@ -262,14 +300,23 @@ AC_DEFUN([TOOLCHAIN_SETUP_PATHS],
# Now that we have resolved CC ourself, let autoconf have its go at it
AC_PROG_CC([$CC])
# Option used to tell the compiler whether to create 32- or 64-bit executables
# Notice that CC contains the full compiler path at this point.
case $CC in
*xlc_r) COMPILER_TARGET_BITS_FLAG="-q";;
*) COMPILER_TARGET_BITS_FLAG="-m";;
esac
AC_SUBST(COMPILER_TARGET_BITS_FLAG)
### Locate C++ compiler (CXX)
if test "x$CXX" != x; then
COMPILER_CHECK_LIST="$CXX"
elif test "x$OPENJDK_TARGET_OS" = "xwindows"; then
if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
COMPILER_CHECK_LIST="cl"
elif test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
COMPILER_CHECK_LIST="CC g++"
elif test "x$OPENJDK_TARGET_OS" = "xaix"; then
# Do not probe for CC on AIX .
COMPILER_CHECK_LIST="xlC_r"
else
COMPILER_CHECK_LIST="g++ CC"
fi
......@@ -306,11 +353,13 @@ AC_DEFUN([TOOLCHAIN_SETUP_PATHS],
AC_SUBST(LDEXECXX)
if test "x$OPENJDK_TARGET_OS" != xwindows; then
AC_CHECK_TOOL(AR, ar)
BASIC_CHECK_TOOLS(AR, ar)
BASIC_FIXUP_EXECUTABLE(AR)
fi
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
ARFLAGS="-r"
elif test "x$OPENJDK_TARGET_OS" = xaix; then
ARFLAGS="-X64"
else
ARFLAGS=""
fi
......@@ -431,7 +480,7 @@ AC_DEFUN([TOOLCHAIN_SETUP_PATHS],
# Find the right assembler.
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
AC_PATH_PROG(AS, as)
BASIC_PATH_PROGS(AS, as)
BASIC_FIXUP_EXECUTABLE(AS)
else
AS="$CC -c"
......@@ -439,41 +488,41 @@ AC_DEFUN([TOOLCHAIN_SETUP_PATHS],
AC_SUBST(AS)
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
AC_PATH_PROG(NM, nm)
BASIC_PATH_PROGS(NM, nm)
BASIC_FIXUP_EXECUTABLE(NM)
AC_PATH_PROG(GNM, gnm)
BASIC_PATH_PROGS(GNM, gnm)
BASIC_FIXUP_EXECUTABLE(GNM)
AC_PATH_PROG(STRIP, strip)
BASIC_PATH_PROGS(STRIP, strip)
BASIC_FIXUP_EXECUTABLE(STRIP)
AC_PATH_PROG(MCS, mcs)
BASIC_PATH_PROGS(MCS, mcs)
BASIC_FIXUP_EXECUTABLE(MCS)
elif test "x$OPENJDK_TARGET_OS" != xwindows; then
AC_CHECK_TOOL(NM, nm)
BASIC_CHECK_TOOLS(NM, nm)
BASIC_FIXUP_EXECUTABLE(NM)
GNM="$NM"
AC_SUBST(GNM)
AC_CHECK_TOOL(STRIP, strip)
BASIC_CHECK_TOOLS(STRIP, strip)
BASIC_FIXUP_EXECUTABLE(STRIP)
fi
# objcopy is used for moving debug symbols to separate files when
# full debug symbols are enabled.
if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then
AC_CHECK_TOOLS(OBJCOPY, [gobjcopy objcopy])
BASIC_CHECK_TOOLS(OBJCOPY, [gobjcopy objcopy])
# Only call fixup if objcopy was found.
if test -n "$OBJCOPY"; then
BASIC_FIXUP_EXECUTABLE(OBJCOPY)
fi
fi
AC_CHECK_TOOLS(OBJDUMP, [gobjdump objdump])
BASIC_CHECK_TOOLS(OBJDUMP, [gobjdump objdump])
if test "x$OBJDUMP" != x; then
# Only used for compare.sh; we can live without it. BASIC_FIXUP_EXECUTABLE bails if argument is missing.
BASIC_FIXUP_EXECUTABLE(OBJDUMP)
fi
if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
AC_PATH_PROG(LIPO, lipo)
BASIC_PATH_PROGS(LIPO, lipo)
BASIC_FIXUP_EXECUTABLE(LIPO)
fi
......@@ -554,6 +603,29 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_LIBS],
POST_STRIP_CMD="$STRIP -x"
POST_MCS_CMD="$MCS -d -a \"JDK $FULL_VERSION\""
fi
if test "x$OPENJDK_TARGET_OS" = xaix; then
COMPILER_NAME=xlc
PICFLAG="-qpic=large"
LIBRARY_PREFIX=lib
SHARED_LIBRARY='lib[$]1.so'
STATIC_LIBRARY='lib[$]1.a'
SHARED_LIBRARY_FLAGS="-qmkshrobj"
SHARED_LIBRARY_SUFFIX='.so'
STATIC_LIBRARY_SUFFIX='.a'
OBJ_SUFFIX='.o'
EXE_SUFFIX=''
SET_SHARED_LIBRARY_NAME=''
SET_SHARED_LIBRARY_MAPFILE=''
C_FLAG_REORDER=''
CXX_FLAG_REORDER=''
SET_SHARED_LIBRARY_ORIGIN=''
SET_EXECUTABLE_ORIGIN=""
CFLAGS_JDK=""
CXXFLAGS_JDK=""
CFLAGS_JDKLIB_EXTRA=''
POST_STRIP_CMD="$STRIP -X32_64"
POST_MCS_CMD=""
fi
if test "x$OPENJDK_TARGET_OS" = xwindows; then
# If it is not gcc, then assume it is the MS Visual Studio compiler
COMPILER_NAME=cl
......@@ -730,6 +802,24 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_OPTIMIZATION],
CFLAGS_DEBUG_SYMBOLS="-g -xs"
CXXFLAGS_DEBUG_SYMBOLS="-g0 -xs"
;;
xlc )
C_FLAG_DEPS="-qmakedep=gcc -MF"
CXX_FLAG_DEPS="-qmakedep=gcc -MF"
C_O_FLAG_HIGHEST="-O3"
C_O_FLAG_HI="-O3 -qstrict"
C_O_FLAG_NORM="-O2"
C_O_FLAG_NONE=""
CXX_O_FLAG_HIGHEST="-O3"
CXX_O_FLAG_HI="-O3 -qstrict"
CXX_O_FLAG_NORM="-O2"
CXX_O_FLAG_NONE=""
CFLAGS_DEBUG_SYMBOLS="-g"
CXXFLAGS_DEBUG_SYMBOLS="-g"
LDFLAGS_JDK="${LDFLAGS_JDK} -q64 -brtl -bnolibpath -liconv -bexpall"
CFLAGS_JDK="${CFLAGS_JDK} -qchars=signed -q64 -qfullpath -qsaveopt"
CXXFLAGS_JDK="${CXXFLAGS_JDK} -qchars=signed -q64 -qfullpath -qsaveopt"
;;
esac
;;
CL )
......@@ -840,6 +930,13 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_JDK],
LDFLAGS_JDK="$LDFLAGS_JDK -z defs -xildoff -ztext"
LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK -norunpath -xnolib"
;;
xlc )
CFLAGS_JDK="$CFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
CXXFLAGS_JDK="$CXXFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
LDFLAGS_JDK="$LDFLAGS_JDK"
LDFLAGS_CXX_JDK="$LDFLAGS_CXX_JDK"
;;
cl )
CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -Zi -MD -Zc:wchar_t- -W3 -wd4800 \
-D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB -DWIN32_LEAN_AND_MEAN \
......@@ -909,6 +1006,9 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_FOR_JDK],
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DSOLARIS"
fi
if test "x$OPENJDK_TARGET_OS" = xaix; then
CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DAIX -DPPC64"
fi
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMACOSX -D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
# Setting these parameters makes it an error to link to macosx APIs that are
......@@ -1076,20 +1176,38 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_COMPILER_FLAGS_MISC],
# ZERO_ARCHFLAG tells the compiler which mode to build for
case "${OPENJDK_TARGET_CPU}" in
s390)
ZERO_ARCHFLAG="-m31"
ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}31"
;;
*)
ZERO_ARCHFLAG="-m${OPENJDK_TARGET_CPU_BITS}"
ZERO_ARCHFLAG="${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
esac
TOOLCHAIN_COMPILER_CHECK_ARGUMENTS([$ZERO_ARCHFLAG], [], [ZERO_ARCHFLAG=""])
AC_SUBST(ZERO_ARCHFLAG)
# Check that the compiler supports -mX flags
# Check that the compiler supports -mX (or -qX on AIX) flags
# Set COMPILER_SUPPORTS_TARGET_BITS_FLAG to 'true' if it does
TOOLCHAIN_COMPILER_CHECK_ARGUMENTS([-m${OPENJDK_TARGET_CPU_BITS}],
TOOLCHAIN_COMPILER_CHECK_ARGUMENTS([${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}],
[COMPILER_SUPPORTS_TARGET_BITS_FLAG=true],
[COMPILER_SUPPORTS_TARGET_BITS_FLAG=false])
AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG)
# Check for broken SuSE 'ld' for which 'Only anonymous version tag is allowed in executable.'
USING_BROKEN_SUSE_LD=no
if test "x$OPENJDK_TARGET_OS" = xlinux && test "x$GCC" = xyes; then
AC_MSG_CHECKING([for broken SuSE 'ld' which only understands anonymous version tags in executables])
echo "SUNWprivate_1.1 { local: *; };" > version-script.map
echo "int main() { }" > main.c
if $CXX -Xlinker -version-script=version-script.map main.c 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD; then
AC_MSG_RESULT(no)
USING_BROKEN_SUSE_LD=no
else
AC_MSG_RESULT(yes)
USING_BROKEN_SUSE_LD=yes
fi
rm -rf version-script.map main.c
fi
AC_SUBST(USING_BROKEN_SUSE_LD)
])
# Setup the JTREG paths
......@@ -1126,7 +1244,7 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_JTREG],
AC_MSG_RESULT($JTREGEXE)
else
# try to find jtreg on path
BASIC_REQUIRE_PROG(JTREGEXE, jtreg)
BASIC_REQUIRE_PROGS(JTREGEXE, jtreg)
JT_HOME="`$DIRNAME $JTREGEXE`"
fi
fi
......
......@@ -163,11 +163,12 @@ define SetupArchive
# The capture contents macro finds all files (matching the patterns, typically
# .class and .prp) that are newer than the jar-file, ie the new content to be put into the jar.
# NOTICE: please leave the parentheses space separated otherwise the AIX build will break!
$1_CAPTURE_CONTENTS=$$(foreach src,$$($1_SRCS), \
(($(FIND) $$(src) -type f -a \( $$($1_FIND_PATTERNS) \) -a -newer $$@ $$($1_GREP_INCLUDES) \
( ( $(FIND) $$(src) -type f -a \( $$($1_FIND_PATTERNS) \) -a -newer $$@ $$($1_GREP_INCLUDES) \
$$($1_GREP_EXCLUDES) | $(SED) 's|$$(src)/||g' && \
$(ECHO) $$(subst $$(src)/,,$$($1_EXTRA_FILES))) > \
$$(src)/_the.$$($1_JARNAME)_contents) $$(NEWLINE))
$(ECHO) $$(subst $$(src)/,,$$($1_EXTRA_FILES) ) ) > \
$$(src)/_the.$$($1_JARNAME)_contents) $$(NEWLINE) )
# The capture metainf macro finds all files below the META-INF directory that are newer than the jar-file.
ifeq (,$$($1_SKIP_METAINF))
$1_CAPTURE_METAINF =$$(foreach src,$$($1_SRCS),($(FIND) $$(src)/META-INF -type f -a -newer $$@ 2> /dev/null | $(SED) 's|$$(src)/||g' >> $$(src)/_the.$$($1_JARNAME)_contents ) $$(NEWLINE))
......@@ -176,19 +177,20 @@ define SetupArchive
# tells us what to remove from the jar-file.
$1_CAPTURE_DELETES=$$(foreach src,$$($1_SRCS),($(FIND) $$(src) -name _the.package.deleted -newer $$@ -exec $(SED) 's|$$(src)||g' \{\} >> $$($1_DELETES_FILE) \;) $$(NEWLINE))
# The update contents macro updates the jar file with the previously capture contents.
# xargs is used to trim the whitespace from the contents file, to see if it is empty.
# Use 'wc -w' to see if the contents file is empty.
$1_UPDATE_CONTENTS=$$(foreach src,$$($1_SRCS), \
(cd $$(src) && \
if [ -n "`$(CAT) _the.$$($1_JARNAME)_contents | $(XARGS)`" ]; then \
if [ "`$(WC) -w _the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'`" -gt "0" ]; then \
$(ECHO) " updating" `$(WC) -l _the.$$($1_JARNAME)_contents | $(AWK) '{ print $$$$1 }'` files && \
$(JAR) $$($1_JAR_UPDATE_OPTIONS) $$@ @_the.$$($1_JARNAME)_contents; \
fi) $$(NEWLINE))
# The s-variants of the above macros are used when the jar is created from scratch.
# NOTICE: please leave the parentheses space separated otherwise the AIX build will break!
$1_SCAPTURE_CONTENTS=$$(foreach src,$$($1_SRCS), \
(($(FIND) $$(src) -type f -a \( $$($1_FIND_PATTERNS) \) $$($1_GREP_INCLUDES) \
( ( $(FIND) $$(src) -type f -a \( $$($1_FIND_PATTERNS) \) $$($1_GREP_INCLUDES) \
$$($1_GREP_EXCLUDES) | $(SED) 's|$$(src)/||g' && \
$$(subst $$(src)/,,$(ECHO) $$($1_EXTRA_FILES))) > \
$$(src)/_the.$$($1_JARNAME)_contents) $$(NEWLINE))
$$(subst $$(src)/,,$(ECHO) $$($1_EXTRA_FILES) ) ) > \
$$(src)/_the.$$($1_JARNAME)_contents) $$(NEWLINE) )
ifeq (,$$($1_SKIP_METAINF))
$1_SCAPTURE_METAINF=$$(foreach src,$$($1_SRCS), \
......@@ -245,6 +247,8 @@ define SetupArchive
$$($1_SUPDATE_CONTENTS) \
$$($1_JARINDEX) && true )
# Add jar to target list
$1 += $$($1_JAR)
endef
define SetupZipArchive
......@@ -305,6 +309,9 @@ define SetupZipArchive
$(ECHO) Updating $$($1_NAME)
$$(foreach i,$$($1_SRC),(cd $$i && $(ZIP) -qru $$@ . $$($1_ZIP_INCLUDES) $$($1_ZIP_EXCLUDES) -x \*_the.\* $$(addprefix -x$(SPACE),$$(patsubst $$i/%,%,$$($1_EXCLUDE_FILES))) || test "$$$$?" = "12" )$$(NEWLINE)) true
$(TOUCH) $$@
# Add zip to target list
$1 += $$($1_ZIP)
endef
define add_file_to_copy
......@@ -527,16 +534,16 @@ define SetupJavaCompilation
# When building in batch, put headers in a temp dir to filter out those that actually
# changed before copying them to the real header dir.
ifneq (,$$($1_HEADERS))
$1_HEADERS_ARG := -h $$($1_HEADERS).tmp
$1_HEADERS_ARG := -h $$($1_HEADERS).$1.tmp
$$($1_HEADERS)/_the.$1_headers: $$($1_BIN)/_the.$1_batch
$(MKDIR) -p $$(@D)
for f in `ls $$($1_HEADERS).tmp`; do \
if [ ! -f "$$($1_HEADERS)/$$$$f" ] || [ "`$(DIFF) $$($1_HEADERS)/$$$$f $$($1_HEADERS).tmp/$$$$f`" != "" ]; then \
$(CP) -f $$($1_HEADERS).tmp/$$$$f $$($1_HEADERS)/$$$$f; \
for f in `ls $$($1_HEADERS).$1.tmp`; do \
if [ ! -f "$$($1_HEADERS)/$$$$f" ] || [ "`$(DIFF) $$($1_HEADERS)/$$$$f $$($1_HEADERS).$1.tmp/$$$$f`" != "" ]; then \
$(CP) -f $$($1_HEADERS).$1.tmp/$$$$f $$($1_HEADERS)/$$$$f; \
fi; \
done
$(RM) -r $$($1_HEADERS).tmp
$(RM) -r $$($1_HEADERS).$1.tmp
$(TOUCH) $$@
$1 += $$($1_HEADERS)/_the.$1_headers
......@@ -577,6 +584,9 @@ define SetupJavaCompilation
JARINDEX:=$$($1_JARINDEX), \
HEADERS:=$$($1_HEADERS), \
SETUP:=$$($1_SETUP)))
# Add jar to target list
$1 += $$($1_JAR)
endif
# Check if a srczip was specified, then setup the rules for the srczip.
......@@ -587,6 +597,8 @@ define SetupJavaCompilation
INCLUDES:=$$($1_INCLUDES), \
EXCLUDES:=$$($1_EXCLUDES), \
EXCLUDE_FILES:=$$($1_EXCLUDE_FILES)))
endif
# Add zip to target list
$1 += $$($1_SRCZIP)
endif
endef
......@@ -512,7 +512,7 @@ define SetupNativeCompilation
# Generating a static library, ie object file archive.
$$($1_TARGET) : $$($1_EXPECTED_OBJS) $$($1_RES)
$$(call ARCHIVING_MSG,$$($1_LIBRARY))
$(AR) $$($1_AR_FLAGS) $(AR_OUT_OPTION)$$($1_TARGET) $$($1_EXPECTED_OBJS) \
$(AR) $$($1_ARFLAGS) $(AR_OUT_OPTION)$$($1_TARGET) $$($1_EXPECTED_OBJS) \
$$($1_RES) $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX)
endif
......
#
# Copyright (c) 2013, 2014 Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
define EvalDebugWrapper
$(if $(DEBUG_$1),
$(info -------- <<< Begin expansion of $1)
$(info $2)
$(info -------- >>> End expansion of $1)
)
$2
endef
# Helper function for SetupTextFileProcessing; adds a rule for a single file
# to be processed.
# param 1 = The namespace argument, e.g. BUILD_VERSION_FILE
# param 2 = the source file name (full path)
# param 3 = the target base directory
# param 4 = the target file name (possibly with a partial path)
define SetupSingleTextFileForProcessing
$(strip $3)/$(strip $4): $2
$(ECHO) $(LOG_INFO) "Processing $(strip $4)"
$(MKDIR) -p '$$(@D)'
$(RM) '$$@' '$$@.includes.tmp' '$$@.replacements.tmp'
$$($1_INCLUDES_COMMAND_LINE) < '$$<' > '$$@.includes.tmp'
$$($1_REPLACEMENTS_COMMAND_LINE) < '$$@.includes.tmp' > '$$@.replacements.tmp'
$(RM) '$$@.includes.tmp'
$(MV) '$$@.replacements.tmp' '$$@'
$1 += $(strip $3)/$(strip $4)
endef
# Setup a text file for processing, in which specified markers are replaced with
# a given text, or with the contents of a given file.
#
# param 1 is the name space for this setup, e.g. BUILD_VERSION_FILE
# param 2, 3, .. etc are named args:
# SOURCE_DIRS one or more directory roots to search for files to process
# SOURCE_FILES complete paths to one or more files to process
# OUTPUT_DIR the directory where we store the processed files.
# OUTPUT_FILE the name of the resulting file. Only allowed if processing a
# single file.
# SOURCE_BASE_DIR a common root to all SOURCE_DIRS.
# If specified, files will keep the path relative to the base in the
# OUTPUT_DIR. Otherwise, the hierarchy will be flattened into the OUTPUT_DIR.
# INCLUDE_FILES only include files matching these patterns (used only with
# SOURCE_DIRS)
# EXCLUDE_FILES exclude files matching these patterns (used only with
# SOURCE_DIRS)
# INCLUDES replace the occurances of a pattern with the contents of a file;
# one or more such include pattern, using the syntax:
# PLACEHOLDER => FILE_TO_INCLUDE ; ...
# Each PLACEHOLDER must be on a single, otherwise empty line (whitespace
# padding is allowed).
# REPLACEMENTS one or more text replacement patterns, using the syntax:
# PATTERN => REPLACEMENT_TEXT ; ...
#
# At least one of INCLUDES or REPLACEMENTS must be present. If both are
# present, then the includes will be processed first, and replacements will be
# done on the included fragments as well.
#
define SetupTextFileProcessing
$(if $(16),$(error Internal makefile error: Too many arguments to SetupTextFileProcessing, please update TextFileProcessing.gmk))
$(call EvalDebugWrapper,$(strip $1),$(call SetupTextFileProcessingInner,$(strip $1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)))
endef
define SetupTextFileProcessingInner
$(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $(strip $($i)),$1_$(strip $($i)))$(NEWLINE))
$(call LogSetupMacroEntry,SetupTextFileProcessing($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
$(if $(16),$(error Internal makefile error: Too many arguments to SetupTextFileProcessing, please update TextFileProcessing.gmk))
ifeq ($$($1_REPLACEMENTS)$$($1_INCLUDES),)
$$(error At least one of REPLACEMENTS or INCLUDES are required for $1)
endif
ifneq ($$($1_SOURCE_FILES),)
ifneq ($$($1_SOURCE_DIRS),)
$$(error Cannot use both SOURCE_FILES and SOURCE_DIRS (in $1))
endif
ifneq ($$($1_SOURCE_BASE_DIR),)
$$(error Cannot use SOURCE_BASE_DIR without SOURCE_DIRS (in $1))
endif
ifneq ($$($1_EXCLUDE_FILES)$$($1_INCLUDE_FILES),)
$$(error Cannot INCLUDE/EXCLUDE_FILES with SOURCE_FILES (in $1))
endif
else
# Find all files in the source trees. Sort to remove duplicates.
$$(foreach src, $$($1_SOURCE_DIRS), $$(if $$(wildcard $$(src)), , \
$$(error SOURCE_DIRS contains missing directory $$(src) (in $1))))
ifneq ($$($1_SOURCE_BASE_DIR),)
$$(foreach src, $$($1_SOURCE_DIRS), \
$$(if $$(findstring $$($1_SOURCE_BASE_DIR), $$(src)), , \
$$(error SOURCE_DIRS contains directory $$(src) outside \
SOURCE_BASE_DIR $$($1_SOURCE_BASE_DIR) (in $1))))
endif
$1_SOURCE_FILES := $$(sort $$(call CacheFind,$$($1_SOURCE_DIRS)))
$1_EXCLUDE_FILES:=$$(foreach i,$$($1_SOURCE_DIRS),$$(addprefix $$i/,$$($1_EXCLUDE_FILES)))
$1_INCLUDE_FILES:=$$(foreach i,$$($1_SOURCE_DIRS),$$(addprefix $$i/,$$($1_INCLUDE_FILES)))
$1_SOURCE_FILES := $$(filter-out $$($1_EXCLUDE_FILES),$$($1_SOURCE_FILES))
ifneq (,$$(strip $$($1_INCLUDE_FILES)))
$1_SOURCE_FILES := $$(filter $$($1_INCLUDE_FILES),$$($1_SOURCE_FILES))
endif
ifeq (,$$($1_SOURCE_FILES))
$$(info No sources found for $1 when looking inside the dirs $$($1_SRC))
endif
endif
ifneq ($$($1_REPLACEMENTS),)
# We have a replacement request, prepare it for the recipe
ifneq ($$(findstring /,$$($1_REPLACEMENTS)),)
# Cannot use / as separator
ifneq ($$(findstring @,$$($1_REPLACEMENTS)),)
# Cannot use @ as separator
ifneq ($$(findstring |,$$($1_REPLACEMENTS)),)
# Cannot use | as separator
ifneq ($$(findstring !,$$($1_REPLACEMENTS)),)
# Cannot use ! as separator. Give up.
$$(error No suitable sed separator can be found for $1. Tested /, @, | and !)
else
$1_SEP := !
endif
else
$1_SEP := |
endif
else
$1_SEP := @
endif
else
$1_SEP := /
endif
# If we have a trailing "=>" (i.e. last rule replaces with empty, and is not
# terminated by a ;), add a trailing ; to minimize the number of corner
# cases in the hairy subst expression..
ifeq ($$(lastword $$($1_REPLACEMENTS)), =>)
$1_REPLACEMENTS += ;
endif
# If we have a trailing ";", add a dummy replacement, since there is no easy
# way to delete the last word in make.
ifeq ($$(lastword $$($1_REPLACEMENTS)), ;)
$1_REPLACEMENTS += DUMMY_REPLACEMENT => DUMMY_REPLACEMENT
endif
# Convert the REPLACEMENTS syntax ( A => B ; C => D ; ...) to a sed command
# line (-e "s/A/B/" -e "s/C/D/" ...), basically by replacing '=>' with '/'
# and ';' with '/" -e "s/', and adjusting for edge cases.
$1_REPLACEMENTS_COMMAND_LINE := $(SED) -e "s$$($1_SEP)$$(subst $$(SPACE);$$(SPACE),$$($1_SEP)" \
-e "s$$($1_SEP),$$(subst $$(SPACE)=>$$(SPACE),$$($1_SEP),$$(subst $$(SPACE)=>$$(SPACE);$$(SPACE),//" \
-e "s$$($1_SEP),$$(strip $$($1_REPLACEMENTS)))))$$($1_SEP)"
else
# We don't have any replacements, just pipe the file through cat.
$1_REPLACEMENTS_COMMAND_LINE := $(CAT)
endif
ifneq ($$($1_INCLUDES),)
# We have a include request, prepare it for the recipe.
# Convert an INCLUDE like this PATTERN_1 => file1 ; PATTERN_2 => file2 ;
# into an awk script fragment like this:
# {
# if (matches("PATTERN_1")) { include("file1") } else
# if (matches("PATTERN_2")) { include("file2") } else
# print
# }
$1_INCLUDES_HEADER_AWK := \
function matches(pattern) { return ($$$$0 ~ "^[ \t]*" pattern "[ \t]*$$$$") } \
function include(filename) { while ((getline < filename) == 1) print ; close(filename) }
$1_INCLUDES_PARTIAL_AWK := $$(subst $$(SPACE);,,$$(subst $$(SPACE)=>$$(SPACE),"$$(RIGHT_PAREN)$$(RIGHT_PAREN) \
{ include$$(LEFT_PAREN)",$$(subst $$(SPACE);$$(SPACE),"$$(RIGHT_PAREN) } \
else if $$(LEFT_PAREN)matches$$(LEFT_PAREN)",$$(strip $$($1_INCLUDES)))))
$1_INCLUDES_COMMAND_LINE := $(NAWK) '$$($1_INCLUDES_HEADER_AWK) \
{ if (matches("$$($1_INCLUDES_PARTIAL_AWK)") } else print }'
else
# We don't have any includes, just pipe the file through cat.
$1_INCLUDES_COMMAND_LINE := $(CAT)
endif
# Reset target list before populating it
$1 :=
ifneq ($$($1_OUTPUT_FILE),)
ifneq ($$(words $$($1_SOURCE_FILES)), 1)
$$(error Cannot use OUTPUT_FILE for more than one source file (in $1))
endif
# Note that $1 is space sensitive and must disobey whitespace rules
$$(eval $$(call SetupSingleTextFileForProcessing,$1, $$($1_SOURCE_FILES), \
$$(dir $$($1_OUTPUT_FILE)), $$(notdir $$($1_OUTPUT_FILE))))
else
ifeq ($$($1_OUTPUT_DIR),)
$$(error Neither OUTPUT_FILE nor OUTPUT_DIR was specified (in $1))
endif
# Now call add_native_source for each source file we are going to process.
ifeq ($$($1_SOURCE_BASE_DIR),)
# With no base dir specified, put all files in target dir, flattening any
# hierarchies. Note that $1 is space sensitive and must disobey whitespace
# rules.
$$(foreach src, $$($1_SOURCE_FILES), \
$$(eval $$(call SetupSingleTextFileForProcessing,$1, $$(src), \
$$($1_OUTPUT_DIR), $$(notdir $$(src)))))
else
# With a base dir, extract the relative portion of the path. Note that $1
# is space sensitive and must disobey whitespace rules, and so is the
# arguments to patsubst.
$$(foreach src, $$($1_SOURCE_FILES), \
$$(eval $$(call SetupSingleTextFileForProcessing,$1, $$(src), \
$$($1_OUTPUT_DIR), $$(patsubst $$($1_SOURCE_BASE_DIR)/%,%,$$(src)))))
endif
endif
endef
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册