diff --git a/meta/classes/autotools.bbclass b/meta/classes/autotools.bbclass
index 4c4bf87..1ab2e0c 100644
--- a/meta/classes/autotools.bbclass
+++ b/meta/classes/autotools.bbclass
@@ -89,7 +89,16 @@ oe_runconf () {
 
 AUTOTOOLS_AUXDIR ?= "${S}"
 
+CONFIGURESTAMPFILE = "${WORKDIR}/configure.sstate"
+
 autotools_do_configure() {
+	if [ -n "${CONFIGURESTAMPFILE}" -a -e "${CONFIGURESTAMPFILE}" ]; then
+		if [ "`cat ${CONFIGURESTAMPFILE}`" != "${BB_TASKHASH}" ]; then
+			echo "Previously configured build detected, running make distclean"
+			oe_runmake distclean
+		fi
+	fi
+
 	case ${PN} in
 	autoconf*)
 	;;
@@ -180,6 +189,9 @@ autotools_do_configure() {
 	else
 		bbnote "nothing to configure"
 	fi
+	if [ -n "${CONFIGURESTAMPFILE}" ]; then
+		echo ${BB_TASKHASH} > ${CONFIGURESTAMPFILE}
+	fi
 }
 
 autotools_do_install() {
