diff --git a/.gitignore b/.gitignore
index 87455408f01f988aeb205cd55da6ced3d5ef1fb7..e8a873187121a803de6f8ace362389e28b7b8d74 100644
--- a/.gitignore
+++ b/.gitignore
@@ -102,5 +102,3 @@ vendor/luajit/src/luajit
 *.tmp
 cscope.files
 tags
-config.guess
-config.sub
diff --git a/config.guess b/config/config.guess
similarity index 100%
rename from config.guess
rename to config/config.guess
diff --git a/config.sub b/config/config.sub
similarity index 100%
rename from config.sub
rename to config/config.sub
diff --git a/install-sh b/config/install-sh
similarity index 100%
rename from install-sh
rename to config/install-sh
diff --git a/configure.ac b/configure.ac
index 0fa61a364d970fd5cd2e7f6dbf21ee834f07ff57..f27177baf7f1d37f1534df9e5a35846f0b975eb3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7,12 +7,21 @@ AC_INIT([Aegisub], [aegisub_version],, [aegisub])
 : ${CFLAGS=""}
 : ${CXXFLAGS=""}
 AC_CONFIG_SRCDIR([src/main.cpp])
+AC_CONFIG_AUX_DIR([config])
 AC_CONFIG_HEADER([acconf.h])
 AC_CONFIG_MACRO_DIR([m4macros])
 AC_GNU_SOURCE
 AC_CANONICAL_HOST
 AM_SILENT_RULES([yes])
 
+##########################
+# Only run from source dir
+##########################
+AEGISUB_PATH_SOURCE="$(dirname $(readlink -f "$0"))"
+AEGISUB_PATH_BUILD="$(pwd)"
+AS_IF([! test "$AEGISUB_PATH_BUILD" = "$AEGISUB_PATH_BUILD"],
+      [AC_MSG_ERROR([The build directory must be the same as the source directory])])
+
 ###################
 # Required packages
 ###################
@@ -88,6 +97,10 @@ AS_IF([test "x$AEGISUB_APPIMAGE_ENABLED" = "xyes"], [
     AC_PATH_PROG([WGET], [wget])
     AC_PATH_PROG([CHMOD], [chmod])
 
+    AS_IF([test "$PATCHELF" = "notfound"],  [AC_MSG_ERROR([patchelf is required for AppImage generation])])
+    AS_IF([test "$WGET" = "notfound"],      [AC_MSG_ERROR([wget is required for AppImage generation])])
+    AS_IF([test "$CHMOD" = "notfound"],     [AC_MSG_ERROR([chmod is required for AppImage generation])])
+
     # Download the AppImage creation tool, transforms the AppDir into an AppImage
     AC_MSG_CHECKING([Downloading AppImage creation tool])
     $WGET https://github.com/probonopd/AppImageKit/releases/download/continuous/appimagetool-`arch`.AppImage -O tools/appimagetool.AppImage -o config.wget.log
diff --git a/header.mk b/header.mk
index faf35b7366772080a8f56fce4883299461a1a706..e9c7721b2ff196f4e2d34f1fff264cb594a1e60c 100644
--- a/header.mk
+++ b/header.mk
@@ -33,6 +33,7 @@ DISTCLEANFILES += \
 	$(TOP)build/git_version.h \
 	$(TOP)Makefile.inc \
 	$(TOP)config.log \
+	$(TOP)config.wget.log \
 	$(TOP)acconf.h.in \
 	$(TOP)config.status \
 	$(TOP)autom4te.cache \
@@ -41,6 +42,9 @@ DISTCLEANFILES += \
 CLEANFILES += \
 	$(wildcard $(TOP)Aegisub/usr/lib/*) \
 	$(TOP)Aegisub-x86_64.AppImage \
+	$(TOP)cscope.files \
+	$(TOP)cscope.out \
+	$(TOP)tags \
 
 CLEANDIRS += \
 	$(TOP)Aegisub \