Driver: If unable to find the gcc tool chain, try the next OS rev.

llvm-svn: 84656
This commit is contained in:
Daniel Dunbar 2009-10-20 19:25:43 +00:00
parent e4f2b2a8ac
commit f4534ee0a3
1 changed files with 18 additions and 1 deletions

View File

@ -54,7 +54,6 @@ DarwinGCC::DarwinGCC(const HostInfo &Host, const llvm::Triple& Triple,
GCCVersion[2] = _GCCVersion[2];
// Set up the tool chain paths to match gcc.
ToolChainDir = "i686-apple-darwin";
ToolChainDir += llvm::utostr(DarwinVersion[0]);
ToolChainDir += "/";
@ -64,6 +63,24 @@ DarwinGCC::DarwinGCC(const HostInfo &Host, const llvm::Triple& Triple,
ToolChainDir += '.';
ToolChainDir += llvm::utostr(GCCVersion[2]);
// Try the next major version if that tool chain dir is invalid.
if (!llvm::sys::Path(ToolChainDir).exists()) {
std::string Next = "i686-apple-darwin";
Next += llvm::utostr(DarwinVersion[0] + 1);
Next += "/";
Next += llvm::utostr(GCCVersion[0]);
Next += '.';
Next += llvm::utostr(GCCVersion[1]);
Next += '.';
Next += llvm::utostr(GCCVersion[2]);
// Use that if it exists, otherwise hope the user isn't linking.
//
// FIXME: Drop dependency on gcc's tool chain.
if (llvm::sys::Path(Next).exists())
ToolChainDir = Next;
}
std::string Path;
if (getArchName() == "x86_64") {
Path = getHost().getDriver().Dir;