changeset 2260:2877f76472f7

Check that cp supports --reflink and use only if it does. 2010-06-14 Andrew John Hughes <ahughes@redhat.com> * Makefile.am: (REFLINK): Set to --reflink=auto if CP_SUPPORTS_REFLINK is defined. (extract-openjdk.stamp): Replace --reflink=auto with $(REFLINK). (generated.stamp): Likewise. (liveconnect-dist.stamp): Likewise. (netx-dist.stamp): Likewise. * acinclude.m4: (IT_CP_SUPPORTS_REFLINK): New macro to check for a cp new enough to have --reflink. * configure.ac: Invoke IT_CP_SUPPORTS_REFLINK.
author Andrew John Hughes <ahughes@redhat.com>
date Mon, 14 Jun 2010 13:41:26 +0100
parents b636f1c1c06b
children 7dd1a3ba46d2
files ChangeLog Makefile.am acinclude.m4 configure.ac
diffstat 4 files changed, 39 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Jun 12 01:24:21 2010 +0100
+++ b/ChangeLog	Mon Jun 14 13:41:26 2010 +0100
@@ -1,3 +1,19 @@
+2010-06-14  Andrew John Hughes  <ahughes@redhat.com>
+
+	* Makefile.am:
+	(REFLINK): Set to --reflink=auto if
+	CP_SUPPORTS_REFLINK is defined.
+	(extract-openjdk.stamp): Replace --reflink=auto
+	with $(REFLINK).
+	(generated.stamp): Likewise.
+	(liveconnect-dist.stamp): Likewise.
+	(netx-dist.stamp): Likewise.
+	* acinclude.m4:
+	(IT_CP_SUPPORTS_REFLINK): New macro to check
+	for a cp new enough to have --reflink.
+	* configure.ac:
+	Invoke IT_CP_SUPPORTS_REFLINK.
+
 2010-06-12  Andrew John Hughes  <ahughes@redhat.com>
 
 	* Makefile.am:
--- a/Makefile.am	Sat Jun 12 01:24:21 2010 +0100
+++ b/Makefile.am	Mon Jun 14 13:41:26 2010 +0100
@@ -236,6 +236,10 @@
   INITIAL_BOOTSTRAP_LINK_STAMP = stamps/bootstrap-directory-symlink-stage2.stamp
 endif
 
+if CP_SUPPORTS_REFLINK
+  REFLINK="--reflink=auto"
+endif
+
 # Target to ensure a patched OpenJDK tree containing Zero & Shark
 # and any overlays is available in $(abs_top_builddir)/openjdk
 OPENJDK_TREE = stamps/overlay.stamp
@@ -1173,7 +1177,7 @@
 
 stamps/extract-openjdk.stamp: stamps/download-openjdk.stamp
 if OPENJDK_SRC_DIR_FOUND
-	cp -pPR --reflink=auto $(OPENJDK_SRC_DIR) openjdk
+	cp -pPR $(REFLINK) $(OPENJDK_SRC_DIR) openjdk
 else
 	set -e ; \
 	if ! test -d openjdk ; then \
@@ -1418,7 +1422,7 @@
 stamps/generated.stamp: stamps/ports.stamp
 	set -e ; \
 	if [ ! -e $(abs_top_builddir)/generated ]; then \
-	  cp -pPR --reflink=auto $(abs_top_srcdir)/generated $(abs_top_builddir); \
+	  cp -pPR $(REFLINK) $(abs_top_srcdir)/generated $(abs_top_builddir); \
 	  find $(abs_top_builddir)/generated -type f -exec chmod 640 '{}' ';' \
 	    -o -type d -exec chmod 750 '{}' ';'; \
 	fi
@@ -2070,7 +2074,7 @@
 	  (cd $(LIVECONNECT_CLASSES) ; \
 	   mkdir -p lib ; \
 	   $(ICEDTEA_BOOT_DIR)/bin/jar cf $(LIVECONNECT_JAR) $(LIVECONNECT_DIR) ; \
-	   cp -pPR --reflink=auto $(PLUGIN_SRCDIR)/java src; \
+	   cp -pPR $(REFLINK) $(PLUGIN_SRCDIR)/java src; \
 	   find src -type f -exec chmod 640 '{}' ';' -o -type d -exec chmod 750 '{}' ';'; \
 	   cd src ; \
 	   $(ZIP) -qr $(LIVECONNECT_SRC) ${LIVECONNECT_DIR} ) ; \
@@ -2107,7 +2111,7 @@
 	(cd $(NETX_CLASSES) ; \
 	 mkdir -p lib ; \
 	 $(ICEDTEA_BOOT_DIR)/bin/jar cf $(NETX_JAR) javax/jnlp net ; \
-	 cp -pPR --reflink=auto $(NETX_SRCDIR) src; \
+	 cp -pPR $(REFLINK) $(NETX_SRCDIR) src; \
 	 find src -type f -exec chmod 640 '{}' ';' -o -type d -exec chmod 750 '{}' ';'; \
 	 cd src ; \
 	 $(ICEDTEA_BOOT_DIR)/bin/jar uf $(NETX_JAR) \
--- a/acinclude.m4	Sat Jun 12 01:24:21 2010 +0100
+++ b/acinclude.m4	Mon Jun 14 13:41:26 2010 +0100
@@ -234,6 +234,20 @@
   AC_SUBST(JAVA)
 ])
 
+AC_DEFUN([IT_CP_SUPPORTS_REFLINK],
+[
+  AC_CACHE_CHECK([if cp supports --reflink], it_cv_reflink, [
+    touch tmp.$$
+    if cp --reflink=auto tmp.$$ tmp2.$$ >&AS_MESSAGE_LOG_FD 2>&1; then
+      it_cv_reflink=yes;
+    else
+      it_cv_reflink=no;
+    fi
+    rm -f tmp.$$ tmp2.$$
+  ])
+  AM_CONDITIONAL([CP_SUPPORTS_REFLINK], test x"${it_cv_reflink}" = "xyes")
+])
+
 AC_DEFUN([WITH_OPENJDK_SRC_DIR],
 [
   AC_MSG_CHECKING(for an OpenJDK source directory)
--- a/configure.ac	Sat Jun 12 01:24:21 2010 +0100
+++ b/configure.ac	Mon Jun 14 13:41:26 2010 +0100
@@ -48,6 +48,7 @@
 AC_PATH_TOOL([LINUX32],[linux32])
 AC_CHECK_GCC_VERSION
 IT_FIND_NUMBER_OF_PROCESSORS
+IT_CP_SUPPORTS_REFLINK
 
 AC_MSG_CHECKING([for a NetBeans installation])
 AC_ARG_WITH([netbeans-home],