summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThien-Thi Nguyen <ttn@gnuvola.org>2012-01-20 06:17:26 +0100
committerThien-Thi Nguyen <ttn@gnuvola.org>2012-01-20 06:17:26 +0100
commit63759f08ef431317bf397e3a3c4cf20791b65264 (patch)
treef7a29112b3e66313164fe74e0800eae81140ed15
parent78812d3afd7d6d08f98e091662a689027f3183d7 (diff)
downloadrcs-63759f08ef.tar.gz
[build] Add configure option ‘--enable-coverage’.
* configure.ac (coverage): New AC_ARG_ENABLE. (enable_coverage): Disable if GCC not detected. (CFLAGS) [enable_coverage]: Add ‘--coverage’. (USE_NORMAL_EXIT): New RCS_CBOOL. * src/rcsutil.c [USE_NORMAL_EXIT] (_Exit): New #define.
-rw-r--r--ChangeLog9
-rw-r--r--configure.ac10
-rw-r--r--src/ChangeLog6
-rw-r--r--src/rcsutil.c11
4 files changed, 36 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 37dd45d..6917219 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-01-20 Thien-Thi Nguyen <ttn@gnuvola.org>
+
+ [build] Add configure option ‘--enable-coverage’.
+
+ * configure.ac (coverage): New AC_ARG_ENABLE.
+ (enable_coverage): Disable if GCC not detected.
+ (CFLAGS) [enable_coverage]: Add ‘--coverage’.
+ (USE_NORMAL_EXIT): New RCS_CBOOL.
+
2012-01-18 Thien-Thi Nguyen <ttn@gnuvola.org>
[build] Remove configure option ‘--disable-standalone-compat’.
diff --git a/configure.ac b/configure.ac
index 9fc372b..49e191d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -70,6 +70,11 @@ AC_DEFINE_UNQUOTED([$1],["$[]$1"],[$3])
# --enable, --with
+AC_ARG_ENABLE([coverage],
+ [AS_HELP_STRING([--enable-coverage],[if the compiler is GCC, arrange
+ to include --coverage in CFLAGS and to use exit(3) instead of _Exit(3);
+ this option is intended for maintainers])],,[enable_coverage=no])
+
AC_ARG_ENABLE([compat2],
[AS_HELP_STRING([--enable-compat2],[enable reading of RCS 2.x
files (really ancient, prior to GNU RCS). If you enable this,
@@ -509,6 +514,11 @@ RCS_CBOOL([BAD_WAIT_IF_SIGCHLD_IGNORED],[no],[rcs_cv_tolerant_wait],
# miscellaneous
+AS_IF([RCS_YESP([GCC])],,[enable_coverage=no])
+AS_IF([RCS_YESP([enable_coverage])],[CFLAGS="$CFLAGS --coverage"])
+RCS_CBOOL([USE_NORMAL_EXIT],[yes],[enable_coverage],
+ [Use exit(3) instead of _Exit(3).])
+
AS_IF([test 1 = `expr "$ac_pwd" : '/*'`],[woe=no],[woe=yes])
RCS_CBOOL([WOE],[yes],[woe],[Are we trying to "support" MS-DOS?])
diff --git a/src/ChangeLog b/src/ChangeLog
index da88cf0..00a0b85 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2012-01-20 Thien-Thi Nguyen <ttn@gnuvola.org>
+
+ [build] Add configure option ‘--enable-coverage’.
+
+ * rcsutil.c [USE_NORMAL_EXIT] (_Exit): New #define.
+
2012-01-18 Thien-Thi Nguyen <ttn@gnuvola.org>
[build] Remove configure option ‘--disable-standalone-compat’.
diff --git a/src/rcsutil.c b/src/rcsutil.c
index a9410cd..37b0168 100644
--- a/src/rcsutil.c
+++ b/src/rcsutil.c
@@ -40,6 +40,17 @@
#include "maketime.h"
#include "progname.h"
+/* Unfortunately, using ‘_Exit’ makes coverage analysis
+ (via ‘gcc --coverage’) difficult since the coverage
+ machinery writes the .gcda files only on ‘exit’.
+ Hence this hair. */
+#ifdef USE_NORMAL_EXIT
+#ifdef _Exit
+#undef _Exit
+#endif
+#define _Exit(x) exit (x)
+#endif /* defined USE_NORMAL_EXIT */
+
void
exit_failurefully (void)
{