diff -Naur dsss-0.67.orig/rebuild/mars.c dsss-0.67/rebuild/mars.c --- dsss-0.67.orig/rebuild/mars.c 2007-06-29 09:44:44.000000000 +0200 +++ dsss-0.67/rebuild/mars.c 2007-07-22 23:35:20.176338928 +0200 @@ -441,23 +441,25 @@ if (nloc != std::string::npos) cmachine = cmachine.substr(0, nloc); // 3) get the prefix - char *gdcdir, *gdcfil; - if (!whereAmI(compiler.c_str(), &gdcdir, &gdcfil)) { + if (readCommand(compiler + " -print-search-dirs", readBuf, READBUFSIZ) < 1) { + error("Failed to detect GDC search dirs"); error("%s is not in $PATH", compiler.c_str()); exit(1); } + std::string gdcdir = readBuf; + nloc = gdcdir.find('\n', 0); + if (nloc != std::string::npos) gdcdir = gdcdir.substr(0, nloc); + nloc = gdcdir.find(": /", 0); + if (nloc != std::string::npos) gdcdir = gdcdir.substr(nloc + 2); // 4) make include paths + /* This: "/../../../../include/d/" + cversion + "/" always works on any GCC installation! */ if (!global.params.imppath) global.params.imppath = new Array(); global.params.imppath->push(strdup( - (std::string(gdcdir) + "/../include/d/" + cversion + "/").c_str())); + (gdcdir + "../../../../include/d/" + cversion + "/").c_str())); global.params.imppath->push(strdup( - (std::string(gdcdir) + "/../include/d/" + cversion + "/" + cmachine + "/").c_str())); - global.params.imppath->push(strdup( - (std::string(gdcdir) + "/../" + cmachine + "/include/d/" + cversion + "/").c_str())); - global.params.imppath->push(strdup( - (std::string(gdcdir) + "/../" + cmachine + "/include/d/" + cversion + "/" + cmachine + "/").c_str())); + (gdcdir + "../../../../include/d/" + cversion + "/" + cmachine + "/").c_str())); } }