changeset 2690:27ceed26e16e

PR2932: Support ccache in a non-automagic manner 2016-07-17 Andrew John Hughes <gnu.andrew@member.fsf.org> PR2932: Support ccache in a non-automagic manner * INSTALL: Document --disable-ccache. * Makefile.am: (ICEDTEA_COMMON_ENV): Introduce to share common environment variables for configure and make. (ICEDTEA_CONFIGURE_ENV): Include ICEDTEA_COMMON_ENV. (ICEDTEA_CONFIGURE): Pass --enable--cache or --disable-ccache depending on whether USE_CCACHE is set or not. (ICEDTEA_ENV): Include ICEDTEA_COMMON_ENV. * NEWS: Updated. * acinclude.m4: (IT_ENABLE_CCACHE): Add option to explicitly enable or disable ccache. We also detect if there is a compiler wrapper on the PATH and remove it if so (OpenJDK doesn't like it). * configure.ac: Detect which. Cluster other tool detection calls together. Invoke IT_ENABLE_CCACHE.
author Andrew John Hughes <gnu_andrew@member.fsf.org>
date Mon, 18 Jul 2016 05:43:30 +0100
parents 46f8680e14e0
children 4735bd39ff61
files ChangeLog INSTALL Makefile.am NEWS acinclude.m4 configure.ac
diffstat 6 files changed, 87 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Jul 18 04:11:46 2016 +0100
+++ b/ChangeLog	Mon Jul 18 05:43:30 2016 +0100
@@ -1,3 +1,25 @@
+2016-07-17  Andrew John Hughes  <gnu.andrew@member.fsf.org>
+
+	PR2932: Support ccache in a non-automagic manner
+	* INSTALL: Document --disable-ccache.
+	* Makefile.am:
+	(ICEDTEA_COMMON_ENV): Introduce to share
+	common environment variables for configure and make.
+	(ICEDTEA_CONFIGURE_ENV): Include ICEDTEA_COMMON_ENV.
+	(ICEDTEA_CONFIGURE): Pass --enable--cache or
+	--disable-ccache depending on whether USE_CCACHE
+	is set or not.
+	(ICEDTEA_ENV): Include ICEDTEA_COMMON_ENV.
+	* NEWS: Updated.
+	* acinclude.m4:
+	(IT_ENABLE_CCACHE): Add option to explicitly
+	enable or disable ccache. We also detect if
+	there is a compiler wrapper on the PATH and remove it
+	if so (OpenJDK doesn't like it).
+	* configure.ac:
+	Detect which. Cluster other tool detection
+	calls together. Invoke IT_ENABLE_CCACHE.
+
 2016-07-17  Andrew John Hughes  <gnu.andrew@member.fsf.org>
 
 	PR2821: Support building OpenJDK
--- a/INSTALL	Mon Jul 18 04:11:46 2016 +0100
+++ b/INSTALL	Mon Jul 18 05:43:30 2016 +0100
@@ -214,6 +214,7 @@
 * --enable-non-nss-curves: Define curves beyond the three specified by NSS (NIST P-{256,384,521})
 * --enable-infinality: Use fontconfig for better font rendering
 * --enable-headless: Build OpenJDK without graphical UI support
+* --disable-cache: Don't use ccache to speed up recompilations (default is to use if available)
 
 Testing
 =======
--- a/Makefile.am	Mon Jul 18 04:11:46 2016 +0100
+++ b/Makefile.am	Mon Jul 18 05:43:30 2016 +0100
@@ -399,6 +399,12 @@
 ICEDTEA_PKG = $(EMPTY) (${PKGVERSION})
 endif
 
+ICEDTEA_COMMON_ENV = \
+	LANG="C" \
+	PATH="$(BOOT_DIR)/bin:$(OS_PATH):$(NO_CCACHE_PATH)" \
+	CLASSPATH="" \
+	LD_LIBRARY_PATH=""
+
 ICEDTEA_CONFIGURE = \
 	  --build=$(build_triplet) \
 	  --host=$(host_triplet) \
@@ -414,6 +420,7 @@
 	  --with-java-debug-symbols=yes
 
 ICEDTEA_CONFIGURE_ENV = \
+	${ICEDTEA_COMMON_ENV} \
 	FREETYPE_CFLAGS="${FREETYPE2_CFLAGS}" \
 	FREETYPE_LIBS="${FREETYPE2_LIBS}"
 
@@ -523,6 +530,14 @@
 	--disable-headful
 endif
 
+if USE_CCACHE
+ICEDTEA_CONFIGURE += \
+	--enable-ccache
+else
+ICEDTEA_CONFIGURE += \
+	--disable-ccache
+endif
+
 ICEDTEA_UNSET = \
 	JAVAC= \
 	JAVA_HOME= \
@@ -530,10 +545,7 @@
 	OS=
 
 ICEDTEA_ENV = \
-	LANG="C" \
-	PATH="$(BOOT_DIR)/bin:$(OS_PATH):$$PATH" \
-	CLASSPATH="" \
-	LD_LIBRARY_PATH="" \
+	${ICEDTEA_COMMON_ENV} \
 	ZERO_LIBARCH="$(ZERO_LIBARCH)" \
 	ARCH_DATA_MODEL="$(ZERO_BITSPERWORD)" \
 	ZERO_ENDIANNESS="$(ZERO_ENDIANNESS)" \
--- a/NEWS	Mon Jul 18 04:11:46 2016 +0100
+++ b/NEWS	Mon Jul 18 05:43:30 2016 +0100
@@ -183,6 +183,7 @@
   - PR2821: Support building OpenJDK with --disable-headful
   - PR2822: Feed LIBS & CFLAGS into configure rather than make to avoid re-discovery by OpenJDK configure
   - PR2931, G478960: Provide Infinality Support via fontconfig
+  - PR2932: Support ccache in a non-automagic manner
   - PR2974: PKCS#10 certificate requests now use CRLF line endings rather than system line endings
   - PR3083, RH1346460: Regression in SSL debug output without an ECC provider
   - PR3089: Remove old memory limits patch
--- a/acinclude.m4	Mon Jul 18 04:11:46 2016 +0100
+++ b/acinclude.m4	Mon Jul 18 05:43:30 2016 +0100
@@ -2358,3 +2358,45 @@
   AM_CONDITIONAL(BUILD_HEADLESS, test x"${ENABLE_HEADLESS}" = "xyes")
   AC_SUBST(ENABLE_HEADLESS)
 ])
+
+AC_DEFUN_ONCE([IT_ENABLE_CCACHE],
+[
+  AC_MSG_CHECKING([whether to use ccache to speed up recompilations])
+  AC_ARG_ENABLE([ccache],
+	      [AS_HELP_STRING(--enable-ccache,use ccache to speed up recompilations [[default=yes if ccache detected]])],
+  [
+    case "${enableval}" in
+      no)
+        ENABLE_CCACHE=no
+        ;;
+      *)
+        ENABLE_CCACHE=yes
+        ;;
+    esac
+    AC_MSG_RESULT(${ENABLE_CCACHE})
+  ],
+  [
+    AC_MSG_RESULT([if available])
+    AC_PATH_PROG(CCACHE, "ccache")
+    if test -z "${CCACHE}"; then
+      ENABLE_CCACHE="no"
+    else
+      ENABLE_CCACHE="yes"
+    fi
+  ])
+  AC_MSG_CHECKING([if there is a ccache gcc wrapper on the PATH])
+  ABS_CC=$(${WHICH} ${CC})
+  REAL_GCC=$(${READLINK} -e ${ABS_CC})
+  if test "x$(basename ${REAL_GCC})" = "xccache"; then
+     AC_MSG_RESULT([yes; ${CC} resolves to ${REAL_GCC}])
+     NO_CCACHE_PATH=$(sed "s#@<:@^:@:>@*$(dirname ${ABS_CC}):##g" <<< "${PATH}")
+     AC_MSG_NOTICE([Using ${NO_CCACHE_PATH} as PATH])
+  else
+     AC_MSG_RESULT([no; ${CC} resolves to ${REAL_GCC}])
+     NO_CCACHE_PATH=${PATH}
+  fi
+  AM_CONDITIONAL(USE_CCACHE, test x"${ENABLE_CCACHE}" = "xyes")
+  AC_SUBST(ENABLE_CCACHE)
+  AC_SUBST(NO_CCACHE_PATH)
+])
+
--- a/configure.ac	Mon Jul 18 04:11:46 2016 +0100
+++ b/configure.ac	Mon Jul 18 05:43:30 2016 +0100
@@ -41,12 +41,14 @@
 dnl OpenJDK's README-builds.html lists gawk as a build dependency so we
 dnl check for it explicitly rather than using AC_PROG_AWK.
 IT_FIND_TOOL([GAWK], [gawk])
+IT_FIND_TOOL([WHICH], [which])
+AC_PATH_TOOL([LSB_RELEASE],[lsb_release])
+AC_PATH_TOOL([LINUX32],[linux32])
+
 IT_CHECK_FOR_MERCURIAL
 IT_OBTAIN_HG_REVISIONS
-AC_PATH_TOOL([LSB_RELEASE],[lsb_release])
 IT_CHECK_FOR_RMDIR
 IT_WITH_HOTSPOT_BUILD
-AC_PATH_TOOL([LINUX32],[linux32])
 IT_CHECK_GCC_VERSION
 IT_FIND_NUMBER_OF_PROCESSORS
 IT_CP_SUPPORTS_REFLINK
@@ -123,6 +125,7 @@
 IT_CHECK_ADDITIONAL_VMS
 IT_ENABLE_NON_NSS_CURVES
 IT_ENABLE_HEADLESS
+IT_ENABLE_CCACHE
 
 IT_WITH_VERSION_SUFFIX
 IT_ENABLE_HG