Apply afb's patch from #168 to use $CC instead of "gcc" for toobj and linker.

This commit is contained in:
Christian Kamm 2009-01-17 17:52:09 +01:00
parent 50be43051a
commit 4042f90800
2 changed files with 18 additions and 4 deletions

View file

@ -204,18 +204,25 @@ int linkObjToExecutable(const char* argv0)
// error string // error string
std::string errstr; std::string errstr;
const char *cc;
#if !_WIN32
cc = getenv("CC");
if (!cc)
#endif
cc = "gcc";
// find gcc for linking // find gcc for linking
llvm::sys::Path gcc = llvm::sys::Program::FindProgramByName("gcc"); llvm::sys::Path gcc = llvm::sys::Program::FindProgramByName(cc);
if (gcc.isEmpty()) if (gcc.isEmpty())
{ {
gcc.set("gcc"); gcc.set(cc);
} }
// build arguments // build arguments
std::vector<const char*> args; std::vector<const char*> args;
// first the program name ?? // first the program name ??
args.push_back("gcc"); args.push_back(cc);
// object files // object files
for (int i = 0; i < global.params.objfiles->dim; i++) for (int i = 0; i < global.params.objfiles->dim; i++)

View file

@ -326,7 +326,14 @@ void assemble(const llvm::sys::Path& asmpath, const llvm::sys::Path& objpath)
{ {
using namespace llvm; using namespace llvm;
sys::Path gcc = llvm::sys::Program::FindProgramByName("gcc"); const char *cc;
#if !_WIN32
cc = getenv("CC");
if (!cc)
#endif
cc = "gcc";
sys::Path gcc = llvm::sys::Program::FindProgramByName(cc);
if (gcc.empty()) if (gcc.empty())
{ {
error("failed to locate gcc"); error("failed to locate gcc");