1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

Recognize the UNAME_RELEASE environment variable to match Darwin's uname.

When this variable is set, "uname -r" will return its value instead of the
real OS version.  Make this affect LLVM's triple for consistency.
<rdar://problem/9919167>

llvm-svn: 137111
This commit is contained in:
Bob Wilson 2011-08-09 05:13:36 +00:00
parent b9ef7f9e3e
commit a97bb9535d

View File

@ -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 "";