From 05f3ae4cc8dda6ea4c72e6d167bafc911d94c1e0 Mon Sep 17 00:00:00 2001
From: Erik Joelsson <erikj@openjdk.org>
Date: Mon, 9 May 2016 17:15:05 +0200
Subject: [PATCH] 8153685: Parfait integration missing in the new tools (jmod
 and jlink)

Reviewed-by: alanb, mchung
---
 common/autoconf/boot-jdk.m4            |  8 ++++++++
 common/autoconf/generated-configure.sh | 13 ++++++++++++-
 common/autoconf/spec.gmk.in            |  8 ++++----
 make/common/JavaCompilation.gmk        |  2 +-
 4 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/common/autoconf/boot-jdk.m4 b/common/autoconf/boot-jdk.m4
index cc4f46c0d6b..f4f57fb8c24 100644
--- a/common/autoconf/boot-jdk.m4
+++ b/common/autoconf/boot-jdk.m4
@@ -435,6 +435,9 @@ AC_DEFUN([BOOTJDK_CHECK_BUILD_JDK],
       elif test ! -x "$BUILD_JDK/bin/jlink"; then
         AC_MSG_NOTICE([Potential Build JDK found at $BUILD_JDK did not contain bin/jlink; ignoring])
         BUILD_JDK_FOUND=no
+      elif test ! -x "$BUILD_JDK/bin/jmod"; then
+        AC_MSG_NOTICE([Potential Build JDK found at $BUILD_JDK did not contain bin/jmod; ignoring])
+        BUILD_JDK_FOUND=no
       elif test ! -x "$BUILD_JDK/bin/javac"; then
         # Do we have a bin/javac?
         AC_MSG_NOTICE([Potential Build JDK found at $BUILD_JDK did not contain bin/javac; ignoring])
@@ -500,6 +503,11 @@ AC_DEFUN([BOOTJDK_SETUP_BUILD_JDK],
     fi
   fi
 
+  JMOD="$BUILD_JDK/bin/jmod"
+  JLINK="$BUILD_JDK/bin/jlink"
+  AC_SUBST(JMOD)
+  AC_SUBST(JLINK)
+
   if test "x$BUILD_JDK_FOUND" != "xyes"; then
     AC_MSG_CHECKING([for Build JDK])
     AC_MSG_RESULT([no])
diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh
index 7b383944e73..548ab680d2a 100644
--- a/common/autoconf/generated-configure.sh
+++ b/common/autoconf/generated-configure.sh
@@ -899,6 +899,8 @@ LANGTOOLS_TOPDIR
 EXTERNAL_BUILDJDK
 BUILD_JDK
 CREATE_BUILDJDK
+JLINK
+JMOD
 BOOT_JDK_BITS
 JAVAC_FLAGS
 BOOT_JDK_MODULAR
@@ -5071,7 +5073,7 @@ VS_SDK_PLATFORM_NAME_2013=
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1462574627
+DATE_WHEN_GENERATED=1462806878
 
 ###############################################################################
 #
@@ -30198,6 +30200,10 @@ $as_echo "$as_me: Potential Build JDK found at $BUILD_JDK did not contain bin/ja
         { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Build JDK found at $BUILD_JDK did not contain bin/jlink; ignoring" >&5
 $as_echo "$as_me: Potential Build JDK found at $BUILD_JDK did not contain bin/jlink; ignoring" >&6;}
         BUILD_JDK_FOUND=no
+      elif test ! -x "$BUILD_JDK/bin/jmod"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Build JDK found at $BUILD_JDK did not contain bin/jmod; ignoring" >&5
+$as_echo "$as_me: Potential Build JDK found at $BUILD_JDK did not contain bin/jmod; ignoring" >&6;}
+        BUILD_JDK_FOUND=no
       elif test ! -x "$BUILD_JDK/bin/javac"; then
         # Do we have a bin/javac?
         { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Build JDK found at $BUILD_JDK did not contain bin/javac; ignoring" >&5
@@ -30386,6 +30392,11 @@ $as_echo "yes, will use output dir" >&6; }
     fi
   fi
 
+  JMOD="$BUILD_JDK/bin/jmod"
+  JLINK="$BUILD_JDK/bin/jlink"
+
+
+
   if test "x$BUILD_JDK_FOUND" != "xyes"; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Build JDK" >&5
 $as_echo_n "checking for Build JDK... " >&6; }
diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in
index 13f0a4ff44a..467cc304b20 100644
--- a/common/autoconf/spec.gmk.in
+++ b/common/autoconf/spec.gmk.in
@@ -543,6 +543,8 @@ JAVA_CMD:=@JAVA@
 JAVAC_CMD:=@JAVAC@
 JAVAH_CMD:=@JAVAH@
 JAR_CMD:=@JAR@
+JLINK_CMD := @JLINK@
+JMOD_CMD := @JMOD@
 JARSIGNER_CMD:=@JARSIGNER@
 SJAVAC_SERVER_JAVA_CMD:=@SJAVAC_SERVER_JAVA@
 # These variables are meant to be used. They are defined with = instead of := to make
@@ -553,6 +555,8 @@ JAVA_JAVAC=@FIXPATH@ $(JAVA_CMD) $(JAVA_FLAGS_JAVAC) $(JAVA_FLAGS)
 JAVAC=@FIXPATH@ $(JAVAC_CMD)
 JAVAH=@FIXPATH@ $(JAVAH_CMD)
 JAR=@FIXPATH@ $(JAR_CMD)
+JLINK = @FIXPATH@ $(JLINK_CMD) $(JAVA_TOOL_FLAGS_SMALL)
+JMOD = @FIXPATH@ $(JMOD_CMD) $(JAVA_TOOL_FLAGS_SMALL)
 JARSIGNER=@FIXPATH@ $(JARSIGNER_CMD)
 # A specific java binary with specific options can be used to run
 # the long running background sjavac servers and other long running tasks.
@@ -593,12 +597,8 @@ endif
 NEW_JAVAC   = $(INTERIM_LANGTOOLS_ARGS) $(JAVAC_MAIN_CLASS)
 NEW_JAVADOC = $(INTERIM_LANGTOOLS_ARGS) $(JAVADOC_MAIN_CLASS)
 
-# JLink/Jmod are run using the BUILD_JDK, which is normally the jdk output dir.
 JLINK_KEEP_PACKAGED_MODULES:=@JLINK_KEEP_PACKAGED_MODULES@
 
-JLINK = @FIXPATH@ $(BUILD_JDK)/bin/jlink $(JAVA_TOOL_FLAGS_SMALL)
-JMOD = @FIXPATH@ $(BUILD_JDK)/bin/jmod $(JAVA_TOOL_FLAGS_SMALL)
-
 # Base flags for RC
 # Guarding this against resetting value. Legacy make files include spec multiple
 # times.
diff --git a/make/common/JavaCompilation.gmk b/make/common/JavaCompilation.gmk
index 22e9d908bfc..29940176b04 100644
--- a/make/common/JavaCompilation.gmk
+++ b/make/common/JavaCompilation.gmk
@@ -181,7 +181,7 @@ define SetupJavaCompilationBody
   # Extract the info from the java compiler setup.
   $1_JVM := $$($$($1_SETUP)_JVM)
   $1_JAVAC := $$($$($1_SETUP)_JAVAC)
-  $1_FLAGS := $$($$($1_SETUP)_FLAGS) $(JAVAC_FLAGS) $$($1_ADD_JAVAC_FLAGS)
+  $1_FLAGS := $$($$($1_SETUP)_FLAGS) $$($1_ADD_JAVAC_FLAGS) $(JAVAC_FLAGS)
   ifneq ($$($1_CLASSPATH), )
     $1_FLAGS += -cp $$(call PathList, $$($1_CLASSPATH))
   endif