diff --git a/LCS/Tools/src/finddep b/LCS/Tools/src/finddep
index 0e1eea25f731544f51c8b9fb1f16d201744e2369..8abe97a9453cfafbf653376dab77e8de3ff603fb 100755
--- a/LCS/Tools/src/finddep
+++ b/LCS/Tools/src/finddep
@@ -26,8 +26,41 @@ find $rootdir -name configure.in > tmp.fil
 egrep '^lofar_' `cat tmp.fil` | \
 sed -e 's%.*/LOFAR/%LOFAR/%' -e 's/,.*//' -e 's/).*//' -e 's%/configure.in:lofar_% %' | \
 egrep -v ' GENERAL$' | fgrep -v ' GENERAL(' | \
-sed -e 's% PACKAGE(% LOFAR/%' -e 's% INTERNAL(% LOFAR/%' -e 's% EXTERNAL(% %' -e s'%(.*%%' | \
-sort > finddep.uses
+sed -e 's% PACKAGE(% LOFAR/%' -e 's% INTERNAL(% LOFAR/%' -e 's% EXTERNAL(% %' -e s'%(.*%%' > tmp.uses
+
+# Find all high level packages containing a lofarconf.in, but not containing
+# leaf packages.
+rm -f tmp.out
+touch tmp.out
+for FIL in `find $rootdir -name lofarconf.in`
+do
+  fildir=`dirname $FIL`
+  nm=`find $fildir -name configure.in`
+  if test "$nm" = ""; then
+    echo $fildir >> tmp.out
+  fi
+done
+# Add those packages to the dependencies.
+for fildir in `cat tmp.out`
+do
+  # Get the packages out of the lofarconf.in file. Remove comments.
+  pkgs=`awk '{print $1 $2;}' $fildir/lofarconf.in | sed -e 's/ *#.*//'`
+  for pkg in $pkgs
+  do
+    fildir=`echo $fildir | sed -e 's%.*/LOFAR/%%'`
+    # If pkg does not start with a slash, it is relative to this level.
+    pkgnm=$fildir/$pkg
+    case $pkg in
+    /*)
+      # Remove leading slash
+      pkgnm=`echo $pkg | sed 's%^/%%'`;;
+    esac
+    echo LOFAR/$fildir LOFAR/$pkgnm >> tmp.uses
+  done
+done
+
+# Sort the file on name.
+sort tmp.uses > finddep.uses
 # Make a reversed copy to get the 'used by' relation.
 awk '{ print $2, $1 }' finddep.uses | sort > finddep.used
 
@@ -46,7 +79,7 @@ do
   done
 done
 sort tmp.out | uniq | sed -e 's/#/ /' > finddep.pkg
-rm -r tmp.out tmp.fil
+rm -f tmp.out tmp.fil tmp.uses
 
 # Now 'expand' the uses and used file to get the relations for the
 # higher level packages.