1 /****************************************************************************
3 ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
6 ** This file is part of the tools applications of the Qt Toolkit.
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
40 ****************************************************************************/
42 #include "configureapp.h"
43 #include "environment.h"
44 #ifdef COMMERCIAL_VERSION
48 #include <qdatetime.h>
50 #include <qdiriterator.h>
51 #include <qtemporaryfile.h>
52 #include <qstandardpaths.h>
55 #include <qfileinfo.h>
56 #include <qtextstream.h>
75 std::ostream &operator<<(std::ostream &s, const QString &val) {
76 s << val.toLocal8Bit().data();
83 // Macros to simplify options marking
84 #define MARK_OPTION(x,y) ( dictionary[ #x ] == #y ? "*" : " " )
86 static inline void promptKeyPress()
88 cout << "(Press any key to continue...)";
89 if (_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
90 exit(0); // Exit cleanly for Ctrl+C
93 bool writeToFile(const char* text, const QString &filename)
95 QByteArray symFile(text);
97 QDir dir(QFileInfo(file).absoluteDir());
99 dir.mkpath(dir.absolutePath());
100 if (!file.open(QFile::WriteOnly | QFile::Text)) {
101 cout << "Couldn't write to " << qPrintable(filename) << ": " << qPrintable(file.errorString())
109 Configure::Configure(int& argc, char** argv)
111 // Default values for indentation
115 // Get console buffer output width
116 CONSOLE_SCREEN_BUFFER_INFO info;
117 HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
118 if (GetConsoleScreenBufferInfo(hStdout, &info))
119 outputWidth = info.dwSize.X - 1;
120 outputWidth = qMin(outputWidth, 79); // Anything wider gets unreadable
121 if (outputWidth < 35) // Insanely small, just use 79
126 ** Set up the initial state, the default
128 dictionary[ "CONFIGCMD" ] = argv[ 0 ];
130 for (i = 1; i < argc; i++)
131 configCmdLine += argv[ i ];
133 if (configCmdLine.size() >= 2 && configCmdLine.at(0) == "-srcdir") {
134 sourcePath = QDir::cleanPath(configCmdLine.at(1));
135 sourceDir = QDir(sourcePath);
136 configCmdLine.erase(configCmdLine.begin(), configCmdLine.begin() + 2);
138 // Get the path to the executable
139 wchar_t module_name[MAX_PATH];
140 GetModuleFileName(0, module_name, sizeof(module_name) / sizeof(wchar_t));
141 QFileInfo sourcePathInfo = QString::fromWCharArray(module_name);
142 sourcePath = sourcePathInfo.absolutePath();
143 sourceDir = sourcePathInfo.dir();
145 buildPath = QDir::currentPath();
147 const QString installPath = QString("C:\\Qt\\%1").arg(QT_VERSION_STR);
149 const QString installPath = buildPath;
151 if (sourceDir != buildDir) { //shadow builds!
152 if (QStandardPaths::findExecutable(QStringLiteral("perl.exe")).isEmpty()) {
153 cout << "Error: Creating a shadow build of Qt requires" << endl
154 << "perl to be in the PATH environment";
155 exit(0); // Exit cleanly for Ctrl+C
158 cout << "Preparing build tree..." << endl;
159 QDir(buildPath).mkpath("bin");
161 { //make a syncqt script(s) that can be used in the shadow
162 QFile syncqt(buildPath + "/bin/syncqt");
163 // no QFile::Text, just in case the perl interpreter can't cope with them (unlikely)
164 if (syncqt.open(QFile::WriteOnly)) {
165 QTextStream stream(&syncqt);
166 stream << "#!/usr/bin/perl -w" << endl
167 << "require \"" << sourcePath + "/bin/syncqt\";" << endl;
169 QFile syncqt_bat(buildPath + "/bin/syncqt.bat");
170 if (syncqt_bat.open(QFile::WriteOnly | QFile::Text)) {
171 QTextStream stream(&syncqt_bat);
172 stream << "@echo off" << endl
173 << "call " << QDir::toNativeSeparators(sourcePath + "/bin/syncqt.bat")
174 << " -mkspecsdir \"" << QDir::toNativeSeparators(buildPath) << "/mkspecs\" %*" << endl;
180 buildDir.mkpath("mkspecs");
181 if (!Environment::cpdir(sourcePath + "/mkspecs", buildPath + "/mkspecs")){
182 cout << "Couldn't copy mkspecs!" << sourcePath << " " << buildPath << endl;
183 dictionary["DONE"] = "error";
187 buildDir.mkpath("doc");
188 if (!Environment::cpdir(sourcePath + "/doc/global", buildPath + "/doc/global")) {
189 cout << "Couldn't copy global documentation!" << sourcePath << " " << buildPath << endl;
190 dictionary["DONE"] = "error";
195 defaultBuildParts << QStringLiteral("libs") << QStringLiteral("tools") << QStringLiteral("examples");
196 dictionary[ "QT_SOURCE_TREE" ] = sourcePath;
197 dictionary[ "QT_BUILD_TREE" ] = buildPath;
198 dictionary[ "QT_INSTALL_PREFIX" ] = installPath;
200 dictionary[ "QMAKESPEC" ] = getenv("QMAKESPEC");
201 if (dictionary[ "QMAKESPEC" ].size() == 0) {
202 dictionary[ "QMAKESPEC" ] = Environment::detectQMakeSpec();
203 dictionary[ "QMAKESPEC_FROM" ] = "detected";
205 dictionary[ "QMAKESPEC_FROM" ] = "env";
208 dictionary[ "QCONFIG" ] = "full";
209 dictionary[ "EMBEDDED" ] = "no";
210 dictionary[ "BUILD_QMAKE" ] = "yes";
211 dictionary[ "VCPROJFILES" ] = "yes";
212 dictionary[ "QMAKE_INTERNAL" ] = "no";
213 dictionary[ "FAST" ] = "no";
214 dictionary[ "PROCESS" ] = "partial";
215 dictionary[ "WIDGETS" ] = "yes";
216 dictionary[ "RTTI" ] = "yes";
217 dictionary[ "STRIP" ] = "yes";
218 dictionary[ "SSE2" ] = "auto";
219 dictionary[ "SSE3" ] = "auto";
220 dictionary[ "SSSE3" ] = "auto";
221 dictionary[ "SSE4_1" ] = "auto";
222 dictionary[ "SSE4_2" ] = "auto";
223 dictionary[ "AVX" ] = "auto";
224 dictionary[ "AVX2" ] = "auto";
225 dictionary[ "IWMMXT" ] = "auto";
226 dictionary[ "SYNCQT" ] = "auto";
227 dictionary[ "CE_CRT" ] = "no";
228 dictionary[ "CETEST" ] = "auto";
229 dictionary[ "CE_SIGNATURE" ] = "no";
230 dictionary[ "AUDIO_BACKEND" ] = "auto";
231 dictionary[ "WMSDK" ] = "auto";
232 dictionary[ "V8SNAPSHOT" ] = "auto";
233 dictionary[ "QML_DEBUG" ] = "yes";
234 dictionary[ "PLUGIN_MANIFESTS" ] = "yes";
235 dictionary[ "DIRECTWRITE" ] = "no";
236 dictionary[ "NIS" ] = "no";
237 dictionary[ "NEON" ] = "no";
238 dictionary[ "LARGE_FILE" ] = "yes";
239 dictionary[ "FONT_CONFIG" ] = "no";
240 dictionary[ "POSIX_IPC" ] = "no";
241 dictionary[ "QT_GLIB" ] = "no";
242 dictionary[ "QT_ICONV" ] = "auto";
243 dictionary[ "QT_INOTIFY" ] = "auto";
244 dictionary[ "QT_CUPS" ] = "auto";
245 dictionary[ "CFG_GCC_SYSROOT" ] = "yes";
246 dictionary[ "SLOG2" ] = "no";
247 dictionary[ "SYSTEM_PROXIES" ] = "no";
249 //Only used when cross compiling.
250 dictionary[ "QT_INSTALL_SETTINGS" ] = "/etc/xdg";
253 QFile qglobal_h(sourcePath + "/src/corelib/global/qglobal.h");
254 if (qglobal_h.open(QFile::ReadOnly)) {
255 QTextStream read(&qglobal_h);
256 QRegExp version_regexp("^# *define *QT_VERSION_STR *\"([^\"]*)\"");
258 while (!read.atEnd()) {
259 line = read.readLine();
260 if (version_regexp.exactMatch(line)) {
261 version = version_regexp.cap(1).trimmed();
262 if (!version.isEmpty())
269 if (version.isEmpty())
270 version = QString("%1.%2.%3").arg(QT_VERSION>>16).arg(((QT_VERSION>>8)&0xff)).arg(QT_VERSION&0xff);
272 dictionary[ "VERSION" ] = version;
274 QRegExp version_re("([0-9]*)\\.([0-9]*)\\.([0-9]*)(|-.*)");
275 if (version_re.exactMatch(version)) {
276 dictionary[ "VERSION_MAJOR" ] = version_re.cap(1);
277 dictionary[ "VERSION_MINOR" ] = version_re.cap(2);
278 dictionary[ "VERSION_PATCH" ] = version_re.cap(3);
282 dictionary[ "REDO" ] = "no";
283 dictionary[ "DEPENDENCIES" ] = "no";
285 dictionary[ "BUILD" ] = "debug";
286 dictionary[ "BUILDALL" ] = "auto"; // Means yes, but not explicitly
287 dictionary[ "FORCEDEBUGINFO" ] = "no";
289 dictionary[ "BUILDTYPE" ] = "none";
291 dictionary[ "BUILDDEV" ] = "no";
293 dictionary[ "C++11" ] = "auto";
295 dictionary[ "SHARED" ] = "yes";
297 dictionary[ "ZLIB" ] = "auto";
299 dictionary[ "PCRE" ] = "auto";
301 dictionary[ "ICU" ] = "auto";
303 dictionary[ "ANGLE" ] = "auto";
305 dictionary[ "GIF" ] = "auto";
306 dictionary[ "JPEG" ] = "auto";
307 dictionary[ "PNG" ] = "auto";
308 dictionary[ "LIBJPEG" ] = "auto";
309 dictionary[ "LIBPNG" ] = "auto";
310 dictionary[ "FREETYPE" ] = "yes";
312 dictionary[ "ACCESSIBILITY" ] = "yes";
313 dictionary[ "OPENGL" ] = "yes";
314 dictionary[ "OPENGL_ES_2" ] = "yes";
315 dictionary[ "OPENVG" ] = "no";
316 dictionary[ "OPENSSL" ] = "auto";
317 dictionary[ "DBUS" ] = "auto";
319 dictionary[ "STYLE_WINDOWS" ] = "yes";
320 dictionary[ "STYLE_WINDOWSXP" ] = "auto";
321 dictionary[ "STYLE_WINDOWSVISTA" ] = "auto";
322 dictionary[ "STYLE_FUSION" ] = "yes";
323 dictionary[ "STYLE_WINDOWSCE" ] = "no";
324 dictionary[ "STYLE_WINDOWSMOBILE" ] = "no";
325 dictionary[ "STYLE_GTK" ] = "no";
327 dictionary[ "SQL_MYSQL" ] = "no";
328 dictionary[ "SQL_ODBC" ] = "no";
329 dictionary[ "SQL_OCI" ] = "no";
330 dictionary[ "SQL_PSQL" ] = "no";
331 dictionary[ "SQL_TDS" ] = "no";
332 dictionary[ "SQL_DB2" ] = "no";
333 dictionary[ "SQL_SQLITE" ] = "auto";
334 dictionary[ "SQL_SQLITE_LIB" ] = "qt";
335 dictionary[ "SQL_SQLITE2" ] = "no";
336 dictionary[ "SQL_IBASE" ] = "no";
338 QString tmp = dictionary[ "QMAKESPEC" ];
339 if (tmp.contains("\\")) {
340 tmp = tmp.mid(tmp.lastIndexOf("\\") + 1);
342 tmp = tmp.mid(tmp.lastIndexOf("/") + 1);
344 dictionary[ "QMAKESPEC" ] = tmp;
346 dictionary[ "INCREDIBUILD_XGE" ] = "auto";
347 dictionary[ "LTCG" ] = "no";
348 dictionary[ "NATIVE_GESTURES" ] = "yes";
349 dictionary[ "MSVC_MP" ] = "no";
352 Configure::~Configure()
354 for (int i=0; i<3; ++i) {
355 QList<MakeItem*> items = makeList[i];
356 for (int j=0; j<items.size(); ++j)
361 QString Configure::formatPath(const QString &path)
363 QString ret = QDir::cleanPath(path);
364 // This amount of quoting is deemed sufficient.
365 if (ret.contains(QLatin1Char(' '))) {
366 ret.prepend(QLatin1Char('"'));
367 ret.append(QLatin1Char('"'));
372 QString Configure::formatPaths(const QStringList &paths)
375 foreach (const QString &path, paths) {
377 ret += QLatin1Char(' ');
378 ret += formatPath(path);
383 // We could use QDir::homePath() + "/.qt-license", but
384 // that will only look in the first of $HOME,$USERPROFILE
385 // or $HOMEDRIVE$HOMEPATH. So, here we try'em all to be
386 // more forgiving for the end user..
387 QString Configure::firstLicensePath()
389 QStringList allPaths;
390 allPaths << "./.qt-license"
391 << QString::fromLocal8Bit(getenv("HOME")) + "/.qt-license"
392 << QString::fromLocal8Bit(getenv("USERPROFILE")) + "/.qt-license"
393 << QString::fromLocal8Bit(getenv("HOMEDRIVE")) + QString::fromLocal8Bit(getenv("HOMEPATH")) + "/.qt-license";
394 for (int i = 0; i< allPaths.count(); ++i)
395 if (QFile::exists(allPaths.at(i)))
396 return allPaths.at(i);
400 // #### somehow I get a compiler error about vc++ reaching the nesting limit without
401 // undefining the ansi for scoping.
406 void Configure::parseCmdLine()
408 int argCount = configCmdLine.size();
410 const QStringList imageFormats = QStringList() << "gif" << "png" << "jpeg";
413 if (argCount < 1) // skip rest if no arguments
415 else if (configCmdLine.at(i) == "-redo") {
416 dictionary[ "REDO" ] = "yes";
417 configCmdLine.clear();
420 else if (configCmdLine.at(i) == "-loadconfig") {
423 dictionary[ "REDO" ] = "yes";
424 dictionary[ "CUSTOMCONFIG" ] = "_" + configCmdLine.at(i);
425 configCmdLine.clear();
428 dictionary[ "HELP" ] = "yes";
432 argCount = configCmdLine.size();
435 bool isDeviceMkspec = false;
437 // Look first for XQMAKESPEC
438 for (int j = 0 ; j < argCount; ++j)
440 if ((configCmdLine.at(j) == "-xplatform") || (configCmdLine.at(j) == "-device")) {
441 isDeviceMkspec = (configCmdLine.at(j) == "-device");
445 dictionary["XQMAKESPEC"] = configCmdLine.at(j);
446 if (!dictionary[ "XQMAKESPEC" ].isEmpty())
447 applySpecSpecifics();
452 for (; i<configCmdLine.size(); ++i) {
453 bool continueElse[] = {false, false};
454 if (configCmdLine.at(i) == "-help"
455 || configCmdLine.at(i) == "-h"
456 || configCmdLine.at(i) == "-?")
457 dictionary[ "HELP" ] = "yes";
460 else if (configCmdLine.at(i) == "-qconfig") {
464 dictionary[ "QCONFIG" ] = configCmdLine.at(i);
467 else if (configCmdLine.at(i) == "-release") {
468 dictionary[ "BUILD" ] = "release";
469 if (dictionary[ "BUILDALL" ] == "auto")
470 dictionary[ "BUILDALL" ] = "no";
471 } else if (configCmdLine.at(i) == "-debug") {
472 dictionary[ "BUILD" ] = "debug";
473 if (dictionary[ "BUILDALL" ] == "auto")
474 dictionary[ "BUILDALL" ] = "no";
475 } else if (configCmdLine.at(i) == "-debug-and-release")
476 dictionary[ "BUILDALL" ] = "yes";
477 else if (configCmdLine.at(i) == "-force-debug-info")
478 dictionary[ "FORCEDEBUGINFO" ] = "yes";
479 else if (configCmdLine.at(i) == "-c++11")
480 dictionary[ "C++11" ] = "yes";
481 else if (configCmdLine.at(i) == "-no-c++11")
482 dictionary[ "C++11" ] = "no";
483 else if (configCmdLine.at(i) == "-shared")
484 dictionary[ "SHARED" ] = "yes";
485 else if (configCmdLine.at(i) == "-static")
486 dictionary[ "SHARED" ] = "no";
487 else if (configCmdLine.at(i) == "-developer-build")
488 dictionary[ "BUILDDEV" ] = "yes";
489 else if (configCmdLine.at(i) == "-opensource") {
490 dictionary[ "BUILDTYPE" ] = "opensource";
492 else if (configCmdLine.at(i) == "-commercial") {
493 dictionary[ "BUILDTYPE" ] = "commercial";
495 else if (configCmdLine.at(i) == "-ltcg") {
496 dictionary[ "LTCG" ] = "yes";
498 else if (configCmdLine.at(i) == "-no-ltcg") {
499 dictionary[ "LTCG" ] = "no";
501 else if (configCmdLine.at(i) == "-mp") {
502 dictionary[ "MSVC_MP" ] = "yes";
504 else if (configCmdLine.at(i) == "-no-mp") {
505 dictionary[ "MSVC_MP" ] = "no";
507 else if (configCmdLine.at(i) == "-force-asserts") {
508 dictionary[ "FORCE_ASSERTS" ] = "yes";
514 else if (configCmdLine.at(i) == "-platform") {
518 dictionary[ "QMAKESPEC" ] = configCmdLine.at(i);
519 dictionary[ "QMAKESPEC_FROM" ] = "commandline";
520 } else if (configCmdLine.at(i) == "-arch") {
524 dictionary["OBSOLETE_ARCH_ARG"] = "yes";
525 } else if (configCmdLine.at(i) == "-embedded") {
526 dictionary[ "EMBEDDED" ] = "yes";
527 } else if (configCmdLine.at(i) == "-xplatform"
528 || configCmdLine.at(i) == "-device") {
535 else if (configCmdLine.at(i) == "-no-zlib") {
536 // No longer supported since Qt 4.4.0
537 // But save the information for later so that we can print a warning
539 // If you REALLY really need no zlib support, you can still disable
540 // it by doing the following:
541 // add "no-zlib" to mkspecs/qconfig.pri
542 // #define QT_NO_COMPRESS (probably by adding to src/corelib/global/qconfig.h)
544 // There's no guarantee that Qt will build under those conditions
546 dictionary[ "ZLIB_FORCED" ] = "yes";
547 } else if (configCmdLine.at(i) == "-qt-zlib") {
548 dictionary[ "ZLIB" ] = "qt";
549 } else if (configCmdLine.at(i) == "-system-zlib") {
550 dictionary[ "ZLIB" ] = "system";
553 else if (configCmdLine.at(i) == "-qt-pcre") {
554 dictionary[ "PCRE" ] = "qt";
555 } else if (configCmdLine.at(i) == "-system-pcre") {
556 dictionary[ "PCRE" ] = "system";
559 else if (configCmdLine.at(i) == "-icu") {
560 dictionary[ "ICU" ] = "yes";
561 } else if (configCmdLine.at(i) == "-no-icu") {
562 dictionary[ "ICU" ] = "no";
565 else if (configCmdLine.at(i) == "-angle") {
566 dictionary[ "ANGLE" ] = "yes";
567 dictionary[ "ANGLE_FROM" ] = "commandline";
568 } else if (configCmdLine.at(i) == "-no-angle") {
569 dictionary[ "ANGLE" ] = "no";
570 dictionary[ "ANGLE_FROM" ] = "commandline";
573 // Image formats --------------------------------------------
574 else if (configCmdLine.at(i) == "-no-gif")
575 dictionary[ "GIF" ] = "no";
577 else if (configCmdLine.at(i) == "-no-libjpeg") {
578 dictionary[ "JPEG" ] = "no";
579 dictionary[ "LIBJPEG" ] = "no";
580 } else if (configCmdLine.at(i) == "-qt-libjpeg") {
581 dictionary[ "LIBJPEG" ] = "qt";
582 } else if (configCmdLine.at(i) == "-system-libjpeg") {
583 dictionary[ "LIBJPEG" ] = "system";
586 else if (configCmdLine.at(i) == "-no-libpng") {
587 dictionary[ "PNG" ] = "no";
588 dictionary[ "LIBPNG" ] = "no";
589 } else if (configCmdLine.at(i) == "-qt-libpng") {
590 dictionary[ "LIBPNG" ] = "qt";
591 } else if (configCmdLine.at(i) == "-system-libpng") {
592 dictionary[ "LIBPNG" ] = "system";
595 // Text Rendering --------------------------------------------
596 else if (configCmdLine.at(i) == "-no-freetype")
597 dictionary[ "FREETYPE" ] = "no";
598 else if (configCmdLine.at(i) == "-qt-freetype")
599 dictionary[ "FREETYPE" ] = "yes";
600 else if (configCmdLine.at(i) == "-system-freetype")
601 dictionary[ "FREETYPE" ] = "system";
603 // CE- C runtime --------------------------------------------
604 else if (configCmdLine.at(i) == "-crt") {
608 QDir cDir(configCmdLine.at(i));
610 cout << "WARNING: Could not find directory (" << qPrintable(configCmdLine.at(i)) << ")for C runtime deployment" << endl;
612 dictionary[ "CE_CRT" ] = QDir::toNativeSeparators(cDir.absolutePath());
613 } else if (configCmdLine.at(i) == "-qt-crt") {
614 dictionary[ "CE_CRT" ] = "yes";
615 } else if (configCmdLine.at(i) == "-no-crt") {
616 dictionary[ "CE_CRT" ] = "no";
618 // cetest ---------------------------------------------------
619 else if (configCmdLine.at(i) == "-no-cetest") {
620 dictionary[ "CETEST" ] = "no";
621 dictionary[ "CETEST_REQUESTED" ] = "no";
622 } else if (configCmdLine.at(i) == "-cetest") {
623 // although specified to use it, we stay at "auto" state
624 // this is because checkAvailability() adds variables
625 // we need for crosscompilation; but remember if we asked
627 dictionary[ "CETEST_REQUESTED" ] = "yes";
629 // Qt/CE - signing tool -------------------------------------
630 else if (configCmdLine.at(i) == "-signature") {
634 QFileInfo info(configCmdLine.at(i));
636 cout << "WARNING: Could not find signature file (" << qPrintable(configCmdLine.at(i)) << ")" << endl;
638 dictionary[ "CE_SIGNATURE" ] = QDir::toNativeSeparators(info.absoluteFilePath());
640 // Styles ---------------------------------------------------
641 else if (configCmdLine.at(i) == "-qt-style-windows")
642 dictionary[ "STYLE_WINDOWS" ] = "yes";
643 else if (configCmdLine.at(i) == "-no-style-windows")
644 dictionary[ "STYLE_WINDOWS" ] = "no";
646 else if (configCmdLine.at(i) == "-qt-style-windowsce")
647 dictionary[ "STYLE_WINDOWSCE" ] = "yes";
648 else if (configCmdLine.at(i) == "-no-style-windowsce")
649 dictionary[ "STYLE_WINDOWSCE" ] = "no";
650 else if (configCmdLine.at(i) == "-qt-style-windowsmobile")
651 dictionary[ "STYLE_WINDOWSMOBILE" ] = "yes";
652 else if (configCmdLine.at(i) == "-no-style-windowsmobile")
653 dictionary[ "STYLE_WINDOWSMOBILE" ] = "no";
655 else if (configCmdLine.at(i) == "-qt-style-windowsxp")
656 dictionary[ "STYLE_WINDOWSXP" ] = "yes";
657 else if (configCmdLine.at(i) == "-no-style-windowsxp")
658 dictionary[ "STYLE_WINDOWSXP" ] = "no";
660 else if (configCmdLine.at(i) == "-qt-style-windowsvista")
661 dictionary[ "STYLE_WINDOWSVISTA" ] = "yes";
662 else if (configCmdLine.at(i) == "-no-style-windowsvista")
663 dictionary[ "STYLE_WINDOWSVISTA" ] = "no";
665 else if (configCmdLine.at(i) == "-qt-style-fusion")
666 dictionary[ "STYLE_FUSION" ] = "yes";
667 else if (configCmdLine.at(i) == "-no-style-fusion")
668 dictionary[ "STYLE_FUSION" ] = "no";
670 // Work around compiler nesting limitation
672 continueElse[1] = true;
673 if (!continueElse[1]) {
676 // OpenGL Support -------------------------------------------
677 else if (configCmdLine.at(i) == "-no-opengl") {
678 dictionary[ "OPENGL" ] = "no";
679 dictionary[ "OPENGL_ES_2" ] = "no";
680 } else if (configCmdLine.at(i) == "-opengl-es-cm") {
681 dictionary[ "OPENGL" ] = "yes";
682 dictionary[ "OPENGL_ES_CM" ] = "yes";
683 } else if (configCmdLine.at(i) == "-opengl-es-2") {
684 dictionary[ "OPENGL" ] = "yes";
685 dictionary[ "OPENGL_ES_2" ] = "yes";
686 } else if (configCmdLine.at(i) == "-opengl") {
687 dictionary[ "OPENGL" ] = "yes";
692 dictionary[ "OPENGL_ES_2" ] = "no";
693 if (configCmdLine.at(i) == "es1") {
694 dictionary[ "OPENGL_ES_CM" ] = "yes";
695 } else if ( configCmdLine.at(i) == "es2" ) {
696 dictionary[ "OPENGL_ES_2" ] = "yes";
697 } else if ( configCmdLine.at(i) == "desktop" ) {
698 // OPENGL=yes suffices
700 cout << "Argument passed to -opengl option is not valid." << endl;
701 dictionary[ "DONE" ] = "error";
706 // OpenVG Support -------------------------------------------
707 else if (configCmdLine.at(i) == "-openvg") {
708 dictionary[ "OPENVG" ] = "yes";
709 } else if (configCmdLine.at(i) == "-no-openvg") {
710 dictionary[ "OPENVG" ] = "no";
713 // Databases ------------------------------------------------
714 else if (configCmdLine.at(i) == "-qt-sql-mysql")
715 dictionary[ "SQL_MYSQL" ] = "yes";
716 else if (configCmdLine.at(i) == "-plugin-sql-mysql")
717 dictionary[ "SQL_MYSQL" ] = "plugin";
718 else if (configCmdLine.at(i) == "-no-sql-mysql")
719 dictionary[ "SQL_MYSQL" ] = "no";
721 else if (configCmdLine.at(i) == "-qt-sql-odbc")
722 dictionary[ "SQL_ODBC" ] = "yes";
723 else if (configCmdLine.at(i) == "-plugin-sql-odbc")
724 dictionary[ "SQL_ODBC" ] = "plugin";
725 else if (configCmdLine.at(i) == "-no-sql-odbc")
726 dictionary[ "SQL_ODBC" ] = "no";
728 else if (configCmdLine.at(i) == "-qt-sql-oci")
729 dictionary[ "SQL_OCI" ] = "yes";
730 else if (configCmdLine.at(i) == "-plugin-sql-oci")
731 dictionary[ "SQL_OCI" ] = "plugin";
732 else if (configCmdLine.at(i) == "-no-sql-oci")
733 dictionary[ "SQL_OCI" ] = "no";
735 else if (configCmdLine.at(i) == "-qt-sql-psql")
736 dictionary[ "SQL_PSQL" ] = "yes";
737 else if (configCmdLine.at(i) == "-plugin-sql-psql")
738 dictionary[ "SQL_PSQL" ] = "plugin";
739 else if (configCmdLine.at(i) == "-no-sql-psql")
740 dictionary[ "SQL_PSQL" ] = "no";
742 else if (configCmdLine.at(i) == "-qt-sql-tds")
743 dictionary[ "SQL_TDS" ] = "yes";
744 else if (configCmdLine.at(i) == "-plugin-sql-tds")
745 dictionary[ "SQL_TDS" ] = "plugin";
746 else if (configCmdLine.at(i) == "-no-sql-tds")
747 dictionary[ "SQL_TDS" ] = "no";
749 else if (configCmdLine.at(i) == "-qt-sql-db2")
750 dictionary[ "SQL_DB2" ] = "yes";
751 else if (configCmdLine.at(i) == "-plugin-sql-db2")
752 dictionary[ "SQL_DB2" ] = "plugin";
753 else if (configCmdLine.at(i) == "-no-sql-db2")
754 dictionary[ "SQL_DB2" ] = "no";
756 else if (configCmdLine.at(i) == "-qt-sql-sqlite")
757 dictionary[ "SQL_SQLITE" ] = "yes";
758 else if (configCmdLine.at(i) == "-plugin-sql-sqlite")
759 dictionary[ "SQL_SQLITE" ] = "plugin";
760 else if (configCmdLine.at(i) == "-no-sql-sqlite")
761 dictionary[ "SQL_SQLITE" ] = "no";
762 else if (configCmdLine.at(i) == "-system-sqlite")
763 dictionary[ "SQL_SQLITE_LIB" ] = "system";
764 else if (configCmdLine.at(i) == "-qt-sql-sqlite2")
765 dictionary[ "SQL_SQLITE2" ] = "yes";
766 else if (configCmdLine.at(i) == "-plugin-sql-sqlite2")
767 dictionary[ "SQL_SQLITE2" ] = "plugin";
768 else if (configCmdLine.at(i) == "-no-sql-sqlite2")
769 dictionary[ "SQL_SQLITE2" ] = "no";
771 else if (configCmdLine.at(i) == "-qt-sql-ibase")
772 dictionary[ "SQL_IBASE" ] = "yes";
773 else if (configCmdLine.at(i) == "-plugin-sql-ibase")
774 dictionary[ "SQL_IBASE" ] = "plugin";
775 else if (configCmdLine.at(i) == "-no-sql-ibase")
776 dictionary[ "SQL_IBASE" ] = "no";
778 // Image formats --------------------------------------------
779 else if (configCmdLine.at(i).startsWith("-qt-imageformat-") &&
780 imageFormats.contains(configCmdLine.at(i).section('-', 3)))
781 dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "yes";
782 else if (configCmdLine.at(i).startsWith("-plugin-imageformat-") &&
783 imageFormats.contains(configCmdLine.at(i).section('-', 3)))
784 dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "plugin";
785 else if (configCmdLine.at(i).startsWith("-no-imageformat-") &&
786 imageFormats.contains(configCmdLine.at(i).section('-', 3)))
787 dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "no";
789 // IDE project generation -----------------------------------
790 else if (configCmdLine.at(i) == "-no-vcproj")
791 dictionary[ "VCPROJFILES" ] = "no";
792 else if (configCmdLine.at(i) == "-vcproj")
793 dictionary[ "VCPROJFILES" ] = "yes";
795 else if (configCmdLine.at(i) == "-no-incredibuild-xge")
796 dictionary[ "INCREDIBUILD_XGE" ] = "no";
797 else if (configCmdLine.at(i) == "-incredibuild-xge")
798 dictionary[ "INCREDIBUILD_XGE" ] = "yes";
799 else if (configCmdLine.at(i) == "-native-gestures")
800 dictionary[ "NATIVE_GESTURES" ] = "yes";
801 else if (configCmdLine.at(i) == "-no-native-gestures")
802 dictionary[ "NATIVE_GESTURES" ] = "no";
804 // Others ---------------------------------------------------
805 else if (configCmdLine.at(i) == "-fast")
806 dictionary[ "FAST" ] = "yes";
807 else if (configCmdLine.at(i) == "-no-fast")
808 dictionary[ "FAST" ] = "no";
810 else if (configCmdLine.at(i) == "-widgets")
811 dictionary[ "WIDGETS" ] = "yes";
812 else if (configCmdLine.at(i) == "-no-widgets")
813 dictionary[ "WIDGETS" ] = "no";
815 else if (configCmdLine.at(i) == "-rtti")
816 dictionary[ "RTTI" ] = "yes";
817 else if (configCmdLine.at(i) == "-no-rtti")
818 dictionary[ "RTTI" ] = "no";
820 else if (configCmdLine.at(i) == "-strip")
821 dictionary[ "STRIP" ] = "yes";
822 else if (configCmdLine.at(i) == "-no-strip")
823 dictionary[ "STRIP" ] = "no";
825 else if (configCmdLine.at(i) == "-accessibility")
826 dictionary[ "ACCESSIBILITY" ] = "yes";
827 else if (configCmdLine.at(i) == "-no-accessibility") {
828 dictionary[ "ACCESSIBILITY" ] = "no";
829 cout << "Setting accessibility to NO" << endl;
832 else if (configCmdLine.at(i) == "-no-sse2")
833 dictionary[ "SSE2" ] = "no";
834 else if (configCmdLine.at(i) == "-sse2")
835 dictionary[ "SSE2" ] = "yes";
836 else if (configCmdLine.at(i) == "-no-sse3")
837 dictionary[ "SSE3" ] = "no";
838 else if (configCmdLine.at(i) == "-sse3")
839 dictionary[ "SSE3" ] = "yes";
840 else if (configCmdLine.at(i) == "-no-ssse3")
841 dictionary[ "SSSE3" ] = "no";
842 else if (configCmdLine.at(i) == "-ssse3")
843 dictionary[ "SSSE3" ] = "yes";
844 else if (configCmdLine.at(i) == "-no-sse4.1")
845 dictionary[ "SSE4_1" ] = "no";
846 else if (configCmdLine.at(i) == "-sse4.1")
847 dictionary[ "SSE4_1" ] = "yes";
848 else if (configCmdLine.at(i) == "-no-sse4.2")
849 dictionary[ "SSE4_2" ] = "no";
850 else if (configCmdLine.at(i) == "-sse4.2")
851 dictionary[ "SSE4_2" ] = "yes";
852 else if (configCmdLine.at(i) == "-no-avx")
853 dictionary[ "AVX" ] = "no";
854 else if (configCmdLine.at(i) == "-avx")
855 dictionary[ "AVX" ] = "yes";
856 else if (configCmdLine.at(i) == "-no-avx2")
857 dictionary[ "AVX2" ] = "no";
858 else if (configCmdLine.at(i) == "-avx2")
859 dictionary[ "AVX2" ] = "yes";
860 else if (configCmdLine.at(i) == "-no-iwmmxt")
861 dictionary[ "IWMMXT" ] = "no";
862 else if (configCmdLine.at(i) == "-iwmmxt")
863 dictionary[ "IWMMXT" ] = "yes";
865 else if (configCmdLine.at(i) == "-no-openssl") {
866 dictionary[ "OPENSSL"] = "no";
867 } else if (configCmdLine.at(i) == "-openssl") {
868 dictionary[ "OPENSSL" ] = "yes";
869 } else if (configCmdLine.at(i) == "-openssl-linked") {
870 dictionary[ "OPENSSL" ] = "linked";
871 } else if (configCmdLine.at(i) == "-no-qdbus") {
872 dictionary[ "DBUS" ] = "no";
873 } else if (configCmdLine.at(i) == "-qdbus") {
874 dictionary[ "DBUS" ] = "yes";
875 } else if (configCmdLine.at(i) == "-no-dbus") {
876 dictionary[ "DBUS" ] = "no";
877 } else if (configCmdLine.at(i) == "-dbus") {
878 dictionary[ "DBUS" ] = "yes";
879 } else if (configCmdLine.at(i) == "-dbus-linked") {
880 dictionary[ "DBUS" ] = "linked";
881 } else if (configCmdLine.at(i) == "-audio-backend") {
882 dictionary[ "AUDIO_BACKEND" ] = "yes";
883 } else if (configCmdLine.at(i) == "-no-audio-backend") {
884 dictionary[ "AUDIO_BACKEND" ] = "no";
885 } else if (configCmdLine.at(i) == "-no-qml-debug") {
886 dictionary[ "QML_DEBUG" ] = "no";
887 } else if (configCmdLine.at(i) == "-qml-debug") {
888 dictionary[ "QML_DEBUG" ] = "yes";
889 } else if (configCmdLine.at(i) == "-no-plugin-manifests") {
890 dictionary[ "PLUGIN_MANIFESTS" ] = "no";
891 } else if (configCmdLine.at(i) == "-plugin-manifests") {
892 dictionary[ "PLUGIN_MANIFESTS" ] = "yes";
893 } else if (configCmdLine.at(i) == "-no-slog2") {
894 dictionary[ "SLOG2" ] = "no";
895 } else if (configCmdLine.at(i) == "-slog2") {
896 dictionary[ "SLOG2" ] = "yes";
897 } else if (configCmdLine.at(i) == "-no-system-proxies") {
898 dictionary[ "SYSTEM_PROXIES" ] = "no";
899 } else if (configCmdLine.at(i) == "-system-proxies") {
900 dictionary[ "SYSTEM_PROXIES" ] = "yes";
903 // Work around compiler nesting limitation
905 continueElse[0] = true;
906 if (!continueElse[0]) {
909 else if (configCmdLine.at(i) == "-internal")
910 dictionary[ "QMAKE_INTERNAL" ] = "yes";
912 else if (configCmdLine.at(i) == "-no-syncqt")
913 dictionary[ "SYNCQT" ] = "no";
915 else if (configCmdLine.at(i) == "-no-qmake")
916 dictionary[ "BUILD_QMAKE" ] = "no";
917 else if (configCmdLine.at(i) == "-qmake")
918 dictionary[ "BUILD_QMAKE" ] = "yes";
920 else if (configCmdLine.at(i) == "-dont-process")
921 dictionary[ "PROCESS" ] = "no";
922 else if (configCmdLine.at(i) == "-process")
923 dictionary[ "PROCESS" ] = "partial";
924 else if (configCmdLine.at(i) == "-fully-process")
925 dictionary[ "PROCESS" ] = "full";
927 else if (configCmdLine.at(i) == "-no-qmake-deps")
928 dictionary[ "DEPENDENCIES" ] = "no";
929 else if (configCmdLine.at(i) == "-qmake-deps")
930 dictionary[ "DEPENDENCIES" ] = "yes";
933 else if (configCmdLine.at(i) == "-qtnamespace") {
937 dictionary[ "QT_NAMESPACE" ] = configCmdLine.at(i);
938 } else if (configCmdLine.at(i) == "-qtlibinfix") {
942 dictionary[ "QT_LIBINFIX" ] = configCmdLine.at(i);
943 } else if (configCmdLine.at(i) == "-D") {
947 qmakeDefines += configCmdLine.at(i);
948 } else if (configCmdLine.at(i) == "-I") {
952 qmakeIncludes += configCmdLine.at(i);
953 } else if (configCmdLine.at(i) == "-L") {
957 QFileInfo checkDirectory(configCmdLine.at(i));
958 if (!checkDirectory.isDir()) {
959 cout << "Argument passed to -L option is not a directory path. Did you mean the -l option?" << endl;
960 dictionary[ "DONE" ] = "error";
963 qmakeLibs += QString("-L" + configCmdLine.at(i));
964 } else if (configCmdLine.at(i) == "-l") {
968 qmakeLibs += QString("-l" + configCmdLine.at(i));
969 } else if (configCmdLine.at(i).startsWith("OPENSSL_LIBS=")) {
970 opensslLibs = configCmdLine.at(i);
971 } else if (configCmdLine.at(i).startsWith("OPENSSL_LIBS_DEBUG=")) {
972 opensslLibsDebug = configCmdLine.at(i);
973 } else if (configCmdLine.at(i).startsWith("OPENSSL_LIBS_RELEASE=")) {
974 opensslLibsRelease = configCmdLine.at(i);
975 } else if (configCmdLine.at(i).startsWith("OPENSSL_PATH=")) {
976 opensslPath = QDir::fromNativeSeparators(configCmdLine.at(i));
977 } else if (configCmdLine.at(i).startsWith("PSQL_LIBS=")) {
978 psqlLibs = configCmdLine.at(i);
979 } else if (configCmdLine.at(i).startsWith("SYBASE=")) {
980 sybase = configCmdLine.at(i);
981 } else if (configCmdLine.at(i).startsWith("SYBASE_LIBS=")) {
982 sybaseLibs = configCmdLine.at(i);
983 } else if (configCmdLine.at(i).startsWith("DBUS_PATH=")) {
984 dbusPath = QDir::fromNativeSeparators(configCmdLine.at(i));
985 } else if (configCmdLine.at(i).startsWith("MYSQL_PATH=")) {
986 mysqlPath = QDir::fromNativeSeparators(configCmdLine.at(i));
987 } else if (configCmdLine.at(i).startsWith("ZLIB_LIBS=")) {
988 zlibLibs = QDir::fromNativeSeparators(configCmdLine.at(i));
991 else if ((configCmdLine.at(i) == "-override-version") || (configCmdLine.at(i) == "-version-override")){
995 dictionary[ "VERSION" ] = configCmdLine.at(i);
998 else if (configCmdLine.at(i) == "-saveconfig") {
1002 dictionary[ "CUSTOMCONFIG" ] = "_" + configCmdLine.at(i);
1005 else if (configCmdLine.at(i) == "-confirm-license") {
1006 dictionary["LICENSE_CONFIRMED"] = "yes";
1009 else if (configCmdLine.at(i) == "-make") {
1013 buildParts += configCmdLine.at(i);
1014 } else if (configCmdLine.at(i) == "-nomake") {
1018 nobuildParts.append(configCmdLine.at(i));
1021 // Directories ----------------------------------------------
1022 else if (configCmdLine.at(i) == "-prefix") {
1026 dictionary[ "QT_INSTALL_PREFIX" ] = configCmdLine.at(i);
1029 else if (configCmdLine.at(i) == "-bindir") {
1033 dictionary[ "QT_INSTALL_BINS" ] = configCmdLine.at(i);
1036 else if (configCmdLine.at(i) == "-libexecdir") {
1040 dictionary[ "QT_INSTALL_LIBEXECS" ] = configCmdLine.at(i);
1043 else if (configCmdLine.at(i) == "-libdir") {
1047 dictionary[ "QT_INSTALL_LIBS" ] = configCmdLine.at(i);
1050 else if (configCmdLine.at(i) == "-docdir") {
1054 dictionary[ "QT_INSTALL_DOCS" ] = configCmdLine.at(i);
1057 else if (configCmdLine.at(i) == "-headerdir") {
1061 dictionary[ "QT_INSTALL_HEADERS" ] = configCmdLine.at(i);
1064 else if (configCmdLine.at(i) == "-plugindir") {
1068 dictionary[ "QT_INSTALL_PLUGINS" ] = configCmdLine.at(i);
1071 else if (configCmdLine.at(i) == "-importdir") {
1075 dictionary[ "QT_INSTALL_IMPORTS" ] = configCmdLine.at(i);
1078 else if (configCmdLine.at(i) == "-qmldir") {
1082 dictionary[ "QT_INSTALL_QML" ] = configCmdLine.at(i);
1085 else if (configCmdLine.at(i) == "-archdatadir") {
1089 dictionary[ "QT_INSTALL_ARCHDATA" ] = configCmdLine.at(i);
1092 else if (configCmdLine.at(i) == "-datadir") {
1096 dictionary[ "QT_INSTALL_DATA" ] = configCmdLine.at(i);
1099 else if (configCmdLine.at(i) == "-translationdir") {
1103 dictionary[ "QT_INSTALL_TRANSLATIONS" ] = configCmdLine.at(i);
1106 else if (configCmdLine.at(i) == "-examplesdir") {
1110 dictionary[ "QT_INSTALL_EXAMPLES" ] = configCmdLine.at(i);
1113 else if (configCmdLine.at(i) == "-testsdir") {
1117 dictionary[ "QT_INSTALL_TESTS" ] = configCmdLine.at(i);
1120 else if (configCmdLine.at(i) == "-sysroot") {
1124 dictionary[ "CFG_SYSROOT" ] = configCmdLine.at(i);
1126 else if (configCmdLine.at(i) == "-no-gcc-sysroot") {
1127 dictionary[ "CFG_GCC_SYSROOT" ] = "no";
1130 else if (configCmdLine.at(i) == "-hostprefix") {
1132 if (i == argCount || configCmdLine.at(i).startsWith('-'))
1133 dictionary[ "QT_HOST_PREFIX" ] = dictionary[ "QT_BUILD_TREE" ];
1135 dictionary[ "QT_HOST_PREFIX" ] = configCmdLine.at(i);
1138 else if (configCmdLine.at(i) == "-hostbindir") {
1142 dictionary[ "QT_HOST_BINS" ] = configCmdLine.at(i);
1145 else if (configCmdLine.at(i) == "-hostdatadir") {
1149 dictionary[ "QT_HOST_DATA" ] = configCmdLine.at(i);
1152 else if (configCmdLine.at(i) == "-make-tool") {
1156 dictionary[ "MAKE" ] = configCmdLine.at(i);
1159 else if (configCmdLine.at(i).indexOf(QRegExp("^-(en|dis)able-")) != -1) {
1160 // Scan to see if any specific modules and drivers are enabled or disabled
1161 for (QStringList::Iterator module = modules.begin(); module != modules.end(); ++module) {
1162 if (configCmdLine.at(i) == QString("-enable-") + (*module)) {
1163 enabledModules += (*module);
1166 else if (configCmdLine.at(i) == QString("-disable-") + (*module)) {
1167 disabledModules += (*module);
1173 else if (configCmdLine.at(i) == "-directwrite") {
1174 dictionary["DIRECTWRITE"] = "yes";
1175 } else if (configCmdLine.at(i) == "-no-directwrite") {
1176 dictionary["DIRECTWRITE"] = "no";
1179 else if (configCmdLine.at(i) == "-nis") {
1180 dictionary["NIS"] = "yes";
1181 } else if (configCmdLine.at(i) == "-no-nis") {
1182 dictionary["NIS"] = "no";
1185 else if (configCmdLine.at(i) == "-cups") {
1186 dictionary["QT_CUPS"] = "yes";
1187 } else if (configCmdLine.at(i) == "-no-cups") {
1188 dictionary["QT_CUPS"] = "no";
1191 else if (configCmdLine.at(i) == "-iconv") {
1192 dictionary["QT_ICONV"] = "yes";
1193 } else if (configCmdLine.at(i) == "-no-iconv") {
1194 dictionary["QT_ICONV"] = "no";
1195 } else if (configCmdLine.at(i) == "-sun-iconv") {
1196 dictionary["QT_ICONV"] = "sun";
1197 } else if (configCmdLine.at(i) == "-gnu-iconv") {
1198 dictionary["QT_ICONV"] = "gnu";
1201 else if (configCmdLine.at(i) == "-inotify") {
1202 dictionary["QT_INOTIFY"] = "yes";
1203 } else if (configCmdLine.at(i) == "-no-inotify") {
1204 dictionary["QT_INOTIFY"] = "no";
1207 else if (configCmdLine.at(i) == "-neon") {
1208 dictionary["NEON"] = "yes";
1209 } else if (configCmdLine.at(i) == "-no-neon") {
1210 dictionary["NEON"] = "no";
1213 else if (configCmdLine.at(i) == "-largefile") {
1214 dictionary["LARGE_FILE"] = "yes";
1217 else if (configCmdLine.at(i) == "-fontconfig") {
1218 dictionary["FONT_CONFIG"] = "yes";
1219 } else if (configCmdLine.at(i) == "-no-fontconfig") {
1220 dictionary["FONT_CONFIG"] = "no";
1223 else if (configCmdLine.at(i) == "-posix-ipc") {
1224 dictionary["POSIX_IPC"] = "yes";
1227 else if (configCmdLine.at(i) == "-glib") {
1228 dictionary["QT_GLIB"] = "yes";
1231 else if (configCmdLine.at(i) == "-sysconfdir") {
1236 dictionary["QT_INSTALL_SETTINGS"] = configCmdLine.at(i);
1240 dictionary[ "HELP" ] = "yes";
1241 cout << "Unknown option " << configCmdLine.at(i) << endl;
1248 // Ensure that QMAKESPEC exists in the mkspecs folder
1249 const QString mkspecPath(sourcePath + "/mkspecs");
1250 QDirIterator itMkspecs(mkspecPath, QDir::AllDirs | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
1251 QStringList mkspecs;
1253 while (itMkspecs.hasNext()) {
1254 QString mkspec = itMkspecs.next();
1256 mkspec.remove(0, mkspecPath.length() + 1);
1260 if (dictionary["QMAKESPEC"].toLower() == "features"
1261 || !mkspecs.contains(dictionary["QMAKESPEC"], Qt::CaseInsensitive)) {
1262 dictionary[ "HELP" ] = "yes";
1263 if (dictionary ["QMAKESPEC_FROM"] == "commandline") {
1264 cout << "Invalid option \"" << dictionary["QMAKESPEC"] << "\" for -platform." << endl;
1265 } else if (dictionary ["QMAKESPEC_FROM"] == "env") {
1266 cout << "QMAKESPEC environment variable is set to \"" << dictionary["QMAKESPEC"]
1267 << "\" which is not a supported platform" << endl;
1268 } else { // was autodetected from environment
1269 cout << "Unable to detect the platform from environment. Use -platform command line"
1270 "argument or set the QMAKESPEC environment variable and run configure again" << endl;
1272 cout << "See the README file for a list of supported operating systems and compilers." << endl;
1274 if (dictionary[ "QMAKESPEC" ].endsWith("-icc") ||
1275 dictionary[ "QMAKESPEC" ].endsWith("-msvc") ||
1276 dictionary[ "QMAKESPEC" ].endsWith("-msvc.net") ||
1277 dictionary[ "QMAKESPEC" ].endsWith("-msvc2002") ||
1278 dictionary[ "QMAKESPEC" ].endsWith("-msvc2003") ||
1279 dictionary[ "QMAKESPEC" ].endsWith("-msvc2005") ||
1280 dictionary[ "QMAKESPEC" ].endsWith("-msvc2008") ||
1281 dictionary[ "QMAKESPEC" ].endsWith("-msvc2010") ||
1282 dictionary[ "QMAKESPEC" ].endsWith("-msvc2012")) {
1283 if (dictionary[ "MAKE" ].isEmpty()) dictionary[ "MAKE" ] = "nmake";
1284 dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32";
1285 } else if (dictionary[ "QMAKESPEC" ] == QString("win32-g++")) {
1286 if (dictionary[ "MAKE" ].isEmpty()) dictionary[ "MAKE" ] = "mingw32-make";
1287 dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32-g++";
1289 if (dictionary[ "MAKE" ].isEmpty()) dictionary[ "MAKE" ] = "make";
1290 dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32";
1294 // Tell the user how to proceed building Qt after configure finished its job
1295 dictionary["QTBUILDINSTRUCTION"] = dictionary["MAKE"];
1296 if (dictionary.contains("XQMAKESPEC")) {
1297 if (dictionary["XQMAKESPEC"].startsWith("wince")) {
1298 dictionary["QTBUILDINSTRUCTION"] =
1299 QString("setcepaths.bat ") + dictionary["XQMAKESPEC"] + QString(" && ") + dictionary["MAKE"];
1303 // Tell the user how to confclean before the next configure
1304 dictionary["CONFCLEANINSTRUCTION"] = dictionary["MAKE"] + QString(" confclean");
1306 if (isDeviceMkspec) {
1307 const QStringList devices = mkspecs.filter("devices/", Qt::CaseInsensitive);
1308 const QStringList family = devices.filter(dictionary["XQMAKESPEC"], Qt::CaseInsensitive);
1310 if (family.isEmpty()) {
1311 dictionary["HELP"] = "yes";
1312 cout << "Error: No device matching '" << dictionary["XQMAKESPEC"] << "'." << endl;
1313 } else if (family.size() > 1) {
1314 dictionary["HELP"] = "yes";
1316 cout << "Error: Multiple matches for device '" << dictionary["XQMAKESPEC"] << "'. Candidates are:" << endl;
1318 foreach (const QString &device, family)
1319 cout << "\t* " << device << endl;
1321 Q_ASSERT(family.size() == 1);
1322 dictionary["XQMAKESPEC"] = family.at(0);
1326 // Ensure that -spec (XQMAKESPEC) exists in the mkspecs folder as well
1327 if (dictionary.contains("XQMAKESPEC") &&
1328 !mkspecs.contains(dictionary["XQMAKESPEC"], Qt::CaseInsensitive)) {
1329 dictionary["HELP"] = "yes";
1330 cout << "Invalid option \"" << dictionary["XQMAKESPEC"] << "\" for -xplatform." << endl;
1334 // Ensure that the crt to be deployed can be found
1335 if (dictionary["CE_CRT"] != QLatin1String("yes") && dictionary["CE_CRT"] != QLatin1String("no")) {
1336 QDir cDir(dictionary["CE_CRT"]);
1337 QStringList entries = cDir.entryList();
1338 bool hasDebug = entries.contains("msvcr80.dll");
1339 bool hasRelease = entries.contains("msvcr80d.dll");
1340 if ((dictionary["BUILDALL"] == "auto") && (!hasDebug || !hasRelease)) {
1341 cout << "Could not find debug and release c-runtime." << endl;
1342 cout << "You need to have msvcr80.dll and msvcr80d.dll in" << endl;
1343 cout << "the path specified. Setting to -no-crt";
1344 dictionary[ "CE_CRT" ] = "no";
1345 } else if ((dictionary["BUILD"] == "debug") && !hasDebug) {
1346 cout << "Could not find debug c-runtime (msvcr80d.dll) in the directory specified." << endl;
1347 cout << "Setting c-runtime automatic deployment to -no-crt" << endl;
1348 dictionary[ "CE_CRT" ] = "no";
1349 } else if ((dictionary["BUILD"] == "release") && !hasRelease) {
1350 cout << "Could not find release c-runtime (msvcr80.dll) in the directory specified." << endl;
1351 cout << "Setting c-runtime automatic deployment to -no-crt" << endl;
1352 dictionary[ "CE_CRT" ] = "no";
1356 // Allow tests for private classes to be compiled against internal builds
1357 if (dictionary["BUILDDEV"] == "yes")
1358 qtConfig += "private_tests";
1360 if (dictionary["FORCE_ASSERTS"] == "yes")
1361 qtConfig += "force_asserts";
1364 for (QStringList::Iterator dis = disabledModules.begin(); dis != disabledModules.end(); ++dis) {
1365 modules.removeAll((*dis));
1367 for (QStringList::Iterator ena = enabledModules.begin(); ena != enabledModules.end(); ++ena) {
1368 if (modules.indexOf((*ena)) == -1)
1371 qtConfig += modules;
1373 for (QStringList::Iterator it = disabledModules.begin(); it != disabledModules.end(); ++it)
1374 qtConfig.removeAll(*it);
1376 if ((dictionary[ "REDO" ] != "yes") && (dictionary[ "HELP" ] != "yes"))
1382 void Configure::validateArgs()
1384 // Validate the specified config
1386 // Get all possible configurations from the file system.
1388 QStringList filters;
1389 filters << "qconfig-*.h";
1390 dir.setNameFilters(filters);
1391 dir.setPath(sourcePath + "/src/corelib/global/");
1393 QStringList stringList = dir.entryList();
1395 QStringList::Iterator it;
1396 for (it = stringList.begin(); it != stringList.end(); ++it)
1397 allConfigs << it->remove("qconfig-").remove(".h");
1398 allConfigs << "full";
1400 // Try internal configurations first.
1401 QStringList possible_configs = QStringList()
1407 int index = possible_configs.indexOf(dictionary["QCONFIG"]);
1409 for (int c = 0; c <= index; c++) {
1410 qmakeConfig += possible_configs[c] + "-config";
1415 // If the internal configurations failed, try others.
1416 QStringList::Iterator config;
1417 for (config = allConfigs.begin(); config != allConfigs.end(); ++config) {
1418 if ((*config) == dictionary[ "QCONFIG" ])
1421 if (config == allConfigs.end()) {
1422 dictionary[ "HELP" ] = "yes";
1423 cout << "No such configuration \"" << qPrintable(dictionary[ "QCONFIG" ]) << "\"" << endl ;
1426 qmakeConfig += (*config) + "-config";
1431 // Output helper functions --------------------------------[ Start ]-
1433 Determines the length of a string token.
1435 static int tokenLength(const char *str)
1440 const char *nextToken = strpbrk(str, " _/\n\r");
1441 if (nextToken == str || !nextToken)
1444 return int(nextToken - str);
1448 Prints out a string which starts at position \a startingAt, and
1449 indents each wrapped line with \a wrapIndent characters.
1450 The wrap point is set to the console width, unless that width
1451 cannot be determined, or is too small.
1453 void Configure::desc(const char *description, int startingAt, int wrapIndent)
1455 int linePos = startingAt;
1457 bool firstLine = true;
1458 const char *nextToken = description;
1459 while (*nextToken) {
1460 int nextTokenLen = tokenLength(nextToken);
1461 if (*nextToken == '\n' // Wrap on newline, duh
1462 || (linePos + nextTokenLen > outputWidth)) // Wrap at outputWidth
1467 if (*nextToken == '\n')
1471 if (!firstLine && linePos < wrapIndent) { // Indent to wrapIndent
1472 printf("%*s", wrapIndent , "");
1473 linePos = wrapIndent;
1474 if (*nextToken == ' ') {
1479 printf("%.*s", nextTokenLen, nextToken);
1480 linePos += nextTokenLen;
1481 nextToken += nextTokenLen;
1486 Prints out an option with its description wrapped at the
1487 description starting point. If \a skipIndent is true, the
1488 indentation to the option is not outputted (used by marked option
1489 version of desc()). Extra spaces between option and its
1490 description is filled with\a fillChar, if there's available
1493 void Configure::desc(const char *option, const char *description, bool skipIndent, char fillChar)
1496 printf("%*s", optionIndent, "");
1498 int remaining = descIndent - optionIndent - strlen(option);
1499 int wrapIndent = descIndent + qMax(0, 1 - remaining);
1500 printf("%s", option);
1502 if (remaining > 2) {
1503 printf(" "); // Space in front
1504 for (int i = remaining; i > 2; --i)
1505 printf("%c", fillChar); // Fill, if available space
1507 printf(" "); // Space between option and description
1509 desc(description, wrapIndent, wrapIndent);
1514 Same as above, except it also marks an option with an '*', if
1515 the option is default action.
1517 void Configure::desc(const char *mark_option, const char *mark, const char *option, const char *description, char fillChar)
1519 const QString markedAs = dictionary.value(mark_option);
1520 if (markedAs == "auto" && markedAs == mark) // both "auto", always => +
1522 else if (markedAs == "auto") // setting marked as "auto" and option is default => +
1523 printf(" %c " , (defaultTo(mark_option) == QLatin1String(mark))? '+' : ' ');
1524 else if (QLatin1String(mark) == "auto" && markedAs != "no") // description marked as "auto" and option is available => +
1525 printf(" %c " , checkAvailability(mark_option) ? '+' : ' ');
1526 else // None are "auto", (markedAs == mark) => *
1527 printf(" %c " , markedAs == QLatin1String(mark) ? '*' : ' ');
1529 desc(option, description, true, fillChar);
1533 Modifies the default configuration based on given -platform option.
1534 Eg. switches to different default styles for Windows CE.
1536 void Configure::applySpecSpecifics()
1538 if (!dictionary[ "XQMAKESPEC" ].isEmpty()) {
1539 //Disable building tools, docs and translations when cross compiling.
1540 nobuildParts << "docs" << "translations" << "tools";
1543 if (dictionary[ "XQMAKESPEC" ].startsWith("wince")) {
1544 dictionary[ "STYLE_WINDOWSXP" ] = "no";
1545 dictionary[ "STYLE_WINDOWSVISTA" ] = "no";
1546 dictionary[ "STYLE_FUSION" ] = "no";
1547 dictionary[ "STYLE_WINDOWSCE" ] = "yes";
1548 dictionary[ "STYLE_WINDOWSMOBILE" ] = "yes";
1549 dictionary[ "OPENGL" ] = "no";
1550 dictionary[ "OPENSSL" ] = "no";
1551 dictionary[ "RTTI" ] = "no";
1552 dictionary[ "SSE2" ] = "no";
1553 dictionary[ "SSE3" ] = "no";
1554 dictionary[ "SSSE3" ] = "no";
1555 dictionary[ "SSE4_1" ] = "no";
1556 dictionary[ "SSE4_2" ] = "no";
1557 dictionary[ "AVX" ] = "no";
1558 dictionary[ "AVX2" ] = "no";
1559 dictionary[ "IWMMXT" ] = "no";
1560 dictionary[ "CE_CRT" ] = "yes";
1561 dictionary[ "LARGE_FILE" ] = "no";
1562 dictionary[ "ANGLE" ] = "no";
1563 // We only apply MMX/IWMMXT for mkspecs we know they work
1564 if (dictionary[ "XQMAKESPEC" ].startsWith("wincewm")) {
1565 dictionary[ "MMX" ] = "yes";
1566 dictionary[ "IWMMXT" ] = "yes";
1568 } else if (dictionary[ "XQMAKESPEC" ].startsWith("linux")) { //TODO actually wrong.
1570 dictionary[ "STYLE_WINDOWSXP" ] = "no";
1571 dictionary[ "STYLE_WINDOWSVISTA" ] = "no";
1572 dictionary[ "KBD_DRIVERS" ] = "tty";
1573 dictionary[ "GFX_DRIVERS" ] = "linuxfb";
1574 dictionary[ "MOUSE_DRIVERS" ] = "pc linuxtp";
1575 dictionary[ "OPENGL" ] = "no";
1576 dictionary[ "DBUS"] = "no";
1577 dictionary[ "QT_INOTIFY" ] = "no";
1578 dictionary[ "QT_CUPS" ] = "no";
1579 dictionary[ "QT_GLIB" ] = "no";
1580 dictionary[ "QT_ICONV" ] = "no";
1582 dictionary["DECORATIONS"] = "default windows styled";
1583 } else if ((platform() == QNX) || (platform() == BLACKBERRY)) {
1584 dictionary["STACK_PROTECTOR_STRONG"] = "auto";
1585 dictionary["SLOG2"] = "auto";
1589 // Output helper functions ---------------------------------[ Stop ]-
1592 bool Configure::displayHelp()
1594 if (dictionary[ "HELP" ] == "yes") {
1595 desc("Usage: configure [options]\n\n", 0, 7);
1597 desc("Installation options:\n\n");
1599 desc("These are optional, but you may specify install directories.\n\n", 0, 1);
1601 desc( "-prefix <dir>", "This will install everything relative to <dir> (default $QT_INSTALL_PREFIX)\n");
1603 desc( "-hostprefix [dir]", "Tools and libraries needed when developing applications are installed in [dir]. "
1604 "If [dir] is not given, the current build directory will be used. (default PREFIX)\n");
1606 desc("You may use these to separate different parts of the install:\n\n");
1608 desc( "-bindir <dir>", "User executables will be installed to <dir>\n(default PREFIX/bin)");
1609 desc( "-libdir <dir>", "Libraries will be installed to <dir>\n(default PREFIX/lib)");
1610 desc( "-headerdir <dir>", "Headers will be installed to <dir>\n(default PREFIX/include)");
1611 desc( "-archdatadir <dir>", "Architecture-dependent data used by Qt will be installed to <dir>\n(default PREFIX)");
1612 desc( "-libexecdir <dir>", "Program executables will be installed to <dir>\n(default ARCHDATADIR/libexec)");
1613 desc( "-plugindir <dir>", "Plugins will be installed to <dir>\n(default ARCHDATADIR/plugins)");
1614 desc( "-importdir <dir>", "Imports for QML1 will be installed to <dir>\n(default ARCHDATADIR/imports)");
1615 desc( "-qmldir <dir>", "Imports for QML2 will be installed to <dir>\n(default ARCHDATADIR/qml)");
1616 desc( "-datadir <dir>", "Data used by Qt programs will be installed to <dir>\n(default PREFIX)");
1617 desc( "-docdir <dir>", "Documentation will be installed to <dir>\n(default DATADIR/doc)");
1618 desc( "-translationdir <dir>", "Translations of Qt programs will be installed to <dir>\n(default DATADIR/translations)");
1619 desc( "-examplesdir <dir>", "Examples will be installed to <dir>\n(default PREFIX/examples)");
1620 desc( "-testsdir <dir>", "Tests will be installed to <dir>\n(default PREFIX/tests)\n");
1622 desc( "-hostbindir <dir>", "Host executables will be installed to <dir>\n(default HOSTPREFIX/bin)");
1623 desc( "-hostdatadir <dir>", "Data used by qmake will be installed to <dir>\n(default HOSTPREFIX)");
1626 desc("\nConfigure options:\n\n");
1628 desc(" The defaults (*) are usually acceptable. A plus (+) denotes a default value"
1629 " that needs to be evaluated. If the evaluation succeeds, the feature is"
1630 " included. Here is a short explanation of each option:\n\n", 0, 1);
1632 desc("BUILD", "release","-release", "Compile and link Qt with debugging turned off.");
1633 desc("BUILD", "debug", "-debug", "Compile and link Qt with debugging turned on.");
1634 desc("BUILDALL", "yes", "-debug-and-release", "Compile and link two Qt libraries, with and without debugging turned on.\n");
1636 desc("FORCEDEBUGINFO", "yes","-force-debug-info", "Create symbol files for release builds.\n");
1638 desc("BUILDDEV", "yes", "-developer-build", "Compile and link Qt with Qt developer options (including auto-tests exporting)\n");
1640 desc("OPENSOURCE", "opensource", "-opensource", "Compile and link the Open-Source Edition of Qt.");
1641 desc("COMMERCIAL", "commercial", "-commercial", "Compile and link the Commercial Edition of Qt.\n");
1643 desc("C++11", "yes", "-c++11", "Compile Qt with C++11 support enabled.");
1644 desc("C++11", "no", "-no-c++11", "Do not compile Qt with C++11 support enabled.\n");
1646 desc("SHARED", "yes", "-shared", "Create and use shared Qt libraries.");
1647 desc("SHARED", "no", "-static", "Create and use static Qt libraries.\n");
1649 desc("LTCG", "yes", "-ltcg", "Use Link Time Code Generation. (Release builds only)");
1650 desc("LTCG", "no", "-no-ltcg", "Do not use Link Time Code Generation.\n");
1652 desc("FAST", "no", "-no-fast", "Configure Qt normally by generating Makefiles for all project files.");
1653 desc("FAST", "yes", "-fast", "Configure Qt quickly by generating Makefiles only for library and "
1654 "subdirectory targets. All other Makefiles are created as wrappers "
1655 "which will in turn run qmake.\n");
1657 desc( "-make <part>", "Add part to the list of parts to be built at make time");
1658 for (int i=0; i<defaultBuildParts.size(); ++i)
1659 desc( "", qPrintable(QString(" %1").arg(defaultBuildParts.at(i))), false, ' ');
1660 desc( "-nomake <part>", "Exclude part from the list of parts to be built.\n");
1662 desc("WIDGETS", "no", "-no-widgets", "Disable QtWidgets module.\n");
1664 desc("ACCESSIBILITY", "no", "-no-accessibility", "Do not compile Windows Active Accessibility support.");
1665 desc("ACCESSIBILITY", "yes", "-accessibility", "Compile Windows Active Accessibility support.\n");
1667 desc( "-no-sql-<driver>", "Disable SQL <driver> entirely, by default none are turned on.");
1668 desc( "-qt-sql-<driver>", "Enable a SQL <driver> in the Qt Library.");
1669 desc( "-plugin-sql-<driver>", "Enable SQL <driver> as a plugin to be linked to at run time.\n"
1670 "Available values for <driver>:");
1671 desc("SQL_MYSQL", "auto", "", " mysql", ' ');
1672 desc("SQL_PSQL", "auto", "", " psql", ' ');
1673 desc("SQL_OCI", "auto", "", " oci", ' ');
1674 desc("SQL_ODBC", "auto", "", " odbc", ' ');
1675 desc("SQL_TDS", "auto", "", " tds", ' ');
1676 desc("SQL_DB2", "auto", "", " db2", ' ');
1677 desc("SQL_SQLITE", "auto", "", " sqlite", ' ');
1678 desc("SQL_SQLITE2", "auto", "", " sqlite2", ' ');
1679 desc("SQL_IBASE", "auto", "", " ibase", ' ');
1680 desc( "", "(drivers marked with a '+' have been detected as available on this system)\n", false, ' ');
1682 desc( "-system-sqlite", "Use sqlite from the operating system.\n");
1684 desc("OPENGL", "no","-no-opengl", "Do not support OpenGL.");
1685 desc("OPENGL", "no","-opengl <api>", "Enable OpenGL support with specified API version.\n"
1686 "Available values for <api>:");
1687 desc("", "no", "", " desktop - Enable support for Desktop OpenGL", ' ');
1688 desc("OPENGL_ES_CM", "no", "", " es1 - Enable support for OpenGL ES Common Profile", ' ');
1689 desc("OPENGL_ES_2", "yes", "", " es2 - Enable support for OpenGL ES 2.0\n", ' ');
1691 desc("OPENVG", "no","-no-openvg", "Disables OpenVG functionality.");
1692 desc("OPENVG", "yes","-openvg", "Enables OpenVG functionality.\n");
1693 desc( "-force-asserts", "Activate asserts in release mode.\n");
1695 desc( "-platform <spec>", "The operating system and compiler you are building on.\n(default %QMAKESPEC%)\n");
1696 desc( "-xplatform <spec>", "The operating system and compiler you are cross compiling to.\n");
1697 desc( "", "See the README file for a list of supported operating systems and compilers.\n", false, ' ');
1698 desc( "-sysroot <dir>", "Sets <dir> as the target compiler's and qmake's sysroot and also sets pkg-config paths.");
1699 desc( "-no-gcc-sysroot", "When using -sysroot, it disables the passing of --sysroot to the compiler.\n");
1701 desc("NIS", "no", "-no-nis", "Do not compile NIS support.");
1702 desc("NIS", "yes", "-nis", "Compile NIS support.\n");
1704 desc("NEON", "yes", "-neon", "Enable the use of NEON instructions.");
1705 desc("NEON", "no", "-no-neon", "Do not enable the use of NEON instructions.\n");
1707 desc("QT_ICONV", "disable", "-no-iconv", "Do not enable support for iconv(3).");
1708 desc("QT_ICONV", "yes", "-iconv", "Enable support for iconv(3).");
1709 desc("QT_ICONV", "yes", "-sun-iconv", "Enable support for iconv(3) using sun-iconv.");
1710 desc("QT_ICONV", "yes", "-gnu-iconv", "Enable support for iconv(3) using gnu-libiconv.\n");
1712 desc("QT_INOTIFY", "yes", "-inotify", "Explicitly enable Qt inotify(7) support.");
1713 desc("QT_INOTIFY", "no", "-no-inotify", "Explicitly disable Qt inotify(7) support.\n");
1715 desc("LARGE_FILE", "yes", "-largefile", "Enables Qt to access files larger than 4 GB.\n");
1717 desc("FONT_CONFIG", "yes", "-fontconfig", "Build with FontConfig support.");
1718 desc("FONT_CONFIG", "no", "-no-fontconfig", "Do not build with FontConfig support.\n");
1720 desc("POSIX_IPC", "yes", "-posix-ipc", "Enable POSIX IPC.\n");
1722 desc("QT_GLIB", "yes", "-glib", "Compile Glib support.\n");
1724 desc("QT_INSTALL_SETTINGS", "auto", "-sysconfdir <dir>", "Settings used by Qt programs will be looked for in\n<dir>.\n");
1726 desc("SYSTEM_PROXIES", "yes", "-system-proxies", "Use system network proxies by default.");
1727 desc("SYSTEM_PROXIES", "no", "-no-system-proxies", "Do not use system network proxies by default.\n");
1731 desc( "-qtnamespace <name>", "Wraps all Qt library code in 'namespace name {...}'.");
1732 desc( "-qtlibinfix <infix>", "Renames all Qt* libs to Qt*<infix>.\n");
1733 desc( "-D <define>", "Add an explicit define to the preprocessor.");
1734 desc( "-I <includepath>", "Add an explicit include path.");
1735 desc( "-L <librarypath>", "Add an explicit library path.");
1736 desc( "-l <libraryname>", "Add an explicit library name, residing in a librarypath.\n");
1739 desc( "-help, -h, -?", "Display this information.\n");
1742 // 3rd party stuff options go below here --------------------------------------------------------------------------------
1743 desc("Third Party Libraries:\n\n");
1745 desc("ZLIB", "qt", "-qt-zlib", "Use the zlib bundled with Qt.");
1746 desc("ZLIB", "system", "-system-zlib", "Use zlib from the operating system.\nSee http://www.gzip.org/zlib\n");
1748 desc("PCRE", "qt", "-qt-pcre", "Use the PCRE library bundled with Qt.");
1749 desc("PCRE", "qt", "-system-pcre", "Use the PCRE library from the operating system.\nSee http://pcre.org/\n");
1751 desc("ICU", "yes", "-icu", "Use the ICU library.");
1752 desc("ICU", "no", "-no-icu", "Do not use the ICU library.\nSee http://site.icu-project.org/\n");
1754 desc("GIF", "no", "-no-gif", "Do not compile GIF reading support.\n");
1756 desc("LIBPNG", "no", "-no-libpng", "Do not compile PNG support.");
1757 desc("LIBPNG", "qt", "-qt-libpng", "Use the libpng bundled with Qt.");
1758 desc("LIBPNG", "system","-system-libpng", "Use libpng from the operating system.\nSee http://www.libpng.org/pub/png\n");
1760 desc("LIBJPEG", "no", "-no-libjpeg", "Do not compile JPEG support.");
1761 desc("LIBJPEG", "qt", "-qt-libjpeg", "Use the libjpeg bundled with Qt.");
1762 desc("LIBJPEG", "system","-system-libjpeg", "Use libjpeg from the operating system.\nSee http://www.ijg.org\n");
1764 desc("FREETYPE", "no", "-no-freetype", "Do not compile in Freetype2 support.");
1765 desc("FREETYPE", "yes", "-qt-freetype", "Use the libfreetype bundled with Qt.");
1766 desc("FREETYPE", "yes", "-system-freetype", "Use the libfreetype provided by the system.");
1768 if ((platform() == QNX) || (platform() == BLACKBERRY)) {
1769 desc("SLOG2", "yes", "-slog2", "Compile with slog2 support.");
1770 desc("SLOG2", "no", "-no-slog2", "Do not compile with slog2 support.");
1773 desc("ANGLE", "yes", "-angle", "Use the ANGLE implementation of OpenGL ES 2.0.");
1774 desc("ANGLE", "no", "-no-angle", "Do not use ANGLE.\nSee http://code.google.com/p/angleproject/\n");
1776 // Qt\Windows only options go below here --------------------------------------------------------------------------------
1777 desc("\nQt for Windows only:\n\n");
1779 desc("VCPROJFILES", "no", "-no-vcproj", "Do not generate VC++ .vcproj files.");
1780 desc("VCPROJFILES", "yes", "-vcproj", "Generate VC++ .vcproj files, only if platform \"win32-msvc.net\".\n");
1782 desc("INCREDIBUILD_XGE", "no", "-no-incredibuild-xge", "Do not add IncrediBuild XGE distribution commands to custom build steps.");
1783 desc("INCREDIBUILD_XGE", "yes", "-incredibuild-xge", "Add IncrediBuild XGE distribution commands to custom build steps. This will distribute MOC and UIC steps, and other custom buildsteps which are added to the INCREDIBUILD_XGE variable.\n(The IncrediBuild distribution commands are only added to Visual Studio projects)\n");
1785 desc("PLUGIN_MANIFESTS", "no", "-no-plugin-manifests", "Do not embed manifests in plugins.");
1786 desc("PLUGIN_MANIFESTS", "yes", "-plugin-manifests", "Embed manifests in plugins.\n");
1788 desc("BUILD_QMAKE", "no", "-no-qmake", "Do not compile qmake.");
1789 desc("BUILD_QMAKE", "yes", "-qmake", "Compile qmake.\n");
1791 desc("PROCESS", "partial", "-process", "Generate top-level Makefiles/Project files.");
1792 desc("PROCESS", "full", "-fully-process", "Generate Makefiles/Project files for the entire Qt\ntree.");
1793 desc("PROCESS", "no", "-dont-process", "Do not generate Makefiles/Project files. This will override -no-fast if specified.\n");
1795 desc("RTTI", "no", "-no-rtti", "Do not compile runtime type information.");
1796 desc("RTTI", "yes", "-rtti", "Compile runtime type information.");
1797 desc("STRIP", "no", "-no-strip", "Do not strip libraries and executables of debug info when installing.");
1798 desc("STRIP", "yes", "-strip", "Strip libraries and executables of debug info when installing.\n");
1800 desc("SSE2", "no", "-no-sse2", "Do not compile with use of SSE2 instructions.");
1801 desc("SSE2", "yes", "-sse2", "Compile with use of SSE2 instructions.");
1802 desc("SSE3", "no", "-no-sse3", "Do not compile with use of SSE3 instructions.");
1803 desc("SSE3", "yes", "-sse3", "Compile with use of SSE3 instructions.");
1804 desc("SSSE3", "no", "-no-ssse3", "Do not compile with use of SSSE3 instructions.");
1805 desc("SSSE3", "yes", "-ssse3", "Compile with use of SSSE3 instructions.");
1806 desc("SSE4_1", "no", "-no-sse4.1", "Do not compile with use of SSE4.1 instructions.");
1807 desc("SSE4_1", "yes", "-sse4.1", "Compile with use of SSE4.1 instructions.");
1808 desc("SSE4_2", "no", "-no-sse4.2", "Do not compile with use of SSE4.2 instructions.");
1809 desc("SSE4_2", "yes", "-sse4.2", "Compile with use of SSE4.2 instructions.");
1810 desc("AVX", "no", "-no-avx", "Do not compile with use of AVX instructions.");
1811 desc("AVX", "yes", "-avx", "Compile with use of AVX instructions.");
1812 desc("AVX2", "no", "-no-avx2", "Do not compile with use of AVX2 instructions.");
1813 desc("AVX2", "yes", "-avx2", "Compile with use of AVX2 instructions.\n");
1814 desc("OPENSSL", "no", "-no-openssl", "Do not compile support for OpenSSL.");
1815 desc("OPENSSL", "yes", "-openssl", "Enable run-time OpenSSL support.");
1816 desc("OPENSSL", "linked","-openssl-linked", "Enable linked OpenSSL support.\n");
1817 desc("DBUS", "no", "-no-dbus", "Do not compile in D-Bus support.");
1818 desc("DBUS", "yes", "-dbus", "Compile in D-Bus support and load libdbus-1\ndynamically.");
1819 desc("DBUS", "linked", "-dbus-linked", "Compile in D-Bus support and link to libdbus-1.\n");
1820 desc("AUDIO_BACKEND", "no","-no-audio-backend", "Do not compile in the platform audio backend into\nQtMultimedia.");
1821 desc("AUDIO_BACKEND", "yes","-audio-backend", "Compile in the platform audio backend into QtMultimedia.\n");
1822 desc("QML_DEBUG", "no", "-no-qml-debug", "Do not build the in-process QML debugging support.");
1823 desc("QML_DEBUG", "yes", "-qml-debug", "Build the in-process QML debugging support.\n");
1824 desc("DIRECTWRITE", "no", "-no-directwrite", "Do not build support for DirectWrite font rendering.");
1825 desc("DIRECTWRITE", "yes", "-directwrite", "Build support for DirectWrite font rendering (experimental, requires DirectWrite availability on target systems, e.g. Windows Vista with Platform Update, Windows 7, etc.)\n");
1827 desc( "-no-style-<style>", "Disable <style> entirely.");
1828 desc( "-qt-style-<style>", "Enable <style> in the Qt Library.\nAvailable styles: ");
1830 desc("STYLE_WINDOWS", "yes", "", " windows", ' ');
1831 desc("STYLE_WINDOWSXP", "auto", "", " windowsxp", ' ');
1832 desc("STYLE_WINDOWSVISTA", "auto", "", " windowsvista", ' ');
1833 desc("STYLE_FUSION", "yes", "", " fusion", ' ');
1834 desc("STYLE_WINDOWSCE", "yes", "", " windowsce", ' ');
1835 desc("STYLE_WINDOWSMOBILE" , "yes", "", " windowsmobile\n", ' ');
1836 desc("NATIVE_GESTURES", "no", "-no-native-gestures", "Do not use native gestures on Windows 7.");
1837 desc("NATIVE_GESTURES", "yes", "-native-gestures", "Use native gestures on Windows 7.\n");
1838 desc("MSVC_MP", "no", "-no-mp", "Do not use multiple processors for compiling with MSVC");
1839 desc("MSVC_MP", "yes", "-mp", "Use multiple processors for compiling with MSVC (-MP).\n");
1841 /* We do not support -qconfig on Windows yet
1843 desc( "-qconfig <local>", "Use src/tools/qconfig-local.h rather than the default.\nPossible values for local:");
1844 for (int i=0; i<allConfigs.size(); ++i)
1845 desc( "", qPrintable(QString(" %1").arg(allConfigs.at(i))), false, ' ');
1849 desc( "-loadconfig <config>", "Run configure with the parameters from file configure_<config>.cache.");
1850 desc( "-saveconfig <config>", "Run configure and save the parameters in file configure_<config>.cache.");
1851 desc( "-redo", "Run configure with the same parameters as last time.\n");
1853 // Qt\Windows CE only options go below here -----------------------------------------------------------------------------
1854 desc("Qt for Windows CE only:\n\n");
1855 desc("IWMMXT", "no", "-no-iwmmxt", "Do not compile with use of IWMMXT instructions.");
1856 desc("IWMMXT", "yes", "-iwmmxt", "Do compile with use of IWMMXT instructions. (Qt for Windows CE on Arm only)\n");
1857 desc("CE_CRT", "no", "-no-crt" , "Do not add the C runtime to default deployment rules.");
1858 desc("CE_CRT", "yes", "-qt-crt", "Qt identifies C runtime during project generation.");
1859 desc( "-crt <path>", "Specify path to C runtime used for project generation.\n");
1860 desc("CETEST", "no", "-no-cetest", "Do not compile Windows CE remote test application.");
1861 desc("CETEST", "yes", "-cetest", "Compile Windows CE remote test application.\n");
1862 desc( "-signature <file>", "Use <file> for signing the target project.");
1868 // Locate a file and return its containing directory.
1869 QString Configure::locateFile(const QString &fileName) const
1871 const QString file = fileName.toLower();
1872 QStringList pathList;
1873 if (file.endsWith(".h")) {
1874 static const QStringList headerPaths =
1875 Environment::headerPaths(Environment::compilerFromQMakeSpec(dictionary[QStringLiteral("QMAKESPEC")]));
1876 pathList = headerPaths;
1877 } else if (file.endsWith(".lib") || file.endsWith(".a")) {
1878 static const QStringList libPaths =
1879 Environment::libraryPaths(Environment::compilerFromQMakeSpec(dictionary[QStringLiteral("QMAKESPEC")]));
1880 pathList = libPaths;
1882 // Fallback for .exe and .dll (latter are not covered by QStandardPaths).
1883 static const QStringList exePaths = Environment::path();
1884 pathList = exePaths;
1886 return Environment::findFileInPaths(file, pathList);
1890 Default value for options marked as "auto" if the test passes.
1891 (Used both by the autoDetection() below, and the desc() function
1892 to mark (+) the default option of autodetecting options.
1894 QString Configure::defaultTo(const QString &option)
1896 // We prefer using the system version of the 3rd party libs
1897 if (option == "ZLIB"
1899 || option == "LIBJPEG"
1900 || option == "LIBPNG")
1903 // PNG is always built-in, never a plugin
1904 if (option == "PNG")
1907 // These database drivers and image formats can be built-in or plugins.
1908 // Prefer plugins when Qt is shared.
1909 if (dictionary[ "SHARED" ] == "yes") {
1910 if (option == "SQL_MYSQL"
1911 || option == "SQL_MYSQL"
1912 || option == "SQL_ODBC"
1913 || option == "SQL_OCI"
1914 || option == "SQL_PSQL"
1915 || option == "SQL_TDS"
1916 || option == "SQL_DB2"
1917 || option == "SQL_SQLITE"
1918 || option == "SQL_SQLITE2"
1919 || option == "SQL_IBASE"
1925 // By default we do not want to compile OCI driver when compiling with
1926 // MinGW, due to lack of such support from Oracle. It prob. wont work.
1927 // (Customer may force the use though)
1928 if (dictionary["QMAKESPEC"].endsWith("-g++")
1929 && option == "SQL_OCI")
1932 // keep 'auto' default for msvc, since we can't set the language supported
1933 if (option == "C++11"
1934 && dictionary["QMAKESPEC"].contains("msvc"))
1937 if (option == "SYNCQT"
1938 && (!QFile::exists(sourcePath + "/bin/syncqt") ||
1939 !QFile::exists(sourcePath + "/bin/syncqt.bat")))
1945 bool Configure::checkAngleAvailability(QString *errorMessage /* = 0 */) const
1947 // Check for Direct X SDK (include lib and direct shader compiler 'fxc').
1948 // Up to Direct X SDK June 2010 and for MinGW, this is pointed to by the
1949 // DXSDK_DIR variable. Starting with Windows Kit 8, it is included
1950 // in the Windows SDK. Checking for the header is not sufficient since
1951 // it is also present in MinGW.
1952 const QString directXSdk = Environment::detectDirectXSdk();
1953 const Compiler compiler = Environment::compilerFromQMakeSpec(dictionary[QStringLiteral("QMAKESPEC")]);
1954 if (compiler < CC_NET2012 && directXSdk.isEmpty()) {
1956 *errorMessage = QStringLiteral("There is no Direct X SDK installed or the environment variable \"DXSDK_DIR\" is not set.");
1959 const QString compilerHeader = QStringLiteral("d3dcompiler.h");
1960 if (!findFile(compilerHeader)) {
1962 *errorMessage = QString::fromLatin1("The header '%1' could not be found.").arg(compilerHeader);
1965 if (dictionary["SSE2"] != "no") {
1966 const QString intrinHeader = QStringLiteral("intrin.h"); // Not present on MinGW-32
1967 if (!findFile(intrinHeader)) {
1969 *errorMessage = QString::fromLatin1("The header '%1' required for SSE2 could not be found.").arg(intrinHeader);
1974 const QString directXLibrary = QStringLiteral("d3d9.lib");
1975 if (!findFile(directXLibrary)) {
1977 *errorMessage = QString::fromLatin1("The library '%1' could not be found.").arg(directXLibrary);
1980 const QString fxcBinary = QStringLiteral("fxc.exe");
1981 QStringList additionalPaths;
1982 if (!directXSdk.isEmpty())
1983 additionalPaths.push_back(directXSdk + QStringLiteral("/Utilities/bin/x86"));
1984 QString fxcPath = QStandardPaths::findExecutable(fxcBinary, additionalPaths);
1985 if (fxcPath.isEmpty()) {
1987 *errorMessage = QString::fromLatin1("The shader compiler '%1' could not be found.").arg(fxcBinary);
1994 Checks the system for the availability of a feature.
1995 Returns true if the feature is available, else false.
1998 bool Configure::checkAvailability(const QString &part)
2000 bool available = false;
2001 if (part == "STYLE_WINDOWSXP")
2002 available = (platform() == WINDOWS) && findFile("uxtheme.h");
2004 else if (part == "ZLIB")
2005 available = findFile("zlib.h");
2007 else if (part == "PCRE")
2008 available = findFile("pcre.h");
2010 else if (part == "ICU")
2011 available = findFile("unicode/utypes.h") && findFile("unicode/ucol.h") && findFile("unicode/ustring.h")
2012 && (findFile("icuin.lib") || findFile("libicuin.lib")); // libicun.lib if compiled with mingw
2014 else if (part == "ANGLE") {
2015 available = checkAngleAvailability();
2018 else if (part == "LIBJPEG")
2019 available = findFile("jpeglib.h");
2020 else if (part == "LIBPNG")
2021 available = findFile("png.h");
2022 else if (part == "SQL_MYSQL")
2023 available = findFile("mysql.h") && findFile("libmySQL.lib");
2024 else if (part == "SQL_ODBC")
2025 available = findFile("sql.h") && findFile("sqlext.h") && findFile("odbc32.lib");
2026 else if (part == "SQL_OCI")
2027 available = findFile("oci.h") && findFile("oci.lib");
2028 else if (part == "SQL_PSQL")
2029 available = findFile("libpq-fe.h") && findFile("libpq.lib") && findFile("ws2_32.lib") && findFile("advapi32.lib");
2030 else if (part == "SQL_TDS")
2031 available = findFile("sybfront.h") && findFile("sybdb.h") && findFile("ntwdblib.lib");
2032 else if (part == "SQL_DB2")
2033 available = findFile("sqlcli.h") && findFile("sqlcli1.h") && findFile("db2cli.lib");
2034 else if (part == "SQL_SQLITE")
2035 available = true; // Built in, we have a fork
2036 else if (part == "SQL_SQLITE_LIB") {
2037 if (dictionary[ "SQL_SQLITE_LIB" ] == "system") {
2038 if ((platform() == QNX) || (platform() == BLACKBERRY)) {
2040 dictionary[ "QT_LFLAGS_SQLITE" ] += "-lsqlite3 -lz";
2042 available = findFile("sqlite3.h") && findFile("sqlite3.lib");
2044 dictionary[ "QT_LFLAGS_SQLITE" ] += "sqlite3.lib";
2049 } else if (part == "SQL_SQLITE2")
2050 available = findFile("sqlite.h") && findFile("sqlite.lib");
2051 else if (part == "SQL_IBASE")
2052 available = findFile("ibase.h") && (findFile("gds32_ms.lib") || findFile("gds32.lib"));
2053 else if (part == "IWMMXT")
2054 available = (dictionary.value("XQMAKESPEC").startsWith("wince"));
2055 else if (part == "OPENGL_ES_CM")
2056 available = (dictionary.value("XQMAKESPEC").startsWith("wince"));
2057 else if (part == "OPENGL_ES_2")
2058 available = (dictionary.value("XQMAKESPEC").startsWith("wince"));
2059 else if (part == "SSE2")
2060 available = tryCompileProject("common/sse2");
2061 else if (part == "SSE3")
2062 available = tryCompileProject("common/sse3");
2063 else if (part == "SSSE3")
2064 available = tryCompileProject("common/ssse3");
2065 else if (part == "SSE4_1")
2066 available = tryCompileProject("common/sse4_1");
2067 else if (part == "SSE4_2")
2068 available = tryCompileProject("common/sse4_2");
2069 else if (part == "AVX")
2070 available = tryCompileProject("common/avx");
2071 else if (part == "AVX2")
2072 available = tryCompileProject("common/avx2");
2073 else if (part == "OPENSSL")
2074 available = findFile("openssl\\ssl.h");
2075 else if (part == "DBUS")
2076 available = findFile("dbus\\dbus.h");
2077 else if (part == "CETEST") {
2078 const QString rapiHeader = QDir::toNativeSeparators(locateFile("rapi.h"));
2079 const QString rapiLib = QDir::toNativeSeparators(locateFile("rapi.lib"));
2080 available = (dictionary.value("XQMAKESPEC").startsWith("wince")) && !rapiHeader.isEmpty() && !rapiLib.isEmpty();
2082 dictionary[ "QT_CE_RAPI_INC" ] += QLatin1String("\"") + rapiHeader + QLatin1String("\"");
2083 dictionary[ "QT_CE_RAPI_LIB" ] += QLatin1String("\"") + rapiLib + QLatin1String("\"");
2085 else if (dictionary[ "CETEST_REQUESTED" ] == "yes") {
2086 cout << "cetest could not be enabled: rapi.h and rapi.lib could not be found." << endl;
2087 cout << "Make sure the environment is set up for compiling with ActiveSync." << endl;
2088 dictionary[ "DONE" ] = "error";
2090 } else if (part == "INCREDIBUILD_XGE") {
2091 available = !QStandardPaths::findExecutable(QStringLiteral("BuildConsole.exe")).isEmpty()
2092 && !QStandardPaths::findExecutable(QStringLiteral("xgConsole.exe")).isEmpty();
2093 } else if (part == "WMSDK") {
2094 available = findFile("wmsdk.h");
2095 } else if (part == "V8SNAPSHOT") {
2097 } else if (part == "AUDIO_BACKEND") {
2099 } else if (part == "DIRECTWRITE") {
2100 available = findFile("dwrite.h") && findFile("d2d1.h") && findFile("dwrite.lib");
2101 } else if (part == "ICONV") {
2102 available = tryCompileProject("unix/iconv") || tryCompileProject("unix/gnu-libiconv");
2103 } else if (part == "INOTIFY") {
2104 available = tryCompileProject("unix/inotify");
2105 } else if (part == "CUPS") {
2106 available = (platform() != WINDOWS) && (platform() != WINDOWS_CE) && tryCompileProject("unix/cups");
2107 } else if (part == "STACK_PROTECTOR_STRONG") {
2108 available = (platform() == QNX || platform() == BLACKBERRY) && compilerSupportsFlag("qcc -fstack-protector-strong");
2109 } else if (part == "SLOG2") {
2110 available = tryCompileProject("unix/slog2");
2117 Autodetect options marked as "auto".
2119 void Configure::autoDetection()
2121 if (dictionary["C++11"] == "auto") {
2122 if (!dictionary["QMAKESPEC"].contains("msvc"))
2123 dictionary["C++11"] = tryCompileProject("common/c++11") ? "yes" : "no";
2127 if (dictionary["STYLE_WINDOWSXP"] == "auto")
2128 dictionary["STYLE_WINDOWSXP"] = checkAvailability("STYLE_WINDOWSXP") ? defaultTo("STYLE_WINDOWSXP") : "no";
2129 if (dictionary["STYLE_WINDOWSVISTA"] == "auto") // Vista style has the same requirements as XP style
2130 dictionary["STYLE_WINDOWSVISTA"] = checkAvailability("STYLE_WINDOWSXP") ? defaultTo("STYLE_WINDOWSVISTA") : "no";
2132 // Compression detection
2133 if (dictionary["ZLIB"] == "auto")
2134 dictionary["ZLIB"] = checkAvailability("ZLIB") ? defaultTo("ZLIB") : "qt";
2137 if (dictionary["PCRE"] == "auto")
2138 dictionary["PCRE"] = checkAvailability("PCRE") ? defaultTo("PCRE") : "qt";
2141 if (dictionary["ICU"] == "auto")
2142 dictionary["ICU"] = checkAvailability("ICU") ? "yes" : "no";
2145 if (dictionary["ANGLE"] == "auto") {
2146 if (dictionary["OPENGL_ES_2"] == "yes") {
2147 dictionary["ANGLE"] = checkAngleAvailability() ? "yes" : "no";
2148 dictionary["ANGLE_FROM"] = "detected";
2150 dictionary["ANGLE"] = "no";
2154 // Image format detection
2155 if (dictionary["GIF"] == "auto")
2156 dictionary["GIF"] = defaultTo("GIF");
2157 if (dictionary["JPEG"] == "auto")
2158 dictionary["JPEG"] = defaultTo("JPEG");
2159 if (dictionary["PNG"] == "auto")
2160 dictionary["PNG"] = defaultTo("PNG");
2161 if (dictionary["LIBJPEG"] == "auto")
2162 dictionary["LIBJPEG"] = checkAvailability("LIBJPEG") ? defaultTo("LIBJPEG") : "qt";
2163 if (dictionary["LIBPNG"] == "auto")
2164 dictionary["LIBPNG"] = checkAvailability("LIBPNG") ? defaultTo("LIBPNG") : "qt";
2166 // SQL detection (not on by default)
2167 if (dictionary["SQL_MYSQL"] == "auto")
2168 dictionary["SQL_MYSQL"] = checkAvailability("SQL_MYSQL") ? defaultTo("SQL_MYSQL") : "no";
2169 if (dictionary["SQL_ODBC"] == "auto")
2170 dictionary["SQL_ODBC"] = checkAvailability("SQL_ODBC") ? defaultTo("SQL_ODBC") : "no";
2171 if (dictionary["SQL_OCI"] == "auto")
2172 dictionary["SQL_OCI"] = checkAvailability("SQL_OCI") ? defaultTo("SQL_OCI") : "no";
2173 if (dictionary["SQL_PSQL"] == "auto")
2174 dictionary["SQL_PSQL"] = checkAvailability("SQL_PSQL") ? defaultTo("SQL_PSQL") : "no";
2175 if (dictionary["SQL_TDS"] == "auto")
2176 dictionary["SQL_TDS"] = checkAvailability("SQL_TDS") ? defaultTo("SQL_TDS") : "no";
2177 if (dictionary["SQL_DB2"] == "auto")
2178 dictionary["SQL_DB2"] = checkAvailability("SQL_DB2") ? defaultTo("SQL_DB2") : "no";
2179 if (dictionary["SQL_SQLITE"] == "auto")
2180 dictionary["SQL_SQLITE"] = checkAvailability("SQL_SQLITE") ? defaultTo("SQL_SQLITE") : "no";
2181 if (dictionary["SQL_SQLITE_LIB"] == "system")
2182 if (!checkAvailability("SQL_SQLITE_LIB"))
2183 dictionary["SQL_SQLITE_LIB"] = "no";
2184 if (dictionary["SQL_SQLITE2"] == "auto")
2185 dictionary["SQL_SQLITE2"] = checkAvailability("SQL_SQLITE2") ? defaultTo("SQL_SQLITE2") : "no";
2186 if (dictionary["SQL_IBASE"] == "auto")
2187 dictionary["SQL_IBASE"] = checkAvailability("SQL_IBASE") ? defaultTo("SQL_IBASE") : "no";
2188 if (dictionary["SSE2"] == "auto")
2189 dictionary["SSE2"] = checkAvailability("SSE2") ? "yes" : "no";
2190 if (dictionary["SSE3"] == "auto")
2191 dictionary["SSE3"] = checkAvailability("SSE3") ? "yes" : "no";
2192 if (dictionary["SSSE3"] == "auto")
2193 dictionary["SSSE3"] = checkAvailability("SSSE3") ? "yes" : "no";
2194 if (dictionary["SSE4_1"] == "auto")
2195 dictionary["SSE4_1"] = checkAvailability("SSE4_1") ? "yes" : "no";
2196 if (dictionary["SSE4_2"] == "auto")
2197 dictionary["SSE4_2"] = checkAvailability("SSE4_2") ? "yes" : "no";
2198 if (dictionary["AVX"] == "auto")
2199 dictionary["AVX"] = checkAvailability("AVX") ? "yes" : "no";
2200 if (dictionary["AVX2"] == "auto")
2201 dictionary["AVX2"] = checkAvailability("AVX2") ? "yes" : "no";
2202 if (dictionary["IWMMXT"] == "auto")
2203 dictionary["IWMMXT"] = checkAvailability("IWMMXT") ? "yes" : "no";
2204 if (dictionary["OPENSSL"] == "auto")
2205 dictionary["OPENSSL"] = checkAvailability("OPENSSL") ? "yes" : "no";
2206 if (dictionary["DBUS"] == "auto")
2207 dictionary["DBUS"] = checkAvailability("DBUS") ? "yes" : "no";
2208 if (dictionary["V8SNAPSHOT"] == "auto")
2209 dictionary["V8SNAPSHOT"] = (dictionary["V8"] == "yes") && checkAvailability("V8SNAPSHOT") ? "yes" : "no";
2210 if (dictionary["QML_DEBUG"] == "auto")
2211 dictionary["QML_DEBUG"] = dictionary["QML"] == "yes" ? "yes" : "no";
2212 if (dictionary["AUDIO_BACKEND"] == "auto")
2213 dictionary["AUDIO_BACKEND"] = checkAvailability("AUDIO_BACKEND") ? "yes" : "no";
2214 if (dictionary["WMSDK"] == "auto")
2215 dictionary["WMSDK"] = checkAvailability("WMSDK") ? "yes" : "no";
2217 // Qt/WinCE remote test application
2218 if (dictionary["CETEST"] == "auto")
2219 dictionary["CETEST"] = checkAvailability("CETEST") ? "yes" : "no";
2221 // Detection of IncrediBuild buildconsole
2222 if (dictionary["INCREDIBUILD_XGE"] == "auto")
2223 dictionary["INCREDIBUILD_XGE"] = checkAvailability("INCREDIBUILD_XGE") ? "yes" : "no";
2225 // Detection of iconv support
2226 if (dictionary["QT_ICONV"] == "auto")
2227 dictionary["QT_ICONV"] = checkAvailability("ICONV") ? "yes" : "no";
2229 // Detection of inotify
2230 if (dictionary["QT_INOTIFY"] == "auto")
2231 dictionary["QT_INOTIFY"] = checkAvailability("INOTIFY") ? "yes" : "no";
2233 // Detection of cups support
2234 if (dictionary["QT_CUPS"] == "auto")
2235 dictionary["QT_CUPS"] = checkAvailability("CUPS") ? "yes" : "no";
2237 // Detection of -fstack-protector-strong support
2238 if (dictionary["STACK_PROTECTOR_STRONG"] == "auto")
2239 dictionary["STACK_PROTECTOR_STRONG"] = checkAvailability("STACK_PROTECTOR_STRONG") ? "yes" : "no";
2241 if ((platform() == QNX || platform() == BLACKBERRY) && dictionary["SLOG2"] == "auto") {
2242 dictionary["SLOG2"] = checkAvailability("SLOG2") ? "yes" : "no";
2245 // Mark all unknown "auto" to the default value..
2246 for (QMap<QString,QString>::iterator i = dictionary.begin(); i != dictionary.end(); ++i) {
2247 if (i.value() == "auto")
2248 i.value() = defaultTo(i.key());
2252 bool Configure::verifyConfiguration()
2254 bool prompt = false;
2255 if (dictionary["C++11"] != "auto"
2256 && dictionary["QMAKESPEC"].contains("msvc")) {
2257 cout << "WARNING: Qt does not support disabling or enabling any existing C++11 support "
2258 "with MSVC compilers.";
2259 if (dictionary["C++11"] == "yes")
2260 cout << "Therefore -c++11 is ignored." << endl << endl;
2262 cout << "Therefore -no-c++11 is ignored." << endl << endl;
2264 dictionary["C++11"] = "auto";
2267 if (dictionary["SQL_SQLITE_LIB"] == "no" && dictionary["SQL_SQLITE"] != "no") {
2268 cout << "WARNING: Configure could not detect the presence of a system SQLite3 lib." << endl
2269 << "Configure will therefore continue with the SQLite3 lib bundled with Qt." << endl;
2270 dictionary["SQL_SQLITE_LIB"] = "qt"; // Set to Qt's bundled lib an continue
2273 if (dictionary["QMAKESPEC"].endsWith("-g++")
2274 && dictionary["SQL_OCI"] != "no") {
2275 cout << "WARNING: Qt does not support compiling the Oracle database driver with" << endl
2276 << "MinGW, due to lack of such support from Oracle. Consider disabling the" << endl
2277 << "Oracle driver, as the current build will most likely fail." << endl;
2280 if (dictionary["QMAKESPEC"].endsWith("win32-msvc.net")) {
2281 cout << "WARNING: The makespec win32-msvc.net is deprecated. Consider using" << endl
2282 << "win32-msvc2002 or win32-msvc2003 instead." << endl;
2285 if (0 != dictionary["ARM_FPU_TYPE"].size()) {
2286 QStringList l= QStringList()
2290 if (!(l.contains(dictionary["ARM_FPU_TYPE"])))
2291 cout << QString("WARNING: Using unsupported fpu flag: %1").arg(dictionary["ARM_FPU_TYPE"]) << endl;
2293 if (dictionary["DIRECTWRITE"] == "yes" && !checkAvailability("DIRECTWRITE")) {
2294 cout << "WARNING: To be able to compile the DirectWrite font engine you will" << endl
2295 << "need the Microsoft DirectWrite and Microsoft Direct2D development" << endl
2296 << "files such as headers and libraries." << endl;
2300 // -angle given on command line, but Direct X cannot be found.
2301 if (dictionary["ANGLE"] == "yes") {
2302 QString errorMessage;
2303 if (!checkAngleAvailability(&errorMessage)) {
2304 cout << "WARNING: ANGLE specified, but the DirectX SDK could not be detected:" << endl
2305 << " " << qPrintable(errorMessage) << endl
2306 << "The build will most likely fail." << endl;
2309 } else if (dictionary["ANGLE"] == "no") {
2310 if (dictionary["ANGLE_FROM"] == "detected") {
2311 QString errorMessage;
2312 checkAngleAvailability(&errorMessage);
2313 cout << "WARNING: The DirectX SDK could not be detected:" << endl
2314 << " " << qPrintable(errorMessage) << endl
2315 << "Disabling the ANGLE backend." << endl;
2318 if ((dictionary["OPENGL_ES_2"] == "yes") && (dictionary.value("XQMAKESPEC").isEmpty())) {
2319 cout << endl << "WARNING: Using OpenGL ES 2.0 without ANGLE." << endl
2320 << "Specify -opengl desktop to use Open GL." << endl
2321 << "The build will most likely fail." << endl;
2333 Things that affect the Qt API/ABI:
2335 minimal-config small-config medium-config large-config full-config
2340 Things that do not affect the Qt API/ABI:
2341 system-jpeg no-jpeg jpeg
2342 system-png no-png png
2343 system-zlib no-zlib zlib
2354 X11 : x11sm xinerama xcursor xfixes xrandr xrender fontconfig xkb
2355 Embedded: embedded freetype
2357 void Configure::generateBuildKey()
2359 QString spec = dictionary["QMAKESPEC"];
2361 QString compiler = "msvc"; // ICC is compatible
2362 if (spec.endsWith("-g++"))
2364 else if (spec.endsWith("-borland"))
2365 compiler = "borland";
2367 // Build options which changes the Qt API/ABI
2368 QStringList build_options;
2369 if (!dictionary["QCONFIG"].isEmpty())
2370 build_options += dictionary["QCONFIG"] + "-config ";
2371 build_options.sort();
2373 // Sorted defines that start with QT_NO_
2374 QStringList build_defines = qmakeDefines.filter(QRegExp("^QT_NO_"));
2375 build_defines.sort();
2378 void Configure::generateSystemVars()
2380 // Generate an empty .qmake.cache file for config.tests
2381 QDir buildDir(buildPath);
2382 bool success = true;
2383 if (!buildDir.exists("config.tests"))
2384 success = buildDir.mkdir("config.tests");
2386 QString fileName(buildPath + "/config.tests/.qmake.cache");
2387 QFile cacheFile(fileName);
2388 success &= cacheFile.open(QIODevice::WriteOnly);
2392 cout << "Failed to create file " << qPrintable(QDir::toNativeSeparators(fileName)) << endl;
2393 dictionary[ "DONE" ] = "error";
2397 void Configure::generateOutputVars()
2399 // Generate variables for output
2400 QString build = dictionary[ "BUILD" ];
2401 bool buildAll = (dictionary[ "BUILDALL" ] == "yes");
2402 if (build == "debug") {
2404 qtConfig += "debug_and_release build_all release";
2405 qtConfig += "debug";
2406 } else if (build == "release") {
2408 qtConfig += "debug_and_release build_all debug";
2409 qtConfig += "release";
2412 if (dictionary[ "C++11" ] == "yes")
2413 qtConfig += "c++11";
2415 if (dictionary[ "SHARED" ] == "no")
2416 qtConfig += "static";
2418 qtConfig += "shared";
2420 if (dictionary[ "WIDGETS" ] == "no")
2421 qtConfig += "no-widgets";
2423 // Compression --------------------------------------------------
2424 if (dictionary[ "ZLIB" ] == "qt")
2426 else if (dictionary[ "ZLIB" ] == "system")
2427 qtConfig += "system-zlib";
2429 // PCRE ---------------------------------------------------------
2430 if (dictionary[ "PCRE" ] == "qt")
2431 qmakeConfig += "pcre";
2433 // ICU ---------------------------------------------------------
2434 if (dictionary[ "ICU" ] == "yes")
2437 // ANGLE --------------------------------------------------------
2438 if (dictionary[ "ANGLE" ] == "yes")
2439 qtConfig += "angle";
2441 // Image formates -----------------------------------------------
2442 if (dictionary[ "GIF" ] == "no")
2443 qtConfig += "no-gif";
2444 else if (dictionary[ "GIF" ] == "yes")
2447 if (dictionary[ "JPEG" ] == "no")
2448 qtConfig += "no-jpeg";
2449 else if (dictionary[ "JPEG" ] == "yes")
2451 if (dictionary[ "LIBJPEG" ] == "system")
2452 qtConfig += "system-jpeg";
2454 if (dictionary[ "PNG" ] == "no")
2455 qtConfig += "no-png";
2456 else if (dictionary[ "PNG" ] == "yes")
2458 if (dictionary[ "LIBPNG" ] == "system")
2459 qtConfig += "system-png";
2461 // Text rendering --------------------------------------------------
2462 if (dictionary[ "FREETYPE" ] == "yes")
2463 qtConfig += "freetype";
2464 else if (dictionary[ "FREETYPE" ] == "system")
2465 qtConfig += "system-freetype";
2467 // Styles -------------------------------------------------------
2468 if (dictionary[ "STYLE_WINDOWS" ] == "yes")
2469 qmakeStyles += "windows";
2471 if (dictionary[ "STYLE_FUSION" ] == "yes")
2472 qmakeStyles += "fusion";
2474 if (dictionary[ "STYLE_WINDOWSXP" ] == "yes")
2475 qmakeStyles += "windowsxp";
2477 if (dictionary[ "STYLE_WINDOWSVISTA" ] == "yes")
2478 qmakeStyles += "windowsvista";
2480 if (dictionary[ "STYLE_WINDOWSCE" ] == "yes")
2481 qmakeStyles += "windowsce";
2483 if (dictionary[ "STYLE_WINDOWSMOBILE" ] == "yes")
2484 qmakeStyles += "windowsmobile";
2486 // Databases ----------------------------------------------------
2487 if (dictionary[ "SQL_MYSQL" ] == "yes")
2488 qmakeSql += "mysql";
2489 else if (dictionary[ "SQL_MYSQL" ] == "plugin")
2490 qmakeSqlPlugins += "mysql";
2492 if (dictionary[ "SQL_ODBC" ] == "yes")
2494 else if (dictionary[ "SQL_ODBC" ] == "plugin")
2495 qmakeSqlPlugins += "odbc";
2497 if (dictionary[ "SQL_OCI" ] == "yes")
2499 else if (dictionary[ "SQL_OCI" ] == "plugin")
2500 qmakeSqlPlugins += "oci";
2502 if (dictionary[ "SQL_PSQL" ] == "yes")
2504 else if (dictionary[ "SQL_PSQL" ] == "plugin")
2505 qmakeSqlPlugins += "psql";
2507 if (dictionary[ "SQL_TDS" ] == "yes")
2509 else if (dictionary[ "SQL_TDS" ] == "plugin")
2510 qmakeSqlPlugins += "tds";
2512 if (dictionary[ "SQL_DB2" ] == "yes")
2514 else if (dictionary[ "SQL_DB2" ] == "plugin")
2515 qmakeSqlPlugins += "db2";
2517 if (dictionary[ "SQL_SQLITE" ] == "yes")
2518 qmakeSql += "sqlite";
2519 else if (dictionary[ "SQL_SQLITE" ] == "plugin")
2520 qmakeSqlPlugins += "sqlite";
2522 if (dictionary[ "SQL_SQLITE_LIB" ] == "system")
2523 qmakeConfig += "system-sqlite";
2525 if (dictionary[ "SQL_SQLITE2" ] == "yes")
2526 qmakeSql += "sqlite2";
2527 else if (dictionary[ "SQL_SQLITE2" ] == "plugin")
2528 qmakeSqlPlugins += "sqlite2";
2530 if (dictionary[ "SQL_IBASE" ] == "yes")
2531 qmakeSql += "ibase";
2532 else if (dictionary[ "SQL_IBASE" ] == "plugin")
2533 qmakeSqlPlugins += "ibase";
2535 // Other options ------------------------------------------------
2536 if (dictionary[ "BUILDALL" ] == "yes") {
2537 qtConfig += "build_all";
2539 if (dictionary[ "FORCEDEBUGINFO" ] == "yes")
2540 qtConfig += "force_debug_info";
2541 qmakeConfig += dictionary[ "BUILD" ];
2542 dictionary[ "QMAKE_OUTDIR" ] = dictionary[ "BUILD" ];
2544 if (buildParts.isEmpty()) {
2545 buildParts = defaultBuildParts;
2547 if (dictionary["BUILDDEV"] == "yes")
2548 buildParts += "tests";
2550 while (!nobuildParts.isEmpty())
2551 buildParts.removeAll(nobuildParts.takeFirst());
2552 if (!buildParts.contains("libs"))
2553 buildParts += "libs";
2554 buildParts.removeDuplicates();
2556 if (dictionary["MSVC_MP"] == "yes")
2557 qmakeConfig += "msvc_mp";
2559 if (dictionary[ "SHARED" ] == "yes") {
2560 QString version = dictionary[ "VERSION" ];
2561 if (!version.isEmpty()) {
2562 qmakeVars += "QMAKE_QT_VERSION_OVERRIDE = " + version.left(version.indexOf('.'));
2563 version.remove(QLatin1Char('.'));
2565 dictionary[ "QMAKE_OUTDIR" ] += "_shared";
2567 dictionary[ "QMAKE_OUTDIR" ] += "_static";
2570 if (dictionary[ "ACCESSIBILITY" ] == "yes")
2571 qtConfig += "accessibility";
2573 if (!qmakeLibs.isEmpty())
2574 qmakeVars += "LIBS += " + formatPaths(qmakeLibs);
2576 if (!dictionary["QT_LFLAGS_SQLITE"].isEmpty())
2577 qmakeVars += "QT_LFLAGS_SQLITE += " + formatPath(dictionary["QT_LFLAGS_SQLITE"]);
2579 if (dictionary[ "OPENGL" ] == "yes")
2580 qtConfig += "opengl";
2582 if (dictionary["OPENGL_ES_CM"] == "yes") {
2583 qtConfig += "opengles1";
2587 if (dictionary["OPENGL_ES_2"] == "yes") {
2588 qtConfig += "opengles2";
2592 if (dictionary["OPENVG"] == "yes") {
2593 qtConfig += "openvg";
2597 if (dictionary[ "OPENSSL" ] == "yes")
2598 qtConfig += "openssl";
2599 else if (dictionary[ "OPENSSL" ] == "linked")
2600 qtConfig += "openssl-linked";
2602 if (dictionary[ "DBUS" ] == "yes")
2604 else if (dictionary[ "DBUS" ] == "linked")
2605 qtConfig += "dbus dbus-linked";
2607 if (dictionary[ "CETEST" ] == "yes")
2608 qtConfig += "cetest";
2611 if (dictionary["AUDIO_BACKEND"] == "yes")
2612 qtConfig += "audio-backend";
2614 if (dictionary["DIRECTWRITE"] == "yes")
2615 qtConfig += "directwrite";
2617 if (dictionary[ "NATIVE_GESTURES" ] == "yes")
2618 qtConfig += "native-gestures";
2622 if (dictionary["NIS"] == "yes")
2625 if (dictionary["QT_CUPS"] == "yes")
2628 if (dictionary["QT_ICONV"] == "yes")
2629 qtConfig += "iconv";
2630 else if (dictionary["QT_ICONV"] == "sun")
2631 qtConfig += "sun-libiconv";
2632 else if (dictionary["QT_ICONV"] == "gnu")
2633 qtConfig += "gnu-libiconv";
2635 if (dictionary["QT_INOTIFY"] == "yes")
2636 qtConfig += "inotify";
2638 if (dictionary["FONT_CONFIG"] == "yes") {
2639 qtConfig += "fontconfig";
2640 qmakeVars += "QMAKE_CFLAGS_FONTCONFIG =";
2641 qmakeVars += "QMAKE_LIBS_FONTCONFIG = -lfreetype -lfontconfig";
2644 if (dictionary["QT_GLIB"] == "yes")
2647 if (dictionary["STACK_PROTECTOR_STRONG"] == "yes")
2648 qtConfig += "stack-protector-strong";
2650 // We currently have no switch for QtConcurrent, so add it unconditionally.
2651 qtConfig += "concurrent";
2654 if (dictionary[ "V8SNAPSHOT" ] == "yes")
2655 qtConfig += "v8snapshot";
2657 if (dictionary[ "SYSTEM_PROXIES" ] == "yes")
2658 qtConfig += "system-proxies";
2660 // Add config levels --------------------------------------------
2661 QStringList possible_configs = QStringList()
2668 QString set_config = dictionary["QCONFIG"];
2669 if (possible_configs.contains(set_config)) {
2670 foreach (const QString &cfg, possible_configs) {
2671 qtConfig += (cfg + "-config");
2672 if (cfg == set_config)
2677 if (dictionary.contains("XQMAKESPEC") && (dictionary["QMAKESPEC"] != dictionary["XQMAKESPEC"])) {
2678 qmakeConfig += "cross_compile";
2679 dictionary["CROSS_COMPILE"] = "yes";
2682 // Directories and settings for .qmake.cache --------------------
2684 if (dictionary.contains("XQMAKESPEC") && dictionary[ "XQMAKESPEC" ].startsWith("linux"))
2685 qtConfig += "rpath";
2687 qmakeVars += QString("OBJECTS_DIR = ") + formatPath(".obj/" + dictionary["QMAKE_OUTDIR"]);
2688 qmakeVars += QString("MOC_DIR = ") + formatPath(".moc/" + dictionary["QMAKE_OUTDIR"]);
2689 qmakeVars += QString("RCC_DIR = ") + formatPath(".rcc/" + dictionary["QMAKE_OUTDIR"]);
2691 if (!qmakeDefines.isEmpty())
2692 qmakeVars += QString("DEFINES += ") + qmakeDefines.join(' ');
2693 if (!qmakeIncludes.isEmpty())
2694 qmakeVars += QString("INCLUDEPATH += ") + formatPaths(qmakeIncludes);
2695 if (!opensslLibs.isEmpty())
2696 qmakeVars += opensslLibs;
2697 if (dictionary[ "OPENSSL" ] == "linked") {
2698 if (!opensslLibsDebug.isEmpty() || !opensslLibsRelease.isEmpty()) {
2699 if (opensslLibsDebug.isEmpty() || opensslLibsRelease.isEmpty()) {
2700 cout << "Error: either both or none of OPENSSL_LIBS_DEBUG/_RELEASE must be defined." << endl;
2703 qmakeVars += opensslLibsDebug;
2704 qmakeVars += opensslLibsRelease;
2705 } else if (opensslLibs.isEmpty()) {
2706 qmakeVars += QString("OPENSSL_LIBS = -lssleay32 -llibeay32");
2708 if (!opensslPath.isEmpty())
2709 qmakeVars += opensslPath;
2711 if (dictionary[ "DBUS" ] != "no" && !dbusPath.isEmpty())
2712 qmakeVars += dbusPath;
2713 if (dictionary[ "SQL_MYSQL" ] != "no" && !mysqlPath.isEmpty())
2714 qmakeVars += mysqlPath;
2715 if (!psqlLibs.isEmpty())
2716 qmakeVars += QString("QT_LFLAGS_PSQL=") + psqlLibs.section("=", 1);
2717 if (!zlibLibs.isEmpty())
2718 qmakeVars += zlibLibs;
2721 QStringList lflagsTDS;
2722 if (!sybase.isEmpty())
2723 lflagsTDS += QString("-L") + formatPath(sybase.section("=", 1) + "/lib");
2724 if (!sybaseLibs.isEmpty())
2725 lflagsTDS += sybaseLibs.section("=", 1);
2726 if (!lflagsTDS.isEmpty())
2727 qmakeVars += QString("QT_LFLAGS_TDS=") + lflagsTDS.join(' ');
2730 if (!qmakeSql.isEmpty())
2731 qmakeVars += QString("sql-drivers += ") + qmakeSql.join(' ');
2732 if (!qmakeSqlPlugins.isEmpty())
2733 qmakeVars += QString("sql-plugins += ") + qmakeSqlPlugins.join(' ');
2734 if (!qmakeStyles.isEmpty())
2735 qmakeVars += QString("styles += ") + qmakeStyles.join(' ');
2736 if (!qmakeStylePlugins.isEmpty())
2737 qmakeVars += QString("style-plugins += ") + qmakeStylePlugins.join(' ');
2739 if (dictionary["QMAKESPEC"].endsWith("-g++")) {
2740 QString includepath = qgetenv("INCLUDE");
2741 const bool hasSh = !QStandardPaths::findExecutable(QStringLiteral("sh.exe")).isEmpty();
2742 QChar separator = (!includepath.contains(":\\") && hasSh ? QChar(':') : QChar(';'));
2743 qmakeVars += QString("TMPPATH = $$quote($$(INCLUDE))");
2744 qmakeVars += QString("QMAKE_INCDIR_POST += $$split(TMPPATH,\"%1\")").arg(separator);
2745 qmakeVars += QString("TMPPATH = $$quote($$(LIB))");
2746 qmakeVars += QString("QMAKE_LIBDIR_POST += $$split(TMPPATH,\"%1\")").arg(separator);
2749 if (!dictionary[ "QMAKESPEC" ].length()) {
2750 cout << "Configure could not detect your compiler. QMAKESPEC must either" << endl
2751 << "be defined as an environment variable, or specified as an" << endl
2752 << "argument with -platform" << endl;
2753 dictionary[ "HELP" ] = "yes";
2755 QStringList winPlatforms;
2756 QDir mkspecsDir(sourcePath + "/mkspecs");
2757 const QFileInfoList &specsList = mkspecsDir.entryInfoList();
2758 for (int i = 0; i < specsList.size(); ++i) {
2759 const QFileInfo &fi = specsList.at(i);
2760 if (fi.fileName().left(5) == "win32") {
2761 winPlatforms += fi.fileName();
2764 cout << "Available platforms are: " << qPrintable(winPlatforms.join(", ")) << endl;
2765 dictionary[ "DONE" ] = "error";
2770 void Configure::generateCachefile()
2772 // Generate .qmake.cache
2773 QFile cacheFile(buildPath + "/.qmake.cache");
2774 if (cacheFile.open(QFile::WriteOnly | QFile::Text)) { // Truncates any existing file.
2775 QTextStream cacheStream(&cacheFile);
2777 cacheStream << "QT_SOURCE_TREE = " << formatPath(dictionary["QT_SOURCE_TREE"]) << endl;
2778 cacheStream << "QT_BUILD_TREE = " << formatPath(dictionary["QT_BUILD_TREE"]) << endl;
2780 cacheStream.flush();
2784 // Generate qmodule.pri
2785 QFile moduleFile(dictionary[ "QT_BUILD_TREE" ] + "/mkspecs/qmodule.pri");
2786 if (moduleFile.open(QFile::WriteOnly | QFile::Text)) { // Truncates any existing file.
2787 QTextStream moduleStream(&moduleFile);
2789 moduleStream << "QT_BUILD_PARTS += " << buildParts.join(' ') << endl << endl;
2791 if (dictionary["QT_EDITION"] != "QT_EDITION_OPENSOURCE")
2792 moduleStream << "DEFINES *= QT_EDITION=QT_EDITION_DESKTOP" << endl;
2794 if (dictionary["CETEST"] == "yes") {
2795 moduleStream << "QT_CE_RAPI_INC = " << formatPath(dictionary["QT_CE_RAPI_INC"]) << endl;
2796 moduleStream << "QT_CE_RAPI_LIB = " << formatPath(dictionary["QT_CE_RAPI_LIB"]) << endl;
2799 moduleStream << "#Qt for Windows CE c-runtime deployment" << endl
2800 << "QT_CE_C_RUNTIME = " << formatPath(dictionary["CE_CRT"]) << endl;
2802 if (dictionary["CE_SIGNATURE"] != QLatin1String("no"))
2803 moduleStream << "DEFAULT_SIGNATURE=" << dictionary["CE_SIGNATURE"] << endl;
2806 if (!dictionary["KBD_DRIVERS"].isEmpty())
2807 moduleStream << "kbd-drivers += "<< dictionary["KBD_DRIVERS"]<<endl;
2808 if (!dictionary["GFX_DRIVERS"].isEmpty())
2809 moduleStream << "gfx-drivers += "<< dictionary["GFX_DRIVERS"]<<endl;
2810 if (!dictionary["MOUSE_DRIVERS"].isEmpty())
2811 moduleStream << "mouse-drivers += "<< dictionary["MOUSE_DRIVERS"]<<endl;
2812 if (!dictionary["DECORATIONS"].isEmpty())
2813 moduleStream << "decorations += "<<dictionary["DECORATIONS"]<<endl;
2815 moduleStream << "CONFIG += " << qmakeConfig.join(' ');
2816 if (dictionary[ "SSE2" ] == "yes")
2817 moduleStream << " sse2";
2818 if (dictionary[ "SSE3" ] == "yes")
2819 moduleStream << " sse3";
2820 if (dictionary[ "SSSE3" ] == "yes")
2821 moduleStream << " ssse3";
2822 if (dictionary[ "SSE4_1" ] == "yes")
2823 moduleStream << " sse4_1";
2824 if (dictionary[ "SSE4_2" ] == "yes")
2825 moduleStream << " sse4_2";
2826 if (dictionary[ "AVX" ] == "yes")
2827 moduleStream << " avx";
2828 if (dictionary[ "AVX2" ] == "yes")
2829 moduleStream << " avx2";
2830 if (dictionary[ "IWMMXT" ] == "yes")
2831 moduleStream << " iwmmxt";
2832 if (dictionary[ "NEON" ] == "yes")
2833 moduleStream << " neon";
2834 if (dictionary[ "LARGE_FILE" ] == "yes")
2835 moduleStream << " largefile";
2836 if (dictionary[ "STRIP" ] == "no")
2837 moduleStream << " nostrip";
2838 moduleStream << endl;
2840 for (QStringList::Iterator var = qmakeVars.begin(); var != qmakeVars.end(); ++var)
2841 moduleStream << (*var) << endl;
2843 moduleStream.flush();
2849 const char *qmakespec;
2851 const char *subarchKey;
2854 ArchData(const char *t, const char *qm, const char *k, const char *sak)
2855 : qmakespec(qm), key(k), subarchKey(sak), type(t)
2860 Runs qmake on config.tests/arch/arch.pro, which will detect the target arch
2861 for the compiler we are using
2863 void Configure::detectArch()
2865 QString oldpwd = QDir::currentPath();
2867 QString newpwd = QString("%1/config.tests/arch").arg(buildPath);
2868 if (!QDir().exists(newpwd) && !QDir().mkpath(newpwd)) {
2869 cout << "Failed to create directory " << qPrintable(QDir::toNativeSeparators(newpwd)) << endl;
2870 dictionary["DONE"] = "error";
2873 if (!QDir::setCurrent(newpwd)) {
2874 cout << "Failed to change working directory to " << qPrintable(QDir::toNativeSeparators(newpwd)) << endl;
2875 dictionary["DONE"] = "error";
2879 QVector<ArchData> qmakespecs;
2880 if (dictionary.contains("XQMAKESPEC"))
2881 qmakespecs << ArchData("target", "XQMAKESPEC", "QT_ARCH", "QT_CPU_FEATURES");
2882 qmakespecs << ArchData("host", "QMAKESPEC", "QT_HOST_ARCH", "QT_HOST_CPU_FEATURES");
2884 for (int i = 0; i < qmakespecs.count(); ++i) {
2885 const ArchData &data = qmakespecs.at(i);
2886 QString qmakespec = dictionary.value(data.qmakespec);
2887 QString key = data.key;
2888 QString subarchKey = data.subarchKey;
2891 QString command = QString("%1 -spec %2 %3")
2892 .arg(QDir::toNativeSeparators(buildPath + "/bin/qmake.exe"),
2893 QDir::toNativeSeparators(qmakespec),
2894 QDir::toNativeSeparators(sourcePath + "/config.tests/arch/arch.pro"));
2895 int returnValue = 0;
2896 Environment::execute(command, &returnValue);
2897 if (returnValue != 0) {
2898 cout << "QMake failed!" << endl;
2899 dictionary["DONE"] = "error";
2904 command = dictionary[ "MAKE" ];
2905 if (command.contains("nmake"))
2906 command += " /NOLOGO";
2908 Environment::execute(command);
2910 // find the executable that was generated
2911 QFile exe("arch.exe");
2912 if (!exe.open(QFile::ReadOnly)) { // no Text, this is binary
2913 exe.setFileName("arch");
2914 if (!exe.open(QFile::ReadOnly)) {
2915 cout << "Could not find output file: " << qPrintable(exe.errorString()) << endl;
2916 dictionary["DONE"] = "error";
2920 QByteArray exeContents = exe.readAll();
2923 static const char archMagic[] = "==Qt=magic=Qt== Architecture:";
2924 int magicPos = exeContents.indexOf(archMagic);
2925 if (magicPos == -1) {
2926 cout << "Internal error, could not find the architecture of the "
2927 << data.type << " executable" << endl;
2928 dictionary["DONE"] = "error";
2931 //cout << "Found magic at offset 0x" << hex << magicPos << endl;
2933 // the conversion from QByteArray will stop at the ending NUL anyway
2934 QString arch = QString::fromLatin1(exeContents.constData() + magicPos
2935 + sizeof(archMagic) - 1);
2936 dictionary[key] = arch;
2938 static const char subarchMagic[] = "==Qt=magic=Qt== Sub-architecture:";
2939 magicPos = exeContents.indexOf(subarchMagic);
2940 if (magicPos == -1) {
2941 cout << "Internal error, could not find the sub-architecture of the "
2942 << data.type << " executable" << endl;
2943 dictionary["DONE"] = "error";
2947 QString subarch = QString::fromLatin1(exeContents.constData() + magicPos
2948 + sizeof(subarchMagic) - 1);
2949 dictionary[subarchKey] = subarch;
2951 //cout << "Detected arch '" << qPrintable(arch) << "'\n";
2952 //cout << "Detected sub-arch '" << qPrintable(subarch) << "'\n";
2955 Environment::execute(command + " distclean");
2958 if (!dictionary.contains("QT_HOST_ARCH"))
2959 dictionary["QT_HOST_ARCH"] = "unknown";
2960 if (!dictionary.contains("QT_ARCH")) {
2961 dictionary["QT_ARCH"] = dictionary["QT_HOST_ARCH"];
2962 dictionary["QT_CPU_FEATURES"] = dictionary["QT_HOST_CPU_FEATURES"];
2965 QDir::setCurrent(oldpwd);
2968 bool Configure::tryCompileProject(const QString &projectPath, const QString &extraOptions)
2970 QString oldpwd = QDir::currentPath();
2972 QString newpwd = QString("%1/config.tests/%2").arg(buildPath, projectPath);
2973 if (!QDir().exists(newpwd) && !QDir().mkpath(newpwd)) {
2974 cout << "Failed to create directory " << qPrintable(QDir::toNativeSeparators(newpwd)) << endl;
2975 dictionary["DONE"] = "error";
2978 if (!QDir::setCurrent(newpwd)) {
2979 cout << "Failed to change working directory to " << qPrintable(QDir::toNativeSeparators(newpwd)) << endl;
2980 dictionary["DONE"] = "error";
2985 QString command = QString("%1 %2 %3 2>&1")
2986 .arg(QDir::toNativeSeparators(buildPath + "/bin/qmake.exe"),
2987 QDir::toNativeSeparators(sourcePath + "/config.tests/" + projectPath),
2990 QString output = Environment::execute(command, &code);
2991 //cout << output << endl;
2995 command = dictionary[ "MAKE" ];
2996 if (command.contains("nmake"))
2997 command += " /NOLOGO";
2998 command += " -s 2>&1";
2999 output = Environment::execute(command, &code);
3000 //cout << output << endl;
3003 Environment::execute(command + " distclean 2>&1");
3006 QDir::setCurrent(oldpwd);
3010 bool Configure::compilerSupportsFlag(const QString &compilerAndArgs)
3012 QFile file("conftest.cpp");
3013 if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
3014 cout << "could not open temp file for writing" << endl;
3017 if (!file.write("int main() { return 0; }\r\n")) {
3018 cout << "could not write to temp file" << endl;
3022 // compilerAndArgs contains compiler because there is no way to query it
3023 QString command = compilerAndArgs + " -o conftest-out.o conftest.cpp";
3025 QString output = Environment::execute(command, &code);
3027 QFile::remove("conftest-out.o");
3031 void Configure::generateQConfigPri()
3033 // Generate qconfig.pri
3034 QFile configFile(dictionary[ "QT_BUILD_TREE" ] + "/mkspecs/qconfig.pri");
3035 if (configFile.open(QFile::WriteOnly | QFile::Text)) { // Truncates any existing file.
3036 QTextStream configStream(&configFile);
3038 configStream << "CONFIG+= ";
3039 configStream << dictionary[ "BUILD" ];
3041 if (dictionary[ "LTCG" ] == "yes")
3042 configStream << " ltcg";
3043 if (dictionary[ "RTTI" ] == "yes")
3044 configStream << " rtti";
3045 if (dictionary["INCREDIBUILD_XGE"] == "yes")
3046 configStream << " incredibuild_xge";
3047 if (dictionary["PLUGIN_MANIFESTS"] == "no")
3048 configStream << " no_plugin_manifest";
3049 if (dictionary["CROSS_COMPILE"] == "yes")
3050 configStream << " cross_compile";
3052 if (dictionary[ "SLOG2" ] == "yes")
3053 configStream << " slog2";
3055 if (dictionary["DIRECTWRITE"] == "yes")
3056 configStream << "directwrite";
3058 // ### For compatibility only, should be removed later.
3059 configStream << " qpa";
3061 configStream << endl;
3062 configStream << "QT_ARCH = " << dictionary["QT_ARCH"] << endl;
3063 configStream << "QT_HOST_ARCH = " << dictionary["QT_HOST_ARCH"] << endl;
3064 configStream << "QT_CPU_FEATURES = " << dictionary["QT_CPU_FEATURES"] << endl;
3065 configStream << "QT_HOST_CPU_FEATURES = " << dictionary["QT_HOST_CPU_FEATURES"] << endl;
3066 if (!dictionary["XQMAKESPEC"].isEmpty() && !dictionary["XQMAKESPEC"].startsWith("wince")) {
3067 // FIXME: add detection
3068 configStream << "QMAKE_DEFAULT_LIBDIRS = /lib /usr/lib" << endl;
3069 configStream << "QMAKE_DEFAULT_INCDIRS = /usr/include /usr/local/include" << endl;
3071 if (dictionary["QT_EDITION"].contains("OPENSOURCE"))
3072 configStream << "QT_EDITION = " << QLatin1String("OpenSource") << endl;
3074 configStream << "QT_EDITION = " << dictionary["EDITION"] << endl;
3075 configStream << "QT_CONFIG += " << qtConfig.join(' ') << endl;
3077 configStream << "#versioning " << endl
3078 << "QT_VERSION = " << dictionary["VERSION"] << endl
3079 << "QT_MAJOR_VERSION = " << dictionary["VERSION_MAJOR"] << endl
3080 << "QT_MINOR_VERSION = " << dictionary["VERSION_MINOR"] << endl
3081 << "QT_PATCH_VERSION = " << dictionary["VERSION_PATCH"] << endl;
3083 if (!dictionary["CFG_SYSROOT"].isEmpty() && dictionary["CFG_GCC_SYSROOT"] == "yes") {
3084 configStream << endl
3085 << "# sysroot" << endl
3086 << "!host_build {" << endl
3087 << " QMAKE_CFLAGS += --sysroot=$$[QT_SYSROOT]" << endl
3088 << " QMAKE_CXXFLAGS += --sysroot=$$[QT_SYSROOT]" << endl
3089 << " QMAKE_LFLAGS += --sysroot=$$[QT_SYSROOT]" << endl
3093 if (!dictionary["QMAKE_RPATHDIR"].isEmpty())
3094 configStream << "QMAKE_RPATHDIR += " << formatPath(dictionary["QMAKE_RPATHDIR"]) << endl;
3096 if (!dictionary["QT_LIBINFIX"].isEmpty())
3097 configStream << "QT_LIBINFIX = " << dictionary["QT_LIBINFIX"] << endl;
3099 if (!dictionary["QT_NAMESPACE"].isEmpty())
3100 configStream << "#namespaces" << endl << "QT_NAMESPACE = " << dictionary["QT_NAMESPACE"] << endl;
3102 if (dictionary[ "SHARED" ] == "no")
3103 configStream << "QT_DEFAULT_QPA_PLUGIN = q" << qpaPlatformName() << endl;
3105 configStream.flush();
3111 QString Configure::addDefine(QString def)
3113 QString result, defNeg, defD = def;
3115 defD.replace(QRegExp("=.*"), "");
3116 def.replace(QRegExp("="), " ");
3118 if (def.startsWith("QT_NO_")) {
3120 defNeg.replace("QT_NO_", "QT_");
3121 } else if (def.startsWith("QT_")) {
3123 defNeg.replace("QT_", "QT_NO_");
3126 if (defNeg.isEmpty()) {
3127 result = "#ifndef $DEFD\n"
3131 result = "#if defined($DEFD) && defined($DEFNEG)\n"
3133 "#elif !defined($DEFD)\n"
3137 result.replace("$DEFNEG", defNeg);
3138 result.replace("$DEFD", defD);
3139 result.replace("$DEF", def);
3144 void Configure::generateConfigfiles()
3146 QDir(buildPath).mkpath("src/corelib/global");
3147 QString outName(buildPath + "/src/corelib/global/qconfig.h");
3148 QTemporaryFile tmpFile;
3149 QTextStream tmpStream;
3151 if (tmpFile.open()) {
3152 tmpStream.setDevice(&tmpFile);
3154 if (dictionary[ "QCONFIG" ] == "full") {
3155 tmpStream << "/* Everything */" << endl;
3157 QString configName("qconfig-" + dictionary[ "QCONFIG" ] + ".h");
3158 tmpStream << "/* Copied from " << configName << "*/" << endl;
3159 tmpStream << "#ifndef QT_BOOTSTRAPPED" << endl;
3160 QFile inFile(sourcePath + "/src/corelib/global/" + configName);
3161 if (inFile.open(QFile::ReadOnly)) {
3162 QByteArray buffer = inFile.readAll();
3163 tmpFile.write(buffer.constData(), buffer.size());
3166 tmpStream << "#endif // QT_BOOTSTRAPPED" << endl;
3170 if (dictionary[ "SHARED" ] == "no") {
3171 tmpStream << "/* Qt was configured for a static build */" << endl
3172 << "#if !defined(QT_SHARED) && !defined(QT_STATIC)" << endl
3173 << "# define QT_STATIC" << endl
3177 tmpStream << "/* License information */" << endl;
3178 tmpStream << "#define QT_PRODUCT_LICENSEE \"" << licenseInfo[ "LICENSEE" ] << "\"" << endl;
3179 tmpStream << "#define QT_PRODUCT_LICENSE \"" << dictionary[ "EDITION" ] << "\"" << endl;
3181 tmpStream << "// Qt Edition" << endl;
3182 tmpStream << "#ifndef QT_EDITION" << endl;
3183 tmpStream << "# define QT_EDITION " << dictionary["QT_EDITION"] << endl;
3184 tmpStream << "#endif" << endl;
3186 if (dictionary["BUILDDEV"] == "yes") {
3187 dictionary["QMAKE_INTERNAL"] = "yes";
3188 tmpStream << "/* Used for example to export symbols for the certain autotests*/" << endl;
3189 tmpStream << "#define QT_BUILD_INTERNAL" << endl;
3193 tmpStream << endl << "// Compiler sub-arch support" << endl;
3194 if (dictionary[ "SSE2" ] == "yes")
3195 tmpStream << "#define QT_COMPILER_SUPPORTS_SSE2" << endl;
3196 if (dictionary[ "SSE3" ] == "yes")
3197 tmpStream << "#define QT_COMPILER_SUPPORTS_SSE3" << endl;
3198 if (dictionary[ "SSSE3" ] == "yes")
3199 tmpStream << "#define QT_COMPILER_SUPPORTS_SSSE3" << endl;
3200 if (dictionary[ "SSE4_1" ] == "yes")
3201 tmpStream << "#define QT_COMPILER_SUPPORTS_SSE4_1" << endl;
3202 if (dictionary[ "SSE4_2" ] == "yes")
3203 tmpStream << "#define QT_COMPILER_SUPPORTS_SSE4_2" << endl;
3204 if (dictionary[ "AVX" ] == "yes")
3205 tmpStream << "#define QT_COMPILER_SUPPORTS_AVX" << endl;
3206 if (dictionary[ "AVX2" ] == "yes")
3207 tmpStream << "#define QT_COMPILER_SUPPORTS_AVX2" << endl;
3208 if (dictionary[ "IWMMXT" ] == "yes")
3209 tmpStream << "#define QT_COMPILER_SUPPORTS_IWMMXT" << endl;
3210 if (dictionary[ "NEON" ] == "yes")
3211 tmpStream << "#define QT_COMPILER_SUPPORTS_NEON" << endl;
3214 tmpStream << endl << "// Compile time features" << endl;
3216 QStringList qconfigList;
3217 if (dictionary["STYLE_WINDOWS"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWS";
3218 if (dictionary["STYLE_FUSION"] != "yes") qconfigList += "QT_NO_STYLE_FUSION";
3219 if (dictionary["STYLE_WINDOWSXP"] != "yes" && dictionary["STYLE_WINDOWSVISTA"] != "yes")
3220 qconfigList += "QT_NO_STYLE_WINDOWSXP";
3221 if (dictionary["STYLE_WINDOWSVISTA"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWSVISTA";
3223 // ### We still need the QT_NO_STYLE_S60 define for compiling Qt. Remove later!
3224 qconfigList += "QT_NO_STYLE_S60";
3226 if (dictionary["STYLE_WINDOWSCE"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWSCE";
3227 if (dictionary["STYLE_WINDOWSMOBILE"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWSMOBILE";
3228 if (dictionary["STYLE_GTK"] != "yes") qconfigList += "QT_NO_STYLE_GTK";
3230 if (dictionary["GIF"] == "yes") qconfigList += "QT_BUILTIN_GIF_READER=1";
3231 if (dictionary["PNG"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_PNG";
3232 if (dictionary["JPEG"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_JPEG";
3233 if (dictionary["ZLIB"] == "no") {
3234 qconfigList += "QT_NO_ZLIB";
3235 qconfigList += "QT_NO_COMPRESS";
3238 if (dictionary["ACCESSIBILITY"] == "no") qconfigList += "QT_NO_ACCESSIBILITY";
3239 if (dictionary["WIDGETS"] == "no") qconfigList += "QT_NO_WIDGETS";
3240 if (dictionary["OPENGL"] == "no") qconfigList += "QT_NO_OPENGL";
3241 if (dictionary["OPENVG"] == "no") qconfigList += "QT_NO_OPENVG";
3242 if (dictionary["OPENSSL"] == "no") {
3243 qconfigList += "QT_NO_OPENSSL";
3244 qconfigList += "QT_NO_SSL";
3246 if (dictionary["OPENSSL"] == "linked") qconfigList += "QT_LINKED_OPENSSL";
3247 if (dictionary["DBUS"] == "no") qconfigList += "QT_NO_DBUS";
3248 if (dictionary["QML_DEBUG"] == "no") qconfigList += "QT_QML_NO_DEBUGGER";
3249 if (dictionary["FREETYPE"] == "no") qconfigList += "QT_NO_FREETYPE";
3250 if (dictionary["NATIVE_GESTURES"] == "no") qconfigList += "QT_NO_NATIVE_GESTURES";
3252 if (dictionary["OPENGL_ES_CM"] == "yes" ||
3253 dictionary["OPENGL_ES_2"] == "yes") qconfigList += "QT_OPENGL_ES";
3255 if (dictionary["OPENGL_ES_CM"] == "yes") qconfigList += "QT_OPENGL_ES_1";
3256 if (dictionary["OPENGL_ES_2"] == "yes") qconfigList += "QT_OPENGL_ES_2";
3257 if (dictionary["SQL_MYSQL"] == "yes") qconfigList += "QT_SQL_MYSQL";
3258 if (dictionary["SQL_ODBC"] == "yes") qconfigList += "QT_SQL_ODBC";
3259 if (dictionary["SQL_OCI"] == "yes") qconfigList += "QT_SQL_OCI";
3260 if (dictionary["SQL_PSQL"] == "yes") qconfigList += "QT_SQL_PSQL";
3261 if (dictionary["SQL_TDS"] == "yes") qconfigList += "QT_SQL_TDS";
3262 if (dictionary["SQL_DB2"] == "yes") qconfigList += "QT_SQL_DB2";
3263 if (dictionary["SQL_SQLITE"] == "yes") qconfigList += "QT_SQL_SQLITE";
3264 if (dictionary["SQL_SQLITE2"] == "yes") qconfigList += "QT_SQL_SQLITE2";
3265 if (dictionary["SQL_IBASE"] == "yes") qconfigList += "QT_SQL_IBASE";
3267 if (dictionary["POSIX_IPC"] == "yes") qconfigList += "QT_POSIX_IPC";
3269 if (dictionary["FONT_CONFIG"] == "no") qconfigList += "QT_NO_FONTCONFIG";
3271 if (dictionary["NIS"] == "yes")
3272 qconfigList += "QT_NIS";
3274 qconfigList += "QT_NO_NIS";
3276 if (dictionary["LARGE_FILE"] == "yes") qconfigList += "QT_LARGEFILE_SUPPORT=64";
3277 if (dictionary["QT_CUPS"] == "no") qconfigList += "QT_NO_CUPS";
3278 if (dictionary["QT_ICONV"] == "no") qconfigList += "QT_NO_ICONV";
3279 if (dictionary["QT_GLIB"] == "no") qconfigList += "QT_NO_GLIB";
3280 if (dictionary["QT_INOTIFY"] == "no") qconfigList += "QT_NO_INOTIFY";
3283 for (int i = 0; i < qconfigList.count(); ++i)
3284 tmpStream << addDefine(qconfigList.at(i));
3286 tmpStream<<"#define QT_QPA_DEFAULT_PLATFORM_NAME \"" << qpaPlatformName() << "\""<<endl;
3291 // Replace old qconfig.h with new one
3292 ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL);
3293 QFile::remove(outName);
3294 tmpFile.copy(outName);
3298 QTemporaryFile tmpFile3;
3299 if (tmpFile3.open()) {
3300 tmpStream.setDevice(&tmpFile3);
3301 tmpStream << "/* Evaluation license key */" << endl
3302 << "static const volatile char qt_eval_key_data [512 + 12] = \"qt_qevalkey=" << licenseInfo["LICENSEKEYEXT"] << "\";" << endl;
3307 outName = buildPath + "/src/corelib/global/qconfig_eval.cpp";
3308 ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL);
3309 QFile::remove(outName);
3311 if (dictionary["EDITION"] == "Evaluation" || qmakeDefines.contains("QT_EVAL"))
3312 tmpFile3.copy(outName);
3319 void Configure::displayConfig()
3322 sout.open(QString(buildPath + "/config.summary").toLocal8Bit().constData(),
3323 ios::in | ios::out | ios::trunc);
3325 // Give some feedback
3326 sout << "Environment:" << endl;
3327 QString env = QString::fromLocal8Bit(getenv("INCLUDE")).replace(QRegExp("[;,]"), "\r\n ");
3330 sout << " INCLUDE=\r\n " << env << endl;
3331 env = QString::fromLocal8Bit(getenv("LIB")).replace(QRegExp("[;,]"), "\r\n ");
3334 sout << " LIB=\r\n " << env << endl;
3335 env = QString::fromLocal8Bit(getenv("PATH")).replace(QRegExp("[;,]"), "\r\n ");
3338 sout << " PATH=\r\n " << env << endl;
3340 if (dictionary[QStringLiteral("EDITION")] != QStringLiteral("OpenSource")) {
3341 QString l1 = licenseInfo[ "LICENSEE" ];
3342 QString l2 = licenseInfo[ "LICENSEID" ];
3343 QString l3 = dictionary["EDITION"] + ' ' + "Edition";
3344 QString l4 = licenseInfo[ "EXPIRYDATE" ];
3345 sout << "Licensee...................." << (l1.isNull() ? "" : l1) << endl;
3346 sout << "License ID.................." << (l2.isNull() ? "" : l2) << endl;
3347 sout << "Product license............." << (l3.isNull() ? "" : l3) << endl;
3348 sout << "Expiry Date................." << (l4.isNull() ? "" : l4) << endl << endl;
3351 sout << "Configuration:" << endl;
3352 sout << " " << qmakeConfig.join("\r\n ") << endl;
3353 sout << "Qt Configuration:" << endl;
3354 sout << " " << qtConfig.join("\r\n ") << endl;
3357 if (dictionary.contains("XQMAKESPEC"))
3358 sout << "QMAKESPEC..................." << dictionary[ "XQMAKESPEC" ] << " (" << dictionary["QMAKESPEC_FROM"] << ")" << endl;
3360 sout << "QMAKESPEC..................." << dictionary[ "QMAKESPEC" ] << " (" << dictionary["QMAKESPEC_FROM"] << ")" << endl;
3361 sout << "Architecture................" << dictionary["QT_ARCH"]
3362 << ", features:" << dictionary["QT_CPU_FEATURES"] << endl;
3363 sout << "Host Architecture..........." << dictionary["QT_HOST_ARCH"]
3364 << ", features:" << dictionary["QT_HOST_CPU_FEATURES"] << endl;
3365 sout << "Maketool...................." << dictionary[ "MAKE" ] << endl;
3366 if (dictionary[ "BUILDALL" ] == "yes") {
3367 sout << "Debug build................." << "yes (combined)" << endl;
3368 sout << "Default build..............." << dictionary[ "BUILD" ] << endl;
3370 sout << "Debug......................." << (dictionary[ "BUILD" ] == "debug" ? "yes" : "no") << endl;
3372 if (dictionary[ "BUILD" ] == "release" || dictionary[ "BUILDALL" ] == "yes")
3373 sout << "Force debug info............" << dictionary[ "FORCEDEBUGINFO" ] << endl;
3374 sout << "C++11 support..............." << dictionary[ "C++11" ] << endl;
3375 sout << "Link Time Code Generation..." << dictionary[ "LTCG" ] << endl;
3376 sout << "Accessibility support......." << dictionary[ "ACCESSIBILITY" ] << endl;
3377 sout << "RTTI support................" << dictionary[ "RTTI" ] << endl;
3378 sout << "SSE2 support................" << dictionary[ "SSE2" ] << endl;
3379 sout << "SSE3 support................" << dictionary[ "SSE3" ] << endl;
3380 sout << "SSSE3 support..............." << dictionary[ "SSSE3" ] << endl;
3381 sout << "SSE4.1 support.............." << dictionary[ "SSE4_1" ] << endl;
3382 sout << "SSE4.2 support.............." << dictionary[ "SSE4_2" ] << endl;
3383 sout << "AVX support................." << dictionary[ "AVX" ] << endl;
3384 sout << "AVX2 support................" << dictionary[ "AVX2" ] << endl;
3385 sout << "NEON support................" << dictionary[ "NEON" ] << endl;
3386 sout << "IWMMXT support.............." << dictionary[ "IWMMXT" ] << endl;
3387 sout << "OpenGL support.............." << dictionary[ "OPENGL" ] << endl;
3388 sout << "Large File support.........." << dictionary[ "LARGE_FILE" ] << endl;
3389 sout << "NIS support................." << dictionary[ "NIS" ] << endl;
3390 sout << "Iconv support..............." << dictionary[ "QT_ICONV" ] << endl;
3391 sout << "Inotify support............." << dictionary[ "QT_INOTIFY" ] << endl;
3392 sout << "Glib support................" << dictionary[ "QT_GLIB" ] << endl;
3393 sout << "CUPS support................" << dictionary[ "QT_CUPS" ] << endl;
3394 sout << "OpenVG support.............." << dictionary[ "OPENVG" ] << endl;
3395 sout << "OpenSSL support............." << dictionary[ "OPENSSL" ] << endl;
3396 sout << "QtDBus support.............." << dictionary[ "DBUS" ] << endl;
3397 sout << "QtWidgets module support...." << dictionary[ "WIDGETS" ] << endl;
3398 sout << "QML debugging..............." << dictionary[ "QML_DEBUG" ] << endl;
3399 sout << "DirectWrite support........." << dictionary[ "DIRECTWRITE" ] << endl;
3400 sout << "Use system proxies.........." << dictionary[ "SYSTEM_PROXIES" ] << endl << endl;
3402 sout << "Third Party Libraries:" << endl;
3403 sout << " ZLIB support............" << dictionary[ "ZLIB" ] << endl;
3404 sout << " GIF support............." << dictionary[ "GIF" ] << endl;
3405 sout << " JPEG support............" << dictionary[ "JPEG" ] << endl;
3406 sout << " PNG support............." << dictionary[ "PNG" ] << endl;
3407 sout << " FreeType support........" << dictionary[ "FREETYPE" ] << endl << endl;
3408 sout << " PCRE support............" << dictionary[ "PCRE" ] << endl;
3409 sout << " ICU support............." << dictionary[ "ICU" ] << endl;
3410 if ((platform() == QNX) || (platform() == BLACKBERRY))
3411 sout << " SLOG2 support..........." << dictionary[ "SLOG2" ] << endl;
3412 sout << " ANGLE..................." << dictionary[ "ANGLE" ] << endl;
3414 sout << "Styles:" << endl;
3415 sout << " Windows................." << dictionary[ "STYLE_WINDOWS" ] << endl;
3416 sout << " Windows XP.............." << dictionary[ "STYLE_WINDOWSXP" ] << endl;
3417 sout << " Windows Vista..........." << dictionary[ "STYLE_WINDOWSVISTA" ] << endl;
3418 sout << " Fusion.................." << dictionary[ "STYLE_FUSION" ] << endl;
3419 sout << " Windows CE.............." << dictionary[ "STYLE_WINDOWSCE" ] << endl;
3420 sout << " Windows Mobile.........." << dictionary[ "STYLE_WINDOWSMOBILE" ] << endl << endl;
3422 sout << "Sql Drivers:" << endl;
3423 sout << " ODBC...................." << dictionary[ "SQL_ODBC" ] << endl;
3424 sout << " MySQL..................." << dictionary[ "SQL_MYSQL" ] << endl;
3425 sout << " OCI....................." << dictionary[ "SQL_OCI" ] << endl;
3426 sout << " PostgreSQL.............." << dictionary[ "SQL_PSQL" ] << endl;
3427 sout << " TDS....................." << dictionary[ "SQL_TDS" ] << endl;
3428 sout << " DB2....................." << dictionary[ "SQL_DB2" ] << endl;
3429 sout << " SQLite.................." << dictionary[ "SQL_SQLITE" ] << " (" << dictionary[ "SQL_SQLITE_LIB" ] << ")" << endl;
3430 sout << " SQLite2................." << dictionary[ "SQL_SQLITE2" ] << endl;
3431 sout << " InterBase..............." << dictionary[ "SQL_IBASE" ] << endl << endl;
3433 sout << "Sources are in.............." << QDir::toNativeSeparators(dictionary["QT_SOURCE_TREE"]) << endl;
3434 sout << "Build is done in............" << QDir::toNativeSeparators(dictionary["QT_BUILD_TREE"]) << endl;
3435 sout << "Install prefix.............." << QDir::toNativeSeparators(dictionary["QT_INSTALL_PREFIX"]) << endl;
3436 sout << "Headers installed to........" << QDir::toNativeSeparators(dictionary["QT_INSTALL_HEADERS"]) << endl;
3437 sout << "Libraries installed to......" << QDir::toNativeSeparators(dictionary["QT_INSTALL_LIBS"]) << endl;
3438 sout << "Arch-dep. data to..........." << QDir::toNativeSeparators(dictionary["QT_INSTALL_ARCHDATA"]) << endl;
3439 sout << "Plugins installed to........" << QDir::toNativeSeparators(dictionary["QT_INSTALL_PLUGINS"]) << endl;
3440 sout << "Library execs installed to.." << QDir::toNativeSeparators(dictionary["QT_INSTALL_LIBEXEC"]) << endl;
3441 sout << "QML1 imports installed to..." << QDir::toNativeSeparators(dictionary["QT_INSTALL_IMPORTS"]) << endl;
3442 sout << "QML2 imports installed to..." << QDir::toNativeSeparators(dictionary["QT_INSTALL_QML"]) << endl;
3443 sout << "Binaries installed to......." << QDir::toNativeSeparators(dictionary["QT_INSTALL_BINS"]) << endl;
3444 sout << "Arch-indep. data to........." << QDir::toNativeSeparators(dictionary["QT_INSTALL_DATA"]) << endl;
3445 sout << "Docs installed to..........." << QDir::toNativeSeparators(dictionary["QT_INSTALL_DOCS"]) << endl;
3446 sout << "Translations installed to..." << QDir::toNativeSeparators(dictionary["QT_INSTALL_TRANSLATIONS"]) << endl;
3447 sout << "Examples installed to......." << QDir::toNativeSeparators(dictionary["QT_INSTALL_EXAMPLES"]) << endl;
3448 sout << "Tests installed to.........." << QDir::toNativeSeparators(dictionary["QT_INSTALL_TESTS"]) << endl;
3450 if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith(QLatin1String("wince"))) {
3451 sout << "Using c runtime detection..." << dictionary[ "CE_CRT" ] << endl;
3452 sout << "Cetest support.............." << dictionary[ "CETEST" ] << endl;
3453 sout << "Signature..................." << dictionary[ "CE_SIGNATURE"] << endl << endl;
3456 if (checkAvailability("INCREDIBUILD_XGE"))
3457 sout << "Using IncrediBuild XGE......" << dictionary["INCREDIBUILD_XGE"] << endl;
3458 if (!qmakeDefines.isEmpty()) {
3459 sout << "Defines.....................";
3460 for (QStringList::Iterator defs = qmakeDefines.begin(); defs != qmakeDefines.end(); ++defs)
3461 sout << (*defs) << " ";
3464 if (!qmakeIncludes.isEmpty()) {
3465 sout << "Include paths...............";
3466 for (QStringList::Iterator incs = qmakeIncludes.begin(); incs != qmakeIncludes.end(); ++incs)
3467 sout << (*incs) << " ";
3470 if (!qmakeLibs.isEmpty()) {
3471 sout << "Additional libraries........";
3472 for (QStringList::Iterator libs = qmakeLibs.begin(); libs != qmakeLibs.end(); ++libs)
3473 sout << (*libs) << " ";
3476 if (dictionary[ "QMAKE_INTERNAL" ] == "yes") {
3477 sout << "Using internal configuration." << endl;
3479 if (dictionary[ "SHARED" ] == "no") {
3480 sout << "WARNING: Using static linking will disable the use of plugins." << endl;
3481 sout << " Make sure you compile ALL needed modules into the library." << endl;
3483 if (dictionary[ "OPENSSL" ] == "linked") {
3484 if (!opensslLibsDebug.isEmpty() || !opensslLibsRelease.isEmpty()) {
3485 sout << "Using OpenSSL libraries:" << endl;
3486 sout << " debug : " << opensslLibsDebug << endl;
3487 sout << " release: " << opensslLibsRelease << endl;
3488 sout << " both : " << opensslLibs << endl;
3489 } else if (opensslLibs.isEmpty()) {
3490 sout << "NOTE: When linking against OpenSSL, you can override the default" << endl;
3491 sout << "library names through OPENSSL_LIBS and optionally OPENSSL_LIBS_DEBUG/OPENSSL_LIBS_RELEASE" << endl;
3492 sout << "For example:" << endl;
3493 sout << " configure -openssl-linked OPENSSL_LIBS=\"-lssleay32 -llibeay32\"" << endl;
3496 if (dictionary[ "ZLIB_FORCED" ] == "yes") {
3497 QString which_zlib = "supplied";
3498 if (dictionary[ "ZLIB" ] == "system")
3499 which_zlib = "system";
3501 sout << "NOTE: The -no-zlib option was supplied but is no longer supported." << endl
3503 << "Qt now requires zlib support in all builds, so the -no-zlib" << endl
3504 << "option was ignored. Qt will be built using the " << which_zlib
3507 if (dictionary["OBSOLETE_ARCH_ARG"] == "yes") {
3509 << "NOTE: The -arch option is obsolete." << endl
3511 << "Qt now detects the target and host architectures based on compiler" << endl
3512 << "output. Qt will be built using " << dictionary["QT_ARCH"] << " for the target architecture" << endl
3513 << "and " << dictionary["QT_HOST_ARCH"] << " for the host architecture (note that these two" << endl
3514 << "will be the same unless you are cross-compiling)." << endl
3518 // display config.summary
3519 sout.seekg(0, ios::beg);
3520 while (sout.good()) {
3523 cout << str << endl;
3529 void Configure::generateHeaders()
3531 if (dictionary["SYNCQT"] == "auto")
3532 dictionary["SYNCQT"] = defaultTo("SYNCQT");
3534 if (dictionary["SYNCQT"] == "yes") {
3535 if (!QStandardPaths::findExecutable(QStringLiteral("perl.exe")).isEmpty()) {
3536 cout << "Running syncqt..." << endl;
3538 args += buildPath + "/bin/syncqt.bat";
3539 args << "-minimal" << "-module" << "QtCore";
3541 int retc = Environment::execute(args, QStringList(), QStringList());
3543 cout << "syncqt failed, return code " << retc << endl << endl;
3544 dictionary["DONE"] = "error";
3547 cout << "Perl not found in environment - cannot run syncqt." << endl;
3548 dictionary["DONE"] = "error";
3553 static QString stripPrefix(const QString &str, const QString &pfx)
3555 return str.startsWith(pfx) ? str.mid(pfx.length()) : str;
3558 void Configure::generateQConfigCpp()
3560 // if QT_INSTALL_* have not been specified on commandline, define them now from QT_INSTALL_PREFIX
3561 // if prefix is empty (WINCE), make all of them empty, if they aren't set
3562 bool qipempty = false;
3563 if (dictionary["QT_INSTALL_PREFIX"].isEmpty())
3566 if (!dictionary["QT_INSTALL_HEADERS"].size())
3567 dictionary["QT_INSTALL_HEADERS"] = qipempty ? "" : dictionary["QT_INSTALL_PREFIX"] + "/include";
3568 if (!dictionary["QT_INSTALL_LIBS"].size())
3569 dictionary["QT_INSTALL_LIBS"] = qipempty ? "" : dictionary["QT_INSTALL_PREFIX"] + "/lib";
3570 if (!dictionary["QT_INSTALL_ARCHDATA"].size())
3571 dictionary["QT_INSTALL_ARCHDATA"] = qipempty ? "" : dictionary["QT_INSTALL_PREFIX"];
3572 if (!dictionary["QT_INSTALL_LIBEXECS"].size())
3573 dictionary["QT_INSTALL_LIBEXECS"] = qipempty ? "" : dictionary["QT_INSTALL_ARCHDATA"] + "/libexec";
3574 if (!dictionary["QT_INSTALL_BINS"].size())
3575 dictionary["QT_INSTALL_BINS"] = qipempty ? "" : dictionary["QT_INSTALL_PREFIX"] + "/bin";
3576 if (!dictionary["QT_INSTALL_PLUGINS"].size())
3577 dictionary["QT_INSTALL_PLUGINS"] = qipempty ? "" : dictionary["QT_INSTALL_ARCHDATA"] + "/plugins";
3578 if (!dictionary["QT_INSTALL_IMPORTS"].size())
3579 dictionary["QT_INSTALL_IMPORTS"] = qipempty ? "" : dictionary["QT_INSTALL_ARCHDATA"] + "/imports";
3580 if (!dictionary["QT_INSTALL_QML"].size())
3581 dictionary["QT_INSTALL_QML"] = qipempty ? "" : dictionary["QT_INSTALL_ARCHDATA"] + "/qml";
3582 if (!dictionary["QT_INSTALL_DATA"].size())
3583 dictionary["QT_INSTALL_DATA"] = qipempty ? "" : dictionary["QT_INSTALL_PREFIX"];
3584 if (!dictionary["QT_INSTALL_DOCS"].size())
3585 dictionary["QT_INSTALL_DOCS"] = qipempty ? "" : dictionary["QT_INSTALL_DATA"] + "/doc";
3586 if (!dictionary["QT_INSTALL_TRANSLATIONS"].size())
3587 dictionary["QT_INSTALL_TRANSLATIONS"] = qipempty ? "" : dictionary["QT_INSTALL_DATA"] + "/translations";
3588 if (!dictionary["QT_INSTALL_EXAMPLES"].size())
3589 dictionary["QT_INSTALL_EXAMPLES"] = qipempty ? "" : dictionary["QT_INSTALL_PREFIX"] + "/examples";
3590 if (!dictionary["QT_INSTALL_TESTS"].size())
3591 dictionary["QT_INSTALL_TESTS"] = qipempty ? "" : dictionary["QT_INSTALL_PREFIX"] + "/tests";
3593 bool haveHpx = false;
3594 if (dictionary["QT_HOST_PREFIX"].isEmpty())
3595 dictionary["QT_HOST_PREFIX"] = dictionary["QT_INSTALL_PREFIX"];
3598 if (dictionary["QT_HOST_BINS"].isEmpty())
3599 dictionary["QT_HOST_BINS"] = haveHpx ? dictionary["QT_HOST_PREFIX"] + "/bin" : dictionary["QT_INSTALL_BINS"];
3600 if (dictionary["QT_HOST_DATA"].isEmpty())
3601 dictionary["QT_HOST_DATA"] = haveHpx ? dictionary["QT_HOST_PREFIX"] : dictionary["QT_INSTALL_ARCHDATA"];
3603 // Generate the new qconfig.cpp file
3604 QDir(buildPath).mkpath("src/corelib/global");
3605 const QString outName(buildPath + "/src/corelib/global/qconfig.cpp");
3607 QString specPfx = dictionary["QT_HOST_DATA"] + "/mkspecs/";
3608 QString hostSpec = stripPrefix(dictionary["QMAKESPEC"], specPfx);
3609 QString targSpec = dictionary.contains("XQMAKESPEC") ? stripPrefix(dictionary["XQMAKESPEC"], specPfx) : hostSpec;
3611 QTemporaryFile tmpFile;
3612 if (tmpFile.open()) {
3613 QTextStream tmpStream(&tmpFile);
3614 tmpStream << "/* Licensed */" << endl
3615 << "static const char qt_configure_licensee_str [512 + 12] = \"qt_lcnsuser=" << licenseInfo["LICENSEE"] << "\";" << endl
3616 << "static const char qt_configure_licensed_products_str [512 + 12] = \"qt_lcnsprod=" << dictionary["EDITION"] << "\";" << endl
3618 << "/* Build date */" << endl
3619 << "static const char qt_configure_installation [11 + 12] = \"qt_instdate=" << QDate::currentDate().toString(Qt::ISODate) << "\";" << endl
3621 << "static const char qt_configure_prefix_path_strs[][12 + 512] = {" << endl
3622 << " \"qt_prfxpath=" << formatPath(dictionary["QT_INSTALL_PREFIX"]) << "\"," << endl
3623 << " \"qt_docspath=" << formatPath(dictionary["QT_INSTALL_DOCS"]) << "\"," << endl
3624 << " \"qt_hdrspath=" << formatPath(dictionary["QT_INSTALL_HEADERS"]) << "\"," << endl
3625 << " \"qt_libspath=" << formatPath(dictionary["QT_INSTALL_LIBS"]) << "\"," << endl
3626 << " \"qt_lbexpath=" << formatPath(dictionary["QT_INSTALL_LIBEXECS"]) << "\"," << endl
3627 << " \"qt_binspath=" << formatPath(dictionary["QT_INSTALL_BINS"]) << "\"," << endl
3628 << " \"qt_plugpath=" << formatPath(dictionary["QT_INSTALL_PLUGINS"]) << "\"," << endl
3629 << " \"qt_impspath=" << formatPath(dictionary["QT_INSTALL_IMPORTS"]) << "\"," << endl
3630 << " \"qt_qml2path=" << formatPath(dictionary["QT_INSTALL_QML"]) << "\"," << endl
3631 << " \"qt_adatpath=" << formatPath(dictionary["QT_INSTALL_ARCHDATA"]) << "\"," << endl
3632 << " \"qt_datapath=" << formatPath(dictionary["QT_INSTALL_DATA"]) << "\"," << endl
3633 << " \"qt_trnspath=" << formatPath(dictionary["QT_INSTALL_TRANSLATIONS"]) << "\"," << endl
3634 << " \"qt_xmplpath=" << formatPath(dictionary["QT_INSTALL_EXAMPLES"]) << "\"," << endl
3635 << " \"qt_tstspath=" << formatPath(dictionary["QT_INSTALL_TESTS"]) << "\"," << endl
3636 << "#ifdef QT_BUILD_QMAKE" << endl
3637 << " \"qt_ssrtpath=" << formatPath(dictionary["CFG_SYSROOT"]) << "\"," << endl
3638 << " \"qt_hpfxpath=" << formatPath(dictionary["QT_HOST_PREFIX"]) << "\"," << endl
3639 << " \"qt_hbinpath=" << formatPath(dictionary["QT_HOST_BINS"]) << "\"," << endl
3640 << " \"qt_hdatpath=" << formatPath(dictionary["QT_HOST_DATA"]) << "\"," << endl
3641 << " \"qt_targspec=" << targSpec << "\"," << endl
3642 << " \"qt_hostspec=" << hostSpec << "\"," << endl
3646 if ((platform() != WINDOWS) && (platform() != WINDOWS_CE))
3647 tmpStream << "static const char qt_configure_settings_path_str [256 + 12] = \"qt_stngpath=" << formatPath(dictionary["QT_INSTALL_SETTINGS"]) << "\";" << endl;
3650 << "/* strlen( \"qt_lcnsxxxx\") == 12 */" << endl
3651 << "#define QT_CONFIGURE_LICENSEE qt_configure_licensee_str + 12;" << endl
3652 << "#define QT_CONFIGURE_LICENSED_PRODUCTS qt_configure_licensed_products_str + 12;" << endl;
3654 if ((platform() != WINDOWS) && (platform() != WINDOWS_CE))
3655 tmpStream << "#define QT_CONFIGURE_SETTINGS_PATH qt_configure_settings_path_str + 12;" << endl;
3660 // Replace old qconfig.cpp with new one
3661 ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL);
3662 QFile::remove(outName);
3663 tmpFile.copy(outName);
3668 void Configure::buildQmake()
3670 if (dictionary[ "BUILD_QMAKE" ] == "yes") {
3674 QString pwd = QDir::currentPath();
3675 if (!QDir(buildPath).mkpath("qmake")) {
3676 cout << "Cannot create qmake build dir." << endl;
3677 dictionary[ "DONE" ] = "error";
3680 if (!QDir::setCurrent(buildPath + "/qmake")) {
3681 cout << "Cannot enter qmake build dir." << endl;
3682 dictionary[ "DONE" ] = "error";
3686 QString makefile = "Makefile";
3688 QFile out(makefile);
3689 if (out.open(QFile::WriteOnly | QFile::Text)) {
3690 QTextStream stream(&out);
3691 stream << "#AutoGenerated by configure.exe" << endl
3692 << "BUILD_PATH = " << QDir::toNativeSeparators(buildPath) << endl
3693 << "SOURCE_PATH = " << QDir::toNativeSeparators(sourcePath) << endl;
3694 stream << "QMAKESPEC = " << dictionary["QMAKESPEC"] << endl
3695 << "QT_VERSION = " << dictionary["VERSION"] << endl;
3697 if (dictionary["EDITION"] == "OpenSource" ||
3698 dictionary["QT_EDITION"].contains("OPENSOURCE"))
3699 stream << "QMAKE_OPENSOURCE_EDITION = yes" << endl;
3702 QFile in(sourcePath + "/qmake/" + dictionary["QMAKEMAKEFILE"]);
3703 if (in.open(QFile::ReadOnly | QFile::Text)) {
3704 QString d = in.readAll();
3705 //### need replaces (like configure.sh)? --Sam
3706 stream << d << endl;
3713 args += dictionary[ "MAKE" ];
3717 cout << "Creating qmake..." << endl;
3718 int exitCode = Environment::execute(args, QStringList(), QStringList());
3721 args += dictionary[ "MAKE" ];
3725 exitCode = Environment::execute(args, QStringList(), QStringList());
3727 cout << "Cleaning qmake failed, return code " << exitCode << endl << endl;
3728 dictionary[ "DONE" ] = "error";
3731 args += dictionary[ "MAKE" ];
3734 exitCode = Environment::execute(args, QStringList(), QStringList());
3736 cout << "Building qmake failed, return code " << exitCode << endl << endl;
3737 dictionary[ "DONE" ] = "error";
3741 QDir::setCurrent(pwd);
3745 QFile confFile(buildPath + "/bin/qt.conf");
3746 if (confFile.open(QFile::WriteOnly | QFile::Text)) { // Truncates any existing file.
3747 QTextStream confStream(&confFile);
3748 confStream << "[EffectivePaths]" << endl
3749 << "Prefix=.." << endl;
3758 void Configure::findProjects(const QString& dirName)
3760 if (dictionary[ "PROCESS" ] != "no") {
3764 ProjectType qmakeTemplate;
3765 const QFileInfoList &list = dir.entryInfoList(QStringList(QLatin1String("*.pro")),
3766 QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
3767 for (int i = 0; i < list.size(); ++i) {
3768 const QFileInfo &fi = list.at(i);
3769 if (fi.fileName() != "qmake.pro") {
3770 entryName = dirName + "/" + fi.fileName();
3772 findProjects(entryName);
3774 qmakeTemplate = projectType(fi.absoluteFilePath());
3775 switch (qmakeTemplate) {
3784 makeList[makeListNumber].append(new MakeItem(sourceDir.relativeFilePath(fi.absolutePath()),
3795 void Configure::appendMakeItem(int inList, const QString &item)
3800 dir.prepend("/src");
3801 makeList[inList].append(new MakeItem(sourcePath + dir,
3802 item + ".pro", buildPath + dir + "/Makefile", Lib));
3803 if (dictionary[ "VCPROJFILES" ] == "yes") {
3804 makeList[inList].append(new MakeItem(sourcePath + dir,
3805 item + ".pro", buildPath + dir + "/" + item + ".vcproj", Lib));
3809 void Configure::generateMakefiles()
3811 if (dictionary[ "PROCESS" ] != "no") {
3812 QString spec = dictionary.contains("XQMAKESPEC") ? dictionary[ "XQMAKESPEC" ] : dictionary[ "QMAKESPEC" ];
3813 if (spec != "win32-msvc.net" && !spec.startsWith("win32-msvc2") && !spec.startsWith(QLatin1String("wince")))
3814 dictionary[ "VCPROJFILES" ] = "no";
3817 QString pwd = QDir::currentPath();
3818 if (dictionary["FAST"] != "yes") {
3820 bool generate = true;
3821 bool doDsp = (dictionary["VCPROJFILES"] == "yes");
3823 QString pwd = QDir::currentPath();
3824 QString dirPath = buildPath + dirName;
3827 args << buildPath + "/bin/qmake";
3830 if (dictionary[ "DEPENDENCIES" ] == "no")
3831 args << "-nodepend";
3832 args << "-tp" << "vc";
3833 doDsp = false; // DSP files will be done
3834 printf("Generating Visual Studio project files...\n");
3836 printf("Generating Makefiles...\n");
3837 generate = false; // Now Makefiles will be done
3839 if (dictionary[ "PROCESS" ] == "full")
3841 args << (sourcePath + "/qtbase.pro");
3845 QDir::setCurrent(dirPath);
3846 if (int exitCode = Environment::execute(args, QStringList(), QStringList())) {
3847 cout << "Qmake failed, return code " << exitCode << endl << endl;
3848 dictionary[ "DONE" ] = "error";
3852 findProjects(sourcePath);
3853 for (i=0; i<3; i++) {
3854 for (int j=0; j<makeList[i].size(); ++j) {
3855 MakeItem *it=makeList[i][j];
3856 if (it->directory == "tools/configure")
3857 continue; // don't overwrite our own Makefile
3859 QString dirPath = it->directory + '/';
3860 QString projectName = it->proFile;
3861 QString makefileName = buildPath + "/" + dirPath + it->target;
3863 // For shadowbuilds, we need to create the path first
3864 QDir buildPathDir(buildPath);
3865 if (sourcePath != buildPath && !buildPathDir.exists(dirPath))
3866 buildPathDir.mkpath(dirPath);
3870 args << QDir::toNativeSeparators(buildPath + "/bin/qmake.exe");
3871 args << sourcePath + "/" + dirPath + projectName;
3873 cout << "For " << qPrintable(QDir::toNativeSeparators(dirPath + projectName)) << endl;
3877 QDir::setCurrent(dirPath);
3879 QFile file(makefileName);
3880 if (!file.open(QFile::WriteOnly | QFile::Text)) {
3881 printf("failed on dirPath=%s, makefile=%s\n",
3882 qPrintable(QDir::toNativeSeparators(dirPath)),
3883 qPrintable(QDir::toNativeSeparators(makefileName)));
3886 QTextStream txt(&file);
3888 txt << "\t" << args.join(' ') << "\n";
3889 txt << "\t$(MAKE) -$(MAKEFLAGS) -f " << it->target << "\n";
3890 txt << "first: all\n";
3891 txt << "qmake: FORCE\n";
3892 txt << "\t" << args.join(' ') << "\n";
3897 QDir::setCurrent(pwd);
3899 cout << "Processing of project files have been disabled." << endl;
3900 cout << "Only use this option if you really know what you're doing." << endl << endl;
3905 void Configure::showSummary()
3907 QString make = dictionary[ "MAKE" ];
3908 cout << endl << endl << "Qt is now configured for building. Just run " << qPrintable(make) << "." << endl;
3909 cout << "To reconfigure, run " << qPrintable(make) << " confclean and configure." << endl << endl;
3912 Configure::ProjectType Configure::projectType(const QString& proFileName)
3914 QFile proFile(proFileName);
3915 if (proFile.open(QFile::ReadOnly)) {
3916 QString buffer = proFile.readLine(1024);
3917 while (!buffer.isEmpty()) {
3918 QStringList segments = buffer.split(QRegExp("\\s"));
3919 QStringList::Iterator it = segments.begin();
3921 if (segments.size() >= 3) {
3922 QString keyword = (*it++);
3923 QString operation = (*it++);
3924 QString value = (*it++);
3926 if (keyword == "TEMPLATE") {
3929 else if (value == "subdirs")
3934 buffer = proFile.readLine(1024);
3938 // Default to app handling
3944 bool Configure::showLicense(QString orgLicenseFile)
3946 if (dictionary["LICENSE_CONFIRMED"] == "yes") {
3947 cout << "You have already accepted the terms of the license." << endl << endl;
3951 bool haveGpl3 = false;
3952 QString licenseFile = orgLicenseFile;
3954 if (dictionary["EDITION"] == "OpenSource" || dictionary["EDITION"] == "Snapshot") {
3955 haveGpl3 = QFile::exists(orgLicenseFile + "/LICENSE.GPL3");
3956 theLicense = "GNU Lesser General Public License (LGPL) version 2.1";
3958 theLicense += "\nor the GNU General Public License (GPL) version 3";
3960 // the first line of the license file tells us which license it is
3961 QFile file(licenseFile);
3962 if (!file.open(QFile::ReadOnly)) {
3963 cout << "Failed to load LICENSE file" << endl;
3966 theLicense = file.readLine().trimmed();
3971 cout << "You are licensed to use this software under the terms of" << endl
3972 << "the " << theLicense << "." << endl
3974 if (dictionary["EDITION"] == "OpenSource" || dictionary["EDITION"] == "Snapshot") {
3976 cout << "Type '3' to view the GNU General Public License version 3 (GPLv3)." << endl;
3977 cout << "Type 'L' to view the Lesser GNU General Public License version 2.1 (LGPLv2.1)." << endl;
3979 cout << "Type '?' to view the " << theLicense << "." << endl;
3981 cout << "Type 'y' to accept this license offer." << endl
3982 << "Type 'n' to decline this license offer." << endl
3984 << "Do you accept the terms of the license?" << endl;
3986 accept = tolower(accept);
3988 if (accept == 'y') {
3990 } else if (accept == 'n') {
3993 if (dictionary["EDITION"] == "OpenSource" || dictionary["EDITION"] == "Snapshot") {
3995 licenseFile = orgLicenseFile + "/LICENSE.GPL3";
3997 licenseFile = orgLicenseFile + "/LICENSE.LGPL";
3999 // Get console line height, to fill the screen properly
4000 int i = 0, screenHeight = 25; // default
4001 CONSOLE_SCREEN_BUFFER_INFO consoleInfo;
4002 HANDLE stdOut = GetStdHandle(STD_OUTPUT_HANDLE);
4003 if (GetConsoleScreenBufferInfo(stdOut, &consoleInfo))
4004 screenHeight = consoleInfo.srWindow.Bottom
4005 - consoleInfo.srWindow.Top
4006 - 1; // Some overlap for context
4008 // Prompt the license content to the user
4009 QFile file(licenseFile);
4010 if (!file.open(QFile::ReadOnly)) {
4011 cout << "Failed to load LICENSE file" << licenseFile << endl;
4014 QStringList licenseContent = QString(file.readAll()).split('\n');
4015 while (i < licenseContent.size()) {
4016 cout << licenseContent.at(i) << endl;
4017 if (++i % screenHeight == 0) {
4019 cout << "\r"; // Overwrite text above
4026 void Configure::readLicense()
4028 dictionary["PLATFORM NAME"] = platformName();
4029 dictionary["LICENSE FILE"] = sourcePath;
4031 bool openSource = false;
4032 bool hasOpenSource = QFile::exists(dictionary["LICENSE FILE"] + "/LICENSE.GPL3") || QFile::exists(dictionary["LICENSE FILE"] + "/LICENSE.LGPL");
4033 if (dictionary["BUILDTYPE"] == "commercial") {
4035 } else if (dictionary["BUILDTYPE"] == "opensource") {
4037 } else if (hasOpenSource) { // No Open Source? Just display the commercial license right away
4040 cout << "Which edition of Qt do you want to use ?" << endl;
4041 cout << "Type 'c' if you want to use the Commercial Edition." << endl;
4042 cout << "Type 'o' if you want to use the Open Source Edition." << endl;
4044 accept = tolower(accept);
4046 if (accept == 'c') {
4049 } else if (accept == 'o') {
4055 if (hasOpenSource && openSource) {
4056 cout << endl << "This is the " << dictionary["PLATFORM NAME"] << " Open Source Edition." << endl;
4057 licenseInfo["LICENSEE"] = "Open Source";
4058 dictionary["EDITION"] = "OpenSource";
4059 dictionary["QT_EDITION"] = "QT_EDITION_OPENSOURCE";
4061 if (!showLicense(dictionary["LICENSE FILE"])) {
4062 cout << "Configuration aborted since license was not accepted";
4063 dictionary["DONE"] = "error";
4066 } else if (openSource) {
4067 cout << endl << "Cannot find the GPL license files! Please download the Open Source version of the library." << endl;
4068 dictionary["DONE"] = "error";
4070 #ifdef COMMERCIAL_VERSION
4072 Tools::checkLicense(dictionary, licenseInfo, firstLicensePath());
4073 if (dictionary["DONE"] != "error") {
4074 // give the user some feedback, and prompt for license acceptance
4075 cout << endl << "This is the " << dictionary["PLATFORM NAME"] << " " << dictionary["EDITION"] << " Edition."<< endl << endl;
4076 if (!showLicense(dictionary["LICENSE FILE"])) {
4077 cout << "Configuration aborted since license was not accepted";
4078 dictionary["DONE"] = "error";
4083 #else // !COMMERCIAL_VERSION
4085 cout << endl << "Cannot build commercial edition from the open source version of the library." << endl;
4086 dictionary["DONE"] = "error";
4091 void Configure::reloadCmdLine()
4093 if (dictionary[ "REDO" ] == "yes") {
4094 QFile inFile(buildPath + "/configure" + dictionary[ "CUSTOMCONFIG" ] + ".cache");
4095 if (inFile.open(QFile::ReadOnly)) {
4096 QTextStream inStream(&inFile);
4099 while (buffer.length()) {
4100 configCmdLine += buffer;
4108 void Configure::saveCmdLine()
4110 if (dictionary[ "REDO" ] != "yes") {
4111 QFile outFile(buildPath + "/configure" + dictionary[ "CUSTOMCONFIG" ] + ".cache");
4112 if (outFile.open(QFile::WriteOnly | QFile::Text)) {
4113 QTextStream outStream(&outFile);
4114 for (QStringList::Iterator it = configCmdLine.begin(); it != configCmdLine.end(); ++it) {
4115 outStream << (*it) << " " << endl;
4124 bool Configure::isDone()
4126 return !dictionary["DONE"].isEmpty();
4129 bool Configure::isOk()
4131 return (dictionary[ "DONE" ] != "error");
4134 QString Configure::platformName() const
4136 switch (platform()) {
4139 return QStringLiteral("Qt for Windows");
4141 return QStringLiteral("Qt for Windows CE");
4143 return QStringLiteral("Qt for QNX");
4145 return QStringLiteral("Qt for Blackberry");
4149 QString Configure::qpaPlatformName() const
4151 switch (platform()) {
4155 return QStringLiteral("windows");
4157 return QStringLiteral("qnx");
4159 return QStringLiteral("blackberry");
4163 int Configure::platform() const
4165 const QString qMakeSpec = dictionary.value("QMAKESPEC");
4166 const QString xQMakeSpec = dictionary.value("XQMAKESPEC");
4168 if ((qMakeSpec.startsWith("wince") || xQMakeSpec.startsWith("wince")))
4171 if (xQMakeSpec.contains("qnx"))
4174 if (xQMakeSpec.contains("blackberry"))
4181 Configure::filesDiffer(const QString &fn1, const QString &fn2)
4183 QFile file1(fn1), file2(fn2);
4184 if (!file1.open(QFile::ReadOnly) || !file2.open(QFile::ReadOnly))
4186 const int chunk = 2048;
4187 int used1 = 0, used2 = 0;
4188 char b1[chunk], b2[chunk];
4189 while (!file1.atEnd() && !file2.atEnd()) {
4191 used1 = file1.read(b1, chunk);
4193 used2 = file2.read(b2, chunk);
4194 if (used1 > 0 && used2 > 0) {
4195 const int cmp = qMin(used1, used2);
4196 if (memcmp(b1, b2, cmp))
4199 memcpy(b1, b1+cmp, used1);
4201 memcpy(b2, b2+cmp, used2);
4204 return !file1.atEnd() || !file2.atEnd();