diff --git a/autoconf_share/dorubbuild b/autoconf_share/dorubbuild
index 4807c3b29dd8ce7e2606505f21ca20a3d50d0abf..65626ede839596b100c4f34f3562a3aff55fbb5a 100755
--- a/autoconf_share/dorubbuild
+++ b/autoconf_share/dorubbuild
@@ -25,6 +25,20 @@
 
 # This script is used by rubbuild to do the build for a single variant.
 
+# Determine the md5sum to use if not done yet
+# Some systems have md5 instead of md5sum.
+# Note that on some systems which always returns 0.
+if test "$md5pgm" = ""; then
+  md5pgm=`which md5sum 2>&1 | sed -e 's%^[^/].*%%'`
+fi
+if test "$md5pgm" = ""; then
+  md5pgm=`which md5 2>&1 | sed -e 's%^[^/].*%%'`
+fi
+if test "$md5pgm" = ""; then
+  echo "md5sum nor md5 is found"
+  exit 1
+fi
+
 # Get all arguments.
 srcdir=$1
 shift
@@ -186,18 +200,18 @@ do
   initcmd="cd $blddir"
 
   # Determine new md5sum of files affecting the configure.
-  md5sum $srcdir/autoconf_share/variants > $blddir/conf.md5
+  $md5pgm $srcdir/autoconf_share/variants > $blddir/conf.md5
   lfr_host=`uname -n | sed -e "s%\..*%%"`
   if [ -f $srcdir/autoconf_share/variants.$lfr_host ]; then
-    md5sum $srcdir/autoconf_share/variants.$lfr_host >> $blddir/conf.md5
+    $md5pgm $srcdir/autoconf_share/variants.$lfr_host >> $blddir/conf.md5
   fi
   if [ -f $srcdir/$pkg/boot.md5 ]; then
-    md5sum $srcdir/$pkg/boot.md5 >> $blddir/conf.md5
+    $md5pgm $srcdir/$pkg/boot.md5 >> $blddir/conf.md5
   fi
 
   # Create the various parts of the configure and make commands.
   if [ $conf != 0 ]; then
-    # Each configure is started and ended with a special message which can
+    # Each configure is started and ended with a special message which
     # is used by scanbuildlog.
     # The message is not fully composed here, because:
     #  1. the variant name is not known here.
@@ -205,7 +219,7 @@ do
     # Instead variable confmsg1 is created from confmsgst prior to lofarconf.
     confmsgst=':::::: CONFIGURING VARIANT $variant FOR PACKAGE $pkg'
     confmsgend=':::::: FINISHED CONFIGURING VARIANT $variant FOR PACKAGE $pkg'
-    confcmd="(stat=0; chg=1; if [ $conf = 2  -a  -f conf.md5-check ]; then md5sum --check conf.md5-check > /dev/null 2>&1; chg="'$?'"; fi; if [ "'$chg'" = 0 ]; then echo '  package '"$pkg"' needs no configuring; md5sum has not changed'; else rm -f conf.md5-check; echo "'$confmsg1'"; $srcdir/$pkg/lofarconf $confopt && md5sum conf.md5 > conf.md5-check; stat="'$?; echo $confmsg2; fi; exit $stat)'" $ksep "
+    confcmd="(stat=0; chg=1; if [ $conf = 2  -a  -f conf.md5-check ]; then $md5pgm --check conf.md5-check > /dev/null 2>&1; chg="'$?'"; fi; if [ "'$chg'" = 0 ]; then echo '  package '"$pkg"' needs no configuring; md5sum has not changed'; else rm -f conf.md5-check; echo "'$confmsg1'"; $srcdir/$pkg/lofarconf $confopt && $md5pgm conf.md5 > conf.md5-check; stat="'$?; echo $confmsg2; fi; exit $stat)'" $ksep "
   fi
   buildmsgst=':::::: BUILDING VARIANT $variant FOR PACKAGE $pkg'
   buildmsgend=':::::: FINISHED BUILDING VARIANT $variant FOR PACKAGE $pkg'
diff --git a/autoconf_share/rub b/autoconf_share/rub
index d256e1b636cee5732a2e888ad4780fac5afed113..06feae0c7ec97702197e25adbde024f2eaf6d5b3 100755
--- a/autoconf_share/rub
+++ b/autoconf_share/rub
@@ -41,6 +41,18 @@
 pgmpath=`dirname $0`
 pgmpath=`cd $pgmpath > /dev/null 2>&1  &&  pwd`
 
+# Determine the md5sum to use. Some systems have md5 instead of md5sum.
+# Note that on some systems which always returns 0.
+md5pgm=`which md5sum 2>&1 | sed -e 's%^[^/].*%%'`
+if test "$md5pgm" = ""; then
+  md5pgm=`which md5 2>&1 | sed -e 's%^[^/].*%%'`
+fi
+if test "$md5pgm" = ""; then
+  echo "md5sum nor md5 is found"
+  exit 1
+fi
+export md5pgm
+
 # Keep arguments.
 # Put quotes around an argument if it contains special characters.
 # Escape a " in the argument.
@@ -769,11 +781,11 @@ if [ $boot != 0 ]; then
    (
     cd $curwd/$pkg
     # Determine new md5sum of files affecting the bootstrap.
-    md5sum configure.in $pgmpath/*.m4 $pgmpath/makeversion > boot.md5
+    $md5pgm configure.in $pgmpath/*.m4 $pgmpath/makeversion > boot.md5
     # Check if boot.md5 has changed.
     chg=1
     if [ $boot = 2  -a  -f boot.md5-check ]; then
-      md5sum --check boot.md5-check > /dev/null 2>&1
+      $md5pgm --check boot.md5-check > /dev/null 2>&1
       chg=$?
     fi
     if [ $chg = 0 ]; then
@@ -796,8 +808,8 @@ if [ $boot != 0 ]; then
       fi
       # Keep the current md5sum.
       # md5 again, because configure.in might be changed by makeversion.
-      md5sum configure.in $pgmpath/*.m4 $pgmpath/makeversion > boot.md5
-      md5sum boot.md5 configure > boot.md5-check
+      $md5pgm configure.in $pgmpath/*.m4 $pgmpath/makeversion > boot.md5
+      $md5pgm boot.md5 configure > boot.md5-check
       pwd >> $curwd/build.log
     fi
     echo $pkg '# bootstrapped at' `date` >> $curwd/build.result