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

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

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

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