[Libguestfs] [PATCH libguestfs] build: enable automake's color-tests option

Jim Meyering jim at meyering.net
Wed Aug 12 09:30:19 UTC 2009


Only marginally useful, but some like it...
This makes tests print "PASS" in green, and "FAIL" in red, when possible:

The autogen.sh snippet ensures that this automake-1.11 feature
is disabled when building-from-clone on a system with too-old automake.
This *does* modify a source file (and a version-controlled one at that),
but only when building from source on e.g. RHEL*

>From 897dab226d5d4ad5f83026d8baa730b072b1f6cd Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Mon, 10 Aug 2009 14:08:57 +0200
Subject: [PATCH libguestfs] build: enable automake's color-tests option

* configure.ac (AM_INIT_AUTOMAKE): Add color-tests.
* daemon/configure.ac: Likewise.
* autogen.sh: Detect a too-old version of automake, and if found,
dumb-down our usage of AM_INIT_AUTOMAKE to exclude the offending option.
---
 autogen.sh          |    9 +++++++++
 configure.ac        |    2 +-
 daemon/configure.ac |    2 +-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/autogen.sh b/autogen.sh
index 5179623..25cf94e 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -32,6 +32,15 @@ else
     ./bootstrap && echo "$t" > $curr_status
 fi

+# In order to accommodate versions of automake that are older than 1.11
+# remove options that we find useful but that would otherwise not be recognized.
+v=$(automake --version | { read ver && echo ${ver#*) }; })
+case $v in
+    1.1[1-9]*|[2-9]*) ;; # Good!
+    *) perl -pi -e 's/(AM_INIT_AUTOMAKE\(\[.*?)\s*color-tests\s*(.*)/$1 $2/'\
+	configure.ac daemon/configure.ac ;;
+esac
+
 mkdir -p daemon/m4
 autoreconf -i

diff --git a/configure.ac b/configure.ac
index a78ca51..27e5be9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,7 +24,7 @@ m4_define([libguestfs_extra],   [])

 AC_INIT([libguestfs],libguestfs_major.libguestfs_minor.libguestfs_release[]libguestfs_extra)
 AC_CONFIG_AUX_DIR([build-aux])
-AM_INIT_AUTOMAKE([foreign])
+AM_INIT_AUTOMAKE([foreign color-tests])

 m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])
 AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
diff --git a/daemon/configure.ac b/daemon/configure.ac
index 43e331b..cd31fa8 100644
--- a/daemon/configure.ac
+++ b/daemon/configure.ac
@@ -17,7 +17,7 @@

 AC_INIT([libguestfs-daemon],[1.0.0])
 AC_CONFIG_AUX_DIR([build-aux])
-AM_INIT_AUTOMAKE([foreign])
+AM_INIT_AUTOMAKE([foreign color-tests])

 m4_ifndef([AM_SILENT_RULES], [m4_define([AM_SILENT_RULES],[])])
 AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
--
1.6.4.300.gc9df




More information about the Libguestfs mailing list