[seahorse] Add option --enable-coverage to build with gcov



commit c80924b172a7cafd3dfe2b985685af4552f9ca36
Author: Stef Walter <stefw gnome org>
Date:   Fri Apr 19 20:25:13 2013 +0200

    Add option --enable-coverage to build with gcov

 configure.ac | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
---
diff --git a/configure.ac b/configure.ac
index 47fe947..95e44ac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -508,6 +508,34 @@ fi
 
 AC_MSG_RESULT($strict_status)
 
+AC_MSG_CHECKING([whether to build with gcov testing])
+AC_ARG_ENABLE([coverage],
+               [AS_HELP_STRING([--enable-coverage], [Whether to enable coverage testing ])],
+               [],
+               [enable_coverage=no])
+
+AC_MSG_RESULT([$enable_coverage])
+
+AC_MSG_CHECKING([code coverage])
+
+if test "$enable_coverage" = "yes"; then
+       if test "$GCC" != "yes"; then
+               AC_MSG_ERROR(Coverage testing requires GCC)
+       fi
+
+       AC_PATH_PROG(GCOV, gcov, no)
+       if test "$GCOV" = "no" ; then
+               AC_MSG_ERROR(gcov tool is not available)
+       fi
+
+       CFLAGS="$CFLAGS -O0 -g --coverage"
+       LDFLAGS="$LDFLAGS --coverage"
+fi
+
+AM_CONDITIONAL([WITH_COVERAGE], [test "$enable_coverage" = "yes"])
+
+AC_MSG_RESULT($enable_coverage)
+
 # -----------------------------------------------------------------------------
 
 AC_SUBST(SEAHORSE_CFLAGS)
@@ -540,4 +568,5 @@ Keyserver Support:          $with_keyserver
   Key Sharing:              $enable_sharing
 Debug:                      $debug_status
 Strict:                     $strict_status
+Coverage:                   $enable_coverage
 "


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