Check for gcc.

Reviewed by me.
This commit is contained in:
Francisco Ryan Tolmasky I committed 2009-11-15 15:07:58 -08:00
1 parent d4edb28837
commit 44cbcc60fa
1 file changed
+13 -7
@@ -55,15 +55,21 @@ function compileWithResolvedFlags(aFilePath, objjcFlags, gccFlags)
{
var shouldObjjPreprocess = objjcFlags & OBJJ_PREPROCESSOR_PREPROCESS,
shouldCheckSyntax = objjcFlags & OBJJ_PREPROCESSOR_SYNTAX,
shouldCompress = objjcFlags & OBJJ_PREPROCESSOR_COMPRESS;
shouldCompress = objjcFlags & OBJJ_PREPROCESSOR_COMPRESS,
fileContents = "";
// GCC preprocess the file.
var gcc = OS.popen("gcc -E -x c -P " + (gccFlags ? gccFlags.join(" ") : "") + " " + aFilePath),
fileContents = "",
chunk = "";
if (OS.popen("which gcc").stdout.read().length === 0)
fileContents = FILE.read(aFilePath, { charset:"UTF-8" });
while (chunk = gcc.stdout.read())
fileContents += chunk;
else
{
// GCC preprocess the file.
var gcc = OS.popen("gcc -E -x c -P " + (gccFlags ? gccFlags.join(" ") : "") + " " + aFilePath),
chunk = "";
while (chunk = gcc.stdout.read())
fileContents += chunk;
}
if (!shouldObjjPreprocess)
return fileContents;