Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into master-integration
[qt-netbsd.git] / tools / configure / configureapp.cpp
blob3defeab25cecb2fa4705713885a1ef6b5f95c5d7
1 /****************************************************************************
2 **
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
6 **
7 ** This file is part of the tools applications of the Qt Toolkit.
8 **
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** No Commercial Usage
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
14 ** this package.
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.
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.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
38 ** $QT_END_LICENSE$
40 ****************************************************************************/
42 #include "configureapp.h"
43 #include "environment.h"
44 #ifdef COMMERCIAL_VERSION
45 # include "tools.h"
46 #endif
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>
58 #include <iostream>
59 #include <windows.h>
60 #include <conio.h>
62 QT_BEGIN_NAMESPACE
64 std::ostream &operator<<( std::ostream &s, const QString &val ) {
65 s << val.toLocal8Bit().data();
66 return s;
70 using namespace std;
72 // Macros to simplify options marking
73 #define MARK_OPTION(x,y) ( dictionary[ #x ] == #y ? "*" : " " )
76 bool writeToFile(const char* text, const QString &filename)
78 QByteArray symFile(text);
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;
88 file.write(symFile);
89 return true;
92 Configure::Configure( int& argc, char** argv )
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;
110 ** Set up the initial state, the default
112 dictionary[ "CONFIGCMD" ] = argv[ 0 ];
114 for ( i = 1; i < argc; i++ )
115 configCmdLine += argv[ i ];
118 // Get the path to the executable
119 wchar_t module_name[MAX_PATH];
120 GetModuleFileName(0, module_name, sizeof(module_name) / sizeof(wchar_t));
121 QFileInfo sourcePathInfo = QString::fromWCharArray(module_name);
122 sourcePath = sourcePathInfo.absolutePath();
123 sourceDir = sourcePathInfo.dir();
124 buildPath = QDir::currentPath();
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
137 cout << "Preparing build tree..." << endl;
138 QDir(buildPath).mkpath("bin");
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);
173 if(justCopy && filesDiffer(inFile, outFile))
174 QFile::copy(inFile, outFile);
180 { //make a syncqt script(s) that can be used in the shadow
181 QFile syncqt(buildPath + "/bin/syncqt");
182 if(syncqt.open(QFile::WriteOnly)) {
183 QTextStream stream(&syncqt);
184 stream << "#!/usr/bin/perl -w" << endl
185 << "require \"" << sourcePath + "/bin/syncqt\";" << endl;
187 QFile syncqt_bat(buildPath + "/bin/syncqt.bat");
188 if(syncqt_bat.open(QFile::WriteOnly)) {
189 QTextStream stream(&syncqt_bat);
190 stream << "@echo off" << endl
191 << "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();
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");
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;
211 dictionary[ "QT_SOURCE_TREE" ] = fixSeparators(sourcePath);
212 dictionary[ "QT_BUILD_TREE" ] = fixSeparators(buildPath);
213 dictionary[ "QT_INSTALL_PREFIX" ] = fixSeparators(installPath);
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";
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";
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;
270 qglobal_h.close();
273 if (version.isEmpty())
274 version = QString("%1.%2.%3").arg(QT_VERSION>>16).arg(((QT_VERSION>>8)&0xff)).arg(QT_VERSION&0xff);
276 dictionary[ "VERSION" ] = version;
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);
286 dictionary[ "REDO" ] = "no";
287 dictionary[ "DEPENDENCIES" ] = "no";
289 dictionary[ "BUILD" ] = "debug";
290 dictionary[ "BUILDALL" ] = "auto"; // Means yes, but not explicitly
292 dictionary[ "BUILDTYPE" ] = "none";
294 dictionary[ "BUILDDEV" ] = "no";
295 dictionary[ "BUILDNOKIA" ] = "no";
297 dictionary[ "SHARED" ] = "yes";
299 dictionary[ "ZLIB" ] = "auto";
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";
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";
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";
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";
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 );
351 dictionary[ "QMAKESPEC" ] = tmp;
353 dictionary[ "INCREDIBUILD_XGE" ] = "auto";
354 dictionary[ "LTCG" ] = "no";
355 dictionary[ "NATIVE_GESTURES" ] = "yes";
358 Configure::~Configure()
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];
367 QString Configure::fixSeparators(QString somePath)
369 return useUnixSeparators ?
370 QDir::fromNativeSeparators(somePath) :
371 QDir::toNativeSeparators(somePath);
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..
378 QString Configure::firstLicensePath()
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();
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
398 void Configure::parseCmdLine()
400 int argCount = configCmdLine.size();
401 int i = 0;
403 #if !defined(EVAL)
404 if (argCount < 1) // skip rest if no arguments
406 else if( configCmdLine.at(i) == "-redo" ) {
407 dictionary[ "REDO" ] = "yes";
408 configCmdLine.clear();
409 reloadCmdLine();
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";
421 i = 0;
423 argCount = configCmdLine.size();
424 #endif
426 // Look first for XQMAKESPEC
427 for(int j = 0 ; j < argCount; ++j)
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();
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";
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);
454 else if ( configCmdLine.at(i) == "-buildkey" ) {
455 ++i;
456 if (i==argCount)
457 break;
458 dictionary[ "USER_BUILD_KEY" ] = configCmdLine.at(i);
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";
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";
486 else if( configCmdLine.at(i) == "-opensource" ) {
487 dictionary[ "BUILDTYPE" ] = "opensource";
489 else if( configCmdLine.at(i) == "-commercial" ) {
490 dictionary[ "BUILDTYPE" ] = "commercial";
492 else if( configCmdLine.at(i) == "-ltcg" ) {
493 dictionary[ "LTCG" ] = "yes";
495 else if( configCmdLine.at(i) == "-no-ltcg" ) {
496 dictionary[ "LTCG" ] = "no";
498 #endif
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
515 } else if( configCmdLine.at(i) == "-embedded" ) {
516 dictionary[ "EMBEDDED" ] = "yes";
517 } else if( configCmdLine.at(i) == "-xplatform") {
518 ++i;
519 // do nothing
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
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)
533 // There's no guarantee that Qt will build under those conditions
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";
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";
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";
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";
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";
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";
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";
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";
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";
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());
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";
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";
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";
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";
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";
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";
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";
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";
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";
685 // Qt 3 Support ---------------------------------------------
686 else if( configCmdLine.at(i) == "-no-qt3support" )
687 dictionary[ "QT3SUPPORT" ] = "no";
689 // Work around compiler nesting limitation
690 else
691 continueElse[1] = true;
692 if (!continueElse[1]) {
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";
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";
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";
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";
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";
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";
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";
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";
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";
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";
787 else if( configCmdLine.at(i) == "-no-vcp" )
788 dictionary[ "VCPFILES" ] = "no";
789 else if( configCmdLine.at(i) == "-vcp" )
790 dictionary[ "VCPFILES" ] = "yes";
792 else if( configCmdLine.at(i) == "-no-vcproj" )
793 dictionary[ "VCPROJFILES" ] = "no";
794 else if( configCmdLine.at(i) == "-vcproj" )
795 dictionary[ "VCPROJFILES" ] = "yes";
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" )
809 ++i;
810 if(i==argCount)
811 break;
812 dictionary[ "ARM_FPU_TYPE" ] = configCmdLine.at(i);
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";
821 else if (configCmdLine.at(i) == "-fast" )
822 dictionary[ "FAST" ] = "yes";
823 else if (configCmdLine.at(i) == "-no-fast" )
824 dictionary[ "FAST" ] = "no";
826 else if( configCmdLine.at(i) == "-stl" )
827 dictionary[ "STL" ] = "yes";
828 else if( configCmdLine.at(i) == "-no-stl" )
829 dictionary[ "STL" ] = "no";
831 else if ( configCmdLine.at(i) == "-exceptions" )
832 dictionary[ "EXCEPTIONS" ] = "yes";
833 else if ( configCmdLine.at(i) == "-no-exceptions" )
834 dictionary[ "EXCEPTIONS" ] = "no";
836 else if ( configCmdLine.at(i) == "-rtti" )
837 dictionary[ "RTTI" ] = "yes";
838 else if ( configCmdLine.at(i) == "-no-rtti" )
839 dictionary[ "RTTI" ] = "no";
841 else if( configCmdLine.at(i) == "-accessibility" )
842 dictionary[ "ACCESSIBILITY" ] = "yes";
843 else if( configCmdLine.at(i) == "-no-accessibility" ) {
844 dictionary[ "ACCESSIBILITY" ] = "no";
845 cout << "Setting accessibility to NO" << endl;
848 else if (configCmdLine.at(i) == "-no-mmx")
849 dictionary[ "MMX" ] = "no";
850 else if (configCmdLine.at(i) == "-mmx")
851 dictionary[ "MMX" ] = "yes";
852 else if (configCmdLine.at(i) == "-no-3dnow")
853 dictionary[ "3DNOW" ] = "no";
854 else if (configCmdLine.at(i) == "-3dnow")
855 dictionary[ "3DNOW" ] = "yes";
856 else if (configCmdLine.at(i) == "-no-sse")
857 dictionary[ "SSE" ] = "no";
858 else if (configCmdLine.at(i) == "-sse")
859 dictionary[ "SSE" ] = "yes";
860 else if (configCmdLine.at(i) == "-no-sse2")
861 dictionary[ "SSE2" ] = "no";
862 else if (configCmdLine.at(i) == "-sse2")
863 dictionary[ "SSE2" ] = "yes";
864 else if (configCmdLine.at(i) == "-no-iwmmxt")
865 dictionary[ "IWMMXT" ] = "no";
866 else if (configCmdLine.at(i) == "-iwmmxt")
867 dictionary[ "IWMMXT" ] = "yes";
869 else if( configCmdLine.at(i) == "-no-openssl" ) {
870 dictionary[ "OPENSSL"] = "no";
871 } else if( configCmdLine.at(i) == "-openssl" ) {
872 dictionary[ "OPENSSL" ] = "yes";
873 } else if( configCmdLine.at(i) == "-openssl-linked" ) {
874 dictionary[ "OPENSSL" ] = "linked";
875 } else if( configCmdLine.at(i) == "-no-qdbus" ) {
876 dictionary[ "DBUS" ] = "no";
877 } else if( configCmdLine.at(i) == "-qdbus" ) {
878 dictionary[ "DBUS" ] = "yes";
879 } else if( configCmdLine.at(i) == "-no-dbus" ) {
880 dictionary[ "DBUS" ] = "no";
881 } else if( configCmdLine.at(i) == "-dbus" ) {
882 dictionary[ "DBUS" ] = "yes";
883 } else if( configCmdLine.at(i) == "-dbus-linked" ) {
884 dictionary[ "DBUS" ] = "linked";
885 } else if( configCmdLine.at(i) == "-no-script" ) {
886 dictionary[ "SCRIPT" ] = "no";
887 } else if( configCmdLine.at(i) == "-script" ) {
888 dictionary[ "SCRIPT" ] = "yes";
889 } else if( configCmdLine.at(i) == "-no-scripttools" ) {
890 dictionary[ "SCRIPTTOOLS" ] = "no";
891 } else if( configCmdLine.at(i) == "-scripttools" ) {
892 dictionary[ "SCRIPTTOOLS" ] = "yes";
893 } else if( configCmdLine.at(i) == "-no-xmlpatterns" ) {
894 dictionary[ "XMLPATTERNS" ] = "no";
895 } else if( configCmdLine.at(i) == "-xmlpatterns" ) {
896 dictionary[ "XMLPATTERNS" ] = "yes";
897 } else if( configCmdLine.at(i) == "-no-multimedia" ) {
898 dictionary[ "MULTIMEDIA" ] = "no";
899 } else if( configCmdLine.at(i) == "-multimedia" ) {
900 dictionary[ "MULTIMEDIA" ] = "yes";
901 } else if( configCmdLine.at(i) == "-audio-backend" ) {
902 dictionary[ "AUDIO_BACKEND" ] = "yes";
903 } else if( configCmdLine.at(i) == "-no-audio-backend" ) {
904 dictionary[ "AUDIO_BACKEND" ] = "no";
905 } else if( configCmdLine.at(i) == "-no-phonon" ) {
906 dictionary[ "PHONON" ] = "no";
907 } else if( configCmdLine.at(i) == "-phonon" ) {
908 dictionary[ "PHONON" ] = "yes";
909 } else if( configCmdLine.at(i) == "-no-phonon-backend" ) {
910 dictionary[ "PHONON_BACKEND" ] = "no";
911 } else if( configCmdLine.at(i) == "-phonon-backend" ) {
912 dictionary[ "PHONON_BACKEND" ] = "yes";
913 } else if( configCmdLine.at(i) == "-phonon-wince-ds9" ) {
914 dictionary[ "DIRECTSHOW" ] = "yes";
915 } else if( configCmdLine.at(i) == "-no-webkit" ) {
916 dictionary[ "WEBKIT" ] = "no";
917 } else if( configCmdLine.at(i) == "-webkit" ) {
918 dictionary[ "WEBKIT" ] = "yes";
919 } else if( configCmdLine.at(i) == "-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";
929 // Work around compiler nesting limitation
930 else
931 continueElse[0] = true;
932 if (!continueElse[0]) {
935 else if( configCmdLine.at(i) == "-internal" )
936 dictionary[ "QMAKE_INTERNAL" ] = "yes";
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";
943 else if( configCmdLine.at(i) == "-dont-process" )
944 dictionary[ "NOPROCESS" ] = "yes";
945 else if( configCmdLine.at(i) == "-process" )
946 dictionary[ "NOPROCESS" ] = "no";
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";
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;
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);
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);
1001 else if( configCmdLine.at(i) == "-saveconfig" ) {
1002 ++i;
1003 if (i==argCount)
1004 break;
1005 dictionary[ "CUSTOMCONFIG" ] = "_" + configCmdLine.at(i);
1008 else if (configCmdLine.at(i) == "-confirm-license") {
1009 dictionary["LICENSE_CONFIRMED"] = "yes";
1012 else if (configCmdLine.at(i) == "-nomake") {
1013 ++i;
1014 if (i==argCount)
1015 break;
1016 disabledBuildParts += configCmdLine.at(i);
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);
1027 else if( configCmdLine.at(i) == "-bindir" ) {
1028 ++i;
1029 if(i==argCount)
1030 break;
1031 dictionary[ "QT_INSTALL_BINS" ] = configCmdLine.at(i);
1034 else if( configCmdLine.at(i) == "-libdir" ) {
1035 ++i;
1036 if(i==argCount)
1037 break;
1038 dictionary[ "QT_INSTALL_LIBS" ] = configCmdLine.at(i);
1041 else if( configCmdLine.at(i) == "-docdir" ) {
1042 ++i;
1043 if(i==argCount)
1044 break;
1045 dictionary[ "QT_INSTALL_DOCS" ] = configCmdLine.at(i);
1048 else if( configCmdLine.at(i) == "-headerdir" ) {
1049 ++i;
1050 if(i==argCount)
1051 break;
1052 dictionary[ "QT_INSTALL_HEADERS" ] = configCmdLine.at(i);
1055 else if( configCmdLine.at(i) == "-plugindir" ) {
1056 ++i;
1057 if(i==argCount)
1058 break;
1059 dictionary[ "QT_INSTALL_PLUGINS" ] = configCmdLine.at(i);
1062 else if( configCmdLine.at(i) == "-datadir" ) {
1063 ++i;
1064 if(i==argCount)
1065 break;
1066 dictionary[ "QT_INSTALL_DATA" ] = configCmdLine.at(i);
1069 else if( configCmdLine.at(i) == "-translationdir" ) {
1070 ++i;
1071 if(i==argCount)
1072 break;
1073 dictionary[ "QT_INSTALL_TRANSLATIONS" ] = configCmdLine.at(i);
1076 else if( configCmdLine.at(i) == "-examplesdir" ) {
1077 ++i;
1078 if(i==argCount)
1079 break;
1080 dictionary[ "QT_INSTALL_EXAMPLES" ] = configCmdLine.at(i);
1083 else if( configCmdLine.at(i) == "-demosdir" ) {
1084 ++i;
1085 if(i==argCount)
1086 break;
1087 dictionary[ "QT_INSTALL_DEMOS" ] = configCmdLine.at(i);
1090 else if( configCmdLine.at(i) == "-hostprefix" ) {
1091 ++i;
1092 if(i==argCount)
1093 break;
1094 dictionary[ "QT_HOST_PREFIX" ] = configCmdLine.at(i);
1097 else if( configCmdLine.at(i) == "-make" ) {
1098 ++i;
1099 if(i==argCount)
1100 break;
1101 dictionary[ "MAKE" ] = configCmdLine.at(i);
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);
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;
1122 else if( configCmdLine.at(i) == QString( "-disable-" ) + (*module) ) {
1123 disabledModules += (*module);
1124 break;
1129 else {
1130 dictionary[ "HELP" ] = "yes";
1131 cout << "Unknown option " << configCmdLine.at(i) << endl;
1132 break;
1135 #endif
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);
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;
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++";
1172 } else {
1173 if ( dictionary[ "MAKE" ].isEmpty() ) dictionary[ "MAKE" ] = "make";
1174 dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32";
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"];
1189 // Tell the user how to confclean before the next configure
1190 dictionary["CONFCLEANINSTRUCTION"] = dictionary["MAKE"] + QString(" confclean");
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;
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";
1221 useUnixSeparators = (dictionary["QMAKESPEC"] == "win32-g++");
1223 // Allow tests for private classes to be compiled against internal builds
1224 if (dictionary["BUILDDEV"] == "yes")
1225 qtConfig += "private_tests";
1228 #if !defined(EVAL)
1229 for( QStringList::Iterator dis = disabledModules.begin(); dis != disabledModules.end(); ++dis ) {
1230 modules.removeAll( (*dis) );
1232 for( QStringList::Iterator ena = enabledModules.begin(); ena != enabledModules.end(); ++ena ) {
1233 if( modules.indexOf( (*ena) ) == -1 )
1234 modules += (*ena);
1236 qtConfig += modules;
1238 for( QStringList::Iterator it = disabledModules.begin(); it != disabledModules.end(); ++it )
1239 qtConfig.removeAll(*it);
1241 if( ( dictionary[ "REDO" ] != "yes" ) && ( dictionary[ "HELP" ] != "yes" ) )
1242 saveCmdLine();
1243 #endif
1246 #if !defined(EVAL)
1247 void Configure::validateArgs()
1249 // Validate the specified config
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/");
1258 QStringList stringList = dir.entryList();
1260 QStringList::Iterator it;
1261 for( it = stringList.begin(); it != stringList.end(); ++it )
1262 allConfigs << it->remove("qconfig-").remove(".h");
1263 allConfigs << "full";
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";
1277 return;
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;
1286 if( config == allConfigs.end() ) {
1287 dictionary[ "HELP" ] = "yes";
1288 cout << "No such configuration \"" << qPrintable(dictionary[ "QCONFIG" ]) << "\"" << endl ;
1290 else
1291 qmakeConfig += (*config) + "-config";
1293 #endif
1296 // Output helper functions --------------------------------[ Start ]-
1298 Determines the length of a string token.
1300 static int tokenLength(const char *str)
1302 if (*str == 0)
1303 return 0;
1305 const char *nextToken = strpbrk(str, " _/\n\r");
1306 if (nextToken == str || !nextToken)
1307 return 1;
1309 return int(nextToken - str);
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.
1318 void Configure::desc(const char *description, int startingAt, int wrapIndent)
1320 int linePos = startingAt;
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
1329 printf("\n");
1330 linePos = 0;
1331 firstLine = false;
1332 if (*nextToken == '\n')
1333 ++nextToken;
1334 continue;
1336 if (!firstLine && linePos < wrapIndent) { // Indent to wrapIndent
1337 printf("%*s", wrapIndent , "");
1338 linePos = wrapIndent;
1339 if (*nextToken == ' ') {
1340 ++nextToken;
1341 continue;
1344 printf("%.*s", nextTokenLen, nextToken);
1345 linePos += nextTokenLen;
1346 nextToken += nextTokenLen;
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.
1358 void Configure::desc(const char *option, const char *description, bool skipIndent, char fillChar)
1360 if (!skipIndent)
1361 printf("%*s", optionIndent, "");
1363 int remaining = descIndent - optionIndent - strlen(option);
1364 int wrapIndent = descIndent + qMax(0, 1 - remaining);
1365 printf("%s", option);
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
1372 printf(" "); // Space between option and description
1374 desc(description, wrapIndent, wrapIndent);
1375 printf("\n");
1379 Same as above, except it also marks an option with an '*', if
1380 the option is default action.
1382 void Configure::desc(const char *mark_option, const char *mark, const char *option, const char *description, char fillChar)
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) ? '*' : ' ');
1394 desc(option, description, true, fillChar);
1398 Modifies the default configuration based on given -platform option.
1399 Eg. switches to different default styles for Windows CE.
1401 void Configure::applySpecSpecifics()
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";
1436 dictionary[ "QT_HOST_PREFIX" ] = dictionary[ "QT_INSTALL_PREFIX" ];
1437 dictionary[ "QT_INSTALL_PREFIX" ] = "";
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";
1482 // Disable building docs and translations for now
1483 disabledBuildParts << "docs" << "translations";
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";
1504 dictionary["DECORATIONS"] = "default windows styled";
1505 dictionary[ "QMAKEADDITIONALARGS" ] = "-unix";
1509 QString Configure::locateFileInPaths(const QString &fileName, const QStringList &paths)
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);
1524 return QString();
1527 QString Configure::locateFile( const QString &fileName )
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);
1545 // Output helper functions ---------------------------------[ Stop ]-
1548 bool Configure::displayHelp()
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);
1579 desc("Installation options:\n\n");
1581 #if !defined(EVAL)
1583 desc(" These are optional, but you may specify install directories.\n\n", 0, 1);
1585 desc( "-prefix dir", "This will install everything relative to dir\n(default $QT_INSTALL_PREFIX)\n");
1587 desc(" You may use these to separate different parts of the install:\n\n", 0, 1);
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)");
1599 desc(" You may use these options to turn on strict plugin loading:\n\n", 0, 1);
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");
1604 desc("Configure options:\n\n");
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);
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");
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");
1617 desc("BUILDDEV", "yes", "-developer-build", "Compile and link Qt with Qt developer options (including auto-tests exporting)\n");
1619 desc("SHARED", "yes", "-shared", "Create and use shared Qt libraries.");
1620 desc("SHARED", "no", "-static", "Create and use static Qt libraries.\n");
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");
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");
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");
1633 desc("ACCESSIBILITY", "no", "-no-accessibility", "Do not compile Windows Active Accessibility support.");
1634 desc("ACCESSIBILITY", "yes", "-accessibility", "Compile Windows Active Accessibility support.\n");
1636 desc("STL", "no", "-no-stl", "Do not compile STL support.");
1637 desc("STL", "yes", "-stl", "Compile STL support.\n");
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, ' ');
1654 desc( "-system-sqlite", "Use sqlite from the operating system.\n");
1656 desc("QT3SUPPORT", "no","-no-qt3support", "Disables the Qt 3 support functionality.\n");
1657 desc("OPENGL", "no","-no-opengl", "Disables OpenGL functionality\n");
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, ' ');
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, ' ');
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!", ' ');
1684 desc( "-help, -h, -?", "Display this information.\n");
1686 #if !defined(EVAL)
1687 // 3rd party stuff options go below here --------------------------------------------------------------------------------
1688 desc("Third Party Libraries:\n\n");
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");
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");
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");
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");
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");
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");
1712 #endif
1713 // Qt\Windows only options go below here --------------------------------------------------------------------------------
1714 desc("Qt for Windows only:\n\n");
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");
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");
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");
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");
1728 #if !defined(EVAL)
1729 desc("BUILD_QMAKE", "no", "-no-qmake", "Do not compile qmake.");
1730 desc("BUILD_QMAKE", "yes", "-qmake", "Compile qmake.\n");
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");
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");
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", ' ');
1776 desc( "-no-style-<style>", "Disable <style> entirely.");
1777 desc( "-qt-style-<style>", "Enable <style> in the Qt Library.\nAvailable styles: ");
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.");
1792 /* We do not support -qconfig on Windows yet
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");
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");
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");
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;
1828 return false;
1831 QString Configure::findFileInPaths(const QString &fileName, const QString &paths)
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;
1851 return QString();
1854 bool Configure::findFile( const QString &fileName )
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();
1861 QString paths;
1862 if (file.endsWith(".h")) {
1863 if (!mingwPath.isNull()) {
1864 if (!findFileInPaths(file, mingwPath + QLatin1String("/../include")).isNull())
1865 return true;
1866 //now let's try the additional compiler path
1867 QDir mingwLibDir = mingwPath + QLatin1String("/../lib/gcc/mingw32");
1868 foreach(const QFileInfo &version, mingwLibDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot)) {
1869 if (!findFileInPaths(file, version.absoluteFilePath() + QLatin1String("/include")).isNull())
1870 return true;
1873 paths = QString::fromLocal8Bit(getenv("INCLUDE"));
1874 } else if ( file.endsWith( ".lib" ) || file.endsWith( ".a" ) ) {
1875 if (!mingwPath.isNull() && !findFileInPaths(file, mingwPath + QLatin1String("/../lib")).isNull())
1876 return true;
1877 paths = QString::fromLocal8Bit(getenv("LIB"));
1878 } else {
1879 paths = pathEnvVar;
1881 return !findFileInPaths(file, paths).isNull();
1885 Default value for options marked as "auto" if the test passes.
1886 (Used both by the autoDetection() below, and the desc() function
1887 to mark (+) the default option of autodetecting options.
1889 QString Configure::defaultTo(const QString &option)
1891 // We prefer using the system version of the 3rd party libs
1892 if (option == "ZLIB"
1893 || option == "LIBJPEG"
1894 || option == "LIBPNG"
1895 || option == "LIBMNG"
1896 || option == "LIBTIFF")
1897 return "system";
1899 // We want PNG built-in
1900 if (option == "PNG")
1901 return "qt";
1903 // The JPEG image library can only be a plugin
1904 if (option == "JPEG"
1905 || option == "MNG" || option == "TIFF")
1906 return "plugin";
1908 // GIF off by default
1909 if (option == "GIF") {
1910 if (dictionary["SHARED"] == "yes")
1911 return "plugin";
1912 else
1913 return "yes";
1916 // By default we do not want to compile OCI driver when compiling with
1917 // MinGW, due to lack of such support from Oracle. It prob. wont work.
1918 // (Customer may force the use though)
1919 if (dictionary["QMAKESPEC"].endsWith("-g++")
1920 && option == "SQL_OCI")
1921 return "no";
1923 if (option == "SQL_MYSQL"
1924 || option == "SQL_MYSQL"
1925 || option == "SQL_ODBC"
1926 || option == "SQL_OCI"
1927 || option == "SQL_PSQL"
1928 || option == "SQL_TDS"
1929 || option == "SQL_DB2"
1930 || option == "SQL_SQLITE"
1931 || option == "SQL_SQLITE2"
1932 || option == "SQL_IBASE")
1933 return "plugin";
1935 if (option == "SYNCQT"
1936 && (!QFile::exists(sourcePath + "/bin/syncqt") ||
1937 !QFile::exists(sourcePath + "/bin/syncqt.bat")))
1938 return "no";
1940 return "yes";
1944 Checks the system for the availability of a feature.
1945 Returns true if the feature is available, else false.
1947 bool Configure::checkAvailability(const QString &part)
1949 bool available = false;
1950 if (part == "STYLE_WINDOWSXP")
1951 available = (findFile("uxtheme.h"));
1953 else if (part == "ZLIB")
1954 available = findFile("zlib.h");
1956 else if (part == "LIBJPEG")
1957 available = findFile("jpeglib.h");
1958 else if (part == "LIBPNG")
1959 available = findFile("png.h");
1960 else if (part == "LIBMNG")
1961 available = findFile("libmng.h");
1962 else if (part == "LIBTIFF")
1963 available = findFile("tiffio.h");
1964 else if (part == "SQL_MYSQL")
1965 available = findFile("mysql.h") && findFile("libmySQL.lib");
1966 else if (part == "SQL_ODBC")
1967 available = findFile("sql.h") && findFile("sqlext.h") && findFile("odbc32.lib");
1968 else if (part == "SQL_OCI")
1969 available = findFile("oci.h") && findFile("oci.lib");
1970 else if (part == "SQL_PSQL")
1971 available = findFile("libpq-fe.h") && findFile("libpq.lib") && findFile("ws2_32.lib") && findFile("advapi32.lib");
1972 else if (part == "SQL_TDS")
1973 available = findFile("sybfront.h") && findFile("sybdb.h") && findFile("ntwdblib.lib");
1974 else if (part == "SQL_DB2")
1975 available = findFile("sqlcli.h") && findFile("sqlcli1.h") && findFile("db2cli.lib");
1976 else if (part == "SQL_SQLITE")
1977 if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian"))
1978 available = false; // In Symbian we only support system sqlite option
1979 else
1980 available = true; // Built in, we have a fork
1981 else if (part == "SQL_SQLITE_LIB") {
1982 if (dictionary[ "SQL_SQLITE_LIB" ] == "system") {
1983 // Symbian has multiple .lib/.dll files we need to find
1984 if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) {
1985 available = true; // There is sqlite_symbian plugin which exports the necessary stuff
1986 dictionary[ "QT_LFLAGS_SQLITE" ] += "-lsqlite3";
1987 } else {
1988 available = findFile("sqlite3.h") && findFile("sqlite3.lib");
1989 if (available)
1990 dictionary[ "QT_LFLAGS_SQLITE" ] += "sqlite3.lib";
1992 } else
1993 available = true;
1994 } else if (part == "SQL_SQLITE2")
1995 available = findFile("sqlite.h") && findFile("sqlite.lib");
1996 else if (part == "SQL_IBASE")
1997 available = findFile("ibase.h") && (findFile("gds32_ms.lib") || findFile("gds32.lib"));
1998 else if (part == "IWMMXT")
1999 available = (dictionary[ "ARCHITECTURE" ] == "windowsce");
2000 else if (part == "OPENGL_ES_CM")
2001 available = (dictionary[ "ARCHITECTURE" ] == "windowsce");
2002 else if (part == "OPENGL_ES_CL")
2003 available = (dictionary[ "ARCHITECTURE" ] == "windowsce");
2004 else if (part == "OPENGL_ES_2")
2005 available = (dictionary[ "ARCHITECTURE" ] == "windowsce");
2006 else if (part == "DIRECTSHOW")
2007 available = (dictionary[ "ARCHITECTURE" ] == "windowsce");
2008 else if (part == "SSE2")
2009 available = (dictionary.value("QMAKESPEC") != "win32-msvc");
2010 else if (part == "3DNOW" )
2011 available = (dictionary.value("QMAKESPEC") != "win32-msvc") && (dictionary.value("QMAKESPEC") != "win32-icc") && findFile("mm3dnow.h");
2012 else if (part == "MMX" || part == "SSE")
2013 available = (dictionary.value("QMAKESPEC") != "win32-msvc");
2014 else if (part == "OPENSSL")
2015 available = findFile("openssl\\ssl.h");
2016 else if (part == "DBUS")
2017 available = findFile("dbus\\dbus.h");
2018 else if (part == "CETEST") {
2019 QString rapiHeader = locateFile("rapi.h");
2020 QString rapiLib = locateFile("rapi.lib");
2021 available = (dictionary[ "ARCHITECTURE" ] == "windowsce") && !rapiHeader.isEmpty() && !rapiLib.isEmpty();
2022 if (available) {
2023 dictionary[ "QT_CE_RAPI_INC" ] += QLatin1String("\"") + rapiHeader + QLatin1String("\"");
2024 dictionary[ "QT_CE_RAPI_LIB" ] += QLatin1String("\"") + rapiLib + QLatin1String("\"");
2026 else if (dictionary[ "CETEST_REQUESTED" ] == "yes") {
2027 cout << "cetest could not be enabled: rapi.h and rapi.lib could not be found." << endl;
2028 cout << "Make sure the environment is set up for compiling with ActiveSync." << endl;
2029 dictionary[ "DONE" ] = "error";
2032 else if (part == "INCREDIBUILD_XGE")
2033 available = findFile("BuildConsole.exe") && findFile("xgConsole.exe");
2034 else if (part == "XMLPATTERNS")
2036 /* MSVC 6.0 and MSVC 2002/7.0 has too poor C++ support for QtXmlPatterns. */
2037 return dictionary.value("QMAKESPEC") != "win32-msvc"
2038 && 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
2039 && dictionary.value("QMAKESPEC") != "win32-msvc2002"
2040 && dictionary.value("EXCEPTIONS") == "yes";
2041 } else if (part == "PHONON") {
2042 available = findFile("vmr9.h") && findFile("dshow.h") && findFile("dmo.h") && findFile("dmodshow.h")
2043 && (findFile("strmiids.lib") || findFile("libstrmiids.a"))
2044 && (findFile("dmoguids.lib") || findFile("libdmoguids.a"))
2045 && (findFile("msdmo.lib") || findFile("libmsdmo.a"))
2046 && findFile("d3d9.h");
2048 if (!available) {
2049 cout << "All the required DirectShow/Direct3D files couldn't be found." << endl
2050 << "Make sure you have either the platform SDK AND the DirectShow SDK or the Windows SDK installed." << endl
2051 << "If you have the DirectShow SDK installed, please make sure that you have run the <path to SDK>\\SetEnv.Cmd script." << endl;
2052 if (!findFile("vmr9.h")) cout << "vmr9.h not found" << endl;
2053 if (!findFile("dshow.h")) cout << "dshow.h not found" << endl;
2054 if (!findFile("strmiids.lib")) cout << "strmiids.lib not found" << endl;
2055 if (!findFile("dmoguids.lib")) cout << "dmoguids.lib not found" << endl;
2056 if (!findFile("msdmo.lib")) cout << "msdmo.lib not found" << endl;
2057 if (!findFile("d3d9.h")) cout << "d3d9.h not found" << endl;
2059 } else if (part == "MULTIMEDIA" || part == "SCRIPT" || part == "SCRIPTTOOLS") {
2060 available = true;
2061 } else if (part == "WEBKIT") {
2062 available = (dictionary.value("QMAKESPEC") == "win32-msvc2005") || (dictionary.value("QMAKESPEC") == "win32-msvc2008") || (dictionary.value("QMAKESPEC") == "win32-g++");
2063 } else if (part == "DECLARATIVE") {
2064 available = QFile::exists(sourcePath + "/src/declarative/qml/qmlcomponent.h");
2067 return available;
2071 Autodetect options marked as "auto".
2073 void Configure::autoDetection()
2075 // Style detection
2076 if (dictionary["STYLE_WINDOWSXP"] == "auto")
2077 dictionary["STYLE_WINDOWSXP"] = checkAvailability("STYLE_WINDOWSXP") ? defaultTo("STYLE_WINDOWSXP") : "no";
2078 if (dictionary["STYLE_WINDOWSVISTA"] == "auto") // Vista style has the same requirements as XP style
2079 dictionary["STYLE_WINDOWSVISTA"] = checkAvailability("STYLE_WINDOWSXP") ? defaultTo("STYLE_WINDOWSVISTA") : "no";
2081 // Compression detection
2082 if (dictionary["ZLIB"] == "auto")
2083 dictionary["ZLIB"] = checkAvailability("ZLIB") ? defaultTo("ZLIB") : "qt";
2085 // Image format detection
2086 if (dictionary["GIF"] == "auto")
2087 dictionary["GIF"] = defaultTo("GIF");
2088 if (dictionary["JPEG"] == "auto")
2089 dictionary["JPEG"] = defaultTo("JPEG");
2090 if (dictionary["PNG"] == "auto")
2091 dictionary["PNG"] = defaultTo("PNG");
2092 if (dictionary["MNG"] == "auto")
2093 dictionary["MNG"] = defaultTo("MNG");
2094 if (dictionary["TIFF"] == "auto")
2095 dictionary["TIFF"] = dictionary["ZLIB"] == "no" ? "no" : defaultTo("TIFF");
2096 if (dictionary["LIBJPEG"] == "auto")
2097 dictionary["LIBJPEG"] = checkAvailability("LIBJPEG") ? defaultTo("LIBJPEG") : "qt";
2098 if (dictionary["LIBPNG"] == "auto")
2099 dictionary["LIBPNG"] = checkAvailability("LIBPNG") ? defaultTo("LIBPNG") : "qt";
2100 if (dictionary["LIBMNG"] == "auto")
2101 dictionary["LIBMNG"] = checkAvailability("LIBMNG") ? defaultTo("LIBMNG") : "qt";
2102 if (dictionary["LIBTIFF"] == "auto")
2103 dictionary["LIBTIFF"] = checkAvailability("LIBTIFF") ? defaultTo("LIBTIFF") : "qt";
2105 // SQL detection (not on by default)
2106 if (dictionary["SQL_MYSQL"] == "auto")
2107 dictionary["SQL_MYSQL"] = checkAvailability("SQL_MYSQL") ? defaultTo("SQL_MYSQL") : "no";
2108 if (dictionary["SQL_ODBC"] == "auto")
2109 dictionary["SQL_ODBC"] = checkAvailability("SQL_ODBC") ? defaultTo("SQL_ODBC") : "no";
2110 if (dictionary["SQL_OCI"] == "auto")
2111 dictionary["SQL_OCI"] = checkAvailability("SQL_OCI") ? defaultTo("SQL_OCI") : "no";
2112 if (dictionary["SQL_PSQL"] == "auto")
2113 dictionary["SQL_PSQL"] = checkAvailability("SQL_PSQL") ? defaultTo("SQL_PSQL") : "no";
2114 if (dictionary["SQL_TDS"] == "auto")
2115 dictionary["SQL_TDS"] = checkAvailability("SQL_TDS") ? defaultTo("SQL_TDS") : "no";
2116 if (dictionary["SQL_DB2"] == "auto")
2117 dictionary["SQL_DB2"] = checkAvailability("SQL_DB2") ? defaultTo("SQL_DB2") : "no";
2118 if (dictionary["SQL_SQLITE"] == "auto")
2119 dictionary["SQL_SQLITE"] = checkAvailability("SQL_SQLITE") ? defaultTo("SQL_SQLITE") : "no";
2120 if (dictionary["SQL_SQLITE_LIB"] == "system")
2121 if (!checkAvailability("SQL_SQLITE_LIB"))
2122 dictionary["SQL_SQLITE_LIB"] = "no";
2123 if (dictionary["SQL_SQLITE2"] == "auto")
2124 dictionary["SQL_SQLITE2"] = checkAvailability("SQL_SQLITE2") ? defaultTo("SQL_SQLITE2") : "no";
2125 if (dictionary["SQL_IBASE"] == "auto")
2126 dictionary["SQL_IBASE"] = checkAvailability("SQL_IBASE") ? defaultTo("SQL_IBASE") : "no";
2127 if (dictionary["MMX"] == "auto")
2128 dictionary["MMX"] = checkAvailability("MMX") ? "yes" : "no";
2129 if (dictionary["3DNOW"] == "auto")
2130 dictionary["3DNOW"] = checkAvailability("3DNOW") ? "yes" : "no";
2131 if (dictionary["SSE"] == "auto")
2132 dictionary["SSE"] = checkAvailability("SSE") ? "yes" : "no";
2133 if (dictionary["SSE2"] == "auto")
2134 dictionary["SSE2"] = checkAvailability("SSE2") ? "yes" : "no";
2135 if (dictionary["IWMMXT"] == "auto")
2136 dictionary["IWMMXT"] = checkAvailability("IWMMXT") ? "yes" : "no";
2137 if (dictionary["OPENSSL"] == "auto")
2138 dictionary["OPENSSL"] = checkAvailability("OPENSSL") ? "yes" : "no";
2139 if (dictionary["DBUS"] == "auto")
2140 dictionary["DBUS"] = checkAvailability("DBUS") ? "yes" : "no";
2141 if (dictionary["SCRIPT"] == "auto")
2142 dictionary["SCRIPT"] = checkAvailability("SCRIPT") ? "yes" : "no";
2143 if (dictionary["SCRIPTTOOLS"] == "auto")
2144 dictionary["SCRIPTTOOLS"] = checkAvailability("SCRIPTTOOLS") ? "yes" : "no";
2145 if (dictionary["XMLPATTERNS"] == "auto")
2146 dictionary["XMLPATTERNS"] = checkAvailability("XMLPATTERNS") ? "yes" : "no";
2147 if (dictionary["PHONON"] == "auto")
2148 dictionary["PHONON"] = checkAvailability("PHONON") ? "yes" : "no";
2149 if (dictionary["WEBKIT"] == "auto")
2150 dictionary["WEBKIT"] = checkAvailability("WEBKIT") ? "yes" : "no";
2151 if (dictionary["DECLARATIVE"] == "auto")
2152 dictionary["DECLARATIVE"] = checkAvailability("DECLARATIVE") ? "yes" : "no";
2154 // Qt/WinCE remote test application
2155 if (dictionary["CETEST"] == "auto")
2156 dictionary["CETEST"] = checkAvailability("CETEST") ? "yes" : "no";
2158 // Detection of IncrediBuild buildconsole
2159 if (dictionary["INCREDIBUILD_XGE"] == "auto")
2160 dictionary["INCREDIBUILD_XGE"] = checkAvailability("INCREDIBUILD_XGE") ? "yes" : "no";
2162 // Mark all unknown "auto" to the default value..
2163 for (QMap<QString,QString>::iterator i = dictionary.begin(); i != dictionary.end(); ++i) {
2164 if (i.value() == "auto")
2165 i.value() = defaultTo(i.key());
2169 bool Configure::verifyConfiguration()
2171 if (dictionary["SQL_SQLITE_LIB"] == "no" && dictionary["SQL_SQLITE"] != "no") {
2172 cout << "WARNING: Configure could not detect the presence of a system SQLite3 lib." << endl
2173 << "Configure will therefore continue with the SQLite3 lib bundled with Qt." << endl
2174 << "(Press any key to continue..)";
2175 if(_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
2176 exit(0); // Exit cleanly for Ctrl+C
2178 dictionary["SQL_SQLITE_LIB"] = "qt"; // Set to Qt's bundled lib an continue
2180 if (dictionary["QMAKESPEC"].endsWith("-g++")
2181 && dictionary["SQL_OCI"] != "no") {
2182 cout << "WARNING: Qt does not support compiling the Oracle database driver with" << endl
2183 << "MinGW, due to lack of such support from Oracle. Consider disabling the" << endl
2184 << "Oracle driver, as the current build will most likely fail." << endl;
2185 cout << "(Press any key to continue..)";
2186 if(_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
2187 exit(0); // Exit cleanly for Ctrl+C
2189 if (dictionary["QMAKESPEC"].endsWith("win32-msvc.net")) {
2190 cout << "WARNING: The makespec win32-msvc.net is deprecated. Consider using" << endl
2191 << "win32-msvc2002 or win32-msvc2003 instead." << endl;
2192 cout << "(Press any key to continue..)";
2193 if(_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
2194 exit(0); // Exit cleanly for Ctrl+C
2196 if (0 != dictionary["ARM_FPU_TYPE"].size())
2198 QStringList l= QStringList()
2199 << "softvfp"
2200 << "softvfp+vfpv2"
2201 << "vfpv2";
2202 if (!(l.contains(dictionary["ARM_FPU_TYPE"])))
2203 cout << QString("WARNING: Using unsupported fpu flag: %1").arg(dictionary["ARM_FPU_TYPE"]) << endl;
2206 return true;
2210 Things that affect the Qt API/ABI:
2211 Options:
2212 minimal-config small-config medium-config large-config full-config
2214 Options:
2215 debug release
2218 Things that do not affect the Qt API/ABI:
2219 system-jpeg no-jpeg jpeg
2220 system-mng no-mng mng
2221 system-png no-png png
2222 system-zlib no-zlib zlib
2223 system-tiff no-tiff tiff
2224 no-gif gif
2225 dll staticlib
2227 nocrosscompiler
2228 GNUmake
2229 largefile
2232 tablet
2233 ipv6
2235 X11 : x11sm xinerama xcursor xfixes xrandr xrender fontconfig xkb
2236 Embedded: embedded freetype
2238 void Configure::generateBuildKey()
2240 QString spec = dictionary["QMAKESPEC"];
2242 QString compiler = "msvc"; // ICC is compatible
2243 if (spec.endsWith("-g++"))
2244 compiler = "mingw";
2245 else if (spec.endsWith("-borland"))
2246 compiler = "borland";
2248 // Build options which changes the Qt API/ABI
2249 QStringList build_options;
2250 if (!dictionary["QCONFIG"].isEmpty())
2251 build_options += dictionary["QCONFIG"] + "-config ";
2252 build_options.sort();
2254 // Sorted defines that start with QT_NO_
2255 QStringList build_defines = qmakeDefines.filter(QRegExp("^QT_NO_"));
2256 build_defines.sort();
2258 // Build up the QT_BUILD_KEY ifdef
2259 QString buildKey = "QT_BUILD_KEY \"";
2260 if (!dictionary["USER_BUILD_KEY"].isEmpty())
2261 buildKey += dictionary["USER_BUILD_KEY"] + " ";
2263 QString build32Key = buildKey + "Windows " + compiler + " %1 " + build_options.join(" ") + " " + build_defines.join(" ");
2264 QString build64Key = buildKey + "Windows x64 " + compiler + " %1 " + build_options.join(" ") + " " + build_defines.join(" ");
2265 build32Key = build32Key.simplified();
2266 build64Key = build64Key.simplified();
2267 build32Key.prepend("# define ");
2268 build64Key.prepend("# define ");
2270 QString buildkey = // Debug builds
2271 "#if (defined(_DEBUG) || defined(DEBUG))\n"
2272 "# if (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))\n"
2273 + build64Key.arg("debug") + "\"\n"
2274 "# else\n"
2275 + build32Key.arg("debug") + "\"\n"
2276 "# endif\n"
2277 "#else\n"
2278 // Release builds
2279 "# if (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))\n"
2280 + build64Key.arg("release") + "\"\n"
2281 "# else\n"
2282 + build32Key.arg("release") + "\"\n"
2283 "# endif\n"
2284 "#endif\n";
2286 dictionary["BUILD_KEY"] = buildkey;
2289 void Configure::generateOutputVars()
2291 // Generate variables for output
2292 // Build key ----------------------------------------------------
2293 if ( dictionary.contains("BUILD_KEY") ) {
2294 qmakeVars += dictionary.value("BUILD_KEY");
2297 QString build = dictionary[ "BUILD" ];
2298 bool buildAll = (dictionary[ "BUILDALL" ] == "yes");
2299 if ( build == "debug") {
2300 if (buildAll)
2301 qtConfig += "release";
2302 qtConfig += "debug";
2303 } else if (build == "release") {
2304 if (buildAll)
2305 qtConfig += "debug";
2306 qtConfig += "release";
2309 // Compression --------------------------------------------------
2310 if( dictionary[ "ZLIB" ] == "qt" )
2311 qtConfig += "zlib";
2312 else if( dictionary[ "ZLIB" ] == "system" )
2313 qtConfig += "system-zlib";
2315 // Image formates -----------------------------------------------
2316 if( dictionary[ "GIF" ] == "no" )
2317 qtConfig += "no-gif";
2318 else if( dictionary[ "GIF" ] == "yes" )
2319 qtConfig += "gif";
2320 else if( dictionary[ "GIF" ] == "plugin" )
2321 qmakeFormatPlugins += "gif";
2323 if( dictionary[ "TIFF" ] == "no" )
2324 qtConfig += "no-tiff";
2325 else if( dictionary[ "TIFF" ] == "plugin" )
2326 qmakeFormatPlugins += "tiff";
2327 if( dictionary[ "LIBTIFF" ] == "system" )
2328 qtConfig += "system-tiff";
2330 if( dictionary[ "JPEG" ] == "no" )
2331 qtConfig += "no-jpeg";
2332 else if( dictionary[ "JPEG" ] == "plugin" )
2333 qmakeFormatPlugins += "jpeg";
2334 if( dictionary[ "LIBJPEG" ] == "system" )
2335 qtConfig += "system-jpeg";
2337 if( dictionary[ "PNG" ] == "no" )
2338 qtConfig += "no-png";
2339 else if( dictionary[ "PNG" ] == "qt" )
2340 qtConfig += "png";
2341 if( dictionary[ "LIBPNG" ] == "system" )
2342 qtConfig += "system-png";
2344 if( dictionary[ "MNG" ] == "no" )
2345 qtConfig += "no-mng";
2346 else if( dictionary[ "MNG" ] == "qt" )
2347 qtConfig += "mng";
2348 if( dictionary[ "LIBMNG" ] == "system" )
2349 qtConfig += "system-mng";
2351 // Text rendering --------------------------------------------------
2352 if( dictionary[ "FREETYPE" ] == "yes" )
2353 qtConfig += "freetype";
2355 // Styles -------------------------------------------------------
2356 if ( dictionary[ "STYLE_WINDOWS" ] == "yes" )
2357 qmakeStyles += "windows";
2359 if ( dictionary[ "STYLE_PLASTIQUE" ] == "yes" )
2360 qmakeStyles += "plastique";
2362 if ( dictionary[ "STYLE_CLEANLOOKS" ] == "yes" )
2363 qmakeStyles += "cleanlooks";
2365 if ( dictionary[ "STYLE_WINDOWSXP" ] == "yes" )
2366 qmakeStyles += "windowsxp";
2368 if ( dictionary[ "STYLE_WINDOWSVISTA" ] == "yes" )
2369 qmakeStyles += "windowsvista";
2371 if ( dictionary[ "STYLE_MOTIF" ] == "yes" )
2372 qmakeStyles += "motif";
2374 if ( dictionary[ "STYLE_SGI" ] == "yes" )
2375 qmakeStyles += "sgi";
2377 if ( dictionary[ "STYLE_WINDOWSCE" ] == "yes" )
2378 qmakeStyles += "windowsce";
2380 if ( dictionary[ "STYLE_WINDOWSMOBILE" ] == "yes" )
2381 qmakeStyles += "windowsmobile";
2383 if ( dictionary[ "STYLE_CDE" ] == "yes" )
2384 qmakeStyles += "cde";
2386 if ( dictionary[ "STYLE_S60" ] == "yes" )
2387 qmakeStyles += "s60";
2389 // Databases ----------------------------------------------------
2390 if ( dictionary[ "SQL_MYSQL" ] == "yes" )
2391 qmakeSql += "mysql";
2392 else if ( dictionary[ "SQL_MYSQL" ] == "plugin" )
2393 qmakeSqlPlugins += "mysql";
2395 if ( dictionary[ "SQL_ODBC" ] == "yes" )
2396 qmakeSql += "odbc";
2397 else if ( dictionary[ "SQL_ODBC" ] == "plugin" )
2398 qmakeSqlPlugins += "odbc";
2400 if ( dictionary[ "SQL_OCI" ] == "yes" )
2401 qmakeSql += "oci";
2402 else if ( dictionary[ "SQL_OCI" ] == "plugin" )
2403 qmakeSqlPlugins += "oci";
2405 if ( dictionary[ "SQL_PSQL" ] == "yes" )
2406 qmakeSql += "psql";
2407 else if ( dictionary[ "SQL_PSQL" ] == "plugin" )
2408 qmakeSqlPlugins += "psql";
2410 if ( dictionary[ "SQL_TDS" ] == "yes" )
2411 qmakeSql += "tds";
2412 else if ( dictionary[ "SQL_TDS" ] == "plugin" )
2413 qmakeSqlPlugins += "tds";
2415 if ( dictionary[ "SQL_DB2" ] == "yes" )
2416 qmakeSql += "db2";
2417 else if ( dictionary[ "SQL_DB2" ] == "plugin" )
2418 qmakeSqlPlugins += "db2";
2420 if ( dictionary[ "SQL_SQLITE" ] == "yes" )
2421 qmakeSql += "sqlite";
2422 else if ( dictionary[ "SQL_SQLITE" ] == "plugin" )
2423 qmakeSqlPlugins += "sqlite";
2425 if ( dictionary[ "SQL_SQLITE_LIB" ] == "system" )
2426 qmakeConfig += "system-sqlite";
2428 if ( dictionary[ "SQL_SQLITE2" ] == "yes" )
2429 qmakeSql += "sqlite2";
2430 else if ( dictionary[ "SQL_SQLITE2" ] == "plugin" )
2431 qmakeSqlPlugins += "sqlite2";
2433 if ( dictionary[ "SQL_IBASE" ] == "yes" )
2434 qmakeSql += "ibase";
2435 else if ( dictionary[ "SQL_IBASE" ] == "plugin" )
2436 qmakeSqlPlugins += "ibase";
2438 // Other options ------------------------------------------------
2439 if( dictionary[ "BUILDALL" ] == "yes" ) {
2440 qmakeConfig += "build_all";
2442 qmakeConfig += dictionary[ "BUILD" ];
2443 dictionary[ "QMAKE_OUTDIR" ] = dictionary[ "BUILD" ];
2445 if ( dictionary[ "SHARED" ] == "yes" ) {
2446 QString version = dictionary[ "VERSION" ];
2447 if (!version.isEmpty()) {
2448 qmakeVars += "QMAKE_QT_VERSION_OVERRIDE = " + version.left(version.indexOf("."));
2449 version.remove(QLatin1Char('.'));
2451 dictionary[ "QMAKE_OUTDIR" ] += "_shared";
2452 } else {
2453 dictionary[ "QMAKE_OUTDIR" ] += "_static";
2456 if( dictionary[ "ACCESSIBILITY" ] == "yes" )
2457 qtConfig += "accessibility";
2459 if( !qmakeLibs.isEmpty() )
2460 qmakeVars += "LIBS += " + qmakeLibs.join( " " );
2462 if( !dictionary["QT_LFLAGS_SQLITE"].isEmpty() )
2463 qmakeVars += "QT_LFLAGS_SQLITE += " + dictionary["QT_LFLAGS_SQLITE"];
2465 if (dictionary[ "QT3SUPPORT" ] == "yes")
2466 qtConfig += "qt3support";
2468 if (dictionary[ "OPENGL" ] == "yes")
2469 qtConfig += "opengl";
2471 if ( dictionary["OPENGL_ES_CM"] == "yes" ) {
2472 qtConfig += "opengles1";
2473 qtConfig += "egl";
2476 if ( dictionary["OPENGL_ES_2"] == "yes" ) {
2477 qtConfig += "opengles2";
2478 qtConfig += "egl";
2481 if ( dictionary["OPENGL_ES_CL"] == "yes" ) {
2482 qtConfig += "opengles1cl";
2483 qtConfig += "egl";
2486 if ( dictionary["OPENVG"] == "yes" ) {
2487 qtConfig += "openvg";
2488 qtConfig += "egl";
2491 if ( dictionary["S60"] == "yes" ) {
2492 qtConfig += "s60";
2495 if ( dictionary["DIRECTSHOW"] == "yes" )
2496 qtConfig += "directshow";
2498 if (dictionary[ "OPENSSL" ] == "yes")
2499 qtConfig += "openssl";
2500 else if (dictionary[ "OPENSSL" ] == "linked")
2501 qtConfig += "openssl-linked";
2503 if (dictionary[ "DBUS" ] == "yes")
2504 qtConfig += "dbus";
2505 else if (dictionary[ "DBUS" ] == "linked")
2506 qtConfig += "dbus dbus-linked";
2508 if (dictionary["IPV6"] == "yes")
2509 qtConfig += "ipv6";
2510 else if (dictionary["IPV6"] == "no")
2511 qtConfig += "no-ipv6";
2513 if (dictionary[ "CETEST" ] == "yes")
2514 qtConfig += "cetest";
2516 if (dictionary[ "SCRIPT" ] == "yes")
2517 qtConfig += "script";
2519 if (dictionary[ "SCRIPTTOOLS" ] == "yes") {
2520 if (dictionary[ "SCRIPT" ] == "no") {
2521 cout << "QtScriptTools was requested, but it can't be built due to QtScript being "
2522 "disabled." << endl;
2523 dictionary[ "DONE" ] = "error";
2525 qtConfig += "scripttools";
2528 if (dictionary[ "XMLPATTERNS" ] == "yes")
2529 qtConfig += "xmlpatterns";
2531 if (dictionary["PHONON"] == "yes") {
2532 qtConfig += "phonon";
2533 if (dictionary["PHONON_BACKEND"] == "yes")
2534 qtConfig += "phonon-backend";
2537 if (dictionary["MULTIMEDIA"] == "yes")
2538 qtConfig += "multimedia";
2540 if (dictionary["WEBKIT"] == "yes")
2541 qtConfig += "webkit";
2543 if (dictionary["DECLARATIVE"] == "yes")
2544 qtConfig += "declarative";
2546 if( dictionary[ "NATIVE_GESTURES" ] == "yes" )
2547 qtConfig += "native-gestures";
2549 // We currently have no switch for QtSvg, so add it unconditionally.
2550 qtConfig += "svg";
2552 // Add config levels --------------------------------------------
2553 QStringList possible_configs = QStringList()
2554 << "minimal"
2555 << "small"
2556 << "medium"
2557 << "large"
2558 << "full";
2560 QString set_config = dictionary["QCONFIG"];
2561 if (possible_configs.contains(set_config)) {
2562 foreach(QString cfg, possible_configs) {
2563 qtConfig += (cfg + "-config");
2564 if (cfg == set_config)
2565 break;
2569 if (dictionary.contains("XQMAKESPEC") && ( dictionary["QMAKESPEC"] != dictionary["XQMAKESPEC"] ) )
2570 qmakeConfig += "cross_compile";
2572 // Directories and settings for .qmake.cache --------------------
2574 // if QT_INSTALL_* have not been specified on commandline, define them now from QT_INSTALL_PREFIX
2575 // if prefix is empty (WINCE), make all of them empty, if they aren't set
2576 bool qipempty = false;
2577 if(dictionary[ "QT_INSTALL_PREFIX" ].isEmpty())
2578 qipempty = true;
2580 if( !dictionary[ "QT_INSTALL_DOCS" ].size() )
2581 dictionary[ "QT_INSTALL_DOCS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/doc" );
2582 if( !dictionary[ "QT_INSTALL_HEADERS" ].size() )
2583 dictionary[ "QT_INSTALL_HEADERS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/include" );
2584 if( !dictionary[ "QT_INSTALL_LIBS" ].size() )
2585 dictionary[ "QT_INSTALL_LIBS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/lib" );
2586 if( !dictionary[ "QT_INSTALL_BINS" ].size() )
2587 dictionary[ "QT_INSTALL_BINS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/bin" );
2588 if( !dictionary[ "QT_INSTALL_PLUGINS" ].size() )
2589 dictionary[ "QT_INSTALL_PLUGINS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/plugins" );
2590 if( !dictionary[ "QT_INSTALL_DATA" ].size() )
2591 dictionary[ "QT_INSTALL_DATA" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] );
2592 if( !dictionary[ "QT_INSTALL_TRANSLATIONS" ].size() )
2593 dictionary[ "QT_INSTALL_TRANSLATIONS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/translations" );
2594 if( !dictionary[ "QT_INSTALL_EXAMPLES" ].size() )
2595 dictionary[ "QT_INSTALL_EXAMPLES" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/examples");
2596 if( !dictionary[ "QT_INSTALL_DEMOS" ].size() )
2597 dictionary[ "QT_INSTALL_DEMOS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/demos" );
2599 if(dictionary.contains("XQMAKESPEC") && dictionary[ "XQMAKESPEC" ].startsWith("linux"))
2600 dictionary[ "QMAKE_RPATHDIR" ] = dictionary[ "QT_INSTALL_LIBS" ];
2602 qmakeVars += QString("OBJECTS_DIR = ") + fixSeparators( "tmp/obj/" + dictionary[ "QMAKE_OUTDIR" ] );
2603 qmakeVars += QString("MOC_DIR = ") + fixSeparators( "tmp/moc/" + dictionary[ "QMAKE_OUTDIR" ] );
2604 qmakeVars += QString("RCC_DIR = ") + fixSeparators("tmp/rcc/" + dictionary["QMAKE_OUTDIR"]);
2606 if (!qmakeDefines.isEmpty())
2607 qmakeVars += QString("DEFINES += ") + qmakeDefines.join( " " );
2608 if (!qmakeIncludes.isEmpty())
2609 qmakeVars += QString("INCLUDEPATH += ") + qmakeIncludes.join( " " );
2610 if (!opensslLibs.isEmpty())
2611 qmakeVars += opensslLibs;
2612 else if (dictionary[ "OPENSSL" ] == "linked") {
2613 if(dictionary.contains("XQMAKESPEC") && dictionary[ "XQMAKESPEC" ].startsWith("symbian") )
2614 qmakeVars += QString("OPENSSL_LIBS = -llibssl -llibcrypto");
2615 else
2616 qmakeVars += QString("OPENSSL_LIBS = -lssleay32 -llibeay32");
2618 if (!qmakeSql.isEmpty())
2619 qmakeVars += QString("sql-drivers += ") + qmakeSql.join( " " );
2620 if (!qmakeSqlPlugins.isEmpty())
2621 qmakeVars += QString("sql-plugins += ") + qmakeSqlPlugins.join( " " );
2622 if (!qmakeStyles.isEmpty())
2623 qmakeVars += QString("styles += ") + qmakeStyles.join( " " );
2624 if (!qmakeStylePlugins.isEmpty())
2625 qmakeVars += QString("style-plugins += ") + qmakeStylePlugins.join( " " );
2626 if (!qmakeFormatPlugins.isEmpty())
2627 qmakeVars += QString("imageformat-plugins += ") + qmakeFormatPlugins.join( " " );
2629 if (dictionary["QMAKESPEC"].endsWith("-g++")) {
2630 QString includepath = qgetenv("INCLUDE");
2631 bool hasSh = Environment::detectExecutable("sh.exe");
2632 QChar separator = (!includepath.contains(":\\") && hasSh ? QChar(':') : QChar(';'));
2633 qmakeVars += QString("TMPPATH = $$quote($$(INCLUDE))");
2634 qmakeVars += QString("QMAKE_INCDIR_POST += $$split(TMPPATH,\"%1\")").arg(separator);
2635 qmakeVars += QString("TMPPATH = $$quote($$(LIB))");
2636 qmakeVars += QString("QMAKE_LIBDIR_POST += $$split(TMPPATH,\"%1\")").arg(separator);
2639 if( !dictionary[ "QMAKESPEC" ].length() ) {
2640 cout << "Configure could not detect your compiler. QMAKESPEC must either" << endl
2641 << "be defined as an environment variable, or specified as an" << endl
2642 << "argument with -platform" << endl;
2643 dictionary[ "HELP" ] = "yes";
2645 QStringList winPlatforms;
2646 QDir mkspecsDir( sourcePath + "/mkspecs" );
2647 const QFileInfoList &specsList = mkspecsDir.entryInfoList();
2648 for(int i = 0; i < specsList.size(); ++i) {
2649 const QFileInfo &fi = specsList.at(i);
2650 if( fi.fileName().left( 5 ) == "win32" ) {
2651 winPlatforms += fi.fileName();
2654 cout << "Available platforms are: " << qPrintable(winPlatforms.join( ", " )) << endl;
2655 dictionary[ "DONE" ] = "error";
2659 #if !defined(EVAL)
2660 void Configure::generateCachefile()
2662 // Generate .qmake.cache
2663 QFile cacheFile( buildPath + "/.qmake.cache" );
2664 if( cacheFile.open( QFile::WriteOnly | QFile::Text ) ) { // Truncates any existing file.
2665 QTextStream cacheStream( &cacheFile );
2666 for( QStringList::Iterator var = qmakeVars.begin(); var != qmakeVars.end(); ++var ) {
2667 cacheStream << (*var) << endl;
2669 cacheStream << "CONFIG += " << qmakeConfig.join( " " ) << " incremental create_prl link_prl depend_includepath QTDIR_build" << endl;
2671 QStringList buildParts;
2672 buildParts << "libs" << "tools" << "examples" << "demos" << "docs" << "translations";
2673 foreach(QString item, disabledBuildParts) {
2674 buildParts.removeAll(item);
2676 cacheStream << "QT_BUILD_PARTS = " << buildParts.join( " " ) << endl;
2678 QString targetSpec = dictionary.contains("XQMAKESPEC") ? dictionary[ "XQMAKESPEC" ] : dictionary[ "QMAKESPEC" ];
2679 QString mkspec_path = fixSeparators(sourcePath + "/mkspecs/" + targetSpec);
2680 if(QFile::exists(mkspec_path))
2681 cacheStream << "QMAKESPEC = " << mkspec_path << endl;
2682 else
2683 cacheStream << "QMAKESPEC = " << fixSeparators(targetSpec) << endl;
2684 cacheStream << "ARCH = " << fixSeparators(dictionary[ "ARCHITECTURE" ]) << endl;
2685 cacheStream << "QT_BUILD_TREE = " << fixSeparators(dictionary[ "QT_BUILD_TREE" ]) << endl;
2686 cacheStream << "QT_SOURCE_TREE = " << fixSeparators(dictionary[ "QT_SOURCE_TREE" ]) << endl;
2688 if (dictionary["QT_EDITION"] != "QT_EDITION_OPENSOURCE")
2689 cacheStream << "DEFINES *= QT_EDITION=QT_EDITION_DESKTOP" << endl;
2691 //so that we can build without an install first (which would be impossible)
2692 cacheStream << "QMAKE_MOC = $$QT_BUILD_TREE" << fixSeparators("/bin/moc.exe") << endl;
2693 cacheStream << "QMAKE_UIC = $$QT_BUILD_TREE" << fixSeparators("/bin/uic.exe") << endl;
2694 cacheStream << "QMAKE_UIC3 = $$QT_BUILD_TREE" << fixSeparators("/bin/uic3.exe") << endl;
2695 cacheStream << "QMAKE_RCC = $$QT_BUILD_TREE" << fixSeparators("/bin/rcc.exe") << endl;
2696 cacheStream << "QMAKE_DUMPCPP = $$QT_BUILD_TREE" << fixSeparators("/bin/dumpcpp.exe") << endl;
2697 cacheStream << "QMAKE_INCDIR_QT = $$QT_BUILD_TREE" << fixSeparators("/include") << endl;
2698 cacheStream << "QMAKE_LIBDIR_QT = $$QT_BUILD_TREE" << fixSeparators("/lib") << endl;
2699 if (dictionary["CETEST"] == "yes") {
2700 cacheStream << "QT_CE_RAPI_INC = " << fixSeparators(dictionary[ "QT_CE_RAPI_INC" ]) << endl;
2701 cacheStream << "QT_CE_RAPI_LIB = " << fixSeparators(dictionary[ "QT_CE_RAPI_LIB" ]) << endl;
2704 // embedded
2705 if( !dictionary["KBD_DRIVERS"].isEmpty())
2706 cacheStream << "kbd-drivers += "<< dictionary["KBD_DRIVERS"]<<endl;
2707 if( !dictionary["GFX_DRIVERS"].isEmpty())
2708 cacheStream << "gfx-drivers += "<< dictionary["GFX_DRIVERS"]<<endl;
2709 if( !dictionary["MOUSE_DRIVERS"].isEmpty())
2710 cacheStream << "mouse-drivers += "<< dictionary["MOUSE_DRIVERS"]<<endl;
2711 if( !dictionary["DECORATIONS"].isEmpty())
2712 cacheStream << "decorations += "<<dictionary["DECORATIONS"]<<endl;
2714 if( !dictionary["QMAKE_RPATHDIR"].isEmpty() )
2715 cacheStream << "QMAKE_RPATHDIR += "<<dictionary["QMAKE_RPATHDIR"];
2717 cacheStream.flush();
2718 cacheFile.close();
2720 QFile configFile( dictionary[ "QT_BUILD_TREE" ] + "/mkspecs/qconfig.pri" );
2721 if( configFile.open( QFile::WriteOnly | QFile::Text ) ) { // Truncates any existing file.
2722 QTextStream configStream( &configFile );
2723 configStream << "CONFIG+= ";
2724 configStream << dictionary[ "BUILD" ];
2725 if( dictionary[ "SHARED" ] == "yes" )
2726 configStream << " shared";
2727 else
2728 configStream << " static";
2730 if( dictionary[ "LTCG" ] == "yes" )
2731 configStream << " ltcg";
2732 if( dictionary[ "STL" ] == "yes" )
2733 configStream << " stl";
2734 if ( dictionary[ "EXCEPTIONS" ] == "yes" )
2735 configStream << " exceptions";
2736 if ( dictionary[ "EXCEPTIONS" ] == "no" )
2737 configStream << " exceptions_off";
2738 if ( dictionary[ "RTTI" ] == "yes" )
2739 configStream << " rtti";
2740 if ( dictionary[ "MMX" ] == "yes" )
2741 configStream << " mmx";
2742 if ( dictionary[ "3DNOW" ] == "yes" )
2743 configStream << " 3dnow";
2744 if ( dictionary[ "SSE" ] == "yes" )
2745 configStream << " sse";
2746 if ( dictionary[ "SSE2" ] == "yes" )
2747 configStream << " sse2";
2748 if ( dictionary[ "IWMMXT" ] == "yes" )
2749 configStream << " iwmmxt";
2750 if ( dictionary["INCREDIBUILD_XGE"] == "yes" )
2751 configStream << " incredibuild_xge";
2752 if ( dictionary["PLUGIN_MANIFESTS"] == "no" )
2753 configStream << " no_plugin_manifest";
2755 configStream << endl;
2756 configStream << "QT_ARCH = " << dictionary[ "ARCHITECTURE" ] << endl;
2757 if (dictionary["QT_EDITION"].contains("OPENSOURCE"))
2758 configStream << "QT_EDITION = " << QLatin1String("OpenSource") << endl;
2759 else
2760 configStream << "QT_EDITION = " << dictionary["EDITION"] << endl;
2761 configStream << "QT_CONFIG += " << qtConfig.join(" ") << endl;
2763 configStream << "#versioning " << endl
2764 << "QT_VERSION = " << dictionary["VERSION"] << endl
2765 << "QT_MAJOR_VERSION = " << dictionary["VERSION_MAJOR"] << endl
2766 << "QT_MINOR_VERSION = " << dictionary["VERSION_MINOR"] << endl
2767 << "QT_PATCH_VERSION = " << dictionary["VERSION_PATCH"] << endl;
2769 configStream << "#Qt for Windows CE c-runtime deployment" << endl
2770 << "QT_CE_C_RUNTIME = " << fixSeparators(dictionary[ "CE_CRT" ]) << endl;
2772 if(dictionary["CE_SIGNATURE"] != QLatin1String("no"))
2773 configStream << "DEFAULT_SIGNATURE=" << dictionary["CE_SIGNATURE"] << endl;
2775 if(!dictionary["QMAKE_RPATHDIR"].isEmpty())
2776 configStream << "QMAKE_RPATHDIR += " << dictionary["QMAKE_RPATHDIR"] << endl;
2778 if (!dictionary["QT_LIBINFIX"].isEmpty())
2779 configStream << "QT_LIBINFIX = " << dictionary["QT_LIBINFIX"] << endl;
2781 configStream << "#Qt for Symbian FPU settings" << endl;
2782 if(!dictionary["ARM_FPU_TYPE"].isEmpty()) {
2783 configStream<<"MMP_RULES += \"ARMFPU "<< dictionary["ARM_FPU_TYPE"]<< "\"";
2786 configStream.flush();
2787 configFile.close();
2790 #endif
2792 QString Configure::addDefine(QString def)
2794 QString result, defNeg, defD = def;
2796 defD.replace(QRegExp("=.*"), "");
2797 def.replace(QRegExp("="), " ");
2799 if(def.startsWith("QT_NO_")) {
2800 defNeg = defD;
2801 defNeg.replace("QT_NO_", "QT_");
2802 } else if(def.startsWith("QT_")) {
2803 defNeg = defD;
2804 defNeg.replace("QT_", "QT_NO_");
2807 if (defNeg.isEmpty()) {
2808 result = "#ifndef $DEFD\n"
2809 "# define $DEF\n"
2810 "#endif\n\n";
2811 } else {
2812 result = "#if defined($DEFD) && defined($DEFNEG)\n"
2813 "# undef $DEFD\n"
2814 "#elif !defined($DEFD)\n"
2815 "# define $DEF\n"
2816 "#endif\n\n";
2818 result.replace("$DEFNEG", defNeg);
2819 result.replace("$DEFD", defD);
2820 result.replace("$DEF", def);
2821 return result;
2824 #if !defined(EVAL)
2825 void Configure::generateConfigfiles()
2827 QDir(buildPath).mkpath("src/corelib/global");
2828 QString outName( buildPath + "/src/corelib/global/qconfig.h" );
2829 QTemporaryFile tmpFile;
2830 QTextStream tmpStream;
2832 if(tmpFile.open()) {
2833 tmpStream.setDevice(&tmpFile);
2835 if( dictionary[ "QCONFIG" ] == "full" ) {
2836 tmpStream << "/* Everything */" << endl;
2837 } else {
2838 QString configName( "qconfig-" + dictionary[ "QCONFIG" ] + ".h" );
2839 tmpStream << "/* Copied from " << configName << "*/" << endl;
2840 tmpStream << "#ifndef QT_BOOTSTRAPPED" << endl;
2841 QFile inFile( sourcePath + "/src/corelib/global/" + configName );
2842 if( inFile.open( QFile::ReadOnly ) ) {
2843 QByteArray buffer = inFile.readAll();
2844 tmpFile.write( buffer.constData(), buffer.size() );
2845 inFile.close();
2847 tmpStream << "#endif // QT_BOOTSTRAPPED" << endl;
2849 tmpStream << endl;
2851 if( dictionary[ "SHARED" ] == "yes" ) {
2852 tmpStream << "#ifndef QT_DLL" << endl;
2853 tmpStream << "#define QT_DLL" << endl;
2854 tmpStream << "#endif" << endl;
2856 tmpStream << endl;
2857 tmpStream << "/* License information */" << endl;
2858 tmpStream << "#define QT_PRODUCT_LICENSEE \"" << licenseInfo[ "LICENSEE" ] << "\"" << endl;
2859 tmpStream << "#define QT_PRODUCT_LICENSE \"" << dictionary[ "EDITION" ] << "\"" << endl;
2860 tmpStream << endl;
2861 tmpStream << "// Qt Edition" << endl;
2862 tmpStream << "#ifndef QT_EDITION" << endl;
2863 tmpStream << "# define QT_EDITION " << dictionary["QT_EDITION"] << endl;
2864 tmpStream << "#endif" << endl;
2865 tmpStream << endl;
2866 tmpStream << dictionary["BUILD_KEY"];
2867 tmpStream << endl;
2868 if (dictionary["BUILDDEV"] == "yes") {
2869 dictionary["QMAKE_INTERNAL"] = "yes";
2870 tmpStream << "/* Used for example to export symbols for the certain autotests*/" << endl;
2871 tmpStream << "#define QT_BUILD_INTERNAL" << endl;
2872 tmpStream << endl;
2874 tmpStream << "/* Machine byte-order */" << endl;
2875 tmpStream << "#define Q_BIG_ENDIAN 4321" << endl;
2876 tmpStream << "#define Q_LITTLE_ENDIAN 1234" << endl;
2877 if ( QSysInfo::ByteOrder == QSysInfo::BigEndian )
2878 tmpStream << "#define Q_BYTE_ORDER Q_BIG_ENDIAN" << endl;
2879 else
2880 tmpStream << "#define Q_BYTE_ORDER Q_LITTLE_ENDIAN" << endl;
2882 tmpStream << endl << "// Compile time features" << endl;
2883 tmpStream << "#define QT_ARCH_" << dictionary["ARCHITECTURE"].toUpper() << endl;
2884 QStringList qconfigList;
2885 if(dictionary["STL"] == "no") qconfigList += "QT_NO_STL";
2886 if(dictionary["STYLE_WINDOWS"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWS";
2887 if(dictionary["STYLE_PLASTIQUE"] != "yes") qconfigList += "QT_NO_STYLE_PLASTIQUE";
2888 if(dictionary["STYLE_CLEANLOOKS"] != "yes") qconfigList += "QT_NO_STYLE_CLEANLOOKS";
2889 if(dictionary["STYLE_WINDOWSXP"] != "yes" && dictionary["STYLE_WINDOWSVISTA"] != "yes")
2890 qconfigList += "QT_NO_STYLE_WINDOWSXP";
2891 if(dictionary["STYLE_WINDOWSVISTA"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWSVISTA";
2892 if(dictionary["STYLE_MOTIF"] != "yes") qconfigList += "QT_NO_STYLE_MOTIF";
2893 if(dictionary["STYLE_CDE"] != "yes") qconfigList += "QT_NO_STYLE_CDE";
2894 if(dictionary["STYLE_S60"] != "yes") qconfigList += "QT_NO_STYLE_S60";
2895 if(dictionary["STYLE_WINDOWSCE"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWSCE";
2896 if(dictionary["STYLE_WINDOWSMOBILE"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWSMOBILE";
2897 if(dictionary["STYLE_GTK"] != "yes") qconfigList += "QT_NO_STYLE_GTK";
2899 if(dictionary["GIF"] == "yes") qconfigList += "QT_BUILTIN_GIF_READER=1";
2900 if(dictionary["PNG"] == "no") qconfigList += "QT_NO_IMAGEFORMAT_PNG";
2901 if(dictionary["MNG"] == "no") qconfigList += "QT_NO_IMAGEFORMAT_MNG";
2902 if(dictionary["JPEG"] == "no") qconfigList += "QT_NO_IMAGEFORMAT_JPEG";
2903 if(dictionary["TIFF"] == "no") qconfigList += "QT_NO_IMAGEFORMAT_TIFF";
2904 if(dictionary["ZLIB"] == "no") {
2905 qconfigList += "QT_NO_ZLIB";
2906 qconfigList += "QT_NO_COMPRESS";
2909 if(dictionary["ACCESSIBILITY"] == "no") qconfigList += "QT_NO_ACCESSIBILITY";
2910 if(dictionary["EXCEPTIONS"] == "no") qconfigList += "QT_NO_EXCEPTIONS";
2911 if(dictionary["OPENGL"] == "no") qconfigList += "QT_NO_OPENGL";
2912 if(dictionary["OPENVG"] == "no") qconfigList += "QT_NO_OPENVG";
2913 if(dictionary["OPENSSL"] == "no") qconfigList += "QT_NO_OPENSSL";
2914 if(dictionary["OPENSSL"] == "linked") qconfigList += "QT_LINKED_OPENSSL";
2915 if(dictionary["DBUS"] == "no") qconfigList += "QT_NO_DBUS";
2916 if(dictionary["IPV6"] == "no") qconfigList += "QT_NO_IPV6";
2917 if(dictionary["WEBKIT"] == "no") qconfigList += "QT_NO_WEBKIT";
2918 if(dictionary["DECLARATIVE"] == "no") qconfigList += "QT_NO_DECLARATIVE";
2919 if(dictionary["PHONON"] == "no") qconfigList += "QT_NO_PHONON";
2920 if(dictionary["MULTIMEDIA"] == "no") qconfigList += "QT_NO_MULTIMEDIA";
2921 if(dictionary["XMLPATTERNS"] == "no") qconfigList += "QT_NO_XMLPATTERNS";
2922 if(dictionary["SCRIPT"] == "no") qconfigList += "QT_NO_SCRIPT";
2923 if(dictionary["SCRIPTTOOLS"] == "no") qconfigList += "QT_NO_SCRIPTTOOLS";
2924 if(dictionary["FREETYPE"] == "no") qconfigList += "QT_NO_FREETYPE";
2925 if(dictionary["S60"] == "no") qconfigList += "QT_NO_S60";
2926 if(dictionary["NATIVE_GESTURES"] == "no") qconfigList += "QT_NO_NATIVE_GESTURES";
2928 if(dictionary["OPENGL_ES_CM"] == "yes" ||
2929 dictionary["OPENGL_ES_CL"] == "yes" ||
2930 dictionary["OPENGL_ES_2"] == "yes") qconfigList += "QT_OPENGL_ES";
2932 if(dictionary["OPENGL_ES_CM"] == "yes") qconfigList += "QT_OPENGL_ES_1";
2933 if(dictionary["OPENGL_ES_2"] == "yes") qconfigList += "QT_OPENGL_ES_2";
2934 if(dictionary["OPENGL_ES_CL"] == "yes") qconfigList += "QT_OPENGL_ES_1_CL";
2936 if(dictionary["SQL_MYSQL"] == "yes") qconfigList += "QT_SQL_MYSQL";
2937 if(dictionary["SQL_ODBC"] == "yes") qconfigList += "QT_SQL_ODBC";
2938 if(dictionary["SQL_OCI"] == "yes") qconfigList += "QT_SQL_OCI";
2939 if(dictionary["SQL_PSQL"] == "yes") qconfigList += "QT_SQL_PSQL";
2940 if(dictionary["SQL_TDS"] == "yes") qconfigList += "QT_SQL_TDS";
2941 if(dictionary["SQL_DB2"] == "yes") qconfigList += "QT_SQL_DB2";
2942 if(dictionary["SQL_SQLITE"] == "yes") qconfigList += "QT_SQL_SQLITE";
2943 if(dictionary["SQL_SQLITE2"] == "yes") qconfigList += "QT_SQL_SQLITE2";
2944 if(dictionary["SQL_IBASE"] == "yes") qconfigList += "QT_SQL_IBASE";
2946 if (dictionary["GRAPHICS_SYSTEM"] == "openvg") qconfigList += "QT_GRAPHICSSYSTEM_OPENVG";
2947 if (dictionary["GRAPHICS_SYSTEM"] == "opengl") qconfigList += "QT_GRAPHICSSYSTEM_OPENGL";
2948 if (dictionary["GRAPHICS_SYSTEM"] == "raster") qconfigList += "QT_GRAPHICSSYSTEM_RASTER";
2950 if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith("symbian")) {
2951 // These features are not ported to Symbian (yet)
2952 qconfigList += "QT_NO_CONCURRENT";
2953 qconfigList += "QT_NO_QFUTURE";
2954 qconfigList += "QT_NO_CRASHHANDLER";
2955 qconfigList += "QT_NO_PRINTER";
2956 qconfigList += "QT_NO_SYSTEMTRAYICON";
2959 qconfigList.sort();
2960 for (int i = 0; i < qconfigList.count(); ++i)
2961 tmpStream << addDefine(qconfigList.at(i));
2963 if(dictionary["EMBEDDED"] == "yes")
2965 // Check for keyboard, mouse, gfx.
2966 QStringList kbdDrivers = dictionary["KBD_DRIVERS"].split(" ");;
2967 QStringList allKbdDrivers;
2968 allKbdDrivers<<"tty"<<"usb"<<"sl5000"<<"yopy"<<"vr41xx"<<"qvfb"<<"um";
2969 foreach(QString kbd, allKbdDrivers) {
2970 if( !kbdDrivers.contains(kbd))
2971 tmpStream<<"#define QT_NO_QWS_KBD_"<<kbd.toUpper()<<endl;
2974 QStringList mouseDrivers = dictionary["MOUSE_DRIVERS"].split(" ");
2975 QStringList allMouseDrivers;
2976 allMouseDrivers << "pc"<<"bus"<<"linuxtp"<<"yopy"<<"vr41xx"<<"tslib"<<"qvfb";
2977 foreach(QString mouse, allMouseDrivers) {
2978 if( !mouseDrivers.contains(mouse) )
2979 tmpStream<<"#define QT_NO_QWS_MOUSE_"<<mouse.toUpper()<<endl;
2982 QStringList gfxDrivers = dictionary["GFX_DRIVERS"].split(" ");
2983 QStringList allGfxDrivers;
2984 allGfxDrivers<<"linuxfb"<<"transformed"<<"qvfb"<<"vnc"<<"multiscreen"<<"ahi";
2985 foreach(QString gfx, allGfxDrivers) {
2986 if( !gfxDrivers.contains(gfx))
2987 tmpStream<<"#define QT_NO_QWS_"<<gfx.toUpper()<<endl;
2990 tmpStream<<"#define Q_WS_QWS"<<endl;
2992 QStringList depths = dictionary[ "QT_QWS_DEPTH" ].split(" ");
2993 foreach(QString depth, depths)
2994 tmpStream<<"#define QT_QWS_DEPTH_"+depth<<endl;
2997 if( dictionary[ "QT_CUPS" ] == "no")
2998 tmpStream<<"#define QT_NO_CUPS"<<endl;
3000 if( dictionary[ "QT_ICONV" ] == "no")
3001 tmpStream<<"#define QT_NO_ICONV"<<endl;
3003 if(dictionary[ "QT_GLIB" ] == "no")
3004 tmpStream<<"#define QT_NO_GLIB"<<endl;
3006 if(dictionary[ "QT_LPR" ] == "no")
3007 tmpStream<<"#define QT_NO_LPR"<<endl;
3009 if(dictionary[ "QT_INOTIFY" ] == "no" )
3010 tmpStream<<"#define QT_NO_INOTIFY"<<endl;
3012 if(dictionary[ "QT_SXE" ] == "no")
3013 tmpStream<<"#define QT_NO_SXE"<<endl;
3015 tmpStream.flush();
3016 tmpFile.flush();
3018 // Replace old qconfig.h with new one
3019 ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL);
3020 QFile::remove(outName);
3021 tmpFile.copy(outName);
3022 tmpFile.close();
3024 if(!QFile::exists(buildPath + "/include/QtCore/qconfig.h")) {
3025 if (!writeToFile("#include \"../../src/corelib/global/qconfig.h\"\n",
3026 buildPath + "/include/QtCore/qconfig.h")
3027 || !writeToFile("#include \"../../src/corelib/global/qconfig.h\"\n",
3028 buildPath + "/include/Qt/qconfig.h")) {
3029 dictionary["DONE"] = "error";
3030 return;
3035 // Copy configured mkspec to default directory, but remove the old one first, if there is any
3036 QString defSpec = buildPath + "/mkspecs/default";
3037 QFileInfo defSpecInfo(defSpec);
3038 if (defSpecInfo.exists()) {
3039 if (!Environment::rmdir(defSpec)) {
3040 cout << "Couldn't update default mkspec! Are files in " << qPrintable(defSpec) << " read-only?" << endl;
3041 dictionary["DONE"] = "error";
3042 return;
3046 QString spec = dictionary.contains("XQMAKESPEC") ? dictionary["XQMAKESPEC"] : dictionary["QMAKESPEC"];
3047 QString pltSpec = sourcePath + "/mkspecs/" + spec;
3048 if (!Environment::cpdir(pltSpec, defSpec)) {
3049 cout << "Couldn't update default mkspec! Does " << qPrintable(pltSpec) << " exist?" << endl;
3050 dictionary["DONE"] = "error";
3051 return;
3054 outName = defSpec + "/qmake.conf";
3055 ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL );
3056 QFile qmakeConfFile(outName);
3057 if (qmakeConfFile.open(QFile::Append | QFile::WriteOnly | QFile::Text)) {
3058 QTextStream qmakeConfStream;
3059 qmakeConfStream.setDevice(&qmakeConfFile);
3060 qmakeConfStream << endl << "QMAKESPEC_ORIGINAL=" << pltSpec << endl;
3061 qmakeConfStream.flush();
3062 qmakeConfFile.close();
3065 // Generate the new qconfig.cpp file
3066 QDir(buildPath).mkpath("src/corelib/global");
3067 outName = buildPath + "/src/corelib/global/qconfig.cpp";
3069 QTemporaryFile tmpFile2;
3070 if (tmpFile2.open()) {
3071 tmpStream.setDevice(&tmpFile2);
3072 tmpStream << "/* Licensed */" << endl
3073 << "static const char qt_configure_licensee_str [512 + 12] = \"qt_lcnsuser=" << licenseInfo["LICENSEE"] << "\";" << endl
3074 << "static const char qt_configure_licensed_products_str [512 + 12] = \"qt_lcnsprod=" << dictionary["EDITION"] << "\";" << endl
3075 << endl
3076 << "/* Build date */" << endl
3077 << "static const char qt_configure_installation [11 + 12] = \"qt_instdate=" << QDate::currentDate().toString(Qt::ISODate) << "\";" << endl
3078 << endl;
3079 if(!dictionary[ "QT_HOST_PREFIX" ].isNull())
3080 tmpStream << "#if !defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE)" << endl;
3081 tmpStream << "static const char qt_configure_prefix_path_str [512 + 12] = \"qt_prfxpath=" << QString(dictionary["QT_INSTALL_PREFIX"]).replace( "\\", "\\\\" ) << "\";" << endl
3082 << "static const char qt_configure_documentation_path_str[512 + 12] = \"qt_docspath=" << QString(dictionary["QT_INSTALL_DOCS"]).replace( "\\", "\\\\" ) << "\";" << endl
3083 << "static const char qt_configure_headers_path_str [512 + 12] = \"qt_hdrspath=" << QString(dictionary["QT_INSTALL_HEADERS"]).replace( "\\", "\\\\" ) << "\";" << endl
3084 << "static const char qt_configure_libraries_path_str [512 + 12] = \"qt_libspath=" << QString(dictionary["QT_INSTALL_LIBS"]).replace( "\\", "\\\\" ) << "\";" << endl
3085 << "static const char qt_configure_binaries_path_str [512 + 12] = \"qt_binspath=" << QString(dictionary["QT_INSTALL_BINS"]).replace( "\\", "\\\\" ) << "\";" << endl
3086 << "static const char qt_configure_plugins_path_str [512 + 12] = \"qt_plugpath=" << QString(dictionary["QT_INSTALL_PLUGINS"]).replace( "\\", "\\\\" ) << "\";" << endl
3087 << "static const char qt_configure_data_path_str [512 + 12] = \"qt_datapath=" << QString(dictionary["QT_INSTALL_DATA"]).replace( "\\", "\\\\" ) << "\";" << endl
3088 << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << QString(dictionary["QT_INSTALL_TRANSLATIONS"]).replace( "\\", "\\\\" ) << "\";" << endl
3089 << "static const char qt_configure_examples_path_str [512 + 12] = \"qt_xmplpath=" << QString(dictionary["QT_INSTALL_EXAMPLES"]).replace( "\\", "\\\\" ) << "\";" << endl
3090 << "static const char qt_configure_demos_path_str [512 + 12] = \"qt_demopath=" << QString(dictionary["QT_INSTALL_DEMOS"]).replace( "\\", "\\\\" ) << "\";" << endl
3091 //<< "static const char qt_configure_settings_path_str [256] = \"qt_stngpath=" << QString(dictionary["QT_INSTALL_SETTINGS"]).replace( "\\", "\\\\" ) << "\";" << endl
3093 if(!dictionary[ "QT_HOST_PREFIX" ].isNull()) {
3094 tmpStream << "#else" << endl
3095 << "static const char qt_configure_prefix_path_str [512 + 12] = \"qt_prfxpath=" << QString(dictionary[ "QT_HOST_PREFIX" ]).replace( "\\", "\\\\" ) << "\";" << endl
3096 << "static const char qt_configure_documentation_path_str[512 + 12] = \"qt_docspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/doc").replace( "\\", "\\\\" ) <<"\";" << endl
3097 << "static const char qt_configure_headers_path_str [512 + 12] = \"qt_hdrspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/include").replace( "\\", "\\\\" ) <<"\";" << endl
3098 << "static const char qt_configure_libraries_path_str [512 + 12] = \"qt_libspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/lib").replace( "\\", "\\\\" ) <<"\";" << endl
3099 << "static const char qt_configure_binaries_path_str [512 + 12] = \"qt_binspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/bin").replace( "\\", "\\\\" ) <<"\";" << endl
3100 << "static const char qt_configure_plugins_path_str [512 + 12] = \"qt_plugpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/plugins").replace( "\\", "\\\\" ) <<"\";" << endl
3101 << "static const char qt_configure_data_path_str [512 + 12] = \"qt_datapath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ]).replace( "\\", "\\\\" ) <<"\";" << endl
3102 << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/translations").replace( "\\", "\\\\" ) <<"\";" << endl
3103 << "static const char qt_configure_examples_path_str [512 + 12] = \"qt_xmplpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/example").replace( "\\", "\\\\" ) <<"\";" << endl
3104 << "static const char qt_configure_demos_path_str [512 + 12] = \"qt_demopath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/demos").replace( "\\", "\\\\" ) <<"\";" << endl
3105 << "#endif //QT_BOOTSTRAPPED" << endl;
3107 tmpStream << "/* strlen( \"qt_lcnsxxxx\" ) == 12 */" << endl
3108 << "#define QT_CONFIGURE_LICENSEE qt_configure_licensee_str + 12;" << endl
3109 << "#define QT_CONFIGURE_LICENSED_PRODUCTS qt_configure_licensed_products_str + 12;" << endl
3110 << "#define QT_CONFIGURE_PREFIX_PATH qt_configure_prefix_path_str + 12;" << endl
3111 << "#define QT_CONFIGURE_DOCUMENTATION_PATH qt_configure_documentation_path_str + 12;" << endl
3112 << "#define QT_CONFIGURE_HEADERS_PATH qt_configure_headers_path_str + 12;" << endl
3113 << "#define QT_CONFIGURE_LIBRARIES_PATH qt_configure_libraries_path_str + 12;" << endl
3114 << "#define QT_CONFIGURE_BINARIES_PATH qt_configure_binaries_path_str + 12;" << endl
3115 << "#define QT_CONFIGURE_PLUGINS_PATH qt_configure_plugins_path_str + 12;" << endl
3116 << "#define QT_CONFIGURE_DATA_PATH qt_configure_data_path_str + 12;" << endl
3117 << "#define QT_CONFIGURE_TRANSLATIONS_PATH qt_configure_translations_path_str + 12;" << endl
3118 << "#define QT_CONFIGURE_EXAMPLES_PATH qt_configure_examples_path_str + 12;" << endl
3119 << "#define QT_CONFIGURE_DEMOS_PATH qt_configure_demos_path_str + 12;" << endl
3120 //<< "#define QT_CONFIGURE_SETTINGS_PATH qt_configure_settings_path_str + 12;" << endl
3121 << endl;
3123 tmpStream.flush();
3124 tmpFile2.flush();
3126 // Replace old qconfig.cpp with new one
3127 ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL );
3128 QFile::remove( outName );
3129 tmpFile2.copy(outName);
3130 tmpFile2.close();
3133 QTemporaryFile tmpFile3;
3134 if (tmpFile3.open()) {
3135 tmpStream.setDevice(&tmpFile3);
3136 tmpStream << "/* Evaluation license key */" << endl
3137 << "static const char qt_eval_key_data [512 + 12] = \"qt_qevalkey=" << licenseInfo["LICENSEKEYEXT"] << "\";" << endl;
3139 tmpStream.flush();
3140 tmpFile3.flush();
3142 outName = buildPath + "/src/corelib/global/qconfig_eval.cpp";
3143 ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL );
3144 QFile::remove( outName );
3146 if (dictionary["EDITION"] == "Evaluation" || qmakeDefines.contains("QT_EVAL"))
3147 tmpFile3.copy(outName);
3148 tmpFile3.close();
3151 #endif
3153 #if !defined(EVAL)
3154 void Configure::displayConfig()
3156 // Give some feedback
3157 cout << "Environment:" << endl;
3158 QString env = QString::fromLocal8Bit(getenv("INCLUDE")).replace(QRegExp("[;,]"), "\r\n ");
3159 if (env.isEmpty())
3160 env = "Unset";
3161 cout << " INCLUDE=\r\n " << env << endl;
3162 env = QString::fromLocal8Bit(getenv("LIB")).replace(QRegExp("[;,]"), "\r\n ");
3163 if (env.isEmpty())
3164 env = "Unset";
3165 cout << " LIB=\r\n " << env << endl;
3166 env = QString::fromLocal8Bit(getenv("PATH")).replace(QRegExp("[;,]"), "\r\n ");
3167 if (env.isEmpty())
3168 env = "Unset";
3169 cout << " PATH=\r\n " << env << endl;
3171 if (dictionary["EDITION"] == "OpenSource") {
3172 cout << "You are licensed to use this software under the terms of the GNU GPL version 3.";
3173 cout << "You are licensed to use this software under the terms of the Lesser GNU LGPL version 2.1." << endl;
3174 cout << "See " << dictionary["LICENSE FILE"] << "3" << endl << endl
3175 << " or " << dictionary["LICENSE FILE"] << "L" << endl << endl;
3176 } else {
3177 QString l1 = licenseInfo[ "LICENSEE" ];
3178 QString l2 = licenseInfo[ "LICENSEID" ];
3179 QString l3 = dictionary["EDITION"] + ' ' + "Edition";
3180 QString l4 = licenseInfo[ "EXPIRYDATE" ];
3181 cout << "Licensee...................." << (l1.isNull() ? "" : l1) << endl;
3182 cout << "License ID.................." << (l2.isNull() ? "" : l2) << endl;
3183 cout << "Product license............." << (l3.isNull() ? "" : l3) << endl;
3184 cout << "Expiry Date................." << (l4.isNull() ? "" : l4) << endl << endl;
3187 cout << "Configuration:" << endl;
3188 cout << " " << qmakeConfig.join( "\r\n " ) << endl;
3189 cout << "Qt Configuration:" << endl;
3190 cout << " " << qtConfig.join( "\r\n " ) << endl;
3191 cout << endl;
3193 if (dictionary.contains("XQMAKESPEC"))
3194 cout << "QMAKESPEC..................." << dictionary[ "XQMAKESPEC" ] << " (" << dictionary["QMAKESPEC_FROM"] << ")" << endl;
3195 else
3196 cout << "QMAKESPEC..................." << dictionary[ "QMAKESPEC" ] << " (" << dictionary["QMAKESPEC_FROM"] << ")" << endl;
3197 cout << "Architecture................" << dictionary[ "ARCHITECTURE" ] << endl;
3198 cout << "Maketool...................." << dictionary[ "MAKE" ] << endl;
3199 cout << "Debug symbols..............." << (dictionary[ "BUILD" ] == "debug" ? "yes" : "no") << endl;
3200 cout << "Link Time Code Generation..." << dictionary[ "LTCG" ] << endl;
3201 cout << "Accessibility support......." << dictionary[ "ACCESSIBILITY" ] << endl;
3202 cout << "STL support................." << dictionary[ "STL" ] << endl;
3203 cout << "Exception support..........." << dictionary[ "EXCEPTIONS" ] << endl;
3204 cout << "RTTI support................" << dictionary[ "RTTI" ] << endl;
3205 cout << "MMX support................." << dictionary[ "MMX" ] << endl;
3206 cout << "3DNOW support..............." << dictionary[ "3DNOW" ] << endl;
3207 cout << "SSE support................." << dictionary[ "SSE" ] << endl;
3208 cout << "SSE2 support................" << dictionary[ "SSE2" ] << endl;
3209 cout << "IWMMXT support.............." << dictionary[ "IWMMXT" ] << endl;
3210 cout << "OpenGL support.............." << dictionary[ "OPENGL" ] << endl;
3211 cout << "OpenVG support.............." << dictionary[ "OPENVG" ] << endl;
3212 cout << "OpenSSL support............." << dictionary[ "OPENSSL" ] << endl;
3213 cout << "QtDBus support.............." << dictionary[ "DBUS" ] << endl;
3214 cout << "QtXmlPatterns support......." << dictionary[ "XMLPATTERNS" ] << endl;
3215 cout << "Phonon support.............." << dictionary[ "PHONON" ] << endl;
3216 cout << "QtMultimedia support........" << dictionary[ "MULTIMEDIA" ] << endl;
3217 cout << "WebKit support.............." << dictionary[ "WEBKIT" ] << endl;
3218 cout << "Declarative support........." << dictionary[ "DECLARATIVE" ] << endl;
3219 cout << "QtScript support............" << dictionary[ "SCRIPT" ] << endl;
3220 cout << "QtScriptTools support......." << dictionary[ "SCRIPTTOOLS" ] << endl;
3221 cout << "Graphics System............." << dictionary[ "GRAPHICS_SYSTEM" ] << endl;
3222 cout << "Qt3 compatibility..........." << dictionary[ "QT3SUPPORT" ] << endl << endl;
3224 cout << "Third Party Libraries:" << endl;
3225 cout << " ZLIB support............" << dictionary[ "ZLIB" ] << endl;
3226 cout << " GIF support............." << dictionary[ "GIF" ] << endl;
3227 cout << " TIFF support............" << dictionary[ "TIFF" ] << endl;
3228 cout << " JPEG support............" << dictionary[ "JPEG" ] << endl;
3229 cout << " PNG support............." << dictionary[ "PNG" ] << endl;
3230 cout << " MNG support............." << dictionary[ "MNG" ] << endl;
3231 cout << " FreeType support........" << dictionary[ "FREETYPE" ] << endl << endl;
3233 cout << "Styles:" << endl;
3234 cout << " Windows................." << dictionary[ "STYLE_WINDOWS" ] << endl;
3235 cout << " Windows XP.............." << dictionary[ "STYLE_WINDOWSXP" ] << endl;
3236 cout << " Windows Vista..........." << dictionary[ "STYLE_WINDOWSVISTA" ] << endl;
3237 cout << " Plastique..............." << dictionary[ "STYLE_PLASTIQUE" ] << endl;
3238 cout << " Cleanlooks.............." << dictionary[ "STYLE_CLEANLOOKS" ] << endl;
3239 cout << " Motif..................." << dictionary[ "STYLE_MOTIF" ] << endl;
3240 cout << " CDE....................." << dictionary[ "STYLE_CDE" ] << endl;
3241 cout << " Windows CE.............." << dictionary[ "STYLE_WINDOWSCE" ] << endl;
3242 cout << " Windows Mobile.........." << dictionary[ "STYLE_WINDOWSMOBILE" ] << endl;
3243 cout << " S60....................." << dictionary[ "STYLE_S60" ] << endl << endl;
3245 cout << "Sql Drivers:" << endl;
3246 cout << " ODBC...................." << dictionary[ "SQL_ODBC" ] << endl;
3247 cout << " MySQL..................." << dictionary[ "SQL_MYSQL" ] << endl;
3248 cout << " OCI....................." << dictionary[ "SQL_OCI" ] << endl;
3249 cout << " PostgreSQL.............." << dictionary[ "SQL_PSQL" ] << endl;
3250 cout << " TDS....................." << dictionary[ "SQL_TDS" ] << endl;
3251 cout << " DB2....................." << dictionary[ "SQL_DB2" ] << endl;
3252 cout << " SQLite.................." << dictionary[ "SQL_SQLITE" ] << " (" << dictionary[ "SQL_SQLITE_LIB" ] << ")" << endl;
3253 cout << " SQLite2................." << dictionary[ "SQL_SQLITE2" ] << endl;
3254 cout << " InterBase..............." << dictionary[ "SQL_IBASE" ] << endl << endl;
3256 cout << "Sources are in.............." << dictionary[ "QT_SOURCE_TREE" ] << endl;
3257 cout << "Build is done in............" << dictionary[ "QT_BUILD_TREE" ] << endl;
3258 cout << "Install prefix.............." << dictionary[ "QT_INSTALL_PREFIX" ] << endl;
3259 cout << "Headers installed to........" << dictionary[ "QT_INSTALL_HEADERS" ] << endl;
3260 cout << "Libraries installed to......" << dictionary[ "QT_INSTALL_LIBS" ] << endl;
3261 cout << "Plugins installed to........" << dictionary[ "QT_INSTALL_PLUGINS" ] << endl;
3262 cout << "Binaries installed to......." << dictionary[ "QT_INSTALL_BINS" ] << endl;
3263 cout << "Docs installed to..........." << dictionary[ "QT_INSTALL_DOCS" ] << endl;
3264 cout << "Data installed to..........." << dictionary[ "QT_INSTALL_DATA" ] << endl;
3265 cout << "Translations installed to..." << dictionary[ "QT_INSTALL_TRANSLATIONS" ] << endl;
3266 cout << "Examples installed to......." << dictionary[ "QT_INSTALL_EXAMPLES" ] << endl;
3267 cout << "Demos installed to.........." << dictionary[ "QT_INSTALL_DEMOS" ] << endl << endl;
3269 if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith(QLatin1String("wince"))) {
3270 cout << "Using c runtime detection..." << dictionary[ "CE_CRT" ] << endl;
3271 cout << "Cetest support.............." << dictionary[ "CETEST" ] << endl;
3272 cout << "Signature..................." << dictionary[ "CE_SIGNATURE"] << endl << endl;
3275 if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith(QLatin1String("symbian"))) {
3276 cout << "Support for S60............." << dictionary[ "S60" ] << endl;
3279 if(dictionary["ASSISTANT_WEBKIT"] == "yes")
3280 cout << "Using WebKit as html rendering engine in Qt Assistant." << endl;
3282 if(checkAvailability("INCREDIBUILD_XGE"))
3283 cout << "Using IncrediBuild XGE......" << dictionary["INCREDIBUILD_XGE"] << endl;
3284 if( !qmakeDefines.isEmpty() ) {
3285 cout << "Defines.....................";
3286 for( QStringList::Iterator defs = qmakeDefines.begin(); defs != qmakeDefines.end(); ++defs )
3287 cout << (*defs) << " ";
3288 cout << endl;
3290 if( !qmakeIncludes.isEmpty() ) {
3291 cout << "Include paths...............";
3292 for( QStringList::Iterator incs = qmakeIncludes.begin(); incs != qmakeIncludes.end(); ++incs )
3293 cout << (*incs) << " ";
3294 cout << endl;
3296 if( !qmakeLibs.isEmpty() ) {
3297 cout << "Additional libraries........";
3298 for( QStringList::Iterator libs = qmakeLibs.begin(); libs != qmakeLibs.end(); ++libs )
3299 cout << (*libs) << " ";
3300 cout << endl;
3302 if( dictionary[ "QMAKE_INTERNAL" ] == "yes" ) {
3303 cout << "Using internal configuration." << endl;
3305 if( dictionary[ "SHARED" ] == "no" ) {
3306 cout << "WARNING: Using static linking will disable the use of plugins." << endl;
3307 cout << " Make sure you compile ALL needed modules into the library." << endl;
3309 if( dictionary[ "OPENSSL" ] == "linked" && opensslLibs.isEmpty() ) {
3310 cout << "NOTE: When linking against OpenSSL, you can override the default" << endl;
3311 cout << "library names through OPENSSL_LIBS." << endl;
3312 cout << "For example:" << endl;
3313 cout << " configure -openssl-linked OPENSSL_LIBS='-lssleay32 -llibeay32'" << endl;
3315 if( dictionary[ "ZLIB_FORCED" ] == "yes" ) {
3316 QString which_zlib = "supplied";
3317 if( dictionary[ "ZLIB" ] == "system")
3318 which_zlib = "system";
3320 cout << "NOTE: The -no-zlib option was supplied but is no longer supported." << endl
3321 << endl
3322 << "Qt now requires zlib support in all builds, so the -no-zlib" << endl
3323 << "option was ignored. Qt will be built using the " << which_zlib
3324 << "zlib" << endl;
3327 #endif
3329 #if !defined(EVAL)
3330 void Configure::generateHeaders()
3332 if (dictionary["SYNCQT"] == "yes"
3333 && findFile("perl.exe")) {
3334 cout << "Running syncqt..." << endl;
3335 QStringList args;
3336 args += buildPath + "/bin/syncqt.bat";
3337 QStringList env;
3338 env += QString("QTDIR=" + sourcePath);
3339 env += QString("PATH=" + buildPath + "/bin/;" + qgetenv("PATH"));
3340 Environment::execute(args, env, QStringList());
3344 void Configure::buildQmake()
3346 if( dictionary[ "BUILD_QMAKE" ] == "yes" ) {
3347 QStringList args;
3349 // Build qmake
3350 QString pwd = QDir::currentPath();
3351 QDir::setCurrent(buildPath + "/qmake" );
3353 QString makefile = "Makefile";
3355 QFile out(makefile);
3356 if(out.open(QFile::WriteOnly | QFile::Text)) {
3357 QTextStream stream(&out);
3358 stream << "#AutoGenerated by configure.exe" << endl
3359 << "BUILD_PATH = " << QDir::convertSeparators(buildPath) << endl
3360 << "SOURCE_PATH = " << QDir::convertSeparators(sourcePath) << endl;
3361 stream << "QMAKESPEC = " << dictionary["QMAKESPEC"] << endl;
3363 if (dictionary["EDITION"] == "OpenSource" ||
3364 dictionary["QT_EDITION"].contains("OPENSOURCE"))
3365 stream << "QMAKE_OPENSOURCE_EDITION = yes" << endl;
3366 stream << "\n\n";
3368 QFile in(sourcePath + "/qmake/" + dictionary["QMAKEMAKEFILE"]);
3369 if(in.open(QFile::ReadOnly | QFile::Text)) {
3370 QString d = in.readAll();
3371 //### need replaces (like configure.sh)? --Sam
3372 stream << d << endl;
3374 stream.flush();
3375 out.close();
3379 args += dictionary[ "MAKE" ];
3380 args += "-f";
3381 args += makefile;
3383 cout << "Creating qmake..." << endl;
3384 int exitCode = 0;
3385 if( exitCode = Environment::execute(args, QStringList(), QStringList()) ) {
3386 args.clear();
3387 args += dictionary[ "MAKE" ];
3388 args += "-f";
3389 args += makefile;
3390 args += "clean";
3391 if( exitCode = Environment::execute(args, QStringList(), QStringList())) {
3392 cout << "Cleaning qmake failed, return code " << exitCode << endl << endl;
3393 dictionary[ "DONE" ] = "error";
3394 } else {
3395 args.clear();
3396 args += dictionary[ "MAKE" ];
3397 args += "-f";
3398 args += makefile;
3399 if (exitCode = Environment::execute(args, QStringList(), QStringList())) {
3400 cout << "Building qmake failed, return code " << exitCode << endl << endl;
3401 dictionary[ "DONE" ] = "error";
3405 QDir::setCurrent( pwd );
3408 #endif
3410 void Configure::buildHostTools()
3412 if (dictionary[ "NOPROCESS" ] == "yes")
3413 dictionary[ "DONE" ] = "yes";
3415 if (!dictionary.contains("XQMAKESPEC"))
3416 return;
3418 QString pwd = QDir::currentPath();
3419 QStringList hostToolsDirs;
3420 hostToolsDirs
3421 << "src/tools"
3422 << "tools/linguist/lrelease";
3424 if(dictionary["XQMAKESPEC"].startsWith("wince"))
3425 hostToolsDirs << "tools/checksdk";
3427 if (dictionary[ "CETEST" ] == "yes")
3428 hostToolsDirs << "tools/qtestlib/wince/cetest";
3430 for (int i = 0; i < hostToolsDirs.count(); ++i) {
3431 cout << "Creating " << hostToolsDirs.at(i) << " ..." << endl;
3432 QString toolBuildPath = buildPath + "/" + hostToolsDirs.at(i);
3433 QString toolSourcePath = sourcePath + "/" + hostToolsDirs.at(i);
3435 // generate Makefile
3436 QStringList args;
3437 args << QDir::toNativeSeparators(buildPath + "/bin/qmake");
3438 args << "-spec" << dictionary["QMAKESPEC"] << "-r";
3439 args << "-o" << QDir::toNativeSeparators(toolBuildPath + "/Makefile");
3441 QDir().mkpath(toolBuildPath);
3442 QDir::setCurrent(toolSourcePath);
3443 int exitCode = 0;
3444 if (exitCode = Environment::execute(args, QStringList(), QStringList())) {
3445 cout << "qmake failed, return code " << exitCode << endl << endl;
3446 dictionary["DONE"] = "error";
3447 break;
3450 // build app
3451 args.clear();
3452 args += dictionary["MAKE"];
3453 QDir::setCurrent(toolBuildPath);
3454 if (exitCode = Environment::execute(args, QStringList(), QStringList())) {
3455 args.clear();
3456 args += dictionary["MAKE"];
3457 args += "clean";
3458 if(exitCode = Environment::execute(args, QStringList(), QStringList())) {
3459 cout << "Cleaning " << hostToolsDirs.at(i) << " failed, return code " << exitCode << endl << endl;
3460 dictionary["DONE"] = "error";
3461 break;
3462 } else {
3463 args.clear();
3464 args += dictionary["MAKE"];
3465 if (exitCode = Environment::execute(args, QStringList(), QStringList())) {
3466 cout << "Building " << hostToolsDirs.at(i) << " failed, return code " << exitCode << endl << endl;
3467 dictionary["DONE"] = "error";
3468 break;
3473 QDir::setCurrent(pwd);
3476 void Configure::findProjects( const QString& dirName )
3478 if( dictionary[ "NOPROCESS" ] == "no" ) {
3479 QDir dir( dirName );
3480 QString entryName;
3481 int makeListNumber;
3482 ProjectType qmakeTemplate;
3483 const QFileInfoList &list = dir.entryInfoList(QStringList(QLatin1String("*.pro")),
3484 QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
3485 for(int i = 0; i < list.size(); ++i) {
3486 const QFileInfo &fi = list.at(i);
3487 if(fi.fileName() != "qmake.pro") {
3488 entryName = dirName + "/" + fi.fileName();
3489 if(fi.isDir()) {
3490 findProjects( entryName );
3491 } else {
3492 qmakeTemplate = projectType( fi.absoluteFilePath() );
3493 switch ( qmakeTemplate ) {
3494 case Lib:
3495 case Subdirs:
3496 makeListNumber = 1;
3497 break;
3498 default:
3499 makeListNumber = 2;
3500 break;
3502 makeList[makeListNumber].append(new MakeItem(sourceDir.relativeFilePath(fi.absolutePath()),
3503 fi.fileName(),
3504 "Makefile",
3505 qmakeTemplate));
3513 void Configure::appendMakeItem(int inList, const QString &item)
3515 QString dir;
3516 if (item != "src")
3517 dir = "/" + item;
3518 dir.prepend("/src");
3519 makeList[inList].append(new MakeItem(sourcePath + dir,
3520 item + ".pro", buildPath + dir + "/Makefile", Lib ) );
3521 if( dictionary[ "DSPFILES" ] == "yes" ) {
3522 makeList[inList].append( new MakeItem(sourcePath + dir,
3523 item + ".pro", buildPath + dir + "/" + item + ".dsp", Lib ) );
3525 if( dictionary[ "VCPFILES" ] == "yes" ) {
3526 makeList[inList].append( new MakeItem(sourcePath + dir,
3527 item + ".pro", buildPath + dir + "/" + item + ".vcp", Lib ) );
3529 if( dictionary[ "VCPROJFILES" ] == "yes" ) {
3530 makeList[inList].append( new MakeItem(sourcePath + dir,
3531 item + ".pro", buildPath + dir + "/" + item + ".vcproj", Lib ) );
3535 void Configure::generateMakefiles()
3537 if( dictionary[ "NOPROCESS" ] == "no" ) {
3538 #if !defined(EVAL)
3539 cout << "Creating makefiles in src..." << endl;
3540 #endif
3542 QString spec = dictionary.contains("XQMAKESPEC") ? dictionary[ "XQMAKESPEC" ] : dictionary[ "QMAKESPEC" ];
3543 if( spec != "win32-msvc" )
3544 dictionary[ "DSPFILES" ] = "no";
3546 if( spec != "win32-msvc.net" && !spec.startsWith("win32-msvc2") && !spec.startsWith(QLatin1String("wince")))
3547 dictionary[ "VCPROJFILES" ] = "no";
3549 int i = 0;
3550 QString pwd = QDir::currentPath();
3551 if (dictionary["FAST"] != "yes") {
3552 QString dirName;
3553 bool generate = true;
3554 bool doDsp = (dictionary["DSPFILES"] == "yes" || dictionary["VCPFILES"] == "yes"
3555 || dictionary["VCPROJFILES"] == "yes");
3556 while (generate) {
3557 QString pwd = QDir::currentPath();
3558 QString dirPath = fixSeparators(buildPath + dirName);
3559 QStringList args;
3561 args << fixSeparators( buildPath + "/bin/qmake" );
3563 if (doDsp) {
3564 if( dictionary[ "DEPENDENCIES" ] == "no" )
3565 args << "-nodepend";
3566 args << "-tp" << "vc";
3567 doDsp = false; // DSP files will be done
3568 printf("Generating Visual Studio project files...\n");
3569 } else {
3570 printf("Generating Makefiles...\n");
3571 generate = false; // Now Makefiles will be done
3573 args << "-spec";
3574 args << spec;
3575 args << "-r";
3576 args << (sourcePath + "/projects.pro");
3577 args << "-o";
3578 args << buildPath;
3579 if(!dictionary[ "QMAKEADDITIONALARGS" ].isEmpty())
3580 args << dictionary[ "QMAKEADDITIONALARGS" ];
3582 QDir::setCurrent( fixSeparators( dirPath ) );
3583 if( int exitCode = Environment::execute(args, QStringList(), QStringList()) ) {
3584 cout << "Qmake failed, return code " << exitCode << endl << endl;
3585 dictionary[ "DONE" ] = "error";
3588 } else {
3589 findProjects(sourcePath);
3590 for ( i=0; i<3; i++ ) {
3591 for ( int j=0; j<makeList[i].size(); ++j) {
3592 MakeItem *it=makeList[i][j];
3593 QString dirPath = fixSeparators( it->directory + "/" );
3594 QString projectName = it->proFile;
3595 QString makefileName = buildPath + "/" + dirPath + it->target;
3597 // For shadowbuilds, we need to create the path first
3598 QDir buildPathDir(buildPath);
3599 if (sourcePath != buildPath && !buildPathDir.exists(dirPath))
3600 buildPathDir.mkpath(dirPath);
3602 QStringList args;
3604 args << fixSeparators( buildPath + "/bin/qmake" );
3605 args << sourcePath + "/" + dirPath + projectName;
3606 args << dictionary[ "QMAKE_ALL_ARGS" ];
3608 cout << "For " << qPrintable(dirPath + projectName) << endl;
3609 args << "-o";
3610 args << it->target;
3611 args << "-spec";
3612 args << spec;
3613 if(!dictionary[ "QMAKEADDITIONALARGS" ].isEmpty())
3614 args << dictionary[ "QMAKEADDITIONALARGS" ];
3616 QDir::setCurrent( fixSeparators( dirPath ) );
3618 QFile file(makefileName);
3619 if (!file.open(QFile::WriteOnly)) {
3620 printf("failed on dirPath=%s, makefile=%s\n",
3621 qPrintable(dirPath), qPrintable(makefileName));
3622 continue;
3624 QTextStream txt(&file);
3625 txt << "all:\n";
3626 txt << "\t" << args.join(" ") << "\n";
3627 txt << "\t" << dictionary[ "MAKE" ] << " -f " << it->target << "\n";
3628 txt << "first: all\n";
3629 txt << "qmake:\n";
3630 txt << "\t" << args.join(" ") << "\n";
3634 QDir::setCurrent( pwd );
3635 } else {
3636 cout << "Processing of project files have been disabled." << endl;
3637 cout << "Only use this option if you really know what you're doing." << endl << endl;
3638 return;
3642 void Configure::showSummary()
3644 QString make = dictionary[ "MAKE" ];
3645 if (!dictionary.contains("XQMAKESPEC")) {
3646 cout << endl << endl << "Qt is now configured for building. Just run " << qPrintable(make) << "." << endl;
3647 cout << "To reconfigure, run " << qPrintable(make) << " confclean and configure." << endl << endl;
3648 } else if(dictionary.value("QMAKESPEC").startsWith("wince")) {
3649 // we are cross compiling for Windows CE
3650 cout << endl << endl << "Qt is now configured for building. To start the build run:" << endl
3651 << "\tsetcepaths " << dictionary.value("XQMAKESPEC") << endl
3652 << "\t" << qPrintable(make) << endl
3653 << "To reconfigure, run " << qPrintable(make) << " confclean and configure." << endl << endl;
3654 } else { // Compiling for Symbian OS
3655 cout << endl << endl << "Qt is now configured for building. To start the build run:" << qPrintable(dictionary["QTBUILDINSTRUCTION"]) << "." << endl
3656 << "To reconfigure, run '" << qPrintable(dictionary["CONFCLEANINSTRUCTION"]) << "' and configure." << endl;
3660 Configure::ProjectType Configure::projectType( const QString& proFileName )
3662 QFile proFile( proFileName );
3663 if( proFile.open( QFile::ReadOnly ) ) {
3664 QString buffer = proFile.readLine(1024);
3665 while (!buffer.isEmpty()) {
3666 QStringList segments = buffer.split(QRegExp( "\\s" ));
3667 QStringList::Iterator it = segments.begin();
3669 if(segments.size() >= 3) {
3670 QString keyword = (*it++);
3671 QString operation = (*it++);
3672 QString value = (*it++);
3674 if( keyword == "TEMPLATE" ) {
3675 if( value == "lib" )
3676 return Lib;
3677 else if( value == "subdirs" )
3678 return Subdirs;
3681 // read next line
3682 buffer = proFile.readLine(1024);
3684 proFile.close();
3686 // Default to app handling
3687 return App;
3690 #if !defined(EVAL)
3692 bool Configure::showLicense(QString orgLicenseFile)
3694 if (dictionary["LICENSE_CONFIRMED"] == "yes") {
3695 cout << "You have already accepted the terms of the license." << endl << endl;
3696 return true;
3699 bool haveGpl3 = false;
3700 QString licenseFile = orgLicenseFile;
3701 QString theLicense;
3702 if (dictionary["EDITION"] == "OpenSource" || dictionary["EDITION"] == "Snapshot") {
3703 haveGpl3 = QFile::exists(orgLicenseFile + "/LICENSE.GPL3");
3704 theLicense = "GNU Lesser General Public License (LGPL) version 2.1";
3705 if (haveGpl3)
3706 theLicense += "\nor the GNU General Public License (GPL) version 3";
3707 } else {
3708 // the first line of the license file tells us which license it is
3709 QFile file(licenseFile);
3710 if (!file.open(QFile::ReadOnly)) {
3711 cout << "Failed to load LICENSE file" << endl;
3712 return false;
3714 theLicense = file.readLine().trimmed();
3717 forever {
3718 char accept = '?';
3719 cout << "You are licensed to use this software under the terms of" << endl
3720 << "the " << theLicense << "." << endl
3721 << endl;
3722 if (dictionary["EDITION"] == "OpenSource" || dictionary["EDITION"] == "Snapshot") {
3723 if (haveGpl3)
3724 cout << "Type '3' to view the GNU General Public License version 3 (GPLv3)." << endl;
3725 cout << "Type 'L' to view the Lesser GNU General Public License version 2.1 (LGPLv2.1)." << endl;
3726 } else {
3727 cout << "Type '?' to view the " << theLicense << "." << endl;
3729 cout << "Type 'y' to accept this license offer." << endl
3730 << "Type 'n' to decline this license offer." << endl
3731 << endl
3732 << "Do you accept the terms of the license?" << endl;
3733 cin >> accept;
3734 accept = tolower(accept);
3736 if (accept == 'y') {
3737 return true;
3738 } else if (accept == 'n') {
3739 return false;
3740 } else {
3741 if (dictionary["EDITION"] == "OpenSource" || dictionary["EDITION"] == "Snapshot") {
3742 if (accept == '3')
3743 licenseFile = orgLicenseFile + "/LICENSE.GPL3";
3744 else
3745 licenseFile = orgLicenseFile + "/LICENSE.LGPL";
3747 // Get console line height, to fill the screen properly
3748 int i = 0, screenHeight = 25; // default
3749 CONSOLE_SCREEN_BUFFER_INFO consoleInfo;
3750 HANDLE stdOut = GetStdHandle(STD_OUTPUT_HANDLE);
3751 if (GetConsoleScreenBufferInfo(stdOut, &consoleInfo))
3752 screenHeight = consoleInfo.srWindow.Bottom
3753 - consoleInfo.srWindow.Top
3754 - 1; // Some overlap for context
3756 // Prompt the license content to the user
3757 QFile file(licenseFile);
3758 if (!file.open(QFile::ReadOnly)) {
3759 cout << "Failed to load LICENSE file" << licenseFile << endl;
3760 return false;
3762 QStringList licenseContent = QString(file.readAll()).split('\n');
3763 while(i < licenseContent.size()) {
3764 cout << licenseContent.at(i) << endl;
3765 if (++i % screenHeight == 0) {
3766 cout << "(Press any key for more..)";
3767 if(_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
3768 exit(0); // Exit cleanly for Ctrl+C
3769 cout << "\r"; // Overwrite text above
3776 void Configure::readLicense()
3778 if (QFile::exists(dictionary["QT_SOURCE_TREE"] + "/src/corelib/kernel/qfunctions_wince.h") &&
3779 (dictionary.value("QMAKESPEC").startsWith("wince") || dictionary.value("XQMAKESPEC").startsWith("wince")))
3780 dictionary["PLATFORM NAME"] = "Qt for Windows CE";
3781 else if (dictionary.value("XQMAKESPEC").startsWith("symbian"))
3782 dictionary["PLATFORM NAME"] = "Qt for Symbian";
3783 else
3784 dictionary["PLATFORM NAME"] = "Qt for Windows";
3785 dictionary["LICENSE FILE"] = sourcePath;
3787 bool openSource = false;
3788 bool hasOpenSource = QFile::exists(dictionary["LICENSE FILE"] + "/LICENSE.GPL3") || QFile::exists(dictionary["LICENSE FILE"] + "/LICENSE.LGPL");
3789 if (dictionary["BUILDNOKIA"] == "yes" || dictionary["BUILDTYPE"] == "commercial") {
3790 openSource = false;
3791 } else if (dictionary["BUILDTYPE"] == "opensource") {
3792 openSource = true;
3793 } else if (hasOpenSource) { // No Open Source? Just display the commercial license right away
3794 forever {
3795 char accept = '?';
3796 cout << "Which edition of Qt do you want to use ?" << endl;
3797 cout << "Type 'c' if you want to use the Commercial Edition." << endl;
3798 cout << "Type 'o' if you want to use the Open Source Edition." << endl;
3799 cin >> accept;
3800 accept = tolower(accept);
3802 if (accept == 'c') {
3803 openSource = false;
3804 break;
3805 } else if (accept == 'o') {
3806 openSource = true;
3807 break;
3811 if (hasOpenSource && openSource) {
3812 cout << endl << "This is the " << dictionary["PLATFORM NAME"] << " Open Source Edition." << endl;
3813 licenseInfo["LICENSEE"] = "Open Source";
3814 dictionary["EDITION"] = "OpenSource";
3815 dictionary["QT_EDITION"] = "QT_EDITION_OPENSOURCE";
3816 cout << endl;
3817 if (!showLicense(dictionary["LICENSE FILE"])) {
3818 cout << "Configuration aborted since license was not accepted";
3819 dictionary["DONE"] = "error";
3820 return;
3822 } else if (openSource) {
3823 cout << endl << "Cannot find the GPL license files! Please download the Open Source version of the library." << endl;
3824 dictionary["DONE"] = "error";
3826 #ifdef COMMERCIAL_VERSION
3827 else {
3828 Tools::checkLicense(dictionary, licenseInfo, firstLicensePath());
3829 if (dictionary["DONE"] != "error" && dictionary["BUILDNOKIA"] != "yes") {
3830 // give the user some feedback, and prompt for license acceptance
3831 cout << endl << "This is the " << dictionary["PLATFORM NAME"] << " " << dictionary["EDITION"] << " Edition."<< endl << endl;
3832 if (!showLicense(dictionary["LICENSE FILE"])) {
3833 cout << "Configuration aborted since license was not accepted";
3834 dictionary["DONE"] = "error";
3835 return;
3839 #else // !COMMERCIAL_VERSION
3840 else {
3841 cout << endl << "Cannot build commercial edition from the open source version of the library." << endl;
3842 dictionary["DONE"] = "error";
3844 #endif
3847 void Configure::reloadCmdLine()
3849 if( dictionary[ "REDO" ] == "yes" ) {
3850 QFile inFile( buildPath + "/configure" + dictionary[ "CUSTOMCONFIG" ] + ".cache" );
3851 if( inFile.open( QFile::ReadOnly ) ) {
3852 QTextStream inStream( &inFile );
3853 QString buffer;
3854 inStream >> buffer;
3855 while( buffer.length() ) {
3856 configCmdLine += buffer;
3857 inStream >> buffer;
3859 inFile.close();
3864 void Configure::saveCmdLine()
3866 if( dictionary[ "REDO" ] != "yes" ) {
3867 QFile outFile( buildPath + "/configure" + dictionary[ "CUSTOMCONFIG" ] + ".cache" );
3868 if( outFile.open( QFile::WriteOnly | QFile::Text ) ) {
3869 QTextStream outStream( &outFile );
3870 for( QStringList::Iterator it = configCmdLine.begin(); it != configCmdLine.end(); ++it ) {
3871 outStream << (*it) << " " << endl;
3873 outStream.flush();
3874 outFile.close();
3878 #endif // !EVAL
3880 bool Configure::isDone()
3882 return !dictionary["DONE"].isEmpty();
3885 bool Configure::isOk()
3887 return (dictionary[ "DONE" ] != "error");
3890 bool
3891 Configure::filesDiffer(const QString &fn1, const QString &fn2)
3893 QFile file1(fn1), file2(fn2);
3894 if(!file1.open(QFile::ReadOnly) || !file2.open(QFile::ReadOnly))
3895 return true;
3896 const int chunk = 2048;
3897 int used1 = 0, used2 = 0;
3898 char b1[chunk], b2[chunk];
3899 while(!file1.atEnd() && !file2.atEnd()) {
3900 if(!used1)
3901 used1 = file1.read(b1, chunk);
3902 if(!used2)
3903 used2 = file2.read(b2, chunk);
3904 if(used1 > 0 && used2 > 0) {
3905 const int cmp = qMin(used1, used2);
3906 if(memcmp(b1, b2, cmp))
3907 return true;
3908 if((used1 -= cmp))
3909 memcpy(b1, b1+cmp, used1);
3910 if((used2 -= cmp))
3911 memcpy(b2, b2+cmp, used2);
3914 return !file1.atEnd() || !file2.atEnd();
3917 QT_END_NAMESPACE