aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Northover <Tim.Northover@arm.com>2013-05-04 07:36:23 +0000
committerTim Northover <Tim.Northover@arm.com>2013-05-04 07:36:23 +0000
commitd66ad6c57115e85487e8a29b1e073305690a9be2 (patch)
treed02875051b4844dd132edd4ba5dfdd516e82c02b
parentc1685b3a5052de377735f69e53e50741dbe5b52a (diff)
downloadexternal_llvm-d66ad6c57115e85487e8a29b1e073305690a9be2.zip
external_llvm-d66ad6c57115e85487e8a29b1e073305690a9be2.tar.gz
external_llvm-d66ad6c57115e85487e8a29b1e073305690a9be2.tar.bz2
Allow host triple to be correctly overridden in CMake builds
The intended semantics mirror autoconf, where the user is able to specify a host triple, but if it's left to the build system then "config.guess" is invoked for the default. This also renames the LLVM_HOSTTRIPLE define to LLVM_HOST_TRIPLE to fit in with the style of the surrounding defines. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181112 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--autoconf/configure.ac2
-rwxr-xr-xcmake/config-ix.cmake9
-rwxr-xr-xconfigure2
-rw-r--r--include/llvm/Config/config.h.cmake2
-rw-r--r--include/llvm/Config/config.h.in2
-rw-r--r--include/llvm/Config/llvm-config.h.cmake2
-rw-r--r--include/llvm/Config/llvm-config.h.in2
-rw-r--r--lib/Support/Host.cpp2
-rw-r--r--test/Makefile2
-rw-r--r--test/lit.site.cfg.in2
10 files changed, 14 insertions, 13 deletions
diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index d1c740f..438b283 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -1777,7 +1777,7 @@ AC_DEFINE_UNQUOTED(LLVM_MANDIR, "$LLVM_MANDIR",
[Installation directory for man pages])
AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME",
[Time at which LLVM was configured])
-AC_DEFINE_UNQUOTED(LLVM_HOSTTRIPLE, "$host",
+AC_DEFINE_UNQUOTED(LLVM_HOST_TRIPLE, "$host",
[Host triple LLVM will be executed on])
AC_DEFINE_UNQUOTED(LLVM_DEFAULT_TARGET_TRIPLE, "$target",
[Target triple LLVM will generate code for by default])
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index 94916b8..11c6344 100755
--- a/cmake/config-ix.cmake
+++ b/cmake/config-ix.cmake
@@ -340,12 +340,13 @@ if (CMAKE_COMPILER_IS_GNUCXX)
endif()
endif()
-include(GetHostTriple)
-get_host_triple(LLVM_HOST_TRIPLE)
-
# By default, we target the host, but this can be overridden at CMake
# invocation time.
-set(LLVM_HOSTTRIPLE "${LLVM_HOST_TRIPLE}")
+include(GetHostTriple)
+get_host_triple(LLVM_INFERRED_HOST_TRIPLE)
+
+set(LLVM_HOST_TRIPLE "${LLVM_INFERRED_HOST_TRIPLE}" CACHE STRING
+ "Host on which LLVM binaries will run")
# Determine the native architecture.
string(TOLOWER "${LLVM_TARGET_ARCH}" LLVM_NATIVE_ARCH)
diff --git a/configure b/configure
index 9225f41..b52ae44 100755
--- a/configure
+++ b/configure
@@ -22375,7 +22375,7 @@ _ACEOF
cat >>confdefs.h <<_ACEOF
-#define LLVM_HOSTTRIPLE "$host"
+#define LLVM_HOST_TRIPLE "$host"
_ACEOF
diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake
index 93c2582..32d192e 100644
--- a/include/llvm/Config/config.h.cmake
+++ b/include/llvm/Config/config.h.cmake
@@ -589,7 +589,7 @@
#cmakedefine01 LLVM_HAS_ATOMICS
/* Host triple LLVM will be executed on */
-#cmakedefine LLVM_HOSTTRIPLE "${LLVM_HOSTTRIPLE}"
+#cmakedefine LLVM_HOST_TRIPLE "${LLVM_HOST_TRIPLE}"
/* Installation directory for include files */
#cmakedefine LLVM_INCLUDEDIR "${LLVM_INCLUDEDIR}"
diff --git a/include/llvm/Config/config.h.in b/include/llvm/Config/config.h.in
index 7fa00b8..950e66f 100644
--- a/include/llvm/Config/config.h.in
+++ b/include/llvm/Config/config.h.in
@@ -594,7 +594,7 @@
#undef LLVM_HAS_ATOMICS
/* Host triple LLVM will be executed on */
-#undef LLVM_HOSTTRIPLE
+#undef LLVM_HOST_TRIPLE
/* Installation directory for include files */
#undef LLVM_INCLUDEDIR
diff --git a/include/llvm/Config/llvm-config.h.cmake b/include/llvm/Config/llvm-config.h.cmake
index eda17ee..c6f2bef 100644
--- a/include/llvm/Config/llvm-config.h.cmake
+++ b/include/llvm/Config/llvm-config.h.cmake
@@ -41,7 +41,7 @@
#cmakedefine01 LLVM_HAS_ATOMICS
/* Host triple LLVM will be executed on */
-#cmakedefine LLVM_HOSTTRIPLE "${LLVM_HOSTTRIPLE}"
+#cmakedefine LLVM_HOST_TRIPLE "${LLVM_HOST_TRIPLE}"
/* Installation directory for include files */
#cmakedefine LLVM_INCLUDEDIR "${LLVM_INCLUDEDIR}"
diff --git a/include/llvm/Config/llvm-config.h.in b/include/llvm/Config/llvm-config.h.in
index af3a324..a5209fa 100644
--- a/include/llvm/Config/llvm-config.h.in
+++ b/include/llvm/Config/llvm-config.h.in
@@ -41,7 +41,7 @@
#undef LLVM_HAS_ATOMICS
/* Host triple LLVM will be executed on */
-#undef LLVM_HOSTTRIPLE
+#undef LLVM_HOST_TRIPLE
/* Installation directory for include files */
#undef LLVM_INCLUDEDIR
diff --git a/lib/Support/Host.cpp b/lib/Support/Host.cpp
index 8657abc..a7c7a95 100644
--- a/lib/Support/Host.cpp
+++ b/lib/Support/Host.cpp
@@ -613,7 +613,7 @@ bool sys::getHostCPUFeatures(StringMap<bool> &Features){
#endif
std::string sys::getProcessTriple() {
- Triple PT(LLVM_HOSTTRIPLE);
+ Triple PT(LLVM_HOST_TRIPLE);
if (sizeof(void *) == 8 && PT.isArch32Bit())
PT = PT.get64BitArchVariant();
diff --git a/test/Makefile b/test/Makefile
index 2213319..88573c5 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -125,7 +125,7 @@ endif
lit.site.cfg: FORCE
@echo "Making LLVM 'lit.site.cfg' file..."
- @$(ECHOPATH) s=@LLVM_HOSTTRIPLE@=$(HOST_TRIPLE)=g > lit.tmp
+ @$(ECHOPATH) s=@LLVM_HOST_TRIPLE@=$(HOST_TRIPLE)=g > lit.tmp
@$(ECHOPATH) s=@TARGET_TRIPLE@=$(TARGET_TRIPLE)=g >> lit.tmp
@$(ECHOPATH) s=@LLVM_SOURCE_DIR@=$(LLVM_SRC_ROOT)=g >> lit.tmp
@$(ECHOPATH) s=@LLVM_BINARY_DIR@=$(LLVM_OBJ_ROOT)=g >> lit.tmp
diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in
index 3a680b2..1ae99eb 100644
--- a/test/lit.site.cfg.in
+++ b/test/lit.site.cfg.in
@@ -1,6 +1,6 @@
## Autogenerated by LLVM/Clang configuration.
# Do not edit!
-config.host_triple = "@LLVM_HOSTTRIPLE@"
+config.host_triple = "@LLVM_HOST_TRIPLE@"
config.target_triple = "@TARGET_TRIPLE@"
config.llvm_src_root = "@LLVM_SOURCE_DIR@"
config.llvm_obj_root = "@LLVM_BINARY_DIR@"