1 /****************************************************************************
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the tools applications of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** 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 ];
118 // Get the path to the executable
119 wchar_t module_name[MAX_PATH];
120 GetModuleFileName(0, module_name, sizeof(module_name) / sizeof(wchar_t));
121 QFileInfo sourcePathInfo = QString::fromWCharArray(module_name);
122 sourcePath = sourcePathInfo.absolutePath();
123 sourceDir = sourcePathInfo.dir();
124 buildPath = QDir::currentPath();
126 const QString installPath = QString("C:\\Qt\\%1").arg(QT_VERSION_STR);
128 const QString installPath = buildPath;
130 if (sourceDir != buildDir) { //shadow builds!
131 if (!findFile("perl") && !findFile("perl.exe")) {
132 cout << "Error: Creating a shadow build of Qt requires" << endl
133 << "perl to be in the PATH environment";
134 exit(0); // Exit cleanly for Ctrl+C
137 cout << "Preparing build tree..." << endl;
138 QDir(buildPath).mkpath("bin");
141 QStack<QString> qmake_dirs;
142 qmake_dirs.push("qmake");
143 while (!qmake_dirs.isEmpty()) {
144 QString dir = qmake_dirs.pop();
145 QString od(buildPath + "/" + dir);
146 QString id(sourcePath + "/" + dir);
147 QFileInfoList entries = QDir(id).entryInfoList(QDir::NoDotAndDotDot|QDir::AllEntries);
148 for (int i = 0; i < entries.size(); ++i) {
149 QFileInfo fi(entries.at(i));
151 qmake_dirs.push(dir + "/" + fi.fileName());
152 QDir().mkpath(od + "/" + fi.fileName());
155 bool justCopy = true;
156 const QString fname = fi.fileName();
157 const QString outFile(od + "/" + fname), inFile(id + "/" + fname);
158 if (fi.fileName() == "Makefile") { //ignore
159 } else if (fi.suffix() == "h" || fi.suffix() == "cpp") {
160 QTemporaryFile tmpFile;
161 if (tmpFile.open()) {
162 QTextStream stream(&tmpFile);
163 stream << "#include \"" << inFile << "\"" << endl;
167 if (filesDiffer(tmpFile.fileName(), outFile)) {
168 QFile::remove(outFile);
169 tmpFile.copy(outFile);
173 if (justCopy && filesDiffer(inFile, outFile))
174 QFile::copy(inFile, outFile);
180 { //make a syncqt script(s) that can be used in the shadow
181 QFile syncqt(buildPath + "/bin/syncqt");
182 if (syncqt.open(QFile::WriteOnly)) {
183 QTextStream stream(&syncqt);
184 stream << "#!/usr/bin/perl -w" << endl
185 << "require \"" << sourcePath + "/bin/syncqt\";" << endl;
187 QFile syncqt_bat(buildPath + "/bin/syncqt.bat");
188 if (syncqt_bat.open(QFile::WriteOnly)) {
189 QTextStream stream(&syncqt_bat);
190 stream << "@echo off" << endl
191 << "call " << fixSeparators(sourcePath) << fixSeparators("/bin/syncqt.bat -outdir \"") << fixSeparators(buildPath) << "\" \"" << fixSeparators(sourcePath) << "\"" << endl;
196 QFile configtests(buildPath + "/bin/qtmodule-configtests");
197 if (configtests.open(QFile::WriteOnly)) {
198 QTextStream stream(&configtests);
199 stream << "#!/usr/bin/perl -w" << endl
200 << "require \"" << sourcePath + "/bin/qtmodule-configtests\";" << endl;
202 // For Windows CE and shadow builds we need to copy these to the
204 QFile::copy(sourcePath + "/bin/setcepaths.bat" , buildPath + "/bin/setcepaths.bat");
206 buildDir.mkpath("mkspecs");
207 if (!Environment::cpdir(sourcePath + "/mkspecs", buildPath + "/mkspecs")){
208 cout << "Couldn't copy mkspecs!" << sourcePath << " " << buildPath << endl;
209 dictionary["DONE"] = "error";
214 dictionary[ "QT_SOURCE_TREE" ] = fixSeparators(sourcePath);
215 dictionary[ "QT_BUILD_TREE" ] = fixSeparators(buildPath);
216 dictionary[ "QT_INSTALL_PREFIX" ] = fixSeparators(installPath);
218 dictionary[ "QMAKESPEC" ] = getenv("QMAKESPEC");
219 if (dictionary[ "QMAKESPEC" ].size() == 0) {
220 dictionary[ "QMAKESPEC" ] = Environment::detectQMakeSpec();
221 dictionary[ "QMAKESPEC_FROM" ] = "detected";
223 dictionary[ "QMAKESPEC_FROM" ] = "env";
226 dictionary[ "ARCHITECTURE" ] = "windows";
227 dictionary[ "QCONFIG" ] = "full";
228 dictionary[ "EMBEDDED" ] = "no";
229 dictionary[ "BUILD_QMAKE" ] = "yes";
230 dictionary[ "DSPFILES" ] = "yes";
231 dictionary[ "VCPROJFILES" ] = "yes";
232 dictionary[ "QMAKE_INTERNAL" ] = "no";
233 dictionary[ "FAST" ] = "no";
234 dictionary[ "NOPROCESS" ] = "no";
235 dictionary[ "STL" ] = "yes";
236 dictionary[ "EXCEPTIONS" ] = "yes";
237 dictionary[ "RTTI" ] = "yes";
238 dictionary[ "MMX" ] = "auto";
239 dictionary[ "3DNOW" ] = "auto";
240 dictionary[ "SSE" ] = "auto";
241 dictionary[ "SSE2" ] = "auto";
242 dictionary[ "IWMMXT" ] = "auto";
243 dictionary[ "SYNCQT" ] = "auto";
244 dictionary[ "CE_CRT" ] = "no";
245 dictionary[ "CETEST" ] = "auto";
246 dictionary[ "CE_SIGNATURE" ] = "no";
247 dictionary[ "SCRIPT" ] = "auto";
248 dictionary[ "SCRIPTTOOLS" ] = "auto";
249 dictionary[ "XMLPATTERNS" ] = "auto";
250 dictionary[ "PHONON" ] = "auto";
251 dictionary[ "PHONON_BACKEND" ] = "yes";
252 dictionary[ "MULTIMEDIA" ] = "yes";
253 dictionary[ "AUDIO_BACKEND" ] = "auto";
254 dictionary[ "WMSDK" ] = "auto";
255 dictionary[ "DIRECTSHOW" ] = "no";
256 dictionary[ "WEBKIT" ] = "auto";
257 dictionary[ "V8" ] = "yes";
258 dictionary[ "V8SNAPSHOT" ] = "auto";
259 dictionary[ "DECLARATIVE" ] = "auto";
260 dictionary[ "DECLARATIVE_DEBUG" ]= "yes";
261 dictionary[ "PLUGIN_MANIFESTS" ] = "yes";
262 dictionary[ "DIRECTWRITE" ] = "no";
265 QFile qglobal_h(sourcePath + "/src/corelib/global/qglobal.h");
266 if (qglobal_h.open(QFile::ReadOnly)) {
267 QTextStream read(&qglobal_h);
268 QRegExp version_regexp("^# *define *QT_VERSION_STR *\"([^\"]*)\"");
270 while (!read.atEnd()) {
271 line = read.readLine();
272 if (version_regexp.exactMatch(line)) {
273 version = version_regexp.cap(1).trimmed();
274 if (!version.isEmpty())
281 if (version.isEmpty())
282 version = QString("%1.%2.%3").arg(QT_VERSION>>16).arg(((QT_VERSION>>8)&0xff)).arg(QT_VERSION&0xff);
284 dictionary[ "VERSION" ] = version;
286 QRegExp version_re("([0-9]*)\\.([0-9]*)\\.([0-9]*)(|-.*)");
287 if (version_re.exactMatch(version)) {
288 dictionary[ "VERSION_MAJOR" ] = version_re.cap(1);
289 dictionary[ "VERSION_MINOR" ] = version_re.cap(2);
290 dictionary[ "VERSION_PATCH" ] = version_re.cap(3);
294 dictionary[ "REDO" ] = "no";
295 dictionary[ "DEPENDENCIES" ] = "no";
297 dictionary[ "BUILD" ] = "debug";
298 dictionary[ "BUILDALL" ] = "auto"; // Means yes, but not explicitly
300 dictionary[ "BUILDTYPE" ] = "none";
302 dictionary[ "BUILDDEV" ] = "no";
304 dictionary[ "SHARED" ] = "yes";
306 dictionary[ "ZLIB" ] = "auto";
308 dictionary[ "GIF" ] = "auto";
309 dictionary[ "TIFF" ] = "auto";
310 dictionary[ "JPEG" ] = "auto";
311 dictionary[ "PNG" ] = "auto";
312 dictionary[ "MNG" ] = "auto";
313 dictionary[ "LIBTIFF" ] = "auto";
314 dictionary[ "LIBJPEG" ] = "auto";
315 dictionary[ "LIBPNG" ] = "auto";
316 dictionary[ "LIBMNG" ] = "auto";
317 dictionary[ "FREETYPE" ] = "yes";
319 dictionary[ "ACCESSIBILITY" ] = "yes";
320 dictionary[ "OPENGL" ] = "yes";
321 dictionary[ "OPENVG" ] = "no";
322 dictionary[ "OPENSSL" ] = "auto";
323 dictionary[ "DBUS" ] = "auto";
325 dictionary[ "STYLE_WINDOWS" ] = "yes";
326 dictionary[ "STYLE_WINDOWSXP" ] = "auto";
327 dictionary[ "STYLE_WINDOWSVISTA" ] = "auto";
328 dictionary[ "STYLE_PLASTIQUE" ] = "yes";
329 dictionary[ "STYLE_CLEANLOOKS" ]= "yes";
330 dictionary[ "STYLE_WINDOWSCE" ] = "no";
331 dictionary[ "STYLE_WINDOWSMOBILE" ] = "no";
332 dictionary[ "STYLE_MOTIF" ] = "yes";
333 dictionary[ "STYLE_CDE" ] = "yes";
334 dictionary[ "STYLE_GTK" ] = "no";
336 dictionary[ "SQL_MYSQL" ] = "no";
337 dictionary[ "SQL_ODBC" ] = "no";
338 dictionary[ "SQL_OCI" ] = "no";
339 dictionary[ "SQL_PSQL" ] = "no";
340 dictionary[ "SQL_TDS" ] = "no";
341 dictionary[ "SQL_DB2" ] = "no";
342 dictionary[ "SQL_SQLITE" ] = "auto";
343 dictionary[ "SQL_SQLITE_LIB" ] = "qt";
344 dictionary[ "SQL_SQLITE2" ] = "no";
345 dictionary[ "SQL_IBASE" ] = "no";
347 QString tmp = dictionary[ "QMAKESPEC" ];
348 if (tmp.contains("\\")) {
349 tmp = tmp.mid(tmp.lastIndexOf("\\") + 1);
351 tmp = tmp.mid(tmp.lastIndexOf("/") + 1);
353 dictionary[ "QMAKESPEC" ] = tmp;
355 dictionary[ "INCREDIBUILD_XGE" ] = "auto";
356 dictionary[ "LTCG" ] = "no";
357 dictionary[ "NATIVE_GESTURES" ] = "yes";
358 dictionary[ "MSVC_MP" ] = "no";
361 Configure::~Configure()
363 for (int i=0; i<3; ++i) {
364 QList<MakeItem*> items = makeList[i];
365 for (int j=0; j<items.size(); ++j)
370 QString Configure::fixSeparators(const QString &somePath, bool escape)
372 if (useUnixSeparators)
373 return QDir::fromNativeSeparators(somePath);
374 QString ret = QDir::toNativeSeparators(somePath);
375 return escape ? escapeSeparators(ret) : ret;
378 QString Configure::escapeSeparators(const QString &somePath)
380 QString out = somePath;
381 out.replace(QLatin1Char('\\'), QLatin1String("\\\\"));
385 // We could use QDir::homePath() + "/.qt-license", but
386 // that will only look in the first of $HOME,$USERPROFILE
387 // or $HOMEDRIVE$HOMEPATH. So, here we try'em all to be
388 // more forgiving for the end user..
389 QString Configure::firstLicensePath()
391 QStringList allPaths;
392 allPaths << "./.qt-license"
393 << QString::fromLocal8Bit(getenv("HOME")) + "/.qt-license"
394 << QString::fromLocal8Bit(getenv("USERPROFILE")) + "/.qt-license"
395 << QString::fromLocal8Bit(getenv("HOMEDRIVE")) + QString::fromLocal8Bit(getenv("HOMEPATH")) + "/.qt-license";
396 for (int i = 0; i< allPaths.count(); ++i)
397 if (QFile::exists(allPaths.at(i)))
398 return allPaths.at(i);
403 // #### somehow I get a compiler error about vc++ reaching the nesting limit without
404 // undefining the ansi for scoping.
409 void Configure::parseCmdLine()
411 int argCount = configCmdLine.size();
413 const QStringList imageFormats = QStringList() << "gif" << "png" << "mng" << "jpeg" << "tiff";
416 if (argCount < 1) // skip rest if no arguments
418 else if (configCmdLine.at(i) == "-redo") {
419 dictionary[ "REDO" ] = "yes";
420 configCmdLine.clear();
423 else if (configCmdLine.at(i) == "-loadconfig") {
426 dictionary[ "REDO" ] = "yes";
427 dictionary[ "CUSTOMCONFIG" ] = "_" + configCmdLine.at(i);
428 configCmdLine.clear();
431 dictionary[ "HELP" ] = "yes";
435 argCount = configCmdLine.size();
438 // Look first for XQMAKESPEC
439 for (int j = 0 ; j < argCount; ++j)
441 if (configCmdLine.at(j) == "-xplatform") {
445 dictionary["XQMAKESPEC"] = configCmdLine.at(j);
446 if (!dictionary[ "XQMAKESPEC" ].isEmpty())
447 applySpecSpecifics();
451 for (; i<configCmdLine.size(); ++i) {
452 bool continueElse[] = {false, false};
453 if (configCmdLine.at(i) == "-help"
454 || configCmdLine.at(i) == "-h"
455 || configCmdLine.at(i) == "-?")
456 dictionary[ "HELP" ] = "yes";
459 else if (configCmdLine.at(i) == "-qconfig") {
463 dictionary[ "QCONFIG" ] = configCmdLine.at(i);
466 else if (configCmdLine.at(i) == "-release") {
467 dictionary[ "BUILD" ] = "release";
468 if (dictionary[ "BUILDALL" ] == "auto")
469 dictionary[ "BUILDALL" ] = "no";
470 } else if (configCmdLine.at(i) == "-debug") {
471 dictionary[ "BUILD" ] = "debug";
472 if (dictionary[ "BUILDALL" ] == "auto")
473 dictionary[ "BUILDALL" ] = "no";
474 } else if (configCmdLine.at(i) == "-debug-and-release")
475 dictionary[ "BUILDALL" ] = "yes";
477 else if (configCmdLine.at(i) == "-shared")
478 dictionary[ "SHARED" ] = "yes";
479 else if (configCmdLine.at(i) == "-static")
480 dictionary[ "SHARED" ] = "no";
481 else if (configCmdLine.at(i) == "-developer-build")
482 dictionary[ "BUILDDEV" ] = "yes";
483 else if (configCmdLine.at(i) == "-opensource") {
484 dictionary[ "BUILDTYPE" ] = "opensource";
486 else if (configCmdLine.at(i) == "-commercial") {
487 dictionary[ "BUILDTYPE" ] = "commercial";
489 else if (configCmdLine.at(i) == "-ltcg") {
490 dictionary[ "LTCG" ] = "yes";
492 else if (configCmdLine.at(i) == "-no-ltcg") {
493 dictionary[ "LTCG" ] = "no";
495 else if (configCmdLine.at(i) == "-mp") {
496 dictionary[ "MSVC_MP" ] = "yes";
498 else if (configCmdLine.at(i) == "-no-mp") {
499 dictionary[ "MSVC_MP" ] = "no";
501 else if (configCmdLine.at(i) == "-force-asserts") {
502 dictionary[ "FORCE_ASSERTS" ] = "yes";
508 else if (configCmdLine.at(i) == "-platform") {
512 dictionary[ "QMAKESPEC" ] = configCmdLine.at(i);
513 dictionary[ "QMAKESPEC_FROM" ] = "commandline";
514 } else if (configCmdLine.at(i) == "-arch") {
518 dictionary[ "ARCHITECTURE" ] = configCmdLine.at(i);
519 if (configCmdLine.at(i) == "boundschecker") {
520 dictionary[ "ARCHITECTURE" ] = "generic"; // Boundschecker uses the generic arch,
521 qtConfig += "boundschecker"; // but also needs this CONFIG option
523 } else if (configCmdLine.at(i) == "-embedded") {
524 dictionary[ "EMBEDDED" ] = "yes";
525 } else if (configCmdLine.at(i) == "-xplatform") {
532 else if (configCmdLine.at(i) == "-no-zlib") {
533 // No longer supported since Qt 4.4.0
534 // But save the information for later so that we can print a warning
536 // If you REALLY really need no zlib support, you can still disable
537 // it by doing the following:
538 // add "no-zlib" to mkspecs/qconfig.pri
539 // #define QT_NO_COMPRESS (probably by adding to src/corelib/global/qconfig.h)
541 // There's no guarantee that Qt will build under those conditions
543 dictionary[ "ZLIB_FORCED" ] = "yes";
544 } else if (configCmdLine.at(i) == "-qt-zlib") {
545 dictionary[ "ZLIB" ] = "qt";
546 } else if (configCmdLine.at(i) == "-system-zlib") {
547 dictionary[ "ZLIB" ] = "system";
550 // Image formats --------------------------------------------
551 else if (configCmdLine.at(i) == "-no-gif")
552 dictionary[ "GIF" ] = "no";
554 else if (configCmdLine.at(i) == "-no-libtiff") {
555 dictionary[ "TIFF"] = "no";
556 dictionary[ "LIBTIFF" ] = "no";
557 } else if (configCmdLine.at(i) == "-qt-libtiff") {
558 dictionary[ "LIBTIFF" ] = "qt";
559 } else if (configCmdLine.at(i) == "-system-libtiff") {
560 dictionary[ "LIBTIFF" ] = "system";
563 else if (configCmdLine.at(i) == "-no-libjpeg") {
564 dictionary[ "JPEG" ] = "no";
565 dictionary[ "LIBJPEG" ] = "no";
566 } else if (configCmdLine.at(i) == "-qt-libjpeg") {
567 dictionary[ "LIBJPEG" ] = "qt";
568 } else if (configCmdLine.at(i) == "-system-libjpeg") {
569 dictionary[ "LIBJPEG" ] = "system";
572 else if (configCmdLine.at(i) == "-no-libpng") {
573 dictionary[ "PNG" ] = "no";
574 dictionary[ "LIBPNG" ] = "no";
575 } else if (configCmdLine.at(i) == "-qt-libpng") {
576 dictionary[ "LIBPNG" ] = "qt";
577 } else if (configCmdLine.at(i) == "-system-libpng") {
578 dictionary[ "LIBPNG" ] = "system";
581 else if (configCmdLine.at(i) == "-no-libmng") {
582 dictionary[ "MNG" ] = "no";
583 dictionary[ "LIBMNG" ] = "no";
584 } else if (configCmdLine.at(i) == "-qt-libmng") {
585 dictionary[ "LIBMNG" ] = "qt";
586 } else if (configCmdLine.at(i) == "-system-libmng") {
587 dictionary[ "LIBMNG" ] = "system";
590 // Text Rendering --------------------------------------------
591 else if (configCmdLine.at(i) == "-no-freetype")
592 dictionary[ "FREETYPE" ] = "no";
593 else if (configCmdLine.at(i) == "-qt-freetype")
594 dictionary[ "FREETYPE" ] = "yes";
596 // CE- C runtime --------------------------------------------
597 else if (configCmdLine.at(i) == "-crt") {
601 QDir cDir(configCmdLine.at(i));
603 cout << "WARNING: Could not find directory (" << qPrintable(configCmdLine.at(i)) << ")for C runtime deployment" << endl;
605 dictionary[ "CE_CRT" ] = QDir::toNativeSeparators(cDir.absolutePath());
606 } else if (configCmdLine.at(i) == "-qt-crt") {
607 dictionary[ "CE_CRT" ] = "yes";
608 } else if (configCmdLine.at(i) == "-no-crt") {
609 dictionary[ "CE_CRT" ] = "no";
611 // cetest ---------------------------------------------------
612 else if (configCmdLine.at(i) == "-no-cetest") {
613 dictionary[ "CETEST" ] = "no";
614 dictionary[ "CETEST_REQUESTED" ] = "no";
615 } else if (configCmdLine.at(i) == "-cetest") {
616 // although specified to use it, we stay at "auto" state
617 // this is because checkAvailability() adds variables
618 // we need for crosscompilation; but remember if we asked
620 dictionary[ "CETEST_REQUESTED" ] = "yes";
622 // Qt/CE - signing tool -------------------------------------
623 else if (configCmdLine.at(i) == "-signature") {
627 QFileInfo info(configCmdLine.at(i));
629 cout << "WARNING: Could not find signature file (" << qPrintable(configCmdLine.at(i)) << ")" << endl;
631 dictionary[ "CE_SIGNATURE" ] = QDir::toNativeSeparators(info.absoluteFilePath());
633 // Styles ---------------------------------------------------
634 else if (configCmdLine.at(i) == "-qt-style-windows")
635 dictionary[ "STYLE_WINDOWS" ] = "yes";
636 else if (configCmdLine.at(i) == "-no-style-windows")
637 dictionary[ "STYLE_WINDOWS" ] = "no";
639 else if (configCmdLine.at(i) == "-qt-style-windowsce")
640 dictionary[ "STYLE_WINDOWSCE" ] = "yes";
641 else if (configCmdLine.at(i) == "-no-style-windowsce")
642 dictionary[ "STYLE_WINDOWSCE" ] = "no";
643 else if (configCmdLine.at(i) == "-qt-style-windowsmobile")
644 dictionary[ "STYLE_WINDOWSMOBILE" ] = "yes";
645 else if (configCmdLine.at(i) == "-no-style-windowsmobile")
646 dictionary[ "STYLE_WINDOWSMOBILE" ] = "no";
648 else if (configCmdLine.at(i) == "-qt-style-windowsxp")
649 dictionary[ "STYLE_WINDOWSXP" ] = "yes";
650 else if (configCmdLine.at(i) == "-no-style-windowsxp")
651 dictionary[ "STYLE_WINDOWSXP" ] = "no";
653 else if (configCmdLine.at(i) == "-qt-style-windowsvista")
654 dictionary[ "STYLE_WINDOWSVISTA" ] = "yes";
655 else if (configCmdLine.at(i) == "-no-style-windowsvista")
656 dictionary[ "STYLE_WINDOWSVISTA" ] = "no";
658 else if (configCmdLine.at(i) == "-qt-style-plastique")
659 dictionary[ "STYLE_PLASTIQUE" ] = "yes";
660 else if (configCmdLine.at(i) == "-no-style-plastique")
661 dictionary[ "STYLE_PLASTIQUE" ] = "no";
663 else if (configCmdLine.at(i) == "-qt-style-cleanlooks")
664 dictionary[ "STYLE_CLEANLOOKS" ] = "yes";
665 else if (configCmdLine.at(i) == "-no-style-cleanlooks")
666 dictionary[ "STYLE_CLEANLOOKS" ] = "no";
668 else if (configCmdLine.at(i) == "-qt-style-motif")
669 dictionary[ "STYLE_MOTIF" ] = "yes";
670 else if (configCmdLine.at(i) == "-no-style-motif")
671 dictionary[ "STYLE_MOTIF" ] = "no";
673 else if (configCmdLine.at(i) == "-qt-style-cde")
674 dictionary[ "STYLE_CDE" ] = "yes";
675 else if (configCmdLine.at(i) == "-no-style-cde")
676 dictionary[ "STYLE_CDE" ] = "no";
678 // Work around compiler nesting limitation
680 continueElse[1] = true;
681 if (!continueElse[1]) {
684 // OpenGL Support -------------------------------------------
685 else if (configCmdLine.at(i) == "-no-opengl") {
686 dictionary[ "OPENGL" ] = "no";
687 } else if (configCmdLine.at(i) == "-opengl-es-cm") {
688 dictionary[ "OPENGL" ] = "yes";
689 dictionary[ "OPENGL_ES_CM" ] = "yes";
690 } else if (configCmdLine.at(i) == "-opengl-es-2") {
691 dictionary[ "OPENGL" ] = "yes";
692 dictionary[ "OPENGL_ES_2" ] = "yes";
693 } else if (configCmdLine.at(i) == "-opengl") {
694 dictionary[ "OPENGL" ] = "yes";
699 if (configCmdLine.at(i) == "es1") {
700 dictionary[ "OPENGL_ES_CM" ] = "yes";
701 } else if ( configCmdLine.at(i) == "es2" ) {
702 dictionary[ "OPENGL_ES_2" ] = "yes";
703 } else if ( configCmdLine.at(i) == "desktop" ) {
704 // OPENGL=yes suffices
706 cout << "Argument passed to -opengl option is not valid." << endl;
707 dictionary[ "DONE" ] = "error";
712 // OpenVG Support -------------------------------------------
713 else if (configCmdLine.at(i) == "-openvg") {
714 dictionary[ "OPENVG" ] = "yes";
715 } else if (configCmdLine.at(i) == "-no-openvg") {
716 dictionary[ "OPENVG" ] = "no";
719 // Databases ------------------------------------------------
720 else if (configCmdLine.at(i) == "-qt-sql-mysql")
721 dictionary[ "SQL_MYSQL" ] = "yes";
722 else if (configCmdLine.at(i) == "-plugin-sql-mysql")
723 dictionary[ "SQL_MYSQL" ] = "plugin";
724 else if (configCmdLine.at(i) == "-no-sql-mysql")
725 dictionary[ "SQL_MYSQL" ] = "no";
727 else if (configCmdLine.at(i) == "-qt-sql-odbc")
728 dictionary[ "SQL_ODBC" ] = "yes";
729 else if (configCmdLine.at(i) == "-plugin-sql-odbc")
730 dictionary[ "SQL_ODBC" ] = "plugin";
731 else if (configCmdLine.at(i) == "-no-sql-odbc")
732 dictionary[ "SQL_ODBC" ] = "no";
734 else if (configCmdLine.at(i) == "-qt-sql-oci")
735 dictionary[ "SQL_OCI" ] = "yes";
736 else if (configCmdLine.at(i) == "-plugin-sql-oci")
737 dictionary[ "SQL_OCI" ] = "plugin";
738 else if (configCmdLine.at(i) == "-no-sql-oci")
739 dictionary[ "SQL_OCI" ] = "no";
741 else if (configCmdLine.at(i) == "-qt-sql-psql")
742 dictionary[ "SQL_PSQL" ] = "yes";
743 else if (configCmdLine.at(i) == "-plugin-sql-psql")
744 dictionary[ "SQL_PSQL" ] = "plugin";
745 else if (configCmdLine.at(i) == "-no-sql-psql")
746 dictionary[ "SQL_PSQL" ] = "no";
748 else if (configCmdLine.at(i) == "-qt-sql-tds")
749 dictionary[ "SQL_TDS" ] = "yes";
750 else if (configCmdLine.at(i) == "-plugin-sql-tds")
751 dictionary[ "SQL_TDS" ] = "plugin";
752 else if (configCmdLine.at(i) == "-no-sql-tds")
753 dictionary[ "SQL_TDS" ] = "no";
755 else if (configCmdLine.at(i) == "-qt-sql-db2")
756 dictionary[ "SQL_DB2" ] = "yes";
757 else if (configCmdLine.at(i) == "-plugin-sql-db2")
758 dictionary[ "SQL_DB2" ] = "plugin";
759 else if (configCmdLine.at(i) == "-no-sql-db2")
760 dictionary[ "SQL_DB2" ] = "no";
762 else if (configCmdLine.at(i) == "-qt-sql-sqlite")
763 dictionary[ "SQL_SQLITE" ] = "yes";
764 else if (configCmdLine.at(i) == "-plugin-sql-sqlite")
765 dictionary[ "SQL_SQLITE" ] = "plugin";
766 else if (configCmdLine.at(i) == "-no-sql-sqlite")
767 dictionary[ "SQL_SQLITE" ] = "no";
768 else if (configCmdLine.at(i) == "-system-sqlite")
769 dictionary[ "SQL_SQLITE_LIB" ] = "system";
770 else if (configCmdLine.at(i) == "-qt-sql-sqlite2")
771 dictionary[ "SQL_SQLITE2" ] = "yes";
772 else if (configCmdLine.at(i) == "-plugin-sql-sqlite2")
773 dictionary[ "SQL_SQLITE2" ] = "plugin";
774 else if (configCmdLine.at(i) == "-no-sql-sqlite2")
775 dictionary[ "SQL_SQLITE2" ] = "no";
777 else if (configCmdLine.at(i) == "-qt-sql-ibase")
778 dictionary[ "SQL_IBASE" ] = "yes";
779 else if (configCmdLine.at(i) == "-plugin-sql-ibase")
780 dictionary[ "SQL_IBASE" ] = "plugin";
781 else if (configCmdLine.at(i) == "-no-sql-ibase")
782 dictionary[ "SQL_IBASE" ] = "no";
784 // Image formats --------------------------------------------
785 else if (configCmdLine.at(i).startsWith("-qt-imageformat-") &&
786 imageFormats.contains(configCmdLine.at(i).section('-', 3)))
787 dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "yes";
788 else if (configCmdLine.at(i).startsWith("-plugin-imageformat-") &&
789 imageFormats.contains(configCmdLine.at(i).section('-', 3)))
790 dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "plugin";
791 else if (configCmdLine.at(i).startsWith("-no-imageformat-") &&
792 imageFormats.contains(configCmdLine.at(i).section('-', 3)))
793 dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "no";
795 // IDE project generation -----------------------------------
796 else if (configCmdLine.at(i) == "-no-dsp")
797 dictionary[ "DSPFILES" ] = "no";
798 else if (configCmdLine.at(i) == "-dsp")
799 dictionary[ "DSPFILES" ] = "yes";
801 else if (configCmdLine.at(i) == "-no-vcp")
802 dictionary[ "VCPFILES" ] = "no";
803 else if (configCmdLine.at(i) == "-vcp")
804 dictionary[ "VCPFILES" ] = "yes";
806 else if (configCmdLine.at(i) == "-no-vcproj")
807 dictionary[ "VCPROJFILES" ] = "no";
808 else if (configCmdLine.at(i) == "-vcproj")
809 dictionary[ "VCPROJFILES" ] = "yes";
811 else if (configCmdLine.at(i) == "-no-incredibuild-xge")
812 dictionary[ "INCREDIBUILD_XGE" ] = "no";
813 else if (configCmdLine.at(i) == "-incredibuild-xge")
814 dictionary[ "INCREDIBUILD_XGE" ] = "yes";
815 else if (configCmdLine.at(i) == "-native-gestures")
816 dictionary[ "NATIVE_GESTURES" ] = "yes";
817 else if (configCmdLine.at(i) == "-no-native-gestures")
818 dictionary[ "NATIVE_GESTURES" ] = "no";
820 // Others ---------------------------------------------------
821 else if (configCmdLine.at(i) == "-fast")
822 dictionary[ "FAST" ] = "yes";
823 else if (configCmdLine.at(i) == "-no-fast")
824 dictionary[ "FAST" ] = "no";
826 else if (configCmdLine.at(i) == "-stl")
827 dictionary[ "STL" ] = "yes";
828 else if (configCmdLine.at(i) == "-no-stl")
829 dictionary[ "STL" ] = "no";
831 else if (configCmdLine.at(i) == "-exceptions")
832 dictionary[ "EXCEPTIONS" ] = "yes";
833 else if (configCmdLine.at(i) == "-no-exceptions")
834 dictionary[ "EXCEPTIONS" ] = "no";
836 else if (configCmdLine.at(i) == "-rtti")
837 dictionary[ "RTTI" ] = "yes";
838 else if (configCmdLine.at(i) == "-no-rtti")
839 dictionary[ "RTTI" ] = "no";
841 else if (configCmdLine.at(i) == "-accessibility")
842 dictionary[ "ACCESSIBILITY" ] = "yes";
843 else if (configCmdLine.at(i) == "-no-accessibility") {
844 dictionary[ "ACCESSIBILITY" ] = "no";
845 cout << "Setting accessibility to NO" << endl;
848 else if (configCmdLine.at(i) == "-no-mmx")
849 dictionary[ "MMX" ] = "no";
850 else if (configCmdLine.at(i) == "-mmx")
851 dictionary[ "MMX" ] = "yes";
852 else if (configCmdLine.at(i) == "-no-3dnow")
853 dictionary[ "3DNOW" ] = "no";
854 else if (configCmdLine.at(i) == "-3dnow")
855 dictionary[ "3DNOW" ] = "yes";
856 else if (configCmdLine.at(i) == "-no-sse")
857 dictionary[ "SSE" ] = "no";
858 else if (configCmdLine.at(i) == "-sse")
859 dictionary[ "SSE" ] = "yes";
860 else if (configCmdLine.at(i) == "-no-sse2")
861 dictionary[ "SSE2" ] = "no";
862 else if (configCmdLine.at(i) == "-sse2")
863 dictionary[ "SSE2" ] = "yes";
864 else if (configCmdLine.at(i) == "-no-iwmmxt")
865 dictionary[ "IWMMXT" ] = "no";
866 else if (configCmdLine.at(i) == "-iwmmxt")
867 dictionary[ "IWMMXT" ] = "yes";
869 else if (configCmdLine.at(i) == "-no-openssl") {
870 dictionary[ "OPENSSL"] = "no";
871 } else if (configCmdLine.at(i) == "-openssl") {
872 dictionary[ "OPENSSL" ] = "yes";
873 } else if (configCmdLine.at(i) == "-openssl-linked") {
874 dictionary[ "OPENSSL" ] = "linked";
875 } else if (configCmdLine.at(i) == "-no-qdbus") {
876 dictionary[ "DBUS" ] = "no";
877 } else if (configCmdLine.at(i) == "-qdbus") {
878 dictionary[ "DBUS" ] = "yes";
879 } else if (configCmdLine.at(i) == "-no-dbus") {
880 dictionary[ "DBUS" ] = "no";
881 } else if (configCmdLine.at(i) == "-dbus") {
882 dictionary[ "DBUS" ] = "yes";
883 } else if (configCmdLine.at(i) == "-dbus-linked") {
884 dictionary[ "DBUS" ] = "linked";
885 } else if (configCmdLine.at(i) == "-no-script") {
886 dictionary[ "SCRIPT" ] = "no";
887 } else if (configCmdLine.at(i) == "-script") {
888 dictionary[ "SCRIPT" ] = "yes";
889 } else if (configCmdLine.at(i) == "-no-scripttools") {
890 dictionary[ "SCRIPTTOOLS" ] = "no";
891 } else if (configCmdLine.at(i) == "-scripttools") {
892 dictionary[ "SCRIPTTOOLS" ] = "yes";
893 } else if (configCmdLine.at(i) == "-no-xmlpatterns") {
894 dictionary[ "XMLPATTERNS" ] = "no";
895 } else if (configCmdLine.at(i) == "-xmlpatterns") {
896 dictionary[ "XMLPATTERNS" ] = "yes";
897 } else if (configCmdLine.at(i) == "-no-multimedia") {
898 dictionary[ "MULTIMEDIA" ] = "no";
899 } else if (configCmdLine.at(i) == "-multimedia") {
900 dictionary[ "MULTIMEDIA" ] = "yes";
901 } else if (configCmdLine.at(i) == "-audio-backend") {
902 dictionary[ "AUDIO_BACKEND" ] = "yes";
903 } else if (configCmdLine.at(i) == "-no-audio-backend") {
904 dictionary[ "AUDIO_BACKEND" ] = "no";
905 } else if (configCmdLine.at(i) == "-no-phonon") {
906 dictionary[ "PHONON" ] = "no";
907 } else if (configCmdLine.at(i) == "-phonon") {
908 dictionary[ "PHONON" ] = "yes";
909 } else if (configCmdLine.at(i) == "-no-phonon-backend") {
910 dictionary[ "PHONON_BACKEND" ] = "no";
911 } else if (configCmdLine.at(i) == "-phonon-backend") {
912 dictionary[ "PHONON_BACKEND" ] = "yes";
913 } else if (configCmdLine.at(i) == "-phonon-wince-ds9") {
914 dictionary[ "DIRECTSHOW" ] = "yes";
915 } else if (configCmdLine.at(i) == "-no-webkit") {
916 dictionary[ "WEBKIT" ] = "no";
917 } else if (configCmdLine.at(i) == "-webkit") {
918 dictionary[ "WEBKIT" ] = "yes";
919 } else if (configCmdLine.at(i) == "-webkit-debug") {
920 dictionary[ "WEBKIT" ] = "debug";
921 } else if (configCmdLine.at(i) == "-no-v8") {
922 dictionary[ "V8" ] = "no";
923 } else if (configCmdLine.at(i) == "-v8") {
924 dictionary[ "V8" ] = "yes";
925 } else if (configCmdLine.at(i) == "-no-declarative") {
926 dictionary[ "DECLARATIVE" ] = "no";
927 } else if (configCmdLine.at(i) == "-declarative") {
928 dictionary[ "DECLARATIVE" ] = "yes";
929 } else if (configCmdLine.at(i) == "-no-declarative-debug") {
930 dictionary[ "DECLARATIVE_DEBUG" ] = "no";
931 } else if (configCmdLine.at(i) == "-declarative-debug") {
932 dictionary[ "DECLARATIVE_DEBUG" ] = "yes";
933 } else if (configCmdLine.at(i) == "-no-plugin-manifests") {
934 dictionary[ "PLUGIN_MANIFESTS" ] = "no";
935 } else if (configCmdLine.at(i) == "-plugin-manifests") {
936 dictionary[ "PLUGIN_MANIFESTS" ] = "yes";
939 // Work around compiler nesting limitation
941 continueElse[0] = true;
942 if (!continueElse[0]) {
945 else if (configCmdLine.at(i) == "-internal")
946 dictionary[ "QMAKE_INTERNAL" ] = "yes";
948 else if (configCmdLine.at(i) == "-no-qmake")
949 dictionary[ "BUILD_QMAKE" ] = "no";
950 else if (configCmdLine.at(i) == "-qmake")
951 dictionary[ "BUILD_QMAKE" ] = "yes";
953 else if (configCmdLine.at(i) == "-dont-process")
954 dictionary[ "NOPROCESS" ] = "yes";
955 else if (configCmdLine.at(i) == "-process")
956 dictionary[ "NOPROCESS" ] = "no";
958 else if (configCmdLine.at(i) == "-no-qmake-deps")
959 dictionary[ "DEPENDENCIES" ] = "no";
960 else if (configCmdLine.at(i) == "-qmake-deps")
961 dictionary[ "DEPENDENCIES" ] = "yes";
964 else if (configCmdLine.at(i) == "-qtnamespace") {
968 dictionary[ "QT_NAMESPACE" ] = configCmdLine.at(i);
969 } else if (configCmdLine.at(i) == "-qtlibinfix") {
973 dictionary[ "QT_LIBINFIX" ] = configCmdLine.at(i);
974 } else if (configCmdLine.at(i) == "-D") {
978 qmakeDefines += configCmdLine.at(i);
979 } else if (configCmdLine.at(i) == "-I") {
983 qmakeIncludes += configCmdLine.at(i);
984 } else if (configCmdLine.at(i) == "-L") {
988 QFileInfo check(configCmdLine.at(i));
989 if (!check.isDir()) {
990 cout << "Argument passed to -L option is not a directory path. Did you mean the -l option?" << endl;
991 dictionary[ "DONE" ] = "error";
994 qmakeLibs += QString("-L" + configCmdLine.at(i));
995 } else if (configCmdLine.at(i) == "-l") {
999 qmakeLibs += QString("-l" + configCmdLine.at(i));
1000 } else if (configCmdLine.at(i).startsWith("OPENSSL_LIBS=")) {
1001 opensslLibs = configCmdLine.at(i);
1002 } else if (configCmdLine.at(i).startsWith("PSQL_LIBS=")) {
1003 psqlLibs = configCmdLine.at(i);
1004 } else if (configCmdLine.at(i).startsWith("SYBASE=")) {
1005 sybase = configCmdLine.at(i);
1006 } else if (configCmdLine.at(i).startsWith("SYBASE_LIBS=")) {
1007 sybaseLibs = configCmdLine.at(i);
1008 } else if (configCmdLine.at(i) == "-qpa") {
1009 dictionary["QPA"] = "yes";
1012 else if ((configCmdLine.at(i) == "-override-version") || (configCmdLine.at(i) == "-version-override")){
1016 dictionary[ "VERSION" ] = configCmdLine.at(i);
1019 else if (configCmdLine.at(i) == "-saveconfig") {
1023 dictionary[ "CUSTOMCONFIG" ] = "_" + configCmdLine.at(i);
1026 else if (configCmdLine.at(i) == "-confirm-license") {
1027 dictionary["LICENSE_CONFIRMED"] = "yes";
1030 else if (configCmdLine.at(i) == "-nomake") {
1034 disabledBuildParts += configCmdLine.at(i);
1037 // Directories ----------------------------------------------
1038 else if (configCmdLine.at(i) == "-prefix") {
1042 dictionary[ "QT_INSTALL_PREFIX" ] = configCmdLine.at(i);
1045 else if (configCmdLine.at(i) == "-bindir") {
1049 dictionary[ "QT_INSTALL_BINS" ] = configCmdLine.at(i);
1052 else if (configCmdLine.at(i) == "-libdir") {
1056 dictionary[ "QT_INSTALL_LIBS" ] = configCmdLine.at(i);
1059 else if (configCmdLine.at(i) == "-docdir") {
1063 dictionary[ "QT_INSTALL_DOCS" ] = configCmdLine.at(i);
1066 else if (configCmdLine.at(i) == "-headerdir") {
1070 dictionary[ "QT_INSTALL_HEADERS" ] = configCmdLine.at(i);
1073 else if (configCmdLine.at(i) == "-plugindir") {
1077 dictionary[ "QT_INSTALL_PLUGINS" ] = configCmdLine.at(i);
1080 else if (configCmdLine.at(i) == "-importdir") {
1084 dictionary[ "QT_INSTALL_IMPORTS" ] = configCmdLine.at(i);
1086 else if (configCmdLine.at(i) == "-datadir") {
1090 dictionary[ "QT_INSTALL_DATA" ] = configCmdLine.at(i);
1093 else if (configCmdLine.at(i) == "-translationdir") {
1097 dictionary[ "QT_INSTALL_TRANSLATIONS" ] = configCmdLine.at(i);
1100 else if (configCmdLine.at(i) == "-examplesdir") {
1104 dictionary[ "QT_INSTALL_EXAMPLES" ] = configCmdLine.at(i);
1107 else if (configCmdLine.at(i) == "-testsdir") {
1111 dictionary[ "QT_INSTALL_TESTS" ] = configCmdLine.at(i);
1114 else if (configCmdLine.at(i) == "-hostprefix") {
1118 dictionary[ "QT_HOST_PREFIX" ] = configCmdLine.at(i);
1121 else if (configCmdLine.at(i) == "-make") {
1125 dictionary[ "MAKE" ] = configCmdLine.at(i);
1128 else if (configCmdLine.at(i).indexOf(QRegExp("^-(en|dis)able-")) != -1) {
1129 // Scan to see if any specific modules and drivers are enabled or disabled
1130 for (QStringList::Iterator module = modules.begin(); module != modules.end(); ++module) {
1131 if (configCmdLine.at(i) == QString("-enable-") + (*module)) {
1132 enabledModules += (*module);
1135 else if (configCmdLine.at(i) == QString("-disable-") + (*module)) {
1136 disabledModules += (*module);
1142 else if (configCmdLine.at(i) == "-directwrite") {
1143 dictionary["DIRECTWRITE"] = "yes";
1144 } else if (configCmdLine.at(i) == "-no-directwrite") {
1145 dictionary["DIRECTWRITE"] = "no";
1149 dictionary[ "HELP" ] = "yes";
1150 cout << "Unknown option " << configCmdLine.at(i) << endl;
1157 // Ensure that QMAKESPEC exists in the mkspecs folder
1158 QDir mkspec_dir = fixSeparators(sourcePath + "/mkspecs");
1159 QStringList mkspecs = mkspec_dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot);
1161 if (dictionary["QMAKESPEC"].toLower() == "features"
1162 || !mkspecs.contains(dictionary["QMAKESPEC"], Qt::CaseInsensitive)) {
1163 dictionary[ "HELP" ] = "yes";
1164 if (dictionary ["QMAKESPEC_FROM"] == "commandline") {
1165 cout << "Invalid option \"" << dictionary["QMAKESPEC"] << "\" for -platform." << endl;
1166 } else if (dictionary ["QMAKESPEC_FROM"] == "env") {
1167 cout << "QMAKESPEC environment variable is set to \"" << dictionary["QMAKESPEC"]
1168 << "\" which is not a supported platform" << endl;
1169 } else { // was autodetected from environment
1170 cout << "Unable to detect the platform from environment. Use -platform command line"
1171 "argument or set the QMAKESPEC environment variable and run configure again" << endl;
1173 cout << "See the README file for a list of supported operating systems and compilers." << endl;
1175 if (dictionary[ "QMAKESPEC" ].endsWith("-icc") ||
1176 dictionary[ "QMAKESPEC" ].endsWith("-msvc") ||
1177 dictionary[ "QMAKESPEC" ].endsWith("-msvc.net") ||
1178 dictionary[ "QMAKESPEC" ].endsWith("-msvc2002") ||
1179 dictionary[ "QMAKESPEC" ].endsWith("-msvc2003") ||
1180 dictionary[ "QMAKESPEC" ].endsWith("-msvc2005") ||
1181 dictionary[ "QMAKESPEC" ].endsWith("-msvc2008") ||
1182 dictionary[ "QMAKESPEC" ].endsWith("-msvc2010")) {
1183 if (dictionary[ "MAKE" ].isEmpty()) dictionary[ "MAKE" ] = "nmake";
1184 dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32";
1185 } else if (dictionary[ "QMAKESPEC" ] == QString("win32-g++")) {
1186 if (dictionary[ "MAKE" ].isEmpty()) dictionary[ "MAKE" ] = "mingw32-make";
1187 if (Environment::detectExecutable("sh.exe")) {
1188 dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32-g++-sh";
1190 dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32-g++";
1193 if (dictionary[ "MAKE" ].isEmpty()) dictionary[ "MAKE" ] = "make";
1194 dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32";
1198 // Tell the user how to proceed building Qt after configure finished its job
1199 dictionary["QTBUILDINSTRUCTION"] = dictionary["MAKE"];
1200 if (dictionary.contains("XQMAKESPEC")) {
1201 if (dictionary["XQMAKESPEC"].startsWith("wince")) {
1202 dictionary["QTBUILDINSTRUCTION"] =
1203 QString("setcepaths.bat ") + dictionary["XQMAKESPEC"] + QString(" && ") + dictionary["MAKE"];
1207 // Tell the user how to confclean before the next configure
1208 dictionary["CONFCLEANINSTRUCTION"] = dictionary["MAKE"] + QString(" confclean");
1210 // Ensure that -spec (XQMAKESPEC) exists in the mkspecs folder as well
1211 if (dictionary.contains("XQMAKESPEC") &&
1212 !mkspecs.contains(dictionary["XQMAKESPEC"], Qt::CaseInsensitive)) {
1213 dictionary["HELP"] = "yes";
1214 cout << "Invalid option \"" << dictionary["XQMAKESPEC"] << "\" for -xplatform." << endl;
1217 // Ensure that the crt to be deployed can be found
1218 if (dictionary["CE_CRT"] != QLatin1String("yes") && dictionary["CE_CRT"] != QLatin1String("no")) {
1219 QDir cDir(dictionary["CE_CRT"]);
1220 QStringList entries = cDir.entryList();
1221 bool hasDebug = entries.contains("msvcr80.dll");
1222 bool hasRelease = entries.contains("msvcr80d.dll");
1223 if ((dictionary["BUILDALL"] == "auto") && (!hasDebug || !hasRelease)) {
1224 cout << "Could not find debug and release c-runtime." << endl;
1225 cout << "You need to have msvcr80.dll and msvcr80d.dll in" << endl;
1226 cout << "the path specified. Setting to -no-crt";
1227 dictionary[ "CE_CRT" ] = "no";
1228 } else if ((dictionary["BUILD"] == "debug") && !hasDebug) {
1229 cout << "Could not find debug c-runtime (msvcr80d.dll) in the directory specified." << endl;
1230 cout << "Setting c-runtime automatic deployment to -no-crt" << endl;
1231 dictionary[ "CE_CRT" ] = "no";
1232 } else if ((dictionary["BUILD"] == "release") && !hasRelease) {
1233 cout << "Could not find release c-runtime (msvcr80.dll) in the directory specified." << endl;
1234 cout << "Setting c-runtime automatic deployment to -no-crt" << endl;
1235 dictionary[ "CE_CRT" ] = "no";
1239 useUnixSeparators = (dictionary["QMAKESPEC"] == "win32-g++");
1241 // Allow tests for private classes to be compiled against internal builds
1242 if (dictionary["BUILDDEV"] == "yes")
1243 qtConfig += "private_tests";
1245 if (dictionary["FORCE_ASSERTS"] == "yes")
1246 qtConfig += "force_asserts";
1249 for (QStringList::Iterator dis = disabledModules.begin(); dis != disabledModules.end(); ++dis) {
1250 modules.removeAll((*dis));
1252 for (QStringList::Iterator ena = enabledModules.begin(); ena != enabledModules.end(); ++ena) {
1253 if (modules.indexOf((*ena)) == -1)
1256 qtConfig += modules;
1258 for (QStringList::Iterator it = disabledModules.begin(); it != disabledModules.end(); ++it)
1259 qtConfig.removeAll(*it);
1261 if ((dictionary[ "REDO" ] != "yes") && (dictionary[ "HELP" ] != "yes"))
1267 void Configure::validateArgs()
1269 // Validate the specified config
1271 // Get all possible configurations from the file system.
1273 QStringList filters;
1274 filters << "qconfig-*.h";
1275 dir.setNameFilters(filters);
1276 dir.setPath(sourcePath + "/src/corelib/global/");
1278 QStringList stringList = dir.entryList();
1280 QStringList::Iterator it;
1281 for (it = stringList.begin(); it != stringList.end(); ++it)
1282 allConfigs << it->remove("qconfig-").remove(".h");
1283 allConfigs << "full";
1285 // Try internal configurations first.
1286 QStringList possible_configs = QStringList()
1292 int index = possible_configs.indexOf(dictionary["QCONFIG"]);
1294 for (int c = 0; c <= index; c++) {
1295 qmakeConfig += possible_configs[c] + "-config";
1300 // If the internal configurations failed, try others.
1301 QStringList::Iterator config;
1302 for (config = allConfigs.begin(); config != allConfigs.end(); ++config) {
1303 if ((*config) == dictionary[ "QCONFIG" ])
1306 if (config == allConfigs.end()) {
1307 dictionary[ "HELP" ] = "yes";
1308 cout << "No such configuration \"" << qPrintable(dictionary[ "QCONFIG" ]) << "\"" << endl ;
1311 qmakeConfig += (*config) + "-config";
1316 // Output helper functions --------------------------------[ Start ]-
1318 Determines the length of a string token.
1320 static int tokenLength(const char *str)
1325 const char *nextToken = strpbrk(str, " _/\n\r");
1326 if (nextToken == str || !nextToken)
1329 return int(nextToken - str);
1333 Prints out a string which starts at position \a startingAt, and
1334 indents each wrapped line with \a wrapIndent characters.
1335 The wrap point is set to the console width, unless that width
1336 cannot be determined, or is too small.
1338 void Configure::desc(const char *description, int startingAt, int wrapIndent)
1340 int linePos = startingAt;
1342 bool firstLine = true;
1343 const char *nextToken = description;
1344 while (*nextToken) {
1345 int nextTokenLen = tokenLength(nextToken);
1346 if (*nextToken == '\n' // Wrap on newline, duh
1347 || (linePos + nextTokenLen > outputWidth)) // Wrap at outputWidth
1352 if (*nextToken == '\n')
1356 if (!firstLine && linePos < wrapIndent) { // Indent to wrapIndent
1357 printf("%*s", wrapIndent , "");
1358 linePos = wrapIndent;
1359 if (*nextToken == ' ') {
1364 printf("%.*s", nextTokenLen, nextToken);
1365 linePos += nextTokenLen;
1366 nextToken += nextTokenLen;
1371 Prints out an option with its description wrapped at the
1372 description starting point. If \a skipIndent is true, the
1373 indentation to the option is not outputted (used by marked option
1374 version of desc()). Extra spaces between option and its
1375 description is filled with\a fillChar, if there's available
1378 void Configure::desc(const char *option, const char *description, bool skipIndent, char fillChar)
1381 printf("%*s", optionIndent, "");
1383 int remaining = descIndent - optionIndent - strlen(option);
1384 int wrapIndent = descIndent + qMax(0, 1 - remaining);
1385 printf("%s", option);
1387 if (remaining > 2) {
1388 printf(" "); // Space in front
1389 for (int i = remaining; i > 2; --i)
1390 printf("%c", fillChar); // Fill, if available space
1392 printf(" "); // Space between option and description
1394 desc(description, wrapIndent, wrapIndent);
1399 Same as above, except it also marks an option with an '*', if
1400 the option is default action.
1402 void Configure::desc(const char *mark_option, const char *mark, const char *option, const char *description, char fillChar)
1404 const QString markedAs = dictionary.value(mark_option);
1405 if (markedAs == "auto" && markedAs == mark) // both "auto", always => +
1407 else if (markedAs == "auto") // setting marked as "auto" and option is default => +
1408 printf(" %c " , (defaultTo(mark_option) == QLatin1String(mark))? '+' : ' ');
1409 else if (QLatin1String(mark) == "auto" && markedAs != "no") // description marked as "auto" and option is available => +
1410 printf(" %c " , checkAvailability(mark_option) ? '+' : ' ');
1411 else // None are "auto", (markedAs == mark) => *
1412 printf(" %c " , markedAs == QLatin1String(mark) ? '*' : ' ');
1414 desc(option, description, true, fillChar);
1418 Modifies the default configuration based on given -platform option.
1419 Eg. switches to different default styles for Windows CE.
1421 void Configure::applySpecSpecifics()
1423 if (dictionary[ "XQMAKESPEC" ].startsWith("wince")) {
1424 dictionary[ "STYLE_WINDOWSXP" ] = "no";
1425 dictionary[ "STYLE_WINDOWSVISTA" ] = "no";
1426 dictionary[ "STYLE_PLASTIQUE" ] = "no";
1427 dictionary[ "STYLE_CLEANLOOKS" ] = "no";
1428 dictionary[ "STYLE_WINDOWSCE" ] = "yes";
1429 dictionary[ "STYLE_WINDOWSMOBILE" ] = "yes";
1430 dictionary[ "STYLE_MOTIF" ] = "no";
1431 dictionary[ "STYLE_CDE" ] = "no";
1432 dictionary[ "FREETYPE" ] = "no";
1433 dictionary[ "OPENGL" ] = "no";
1434 dictionary[ "OPENSSL" ] = "no";
1435 dictionary[ "STL" ] = "no";
1436 dictionary[ "EXCEPTIONS" ] = "no";
1437 dictionary[ "RTTI" ] = "no";
1438 dictionary[ "ARCHITECTURE" ] = "windowsce";
1439 dictionary[ "3DNOW" ] = "no";
1440 dictionary[ "SSE" ] = "no";
1441 dictionary[ "SSE2" ] = "no";
1442 dictionary[ "MMX" ] = "no";
1443 dictionary[ "IWMMXT" ] = "no";
1444 dictionary[ "CE_CRT" ] = "yes";
1445 dictionary[ "WEBKIT" ] = "no";
1446 dictionary[ "PHONON" ] = "yes";
1447 dictionary[ "DIRECTSHOW" ] = "no";
1448 // We only apply MMX/IWMMXT for mkspecs we know they work
1449 if (dictionary[ "XQMAKESPEC" ].startsWith("wincewm")) {
1450 dictionary[ "MMX" ] = "yes";
1451 dictionary[ "IWMMXT" ] = "yes";
1452 dictionary[ "DIRECTSHOW" ] = "yes";
1454 dictionary[ "QT_HOST_PREFIX" ] = dictionary[ "QT_INSTALL_PREFIX" ];
1455 dictionary[ "QT_INSTALL_PREFIX" ] = "";
1457 } else if (dictionary[ "XQMAKESPEC" ].startsWith("linux")) { //TODO actually wrong.
1459 dictionary[ "STYLE_WINDOWSXP" ] = "no";
1460 dictionary[ "STYLE_WINDOWSVISTA" ] = "no";
1461 dictionary[ "KBD_DRIVERS" ] = "tty";
1462 dictionary[ "GFX_DRIVERS" ] = "linuxfb vnc";
1463 dictionary[ "MOUSE_DRIVERS" ] = "pc linuxtp";
1464 dictionary[ "OPENGL" ] = "no";
1465 dictionary[ "EXCEPTIONS" ] = "no";
1466 dictionary[ "DBUS"] = "no";
1467 dictionary[ "QT_QWS_DEPTH" ] = "4 8 16 24 32";
1468 dictionary[ "QT_SXE" ] = "no";
1469 dictionary[ "QT_INOTIFY" ] = "no";
1470 dictionary[ "QT_LPR" ] = "no";
1471 dictionary[ "QT_CUPS" ] = "no";
1472 dictionary[ "QT_GLIB" ] = "no";
1473 dictionary[ "QT_ICONV" ] = "no";
1475 dictionary["DECORATIONS"] = "default windows styled";
1479 QString Configure::locateFileInPaths(const QString &fileName, const QStringList &paths)
1482 for (QStringList::ConstIterator it = paths.begin(); it != paths.end(); ++it) {
1483 // Remove any leading or trailing ", this is commonly used in the environment
1485 QString path = (*it);
1486 if (path.startsWith("\""))
1487 path = path.right(path.length() - 1);
1488 if (path.endsWith("\""))
1489 path = path.left(path.length() - 1);
1490 if (d.exists(path + QDir::separator() + fileName)) {
1497 QString Configure::locateFile(const QString &fileName)
1499 QString file = fileName.toLower();
1501 #if defined(Q_OS_WIN32)
1502 QRegExp splitReg("[;,]");
1504 QRegExp splitReg("[:]");
1506 if (file.endsWith(".h"))
1507 paths = QString::fromLocal8Bit(getenv("INCLUDE")).split(splitReg, QString::SkipEmptyParts);
1508 else if (file.endsWith(".lib"))
1509 paths = QString::fromLocal8Bit(getenv("LIB")).split(splitReg, QString::SkipEmptyParts);
1511 paths = QString::fromLocal8Bit(getenv("PATH")).split(splitReg, QString::SkipEmptyParts);
1512 return locateFileInPaths(file, paths);
1515 // Output helper functions ---------------------------------[ Stop ]-
1518 bool Configure::displayHelp()
1520 if (dictionary[ "HELP" ] == "yes") {
1521 desc("Usage: configure\n"
1522 // desc("Usage: configure [-prefix dir] [-bindir <dir>] [-libdir <dir>]\n"
1523 // "[-docdir <dir>] [-headerdir <dir>] [-plugindir <dir>]\n"
1524 // "[-importdir <dir>] [-datadir <dir>] [-translationdir <dir>]\n"
1525 // "[-examplesdir <dir>]\n"
1526 "[-release] [-debug] [-debug-and-release] [-shared] [-static]\n"
1527 "[-no-fast] [-fast] [-no-exceptions] [-exceptions]\n"
1528 "[-no-accessibility] [-accessibility] [-no-rtti] [-rtti]\n"
1529 "[-no-stl] [-stl] [-no-sql-<driver>] [-qt-sql-<driver>]\n"
1530 "[-plugin-sql-<driver>] [-system-sqlite] [-arch <arch>]\n"
1531 "[-D <define>] [-I <includepath>] [-L <librarypath>]\n"
1532 "[-help] [-no-dsp] [-dsp] [-no-vcproj] [-vcproj]\n"
1533 "[-no-qmake] [-qmake] [-dont-process] [-process]\n"
1534 "[-no-style-<style>] [-qt-style-<style>] [-redo]\n"
1535 "[-saveconfig <config>] [-loadconfig <config>]\n"
1536 "[-qt-zlib] [-system-zlib] [-no-gif] [-no-libpng]\n"
1537 "[-qt-libpng] [-system-libpng] [-no-libtiff] [-qt-libtiff]\n"
1538 "[-system-libtiff] [-no-libjpeg] [-qt-libjpeg] [-system-libjpeg]\n"
1539 "[-no-libmng] [-qt-libmng] [-system-libmng] [-mmx]\n"
1540 "[-no-mmx] [-3dnow] [-no-3dnow] [-sse] [-no-sse] [-sse2] [-no-sse2]\n"
1541 "[-no-iwmmxt] [-iwmmxt] [-openssl] [-openssl-linked]\n"
1542 "[-no-openssl] [-no-dbus] [-dbus] [-dbus-linked] [-platform <spec>]\n"
1543 "[-qtnamespace <namespace>] [-qtlibinfix <infix>] [-no-phonon]\n"
1544 "[-phonon] [-no-phonon-backend] [-phonon-backend]\n"
1545 "[-no-multimedia] [-multimedia] [-no-audio-backend] [-audio-backend]\n"
1546 "[-no-script] [-script] [-no-scripttools] [-scripttools]\n"
1547 "[-no-webkit] [-webkit] [-webkit-debug]\n"
1548 "[-no-directwrite] [-directwrite] [-qpa]\n\n", 0, 7);
1550 desc("Installation options:\n\n");
1554 desc(" These are optional, but you may specify install directories.\n\n", 0, 1);
1556 desc( "-prefix dir", "This will install everything relative to dir\n(default $QT_INSTALL_PREFIX)\n");
1558 desc(" You may use these to separate different parts of the install:\n\n", 0, 1);
1560 desc( "-bindir <dir>", "Executables will be installed to dir\n(default PREFIX/bin)");
1561 desc( "-libdir <dir>", "Libraries will be installed to dir\n(default PREFIX/lib)");
1562 desc( "-docdir <dir>", "Documentation will be installed to dir\n(default PREFIX/doc)");
1563 desc( "-headerdir <dir>", "Headers will be installed to dir\n(default PREFIX/include)");
1564 desc( "-plugindir <dir>", "Plugins will be installed to dir\n(default PREFIX/plugins)");
1565 desc( "-importdir <dir>", "Imports for QML will be installed to dir\n(default PREFIX/imports)");
1566 desc( "-datadir <dir>", "Data used by Qt programs will be installed to dir\n(default PREFIX)");
1567 desc( "-translationdir <dir>","Translations of Qt programs will be installed to dir\n(default PREFIX/translations)\n");
1568 desc( "-examplesdir <dir>", "Examples will be installed to dir\n(default PREFIX/examples)");
1571 desc("Configure options:\n\n");
1573 desc(" The defaults (*) are usually acceptable. A plus (+) denotes a default value"
1574 " that needs to be evaluated. If the evaluation succeeds, the feature is"
1575 " included. Here is a short explanation of each option:\n\n", 0, 1);
1577 desc("BUILD", "release","-release", "Compile and link Qt with debugging turned off.");
1578 desc("BUILD", "debug", "-debug", "Compile and link Qt with debugging turned on.");
1579 desc("BUILDALL", "yes", "-debug-and-release", "Compile and link two Qt libraries, with and without debugging turned on.\n");
1581 desc("OPENSOURCE", "opensource", "-opensource", "Compile and link the Open-Source Edition of Qt.");
1582 desc("COMMERCIAL", "commercial", "-commercial", "Compile and link the Commercial Edition of Qt.\n");
1584 desc("BUILDDEV", "yes", "-developer-build", "Compile and link Qt with Qt developer options (including auto-tests exporting)\n");
1586 desc("SHARED", "yes", "-shared", "Create and use shared Qt libraries.");
1587 desc("SHARED", "no", "-static", "Create and use static Qt libraries.\n");
1589 desc("LTCG", "yes", "-ltcg", "Use Link Time Code Generation. (Release builds only)");
1590 desc("LTCG", "no", "-no-ltcg", "Do not use Link Time Code Generation.\n");
1592 desc("FAST", "no", "-no-fast", "Configure Qt normally by generating Makefiles for all project files.");
1593 desc("FAST", "yes", "-fast", "Configure Qt quickly by generating Makefiles only for library and "
1594 "subdirectory targets. All other Makefiles are created as wrappers "
1595 "which will in turn run qmake\n");
1597 desc("EXCEPTIONS", "no", "-no-exceptions", "Disable exceptions on platforms that support it.");
1598 desc("EXCEPTIONS", "yes","-exceptions", "Enable exceptions on platforms that support it.\n");
1600 desc("ACCESSIBILITY", "no", "-no-accessibility", "Do not compile Windows Active Accessibility support.");
1601 desc("ACCESSIBILITY", "yes", "-accessibility", "Compile Windows Active Accessibility support.\n");
1603 desc("STL", "no", "-no-stl", "Do not compile STL support.");
1604 desc("STL", "yes", "-stl", "Compile STL support.\n");
1606 desc( "-no-sql-<driver>", "Disable SQL <driver> entirely, by default none are turned on.");
1607 desc( "-qt-sql-<driver>", "Enable a SQL <driver> in the Qt Library.");
1608 desc( "-plugin-sql-<driver>", "Enable SQL <driver> as a plugin to be linked to at run time.\n"
1609 "Available values for <driver>:");
1610 desc("SQL_MYSQL", "auto", "", " mysql", ' ');
1611 desc("SQL_PSQL", "auto", "", " psql", ' ');
1612 desc("SQL_OCI", "auto", "", " oci", ' ');
1613 desc("SQL_ODBC", "auto", "", " odbc", ' ');
1614 desc("SQL_TDS", "auto", "", " tds", ' ');
1615 desc("SQL_DB2", "auto", "", " db2", ' ');
1616 desc("SQL_SQLITE", "auto", "", " sqlite", ' ');
1617 desc("SQL_SQLITE2", "auto", "", " sqlite2", ' ');
1618 desc("SQL_IBASE", "auto", "", " ibase", ' ');
1619 desc( "", "(drivers marked with a '+' have been detected as available on this system)\n", false, ' ');
1621 desc( "-system-sqlite", "Use sqlite from the operating system.\n");
1623 desc("OPENGL", "no","-no-opengl", "Disables OpenGL functionality\n");
1624 desc("OPENGL", "no","-opengl <api>", "Enable OpenGL support with specified API version.\n"
1625 "Available values for <api>:");
1626 desc("", "", "", " desktop - Enable support for Desktop OpenGL", ' ');
1627 desc("OPENGL_ES_CM", "no", "", " es1 - Enable support for OpenGL ES Common Profile", ' ');
1628 desc("OPENGL_ES_2", "no", "", " es2 - Enable support for OpenGL ES 2.0", ' ');
1630 desc("OPENVG", "no","-no-openvg", "Disables OpenVG functionality\n");
1631 desc("OPENVG", "yes","-openvg", "Enables OpenVG functionality");
1632 desc( "", "Requires EGL support, typically supplied by an OpenGL", false, ' ');
1633 desc( "", "or other graphics implementation\n", false, ' ');
1634 desc( "-force-asserts", "Activate asserts in release mode.\n");
1636 desc( "-platform <spec>", "The operating system and compiler you are building on.\n(default %QMAKESPEC%)\n");
1637 desc( "-xplatform <spec>", "The operating system and compiler you are cross compiling to.\n");
1638 desc( "", "See the README file for a list of supported operating systems and compilers.\n", false, ' ');
1641 desc( "-qtnamespace <namespace>", "Wraps all Qt library code in 'namespace name {...}");
1642 desc( "-qtlibinfix <infix>", "Renames all Qt* libs to Qt*<infix>\n");
1643 desc( "-D <define>", "Add an explicit define to the preprocessor.");
1644 desc( "-I <includepath>", "Add an explicit include path.");
1645 desc( "-L <librarypath>", "Add an explicit library path.");
1646 desc( "-l <libraryname>", "Add an explicit library name, residing in a librarypath.\n");
1649 desc( "-help, -h, -?", "Display this information.\n");
1652 // 3rd party stuff options go below here --------------------------------------------------------------------------------
1653 desc("Third Party Libraries:\n\n");
1655 desc("ZLIB", "qt", "-qt-zlib", "Use the zlib bundled with Qt.");
1656 desc("ZLIB", "system", "-system-zlib", "Use zlib from the operating system.\nSee http://www.gzip.org/zlib\n");
1658 desc("GIF", "no", "-no-gif", "Do not compile GIF reading support.");
1660 desc("LIBPNG", "no", "-no-libpng", "Do not compile PNG support.");
1661 desc("LIBPNG", "qt", "-qt-libpng", "Use the libpng bundled with Qt.");
1662 desc("LIBPNG", "system","-system-libpng", "Use libpng from the operating system.\nSee http://www.libpng.org/pub/png\n");
1664 desc("LIBMNG", "no", "-no-libmng", "Do not compile MNG support.");
1665 desc("LIBMNG", "qt", "-qt-libmng", "Use the libmng bundled with Qt.");
1666 desc("LIBMNG", "system","-system-libmng", "Use libmng from the operating system.\nSee See http://www.libmng.com\n");
1668 desc("LIBTIFF", "no", "-no-libtiff", "Do not compile TIFF support.");
1669 desc("LIBTIFF", "qt", "-qt-libtiff", "Use the libtiff bundled with Qt.");
1670 desc("LIBTIFF", "system","-system-libtiff", "Use libtiff from the operating system.\nSee http://www.libtiff.org\n");
1672 desc("LIBJPEG", "no", "-no-libjpeg", "Do not compile JPEG support.");
1673 desc("LIBJPEG", "qt", "-qt-libjpeg", "Use the libjpeg bundled with Qt.");
1674 desc("LIBJPEG", "system","-system-libjpeg", "Use libjpeg from the operating system.\nSee http://www.ijg.org\n");
1676 desc("FREETYPE", "no", "-no-freetype", "Do not compile in Freetype2 support.");
1677 desc("FREETYPE", "yes", "-qt-freetype", "Use the libfreetype bundled with Qt.");
1679 // Qt\Windows only options go below here --------------------------------------------------------------------------------
1680 desc("Qt for Windows only:\n\n");
1682 desc("DSPFILES", "no", "-no-dsp", "Do not generate VC++ .dsp files.");
1683 desc("DSPFILES", "yes", "-dsp", "Generate VC++ .dsp files, only if spec \"win32-msvc\".\n");
1685 desc("VCPROJFILES", "no", "-no-vcproj", "Do not generate VC++ .vcproj files.");
1686 desc("VCPROJFILES", "yes", "-vcproj", "Generate VC++ .vcproj files, only if platform \"win32-msvc.net\".\n");
1688 desc("INCREDIBUILD_XGE", "no", "-no-incredibuild-xge", "Do not add IncrediBuild XGE distribution commands to custom build steps.");
1689 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");
1691 desc("PLUGIN_MANIFESTS", "no", "-no-plugin-manifests", "Do not embed manifests in plugins.");
1692 desc("PLUGIN_MANIFESTS", "yes", "-plugin-manifests", "Embed manifests in plugins.\n");
1695 desc("BUILD_QMAKE", "no", "-no-qmake", "Do not compile qmake.");
1696 desc("BUILD_QMAKE", "yes", "-qmake", "Compile qmake.\n");
1698 desc("NOPROCESS", "yes", "-dont-process", "Do not generate Makefiles/Project files. This will override -no-fast if specified.");
1699 desc("NOPROCESS", "no", "-process", "Generate Makefiles/Project files.\n");
1701 desc("RTTI", "no", "-no-rtti", "Do not compile runtime type information.");
1702 desc("RTTI", "yes", "-rtti", "Compile runtime type information.\n");
1703 desc("MMX", "no", "-no-mmx", "Do not compile with use of MMX instructions");
1704 desc("MMX", "yes", "-mmx", "Compile with use of MMX instructions");
1705 desc("3DNOW", "no", "-no-3dnow", "Do not compile with use of 3DNOW instructions");
1706 desc("3DNOW", "yes", "-3dnow", "Compile with use of 3DNOW instructions");
1707 desc("SSE", "no", "-no-sse", "Do not compile with use of SSE instructions");
1708 desc("SSE", "yes", "-sse", "Compile with use of SSE instructions");
1709 desc("SSE2", "no", "-no-sse2", "Do not compile with use of SSE2 instructions");
1710 desc("SSE2", "yes", "-sse2", "Compile with use of SSE2 instructions");
1711 desc("OPENSSL", "no", "-no-openssl", "Do not compile in OpenSSL support");
1712 desc("OPENSSL", "yes", "-openssl", "Compile in run-time OpenSSL support");
1713 desc("OPENSSL", "linked","-openssl-linked", "Compile in linked OpenSSL support");
1714 desc("DBUS", "no", "-no-dbus", "Do not compile in D-Bus support");
1715 desc("DBUS", "yes", "-dbus", "Compile in D-Bus support and load libdbus-1 dynamically");
1716 desc("DBUS", "linked", "-dbus-linked", "Compile in D-Bus support and link to libdbus-1");
1717 desc("PHONON", "no", "-no-phonon", "Do not compile in the Phonon module");
1718 desc("PHONON", "yes", "-phonon", "Compile the Phonon module (Phonon is built if a decent C++ compiler is used.)");
1719 desc("PHONON_BACKEND","no", "-no-phonon-backend","Do not compile the platform-specific Phonon backend-plugin");
1720 desc("PHONON_BACKEND","yes","-phonon-backend", "Compile in the platform-specific Phonon backend-plugin");
1721 desc("MULTIMEDIA", "no", "-no-multimedia", "Do not compile the multimedia module");
1722 desc("MULTIMEDIA", "yes","-multimedia", "Compile in multimedia module");
1723 desc("AUDIO_BACKEND", "no","-no-audio-backend", "Do not compile in the platform audio backend into QtMultimedia");
1724 desc("AUDIO_BACKEND", "yes","-audio-backend", "Compile in the platform audio backend into QtMultimedia");
1725 desc("WEBKIT", "no", "-no-webkit", "Do not compile in the WebKit module");
1726 desc("WEBKIT", "yes", "-webkit", "Compile in the WebKit module (WebKit is built if a decent C++ compiler is used.)");
1727 desc("WEBKIT", "debug", "-webkit-debug", "Compile in the WebKit module with debug symbols.");
1728 desc("SCRIPT", "no", "-no-script", "Do not build the QtScript module.");
1729 desc("SCRIPT", "yes", "-script", "Build the QtScript module.");
1730 desc("SCRIPTTOOLS", "no", "-no-scripttools", "Do not build the QtScriptTools module.");
1731 desc("SCRIPTTOOLS", "yes", "-scripttools", "Build the QtScriptTools module.");
1732 desc("V8", "no", "-no-v8", "Do not build the V8 module.");
1733 desc("V8", "yes", "-v8", "Build the V8 module.");
1734 desc("DECLARATIVE", "no", "-no-declarative", "Do not build the declarative module");
1735 desc("DECLARATIVE", "yes", "-declarative", "Build the declarative module");
1736 desc("DECLARATIVE_DEBUG", "no", "-no-declarative-debug", "Do not build the declarative debugging support");
1737 desc("DECLARATIVE_DEBUG", "yes", "-declarative-debug", "Build the declarative debugging support");
1738 desc("DIRECTWRITE", "no", "-no-directwrite", "Do not build support for DirectWrite font rendering");
1739 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.)");
1741 desc( "-arch <arch>", "Specify an architecture.\n"
1742 "Available values for <arch>:");
1743 desc("ARCHITECTURE","windows", "", " windows", ' ');
1744 desc("ARCHITECTURE","windowsce", "", " windowsce", ' ');
1745 desc("ARCHITECTURE","boundschecker", "", " boundschecker", ' ');
1746 desc("ARCHITECTURE","generic", "", " generic\n", ' ');
1748 desc( "-no-style-<style>", "Disable <style> entirely.");
1749 desc( "-qt-style-<style>", "Enable <style> in the Qt Library.\nAvailable styles: ");
1751 desc("STYLE_WINDOWS", "yes", "", " windows", ' ');
1752 desc("STYLE_WINDOWSXP", "auto", "", " windowsxp", ' ');
1753 desc("STYLE_WINDOWSVISTA", "auto", "", " windowsvista", ' ');
1754 desc("STYLE_PLASTIQUE", "yes", "", " plastique", ' ');
1755 desc("STYLE_CLEANLOOKS", "yes", "", " cleanlooks", ' ');
1756 desc("STYLE_MOTIF", "yes", "", " motif", ' ');
1757 desc("STYLE_CDE", "yes", "", " cde", ' ');
1758 desc("STYLE_WINDOWSCE", "yes", "", " windowsce", ' ');
1759 desc("STYLE_WINDOWSMOBILE" , "yes", "", " windowsmobile", ' ');
1760 desc("NATIVE_GESTURES", "no", "-no-native-gestures", "Do not use native gestures on Windows 7.");
1761 desc("NATIVE_GESTURES", "yes", "-native-gestures", "Use native gestures on Windows 7.");
1762 desc("MSVC_MP", "no", "-no-mp", "Do not use multiple processors for compiling with MSVC");
1763 desc("MSVC_MP", "yes", "-mp", "Use multiple processors for compiling with MSVC (-MP)");
1765 /* We do not support -qconfig on Windows yet
1767 desc( "-qconfig <local>", "Use src/tools/qconfig-local.h rather than the default.\nPossible values for local:");
1768 for (int i=0; i<allConfigs.size(); ++i)
1769 desc( "", qPrintable(QString(" %1").arg(allConfigs.at(i))), false, ' ');
1773 desc( "-loadconfig <config>", "Run configure with the parameters from file configure_<config>.cache.");
1774 desc( "-saveconfig <config>", "Run configure and save the parameters in file configure_<config>.cache.");
1775 desc( "-redo", "Run configure with the same parameters as last time.\n");
1777 // Qt\Windows CE only options go below here -----------------------------------------------------------------------------
1778 desc("Qt for Windows CE only:\n\n");
1779 desc("IWMMXT", "no", "-no-iwmmxt", "Do not compile with use of IWMMXT instructions");
1780 desc("IWMMXT", "yes", "-iwmmxt", "Do compile with use of IWMMXT instructions (Qt for Windows CE on Arm only)");
1781 desc("CE_CRT", "no", "-no-crt" , "Do not add the C runtime to default deployment rules");
1782 desc("CE_CRT", "yes", "-qt-crt", "Qt identifies C runtime during project generation");
1783 desc( "-crt <path>", "Specify path to C runtime used for project generation.");
1784 desc("CETEST", "no", "-no-cetest", "Do not compile Windows CE remote test application");
1785 desc("CETEST", "yes", "-cetest", "Compile Windows CE remote test application");
1786 desc( "-signature <file>", "Use file for signing the target project");
1788 desc("DIRECTSHOW", "no", "-phonon-wince-ds9", "Enable Phonon Direct Show 9 backend for Windows CE");
1794 QString Configure::findFileInPaths(const QString &fileName, const QString &paths)
1796 #if defined(Q_OS_WIN32)
1797 QRegExp splitReg("[;,]");
1799 QRegExp splitReg("[:]");
1801 QStringList pathList = paths.split(splitReg, QString::SkipEmptyParts);
1803 for (QStringList::ConstIterator it = pathList.begin(); it != pathList.end(); ++it) {
1804 // Remove any leading or trailing ", this is commonly used in the environment
1806 QString path = (*it);
1807 if (path.startsWith('\"'))
1808 path = path.right(path.length() - 1);
1809 if (path.endsWith('\"'))
1810 path = path.left(path.length() - 1);
1811 if (d.exists(path + QDir::separator() + fileName))
1817 static QString mingwPaths(const QString &mingwPath, const QString &pathName)
1820 QDir mingwDir = QFileInfo(mingwPath).dir();
1821 const QFileInfoList subdirs = mingwDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
1822 for (int i = 0 ;i < subdirs.length(); ++i) {
1823 const QFileInfo &fi = subdirs.at(i);
1824 const QString name = fi.fileName();
1825 if (name == pathName)
1826 ret += fi.absoluteFilePath() + ';';
1827 else if (name.contains("mingw"))
1828 ret += fi.absoluteFilePath() + QDir::separator() + pathName + ';';
1833 bool Configure::findFile(const QString &fileName)
1835 const QString file = fileName.toLower();
1836 const QString pathEnvVar = QString::fromLocal8Bit(getenv("PATH"));
1837 const QString mingwPath = dictionary["QMAKESPEC"].endsWith("-g++") ?
1838 findFileInPaths("g++.exe", pathEnvVar) : QString();
1841 if (file.endsWith(".h")) {
1842 if (!mingwPath.isNull()) {
1843 if (!findFileInPaths(file, mingwPaths(mingwPath, "include")).isNull())
1845 //now let's try the additional compiler path
1847 const QFileInfoList mingwConfigs = QDir(mingwPath + QLatin1String("/../lib/gcc")).entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
1848 for (int i = 0; i < mingwConfigs.length(); ++i) {
1849 const QDir mingwLibDir = mingwConfigs.at(i).absoluteFilePath();
1850 foreach(const QFileInfo &version, mingwLibDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot)) {
1851 if (!findFileInPaths(file, version.absoluteFilePath() + QLatin1String("/include")).isNull())
1856 paths = QString::fromLocal8Bit(getenv("INCLUDE"));
1857 } else if (file.endsWith(".lib") || file.endsWith(".a")) {
1858 if (!mingwPath.isNull() && !findFileInPaths(file, mingwPaths(mingwPath, "lib")).isNull())
1860 paths = QString::fromLocal8Bit(getenv("LIB"));
1864 return !findFileInPaths(file, paths).isNull();
1868 Default value for options marked as "auto" if the test passes.
1869 (Used both by the autoDetection() below, and the desc() function
1870 to mark (+) the default option of autodetecting options.
1872 QString Configure::defaultTo(const QString &option)
1874 // We prefer using the system version of the 3rd party libs
1875 if (option == "ZLIB"
1876 || option == "LIBJPEG"
1877 || option == "LIBPNG"
1878 || option == "LIBMNG"
1879 || option == "LIBTIFF")
1882 // PNG is always built-in, never a plugin
1883 if (option == "PNG")
1886 // These database drivers and image formats can be built-in or plugins.
1887 // Prefer plugins when Qt is shared.
1888 if (dictionary[ "SHARED" ] == "yes") {
1889 if (option == "SQL_MYSQL"
1890 || option == "SQL_MYSQL"
1891 || option == "SQL_ODBC"
1892 || option == "SQL_OCI"
1893 || option == "SQL_PSQL"
1894 || option == "SQL_TDS"
1895 || option == "SQL_DB2"
1896 || option == "SQL_SQLITE"
1897 || option == "SQL_SQLITE2"
1898 || option == "SQL_IBASE"
1906 // By default we do not want to compile OCI driver when compiling with
1907 // MinGW, due to lack of such support from Oracle. It prob. wont work.
1908 // (Customer may force the use though)
1909 if (dictionary["QMAKESPEC"].endsWith("-g++")
1910 && option == "SQL_OCI")
1913 if (option == "SYNCQT"
1914 && (!QFile::exists(sourcePath + "/bin/syncqt") ||
1915 !QFile::exists(sourcePath + "/bin/syncqt.bat")))
1922 Checks the system for the availability of a feature.
1923 Returns true if the feature is available, else false.
1925 bool Configure::checkAvailability(const QString &part)
1927 bool available = false;
1928 if (part == "STYLE_WINDOWSXP")
1929 available = findFile("uxtheme.h");
1931 else if (part == "ZLIB")
1932 available = findFile("zlib.h");
1934 else if (part == "LIBJPEG")
1935 available = findFile("jpeglib.h");
1936 else if (part == "LIBPNG")
1937 available = findFile("png.h");
1938 else if (part == "LIBMNG")
1939 available = findFile("libmng.h");
1940 else if (part == "LIBTIFF")
1941 available = findFile("tiffio.h");
1942 else if (part == "SQL_MYSQL")
1943 available = findFile("mysql.h") && findFile("libmySQL.lib");
1944 else if (part == "SQL_ODBC")
1945 available = findFile("sql.h") && findFile("sqlext.h") && findFile("odbc32.lib");
1946 else if (part == "SQL_OCI")
1947 available = findFile("oci.h") && findFile("oci.lib");
1948 else if (part == "SQL_PSQL")
1949 available = findFile("libpq-fe.h") && findFile("libpq.lib") && findFile("ws2_32.lib") && findFile("advapi32.lib");
1950 else if (part == "SQL_TDS")
1951 available = findFile("sybfront.h") && findFile("sybdb.h") && findFile("ntwdblib.lib");
1952 else if (part == "SQL_DB2")
1953 available = findFile("sqlcli.h") && findFile("sqlcli1.h") && findFile("db2cli.lib");
1954 else if (part == "SQL_SQLITE")
1955 available = true; // Built in, we have a fork
1956 else if (part == "SQL_SQLITE_LIB") {
1957 if (dictionary[ "SQL_SQLITE_LIB" ] == "system") {
1958 available = findFile("sqlite3.h") && findFile("sqlite3.lib");
1960 dictionary[ "QT_LFLAGS_SQLITE" ] += "sqlite3.lib";
1963 } else if (part == "SQL_SQLITE2")
1964 available = findFile("sqlite.h") && findFile("sqlite.lib");
1965 else if (part == "SQL_IBASE")
1966 available = findFile("ibase.h") && (findFile("gds32_ms.lib") || findFile("gds32.lib"));
1967 else if (part == "IWMMXT")
1968 available = (dictionary[ "ARCHITECTURE" ] == "windowsce");
1969 else if (part == "OPENGL_ES_CM")
1970 available = (dictionary[ "ARCHITECTURE" ] == "windowsce");
1971 else if (part == "OPENGL_ES_2")
1972 available = (dictionary[ "ARCHITECTURE" ] == "windowsce");
1973 else if (part == "DIRECTSHOW")
1974 available = (dictionary[ "ARCHITECTURE" ] == "windowsce");
1975 else if (part == "SSE2")
1976 available = (dictionary.value("QMAKESPEC") != "win32-msvc");
1977 else if (part == "3DNOW")
1978 available = (dictionary.value("QMAKESPEC") != "win32-msvc") && (dictionary.value("QMAKESPEC") != "win32-icc") && findFile("mm3dnow.h");
1979 else if (part == "MMX" || part == "SSE")
1980 available = (dictionary.value("QMAKESPEC") != "win32-msvc");
1981 else if (part == "OPENSSL")
1982 available = findFile("openssl\\ssl.h");
1983 else if (part == "DBUS")
1984 available = findFile("dbus\\dbus.h");
1985 else if (part == "CETEST") {
1986 QString rapiHeader = locateFile("rapi.h");
1987 QString rapiLib = locateFile("rapi.lib");
1988 available = (dictionary[ "ARCHITECTURE" ] == "windowsce") && !rapiHeader.isEmpty() && !rapiLib.isEmpty();
1990 dictionary[ "QT_CE_RAPI_INC" ] += QLatin1String("\"") + rapiHeader + QLatin1String("\"");
1991 dictionary[ "QT_CE_RAPI_LIB" ] += QLatin1String("\"") + rapiLib + QLatin1String("\"");
1993 else if (dictionary[ "CETEST_REQUESTED" ] == "yes") {
1994 cout << "cetest could not be enabled: rapi.h and rapi.lib could not be found." << endl;
1995 cout << "Make sure the environment is set up for compiling with ActiveSync." << endl;
1996 dictionary[ "DONE" ] = "error";
1999 else if (part == "INCREDIBUILD_XGE")
2000 available = findFile("BuildConsole.exe") && findFile("xgConsole.exe");
2001 else if (part == "XMLPATTERNS")
2002 available = dictionary.value("EXCEPTIONS") == "yes";
2003 else if (part == "PHONON") {
2004 available = findFile("vmr9.h") && findFile("dshow.h") && findFile("dmo.h") && findFile("dmodshow.h")
2005 && (findFile("strmiids.lib") || findFile("libstrmiids.a"))
2006 && (findFile("dmoguids.lib") || findFile("libdmoguids.a"))
2007 && (findFile("msdmo.lib") || findFile("libmsdmo.a"))
2008 && findFile("d3d9.h");
2011 cout << "All the required DirectShow/Direct3D files couldn't be found." << endl
2012 << "Make sure you have either the platform SDK AND the DirectShow SDK or the Windows SDK installed." << endl
2013 << "If you have the DirectShow SDK installed, please make sure that you have run the <path to SDK>\\SetEnv.Cmd script." << endl;
2014 if (!findFile("vmr9.h")) cout << "vmr9.h not found" << endl;
2015 if (!findFile("dshow.h")) cout << "dshow.h not found" << endl;
2016 if (!findFile("strmiids.lib")) cout << "strmiids.lib not found" << endl;
2017 if (!findFile("dmoguids.lib")) cout << "dmoguids.lib not found" << endl;
2018 if (!findFile("msdmo.lib")) cout << "msdmo.lib not found" << endl;
2019 if (!findFile("d3d9.h")) cout << "d3d9.h not found" << endl;
2021 } else if (part == "WMSDK") {
2022 available = findFile("wmsdk.h");
2023 } else if (part == "MULTIMEDIA" || part == "SCRIPT" || part == "SCRIPTTOOLS" || part == "V8" || part == "DECLARATIVE") {
2025 } else if (part == "V8SNAPSHOT") {
2027 } else if (part == "WEBKIT") {
2028 available = (dictionary.value("QMAKESPEC") == "win32-msvc2005") || (dictionary.value("QMAKESPEC") == "win32-msvc2008") || (dictionary.value("QMAKESPEC") == "win32-msvc2010") || (dictionary.value("QMAKESPEC") == "win32-g++");
2029 if (dictionary[ "SHARED" ] == "no") {
2030 cout << endl << "WARNING: Using static linking will disable the WebKit module." << endl
2034 } else if (part == "AUDIO_BACKEND") {
2036 } else if (part == "DIRECTWRITE") {
2037 available = findFile("dwrite.h") && findFile("d2d1.h") && findFile("dwrite.lib");
2044 Autodetect options marked as "auto".
2046 void Configure::autoDetection()
2049 if (dictionary["STYLE_WINDOWSXP"] == "auto")
2050 dictionary["STYLE_WINDOWSXP"] = checkAvailability("STYLE_WINDOWSXP") ? defaultTo("STYLE_WINDOWSXP") : "no";
2051 if (dictionary["STYLE_WINDOWSVISTA"] == "auto") // Vista style has the same requirements as XP style
2052 dictionary["STYLE_WINDOWSVISTA"] = checkAvailability("STYLE_WINDOWSXP") ? defaultTo("STYLE_WINDOWSVISTA") : "no";
2054 // Compression detection
2055 if (dictionary["ZLIB"] == "auto")
2056 dictionary["ZLIB"] = checkAvailability("ZLIB") ? defaultTo("ZLIB") : "qt";
2058 // Image format detection
2059 if (dictionary["GIF"] == "auto")
2060 dictionary["GIF"] = defaultTo("GIF");
2061 if (dictionary["JPEG"] == "auto")
2062 dictionary["JPEG"] = defaultTo("JPEG");
2063 if (dictionary["PNG"] == "auto")
2064 dictionary["PNG"] = defaultTo("PNG");
2065 if (dictionary["MNG"] == "auto")
2066 dictionary["MNG"] = defaultTo("MNG");
2067 if (dictionary["TIFF"] == "auto")
2068 dictionary["TIFF"] = dictionary["ZLIB"] == "no" ? "no" : defaultTo("TIFF");
2069 if (dictionary["LIBJPEG"] == "auto")
2070 dictionary["LIBJPEG"] = checkAvailability("LIBJPEG") ? defaultTo("LIBJPEG") : "qt";
2071 if (dictionary["LIBPNG"] == "auto")
2072 dictionary["LIBPNG"] = checkAvailability("LIBPNG") ? defaultTo("LIBPNG") : "qt";
2073 if (dictionary["LIBMNG"] == "auto")
2074 dictionary["LIBMNG"] = checkAvailability("LIBMNG") ? defaultTo("LIBMNG") : "qt";
2075 if (dictionary["LIBTIFF"] == "auto")
2076 dictionary["LIBTIFF"] = checkAvailability("LIBTIFF") ? defaultTo("LIBTIFF") : "qt";
2078 // SQL detection (not on by default)
2079 if (dictionary["SQL_MYSQL"] == "auto")
2080 dictionary["SQL_MYSQL"] = checkAvailability("SQL_MYSQL") ? defaultTo("SQL_MYSQL") : "no";
2081 if (dictionary["SQL_ODBC"] == "auto")
2082 dictionary["SQL_ODBC"] = checkAvailability("SQL_ODBC") ? defaultTo("SQL_ODBC") : "no";
2083 if (dictionary["SQL_OCI"] == "auto")
2084 dictionary["SQL_OCI"] = checkAvailability("SQL_OCI") ? defaultTo("SQL_OCI") : "no";
2085 if (dictionary["SQL_PSQL"] == "auto")
2086 dictionary["SQL_PSQL"] = checkAvailability("SQL_PSQL") ? defaultTo("SQL_PSQL") : "no";
2087 if (dictionary["SQL_TDS"] == "auto")
2088 dictionary["SQL_TDS"] = checkAvailability("SQL_TDS") ? defaultTo("SQL_TDS") : "no";
2089 if (dictionary["SQL_DB2"] == "auto")
2090 dictionary["SQL_DB2"] = checkAvailability("SQL_DB2") ? defaultTo("SQL_DB2") : "no";
2091 if (dictionary["SQL_SQLITE"] == "auto")
2092 dictionary["SQL_SQLITE"] = checkAvailability("SQL_SQLITE") ? defaultTo("SQL_SQLITE") : "no";
2093 if (dictionary["SQL_SQLITE_LIB"] == "system")
2094 if (!checkAvailability("SQL_SQLITE_LIB"))
2095 dictionary["SQL_SQLITE_LIB"] = "no";
2096 if (dictionary["SQL_SQLITE2"] == "auto")
2097 dictionary["SQL_SQLITE2"] = checkAvailability("SQL_SQLITE2") ? defaultTo("SQL_SQLITE2") : "no";
2098 if (dictionary["SQL_IBASE"] == "auto")
2099 dictionary["SQL_IBASE"] = checkAvailability("SQL_IBASE") ? defaultTo("SQL_IBASE") : "no";
2100 if (dictionary["MMX"] == "auto")
2101 dictionary["MMX"] = checkAvailability("MMX") ? "yes" : "no";
2102 if (dictionary["3DNOW"] == "auto")
2103 dictionary["3DNOW"] = checkAvailability("3DNOW") ? "yes" : "no";
2104 if (dictionary["SSE"] == "auto")
2105 dictionary["SSE"] = checkAvailability("SSE") ? "yes" : "no";
2106 if (dictionary["SSE2"] == "auto")
2107 dictionary["SSE2"] = checkAvailability("SSE2") ? "yes" : "no";
2108 if (dictionary["IWMMXT"] == "auto")
2109 dictionary["IWMMXT"] = checkAvailability("IWMMXT") ? "yes" : "no";
2110 if (dictionary["OPENSSL"] == "auto")
2111 dictionary["OPENSSL"] = checkAvailability("OPENSSL") ? "yes" : "no";
2112 if (dictionary["DBUS"] == "auto")
2113 dictionary["DBUS"] = checkAvailability("DBUS") ? "yes" : "no";
2114 if (dictionary["SCRIPT"] == "auto")
2115 dictionary["SCRIPT"] = checkAvailability("SCRIPT") ? "yes" : "no";
2116 if (dictionary["SCRIPTTOOLS"] == "auto")
2117 dictionary["SCRIPTTOOLS"] = dictionary["SCRIPT"] == "yes" ? "yes" : "no";
2118 if (dictionary["XMLPATTERNS"] == "auto")
2119 dictionary["XMLPATTERNS"] = checkAvailability("XMLPATTERNS") ? "yes" : "no";
2120 if (dictionary["PHONON"] == "auto")
2121 dictionary["PHONON"] = checkAvailability("PHONON") ? "yes" : "no";
2122 if (dictionary["WEBKIT"] == "auto")
2123 dictionary["WEBKIT"] = checkAvailability("WEBKIT") ? "yes" : "no";
2124 if (dictionary["V8"] == "auto")
2125 dictionary["V8"] = checkAvailability("V8") ? "yes" : "no";
2126 if (dictionary["V8SNAPSHOT"] == "auto")
2127 dictionary["V8SNAPSHOT"] = (dictionary["V8"] == "yes") && checkAvailability("V8SNAPSHOT") ? "yes" : "no";
2128 if (dictionary["DECLARATIVE"] == "auto")
2129 dictionary["DECLARATIVE"] = dictionary["V8"] == "yes" ? "yes" : "no";
2130 if (dictionary["DECLARATIVE_DEBUG"] == "auto")
2131 dictionary["DECLARATIVE_DEBUG"] = dictionary["DECLARATIVE"] == "yes" ? "yes" : "no";
2132 if (dictionary["AUDIO_BACKEND"] == "auto")
2133 dictionary["AUDIO_BACKEND"] = checkAvailability("AUDIO_BACKEND") ? "yes" : "no";
2134 if (dictionary["WMSDK"] == "auto")
2135 dictionary["WMSDK"] = checkAvailability("WMSDK") ? "yes" : "no";
2137 // Qt/WinCE remote test application
2138 if (dictionary["CETEST"] == "auto")
2139 dictionary["CETEST"] = checkAvailability("CETEST") ? "yes" : "no";
2141 // Detection of IncrediBuild buildconsole
2142 if (dictionary["INCREDIBUILD_XGE"] == "auto")
2143 dictionary["INCREDIBUILD_XGE"] = checkAvailability("INCREDIBUILD_XGE") ? "yes" : "no";
2145 // Mark all unknown "auto" to the default value..
2146 for (QMap<QString,QString>::iterator i = dictionary.begin(); i != dictionary.end(); ++i) {
2147 if (i.value() == "auto")
2148 i.value() = defaultTo(i.key());
2152 bool Configure::verifyConfiguration()
2154 if (dictionary["SQL_SQLITE_LIB"] == "no" && dictionary["SQL_SQLITE"] != "no") {
2155 cout << "WARNING: Configure could not detect the presence of a system SQLite3 lib." << endl
2156 << "Configure will therefore continue with the SQLite3 lib bundled with Qt." << endl
2157 << "(Press any key to continue..)";
2158 if (_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
2159 exit(0); // Exit cleanly for Ctrl+C
2161 dictionary["SQL_SQLITE_LIB"] = "qt"; // Set to Qt's bundled lib an continue
2163 if (dictionary["QMAKESPEC"].endsWith("-g++")
2164 && dictionary["SQL_OCI"] != "no") {
2165 cout << "WARNING: Qt does not support compiling the Oracle database driver with" << endl
2166 << "MinGW, due to lack of such support from Oracle. Consider disabling the" << endl
2167 << "Oracle driver, as the current build will most likely fail." << endl;
2168 cout << "(Press any key to continue..)";
2169 if (_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
2170 exit(0); // Exit cleanly for Ctrl+C
2172 if (dictionary["QMAKESPEC"].endsWith("win32-msvc.net")) {
2173 cout << "WARNING: The makespec win32-msvc.net is deprecated. Consider using" << endl
2174 << "win32-msvc2002 or win32-msvc2003 instead." << endl;
2175 cout << "(Press any key to continue..)";
2176 if (_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
2177 exit(0); // Exit cleanly for Ctrl+C
2179 if (0 != dictionary["ARM_FPU_TYPE"].size()) {
2180 QStringList l= QStringList()
2184 if (!(l.contains(dictionary["ARM_FPU_TYPE"])))
2185 cout << QString("WARNING: Using unsupported fpu flag: %1").arg(dictionary["ARM_FPU_TYPE"]) << endl;
2187 if (dictionary["DECLARATIVE"] == "yes" && dictionary["V8"] == "no") {
2188 cout << "WARNING: To be able to compile QtDeclarative we need to also compile the" << endl
2189 << "V8 module. If you continue, we will turn on the V8 module." << endl
2190 << "(Press any key to continue..)";
2191 if (_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
2192 exit(0); // Exit cleanly for Ctrl+C
2194 dictionary["SCRIPT"] = "yes";
2197 if (dictionary["DIRECTWRITE"] == "yes" && !checkAvailability("DIRECTWRITE")) {
2198 cout << "WARNING: To be able to compile the DirectWrite font engine you will" << endl
2199 << "need the Microsoft DirectWrite and Microsoft Direct2D development" << endl
2200 << "files such as headers and libraries." << endl
2201 << "(Press any key to continue..)";
2202 if (_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
2203 exit(0); // Exit cleanly for Ctrl+C
2210 Things that affect the Qt API/ABI:
2212 minimal-config small-config medium-config large-config full-config
2218 Things that do not affect the Qt API/ABI:
2219 system-jpeg no-jpeg jpeg
2220 system-mng no-mng mng
2221 system-png no-png png
2222 system-zlib no-zlib zlib
2223 system-tiff no-tiff tiff
2234 X11 : x11sm xinerama xcursor xfixes xrandr xrender fontconfig xkb
2235 Embedded: embedded freetype
2237 void Configure::generateBuildKey()
2239 QString spec = dictionary["QMAKESPEC"];
2241 QString compiler = "msvc"; // ICC is compatible
2242 if (spec.endsWith("-g++"))
2244 else if (spec.endsWith("-borland"))
2245 compiler = "borland";
2247 // Build options which changes the Qt API/ABI
2248 QStringList build_options;
2249 if (!dictionary["QCONFIG"].isEmpty())
2250 build_options += dictionary["QCONFIG"] + "-config ";
2251 build_options.sort();
2253 // Sorted defines that start with QT_NO_
2254 QStringList build_defines = qmakeDefines.filter(QRegExp("^QT_NO_"));
2255 build_defines.sort();
2258 void Configure::generateOutputVars()
2260 // Generate variables for output
2261 QString build = dictionary[ "BUILD" ];
2262 bool buildAll = (dictionary[ "BUILDALL" ] == "yes");
2263 if (build == "debug") {
2265 qtConfig += "release";
2266 qtConfig += "debug";
2267 } else if (build == "release") {
2269 qtConfig += "debug";
2270 qtConfig += "release";
2273 // Compression --------------------------------------------------
2274 if (dictionary[ "ZLIB" ] == "qt")
2276 else if (dictionary[ "ZLIB" ] == "system")
2277 qtConfig += "system-zlib";
2279 // Image formates -----------------------------------------------
2280 if (dictionary[ "GIF" ] == "no")
2281 qtConfig += "no-gif";
2282 else if (dictionary[ "GIF" ] == "yes")
2285 if (dictionary[ "TIFF" ] == "no")
2286 qtConfig += "no-tiff";
2287 else if (dictionary[ "TIFF" ] == "yes")
2289 if (dictionary[ "LIBTIFF" ] == "system")
2290 qtConfig += "system-tiff";
2292 if (dictionary[ "JPEG" ] == "no")
2293 qtConfig += "no-jpeg";
2294 else if (dictionary[ "JPEG" ] == "yes")
2296 if (dictionary[ "LIBJPEG" ] == "system")
2297 qtConfig += "system-jpeg";
2299 if (dictionary[ "PNG" ] == "no")
2300 qtConfig += "no-png";
2301 else if (dictionary[ "PNG" ] == "yes")
2303 if (dictionary[ "LIBPNG" ] == "system")
2304 qtConfig += "system-png";
2306 if (dictionary[ "MNG" ] == "no")
2307 qtConfig += "no-mng";
2308 else if (dictionary[ "MNG" ] == "yes")
2310 if (dictionary[ "LIBMNG" ] == "system")
2311 qtConfig += "system-mng";
2313 // Text rendering --------------------------------------------------
2314 if (dictionary[ "FREETYPE" ] == "yes")
2315 qtConfig += "freetype";
2317 // Styles -------------------------------------------------------
2318 if (dictionary[ "STYLE_WINDOWS" ] == "yes")
2319 qmakeStyles += "windows";
2321 if (dictionary[ "STYLE_PLASTIQUE" ] == "yes")
2322 qmakeStyles += "plastique";
2324 if (dictionary[ "STYLE_CLEANLOOKS" ] == "yes")
2325 qmakeStyles += "cleanlooks";
2327 if (dictionary[ "STYLE_WINDOWSXP" ] == "yes")
2328 qmakeStyles += "windowsxp";
2330 if (dictionary[ "STYLE_WINDOWSVISTA" ] == "yes")
2331 qmakeStyles += "windowsvista";
2333 if (dictionary[ "STYLE_MOTIF" ] == "yes")
2334 qmakeStyles += "motif";
2336 if (dictionary[ "STYLE_SGI" ] == "yes")
2337 qmakeStyles += "sgi";
2339 if (dictionary[ "STYLE_WINDOWSCE" ] == "yes")
2340 qmakeStyles += "windowsce";
2342 if (dictionary[ "STYLE_WINDOWSMOBILE" ] == "yes")
2343 qmakeStyles += "windowsmobile";
2345 if (dictionary[ "STYLE_CDE" ] == "yes")
2346 qmakeStyles += "cde";
2348 // Databases ----------------------------------------------------
2349 if (dictionary[ "SQL_MYSQL" ] == "yes")
2350 qmakeSql += "mysql";
2351 else if (dictionary[ "SQL_MYSQL" ] == "plugin")
2352 qmakeSqlPlugins += "mysql";
2354 if (dictionary[ "SQL_ODBC" ] == "yes")
2356 else if (dictionary[ "SQL_ODBC" ] == "plugin")
2357 qmakeSqlPlugins += "odbc";
2359 if (dictionary[ "SQL_OCI" ] == "yes")
2361 else if (dictionary[ "SQL_OCI" ] == "plugin")
2362 qmakeSqlPlugins += "oci";
2364 if (dictionary[ "SQL_PSQL" ] == "yes")
2366 else if (dictionary[ "SQL_PSQL" ] == "plugin")
2367 qmakeSqlPlugins += "psql";
2369 if (dictionary[ "SQL_TDS" ] == "yes")
2371 else if (dictionary[ "SQL_TDS" ] == "plugin")
2372 qmakeSqlPlugins += "tds";
2374 if (dictionary[ "SQL_DB2" ] == "yes")
2376 else if (dictionary[ "SQL_DB2" ] == "plugin")
2377 qmakeSqlPlugins += "db2";
2379 if (dictionary[ "SQL_SQLITE" ] == "yes")
2380 qmakeSql += "sqlite";
2381 else if (dictionary[ "SQL_SQLITE" ] == "plugin")
2382 qmakeSqlPlugins += "sqlite";
2384 if (dictionary[ "SQL_SQLITE_LIB" ] == "system")
2385 qmakeConfig += "system-sqlite";
2387 if (dictionary[ "SQL_SQLITE2" ] == "yes")
2388 qmakeSql += "sqlite2";
2389 else if (dictionary[ "SQL_SQLITE2" ] == "plugin")
2390 qmakeSqlPlugins += "sqlite2";
2392 if (dictionary[ "SQL_IBASE" ] == "yes")
2393 qmakeSql += "ibase";
2394 else if (dictionary[ "SQL_IBASE" ] == "plugin")
2395 qmakeSqlPlugins += "ibase";
2397 // Other options ------------------------------------------------
2398 if (dictionary[ "BUILDALL" ] == "yes") {
2399 qtConfig += "build_all";
2401 qmakeConfig += dictionary[ "BUILD" ];
2402 dictionary[ "QMAKE_OUTDIR" ] = dictionary[ "BUILD" ];
2404 if (dictionary[ "SHARED" ] == "yes") {
2405 QString version = dictionary[ "VERSION" ];
2406 if (!version.isEmpty()) {
2407 qmakeVars += "QMAKE_QT_VERSION_OVERRIDE = " + version.left(version.indexOf("."));
2408 version.remove(QLatin1Char('.'));
2410 dictionary[ "QMAKE_OUTDIR" ] += "_shared";
2412 dictionary[ "QMAKE_OUTDIR" ] += "_static";
2415 if (dictionary[ "ACCESSIBILITY" ] == "yes")
2416 qtConfig += "accessibility";
2418 if (!qmakeLibs.isEmpty())
2419 qmakeVars += "LIBS += " + escapeSeparators(qmakeLibs.join(" "));
2421 if (!dictionary["QT_LFLAGS_SQLITE"].isEmpty())
2422 qmakeVars += "QT_LFLAGS_SQLITE += " + escapeSeparators(dictionary["QT_LFLAGS_SQLITE"]);
2424 if (dictionary[ "OPENGL" ] == "yes")
2425 qtConfig += "opengl";
2427 if (dictionary["OPENGL_ES_CM"] == "yes") {
2428 qtConfig += "opengles1";
2432 if (dictionary["OPENGL_ES_2"] == "yes") {
2433 qtConfig += "opengles2";
2437 if (dictionary["OPENVG"] == "yes") {
2438 qtConfig += "openvg";
2442 if (dictionary["DIRECTSHOW"] == "yes")
2443 qtConfig += "directshow";
2445 if (dictionary[ "OPENSSL" ] == "yes")
2446 qtConfig += "openssl";
2447 else if (dictionary[ "OPENSSL" ] == "linked")
2448 qtConfig += "openssl-linked";
2450 if (dictionary[ "DBUS" ] == "yes")
2452 else if (dictionary[ "DBUS" ] == "linked")
2453 qtConfig += "dbus dbus-linked";
2455 if (dictionary[ "CETEST" ] == "yes")
2456 qtConfig += "cetest";
2458 // No longer needed after modularization
2459 // if (dictionary[ "SCRIPT" ] == "yes")
2460 // qtConfig += "script";
2462 // No longer needed after modularization
2463 // if (dictionary[ "SCRIPTTOOLS" ] == "yes") {
2464 // if (dictionary[ "SCRIPT" ] == "no") {
2465 // cout << "QtScriptTools was requested, but it can't be built due to QtScript being "
2466 // "disabled." << endl;
2467 // dictionary[ "DONE" ] = "error";
2469 // qtConfig += "scripttools";
2472 // No longer needed after modularization
2473 // if (dictionary[ "XMLPATTERNS" ] == "yes")
2474 // qtConfig += "xmlpatterns";
2476 if (dictionary["PHONON"] == "yes") {
2477 // No longer needed after modularization
2478 //qtConfig += "phonon";
2479 if (dictionary["PHONON_BACKEND"] == "yes")
2480 qtConfig += "phonon-backend";
2483 if (dictionary["MULTIMEDIA"] == "yes") {
2484 // No longer needed after modularization
2485 //qtConfig += "multimedia";
2486 if (dictionary["AUDIO_BACKEND"] == "yes")
2487 qtConfig += "audio-backend";
2490 if (dictionary["WEBKIT"] != "no") {
2491 if (dictionary["WEBKIT"] == "debug")
2492 qtConfig += "webkit-debug";
2495 // No longer needed after modularization
2496 // if (dictionary["DECLARATIVE"] == "yes") {
2497 // if (dictionary[ "V8" ] == "no") {
2498 // cout << "QtDeclarative was requested, but it can't be built due to V8 being "
2499 // "disabled." << endl;
2500 // dictionary[ "DONE" ] = "error";
2502 // qtConfig += "declarative";
2505 if (dictionary["DIRECTWRITE"] == "yes")
2506 qtConfig += "directwrite";
2508 if (dictionary[ "NATIVE_GESTURES" ] == "yes")
2509 qtConfig += "native-gestures";
2511 // We currently have no switch for QtSvg, so add it unconditionally.
2514 if (dictionary[ "V8" ] == "yes") {
2516 if (dictionary[ "V8SNAPSHOT" ] == "yes")
2517 qtConfig += "v8snapshot";
2520 // Add config levels --------------------------------------------
2521 QStringList possible_configs = QStringList()
2528 QString set_config = dictionary["QCONFIG"];
2529 if (possible_configs.contains(set_config)) {
2530 foreach (const QString &cfg, possible_configs) {
2531 qtConfig += (cfg + "-config");
2532 if (cfg == set_config)
2537 if (dictionary.contains("XQMAKESPEC") && (dictionary["QMAKESPEC"] != dictionary["XQMAKESPEC"]))
2538 qmakeConfig += "cross_compile";
2540 // Directories and settings for .qmake.cache --------------------
2542 // if QT_INSTALL_* have not been specified on commandline, define them now from QT_INSTALL_PREFIX
2543 // if prefix is empty (WINCE), make all of them empty, if they aren't set
2544 bool qipempty = false;
2545 if (dictionary[ "QT_INSTALL_PREFIX" ].isEmpty())
2548 if (!dictionary[ "QT_INSTALL_DOCS" ].size())
2549 dictionary[ "QT_INSTALL_DOCS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/doc");
2550 if (!dictionary[ "QT_INSTALL_HEADERS" ].size())
2551 dictionary[ "QT_INSTALL_HEADERS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/include");
2552 if (!dictionary[ "QT_INSTALL_LIBS" ].size())
2553 dictionary[ "QT_INSTALL_LIBS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/lib");
2554 if (!dictionary[ "QT_INSTALL_BINS" ].size())
2555 dictionary[ "QT_INSTALL_BINS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/bin");
2556 if (!dictionary[ "QT_INSTALL_PLUGINS" ].size())
2557 dictionary[ "QT_INSTALL_PLUGINS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/plugins");
2558 if (!dictionary[ "QT_INSTALL_IMPORTS" ].size())
2559 dictionary[ "QT_INSTALL_IMPORTS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/imports");
2560 if (!dictionary[ "QT_INSTALL_DATA" ].size())
2561 dictionary[ "QT_INSTALL_DATA" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ]);
2562 if (!dictionary[ "QT_INSTALL_TRANSLATIONS" ].size())
2563 dictionary[ "QT_INSTALL_TRANSLATIONS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/translations");
2564 if (!dictionary[ "QT_INSTALL_EXAMPLES" ].size())
2565 dictionary[ "QT_INSTALL_EXAMPLES" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/examples");
2566 if (!dictionary[ "QT_INSTALL_TESTS" ].size())
2567 dictionary[ "QT_INSTALL_TESTS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/tests");
2569 if (dictionary.contains("XQMAKESPEC") && dictionary[ "XQMAKESPEC" ].startsWith("linux"))
2570 dictionary[ "QMAKE_RPATHDIR" ] = dictionary[ "QT_INSTALL_LIBS" ];
2572 qmakeVars += QString("OBJECTS_DIR = ") + fixSeparators("tmp/obj/" + dictionary[ "QMAKE_OUTDIR" ], true);
2573 qmakeVars += QString("MOC_DIR = ") + fixSeparators("tmp/moc/" + dictionary[ "QMAKE_OUTDIR" ], true);
2574 qmakeVars += QString("RCC_DIR = ") + fixSeparators("tmp/rcc/" + dictionary["QMAKE_OUTDIR"], true);
2576 if (!qmakeDefines.isEmpty())
2577 qmakeVars += QString("DEFINES += ") + qmakeDefines.join(" ");
2578 if (!qmakeIncludes.isEmpty())
2579 qmakeVars += QString("INCLUDEPATH += ") + escapeSeparators(qmakeIncludes.join(" "));
2580 if (!opensslLibs.isEmpty())
2581 qmakeVars += opensslLibs;
2582 else if (dictionary[ "OPENSSL" ] == "linked")
2583 qmakeVars += QString("OPENSSL_LIBS = -lssleay32 -llibeay32");
2584 if (!psqlLibs.isEmpty())
2585 qmakeVars += QString("QT_LFLAGS_PSQL=") + psqlLibs.section("=", 1);
2588 QStringList lflagsTDS;
2589 if (!sybase.isEmpty())
2590 lflagsTDS += QString("-L") + fixSeparators(sybase.section("=", 1) + "/lib");
2591 if (!sybaseLibs.isEmpty())
2592 lflagsTDS += sybaseLibs.section("=", 1);
2593 if (!lflagsTDS.isEmpty())
2594 qmakeVars += QString("QT_LFLAGS_TDS=") + lflagsTDS.join(" ");
2597 if (!qmakeSql.isEmpty())
2598 qmakeVars += QString("sql-drivers += ") + qmakeSql.join(" ");
2599 if (!qmakeSqlPlugins.isEmpty())
2600 qmakeVars += QString("sql-plugins += ") + qmakeSqlPlugins.join(" ");
2601 if (!qmakeStyles.isEmpty())
2602 qmakeVars += QString("styles += ") + qmakeStyles.join(" ");
2603 if (!qmakeStylePlugins.isEmpty())
2604 qmakeVars += QString("style-plugins += ") + qmakeStylePlugins.join(" ");
2606 if (dictionary["QMAKESPEC"].endsWith("-g++")) {
2607 QString includepath = qgetenv("INCLUDE");
2608 bool hasSh = Environment::detectExecutable("sh.exe");
2609 QChar separator = (!includepath.contains(":\\") && hasSh ? QChar(':') : QChar(';'));
2610 qmakeVars += QString("TMPPATH = $$quote($$(INCLUDE))");
2611 qmakeVars += QString("QMAKE_INCDIR_POST += $$split(TMPPATH,\"%1\")").arg(separator);
2612 qmakeVars += QString("TMPPATH = $$quote($$(LIB))");
2613 qmakeVars += QString("QMAKE_LIBDIR_POST += $$split(TMPPATH,\"%1\")").arg(separator);
2616 if (!dictionary[ "QMAKESPEC" ].length()) {
2617 cout << "Configure could not detect your compiler. QMAKESPEC must either" << endl
2618 << "be defined as an environment variable, or specified as an" << endl
2619 << "argument with -platform" << endl;
2620 dictionary[ "HELP" ] = "yes";
2622 QStringList winPlatforms;
2623 QDir mkspecsDir(sourcePath + "/mkspecs");
2624 const QFileInfoList &specsList = mkspecsDir.entryInfoList();
2625 for (int i = 0; i < specsList.size(); ++i) {
2626 const QFileInfo &fi = specsList.at(i);
2627 if (fi.fileName().left(5) == "win32") {
2628 winPlatforms += fi.fileName();
2631 cout << "Available platforms are: " << qPrintable(winPlatforms.join(", ")) << endl;
2632 dictionary[ "DONE" ] = "error";
2637 void Configure::generateCachefile()
2639 // Generate .qmake.cache
2640 QFile cacheFile(buildPath + "/.qmake.cache");
2641 if (cacheFile.open(QFile::WriteOnly | QFile::Text)) { // Truncates any existing file.
2642 QTextStream cacheStream(&cacheFile);
2644 cacheStream << "include($$PWD/mkspecs/qmodule.pri)" << endl;
2646 for (QStringList::Iterator var = qmakeVars.begin(); var != qmakeVars.end(); ++var) {
2647 cacheStream << (*var) << endl;
2649 cacheStream << "CONFIG += " << qmakeConfig.join(" ") << " incremental msvc_mp depend_includepath no_private_qt_headers_warning QTDIR_build" << endl;
2651 cacheStream.flush();
2655 // Generate qmodule.pri
2656 QFile moduleFile(dictionary[ "QT_BUILD_TREE" ] + "/mkspecs/qmodule.pri");
2657 if (moduleFile.open(QFile::WriteOnly | QFile::Text)) { // Truncates any existing file.
2658 QTextStream moduleStream(&moduleFile);
2660 moduleStream << "#paths" << endl;
2661 moduleStream << "QT_BUILD_TREE = " << fixSeparators(dictionary[ "QT_BUILD_TREE" ], true) << endl;
2662 moduleStream << "QT_SOURCE_TREE = " << fixSeparators(dictionary[ "QT_SOURCE_TREE" ], true) << endl;
2663 QStringList buildParts;
2664 buildParts << QStringLiteral("libs") << QStringLiteral("examples") << QStringLiteral("tests");
2665 foreach (const QString &item, disabledBuildParts) {
2666 buildParts.removeAll(item);
2668 moduleStream << "QT_BUILD_PARTS = " << buildParts.join(" ") << endl << endl;
2670 //so that we can build without an install first (which would be impossible)
2671 moduleStream << "#local paths that cannot be queried from the QT_INSTALL_* properties while building QTDIR" << endl;
2672 moduleStream << "QMAKE_MOC = $$QT_BUILD_TREE" << fixSeparators("/bin/moc.exe", true) << endl;
2673 moduleStream << "QMAKE_UIC = $$QT_BUILD_TREE" << fixSeparators("/bin/uic.exe", true) << endl;
2674 moduleStream << "QMAKE_RCC = $$QT_BUILD_TREE" << fixSeparators("/bin/rcc.exe", true) << endl;
2675 moduleStream << "QMAKE_DUMPCPP = $$QT_BUILD_TREE" << fixSeparators("/bin/dumpcpp.exe", true) << endl;
2676 moduleStream << "QMAKE_INCDIR_QT = $$QT_BUILD_TREE" << fixSeparators("/include", true) << endl;
2677 moduleStream << "QMAKE_LIBDIR_QT = $$QT_BUILD_TREE" << fixSeparators("/lib", true) << endl;
2680 QString targetSpec = dictionary.contains("XQMAKESPEC") ? dictionary[ "XQMAKESPEC" ] : dictionary[ "QMAKESPEC" ];
2681 QString mkspec_path = fixSeparators(sourcePath + "/mkspecs/" + targetSpec);
2682 if (QFile::exists(mkspec_path))
2683 moduleStream << "QMAKESPEC = " << escapeSeparators(mkspec_path) << endl;
2685 moduleStream << "QMAKESPEC = " << fixSeparators(targetSpec, true) << endl;
2686 moduleStream << "ARCH = " << dictionary[ "ARCHITECTURE" ] << endl;
2688 if (dictionary["QT_EDITION"] != "QT_EDITION_OPENSOURCE")
2689 moduleStream << "DEFINES *= QT_EDITION=QT_EDITION_DESKTOP" << endl;
2691 if (dictionary["CETEST"] == "yes") {
2692 moduleStream << "QT_CE_RAPI_INC = " << fixSeparators(dictionary[ "QT_CE_RAPI_INC" ], true) << endl;
2693 moduleStream << "QT_CE_RAPI_LIB = " << fixSeparators(dictionary[ "QT_CE_RAPI_LIB" ], true) << endl;
2696 moduleStream << "#Qt for Windows CE c-runtime deployment" << endl
2697 << "QT_CE_C_RUNTIME = " << fixSeparators(dictionary[ "CE_CRT" ], true) << endl;
2699 if (dictionary["CE_SIGNATURE"] != QLatin1String("no"))
2700 moduleStream << "DEFAULT_SIGNATURE=" << dictionary["CE_SIGNATURE"] << endl;
2702 if (!dictionary["QMAKE_RPATHDIR"].isEmpty())
2703 moduleStream << "QMAKE_RPATHDIR += " << dictionary["QMAKE_RPATHDIR"] << endl;
2705 if (!dictionary["QT_LIBINFIX"].isEmpty())
2706 moduleStream << "QT_LIBINFIX = " << dictionary["QT_LIBINFIX"] << endl;
2708 if (!dictionary["QT_NAMESPACE"].isEmpty()) {
2709 moduleStream << "#namespaces" << endl << "QT_NAMESPACE = " << dictionary["QT_NAMESPACE"] << endl;
2713 if (!dictionary["KBD_DRIVERS"].isEmpty())
2714 moduleStream << "kbd-drivers += "<< dictionary["KBD_DRIVERS"]<<endl;
2715 if (!dictionary["GFX_DRIVERS"].isEmpty())
2716 moduleStream << "gfx-drivers += "<< dictionary["GFX_DRIVERS"]<<endl;
2717 if (!dictionary["MOUSE_DRIVERS"].isEmpty())
2718 moduleStream << "mouse-drivers += "<< dictionary["MOUSE_DRIVERS"]<<endl;
2719 if (!dictionary["DECORATIONS"].isEmpty())
2720 moduleStream << "decorations += "<<dictionary["DECORATIONS"]<<endl;
2722 if (!dictionary["QMAKE_RPATHDIR"].isEmpty())
2723 moduleStream << "QMAKE_RPATHDIR += "<<dictionary["QMAKE_RPATHDIR"]<<endl;
2725 moduleStream << "CONFIG += create_prl link_prl" << endl;
2727 moduleStream.flush();
2731 // Generate qconfig.pri
2732 QFile configFile(dictionary[ "QT_BUILD_TREE" ] + "/mkspecs/qconfig.pri");
2733 if (configFile.open(QFile::WriteOnly | QFile::Text)) { // Truncates any existing file.
2734 QTextStream configStream(&configFile);
2736 configStream << "CONFIG+= ";
2737 configStream << dictionary[ "BUILD" ];
2738 if (dictionary[ "SHARED" ] == "yes")
2739 configStream << " shared";
2741 configStream << " static";
2743 if (dictionary[ "LTCG" ] == "yes")
2744 configStream << " ltcg";
2745 if (dictionary[ "MSVC_MP" ] == "yes")
2746 configStream << " msvc_mp";
2747 if (dictionary[ "STL" ] == "yes")
2748 configStream << " stl";
2749 if (dictionary[ "EXCEPTIONS" ] == "yes")
2750 configStream << " exceptions";
2751 if (dictionary[ "EXCEPTIONS" ] == "no")
2752 configStream << " exceptions_off";
2753 if (dictionary[ "RTTI" ] == "yes")
2754 configStream << " rtti";
2755 if (dictionary[ "MMX" ] == "yes")
2756 configStream << " mmx";
2757 if (dictionary[ "3DNOW" ] == "yes")
2758 configStream << " 3dnow";
2759 if (dictionary[ "SSE" ] == "yes")
2760 configStream << " sse";
2761 if (dictionary[ "SSE2" ] == "yes")
2762 configStream << " sse2";
2763 if (dictionary[ "IWMMXT" ] == "yes")
2764 configStream << " iwmmxt";
2765 if (dictionary["INCREDIBUILD_XGE"] == "yes")
2766 configStream << " incredibuild_xge";
2767 if (dictionary["PLUGIN_MANIFESTS"] == "no")
2768 configStream << " no_plugin_manifest";
2769 if (dictionary["QPA"] == "yes")
2770 configStream << " qpa";
2772 if (dictionary["DIRECTWRITE"] == "yes")
2773 configStream << "directwrite";
2775 configStream << endl;
2776 configStream << "QT_ARCH = " << dictionary[ "ARCHITECTURE" ] << endl;
2777 if (dictionary["QT_EDITION"].contains("OPENSOURCE"))
2778 configStream << "QT_EDITION = " << QLatin1String("OpenSource") << endl;
2780 configStream << "QT_EDITION = " << dictionary["EDITION"] << endl;
2781 configStream << "QT_CONFIG += " << qtConfig.join(" ") << endl;
2783 configStream << "#versioning " << endl
2784 << "QT_VERSION = " << dictionary["VERSION"] << endl
2785 << "QT_MAJOR_VERSION = " << dictionary["VERSION_MAJOR"] << endl
2786 << "QT_MINOR_VERSION = " << dictionary["VERSION_MINOR"] << endl
2787 << "QT_PATCH_VERSION = " << dictionary["VERSION_PATCH"] << endl;
2789 configStream.flush();
2795 QString Configure::addDefine(QString def)
2797 QString result, defNeg, defD = def;
2799 defD.replace(QRegExp("=.*"), "");
2800 def.replace(QRegExp("="), " ");
2802 if (def.startsWith("QT_NO_")) {
2804 defNeg.replace("QT_NO_", "QT_");
2805 } else if (def.startsWith("QT_")) {
2807 defNeg.replace("QT_", "QT_NO_");
2810 if (defNeg.isEmpty()) {
2811 result = "#ifndef $DEFD\n"
2815 result = "#if defined($DEFD) && defined($DEFNEG)\n"
2817 "#elif !defined($DEFD)\n"
2821 result.replace("$DEFNEG", defNeg);
2822 result.replace("$DEFD", defD);
2823 result.replace("$DEF", def);
2828 void Configure::generateConfigfiles()
2830 QDir(buildPath).mkpath("src/corelib/global");
2831 QString outName(buildPath + "/src/corelib/global/qconfig.h");
2832 QTemporaryFile tmpFile;
2833 QTextStream tmpStream;
2835 if (tmpFile.open()) {
2836 tmpStream.setDevice(&tmpFile);
2838 if (dictionary[ "QCONFIG" ] == "full") {
2839 tmpStream << "/* Everything */" << endl;
2841 QString configName("qconfig-" + dictionary[ "QCONFIG" ] + ".h");
2842 tmpStream << "/* Copied from " << configName << "*/" << endl;
2843 tmpStream << "#ifndef QT_BOOTSTRAPPED" << endl;
2844 QFile inFile(sourcePath + "/src/corelib/global/" + configName);
2845 if (inFile.open(QFile::ReadOnly)) {
2846 QByteArray buffer = inFile.readAll();
2847 tmpFile.write(buffer.constData(), buffer.size());
2850 tmpStream << "#endif // QT_BOOTSTRAPPED" << endl;
2854 if (dictionary[ "SHARED" ] == "yes") {
2855 tmpStream << "#ifndef QT_DLL" << endl;
2856 tmpStream << "#define QT_DLL" << endl;
2857 tmpStream << "#endif" << endl;
2860 tmpStream << "/* License information */" << endl;
2861 tmpStream << "#define QT_PRODUCT_LICENSEE \"" << licenseInfo[ "LICENSEE" ] << "\"" << endl;
2862 tmpStream << "#define QT_PRODUCT_LICENSE \"" << dictionary[ "EDITION" ] << "\"" << endl;
2864 tmpStream << "// Qt Edition" << endl;
2865 tmpStream << "#ifndef QT_EDITION" << endl;
2866 tmpStream << "# define QT_EDITION " << dictionary["QT_EDITION"] << endl;
2867 tmpStream << "#endif" << endl;
2869 if (dictionary["BUILDDEV"] == "yes") {
2870 dictionary["QMAKE_INTERNAL"] = "yes";
2871 tmpStream << "/* Used for example to export symbols for the certain autotests*/" << endl;
2872 tmpStream << "#define QT_BUILD_INTERNAL" << endl;
2875 tmpStream << "/* Machine byte-order */" << endl;
2876 tmpStream << "#define Q_BIG_ENDIAN 4321" << endl;
2877 tmpStream << "#define Q_LITTLE_ENDIAN 1234" << endl;
2878 tmpStream << "#define Q_BYTE_ORDER Q_LITTLE_ENDIAN" << endl;
2880 if (dictionary[ "QPA" ] == "yes")
2881 tmpStream << endl << "#define Q_WS_QPA" << endl;
2883 tmpStream << endl << "// Compile time features" << endl;
2884 tmpStream << "#define QT_ARCH_" << dictionary["ARCHITECTURE"].toUpper() << endl;
2886 QStringList qconfigList;
2887 if (dictionary["STL"] == "no") qconfigList += "QT_NO_STL";
2888 if (dictionary["STYLE_WINDOWS"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWS";
2889 if (dictionary["STYLE_PLASTIQUE"] != "yes") qconfigList += "QT_NO_STYLE_PLASTIQUE";
2890 if (dictionary["STYLE_CLEANLOOKS"] != "yes") qconfigList += "QT_NO_STYLE_CLEANLOOKS";
2891 if (dictionary["STYLE_WINDOWSXP"] != "yes" && dictionary["STYLE_WINDOWSVISTA"] != "yes")
2892 qconfigList += "QT_NO_STYLE_WINDOWSXP";
2893 if (dictionary["STYLE_WINDOWSVISTA"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWSVISTA";
2894 if (dictionary["STYLE_MOTIF"] != "yes") qconfigList += "QT_NO_STYLE_MOTIF";
2895 if (dictionary["STYLE_CDE"] != "yes") qconfigList += "QT_NO_STYLE_CDE";
2897 // ### We still need the QT_NO_STYLE_S60 define for compiling Qt. Remove later!
2898 qconfigList += "QT_NO_STYLE_S60";
2900 if (dictionary["STYLE_WINDOWSCE"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWSCE";
2901 if (dictionary["STYLE_WINDOWSMOBILE"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWSMOBILE";
2902 if (dictionary["STYLE_GTK"] != "yes") qconfigList += "QT_NO_STYLE_GTK";
2904 if (dictionary["GIF"] == "yes") qconfigList += "QT_BUILTIN_GIF_READER=1";
2905 if (dictionary["PNG"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_PNG";
2906 if (dictionary["MNG"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_MNG";
2907 if (dictionary["JPEG"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_JPEG";
2908 if (dictionary["TIFF"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_TIFF";
2909 if (dictionary["ZLIB"] == "no") {
2910 qconfigList += "QT_NO_ZLIB";
2911 qconfigList += "QT_NO_COMPRESS";
2914 if (dictionary["ACCESSIBILITY"] == "no") qconfigList += "QT_NO_ACCESSIBILITY";
2915 if (dictionary["EXCEPTIONS"] == "no") qconfigList += "QT_NO_EXCEPTIONS";
2916 if (dictionary["OPENGL"] == "no") qconfigList += "QT_NO_OPENGL";
2917 if (dictionary["OPENVG"] == "no") qconfigList += "QT_NO_OPENVG";
2918 if (dictionary["OPENSSL"] == "no") qconfigList += "QT_NO_OPENSSL";
2919 if (dictionary["OPENSSL"] == "linked") qconfigList += "QT_LINKED_OPENSSL";
2920 if (dictionary["DBUS"] == "no") qconfigList += "QT_NO_DBUS";
2921 if (dictionary["WEBKIT"] == "no") qconfigList += "QT_NO_WEBKIT";
2922 if (dictionary["V8"] == "no") qconfigList += "QT_NO_V8";
2923 if (dictionary["DECLARATIVE"] == "no") qconfigList += "QT_NO_DECLARATIVE";
2924 if (dictionary["DECLARATIVE_DEBUG"] == "no") qconfigList += "QDECLARATIVE_NO_DEBUG_PROTOCOL";
2925 if (dictionary["PHONON"] == "no") qconfigList += "QT_NO_PHONON";
2926 if (dictionary["MULTIMEDIA"] == "no") qconfigList += "QT_NO_MULTIMEDIA";
2927 if (dictionary["XMLPATTERNS"] == "no") qconfigList += "QT_NO_XMLPATTERNS";
2928 if (dictionary["SCRIPT"] == "no") qconfigList += "QT_NO_SCRIPT";
2929 if (dictionary["SCRIPTTOOLS"] == "no") qconfigList += "QT_NO_SCRIPTTOOLS";
2930 if (dictionary["FREETYPE"] == "no") qconfigList += "QT_NO_FREETYPE";
2931 if (dictionary["NATIVE_GESTURES"] == "no") qconfigList += "QT_NO_NATIVE_GESTURES";
2933 if (dictionary["OPENGL_ES_CM"] == "no" &&
2934 dictionary["OPENGL_ES_2"] == "no" &&
2935 dictionary["OPENVG"] == "no") qconfigList += "QT_NO_EGL";
2937 if (dictionary["OPENGL_ES_CM"] == "yes" ||
2938 dictionary["OPENGL_ES_2"] == "yes") qconfigList += "QT_OPENGL_ES";
2940 if (dictionary["OPENGL_ES_CM"] == "yes") qconfigList += "QT_OPENGL_ES_1";
2941 if (dictionary["OPENGL_ES_2"] == "yes") qconfigList += "QT_OPENGL_ES_2";
2942 if (dictionary["SQL_MYSQL"] == "yes") qconfigList += "QT_SQL_MYSQL";
2943 if (dictionary["SQL_ODBC"] == "yes") qconfigList += "QT_SQL_ODBC";
2944 if (dictionary["SQL_OCI"] == "yes") qconfigList += "QT_SQL_OCI";
2945 if (dictionary["SQL_PSQL"] == "yes") qconfigList += "QT_SQL_PSQL";
2946 if (dictionary["SQL_TDS"] == "yes") qconfigList += "QT_SQL_TDS";
2947 if (dictionary["SQL_DB2"] == "yes") qconfigList += "QT_SQL_DB2";
2948 if (dictionary["SQL_SQLITE"] == "yes") qconfigList += "QT_SQL_SQLITE";
2949 if (dictionary["SQL_SQLITE2"] == "yes") qconfigList += "QT_SQL_SQLITE2";
2950 if (dictionary["SQL_IBASE"] == "yes") qconfigList += "QT_SQL_IBASE";
2953 for (int i = 0; i < qconfigList.count(); ++i)
2954 tmpStream << addDefine(qconfigList.at(i));
2956 if (dictionary["EMBEDDED"] == "yes")
2958 // Check for keyboard, mouse, gfx.
2959 QStringList kbdDrivers = dictionary["KBD_DRIVERS"].split(" ");;
2960 QStringList allKbdDrivers;
2961 allKbdDrivers<<"tty"<<"usb"<<"sl5000"<<"yopy"<<"vr41xx"<<"qvfb"<<"um";
2962 foreach (const QString &kbd, allKbdDrivers) {
2963 if (!kbdDrivers.contains(kbd))
2964 tmpStream<<"#define QT_NO_QWS_KBD_"<<kbd.toUpper()<<endl;
2967 QStringList mouseDrivers = dictionary["MOUSE_DRIVERS"].split(" ");
2968 QStringList allMouseDrivers;
2969 allMouseDrivers << "pc"<<"bus"<<"linuxtp"<<"yopy"<<"vr41xx"<<"tslib"<<"qvfb";
2970 foreach (const QString &mouse, allMouseDrivers) {
2971 if (!mouseDrivers.contains(mouse))
2972 tmpStream<<"#define QT_NO_QWS_MOUSE_"<<mouse.toUpper()<<endl;
2975 QStringList gfxDrivers = dictionary["GFX_DRIVERS"].split(" ");
2976 QStringList allGfxDrivers;
2977 allGfxDrivers<<"linuxfb"<<"transformed"<<"qvfb"<<"vnc"<<"multiscreen"<<"ahi";
2978 foreach (const QString &gfx, allGfxDrivers) {
2979 if (!gfxDrivers.contains(gfx))
2980 tmpStream<<"#define QT_NO_QWS_"<<gfx.toUpper()<<endl;
2983 tmpStream<<"#define Q_WS_QWS"<<endl;
2985 QStringList depths = dictionary[ "QT_QWS_DEPTH" ].split(" ");
2986 foreach (const QString &depth, depths)
2987 tmpStream<<"#define QT_QWS_DEPTH_"+depth<<endl;
2990 if (dictionary[ "QT_CUPS" ] == "no")
2991 tmpStream<<"#define QT_NO_CUPS"<<endl;
2993 if (dictionary[ "QT_ICONV" ] == "no")
2994 tmpStream<<"#define QT_NO_ICONV"<<endl;
2996 if (dictionary[ "QT_GLIB" ] == "no")
2997 tmpStream<<"#define QT_NO_GLIB"<<endl;
2999 if (dictionary[ "QT_LPR" ] == "no")
3000 tmpStream<<"#define QT_NO_LPR"<<endl;
3002 if (dictionary[ "QT_INOTIFY" ] == "no")
3003 tmpStream<<"#define QT_NO_INOTIFY"<<endl;
3005 if (dictionary[ "QT_SXE" ] == "no")
3006 tmpStream<<"#define QT_NO_SXE"<<endl;
3011 // Replace old qconfig.h with new one
3012 ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL);
3013 QFile::remove(outName);
3014 tmpFile.copy(outName);
3018 // Copy configured mkspec to default directory, but remove the old one first, if there is any
3019 QString defSpec = buildPath + "/mkspecs/default";
3020 QFileInfo defSpecInfo(defSpec);
3021 if (defSpecInfo.exists()) {
3022 if (!Environment::rmdir(defSpec)) {
3023 cout << "Couldn't update default mkspec! Are files in " << qPrintable(defSpec) << " read-only?" << endl;
3024 dictionary["DONE"] = "error";
3029 QString spec = dictionary.contains("XQMAKESPEC") ? dictionary["XQMAKESPEC"] : dictionary["QMAKESPEC"];
3030 QString pltSpec = sourcePath + "/mkspecs/" + spec;
3031 QString includeSpec = buildPath + "/mkspecs/" + spec;
3032 if (!Environment::cpdir(pltSpec, defSpec, includeSpec)) {
3033 cout << "Couldn't update default mkspec! Does " << qPrintable(pltSpec) << " exist?" << endl;
3034 dictionary["DONE"] = "error";
3038 // Generate the new qconfig.cpp file
3039 QDir(buildPath).mkpath("src/corelib/global");
3040 outName = buildPath + "/src/corelib/global/qconfig.cpp";
3042 QTemporaryFile tmpFile2;
3043 if (tmpFile2.open()) {
3044 tmpStream.setDevice(&tmpFile2);
3045 tmpStream << "/* Licensed */" << endl
3046 << "static const char qt_configure_licensee_str [512 + 12] = \"qt_lcnsuser=" << licenseInfo["LICENSEE"] << "\";" << endl
3047 << "static const char qt_configure_licensed_products_str [512 + 12] = \"qt_lcnsprod=" << dictionary["EDITION"] << "\";" << endl
3049 << "/* Build date */" << endl
3050 << "static const char qt_configure_installation [11 + 12] = \"qt_instdate=" << QDate::currentDate().toString(Qt::ISODate) << "\";" << endl
3052 if (!dictionary[ "QT_HOST_PREFIX" ].isNull())
3053 tmpStream << "#if !defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE)" << endl;
3054 tmpStream << "static const char qt_configure_prefix_path_str [512 + 12] = \"qt_prfxpath=" << escapeSeparators(dictionary["QT_INSTALL_PREFIX"]) << "\";" << endl
3055 << "static const char qt_configure_documentation_path_str[512 + 12] = \"qt_docspath=" << escapeSeparators(dictionary["QT_INSTALL_DOCS"]) << "\";" << endl
3056 << "static const char qt_configure_headers_path_str [512 + 12] = \"qt_hdrspath=" << escapeSeparators(dictionary["QT_INSTALL_HEADERS"]) << "\";" << endl
3057 << "static const char qt_configure_libraries_path_str [512 + 12] = \"qt_libspath=" << escapeSeparators(dictionary["QT_INSTALL_LIBS"]) << "\";" << endl
3058 << "static const char qt_configure_binaries_path_str [512 + 12] = \"qt_binspath=" << escapeSeparators(dictionary["QT_INSTALL_BINS"]) << "\";" << endl
3059 << "static const char qt_configure_plugins_path_str [512 + 12] = \"qt_plugpath=" << escapeSeparators(dictionary["QT_INSTALL_PLUGINS"]) << "\";" << endl
3060 << "static const char qt_configure_imports_path_str [512 + 12] = \"qt_impspath=" << escapeSeparators(dictionary["QT_INSTALL_IMPORTS"]) << "\";" << endl
3061 << "static const char qt_configure_data_path_str [512 + 12] = \"qt_datapath=" << escapeSeparators(dictionary["QT_INSTALL_DATA"]) << "\";" << endl
3062 << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << escapeSeparators(dictionary["QT_INSTALL_TRANSLATIONS"]) << "\";" << endl
3063 << "static const char qt_configure_examples_path_str [512 + 12] = \"qt_xmplpath=" << escapeSeparators(dictionary["QT_INSTALL_EXAMPLES"]) << "\";" << endl
3064 << "static const char qt_configure_tests_path_str [512 + 12] = \"qt_tstspath=" << escapeSeparators(dictionary["QT_INSTALL_TESTS"]) << "\";" << endl
3065 //<< "static const char qt_configure_settings_path_str [256] = \"qt_stngpath=" << escapeSeparators(dictionary["QT_INSTALL_SETTINGS"]) << "\";" << endl
3067 if (!dictionary[ "QT_HOST_PREFIX" ].isNull()) {
3068 tmpStream << "#else" << endl
3069 << "static const char qt_configure_prefix_path_str [512 + 12] = \"qt_prfxpath=" << escapeSeparators(dictionary[ "QT_HOST_PREFIX" ]) << "\";" << endl
3070 << "static const char qt_configure_documentation_path_str[512 + 12] = \"qt_docspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/doc", true) <<"\";" << endl
3071 << "static const char qt_configure_headers_path_str [512 + 12] = \"qt_hdrspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/include", true) <<"\";" << endl
3072 << "static const char qt_configure_libraries_path_str [512 + 12] = \"qt_libspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/lib", true) <<"\";" << endl
3073 << "static const char qt_configure_binaries_path_str [512 + 12] = \"qt_binspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/bin", true) <<"\";" << endl
3074 << "static const char qt_configure_plugins_path_str [512 + 12] = \"qt_plugpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/plugins", true) <<"\";" << endl
3075 << "static const char qt_configure_imports_path_str [512 + 12] = \"qt_impspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/imports", true) <<"\";" << endl
3076 << "static const char qt_configure_data_path_str [512 + 12] = \"qt_datapath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ], true) <<"\";" << endl
3077 << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/translations", true) <<"\";" << endl
3078 << "static const char qt_configure_examples_path_str [512 + 12] = \"qt_xmplpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/example", true) <<"\";" << endl
3079 << "static const char qt_configure_tests_path_str [512 + 12] = \"qt_tstspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/tests", true) <<"\";" << endl
3080 << "#endif //QT_BOOTSTRAPPED" << endl;
3082 tmpStream << "/* strlen( \"qt_lcnsxxxx\") == 12 */" << endl
3083 << "#define QT_CONFIGURE_LICENSEE qt_configure_licensee_str + 12;" << endl
3084 << "#define QT_CONFIGURE_LICENSED_PRODUCTS qt_configure_licensed_products_str + 12;" << endl
3085 << "#define QT_CONFIGURE_PREFIX_PATH qt_configure_prefix_path_str + 12;" << endl
3086 << "#define QT_CONFIGURE_DOCUMENTATION_PATH qt_configure_documentation_path_str + 12;" << endl
3087 << "#define QT_CONFIGURE_HEADERS_PATH qt_configure_headers_path_str + 12;" << endl
3088 << "#define QT_CONFIGURE_LIBRARIES_PATH qt_configure_libraries_path_str + 12;" << endl
3089 << "#define QT_CONFIGURE_BINARIES_PATH qt_configure_binaries_path_str + 12;" << endl
3090 << "#define QT_CONFIGURE_PLUGINS_PATH qt_configure_plugins_path_str + 12;" << endl
3091 << "#define QT_CONFIGURE_IMPORTS_PATH qt_configure_imports_path_str + 12;" << endl
3092 << "#define QT_CONFIGURE_DATA_PATH qt_configure_data_path_str + 12;" << endl
3093 << "#define QT_CONFIGURE_TRANSLATIONS_PATH qt_configure_translations_path_str + 12;" << endl
3094 << "#define QT_CONFIGURE_EXAMPLES_PATH qt_configure_examples_path_str + 12;" << endl
3095 << "#define QT_CONFIGURE_TESTS_PATH qt_configure_tests_path_str + 12;" << endl
3096 //<< "#define QT_CONFIGURE_SETTINGS_PATH qt_configure_settings_path_str + 12;" << endl
3102 // Replace old qconfig.cpp with new one
3103 ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL);
3104 QFile::remove(outName);
3105 tmpFile2.copy(outName);
3109 QTemporaryFile tmpFile3;
3110 if (tmpFile3.open()) {
3111 tmpStream.setDevice(&tmpFile3);
3112 tmpStream << "/* Evaluation license key */" << endl
3113 << "static const volatile char qt_eval_key_data [512 + 12] = \"qt_qevalkey=" << licenseInfo["LICENSEKEYEXT"] << "\";" << endl;
3118 outName = buildPath + "/src/corelib/global/qconfig_eval.cpp";
3119 ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL);
3120 QFile::remove(outName);
3122 if (dictionary["EDITION"] == "Evaluation" || qmakeDefines.contains("QT_EVAL"))
3123 tmpFile3.copy(outName);
3130 void Configure::displayConfig()
3132 // Give some feedback
3133 cout << "Environment:" << endl;
3134 QString env = QString::fromLocal8Bit(getenv("INCLUDE")).replace(QRegExp("[;,]"), "\r\n ");
3137 cout << " INCLUDE=\r\n " << env << endl;
3138 env = QString::fromLocal8Bit(getenv("LIB")).replace(QRegExp("[;,]"), "\r\n ");
3141 cout << " LIB=\r\n " << env << endl;
3142 env = QString::fromLocal8Bit(getenv("PATH")).replace(QRegExp("[;,]"), "\r\n ");
3145 cout << " PATH=\r\n " << env << endl;
3147 if (dictionary["EDITION"] == "OpenSource") {
3148 cout << "You are licensed to use this software under the terms of the GNU GPL version 3.";
3149 cout << "You are licensed to use this software under the terms of the Lesser GNU LGPL version 2.1." << endl;
3150 cout << "See " << dictionary["LICENSE FILE"] << "3" << endl << endl
3151 << " or " << dictionary["LICENSE FILE"] << "L" << endl << endl;
3153 QString l1 = licenseInfo[ "LICENSEE" ];
3154 QString l2 = licenseInfo[ "LICENSEID" ];
3155 QString l3 = dictionary["EDITION"] + ' ' + "Edition";
3156 QString l4 = licenseInfo[ "EXPIRYDATE" ];
3157 cout << "Licensee...................." << (l1.isNull() ? "" : l1) << endl;
3158 cout << "License ID.................." << (l2.isNull() ? "" : l2) << endl;
3159 cout << "Product license............." << (l3.isNull() ? "" : l3) << endl;
3160 cout << "Expiry Date................." << (l4.isNull() ? "" : l4) << endl << endl;
3163 cout << "Configuration:" << endl;
3164 cout << " " << qmakeConfig.join("\r\n ") << endl;
3165 cout << "Qt Configuration:" << endl;
3166 cout << " " << qtConfig.join("\r\n ") << endl;
3169 if (dictionary.contains("XQMAKESPEC"))
3170 cout << "QMAKESPEC..................." << dictionary[ "XQMAKESPEC" ] << " (" << dictionary["QMAKESPEC_FROM"] << ")" << endl;
3172 cout << "QMAKESPEC..................." << dictionary[ "QMAKESPEC" ] << " (" << dictionary["QMAKESPEC_FROM"] << ")" << endl;
3173 cout << "Architecture................" << dictionary[ "ARCHITECTURE" ] << endl;
3174 cout << "Maketool...................." << dictionary[ "MAKE" ] << endl;
3175 cout << "Debug symbols..............." << (dictionary[ "BUILD" ] == "debug" ? "yes" : "no") << endl;
3176 cout << "Link Time Code Generation..." << dictionary[ "LTCG" ] << endl;
3177 cout << "Accessibility support......." << dictionary[ "ACCESSIBILITY" ] << endl;
3178 cout << "STL support................." << dictionary[ "STL" ] << endl;
3179 cout << "Exception support..........." << dictionary[ "EXCEPTIONS" ] << endl;
3180 cout << "RTTI support................" << dictionary[ "RTTI" ] << endl;
3181 cout << "MMX support................." << dictionary[ "MMX" ] << endl;
3182 cout << "3DNOW support..............." << dictionary[ "3DNOW" ] << endl;
3183 cout << "SSE support................." << dictionary[ "SSE" ] << endl;
3184 cout << "SSE2 support................" << dictionary[ "SSE2" ] << endl;
3185 cout << "IWMMXT support.............." << dictionary[ "IWMMXT" ] << endl;
3186 cout << "OpenGL support.............." << dictionary[ "OPENGL" ] << endl;
3187 cout << "OpenVG support.............." << dictionary[ "OPENVG" ] << endl;
3188 cout << "OpenSSL support............." << dictionary[ "OPENSSL" ] << endl;
3189 cout << "QtDBus support.............." << dictionary[ "DBUS" ] << endl;
3190 cout << "QtXmlPatterns support......." << dictionary[ "XMLPATTERNS" ] << endl;
3191 cout << "Phonon support.............." << dictionary[ "PHONON" ] << endl;
3192 cout << "QtMultimedia support........" << dictionary[ "MULTIMEDIA" ] << endl;
3194 QString webkit = dictionary[ "WEBKIT" ];
3195 if (webkit == "debug")
3196 webkit = "yes (debug)";
3197 cout << "WebKit support.............." << webkit << endl;
3200 QString declarative = dictionary[ "DECLARATIVE" ];
3201 cout << "Declarative support........." << declarative << endl;
3202 if (declarative == "yes")
3203 cout << "Declarative debugging......." << dictionary[ "DECLARATIVE_DEBUG" ] << endl;
3205 cout << "V8 support.................." << dictionary[ "V8" ] << endl;
3206 cout << "QtScript support............" << dictionary[ "SCRIPT" ] << endl;
3207 cout << "QtScriptTools support......." << dictionary[ "SCRIPTTOOLS" ] << endl;
3208 cout << "DirectWrite support........." << dictionary[ "DIRECTWRITE" ] << endl << endl;
3210 cout << "Third Party Libraries:" << endl;
3211 cout << " ZLIB support............" << dictionary[ "ZLIB" ] << endl;
3212 cout << " GIF support............." << dictionary[ "GIF" ] << endl;
3213 cout << " TIFF support............" << dictionary[ "TIFF" ] << endl;
3214 cout << " JPEG support............" << dictionary[ "JPEG" ] << endl;
3215 cout << " PNG support............." << dictionary[ "PNG" ] << endl;
3216 cout << " MNG support............." << dictionary[ "MNG" ] << endl;
3217 cout << " FreeType support........" << dictionary[ "FREETYPE" ] << endl << endl;
3219 cout << "Styles:" << endl;
3220 cout << " Windows................." << dictionary[ "STYLE_WINDOWS" ] << endl;
3221 cout << " Windows XP.............." << dictionary[ "STYLE_WINDOWSXP" ] << endl;
3222 cout << " Windows Vista..........." << dictionary[ "STYLE_WINDOWSVISTA" ] << endl;
3223 cout << " Plastique..............." << dictionary[ "STYLE_PLASTIQUE" ] << endl;
3224 cout << " Cleanlooks.............." << dictionary[ "STYLE_CLEANLOOKS" ] << endl;
3225 cout << " Motif..................." << dictionary[ "STYLE_MOTIF" ] << endl;
3226 cout << " CDE....................." << dictionary[ "STYLE_CDE" ] << endl;
3227 cout << " Windows CE.............." << dictionary[ "STYLE_WINDOWSCE" ] << endl;
3228 cout << " Windows Mobile.........." << dictionary[ "STYLE_WINDOWSMOBILE" ] << endl << endl;
3230 cout << "Sql Drivers:" << endl;
3231 cout << " ODBC...................." << dictionary[ "SQL_ODBC" ] << endl;
3232 cout << " MySQL..................." << dictionary[ "SQL_MYSQL" ] << endl;
3233 cout << " OCI....................." << dictionary[ "SQL_OCI" ] << endl;
3234 cout << " PostgreSQL.............." << dictionary[ "SQL_PSQL" ] << endl;
3235 cout << " TDS....................." << dictionary[ "SQL_TDS" ] << endl;
3236 cout << " DB2....................." << dictionary[ "SQL_DB2" ] << endl;
3237 cout << " SQLite.................." << dictionary[ "SQL_SQLITE" ] << " (" << dictionary[ "SQL_SQLITE_LIB" ] << ")" << endl;
3238 cout << " SQLite2................." << dictionary[ "SQL_SQLITE2" ] << endl;
3239 cout << " InterBase..............." << dictionary[ "SQL_IBASE" ] << endl << endl;
3241 cout << "Sources are in.............." << dictionary[ "QT_SOURCE_TREE" ] << endl;
3242 cout << "Build is done in............" << dictionary[ "QT_BUILD_TREE" ] << endl;
3243 cout << "Install prefix.............." << dictionary[ "QT_INSTALL_PREFIX" ] << endl;
3244 cout << "Headers installed to........" << dictionary[ "QT_INSTALL_HEADERS" ] << endl;
3245 cout << "Libraries installed to......" << dictionary[ "QT_INSTALL_LIBS" ] << endl;
3246 cout << "Plugins installed to........" << dictionary[ "QT_INSTALL_PLUGINS" ] << endl;
3247 cout << "Imports installed to........" << dictionary[ "QT_INSTALL_IMPORTS" ] << endl;
3248 cout << "Binaries installed to......." << dictionary[ "QT_INSTALL_BINS" ] << endl;
3249 cout << "Docs installed to..........." << dictionary[ "QT_INSTALL_DOCS" ] << endl;
3250 cout << "Data installed to..........." << dictionary[ "QT_INSTALL_DATA" ] << endl;
3251 cout << "Translations installed to..." << dictionary[ "QT_INSTALL_TRANSLATIONS" ] << endl;
3252 cout << "Examples installed to......." << dictionary[ "QT_INSTALL_EXAMPLES" ] << endl;
3253 cout << "Tests installed to.........." << dictionary[ "QT_INSTALL_TESTS" ] << endl;
3255 if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith(QLatin1String("wince"))) {
3256 cout << "Using c runtime detection..." << dictionary[ "CE_CRT" ] << endl;
3257 cout << "Cetest support.............." << dictionary[ "CETEST" ] << endl;
3258 cout << "Signature..................." << dictionary[ "CE_SIGNATURE"] << endl << endl;
3261 if (dictionary["ASSISTANT_WEBKIT"] == "yes")
3262 cout << "Using WebKit as html rendering engine in Qt Assistant." << endl;
3264 if (checkAvailability("INCREDIBUILD_XGE"))
3265 cout << "Using IncrediBuild XGE......" << dictionary["INCREDIBUILD_XGE"] << endl;
3266 if (!qmakeDefines.isEmpty()) {
3267 cout << "Defines.....................";
3268 for (QStringList::Iterator defs = qmakeDefines.begin(); defs != qmakeDefines.end(); ++defs)
3269 cout << (*defs) << " ";
3272 if (!qmakeIncludes.isEmpty()) {
3273 cout << "Include paths...............";
3274 for (QStringList::Iterator incs = qmakeIncludes.begin(); incs != qmakeIncludes.end(); ++incs)
3275 cout << (*incs) << " ";
3278 if (!qmakeLibs.isEmpty()) {
3279 cout << "Additional libraries........";
3280 for (QStringList::Iterator libs = qmakeLibs.begin(); libs != qmakeLibs.end(); ++libs)
3281 cout << (*libs) << " ";
3284 if (dictionary[ "QMAKE_INTERNAL" ] == "yes") {
3285 cout << "Using internal configuration." << endl;
3287 if (dictionary[ "SHARED" ] == "no") {
3288 cout << "WARNING: Using static linking will disable the use of plugins." << endl;
3289 cout << " Make sure you compile ALL needed modules into the library." << endl;
3291 if (dictionary[ "OPENSSL" ] == "linked" && opensslLibs.isEmpty()) {
3292 cout << "NOTE: When linking against OpenSSL, you can override the default" << endl;
3293 cout << "library names through OPENSSL_LIBS." << endl;
3294 cout << "For example:" << endl;
3295 cout << " configure -openssl-linked OPENSSL_LIBS=\"-lssleay32 -llibeay32\"" << endl;
3297 if (dictionary[ "ZLIB_FORCED" ] == "yes") {
3298 QString which_zlib = "supplied";
3299 if (dictionary[ "ZLIB" ] == "system")
3300 which_zlib = "system";
3302 cout << "NOTE: The -no-zlib option was supplied but is no longer supported." << endl
3304 << "Qt now requires zlib support in all builds, so the -no-zlib" << endl
3305 << "option was ignored. Qt will be built using the " << which_zlib
3312 void Configure::generateHeaders()
3314 if (dictionary["SYNCQT"] == "yes") {
3315 if (findFile("perl.exe")) {
3316 cout << "Running syncqt..." << endl;
3318 args += buildPath + "/bin/syncqt.bat";
3320 env += QString("QTDIR=" + sourcePath);
3321 env += QString("PATH=" + buildPath + "/bin/;" + qgetenv("PATH"));
3322 int retc = Environment::execute(args, env, QStringList());
3324 cout << "syncqt failed, return code " << retc << endl << endl;
3325 dictionary["DONE"] = "error";
3328 cout << "Perl not found in environment - cannot run syncqt." << endl;
3329 dictionary["DONE"] = "error";
3334 void Configure::buildQmake()
3336 if (dictionary[ "BUILD_QMAKE" ] == "yes") {
3340 QString pwd = QDir::currentPath();
3341 QDir::setCurrent(buildPath + "/qmake");
3343 QString makefile = "Makefile";
3345 QFile out(makefile);
3346 if (out.open(QFile::WriteOnly | QFile::Text)) {
3347 QTextStream stream(&out);
3348 stream << "#AutoGenerated by configure.exe" << endl
3349 << "BUILD_PATH = " << QDir::convertSeparators(buildPath) << endl
3350 << "SOURCE_PATH = " << QDir::convertSeparators(sourcePath) << endl;
3351 stream << "QMAKESPEC = " << dictionary["QMAKESPEC"] << endl
3352 << "QT_VERSION = " << dictionary["VERSION"] << endl;
3354 if (dictionary["EDITION"] == "OpenSource" ||
3355 dictionary["QT_EDITION"].contains("OPENSOURCE"))
3356 stream << "QMAKE_OPENSOURCE_EDITION = yes" << endl;
3359 QFile in(sourcePath + "/qmake/" + dictionary["QMAKEMAKEFILE"]);
3360 if (in.open(QFile::ReadOnly | QFile::Text)) {
3361 QString d = in.readAll();
3362 //### need replaces (like configure.sh)? --Sam
3363 stream << d << endl;
3370 args += dictionary[ "MAKE" ];
3374 cout << "Creating qmake..." << endl;
3375 int exitCode = Environment::execute(args, QStringList(), QStringList());
3378 args += dictionary[ "MAKE" ];
3382 exitCode = Environment::execute(args, QStringList(), QStringList());
3384 cout << "Cleaning qmake failed, return code " << exitCode << endl << endl;
3385 dictionary[ "DONE" ] = "error";
3388 args += dictionary[ "MAKE" ];
3391 exitCode = Environment::execute(args, QStringList(), QStringList());
3393 cout << "Building qmake failed, return code " << exitCode << endl << endl;
3394 dictionary[ "DONE" ] = "error";
3398 QDir::setCurrent(pwd);
3403 void Configure::buildHostTools()
3405 if (dictionary[ "NOPROCESS" ] == "yes")
3406 dictionary[ "DONE" ] = "yes";
3408 if (!dictionary.contains("XQMAKESPEC"))
3411 QString pwd = QDir::currentPath();
3412 QStringList hostToolsDirs;
3415 << "tools/linguist/lrelease";
3417 if (dictionary["XQMAKESPEC"].startsWith("wince"))
3418 hostToolsDirs << "tools/checksdk";
3420 if (dictionary[ "CETEST" ] == "yes")
3421 hostToolsDirs << "tools/qtestlib/wince/cetest";
3423 for (int i = 0; i < hostToolsDirs.count(); ++i) {
3424 cout << "Creating " << hostToolsDirs.at(i) << " ..." << endl;
3425 QString toolBuildPath = buildPath + "/" + hostToolsDirs.at(i);
3426 QString toolSourcePath = sourcePath + "/" + hostToolsDirs.at(i);
3428 // generate Makefile
3430 args << QDir::toNativeSeparators(buildPath + "/bin/qmake");
3431 // override .qmake.cache because we are not cross-building these.
3432 // we need a full path so that a build with -prefix will still find it.
3433 args << "-spec" << QDir::toNativeSeparators(buildPath + "/mkspecs/" + dictionary["QMAKESPEC"]);
3435 args << "-o" << QDir::toNativeSeparators(toolBuildPath + "/Makefile");
3437 QDir().mkpath(toolBuildPath);
3438 QDir::setCurrent(toolSourcePath);
3439 int exitCode = Environment::execute(args, QStringList(), QStringList());
3441 cout << "qmake failed, return code " << exitCode << endl << endl;
3442 dictionary["DONE"] = "error";
3448 args += dictionary["MAKE"];
3449 QDir::setCurrent(toolBuildPath);
3450 exitCode = Environment::execute(args, QStringList(), QStringList());
3453 args += dictionary["MAKE"];
3455 exitCode = Environment::execute(args, QStringList(), QStringList());
3457 cout << "Cleaning " << hostToolsDirs.at(i) << " failed, return code " << exitCode << endl << endl;
3458 dictionary["DONE"] = "error";
3462 args += dictionary["MAKE"];
3463 exitCode = Environment::execute(args, QStringList(), QStringList());
3465 cout << "Building " << hostToolsDirs.at(i) << " failed, return code " << exitCode << endl << endl;
3466 dictionary["DONE"] = "error";
3472 QDir::setCurrent(pwd);
3475 void Configure::findProjects(const QString& dirName)
3477 if (dictionary[ "NOPROCESS" ] == "no") {
3481 ProjectType qmakeTemplate;
3482 const QFileInfoList &list = dir.entryInfoList(QStringList(QLatin1String("*.pro")),
3483 QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
3484 for (int i = 0; i < list.size(); ++i) {
3485 const QFileInfo &fi = list.at(i);
3486 if (fi.fileName() != "qmake.pro") {
3487 entryName = dirName + "/" + fi.fileName();
3489 findProjects(entryName);
3491 qmakeTemplate = projectType(fi.absoluteFilePath());
3492 switch (qmakeTemplate) {
3501 makeList[makeListNumber].append(new MakeItem(sourceDir.relativeFilePath(fi.absolutePath()),
3512 void Configure::appendMakeItem(int inList, const QString &item)
3517 dir.prepend("/src");
3518 makeList[inList].append(new MakeItem(sourcePath + dir,
3519 item + ".pro", buildPath + dir + "/Makefile", Lib));
3520 if (dictionary[ "DSPFILES" ] == "yes") {
3521 makeList[inList].append(new MakeItem(sourcePath + dir,
3522 item + ".pro", buildPath + dir + "/" + item + ".dsp", Lib));
3524 if (dictionary[ "VCPFILES" ] == "yes") {
3525 makeList[inList].append(new MakeItem(sourcePath + dir,
3526 item + ".pro", buildPath + dir + "/" + item + ".vcp", Lib));
3528 if (dictionary[ "VCPROJFILES" ] == "yes") {
3529 makeList[inList].append(new MakeItem(sourcePath + dir,
3530 item + ".pro", buildPath + dir + "/" + item + ".vcproj", Lib));
3534 void Configure::generateMakefiles()
3536 if (dictionary[ "NOPROCESS" ] == "no") {
3538 cout << "Creating makefiles in src..." << endl;
3541 QString spec = dictionary.contains("XQMAKESPEC") ? dictionary[ "XQMAKESPEC" ] : dictionary[ "QMAKESPEC" ];
3542 if (spec != "win32-msvc")
3543 dictionary[ "DSPFILES" ] = "no";
3545 if (spec != "win32-msvc.net" && !spec.startsWith("win32-msvc2") && !spec.startsWith(QLatin1String("wince")))
3546 dictionary[ "VCPROJFILES" ] = "no";
3549 QString pwd = QDir::currentPath();
3550 if (dictionary["FAST"] != "yes") {
3552 bool generate = true;
3553 bool doDsp = (dictionary["DSPFILES"] == "yes" || dictionary["VCPFILES"] == "yes"
3554 || dictionary["VCPROJFILES"] == "yes");
3556 QString pwd = QDir::currentPath();
3557 QString dirPath = fixSeparators(buildPath + dirName);
3560 args << fixSeparators(buildPath + "/bin/qmake");
3563 if (dictionary[ "DEPENDENCIES" ] == "no")
3564 args << "-nodepend";
3565 args << "-tp" << "vc";
3566 doDsp = false; // DSP files will be done
3567 printf("Generating Visual Studio project files...\n");
3569 printf("Generating Makefiles...\n");
3570 generate = false; // Now Makefiles will be done
3572 // don't pass -spec - .qmake.cache has it already
3574 args << (sourcePath + "/qtbase.pro");
3577 if (!dictionary[ "QMAKEADDITIONALARGS" ].isEmpty())
3578 args << dictionary[ "QMAKEADDITIONALARGS" ];
3580 QDir::setCurrent(fixSeparators(dirPath));
3581 if (int exitCode = Environment::execute(args, QStringList(), QStringList())) {
3582 cout << "Qmake failed, return code " << exitCode << endl << endl;
3583 dictionary[ "DONE" ] = "error";
3587 findProjects(sourcePath);
3588 for (i=0; i<3; i++) {
3589 for (int j=0; j<makeList[i].size(); ++j) {
3590 MakeItem *it=makeList[i][j];
3591 QString dirPath = fixSeparators(it->directory + "/");
3592 QString projectName = it->proFile;
3593 QString makefileName = buildPath + "/" + dirPath + it->target;
3595 // For shadowbuilds, we need to create the path first
3596 QDir buildPathDir(buildPath);
3597 if (sourcePath != buildPath && !buildPathDir.exists(dirPath))
3598 buildPathDir.mkpath(dirPath);
3602 args << fixSeparators(buildPath + "/bin/qmake");
3603 args << sourcePath + "/" + dirPath + projectName;
3604 args << dictionary[ "QMAKE_ALL_ARGS" ];
3606 cout << "For " << qPrintable(dirPath + projectName) << endl;
3611 if (!dictionary[ "QMAKEADDITIONALARGS" ].isEmpty())
3612 args << dictionary[ "QMAKEADDITIONALARGS" ];
3614 QDir::setCurrent(fixSeparators(dirPath));
3616 QFile file(makefileName);
3617 if (!file.open(QFile::WriteOnly)) {
3618 printf("failed on dirPath=%s, makefile=%s\n",
3619 qPrintable(dirPath), qPrintable(makefileName));
3622 QTextStream txt(&file);
3624 txt << "\t" << args.join(" ") << "\n";
3625 txt << "\t\"$(MAKE)\" -$(MAKEFLAGS) -f " << it->target << "\n";
3626 txt << "first: all\n";
3628 txt << "\t" << args.join(" ") << "\n";
3632 QDir::setCurrent(pwd);
3634 cout << "Processing of project files have been disabled." << endl;
3635 cout << "Only use this option if you really know what you're doing." << endl << endl;
3640 void Configure::showSummary()
3642 QString make = dictionary[ "MAKE" ];
3643 if (!dictionary.contains("XQMAKESPEC")) {
3644 cout << endl << endl << "Qt is now configured for building. Just run " << qPrintable(make) << "." << endl;
3645 cout << "To reconfigure, run " << qPrintable(make) << " confclean and configure." << endl << endl;
3646 } else if (dictionary.value("QMAKESPEC").startsWith("wince")) {
3647 // we are cross compiling for Windows CE
3648 cout << endl << endl << "Qt is now configured for building. To start the build run:" << endl
3649 << "\tsetcepaths " << dictionary.value("XQMAKESPEC") << endl
3650 << "\t" << qPrintable(make) << endl
3651 << "To reconfigure, run " << qPrintable(make) << " confclean and configure." << endl << endl;
3655 Configure::ProjectType Configure::projectType(const QString& proFileName)
3657 QFile proFile(proFileName);
3658 if (proFile.open(QFile::ReadOnly)) {
3659 QString buffer = proFile.readLine(1024);
3660 while (!buffer.isEmpty()) {
3661 QStringList segments = buffer.split(QRegExp("\\s"));
3662 QStringList::Iterator it = segments.begin();
3664 if (segments.size() >= 3) {
3665 QString keyword = (*it++);
3666 QString operation = (*it++);
3667 QString value = (*it++);
3669 if (keyword == "TEMPLATE") {
3672 else if (value == "subdirs")
3677 buffer = proFile.readLine(1024);
3681 // Default to app handling
3687 bool Configure::showLicense(QString orgLicenseFile)
3689 if (dictionary["LICENSE_CONFIRMED"] == "yes") {
3690 cout << "You have already accepted the terms of the license." << endl << endl;
3694 bool haveGpl3 = false;
3695 QString licenseFile = orgLicenseFile;
3697 if (dictionary["EDITION"] == "OpenSource" || dictionary["EDITION"] == "Snapshot") {
3698 haveGpl3 = QFile::exists(orgLicenseFile + "/LICENSE.GPL3");
3699 theLicense = "GNU Lesser General Public License (LGPL) version 2.1";
3701 theLicense += "\nor the GNU General Public License (GPL) version 3";
3703 // the first line of the license file tells us which license it is
3704 QFile file(licenseFile);
3705 if (!file.open(QFile::ReadOnly)) {
3706 cout << "Failed to load LICENSE file" << endl;
3709 theLicense = file.readLine().trimmed();
3714 cout << "You are licensed to use this software under the terms of" << endl
3715 << "the " << theLicense << "." << endl
3717 if (dictionary["EDITION"] == "OpenSource" || dictionary["EDITION"] == "Snapshot") {
3719 cout << "Type '3' to view the GNU General Public License version 3 (GPLv3)." << endl;
3720 cout << "Type 'L' to view the Lesser GNU General Public License version 2.1 (LGPLv2.1)." << endl;
3722 cout << "Type '?' to view the " << theLicense << "." << endl;
3724 cout << "Type 'y' to accept this license offer." << endl
3725 << "Type 'n' to decline this license offer." << endl
3727 << "Do you accept the terms of the license?" << endl;
3729 accept = tolower(accept);
3731 if (accept == 'y') {
3733 } else if (accept == 'n') {
3736 if (dictionary["EDITION"] == "OpenSource" || dictionary["EDITION"] == "Snapshot") {
3738 licenseFile = orgLicenseFile + "/LICENSE.GPL3";
3740 licenseFile = orgLicenseFile + "/LICENSE.LGPL";
3742 // Get console line height, to fill the screen properly
3743 int i = 0, screenHeight = 25; // default
3744 CONSOLE_SCREEN_BUFFER_INFO consoleInfo;
3745 HANDLE stdOut = GetStdHandle(STD_OUTPUT_HANDLE);
3746 if (GetConsoleScreenBufferInfo(stdOut, &consoleInfo))
3747 screenHeight = consoleInfo.srWindow.Bottom
3748 - consoleInfo.srWindow.Top
3749 - 1; // Some overlap for context
3751 // Prompt the license content to the user
3752 QFile file(licenseFile);
3753 if (!file.open(QFile::ReadOnly)) {
3754 cout << "Failed to load LICENSE file" << licenseFile << endl;
3757 QStringList licenseContent = QString(file.readAll()).split('\n');
3758 while (i < licenseContent.size()) {
3759 cout << licenseContent.at(i) << endl;
3760 if (++i % screenHeight == 0) {
3761 cout << "(Press any key for more..)";
3762 if (_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
3763 exit(0); // Exit cleanly for Ctrl+C
3764 cout << "\r"; // Overwrite text above
3771 void Configure::readLicense()
3773 if (QFile::exists(dictionary["QT_SOURCE_TREE"] + "/src/corelib/kernel/qfunctions_wince.h") &&
3774 (dictionary.value("QMAKESPEC").startsWith("wince") || dictionary.value("XQMAKESPEC").startsWith("wince")))
3775 dictionary["PLATFORM NAME"] = "Qt for Windows CE";
3777 dictionary["PLATFORM NAME"] = "Qt for Windows";
3778 dictionary["LICENSE FILE"] = sourcePath;
3780 bool openSource = false;
3781 bool hasOpenSource = QFile::exists(dictionary["LICENSE FILE"] + "/LICENSE.GPL3") || QFile::exists(dictionary["LICENSE FILE"] + "/LICENSE.LGPL");
3782 if (dictionary["BUILDTYPE"] == "commercial") {
3784 } else if (dictionary["BUILDTYPE"] == "opensource") {
3786 } else if (hasOpenSource) { // No Open Source? Just display the commercial license right away
3789 cout << "Which edition of Qt do you want to use ?" << endl;
3790 cout << "Type 'c' if you want to use the Commercial Edition." << endl;
3791 cout << "Type 'o' if you want to use the Open Source Edition." << endl;
3793 accept = tolower(accept);
3795 if (accept == 'c') {
3798 } else if (accept == 'o') {
3804 if (hasOpenSource && openSource) {
3805 cout << endl << "This is the " << dictionary["PLATFORM NAME"] << " Open Source Edition." << endl;
3806 licenseInfo["LICENSEE"] = "Open Source";
3807 dictionary["EDITION"] = "OpenSource";
3808 dictionary["QT_EDITION"] = "QT_EDITION_OPENSOURCE";
3810 if (!showLicense(dictionary["LICENSE FILE"])) {
3811 cout << "Configuration aborted since license was not accepted";
3812 dictionary["DONE"] = "error";
3815 } else if (openSource) {
3816 cout << endl << "Cannot find the GPL license files! Please download the Open Source version of the library." << endl;
3817 dictionary["DONE"] = "error";
3819 #ifdef COMMERCIAL_VERSION
3821 Tools::checkLicense(dictionary, licenseInfo, firstLicensePath());
3822 if (dictionary["DONE"] != "error") {
3823 // give the user some feedback, and prompt for license acceptance
3824 cout << endl << "This is the " << dictionary["PLATFORM NAME"] << " " << dictionary["EDITION"] << " Edition."<< endl << endl;
3825 if (!showLicense(dictionary["LICENSE FILE"])) {
3826 cout << "Configuration aborted since license was not accepted";
3827 dictionary["DONE"] = "error";
3832 #else // !COMMERCIAL_VERSION
3834 cout << endl << "Cannot build commercial edition from the open source version of the library." << endl;
3835 dictionary["DONE"] = "error";
3840 void Configure::reloadCmdLine()
3842 if (dictionary[ "REDO" ] == "yes") {
3843 QFile inFile(buildPath + "/configure" + dictionary[ "CUSTOMCONFIG" ] + ".cache");
3844 if (inFile.open(QFile::ReadOnly)) {
3845 QTextStream inStream(&inFile);
3848 while (buffer.length()) {
3849 configCmdLine += buffer;
3857 void Configure::saveCmdLine()
3859 if (dictionary[ "REDO" ] != "yes") {
3860 QFile outFile(buildPath + "/configure" + dictionary[ "CUSTOMCONFIG" ] + ".cache");
3861 if (outFile.open(QFile::WriteOnly | QFile::Text)) {
3862 QTextStream outStream(&outFile);
3863 for (QStringList::Iterator it = configCmdLine.begin(); it != configCmdLine.end(); ++it) {
3864 outStream << (*it) << " " << endl;
3873 bool Configure::isDone()
3875 return !dictionary["DONE"].isEmpty();
3878 bool Configure::isOk()
3880 return (dictionary[ "DONE" ] != "error");
3884 Configure::filesDiffer(const QString &fn1, const QString &fn2)
3886 QFile file1(fn1), file2(fn2);
3887 if (!file1.open(QFile::ReadOnly) || !file2.open(QFile::ReadOnly))
3889 const int chunk = 2048;
3890 int used1 = 0, used2 = 0;
3891 char b1[chunk], b2[chunk];
3892 while (!file1.atEnd() && !file2.atEnd()) {
3894 used1 = file1.read(b1, chunk);
3896 used2 = file2.read(b2, chunk);
3897 if (used1 > 0 && used2 > 0) {
3898 const int cmp = qMin(used1, used2);
3899 if (memcmp(b1, b2, cmp))
3902 memcpy(b1, b1+cmp, used1);
3904 memcpy(b2, b2+cmp, used2);
3907 return !file1.atEnd() || !file2.atEnd();