diff --git a/config-ml.in b/config-ml.in
index 527e781e697b37029859e018d14833d67702b5b8..2ba21f45ac5d46b883ad7a857f37a400548454c0 100644
--- a/config-ml.in
+++ b/config-ml.in
@@ -564,6 +564,13 @@ if [ -n "${multidirs}" ] && [ -z "${ml_norecursion}" ]; then
       fi
       (cd ${ml_dir}/${ml_libdir};
        ../${dotdot}${ml_unsubdir}symlink-tree ../${dotdot}${ml_unsubdir}${ml_libdir} "")
+      if [ -f ${ml_dir}/${ml_libdir}/Makefile ]; then
+	if [ x"${MAKE}" = x ]; then
+	  (cd ${ml_dir}/${ml_libdir}; make distclean)
+	else
+	  (cd ${ml_dir}/${ml_libdir}; ${MAKE} distclean)
+	fi
+      fi
       ml_newsrcdir="."
       ml_srcdiroption=
       multisrctop=${dotdot}