@@ -43,6 +43,14 @@ AC_DEFUN([_AC_PROG_CC_C89], [[$1]])
dnl This is here so we can set $subdirs directly based on configure
fragments.
AC_CONFIG_SUBDIRS()
+# Validate the build directory as early as possible, so that someone
+# who's made the mistake of casually typing "./configure" in the source
+# directory doesn't have to wait for autoconf to probe a bunch of stuff
+# before it gets around to telling them they made a mistake.
+AS_IF(["`cd $srcdir && pwd -P`" = "`pwd -P`"],
+ [AC_MSG_ERROR([you must configure in a separate build directory])
+])
+
AC_CANONICAL_HOST