[glom/glom-1-20] cov: Use AC_PATH_PROG().



commit 172d10fe8930474eabd190c8a48bfad990fe4a28
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Nov 25 11:37:38 2011 +0100

    cov: Use AC_PATH_PROG().
    
    * configure.ac: Check for the path to gcov.
    * Makefile.am: Use it.

 ChangeLog    |    7 +++++++
 Makefile.am  |    2 +-
 configure.ac |   20 +++++++++++++-------
 3 files changed, 21 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8e86c19..3d8d98c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2011-11-25  Murray Cumming  <murrayc murrayc com>
 
+	gcov: Use AC_PATH_PROG().
+
+	* configure.ac: Check for the path to gcov.
+	* Makefile.am: Use it.
+
+2011-11-25  Murray Cumming  <murrayc murrayc com>
+
 	Added a "make gcov" target to get some test coverage statistics.
 
 	* configure.ac: Add an --enable-gcov option which add gcc/g++ flags.
diff --git a/Makefile.am b/Makefile.am
index de3bf85..3ef5aed 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -94,7 +94,7 @@ gcov-report.txt: gcov-clean all check
           if [ -z $file_o ]; then \
             echo "Glom: gcov input file (.o) not found."; \
           else \
-	    gcov -o $$file_o $$file_basename > /dev/null; \
+	    $(GCOV) -o $$file_o $$file_basename > /dev/null; \
 	    file_gcov=$$file_basename.gcov; \
 	    if test -f $$file_gcov; then \
 	      actual=`grep -v '        -:' $$file_basename.gcov  | wc -l`; \
diff --git a/configure.ac b/configure.ac
index 43ec748..0fdccdf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -278,15 +278,21 @@ AC_MSG_CHECKING(whether to build with gcov testing)
 AC_ARG_ENABLE(gcov, AS_HELP_STRING([--enable-gcov], [Whether to enable gcov testing]),, enable_gcov=no)
 			
 if test "x$enable_gcov" = "xyes"; then
-	if test "$GCC" = "no"; then
-		AC_MSG_ERROR(not compiling with gcc, which is required for gcov testing)
-	fi
+  if test "$GCC" = "no"; then
+    AC_MSG_ERROR(not compiling with gcc, which is required for gcov testing)
+  fi
 
-	GCOV_CFLAGS="-fprofile-arcs -ftest-coverage"
-	GCOV_LIBS="-lgcov"
+  AC_PATH_PROG(GCOV, [gcov], [no])
+  if test "x$GCOV" = "xno"; then
+    AC_MSG_ERROR([gcov was enabled but gcov was not found.])
+  fi
+  AC_SUBST(GCOV)
 
-	AC_SUBST(GCOV_CFLAGS)
-	AC_SUBST(GCOV_LIBS)
+  GCOV_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
+  GCOV_LIBS="-lgcov"
+
+  AC_SUBST(GCOV_CFLAGS)
+  AC_SUBST(GCOV_LIBS)
 fi
 
 AM_CONDITIONAL(GCOV_ENABLED, test x$enable_gcov = xyes)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]