summaryrefslogtreecommitdiffstats
path: root/tools/llvm-config
diff options
context:
space:
mode:
Diffstat (limited to 'tools/llvm-config')
-rw-r--r--tools/llvm-config/Makefile8
-rw-r--r--tools/llvm-config/llvm-config.cpp11
2 files changed, 14 insertions, 5 deletions
diff --git a/tools/llvm-config/Makefile b/tools/llvm-config/Makefile
index 3f11730..e8c8692 100644
--- a/tools/llvm-config/Makefile
+++ b/tools/llvm-config/Makefile
@@ -57,3 +57,11 @@ $(ObjDir)/BuildVariables.inc: $(BUILDVARIABLES_SRCPATH) Makefile $(ObjDir)/.dir
>> temp.sed
$(Verb) $(SED) -f temp.sed < $< > $@
$(Verb) $(RM) temp.sed
+
+# When cross-compiling, install a version of llvm-config that runs on the host.
+ifeq ($(LLVM_CROSS_COMPILING),1)
+install:: $(DESTDIR)$(PROJ_bindir)
+ $(Echo) Installing llvm-config-host
+ $(Verb) $(ProgInstall) $(BuildLLVMToolDir)/llvm-config \
+ $(DESTDIR)$(PROJ_bindir)/llvm-config-host
+endif
diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
index 126542c..7edf5ec 100644
--- a/tools/llvm-config/llvm-config.cpp
+++ b/tools/llvm-config/llvm-config.cpp
@@ -190,9 +190,9 @@ int main(int argc, char **argv) {
sys::path::parent_path(CurrentPath)).str();
// Check to see if we are inside a development tree by comparing to possible
- // locations (prefix style or CMake style). This could be wrong in the face of
- // symbolic links, but is good enough.
- if (CurrentExecPrefix == std::string(LLVM_OBJ_ROOT) + "/" + LLVM_BUILDMODE) {
+ // locations (prefix style or CMake style).
+ if (sys::fs::equivalent(CurrentExecPrefix,
+ Twine(LLVM_OBJ_ROOT) + "/" + LLVM_BUILDMODE)) {
IsInDevelopmentTree = true;
DevelopmentTreeLayout = MakefileStyle;
@@ -204,11 +204,12 @@ int main(int argc, char **argv) {
} else {
ActiveObjRoot = LLVM_OBJ_ROOT;
}
- } else if (CurrentExecPrefix == std::string(LLVM_OBJ_ROOT)) {
+ } else if (sys::fs::equivalent(CurrentExecPrefix, LLVM_OBJ_ROOT)) {
IsInDevelopmentTree = true;
DevelopmentTreeLayout = CMakeStyle;
ActiveObjRoot = LLVM_OBJ_ROOT;
- } else if (CurrentExecPrefix == std::string(LLVM_OBJ_ROOT) + "/bin") {
+ } else if (sys::fs::equivalent(CurrentExecPrefix,
+ Twine(LLVM_OBJ_ROOT) + "/bin")) {
IsInDevelopmentTree = true;
DevelopmentTreeLayout = CMakeBuildModeStyle;
ActiveObjRoot = LLVM_OBJ_ROOT;
OpenPOWER on IntegriCloud