1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
6 ** This file is part of the tools applications of the Qt Toolkit.
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser General Public
11 ** License version 2.1 as published by the Free Software Foundation and
12 ** appearing in the file LICENSE.LGPL included in the packaging of this
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General Public License version 2.1 requirements will be met:
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 ** In addition, as a special exception, Nokia gives you certain additional
18 ** rights. These rights are described in the Nokia Qt LGPL Exception
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
21 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
42 #include "configureapp.h"
43 #include "environment.h"
44 #ifdef COMMERCIAL_VERSION
50 #include <qtemporaryfile.h>
53 #include <qfileinfo.h>
54 #include <qtextstream.h>
64 std::ostream &operator<<(std::ostream &s, const QString &val) {
65 s << val.toLocal8Bit().data();
72 // Macros to simplify options marking
73 #define MARK_OPTION(x,y) ( dictionary[ #x ] == #y ? "*" : " " )
76 bool writeToFile(const char* text, const QString &filename)
78 QByteArray symFile(text);
80 QDir dir(QFileInfo(file).absoluteDir());
82 dir.mkpath(dir.absolutePath());
83 if (!file.open(QFile::WriteOnly)) {
84 cout << "Couldn't write to " << qPrintable(filename) << ": " << qPrintable(file.errorString())
92 Configure::Configure(int& argc, char** argv)
94 useUnixSeparators = false;
95 // Default values for indentation
99 // Get console buffer output width
100 CONSOLE_SCREEN_BUFFER_INFO info;
101 HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
102 if (GetConsoleScreenBufferInfo(hStdout, &info))
103 outputWidth = info.dwSize.X - 1;
104 outputWidth = qMin(outputWidth, 79); // Anything wider gets unreadable
105 if (outputWidth < 35) // Insanely small, just use 79
110 ** Set up the initial state, the default
112 dictionary[ "CONFIGCMD" ] = argv[ 0 ];
114 for (i = 1; i < argc; i++)
115 configCmdLine += argv[ i ];
117 if (configCmdLine.size() >= 2 && configCmdLine.at(0) == "-srcdir") {
118 sourcePath = QDir::cleanPath(configCmdLine.at(1));
119 sourceDir = QDir(sourcePath);
120 configCmdLine.erase(configCmdLine.begin(), configCmdLine.begin() + 2);
122 // Get the path to the executable
123 wchar_t module_name[MAX_PATH];
124 GetModuleFileName(0, module_name, sizeof(module_name) / sizeof(wchar_t));
125 QFileInfo sourcePathInfo = QString::fromWCharArray(module_name);
126 sourcePath = sourcePathInfo.absolutePath();
127 sourceDir = sourcePathInfo.dir();
129 buildPath = QDir::currentPath();
131 const QString installPath = QString("C:\\Qt\\%1").arg(QT_VERSION_STR);
133 const QString installPath = buildPath;
135 if (sourceDir != buildDir) { //shadow builds!
136 if (!findFile("perl") && !findFile("perl.exe")) {
137 cout << "Error: Creating a shadow build of Qt requires" << endl
138 << "perl to be in the PATH environment";
139 exit(0); // Exit cleanly for Ctrl+C
142 cout << "Preparing build tree..." << endl;
143 QDir(buildPath).mkpath("bin");
145 { //make a syncqt script(s) that can be used in the shadow
146 QFile syncqt(buildPath + "/bin/syncqt");
147 if (syncqt.open(QFile::WriteOnly)) {
148 QTextStream stream(&syncqt);
149 stream << "#!/usr/bin/perl -w" << endl
150 << "require \"" << sourcePath + "/bin/syncqt\";" << endl;
152 QFile syncqt_bat(buildPath + "/bin/syncqt.bat");
153 if (syncqt_bat.open(QFile::WriteOnly)) {
154 QTextStream stream(&syncqt_bat);
155 stream << "@echo off" << endl
156 << "call " << fixSeparators(sourcePath) << fixSeparators("/bin/syncqt.bat -qtdir \"") << fixSeparators(buildPath) << "\" %*" << endl;
161 QFile configtests(buildPath + "/bin/qtmodule-configtests");
162 if (configtests.open(QFile::WriteOnly)) {
163 QTextStream stream(&configtests);
164 stream << "#!/usr/bin/perl -w" << endl
165 << "require \"" << sourcePath + "/bin/qtmodule-configtests\";" << endl;
167 // For Windows CE and shadow builds we need to copy these to the
169 QFile::copy(sourcePath + "/bin/setcepaths.bat" , buildPath + "/bin/setcepaths.bat");
171 buildDir.mkpath("mkspecs");
172 if (!Environment::cpdir(sourcePath + "/mkspecs", buildPath + "/mkspecs")){
173 cout << "Couldn't copy mkspecs!" << sourcePath << " " << buildPath << endl;
174 dictionary["DONE"] = "error";
179 defaultBuildParts << QStringLiteral("libs") << QStringLiteral("examples");
180 dictionary[ "QT_SOURCE_TREE" ] = fixSeparators(sourcePath);
181 dictionary[ "QT_BUILD_TREE" ] = fixSeparators(buildPath);
182 dictionary[ "QT_INSTALL_PREFIX" ] = fixSeparators(installPath);
184 dictionary[ "QMAKESPEC" ] = getenv("QMAKESPEC");
185 if (dictionary[ "QMAKESPEC" ].size() == 0) {
186 dictionary[ "QMAKESPEC" ] = Environment::detectQMakeSpec();
187 dictionary[ "QMAKESPEC_FROM" ] = "detected";
189 dictionary[ "QMAKESPEC_FROM" ] = "env";
192 dictionary[ "QCONFIG" ] = "full";
193 dictionary[ "EMBEDDED" ] = "no";
194 dictionary[ "BUILD_QMAKE" ] = "yes";
195 dictionary[ "DSPFILES" ] = "yes";
196 dictionary[ "VCPROJFILES" ] = "yes";
197 dictionary[ "QMAKE_INTERNAL" ] = "no";
198 dictionary[ "FAST" ] = "no";
199 dictionary[ "NOPROCESS" ] = "no";
200 dictionary[ "STL" ] = "yes";
201 dictionary[ "EXCEPTIONS" ] = "yes";
202 dictionary[ "WIDGETS" ] = "yes";
203 dictionary[ "RTTI" ] = "yes";
204 dictionary[ "MMX" ] = "auto";
205 dictionary[ "3DNOW" ] = "auto";
206 dictionary[ "SSE" ] = "auto";
207 dictionary[ "SSE2" ] = "auto";
208 dictionary[ "IWMMXT" ] = "auto";
209 dictionary[ "SYNCQT" ] = "auto";
210 dictionary[ "CE_CRT" ] = "no";
211 dictionary[ "CETEST" ] = "auto";
212 dictionary[ "CE_SIGNATURE" ] = "no";
213 dictionary[ "PHONON_BACKEND" ] = "yes";
214 dictionary[ "AUDIO_BACKEND" ] = "auto";
215 dictionary[ "WMSDK" ] = "auto";
216 dictionary[ "DIRECTSHOW" ] = "no";
217 dictionary[ "V8SNAPSHOT" ] = "auto";
218 dictionary[ "QML_DEBUG" ] = "yes";
219 dictionary[ "PLUGIN_MANIFESTS" ] = "yes";
220 dictionary[ "DIRECTWRITE" ] = "no";
223 QFile qglobal_h(sourcePath + "/src/corelib/global/qglobal.h");
224 if (qglobal_h.open(QFile::ReadOnly)) {
225 QTextStream read(&qglobal_h);
226 QRegExp version_regexp("^# *define *QT_VERSION_STR *\"([^\"]*)\"");
228 while (!read.atEnd()) {
229 line = read.readLine();
230 if (version_regexp.exactMatch(line)) {
231 version = version_regexp.cap(1).trimmed();
232 if (!version.isEmpty())
239 if (version.isEmpty())
240 version = QString("%1.%2.%3").arg(QT_VERSION>>16).arg(((QT_VERSION>>8)&0xff)).arg(QT_VERSION&0xff);
242 dictionary[ "VERSION" ] = version;
244 QRegExp version_re("([0-9]*)\\.([0-9]*)\\.([0-9]*)(|-.*)");
245 if (version_re.exactMatch(version)) {
246 dictionary[ "VERSION_MAJOR" ] = version_re.cap(1);
247 dictionary[ "VERSION_MINOR" ] = version_re.cap(2);
248 dictionary[ "VERSION_PATCH" ] = version_re.cap(3);
252 dictionary[ "REDO" ] = "no";
253 dictionary[ "DEPENDENCIES" ] = "no";
255 dictionary[ "BUILD" ] = "debug";
256 dictionary[ "BUILDALL" ] = "auto"; // Means yes, but not explicitly
258 dictionary[ "BUILDTYPE" ] = "none";
260 dictionary[ "BUILDDEV" ] = "no";
262 dictionary[ "SHARED" ] = "yes";
264 dictionary[ "ZLIB" ] = "auto";
266 dictionary[ "PCRE" ] = "auto";
268 dictionary[ "ICU" ] = "auto";
270 dictionary[ "GIF" ] = "auto";
271 dictionary[ "JPEG" ] = "auto";
272 dictionary[ "PNG" ] = "auto";
273 dictionary[ "LIBJPEG" ] = "auto";
274 dictionary[ "LIBPNG" ] = "auto";
275 dictionary[ "FREETYPE" ] = "yes";
277 dictionary[ "ACCESSIBILITY" ] = "yes";
278 dictionary[ "OPENGL" ] = "yes";
279 dictionary[ "OPENVG" ] = "no";
280 dictionary[ "OPENSSL" ] = "auto";
281 dictionary[ "DBUS" ] = "auto";
283 dictionary[ "STYLE_WINDOWS" ] = "yes";
284 dictionary[ "STYLE_WINDOWSXP" ] = "auto";
285 dictionary[ "STYLE_WINDOWSVISTA" ] = "auto";
286 dictionary[ "STYLE_PLASTIQUE" ] = "yes";
287 dictionary[ "STYLE_CLEANLOOKS" ]= "yes";
288 dictionary[ "STYLE_WINDOWSCE" ] = "no";
289 dictionary[ "STYLE_WINDOWSMOBILE" ] = "no";
290 dictionary[ "STYLE_MOTIF" ] = "yes";
291 dictionary[ "STYLE_CDE" ] = "yes";
292 dictionary[ "STYLE_GTK" ] = "no";
294 dictionary[ "SQL_MYSQL" ] = "no";
295 dictionary[ "SQL_ODBC" ] = "no";
296 dictionary[ "SQL_OCI" ] = "no";
297 dictionary[ "SQL_PSQL" ] = "no";
298 dictionary[ "SQL_TDS" ] = "no";
299 dictionary[ "SQL_DB2" ] = "no";
300 dictionary[ "SQL_SQLITE" ] = "auto";
301 dictionary[ "SQL_SQLITE_LIB" ] = "qt";
302 dictionary[ "SQL_SQLITE2" ] = "no";
303 dictionary[ "SQL_IBASE" ] = "no";
305 QString tmp = dictionary[ "QMAKESPEC" ];
306 if (tmp.contains("\\")) {
307 tmp = tmp.mid(tmp.lastIndexOf("\\") + 1);
309 tmp = tmp.mid(tmp.lastIndexOf("/") + 1);
311 dictionary[ "QMAKESPEC" ] = tmp;
313 dictionary[ "INCREDIBUILD_XGE" ] = "auto";
314 dictionary[ "LTCG" ] = "no";
315 dictionary[ "NATIVE_GESTURES" ] = "yes";
316 dictionary[ "MSVC_MP" ] = "no";
319 Configure::~Configure()
321 for (int i=0; i<3; ++i) {
322 QList<MakeItem*> items = makeList[i];
323 for (int j=0; j<items.size(); ++j)
328 QString Configure::fixSeparators(const QString &somePath, bool escape)
330 if (useUnixSeparators)
331 return QDir::fromNativeSeparators(somePath);
332 QString ret = QDir::toNativeSeparators(somePath);
333 return escape ? escapeSeparators(ret) : ret;
336 QString Configure::escapeSeparators(const QString &somePath)
338 QString out = somePath;
339 out.replace(QLatin1Char('\\'), QLatin1String("\\\\"));
343 // We could use QDir::homePath() + "/.qt-license", but
344 // that will only look in the first of $HOME,$USERPROFILE
345 // or $HOMEDRIVE$HOMEPATH. So, here we try'em all to be
346 // more forgiving for the end user..
347 QString Configure::firstLicensePath()
349 QStringList allPaths;
350 allPaths << "./.qt-license"
351 << QString::fromLocal8Bit(getenv("HOME")) + "/.qt-license"
352 << QString::fromLocal8Bit(getenv("USERPROFILE")) + "/.qt-license"
353 << QString::fromLocal8Bit(getenv("HOMEDRIVE")) + QString::fromLocal8Bit(getenv("HOMEPATH")) + "/.qt-license";
354 for (int i = 0; i< allPaths.count(); ++i)
355 if (QFile::exists(allPaths.at(i)))
356 return allPaths.at(i);
361 // #### somehow I get a compiler error about vc++ reaching the nesting limit without
362 // undefining the ansi for scoping.
367 void Configure::parseCmdLine()
369 int argCount = configCmdLine.size();
371 const QStringList imageFormats = QStringList() << "gif" << "png" << "jpeg";
374 if (argCount < 1) // skip rest if no arguments
376 else if (configCmdLine.at(i) == "-redo") {
377 dictionary[ "REDO" ] = "yes";
378 configCmdLine.clear();
381 else if (configCmdLine.at(i) == "-loadconfig") {
384 dictionary[ "REDO" ] = "yes";
385 dictionary[ "CUSTOMCONFIG" ] = "_" + configCmdLine.at(i);
386 configCmdLine.clear();
389 dictionary[ "HELP" ] = "yes";
393 argCount = configCmdLine.size();
396 // Look first for XQMAKESPEC
397 for (int j = 0 ; j < argCount; ++j)
399 if (configCmdLine.at(j) == "-xplatform") {
403 dictionary["XQMAKESPEC"] = configCmdLine.at(j);
404 if (!dictionary[ "XQMAKESPEC" ].isEmpty())
405 applySpecSpecifics();
409 for (; i<configCmdLine.size(); ++i) {
410 bool continueElse[] = {false, false};
411 if (configCmdLine.at(i) == "-help"
412 || configCmdLine.at(i) == "-h"
413 || configCmdLine.at(i) == "-?")
414 dictionary[ "HELP" ] = "yes";
417 else if (configCmdLine.at(i) == "-qconfig") {
421 dictionary[ "QCONFIG" ] = configCmdLine.at(i);
424 else if (configCmdLine.at(i) == "-release") {
425 dictionary[ "BUILD" ] = "release";
426 if (dictionary[ "BUILDALL" ] == "auto")
427 dictionary[ "BUILDALL" ] = "no";
428 } else if (configCmdLine.at(i) == "-debug") {
429 dictionary[ "BUILD" ] = "debug";
430 if (dictionary[ "BUILDALL" ] == "auto")
431 dictionary[ "BUILDALL" ] = "no";
432 } else if (configCmdLine.at(i) == "-debug-and-release")
433 dictionary[ "BUILDALL" ] = "yes";
435 else if (configCmdLine.at(i) == "-shared")
436 dictionary[ "SHARED" ] = "yes";
437 else if (configCmdLine.at(i) == "-static")
438 dictionary[ "SHARED" ] = "no";
439 else if (configCmdLine.at(i) == "-developer-build")
440 dictionary[ "BUILDDEV" ] = "yes";
441 else if (configCmdLine.at(i) == "-opensource") {
442 dictionary[ "BUILDTYPE" ] = "opensource";
444 else if (configCmdLine.at(i) == "-commercial") {
445 dictionary[ "BUILDTYPE" ] = "commercial";
447 else if (configCmdLine.at(i) == "-ltcg") {
448 dictionary[ "LTCG" ] = "yes";
450 else if (configCmdLine.at(i) == "-no-ltcg") {
451 dictionary[ "LTCG" ] = "no";
453 else if (configCmdLine.at(i) == "-mp") {
454 dictionary[ "MSVC_MP" ] = "yes";
456 else if (configCmdLine.at(i) == "-no-mp") {
457 dictionary[ "MSVC_MP" ] = "no";
459 else if (configCmdLine.at(i) == "-force-asserts") {
460 dictionary[ "FORCE_ASSERTS" ] = "yes";
466 else if (configCmdLine.at(i) == "-platform") {
470 dictionary[ "QMAKESPEC" ] = configCmdLine.at(i);
471 dictionary[ "QMAKESPEC_FROM" ] = "commandline";
472 } else if (configCmdLine.at(i) == "-arch") {
476 dictionary["OBSOLETE_ARCH_ARG"] = "yes";
477 } else if (configCmdLine.at(i) == "-embedded") {
478 dictionary[ "EMBEDDED" ] = "yes";
479 } else if (configCmdLine.at(i) == "-xplatform") {
486 else if (configCmdLine.at(i) == "-no-zlib") {
487 // No longer supported since Qt 4.4.0
488 // But save the information for later so that we can print a warning
490 // If you REALLY really need no zlib support, you can still disable
491 // it by doing the following:
492 // add "no-zlib" to mkspecs/qconfig.pri
493 // #define QT_NO_COMPRESS (probably by adding to src/corelib/global/qconfig.h)
495 // There's no guarantee that Qt will build under those conditions
497 dictionary[ "ZLIB_FORCED" ] = "yes";
498 } else if (configCmdLine.at(i) == "-qt-zlib") {
499 dictionary[ "ZLIB" ] = "qt";
500 } else if (configCmdLine.at(i) == "-system-zlib") {
501 dictionary[ "ZLIB" ] = "system";
504 else if (configCmdLine.at(i) == "-qt-pcre") {
505 dictionary[ "PCRE" ] = "qt";
506 } else if (configCmdLine.at(i) == "-system-pcre") {
507 dictionary[ "PCRE" ] = "system";
510 else if (configCmdLine.at(i) == "-icu") {
511 dictionary[ "ICU" ] = "yes";
512 } else if (configCmdLine.at(i) == "-no-icu") {
513 dictionary[ "ICU" ] = "no";
516 // Image formats --------------------------------------------
517 else if (configCmdLine.at(i) == "-no-gif")
518 dictionary[ "GIF" ] = "no";
520 else if (configCmdLine.at(i) == "-no-libjpeg") {
521 dictionary[ "JPEG" ] = "no";
522 dictionary[ "LIBJPEG" ] = "no";
523 } else if (configCmdLine.at(i) == "-qt-libjpeg") {
524 dictionary[ "LIBJPEG" ] = "qt";
525 } else if (configCmdLine.at(i) == "-system-libjpeg") {
526 dictionary[ "LIBJPEG" ] = "system";
529 else if (configCmdLine.at(i) == "-no-libpng") {
530 dictionary[ "PNG" ] = "no";
531 dictionary[ "LIBPNG" ] = "no";
532 } else if (configCmdLine.at(i) == "-qt-libpng") {
533 dictionary[ "LIBPNG" ] = "qt";
534 } else if (configCmdLine.at(i) == "-system-libpng") {
535 dictionary[ "LIBPNG" ] = "system";
538 // Text Rendering --------------------------------------------
539 else if (configCmdLine.at(i) == "-no-freetype")
540 dictionary[ "FREETYPE" ] = "no";
541 else if (configCmdLine.at(i) == "-qt-freetype")
542 dictionary[ "FREETYPE" ] = "yes";
544 // CE- C runtime --------------------------------------------
545 else if (configCmdLine.at(i) == "-crt") {
549 QDir cDir(configCmdLine.at(i));
551 cout << "WARNING: Could not find directory (" << qPrintable(configCmdLine.at(i)) << ")for C runtime deployment" << endl;
553 dictionary[ "CE_CRT" ] = QDir::toNativeSeparators(cDir.absolutePath());
554 } else if (configCmdLine.at(i) == "-qt-crt") {
555 dictionary[ "CE_CRT" ] = "yes";
556 } else if (configCmdLine.at(i) == "-no-crt") {
557 dictionary[ "CE_CRT" ] = "no";
559 // cetest ---------------------------------------------------
560 else if (configCmdLine.at(i) == "-no-cetest") {
561 dictionary[ "CETEST" ] = "no";
562 dictionary[ "CETEST_REQUESTED" ] = "no";
563 } else if (configCmdLine.at(i) == "-cetest") {
564 // although specified to use it, we stay at "auto" state
565 // this is because checkAvailability() adds variables
566 // we need for crosscompilation; but remember if we asked
568 dictionary[ "CETEST_REQUESTED" ] = "yes";
570 // Qt/CE - signing tool -------------------------------------
571 else if (configCmdLine.at(i) == "-signature") {
575 QFileInfo info(configCmdLine.at(i));
577 cout << "WARNING: Could not find signature file (" << qPrintable(configCmdLine.at(i)) << ")" << endl;
579 dictionary[ "CE_SIGNATURE" ] = QDir::toNativeSeparators(info.absoluteFilePath());
581 // Styles ---------------------------------------------------
582 else if (configCmdLine.at(i) == "-qt-style-windows")
583 dictionary[ "STYLE_WINDOWS" ] = "yes";
584 else if (configCmdLine.at(i) == "-no-style-windows")
585 dictionary[ "STYLE_WINDOWS" ] = "no";
587 else if (configCmdLine.at(i) == "-qt-style-windowsce")
588 dictionary[ "STYLE_WINDOWSCE" ] = "yes";
589 else if (configCmdLine.at(i) == "-no-style-windowsce")
590 dictionary[ "STYLE_WINDOWSCE" ] = "no";
591 else if (configCmdLine.at(i) == "-qt-style-windowsmobile")
592 dictionary[ "STYLE_WINDOWSMOBILE" ] = "yes";
593 else if (configCmdLine.at(i) == "-no-style-windowsmobile")
594 dictionary[ "STYLE_WINDOWSMOBILE" ] = "no";
596 else if (configCmdLine.at(i) == "-qt-style-windowsxp")
597 dictionary[ "STYLE_WINDOWSXP" ] = "yes";
598 else if (configCmdLine.at(i) == "-no-style-windowsxp")
599 dictionary[ "STYLE_WINDOWSXP" ] = "no";
601 else if (configCmdLine.at(i) == "-qt-style-windowsvista")
602 dictionary[ "STYLE_WINDOWSVISTA" ] = "yes";
603 else if (configCmdLine.at(i) == "-no-style-windowsvista")
604 dictionary[ "STYLE_WINDOWSVISTA" ] = "no";
606 else if (configCmdLine.at(i) == "-qt-style-plastique")
607 dictionary[ "STYLE_PLASTIQUE" ] = "yes";
608 else if (configCmdLine.at(i) == "-no-style-plastique")
609 dictionary[ "STYLE_PLASTIQUE" ] = "no";
611 else if (configCmdLine.at(i) == "-qt-style-cleanlooks")
612 dictionary[ "STYLE_CLEANLOOKS" ] = "yes";
613 else if (configCmdLine.at(i) == "-no-style-cleanlooks")
614 dictionary[ "STYLE_CLEANLOOKS" ] = "no";
616 else if (configCmdLine.at(i) == "-qt-style-motif")
617 dictionary[ "STYLE_MOTIF" ] = "yes";
618 else if (configCmdLine.at(i) == "-no-style-motif")
619 dictionary[ "STYLE_MOTIF" ] = "no";
621 else if (configCmdLine.at(i) == "-qt-style-cde")
622 dictionary[ "STYLE_CDE" ] = "yes";
623 else if (configCmdLine.at(i) == "-no-style-cde")
624 dictionary[ "STYLE_CDE" ] = "no";
626 // Work around compiler nesting limitation
628 continueElse[1] = true;
629 if (!continueElse[1]) {
632 // OpenGL Support -------------------------------------------
633 else if (configCmdLine.at(i) == "-no-opengl") {
634 dictionary[ "OPENGL" ] = "no";
635 } else if (configCmdLine.at(i) == "-opengl-es-cm") {
636 dictionary[ "OPENGL" ] = "yes";
637 dictionary[ "OPENGL_ES_CM" ] = "yes";
638 } else if (configCmdLine.at(i) == "-opengl-es-2") {
639 dictionary[ "OPENGL" ] = "yes";
640 dictionary[ "OPENGL_ES_2" ] = "yes";
641 } else if (configCmdLine.at(i) == "-opengl") {
642 dictionary[ "OPENGL" ] = "yes";
647 if (configCmdLine.at(i) == "es1") {
648 dictionary[ "OPENGL_ES_CM" ] = "yes";
649 } else if ( configCmdLine.at(i) == "es2" ) {
650 dictionary[ "OPENGL_ES_2" ] = "yes";
651 } else if ( configCmdLine.at(i) == "desktop" ) {
652 // OPENGL=yes suffices
654 cout << "Argument passed to -opengl option is not valid." << endl;
655 dictionary[ "DONE" ] = "error";
660 // OpenVG Support -------------------------------------------
661 else if (configCmdLine.at(i) == "-openvg") {
662 dictionary[ "OPENVG" ] = "yes";
663 } else if (configCmdLine.at(i) == "-no-openvg") {
664 dictionary[ "OPENVG" ] = "no";
667 // Databases ------------------------------------------------
668 else if (configCmdLine.at(i) == "-qt-sql-mysql")
669 dictionary[ "SQL_MYSQL" ] = "yes";
670 else if (configCmdLine.at(i) == "-plugin-sql-mysql")
671 dictionary[ "SQL_MYSQL" ] = "plugin";
672 else if (configCmdLine.at(i) == "-no-sql-mysql")
673 dictionary[ "SQL_MYSQL" ] = "no";
675 else if (configCmdLine.at(i) == "-qt-sql-odbc")
676 dictionary[ "SQL_ODBC" ] = "yes";
677 else if (configCmdLine.at(i) == "-plugin-sql-odbc")
678 dictionary[ "SQL_ODBC" ] = "plugin";
679 else if (configCmdLine.at(i) == "-no-sql-odbc")
680 dictionary[ "SQL_ODBC" ] = "no";
682 else if (configCmdLine.at(i) == "-qt-sql-oci")
683 dictionary[ "SQL_OCI" ] = "yes";
684 else if (configCmdLine.at(i) == "-plugin-sql-oci")
685 dictionary[ "SQL_OCI" ] = "plugin";
686 else if (configCmdLine.at(i) == "-no-sql-oci")
687 dictionary[ "SQL_OCI" ] = "no";
689 else if (configCmdLine.at(i) == "-qt-sql-psql")
690 dictionary[ "SQL_PSQL" ] = "yes";
691 else if (configCmdLine.at(i) == "-plugin-sql-psql")
692 dictionary[ "SQL_PSQL" ] = "plugin";
693 else if (configCmdLine.at(i) == "-no-sql-psql")
694 dictionary[ "SQL_PSQL" ] = "no";
696 else if (configCmdLine.at(i) == "-qt-sql-tds")
697 dictionary[ "SQL_TDS" ] = "yes";
698 else if (configCmdLine.at(i) == "-plugin-sql-tds")
699 dictionary[ "SQL_TDS" ] = "plugin";
700 else if (configCmdLine.at(i) == "-no-sql-tds")
701 dictionary[ "SQL_TDS" ] = "no";
703 else if (configCmdLine.at(i) == "-qt-sql-db2")
704 dictionary[ "SQL_DB2" ] = "yes";
705 else if (configCmdLine.at(i) == "-plugin-sql-db2")
706 dictionary[ "SQL_DB2" ] = "plugin";
707 else if (configCmdLine.at(i) == "-no-sql-db2")
708 dictionary[ "SQL_DB2" ] = "no";
710 else if (configCmdLine.at(i) == "-qt-sql-sqlite")
711 dictionary[ "SQL_SQLITE" ] = "yes";
712 else if (configCmdLine.at(i) == "-plugin-sql-sqlite")
713 dictionary[ "SQL_SQLITE" ] = "plugin";
714 else if (configCmdLine.at(i) == "-no-sql-sqlite")
715 dictionary[ "SQL_SQLITE" ] = "no";
716 else if (configCmdLine.at(i) == "-system-sqlite")
717 dictionary[ "SQL_SQLITE_LIB" ] = "system";
718 else if (configCmdLine.at(i) == "-qt-sql-sqlite2")
719 dictionary[ "SQL_SQLITE2" ] = "yes";
720 else if (configCmdLine.at(i) == "-plugin-sql-sqlite2")
721 dictionary[ "SQL_SQLITE2" ] = "plugin";
722 else if (configCmdLine.at(i) == "-no-sql-sqlite2")
723 dictionary[ "SQL_SQLITE2" ] = "no";
725 else if (configCmdLine.at(i) == "-qt-sql-ibase")
726 dictionary[ "SQL_IBASE" ] = "yes";
727 else if (configCmdLine.at(i) == "-plugin-sql-ibase")
728 dictionary[ "SQL_IBASE" ] = "plugin";
729 else if (configCmdLine.at(i) == "-no-sql-ibase")
730 dictionary[ "SQL_IBASE" ] = "no";
732 // Image formats --------------------------------------------
733 else if (configCmdLine.at(i).startsWith("-qt-imageformat-") &&
734 imageFormats.contains(configCmdLine.at(i).section('-', 3)))
735 dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "yes";
736 else if (configCmdLine.at(i).startsWith("-plugin-imageformat-") &&
737 imageFormats.contains(configCmdLine.at(i).section('-', 3)))
738 dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "plugin";
739 else if (configCmdLine.at(i).startsWith("-no-imageformat-") &&
740 imageFormats.contains(configCmdLine.at(i).section('-', 3)))
741 dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "no";
743 // IDE project generation -----------------------------------
744 else if (configCmdLine.at(i) == "-no-dsp")
745 dictionary[ "DSPFILES" ] = "no";
746 else if (configCmdLine.at(i) == "-dsp")
747 dictionary[ "DSPFILES" ] = "yes";
749 else if (configCmdLine.at(i) == "-no-vcp")
750 dictionary[ "VCPFILES" ] = "no";
751 else if (configCmdLine.at(i) == "-vcp")
752 dictionary[ "VCPFILES" ] = "yes";
754 else if (configCmdLine.at(i) == "-no-vcproj")
755 dictionary[ "VCPROJFILES" ] = "no";
756 else if (configCmdLine.at(i) == "-vcproj")
757 dictionary[ "VCPROJFILES" ] = "yes";
759 else if (configCmdLine.at(i) == "-no-incredibuild-xge")
760 dictionary[ "INCREDIBUILD_XGE" ] = "no";
761 else if (configCmdLine.at(i) == "-incredibuild-xge")
762 dictionary[ "INCREDIBUILD_XGE" ] = "yes";
763 else if (configCmdLine.at(i) == "-native-gestures")
764 dictionary[ "NATIVE_GESTURES" ] = "yes";
765 else if (configCmdLine.at(i) == "-no-native-gestures")
766 dictionary[ "NATIVE_GESTURES" ] = "no";
768 // Others ---------------------------------------------------
769 else if (configCmdLine.at(i) == "-fast")
770 dictionary[ "FAST" ] = "yes";
771 else if (configCmdLine.at(i) == "-no-fast")
772 dictionary[ "FAST" ] = "no";
774 else if (configCmdLine.at(i) == "-stl")
775 dictionary[ "STL" ] = "yes";
776 else if (configCmdLine.at(i) == "-no-stl")
777 dictionary[ "STL" ] = "no";
779 else if (configCmdLine.at(i) == "-exceptions")
780 dictionary[ "EXCEPTIONS" ] = "yes";
781 else if (configCmdLine.at(i) == "-no-exceptions")
782 dictionary[ "EXCEPTIONS" ] = "no";
784 else if (configCmdLine.at(i) == "-widgets")
785 dictionary[ "WIDGETS" ] = "yes";
786 else if (configCmdLine.at(i) == "-no-widgets")
787 dictionary[ "WIDGETS" ] = "no";
789 else if (configCmdLine.at(i) == "-rtti")
790 dictionary[ "RTTI" ] = "yes";
791 else if (configCmdLine.at(i) == "-no-rtti")
792 dictionary[ "RTTI" ] = "no";
794 else if (configCmdLine.at(i) == "-accessibility")
795 dictionary[ "ACCESSIBILITY" ] = "yes";
796 else if (configCmdLine.at(i) == "-no-accessibility") {
797 dictionary[ "ACCESSIBILITY" ] = "no";
798 cout << "Setting accessibility to NO" << endl;
801 else if (configCmdLine.at(i) == "-no-mmx")
802 dictionary[ "MMX" ] = "no";
803 else if (configCmdLine.at(i) == "-mmx")
804 dictionary[ "MMX" ] = "yes";
805 else if (configCmdLine.at(i) == "-no-3dnow")
806 dictionary[ "3DNOW" ] = "no";
807 else if (configCmdLine.at(i) == "-3dnow")
808 dictionary[ "3DNOW" ] = "yes";
809 else if (configCmdLine.at(i) == "-no-sse")
810 dictionary[ "SSE" ] = "no";
811 else if (configCmdLine.at(i) == "-sse")
812 dictionary[ "SSE" ] = "yes";
813 else if (configCmdLine.at(i) == "-no-sse2")
814 dictionary[ "SSE2" ] = "no";
815 else if (configCmdLine.at(i) == "-sse2")
816 dictionary[ "SSE2" ] = "yes";
817 else if (configCmdLine.at(i) == "-no-iwmmxt")
818 dictionary[ "IWMMXT" ] = "no";
819 else if (configCmdLine.at(i) == "-iwmmxt")
820 dictionary[ "IWMMXT" ] = "yes";
822 else if (configCmdLine.at(i) == "-no-openssl") {
823 dictionary[ "OPENSSL"] = "no";
824 } else if (configCmdLine.at(i) == "-openssl") {
825 dictionary[ "OPENSSL" ] = "yes";
826 } else if (configCmdLine.at(i) == "-openssl-linked") {
827 dictionary[ "OPENSSL" ] = "linked";
828 } else if (configCmdLine.at(i) == "-no-qdbus") {
829 dictionary[ "DBUS" ] = "no";
830 } else if (configCmdLine.at(i) == "-qdbus") {
831 dictionary[ "DBUS" ] = "yes";
832 } else if (configCmdLine.at(i) == "-no-dbus") {
833 dictionary[ "DBUS" ] = "no";
834 } else if (configCmdLine.at(i) == "-dbus") {
835 dictionary[ "DBUS" ] = "yes";
836 } else if (configCmdLine.at(i) == "-dbus-linked") {
837 dictionary[ "DBUS" ] = "linked";
838 } else if (configCmdLine.at(i) == "-audio-backend") {
839 dictionary[ "AUDIO_BACKEND" ] = "yes";
840 } else if (configCmdLine.at(i) == "-no-audio-backend") {
841 dictionary[ "AUDIO_BACKEND" ] = "no";
842 } else if (configCmdLine.at(i) == "-no-phonon-backend") {
843 dictionary[ "PHONON_BACKEND" ] = "no";
844 } else if (configCmdLine.at(i) == "-phonon-backend") {
845 dictionary[ "PHONON_BACKEND" ] = "yes";
846 } else if (configCmdLine.at(i) == "-phonon-wince-ds9") {
847 dictionary[ "DIRECTSHOW" ] = "yes";
848 } else if (configCmdLine.at(i) == "-no-qml-debug") {
849 dictionary[ "QML_DEBUG" ] = "no";
850 } else if (configCmdLine.at(i) == "-qml-debug") {
851 dictionary[ "QML_DEBUG" ] = "yes";
852 } else if (configCmdLine.at(i) == "-no-plugin-manifests") {
853 dictionary[ "PLUGIN_MANIFESTS" ] = "no";
854 } else if (configCmdLine.at(i) == "-plugin-manifests") {
855 dictionary[ "PLUGIN_MANIFESTS" ] = "yes";
858 // Work around compiler nesting limitation
860 continueElse[0] = true;
861 if (!continueElse[0]) {
864 else if (configCmdLine.at(i) == "-internal")
865 dictionary[ "QMAKE_INTERNAL" ] = "yes";
867 else if (configCmdLine.at(i) == "-no-syncqt")
868 dictionary[ "SYNCQT" ] = "no";
870 else if (configCmdLine.at(i) == "-no-qmake")
871 dictionary[ "BUILD_QMAKE" ] = "no";
872 else if (configCmdLine.at(i) == "-qmake")
873 dictionary[ "BUILD_QMAKE" ] = "yes";
875 else if (configCmdLine.at(i) == "-dont-process")
876 dictionary[ "NOPROCESS" ] = "yes";
877 else if (configCmdLine.at(i) == "-process")
878 dictionary[ "NOPROCESS" ] = "no";
880 else if (configCmdLine.at(i) == "-no-qmake-deps")
881 dictionary[ "DEPENDENCIES" ] = "no";
882 else if (configCmdLine.at(i) == "-qmake-deps")
883 dictionary[ "DEPENDENCIES" ] = "yes";
886 else if (configCmdLine.at(i) == "-qtnamespace") {
890 dictionary[ "QT_NAMESPACE" ] = configCmdLine.at(i);
891 } else if (configCmdLine.at(i) == "-qtlibinfix") {
895 dictionary[ "QT_LIBINFIX" ] = configCmdLine.at(i);
896 } else if (configCmdLine.at(i) == "-D") {
900 qmakeDefines += configCmdLine.at(i);
901 } else if (configCmdLine.at(i) == "-I") {
905 qmakeIncludes += configCmdLine.at(i);
906 } else if (configCmdLine.at(i) == "-L") {
910 QFileInfo checkDirectory(configCmdLine.at(i));
911 if (!checkDirectory.isDir()) {
912 cout << "Argument passed to -L option is not a directory path. Did you mean the -l option?" << endl;
913 dictionary[ "DONE" ] = "error";
916 qmakeLibs += QString("-L" + configCmdLine.at(i));
917 } else if (configCmdLine.at(i) == "-l") {
921 qmakeLibs += QString("-l" + configCmdLine.at(i));
922 } else if (configCmdLine.at(i).startsWith("OPENSSL_LIBS=")) {
923 opensslLibs = configCmdLine.at(i);
924 } else if (configCmdLine.at(i).startsWith("PSQL_LIBS=")) {
925 psqlLibs = configCmdLine.at(i);
926 } else if (configCmdLine.at(i).startsWith("SYBASE=")) {
927 sybase = configCmdLine.at(i);
928 } else if (configCmdLine.at(i).startsWith("SYBASE_LIBS=")) {
929 sybaseLibs = configCmdLine.at(i);
932 else if ((configCmdLine.at(i) == "-override-version") || (configCmdLine.at(i) == "-version-override")){
936 dictionary[ "VERSION" ] = configCmdLine.at(i);
939 else if (configCmdLine.at(i) == "-saveconfig") {
943 dictionary[ "CUSTOMCONFIG" ] = "_" + configCmdLine.at(i);
946 else if (configCmdLine.at(i) == "-confirm-license") {
947 dictionary["LICENSE_CONFIRMED"] = "yes";
950 else if (configCmdLine.at(i) == "-make") {
954 buildParts += configCmdLine.at(i);
955 } else if (configCmdLine.at(i) == "-nomake") {
959 nobuildParts.append(configCmdLine.at(i));
962 // Directories ----------------------------------------------
963 else if (configCmdLine.at(i) == "-prefix") {
967 dictionary[ "QT_INSTALL_PREFIX" ] = configCmdLine.at(i);
970 else if (configCmdLine.at(i) == "-bindir") {
974 dictionary[ "QT_INSTALL_BINS" ] = configCmdLine.at(i);
977 else if (configCmdLine.at(i) == "-libdir") {
981 dictionary[ "QT_INSTALL_LIBS" ] = configCmdLine.at(i);
984 else if (configCmdLine.at(i) == "-docdir") {
988 dictionary[ "QT_INSTALL_DOCS" ] = configCmdLine.at(i);
991 else if (configCmdLine.at(i) == "-headerdir") {
995 dictionary[ "QT_INSTALL_HEADERS" ] = configCmdLine.at(i);
998 else if (configCmdLine.at(i) == "-plugindir") {
1002 dictionary[ "QT_INSTALL_PLUGINS" ] = configCmdLine.at(i);
1005 else if (configCmdLine.at(i) == "-importdir") {
1009 dictionary[ "QT_INSTALL_IMPORTS" ] = configCmdLine.at(i);
1011 else if (configCmdLine.at(i) == "-datadir") {
1015 dictionary[ "QT_INSTALL_DATA" ] = configCmdLine.at(i);
1018 else if (configCmdLine.at(i) == "-translationdir") {
1022 dictionary[ "QT_INSTALL_TRANSLATIONS" ] = configCmdLine.at(i);
1025 else if (configCmdLine.at(i) == "-examplesdir") {
1029 dictionary[ "QT_INSTALL_EXAMPLES" ] = configCmdLine.at(i);
1032 else if (configCmdLine.at(i) == "-testsdir") {
1036 dictionary[ "QT_INSTALL_TESTS" ] = configCmdLine.at(i);
1039 else if (configCmdLine.at(i) == "-sysroot") {
1043 dictionary[ "CFG_SYSROOT" ] = configCmdLine.at(i);
1046 else if (configCmdLine.at(i) == "-hostprefix") {
1048 if (i == argCount || configCmdLine.at(i).startsWith('-'))
1049 dictionary[ "QT_HOST_PREFIX" ] = dictionary[ "QT_BUILD_TREE" ];
1051 dictionary[ "QT_HOST_PREFIX" ] = configCmdLine.at(i);
1054 else if (configCmdLine.at(i) == "-hostbindir") {
1058 dictionary[ "QT_HOST_BINS" ] = configCmdLine.at(i);
1061 else if (configCmdLine.at(i) == "-hostdatadir") {
1065 dictionary[ "QT_HOST_DATA" ] = configCmdLine.at(i);
1068 else if (configCmdLine.at(i) == "-make-tool") {
1072 dictionary[ "MAKE" ] = configCmdLine.at(i);
1075 else if (configCmdLine.at(i).indexOf(QRegExp("^-(en|dis)able-")) != -1) {
1076 // Scan to see if any specific modules and drivers are enabled or disabled
1077 for (QStringList::Iterator module = modules.begin(); module != modules.end(); ++module) {
1078 if (configCmdLine.at(i) == QString("-enable-") + (*module)) {
1079 enabledModules += (*module);
1082 else if (configCmdLine.at(i) == QString("-disable-") + (*module)) {
1083 disabledModules += (*module);
1089 else if (configCmdLine.at(i) == "-directwrite") {
1090 dictionary["DIRECTWRITE"] = "yes";
1091 } else if (configCmdLine.at(i) == "-no-directwrite") {
1092 dictionary["DIRECTWRITE"] = "no";
1096 dictionary[ "HELP" ] = "yes";
1097 cout << "Unknown option " << configCmdLine.at(i) << endl;
1104 // Ensure that QMAKESPEC exists in the mkspecs folder
1105 QDir mkspec_dir = fixSeparators(sourcePath + "/mkspecs");
1106 QStringList mkspecs = mkspec_dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot);
1108 if (dictionary["QMAKESPEC"].toLower() == "features"
1109 || !mkspecs.contains(dictionary["QMAKESPEC"], Qt::CaseInsensitive)) {
1110 dictionary[ "HELP" ] = "yes";
1111 if (dictionary ["QMAKESPEC_FROM"] == "commandline") {
1112 cout << "Invalid option \"" << dictionary["QMAKESPEC"] << "\" for -platform." << endl;
1113 } else if (dictionary ["QMAKESPEC_FROM"] == "env") {
1114 cout << "QMAKESPEC environment variable is set to \"" << dictionary["QMAKESPEC"]
1115 << "\" which is not a supported platform" << endl;
1116 } else { // was autodetected from environment
1117 cout << "Unable to detect the platform from environment. Use -platform command line"
1118 "argument or set the QMAKESPEC environment variable and run configure again" << endl;
1120 cout << "See the README file for a list of supported operating systems and compilers." << endl;
1122 if (dictionary[ "QMAKESPEC" ].endsWith("-icc") ||
1123 dictionary[ "QMAKESPEC" ].endsWith("-msvc") ||
1124 dictionary[ "QMAKESPEC" ].endsWith("-msvc.net") ||
1125 dictionary[ "QMAKESPEC" ].endsWith("-msvc2002") ||
1126 dictionary[ "QMAKESPEC" ].endsWith("-msvc2003") ||
1127 dictionary[ "QMAKESPEC" ].endsWith("-msvc2005") ||
1128 dictionary[ "QMAKESPEC" ].endsWith("-msvc2008") ||
1129 dictionary[ "QMAKESPEC" ].endsWith("-msvc2010")) {
1130 if (dictionary[ "MAKE" ].isEmpty()) dictionary[ "MAKE" ] = "nmake";
1131 dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32";
1132 } else if (dictionary[ "QMAKESPEC" ] == QString("win32-g++")) {
1133 if (dictionary[ "MAKE" ].isEmpty()) dictionary[ "MAKE" ] = "mingw32-make";
1134 dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32-g++";
1136 if (dictionary[ "MAKE" ].isEmpty()) dictionary[ "MAKE" ] = "make";
1137 dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32";
1141 // Tell the user how to proceed building Qt after configure finished its job
1142 dictionary["QTBUILDINSTRUCTION"] = dictionary["MAKE"];
1143 if (dictionary.contains("XQMAKESPEC")) {
1144 if (dictionary["XQMAKESPEC"].startsWith("wince")) {
1145 dictionary["QTBUILDINSTRUCTION"] =
1146 QString("setcepaths.bat ") + dictionary["XQMAKESPEC"] + QString(" && ") + dictionary["MAKE"];
1150 // Tell the user how to confclean before the next configure
1151 dictionary["CONFCLEANINSTRUCTION"] = dictionary["MAKE"] + QString(" confclean");
1153 // Ensure that -spec (XQMAKESPEC) exists in the mkspecs folder as well
1154 if (dictionary.contains("XQMAKESPEC") &&
1155 !mkspecs.contains(dictionary["XQMAKESPEC"], Qt::CaseInsensitive)) {
1156 dictionary["HELP"] = "yes";
1157 cout << "Invalid option \"" << dictionary["XQMAKESPEC"] << "\" for -xplatform." << endl;
1160 // Ensure that the crt to be deployed can be found
1161 if (dictionary["CE_CRT"] != QLatin1String("yes") && dictionary["CE_CRT"] != QLatin1String("no")) {
1162 QDir cDir(dictionary["CE_CRT"]);
1163 QStringList entries = cDir.entryList();
1164 bool hasDebug = entries.contains("msvcr80.dll");
1165 bool hasRelease = entries.contains("msvcr80d.dll");
1166 if ((dictionary["BUILDALL"] == "auto") && (!hasDebug || !hasRelease)) {
1167 cout << "Could not find debug and release c-runtime." << endl;
1168 cout << "You need to have msvcr80.dll and msvcr80d.dll in" << endl;
1169 cout << "the path specified. Setting to -no-crt";
1170 dictionary[ "CE_CRT" ] = "no";
1171 } else if ((dictionary["BUILD"] == "debug") && !hasDebug) {
1172 cout << "Could not find debug c-runtime (msvcr80d.dll) in the directory specified." << endl;
1173 cout << "Setting c-runtime automatic deployment to -no-crt" << endl;
1174 dictionary[ "CE_CRT" ] = "no";
1175 } else if ((dictionary["BUILD"] == "release") && !hasRelease) {
1176 cout << "Could not find release c-runtime (msvcr80.dll) in the directory specified." << endl;
1177 cout << "Setting c-runtime automatic deployment to -no-crt" << endl;
1178 dictionary[ "CE_CRT" ] = "no";
1182 useUnixSeparators = (dictionary["QMAKESPEC"] == "win32-g++");
1184 // Allow tests for private classes to be compiled against internal builds
1185 if (dictionary["BUILDDEV"] == "yes")
1186 qtConfig += "private_tests";
1188 if (dictionary["FORCE_ASSERTS"] == "yes")
1189 qtConfig += "force_asserts";
1192 for (QStringList::Iterator dis = disabledModules.begin(); dis != disabledModules.end(); ++dis) {
1193 modules.removeAll((*dis));
1195 for (QStringList::Iterator ena = enabledModules.begin(); ena != enabledModules.end(); ++ena) {
1196 if (modules.indexOf((*ena)) == -1)
1199 qtConfig += modules;
1201 for (QStringList::Iterator it = disabledModules.begin(); it != disabledModules.end(); ++it)
1202 qtConfig.removeAll(*it);
1204 if ((dictionary[ "REDO" ] != "yes") && (dictionary[ "HELP" ] != "yes"))
1210 void Configure::validateArgs()
1212 // Validate the specified config
1214 // Get all possible configurations from the file system.
1216 QStringList filters;
1217 filters << "qconfig-*.h";
1218 dir.setNameFilters(filters);
1219 dir.setPath(sourcePath + "/src/corelib/global/");
1221 QStringList stringList = dir.entryList();
1223 QStringList::Iterator it;
1224 for (it = stringList.begin(); it != stringList.end(); ++it)
1225 allConfigs << it->remove("qconfig-").remove(".h");
1226 allConfigs << "full";
1228 // Try internal configurations first.
1229 QStringList possible_configs = QStringList()
1235 int index = possible_configs.indexOf(dictionary["QCONFIG"]);
1237 for (int c = 0; c <= index; c++) {
1238 qmakeConfig += possible_configs[c] + "-config";
1243 // If the internal configurations failed, try others.
1244 QStringList::Iterator config;
1245 for (config = allConfigs.begin(); config != allConfigs.end(); ++config) {
1246 if ((*config) == dictionary[ "QCONFIG" ])
1249 if (config == allConfigs.end()) {
1250 dictionary[ "HELP" ] = "yes";
1251 cout << "No such configuration \"" << qPrintable(dictionary[ "QCONFIG" ]) << "\"" << endl ;
1254 qmakeConfig += (*config) + "-config";
1259 // Output helper functions --------------------------------[ Start ]-
1261 Determines the length of a string token.
1263 static int tokenLength(const char *str)
1268 const char *nextToken = strpbrk(str, " _/\n\r");
1269 if (nextToken == str || !nextToken)
1272 return int(nextToken - str);
1276 Prints out a string which starts at position \a startingAt, and
1277 indents each wrapped line with \a wrapIndent characters.
1278 The wrap point is set to the console width, unless that width
1279 cannot be determined, or is too small.
1281 void Configure::desc(const char *description, int startingAt, int wrapIndent)
1283 int linePos = startingAt;
1285 bool firstLine = true;
1286 const char *nextToken = description;
1287 while (*nextToken) {
1288 int nextTokenLen = tokenLength(nextToken);
1289 if (*nextToken == '\n' // Wrap on newline, duh
1290 || (linePos + nextTokenLen > outputWidth)) // Wrap at outputWidth
1295 if (*nextToken == '\n')
1299 if (!firstLine && linePos < wrapIndent) { // Indent to wrapIndent
1300 printf("%*s", wrapIndent , "");
1301 linePos = wrapIndent;
1302 if (*nextToken == ' ') {
1307 printf("%.*s", nextTokenLen, nextToken);
1308 linePos += nextTokenLen;
1309 nextToken += nextTokenLen;
1314 Prints out an option with its description wrapped at the
1315 description starting point. If \a skipIndent is true, the
1316 indentation to the option is not outputted (used by marked option
1317 version of desc()). Extra spaces between option and its
1318 description is filled with\a fillChar, if there's available
1321 void Configure::desc(const char *option, const char *description, bool skipIndent, char fillChar)
1324 printf("%*s", optionIndent, "");
1326 int remaining = descIndent - optionIndent - strlen(option);
1327 int wrapIndent = descIndent + qMax(0, 1 - remaining);
1328 printf("%s", option);
1330 if (remaining > 2) {
1331 printf(" "); // Space in front
1332 for (int i = remaining; i > 2; --i)
1333 printf("%c", fillChar); // Fill, if available space
1335 printf(" "); // Space between option and description
1337 desc(description, wrapIndent, wrapIndent);
1342 Same as above, except it also marks an option with an '*', if
1343 the option is default action.
1345 void Configure::desc(const char *mark_option, const char *mark, const char *option, const char *description, char fillChar)
1347 const QString markedAs = dictionary.value(mark_option);
1348 if (markedAs == "auto" && markedAs == mark) // both "auto", always => +
1350 else if (markedAs == "auto") // setting marked as "auto" and option is default => +
1351 printf(" %c " , (defaultTo(mark_option) == QLatin1String(mark))? '+' : ' ');
1352 else if (QLatin1String(mark) == "auto" && markedAs != "no") // description marked as "auto" and option is available => +
1353 printf(" %c " , checkAvailability(mark_option) ? '+' : ' ');
1354 else // None are "auto", (markedAs == mark) => *
1355 printf(" %c " , markedAs == QLatin1String(mark) ? '*' : ' ');
1357 desc(option, description, true, fillChar);
1361 Modifies the default configuration based on given -platform option.
1362 Eg. switches to different default styles for Windows CE.
1364 void Configure::applySpecSpecifics()
1366 if (dictionary[ "XQMAKESPEC" ].startsWith("wince")) {
1367 dictionary[ "STYLE_WINDOWSXP" ] = "no";
1368 dictionary[ "STYLE_WINDOWSVISTA" ] = "no";
1369 dictionary[ "STYLE_PLASTIQUE" ] = "no";
1370 dictionary[ "STYLE_CLEANLOOKS" ] = "no";
1371 dictionary[ "STYLE_WINDOWSCE" ] = "yes";
1372 dictionary[ "STYLE_WINDOWSMOBILE" ] = "yes";
1373 dictionary[ "STYLE_MOTIF" ] = "no";
1374 dictionary[ "STYLE_CDE" ] = "no";
1375 dictionary[ "FREETYPE" ] = "no";
1376 dictionary[ "OPENGL" ] = "no";
1377 dictionary[ "OPENSSL" ] = "no";
1378 dictionary[ "STL" ] = "no";
1379 dictionary[ "EXCEPTIONS" ] = "no";
1380 dictionary[ "RTTI" ] = "no";
1381 dictionary[ "3DNOW" ] = "no";
1382 dictionary[ "SSE" ] = "no";
1383 dictionary[ "SSE2" ] = "no";
1384 dictionary[ "MMX" ] = "no";
1385 dictionary[ "IWMMXT" ] = "no";
1386 dictionary[ "CE_CRT" ] = "yes";
1387 dictionary[ "DIRECTSHOW" ] = "no";
1388 // We only apply MMX/IWMMXT for mkspecs we know they work
1389 if (dictionary[ "XQMAKESPEC" ].startsWith("wincewm")) {
1390 dictionary[ "MMX" ] = "yes";
1391 dictionary[ "IWMMXT" ] = "yes";
1392 dictionary[ "DIRECTSHOW" ] = "yes";
1394 dictionary[ "QT_HOST_PREFIX" ] = dictionary[ "QT_INSTALL_PREFIX" ];
1395 dictionary[ "QT_INSTALL_PREFIX" ] = "";
1397 } else if (dictionary[ "XQMAKESPEC" ].startsWith("linux")) { //TODO actually wrong.
1399 dictionary[ "STYLE_WINDOWSXP" ] = "no";
1400 dictionary[ "STYLE_WINDOWSVISTA" ] = "no";
1401 dictionary[ "KBD_DRIVERS" ] = "tty";
1402 dictionary[ "GFX_DRIVERS" ] = "linuxfb";
1403 dictionary[ "MOUSE_DRIVERS" ] = "pc linuxtp";
1404 dictionary[ "OPENGL" ] = "no";
1405 dictionary[ "EXCEPTIONS" ] = "no";
1406 dictionary[ "DBUS"] = "no";
1407 dictionary[ "QT_QWS_DEPTH" ] = "4 8 16 24 32";
1408 dictionary[ "QT_SXE" ] = "no";
1409 dictionary[ "QT_INOTIFY" ] = "no";
1410 dictionary[ "QT_LPR" ] = "no";
1411 dictionary[ "QT_CUPS" ] = "no";
1412 dictionary[ "QT_GLIB" ] = "no";
1413 dictionary[ "QT_ICONV" ] = "no";
1415 dictionary["DECORATIONS"] = "default windows styled";
1419 QString Configure::locateFileInPaths(const QString &fileName, const QStringList &paths)
1422 for (QStringList::ConstIterator it = paths.begin(); it != paths.end(); ++it) {
1423 // Remove any leading or trailing ", this is commonly used in the environment
1425 QString path = (*it);
1426 if (path.startsWith("\""))
1427 path = path.right(path.length() - 1);
1428 if (path.endsWith("\""))
1429 path = path.left(path.length() - 1);
1430 if (d.exists(path + QDir::separator() + fileName)) {
1437 QString Configure::locateFile(const QString &fileName)
1439 QString file = fileName.toLower();
1441 #if defined(Q_OS_WIN32)
1442 QRegExp splitReg("[;,]");
1444 QRegExp splitReg("[:]");
1446 if (file.endsWith(".h"))
1447 paths = QString::fromLocal8Bit(getenv("INCLUDE")).split(splitReg, QString::SkipEmptyParts);
1448 else if (file.endsWith(".lib"))
1449 paths = QString::fromLocal8Bit(getenv("LIB")).split(splitReg, QString::SkipEmptyParts);
1451 paths = QString::fromLocal8Bit(getenv("PATH")).split(splitReg, QString::SkipEmptyParts);
1452 return locateFileInPaths(file, paths);
1455 // Output helper functions ---------------------------------[ Stop ]-
1458 bool Configure::displayHelp()
1460 if (dictionary[ "HELP" ] == "yes") {
1461 desc("Usage: configure\n"
1462 "[-release] [-debug] [-debug-and-release] [-shared] [-static]\n"
1463 "[-no-fast] [-fast] [-no-exceptions] [-exceptions]\n"
1464 "[-no-accessibility] [-accessibility] [-no-rtti] [-rtti]\n"
1465 "[-no-stl] [-stl] [-no-sql-<driver>] [-qt-sql-<driver>]\n"
1466 "[-plugin-sql-<driver>] [-system-sqlite]\n"
1467 "[-D <define>] [-I <includepath>] [-L <librarypath>]\n"
1468 "[-help] [-no-dsp] [-dsp] [-no-vcproj] [-vcproj]\n"
1469 "[-no-qmake] [-qmake] [-dont-process] [-process]\n"
1470 "[-no-style-<style>] [-qt-style-<style>] [-redo]\n"
1471 "[-saveconfig <config>] [-loadconfig <config>]\n"
1472 "[-qt-zlib] [-system-zlib] [-qt-pcre] [-system-pcre] [-no-gif]\n"
1473 "[-no-libpng] [-qt-libpng] [-system-libpng]\n"
1474 "[-no-libjpeg] [-qt-libjpeg] [-system-libjpeg]\n"
1475 "[-mmx] [-no-mmx] [-3dnow] [-no-3dnow] [-sse] [-no-sse] [-sse2] [-no-sse2]\n"
1476 "[-no-iwmmxt] [-iwmmxt] [-openssl] [-openssl-linked]\n"
1477 "[-no-openssl] [-no-dbus] [-dbus] [-dbus-linked] [-platform <spec>]\n"
1478 "[-qtnamespace <namespace>] [-qtlibinfix <infix>] [-no-phonon]\n"
1479 "[-phonon] [-no-phonon-backend] [-phonon-backend]\n"
1480 "[-no-multimedia] [-multimedia] [-no-audio-backend] [-audio-backend]\n"
1481 "[-no-script] [-script] [-no-scripttools] [-scripttools]\n"
1482 "[-no-webkit] [-webkit] [-webkit-debug]\n"
1483 "[-no-directwrite] [-directwrite] [-no-widgets] [-icu]\n\n", 0, 7);
1485 desc("Installation options:\n\n");
1488 desc("Configure options:\n\n");
1490 desc(" The defaults (*) are usually acceptable. A plus (+) denotes a default value"
1491 " that needs to be evaluated. If the evaluation succeeds, the feature is"
1492 " included. Here is a short explanation of each option:\n\n", 0, 1);
1494 desc("BUILD", "release","-release", "Compile and link Qt with debugging turned off.");
1495 desc("BUILD", "debug", "-debug", "Compile and link Qt with debugging turned on.");
1496 desc("BUILDALL", "yes", "-debug-and-release", "Compile and link two Qt libraries, with and without debugging turned on.\n");
1498 desc("OPENSOURCE", "opensource", "-opensource", "Compile and link the Open-Source Edition of Qt.");
1499 desc("COMMERCIAL", "commercial", "-commercial", "Compile and link the Commercial Edition of Qt.\n");
1501 desc("BUILDDEV", "yes", "-developer-build", "Compile and link Qt with Qt developer options (including auto-tests exporting)\n");
1503 desc("SHARED", "yes", "-shared", "Create and use shared Qt libraries.");
1504 desc("SHARED", "no", "-static", "Create and use static Qt libraries.\n");
1506 desc("LTCG", "yes", "-ltcg", "Use Link Time Code Generation. (Release builds only)");
1507 desc("LTCG", "no", "-no-ltcg", "Do not use Link Time Code Generation.\n");
1509 desc("FAST", "no", "-no-fast", "Configure Qt normally by generating Makefiles for all project files.");
1510 desc("FAST", "yes", "-fast", "Configure Qt quickly by generating Makefiles only for library and "
1511 "subdirectory targets. All other Makefiles are created as wrappers "
1512 "which will in turn run qmake\n");
1514 desc( "-make <part>", "Add part to the list of parts to be built at make time.");
1515 for (int i=0; i<defaultBuildParts.size(); ++i)
1516 desc( "", qPrintable(QString(" %1").arg(defaultBuildParts.at(i))), false, ' ');
1517 desc( "-nomake <part>", "Exclude part from the list of parts to be built.\n");
1519 desc("EXCEPTIONS", "no", "-no-exceptions", "Disable exceptions on platforms that support it.");
1520 desc("EXCEPTIONS", "yes","-exceptions", "Enable exceptions on platforms that support it.\n");
1522 desc("WIDGETS", "no", "-no-widgets", "Disable QtWidgets module\n");
1524 desc("ACCESSIBILITY", "no", "-no-accessibility", "Do not compile Windows Active Accessibility support.");
1525 desc("ACCESSIBILITY", "yes", "-accessibility", "Compile Windows Active Accessibility support.\n");
1527 desc("STL", "no", "-no-stl", "Do not compile STL support.");
1528 desc("STL", "yes", "-stl", "Compile STL support.\n");
1530 desc( "-no-sql-<driver>", "Disable SQL <driver> entirely, by default none are turned on.");
1531 desc( "-qt-sql-<driver>", "Enable a SQL <driver> in the Qt Library.");
1532 desc( "-plugin-sql-<driver>", "Enable SQL <driver> as a plugin to be linked to at run time.\n"
1533 "Available values for <driver>:");
1534 desc("SQL_MYSQL", "auto", "", " mysql", ' ');
1535 desc("SQL_PSQL", "auto", "", " psql", ' ');
1536 desc("SQL_OCI", "auto", "", " oci", ' ');
1537 desc("SQL_ODBC", "auto", "", " odbc", ' ');
1538 desc("SQL_TDS", "auto", "", " tds", ' ');
1539 desc("SQL_DB2", "auto", "", " db2", ' ');
1540 desc("SQL_SQLITE", "auto", "", " sqlite", ' ');
1541 desc("SQL_SQLITE2", "auto", "", " sqlite2", ' ');
1542 desc("SQL_IBASE", "auto", "", " ibase", ' ');
1543 desc( "", "(drivers marked with a '+' have been detected as available on this system)\n", false, ' ');
1545 desc( "-system-sqlite", "Use sqlite from the operating system.\n");
1547 desc("OPENGL", "no","-no-opengl", "Disables OpenGL functionality\n");
1548 desc("OPENGL", "no","-opengl <api>", "Enable OpenGL support with specified API version.\n"
1549 "Available values for <api>:");
1550 desc("", "", "", " desktop - Enable support for Desktop OpenGL", ' ');
1551 desc("OPENGL_ES_CM", "no", "", " es1 - Enable support for OpenGL ES Common Profile", ' ');
1552 desc("OPENGL_ES_2", "no", "", " es2 - Enable support for OpenGL ES 2.0", ' ');
1554 desc("OPENVG", "no","-no-openvg", "Disables OpenVG functionality\n");
1555 desc("OPENVG", "yes","-openvg", "Enables OpenVG functionality");
1556 desc( "-force-asserts", "Activate asserts in release mode.\n");
1558 desc( "-platform <spec>", "The operating system and compiler you are building on.\n(default %QMAKESPEC%)\n");
1559 desc( "-xplatform <spec>", "The operating system and compiler you are cross compiling to.\n");
1560 desc( "", "See the README file for a list of supported operating systems and compilers.\n", false, ' ');
1563 desc( "-qtnamespace <namespace>", "Wraps all Qt library code in 'namespace name {...}");
1564 desc( "-qtlibinfix <infix>", "Renames all Qt* libs to Qt*<infix>\n");
1565 desc( "-D <define>", "Add an explicit define to the preprocessor.");
1566 desc( "-I <includepath>", "Add an explicit include path.");
1567 desc( "-L <librarypath>", "Add an explicit library path.");
1568 desc( "-l <libraryname>", "Add an explicit library name, residing in a librarypath.\n");
1571 desc( "-help, -h, -?", "Display this information.\n");
1574 // 3rd party stuff options go below here --------------------------------------------------------------------------------
1575 desc("Third Party Libraries:\n\n");
1577 desc("ZLIB", "qt", "-qt-zlib", "Use the zlib bundled with Qt.");
1578 desc("ZLIB", "system", "-system-zlib", "Use zlib from the operating system.\nSee http://www.gzip.org/zlib\n");
1580 desc("PCRE", "qt", "-qt-pcre", "Use the PCRE library bundled with Qt.");
1581 desc("PCRE", "qt", "-system-pcre", "Use the PCRE library from the operating system.\nSee http://pcre.org/\n");
1583 desc("ICU", "yes", "-icu", "Use the ICU library.");
1584 desc("ICU", "no", "-no-icu", "Do not use the ICU library.\nSee http://site.icu-project.org/\n");
1586 desc("GIF", "no", "-no-gif", "Do not compile GIF reading support.");
1588 desc("LIBPNG", "no", "-no-libpng", "Do not compile PNG support.");
1589 desc("LIBPNG", "qt", "-qt-libpng", "Use the libpng bundled with Qt.");
1590 desc("LIBPNG", "system","-system-libpng", "Use libpng from the operating system.\nSee http://www.libpng.org/pub/png\n");
1592 desc("LIBJPEG", "no", "-no-libjpeg", "Do not compile JPEG support.");
1593 desc("LIBJPEG", "qt", "-qt-libjpeg", "Use the libjpeg bundled with Qt.");
1594 desc("LIBJPEG", "system","-system-libjpeg", "Use libjpeg from the operating system.\nSee http://www.ijg.org\n");
1596 desc("FREETYPE", "no", "-no-freetype", "Do not compile in Freetype2 support.");
1597 desc("FREETYPE", "yes", "-qt-freetype", "Use the libfreetype bundled with Qt.");
1599 // Qt\Windows only options go below here --------------------------------------------------------------------------------
1600 desc("Qt for Windows only:\n\n");
1602 desc("DSPFILES", "no", "-no-dsp", "Do not generate VC++ .dsp files.");
1603 desc("DSPFILES", "yes", "-dsp", "Generate VC++ .dsp files, only if spec \"win32-msvc\".\n");
1605 desc("VCPROJFILES", "no", "-no-vcproj", "Do not generate VC++ .vcproj files.");
1606 desc("VCPROJFILES", "yes", "-vcproj", "Generate VC++ .vcproj files, only if platform \"win32-msvc.net\".\n");
1608 desc("INCREDIBUILD_XGE", "no", "-no-incredibuild-xge", "Do not add IncrediBuild XGE distribution commands to custom build steps.");
1609 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");
1611 desc("PLUGIN_MANIFESTS", "no", "-no-plugin-manifests", "Do not embed manifests in plugins.");
1612 desc("PLUGIN_MANIFESTS", "yes", "-plugin-manifests", "Embed manifests in plugins.\n");
1615 desc("BUILD_QMAKE", "no", "-no-qmake", "Do not compile qmake.");
1616 desc("BUILD_QMAKE", "yes", "-qmake", "Compile qmake.\n");
1618 desc("NOPROCESS", "yes", "-dont-process", "Do not generate Makefiles/Project files. This will override -no-fast if specified.");
1619 desc("NOPROCESS", "no", "-process", "Generate Makefiles/Project files.\n");
1621 desc("RTTI", "no", "-no-rtti", "Do not compile runtime type information.");
1622 desc("RTTI", "yes", "-rtti", "Compile runtime type information.\n");
1623 desc("MMX", "no", "-no-mmx", "Do not compile with use of MMX instructions");
1624 desc("MMX", "yes", "-mmx", "Compile with use of MMX instructions");
1625 desc("3DNOW", "no", "-no-3dnow", "Do not compile with use of 3DNOW instructions");
1626 desc("3DNOW", "yes", "-3dnow", "Compile with use of 3DNOW instructions");
1627 desc("SSE", "no", "-no-sse", "Do not compile with use of SSE instructions");
1628 desc("SSE", "yes", "-sse", "Compile with use of SSE instructions");
1629 desc("SSE2", "no", "-no-sse2", "Do not compile with use of SSE2 instructions");
1630 desc("SSE2", "yes", "-sse2", "Compile with use of SSE2 instructions");
1631 desc("OPENSSL", "no", "-no-openssl", "Do not compile in OpenSSL support");
1632 desc("OPENSSL", "yes", "-openssl", "Compile in run-time OpenSSL support");
1633 desc("OPENSSL", "linked","-openssl-linked", "Compile in linked OpenSSL support");
1634 desc("DBUS", "no", "-no-dbus", "Do not compile in D-Bus support");
1635 desc("DBUS", "yes", "-dbus", "Compile in D-Bus support and load libdbus-1 dynamically");
1636 desc("DBUS", "linked", "-dbus-linked", "Compile in D-Bus support and link to libdbus-1");
1637 desc("PHONON_BACKEND","no", "-no-phonon-backend","Do not compile the platform-specific Phonon backend-plugin");
1638 desc("PHONON_BACKEND","yes","-phonon-backend", "Compile in the platform-specific Phonon backend-plugin");
1639 desc("AUDIO_BACKEND", "no","-no-audio-backend", "Do not compile in the platform audio backend into QtMultimedia");
1640 desc("AUDIO_BACKEND", "yes","-audio-backend", "Compile in the platform audio backend into QtMultimedia");
1641 desc("QML_DEBUG", "no", "-no-qml-debug", "Do not build the QML debugging support");
1642 desc("QML_DEBUG", "yes", "-qml-debug", "Build the QML debugging support");
1643 desc("DIRECTWRITE", "no", "-no-directwrite", "Do not build support for DirectWrite font rendering");
1644 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.)");
1646 desc( "-no-style-<style>", "Disable <style> entirely.");
1647 desc( "-qt-style-<style>", "Enable <style> in the Qt Library.\nAvailable styles: ");
1649 desc("STYLE_WINDOWS", "yes", "", " windows", ' ');
1650 desc("STYLE_WINDOWSXP", "auto", "", " windowsxp", ' ');
1651 desc("STYLE_WINDOWSVISTA", "auto", "", " windowsvista", ' ');
1652 desc("STYLE_PLASTIQUE", "yes", "", " plastique", ' ');
1653 desc("STYLE_CLEANLOOKS", "yes", "", " cleanlooks", ' ');
1654 desc("STYLE_MOTIF", "yes", "", " motif", ' ');
1655 desc("STYLE_CDE", "yes", "", " cde", ' ');
1656 desc("STYLE_WINDOWSCE", "yes", "", " windowsce", ' ');
1657 desc("STYLE_WINDOWSMOBILE" , "yes", "", " windowsmobile", ' ');
1658 desc("NATIVE_GESTURES", "no", "-no-native-gestures", "Do not use native gestures on Windows 7.");
1659 desc("NATIVE_GESTURES", "yes", "-native-gestures", "Use native gestures on Windows 7.");
1660 desc("MSVC_MP", "no", "-no-mp", "Do not use multiple processors for compiling with MSVC");
1661 desc("MSVC_MP", "yes", "-mp", "Use multiple processors for compiling with MSVC (-MP)");
1663 /* We do not support -qconfig on Windows yet
1665 desc( "-qconfig <local>", "Use src/tools/qconfig-local.h rather than the default.\nPossible values for local:");
1666 for (int i=0; i<allConfigs.size(); ++i)
1667 desc( "", qPrintable(QString(" %1").arg(allConfigs.at(i))), false, ' ');
1671 desc( "-loadconfig <config>", "Run configure with the parameters from file configure_<config>.cache.");
1672 desc( "-saveconfig <config>", "Run configure and save the parameters in file configure_<config>.cache.");
1673 desc( "-redo", "Run configure with the same parameters as last time.\n");
1675 // Qt\Windows CE only options go below here -----------------------------------------------------------------------------
1676 desc("Qt for Windows CE only:\n\n");
1677 desc("IWMMXT", "no", "-no-iwmmxt", "Do not compile with use of IWMMXT instructions");
1678 desc("IWMMXT", "yes", "-iwmmxt", "Do compile with use of IWMMXT instructions (Qt for Windows CE on Arm only)");
1679 desc("CE_CRT", "no", "-no-crt" , "Do not add the C runtime to default deployment rules");
1680 desc("CE_CRT", "yes", "-qt-crt", "Qt identifies C runtime during project generation");
1681 desc( "-crt <path>", "Specify path to C runtime used for project generation.");
1682 desc("CETEST", "no", "-no-cetest", "Do not compile Windows CE remote test application");
1683 desc("CETEST", "yes", "-cetest", "Compile Windows CE remote test application");
1684 desc( "-signature <file>", "Use file for signing the target project");
1686 desc("DIRECTSHOW", "no", "-phonon-wince-ds9", "Enable Phonon Direct Show 9 backend for Windows CE");
1692 QString Configure::findFileInPaths(const QString &fileName, const QString &paths)
1694 #if defined(Q_OS_WIN32)
1695 QRegExp splitReg("[;,]");
1697 QRegExp splitReg("[:]");
1699 QStringList pathList = paths.split(splitReg, QString::SkipEmptyParts);
1701 for (QStringList::ConstIterator it = pathList.begin(); it != pathList.end(); ++it) {
1702 // Remove any leading or trailing ", this is commonly used in the environment
1704 QString path = (*it);
1705 if (path.startsWith('\"'))
1706 path = path.right(path.length() - 1);
1707 if (path.endsWith('\"'))
1708 path = path.left(path.length() - 1);
1709 if (d.exists(path + QDir::separator() + fileName))
1715 static QString mingwPaths(const QString &mingwPath, const QString &pathName)
1718 QDir mingwDir = QFileInfo(mingwPath).dir();
1719 const QFileInfoList subdirs = mingwDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
1720 for (int i = 0 ;i < subdirs.length(); ++i) {
1721 const QFileInfo &fi = subdirs.at(i);
1722 const QString name = fi.fileName();
1723 if (name == pathName)
1724 ret += fi.absoluteFilePath() + ';';
1725 else if (name.contains("mingw"))
1726 ret += fi.absoluteFilePath() + QDir::separator() + pathName + ';';
1731 bool Configure::findFile(const QString &fileName)
1733 const QString file = fileName.toLower();
1734 const QString pathEnvVar = QString::fromLocal8Bit(getenv("PATH"));
1735 const QString mingwPath = dictionary["QMAKESPEC"].endsWith("-g++") ?
1736 findFileInPaths("g++.exe", pathEnvVar) : QString();
1739 if (file.endsWith(".h")) {
1740 if (!mingwPath.isNull()) {
1741 if (!findFileInPaths(file, mingwPaths(mingwPath, "include")).isNull())
1743 //now let's try the additional compiler path
1745 const QFileInfoList mingwConfigs = QDir(mingwPath + QLatin1String("/../lib/gcc")).entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
1746 for (int i = 0; i < mingwConfigs.length(); ++i) {
1747 const QDir mingwLibDir = mingwConfigs.at(i).absoluteFilePath();
1748 foreach(const QFileInfo &version, mingwLibDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot)) {
1749 if (!findFileInPaths(file, version.absoluteFilePath() + QLatin1String("/include")).isNull())
1754 paths = QString::fromLocal8Bit(getenv("INCLUDE"));
1755 } else if (file.endsWith(".lib") || file.endsWith(".a")) {
1756 if (!mingwPath.isNull() && !findFileInPaths(file, mingwPaths(mingwPath, "lib")).isNull())
1758 paths = QString::fromLocal8Bit(getenv("LIB"));
1762 return !findFileInPaths(file, paths).isNull();
1766 Default value for options marked as "auto" if the test passes.
1767 (Used both by the autoDetection() below, and the desc() function
1768 to mark (+) the default option of autodetecting options.
1770 QString Configure::defaultTo(const QString &option)
1772 // We prefer using the system version of the 3rd party libs
1773 if (option == "ZLIB"
1775 || option == "LIBJPEG"
1776 || option == "LIBPNG")
1779 // PNG is always built-in, never a plugin
1780 if (option == "PNG")
1783 // These database drivers and image formats can be built-in or plugins.
1784 // Prefer plugins when Qt is shared.
1785 if (dictionary[ "SHARED" ] == "yes") {
1786 if (option == "SQL_MYSQL"
1787 || option == "SQL_MYSQL"
1788 || option == "SQL_ODBC"
1789 || option == "SQL_OCI"
1790 || option == "SQL_PSQL"
1791 || option == "SQL_TDS"
1792 || option == "SQL_DB2"
1793 || option == "SQL_SQLITE"
1794 || option == "SQL_SQLITE2"
1795 || option == "SQL_IBASE"
1801 // By default we do not want to compile OCI driver when compiling with
1802 // MinGW, due to lack of such support from Oracle. It prob. wont work.
1803 // (Customer may force the use though)
1804 if (dictionary["QMAKESPEC"].endsWith("-g++")
1805 && option == "SQL_OCI")
1808 if (option == "SYNCQT"
1809 && (!QFile::exists(sourcePath + "/bin/syncqt") ||
1810 !QFile::exists(sourcePath + "/bin/syncqt.bat")))
1817 Checks the system for the availability of a feature.
1818 Returns true if the feature is available, else false.
1820 bool Configure::checkAvailability(const QString &part)
1822 bool available = false;
1823 if (part == "STYLE_WINDOWSXP")
1824 available = findFile("uxtheme.h");
1826 else if (part == "ZLIB")
1827 available = findFile("zlib.h");
1829 else if (part == "PCRE")
1830 available = findFile("pcre.h");
1832 else if (part == "ICU")
1833 available = findFile("unicode/utypes.h") && findFile("unicode/ucol.h") && findFile("unicode/ustring.h") && findFile("icuin.lib");
1835 else if (part == "LIBJPEG")
1836 available = findFile("jpeglib.h");
1837 else if (part == "LIBPNG")
1838 available = findFile("png.h");
1839 else if (part == "SQL_MYSQL")
1840 available = findFile("mysql.h") && findFile("libmySQL.lib");
1841 else if (part == "SQL_ODBC")
1842 available = findFile("sql.h") && findFile("sqlext.h") && findFile("odbc32.lib");
1843 else if (part == "SQL_OCI")
1844 available = findFile("oci.h") && findFile("oci.lib");
1845 else if (part == "SQL_PSQL")
1846 available = findFile("libpq-fe.h") && findFile("libpq.lib") && findFile("ws2_32.lib") && findFile("advapi32.lib");
1847 else if (part == "SQL_TDS")
1848 available = findFile("sybfront.h") && findFile("sybdb.h") && findFile("ntwdblib.lib");
1849 else if (part == "SQL_DB2")
1850 available = findFile("sqlcli.h") && findFile("sqlcli1.h") && findFile("db2cli.lib");
1851 else if (part == "SQL_SQLITE")
1852 available = true; // Built in, we have a fork
1853 else if (part == "SQL_SQLITE_LIB") {
1854 if (dictionary[ "SQL_SQLITE_LIB" ] == "system") {
1855 available = findFile("sqlite3.h") && findFile("sqlite3.lib");
1857 dictionary[ "QT_LFLAGS_SQLITE" ] += "sqlite3.lib";
1860 } else if (part == "SQL_SQLITE2")
1861 available = findFile("sqlite.h") && findFile("sqlite.lib");
1862 else if (part == "SQL_IBASE")
1863 available = findFile("ibase.h") && (findFile("gds32_ms.lib") || findFile("gds32.lib"));
1864 else if (part == "IWMMXT")
1865 available = (dictionary.value("XQMAKESPEC").startsWith("wince"));
1866 else if (part == "OPENGL_ES_CM")
1867 available = (dictionary.value("XQMAKESPEC").startsWith("wince"));
1868 else if (part == "OPENGL_ES_2")
1869 available = (dictionary.value("XQMAKESPEC").startsWith("wince"));
1870 else if (part == "DIRECTSHOW")
1871 available = (dictionary.value("XQMAKESPEC").startsWith("wince"));
1872 else if (part == "SSE2")
1873 available = (dictionary.value("QMAKESPEC") != "win32-msvc");
1874 else if (part == "3DNOW")
1875 available = (dictionary.value("QMAKESPEC") != "win32-msvc") && (dictionary.value("QMAKESPEC") != "win32-icc") && findFile("mm3dnow.h");
1876 else if (part == "MMX" || part == "SSE")
1877 available = (dictionary.value("QMAKESPEC") != "win32-msvc");
1878 else if (part == "OPENSSL")
1879 available = findFile("openssl\\ssl.h");
1880 else if (part == "DBUS")
1881 available = findFile("dbus\\dbus.h");
1882 else if (part == "CETEST") {
1883 QString rapiHeader = locateFile("rapi.h");
1884 QString rapiLib = locateFile("rapi.lib");
1885 available = (dictionary.value("XQMAKESPEC").startsWith("wince")) && !rapiHeader.isEmpty() && !rapiLib.isEmpty();
1887 dictionary[ "QT_CE_RAPI_INC" ] += QLatin1String("\"") + rapiHeader + QLatin1String("\"");
1888 dictionary[ "QT_CE_RAPI_LIB" ] += QLatin1String("\"") + rapiLib + QLatin1String("\"");
1890 else if (dictionary[ "CETEST_REQUESTED" ] == "yes") {
1891 cout << "cetest could not be enabled: rapi.h and rapi.lib could not be found." << endl;
1892 cout << "Make sure the environment is set up for compiling with ActiveSync." << endl;
1893 dictionary[ "DONE" ] = "error";
1896 else if (part == "INCREDIBUILD_XGE")
1897 available = findFile("BuildConsole.exe") && findFile("xgConsole.exe");
1898 else if (part == "PHONON") {
1899 available = findFile("vmr9.h") && findFile("dshow.h") && findFile("dmo.h") && findFile("dmodshow.h")
1900 && (findFile("strmiids.lib") || findFile("libstrmiids.a"))
1901 && (findFile("dmoguids.lib") || findFile("libdmoguids.a"))
1902 && (findFile("msdmo.lib") || findFile("libmsdmo.a"))
1903 && findFile("d3d9.h");
1906 cout << "All the required DirectShow/Direct3D files couldn't be found." << endl
1907 << "Make sure you have either the platform SDK AND the DirectShow SDK or the Windows SDK installed." << endl
1908 << "If you have the DirectShow SDK installed, please make sure that you have run the <path to SDK>\\SetEnv.Cmd script." << endl;
1909 if (!findFile("vmr9.h")) cout << "vmr9.h not found" << endl;
1910 if (!findFile("dshow.h")) cout << "dshow.h not found" << endl;
1911 if (!findFile("strmiids.lib")) cout << "strmiids.lib not found" << endl;
1912 if (!findFile("dmoguids.lib")) cout << "dmoguids.lib not found" << endl;
1913 if (!findFile("msdmo.lib")) cout << "msdmo.lib not found" << endl;
1914 if (!findFile("d3d9.h")) cout << "d3d9.h not found" << endl;
1916 } else if (part == "WMSDK") {
1917 available = findFile("wmsdk.h");
1918 } else if (part == "V8SNAPSHOT") {
1920 } else if (part == "AUDIO_BACKEND") {
1922 } else if (part == "DIRECTWRITE") {
1923 available = findFile("dwrite.h") && findFile("d2d1.h") && findFile("dwrite.lib");
1930 Autodetect options marked as "auto".
1932 void Configure::autoDetection()
1935 if (dictionary["STYLE_WINDOWSXP"] == "auto")
1936 dictionary["STYLE_WINDOWSXP"] = checkAvailability("STYLE_WINDOWSXP") ? defaultTo("STYLE_WINDOWSXP") : "no";
1937 if (dictionary["STYLE_WINDOWSVISTA"] == "auto") // Vista style has the same requirements as XP style
1938 dictionary["STYLE_WINDOWSVISTA"] = checkAvailability("STYLE_WINDOWSXP") ? defaultTo("STYLE_WINDOWSVISTA") : "no";
1940 // Compression detection
1941 if (dictionary["ZLIB"] == "auto")
1942 dictionary["ZLIB"] = checkAvailability("ZLIB") ? defaultTo("ZLIB") : "qt";
1945 if (dictionary["PCRE"] == "auto")
1946 dictionary["PCRE"] = checkAvailability("PCRE") ? defaultTo("PCRE") : "qt";
1949 if (dictionary["ICU"] == "auto")
1950 dictionary["ICU"] = checkAvailability("ICU") ? "yes" : "no";
1952 // Image format detection
1953 if (dictionary["GIF"] == "auto")
1954 dictionary["GIF"] = defaultTo("GIF");
1955 if (dictionary["JPEG"] == "auto")
1956 dictionary["JPEG"] = defaultTo("JPEG");
1957 if (dictionary["PNG"] == "auto")
1958 dictionary["PNG"] = defaultTo("PNG");
1959 if (dictionary["LIBJPEG"] == "auto")
1960 dictionary["LIBJPEG"] = checkAvailability("LIBJPEG") ? defaultTo("LIBJPEG") : "qt";
1961 if (dictionary["LIBPNG"] == "auto")
1962 dictionary["LIBPNG"] = checkAvailability("LIBPNG") ? defaultTo("LIBPNG") : "qt";
1964 // SQL detection (not on by default)
1965 if (dictionary["SQL_MYSQL"] == "auto")
1966 dictionary["SQL_MYSQL"] = checkAvailability("SQL_MYSQL") ? defaultTo("SQL_MYSQL") : "no";
1967 if (dictionary["SQL_ODBC"] == "auto")
1968 dictionary["SQL_ODBC"] = checkAvailability("SQL_ODBC") ? defaultTo("SQL_ODBC") : "no";
1969 if (dictionary["SQL_OCI"] == "auto")
1970 dictionary["SQL_OCI"] = checkAvailability("SQL_OCI") ? defaultTo("SQL_OCI") : "no";
1971 if (dictionary["SQL_PSQL"] == "auto")
1972 dictionary["SQL_PSQL"] = checkAvailability("SQL_PSQL") ? defaultTo("SQL_PSQL") : "no";
1973 if (dictionary["SQL_TDS"] == "auto")
1974 dictionary["SQL_TDS"] = checkAvailability("SQL_TDS") ? defaultTo("SQL_TDS") : "no";
1975 if (dictionary["SQL_DB2"] == "auto")
1976 dictionary["SQL_DB2"] = checkAvailability("SQL_DB2") ? defaultTo("SQL_DB2") : "no";
1977 if (dictionary["SQL_SQLITE"] == "auto")
1978 dictionary["SQL_SQLITE"] = checkAvailability("SQL_SQLITE") ? defaultTo("SQL_SQLITE") : "no";
1979 if (dictionary["SQL_SQLITE_LIB"] == "system")
1980 if (!checkAvailability("SQL_SQLITE_LIB"))
1981 dictionary["SQL_SQLITE_LIB"] = "no";
1982 if (dictionary["SQL_SQLITE2"] == "auto")
1983 dictionary["SQL_SQLITE2"] = checkAvailability("SQL_SQLITE2") ? defaultTo("SQL_SQLITE2") : "no";
1984 if (dictionary["SQL_IBASE"] == "auto")
1985 dictionary["SQL_IBASE"] = checkAvailability("SQL_IBASE") ? defaultTo("SQL_IBASE") : "no";
1986 if (dictionary["MMX"] == "auto")
1987 dictionary["MMX"] = checkAvailability("MMX") ? "yes" : "no";
1988 if (dictionary["3DNOW"] == "auto")
1989 dictionary["3DNOW"] = checkAvailability("3DNOW") ? "yes" : "no";
1990 if (dictionary["SSE"] == "auto")
1991 dictionary["SSE"] = checkAvailability("SSE") ? "yes" : "no";
1992 if (dictionary["SSE2"] == "auto")
1993 dictionary["SSE2"] = checkAvailability("SSE2") ? "yes" : "no";
1994 if (dictionary["IWMMXT"] == "auto")
1995 dictionary["IWMMXT"] = checkAvailability("IWMMXT") ? "yes" : "no";
1996 if (dictionary["OPENSSL"] == "auto")
1997 dictionary["OPENSSL"] = checkAvailability("OPENSSL") ? "yes" : "no";
1998 if (dictionary["DBUS"] == "auto")
1999 dictionary["DBUS"] = checkAvailability("DBUS") ? "yes" : "no";
2000 if (dictionary["V8SNAPSHOT"] == "auto")
2001 dictionary["V8SNAPSHOT"] = (dictionary["V8"] == "yes") && checkAvailability("V8SNAPSHOT") ? "yes" : "no";
2002 if (dictionary["QML_DEBUG"] == "auto")
2003 dictionary["QML_DEBUG"] = dictionary["QML"] == "yes" ? "yes" : "no";
2004 if (dictionary["AUDIO_BACKEND"] == "auto")
2005 dictionary["AUDIO_BACKEND"] = checkAvailability("AUDIO_BACKEND") ? "yes" : "no";
2006 if (dictionary["WMSDK"] == "auto")
2007 dictionary["WMSDK"] = checkAvailability("WMSDK") ? "yes" : "no";
2009 // Qt/WinCE remote test application
2010 if (dictionary["CETEST"] == "auto")
2011 dictionary["CETEST"] = checkAvailability("CETEST") ? "yes" : "no";
2013 // Detection of IncrediBuild buildconsole
2014 if (dictionary["INCREDIBUILD_XGE"] == "auto")
2015 dictionary["INCREDIBUILD_XGE"] = checkAvailability("INCREDIBUILD_XGE") ? "yes" : "no";
2017 // Mark all unknown "auto" to the default value..
2018 for (QMap<QString,QString>::iterator i = dictionary.begin(); i != dictionary.end(); ++i) {
2019 if (i.value() == "auto")
2020 i.value() = defaultTo(i.key());
2024 bool Configure::verifyConfiguration()
2026 if (dictionary["SQL_SQLITE_LIB"] == "no" && dictionary["SQL_SQLITE"] != "no") {
2027 cout << "WARNING: Configure could not detect the presence of a system SQLite3 lib." << endl
2028 << "Configure will therefore continue with the SQLite3 lib bundled with Qt." << endl
2029 << "(Press any key to continue..)";
2030 if (_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
2031 exit(0); // Exit cleanly for Ctrl+C
2033 dictionary["SQL_SQLITE_LIB"] = "qt"; // Set to Qt's bundled lib an continue
2035 if (dictionary["QMAKESPEC"].endsWith("-g++")
2036 && dictionary["SQL_OCI"] != "no") {
2037 cout << "WARNING: Qt does not support compiling the Oracle database driver with" << endl
2038 << "MinGW, due to lack of such support from Oracle. Consider disabling the" << endl
2039 << "Oracle driver, as the current build will most likely fail." << endl;
2040 cout << "(Press any key to continue..)";
2041 if (_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
2042 exit(0); // Exit cleanly for Ctrl+C
2044 if (dictionary["QMAKESPEC"].endsWith("win32-msvc.net")) {
2045 cout << "WARNING: The makespec win32-msvc.net is deprecated. Consider using" << endl
2046 << "win32-msvc2002 or win32-msvc2003 instead." << endl;
2047 cout << "(Press any key to continue..)";
2048 if (_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
2049 exit(0); // Exit cleanly for Ctrl+C
2051 if (0 != dictionary["ARM_FPU_TYPE"].size()) {
2052 QStringList l= QStringList()
2056 if (!(l.contains(dictionary["ARM_FPU_TYPE"])))
2057 cout << QString("WARNING: Using unsupported fpu flag: %1").arg(dictionary["ARM_FPU_TYPE"]) << endl;
2059 if (dictionary["DIRECTWRITE"] == "yes" && !checkAvailability("DIRECTWRITE")) {
2060 cout << "WARNING: To be able to compile the DirectWrite font engine you will" << endl
2061 << "need the Microsoft DirectWrite and Microsoft Direct2D development" << endl
2062 << "files such as headers and libraries." << endl
2063 << "(Press any key to continue..)";
2064 if (_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
2065 exit(0); // Exit cleanly for Ctrl+C
2072 Things that affect the Qt API/ABI:
2074 minimal-config small-config medium-config large-config full-config
2080 Things that do not affect the Qt API/ABI:
2081 system-jpeg no-jpeg jpeg
2082 system-png no-png png
2083 system-zlib no-zlib zlib
2094 X11 : x11sm xinerama xcursor xfixes xrandr xrender fontconfig xkb
2095 Embedded: embedded freetype
2097 void Configure::generateBuildKey()
2099 QString spec = dictionary["QMAKESPEC"];
2101 QString compiler = "msvc"; // ICC is compatible
2102 if (spec.endsWith("-g++"))
2104 else if (spec.endsWith("-borland"))
2105 compiler = "borland";
2107 // Build options which changes the Qt API/ABI
2108 QStringList build_options;
2109 if (!dictionary["QCONFIG"].isEmpty())
2110 build_options += dictionary["QCONFIG"] + "-config ";
2111 build_options.sort();
2113 // Sorted defines that start with QT_NO_
2114 QStringList build_defines = qmakeDefines.filter(QRegExp("^QT_NO_"));
2115 build_defines.sort();
2118 void Configure::generateOutputVars()
2120 // Generate variables for output
2121 QString build = dictionary[ "BUILD" ];
2122 bool buildAll = (dictionary[ "BUILDALL" ] == "yes");
2123 if (build == "debug") {
2125 qtConfig += "release";
2126 qtConfig += "debug";
2127 } else if (build == "release") {
2129 qtConfig += "debug";
2130 qtConfig += "release";
2133 if (dictionary[ "WIDGETS" ] == "no")
2134 qtConfig += "no-widgets";
2136 // Compression --------------------------------------------------
2137 if (dictionary[ "ZLIB" ] == "qt")
2139 else if (dictionary[ "ZLIB" ] == "system")
2140 qtConfig += "system-zlib";
2142 // PCRE ---------------------------------------------------------
2143 if (dictionary[ "PCRE" ] == "qt")
2144 qmakeConfig += "pcre";
2146 // ICU ---------------------------------------------------------
2147 if (dictionary[ "ICU" ] == "yes")
2150 // Image formates -----------------------------------------------
2151 if (dictionary[ "GIF" ] == "no")
2152 qtConfig += "no-gif";
2153 else if (dictionary[ "GIF" ] == "yes")
2156 if (dictionary[ "JPEG" ] == "no")
2157 qtConfig += "no-jpeg";
2158 else if (dictionary[ "JPEG" ] == "yes")
2160 if (dictionary[ "LIBJPEG" ] == "system")
2161 qtConfig += "system-jpeg";
2163 if (dictionary[ "PNG" ] == "no")
2164 qtConfig += "no-png";
2165 else if (dictionary[ "PNG" ] == "yes")
2167 if (dictionary[ "LIBPNG" ] == "system")
2168 qtConfig += "system-png";
2170 // Text rendering --------------------------------------------------
2171 if (dictionary[ "FREETYPE" ] == "yes")
2172 qtConfig += "freetype";
2174 // Styles -------------------------------------------------------
2175 if (dictionary[ "STYLE_WINDOWS" ] == "yes")
2176 qmakeStyles += "windows";
2178 if (dictionary[ "STYLE_PLASTIQUE" ] == "yes")
2179 qmakeStyles += "plastique";
2181 if (dictionary[ "STYLE_CLEANLOOKS" ] == "yes")
2182 qmakeStyles += "cleanlooks";
2184 if (dictionary[ "STYLE_WINDOWSXP" ] == "yes")
2185 qmakeStyles += "windowsxp";
2187 if (dictionary[ "STYLE_WINDOWSVISTA" ] == "yes")
2188 qmakeStyles += "windowsvista";
2190 if (dictionary[ "STYLE_MOTIF" ] == "yes")
2191 qmakeStyles += "motif";
2193 if (dictionary[ "STYLE_SGI" ] == "yes")
2194 qmakeStyles += "sgi";
2196 if (dictionary[ "STYLE_WINDOWSCE" ] == "yes")
2197 qmakeStyles += "windowsce";
2199 if (dictionary[ "STYLE_WINDOWSMOBILE" ] == "yes")
2200 qmakeStyles += "windowsmobile";
2202 if (dictionary[ "STYLE_CDE" ] == "yes")
2203 qmakeStyles += "cde";
2205 // Databases ----------------------------------------------------
2206 if (dictionary[ "SQL_MYSQL" ] == "yes")
2207 qmakeSql += "mysql";
2208 else if (dictionary[ "SQL_MYSQL" ] == "plugin")
2209 qmakeSqlPlugins += "mysql";
2211 if (dictionary[ "SQL_ODBC" ] == "yes")
2213 else if (dictionary[ "SQL_ODBC" ] == "plugin")
2214 qmakeSqlPlugins += "odbc";
2216 if (dictionary[ "SQL_OCI" ] == "yes")
2218 else if (dictionary[ "SQL_OCI" ] == "plugin")
2219 qmakeSqlPlugins += "oci";
2221 if (dictionary[ "SQL_PSQL" ] == "yes")
2223 else if (dictionary[ "SQL_PSQL" ] == "plugin")
2224 qmakeSqlPlugins += "psql";
2226 if (dictionary[ "SQL_TDS" ] == "yes")
2228 else if (dictionary[ "SQL_TDS" ] == "plugin")
2229 qmakeSqlPlugins += "tds";
2231 if (dictionary[ "SQL_DB2" ] == "yes")
2233 else if (dictionary[ "SQL_DB2" ] == "plugin")
2234 qmakeSqlPlugins += "db2";
2236 if (dictionary[ "SQL_SQLITE" ] == "yes")
2237 qmakeSql += "sqlite";
2238 else if (dictionary[ "SQL_SQLITE" ] == "plugin")
2239 qmakeSqlPlugins += "sqlite";
2241 if (dictionary[ "SQL_SQLITE_LIB" ] == "system")
2242 qmakeConfig += "system-sqlite";
2244 if (dictionary[ "SQL_SQLITE2" ] == "yes")
2245 qmakeSql += "sqlite2";
2246 else if (dictionary[ "SQL_SQLITE2" ] == "plugin")
2247 qmakeSqlPlugins += "sqlite2";
2249 if (dictionary[ "SQL_IBASE" ] == "yes")
2250 qmakeSql += "ibase";
2251 else if (dictionary[ "SQL_IBASE" ] == "plugin")
2252 qmakeSqlPlugins += "ibase";
2254 // Other options ------------------------------------------------
2255 if (dictionary[ "BUILDALL" ] == "yes") {
2256 qtConfig += "build_all";
2258 qmakeConfig += dictionary[ "BUILD" ];
2259 dictionary[ "QMAKE_OUTDIR" ] = dictionary[ "BUILD" ];
2261 if (buildParts.isEmpty()) {
2262 buildParts = defaultBuildParts;
2264 if (dictionary["BUILDDEV"] == "yes")
2265 buildParts += "tests";
2267 while (!nobuildParts.isEmpty())
2268 buildParts.removeAll(nobuildParts.takeFirst());
2269 if (!buildParts.contains("libs"))
2270 buildParts += "libs";
2271 buildParts.removeDuplicates();
2273 if (dictionary["MSVC_MP"] == "yes")
2274 qmakeConfig += "msvc_mp";
2276 if (dictionary[ "SHARED" ] == "yes") {
2277 QString version = dictionary[ "VERSION" ];
2278 if (!version.isEmpty()) {
2279 qmakeVars += "QMAKE_QT_VERSION_OVERRIDE = " + version.left(version.indexOf("."));
2280 version.remove(QLatin1Char('.'));
2282 dictionary[ "QMAKE_OUTDIR" ] += "_shared";
2284 dictionary[ "QMAKE_OUTDIR" ] += "_static";
2287 if (dictionary[ "ACCESSIBILITY" ] == "yes")
2288 qtConfig += "accessibility";
2290 if (!qmakeLibs.isEmpty())
2291 qmakeVars += "LIBS += " + escapeSeparators(qmakeLibs.join(" "));
2293 if (!dictionary["QT_LFLAGS_SQLITE"].isEmpty())
2294 qmakeVars += "QT_LFLAGS_SQLITE += " + escapeSeparators(dictionary["QT_LFLAGS_SQLITE"]);
2296 if (dictionary[ "OPENGL" ] == "yes")
2297 qtConfig += "opengl";
2299 if (dictionary["OPENGL_ES_CM"] == "yes") {
2300 qtConfig += "opengles1";
2304 if (dictionary["OPENGL_ES_2"] == "yes") {
2305 qtConfig += "opengles2";
2309 if (dictionary["OPENVG"] == "yes") {
2310 qtConfig += "openvg";
2315 if (dictionary["DIRECTSHOW"] == "yes")
2316 qtConfig += "directshow";
2318 if (dictionary[ "OPENSSL" ] == "yes")
2319 qtConfig += "openssl";
2320 else if (dictionary[ "OPENSSL" ] == "linked")
2321 qtConfig += "openssl-linked";
2323 if (dictionary[ "DBUS" ] == "yes")
2325 else if (dictionary[ "DBUS" ] == "linked")
2326 qtConfig += "dbus dbus-linked";
2328 if (dictionary[ "CETEST" ] == "yes")
2329 qtConfig += "cetest";
2332 if (dictionary["PHONON_BACKEND"] == "yes")
2333 qtConfig += "phonon-backend";
2336 if (dictionary["AUDIO_BACKEND"] == "yes")
2337 qtConfig += "audio-backend";
2339 if (dictionary["DIRECTWRITE"] == "yes")
2340 qtConfig += "directwrite";
2342 if (dictionary[ "NATIVE_GESTURES" ] == "yes")
2343 qtConfig += "native-gestures";
2345 // We currently have no switch for QtConcurrent, so add it unconditionally.
2346 qtConfig += "concurrent";
2349 if (dictionary[ "V8SNAPSHOT" ] == "yes")
2350 qtConfig += "v8snapshot";
2352 // Add config levels --------------------------------------------
2353 QStringList possible_configs = QStringList()
2360 QString set_config = dictionary["QCONFIG"];
2361 if (possible_configs.contains(set_config)) {
2362 foreach (const QString &cfg, possible_configs) {
2363 qtConfig += (cfg + "-config");
2364 if (cfg == set_config)
2369 if (dictionary.contains("XQMAKESPEC") && (dictionary["QMAKESPEC"] != dictionary["XQMAKESPEC"])) {
2370 qmakeConfig += "cross_compile";
2371 dictionary["CROSS_COMPILE"] = "yes";
2374 // Directories and settings for .qmake.cache --------------------
2376 // if QT_INSTALL_* have not been specified on commandline, define them now from QT_INSTALL_PREFIX
2377 // if prefix is empty (WINCE), make all of them empty, if they aren't set
2378 bool qipempty = false;
2379 if (dictionary[ "QT_INSTALL_PREFIX" ].isEmpty())
2382 if (!dictionary[ "QT_INSTALL_DOCS" ].size())
2383 dictionary[ "QT_INSTALL_DOCS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/doc");
2384 if (!dictionary[ "QT_INSTALL_HEADERS" ].size())
2385 dictionary[ "QT_INSTALL_HEADERS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/include");
2386 if (!dictionary[ "QT_INSTALL_LIBS" ].size())
2387 dictionary[ "QT_INSTALL_LIBS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/lib");
2388 if (!dictionary[ "QT_INSTALL_BINS" ].size())
2389 dictionary[ "QT_INSTALL_BINS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/bin");
2390 if (!dictionary[ "QT_INSTALL_PLUGINS" ].size())
2391 dictionary[ "QT_INSTALL_PLUGINS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/plugins");
2392 if (!dictionary[ "QT_INSTALL_IMPORTS" ].size())
2393 dictionary[ "QT_INSTALL_IMPORTS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/imports");
2394 if (!dictionary[ "QT_INSTALL_DATA" ].size())
2395 dictionary[ "QT_INSTALL_DATA" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ]);
2396 if (!dictionary[ "QT_INSTALL_TRANSLATIONS" ].size())
2397 dictionary[ "QT_INSTALL_TRANSLATIONS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/translations");
2398 if (!dictionary[ "QT_INSTALL_EXAMPLES" ].size())
2399 dictionary[ "QT_INSTALL_EXAMPLES" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/examples");
2400 if (!dictionary[ "QT_INSTALL_TESTS" ].size())
2401 dictionary[ "QT_INSTALL_TESTS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/tests");
2403 bool haveHpx = false;
2404 if (dictionary[ "QT_HOST_PREFIX" ].isEmpty())
2405 dictionary[ "QT_HOST_PREFIX" ] = dictionary[ "QT_INSTALL_PREFIX" ];
2408 if (dictionary[ "QT_HOST_BINS" ].isEmpty())
2409 dictionary[ "QT_HOST_BINS" ] = haveHpx ? fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/bin") : dictionary[ "QT_INSTALL_BINS" ];
2410 if (dictionary[ "QT_HOST_DATA" ].isEmpty())
2411 dictionary[ "QT_HOST_DATA" ] = haveHpx ? dictionary[ "QT_HOST_PREFIX" ] : dictionary[ "QT_INSTALL_DATA" ];
2413 if (dictionary.contains("XQMAKESPEC") && dictionary[ "XQMAKESPEC" ].startsWith("linux"))
2414 dictionary[ "QMAKE_RPATHDIR" ] = dictionary[ "QT_INSTALL_LIBS" ];
2416 qmakeVars += QString("OBJECTS_DIR = ") + fixSeparators("tmp/obj/" + dictionary[ "QMAKE_OUTDIR" ], true);
2417 qmakeVars += QString("MOC_DIR = ") + fixSeparators("tmp/moc/" + dictionary[ "QMAKE_OUTDIR" ], true);
2418 qmakeVars += QString("RCC_DIR = ") + fixSeparators("tmp/rcc/" + dictionary["QMAKE_OUTDIR"], true);
2420 if (!qmakeDefines.isEmpty())
2421 qmakeVars += QString("DEFINES += ") + qmakeDefines.join(" ");
2422 if (!qmakeIncludes.isEmpty())
2423 qmakeVars += QString("INCLUDEPATH += ") + escapeSeparators(qmakeIncludes.join(" "));
2424 if (!opensslLibs.isEmpty())
2425 qmakeVars += opensslLibs;
2426 else if (dictionary[ "OPENSSL" ] == "linked")
2427 qmakeVars += QString("OPENSSL_LIBS = -lssleay32 -llibeay32");
2428 if (!psqlLibs.isEmpty())
2429 qmakeVars += QString("QT_LFLAGS_PSQL=") + psqlLibs.section("=", 1);
2432 QStringList lflagsTDS;
2433 if (!sybase.isEmpty())
2434 lflagsTDS += QString("-L") + fixSeparators(sybase.section("=", 1) + "/lib");
2435 if (!sybaseLibs.isEmpty())
2436 lflagsTDS += sybaseLibs.section("=", 1);
2437 if (!lflagsTDS.isEmpty())
2438 qmakeVars += QString("QT_LFLAGS_TDS=") + lflagsTDS.join(" ");
2441 if (!qmakeSql.isEmpty())
2442 qmakeVars += QString("sql-drivers += ") + qmakeSql.join(" ");
2443 if (!qmakeSqlPlugins.isEmpty())
2444 qmakeVars += QString("sql-plugins += ") + qmakeSqlPlugins.join(" ");
2445 if (!qmakeStyles.isEmpty())
2446 qmakeVars += QString("styles += ") + qmakeStyles.join(" ");
2447 if (!qmakeStylePlugins.isEmpty())
2448 qmakeVars += QString("style-plugins += ") + qmakeStylePlugins.join(" ");
2450 if (dictionary["QMAKESPEC"].endsWith("-g++")) {
2451 QString includepath = qgetenv("INCLUDE");
2452 bool hasSh = Environment::detectExecutable("sh.exe");
2453 QChar separator = (!includepath.contains(":\\") && hasSh ? QChar(':') : QChar(';'));
2454 qmakeVars += QString("TMPPATH = $$quote($$(INCLUDE))");
2455 qmakeVars += QString("QMAKE_INCDIR_POST += $$split(TMPPATH,\"%1\")").arg(separator);
2456 qmakeVars += QString("TMPPATH = $$quote($$(LIB))");
2457 qmakeVars += QString("QMAKE_LIBDIR_POST += $$split(TMPPATH,\"%1\")").arg(separator);
2460 if (!dictionary[ "QMAKESPEC" ].length()) {
2461 cout << "Configure could not detect your compiler. QMAKESPEC must either" << endl
2462 << "be defined as an environment variable, or specified as an" << endl
2463 << "argument with -platform" << endl;
2464 dictionary[ "HELP" ] = "yes";
2466 QStringList winPlatforms;
2467 QDir mkspecsDir(sourcePath + "/mkspecs");
2468 const QFileInfoList &specsList = mkspecsDir.entryInfoList();
2469 for (int i = 0; i < specsList.size(); ++i) {
2470 const QFileInfo &fi = specsList.at(i);
2471 if (fi.fileName().left(5) == "win32") {
2472 winPlatforms += fi.fileName();
2475 cout << "Available platforms are: " << qPrintable(winPlatforms.join(", ")) << endl;
2476 dictionary[ "DONE" ] = "error";
2481 void Configure::generateCachefile()
2483 // Generate .qmake.cache
2484 QFile cacheFile(buildPath + "/.qmake.cache");
2485 if (cacheFile.open(QFile::WriteOnly | QFile::Text)) { // Truncates any existing file.
2486 QTextStream cacheStream(&cacheFile);
2488 cacheStream << "include($$PWD/mkspecs/qmodule.pri)" << endl;
2490 for (QStringList::Iterator var = qmakeVars.begin(); var != qmakeVars.end(); ++var) {
2491 cacheStream << (*var) << endl;
2493 cacheStream << "CONFIG += " << qmakeConfig.join(" ") << "depend_includepath no_private_qt_headers_warning QTDIR_build" << endl;
2495 cacheStream.flush();
2499 // Generate qmodule.pri
2500 QFile moduleFile(dictionary[ "QT_BUILD_TREE" ] + "/mkspecs/qmodule.pri");
2501 if (moduleFile.open(QFile::WriteOnly | QFile::Text)) { // Truncates any existing file.
2502 QTextStream moduleStream(&moduleFile);
2504 moduleStream << "#paths" << endl;
2505 moduleStream << "QT_BUILD_TREE = " << fixSeparators(dictionary[ "QT_BUILD_TREE" ], true) << endl;
2506 moduleStream << "QT_SOURCE_TREE = " << fixSeparators(dictionary[ "QT_SOURCE_TREE" ], true) << endl;
2507 moduleStream << "QT_BUILD_PARTS = " << buildParts.join(" ") << endl << endl;
2509 //so that we can build without an install first (which would be impossible)
2510 moduleStream << "#local paths that cannot be queried from the QT_INSTALL_* properties while building QTDIR" << endl;
2511 moduleStream << "QMAKE_INCDIR_QT = $$QT_BUILD_TREE" << fixSeparators("/include", true) << endl;
2512 moduleStream << "QMAKE_LIBDIR_QT = $$QT_BUILD_TREE" << fixSeparators("/lib", true) << endl;
2515 QString targetSpec = dictionary.contains("XQMAKESPEC") ? dictionary[ "XQMAKESPEC" ] : dictionary[ "QMAKESPEC" ];
2516 QString mkspec_path = fixSeparators(sourcePath + "/mkspecs/" + targetSpec);
2517 if (QFile::exists(mkspec_path))
2518 moduleStream << "QMAKESPEC = " << escapeSeparators(mkspec_path) << endl;
2520 moduleStream << "QMAKESPEC = " << fixSeparators(targetSpec, true) << endl;
2522 if (dictionary["QT_EDITION"] != "QT_EDITION_OPENSOURCE")
2523 moduleStream << "DEFINES *= QT_EDITION=QT_EDITION_DESKTOP" << endl;
2525 if (dictionary["CETEST"] == "yes") {
2526 moduleStream << "QT_CE_RAPI_INC = " << fixSeparators(dictionary[ "QT_CE_RAPI_INC" ], true) << endl;
2527 moduleStream << "QT_CE_RAPI_LIB = " << fixSeparators(dictionary[ "QT_CE_RAPI_LIB" ], true) << endl;
2530 moduleStream << "#Qt for Windows CE c-runtime deployment" << endl
2531 << "QT_CE_C_RUNTIME = " << fixSeparators(dictionary[ "CE_CRT" ], true) << endl;
2533 if (dictionary["CE_SIGNATURE"] != QLatin1String("no"))
2534 moduleStream << "DEFAULT_SIGNATURE=" << dictionary["CE_SIGNATURE"] << endl;
2536 if (!dictionary["QMAKE_RPATHDIR"].isEmpty())
2537 moduleStream << "QMAKE_RPATHDIR += " << dictionary["QMAKE_RPATHDIR"] << endl;
2539 if (!dictionary["QT_LIBINFIX"].isEmpty())
2540 moduleStream << "QT_LIBINFIX = " << dictionary["QT_LIBINFIX"] << endl;
2542 if (!dictionary["QT_NAMESPACE"].isEmpty()) {
2543 moduleStream << "#namespaces" << endl << "QT_NAMESPACE = " << dictionary["QT_NAMESPACE"] << endl;
2547 if (!dictionary["KBD_DRIVERS"].isEmpty())
2548 moduleStream << "kbd-drivers += "<< dictionary["KBD_DRIVERS"]<<endl;
2549 if (!dictionary["GFX_DRIVERS"].isEmpty())
2550 moduleStream << "gfx-drivers += "<< dictionary["GFX_DRIVERS"]<<endl;
2551 if (!dictionary["MOUSE_DRIVERS"].isEmpty())
2552 moduleStream << "mouse-drivers += "<< dictionary["MOUSE_DRIVERS"]<<endl;
2553 if (!dictionary["DECORATIONS"].isEmpty())
2554 moduleStream << "decorations += "<<dictionary["DECORATIONS"]<<endl;
2556 if (!dictionary["QMAKE_RPATHDIR"].isEmpty())
2557 moduleStream << "QMAKE_RPATHDIR += "<<dictionary["QMAKE_RPATHDIR"]<<endl;
2559 moduleStream << "CONFIG += create_prl link_prl" << endl;
2561 moduleStream.flush();
2567 Runs qmake on config.tests/arch/arch.pro, which will detect the target arch
2568 for the compiler we are using
2570 void Configure::detectArch()
2572 QString oldpwd = QDir::currentPath();
2574 QString newpwd = fixSeparators(QString("%1/config.tests/arch").arg(buildPath));
2575 if (!QDir().exists(newpwd) && !QDir().mkpath(newpwd)) {
2576 cout << "Failed to create directory " << qPrintable(newpwd) << endl;
2577 dictionary["DONE"] = "error";
2580 if (!QDir::setCurrent(newpwd)) {
2581 cout << "Failed to change working directory to " << qPrintable(newpwd) << endl;
2582 dictionary["DONE"] = "error";
2586 QList<QPair<QString, QString> > qmakespecs;
2587 if (dictionary.contains("XQMAKESPEC"))
2588 qmakespecs << qMakePair(QString("XQMAKESPEC"), QString("QT_ARCH"));
2589 qmakespecs << qMakePair(QString("QMAKESPEC"), QString("QT_HOST_ARCH"));
2591 for (int i = 0; i < qmakespecs.count(); ++i) {
2592 const QPair<QString, QString> &pair = qmakespecs.at(i);
2593 QString qmakespec = dictionary.value(pair.first);
2594 QString key = pair.second;
2597 fixSeparators(QString("%1/bin/qmake.exe -spec %2 %3/config.tests/arch/arch.pro -o %4/Makefile.unused 2>&1")
2598 .arg(buildPath, qmakespec, sourcePath, newpwd));
2599 QString output = Environment::execute(command);
2600 if (output.isEmpty())
2603 QRegExp re("Project MESSAGE:.*Architecture: ([a-zA-Z0-9_]*)");
2604 if (re.indexIn(output) != -1)
2605 dictionary[key] = re.cap(1);
2608 if (!dictionary.contains("QT_HOST_ARCH"))
2609 dictionary["QT_HOST_ARCH"] = "unknown";
2610 if (!dictionary.contains("QT_ARCH"))
2611 dictionary["QT_ARCH"] = dictionary["QT_HOST_ARCH"];
2613 QDir::setCurrent(oldpwd);
2616 void Configure::generateQConfigPri()
2618 // Generate qconfig.pri
2619 QFile configFile(dictionary[ "QT_BUILD_TREE" ] + "/mkspecs/qconfig.pri");
2620 if (configFile.open(QFile::WriteOnly | QFile::Text)) { // Truncates any existing file.
2621 QTextStream configStream(&configFile);
2623 configStream << "CONFIG+= ";
2624 configStream << dictionary[ "BUILD" ];
2625 if (dictionary[ "SHARED" ] == "yes")
2626 configStream << " shared";
2628 configStream << " static";
2630 if (dictionary[ "LTCG" ] == "yes")
2631 configStream << " ltcg";
2632 if (dictionary[ "STL" ] == "yes")
2633 configStream << " stl";
2634 if (dictionary[ "EXCEPTIONS" ] == "yes")
2635 configStream << " exceptions";
2636 if (dictionary[ "EXCEPTIONS" ] == "no")
2637 configStream << " exceptions_off";
2638 if (dictionary[ "RTTI" ] == "yes")
2639 configStream << " rtti";
2640 if (dictionary[ "MMX" ] == "yes")
2641 configStream << " mmx";
2642 if (dictionary[ "3DNOW" ] == "yes")
2643 configStream << " 3dnow";
2644 if (dictionary[ "SSE" ] == "yes")
2645 configStream << " sse";
2646 if (dictionary[ "SSE2" ] == "yes")
2647 configStream << " sse2";
2648 if (dictionary[ "IWMMXT" ] == "yes")
2649 configStream << " iwmmxt";
2650 if (dictionary["INCREDIBUILD_XGE"] == "yes")
2651 configStream << " incredibuild_xge";
2652 if (dictionary["PLUGIN_MANIFESTS"] == "no")
2653 configStream << " no_plugin_manifest";
2654 if (dictionary["CROSS_COMPILE"] == "yes")
2655 configStream << " cross_compile";
2657 if (dictionary["DIRECTWRITE"] == "yes")
2658 configStream << "directwrite";
2660 // ### For compatibility only, should be removed later.
2661 configStream << " qpa";
2663 configStream << endl;
2664 configStream << "QT_ARCH = " << dictionary["QT_ARCH"] << endl;
2665 configStream << "QT_HOST_ARCH = " << dictionary["QT_HOST_ARCH"] << endl;
2666 if (dictionary["QT_EDITION"].contains("OPENSOURCE"))
2667 configStream << "QT_EDITION = " << QLatin1String("OpenSource") << endl;
2669 configStream << "QT_EDITION = " << dictionary["EDITION"] << endl;
2670 configStream << "QT_CONFIG += " << qtConfig.join(" ") << endl;
2672 configStream << "#versioning " << endl
2673 << "QT_VERSION = " << dictionary["VERSION"] << endl
2674 << "QT_MAJOR_VERSION = " << dictionary["VERSION_MAJOR"] << endl
2675 << "QT_MINOR_VERSION = " << dictionary["VERSION_MINOR"] << endl
2676 << "QT_PATCH_VERSION = " << dictionary["VERSION_PATCH"] << endl;
2678 if (!dictionary["CFG_SYSROOT"].isEmpty()) {
2679 QString targetSpec = dictionary.contains("XQMAKESPEC") ? dictionary[ "XQMAKESPEC" ] : dictionary[ "QMAKESPEC" ];
2680 configStream << endl
2681 << "# sysroot" << endl
2682 << targetSpec << " {" << endl
2683 << " QMAKE_CFLAGS += --sysroot=$$[QT_SYSROOT]" << endl
2684 << " QMAKE_CXXFLAGS += --sysroot=$$[QT_SYSROOT]" << endl
2685 << " QMAKE_LFLAGS += --sysroot=$$[QT_SYSROOT]" << endl
2689 configStream.flush();
2695 QString Configure::addDefine(QString def)
2697 QString result, defNeg, defD = def;
2699 defD.replace(QRegExp("=.*"), "");
2700 def.replace(QRegExp("="), " ");
2702 if (def.startsWith("QT_NO_")) {
2704 defNeg.replace("QT_NO_", "QT_");
2705 } else if (def.startsWith("QT_")) {
2707 defNeg.replace("QT_", "QT_NO_");
2710 if (defNeg.isEmpty()) {
2711 result = "#ifndef $DEFD\n"
2715 result = "#if defined($DEFD) && defined($DEFNEG)\n"
2717 "#elif !defined($DEFD)\n"
2721 result.replace("$DEFNEG", defNeg);
2722 result.replace("$DEFD", defD);
2723 result.replace("$DEF", def);
2728 bool Configure::copySpec(const char *name, const char *pfx, const QString &spec)
2730 // Copy configured mkspec to default directory, but remove the old one first, if there is any
2731 QString defSpec = buildPath + "/mkspecs/" + name;
2732 QFileInfo defSpecInfo(defSpec);
2733 if (defSpecInfo.exists()) {
2734 if (!Environment::rmdir(defSpec)) {
2735 cout << "Couldn't update default " << pfx << "mkspec! Are files in " << qPrintable(defSpec) << " read-only?" << endl;
2736 dictionary["DONE"] = "error";
2741 QString pltSpec = sourcePath + "/mkspecs/" + spec;
2742 QString includeSpec = buildPath + "/mkspecs/" + spec;
2743 if (!Environment::cpdir(pltSpec, defSpec, includeSpec)) {
2744 cout << "Couldn't update default " << pfx << "mkspec! Does " << qPrintable(pltSpec) << " exist?" << endl;
2745 dictionary["DONE"] = "error";
2751 void Configure::generateConfigfiles()
2753 QDir(buildPath).mkpath("src/corelib/global");
2754 QString outName(buildPath + "/src/corelib/global/qconfig.h");
2755 QTemporaryFile tmpFile;
2756 QTextStream tmpStream;
2758 if (tmpFile.open()) {
2759 tmpStream.setDevice(&tmpFile);
2761 if (dictionary[ "QCONFIG" ] == "full") {
2762 tmpStream << "/* Everything */" << endl;
2764 QString configName("qconfig-" + dictionary[ "QCONFIG" ] + ".h");
2765 tmpStream << "/* Copied from " << configName << "*/" << endl;
2766 tmpStream << "#ifndef QT_BOOTSTRAPPED" << endl;
2767 QFile inFile(sourcePath + "/src/corelib/global/" + configName);
2768 if (inFile.open(QFile::ReadOnly)) {
2769 QByteArray buffer = inFile.readAll();
2770 tmpFile.write(buffer.constData(), buffer.size());
2773 tmpStream << "#endif // QT_BOOTSTRAPPED" << endl;
2777 if (dictionary[ "SHARED" ] == "yes") {
2778 tmpStream << "#ifndef QT_DLL" << endl;
2779 tmpStream << "#define QT_DLL" << endl;
2780 tmpStream << "#endif" << endl;
2783 tmpStream << "/* License information */" << endl;
2784 tmpStream << "#define QT_PRODUCT_LICENSEE \"" << licenseInfo[ "LICENSEE" ] << "\"" << endl;
2785 tmpStream << "#define QT_PRODUCT_LICENSE \"" << dictionary[ "EDITION" ] << "\"" << endl;
2787 tmpStream << "// Qt Edition" << endl;
2788 tmpStream << "#ifndef QT_EDITION" << endl;
2789 tmpStream << "# define QT_EDITION " << dictionary["QT_EDITION"] << endl;
2790 tmpStream << "#endif" << endl;
2792 if (dictionary["BUILDDEV"] == "yes") {
2793 dictionary["QMAKE_INTERNAL"] = "yes";
2794 tmpStream << "/* Used for example to export symbols for the certain autotests*/" << endl;
2795 tmpStream << "#define QT_BUILD_INTERNAL" << endl;
2799 // ### For compatibility only, should be removed later.
2800 tmpStream << endl << "#define Q_WS_QPA" << endl;
2802 tmpStream << endl << "// Compile time features" << endl;
2804 QStringList qconfigList;
2805 if (dictionary["STL"] == "no") qconfigList += "QT_NO_STL";
2806 if (dictionary["STYLE_WINDOWS"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWS";
2807 if (dictionary["STYLE_PLASTIQUE"] != "yes") qconfigList += "QT_NO_STYLE_PLASTIQUE";
2808 if (dictionary["STYLE_CLEANLOOKS"] != "yes") qconfigList += "QT_NO_STYLE_CLEANLOOKS";
2809 if (dictionary["STYLE_WINDOWSXP"] != "yes" && dictionary["STYLE_WINDOWSVISTA"] != "yes")
2810 qconfigList += "QT_NO_STYLE_WINDOWSXP";
2811 if (dictionary["STYLE_WINDOWSVISTA"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWSVISTA";
2812 if (dictionary["STYLE_MOTIF"] != "yes") qconfigList += "QT_NO_STYLE_MOTIF";
2813 if (dictionary["STYLE_CDE"] != "yes") qconfigList += "QT_NO_STYLE_CDE";
2815 // ### We still need the QT_NO_STYLE_S60 define for compiling Qt. Remove later!
2816 qconfigList += "QT_NO_STYLE_S60";
2818 if (dictionary["STYLE_WINDOWSCE"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWSCE";
2819 if (dictionary["STYLE_WINDOWSMOBILE"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWSMOBILE";
2820 if (dictionary["STYLE_GTK"] != "yes") qconfigList += "QT_NO_STYLE_GTK";
2822 if (dictionary["GIF"] == "yes") qconfigList += "QT_BUILTIN_GIF_READER=1";
2823 if (dictionary["PNG"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_PNG";
2824 if (dictionary["JPEG"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_JPEG";
2825 if (dictionary["ZLIB"] == "no") {
2826 qconfigList += "QT_NO_ZLIB";
2827 qconfigList += "QT_NO_COMPRESS";
2830 if (dictionary["ACCESSIBILITY"] == "no") qconfigList += "QT_NO_ACCESSIBILITY";
2831 if (dictionary["EXCEPTIONS"] == "no") qconfigList += "QT_NO_EXCEPTIONS";
2832 if (dictionary["WIDGETS"] == "no") qconfigList += "QT_NO_WIDGETS";
2833 if (dictionary["OPENGL"] == "no") qconfigList += "QT_NO_OPENGL";
2834 if (dictionary["OPENVG"] == "no") qconfigList += "QT_NO_OPENVG";
2835 if (dictionary["OPENSSL"] == "no") {
2836 qconfigList += "QT_NO_OPENSSL";
2837 qconfigList += "QT_NO_SSL";
2839 if (dictionary["OPENSSL"] == "linked") qconfigList += "QT_LINKED_OPENSSL";
2840 if (dictionary["DBUS"] == "no") qconfigList += "QT_NO_DBUS";
2841 if (dictionary["QML_DEBUG"] == "no") qconfigList += "QT_QML_NO_DEBUGGER";
2842 if (dictionary["FREETYPE"] == "no") qconfigList += "QT_NO_FREETYPE";
2843 if (dictionary["NATIVE_GESTURES"] == "no") qconfigList += "QT_NO_NATIVE_GESTURES";
2845 if (dictionary["OPENGL_ES_CM"] == "yes" ||
2846 dictionary["OPENGL_ES_2"] == "yes") qconfigList += "QT_OPENGL_ES";
2848 if (dictionary["OPENGL_ES_CM"] == "yes") qconfigList += "QT_OPENGL_ES_1";
2849 if (dictionary["OPENGL_ES_2"] == "yes") qconfigList += "QT_OPENGL_ES_2";
2850 if (dictionary["SQL_MYSQL"] == "yes") qconfigList += "QT_SQL_MYSQL";
2851 if (dictionary["SQL_ODBC"] == "yes") qconfigList += "QT_SQL_ODBC";
2852 if (dictionary["SQL_OCI"] == "yes") qconfigList += "QT_SQL_OCI";
2853 if (dictionary["SQL_PSQL"] == "yes") qconfigList += "QT_SQL_PSQL";
2854 if (dictionary["SQL_TDS"] == "yes") qconfigList += "QT_SQL_TDS";
2855 if (dictionary["SQL_DB2"] == "yes") qconfigList += "QT_SQL_DB2";
2856 if (dictionary["SQL_SQLITE"] == "yes") qconfigList += "QT_SQL_SQLITE";
2857 if (dictionary["SQL_SQLITE2"] == "yes") qconfigList += "QT_SQL_SQLITE2";
2858 if (dictionary["SQL_IBASE"] == "yes") qconfigList += "QT_SQL_IBASE";
2861 for (int i = 0; i < qconfigList.count(); ++i)
2862 tmpStream << addDefine(qconfigList.at(i));
2864 if (dictionary["EMBEDDED"] == "yes")
2866 // Check for keyboard, mouse, gfx.
2867 QStringList kbdDrivers = dictionary["KBD_DRIVERS"].split(" ");;
2868 QStringList allKbdDrivers;
2869 allKbdDrivers<<"tty"<<"usb"<<"sl5000"<<"yopy"<<"vr41xx"<<"qvfb"<<"um";
2870 foreach (const QString &kbd, allKbdDrivers) {
2871 if (!kbdDrivers.contains(kbd))
2872 tmpStream<<"#define QT_NO_QWS_KBD_"<<kbd.toUpper()<<endl;
2875 QStringList mouseDrivers = dictionary["MOUSE_DRIVERS"].split(" ");
2876 QStringList allMouseDrivers;
2877 allMouseDrivers << "pc"<<"bus"<<"linuxtp"<<"yopy"<<"vr41xx"<<"tslib"<<"qvfb";
2878 foreach (const QString &mouse, allMouseDrivers) {
2879 if (!mouseDrivers.contains(mouse))
2880 tmpStream<<"#define QT_NO_QWS_MOUSE_"<<mouse.toUpper()<<endl;
2883 QStringList gfxDrivers = dictionary["GFX_DRIVERS"].split(" ");
2884 QStringList allGfxDrivers;
2885 allGfxDrivers<<"linuxfb"<<"transformed"<<"qvfb"<<"multiscreen"<<"ahi";
2886 foreach (const QString &gfx, allGfxDrivers) {
2887 if (!gfxDrivers.contains(gfx))
2888 tmpStream<<"#define QT_NO_QWS_"<<gfx.toUpper()<<endl;
2891 tmpStream<<"#define Q_WS_QWS"<<endl;
2893 QStringList depths = dictionary[ "QT_QWS_DEPTH" ].split(" ");
2894 foreach (const QString &depth, depths)
2895 tmpStream<<"#define QT_QWS_DEPTH_"+depth<<endl;
2898 if (dictionary[ "QT_CUPS" ] == "no")
2899 tmpStream<<"#define QT_NO_CUPS"<<endl;
2901 if (dictionary[ "QT_ICONV" ] == "no")
2902 tmpStream<<"#define QT_NO_ICONV"<<endl;
2904 if (dictionary[ "QT_GLIB" ] == "no")
2905 tmpStream<<"#define QT_NO_GLIB"<<endl;
2907 if (dictionary[ "QT_LPR" ] == "no")
2908 tmpStream<<"#define QT_NO_LPR"<<endl;
2910 if (dictionary[ "QT_INOTIFY" ] == "no")
2911 tmpStream<<"#define QT_NO_INOTIFY"<<endl;
2913 if (dictionary[ "QT_SXE" ] == "no")
2914 tmpStream<<"#define QT_NO_SXE"<<endl;
2919 // Replace old qconfig.h with new one
2920 ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL);
2921 QFile::remove(outName);
2922 tmpFile.copy(outName);
2926 QString spec = dictionary.contains("XQMAKESPEC") ? dictionary["XQMAKESPEC"] : dictionary["QMAKESPEC"];
2927 if (!copySpec("default", "", spec))
2930 // Generate the new qconfig.cpp file
2931 QDir(buildPath).mkpath("src/corelib/global");
2932 outName = buildPath + "/src/corelib/global/qconfig.cpp";
2934 QTemporaryFile tmpFile2;
2935 if (tmpFile2.open()) {
2936 tmpStream.setDevice(&tmpFile2);
2937 tmpStream << "/* Licensed */" << endl
2938 << "static const char qt_configure_licensee_str [512 + 12] = \"qt_lcnsuser=" << licenseInfo["LICENSEE"] << "\";" << endl
2939 << "static const char qt_configure_licensed_products_str [512 + 12] = \"qt_lcnsprod=" << dictionary["EDITION"] << "\";" << endl
2941 << "/* Build date */" << endl
2942 << "static const char qt_configure_installation [11 + 12] = \"qt_instdate=" << QDate::currentDate().toString(Qt::ISODate) << "\";" << endl
2944 << "static const char qt_configure_prefix_path_strs[][12 + 512] = {" << endl
2945 << " \"qt_prfxpath=" << escapeSeparators(dictionary["QT_INSTALL_PREFIX"]) << "\"," << endl
2946 << " \"qt_docspath=" << escapeSeparators(dictionary["QT_INSTALL_DOCS"]) << "\"," << endl
2947 << " \"qt_hdrspath=" << escapeSeparators(dictionary["QT_INSTALL_HEADERS"]) << "\"," << endl
2948 << " \"qt_libspath=" << escapeSeparators(dictionary["QT_INSTALL_LIBS"]) << "\"," << endl
2949 << " \"qt_binspath=" << escapeSeparators(dictionary["QT_INSTALL_BINS"]) << "\"," << endl
2950 << " \"qt_plugpath=" << escapeSeparators(dictionary["QT_INSTALL_PLUGINS"]) << "\"," << endl
2951 << " \"qt_impspath=" << escapeSeparators(dictionary["QT_INSTALL_IMPORTS"]) << "\"," << endl
2952 << " \"qt_datapath=" << escapeSeparators(dictionary["QT_INSTALL_DATA"]) << "\"," << endl
2953 << " \"qt_trnspath=" << escapeSeparators(dictionary["QT_INSTALL_TRANSLATIONS"]) << "\"," << endl
2954 << " \"qt_xmplpath=" << escapeSeparators(dictionary["QT_INSTALL_EXAMPLES"]) << "\"," << endl
2955 << " \"qt_tstspath=" << escapeSeparators(dictionary["QT_INSTALL_TESTS"]) << "\"," << endl
2956 << "#ifdef QT_BUILD_QMAKE" << endl
2957 << " \"qt_ssrtpath=" << escapeSeparators(dictionary["CFG_SYSROOT"]) << "\"," << endl
2958 << " \"qt_hpfxpath=" << escapeSeparators(dictionary["QT_HOST_PREFIX"]) << "\"," << endl
2959 << " \"qt_hbinpath=" << escapeSeparators(dictionary["QT_HOST_BINS"]) << "\"," << endl
2960 << " \"qt_hdatpath=" << escapeSeparators(dictionary["QT_HOST_DATA"]) << "\"," << endl
2963 //<< "static const char qt_configure_settings_path_str [256] = \"qt_stngpath=" << escapeSeparators(dictionary["QT_INSTALL_SETTINGS"]) << "\";" << endl
2965 << "/* strlen( \"qt_lcnsxxxx\") == 12 */" << endl
2966 << "#define QT_CONFIGURE_LICENSEE qt_configure_licensee_str + 12;" << endl
2967 << "#define QT_CONFIGURE_LICENSED_PRODUCTS qt_configure_licensed_products_str + 12;" << endl
2968 //<< "#define QT_CONFIGURE_SETTINGS_PATH qt_configure_settings_path_str + 12;" << endl
2974 // Replace old qconfig.cpp with new one
2975 ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL);
2976 QFile::remove(outName);
2977 tmpFile2.copy(outName);
2981 QTemporaryFile tmpFile3;
2982 if (tmpFile3.open()) {
2983 tmpStream.setDevice(&tmpFile3);
2984 tmpStream << "/* Evaluation license key */" << endl
2985 << "static const volatile char qt_eval_key_data [512 + 12] = \"qt_qevalkey=" << licenseInfo["LICENSEKEYEXT"] << "\";" << endl;
2990 outName = buildPath + "/src/corelib/global/qconfig_eval.cpp";
2991 ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL);
2992 QFile::remove(outName);
2994 if (dictionary["EDITION"] == "Evaluation" || qmakeDefines.contains("QT_EVAL"))
2995 tmpFile3.copy(outName);
3002 void Configure::displayConfig()
3004 // Give some feedback
3005 cout << "Environment:" << endl;
3006 QString env = QString::fromLocal8Bit(getenv("INCLUDE")).replace(QRegExp("[;,]"), "\r\n ");
3009 cout << " INCLUDE=\r\n " << env << endl;
3010 env = QString::fromLocal8Bit(getenv("LIB")).replace(QRegExp("[;,]"), "\r\n ");
3013 cout << " LIB=\r\n " << env << endl;
3014 env = QString::fromLocal8Bit(getenv("PATH")).replace(QRegExp("[;,]"), "\r\n ");
3017 cout << " PATH=\r\n " << env << endl;
3019 if (dictionary["EDITION"] == "OpenSource") {
3020 cout << "You are licensed to use this software under the terms of the GNU GPL version 3.";
3021 cout << "You are licensed to use this software under the terms of the Lesser GNU LGPL version 2.1." << endl;
3022 cout << "See " << dictionary["LICENSE FILE"] << "3" << endl << endl
3023 << " or " << dictionary["LICENSE FILE"] << "L" << endl << endl;
3025 QString l1 = licenseInfo[ "LICENSEE" ];
3026 QString l2 = licenseInfo[ "LICENSEID" ];
3027 QString l3 = dictionary["EDITION"] + ' ' + "Edition";
3028 QString l4 = licenseInfo[ "EXPIRYDATE" ];
3029 cout << "Licensee...................." << (l1.isNull() ? "" : l1) << endl;
3030 cout << "License ID.................." << (l2.isNull() ? "" : l2) << endl;
3031 cout << "Product license............." << (l3.isNull() ? "" : l3) << endl;
3032 cout << "Expiry Date................." << (l4.isNull() ? "" : l4) << endl << endl;
3035 cout << "Configuration:" << endl;
3036 cout << " " << qmakeConfig.join("\r\n ") << endl;
3037 cout << "Qt Configuration:" << endl;
3038 cout << " " << qtConfig.join("\r\n ") << endl;
3041 if (dictionary.contains("XQMAKESPEC"))
3042 cout << "QMAKESPEC..................." << dictionary[ "XQMAKESPEC" ] << " (" << dictionary["QMAKESPEC_FROM"] << ")" << endl;
3044 cout << "QMAKESPEC..................." << dictionary[ "QMAKESPEC" ] << " (" << dictionary["QMAKESPEC_FROM"] << ")" << endl;
3045 cout << "Architecture................" << dictionary["QT_ARCH"] << endl;
3046 cout << "Host Architecture..........." << dictionary["QT_HOST_ARCH"] << endl;
3047 cout << "Maketool...................." << dictionary[ "MAKE" ] << endl;
3048 cout << "Debug symbols..............." << (dictionary[ "BUILD" ] == "debug" ? "yes" : "no") << endl;
3049 cout << "Link Time Code Generation..." << dictionary[ "LTCG" ] << endl;
3050 cout << "Accessibility support......." << dictionary[ "ACCESSIBILITY" ] << endl;
3051 cout << "STL support................." << dictionary[ "STL" ] << endl;
3052 cout << "Exception support..........." << dictionary[ "EXCEPTIONS" ] << endl;
3053 cout << "RTTI support................" << dictionary[ "RTTI" ] << endl;
3054 cout << "MMX support................." << dictionary[ "MMX" ] << endl;
3055 cout << "3DNOW support..............." << dictionary[ "3DNOW" ] << endl;
3056 cout << "SSE support................." << dictionary[ "SSE" ] << endl;
3057 cout << "SSE2 support................" << dictionary[ "SSE2" ] << endl;
3058 cout << "IWMMXT support.............." << dictionary[ "IWMMXT" ] << endl;
3059 cout << "OpenGL support.............." << dictionary[ "OPENGL" ] << endl;
3060 cout << "OpenVG support.............." << dictionary[ "OPENVG" ] << endl;
3061 cout << "OpenSSL support............." << dictionary[ "OPENSSL" ] << endl;
3062 cout << "QtDBus support.............." << dictionary[ "DBUS" ] << endl;
3063 cout << "QtWidgets module support...." << dictionary[ "WIDGETS" ] << endl;
3064 cout << "QML debugging..............." << dictionary[ "QML_DEBUG" ] << endl;
3065 cout << "DirectWrite support........." << dictionary[ "DIRECTWRITE" ] << endl << endl;
3067 cout << "Third Party Libraries:" << endl;
3068 cout << " ZLIB support............" << dictionary[ "ZLIB" ] << endl;
3069 cout << " GIF support............." << dictionary[ "GIF" ] << endl;
3070 cout << " JPEG support............" << dictionary[ "JPEG" ] << endl;
3071 cout << " PNG support............." << dictionary[ "PNG" ] << endl;
3072 cout << " FreeType support........" << dictionary[ "FREETYPE" ] << endl << endl;
3073 cout << " PCRE support............" << dictionary[ "PCRE" ] << endl;
3074 cout << " ICU support............." << dictionary[ "ICU" ] << endl;
3076 cout << "Styles:" << endl;
3077 cout << " Windows................." << dictionary[ "STYLE_WINDOWS" ] << endl;
3078 cout << " Windows XP.............." << dictionary[ "STYLE_WINDOWSXP" ] << endl;
3079 cout << " Windows Vista..........." << dictionary[ "STYLE_WINDOWSVISTA" ] << endl;
3080 cout << " Plastique..............." << dictionary[ "STYLE_PLASTIQUE" ] << endl;
3081 cout << " Cleanlooks.............." << dictionary[ "STYLE_CLEANLOOKS" ] << endl;
3082 cout << " Motif..................." << dictionary[ "STYLE_MOTIF" ] << endl;
3083 cout << " CDE....................." << dictionary[ "STYLE_CDE" ] << endl;
3084 cout << " Windows CE.............." << dictionary[ "STYLE_WINDOWSCE" ] << endl;
3085 cout << " Windows Mobile.........." << dictionary[ "STYLE_WINDOWSMOBILE" ] << endl << endl;
3087 cout << "Sql Drivers:" << endl;
3088 cout << " ODBC...................." << dictionary[ "SQL_ODBC" ] << endl;
3089 cout << " MySQL..................." << dictionary[ "SQL_MYSQL" ] << endl;
3090 cout << " OCI....................." << dictionary[ "SQL_OCI" ] << endl;
3091 cout << " PostgreSQL.............." << dictionary[ "SQL_PSQL" ] << endl;
3092 cout << " TDS....................." << dictionary[ "SQL_TDS" ] << endl;
3093 cout << " DB2....................." << dictionary[ "SQL_DB2" ] << endl;
3094 cout << " SQLite.................." << dictionary[ "SQL_SQLITE" ] << " (" << dictionary[ "SQL_SQLITE_LIB" ] << ")" << endl;
3095 cout << " SQLite2................." << dictionary[ "SQL_SQLITE2" ] << endl;
3096 cout << " InterBase..............." << dictionary[ "SQL_IBASE" ] << endl << endl;
3098 cout << "Sources are in.............." << dictionary[ "QT_SOURCE_TREE" ] << endl;
3099 cout << "Build is done in............" << dictionary[ "QT_BUILD_TREE" ] << endl;
3100 cout << "Install prefix.............." << dictionary[ "QT_INSTALL_PREFIX" ] << endl;
3101 cout << "Headers installed to........" << dictionary[ "QT_INSTALL_HEADERS" ] << endl;
3102 cout << "Libraries installed to......" << dictionary[ "QT_INSTALL_LIBS" ] << endl;
3103 cout << "Plugins installed to........" << dictionary[ "QT_INSTALL_PLUGINS" ] << endl;
3104 cout << "Imports installed to........" << dictionary[ "QT_INSTALL_IMPORTS" ] << endl;
3105 cout << "Binaries installed to......." << dictionary[ "QT_INSTALL_BINS" ] << endl;
3106 cout << "Docs installed to..........." << dictionary[ "QT_INSTALL_DOCS" ] << endl;
3107 cout << "Data installed to..........." << dictionary[ "QT_INSTALL_DATA" ] << endl;
3108 cout << "Translations installed to..." << dictionary[ "QT_INSTALL_TRANSLATIONS" ] << endl;
3109 cout << "Examples installed to......." << dictionary[ "QT_INSTALL_EXAMPLES" ] << endl;
3110 cout << "Tests installed to.........." << dictionary[ "QT_INSTALL_TESTS" ] << endl;
3112 if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith(QLatin1String("wince"))) {
3113 cout << "Using c runtime detection..." << dictionary[ "CE_CRT" ] << endl;
3114 cout << "Cetest support.............." << dictionary[ "CETEST" ] << endl;
3115 cout << "Signature..................." << dictionary[ "CE_SIGNATURE"] << endl << endl;
3118 if (checkAvailability("INCREDIBUILD_XGE"))
3119 cout << "Using IncrediBuild XGE......" << dictionary["INCREDIBUILD_XGE"] << endl;
3120 if (!qmakeDefines.isEmpty()) {
3121 cout << "Defines.....................";
3122 for (QStringList::Iterator defs = qmakeDefines.begin(); defs != qmakeDefines.end(); ++defs)
3123 cout << (*defs) << " ";
3126 if (!qmakeIncludes.isEmpty()) {
3127 cout << "Include paths...............";
3128 for (QStringList::Iterator incs = qmakeIncludes.begin(); incs != qmakeIncludes.end(); ++incs)
3129 cout << (*incs) << " ";
3132 if (!qmakeLibs.isEmpty()) {
3133 cout << "Additional libraries........";
3134 for (QStringList::Iterator libs = qmakeLibs.begin(); libs != qmakeLibs.end(); ++libs)
3135 cout << (*libs) << " ";
3138 if (dictionary[ "QMAKE_INTERNAL" ] == "yes") {
3139 cout << "Using internal configuration." << endl;
3141 if (dictionary[ "SHARED" ] == "no") {
3142 cout << "WARNING: Using static linking will disable the use of plugins." << endl;
3143 cout << " Make sure you compile ALL needed modules into the library." << endl;
3145 if (dictionary[ "OPENSSL" ] == "linked" && opensslLibs.isEmpty()) {
3146 cout << "NOTE: When linking against OpenSSL, you can override the default" << endl;
3147 cout << "library names through OPENSSL_LIBS." << endl;
3148 cout << "For example:" << endl;
3149 cout << " configure -openssl-linked OPENSSL_LIBS=\"-lssleay32 -llibeay32\"" << endl;
3151 if (dictionary[ "ZLIB_FORCED" ] == "yes") {
3152 QString which_zlib = "supplied";
3153 if (dictionary[ "ZLIB" ] == "system")
3154 which_zlib = "system";
3156 cout << "NOTE: The -no-zlib option was supplied but is no longer supported." << endl
3158 << "Qt now requires zlib support in all builds, so the -no-zlib" << endl
3159 << "option was ignored. Qt will be built using the " << which_zlib
3162 if (dictionary["OBSOLETE_ARCH_ARG"] == "yes") {
3164 << "NOTE: The -arch option is obsolete." << endl
3166 << "Qt now detects the target and host architectures based on compiler" << endl
3167 << "output. Qt will be built using " << dictionary["QT_ARCH"] << " for the target architecture" << endl
3168 << "and " << dictionary["QT_HOST_ARCH"] << " for the host architecture (note that these two" << endl
3169 << "will be the same unless you are cross-compiling)." << endl
3176 void Configure::generateHeaders()
3178 if (dictionary["SYNCQT"] == "yes") {
3179 if (findFile("perl.exe")) {
3180 cout << "Running syncqt..." << endl;
3182 args += buildPath + "/bin/syncqt.bat";
3185 env += QString("QTDIR=" + sourcePath);
3186 env += QString("PATH=" + buildPath + "/bin/;" + qgetenv("PATH"));
3187 int retc = Environment::execute(args, env, QStringList());
3189 cout << "syncqt failed, return code " << retc << endl << endl;
3190 dictionary["DONE"] = "error";
3193 cout << "Perl not found in environment - cannot run syncqt." << endl;
3194 dictionary["DONE"] = "error";
3199 void Configure::buildQmake()
3201 if (dictionary[ "BUILD_QMAKE" ] == "yes") {
3205 QString pwd = QDir::currentPath();
3206 if (!QDir(buildPath).mkpath("qmake")) {
3207 cout << "Cannot create qmake build dir." << endl;
3208 dictionary[ "DONE" ] = "error";
3211 if (!QDir::setCurrent(buildPath + "/qmake")) {
3212 cout << "Cannot enter qmake build dir." << endl;
3213 dictionary[ "DONE" ] = "error";
3217 QString makefile = "Makefile";
3219 QFile out(makefile);
3220 if (out.open(QFile::WriteOnly | QFile::Text)) {
3221 QTextStream stream(&out);
3222 stream << "#AutoGenerated by configure.exe" << endl
3223 << "BUILD_PATH = " << QDir::toNativeSeparators(buildPath) << endl
3224 << "SOURCE_PATH = " << QDir::toNativeSeparators(sourcePath) << endl;
3225 stream << "QMAKESPEC = " << dictionary["QMAKESPEC"] << endl
3226 << "QT_VERSION = " << dictionary["VERSION"] << endl;
3228 if (dictionary["EDITION"] == "OpenSource" ||
3229 dictionary["QT_EDITION"].contains("OPENSOURCE"))
3230 stream << "QMAKE_OPENSOURCE_EDITION = yes" << endl;
3233 QFile in(sourcePath + "/qmake/" + dictionary["QMAKEMAKEFILE"]);
3234 if (in.open(QFile::ReadOnly | QFile::Text)) {
3235 QString d = in.readAll();
3236 //### need replaces (like configure.sh)? --Sam
3237 stream << d << endl;
3244 args += dictionary[ "MAKE" ];
3248 cout << "Creating qmake..." << endl;
3249 int exitCode = Environment::execute(args, QStringList(), QStringList());
3252 args += dictionary[ "MAKE" ];
3256 exitCode = Environment::execute(args, QStringList(), QStringList());
3258 cout << "Cleaning qmake failed, return code " << exitCode << endl << endl;
3259 dictionary[ "DONE" ] = "error";
3262 args += dictionary[ "MAKE" ];
3265 exitCode = Environment::execute(args, QStringList(), QStringList());
3267 cout << "Building qmake failed, return code " << exitCode << endl << endl;
3268 dictionary[ "DONE" ] = "error";
3272 QDir::setCurrent(pwd);
3277 void Configure::buildHostTools()
3279 if (dictionary[ "NOPROCESS" ] == "yes")
3280 dictionary[ "DONE" ] = "yes";
3282 if (!dictionary.contains("XQMAKESPEC"))
3285 QString pwd = QDir::currentPath();
3286 QStringList hostToolsDirs;
3290 for (int i = 0; i < hostToolsDirs.count(); ++i) {
3291 cout << "Creating " << hostToolsDirs.at(i) << " ..." << endl;
3292 QString toolBuildPath = buildPath + "/" + hostToolsDirs.at(i);
3293 QString toolSourcePath = sourcePath + "/" + hostToolsDirs.at(i);
3295 // generate Makefile
3297 args << QDir::toNativeSeparators(buildPath + "/bin/qmake");
3298 // override .qmake.cache because we are not cross-building these.
3299 // we need a full path so that a build with -prefix will still find it.
3300 args << "-spec" << QDir::toNativeSeparators(buildPath + "/mkspecs/" + dictionary["QMAKESPEC"]);
3302 args << "-o" << QDir::toNativeSeparators(toolBuildPath + "/Makefile");
3304 QDir().mkpath(toolBuildPath);
3305 QDir::setCurrent(toolSourcePath);
3306 int exitCode = Environment::execute(args, QStringList(), QStringList());
3308 cout << "qmake failed, return code " << exitCode << endl << endl;
3309 dictionary["DONE"] = "error";
3315 args += dictionary["MAKE"];
3316 QDir::setCurrent(toolBuildPath);
3317 exitCode = Environment::execute(args, QStringList(), QStringList());
3320 args += dictionary["MAKE"];
3322 exitCode = Environment::execute(args, QStringList(), QStringList());
3324 cout << "Cleaning " << hostToolsDirs.at(i) << " failed, return code " << exitCode << endl << endl;
3325 dictionary["DONE"] = "error";
3329 args += dictionary["MAKE"];
3330 exitCode = Environment::execute(args, QStringList(), QStringList());
3332 cout << "Building " << hostToolsDirs.at(i) << " failed, return code " << exitCode << endl << endl;
3333 dictionary["DONE"] = "error";
3339 QDir::setCurrent(pwd);
3342 void Configure::findProjects(const QString& dirName)
3344 if (dictionary[ "NOPROCESS" ] == "no") {
3348 ProjectType qmakeTemplate;
3349 const QFileInfoList &list = dir.entryInfoList(QStringList(QLatin1String("*.pro")),
3350 QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
3351 for (int i = 0; i < list.size(); ++i) {
3352 const QFileInfo &fi = list.at(i);
3353 if (fi.fileName() != "qmake.pro") {
3354 entryName = dirName + "/" + fi.fileName();
3356 findProjects(entryName);
3358 qmakeTemplate = projectType(fi.absoluteFilePath());
3359 switch (qmakeTemplate) {
3368 makeList[makeListNumber].append(new MakeItem(sourceDir.relativeFilePath(fi.absolutePath()),
3379 void Configure::appendMakeItem(int inList, const QString &item)
3384 dir.prepend("/src");
3385 makeList[inList].append(new MakeItem(sourcePath + dir,
3386 item + ".pro", buildPath + dir + "/Makefile", Lib));
3387 if (dictionary[ "DSPFILES" ] == "yes") {
3388 makeList[inList].append(new MakeItem(sourcePath + dir,
3389 item + ".pro", buildPath + dir + "/" + item + ".dsp", Lib));
3391 if (dictionary[ "VCPFILES" ] == "yes") {
3392 makeList[inList].append(new MakeItem(sourcePath + dir,
3393 item + ".pro", buildPath + dir + "/" + item + ".vcp", Lib));
3395 if (dictionary[ "VCPROJFILES" ] == "yes") {
3396 makeList[inList].append(new MakeItem(sourcePath + dir,
3397 item + ".pro", buildPath + dir + "/" + item + ".vcproj", Lib));
3401 void Configure::generateMakefiles()
3403 if (dictionary[ "NOPROCESS" ] == "no") {
3405 cout << "Creating makefiles in src..." << endl;
3408 QString spec = dictionary.contains("XQMAKESPEC") ? dictionary[ "XQMAKESPEC" ] : dictionary[ "QMAKESPEC" ];
3409 if (spec != "win32-msvc")
3410 dictionary[ "DSPFILES" ] = "no";
3412 if (spec != "win32-msvc.net" && !spec.startsWith("win32-msvc2") && !spec.startsWith(QLatin1String("wince")))
3413 dictionary[ "VCPROJFILES" ] = "no";
3416 QString pwd = QDir::currentPath();
3417 if (dictionary["FAST"] != "yes") {
3419 bool generate = true;
3420 bool doDsp = (dictionary["DSPFILES"] == "yes" || dictionary["VCPFILES"] == "yes"
3421 || dictionary["VCPROJFILES"] == "yes");
3423 QString pwd = QDir::currentPath();
3424 QString dirPath = fixSeparators(buildPath + dirName);
3427 args << fixSeparators(buildPath + "/bin/qmake");
3430 if (dictionary[ "DEPENDENCIES" ] == "no")
3431 args << "-nodepend";
3432 args << "-tp" << "vc";
3433 doDsp = false; // DSP files will be done
3434 printf("Generating Visual Studio project files...\n");
3436 printf("Generating Makefiles...\n");
3437 generate = false; // Now Makefiles will be done
3439 // don't pass -spec - .qmake.cache has it already
3441 args << (sourcePath + "/qtbase.pro");
3444 if (!dictionary[ "QMAKEADDITIONALARGS" ].isEmpty())
3445 args << dictionary[ "QMAKEADDITIONALARGS" ];
3447 QDir::setCurrent(fixSeparators(dirPath));
3448 if (int exitCode = Environment::execute(args, QStringList(), QStringList())) {
3449 cout << "Qmake failed, return code " << exitCode << endl << endl;
3450 dictionary[ "DONE" ] = "error";
3454 findProjects(sourcePath);
3455 for (i=0; i<3; i++) {
3456 for (int j=0; j<makeList[i].size(); ++j) {
3457 MakeItem *it=makeList[i][j];
3458 QString dirPath = fixSeparators(it->directory + "/");
3459 QString projectName = it->proFile;
3460 QString makefileName = buildPath + "/" + dirPath + it->target;
3462 // For shadowbuilds, we need to create the path first
3463 QDir buildPathDir(buildPath);
3464 if (sourcePath != buildPath && !buildPathDir.exists(dirPath))
3465 buildPathDir.mkpath(dirPath);
3469 args << fixSeparators(buildPath + "/bin/qmake");
3470 args << sourcePath + "/" + dirPath + projectName;
3471 args << dictionary[ "QMAKE_ALL_ARGS" ];
3473 cout << "For " << qPrintable(dirPath + projectName) << endl;
3478 if (!dictionary[ "QMAKEADDITIONALARGS" ].isEmpty())
3479 args << dictionary[ "QMAKEADDITIONALARGS" ];
3481 QDir::setCurrent(fixSeparators(dirPath));
3483 QFile file(makefileName);
3484 if (!file.open(QFile::WriteOnly)) {
3485 printf("failed on dirPath=%s, makefile=%s\n",
3486 qPrintable(dirPath), qPrintable(makefileName));
3489 QTextStream txt(&file);
3491 txt << "\t" << args.join(" ") << "\n";
3492 txt << "\t\"$(MAKE)\" -$(MAKEFLAGS) -f " << it->target << "\n";
3493 txt << "first: all\n";
3495 txt << "\t" << args.join(" ") << "\n";
3499 QDir::setCurrent(pwd);
3501 cout << "Processing of project files have been disabled." << endl;
3502 cout << "Only use this option if you really know what you're doing." << endl << endl;
3507 void Configure::showSummary()
3509 QString make = dictionary[ "MAKE" ];
3510 if (!dictionary.contains("XQMAKESPEC")) {
3511 cout << endl << endl << "Qt is now configured for building. Just run " << qPrintable(make) << "." << endl;
3512 cout << "To reconfigure, run " << qPrintable(make) << " confclean and configure." << endl << endl;
3513 } else if (dictionary.value("QMAKESPEC").startsWith("wince")) {
3514 // we are cross compiling for Windows CE
3515 cout << endl << endl << "Qt is now configured for building. To start the build run:" << endl
3516 << "\tsetcepaths " << dictionary.value("XQMAKESPEC") << endl
3517 << "\t" << qPrintable(make) << endl
3518 << "To reconfigure, run " << qPrintable(make) << " confclean and configure." << endl << endl;
3522 Configure::ProjectType Configure::projectType(const QString& proFileName)
3524 QFile proFile(proFileName);
3525 if (proFile.open(QFile::ReadOnly)) {
3526 QString buffer = proFile.readLine(1024);
3527 while (!buffer.isEmpty()) {
3528 QStringList segments = buffer.split(QRegExp("\\s"));
3529 QStringList::Iterator it = segments.begin();
3531 if (segments.size() >= 3) {
3532 QString keyword = (*it++);
3533 QString operation = (*it++);
3534 QString value = (*it++);
3536 if (keyword == "TEMPLATE") {
3539 else if (value == "subdirs")
3544 buffer = proFile.readLine(1024);
3548 // Default to app handling
3554 bool Configure::showLicense(QString orgLicenseFile)
3556 if (dictionary["LICENSE_CONFIRMED"] == "yes") {
3557 cout << "You have already accepted the terms of the license." << endl << endl;
3561 bool haveGpl3 = false;
3562 QString licenseFile = orgLicenseFile;
3564 if (dictionary["EDITION"] == "OpenSource" || dictionary["EDITION"] == "Snapshot") {
3565 haveGpl3 = QFile::exists(orgLicenseFile + "/LICENSE.GPL3");
3566 theLicense = "GNU Lesser General Public License (LGPL) version 2.1";
3568 theLicense += "\nor the GNU General Public License (GPL) version 3";
3570 // the first line of the license file tells us which license it is
3571 QFile file(licenseFile);
3572 if (!file.open(QFile::ReadOnly)) {
3573 cout << "Failed to load LICENSE file" << endl;
3576 theLicense = file.readLine().trimmed();
3581 cout << "You are licensed to use this software under the terms of" << endl
3582 << "the " << theLicense << "." << endl
3584 if (dictionary["EDITION"] == "OpenSource" || dictionary["EDITION"] == "Snapshot") {
3586 cout << "Type '3' to view the GNU General Public License version 3 (GPLv3)." << endl;
3587 cout << "Type 'L' to view the Lesser GNU General Public License version 2.1 (LGPLv2.1)." << endl;
3589 cout << "Type '?' to view the " << theLicense << "." << endl;
3591 cout << "Type 'y' to accept this license offer." << endl
3592 << "Type 'n' to decline this license offer." << endl
3594 << "Do you accept the terms of the license?" << endl;
3596 accept = tolower(accept);
3598 if (accept == 'y') {
3600 } else if (accept == 'n') {
3603 if (dictionary["EDITION"] == "OpenSource" || dictionary["EDITION"] == "Snapshot") {
3605 licenseFile = orgLicenseFile + "/LICENSE.GPL3";
3607 licenseFile = orgLicenseFile + "/LICENSE.LGPL";
3609 // Get console line height, to fill the screen properly
3610 int i = 0, screenHeight = 25; // default
3611 CONSOLE_SCREEN_BUFFER_INFO consoleInfo;
3612 HANDLE stdOut = GetStdHandle(STD_OUTPUT_HANDLE);
3613 if (GetConsoleScreenBufferInfo(stdOut, &consoleInfo))
3614 screenHeight = consoleInfo.srWindow.Bottom
3615 - consoleInfo.srWindow.Top
3616 - 1; // Some overlap for context
3618 // Prompt the license content to the user
3619 QFile file(licenseFile);
3620 if (!file.open(QFile::ReadOnly)) {
3621 cout << "Failed to load LICENSE file" << licenseFile << endl;
3624 QStringList licenseContent = QString(file.readAll()).split('\n');
3625 while (i < licenseContent.size()) {
3626 cout << licenseContent.at(i) << endl;
3627 if (++i % screenHeight == 0) {
3628 cout << "(Press any key for more..)";
3629 if (_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
3630 exit(0); // Exit cleanly for Ctrl+C
3631 cout << "\r"; // Overwrite text above
3638 void Configure::readLicense()
3640 if (QFile::exists(dictionary["QT_SOURCE_TREE"] + "/src/corelib/kernel/qfunctions_wince.h") &&
3641 (dictionary.value("QMAKESPEC").startsWith("wince") || dictionary.value("XQMAKESPEC").startsWith("wince")))
3642 dictionary["PLATFORM NAME"] = "Qt for Windows CE";
3644 dictionary["PLATFORM NAME"] = "Qt for Windows";
3645 dictionary["LICENSE FILE"] = sourcePath;
3647 bool openSource = false;
3648 bool hasOpenSource = QFile::exists(dictionary["LICENSE FILE"] + "/LICENSE.GPL3") || QFile::exists(dictionary["LICENSE FILE"] + "/LICENSE.LGPL");
3649 if (dictionary["BUILDTYPE"] == "commercial") {
3651 } else if (dictionary["BUILDTYPE"] == "opensource") {
3653 } else if (hasOpenSource) { // No Open Source? Just display the commercial license right away
3656 cout << "Which edition of Qt do you want to use ?" << endl;
3657 cout << "Type 'c' if you want to use the Commercial Edition." << endl;
3658 cout << "Type 'o' if you want to use the Open Source Edition." << endl;
3660 accept = tolower(accept);
3662 if (accept == 'c') {
3665 } else if (accept == 'o') {
3671 if (hasOpenSource && openSource) {
3672 cout << endl << "This is the " << dictionary["PLATFORM NAME"] << " Open Source Edition." << endl;
3673 licenseInfo["LICENSEE"] = "Open Source";
3674 dictionary["EDITION"] = "OpenSource";
3675 dictionary["QT_EDITION"] = "QT_EDITION_OPENSOURCE";
3677 if (!showLicense(dictionary["LICENSE FILE"])) {
3678 cout << "Configuration aborted since license was not accepted";
3679 dictionary["DONE"] = "error";
3682 } else if (openSource) {
3683 cout << endl << "Cannot find the GPL license files! Please download the Open Source version of the library." << endl;
3684 dictionary["DONE"] = "error";
3686 #ifdef COMMERCIAL_VERSION
3688 Tools::checkLicense(dictionary, licenseInfo, firstLicensePath());
3689 if (dictionary["DONE"] != "error") {
3690 // give the user some feedback, and prompt for license acceptance
3691 cout << endl << "This is the " << dictionary["PLATFORM NAME"] << " " << dictionary["EDITION"] << " Edition."<< endl << endl;
3692 if (!showLicense(dictionary["LICENSE FILE"])) {
3693 cout << "Configuration aborted since license was not accepted";
3694 dictionary["DONE"] = "error";
3699 #else // !COMMERCIAL_VERSION
3701 cout << endl << "Cannot build commercial edition from the open source version of the library." << endl;
3702 dictionary["DONE"] = "error";
3707 void Configure::reloadCmdLine()
3709 if (dictionary[ "REDO" ] == "yes") {
3710 QFile inFile(buildPath + "/configure" + dictionary[ "CUSTOMCONFIG" ] + ".cache");
3711 if (inFile.open(QFile::ReadOnly)) {
3712 QTextStream inStream(&inFile);
3715 while (buffer.length()) {
3716 configCmdLine += buffer;
3724 void Configure::saveCmdLine()
3726 if (dictionary[ "REDO" ] != "yes") {
3727 QFile outFile(buildPath + "/configure" + dictionary[ "CUSTOMCONFIG" ] + ".cache");
3728 if (outFile.open(QFile::WriteOnly | QFile::Text)) {
3729 QTextStream outStream(&outFile);
3730 for (QStringList::Iterator it = configCmdLine.begin(); it != configCmdLine.end(); ++it) {
3731 outStream << (*it) << " " << endl;
3740 bool Configure::isDone()
3742 return !dictionary["DONE"].isEmpty();
3745 bool Configure::isOk()
3747 return (dictionary[ "DONE" ] != "error");
3751 Configure::filesDiffer(const QString &fn1, const QString &fn2)
3753 QFile file1(fn1), file2(fn2);
3754 if (!file1.open(QFile::ReadOnly) || !file2.open(QFile::ReadOnly))
3756 const int chunk = 2048;
3757 int used1 = 0, used2 = 0;
3758 char b1[chunk], b2[chunk];
3759 while (!file1.atEnd() && !file2.atEnd()) {
3761 used1 = file1.read(b1, chunk);
3763 used2 = file2.read(b2, chunk);
3764 if (used1 > 0 && used2 > 0) {
3765 const int cmp = qMin(used1, used2);
3766 if (memcmp(b1, b2, cmp))
3769 memcpy(b1, b1+cmp, used1);
3771 memcpy(b2, b2+cmp, used2);
3774 return !file1.atEnd() || !file2.atEnd();