From 86cd690cf6a6925b3371fcbb6da844f69585a195 Mon Sep 17 00:00:00 2001
From: Ger van Diepen <diepen@astron.nl>
Date: Fri, 28 Jul 2006 12:23:13 +0000
Subject: [PATCH] BugID: 841 Look in Makefile.am to test if a test program
 really has to be built

---
 autoconf_share/Makefile.common | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/autoconf_share/Makefile.common b/autoconf_share/Makefile.common
index e62a9e73bec..cac41628477 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)" \
-- 
GitLab