--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,6 +1,8 @@
 
 AUTOMAKE_OPTIONS = 1.0 foreign
 
+CFLAGS += -fprofile-arcs -ftest-coverage
+
 DEFS = 
 
 noinst_LTLIBRARIES = libshadow.la
--- a/libmisc/Makefile.am
+++ b/libmisc/Makefile.am
@@ -1,6 +1,8 @@
 
 EXTRA_DIST = .indent.pro xgetXXbyYY.c
 
+CFLAGS += -fprofile-arcs -ftest-coverage
+
 INCLUDES = -I$(top_srcdir)/lib
 
 noinst_LIBRARIES = libmisc.a
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -7,6 +7,8 @@
 suidperms = 4755
 sgidperms = 2755
 
+CFLAGS += -fprofile-arcs -ftest-coverage
+
 INCLUDES = \
 	-I${top_srcdir}/lib \
 	-I$(top_srcdir)/libmisc
--- a/debian/rules
+++ b/debian/rules
@@ -40,6 +40,12 @@
 endif
 export CFLAGS
 
+clean:: clean_gcov
+
+clean_gcov:
+	find . -name "*.gcda" -delete
+	find . -name "*.gcno" -delete
+
 # Add extras to the install process:
 binary-install/login::
 	dh_installpam -p login
--- a/lib/defines.h
+++ b/lib/defines.h
@@ -174,23 +174,9 @@
    trust the formatted time received from the unix domain (or worse,
    UDP) socket.  -MM */
 /* Avoid translated PAM error messages: Set LC_ALL to "C".
+ * This is disabled for coverage testing
  * --Nekral */
-#define SYSLOG(x)							\
-	do {								\
-		char *old_locale = setlocale (LC_ALL, NULL);		\
-		char *saved_locale = NULL;				\
-		if (NULL != old_locale) {				\
-			saved_locale = strdup (old_locale);		\
-		}							\
-		if (NULL != saved_locale) {				\
-			(void) setlocale (LC_ALL, "C");			\
-		}							\
-		syslog x ;						\
-		if (NULL != saved_locale) {				\
-			(void) setlocale (LC_ALL, saved_locale);	\
-			free (saved_locale);				\
-		}							\
-	} while (false)
+#define SYSLOG(x) syslog x
 #else				/* !ENABLE_NLS */
 #define SYSLOG(x) syslog x
 #endif				/* !ENABLE_NLS */
