source: trunk/tools/configure/configureapp.cpp@ 1147

Last change on this file since 1147 was 846, checked in by Dmitry A. Kuminov, 14 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

File size: 187.4 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation (qt-info@nokia.com)
6**
7** This file is part of the tools applications of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and Nokia.
15**
16** GNU Lesser General Public License Usage
17** Alternatively, this file may be used under the terms of the GNU Lesser
18** General Public License version 2.1 as published by the Free Software
19** Foundation and appearing in the file LICENSE.LGPL included in the
20** packaging of this file. Please review the following information to
21** ensure the GNU Lesser General Public License version 2.1 requirements
22** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23**
24** In addition, as a special exception, Nokia gives you certain additional
25** rights. These rights are described in the Nokia Qt LGPL Exception
26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you have questions regarding the use of this file, please contact
37** Nokia at qt-info@nokia.com.
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#include "configureapp.h"
43#include "environment.h"
44#ifdef COMMERCIAL_VERSION
45# include "tools.h"
46#endif
47
48#include <QDate>
49#include <qdir.h>
50#include <qtemporaryfile.h>
51#include <qstack.h>
52#include <qdebug.h>
53#include <qfileinfo.h>
54#include <qtextstream.h>
55#include <qregexp.h>
56#include <qhash.h>
57
58#include <iostream>
59#include <windows.h>
60#include <conio.h>
61
62QT_BEGIN_NAMESPACE
63
64std::ostream &operator<<(std::ostream &s, const QString &val) {
65 s << val.toLocal8Bit().data();
66 return s;
67}
68
69
70using namespace std;
71
72// Macros to simplify options marking
73#define MARK_OPTION(x,y) ( dictionary[ #x ] == #y ? "*" : " " )
74
75
76bool writeToFile(const char* text, const QString &filename)
77{
78 QByteArray symFile(text);
79 QFile file(filename);
80 QDir dir(QFileInfo(file).absoluteDir());
81 if (!dir.exists())
82 dir.mkpath(dir.absolutePath());
83 if (!file.open(QFile::WriteOnly)) {
84 cout << "Couldn't write to " << qPrintable(filename) << ": " << qPrintable(file.errorString())
85 << endl;
86 return false;
87 }
88 file.write(symFile);
89 return true;
90}
91
92Configure::Configure(int& argc, char** argv)
93{
94 useUnixSeparators = false;
95 // Default values for indentation
96 optionIndent = 4;
97 descIndent = 25;
98 outputWidth = 0;
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
106 outputWidth = 79;
107 int i;
108
109 /*
110 ** Set up the initial state, the default
111 */
112 dictionary[ "CONFIGCMD" ] = argv[ 0 ];
113
114 for (i = 1; i < argc; i++)
115 configCmdLine += argv[ i ];
116
117
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();
125#if 0
126 const QString installPath = QString("C:\\Qt\\%1").arg(QT_VERSION_STR);
127#else
128 const QString installPath = buildPath;
129#endif
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
135 }
136
137 cout << "Preparing build tree..." << endl;
138 QDir(buildPath).mkpath("bin");
139
140 { //duplicate qmake
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));
150 if (fi.isDir()) {
151 qmake_dirs.push(dir + "/" + fi.fileName());
152 QDir().mkpath(od + "/" + fi.fileName());
153 } else {
154 QDir().mkpath(od);
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;
164 justCopy = false;
165 stream.flush();
166 tmpFile.flush();
167 if (filesDiffer(tmpFile.fileName(), outFile)) {
168 QFile::remove(outFile);
169 tmpFile.copy(outFile);
170 }
171 }
172 }
173 if (justCopy && filesDiffer(inFile, outFile))
174 QFile::copy(inFile, outFile);
175 }
176 }
177 }
178 }
179
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;
186 }
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 << "set QTDIR=" << QDir::toNativeSeparators(sourcePath) << endl
192 << "call " << fixSeparators(sourcePath) << fixSeparators("/bin/syncqt.bat -outdir \"") << fixSeparators(buildPath) << "\"" << endl
193 << "set QTDIR=" << QDir::toNativeSeparators(buildPath) << endl;
194 syncqt_bat.close();
195 }
196 }
197
198 // make patch_capabilities and createpackage scripts for Symbian that can be used from the shadow build
199 QFile patch_capabilities(buildPath + "/bin/patch_capabilities");
200 if (patch_capabilities.open(QFile::WriteOnly)) {
201 QTextStream stream(&patch_capabilities);
202 stream << "#!/usr/bin/perl -w" << endl
203 << "require \"" << sourcePath + "/bin/patch_capabilities\";" << endl;
204 }
205 QFile patch_capabilities_bat(buildPath + "/bin/patch_capabilities.bat");
206 if (patch_capabilities_bat.open(QFile::WriteOnly)) {
207 QTextStream stream(&patch_capabilities_bat);
208 stream << "@echo off" << endl
209 << "call " << fixSeparators(sourcePath) << fixSeparators("/bin/patch_capabilities.bat %*") << endl;
210 patch_capabilities_bat.close();
211 }
212 QFile createpackage(buildPath + "/bin/createpackage");
213 if (createpackage.open(QFile::WriteOnly)) {
214 QTextStream stream(&createpackage);
215 stream << "#!/usr/bin/perl -w" << endl
216 << "require \"" << sourcePath + "/bin/createpackage\";" << endl;
217 }
218 QFile createpackage_bat(buildPath + "/bin/createpackage.bat");
219 if (createpackage_bat.open(QFile::WriteOnly)) {
220 QTextStream stream(&createpackage_bat);
221 stream << "@echo off" << endl
222 << "call " << fixSeparators(sourcePath) << fixSeparators("/bin/createpackage.bat %*") << endl;
223 createpackage_bat.close();
224 }
225
226 // For Windows CE and shadow builds we need to copy these to the
227 // build directory.
228 QFile::copy(sourcePath + "/bin/setcepaths.bat" , buildPath + "/bin/setcepaths.bat");
229 //copy the mkspecs
230 buildDir.mkpath("mkspecs");
231 if (!Environment::cpdir(sourcePath + "/mkspecs", buildPath + "/mkspecs")){
232 cout << "Couldn't copy mkspecs!" << sourcePath << " " << buildPath << endl;
233 dictionary["DONE"] = "error";
234 return;
235 }
236 }
237
238 dictionary[ "QT_SOURCE_TREE" ] = fixSeparators(sourcePath);
239 dictionary[ "QT_BUILD_TREE" ] = fixSeparators(buildPath);
240 dictionary[ "QT_INSTALL_PREFIX" ] = fixSeparators(installPath);
241
242 dictionary[ "QMAKESPEC" ] = getenv("QMAKESPEC");
243 if (dictionary[ "QMAKESPEC" ].size() == 0) {
244 dictionary[ "QMAKESPEC" ] = Environment::detectQMakeSpec();
245 dictionary[ "QMAKESPEC_FROM" ] = "detected";
246 } else {
247 dictionary[ "QMAKESPEC_FROM" ] = "env";
248 }
249
250 dictionary[ "ARCHITECTURE" ] = "windows";
251 dictionary[ "QCONFIG" ] = "full";
252 dictionary[ "EMBEDDED" ] = "no";
253 dictionary[ "BUILD_QMAKE" ] = "yes";
254 dictionary[ "DSPFILES" ] = "yes";
255 dictionary[ "VCPROJFILES" ] = "yes";
256 dictionary[ "QMAKE_INTERNAL" ] = "no";
257 dictionary[ "FAST" ] = "no";
258 dictionary[ "NOPROCESS" ] = "no";
259 dictionary[ "STL" ] = "yes";
260 dictionary[ "EXCEPTIONS" ] = "yes";
261 dictionary[ "RTTI" ] = "yes";
262 dictionary[ "MMX" ] = "auto";
263 dictionary[ "3DNOW" ] = "auto";
264 dictionary[ "SSE" ] = "auto";
265 dictionary[ "SSE2" ] = "auto";
266 dictionary[ "IWMMXT" ] = "auto";
267 dictionary[ "SYNCQT" ] = "auto";
268 dictionary[ "CE_CRT" ] = "no";
269 dictionary[ "CETEST" ] = "auto";
270 dictionary[ "CE_SIGNATURE" ] = "no";
271 dictionary[ "SCRIPT" ] = "auto";
272 dictionary[ "SCRIPTTOOLS" ] = "auto";
273 dictionary[ "XMLPATTERNS" ] = "auto";
274 dictionary[ "PHONON" ] = "auto";
275 dictionary[ "PHONON_BACKEND" ] = "yes";
276 dictionary[ "MULTIMEDIA" ] = "yes";
277 dictionary[ "AUDIO_BACKEND" ] = "auto";
278 dictionary[ "WMSDK" ] = "auto";
279 dictionary[ "DIRECTSHOW" ] = "no";
280 dictionary[ "WEBKIT" ] = "auto";
281 dictionary[ "DECLARATIVE" ] = "auto";
282 dictionary[ "DECLARATIVE_DEBUG" ]= "yes";
283 dictionary[ "PLUGIN_MANIFESTS" ] = "yes";
284
285 QString version;
286 QFile qglobal_h(sourcePath + "/src/corelib/global/qglobal.h");
287 if (qglobal_h.open(QFile::ReadOnly)) {
288 QTextStream read(&qglobal_h);
289 QRegExp version_regexp("^# *define *QT_VERSION_STR *\"([^\"]*)\"");
290 QString line;
291 while (!read.atEnd()) {
292 line = read.readLine();
293 if (version_regexp.exactMatch(line)) {
294 version = version_regexp.cap(1).trimmed();
295 if (!version.isEmpty())
296 break;
297 }
298 }
299 qglobal_h.close();
300 }
301
302 if (version.isEmpty())
303 version = QString("%1.%2.%3").arg(QT_VERSION>>16).arg(((QT_VERSION>>8)&0xff)).arg(QT_VERSION&0xff);
304
305 dictionary[ "VERSION" ] = version;
306 {
307 QRegExp version_re("([0-9]*)\\.([0-9]*)\\.([0-9]*)(|-.*)");
308 if (version_re.exactMatch(version)) {
309 dictionary[ "VERSION_MAJOR" ] = version_re.cap(1);
310 dictionary[ "VERSION_MINOR" ] = version_re.cap(2);
311 dictionary[ "VERSION_PATCH" ] = version_re.cap(3);
312 }
313 }
314
315 dictionary[ "REDO" ] = "no";
316 dictionary[ "DEPENDENCIES" ] = "no";
317
318 dictionary[ "BUILD" ] = "debug";
319 dictionary[ "BUILDALL" ] = "auto"; // Means yes, but not explicitly
320
321 dictionary[ "BUILDTYPE" ] = "none";
322
323 dictionary[ "BUILDDEV" ] = "no";
324 dictionary[ "BUILDNOKIA" ] = "no";
325
326 dictionary[ "SHARED" ] = "yes";
327
328 dictionary[ "ZLIB" ] = "auto";
329
330 dictionary[ "GIF" ] = "auto";
331 dictionary[ "TIFF" ] = "auto";
332 dictionary[ "JPEG" ] = "auto";
333 dictionary[ "PNG" ] = "auto";
334 dictionary[ "MNG" ] = "auto";
335 dictionary[ "LIBTIFF" ] = "auto";
336 dictionary[ "LIBJPEG" ] = "auto";
337 dictionary[ "LIBPNG" ] = "auto";
338 dictionary[ "LIBMNG" ] = "auto";
339 dictionary[ "FREETYPE" ] = "no";
340
341 dictionary[ "QT3SUPPORT" ] = "yes";
342 dictionary[ "ACCESSIBILITY" ] = "yes";
343 dictionary[ "OPENGL" ] = "yes";
344 dictionary[ "OPENVG" ] = "no";
345 dictionary[ "IPV6" ] = "yes"; // Always, dynamically loaded
346 dictionary[ "OPENSSL" ] = "auto";
347 dictionary[ "DBUS" ] = "auto";
348 dictionary[ "S60" ] = "yes";
349
350 dictionary[ "STYLE_WINDOWS" ] = "yes";
351 dictionary[ "STYLE_WINDOWSXP" ] = "auto";
352 dictionary[ "STYLE_WINDOWSVISTA" ] = "auto";
353 dictionary[ "STYLE_PLASTIQUE" ] = "yes";
354 dictionary[ "STYLE_CLEANLOOKS" ]= "yes";
355 dictionary[ "STYLE_WINDOWSCE" ] = "no";
356 dictionary[ "STYLE_WINDOWSMOBILE" ] = "no";
357 dictionary[ "STYLE_MOTIF" ] = "yes";
358 dictionary[ "STYLE_CDE" ] = "yes";
359 dictionary[ "STYLE_S60" ] = "no";
360 dictionary[ "STYLE_GTK" ] = "no";
361
362 dictionary[ "SQL_MYSQL" ] = "no";
363 dictionary[ "SQL_ODBC" ] = "no";
364 dictionary[ "SQL_OCI" ] = "no";
365 dictionary[ "SQL_PSQL" ] = "no";
366 dictionary[ "SQL_TDS" ] = "no";
367 dictionary[ "SQL_DB2" ] = "no";
368 dictionary[ "SQL_SQLITE" ] = "auto";
369 dictionary[ "SQL_SQLITE_LIB" ] = "qt";
370 dictionary[ "SQL_SQLITE2" ] = "no";
371 dictionary[ "SQL_IBASE" ] = "no";
372 dictionary[ "GRAPHICS_SYSTEM" ] = "raster";
373
374 QString tmp = dictionary[ "QMAKESPEC" ];
375 if (tmp.contains("\\")) {
376 tmp = tmp.mid(tmp.lastIndexOf("\\") + 1);
377 } else {
378 tmp = tmp.mid(tmp.lastIndexOf("/") + 1);
379 }
380 dictionary[ "QMAKESPEC" ] = tmp;
381
382 dictionary[ "INCREDIBUILD_XGE" ] = "auto";
383 dictionary[ "LTCG" ] = "no";
384 dictionary[ "NATIVE_GESTURES" ] = "yes";
385 dictionary[ "MSVC_MP" ] = "no";
386}
387
388Configure::~Configure()
389{
390 for (int i=0; i<3; ++i) {
391 QList<MakeItem*> items = makeList[i];
392 for (int j=0; j<items.size(); ++j)
393 delete items[j];
394 }
395}
396
397QString Configure::fixSeparators(const QString &somePath, bool escape)
398{
399 if (useUnixSeparators)
400 return QDir::fromNativeSeparators(somePath);
401 QString ret = QDir::toNativeSeparators(somePath);
402 return escape ? escapeSeparators(ret) : ret;
403}
404
405QString Configure::escapeSeparators(const QString &somePath)
406{
407 QString out = somePath;
408 out.replace(QLatin1Char('\\'), QLatin1String("\\\\"));
409 return out;
410}
411
412// We could use QDir::homePath() + "/.qt-license", but
413// that will only look in the first of $HOME,$USERPROFILE
414// or $HOMEDRIVE$HOMEPATH. So, here we try'em all to be
415// more forgiving for the end user..
416QString Configure::firstLicensePath()
417{
418 QStringList allPaths;
419 allPaths << "./.qt-license"
420 << QString::fromLocal8Bit(getenv("HOME")) + "/.qt-license"
421 << QString::fromLocal8Bit(getenv("USERPROFILE")) + "/.qt-license"
422 << QString::fromLocal8Bit(getenv("HOMEDRIVE")) + QString::fromLocal8Bit(getenv("HOMEPATH")) + "/.qt-license";
423 for (int i = 0; i< allPaths.count(); ++i)
424 if (QFile::exists(allPaths.at(i)))
425 return allPaths.at(i);
426 return QString();
427}
428
429
430// #### somehow I get a compiler error about vc++ reaching the nesting limit without
431// undefining the ansi for scoping.
432#ifdef for
433#undef for
434#endif
435
436void Configure::parseCmdLine()
437{
438 int argCount = configCmdLine.size();
439 int i = 0;
440
441#if !defined(EVAL)
442 if (argCount < 1) // skip rest if no arguments
443 ;
444 else if (configCmdLine.at(i) == "-redo") {
445 dictionary[ "REDO" ] = "yes";
446 configCmdLine.clear();
447 reloadCmdLine();
448 }
449 else if (configCmdLine.at(i) == "-loadconfig") {
450 ++i;
451 if (i != argCount) {
452 dictionary[ "REDO" ] = "yes";
453 dictionary[ "CUSTOMCONFIG" ] = "_" + configCmdLine.at(i);
454 configCmdLine.clear();
455 reloadCmdLine();
456 } else {
457 dictionary[ "HELP" ] = "yes";
458 }
459 i = 0;
460 }
461 argCount = configCmdLine.size();
462#endif
463
464 // Look first for XQMAKESPEC
465 for (int j = 0 ; j < argCount; ++j)
466 {
467 if (configCmdLine.at(j) == "-xplatform") {
468 ++j;
469 if (j == argCount)
470 break;
471 dictionary["XQMAKESPEC"] = configCmdLine.at(j);
472 if (!dictionary[ "XQMAKESPEC" ].isEmpty())
473 applySpecSpecifics();
474 }
475 }
476
477 for (; i<configCmdLine.size(); ++i) {
478 bool continueElse[] = {false, false};
479 if (configCmdLine.at(i) == "-help"
480 || configCmdLine.at(i) == "-h"
481 || configCmdLine.at(i) == "-?")
482 dictionary[ "HELP" ] = "yes";
483
484#if !defined(EVAL)
485 else if (configCmdLine.at(i) == "-qconfig") {
486 ++i;
487 if (i == argCount)
488 break;
489 dictionary[ "QCONFIG" ] = configCmdLine.at(i);
490 }
491
492 else if (configCmdLine.at(i) == "-buildkey") {
493 ++i;
494 if (i == argCount)
495 break;
496 dictionary[ "USER_BUILD_KEY" ] = configCmdLine.at(i);
497 }
498
499 else if (configCmdLine.at(i) == "-release") {
500 dictionary[ "BUILD" ] = "release";
501 if (dictionary[ "BUILDALL" ] == "auto")
502 dictionary[ "BUILDALL" ] = "no";
503 } else if (configCmdLine.at(i) == "-debug") {
504 dictionary[ "BUILD" ] = "debug";
505 if (dictionary[ "BUILDALL" ] == "auto")
506 dictionary[ "BUILDALL" ] = "no";
507 } else if (configCmdLine.at(i) == "-debug-and-release")
508 dictionary[ "BUILDALL" ] = "yes";
509
510 else if (configCmdLine.at(i) == "-shared")
511 dictionary[ "SHARED" ] = "yes";
512 else if (configCmdLine.at(i) == "-static")
513 dictionary[ "SHARED" ] = "no";
514 else if (configCmdLine.at(i) == "-developer-build")
515 dictionary[ "BUILDDEV" ] = "yes";
516 else if (configCmdLine.at(i) == "-nokia-developer") {
517 cout << "Detected -nokia-developer option" << endl;
518 cout << "Nokia employees and agents are allowed to use this software under" << endl;
519 cout << "the authority of Nokia Corporation and/or its subsidiary(-ies)" << endl;
520 dictionary[ "BUILDNOKIA" ] = "yes";
521 dictionary[ "BUILDDEV" ] = "yes";
522 dictionary["LICENSE_CONFIRMED"] = "yes";
523 if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) {
524 dictionary[ "SYMBIAN_DEFFILES" ] = "no";
525 }
526 }
527 else if (configCmdLine.at(i) == "-opensource") {
528 dictionary[ "BUILDTYPE" ] = "opensource";
529 }
530 else if (configCmdLine.at(i) == "-commercial") {
531 dictionary[ "BUILDTYPE" ] = "commercial";
532 }
533 else if (configCmdLine.at(i) == "-ltcg") {
534 dictionary[ "LTCG" ] = "yes";
535 }
536 else if (configCmdLine.at(i) == "-no-ltcg") {
537 dictionary[ "LTCG" ] = "no";
538 }
539 else if (configCmdLine.at(i) == "-mp") {
540 dictionary[ "MSVC_MP" ] = "yes";
541 }
542 else if (configCmdLine.at(i) == "-no-mp") {
543 dictionary[ "MSVC_MP" ] = "no";
544 }
545
546#endif
547
548 else if (configCmdLine.at(i) == "-platform") {
549 ++i;
550 if (i == argCount)
551 break;
552 dictionary[ "QMAKESPEC" ] = configCmdLine.at(i);
553 dictionary[ "QMAKESPEC_FROM" ] = "commandline";
554 } else if (configCmdLine.at(i) == "-arch") {
555 ++i;
556 if (i == argCount)
557 break;
558 dictionary[ "ARCHITECTURE" ] = configCmdLine.at(i);
559 if (configCmdLine.at(i) == "boundschecker") {
560 dictionary[ "ARCHITECTURE" ] = "generic"; // Boundschecker uses the generic arch,
561 qtConfig += "boundschecker"; // but also needs this CONFIG option
562 }
563 } else if (configCmdLine.at(i) == "-embedded") {
564 dictionary[ "EMBEDDED" ] = "yes";
565 } else if (configCmdLine.at(i) == "-xplatform") {
566 ++i;
567 // do nothing
568 }
569
570
571#if !defined(EVAL)
572 else if (configCmdLine.at(i) == "-no-zlib") {
573 // No longer supported since Qt 4.4.0
574 // But save the information for later so that we can print a warning
575 //
576 // If you REALLY really need no zlib support, you can still disable
577 // it by doing the following:
578 // add "no-zlib" to mkspecs/qconfig.pri
579 // #define QT_NO_COMPRESS (probably by adding to src/corelib/global/qconfig.h)
580 //
581 // There's no guarantee that Qt will build under those conditions
582
583 dictionary[ "ZLIB_FORCED" ] = "yes";
584 } else if (configCmdLine.at(i) == "-qt-zlib") {
585 dictionary[ "ZLIB" ] = "qt";
586 } else if (configCmdLine.at(i) == "-system-zlib") {
587 dictionary[ "ZLIB" ] = "system";
588 }
589
590 // Image formats --------------------------------------------
591 else if (configCmdLine.at(i) == "-no-gif")
592 dictionary[ "GIF" ] = "no";
593 else if (configCmdLine.at(i) == "-qt-gif")
594 dictionary[ "GIF" ] = "plugin";
595
596 else if (configCmdLine.at(i) == "-no-libtiff") {
597 dictionary[ "TIFF"] = "no";
598 dictionary[ "LIBTIFF" ] = "no";
599 } else if (configCmdLine.at(i) == "-qt-libtiff") {
600 dictionary[ "LIBTIFF" ] = "qt";
601 } else if (configCmdLine.at(i) == "-system-libtiff") {
602 dictionary[ "LIBTIFF" ] = "system";
603 }
604
605 else if (configCmdLine.at(i) == "-no-libjpeg") {
606 dictionary[ "JPEG" ] = "no";
607 dictionary[ "LIBJPEG" ] = "no";
608 } else if (configCmdLine.at(i) == "-qt-libjpeg") {
609 dictionary[ "LIBJPEG" ] = "qt";
610 } else if (configCmdLine.at(i) == "-system-libjpeg") {
611 dictionary[ "LIBJPEG" ] = "system";
612 }
613
614 else if (configCmdLine.at(i) == "-no-libpng") {
615 dictionary[ "PNG" ] = "no";
616 dictionary[ "LIBPNG" ] = "no";
617 } else if (configCmdLine.at(i) == "-qt-libpng") {
618 dictionary[ "LIBPNG" ] = "qt";
619 } else if (configCmdLine.at(i) == "-system-libpng") {
620 dictionary[ "LIBPNG" ] = "system";
621 }
622
623 else if (configCmdLine.at(i) == "-no-libmng") {
624 dictionary[ "MNG" ] = "no";
625 dictionary[ "LIBMNG" ] = "no";
626 } else if (configCmdLine.at(i) == "-qt-libmng") {
627 dictionary[ "LIBMNG" ] = "qt";
628 } else if (configCmdLine.at(i) == "-system-libmng") {
629 dictionary[ "LIBMNG" ] = "system";
630 }
631
632 // Text Rendering --------------------------------------------
633 else if (configCmdLine.at(i) == "-no-freetype")
634 dictionary[ "FREETYPE" ] = "no";
635 else if (configCmdLine.at(i) == "-qt-freetype")
636 dictionary[ "FREETYPE" ] = "yes";
637
638 // CE- C runtime --------------------------------------------
639 else if (configCmdLine.at(i) == "-crt") {
640 ++i;
641 if (i == argCount)
642 break;
643 QDir cDir(configCmdLine.at(i));
644 if (!cDir.exists())
645 cout << "WARNING: Could not find directory (" << qPrintable(configCmdLine.at(i)) << ")for C runtime deployment" << endl;
646 else
647 dictionary[ "CE_CRT" ] = QDir::toNativeSeparators(cDir.absolutePath());
648 } else if (configCmdLine.at(i) == "-qt-crt") {
649 dictionary[ "CE_CRT" ] = "yes";
650 } else if (configCmdLine.at(i) == "-no-crt") {
651 dictionary[ "CE_CRT" ] = "no";
652 }
653 // cetest ---------------------------------------------------
654 else if (configCmdLine.at(i) == "-no-cetest") {
655 dictionary[ "CETEST" ] = "no";
656 dictionary[ "CETEST_REQUESTED" ] = "no";
657 } else if (configCmdLine.at(i) == "-cetest") {
658 // although specified to use it, we stay at "auto" state
659 // this is because checkAvailability() adds variables
660 // we need for crosscompilation; but remember if we asked
661 // for it.
662 dictionary[ "CETEST_REQUESTED" ] = "yes";
663 }
664 // Qt/CE - signing tool -------------------------------------
665 else if (configCmdLine.at(i) == "-signature") {
666 ++i;
667 if (i == argCount)
668 break;
669 QFileInfo info(configCmdLine.at(i));
670 if (!info.exists())
671 cout << "WARNING: Could not find signature file (" << qPrintable(configCmdLine.at(i)) << ")" << endl;
672 else
673 dictionary[ "CE_SIGNATURE" ] = QDir::toNativeSeparators(info.absoluteFilePath());
674 }
675 // Styles ---------------------------------------------------
676 else if (configCmdLine.at(i) == "-qt-style-windows")
677 dictionary[ "STYLE_WINDOWS" ] = "yes";
678 else if (configCmdLine.at(i) == "-no-style-windows")
679 dictionary[ "STYLE_WINDOWS" ] = "no";
680
681 else if (configCmdLine.at(i) == "-qt-style-windowsce")
682 dictionary[ "STYLE_WINDOWSCE" ] = "yes";
683 else if (configCmdLine.at(i) == "-no-style-windowsce")
684 dictionary[ "STYLE_WINDOWSCE" ] = "no";
685 else if (configCmdLine.at(i) == "-qt-style-windowsmobile")
686 dictionary[ "STYLE_WINDOWSMOBILE" ] = "yes";
687 else if (configCmdLine.at(i) == "-no-style-windowsmobile")
688 dictionary[ "STYLE_WINDOWSMOBILE" ] = "no";
689
690 else if (configCmdLine.at(i) == "-qt-style-windowsxp")
691 dictionary[ "STYLE_WINDOWSXP" ] = "yes";
692 else if (configCmdLine.at(i) == "-no-style-windowsxp")
693 dictionary[ "STYLE_WINDOWSXP" ] = "no";
694
695 else if (configCmdLine.at(i) == "-qt-style-windowsvista")
696 dictionary[ "STYLE_WINDOWSVISTA" ] = "yes";
697 else if (configCmdLine.at(i) == "-no-style-windowsvista")
698 dictionary[ "STYLE_WINDOWSVISTA" ] = "no";
699
700 else if (configCmdLine.at(i) == "-qt-style-plastique")
701 dictionary[ "STYLE_PLASTIQUE" ] = "yes";
702 else if (configCmdLine.at(i) == "-no-style-plastique")
703 dictionary[ "STYLE_PLASTIQUE" ] = "no";
704
705 else if (configCmdLine.at(i) == "-qt-style-cleanlooks")
706 dictionary[ "STYLE_CLEANLOOKS" ] = "yes";
707 else if (configCmdLine.at(i) == "-no-style-cleanlooks")
708 dictionary[ "STYLE_CLEANLOOKS" ] = "no";
709
710 else if (configCmdLine.at(i) == "-qt-style-motif")
711 dictionary[ "STYLE_MOTIF" ] = "yes";
712 else if (configCmdLine.at(i) == "-no-style-motif")
713 dictionary[ "STYLE_MOTIF" ] = "no";
714
715 else if (configCmdLine.at(i) == "-qt-style-cde")
716 dictionary[ "STYLE_CDE" ] = "yes";
717 else if (configCmdLine.at(i) == "-no-style-cde")
718 dictionary[ "STYLE_CDE" ] = "no";
719
720 else if (configCmdLine.at(i) == "-qt-style-s60")
721 dictionary[ "STYLE_S60" ] = "yes";
722 else if (configCmdLine.at(i) == "-no-style-s60")
723 dictionary[ "STYLE_S60" ] = "no";
724
725 // Qt 3 Support ---------------------------------------------
726 else if (configCmdLine.at(i) == "-no-qt3support")
727 dictionary[ "QT3SUPPORT" ] = "no";
728
729 // Work around compiler nesting limitation
730 else
731 continueElse[1] = true;
732 if (!continueElse[1]) {
733 }
734
735 // OpenGL Support -------------------------------------------
736 else if (configCmdLine.at(i) == "-no-opengl") {
737 dictionary[ "OPENGL" ] = "no";
738 } else if (configCmdLine.at(i) == "-opengl-es-cm") {
739 dictionary[ "OPENGL" ] = "yes";
740 dictionary[ "OPENGL_ES_CM" ] = "yes";
741 } else if (configCmdLine.at(i) == "-opengl-es-2") {
742 dictionary[ "OPENGL" ] = "yes";
743 dictionary[ "OPENGL_ES_2" ] = "yes";
744 } else if (configCmdLine.at(i) == "-opengl") {
745 dictionary[ "OPENGL" ] = "yes";
746 i++;
747 if (i == argCount)
748 break;
749
750 if (configCmdLine.at(i) == "es1") {
751 dictionary[ "OPENGL_ES_CM" ] = "yes";
752 } else if ( configCmdLine.at(i) == "es2" ) {
753 dictionary[ "OPENGL_ES_2" ] = "yes";
754 } else if ( configCmdLine.at(i) == "desktop" ) {
755 dictionary[ "OPENGL_ES_2" ] = "yes";
756 } else {
757 cout << "Argument passed to -opengl option is not valid." << endl;
758 dictionary[ "DONE" ] = "error";
759 break;
760 }
761 }
762
763 // OpenVG Support -------------------------------------------
764 else if (configCmdLine.at(i) == "-openvg") {
765 dictionary[ "OPENVG" ] = "yes";
766 } else if (configCmdLine.at(i) == "-no-openvg") {
767 dictionary[ "OPENVG" ] = "no";
768 }
769
770 // Databases ------------------------------------------------
771 else if (configCmdLine.at(i) == "-qt-sql-mysql")
772 dictionary[ "SQL_MYSQL" ] = "yes";
773 else if (configCmdLine.at(i) == "-plugin-sql-mysql")
774 dictionary[ "SQL_MYSQL" ] = "plugin";
775 else if (configCmdLine.at(i) == "-no-sql-mysql")
776 dictionary[ "SQL_MYSQL" ] = "no";
777
778 else if (configCmdLine.at(i) == "-qt-sql-odbc")
779 dictionary[ "SQL_ODBC" ] = "yes";
780 else if (configCmdLine.at(i) == "-plugin-sql-odbc")
781 dictionary[ "SQL_ODBC" ] = "plugin";
782 else if (configCmdLine.at(i) == "-no-sql-odbc")
783 dictionary[ "SQL_ODBC" ] = "no";
784
785 else if (configCmdLine.at(i) == "-qt-sql-oci")
786 dictionary[ "SQL_OCI" ] = "yes";
787 else if (configCmdLine.at(i) == "-plugin-sql-oci")
788 dictionary[ "SQL_OCI" ] = "plugin";
789 else if (configCmdLine.at(i) == "-no-sql-oci")
790 dictionary[ "SQL_OCI" ] = "no";
791
792 else if (configCmdLine.at(i) == "-qt-sql-psql")
793 dictionary[ "SQL_PSQL" ] = "yes";
794 else if (configCmdLine.at(i) == "-plugin-sql-psql")
795 dictionary[ "SQL_PSQL" ] = "plugin";
796 else if (configCmdLine.at(i) == "-no-sql-psql")
797 dictionary[ "SQL_PSQL" ] = "no";
798
799 else if (configCmdLine.at(i) == "-qt-sql-tds")
800 dictionary[ "SQL_TDS" ] = "yes";
801 else if (configCmdLine.at(i) == "-plugin-sql-tds")
802 dictionary[ "SQL_TDS" ] = "plugin";
803 else if (configCmdLine.at(i) == "-no-sql-tds")
804 dictionary[ "SQL_TDS" ] = "no";
805
806 else if (configCmdLine.at(i) == "-qt-sql-db2")
807 dictionary[ "SQL_DB2" ] = "yes";
808 else if (configCmdLine.at(i) == "-plugin-sql-db2")
809 dictionary[ "SQL_DB2" ] = "plugin";
810 else if (configCmdLine.at(i) == "-no-sql-db2")
811 dictionary[ "SQL_DB2" ] = "no";
812
813 else if (configCmdLine.at(i) == "-qt-sql-sqlite")
814 dictionary[ "SQL_SQLITE" ] = "yes";
815 else if (configCmdLine.at(i) == "-plugin-sql-sqlite")
816 dictionary[ "SQL_SQLITE" ] = "plugin";
817 else if (configCmdLine.at(i) == "-no-sql-sqlite")
818 dictionary[ "SQL_SQLITE" ] = "no";
819 else if (configCmdLine.at(i) == "-system-sqlite")
820 dictionary[ "SQL_SQLITE_LIB" ] = "system";
821 else if (configCmdLine.at(i) == "-qt-sql-sqlite2")
822 dictionary[ "SQL_SQLITE2" ] = "yes";
823 else if (configCmdLine.at(i) == "-plugin-sql-sqlite2")
824 dictionary[ "SQL_SQLITE2" ] = "plugin";
825 else if (configCmdLine.at(i) == "-no-sql-sqlite2")
826 dictionary[ "SQL_SQLITE2" ] = "no";
827
828 else if (configCmdLine.at(i) == "-qt-sql-ibase")
829 dictionary[ "SQL_IBASE" ] = "yes";
830 else if (configCmdLine.at(i) == "-plugin-sql-ibase")
831 dictionary[ "SQL_IBASE" ] = "plugin";
832 else if (configCmdLine.at(i) == "-no-sql-ibase")
833 dictionary[ "SQL_IBASE" ] = "no";
834#endif
835 // IDE project generation -----------------------------------
836 else if (configCmdLine.at(i) == "-no-dsp")
837 dictionary[ "DSPFILES" ] = "no";
838 else if (configCmdLine.at(i) == "-dsp")
839 dictionary[ "DSPFILES" ] = "yes";
840
841 else if (configCmdLine.at(i) == "-no-vcp")
842 dictionary[ "VCPFILES" ] = "no";
843 else if (configCmdLine.at(i) == "-vcp")
844 dictionary[ "VCPFILES" ] = "yes";
845
846 else if (configCmdLine.at(i) == "-no-vcproj")
847 dictionary[ "VCPROJFILES" ] = "no";
848 else if (configCmdLine.at(i) == "-vcproj")
849 dictionary[ "VCPROJFILES" ] = "yes";
850
851 else if (configCmdLine.at(i) == "-no-incredibuild-xge")
852 dictionary[ "INCREDIBUILD_XGE" ] = "no";
853 else if (configCmdLine.at(i) == "-incredibuild-xge")
854 dictionary[ "INCREDIBUILD_XGE" ] = "yes";
855 else if (configCmdLine.at(i) == "-native-gestures")
856 dictionary[ "NATIVE_GESTURES" ] = "yes";
857 else if (configCmdLine.at(i) == "-no-native-gestures")
858 dictionary[ "NATIVE_GESTURES" ] = "no";
859#if !defined(EVAL)
860 // Symbian Support -------------------------------------------
861 else if (configCmdLine.at(i) == "-fpu")
862 {
863 ++i;
864 if (i == argCount)
865 break;
866 dictionary[ "ARM_FPU_TYPE" ] = configCmdLine.at(i);
867 }
868
869 else if (configCmdLine.at(i) == "-s60")
870 dictionary[ "S60" ] = "yes";
871 else if (configCmdLine.at(i) == "-no-s60")
872 dictionary[ "S60" ] = "no";
873
874 else if (configCmdLine.at(i) == "-usedeffiles")
875 dictionary[ "SYMBIAN_DEFFILES" ] = "yes";
876 else if (configCmdLine.at(i) == "-no-usedeffiles")
877 dictionary[ "SYMBIAN_DEFFILES" ] = "no";
878
879 // Others ---------------------------------------------------
880 else if (configCmdLine.at(i) == "-fast")
881 dictionary[ "FAST" ] = "yes";
882 else if (configCmdLine.at(i) == "-no-fast")
883 dictionary[ "FAST" ] = "no";
884
885 else if (configCmdLine.at(i) == "-stl")
886 dictionary[ "STL" ] = "yes";
887 else if (configCmdLine.at(i) == "-no-stl")
888 dictionary[ "STL" ] = "no";
889
890 else if (configCmdLine.at(i) == "-exceptions")
891 dictionary[ "EXCEPTIONS" ] = "yes";
892 else if (configCmdLine.at(i) == "-no-exceptions")
893 dictionary[ "EXCEPTIONS" ] = "no";
894
895 else if (configCmdLine.at(i) == "-rtti")
896 dictionary[ "RTTI" ] = "yes";
897 else if (configCmdLine.at(i) == "-no-rtti")
898 dictionary[ "RTTI" ] = "no";
899
900 else if (configCmdLine.at(i) == "-accessibility")
901 dictionary[ "ACCESSIBILITY" ] = "yes";
902 else if (configCmdLine.at(i) == "-no-accessibility") {
903 dictionary[ "ACCESSIBILITY" ] = "no";
904 cout << "Setting accessibility to NO" << endl;
905 }
906
907 else if (configCmdLine.at(i) == "-no-mmx")
908 dictionary[ "MMX" ] = "no";
909 else if (configCmdLine.at(i) == "-mmx")
910 dictionary[ "MMX" ] = "yes";
911 else if (configCmdLine.at(i) == "-no-3dnow")
912 dictionary[ "3DNOW" ] = "no";
913 else if (configCmdLine.at(i) == "-3dnow")
914 dictionary[ "3DNOW" ] = "yes";
915 else if (configCmdLine.at(i) == "-no-sse")
916 dictionary[ "SSE" ] = "no";
917 else if (configCmdLine.at(i) == "-sse")
918 dictionary[ "SSE" ] = "yes";
919 else if (configCmdLine.at(i) == "-no-sse2")
920 dictionary[ "SSE2" ] = "no";
921 else if (configCmdLine.at(i) == "-sse2")
922 dictionary[ "SSE2" ] = "yes";
923 else if (configCmdLine.at(i) == "-no-iwmmxt")
924 dictionary[ "IWMMXT" ] = "no";
925 else if (configCmdLine.at(i) == "-iwmmxt")
926 dictionary[ "IWMMXT" ] = "yes";
927
928 else if (configCmdLine.at(i) == "-no-openssl") {
929 dictionary[ "OPENSSL"] = "no";
930 } else if (configCmdLine.at(i) == "-openssl") {
931 dictionary[ "OPENSSL" ] = "yes";
932 } else if (configCmdLine.at(i) == "-openssl-linked") {
933 dictionary[ "OPENSSL" ] = "linked";
934 } else if (configCmdLine.at(i) == "-no-qdbus") {
935 dictionary[ "DBUS" ] = "no";
936 } else if (configCmdLine.at(i) == "-qdbus") {
937 dictionary[ "DBUS" ] = "yes";
938 } else if (configCmdLine.at(i) == "-no-dbus") {
939 dictionary[ "DBUS" ] = "no";
940 } else if (configCmdLine.at(i) == "-dbus") {
941 dictionary[ "DBUS" ] = "yes";
942 } else if (configCmdLine.at(i) == "-dbus-linked") {
943 dictionary[ "DBUS" ] = "linked";
944 } else if (configCmdLine.at(i) == "-no-script") {
945 dictionary[ "SCRIPT" ] = "no";
946 } else if (configCmdLine.at(i) == "-script") {
947 dictionary[ "SCRIPT" ] = "yes";
948 } else if (configCmdLine.at(i) == "-no-scripttools") {
949 dictionary[ "SCRIPTTOOLS" ] = "no";
950 } else if (configCmdLine.at(i) == "-scripttools") {
951 dictionary[ "SCRIPTTOOLS" ] = "yes";
952 } else if (configCmdLine.at(i) == "-no-xmlpatterns") {
953 dictionary[ "XMLPATTERNS" ] = "no";
954 } else if (configCmdLine.at(i) == "-xmlpatterns") {
955 dictionary[ "XMLPATTERNS" ] = "yes";
956 } else if (configCmdLine.at(i) == "-no-multimedia") {
957 dictionary[ "MULTIMEDIA" ] = "no";
958 } else if (configCmdLine.at(i) == "-multimedia") {
959 dictionary[ "MULTIMEDIA" ] = "yes";
960 } else if (configCmdLine.at(i) == "-audio-backend") {
961 dictionary[ "AUDIO_BACKEND" ] = "yes";
962 } else if (configCmdLine.at(i) == "-no-audio-backend") {
963 dictionary[ "AUDIO_BACKEND" ] = "no";
964 } else if (configCmdLine.at(i) == "-no-phonon") {
965 dictionary[ "PHONON" ] = "no";
966 } else if (configCmdLine.at(i) == "-phonon") {
967 dictionary[ "PHONON" ] = "yes";
968 } else if (configCmdLine.at(i) == "-no-phonon-backend") {
969 dictionary[ "PHONON_BACKEND" ] = "no";
970 } else if (configCmdLine.at(i) == "-phonon-backend") {
971 dictionary[ "PHONON_BACKEND" ] = "yes";
972 } else if (configCmdLine.at(i) == "-phonon-wince-ds9") {
973 dictionary[ "DIRECTSHOW" ] = "yes";
974 } else if (configCmdLine.at(i) == "-no-webkit") {
975 dictionary[ "WEBKIT" ] = "no";
976 } else if (configCmdLine.at(i) == "-webkit") {
977 dictionary[ "WEBKIT" ] = "yes";
978 } else if (configCmdLine.at(i) == "-webkit-debug") {
979 dictionary[ "WEBKIT" ] = "debug";
980 } else if (configCmdLine.at(i) == "-no-declarative") {
981 dictionary[ "DECLARATIVE" ] = "no";
982 } else if (configCmdLine.at(i) == "-declarative") {
983 dictionary[ "DECLARATIVE" ] = "yes";
984 } else if (configCmdLine.at(i) == "-no-declarative-debug") {
985 dictionary[ "DECLARATIVE_DEBUG" ] = "no";
986 } else if (configCmdLine.at(i) == "-declarative-debug") {
987 dictionary[ "DECLARATIVE_DEBUG" ] = "yes";
988 } else if (configCmdLine.at(i) == "-no-plugin-manifests") {
989 dictionary[ "PLUGIN_MANIFESTS" ] = "no";
990 } else if (configCmdLine.at(i) == "-plugin-manifests") {
991 dictionary[ "PLUGIN_MANIFESTS" ] = "yes";
992 }
993
994 // Work around compiler nesting limitation
995 else
996 continueElse[0] = true;
997 if (!continueElse[0]) {
998 }
999
1000 else if (configCmdLine.at(i) == "-internal")
1001 dictionary[ "QMAKE_INTERNAL" ] = "yes";
1002
1003 else if (configCmdLine.at(i) == "-no-qmake")
1004 dictionary[ "BUILD_QMAKE" ] = "no";
1005 else if (configCmdLine.at(i) == "-qmake")
1006 dictionary[ "BUILD_QMAKE" ] = "yes";
1007
1008 else if (configCmdLine.at(i) == "-dont-process")
1009 dictionary[ "NOPROCESS" ] = "yes";
1010 else if (configCmdLine.at(i) == "-process")
1011 dictionary[ "NOPROCESS" ] = "no";
1012
1013 else if (configCmdLine.at(i) == "-no-qmake-deps")
1014 dictionary[ "DEPENDENCIES" ] = "no";
1015 else if (configCmdLine.at(i) == "-qmake-deps")
1016 dictionary[ "DEPENDENCIES" ] = "yes";
1017
1018
1019 else if (configCmdLine.at(i) == "-qtnamespace") {
1020 ++i;
1021 if (i == argCount)
1022 break;
1023 dictionary[ "QT_NAMESPACE" ] = configCmdLine.at(i);
1024 } else if (configCmdLine.at(i) == "-qtlibinfix") {
1025 ++i;
1026 if (i == argCount)
1027 break;
1028 dictionary[ "QT_LIBINFIX" ] = configCmdLine.at(i);
1029 if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) {
1030 dictionary[ "QT_INSTALL_PLUGINS" ] =
1031 QString("\\resource\\qt%1\\plugins").arg(dictionary[ "QT_LIBINFIX" ]);
1032 dictionary[ "QT_INSTALL_IMPORTS" ] =
1033 QString("\\resource\\qt%1\\imports").arg(dictionary[ "QT_LIBINFIX" ]);
1034 }
1035 } else if (configCmdLine.at(i) == "-D") {
1036 ++i;
1037 if (i == argCount)
1038 break;
1039 qmakeDefines += configCmdLine.at(i);
1040 } else if (configCmdLine.at(i) == "-I") {
1041 ++i;
1042 if (i == argCount)
1043 break;
1044 qmakeIncludes += configCmdLine.at(i);
1045 } else if (configCmdLine.at(i) == "-L") {
1046 ++i;
1047 if (i == argCount)
1048 break;
1049 QFileInfo check(configCmdLine.at(i));
1050 if (!check.isDir()) {
1051 cout << "Argument passed to -L option is not a directory path. Did you mean the -l option?" << endl;
1052 dictionary[ "DONE" ] = "error";
1053 break;
1054 }
1055 qmakeLibs += QString("-L" + configCmdLine.at(i));
1056 } else if (configCmdLine.at(i) == "-l") {
1057 ++i;
1058 if (i == argCount)
1059 break;
1060 qmakeLibs += QString("-l" + configCmdLine.at(i));
1061 } else if (configCmdLine.at(i).startsWith("OPENSSL_LIBS=")) {
1062 opensslLibs = configCmdLine.at(i);
1063 } else if (configCmdLine.at(i).startsWith("PSQL_LIBS=")) {
1064 psqlLibs = configCmdLine.at(i);
1065 } else if (configCmdLine.at(i).startsWith("SYBASE=")) {
1066 sybase = configCmdLine.at(i);
1067 } else if (configCmdLine.at(i).startsWith("SYBASE_LIBS=")) {
1068 sybaseLibs = configCmdLine.at(i);
1069 }
1070
1071 else if ((configCmdLine.at(i) == "-override-version") || (configCmdLine.at(i) == "-version-override")){
1072 ++i;
1073 if (i == argCount)
1074 break;
1075 dictionary[ "VERSION" ] = configCmdLine.at(i);
1076 }
1077
1078 else if (configCmdLine.at(i) == "-saveconfig") {
1079 ++i;
1080 if (i == argCount)
1081 break;
1082 dictionary[ "CUSTOMCONFIG" ] = "_" + configCmdLine.at(i);
1083 }
1084
1085 else if (configCmdLine.at(i) == "-confirm-license") {
1086 dictionary["LICENSE_CONFIRMED"] = "yes";
1087 }
1088
1089 else if (configCmdLine.at(i) == "-nomake") {
1090 ++i;
1091 if (i == argCount)
1092 break;
1093 disabledBuildParts += configCmdLine.at(i);
1094 }
1095
1096 // Directories ----------------------------------------------
1097 else if (configCmdLine.at(i) == "-prefix") {
1098 ++i;
1099 if (i == argCount)
1100 break;
1101 dictionary[ "QT_INSTALL_PREFIX" ] = configCmdLine.at(i);
1102 }
1103
1104 else if (configCmdLine.at(i) == "-bindir") {
1105 ++i;
1106 if (i == argCount)
1107 break;
1108 dictionary[ "QT_INSTALL_BINS" ] = configCmdLine.at(i);
1109 }
1110
1111 else if (configCmdLine.at(i) == "-libdir") {
1112 ++i;
1113 if (i == argCount)
1114 break;
1115 dictionary[ "QT_INSTALL_LIBS" ] = configCmdLine.at(i);
1116 }
1117
1118 else if (configCmdLine.at(i) == "-docdir") {
1119 ++i;
1120 if (i == argCount)
1121 break;
1122 dictionary[ "QT_INSTALL_DOCS" ] = configCmdLine.at(i);
1123 }
1124
1125 else if (configCmdLine.at(i) == "-headerdir") {
1126 ++i;
1127 if (i == argCount)
1128 break;
1129 dictionary[ "QT_INSTALL_HEADERS" ] = configCmdLine.at(i);
1130 }
1131
1132 else if (configCmdLine.at(i) == "-plugindir") {
1133 ++i;
1134 if (i == argCount)
1135 break;
1136 dictionary[ "QT_INSTALL_PLUGINS" ] = configCmdLine.at(i);
1137 }
1138
1139 else if (configCmdLine.at(i) == "-importdir") {
1140 ++i;
1141 if (i == argCount)
1142 break;
1143 dictionary[ "QT_INSTALL_IMPORTS" ] = configCmdLine.at(i);
1144 }
1145 else if (configCmdLine.at(i) == "-datadir") {
1146 ++i;
1147 if (i == argCount)
1148 break;
1149 dictionary[ "QT_INSTALL_DATA" ] = configCmdLine.at(i);
1150 }
1151
1152 else if (configCmdLine.at(i) == "-translationdir") {
1153 ++i;
1154 if (i == argCount)
1155 break;
1156 dictionary[ "QT_INSTALL_TRANSLATIONS" ] = configCmdLine.at(i);
1157 }
1158
1159 else if (configCmdLine.at(i) == "-examplesdir") {
1160 ++i;
1161 if (i == argCount)
1162 break;
1163 dictionary[ "QT_INSTALL_EXAMPLES" ] = configCmdLine.at(i);
1164 }
1165
1166 else if (configCmdLine.at(i) == "-demosdir") {
1167 ++i;
1168 if (i == argCount)
1169 break;
1170 dictionary[ "QT_INSTALL_DEMOS" ] = configCmdLine.at(i);
1171 }
1172
1173 else if (configCmdLine.at(i) == "-hostprefix") {
1174 ++i;
1175 if (i == argCount)
1176 break;
1177 dictionary[ "QT_HOST_PREFIX" ] = configCmdLine.at(i);
1178 }
1179
1180 else if (configCmdLine.at(i) == "-make") {
1181 ++i;
1182 if (i == argCount)
1183 break;
1184 dictionary[ "MAKE" ] = configCmdLine.at(i);
1185 }
1186
1187 else if (configCmdLine.at(i) == "-graphicssystem") {
1188 ++i;
1189 if (i == argCount)
1190 break;
1191 QString system = configCmdLine.at(i);
1192 if (system == QLatin1String("raster")
1193 || system == QLatin1String("opengl")
1194 || system == QLatin1String("openvg")
1195 || system == QLatin1String("runtime"))
1196 dictionary["GRAPHICS_SYSTEM"] = configCmdLine.at(i);
1197 }
1198
1199 else if (configCmdLine.at(i) == "-runtimegraphicssystem") {
1200 ++i;
1201 if (i == argCount)
1202 break;
1203 dictionary["RUNTIME_SYSTEM"] = configCmdLine.at(i);
1204 }
1205
1206 else if (configCmdLine.at(i).indexOf(QRegExp("^-(en|dis)able-")) != -1) {
1207 // Scan to see if any specific modules and drivers are enabled or disabled
1208 for (QStringList::Iterator module = modules.begin(); module != modules.end(); ++module) {
1209 if (configCmdLine.at(i) == QString("-enable-") + (*module)) {
1210 enabledModules += (*module);
1211 break;
1212 }
1213 else if (configCmdLine.at(i) == QString("-disable-") + (*module)) {
1214 disabledModules += (*module);
1215 break;
1216 }
1217 }
1218 }
1219
1220 else {
1221 dictionary[ "HELP" ] = "yes";
1222 cout << "Unknown option " << configCmdLine.at(i) << endl;
1223 break;
1224 }
1225
1226#endif
1227 }
1228
1229 // Ensure that QMAKESPEC exists in the mkspecs folder
1230 QDir mkspec_dir = fixSeparators(sourcePath + "/mkspecs");
1231 QStringList mkspecs = mkspec_dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot);
1232
1233 if (dictionary["QMAKESPEC"].toLower() == "features"
1234 || !mkspecs.contains(dictionary["QMAKESPEC"], Qt::CaseInsensitive)) {
1235 dictionary[ "HELP" ] = "yes";
1236 if (dictionary ["QMAKESPEC_FROM"] == "commandline") {
1237 cout << "Invalid option \"" << dictionary["QMAKESPEC"] << "\" for -platform." << endl;
1238 } else if (dictionary ["QMAKESPEC_FROM"] == "env") {
1239 cout << "QMAKESPEC environment variable is set to \"" << dictionary["QMAKESPEC"]
1240 << "\" which is not a supported platform" << endl;
1241 } else { // was autodetected from environment
1242 cout << "Unable to detect the platform from environment. Use -platform command line"
1243 "argument or set the QMAKESPEC environment variable and run configure again" << endl;
1244 }
1245 cout << "See the README file for a list of supported operating systems and compilers." << endl;
1246 } else {
1247 if (dictionary[ "QMAKESPEC" ].endsWith("-icc") ||
1248 dictionary[ "QMAKESPEC" ].endsWith("-msvc") ||
1249 dictionary[ "QMAKESPEC" ].endsWith("-msvc.net") ||
1250 dictionary[ "QMAKESPEC" ].endsWith("-msvc2002") ||
1251 dictionary[ "QMAKESPEC" ].endsWith("-msvc2003") ||
1252 dictionary[ "QMAKESPEC" ].endsWith("-msvc2005") ||
1253 dictionary[ "QMAKESPEC" ].endsWith("-msvc2008") ||
1254 dictionary[ "QMAKESPEC" ].endsWith("-msvc2010")) {
1255 if (dictionary[ "MAKE" ].isEmpty()) dictionary[ "MAKE" ] = "nmake";
1256 dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32";
1257 } else if (dictionary[ "QMAKESPEC" ] == QString("win32-g++")) {
1258 if (dictionary[ "MAKE" ].isEmpty()) dictionary[ "MAKE" ] = "mingw32-make";
1259 if (Environment::detectExecutable("sh.exe")) {
1260 dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32-g++-sh";
1261 } else {
1262 dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32-g++";
1263 }
1264 } else {
1265 if (dictionary[ "MAKE" ].isEmpty()) dictionary[ "MAKE" ] = "make";
1266 dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32";
1267 }
1268 }
1269
1270 // Tell the user how to proceed building Qt after configure finished its job
1271 dictionary["QTBUILDINSTRUCTION"] = dictionary["MAKE"];
1272 if (dictionary.contains("XQMAKESPEC")) {
1273 if (dictionary["XQMAKESPEC"].startsWith("symbian")) {
1274 dictionary["QTBUILDINSTRUCTION"] = QString("make debug-winscw|debug-armv5|release-armv5");
1275 } else if (dictionary["XQMAKESPEC"].startsWith("wince")) {
1276 dictionary["QTBUILDINSTRUCTION"] =
1277 QString("setcepaths.bat ") + dictionary["XQMAKESPEC"] + QString(" && ") + dictionary["MAKE"];
1278 }
1279 }
1280
1281 // Tell the user how to confclean before the next configure
1282 dictionary["CONFCLEANINSTRUCTION"] = dictionary["MAKE"] + QString(" confclean");
1283
1284 // Ensure that -spec (XQMAKESPEC) exists in the mkspecs folder as well
1285 if (dictionary.contains("XQMAKESPEC") &&
1286 !mkspecs.contains(dictionary["XQMAKESPEC"], Qt::CaseInsensitive)) {
1287 dictionary["HELP"] = "yes";
1288 cout << "Invalid option \"" << dictionary["XQMAKESPEC"] << "\" for -xplatform." << endl;
1289 }
1290
1291 // Ensure that the crt to be deployed can be found
1292 if (dictionary["CE_CRT"] != QLatin1String("yes") && dictionary["CE_CRT"] != QLatin1String("no")) {
1293 QDir cDir(dictionary["CE_CRT"]);
1294 QStringList entries = cDir.entryList();
1295 bool hasDebug = entries.contains("msvcr80.dll");
1296 bool hasRelease = entries.contains("msvcr80d.dll");
1297 if ((dictionary["BUILDALL"] == "auto") && (!hasDebug || !hasRelease)) {
1298 cout << "Could not find debug and release c-runtime." << endl;
1299 cout << "You need to have msvcr80.dll and msvcr80d.dll in" << endl;
1300 cout << "the path specified. Setting to -no-crt";
1301 dictionary[ "CE_CRT" ] = "no";
1302 } else if ((dictionary["BUILD"] == "debug") && !hasDebug) {
1303 cout << "Could not find debug c-runtime (msvcr80d.dll) in the directory specified." << endl;
1304 cout << "Setting c-runtime automatic deployment to -no-crt" << endl;
1305 dictionary[ "CE_CRT" ] = "no";
1306 } else if ((dictionary["BUILD"] == "release") && !hasRelease) {
1307 cout << "Could not find release c-runtime (msvcr80.dll) in the directory specified." << endl;
1308 cout << "Setting c-runtime automatic deployment to -no-crt" << endl;
1309 dictionary[ "CE_CRT" ] = "no";
1310 }
1311 }
1312
1313 useUnixSeparators = (dictionary["QMAKESPEC"] == "win32-g++");
1314
1315 // Allow tests for private classes to be compiled against internal builds
1316 if (dictionary["BUILDDEV"] == "yes")
1317 qtConfig += "private_tests";
1318
1319
1320#if !defined(EVAL)
1321 for (QStringList::Iterator dis = disabledModules.begin(); dis != disabledModules.end(); ++dis) {
1322 modules.removeAll((*dis));
1323 }
1324 for (QStringList::Iterator ena = enabledModules.begin(); ena != enabledModules.end(); ++ena) {
1325 if (modules.indexOf((*ena)) == -1)
1326 modules += (*ena);
1327 }
1328 qtConfig += modules;
1329
1330 for (QStringList::Iterator it = disabledModules.begin(); it != disabledModules.end(); ++it)
1331 qtConfig.removeAll(*it);
1332
1333 if ((dictionary[ "REDO" ] != "yes") && (dictionary[ "HELP" ] != "yes"))
1334 saveCmdLine();
1335#endif
1336}
1337
1338#if !defined(EVAL)
1339void Configure::validateArgs()
1340{
1341 // Validate the specified config
1342
1343 // Get all possible configurations from the file system.
1344 QDir dir;
1345 QStringList filters;
1346 filters << "qconfig-*.h";
1347 dir.setNameFilters(filters);
1348 dir.setPath(sourcePath + "/src/corelib/global/");
1349
1350 QStringList stringList = dir.entryList();
1351
1352 QStringList::Iterator it;
1353 for (it = stringList.begin(); it != stringList.end(); ++it)
1354 allConfigs << it->remove("qconfig-").remove(".h");
1355 allConfigs << "full";
1356
1357 // Try internal configurations first.
1358 QStringList possible_configs = QStringList()
1359 << "minimal"
1360 << "small"
1361 << "medium"
1362 << "large"
1363 << "full";
1364 int index = possible_configs.indexOf(dictionary["QCONFIG"]);
1365 if (index >= 0) {
1366 for (int c = 0; c <= index; c++) {
1367 qmakeConfig += possible_configs[c] + "-config";
1368 }
1369 return;
1370 }
1371
1372 // If the internal configurations failed, try others.
1373 QStringList::Iterator config;
1374 for (config = allConfigs.begin(); config != allConfigs.end(); ++config) {
1375 if ((*config) == dictionary[ "QCONFIG" ])
1376 break;
1377 }
1378 if (config == allConfigs.end()) {
1379 dictionary[ "HELP" ] = "yes";
1380 cout << "No such configuration \"" << qPrintable(dictionary[ "QCONFIG" ]) << "\"" << endl ;
1381 }
1382 else
1383 qmakeConfig += (*config) + "-config";
1384}
1385#endif
1386
1387
1388// Output helper functions --------------------------------[ Start ]-
1389/*!
1390 Determines the length of a string token.
1391*/
1392static int tokenLength(const char *str)
1393{
1394 if (*str == 0)
1395 return 0;
1396
1397 const char *nextToken = strpbrk(str, " _/\n\r");
1398 if (nextToken == str || !nextToken)
1399 return 1;
1400
1401 return int(nextToken - str);
1402}
1403
1404/*!
1405 Prints out a string which starts at position \a startingAt, and
1406 indents each wrapped line with \a wrapIndent characters.
1407 The wrap point is set to the console width, unless that width
1408 cannot be determined, or is too small.
1409*/
1410void Configure::desc(const char *description, int startingAt, int wrapIndent)
1411{
1412 int linePos = startingAt;
1413
1414 bool firstLine = true;
1415 const char *nextToken = description;
1416 while (*nextToken) {
1417 int nextTokenLen = tokenLength(nextToken);
1418 if (*nextToken == '\n' // Wrap on newline, duh
1419 || (linePos + nextTokenLen > outputWidth)) // Wrap at outputWidth
1420 {
1421 printf("\n");
1422 linePos = 0;
1423 firstLine = false;
1424 if (*nextToken == '\n')
1425 ++nextToken;
1426 continue;
1427 }
1428 if (!firstLine && linePos < wrapIndent) { // Indent to wrapIndent
1429 printf("%*s", wrapIndent , "");
1430 linePos = wrapIndent;
1431 if (*nextToken == ' ') {
1432 ++nextToken;
1433 continue;
1434 }
1435 }
1436 printf("%.*s", nextTokenLen, nextToken);
1437 linePos += nextTokenLen;
1438 nextToken += nextTokenLen;
1439 }
1440}
1441
1442/*!
1443 Prints out an option with its description wrapped at the
1444 description starting point. If \a skipIndent is true, the
1445 indentation to the option is not outputted (used by marked option
1446 version of desc()). Extra spaces between option and its
1447 description is filled with\a fillChar, if there's available
1448 space.
1449*/
1450void Configure::desc(const char *option, const char *description, bool skipIndent, char fillChar)
1451{
1452 if (!skipIndent)
1453 printf("%*s", optionIndent, "");
1454
1455 int remaining = descIndent - optionIndent - strlen(option);
1456 int wrapIndent = descIndent + qMax(0, 1 - remaining);
1457 printf("%s", option);
1458
1459 if (remaining > 2) {
1460 printf(" "); // Space in front
1461 for (int i = remaining; i > 2; --i)
1462 printf("%c", fillChar); // Fill, if available space
1463 }
1464 printf(" "); // Space between option and description
1465
1466 desc(description, wrapIndent, wrapIndent);
1467 printf("\n");
1468}
1469
1470/*!
1471 Same as above, except it also marks an option with an '*', if
1472 the option is default action.
1473*/
1474void Configure::desc(const char *mark_option, const char *mark, const char *option, const char *description, char fillChar)
1475{
1476 const QString markedAs = dictionary.value(mark_option);
1477 if (markedAs == "auto" && markedAs == mark) // both "auto", always => +
1478 printf(" + ");
1479 else if (markedAs == "auto") // setting marked as "auto" and option is default => +
1480 printf(" %c " , (defaultTo(mark_option) == QLatin1String(mark))? '+' : ' ');
1481 else if (QLatin1String(mark) == "auto" && markedAs != "no") // description marked as "auto" and option is available => +
1482 printf(" %c " , checkAvailability(mark_option) ? '+' : ' ');
1483 else // None are "auto", (markedAs == mark) => *
1484 printf(" %c " , markedAs == QLatin1String(mark) ? '*' : ' ');
1485
1486 desc(option, description, true, fillChar);
1487}
1488
1489/*!
1490 Modifies the default configuration based on given -platform option.
1491 Eg. switches to different default styles for Windows CE.
1492*/
1493void Configure::applySpecSpecifics()
1494{
1495 if (dictionary[ "XQMAKESPEC" ].startsWith("wince")) {
1496 dictionary[ "STYLE_WINDOWSXP" ] = "no";
1497 dictionary[ "STYLE_WINDOWSVISTA" ] = "no";
1498 dictionary[ "STYLE_PLASTIQUE" ] = "no";
1499 dictionary[ "STYLE_CLEANLOOKS" ] = "no";
1500 dictionary[ "STYLE_WINDOWSCE" ] = "yes";
1501 dictionary[ "STYLE_WINDOWSMOBILE" ] = "yes";
1502 dictionary[ "STYLE_MOTIF" ] = "no";
1503 dictionary[ "STYLE_CDE" ] = "no";
1504 dictionary[ "STYLE_S60" ] = "no";
1505 dictionary[ "FREETYPE" ] = "no";
1506 dictionary[ "QT3SUPPORT" ] = "no";
1507 dictionary[ "OPENGL" ] = "no";
1508 dictionary[ "OPENSSL" ] = "no";
1509 dictionary[ "STL" ] = "no";
1510 dictionary[ "EXCEPTIONS" ] = "no";
1511 dictionary[ "RTTI" ] = "no";
1512 dictionary[ "ARCHITECTURE" ] = "windowsce";
1513 dictionary[ "3DNOW" ] = "no";
1514 dictionary[ "SSE" ] = "no";
1515 dictionary[ "SSE2" ] = "no";
1516 dictionary[ "MMX" ] = "no";
1517 dictionary[ "IWMMXT" ] = "no";
1518 dictionary[ "CE_CRT" ] = "yes";
1519 dictionary[ "WEBKIT" ] = "no";
1520 dictionary[ "PHONON" ] = "yes";
1521 dictionary[ "DIRECTSHOW" ] = "no";
1522 // We only apply MMX/IWMMXT for mkspecs we know they work
1523 if (dictionary[ "XQMAKESPEC" ].startsWith("wincewm")) {
1524 dictionary[ "MMX" ] = "yes";
1525 dictionary[ "IWMMXT" ] = "yes";
1526 dictionary[ "DIRECTSHOW" ] = "yes";
1527 }
1528 dictionary[ "QT_HOST_PREFIX" ] = dictionary[ "QT_INSTALL_PREFIX" ];
1529 dictionary[ "QT_INSTALL_PREFIX" ] = "";
1530
1531 } else if (dictionary[ "XQMAKESPEC" ].startsWith("symbian")) {
1532 dictionary[ "ACCESSIBILITY" ] = "no";
1533 dictionary[ "STYLE_WINDOWSXP" ] = "no";
1534 dictionary[ "STYLE_WINDOWSVISTA" ] = "no";
1535 dictionary[ "STYLE_PLASTIQUE" ] = "no";
1536 dictionary[ "STYLE_CLEANLOOKS" ] = "no";
1537 dictionary[ "STYLE_WINDOWSCE" ] = "no";
1538 dictionary[ "STYLE_WINDOWSMOBILE" ] = "no";
1539 dictionary[ "STYLE_MOTIF" ] = "no";
1540 dictionary[ "STYLE_CDE" ] = "no";
1541 dictionary[ "STYLE_S60" ] = "yes";
1542 dictionary[ "FREETYPE" ] = "no";
1543 dictionary[ "QT3SUPPORT" ] = "no";
1544 dictionary[ "OPENGL" ] = "no";
1545 dictionary[ "OPENSSL" ] = "yes";
1546 // We accidently enabled IPv6 for Qt Symbian in 4.6.x. However the underlying OpenC does not fully support IPV6.
1547 // Therefore for 4.7.1 and following we disable it until OpenC either supports it or we have the native Qt
1548 // symbian socket engine.
1549 dictionary[ "IPV6" ] = "no";
1550 dictionary[ "STL" ] = "yes";
1551 dictionary[ "EXCEPTIONS" ] = "yes";
1552 dictionary[ "RTTI" ] = "yes";
1553 dictionary[ "ARCHITECTURE" ] = "symbian";
1554 dictionary[ "3DNOW" ] = "no";
1555 dictionary[ "SSE" ] = "no";
1556 dictionary[ "SSE2" ] = "no";
1557 dictionary[ "MMX" ] = "no";
1558 dictionary[ "IWMMXT" ] = "no";
1559 dictionary[ "CE_CRT" ] = "no";
1560 dictionary[ "DIRECT3D" ] = "no";
1561 dictionary[ "WEBKIT" ] = "yes";
1562 dictionary[ "ASSISTANT_WEBKIT" ] = "no";
1563 dictionary[ "PHONON" ] = "yes";
1564 dictionary[ "XMLPATTERNS" ] = "yes";
1565 dictionary[ "QT_GLIB" ] = "no";
1566 dictionary[ "S60" ] = "yes";
1567 dictionary[ "SYMBIAN_DEFFILES" ] = "yes";
1568 // iconv makes makes apps start and run ridiculously slowly in symbian emulator (HW not tested)
1569 // iconv_open seems to return -1 always, so something is probably missing from the platform.
1570 dictionary[ "QT_ICONV" ] = "no";
1571 dictionary[ "SCRIPTTOOLS" ] = "no";
1572 dictionary[ "QT_HOST_PREFIX" ] = dictionary[ "QT_INSTALL_PREFIX" ];
1573 dictionary[ "QT_INSTALL_PREFIX" ] = "";
1574 dictionary[ "QT_INSTALL_PLUGINS" ] = "\\resource\\qt\\plugins";
1575 dictionary[ "QT_INSTALL_IMPORTS" ] = "\\resource\\qt\\imports";
1576 dictionary[ "QT_INSTALL_TRANSLATIONS" ] = "\\resource\\qt\\translations";
1577 dictionary[ "ARM_FPU_TYPE" ] = "softvfp";
1578 dictionary[ "SQL_SQLITE" ] = "yes";
1579 dictionary[ "SQL_SQLITE_LIB" ] = "system";
1580
1581 // Disable building docs and translations for now
1582 disabledBuildParts << "docs" << "translations";
1583
1584 } else if (dictionary[ "XQMAKESPEC" ].startsWith("linux")) { //TODO actually wrong.
1585 //TODO
1586 dictionary[ "STYLE_WINDOWSXP" ] = "no";
1587 dictionary[ "STYLE_WINDOWSVISTA" ] = "no";
1588 dictionary[ "KBD_DRIVERS" ] = "tty";
1589 dictionary[ "GFX_DRIVERS" ] = "linuxfb vnc";
1590 dictionary[ "MOUSE_DRIVERS" ] = "pc linuxtp";
1591 dictionary[ "QT3SUPPORT" ] = "no";
1592 dictionary[ "OPENGL" ] = "no";
1593 dictionary[ "EXCEPTIONS" ] = "no";
1594 dictionary[ "DBUS"] = "no";
1595 dictionary[ "QT_QWS_DEPTH" ] = "4 8 16 24 32";
1596 dictionary[ "QT_SXE" ] = "no";
1597 dictionary[ "QT_INOTIFY" ] = "no";
1598 dictionary[ "QT_LPR" ] = "no";
1599 dictionary[ "QT_CUPS" ] = "no";
1600 dictionary[ "QT_GLIB" ] = "no";
1601 dictionary[ "QT_ICONV" ] = "no";
1602
1603 dictionary["DECORATIONS"] = "default windows styled";
1604 }
1605}
1606
1607QString Configure::locateFileInPaths(const QString &fileName, const QStringList &paths)
1608{
1609 QDir d;
1610 for (QStringList::ConstIterator it = paths.begin(); it != paths.end(); ++it) {
1611 // Remove any leading or trailing ", this is commonly used in the environment
1612 // variables
1613 QString path = (*it);
1614 if (path.startsWith("\""))
1615 path = path.right(path.length() - 1);
1616 if (path.endsWith("\""))
1617 path = path.left(path.length() - 1);
1618 if (d.exists(path + QDir::separator() + fileName)) {
1619 return (path);
1620 }
1621 }
1622 return QString();
1623}
1624
1625QString Configure::locateFile(const QString &fileName)
1626{
1627 QString file = fileName.toLower();
1628 QStringList paths;
1629#if defined(Q_OS_WIN32)
1630 QRegExp splitReg("[;,]");
1631#else
1632 QRegExp splitReg("[:]");
1633#endif
1634 if (file.endsWith(".h"))
1635 paths = QString::fromLocal8Bit(getenv("INCLUDE")).split(splitReg, QString::SkipEmptyParts);
1636 else if (file.endsWith(".lib"))
1637 paths = QString::fromLocal8Bit(getenv("LIB")).split(splitReg, QString::SkipEmptyParts);
1638 else
1639 paths = QString::fromLocal8Bit(getenv("PATH")).split(splitReg, QString::SkipEmptyParts);
1640 return locateFileInPaths(file, paths);
1641}
1642
1643// Output helper functions ---------------------------------[ Stop ]-
1644
1645
1646bool Configure::displayHelp()
1647{
1648 if (dictionary[ "HELP" ] == "yes") {
1649 desc("Usage: configure [-buildkey <key>]\n"
1650// desc("Usage: configure [-prefix dir] [-bindir <dir>] [-libdir <dir>]\n"
1651// "[-docdir <dir>] [-headerdir <dir>] [-plugindir <dir>]\n"
1652// "[-importdir <dir>] [-datadir <dir>] [-translationdir <dir>]\n"
1653// "[-examplesdir <dir>] [-demosdir <dir>][-buildkey <key>]\n"
1654 "[-release] [-debug] [-debug-and-release] [-shared] [-static]\n"
1655 "[-no-fast] [-fast] [-no-exceptions] [-exceptions]\n"
1656 "[-no-accessibility] [-accessibility] [-no-rtti] [-rtti]\n"
1657 "[-no-stl] [-stl] [-no-sql-<driver>] [-qt-sql-<driver>]\n"
1658 "[-plugin-sql-<driver>] [-system-sqlite] [-arch <arch>]\n"
1659 "[-D <define>] [-I <includepath>] [-L <librarypath>]\n"
1660 "[-help] [-no-dsp] [-dsp] [-no-vcproj] [-vcproj]\n"
1661 "[-no-qmake] [-qmake] [-dont-process] [-process]\n"
1662 "[-no-style-<style>] [-qt-style-<style>] [-redo]\n"
1663 "[-saveconfig <config>] [-loadconfig <config>]\n"
1664 "[-qt-zlib] [-system-zlib] [-no-gif] [-qt-gif] [-no-libpng]\n"
1665 "[-qt-libpng] [-system-libpng] [-no-libtiff] [-qt-libtiff]\n"
1666 "[-system-libtiff] [-no-libjpeg] [-qt-libjpeg] [-system-libjpeg]\n"
1667 "[-no-libmng] [-qt-libmng] [-system-libmng] [-no-qt3support] [-mmx]\n"
1668 "[-no-mmx] [-3dnow] [-no-3dnow] [-sse] [-no-sse] [-sse2] [-no-sse2]\n"
1669 "[-no-iwmmxt] [-iwmmxt] [-openssl] [-openssl-linked]\n"
1670 "[-no-openssl] [-no-dbus] [-dbus] [-dbus-linked] [-platform <spec>]\n"
1671 "[-qtnamespace <namespace>] [-qtlibinfix <infix>] [-no-phonon]\n"
1672 "[-phonon] [-no-phonon-backend] [-phonon-backend]\n"
1673 "[-no-multimedia] [-multimedia] [-no-audio-backend] [-audio-backend]\n"
1674 "[-no-script] [-script] [-no-scripttools] [-scripttools]\n"
1675 "[-no-webkit] [-webkit] [-webkit-debug] [-graphicssystem raster|opengl|openvg]\n\n", 0, 7);
1676
1677 desc("Installation options:\n\n");
1678
1679#if !defined(EVAL)
1680/*
1681 desc(" These are optional, but you may specify install directories.\n\n", 0, 1);
1682
1683 desc( "-prefix dir", "This will install everything relative to dir\n(default $QT_INSTALL_PREFIX)\n");
1684
1685 desc(" You may use these to separate different parts of the install:\n\n", 0, 1);
1686
1687 desc( "-bindir <dir>", "Executables will be installed to dir\n(default PREFIX/bin)");
1688 desc( "-libdir <dir>", "Libraries will be installed to dir\n(default PREFIX/lib)");
1689 desc( "-docdir <dir>", "Documentation will be installed to dir\n(default PREFIX/doc)");
1690 desc( "-headerdir <dir>", "Headers will be installed to dir\n(default PREFIX/include)");
1691 desc( "-plugindir <dir>", "Plugins will be installed to dir\n(default PREFIX/plugins)");
1692 desc( "-importdir <dir>", "Imports for QML will be installed to dir\n(default PREFIX/imports)");
1693 desc( "-datadir <dir>", "Data used by Qt programs will be installed to dir\n(default PREFIX)");
1694 desc( "-translationdir <dir>","Translations of Qt programs will be installed to dir\n(default PREFIX/translations)\n");
1695 desc( "-examplesdir <dir>", "Examples will be installed to dir\n(default PREFIX/examples)");
1696 desc( "-demosdir <dir>", "Demos will be installed to dir\n(default PREFIX/demos)");
1697*/
1698 desc(" You may use these options to turn on strict plugin loading:\n\n", 0, 1);
1699
1700 desc( "-buildkey <key>", "Build the Qt library and plugins using the specified <key>. "
1701 "When the library loads plugins, it will only load those that have a matching <key>.\n");
1702
1703 desc("Configure options:\n\n");
1704
1705 desc(" The defaults (*) are usually acceptable. A plus (+) denotes a default value"
1706 " that needs to be evaluated. If the evaluation succeeds, the feature is"
1707 " included. Here is a short explanation of each option:\n\n", 0, 1);
1708
1709 desc("BUILD", "release","-release", "Compile and link Qt with debugging turned off.");
1710 desc("BUILD", "debug", "-debug", "Compile and link Qt with debugging turned on.");
1711 desc("BUILDALL", "yes", "-debug-and-release", "Compile and link two Qt libraries, with and without debugging turned on.\n");
1712
1713 desc("OPENSOURCE", "opensource", "-opensource", "Compile and link the Open-Source Edition of Qt.");
1714 desc("COMMERCIAL", "commercial", "-commercial", "Compile and link the Commercial Edition of Qt.\n");
1715
1716 desc("BUILDDEV", "yes", "-developer-build", "Compile and link Qt with Qt developer options (including auto-tests exporting)\n");
1717
1718 desc("SHARED", "yes", "-shared", "Create and use shared Qt libraries.");
1719 desc("SHARED", "no", "-static", "Create and use static Qt libraries.\n");
1720
1721 desc("LTCG", "yes", "-ltcg", "Use Link Time Code Generation. (Release builds only)");
1722 desc("LTCG", "no", "-no-ltcg", "Do not use Link Time Code Generation.\n");
1723
1724 desc("FAST", "no", "-no-fast", "Configure Qt normally by generating Makefiles for all project files.");
1725 desc("FAST", "yes", "-fast", "Configure Qt quickly by generating Makefiles only for library and "
1726 "subdirectory targets. All other Makefiles are created as wrappers "
1727 "which will in turn run qmake\n");
1728
1729 desc("EXCEPTIONS", "no", "-no-exceptions", "Disable exceptions on platforms that support it.");
1730 desc("EXCEPTIONS", "yes","-exceptions", "Enable exceptions on platforms that support it.\n");
1731
1732 desc("ACCESSIBILITY", "no", "-no-accessibility", "Do not compile Windows Active Accessibility support.");
1733 desc("ACCESSIBILITY", "yes", "-accessibility", "Compile Windows Active Accessibility support.\n");
1734
1735 desc("STL", "no", "-no-stl", "Do not compile STL support.");
1736 desc("STL", "yes", "-stl", "Compile STL support.\n");
1737
1738 desc( "-no-sql-<driver>", "Disable SQL <driver> entirely, by default none are turned on.");
1739 desc( "-qt-sql-<driver>", "Enable a SQL <driver> in the Qt Library.");
1740 desc( "-plugin-sql-<driver>", "Enable SQL <driver> as a plugin to be linked to at run time.\n"
1741 "Available values for <driver>:");
1742 desc("SQL_MYSQL", "auto", "", " mysql", ' ');
1743 desc("SQL_PSQL", "auto", "", " psql", ' ');
1744 desc("SQL_OCI", "auto", "", " oci", ' ');
1745 desc("SQL_ODBC", "auto", "", " odbc", ' ');
1746 desc("SQL_TDS", "auto", "", " tds", ' ');
1747 desc("SQL_DB2", "auto", "", " db2", ' ');
1748 desc("SQL_SQLITE", "auto", "", " sqlite", ' ');
1749 desc("SQL_SQLITE2", "auto", "", " sqlite2", ' ');
1750 desc("SQL_IBASE", "auto", "", " ibase", ' ');
1751 desc( "", "(drivers marked with a '+' have been detected as available on this system)\n", false, ' ');
1752
1753 desc( "-system-sqlite", "Use sqlite from the operating system.\n");
1754
1755 desc("QT3SUPPORT", "no","-no-qt3support", "Disables the Qt 3 support functionality.\n");
1756 desc("OPENGL", "no","-no-opengl", "Disables OpenGL functionality\n");
1757 desc("OPENGL", "no","-opengl <api>", "Enable OpenGL support with specified API version.\n"
1758 "Available values for <api>:");
1759 desc("", "", "", " desktop - Enable support for Desktop OpenGL", ' ');
1760 desc("OPENGL_ES_CM", "no", "", " es1 - Enable support for OpenGL ES Common Profile", ' ');
1761 desc("OPENGL_ES_2", "no", "", " es2 - Enable support for OpenGL ES 2.0", ' ');
1762
1763 desc("OPENVG", "no","-no-openvg", "Disables OpenVG functionality\n");
1764 desc("OPENVG", "yes","-openvg", "Enables OpenVG functionality");
1765 desc( "", "Requires EGL support, typically supplied by an OpenGL", false, ' ');
1766 desc( "", "or other graphics implementation\n", false, ' ');
1767
1768#endif
1769 desc( "-platform <spec>", "The operating system and compiler you are building on.\n(default %QMAKESPEC%)\n");
1770 desc( "-xplatform <spec>", "The operating system and compiler you are cross compiling to.\n");
1771 desc( "", "See the README file for a list of supported operating systems and compilers.\n", false, ' ');
1772
1773#if !defined(EVAL)
1774 desc( "-qtnamespace <namespace>", "Wraps all Qt library code in 'namespace name {...}");
1775 desc( "-qtlibinfix <infix>", "Renames all Qt* libs to Qt*<infix>\n");
1776 desc( "-D <define>", "Add an explicit define to the preprocessor.");
1777 desc( "-I <includepath>", "Add an explicit include path.");
1778 desc( "-L <librarypath>", "Add an explicit library path.");
1779 desc( "-l <libraryname>", "Add an explicit library name, residing in a librarypath.\n");
1780#endif
1781 desc( "-graphicssystem <sys>", "Specify which graphicssystem should be used.\n"
1782 "Available values for <sys>:");
1783 desc("GRAPHICS_SYSTEM", "raster", "", " raster - Software rasterizer", ' ');
1784 desc("GRAPHICS_SYSTEM", "opengl", "", " opengl - Using OpenGL acceleration, experimental!", ' ');
1785 desc("GRAPHICS_SYSTEM", "openvg", "", " openvg - Using OpenVG acceleration, experimental!\n", ' ');
1786
1787 desc( "-help, -h, -?", "Display this information.\n");
1788
1789#if !defined(EVAL)
1790 // 3rd party stuff options go below here --------------------------------------------------------------------------------
1791 desc("Third Party Libraries:\n\n");
1792
1793 desc("ZLIB", "qt", "-qt-zlib", "Use the zlib bundled with Qt.");
1794 desc("ZLIB", "system", "-system-zlib", "Use zlib from the operating system.\nSee http://www.gzip.org/zlib\n");
1795
1796 desc("GIF", "no", "-no-gif", "Do not compile GIF reading support.");
1797 desc("GIF", "auto", "-qt-gif", "Compile GIF reading support.\nSee also src/gui/image/qgifhandler_p.h\n");
1798
1799 desc("LIBPNG", "no", "-no-libpng", "Do not compile PNG support.");
1800 desc("LIBPNG", "qt", "-qt-libpng", "Use the libpng bundled with Qt.");
1801 desc("LIBPNG", "system","-system-libpng", "Use libpng from the operating system.\nSee http://www.libpng.org/pub/png\n");
1802
1803 desc("LIBMNG", "no", "-no-libmng", "Do not compile MNG support.");
1804 desc("LIBMNG", "qt", "-qt-libmng", "Use the libmng bundled with Qt.");
1805 desc("LIBMNG", "system","-system-libmng", "Use libmng from the operating system.\nSee See http://www.libmng.com\n");
1806
1807 desc("LIBTIFF", "no", "-no-libtiff", "Do not compile TIFF support.");
1808 desc("LIBTIFF", "qt", "-qt-libtiff", "Use the libtiff bundled with Qt.");
1809 desc("LIBTIFF", "system","-system-libtiff", "Use libtiff from the operating system.\nSee http://www.libtiff.org\n");
1810
1811 desc("LIBJPEG", "no", "-no-libjpeg", "Do not compile JPEG support.");
1812 desc("LIBJPEG", "qt", "-qt-libjpeg", "Use the libjpeg bundled with Qt.");
1813 desc("LIBJPEG", "system","-system-libjpeg", "Use libjpeg from the operating system.\nSee http://www.ijg.org\n");
1814
1815#endif
1816 // Qt\Windows only options go below here --------------------------------------------------------------------------------
1817 desc("Qt for Windows only:\n\n");
1818
1819 desc("DSPFILES", "no", "-no-dsp", "Do not generate VC++ .dsp files.");
1820 desc("DSPFILES", "yes", "-dsp", "Generate VC++ .dsp files, only if spec \"win32-msvc\".\n");
1821
1822 desc("VCPROJFILES", "no", "-no-vcproj", "Do not generate VC++ .vcproj files.");
1823 desc("VCPROJFILES", "yes", "-vcproj", "Generate VC++ .vcproj files, only if platform \"win32-msvc.net\".\n");
1824
1825 desc("INCREDIBUILD_XGE", "no", "-no-incredibuild-xge", "Do not add IncrediBuild XGE distribution commands to custom build steps.");
1826 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");
1827
1828 desc("PLUGIN_MANIFESTS", "no", "-no-plugin-manifests", "Do not embed manifests in plugins.");
1829 desc("PLUGIN_MANIFESTS", "yes", "-plugin-manifests", "Embed manifests in plugins.\n");
1830
1831#if !defined(EVAL)
1832 desc("BUILD_QMAKE", "no", "-no-qmake", "Do not compile qmake.");
1833 desc("BUILD_QMAKE", "yes", "-qmake", "Compile qmake.\n");
1834
1835 desc("NOPROCESS", "yes", "-dont-process", "Do not generate Makefiles/Project files. This will override -no-fast if specified.");
1836 desc("NOPROCESS", "no", "-process", "Generate Makefiles/Project files.\n");
1837
1838 desc("RTTI", "no", "-no-rtti", "Do not compile runtime type information.");
1839 desc("RTTI", "yes", "-rtti", "Compile runtime type information.\n");
1840 desc("MMX", "no", "-no-mmx", "Do not compile with use of MMX instructions");
1841 desc("MMX", "yes", "-mmx", "Compile with use of MMX instructions");
1842 desc("3DNOW", "no", "-no-3dnow", "Do not compile with use of 3DNOW instructions");
1843 desc("3DNOW", "yes", "-3dnow", "Compile with use of 3DNOW instructions");
1844 desc("SSE", "no", "-no-sse", "Do not compile with use of SSE instructions");
1845 desc("SSE", "yes", "-sse", "Compile with use of SSE instructions");
1846 desc("SSE2", "no", "-no-sse2", "Do not compile with use of SSE2 instructions");
1847 desc("SSE2", "yes", "-sse2", "Compile with use of SSE2 instructions");
1848 desc("OPENSSL", "no", "-no-openssl", "Do not compile in OpenSSL support");
1849 desc("OPENSSL", "yes", "-openssl", "Compile in run-time OpenSSL support");
1850 desc("OPENSSL", "linked","-openssl-linked", "Compile in linked OpenSSL support");
1851 desc("DBUS", "no", "-no-dbus", "Do not compile in D-Bus support");
1852 desc("DBUS", "yes", "-dbus", "Compile in D-Bus support and load libdbus-1 dynamically");
1853 desc("DBUS", "linked", "-dbus-linked", "Compile in D-Bus support and link to libdbus-1");
1854 desc("PHONON", "no", "-no-phonon", "Do not compile in the Phonon module");
1855 desc("PHONON", "yes", "-phonon", "Compile the Phonon module (Phonon is built if a decent C++ compiler is used.)");
1856 desc("PHONON_BACKEND","no", "-no-phonon-backend","Do not compile the platform-specific Phonon backend-plugin");
1857 desc("PHONON_BACKEND","yes","-phonon-backend", "Compile in the platform-specific Phonon backend-plugin");
1858 desc("MULTIMEDIA", "no", "-no-multimedia", "Do not compile the multimedia module");
1859 desc("MULTIMEDIA", "yes","-multimedia", "Compile in multimedia module");
1860 desc("AUDIO_BACKEND", "no","-no-audio-backend", "Do not compile in the platform audio backend into QtMultimedia");
1861 desc("AUDIO_BACKEND", "yes","-audio-backend", "Compile in the platform audio backend into QtMultimedia");
1862 desc("WEBKIT", "no", "-no-webkit", "Do not compile in the WebKit module");
1863 desc("WEBKIT", "yes", "-webkit", "Compile in the WebKit module (WebKit is built if a decent C++ compiler is used.)");
1864 desc("WEBKIT", "debug", "-webkit-debug", "Compile in the WebKit module with debug symbols.");
1865 desc("SCRIPT", "no", "-no-script", "Do not build the QtScript module.");
1866 desc("SCRIPT", "yes", "-script", "Build the QtScript module.");
1867 desc("SCRIPTTOOLS", "no", "-no-scripttools", "Do not build the QtScriptTools module.");
1868 desc("SCRIPTTOOLS", "yes", "-scripttools", "Build the QtScriptTools module.");
1869 desc("DECLARATIVE", "no", "-no-declarative", "Do not build the declarative module");
1870 desc("DECLARATIVE", "yes", "-declarative", "Build the declarative module");
1871 desc("DECLARATIVE_DEBUG", "no", "-no-declarative-debug", "Do not build the declarative debugging support");
1872 desc("DECLARATIVE_DEBUG", "yes", "-declarative-debug", "Build the declarative debugging support");
1873
1874 desc( "-arch <arch>", "Specify an architecture.\n"
1875 "Available values for <arch>:");
1876 desc("ARCHITECTURE","windows", "", " windows", ' ');
1877 desc("ARCHITECTURE","windowsce", "", " windowsce", ' ');
1878 desc("ARCHITECTURE","symbian", "", " symbian", ' ');
1879 desc("ARCHITECTURE","boundschecker", "", " boundschecker", ' ');
1880 desc("ARCHITECTURE","generic", "", " generic\n", ' ');
1881
1882 desc( "-no-style-<style>", "Disable <style> entirely.");
1883 desc( "-qt-style-<style>", "Enable <style> in the Qt Library.\nAvailable styles: ");
1884
1885 desc("STYLE_WINDOWS", "yes", "", " windows", ' ');
1886 desc("STYLE_WINDOWSXP", "auto", "", " windowsxp", ' ');
1887 desc("STYLE_WINDOWSVISTA", "auto", "", " windowsvista", ' ');
1888 desc("STYLE_PLASTIQUE", "yes", "", " plastique", ' ');
1889 desc("STYLE_CLEANLOOKS", "yes", "", " cleanlooks", ' ');
1890 desc("STYLE_MOTIF", "yes", "", " motif", ' ');
1891 desc("STYLE_CDE", "yes", "", " cde", ' ');
1892 desc("STYLE_WINDOWSCE", "yes", "", " windowsce", ' ');
1893 desc("STYLE_WINDOWSMOBILE" , "yes", "", " windowsmobile", ' ');
1894 desc("STYLE_S60" , "yes", "", " s60\n", ' ');
1895 desc("NATIVE_GESTURES", "no", "-no-native-gestures", "Do not use native gestures on Windows 7.");
1896 desc("NATIVE_GESTURES", "yes", "-native-gestures", "Use native gestures on Windows 7.");
1897 desc("MSVC_MP", "no", "-no-mp", "Do not use multiple processors for compiling with MSVC");
1898 desc("MSVC_MP", "yes", "-mp", "Use multiple processors for compiling with MSVC (-MP)");
1899
1900/* We do not support -qconfig on Windows yet
1901
1902 desc( "-qconfig <local>", "Use src/tools/qconfig-local.h rather than the default.\nPossible values for local:");
1903 for (int i=0; i<allConfigs.size(); ++i)
1904 desc( "", qPrintable(QString(" %1").arg(allConfigs.at(i))), false, ' ');
1905 printf("\n");
1906*/
1907#endif
1908 desc( "-loadconfig <config>", "Run configure with the parameters from file configure_<config>.cache.");
1909 desc( "-saveconfig <config>", "Run configure and save the parameters in file configure_<config>.cache.");
1910 desc( "-redo", "Run configure with the same parameters as last time.\n");
1911
1912 // Qt\Windows CE only options go below here -----------------------------------------------------------------------------
1913 desc("Qt for Windows CE only:\n\n");
1914 desc("IWMMXT", "no", "-no-iwmmxt", "Do not compile with use of IWMMXT instructions");
1915 desc("IWMMXT", "yes", "-iwmmxt", "Do compile with use of IWMMXT instructions (Qt for Windows CE on Arm only)");
1916 desc("CE_CRT", "no", "-no-crt" , "Do not add the C runtime to default deployment rules");
1917 desc("CE_CRT", "yes", "-qt-crt", "Qt identifies C runtime during project generation");
1918 desc( "-crt <path>", "Specify path to C runtime used for project generation.");
1919 desc("CETEST", "no", "-no-cetest", "Do not compile Windows CE remote test application");
1920 desc("CETEST", "yes", "-cetest", "Compile Windows CE remote test application");
1921 desc( "-signature <file>", "Use file for signing the target project");
1922
1923 desc("DIRECTSHOW", "no", "-phonon-wince-ds9", "Enable Phonon Direct Show 9 backend for Windows CE");
1924
1925 // Qt\Symbian only options go below here -----------------------------------------------------------------------------
1926 desc("Qt for Symbian OS only:\n\n");
1927 desc("FREETYPE", "no", "-no-freetype", "Do not compile in Freetype2 support.");
1928 desc("FREETYPE", "yes", "-qt-freetype", "Use the libfreetype bundled with Qt.");
1929 desc( "-fpu <flags>", "VFP type on ARM, supported options: softvfp(default) | vfpv2 | softvfp+vfpv2");
1930 desc("S60", "no", "-no-s60", "Do not compile in S60 support.");
1931 desc("S60", "yes", "-s60", "Compile with support for the S60 UI Framework");
1932 desc("SYMBIAN_DEFFILES", "no", "-no-usedeffiles", "Disable the usage of DEF files.");
1933 desc("SYMBIAN_DEFFILES", "yes", "-usedeffiles", "Enable the usage of DEF files.\n");
1934 return true;
1935 }
1936 return false;
1937}
1938
1939QString Configure::findFileInPaths(const QString &fileName, const QString &paths)
1940{
1941#if defined(Q_OS_WIN32)
1942 QRegExp splitReg("[;,]");
1943#else
1944 QRegExp splitReg("[:]");
1945#endif
1946 QStringList pathList = paths.split(splitReg, QString::SkipEmptyParts);
1947 QDir d;
1948 for (QStringList::ConstIterator it = pathList.begin(); it != pathList.end(); ++it) {
1949 // Remove any leading or trailing ", this is commonly used in the environment
1950 // variables
1951 QString path = (*it);
1952 if (path.startsWith('\"'))
1953 path = path.right(path.length() - 1);
1954 if (path.endsWith('\"'))
1955 path = path.left(path.length() - 1);
1956 if (d.exists(path + QDir::separator() + fileName))
1957 return path;
1958 }
1959 return QString();
1960}
1961
1962bool Configure::findFile(const QString &fileName)
1963{
1964 const QString file = fileName.toLower();
1965 const QString pathEnvVar = QString::fromLocal8Bit(getenv("PATH"));
1966 const QString mingwPath = dictionary["QMAKESPEC"].endsWith("-g++") ?
1967 findFileInPaths("g++.exe", pathEnvVar) : QString();
1968
1969 QString paths;
1970 if (file.endsWith(".h")) {
1971 if (!mingwPath.isNull()) {
1972 if (!findFileInPaths(file, mingwPath + QLatin1String("/../include")).isNull())
1973 return true;
1974 //now let's try the additional compiler path
1975 QDir mingwLibDir = mingwPath + QLatin1String("/../lib/gcc/mingw32");
1976 foreach(const QFileInfo &version, mingwLibDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot)) {
1977 if (!findFileInPaths(file, version.absoluteFilePath() + QLatin1String("/include")).isNull())
1978 return true;
1979 }
1980 }
1981 paths = QString::fromLocal8Bit(getenv("INCLUDE"));
1982 } else if (file.endsWith(".lib") || file.endsWith(".a")) {
1983 if (!mingwPath.isNull() && !findFileInPaths(file, mingwPath + QLatin1String("/../lib")).isNull())
1984 return true;
1985 paths = QString::fromLocal8Bit(getenv("LIB"));
1986 } else {
1987 paths = pathEnvVar;
1988 }
1989 return !findFileInPaths(file, paths).isNull();
1990}
1991
1992/*!
1993 Default value for options marked as "auto" if the test passes.
1994 (Used both by the autoDetection() below, and the desc() function
1995 to mark (+) the default option of autodetecting options.
1996*/
1997QString Configure::defaultTo(const QString &option)
1998{
1999 // We prefer using the system version of the 3rd party libs
2000 if (option == "ZLIB"
2001 || option == "LIBJPEG"
2002 || option == "LIBPNG"
2003 || option == "LIBMNG"
2004 || option == "LIBTIFF")
2005 return "system";
2006
2007 // PNG is always built-in, never a plugin
2008 if (option == "PNG")
2009 return "yes";
2010
2011 // These database drivers and image formats can be built-in or plugins.
2012 // Prefer plugins when Qt is shared.
2013 if (dictionary[ "SHARED" ] == "yes") {
2014 if (option == "SQL_MYSQL"
2015 || option == "SQL_MYSQL"
2016 || option == "SQL_ODBC"
2017 || option == "SQL_OCI"
2018 || option == "SQL_PSQL"
2019 || option == "SQL_TDS"
2020 || option == "SQL_DB2"
2021 || option == "SQL_SQLITE"
2022 || option == "SQL_SQLITE2"
2023 || option == "SQL_IBASE"
2024 || option == "JPEG"
2025 || option == "MNG"
2026 || option == "TIFF"
2027 || option == "GIF")
2028 return "plugin";
2029 }
2030
2031 // By default we do not want to compile OCI driver when compiling with
2032 // MinGW, due to lack of such support from Oracle. It prob. wont work.
2033 // (Customer may force the use though)
2034 if (dictionary["QMAKESPEC"].endsWith("-g++")
2035 && option == "SQL_OCI")
2036 return "no";
2037
2038 if (option == "SYNCQT"
2039 && (!QFile::exists(sourcePath + "/bin/syncqt") ||
2040 !QFile::exists(sourcePath + "/bin/syncqt.bat")))
2041 return "no";
2042
2043 return "yes";
2044}
2045
2046/*!
2047 Checks the system for the availability of a feature.
2048 Returns true if the feature is available, else false.
2049*/
2050bool Configure::checkAvailability(const QString &part)
2051{
2052 bool available = false;
2053 if (part == "STYLE_WINDOWSXP")
2054 available = findFile("uxtheme.h");
2055
2056 else if (part == "ZLIB")
2057 available = findFile("zlib.h");
2058
2059 else if (part == "LIBJPEG")
2060 available = findFile("jpeglib.h");
2061 else if (part == "LIBPNG")
2062 available = findFile("png.h");
2063 else if (part == "LIBMNG")
2064 available = findFile("libmng.h");
2065 else if (part == "LIBTIFF")
2066 available = findFile("tiffio.h");
2067 else if (part == "SQL_MYSQL")
2068 available = findFile("mysql.h") && findFile("libmySQL.lib");
2069 else if (part == "SQL_ODBC")
2070 available = findFile("sql.h") && findFile("sqlext.h") && findFile("odbc32.lib");
2071 else if (part == "SQL_OCI")
2072 available = findFile("oci.h") && findFile("oci.lib");
2073 else if (part == "SQL_PSQL")
2074 available = findFile("libpq-fe.h") && findFile("libpq.lib") && findFile("ws2_32.lib") && findFile("advapi32.lib");
2075 else if (part == "SQL_TDS")
2076 available = findFile("sybfront.h") && findFile("sybdb.h") && findFile("ntwdblib.lib");
2077 else if (part == "SQL_DB2")
2078 available = findFile("sqlcli.h") && findFile("sqlcli1.h") && findFile("db2cli.lib");
2079 else if (part == "SQL_SQLITE")
2080 if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian"))
2081 available = false; // In Symbian we only support system sqlite option
2082 else
2083 available = true; // Built in, we have a fork
2084 else if (part == "SQL_SQLITE_LIB") {
2085 if (dictionary[ "SQL_SQLITE_LIB" ] == "system") {
2086 // Symbian has multiple .lib/.dll files we need to find
2087 if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) {
2088 available = true; // There is sqlite_symbian plugin which exports the necessary stuff
2089 dictionary[ "QT_LFLAGS_SQLITE" ] += "-lsqlite3";
2090 } else {
2091 available = findFile("sqlite3.h") && findFile("sqlite3.lib");
2092 if (available)
2093 dictionary[ "QT_LFLAGS_SQLITE" ] += "sqlite3.lib";
2094 }
2095 } else
2096 available = true;
2097 } else if (part == "SQL_SQLITE2")
2098 available = findFile("sqlite.h") && findFile("sqlite.lib");
2099 else if (part == "SQL_IBASE")
2100 available = findFile("ibase.h") && (findFile("gds32_ms.lib") || findFile("gds32.lib"));
2101 else if (part == "IWMMXT")
2102 available = (dictionary[ "ARCHITECTURE" ] == "windowsce");
2103 else if (part == "OPENGL_ES_CM")
2104 available = (dictionary[ "ARCHITECTURE" ] == "windowsce");
2105 else if (part == "OPENGL_ES_2")
2106 available = (dictionary[ "ARCHITECTURE" ] == "windowsce");
2107 else if (part == "DIRECTSHOW")
2108 available = (dictionary[ "ARCHITECTURE" ] == "windowsce");
2109 else if (part == "SSE2")
2110 available = (dictionary.value("QMAKESPEC") != "win32-msvc");
2111 else if (part == "3DNOW")
2112 available = (dictionary.value("QMAKESPEC") != "win32-msvc") && (dictionary.value("QMAKESPEC") != "win32-icc") && findFile("mm3dnow.h");
2113 else if (part == "MMX" || part == "SSE")
2114 available = (dictionary.value("QMAKESPEC") != "win32-msvc");
2115 else if (part == "OPENSSL")
2116 available = findFile("openssl\\ssl.h");
2117 else if (part == "DBUS")
2118 available = findFile("dbus\\dbus.h");
2119 else if (part == "CETEST") {
2120 QString rapiHeader = locateFile("rapi.h");
2121 QString rapiLib = locateFile("rapi.lib");
2122 available = (dictionary[ "ARCHITECTURE" ] == "windowsce") && !rapiHeader.isEmpty() && !rapiLib.isEmpty();
2123 if (available) {
2124 dictionary[ "QT_CE_RAPI_INC" ] += QLatin1String("\"") + rapiHeader + QLatin1String("\"");
2125 dictionary[ "QT_CE_RAPI_LIB" ] += QLatin1String("\"") + rapiLib + QLatin1String("\"");
2126 }
2127 else if (dictionary[ "CETEST_REQUESTED" ] == "yes") {
2128 cout << "cetest could not be enabled: rapi.h and rapi.lib could not be found." << endl;
2129 cout << "Make sure the environment is set up for compiling with ActiveSync." << endl;
2130 dictionary[ "DONE" ] = "error";
2131 }
2132 }
2133 else if (part == "INCREDIBUILD_XGE")
2134 available = findFile("BuildConsole.exe") && findFile("xgConsole.exe");
2135 else if (part == "XMLPATTERNS")
2136 {
2137 /* MSVC 6.0 and MSVC 2002/7.0 has too poor C++ support for QtXmlPatterns. */
2138 return dictionary.value("QMAKESPEC") != "win32-msvc"
2139 && dictionary.value("QMAKESPEC") != "win32-msvc.net" // Leave for now, since we can't be sure if they are using 2002 or 2003 with this spec
2140 && dictionary.value("QMAKESPEC") != "win32-msvc2002"
2141 && dictionary.value("EXCEPTIONS") == "yes";
2142 } else if (part == "PHONON") {
2143 if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) {
2144 available = true;
2145 } else {
2146 available = findFile("vmr9.h") && findFile("dshow.h") && findFile("dmo.h") && findFile("dmodshow.h")
2147 && (findFile("strmiids.lib") || findFile("libstrmiids.a"))
2148 && (findFile("dmoguids.lib") || findFile("libdmoguids.a"))
2149 && (findFile("msdmo.lib") || findFile("libmsdmo.a"))
2150 && findFile("d3d9.h");
2151
2152 if (!available) {
2153 cout << "All the required DirectShow/Direct3D files couldn't be found." << endl
2154 << "Make sure you have either the platform SDK AND the DirectShow SDK or the Windows SDK installed." << endl
2155 << "If you have the DirectShow SDK installed, please make sure that you have run the <path to SDK>\\SetEnv.Cmd script." << endl;
2156 if (!findFile("vmr9.h")) cout << "vmr9.h not found" << endl;
2157 if (!findFile("dshow.h")) cout << "dshow.h not found" << endl;
2158 if (!findFile("strmiids.lib")) cout << "strmiids.lib not found" << endl;
2159 if (!findFile("dmoguids.lib")) cout << "dmoguids.lib not found" << endl;
2160 if (!findFile("msdmo.lib")) cout << "msdmo.lib not found" << endl;
2161 if (!findFile("d3d9.h")) cout << "d3d9.h not found" << endl;
2162 }
2163 }
2164 } else if (part == "WMSDK") {
2165 available = findFile("wmsdk.h");
2166 } else if (part == "MULTIMEDIA" || part == "SCRIPT" || part == "SCRIPTTOOLS" || part == "DECLARATIVE") {
2167 available = true;
2168 } else if (part == "WEBKIT") {
2169 available = (dictionary.value("QMAKESPEC") == "win32-msvc2005") || (dictionary.value("QMAKESPEC") == "win32-msvc2008") || (dictionary.value("QMAKESPEC") == "win32-msvc2010") || (dictionary.value("QMAKESPEC") == "win32-g++");
2170 if (dictionary[ "SHARED" ] == "no") {
2171 cout << endl << "WARNING: Using static linking will disable the WebKit module." << endl
2172 << endl;
2173 available = false;
2174 }
2175 } else if (part == "AUDIO_BACKEND") {
2176 available = true;
2177 if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) {
2178 QString epocRoot = Environment::symbianEpocRoot();
2179 const QDir epocRootDir(epocRoot);
2180 if (epocRootDir.exists()) {
2181 QStringList paths;
2182 paths << "epoc32/release/armv5/lib/mmfdevsound.dso"
2183 << "epoc32/release/armv5/lib/mmfdevsound.lib"
2184 << "epoc32/release/winscw/udeb/mmfdevsound.dll"
2185 << "epoc32/release/winscw/udeb/mmfdevsound.lib"
2186 << "epoc32/include/mmf/server/sounddevice.h";
2187
2188 QStringList::iterator i = paths.begin();
2189 while (i != paths.end()) {
2190 const QString &path = epocRoot + *i;
2191 if (QFile::exists(path))
2192 i = paths.erase(i);
2193 else
2194 ++i;
2195 }
2196
2197 available = (paths.size() == 0);
2198 if (!available) {
2199 if (epocRoot.isEmpty())
2200 epocRoot = "<empty string>";
2201 cout << endl
2202 << "The QtMultimedia audio backend will not be built because required" << endl
2203 << "support for CMMFDevSound was not found in the SDK." << endl
2204 << "The SDK which was examined was located at the following path:" << endl
2205 << " " << epocRoot << endl
2206 << "The following required files were missing from the SDK:" << endl;
2207 QString path;
2208 foreach (path, paths)
2209 cout << " " << path << endl;
2210 cout << endl;
2211 }
2212 } else {
2213 cout << endl
2214 << "The SDK root was determined to be '" << epocRoot << "'." << endl
2215 << "This directory was not found, so the SDK could not be checked for" << endl
2216 << "CMMFDevSound support. The QtMultimedia audio backend will therefore" << endl
2217 << "not be built." << endl << endl;
2218 available = false;
2219 }
2220 }
2221 }
2222
2223 return available;
2224}
2225
2226/*
2227 Autodetect options marked as "auto".
2228*/
2229void Configure::autoDetection()
2230{
2231 // Style detection
2232 if (dictionary["STYLE_WINDOWSXP"] == "auto")
2233 dictionary["STYLE_WINDOWSXP"] = checkAvailability("STYLE_WINDOWSXP") ? defaultTo("STYLE_WINDOWSXP") : "no";
2234 if (dictionary["STYLE_WINDOWSVISTA"] == "auto") // Vista style has the same requirements as XP style
2235 dictionary["STYLE_WINDOWSVISTA"] = checkAvailability("STYLE_WINDOWSXP") ? defaultTo("STYLE_WINDOWSVISTA") : "no";
2236
2237 // Compression detection
2238 if (dictionary["ZLIB"] == "auto")
2239 dictionary["ZLIB"] = checkAvailability("ZLIB") ? defaultTo("ZLIB") : "qt";
2240
2241 // Image format detection
2242 if (dictionary["GIF"] == "auto")
2243 dictionary["GIF"] = defaultTo("GIF");
2244 if (dictionary["JPEG"] == "auto")
2245 dictionary["JPEG"] = defaultTo("JPEG");
2246 if (dictionary["PNG"] == "auto")
2247 dictionary["PNG"] = defaultTo("PNG");
2248 if (dictionary["MNG"] == "auto")
2249 dictionary["MNG"] = defaultTo("MNG");
2250 if (dictionary["TIFF"] == "auto")
2251 dictionary["TIFF"] = dictionary["ZLIB"] == "no" ? "no" : defaultTo("TIFF");
2252 if (dictionary["LIBJPEG"] == "auto")
2253 dictionary["LIBJPEG"] = checkAvailability("LIBJPEG") ? defaultTo("LIBJPEG") : "qt";
2254 if (dictionary["LIBPNG"] == "auto")
2255 dictionary["LIBPNG"] = checkAvailability("LIBPNG") ? defaultTo("LIBPNG") : "qt";
2256 if (dictionary["LIBMNG"] == "auto")
2257 dictionary["LIBMNG"] = checkAvailability("LIBMNG") ? defaultTo("LIBMNG") : "qt";
2258 if (dictionary["LIBTIFF"] == "auto")
2259 dictionary["LIBTIFF"] = checkAvailability("LIBTIFF") ? defaultTo("LIBTIFF") : "qt";
2260
2261 // SQL detection (not on by default)
2262 if (dictionary["SQL_MYSQL"] == "auto")
2263 dictionary["SQL_MYSQL"] = checkAvailability("SQL_MYSQL") ? defaultTo("SQL_MYSQL") : "no";
2264 if (dictionary["SQL_ODBC"] == "auto")
2265 dictionary["SQL_ODBC"] = checkAvailability("SQL_ODBC") ? defaultTo("SQL_ODBC") : "no";
2266 if (dictionary["SQL_OCI"] == "auto")
2267 dictionary["SQL_OCI"] = checkAvailability("SQL_OCI") ? defaultTo("SQL_OCI") : "no";
2268 if (dictionary["SQL_PSQL"] == "auto")
2269 dictionary["SQL_PSQL"] = checkAvailability("SQL_PSQL") ? defaultTo("SQL_PSQL") : "no";
2270 if (dictionary["SQL_TDS"] == "auto")
2271 dictionary["SQL_TDS"] = checkAvailability("SQL_TDS") ? defaultTo("SQL_TDS") : "no";
2272 if (dictionary["SQL_DB2"] == "auto")
2273 dictionary["SQL_DB2"] = checkAvailability("SQL_DB2") ? defaultTo("SQL_DB2") : "no";
2274 if (dictionary["SQL_SQLITE"] == "auto")
2275 dictionary["SQL_SQLITE"] = checkAvailability("SQL_SQLITE") ? defaultTo("SQL_SQLITE") : "no";
2276 if (dictionary["SQL_SQLITE_LIB"] == "system")
2277 if (!checkAvailability("SQL_SQLITE_LIB"))
2278 dictionary["SQL_SQLITE_LIB"] = "no";
2279 if (dictionary["SQL_SQLITE2"] == "auto")
2280 dictionary["SQL_SQLITE2"] = checkAvailability("SQL_SQLITE2") ? defaultTo("SQL_SQLITE2") : "no";
2281 if (dictionary["SQL_IBASE"] == "auto")
2282 dictionary["SQL_IBASE"] = checkAvailability("SQL_IBASE") ? defaultTo("SQL_IBASE") : "no";
2283 if (dictionary["MMX"] == "auto")
2284 dictionary["MMX"] = checkAvailability("MMX") ? "yes" : "no";
2285 if (dictionary["3DNOW"] == "auto")
2286 dictionary["3DNOW"] = checkAvailability("3DNOW") ? "yes" : "no";
2287 if (dictionary["SSE"] == "auto")
2288 dictionary["SSE"] = checkAvailability("SSE") ? "yes" : "no";
2289 if (dictionary["SSE2"] == "auto")
2290 dictionary["SSE2"] = checkAvailability("SSE2") ? "yes" : "no";
2291 if (dictionary["IWMMXT"] == "auto")
2292 dictionary["IWMMXT"] = checkAvailability("IWMMXT") ? "yes" : "no";
2293 if (dictionary["OPENSSL"] == "auto")
2294 dictionary["OPENSSL"] = checkAvailability("OPENSSL") ? "yes" : "no";
2295 if (dictionary["DBUS"] == "auto")
2296 dictionary["DBUS"] = checkAvailability("DBUS") ? "yes" : "no";
2297 if (dictionary["SCRIPT"] == "auto")
2298 dictionary["SCRIPT"] = checkAvailability("SCRIPT") ? "yes" : "no";
2299 if (dictionary["SCRIPTTOOLS"] == "auto")
2300 dictionary["SCRIPTTOOLS"] = dictionary["SCRIPT"] == "yes" ? "yes" : "no";
2301 if (dictionary["XMLPATTERNS"] == "auto")
2302 dictionary["XMLPATTERNS"] = checkAvailability("XMLPATTERNS") ? "yes" : "no";
2303 if (dictionary["PHONON"] == "auto")
2304 dictionary["PHONON"] = checkAvailability("PHONON") ? "yes" : "no";
2305 if (dictionary["WEBKIT"] == "auto")
2306 dictionary["WEBKIT"] = checkAvailability("WEBKIT") ? "yes" : "no";
2307 if (dictionary["DECLARATIVE"] == "auto")
2308 dictionary["DECLARATIVE"] = dictionary["SCRIPT"] == "yes" ? "yes" : "no";
2309 if (dictionary["DECLARATIVE_DEBUG"] == "auto")
2310 dictionary["DECLARATIVE_DEBUG"] = dictionary["DECLARATIVE"] == "yes" ? "yes" : "no";
2311 if (dictionary["AUDIO_BACKEND"] == "auto")
2312 dictionary["AUDIO_BACKEND"] = checkAvailability("AUDIO_BACKEND") ? "yes" : "no";
2313 if (dictionary["WMSDK"] == "auto")
2314 dictionary["WMSDK"] = checkAvailability("WMSDK") ? "yes" : "no";
2315
2316 // Qt/WinCE remote test application
2317 if (dictionary["CETEST"] == "auto")
2318 dictionary["CETEST"] = checkAvailability("CETEST") ? "yes" : "no";
2319
2320 // Detection of IncrediBuild buildconsole
2321 if (dictionary["INCREDIBUILD_XGE"] == "auto")
2322 dictionary["INCREDIBUILD_XGE"] = checkAvailability("INCREDIBUILD_XGE") ? "yes" : "no";
2323
2324 // Mark all unknown "auto" to the default value..
2325 for (QMap<QString,QString>::iterator i = dictionary.begin(); i != dictionary.end(); ++i) {
2326 if (i.value() == "auto")
2327 i.value() = defaultTo(i.key());
2328 }
2329}
2330
2331bool Configure::verifyConfiguration()
2332{
2333 if (dictionary["SQL_SQLITE_LIB"] == "no" && dictionary["SQL_SQLITE"] != "no") {
2334 cout << "WARNING: Configure could not detect the presence of a system SQLite3 lib." << endl
2335 << "Configure will therefore continue with the SQLite3 lib bundled with Qt." << endl
2336 << "(Press any key to continue..)";
2337 if (_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
2338 exit(0); // Exit cleanly for Ctrl+C
2339
2340 dictionary["SQL_SQLITE_LIB"] = "qt"; // Set to Qt's bundled lib an continue
2341 }
2342 if (dictionary["QMAKESPEC"].endsWith("-g++")
2343 && dictionary["SQL_OCI"] != "no") {
2344 cout << "WARNING: Qt does not support compiling the Oracle database driver with" << endl
2345 << "MinGW, due to lack of such support from Oracle. Consider disabling the" << endl
2346 << "Oracle driver, as the current build will most likely fail." << endl;
2347 cout << "(Press any key to continue..)";
2348 if (_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
2349 exit(0); // Exit cleanly for Ctrl+C
2350 }
2351 if (dictionary["QMAKESPEC"].endsWith("win32-msvc.net")) {
2352 cout << "WARNING: The makespec win32-msvc.net is deprecated. Consider using" << endl
2353 << "win32-msvc2002 or win32-msvc2003 instead." << endl;
2354 cout << "(Press any key to continue..)";
2355 if (_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
2356 exit(0); // Exit cleanly for Ctrl+C
2357 }
2358 if (0 != dictionary["ARM_FPU_TYPE"].size()) {
2359 QStringList l= QStringList()
2360 << "softvfp"
2361 << "softvfp+vfpv2"
2362 << "vfpv2";
2363 if (!(l.contains(dictionary["ARM_FPU_TYPE"])))
2364 cout << QString("WARNING: Using unsupported fpu flag: %1").arg(dictionary["ARM_FPU_TYPE"]) << endl;
2365 }
2366 if (dictionary["DECLARATIVE"] == "yes" && dictionary["SCRIPT"] == "no") {
2367 cout << "WARNING: To be able to compile QtDeclarative we need to also compile the" << endl
2368 << "QtScript module. If you continue, we will turn on the QtScript module." << endl
2369 << "(Press any key to continue..)";
2370 if (_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
2371 exit(0); // Exit cleanly for Ctrl+C
2372
2373 dictionary["SCRIPT"] = "yes";
2374 }
2375
2376 return true;
2377}
2378
2379/*
2380 Things that affect the Qt API/ABI:
2381 Options:
2382 minimal-config small-config medium-config large-config full-config
2383
2384 Options:
2385 debug release
2386 stl
2387
2388 Things that do not affect the Qt API/ABI:
2389 system-jpeg no-jpeg jpeg
2390 system-mng no-mng mng
2391 system-png no-png png
2392 system-zlib no-zlib zlib
2393 system-tiff no-tiff tiff
2394 no-gif gif
2395 dll staticlib
2396
2397 nocrosscompiler
2398 GNUmake
2399 largefile
2400 nis
2401 nas
2402 tablet
2403 ipv6
2404
2405 X11 : x11sm xinerama xcursor xfixes xrandr xrender fontconfig xkb
2406 Embedded: embedded freetype
2407*/
2408void Configure::generateBuildKey()
2409{
2410 QString spec = dictionary["QMAKESPEC"];
2411
2412 QString compiler = "msvc"; // ICC is compatible
2413 if (spec.endsWith("-g++"))
2414 compiler = "mingw";
2415 else if (spec.endsWith("-borland"))
2416 compiler = "borland";
2417
2418 // Build options which changes the Qt API/ABI
2419 QStringList build_options;
2420 if (!dictionary["QCONFIG"].isEmpty())
2421 build_options += dictionary["QCONFIG"] + "-config ";
2422 build_options.sort();
2423
2424 // Sorted defines that start with QT_NO_
2425 QStringList build_defines = qmakeDefines.filter(QRegExp("^QT_NO_"));
2426 build_defines.sort();
2427
2428 // Build up the QT_BUILD_KEY ifdef
2429 QString buildKey = "QT_BUILD_KEY \"";
2430 if (!dictionary["USER_BUILD_KEY"].isEmpty())
2431 buildKey += dictionary["USER_BUILD_KEY"] + " ";
2432
2433 QString build32Key = buildKey + "Windows " + compiler + " %1 " + build_options.join(" ") + " " + build_defines.join(" ");
2434 QString build64Key = buildKey + "Windows x64 " + compiler + " %1 " + build_options.join(" ") + " " + build_defines.join(" ");
2435 QString buildSymbianKey = buildKey + "Symbian " + build_options.join(" ") + " " + build_defines.join(" ");
2436 build32Key = build32Key.simplified();
2437 build64Key = build64Key.simplified();
2438 buildSymbianKey = buildSymbianKey.simplified();
2439 build32Key.prepend("# define ");
2440 build64Key.prepend("# define ");
2441 buildSymbianKey.prepend("# define ");
2442
2443 QString buildkey = "#if defined(__SYMBIAN32__)\n"
2444 + buildSymbianKey + "\"\n"
2445 "#else\n"
2446 // Debug builds
2447 "# if !defined(QT_NO_DEBUG)\n"
2448 "# if (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))\n"
2449 + build64Key.arg("debug") + "\"\n"
2450 "# else\n"
2451 + build32Key.arg("debug") + "\"\n"
2452 "# endif\n"
2453 "# else\n"
2454 // Release builds
2455 "# if (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))\n"
2456 + build64Key.arg("release") + "\"\n"
2457 "# else\n"
2458 + build32Key.arg("release") + "\"\n"
2459 "# endif\n"
2460 "# endif\n"
2461 "#endif\n";
2462
2463 dictionary["BUILD_KEY"] = buildkey;
2464}
2465
2466void Configure::generateOutputVars()
2467{
2468 // Generate variables for output
2469 // Build key ----------------------------------------------------
2470 if (dictionary.contains("BUILD_KEY")) {
2471 qmakeVars += dictionary.value("BUILD_KEY");
2472 }
2473
2474 QString build = dictionary[ "BUILD" ];
2475 bool buildAll = (dictionary[ "BUILDALL" ] == "yes");
2476 if (build == "debug") {
2477 if (buildAll)
2478 qtConfig += "release";
2479 qtConfig += "debug";
2480 } else if (build == "release") {
2481 if (buildAll)
2482 qtConfig += "debug";
2483 qtConfig += "release";
2484 }
2485
2486 // Compression --------------------------------------------------
2487 if (dictionary[ "ZLIB" ] == "qt")
2488 qtConfig += "zlib";
2489 else if (dictionary[ "ZLIB" ] == "system")
2490 qtConfig += "system-zlib";
2491
2492 // Image formates -----------------------------------------------
2493 if (dictionary[ "GIF" ] == "no")
2494 qtConfig += "no-gif";
2495 else if (dictionary[ "GIF" ] == "yes")
2496 qtConfig += "gif";
2497
2498 if (dictionary[ "TIFF" ] == "no")
2499 qtConfig += "no-tiff";
2500 else if (dictionary[ "TIFF" ] == "yes")
2501 qtConfig += "tiff";
2502 if (dictionary[ "LIBTIFF" ] == "system")
2503 qtConfig += "system-tiff";
2504
2505 if (dictionary[ "JPEG" ] == "no")
2506 qtConfig += "no-jpeg";
2507 else if (dictionary[ "JPEG" ] == "yes")
2508 qtConfig += "jpeg";
2509 if (dictionary[ "LIBJPEG" ] == "system")
2510 qtConfig += "system-jpeg";
2511
2512 if (dictionary[ "PNG" ] == "no")
2513 qtConfig += "no-png";
2514 else if (dictionary[ "PNG" ] == "yes")
2515 qtConfig += "png";
2516 if (dictionary[ "LIBPNG" ] == "system")
2517 qtConfig += "system-png";
2518
2519 if (dictionary[ "MNG" ] == "no")
2520 qtConfig += "no-mng";
2521 else if (dictionary[ "MNG" ] == "yes")
2522 qtConfig += "mng";
2523 if (dictionary[ "LIBMNG" ] == "system")
2524 qtConfig += "system-mng";
2525
2526 // Text rendering --------------------------------------------------
2527 if (dictionary[ "FREETYPE" ] == "yes")
2528 qtConfig += "freetype";
2529
2530 // Styles -------------------------------------------------------
2531 if (dictionary[ "STYLE_WINDOWS" ] == "yes")
2532 qmakeStyles += "windows";
2533
2534 if (dictionary[ "STYLE_PLASTIQUE" ] == "yes")
2535 qmakeStyles += "plastique";
2536
2537 if (dictionary[ "STYLE_CLEANLOOKS" ] == "yes")
2538 qmakeStyles += "cleanlooks";
2539
2540 if (dictionary[ "STYLE_WINDOWSXP" ] == "yes")
2541 qmakeStyles += "windowsxp";
2542
2543 if (dictionary[ "STYLE_WINDOWSVISTA" ] == "yes")
2544 qmakeStyles += "windowsvista";
2545
2546 if (dictionary[ "STYLE_MOTIF" ] == "yes")
2547 qmakeStyles += "motif";
2548
2549 if (dictionary[ "STYLE_SGI" ] == "yes")
2550 qmakeStyles += "sgi";
2551
2552 if (dictionary[ "STYLE_WINDOWSCE" ] == "yes")
2553 qmakeStyles += "windowsce";
2554
2555 if (dictionary[ "STYLE_WINDOWSMOBILE" ] == "yes")
2556 qmakeStyles += "windowsmobile";
2557
2558 if (dictionary[ "STYLE_CDE" ] == "yes")
2559 qmakeStyles += "cde";
2560
2561 if (dictionary[ "STYLE_S60" ] == "yes")
2562 qmakeStyles += "s60";
2563
2564 // Databases ----------------------------------------------------
2565 if (dictionary[ "SQL_MYSQL" ] == "yes")
2566 qmakeSql += "mysql";
2567 else if (dictionary[ "SQL_MYSQL" ] == "plugin")
2568 qmakeSqlPlugins += "mysql";
2569
2570 if (dictionary[ "SQL_ODBC" ] == "yes")
2571 qmakeSql += "odbc";
2572 else if (dictionary[ "SQL_ODBC" ] == "plugin")
2573 qmakeSqlPlugins += "odbc";
2574
2575 if (dictionary[ "SQL_OCI" ] == "yes")
2576 qmakeSql += "oci";
2577 else if (dictionary[ "SQL_OCI" ] == "plugin")
2578 qmakeSqlPlugins += "oci";
2579
2580 if (dictionary[ "SQL_PSQL" ] == "yes")
2581 qmakeSql += "psql";
2582 else if (dictionary[ "SQL_PSQL" ] == "plugin")
2583 qmakeSqlPlugins += "psql";
2584
2585 if (dictionary[ "SQL_TDS" ] == "yes")
2586 qmakeSql += "tds";
2587 else if (dictionary[ "SQL_TDS" ] == "plugin")
2588 qmakeSqlPlugins += "tds";
2589
2590 if (dictionary[ "SQL_DB2" ] == "yes")
2591 qmakeSql += "db2";
2592 else if (dictionary[ "SQL_DB2" ] == "plugin")
2593 qmakeSqlPlugins += "db2";
2594
2595 if (dictionary[ "SQL_SQLITE" ] == "yes")
2596 qmakeSql += "sqlite";
2597 else if (dictionary[ "SQL_SQLITE" ] == "plugin")
2598 qmakeSqlPlugins += "sqlite";
2599
2600 if (dictionary[ "SQL_SQLITE_LIB" ] == "system")
2601 qmakeConfig += "system-sqlite";
2602
2603 if (dictionary[ "SQL_SQLITE2" ] == "yes")
2604 qmakeSql += "sqlite2";
2605 else if (dictionary[ "SQL_SQLITE2" ] == "plugin")
2606 qmakeSqlPlugins += "sqlite2";
2607
2608 if (dictionary[ "SQL_IBASE" ] == "yes")
2609 qmakeSql += "ibase";
2610 else if (dictionary[ "SQL_IBASE" ] == "plugin")
2611 qmakeSqlPlugins += "ibase";
2612
2613 // Other options ------------------------------------------------
2614 if (dictionary[ "BUILDALL" ] == "yes") {
2615 qmakeConfig += "build_all";
2616 }
2617 qmakeConfig += dictionary[ "BUILD" ];
2618 dictionary[ "QMAKE_OUTDIR" ] = dictionary[ "BUILD" ];
2619
2620 if (dictionary[ "SHARED" ] == "yes") {
2621 QString version = dictionary[ "VERSION" ];
2622 if (!version.isEmpty()) {
2623 qmakeVars += "QMAKE_QT_VERSION_OVERRIDE = " + version.left(version.indexOf("."));
2624 version.remove(QLatin1Char('.'));
2625 }
2626 dictionary[ "QMAKE_OUTDIR" ] += "_shared";
2627 } else {
2628 dictionary[ "QMAKE_OUTDIR" ] += "_static";
2629 }
2630
2631 if (dictionary[ "ACCESSIBILITY" ] == "yes")
2632 qtConfig += "accessibility";
2633
2634 if (!qmakeLibs.isEmpty())
2635 qmakeVars += "LIBS += " + escapeSeparators(qmakeLibs.join(" "));
2636
2637 if (!dictionary["QT_LFLAGS_SQLITE"].isEmpty())
2638 qmakeVars += "QT_LFLAGS_SQLITE += " + escapeSeparators(dictionary["QT_LFLAGS_SQLITE"]);
2639
2640 if (dictionary[ "QT3SUPPORT" ] == "yes")
2641 qtConfig += "qt3support";
2642
2643 if (dictionary[ "OPENGL" ] == "yes")
2644 qtConfig += "opengl";
2645
2646 if (dictionary["OPENGL_ES_CM"] == "yes") {
2647 qtConfig += "opengles1";
2648 qtConfig += "egl";
2649 }
2650
2651 if (dictionary["OPENGL_ES_2"] == "yes") {
2652 qtConfig += "opengles2";
2653 qtConfig += "egl";
2654 }
2655
2656 if (dictionary["OPENVG"] == "yes") {
2657 qtConfig += "openvg";
2658 qtConfig += "egl";
2659 }
2660
2661 if (dictionary["S60"] == "yes") {
2662 qtConfig += "s60";
2663 }
2664
2665 if (dictionary["DIRECTSHOW"] == "yes")
2666 qtConfig += "directshow";
2667
2668 if (dictionary[ "OPENSSL" ] == "yes")
2669 qtConfig += "openssl";
2670 else if (dictionary[ "OPENSSL" ] == "linked")
2671 qtConfig += "openssl-linked";
2672
2673 if (dictionary[ "DBUS" ] == "yes")
2674 qtConfig += "dbus";
2675 else if (dictionary[ "DBUS" ] == "linked")
2676 qtConfig += "dbus dbus-linked";
2677
2678 if (dictionary["IPV6"] == "yes")
2679 qtConfig += "ipv6";
2680 else if (dictionary["IPV6"] == "no")
2681 qtConfig += "no-ipv6";
2682
2683 if (dictionary[ "CETEST" ] == "yes")
2684 qtConfig += "cetest";
2685
2686 if (dictionary[ "SCRIPT" ] == "yes")
2687 qtConfig += "script";
2688
2689 if (dictionary[ "SCRIPTTOOLS" ] == "yes") {
2690 if (dictionary[ "SCRIPT" ] == "no") {
2691 cout << "QtScriptTools was requested, but it can't be built due to QtScript being "
2692 "disabled." << endl;
2693 dictionary[ "DONE" ] = "error";
2694 }
2695 qtConfig += "scripttools";
2696 }
2697
2698 if (dictionary[ "XMLPATTERNS" ] == "yes")
2699 qtConfig += "xmlpatterns";
2700
2701 if (dictionary["PHONON"] == "yes") {
2702 qtConfig += "phonon";
2703 if (dictionary["PHONON_BACKEND"] == "yes")
2704 qtConfig += "phonon-backend";
2705 }
2706
2707 if (dictionary["MULTIMEDIA"] == "yes") {
2708 qtConfig += "multimedia";
2709 if (dictionary["AUDIO_BACKEND"] == "yes")
2710 qtConfig += "audio-backend";
2711 }
2712
2713 QString dst = buildPath + "/mkspecs/modules/qt_webkit_version.pri";
2714 QFile::remove(dst);
2715 if (dictionary["WEBKIT"] != "no") {
2716 // This include takes care of adding "webkit" to QT_CONFIG.
2717 QString src = sourcePath + "/src/3rdparty/webkit/WebKit/qt/qt_webkit_version.pri";
2718 QFile::copy(src, dst);
2719 if (dictionary["WEBKIT"] == "debug")
2720 qtConfig += "webkit-debug";
2721 }
2722
2723 if (dictionary["DECLARATIVE"] == "yes") {
2724 if (dictionary[ "SCRIPT" ] == "no") {
2725 cout << "QtDeclarative was requested, but it can't be built due to QtScript being "
2726 "disabled." << endl;
2727 dictionary[ "DONE" ] = "error";
2728 }
2729 qtConfig += "declarative";
2730 }
2731
2732 if (dictionary[ "NATIVE_GESTURES" ] == "yes")
2733 qtConfig += "native-gestures";
2734
2735 // We currently have no switch for QtSvg, so add it unconditionally.
2736 qtConfig += "svg";
2737
2738 // Add config levels --------------------------------------------
2739 QStringList possible_configs = QStringList()
2740 << "minimal"
2741 << "small"
2742 << "medium"
2743 << "large"
2744 << "full";
2745
2746 QString set_config = dictionary["QCONFIG"];
2747 if (possible_configs.contains(set_config)) {
2748 foreach (const QString &cfg, possible_configs) {
2749 qtConfig += (cfg + "-config");
2750 if (cfg == set_config)
2751 break;
2752 }
2753 }
2754
2755 if (dictionary.contains("XQMAKESPEC") && (dictionary["QMAKESPEC"] != dictionary["XQMAKESPEC"]))
2756 qmakeConfig += "cross_compile";
2757
2758 // Directories and settings for .qmake.cache --------------------
2759
2760 // if QT_INSTALL_* have not been specified on commandline, define them now from QT_INSTALL_PREFIX
2761 // if prefix is empty (WINCE), make all of them empty, if they aren't set
2762 bool qipempty = false;
2763 if (dictionary[ "QT_INSTALL_PREFIX" ].isEmpty())
2764 qipempty = true;
2765
2766 if (!dictionary[ "QT_INSTALL_DOCS" ].size())
2767 dictionary[ "QT_INSTALL_DOCS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/doc");
2768 if (!dictionary[ "QT_INSTALL_HEADERS" ].size())
2769 dictionary[ "QT_INSTALL_HEADERS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/include");
2770 if (!dictionary[ "QT_INSTALL_LIBS" ].size())
2771 dictionary[ "QT_INSTALL_LIBS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/lib");
2772 if (!dictionary[ "QT_INSTALL_BINS" ].size())
2773 dictionary[ "QT_INSTALL_BINS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/bin");
2774 if (!dictionary[ "QT_INSTALL_PLUGINS" ].size())
2775 dictionary[ "QT_INSTALL_PLUGINS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/plugins");
2776 if (!dictionary[ "QT_INSTALL_IMPORTS" ].size())
2777 dictionary[ "QT_INSTALL_IMPORTS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/imports");
2778 if (!dictionary[ "QT_INSTALL_DATA" ].size())
2779 dictionary[ "QT_INSTALL_DATA" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ]);
2780 if (!dictionary[ "QT_INSTALL_TRANSLATIONS" ].size())
2781 dictionary[ "QT_INSTALL_TRANSLATIONS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/translations");
2782 if (!dictionary[ "QT_INSTALL_EXAMPLES" ].size())
2783 dictionary[ "QT_INSTALL_EXAMPLES" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/examples");
2784 if (!dictionary[ "QT_INSTALL_DEMOS" ].size())
2785 dictionary[ "QT_INSTALL_DEMOS" ] = qipempty ? "" : fixSeparators(dictionary[ "QT_INSTALL_PREFIX" ] + "/demos");
2786
2787 if (dictionary.contains("XQMAKESPEC") && dictionary[ "XQMAKESPEC" ].startsWith("linux"))
2788 dictionary[ "QMAKE_RPATHDIR" ] = dictionary[ "QT_INSTALL_LIBS" ];
2789
2790 qmakeVars += QString("OBJECTS_DIR = ") + fixSeparators("tmp/obj/" + dictionary[ "QMAKE_OUTDIR" ], true);
2791 qmakeVars += QString("MOC_DIR = ") + fixSeparators("tmp/moc/" + dictionary[ "QMAKE_OUTDIR" ], true);
2792 qmakeVars += QString("RCC_DIR = ") + fixSeparators("tmp/rcc/" + dictionary["QMAKE_OUTDIR"], true);
2793
2794 if (!qmakeDefines.isEmpty())
2795 qmakeVars += QString("DEFINES += ") + qmakeDefines.join(" ");
2796 if (!qmakeIncludes.isEmpty())
2797 qmakeVars += QString("INCLUDEPATH += ") + escapeSeparators(qmakeIncludes.join(" "));
2798 if (!opensslLibs.isEmpty())
2799 qmakeVars += opensslLibs;
2800 else if (dictionary[ "OPENSSL" ] == "linked") {
2801 if (dictionary.contains("XQMAKESPEC") && dictionary[ "XQMAKESPEC" ].startsWith("symbian"))
2802 qmakeVars += QString("OPENSSL_LIBS = -llibssl -llibcrypto");
2803 else
2804 qmakeVars += QString("OPENSSL_LIBS = -lssleay32 -llibeay32");
2805 }
2806 if (!psqlLibs.isEmpty())
2807 qmakeVars += QString("QT_LFLAGS_PSQL=") + psqlLibs.section("=", 1);
2808
2809 {
2810 QStringList lflagsTDS;
2811 if (!sybase.isEmpty())
2812 lflagsTDS += QString("-L") + fixSeparators(sybase.section("=", 1) + "/lib");
2813 if (!sybaseLibs.isEmpty())
2814 lflagsTDS += sybaseLibs.section("=", 1);
2815 if (!lflagsTDS.isEmpty())
2816 qmakeVars += QString("QT_LFLAGS_TDS=") + lflagsTDS.join(" ");
2817 }
2818
2819 if (!qmakeSql.isEmpty())
2820 qmakeVars += QString("sql-drivers += ") + qmakeSql.join(" ");
2821 if (!qmakeSqlPlugins.isEmpty())
2822 qmakeVars += QString("sql-plugins += ") + qmakeSqlPlugins.join(" ");
2823 if (!qmakeStyles.isEmpty())
2824 qmakeVars += QString("styles += ") + qmakeStyles.join(" ");
2825 if (!qmakeStylePlugins.isEmpty())
2826 qmakeVars += QString("style-plugins += ") + qmakeStylePlugins.join(" ");
2827
2828 if (dictionary["QMAKESPEC"].endsWith("-g++")) {
2829 QString includepath = qgetenv("INCLUDE");
2830 bool hasSh = Environment::detectExecutable("sh.exe");
2831 QChar separator = (!includepath.contains(":\\") && hasSh ? QChar(':') : QChar(';'));
2832 qmakeVars += QString("TMPPATH = $$quote($$(INCLUDE))");
2833 qmakeVars += QString("QMAKE_INCDIR_POST += $$split(TMPPATH,\"%1\")").arg(separator);
2834 qmakeVars += QString("TMPPATH = $$quote($$(LIB))");
2835 qmakeVars += QString("QMAKE_LIBDIR_POST += $$split(TMPPATH,\"%1\")").arg(separator);
2836 }
2837
2838 if (!dictionary[ "QMAKESPEC" ].length()) {
2839 cout << "Configure could not detect your compiler. QMAKESPEC must either" << endl
2840 << "be defined as an environment variable, or specified as an" << endl
2841 << "argument with -platform" << endl;
2842 dictionary[ "HELP" ] = "yes";
2843
2844 QStringList winPlatforms;
2845 QDir mkspecsDir(sourcePath + "/mkspecs");
2846 const QFileInfoList &specsList = mkspecsDir.entryInfoList();
2847 for (int i = 0; i < specsList.size(); ++i) {
2848 const QFileInfo &fi = specsList.at(i);
2849 if (fi.fileName().left(5) == "win32") {
2850 winPlatforms += fi.fileName();
2851 }
2852 }
2853 cout << "Available platforms are: " << qPrintable(winPlatforms.join(", ")) << endl;
2854 dictionary[ "DONE" ] = "error";
2855 }
2856}
2857
2858#if !defined(EVAL)
2859void Configure::generateCachefile()
2860{
2861 // Generate .qmake.cache
2862 QFile cacheFile(buildPath + "/.qmake.cache");
2863 if (cacheFile.open(QFile::WriteOnly | QFile::Text)) { // Truncates any existing file.
2864 QTextStream cacheStream(&cacheFile);
2865 for (QStringList::Iterator var = qmakeVars.begin(); var != qmakeVars.end(); ++var) {
2866 cacheStream << (*var) << endl;
2867 }
2868 cacheStream << "CONFIG += " << qmakeConfig.join(" ") << " incremental msvc_mp create_prl link_prl depend_includepath QTDIR_build" << endl;
2869
2870 QStringList buildParts;
2871 buildParts << "libs" << "tools" << "examples" << "demos" << "docs" << "translations";
2872 foreach (const QString &item, disabledBuildParts) {
2873 buildParts.removeAll(item);
2874 }
2875 cacheStream << "QT_BUILD_PARTS = " << buildParts.join(" ") << endl;
2876
2877 QString targetSpec = dictionary.contains("XQMAKESPEC") ? dictionary[ "XQMAKESPEC" ] : dictionary[ "QMAKESPEC" ];
2878 QString mkspec_path = fixSeparators(sourcePath + "/mkspecs/" + targetSpec);
2879 if (QFile::exists(mkspec_path))
2880 cacheStream << "QMAKESPEC = " << escapeSeparators(mkspec_path) << endl;
2881 else
2882 cacheStream << "QMAKESPEC = " << fixSeparators(targetSpec, true) << endl;
2883 cacheStream << "ARCH = " << dictionary[ "ARCHITECTURE" ] << endl;
2884 cacheStream << "QT_BUILD_TREE = " << fixSeparators(dictionary[ "QT_BUILD_TREE" ], true) << endl;
2885 cacheStream << "QT_SOURCE_TREE = " << fixSeparators(dictionary[ "QT_SOURCE_TREE" ], true) << endl;
2886
2887 if (dictionary["QT_EDITION"] != "QT_EDITION_OPENSOURCE")
2888 cacheStream << "DEFINES *= QT_EDITION=QT_EDITION_DESKTOP" << endl;
2889
2890 //so that we can build without an install first (which would be impossible)
2891 cacheStream << "QMAKE_MOC = $$QT_BUILD_TREE" << fixSeparators("/bin/moc.exe", true) << endl;
2892 cacheStream << "QMAKE_UIC = $$QT_BUILD_TREE" << fixSeparators("/bin/uic.exe", true) << endl;
2893 cacheStream << "QMAKE_UIC3 = $$QT_BUILD_TREE" << fixSeparators("/bin/uic3.exe", true) << endl;
2894 cacheStream << "QMAKE_RCC = $$QT_BUILD_TREE" << fixSeparators("/bin/rcc.exe", true) << endl;
2895 cacheStream << "QMAKE_DUMPCPP = $$QT_BUILD_TREE" << fixSeparators("/bin/dumpcpp.exe", true) << endl;
2896 cacheStream << "QMAKE_INCDIR_QT = $$QT_BUILD_TREE" << fixSeparators("/include", true) << endl;
2897 cacheStream << "QMAKE_LIBDIR_QT = $$QT_BUILD_TREE" << fixSeparators("/lib", true) << endl;
2898 if (dictionary["CETEST"] == "yes") {
2899 cacheStream << "QT_CE_RAPI_INC = " << fixSeparators(dictionary[ "QT_CE_RAPI_INC" ], true) << endl;
2900 cacheStream << "QT_CE_RAPI_LIB = " << fixSeparators(dictionary[ "QT_CE_RAPI_LIB" ], true) << endl;
2901 }
2902
2903 // embedded
2904 if (!dictionary["KBD_DRIVERS"].isEmpty())
2905 cacheStream << "kbd-drivers += "<< dictionary["KBD_DRIVERS"]<<endl;
2906 if (!dictionary["GFX_DRIVERS"].isEmpty())
2907 cacheStream << "gfx-drivers += "<< dictionary["GFX_DRIVERS"]<<endl;
2908 if (!dictionary["MOUSE_DRIVERS"].isEmpty())
2909 cacheStream << "mouse-drivers += "<< dictionary["MOUSE_DRIVERS"]<<endl;
2910 if (!dictionary["DECORATIONS"].isEmpty())
2911 cacheStream << "decorations += "<<dictionary["DECORATIONS"]<<endl;
2912
2913 if (!dictionary["QMAKE_RPATHDIR"].isEmpty())
2914 cacheStream << "QMAKE_RPATHDIR += "<<dictionary["QMAKE_RPATHDIR"];
2915
2916 cacheStream.flush();
2917 cacheFile.close();
2918 }
2919 QFile configFile(dictionary[ "QT_BUILD_TREE" ] + "/mkspecs/qconfig.pri");
2920 if (configFile.open(QFile::WriteOnly | QFile::Text)) { // Truncates any existing file.
2921 QTextStream configStream(&configFile);
2922 configStream << "CONFIG+= ";
2923 configStream << dictionary[ "BUILD" ];
2924 if (dictionary[ "SHARED" ] == "yes")
2925 configStream << " shared";
2926 else
2927 configStream << " static";
2928
2929 if (dictionary[ "LTCG" ] == "yes")
2930 configStream << " ltcg";
2931 if (dictionary[ "MSVC_MP" ] == "yes")
2932 configStream << " msvc_mp";
2933 if (dictionary[ "STL" ] == "yes")
2934 configStream << " stl";
2935 if (dictionary[ "EXCEPTIONS" ] == "yes")
2936 configStream << " exceptions";
2937 if (dictionary[ "EXCEPTIONS" ] == "no")
2938 configStream << " exceptions_off";
2939 if (dictionary[ "RTTI" ] == "yes")
2940 configStream << " rtti";
2941 if (dictionary[ "MMX" ] == "yes")
2942 configStream << " mmx";
2943 if (dictionary[ "3DNOW" ] == "yes")
2944 configStream << " 3dnow";
2945 if (dictionary[ "SSE" ] == "yes")
2946 configStream << " sse";
2947 if (dictionary[ "SSE2" ] == "yes")
2948 configStream << " sse2";
2949 if (dictionary[ "IWMMXT" ] == "yes")
2950 configStream << " iwmmxt";
2951 if (dictionary["INCREDIBUILD_XGE"] == "yes")
2952 configStream << " incredibuild_xge";
2953 if (dictionary["PLUGIN_MANIFESTS"] == "no")
2954 configStream << " no_plugin_manifest";
2955
2956 if (dictionary.contains("SYMBIAN_DEFFILES")) {
2957 if (dictionary["SYMBIAN_DEFFILES"] == "yes") {
2958 configStream << " def_files";
2959 } else if (dictionary["SYMBIAN_DEFFILES"] == "no") {
2960 configStream << " def_files_disabled";
2961 }
2962 }
2963 configStream << endl;
2964 configStream << "QT_ARCH = " << dictionary[ "ARCHITECTURE" ] << endl;
2965 if (dictionary["QT_EDITION"].contains("OPENSOURCE"))
2966 configStream << "QT_EDITION = " << QLatin1String("OpenSource") << endl;
2967 else
2968 configStream << "QT_EDITION = " << dictionary["EDITION"] << endl;
2969 configStream << "QT_CONFIG += " << qtConfig.join(" ") << endl;
2970
2971 configStream << "#versioning " << endl
2972 << "QT_VERSION = " << dictionary["VERSION"] << endl
2973 << "QT_MAJOR_VERSION = " << dictionary["VERSION_MAJOR"] << endl
2974 << "QT_MINOR_VERSION = " << dictionary["VERSION_MINOR"] << endl
2975 << "QT_PATCH_VERSION = " << dictionary["VERSION_PATCH"] << endl;
2976
2977 configStream << "#Qt for Windows CE c-runtime deployment" << endl
2978 << "QT_CE_C_RUNTIME = " << fixSeparators(dictionary[ "CE_CRT" ], true) << endl;
2979
2980 if (dictionary["CE_SIGNATURE"] != QLatin1String("no"))
2981 configStream << "DEFAULT_SIGNATURE=" << dictionary["CE_SIGNATURE"] << endl;
2982
2983 if (!dictionary["QMAKE_RPATHDIR"].isEmpty())
2984 configStream << "QMAKE_RPATHDIR += " << dictionary["QMAKE_RPATHDIR"] << endl;
2985
2986 if (!dictionary["QT_LIBINFIX"].isEmpty())
2987 configStream << "QT_LIBINFIX = " << dictionary["QT_LIBINFIX"] << endl;
2988
2989 configStream << "#Qt for Symbian FPU settings" << endl;
2990 if (!dictionary["ARM_FPU_TYPE"].isEmpty()) {
2991 configStream<<"MMP_RULES += \"ARMFPU "<< dictionary["ARM_FPU_TYPE"]<< "\"";
2992 }
2993 if (!dictionary["QT_NAMESPACE"].isEmpty()) {
2994 configStream << "#namespaces" << endl << "QT_NAMESPACE = " << dictionary["QT_NAMESPACE"] << endl;
2995 }
2996
2997 configStream.flush();
2998 configFile.close();
2999 }
3000}
3001#endif
3002
3003QString Configure::addDefine(QString def)
3004{
3005 QString result, defNeg, defD = def;
3006
3007 defD.replace(QRegExp("=.*"), "");
3008 def.replace(QRegExp("="), " ");
3009
3010 if (def.startsWith("QT_NO_")) {
3011 defNeg = defD;
3012 defNeg.replace("QT_NO_", "QT_");
3013 } else if (def.startsWith("QT_")) {
3014 defNeg = defD;
3015 defNeg.replace("QT_", "QT_NO_");
3016 }
3017
3018 if (defNeg.isEmpty()) {
3019 result = "#ifndef $DEFD\n"
3020 "# define $DEF\n"
3021 "#endif\n\n";
3022 } else {
3023 result = "#if defined($DEFD) && defined($DEFNEG)\n"
3024 "# undef $DEFD\n"
3025 "#elif !defined($DEFD)\n"
3026 "# define $DEF\n"
3027 "#endif\n\n";
3028 }
3029 result.replace("$DEFNEG", defNeg);
3030 result.replace("$DEFD", defD);
3031 result.replace("$DEF", def);
3032 return result;
3033}
3034
3035#if !defined(EVAL)
3036void Configure::generateConfigfiles()
3037{
3038 QDir(buildPath).mkpath("src/corelib/global");
3039 QString outName(buildPath + "/src/corelib/global/qconfig.h");
3040 QTemporaryFile tmpFile;
3041 QTextStream tmpStream;
3042
3043 if (tmpFile.open()) {
3044 tmpStream.setDevice(&tmpFile);
3045
3046 if (dictionary[ "QCONFIG" ] == "full") {
3047 tmpStream << "/* Everything */" << endl;
3048 } else {
3049 QString configName("qconfig-" + dictionary[ "QCONFIG" ] + ".h");
3050 tmpStream << "/* Copied from " << configName << "*/" << endl;
3051 tmpStream << "#ifndef QT_BOOTSTRAPPED" << endl;
3052 QFile inFile(sourcePath + "/src/corelib/global/" + configName);
3053 if (inFile.open(QFile::ReadOnly)) {
3054 QByteArray buffer = inFile.readAll();
3055 tmpFile.write(buffer.constData(), buffer.size());
3056 inFile.close();
3057 }
3058 tmpStream << "#endif // QT_BOOTSTRAPPED" << endl;
3059 }
3060 tmpStream << endl;
3061
3062 if (dictionary[ "SHARED" ] == "yes") {
3063 tmpStream << "#ifndef QT_DLL" << endl;
3064 tmpStream << "#define QT_DLL" << endl;
3065 tmpStream << "#endif" << endl;
3066 }
3067 tmpStream << endl;
3068 tmpStream << "/* License information */" << endl;
3069 tmpStream << "#define QT_PRODUCT_LICENSEE \"" << licenseInfo[ "LICENSEE" ] << "\"" << endl;
3070 tmpStream << "#define QT_PRODUCT_LICENSE \"" << dictionary[ "EDITION" ] << "\"" << endl;
3071 tmpStream << endl;
3072 tmpStream << "// Qt Edition" << endl;
3073 tmpStream << "#ifndef QT_EDITION" << endl;
3074 tmpStream << "# define QT_EDITION " << dictionary["QT_EDITION"] << endl;
3075 tmpStream << "#endif" << endl;
3076 tmpStream << endl;
3077 tmpStream << dictionary["BUILD_KEY"];
3078 tmpStream << endl;
3079 if (dictionary["BUILDDEV"] == "yes") {
3080 dictionary["QMAKE_INTERNAL"] = "yes";
3081 tmpStream << "/* Used for example to export symbols for the certain autotests*/" << endl;
3082 tmpStream << "#define QT_BUILD_INTERNAL" << endl;
3083 tmpStream << endl;
3084 }
3085 tmpStream << "/* Machine byte-order */" << endl;
3086 tmpStream << "#define Q_BIG_ENDIAN 4321" << endl;
3087 tmpStream << "#define Q_LITTLE_ENDIAN 1234" << endl;
3088 if (QSysInfo::ByteOrder == QSysInfo::BigEndian)
3089 tmpStream << "#define Q_BYTE_ORDER Q_BIG_ENDIAN" << endl;
3090 else
3091 tmpStream << "#define Q_BYTE_ORDER Q_LITTLE_ENDIAN" << endl;
3092
3093 tmpStream << endl << "// Compile time features" << endl;
3094 tmpStream << "#define QT_ARCH_" << dictionary["ARCHITECTURE"].toUpper() << endl;
3095 if (dictionary["GRAPHICS_SYSTEM"] == "runtime" && dictionary["RUNTIME_SYSTEM"] != "runtime")
3096 tmpStream << "#define QT_DEFAULT_RUNTIME_SYSTEM \"" << dictionary["RUNTIME_SYSTEM"] << "\"" << endl;
3097
3098 QStringList qconfigList;
3099 if (dictionary["STL"] == "no") qconfigList += "QT_NO_STL";
3100 if (dictionary["STYLE_WINDOWS"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWS";
3101 if (dictionary["STYLE_PLASTIQUE"] != "yes") qconfigList += "QT_NO_STYLE_PLASTIQUE";
3102 if (dictionary["STYLE_CLEANLOOKS"] != "yes") qconfigList += "QT_NO_STYLE_CLEANLOOKS";
3103 if (dictionary["STYLE_WINDOWSXP"] != "yes" && dictionary["STYLE_WINDOWSVISTA"] != "yes")
3104 qconfigList += "QT_NO_STYLE_WINDOWSXP";
3105 if (dictionary["STYLE_WINDOWSVISTA"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWSVISTA";
3106 if (dictionary["STYLE_MOTIF"] != "yes") qconfigList += "QT_NO_STYLE_MOTIF";
3107 if (dictionary["STYLE_CDE"] != "yes") qconfigList += "QT_NO_STYLE_CDE";
3108 if (dictionary["STYLE_S60"] != "yes") qconfigList += "QT_NO_STYLE_S60";
3109 if (dictionary["STYLE_WINDOWSCE"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWSCE";
3110 if (dictionary["STYLE_WINDOWSMOBILE"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWSMOBILE";
3111 if (dictionary["STYLE_GTK"] != "yes") qconfigList += "QT_NO_STYLE_GTK";
3112
3113 if (dictionary["GIF"] == "yes") qconfigList += "QT_BUILTIN_GIF_READER=1";
3114 if (dictionary["PNG"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_PNG";
3115 if (dictionary["MNG"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_MNG";
3116 if (dictionary["JPEG"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_JPEG";
3117 if (dictionary["TIFF"] != "yes") qconfigList += "QT_NO_IMAGEFORMAT_TIFF";
3118 if (dictionary["ZLIB"] == "no") {
3119 qconfigList += "QT_NO_ZLIB";
3120 qconfigList += "QT_NO_COMPRESS";
3121 }
3122
3123 if (dictionary["ACCESSIBILITY"] == "no") qconfigList += "QT_NO_ACCESSIBILITY";
3124 if (dictionary["EXCEPTIONS"] == "no") qconfigList += "QT_NO_EXCEPTIONS";
3125 if (dictionary["OPENGL"] == "no") qconfigList += "QT_NO_OPENGL";
3126 if (dictionary["OPENVG"] == "no") qconfigList += "QT_NO_OPENVG";
3127 if (dictionary["OPENSSL"] == "no") qconfigList += "QT_NO_OPENSSL";
3128 if (dictionary["OPENSSL"] == "linked") qconfigList += "QT_LINKED_OPENSSL";
3129 if (dictionary["DBUS"] == "no") qconfigList += "QT_NO_DBUS";
3130 if (dictionary["IPV6"] == "no") qconfigList += "QT_NO_IPV6";
3131 if (dictionary["WEBKIT"] == "no") qconfigList += "QT_NO_WEBKIT";
3132 if (dictionary["DECLARATIVE"] == "no") qconfigList += "QT_NO_DECLARATIVE";
3133 if (dictionary["DECLARATIVE_DEBUG"] == "no") qconfigList += "QDECLARATIVE_NO_DEBUG_PROTOCOL";
3134 if (dictionary["PHONON"] == "no") qconfigList += "QT_NO_PHONON";
3135 if (dictionary["MULTIMEDIA"] == "no") qconfigList += "QT_NO_MULTIMEDIA";
3136 if (dictionary["XMLPATTERNS"] == "no") qconfigList += "QT_NO_XMLPATTERNS";
3137 if (dictionary["SCRIPT"] == "no") qconfigList += "QT_NO_SCRIPT";
3138 if (dictionary["SCRIPTTOOLS"] == "no") qconfigList += "QT_NO_SCRIPTTOOLS";
3139 if (dictionary["FREETYPE"] == "no") qconfigList += "QT_NO_FREETYPE";
3140 if (dictionary["S60"] == "no") qconfigList += "QT_NO_S60";
3141 if (dictionary["NATIVE_GESTURES"] == "no") qconfigList += "QT_NO_NATIVE_GESTURES";
3142
3143 if (dictionary["OPENGL_ES_CM"] == "no" &&
3144 dictionary["OPENGL_ES_2"] == "no" &&
3145 dictionary["OPENVG"] == "no") qconfigList += "QT_NO_EGL";
3146
3147 if (dictionary["OPENGL_ES_CM"] == "yes" ||
3148 dictionary["OPENGL_ES_2"] == "yes") qconfigList += "QT_OPENGL_ES";
3149
3150 if (dictionary["OPENGL_ES_CM"] == "yes") qconfigList += "QT_OPENGL_ES_1";
3151 if (dictionary["OPENGL_ES_2"] == "yes") qconfigList += "QT_OPENGL_ES_2";
3152 if (dictionary["SQL_MYSQL"] == "yes") qconfigList += "QT_SQL_MYSQL";
3153 if (dictionary["SQL_ODBC"] == "yes") qconfigList += "QT_SQL_ODBC";
3154 if (dictionary["SQL_OCI"] == "yes") qconfigList += "QT_SQL_OCI";
3155 if (dictionary["SQL_PSQL"] == "yes") qconfigList += "QT_SQL_PSQL";
3156 if (dictionary["SQL_TDS"] == "yes") qconfigList += "QT_SQL_TDS";
3157 if (dictionary["SQL_DB2"] == "yes") qconfigList += "QT_SQL_DB2";
3158 if (dictionary["SQL_SQLITE"] == "yes") qconfigList += "QT_SQL_SQLITE";
3159 if (dictionary["SQL_SQLITE2"] == "yes") qconfigList += "QT_SQL_SQLITE2";
3160 if (dictionary["SQL_IBASE"] == "yes") qconfigList += "QT_SQL_IBASE";
3161
3162 if (dictionary["GRAPHICS_SYSTEM"] == "openvg") qconfigList += "QT_GRAPHICSSYSTEM_OPENVG";
3163 if (dictionary["GRAPHICS_SYSTEM"] == "opengl") qconfigList += "QT_GRAPHICSSYSTEM_OPENGL";
3164 if (dictionary["GRAPHICS_SYSTEM"] == "raster") qconfigList += "QT_GRAPHICSSYSTEM_RASTER";
3165 if (dictionary["GRAPHICS_SYSTEM"] == "runtime") qconfigList += "QT_GRAPHICSSYSTEM_RUNTIME";
3166
3167 if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) {
3168 // These features are not ported to Symbian (yet)
3169 qconfigList += "QT_NO_CONCURRENT";
3170 qconfigList += "QT_NO_QFUTURE";
3171 qconfigList += "QT_NO_CRASHHANDLER";
3172 qconfigList += "QT_NO_PRINTER";
3173 qconfigList += "QT_NO_SYSTEMTRAYICON";
3174 if (dictionary.contains("QT_LIBINFIX"))
3175 tmpStream << QString("#define QT_LIBINFIX \"%1\"").arg(dictionary["QT_LIBINFIX"]) << endl;
3176 }
3177
3178 qconfigList.sort();
3179 for (int i = 0; i < qconfigList.count(); ++i)
3180 tmpStream << addDefine(qconfigList.at(i));
3181
3182 if (dictionary["EMBEDDED"] == "yes")
3183 {
3184 // Check for keyboard, mouse, gfx.
3185 QStringList kbdDrivers = dictionary["KBD_DRIVERS"].split(" ");;
3186 QStringList allKbdDrivers;
3187 allKbdDrivers<<"tty"<<"usb"<<"sl5000"<<"yopy"<<"vr41xx"<<"qvfb"<<"um";
3188 foreach (const QString &kbd, allKbdDrivers) {
3189 if (!kbdDrivers.contains(kbd))
3190 tmpStream<<"#define QT_NO_QWS_KBD_"<<kbd.toUpper()<<endl;
3191 }
3192
3193 QStringList mouseDrivers = dictionary["MOUSE_DRIVERS"].split(" ");
3194 QStringList allMouseDrivers;
3195 allMouseDrivers << "pc"<<"bus"<<"linuxtp"<<"yopy"<<"vr41xx"<<"tslib"<<"qvfb";
3196 foreach (const QString &mouse, allMouseDrivers) {
3197 if (!mouseDrivers.contains(mouse))
3198 tmpStream<<"#define QT_NO_QWS_MOUSE_"<<mouse.toUpper()<<endl;
3199 }
3200
3201 QStringList gfxDrivers = dictionary["GFX_DRIVERS"].split(" ");
3202 QStringList allGfxDrivers;
3203 allGfxDrivers<<"linuxfb"<<"transformed"<<"qvfb"<<"vnc"<<"multiscreen"<<"ahi";
3204 foreach (const QString &gfx, allGfxDrivers) {
3205 if (!gfxDrivers.contains(gfx))
3206 tmpStream<<"#define QT_NO_QWS_"<<gfx.toUpper()<<endl;
3207 }
3208
3209 tmpStream<<"#define Q_WS_QWS"<<endl;
3210
3211 QStringList depths = dictionary[ "QT_QWS_DEPTH" ].split(" ");
3212 foreach (const QString &depth, depths)
3213 tmpStream<<"#define QT_QWS_DEPTH_"+depth<<endl;
3214 }
3215
3216 if (dictionary[ "QT_CUPS" ] == "no")
3217 tmpStream<<"#define QT_NO_CUPS"<<endl;
3218
3219 if (dictionary[ "QT_ICONV" ] == "no")
3220 tmpStream<<"#define QT_NO_ICONV"<<endl;
3221
3222 if (dictionary[ "QT_GLIB" ] == "no")
3223 tmpStream<<"#define QT_NO_GLIB"<<endl;
3224
3225 if (dictionary[ "QT_LPR" ] == "no")
3226 tmpStream<<"#define QT_NO_LPR"<<endl;
3227
3228 if (dictionary[ "QT_INOTIFY" ] == "no")
3229 tmpStream<<"#define QT_NO_INOTIFY"<<endl;
3230
3231 if (dictionary[ "QT_SXE" ] == "no")
3232 tmpStream<<"#define QT_NO_SXE"<<endl;
3233
3234 tmpStream.flush();
3235 tmpFile.flush();
3236
3237 // Replace old qconfig.h with new one
3238 ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL);
3239 QFile::remove(outName);
3240 tmpFile.copy(outName);
3241 tmpFile.close();
3242 }
3243
3244 // Copy configured mkspec to default directory, but remove the old one first, if there is any
3245 QString defSpec = buildPath + "/mkspecs/default";
3246 QFileInfo defSpecInfo(defSpec);
3247 if (defSpecInfo.exists()) {
3248 if (!Environment::rmdir(defSpec)) {
3249 cout << "Couldn't update default mkspec! Are files in " << qPrintable(defSpec) << " read-only?" << endl;
3250 dictionary["DONE"] = "error";
3251 return;
3252 }
3253 }
3254
3255 QString spec = dictionary.contains("XQMAKESPEC") ? dictionary["XQMAKESPEC"] : dictionary["QMAKESPEC"];
3256 QString pltSpec = sourcePath + "/mkspecs/" + spec;
3257 QString includeSpec = buildPath + "/mkspecs/" + spec;
3258 if (!Environment::cpdir(pltSpec, defSpec, includeSpec)) {
3259 cout << "Couldn't update default mkspec! Does " << qPrintable(pltSpec) << " exist?" << endl;
3260 dictionary["DONE"] = "error";
3261 return;
3262 }
3263
3264 // Generate the new qconfig.cpp file
3265 QDir(buildPath).mkpath("src/corelib/global");
3266 outName = buildPath + "/src/corelib/global/qconfig.cpp";
3267
3268 QTemporaryFile tmpFile2;
3269 if (tmpFile2.open()) {
3270 tmpStream.setDevice(&tmpFile2);
3271 tmpStream << "/* Licensed */" << endl
3272 << "static const char qt_configure_licensee_str [512 + 12] = \"qt_lcnsuser=" << licenseInfo["LICENSEE"] << "\";" << endl
3273 << "static const char qt_configure_licensed_products_str [512 + 12] = \"qt_lcnsprod=" << dictionary["EDITION"] << "\";" << endl
3274 << endl
3275 << "/* Build date */" << endl
3276 << "static const char qt_configure_installation [11 + 12] = \"qt_instdate=" << QDate::currentDate().toString(Qt::ISODate) << "\";" << endl
3277 << endl;
3278 if (!dictionary[ "QT_HOST_PREFIX" ].isNull())
3279 tmpStream << "#if !defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE)" << endl;
3280 tmpStream << "static const char qt_configure_prefix_path_str [512 + 12] = \"qt_prfxpath=" << escapeSeparators(dictionary["QT_INSTALL_PREFIX"]) << "\";" << endl
3281 << "static const char qt_configure_documentation_path_str[512 + 12] = \"qt_docspath=" << escapeSeparators(dictionary["QT_INSTALL_DOCS"]) << "\";" << endl
3282 << "static const char qt_configure_headers_path_str [512 + 12] = \"qt_hdrspath=" << escapeSeparators(dictionary["QT_INSTALL_HEADERS"]) << "\";" << endl
3283 << "static const char qt_configure_libraries_path_str [512 + 12] = \"qt_libspath=" << escapeSeparators(dictionary["QT_INSTALL_LIBS"]) << "\";" << endl
3284 << "static const char qt_configure_binaries_path_str [512 + 12] = \"qt_binspath=" << escapeSeparators(dictionary["QT_INSTALL_BINS"]) << "\";" << endl
3285 << "static const char qt_configure_plugins_path_str [512 + 12] = \"qt_plugpath=" << escapeSeparators(dictionary["QT_INSTALL_PLUGINS"]) << "\";" << endl
3286 << "static const char qt_configure_imports_path_str [512 + 12] = \"qt_impspath=" << escapeSeparators(dictionary["QT_INSTALL_IMPORTS"]) << "\";" << endl
3287 << "static const char qt_configure_data_path_str [512 + 12] = \"qt_datapath=" << escapeSeparators(dictionary["QT_INSTALL_DATA"]) << "\";" << endl
3288 << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << escapeSeparators(dictionary["QT_INSTALL_TRANSLATIONS"]) << "\";" << endl
3289 << "static const char qt_configure_examples_path_str [512 + 12] = \"qt_xmplpath=" << escapeSeparators(dictionary["QT_INSTALL_EXAMPLES"]) << "\";" << endl
3290 << "static const char qt_configure_demos_path_str [512 + 12] = \"qt_demopath=" << escapeSeparators(dictionary["QT_INSTALL_DEMOS"]) << "\";" << endl
3291 //<< "static const char qt_configure_settings_path_str [256] = \"qt_stngpath=" << escapeSeparators(dictionary["QT_INSTALL_SETTINGS"]) << "\";" << endl
3292 ;
3293 if (!dictionary[ "QT_HOST_PREFIX" ].isNull()) {
3294 tmpStream << "#else" << endl
3295 << "static const char qt_configure_prefix_path_str [512 + 12] = \"qt_prfxpath=" << escapeSeparators(dictionary[ "QT_HOST_PREFIX" ]) << "\";" << endl
3296 << "static const char qt_configure_documentation_path_str[512 + 12] = \"qt_docspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/doc", true) <<"\";" << endl
3297 << "static const char qt_configure_headers_path_str [512 + 12] = \"qt_hdrspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/include", true) <<"\";" << endl
3298 << "static const char qt_configure_libraries_path_str [512 + 12] = \"qt_libspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/lib", true) <<"\";" << endl
3299 << "static const char qt_configure_binaries_path_str [512 + 12] = \"qt_binspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/bin", true) <<"\";" << endl
3300 << "static const char qt_configure_plugins_path_str [512 + 12] = \"qt_plugpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/plugins", true) <<"\";" << endl
3301 << "static const char qt_configure_imports_path_str [512 + 12] = \"qt_impspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/imports", true) <<"\";" << endl
3302 << "static const char qt_configure_data_path_str [512 + 12] = \"qt_datapath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ], true) <<"\";" << endl
3303 << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/translations", true) <<"\";" << endl
3304 << "static const char qt_configure_examples_path_str [512 + 12] = \"qt_xmplpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/example", true) <<"\";" << endl
3305 << "static const char qt_configure_demos_path_str [512 + 12] = \"qt_demopath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/demos", true) <<"\";" << endl
3306 << "#endif //QT_BOOTSTRAPPED" << endl;
3307 }
3308 tmpStream << "/* strlen( \"qt_lcnsxxxx\") == 12 */" << endl
3309 << "#define QT_CONFIGURE_LICENSEE qt_configure_licensee_str + 12;" << endl
3310 << "#define QT_CONFIGURE_LICENSED_PRODUCTS qt_configure_licensed_products_str + 12;" << endl
3311 << "#define QT_CONFIGURE_PREFIX_PATH qt_configure_prefix_path_str + 12;" << endl
3312 << "#define QT_CONFIGURE_DOCUMENTATION_PATH qt_configure_documentation_path_str + 12;" << endl
3313 << "#define QT_CONFIGURE_HEADERS_PATH qt_configure_headers_path_str + 12;" << endl
3314 << "#define QT_CONFIGURE_LIBRARIES_PATH qt_configure_libraries_path_str + 12;" << endl
3315 << "#define QT_CONFIGURE_BINARIES_PATH qt_configure_binaries_path_str + 12;" << endl
3316 << "#define QT_CONFIGURE_PLUGINS_PATH qt_configure_plugins_path_str + 12;" << endl
3317 << "#define QT_CONFIGURE_IMPORTS_PATH qt_configure_imports_path_str + 12;" << endl
3318 << "#define QT_CONFIGURE_DATA_PATH qt_configure_data_path_str + 12;" << endl
3319 << "#define QT_CONFIGURE_TRANSLATIONS_PATH qt_configure_translations_path_str + 12;" << endl
3320 << "#define QT_CONFIGURE_EXAMPLES_PATH qt_configure_examples_path_str + 12;" << endl
3321 << "#define QT_CONFIGURE_DEMOS_PATH qt_configure_demos_path_str + 12;" << endl
3322 //<< "#define QT_CONFIGURE_SETTINGS_PATH qt_configure_settings_path_str + 12;" << endl
3323 << endl;
3324
3325 tmpStream.flush();
3326 tmpFile2.flush();
3327
3328 // Replace old qconfig.cpp with new one
3329 ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL);
3330 QFile::remove(outName);
3331 tmpFile2.copy(outName);
3332 tmpFile2.close();
3333 }
3334
3335 QTemporaryFile tmpFile3;
3336 if (tmpFile3.open()) {
3337 tmpStream.setDevice(&tmpFile3);
3338 tmpStream << "/* Evaluation license key */" << endl
3339 << "static const volatile char qt_eval_key_data [512 + 12] = \"qt_qevalkey=" << licenseInfo["LICENSEKEYEXT"] << "\";" << endl;
3340
3341 tmpStream.flush();
3342 tmpFile3.flush();
3343
3344 outName = buildPath + "/src/corelib/global/qconfig_eval.cpp";
3345 ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL);
3346 QFile::remove(outName);
3347
3348 if (dictionary["EDITION"] == "Evaluation" || qmakeDefines.contains("QT_EVAL"))
3349 tmpFile3.copy(outName);
3350 tmpFile3.close();
3351 }
3352}
3353#endif
3354
3355#if !defined(EVAL)
3356void Configure::displayConfig()
3357{
3358 // Give some feedback
3359 cout << "Environment:" << endl;
3360 QString env = QString::fromLocal8Bit(getenv("INCLUDE")).replace(QRegExp("[;,]"), "\r\n ");
3361 if (env.isEmpty())
3362 env = "Unset";
3363 cout << " INCLUDE=\r\n " << env << endl;
3364 env = QString::fromLocal8Bit(getenv("LIB")).replace(QRegExp("[;,]"), "\r\n ");
3365 if (env.isEmpty())
3366 env = "Unset";
3367 cout << " LIB=\r\n " << env << endl;
3368 env = QString::fromLocal8Bit(getenv("PATH")).replace(QRegExp("[;,]"), "\r\n ");
3369 if (env.isEmpty())
3370 env = "Unset";
3371 cout << " PATH=\r\n " << env << endl;
3372
3373 if (dictionary["EDITION"] == "OpenSource") {
3374 cout << "You are licensed to use this software under the terms of the GNU GPL version 3.";
3375 cout << "You are licensed to use this software under the terms of the Lesser GNU LGPL version 2.1." << endl;
3376 cout << "See " << dictionary["LICENSE FILE"] << "3" << endl << endl
3377 << " or " << dictionary["LICENSE FILE"] << "L" << endl << endl;
3378 } else {
3379 QString l1 = licenseInfo[ "LICENSEE" ];
3380 QString l2 = licenseInfo[ "LICENSEID" ];
3381 QString l3 = dictionary["EDITION"] + ' ' + "Edition";
3382 QString l4 = licenseInfo[ "EXPIRYDATE" ];
3383 cout << "Licensee...................." << (l1.isNull() ? "" : l1) << endl;
3384 cout << "License ID.................." << (l2.isNull() ? "" : l2) << endl;
3385 cout << "Product license............." << (l3.isNull() ? "" : l3) << endl;
3386 cout << "Expiry Date................." << (l4.isNull() ? "" : l4) << endl << endl;
3387 }
3388
3389 cout << "Configuration:" << endl;
3390 cout << " " << qmakeConfig.join("\r\n ") << endl;
3391 cout << "Qt Configuration:" << endl;
3392 cout << " " << qtConfig.join("\r\n ") << endl;
3393 cout << endl;
3394
3395 if (dictionary.contains("XQMAKESPEC"))
3396 cout << "QMAKESPEC..................." << dictionary[ "XQMAKESPEC" ] << " (" << dictionary["QMAKESPEC_FROM"] << ")" << endl;
3397 else
3398 cout << "QMAKESPEC..................." << dictionary[ "QMAKESPEC" ] << " (" << dictionary["QMAKESPEC_FROM"] << ")" << endl;
3399 cout << "Architecture................" << dictionary[ "ARCHITECTURE" ] << endl;
3400 cout << "Maketool...................." << dictionary[ "MAKE" ] << endl;
3401 cout << "Debug symbols..............." << (dictionary[ "BUILD" ] == "debug" ? "yes" : "no") << endl;
3402 cout << "Link Time Code Generation..." << dictionary[ "LTCG" ] << endl;
3403 cout << "Accessibility support......." << dictionary[ "ACCESSIBILITY" ] << endl;
3404 cout << "STL support................." << dictionary[ "STL" ] << endl;
3405 cout << "Exception support..........." << dictionary[ "EXCEPTIONS" ] << endl;
3406 cout << "RTTI support................" << dictionary[ "RTTI" ] << endl;
3407 cout << "MMX support................." << dictionary[ "MMX" ] << endl;
3408 cout << "3DNOW support..............." << dictionary[ "3DNOW" ] << endl;
3409 cout << "SSE support................." << dictionary[ "SSE" ] << endl;
3410 cout << "SSE2 support................" << dictionary[ "SSE2" ] << endl;
3411 cout << "IWMMXT support.............." << dictionary[ "IWMMXT" ] << endl;
3412 cout << "OpenGL support.............." << dictionary[ "OPENGL" ] << endl;
3413 cout << "OpenVG support.............." << dictionary[ "OPENVG" ] << endl;
3414 cout << "OpenSSL support............." << dictionary[ "OPENSSL" ] << endl;
3415 cout << "QtDBus support.............." << dictionary[ "DBUS" ] << endl;
3416 cout << "QtXmlPatterns support......." << dictionary[ "XMLPATTERNS" ] << endl;
3417 cout << "Phonon support.............." << dictionary[ "PHONON" ] << endl;
3418 cout << "QtMultimedia support........" << dictionary[ "MULTIMEDIA" ] << endl;
3419 {
3420 QString webkit = dictionary[ "WEBKIT" ];
3421 if (webkit == "debug")
3422 webkit = "yes (debug)";
3423 cout << "WebKit support.............." << webkit << endl;
3424 }
3425 cout << "Declarative support........." << dictionary[ "DECLARATIVE" ] << endl;
3426 cout << "Declarative debugging......." << dictionary[ "DECLARATIVE_DEBUG" ] << endl;
3427 cout << "QtScript support............" << dictionary[ "SCRIPT" ] << endl;
3428 cout << "QtScriptTools support......." << dictionary[ "SCRIPTTOOLS" ] << endl;
3429 cout << "Graphics System............." << dictionary[ "GRAPHICS_SYSTEM" ] << endl;
3430 cout << "Qt3 compatibility..........." << dictionary[ "QT3SUPPORT" ] << endl << endl;
3431
3432 cout << "Third Party Libraries:" << endl;
3433 cout << " ZLIB support............" << dictionary[ "ZLIB" ] << endl;
3434 cout << " GIF support............." << dictionary[ "GIF" ] << endl;
3435 cout << " TIFF support............" << dictionary[ "TIFF" ] << endl;
3436 cout << " JPEG support............" << dictionary[ "JPEG" ] << endl;
3437 cout << " PNG support............." << dictionary[ "PNG" ] << endl;
3438 cout << " MNG support............." << dictionary[ "MNG" ] << endl;
3439 cout << " FreeType support........" << dictionary[ "FREETYPE" ] << endl << endl;
3440
3441 cout << "Styles:" << endl;
3442 cout << " Windows................." << dictionary[ "STYLE_WINDOWS" ] << endl;
3443 cout << " Windows XP.............." << dictionary[ "STYLE_WINDOWSXP" ] << endl;
3444 cout << " Windows Vista..........." << dictionary[ "STYLE_WINDOWSVISTA" ] << endl;
3445 cout << " Plastique..............." << dictionary[ "STYLE_PLASTIQUE" ] << endl;
3446 cout << " Cleanlooks.............." << dictionary[ "STYLE_CLEANLOOKS" ] << endl;
3447 cout << " Motif..................." << dictionary[ "STYLE_MOTIF" ] << endl;
3448 cout << " CDE....................." << dictionary[ "STYLE_CDE" ] << endl;
3449 cout << " Windows CE.............." << dictionary[ "STYLE_WINDOWSCE" ] << endl;
3450 cout << " Windows Mobile.........." << dictionary[ "STYLE_WINDOWSMOBILE" ] << endl;
3451 cout << " S60....................." << dictionary[ "STYLE_S60" ] << endl << endl;
3452
3453 cout << "Sql Drivers:" << endl;
3454 cout << " ODBC...................." << dictionary[ "SQL_ODBC" ] << endl;
3455 cout << " MySQL..................." << dictionary[ "SQL_MYSQL" ] << endl;
3456 cout << " OCI....................." << dictionary[ "SQL_OCI" ] << endl;
3457 cout << " PostgreSQL.............." << dictionary[ "SQL_PSQL" ] << endl;
3458 cout << " TDS....................." << dictionary[ "SQL_TDS" ] << endl;
3459 cout << " DB2....................." << dictionary[ "SQL_DB2" ] << endl;
3460 cout << " SQLite.................." << dictionary[ "SQL_SQLITE" ] << " (" << dictionary[ "SQL_SQLITE_LIB" ] << ")" << endl;
3461 cout << " SQLite2................." << dictionary[ "SQL_SQLITE2" ] << endl;
3462 cout << " InterBase..............." << dictionary[ "SQL_IBASE" ] << endl << endl;
3463
3464 cout << "Sources are in.............." << dictionary[ "QT_SOURCE_TREE" ] << endl;
3465 cout << "Build is done in............" << dictionary[ "QT_BUILD_TREE" ] << endl;
3466 cout << "Install prefix.............." << dictionary[ "QT_INSTALL_PREFIX" ] << endl;
3467 cout << "Headers installed to........" << dictionary[ "QT_INSTALL_HEADERS" ] << endl;
3468 cout << "Libraries installed to......" << dictionary[ "QT_INSTALL_LIBS" ] << endl;
3469 cout << "Plugins installed to........" << dictionary[ "QT_INSTALL_PLUGINS" ] << endl;
3470 cout << "Imports installed to........" << dictionary[ "QT_INSTALL_IMPORTS" ] << endl;
3471 cout << "Binaries installed to......." << dictionary[ "QT_INSTALL_BINS" ] << endl;
3472 cout << "Docs installed to..........." << dictionary[ "QT_INSTALL_DOCS" ] << endl;
3473 cout << "Data installed to..........." << dictionary[ "QT_INSTALL_DATA" ] << endl;
3474 cout << "Translations installed to..." << dictionary[ "QT_INSTALL_TRANSLATIONS" ] << endl;
3475 cout << "Examples installed to......." << dictionary[ "QT_INSTALL_EXAMPLES" ] << endl;
3476 cout << "Demos installed to.........." << dictionary[ "QT_INSTALL_DEMOS" ] << endl << endl;
3477
3478 if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith(QLatin1String("wince"))) {
3479 cout << "Using c runtime detection..." << dictionary[ "CE_CRT" ] << endl;
3480 cout << "Cetest support.............." << dictionary[ "CETEST" ] << endl;
3481 cout << "Signature..................." << dictionary[ "CE_SIGNATURE"] << endl << endl;
3482 }
3483
3484 if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith(QLatin1String("symbian"))) {
3485 cout << "Support for S60............." << dictionary[ "S60" ] << endl;
3486 }
3487
3488 if (dictionary.contains("SYMBIAN_DEFFILES")) {
3489 cout << "Symbian DEF files enabled..." << dictionary[ "SYMBIAN_DEFFILES" ] << endl;
3490 if (dictionary["SYMBIAN_DEFFILES"] == "no") {
3491 cout << "WARNING: Disabling DEF files will mean that Qt is NOT binary compatible with previous versions." << endl;
3492 cout << " This feature is only intended for use during development, NEVER for release builds." << endl;
3493 }
3494 }
3495
3496 if (dictionary["ASSISTANT_WEBKIT"] == "yes")
3497 cout << "Using WebKit as html rendering engine in Qt Assistant." << endl;
3498
3499 if (checkAvailability("INCREDIBUILD_XGE"))
3500 cout << "Using IncrediBuild XGE......" << dictionary["INCREDIBUILD_XGE"] << endl;
3501 if (!qmakeDefines.isEmpty()) {
3502 cout << "Defines.....................";
3503 for (QStringList::Iterator defs = qmakeDefines.begin(); defs != qmakeDefines.end(); ++defs)
3504 cout << (*defs) << " ";
3505 cout << endl;
3506 }
3507 if (!qmakeIncludes.isEmpty()) {
3508 cout << "Include paths...............";
3509 for (QStringList::Iterator incs = qmakeIncludes.begin(); incs != qmakeIncludes.end(); ++incs)
3510 cout << (*incs) << " ";
3511 cout << endl;
3512 }
3513 if (!qmakeLibs.isEmpty()) {
3514 cout << "Additional libraries........";
3515 for (QStringList::Iterator libs = qmakeLibs.begin(); libs != qmakeLibs.end(); ++libs)
3516 cout << (*libs) << " ";
3517 cout << endl;
3518 }
3519 if (dictionary[ "QMAKE_INTERNAL" ] == "yes") {
3520 cout << "Using internal configuration." << endl;
3521 }
3522 if (dictionary[ "SHARED" ] == "no") {
3523 cout << "WARNING: Using static linking will disable the use of plugins." << endl;
3524 cout << " Make sure you compile ALL needed modules into the library." << endl;
3525 }
3526 if (dictionary[ "OPENSSL" ] == "linked" && opensslLibs.isEmpty()) {
3527 cout << "NOTE: When linking against OpenSSL, you can override the default" << endl;
3528 cout << "library names through OPENSSL_LIBS." << endl;
3529 cout << "For example:" << endl;
3530 cout << " configure -openssl-linked OPENSSL_LIBS=\"-lssleay32 -llibeay32\"" << endl;
3531 }
3532 if (dictionary[ "ZLIB_FORCED" ] == "yes") {
3533 QString which_zlib = "supplied";
3534 if (dictionary[ "ZLIB" ] == "system")
3535 which_zlib = "system";
3536
3537 cout << "NOTE: The -no-zlib option was supplied but is no longer supported." << endl
3538 << endl
3539 << "Qt now requires zlib support in all builds, so the -no-zlib" << endl
3540 << "option was ignored. Qt will be built using the " << which_zlib
3541 << "zlib" << endl;
3542 }
3543}
3544#endif
3545
3546#if !defined(EVAL)
3547void Configure::generateHeaders()
3548{
3549 if (dictionary["SYNCQT"] == "yes"
3550 && findFile("perl.exe")) {
3551 cout << "Running syncqt..." << endl;
3552 QStringList args;
3553 args += buildPath + "/bin/syncqt.bat";
3554 QStringList env;
3555 env += QString("QTDIR=" + sourcePath);
3556 env += QString("PATH=" + buildPath + "/bin/;" + qgetenv("PATH"));
3557 Environment::execute(args, env, QStringList());
3558 }
3559}
3560
3561void Configure::buildQmake()
3562{
3563 if (dictionary[ "BUILD_QMAKE" ] == "yes") {
3564 QStringList args;
3565
3566 // Build qmake
3567 QString pwd = QDir::currentPath();
3568 QDir::setCurrent(buildPath + "/qmake");
3569
3570 QString makefile = "Makefile";
3571 {
3572 QFile out(makefile);
3573 if (out.open(QFile::WriteOnly | QFile::Text)) {
3574 QTextStream stream(&out);
3575 stream << "#AutoGenerated by configure.exe" << endl
3576 << "BUILD_PATH = " << QDir::convertSeparators(buildPath) << endl
3577 << "SOURCE_PATH = " << QDir::convertSeparators(sourcePath) << endl;
3578 stream << "QMAKESPEC = " << dictionary["QMAKESPEC"] << endl;
3579
3580 if (dictionary["EDITION"] == "OpenSource" ||
3581 dictionary["QT_EDITION"].contains("OPENSOURCE"))
3582 stream << "QMAKE_OPENSOURCE_EDITION = yes" << endl;
3583 stream << "\n\n";
3584
3585 QFile in(sourcePath + "/qmake/" + dictionary["QMAKEMAKEFILE"]);
3586 if (in.open(QFile::ReadOnly | QFile::Text)) {
3587 QString d = in.readAll();
3588 //### need replaces (like configure.sh)? --Sam
3589 stream << d << endl;
3590 }
3591 stream.flush();
3592 out.close();
3593 }
3594 }
3595
3596 args += dictionary[ "MAKE" ];
3597 args += "-f";
3598 args += makefile;
3599
3600 cout << "Creating qmake..." << endl;
3601 int exitCode = Environment::execute(args, QStringList(), QStringList());
3602 if (exitCode) {
3603 args.clear();
3604 args += dictionary[ "MAKE" ];
3605 args += "-f";
3606 args += makefile;
3607 args += "clean";
3608 exitCode = Environment::execute(args, QStringList(), QStringList());
3609 if (exitCode) {
3610 cout << "Cleaning qmake failed, return code " << exitCode << endl << endl;
3611 dictionary[ "DONE" ] = "error";
3612 } else {
3613 args.clear();
3614 args += dictionary[ "MAKE" ];
3615 args += "-f";
3616 args += makefile;
3617 exitCode = Environment::execute(args, QStringList(), QStringList());
3618 if (exitCode) {
3619 cout << "Building qmake failed, return code " << exitCode << endl << endl;
3620 dictionary[ "DONE" ] = "error";
3621 }
3622 }
3623 }
3624 QDir::setCurrent(pwd);
3625 }
3626}
3627#endif
3628
3629void Configure::buildHostTools()
3630{
3631 if (dictionary[ "NOPROCESS" ] == "yes")
3632 dictionary[ "DONE" ] = "yes";
3633
3634 if (!dictionary.contains("XQMAKESPEC"))
3635 return;
3636
3637 QString pwd = QDir::currentPath();
3638 QStringList hostToolsDirs;
3639 hostToolsDirs
3640 << "src/tools"
3641 << "tools/linguist/lrelease";
3642
3643 if (dictionary["XQMAKESPEC"].startsWith("wince"))
3644 hostToolsDirs << "tools/checksdk";
3645
3646 if (dictionary[ "CETEST" ] == "yes")
3647 hostToolsDirs << "tools/qtestlib/wince/cetest";
3648
3649 for (int i = 0; i < hostToolsDirs.count(); ++i) {
3650 cout << "Creating " << hostToolsDirs.at(i) << " ..." << endl;
3651 QString toolBuildPath = buildPath + "/" + hostToolsDirs.at(i);
3652 QString toolSourcePath = sourcePath + "/" + hostToolsDirs.at(i);
3653
3654 // generate Makefile
3655 QStringList args;
3656 args << QDir::toNativeSeparators(buildPath + "/bin/qmake");
3657 // override .qmake.cache because we are not cross-building these.
3658 // we need a full path so that a build with -prefix will still find it.
3659 args << "-spec" << QDir::toNativeSeparators(buildPath + "/mkspecs/" + dictionary["QMAKESPEC"]);
3660 args << "-r";
3661 args << "-o" << QDir::toNativeSeparators(toolBuildPath + "/Makefile");
3662
3663 QDir().mkpath(toolBuildPath);
3664 QDir::setCurrent(toolSourcePath);
3665 int exitCode = Environment::execute(args, QStringList(), QStringList());
3666 if (exitCode) {
3667 cout << "qmake failed, return code " << exitCode << endl << endl;
3668 dictionary["DONE"] = "error";
3669 break;
3670 }
3671
3672 // build app
3673 args.clear();
3674 args += dictionary["MAKE"];
3675 QDir::setCurrent(toolBuildPath);
3676 exitCode = Environment::execute(args, QStringList(), QStringList());
3677 if (exitCode) {
3678 args.clear();
3679 args += dictionary["MAKE"];
3680 args += "clean";
3681 exitCode = Environment::execute(args, QStringList(), QStringList());
3682 if (exitCode) {
3683 cout << "Cleaning " << hostToolsDirs.at(i) << " failed, return code " << exitCode << endl << endl;
3684 dictionary["DONE"] = "error";
3685 break;
3686 } else {
3687 args.clear();
3688 args += dictionary["MAKE"];
3689 exitCode = Environment::execute(args, QStringList(), QStringList());
3690 if (exitCode) {
3691 cout << "Building " << hostToolsDirs.at(i) << " failed, return code " << exitCode << endl << endl;
3692 dictionary["DONE"] = "error";
3693 break;
3694 }
3695 }
3696 }
3697 }
3698 QDir::setCurrent(pwd);
3699}
3700
3701void Configure::findProjects(const QString& dirName)
3702{
3703 if (dictionary[ "NOPROCESS" ] == "no") {
3704 QDir dir(dirName);
3705 QString entryName;
3706 int makeListNumber;
3707 ProjectType qmakeTemplate;
3708 const QFileInfoList &list = dir.entryInfoList(QStringList(QLatin1String("*.pro")),
3709 QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
3710 for (int i = 0; i < list.size(); ++i) {
3711 const QFileInfo &fi = list.at(i);
3712 if (fi.fileName() != "qmake.pro") {
3713 entryName = dirName + "/" + fi.fileName();
3714 if (fi.isDir()) {
3715 findProjects(entryName);
3716 } else {
3717 qmakeTemplate = projectType(fi.absoluteFilePath());
3718 switch (qmakeTemplate) {
3719 case Lib:
3720 case Subdirs:
3721 makeListNumber = 1;
3722 break;
3723 default:
3724 makeListNumber = 2;
3725 break;
3726 }
3727 makeList[makeListNumber].append(new MakeItem(sourceDir.relativeFilePath(fi.absolutePath()),
3728 fi.fileName(),
3729 "Makefile",
3730 qmakeTemplate));
3731 }
3732 }
3733
3734 }
3735 }
3736}
3737
3738void Configure::appendMakeItem(int inList, const QString &item)
3739{
3740 QString dir;
3741 if (item != "src")
3742 dir = "/" + item;
3743 dir.prepend("/src");
3744 makeList[inList].append(new MakeItem(sourcePath + dir,
3745 item + ".pro", buildPath + dir + "/Makefile", Lib));
3746 if (dictionary[ "DSPFILES" ] == "yes") {
3747 makeList[inList].append(new MakeItem(sourcePath + dir,
3748 item + ".pro", buildPath + dir + "/" + item + ".dsp", Lib));
3749 }
3750 if (dictionary[ "VCPFILES" ] == "yes") {
3751 makeList[inList].append(new MakeItem(sourcePath + dir,
3752 item + ".pro", buildPath + dir + "/" + item + ".vcp", Lib));
3753 }
3754 if (dictionary[ "VCPROJFILES" ] == "yes") {
3755 makeList[inList].append(new MakeItem(sourcePath + dir,
3756 item + ".pro", buildPath + dir + "/" + item + ".vcproj", Lib));
3757 }
3758}
3759
3760void Configure::generateMakefiles()
3761{
3762 if (dictionary[ "NOPROCESS" ] == "no") {
3763#if !defined(EVAL)
3764 cout << "Creating makefiles in src..." << endl;
3765#endif
3766
3767 QString spec = dictionary.contains("XQMAKESPEC") ? dictionary[ "XQMAKESPEC" ] : dictionary[ "QMAKESPEC" ];
3768 if (spec != "win32-msvc")
3769 dictionary[ "DSPFILES" ] = "no";
3770
3771 if (spec != "win32-msvc.net" && !spec.startsWith("win32-msvc2") && !spec.startsWith(QLatin1String("wince")))
3772 dictionary[ "VCPROJFILES" ] = "no";
3773
3774 int i = 0;
3775 QString pwd = QDir::currentPath();
3776 if (dictionary["FAST"] != "yes") {
3777 QString dirName;
3778 bool generate = true;
3779 bool doDsp = (dictionary["DSPFILES"] == "yes" || dictionary["VCPFILES"] == "yes"
3780 || dictionary["VCPROJFILES"] == "yes");
3781 while (generate) {
3782 QString pwd = QDir::currentPath();
3783 QString dirPath = fixSeparators(buildPath + dirName);
3784 QStringList args;
3785
3786 args << fixSeparators(buildPath + "/bin/qmake");
3787
3788 if (doDsp) {
3789 if (dictionary[ "DEPENDENCIES" ] == "no")
3790 args << "-nodepend";
3791 args << "-tp" << "vc";
3792 doDsp = false; // DSP files will be done
3793 printf("Generating Visual Studio project files...\n");
3794 } else {
3795 printf("Generating Makefiles...\n");
3796 generate = false; // Now Makefiles will be done
3797 }
3798 // don't pass -spec - .qmake.cache has it already
3799 args << "-r";
3800 args << (sourcePath + "/projects.pro");
3801 args << "-o";
3802 args << buildPath;
3803 if (!dictionary[ "QMAKEADDITIONALARGS" ].isEmpty())
3804 args << dictionary[ "QMAKEADDITIONALARGS" ];
3805
3806 QDir::setCurrent(fixSeparators(dirPath));
3807 if (int exitCode = Environment::execute(args, QStringList(), QStringList())) {
3808 cout << "Qmake failed, return code " << exitCode << endl << endl;
3809 dictionary[ "DONE" ] = "error";
3810 }
3811 }
3812 } else {
3813 findProjects(sourcePath);
3814 for (i=0; i<3; i++) {
3815 for (int j=0; j<makeList[i].size(); ++j) {
3816 MakeItem *it=makeList[i][j];
3817 QString dirPath = fixSeparators(it->directory + "/");
3818 QString projectName = it->proFile;
3819 QString makefileName = buildPath + "/" + dirPath + it->target;
3820
3821 // For shadowbuilds, we need to create the path first
3822 QDir buildPathDir(buildPath);
3823 if (sourcePath != buildPath && !buildPathDir.exists(dirPath))
3824 buildPathDir.mkpath(dirPath);
3825
3826 QStringList args;
3827
3828 args << fixSeparators(buildPath + "/bin/qmake");
3829 args << sourcePath + "/" + dirPath + projectName;
3830 args << dictionary[ "QMAKE_ALL_ARGS" ];
3831
3832 cout << "For " << qPrintable(dirPath + projectName) << endl;
3833 args << "-o";
3834 args << it->target;
3835 args << "-spec";
3836 args << spec;
3837 if (!dictionary[ "QMAKEADDITIONALARGS" ].isEmpty())
3838 args << dictionary[ "QMAKEADDITIONALARGS" ];
3839
3840 QDir::setCurrent(fixSeparators(dirPath));
3841
3842 QFile file(makefileName);
3843 if (!file.open(QFile::WriteOnly)) {
3844 printf("failed on dirPath=%s, makefile=%s\n",
3845 qPrintable(dirPath), qPrintable(makefileName));
3846 continue;
3847 }
3848 QTextStream txt(&file);
3849 txt << "all:\n";
3850 txt << "\t" << args.join(" ") << "\n";
3851 txt << "\t\"$(MAKE)\" -$(MAKEFLAGS) -f " << it->target << "\n";
3852 txt << "first: all\n";
3853 txt << "qmake:\n";
3854 txt << "\t" << args.join(" ") << "\n";
3855 }
3856 }
3857 }
3858 QDir::setCurrent(pwd);
3859 } else {
3860 cout << "Processing of project files have been disabled." << endl;
3861 cout << "Only use this option if you really know what you're doing." << endl << endl;
3862 return;
3863 }
3864}
3865
3866void Configure::showSummary()
3867{
3868 QString make = dictionary[ "MAKE" ];
3869 if (!dictionary.contains("XQMAKESPEC")) {
3870 cout << endl << endl << "Qt is now configured for building. Just run " << qPrintable(make) << "." << endl;
3871 cout << "To reconfigure, run " << qPrintable(make) << " confclean and configure." << endl << endl;
3872 } else if (dictionary.value("QMAKESPEC").startsWith("wince")) {
3873 // we are cross compiling for Windows CE
3874 cout << endl << endl << "Qt is now configured for building. To start the build run:" << endl
3875 << "\tsetcepaths " << dictionary.value("XQMAKESPEC") << endl
3876 << "\t" << qPrintable(make) << endl
3877 << "To reconfigure, run " << qPrintable(make) << " confclean and configure." << endl << endl;
3878 } else { // Compiling for Symbian OS
3879 cout << endl << endl << "Qt is now configured for building. To start the build run:" << qPrintable(dictionary["QTBUILDINSTRUCTION"]) << "." << endl
3880 << "To reconfigure, run '" << qPrintable(dictionary["CONFCLEANINSTRUCTION"]) << "' and configure." << endl;
3881 }
3882}
3883
3884Configure::ProjectType Configure::projectType(const QString& proFileName)
3885{
3886 QFile proFile(proFileName);
3887 if (proFile.open(QFile::ReadOnly)) {
3888 QString buffer = proFile.readLine(1024);
3889 while (!buffer.isEmpty()) {
3890 QStringList segments = buffer.split(QRegExp("\\s"));
3891 QStringList::Iterator it = segments.begin();
3892
3893 if (segments.size() >= 3) {
3894 QString keyword = (*it++);
3895 QString operation = (*it++);
3896 QString value = (*it++);
3897
3898 if (keyword == "TEMPLATE") {
3899 if (value == "lib")
3900 return Lib;
3901 else if (value == "subdirs")
3902 return Subdirs;
3903 }
3904 }
3905 // read next line
3906 buffer = proFile.readLine(1024);
3907 }
3908 proFile.close();
3909 }
3910 // Default to app handling
3911 return App;
3912}
3913
3914#if !defined(EVAL)
3915
3916bool Configure::showLicense(QString orgLicenseFile)
3917{
3918 if (dictionary["LICENSE_CONFIRMED"] == "yes") {
3919 cout << "You have already accepted the terms of the license." << endl << endl;
3920 return true;
3921 }
3922
3923 bool haveGpl3 = false;
3924 QString licenseFile = orgLicenseFile;
3925 QString theLicense;
3926 if (dictionary["EDITION"] == "OpenSource" || dictionary["EDITION"] == "Snapshot") {
3927 haveGpl3 = QFile::exists(orgLicenseFile + "/LICENSE.GPL3");
3928 theLicense = "GNU Lesser General Public License (LGPL) version 2.1";
3929 if (haveGpl3)
3930 theLicense += "\nor the GNU General Public License (GPL) version 3";
3931 } else {
3932 // the first line of the license file tells us which license it is
3933 QFile file(licenseFile);
3934 if (!file.open(QFile::ReadOnly)) {
3935 cout << "Failed to load LICENSE file" << endl;
3936 return false;
3937 }
3938 theLicense = file.readLine().trimmed();
3939 }
3940
3941 forever {
3942 char accept = '?';
3943 cout << "You are licensed to use this software under the terms of" << endl
3944 << "the " << theLicense << "." << endl
3945 << endl;
3946 if (dictionary["EDITION"] == "OpenSource" || dictionary["EDITION"] == "Snapshot") {
3947 if (haveGpl3)
3948 cout << "Type '3' to view the GNU General Public License version 3 (GPLv3)." << endl;
3949 cout << "Type 'L' to view the Lesser GNU General Public License version 2.1 (LGPLv2.1)." << endl;
3950 } else {
3951 cout << "Type '?' to view the " << theLicense << "." << endl;
3952 }
3953 cout << "Type 'y' to accept this license offer." << endl
3954 << "Type 'n' to decline this license offer." << endl
3955 << endl
3956 << "Do you accept the terms of the license?" << endl;
3957 cin >> accept;
3958 accept = tolower(accept);
3959
3960 if (accept == 'y') {
3961 return true;
3962 } else if (accept == 'n') {
3963 return false;
3964 } else {
3965 if (dictionary["EDITION"] == "OpenSource" || dictionary["EDITION"] == "Snapshot") {
3966 if (accept == '3')
3967 licenseFile = orgLicenseFile + "/LICENSE.GPL3";
3968 else
3969 licenseFile = orgLicenseFile + "/LICENSE.LGPL";
3970 }
3971 // Get console line height, to fill the screen properly
3972 int i = 0, screenHeight = 25; // default
3973 CONSOLE_SCREEN_BUFFER_INFO consoleInfo;
3974 HANDLE stdOut = GetStdHandle(STD_OUTPUT_HANDLE);
3975 if (GetConsoleScreenBufferInfo(stdOut, &consoleInfo))
3976 screenHeight = consoleInfo.srWindow.Bottom
3977 - consoleInfo.srWindow.Top
3978 - 1; // Some overlap for context
3979
3980 // Prompt the license content to the user
3981 QFile file(licenseFile);
3982 if (!file.open(QFile::ReadOnly)) {
3983 cout << "Failed to load LICENSE file" << licenseFile << endl;
3984 return false;
3985 }
3986 QStringList licenseContent = QString(file.readAll()).split('\n');
3987 while (i < licenseContent.size()) {
3988 cout << licenseContent.at(i) << endl;
3989 if (++i % screenHeight == 0) {
3990 cout << "(Press any key for more..)";
3991 if (_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
3992 exit(0); // Exit cleanly for Ctrl+C
3993 cout << "\r"; // Overwrite text above
3994 }
3995 }
3996 }
3997 }
3998}
3999
4000void Configure::readLicense()
4001{
4002 if (QFile::exists(dictionary["QT_SOURCE_TREE"] + "/src/corelib/kernel/qfunctions_wince.h") &&
4003 (dictionary.value("QMAKESPEC").startsWith("wince") || dictionary.value("XQMAKESPEC").startsWith("wince")))
4004 dictionary["PLATFORM NAME"] = "Qt for Windows CE";
4005 else if (dictionary.value("XQMAKESPEC").startsWith("symbian"))
4006 dictionary["PLATFORM NAME"] = "Qt for Symbian";
4007 else
4008 dictionary["PLATFORM NAME"] = "Qt for Windows";
4009 dictionary["LICENSE FILE"] = sourcePath;
4010
4011 bool openSource = false;
4012 bool hasOpenSource = QFile::exists(dictionary["LICENSE FILE"] + "/LICENSE.GPL3") || QFile::exists(dictionary["LICENSE FILE"] + "/LICENSE.LGPL");
4013 if (dictionary["BUILDNOKIA"] == "yes" || dictionary["BUILDTYPE"] == "commercial") {
4014 openSource = false;
4015 } else if (dictionary["BUILDTYPE"] == "opensource") {
4016 openSource = true;
4017 } else if (hasOpenSource) { // No Open Source? Just display the commercial license right away
4018 forever {
4019 char accept = '?';
4020 cout << "Which edition of Qt do you want to use ?" << endl;
4021 cout << "Type 'c' if you want to use the Commercial Edition." << endl;
4022 cout << "Type 'o' if you want to use the Open Source Edition." << endl;
4023 cin >> accept;
4024 accept = tolower(accept);
4025
4026 if (accept == 'c') {
4027 openSource = false;
4028 break;
4029 } else if (accept == 'o') {
4030 openSource = true;
4031 break;
4032 }
4033 }
4034 }
4035 if (hasOpenSource && openSource) {
4036 cout << endl << "This is the " << dictionary["PLATFORM NAME"] << " Open Source Edition." << endl;
4037 licenseInfo["LICENSEE"] = "Open Source";
4038 dictionary["EDITION"] = "OpenSource";
4039 dictionary["QT_EDITION"] = "QT_EDITION_OPENSOURCE";
4040 cout << endl;
4041 if (!showLicense(dictionary["LICENSE FILE"])) {
4042 cout << "Configuration aborted since license was not accepted";
4043 dictionary["DONE"] = "error";
4044 return;
4045 }
4046 } else if (openSource) {
4047 cout << endl << "Cannot find the GPL license files! Please download the Open Source version of the library." << endl;
4048 dictionary["DONE"] = "error";
4049 }
4050#ifdef COMMERCIAL_VERSION
4051 else {
4052 Tools::checkLicense(dictionary, licenseInfo, firstLicensePath());
4053 if (dictionary["DONE"] != "error" && dictionary["BUILDNOKIA"] != "yes") {
4054 // give the user some feedback, and prompt for license acceptance
4055 cout << endl << "This is the " << dictionary["PLATFORM NAME"] << " " << dictionary["EDITION"] << " Edition."<< endl << endl;
4056 if (!showLicense(dictionary["LICENSE FILE"])) {
4057 cout << "Configuration aborted since license was not accepted";
4058 dictionary["DONE"] = "error";
4059 return;
4060 }
4061 }
4062 }
4063#else // !COMMERCIAL_VERSION
4064 else {
4065 cout << endl << "Cannot build commercial edition from the open source version of the library." << endl;
4066 dictionary["DONE"] = "error";
4067 }
4068#endif
4069}
4070
4071void Configure::reloadCmdLine()
4072{
4073 if (dictionary[ "REDO" ] == "yes") {
4074 QFile inFile(buildPath + "/configure" + dictionary[ "CUSTOMCONFIG" ] + ".cache");
4075 if (inFile.open(QFile::ReadOnly)) {
4076 QTextStream inStream(&inFile);
4077 QString buffer;
4078 inStream >> buffer;
4079 while (buffer.length()) {
4080 configCmdLine += buffer;
4081 inStream >> buffer;
4082 }
4083 inFile.close();
4084 }
4085 }
4086}
4087
4088void Configure::saveCmdLine()
4089{
4090 if (dictionary[ "REDO" ] != "yes") {
4091 QFile outFile(buildPath + "/configure" + dictionary[ "CUSTOMCONFIG" ] + ".cache");
4092 if (outFile.open(QFile::WriteOnly | QFile::Text)) {
4093 QTextStream outStream(&outFile);
4094 for (QStringList::Iterator it = configCmdLine.begin(); it != configCmdLine.end(); ++it) {
4095 outStream << (*it) << " " << endl;
4096 }
4097 outStream.flush();
4098 outFile.close();
4099 }
4100 }
4101}
4102#endif // !EVAL
4103
4104bool Configure::isDone()
4105{
4106 return !dictionary["DONE"].isEmpty();
4107}
4108
4109bool Configure::isOk()
4110{
4111 return (dictionary[ "DONE" ] != "error");
4112}
4113
4114bool
4115Configure::filesDiffer(const QString &fn1, const QString &fn2)
4116{
4117 QFile file1(fn1), file2(fn2);
4118 if (!file1.open(QFile::ReadOnly) || !file2.open(QFile::ReadOnly))
4119 return true;
4120 const int chunk = 2048;
4121 int used1 = 0, used2 = 0;
4122 char b1[chunk], b2[chunk];
4123 while (!file1.atEnd() && !file2.atEnd()) {
4124 if (!used1)
4125 used1 = file1.read(b1, chunk);
4126 if (!used2)
4127 used2 = file2.read(b2, chunk);
4128 if (used1 > 0 && used2 > 0) {
4129 const int cmp = qMin(used1, used2);
4130 if (memcmp(b1, b2, cmp))
4131 return true;
4132 if ((used1 -= cmp))
4133 memcpy(b1, b1+cmp, used1);
4134 if ((used2 -= cmp))
4135 memcpy(b2, b2+cmp, used2);
4136 }
4137 }
4138 return !file1.atEnd() || !file2.atEnd();
4139}
4140
4141QT_END_NAMESPACE
Note: See TracBrowser for help on using the repository browser.