aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/Unix/Host.inc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Support/Unix/Host.inc')
-rw-r--r--lib/Support/Unix/Host.inc6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Support/Unix/Host.inc b/lib/Support/Unix/Host.inc
index 5fd0e5e079..0f3e31a41b 100644
--- a/lib/Support/Unix/Host.inc
+++ b/lib/Support/Unix/Host.inc
@@ -22,12 +22,18 @@
#include <sys/utsname.h>
#include <cctype>
#include <string>
+#include <cstdlib> // ::getenv
using namespace llvm;
static std::string getOSVersion() {
struct utsname info;
+ // Recognize UNAME_RELEASE environment variable to match Darwin uname.
+ const char *UnameOverride = ::getenv("UNAME_RELEASE");
+ if (UnameOverride && UnameOverride[0] != '\0')
+ return UnameOverride;
+
if (uname(&info))
return "";