Index: Makefile.config.in =================================================================== --- Makefile.config.in +++ Makefile.config.in @@ -58,6 +58,10 @@ PROJ_SRC_ROOT := $(LLVM_SRC_ROOT) PROJ_SRC_DIR := $(LLVM_SRC_ROOT)$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR)) +ifeq ($(LLVM_SRC_ROOT), $(LLVM_OBJ_ROOT)) +$(error In-source builds are discouraged. Configure from a separate build directory.) +endif + ifneq ($(CLANG_SRC_ROOT),) CLANG_SRC_ROOT:= $(call realpath, $(CLANG_SRC_ROOT)) PROJ_SRC_DIR := $(patsubst $(LLVM_SRC_ROOT)/tools/clang%,$(CLANG_SRC_ROOT)%,$(PROJ_SRC_DIR)) Index: autoconf/configure.ac =================================================================== --- autoconf/configure.ac +++ autoconf/configure.ac @@ -73,6 +73,11 @@ fi fi +dnl Quit if it is an in-source build +if test ${srcdir} == "." ; then + AC_MSG_ERROR([In-source builds are discouraged. Configure from a separate build directory.]) +fi + dnl Default to empty (i.e. assigning the null string to) CFLAGS and CXXFLAGS, dnl instead of the autoconf default (for example, '-g -O2' for CC=gcc). : ${CFLAGS=}