--- a/bin/aclocal.in
+++ b/bin/aclocal.in
@@ -370,6 +370,12 @@ sub scan_m4_dirs ($$@)
 
   foreach my $m4dir (@dirlist)
     {
+      if (! -d $m4dir)
+        {
+          msg ('override', "warning: skipping not existing directory `$m4dir'");
+          next;
+        }
+
       if (! opendir (DIR, $m4dir))
 	{
 	  # TODO: maybe avoid complaining only if errno == ENONENT?
