[PATCH] Discourage in-source autoconf builds (as we already do for the cmake build)
Jonathan Roelofs
jonathan at codesourcery.com
Fri Feb 27 15:16:25 PST 2015
Now barfs earlier. Needs autoconf to be run on it, though.
Any benefit to having this in both the configure and the makefile, other than to make it slightly harder to do the wrong thing?
http://reviews.llvm.org/D7961
Files:
Makefile.config.in
autoconf/configure.ac
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=}
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7961.20905.patch
Type: text/x-patch
Size: 1121 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150227/008b15c4/attachment.bin>
More information about the llvm-commits
mailing list