diff options
Diffstat (limited to 'tools/configure')
-rw-r--r-- | tools/configure/configureapp.cpp | 36 | ||||
-rw-r--r-- | tools/configure/configureapp.h | 2 |
2 files changed, 38 insertions, 0 deletions
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index be28762..21131b6 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1724,6 +1724,7 @@ void Configure::applySpecSpecifics() dictionary[ "FONT_CONFIG" ] = "yes"; dictionary[ "FONT_CONFIG" ] = "yes"; dictionary[ "FREETYPE" ] = "system"; + dictionary[ "STACK_PROTECTOR_STRONG" ] = "auto"; } } @@ -2401,6 +2402,11 @@ bool Configure::checkAvailability(const QString &part) } } else if (part == "DIRECTWRITE") { available = findFile("dwrite.h") && findFile("d2d1.h") && findFile("dwrite.lib"); + } else if (part == "STACK_PROTECTOR_STRONG") { + QStringList compilerAndArgs; + compilerAndArgs += "qcc"; + compilerAndArgs += "-fstack-protector-strong"; + available = dictionary[ "XQMAKESPEC" ].contains("blackberry") && compilerSupportsFlag(compilerAndArgs); } return available; @@ -2504,6 +2510,10 @@ void Configure::autoDetection() if (dictionary["INCREDIBUILD_XGE"] == "auto") dictionary["INCREDIBUILD_XGE"] = checkAvailability("INCREDIBUILD_XGE") ? "yes" : "no"; + // Detection of -fstack-protector-strong support + if (dictionary["STACK_PROTECTOR_STRONG"] == "auto") + dictionary["STACK_PROTECTOR_STRONG"] = checkAvailability("STACK_PROTECTOR_STRONG") ? "yes" : "no"; + // Mark all unknown "auto" to the default value.. for (QMap<QString,QString>::iterator i = dictionary.begin(); i != dictionary.end(); ++i) { if (i.value() == "auto") @@ -2979,6 +2989,9 @@ void Configure::generateOutputVars() // We currently have no switch for QtSvg, so add it unconditionally. qtConfig += "svg"; + if (dictionary["STACK_PROTECTOR_STRONG"] == "yes") + qtConfig += "stack-protector-strong"; + // We currently have no switch for QtConcurrent, so add it unconditionally. qtConfig += "concurrent"; @@ -4426,6 +4439,29 @@ void Configure::saveCmdLine() } #endif // !EVAL +bool Configure::compilerSupportsFlag(const QStringList &compilerAndArgs) +{ + QFile file("conftest.cpp"); + if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { + cout << "could not open temp file for writing" << endl; + return false; + } + if (!file.write("int main() { return 0; }\r\n")) { + cout << "could not write to temp file" << endl; + return false; + } + file.close(); + // compilerAndArgs contains compiler because there is no way to query it + QStringList command = compilerAndArgs; + command += "-o"; + command += "conftest-out.o"; + command += "conftest.cpp"; + int code = Environment::execute(command, QStringList(), QStringList()); + file.remove(); + QFile::remove("conftest-out.o"); + return code == 0; +} + bool Configure::isDone() { return !dictionary["DONE"].isEmpty(); diff --git a/tools/configure/configureapp.h b/tools/configure/configureapp.h index ee34b0d..d3f4ca1 100644 --- a/tools/configure/configureapp.h +++ b/tools/configure/configureapp.h @@ -161,6 +161,8 @@ private: void saveCmdLine(); #endif + bool compilerSupportsFlag(const QStringList &compilerAndArgs); + void desc(const char *description, int startingAt = 0, int wrapIndent = 0); void desc(const char *option, const char *description, bool skipIndent = false, char fillChar = '.'); void desc(const char *mark_option, const char *mark, const char *option, const char *description, char fillChar = '.'); |