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

Last change on this file since 651 was 651, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.6.2 sources.

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