diff options
-rw-r--r-- | Makefile.config.in | 10 | ||||
-rw-r--r-- | autoconf/configure.ac | 11 | ||||
-rwxr-xr-x | configure | 23 | ||||
-rw-r--r-- | tools/Makefile | 12 |
4 files changed, 49 insertions, 7 deletions
diff --git a/Makefile.config.in b/Makefile.config.in index fff482e7774..9755a5de078 100644 --- a/Makefile.config.in +++ b/Makefile.config.in @@ -46,11 +46,19 @@ realpath = $(shell cd $(1); $(PWD)) PROJ_OBJ_DIR := $(call realpath, .) PROJ_OBJ_ROOT := $(call realpath, $(PROJ_OBJ_DIR)/$(LEVEL)) +CLANG_SRC_ROOT := @CLANG_SRC_ROOT@ + ifeq ($(PROJECT_NAME),llvm) LLVM_SRC_ROOT := $(call realpath, @abs_top_srcdir@) LLVM_OBJ_ROOT := $(call realpath, @abs_top_builddir@) PROJ_SRC_ROOT := $(LLVM_SRC_ROOT) -PROJ_SRC_DIR := $(call realpath, $(LLVM_SRC_ROOT)/$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR))) +PROJ_SRC_DIR := $(LLVM_SRC_ROOT)$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR)) + +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)) +endif + prefix := @prefix@ PROJ_prefix := $(prefix) PROJ_VERSION := $(LLVMVersion) diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 128dd7f9786..b8b61bc16b4 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -795,6 +795,17 @@ case "$withval" in *) AC_MSG_ERROR([Invalid path for --with-ocaml-libdir. Provide full path]) ;; esac +AC_ARG_WITH(clang-srcdir, + AS_HELP_STRING([--with-clang-srcdir], + [Directory to the out-of-tree Clang source]),, + withval="-") +case "$withval" in + -) clang_src_root="" ;; + /* | [[A-Za-z]]:[[\\/]]*) clang_src_root="$withval" ;; + *) clang_src_root="$ac_pwd/$withval" ;; +esac +AC_SUBST(CLANG_SRC_ROOT,[$clang_src_root]) + AC_ARG_WITH(clang-resource-dir, AS_HELP_STRING([--with-clang-resource-dir], [Relative directory from the Clang binary for resource files]),, diff --git a/configure b/configure index 49e189a4696..c8b3c767ad0 100755 --- a/configure +++ b/configure @@ -708,6 +708,7 @@ ENABLE_CBE_PRINTF_A OPTIMIZE_OPTION EXTRA_OPTIONS EXTRA_LD_OPTIONS +CLANG_SRC_ROOT BINUTILS_INCDIR NM ifGNUmake @@ -1433,6 +1434,7 @@ Optional Packages: --with-extra-ld-options Specify additional options to link LLVM with --with-ocaml-libdir Specify install location for ocaml bindings (default is stdlib) + --with-clang-srcdir Directory to the out-of-tree Clang source --with-clang-resource-dir Relative directory from the Clang binary for resource files @@ -5510,6 +5512,22 @@ echo "$as_me: error: Invalid path for --with-ocaml-libdir. Provide full path" >& esac +# Check whether --with-clang-srcdir was given. +if test "${with_clang_srcdir+set}" = set; then + withval=$with_clang_srcdir; +else + withval="-" +fi + +case "$withval" in + -) clang_src_root="" ;; + /* | [A-Za-z]:[\\/]*) clang_src_root="$withval" ;; + *) clang_src_root="$ac_pwd/$withval" ;; +esac +CLANG_SRC_ROOT=$clang_src_root + + + # Check whether --with-clang-resource-dir was given. if test "${with_clang_resource_dir+set}" = set; then withval=$with_clang_resource_dir; @@ -10453,7 +10471,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 10456 "configure" +#line 10474 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -21906,6 +21924,7 @@ ENABLE_CBE_PRINTF_A!$ENABLE_CBE_PRINTF_A$ac_delim OPTIMIZE_OPTION!$OPTIMIZE_OPTION$ac_delim EXTRA_OPTIONS!$EXTRA_OPTIONS$ac_delim EXTRA_LD_OPTIONS!$EXTRA_LD_OPTIONS$ac_delim +CLANG_SRC_ROOT!$CLANG_SRC_ROOT$ac_delim BINUTILS_INCDIR!$BINUTILS_INCDIR$ac_delim NM!$NM$ac_delim ifGNUmake!$ifGNUmake$ac_delim @@ -21987,7 +22006,7 @@ LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 88; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 89; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/tools/Makefile b/tools/Makefile index 68ce314c92a..2da39177815 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -9,8 +9,15 @@ LEVEL := .. +include $(LEVEL)/Makefile.config + # Build clang if present. -OPTIONAL_PARALLEL_DIRS := clang + +ifneq ($(CLANG_SRC_ROOT),) + OPTIONAL_PARALLEL_DIRS := $(CLANG_SRC_ROOT) +else + OPTIONAL_PARALLEL_DIRS := clang +endif # Build LLDB if present. Note LLDB must be built last as it depends on the # wider LLVM infrastructure (including Clang). @@ -36,9 +43,6 @@ ifdef ONLY_TOOLS PARALLEL_DIRS := $(filter-out lldb,$(ONLY_TOOLS)) endif -include $(LEVEL)/Makefile.config - - # These libraries build as dynamic libraries (.dylib /.so), they can only be # built if ENABLE_PIC is set. ifndef ONLY_TOOLS |