diff --git a/autoconf_share/Makefile.common b/autoconf_share/Makefile.common
index e62a9e73becebe0ae58f206f73da2b6b30172afd..cac41628477aff22cb0a833e89bebf8d6b789e49 100644
--- a/autoconf_share/Makefile.common
+++ b/autoconf_share/Makefile.common
@@ -32,6 +32,7 @@ DISTCLEANFILES=\
 
 # Rule to delete all files generated by bootstrap.
 # This is sometimes needed when switching to another version of autotools.
+confclean: pkgclean
 pkgclean: distclean
 	  -rm -rf $(srcdir)/autom4te.cache
 	  -rm -f $(srcdir)/config.*
@@ -103,9 +104,14 @@ checkrun:
 	   if [ "$$bcurwd" != test ]; then \
 	     echo "Error: run (mem)checkrun in test directory"; \
 	   else \
+	     PGMB=; \
 	     PGMT=; \
 	     for PGMVAR in $(PGM) ; \
 	     do \
+	       grep "^ *$${PGMVAR}_SOURCES" $(srcdir)/Makefile.am >& /dev/null; \
+	       if [ $$? = 0 ]; then \
+	         PGMB="$$PGMB $$PGMVAR"; \
+	       fi; \
 	       PGMTST=$$PGMVAR; \
 	       if [ -f $(srcdir)/$${PGMVAR}.sh ] ; then \
 	         PGMTST=$(srcdir)/$${PGMVAR}.sh; \
@@ -114,8 +120,8 @@ checkrun:
 	       fi; \
 	       PGMT="$$PGMT $$PGMTST"; \
 	     done; \
-	     echo "make check CHECKTOOL='$(CHECKTOOL)' check_PROGRAMS='$$PGM' TESTS='$$PGMT'"; \
-	     make check CHECKTOOL="$(CHECKTOOL)" check_PROGRAMS="$$PGM" TESTS="$$PGMT"; \
+	     echo "make check CHECKTOOL='$(CHECKTOOL)' check_PROGRAMS='$$PGMB' TESTS='$$PGMT'"; \
+	     make check CHECKTOOL="$(CHECKTOOL)" check_PROGRAMS="$$PGMB" TESTS="$$PGMT"; \
 	   fi \
 	 fi
 
@@ -264,6 +270,7 @@ help:
 # Define the default variables to export to the test scripts.
 #TESTS_ENVIRONMENT = LOFARROOT="$(LOFARROOT)" \
 #		    lofar_sharedir="$(lofar_sharedir)" \
+#                   prefix="$(prefix)" \
 #                   top_srcdir="$(top_srcdir)" \
 #                   srcdir="$(srcdir)" \
 #		    CHECKTOOLPROGS="$(CHECKTOOLPROGS)" \