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

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

trunk: Merged in qt 4.6.1 sources.

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