Make script and scripttools autodetect, like webkit
[qt-netbsd.git] / tools / configure / configureapp.cpp
blobaff7e7b083e412b6ed83779455004b2f40ad4c6e
1 /****************************************************************************
2 **
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: Nokia Corporation (qt-info@nokia.com)
5 **
6 ** This file is part of the tools applications of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** No Commercial Usage
10 ** This file contains pre-release code and may not be distributed.
11 ** You may use this file in accordance with the terms and conditions
12 ** contained in the either Technology Preview License Agreement or the
13 ** Beta Release License Agreement.
15 ** GNU Lesser General Public License Usage
16 ** Alternatively, this file may be used under the terms of the GNU Lesser
17 ** General Public License version 2.1 as published by the Free Software
18 ** Foundation and appearing in the file LICENSE.LGPL included in the
19 ** packaging of this file. Please review the following information to
20 ** ensure the GNU Lesser General Public License version 2.1 requirements
21 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23 ** In addition, as a special exception, Nokia gives you certain
24 ** additional rights. These rights are described in the Nokia Qt LGPL
25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26 ** package.
28 ** GNU General Public License Usage
29 ** Alternatively, this file may be used under the terms of the GNU
30 ** General Public License version 3.0 as published by the Free Software
31 ** Foundation and appearing in the file LICENSE.GPL included in the
32 ** packaging of this file. Please review the following information to
33 ** ensure the GNU General Public License version 3.0 requirements will be
34 ** met: http://www.gnu.org/copyleft/gpl.html.
36 ** If you are unsure which license is appropriate for your use, please
37 ** contact the sales department at http://www.qtsoftware.com/contact.
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[ "DIRECTSHOW" ] = "no";
251 dictionary[ "WEBKIT" ] = "auto";
252 dictionary[ "PLUGIN_MANIFESTS" ] = "yes";
254 QString version;
255 QFile qglobal_h(sourcePath + "/src/corelib/global/qglobal.h");
256 if (qglobal_h.open(QFile::ReadOnly)) {
257 QTextStream read(&qglobal_h);
258 QRegExp version_regexp("^# *define *QT_VERSION_STR *\"([^\"]*)\"");
259 QString line;
260 while (!read.atEnd()) {
261 line = read.readLine();
262 if (version_regexp.exactMatch(line)) {
263 version = version_regexp.cap(1).trimmed();
264 if (!version.isEmpty())
265 break;
268 qglobal_h.close();
271 if (version.isEmpty())
272 version = QString("%1.%2.%3").arg(QT_VERSION>>16).arg(((QT_VERSION>>8)&0xff)).arg(QT_VERSION&0xff);
274 dictionary[ "VERSION" ] = version;
276 QRegExp version_re("([0-9]*)\\.([0-9]*)\\.([0-9]*)(|-.*)");
277 if(version_re.exactMatch(version)) {
278 dictionary[ "VERSION_MAJOR" ] = version_re.cap(1);
279 dictionary[ "VERSION_MINOR" ] = version_re.cap(2);
280 dictionary[ "VERSION_PATCH" ] = version_re.cap(3);
284 dictionary[ "REDO" ] = "no";
285 dictionary[ "DEPENDENCIES" ] = "no";
287 dictionary[ "BUILD" ] = "debug";
288 dictionary[ "BUILDALL" ] = "auto"; // Means yes, but not explicitly
290 dictionary[ "BUILDTYPE" ] = "none";
292 dictionary[ "BUILDDEV" ] = "no";
293 dictionary[ "BUILDNOKIA" ] = "no";
295 dictionary[ "SHARED" ] = "yes";
297 dictionary[ "ZLIB" ] = "auto";
299 dictionary[ "GIF" ] = "auto";
300 dictionary[ "TIFF" ] = "auto";
301 dictionary[ "JPEG" ] = "auto";
302 dictionary[ "PNG" ] = "auto";
303 dictionary[ "MNG" ] = "auto";
304 dictionary[ "LIBTIFF" ] = "auto";
305 dictionary[ "LIBJPEG" ] = "auto";
306 dictionary[ "LIBPNG" ] = "auto";
307 dictionary[ "LIBMNG" ] = "auto";
309 dictionary[ "QT3SUPPORT" ] = "yes";
310 dictionary[ "ACCESSIBILITY" ] = "yes";
311 dictionary[ "OPENGL" ] = "yes";
312 dictionary[ "IPV6" ] = "yes"; // Always, dynamicly loaded
313 dictionary[ "OPENSSL" ] = "auto";
314 dictionary[ "DBUS" ] = "auto";
316 dictionary[ "STYLE_WINDOWS" ] = "yes";
317 dictionary[ "STYLE_WINDOWSXP" ] = "auto";
318 dictionary[ "STYLE_WINDOWSVISTA" ] = "auto";
319 dictionary[ "STYLE_PLASTIQUE" ] = "yes";
320 dictionary[ "STYLE_CLEANLOOKS" ]= "yes";
321 dictionary[ "STYLE_WINDOWSCE" ] = "no";
322 dictionary[ "STYLE_WINDOWSMOBILE" ] = "no";
323 dictionary[ "STYLE_MOTIF" ] = "yes";
324 dictionary[ "STYLE_CDE" ] = "yes";
325 dictionary[ "STYLE_GTK" ] = "no";
327 dictionary[ "SQL_MYSQL" ] = "no";
328 dictionary[ "SQL_ODBC" ] = "no";
329 dictionary[ "SQL_OCI" ] = "no";
330 dictionary[ "SQL_PSQL" ] = "no";
331 dictionary[ "SQL_TDS" ] = "no";
332 dictionary[ "SQL_DB2" ] = "no";
333 dictionary[ "SQL_SQLITE" ] = "auto";
334 dictionary[ "SQL_SQLITE_LIB" ] = "qt";
335 dictionary[ "SQL_SQLITE2" ] = "no";
336 dictionary[ "SQL_IBASE" ] = "no";
337 dictionary[ "GRAPHICS_SYSTEM" ] = "raster";
339 QString tmp = dictionary[ "QMAKESPEC" ];
340 if (tmp.contains("\\")) {
341 tmp = tmp.mid( tmp.lastIndexOf( "\\" ) + 1 );
342 } else {
343 tmp = tmp.mid( tmp.lastIndexOf("/") + 1 );
345 dictionary[ "QMAKESPEC" ] = tmp;
347 dictionary[ "INCREDIBUILD_XGE" ] = "auto";
348 dictionary[ "LTCG" ] = "no";
351 Configure::~Configure()
353 for (int i=0; i<3; ++i) {
354 QList<MakeItem*> items = makeList[i];
355 for (int j=0; j<items.size(); ++j)
356 delete items[j];
360 QString Configure::fixSeparators(QString somePath)
362 return useUnixSeparators ?
363 QDir::fromNativeSeparators(somePath) :
364 QDir::toNativeSeparators(somePath);
367 // We could use QDir::homePath() + "/.qt-license", but
368 // that will only look in the first of $HOME,$USERPROFILE
369 // or $HOMEDRIVE$HOMEPATH. So, here we try'em all to be
370 // more forgiving for the end user..
371 QString Configure::firstLicensePath()
373 QStringList allPaths;
374 allPaths << "./.qt-license"
375 << QString::fromLocal8Bit(getenv("HOME")) + "/.qt-license"
376 << QString::fromLocal8Bit(getenv("USERPROFILE")) + "/.qt-license"
377 << QString::fromLocal8Bit(getenv("HOMEDRIVE")) + QString::fromLocal8Bit(getenv("HOMEPATH")) + "/.qt-license";
378 for (int i = 0; i< allPaths.count(); ++i)
379 if (QFile::exists(allPaths.at(i)))
380 return allPaths.at(i);
381 return QString();
385 // #### somehow I get a compiler error about vc++ reaching the nesting limit without
386 // undefining the ansi for scoping.
387 #ifdef for
388 #undef for
389 #endif
391 void Configure::parseCmdLine()
393 int argCount = configCmdLine.size();
394 int i = 0;
396 #if !defined(EVAL)
397 if (argCount < 1) // skip rest if no arguments
399 else if( configCmdLine.at(i) == "-redo" ) {
400 dictionary[ "REDO" ] = "yes";
401 configCmdLine.clear();
402 reloadCmdLine();
404 else if( configCmdLine.at(i) == "-loadconfig" ) {
405 ++i;
406 if (i != argCount) {
407 dictionary[ "REDO" ] = "yes";
408 dictionary[ "CUSTOMCONFIG" ] = "_" + configCmdLine.at(i);
409 configCmdLine.clear();
410 reloadCmdLine();
411 } else {
412 dictionary[ "HELP" ] = "yes";
414 i = 0;
416 argCount = configCmdLine.size();
417 #endif
419 // Look first for XQMAKESPEC
420 for(int j = 0 ; j < argCount; ++j)
422 if( configCmdLine.at(j) == "-xplatform") {
423 ++j;
424 if (j == argCount)
425 break;
426 dictionary["XQMAKESPEC"] = configCmdLine.at(j);
427 if (!dictionary[ "XQMAKESPEC" ].isEmpty())
428 applySpecSpecifics();
432 for( ; i<configCmdLine.size(); ++i ) {
433 bool continueElse = false;
434 if( configCmdLine.at(i) == "-help"
435 || configCmdLine.at(i) == "-h"
436 || configCmdLine.at(i) == "-?" )
437 dictionary[ "HELP" ] = "yes";
439 #if !defined(EVAL)
440 else if( configCmdLine.at(i) == "-qconfig" ) {
441 ++i;
442 if (i==argCount)
443 break;
444 dictionary[ "QCONFIG" ] = configCmdLine.at(i);
447 else if ( configCmdLine.at(i) == "-buildkey" ) {
448 ++i;
449 if (i==argCount)
450 break;
451 dictionary[ "USER_BUILD_KEY" ] = configCmdLine.at(i);
454 else if( configCmdLine.at(i) == "-release" ) {
455 dictionary[ "BUILD" ] = "release";
456 if (dictionary[ "BUILDALL" ] == "auto")
457 dictionary[ "BUILDALL" ] = "no";
458 } else if( configCmdLine.at(i) == "-debug" ) {
459 dictionary[ "BUILD" ] = "debug";
460 if (dictionary[ "BUILDALL" ] == "auto")
461 dictionary[ "BUILDALL" ] = "no";
462 } else if( configCmdLine.at(i) == "-debug-and-release" )
463 dictionary[ "BUILDALL" ] = "yes";
465 else if( configCmdLine.at(i) == "-shared" )
466 dictionary[ "SHARED" ] = "yes";
467 else if( configCmdLine.at(i) == "-static" )
468 dictionary[ "SHARED" ] = "no";
469 else if( configCmdLine.at(i) == "-developer-build" )
470 dictionary[ "BUILDDEV" ] = "yes";
471 else if( configCmdLine.at(i) == "-nokia-developer" ) {
472 cout << "Detected -nokia-developer option" << endl;
473 cout << "Nokia employees and agents are allowed to use this software under" << endl;
474 cout << "the authority of Nokia Corporation and/or its subsidiary(-ies)" << endl;
475 dictionary[ "BUILDNOKIA" ] = "yes";
476 dictionary[ "BUILDDEV" ] = "yes";
477 dictionary["LICENSE_CONFIRMED"] = "yes";
479 else if( configCmdLine.at(i) == "-opensource" ) {
480 dictionary[ "BUILDTYPE" ] = "opensource";
482 else if( configCmdLine.at(i) == "-commercial" ) {
483 dictionary[ "BUILDTYPE" ] = "commercial";
485 else if( configCmdLine.at(i) == "-ltcg" ) {
486 dictionary[ "LTCG" ] = "yes";
488 else if( configCmdLine.at(i) == "-no-ltcg" ) {
489 dictionary[ "LTCG" ] = "no";
491 #endif
493 else if( configCmdLine.at(i) == "-platform" ) {
494 ++i;
495 if (i==argCount)
496 break;
497 dictionary[ "QMAKESPEC" ] = configCmdLine.at(i);
498 dictionary[ "QMAKESPEC_FROM" ] = "commandline";
499 } else if( configCmdLine.at(i) == "-arch" ) {
500 ++i;
501 if (i==argCount)
502 break;
503 dictionary[ "ARCHITECTURE" ] = configCmdLine.at(i);
504 if (configCmdLine.at(i) == "boundschecker") {
505 dictionary[ "ARCHITECTURE" ] = "generic"; // Boundschecker uses the generic arch,
506 qtConfig += "boundschecker"; // but also needs this CONFIG option
508 } else if( configCmdLine.at(i) == "-embedded" ) {
509 dictionary[ "EMBEDDED" ] = "yes";
510 } else if( configCmdLine.at(i) == "-xplatform") {
511 ++i;
512 // do nothing
516 #if !defined(EVAL)
517 else if( configCmdLine.at(i) == "-no-zlib" ) {
518 // No longer supported since Qt 4.4.0
519 // But save the information for later so that we can print a warning
521 // If you REALLY really need no zlib support, you can still disable
522 // it by doing the following:
523 // add "no-zlib" to mkspecs/qconfig.pri
524 // #define QT_NO_COMPRESS (probably by adding to src/corelib/global/qconfig.h)
526 // There's no guarantee that Qt will build under those conditions
528 dictionary[ "ZLIB_FORCED" ] = "yes";
529 } else if( configCmdLine.at(i) == "-qt-zlib" ) {
530 dictionary[ "ZLIB" ] = "qt";
531 } else if( configCmdLine.at(i) == "-system-zlib" ) {
532 dictionary[ "ZLIB" ] = "system";
535 // Image formats --------------------------------------------
536 else if( configCmdLine.at(i) == "-no-gif" )
537 dictionary[ "GIF" ] = "no";
538 else if( configCmdLine.at(i) == "-qt-gif" )
539 dictionary[ "GIF" ] = "auto";
541 else if( configCmdLine.at(i) == "-no-libtiff" ) {
542 dictionary[ "TIFF"] = "no";
543 dictionary[ "LIBTIFF" ] = "no";
544 } else if( configCmdLine.at(i) == "-qt-libtiff" ) {
545 dictionary[ "TIFF" ] = "plugin";
546 dictionary[ "LIBTIFF" ] = "qt";
547 } else if( configCmdLine.at(i) == "-system-libtiff" ) {
548 dictionary[ "TIFF" ] = "plugin";
549 dictionary[ "LIBTIFF" ] = "system";
552 else if( configCmdLine.at(i) == "-no-libjpeg" ) {
553 dictionary[ "JPEG" ] = "no";
554 dictionary[ "LIBJPEG" ] = "no";
555 } else if( configCmdLine.at(i) == "-qt-libjpeg" ) {
556 dictionary[ "JPEG" ] = "plugin";
557 dictionary[ "LIBJPEG" ] = "qt";
558 } else if( configCmdLine.at(i) == "-system-libjpeg" ) {
559 dictionary[ "JPEG" ] = "plugin";
560 dictionary[ "LIBJPEG" ] = "system";
563 else if( configCmdLine.at(i) == "-no-libpng" ) {
564 dictionary[ "PNG" ] = "no";
565 dictionary[ "LIBPNG" ] = "no";
566 } else if( configCmdLine.at(i) == "-qt-libpng" ) {
567 dictionary[ "PNG" ] = "qt";
568 dictionary[ "LIBPNG" ] = "qt";
569 } else if( configCmdLine.at(i) == "-system-libpng" ) {
570 dictionary[ "PNG" ] = "qt";
571 dictionary[ "LIBPNG" ] = "system";
574 else if( configCmdLine.at(i) == "-no-libmng" ) {
575 dictionary[ "MNG" ] = "no";
576 dictionary[ "LIBMNG" ] = "no";
577 } else if( configCmdLine.at(i) == "-qt-libmng" ) {
578 dictionary[ "MNG" ] = "qt";
579 dictionary[ "LIBMNG" ] = "qt";
580 } else if( configCmdLine.at(i) == "-system-libmng" ) {
581 dictionary[ "MNG" ] = "qt";
582 dictionary[ "LIBMNG" ] = "system";
584 // CE- C runtime --------------------------------------------
585 else if( configCmdLine.at(i) == "-crt" ) {
586 ++i;
587 if (i==argCount)
588 break;
589 QDir cDir(configCmdLine.at(i));
590 if (!cDir.exists())
591 cout << "WARNING: Could not find directory (" << qPrintable(configCmdLine.at(i)) << ")for C runtime deployment" << endl;
592 else
593 dictionary[ "CE_CRT" ] = QDir::toNativeSeparators(cDir.absolutePath());
594 } else if (configCmdLine.at(i) == "-qt-crt") {
595 dictionary[ "CE_CRT" ] = "yes";
596 } else if (configCmdLine.at(i) == "-no-crt") {
597 dictionary[ "CE_CRT" ] = "no";
599 // cetest ---------------------------------------------------
600 else if (configCmdLine.at(i) == "-no-cetest") {
601 dictionary[ "CETEST" ] = "no";
602 dictionary[ "CETEST_REQUESTED" ] = "no";
603 } else if (configCmdLine.at(i) == "-cetest") {
604 // although specified to use it, we stay at "auto" state
605 // this is because checkAvailability() adds variables
606 // we need for crosscompilation; but remember if we asked
607 // for it.
608 dictionary[ "CETEST_REQUESTED" ] = "yes";
610 // Qt/CE - signing tool -------------------------------------
611 else if( configCmdLine.at(i) == "-signature") {
612 ++i;
613 if (i==argCount)
614 break;
615 QFileInfo info(configCmdLine.at(i));
616 if (!info.exists())
617 cout << "WARNING: Could not find signature file (" << qPrintable(configCmdLine.at(i)) << ")" << endl;
618 else
619 dictionary[ "CE_SIGNATURE" ] = QDir::toNativeSeparators(info.absoluteFilePath());
621 // Styles ---------------------------------------------------
622 else if( configCmdLine.at(i) == "-qt-style-windows" )
623 dictionary[ "STYLE_WINDOWS" ] = "yes";
624 else if( configCmdLine.at(i) == "-no-style-windows" )
625 dictionary[ "STYLE_WINDOWS" ] = "no";
627 else if( configCmdLine.at(i) == "-qt-style-windowsce" )
628 dictionary[ "STYLE_WINDOWSCE" ] = "yes";
629 else if( configCmdLine.at(i) == "-no-style-windowsce" )
630 dictionary[ "STYLE_WINDOWSCE" ] = "no";
631 else if( configCmdLine.at(i) == "-qt-style-windowsmobile" )
632 dictionary[ "STYLE_WINDOWSMOBILE" ] = "yes";
633 else if( configCmdLine.at(i) == "-no-style-windowsmobile" )
634 dictionary[ "STYLE_WINDOWSMOBILE" ] = "no";
636 else if( configCmdLine.at(i) == "-qt-style-windowsxp" )
637 dictionary[ "STYLE_WINDOWSXP" ] = "yes";
638 else if( configCmdLine.at(i) == "-no-style-windowsxp" )
639 dictionary[ "STYLE_WINDOWSXP" ] = "no";
641 else if( configCmdLine.at(i) == "-qt-style-windowsvista" )
642 dictionary[ "STYLE_WINDOWSVISTA" ] = "yes";
643 else if( configCmdLine.at(i) == "-no-style-windowsvista" )
644 dictionary[ "STYLE_WINDOWSVISTA" ] = "no";
646 else if( configCmdLine.at(i) == "-qt-style-plastique" )
647 dictionary[ "STYLE_PLASTIQUE" ] = "yes";
648 else if( configCmdLine.at(i) == "-no-style-plastique" )
649 dictionary[ "STYLE_PLASTIQUE" ] = "no";
651 else if( configCmdLine.at(i) == "-qt-style-cleanlooks" )
652 dictionary[ "STYLE_CLEANLOOKS" ] = "yes";
653 else if( configCmdLine.at(i) == "-no-style-cleanlooks" )
654 dictionary[ "STYLE_CLEANLOOKS" ] = "no";
656 else if( configCmdLine.at(i) == "-qt-style-motif" )
657 dictionary[ "STYLE_MOTIF" ] = "yes";
658 else if( configCmdLine.at(i) == "-no-style-motif" )
659 dictionary[ "STYLE_MOTIF" ] = "no";
661 else if( configCmdLine.at(i) == "-qt-style-cde" )
662 dictionary[ "STYLE_CDE" ] = "yes";
663 else if( configCmdLine.at(i) == "-no-style-cde" )
664 dictionary[ "STYLE_CDE" ] = "no";
666 // Qt 3 Support ---------------------------------------------
667 else if( configCmdLine.at(i) == "-no-qt3support" )
668 dictionary[ "QT3SUPPORT" ] = "no";
670 // Work around compiler nesting limitation
671 else
672 continueElse = true;
673 if (!continueElse) {
676 // OpenGL Support -------------------------------------------
677 else if( configCmdLine.at(i) == "-no-opengl" ) {
678 dictionary[ "OPENGL" ] = "no";
679 } else if ( configCmdLine.at(i) == "-opengl-es-cm" ) {
680 dictionary[ "OPENGL" ] = "yes";
681 dictionary[ "OPENGL_ES_CM" ] = "yes";
682 } else if ( configCmdLine.at(i) == "-opengl-es-cl" ) {
683 dictionary[ "OPENGL" ] = "yes";
684 dictionary[ "OPENGL_ES_CL" ] = "yes";
685 } else if ( configCmdLine.at(i) == "-opengl-es-2" ) {
686 dictionary[ "OPENGL" ] = "yes";
687 dictionary[ "OPENGL_ES_2" ] = "yes";
689 // Databases ------------------------------------------------
690 else if( configCmdLine.at(i) == "-qt-sql-mysql" )
691 dictionary[ "SQL_MYSQL" ] = "yes";
692 else if( configCmdLine.at(i) == "-plugin-sql-mysql" )
693 dictionary[ "SQL_MYSQL" ] = "plugin";
694 else if( configCmdLine.at(i) == "-no-sql-mysql" )
695 dictionary[ "SQL_MYSQL" ] = "no";
697 else if( configCmdLine.at(i) == "-qt-sql-odbc" )
698 dictionary[ "SQL_ODBC" ] = "yes";
699 else if( configCmdLine.at(i) == "-plugin-sql-odbc" )
700 dictionary[ "SQL_ODBC" ] = "plugin";
701 else if( configCmdLine.at(i) == "-no-sql-odbc" )
702 dictionary[ "SQL_ODBC" ] = "no";
704 else if( configCmdLine.at(i) == "-qt-sql-oci" )
705 dictionary[ "SQL_OCI" ] = "yes";
706 else if( configCmdLine.at(i) == "-plugin-sql-oci" )
707 dictionary[ "SQL_OCI" ] = "plugin";
708 else if( configCmdLine.at(i) == "-no-sql-oci" )
709 dictionary[ "SQL_OCI" ] = "no";
711 else if( configCmdLine.at(i) == "-qt-sql-psql" )
712 dictionary[ "SQL_PSQL" ] = "yes";
713 else if( configCmdLine.at(i) == "-plugin-sql-psql" )
714 dictionary[ "SQL_PSQL" ] = "plugin";
715 else if( configCmdLine.at(i) == "-no-sql-psql" )
716 dictionary[ "SQL_PSQL" ] = "no";
718 else if( configCmdLine.at(i) == "-qt-sql-tds" )
719 dictionary[ "SQL_TDS" ] = "yes";
720 else if( configCmdLine.at(i) == "-plugin-sql-tds" )
721 dictionary[ "SQL_TDS" ] = "plugin";
722 else if( configCmdLine.at(i) == "-no-sql-tds" )
723 dictionary[ "SQL_TDS" ] = "no";
725 else if( configCmdLine.at(i) == "-qt-sql-db2" )
726 dictionary[ "SQL_DB2" ] = "yes";
727 else if( configCmdLine.at(i) == "-plugin-sql-db2" )
728 dictionary[ "SQL_DB2" ] = "plugin";
729 else if( configCmdLine.at(i) == "-no-sql-db2" )
730 dictionary[ "SQL_DB2" ] = "no";
732 else if( configCmdLine.at(i) == "-qt-sql-sqlite" )
733 dictionary[ "SQL_SQLITE" ] = "yes";
734 else if( configCmdLine.at(i) == "-plugin-sql-sqlite" )
735 dictionary[ "SQL_SQLITE" ] = "plugin";
736 else if( configCmdLine.at(i) == "-no-sql-sqlite" )
737 dictionary[ "SQL_SQLITE" ] = "no";
738 else if( configCmdLine.at(i) == "-system-sqlite" )
739 dictionary[ "SQL_SQLITE_LIB" ] = "system";
740 else if( configCmdLine.at(i) == "-qt-sql-sqlite2" )
741 dictionary[ "SQL_SQLITE2" ] = "yes";
742 else if( configCmdLine.at(i) == "-plugin-sql-sqlite2" )
743 dictionary[ "SQL_SQLITE2" ] = "plugin";
744 else if( configCmdLine.at(i) == "-no-sql-sqlite2" )
745 dictionary[ "SQL_SQLITE2" ] = "no";
747 else if( configCmdLine.at(i) == "-qt-sql-ibase" )
748 dictionary[ "SQL_IBASE" ] = "yes";
749 else if( configCmdLine.at(i) == "-plugin-sql-ibase" )
750 dictionary[ "SQL_IBASE" ] = "plugin";
751 else if( configCmdLine.at(i) == "-no-sql-ibase" )
752 dictionary[ "SQL_IBASE" ] = "no";
753 #endif
754 // IDE project generation -----------------------------------
755 else if( configCmdLine.at(i) == "-no-dsp" )
756 dictionary[ "DSPFILES" ] = "no";
757 else if( configCmdLine.at(i) == "-dsp" )
758 dictionary[ "DSPFILES" ] = "yes";
760 else if( configCmdLine.at(i) == "-no-vcp" )
761 dictionary[ "VCPFILES" ] = "no";
762 else if( configCmdLine.at(i) == "-vcp" )
763 dictionary[ "VCPFILES" ] = "yes";
765 else if( configCmdLine.at(i) == "-no-vcproj" )
766 dictionary[ "VCPROJFILES" ] = "no";
767 else if( configCmdLine.at(i) == "-vcproj" )
768 dictionary[ "VCPROJFILES" ] = "yes";
770 else if( configCmdLine.at(i) == "-no-incredibuild-xge" )
771 dictionary[ "INCREDIBUILD_XGE" ] = "no";
772 else if( configCmdLine.at(i) == "-incredibuild-xge" )
773 dictionary[ "INCREDIBUILD_XGE" ] = "yes";
774 #if !defined(EVAL)
775 // Others ---------------------------------------------------
776 else if (configCmdLine.at(i) == "-fast" )
777 dictionary[ "FAST" ] = "yes";
778 else if (configCmdLine.at(i) == "-no-fast" )
779 dictionary[ "FAST" ] = "no";
781 else if( configCmdLine.at(i) == "-stl" )
782 dictionary[ "STL" ] = "yes";
783 else if( configCmdLine.at(i) == "-no-stl" )
784 dictionary[ "STL" ] = "no";
786 else if ( configCmdLine.at(i) == "-exceptions" )
787 dictionary[ "EXCEPTIONS" ] = "yes";
788 else if ( configCmdLine.at(i) == "-no-exceptions" )
789 dictionary[ "EXCEPTIONS" ] = "no";
791 else if ( configCmdLine.at(i) == "-rtti" )
792 dictionary[ "RTTI" ] = "yes";
793 else if ( configCmdLine.at(i) == "-no-rtti" )
794 dictionary[ "RTTI" ] = "no";
796 else if( configCmdLine.at(i) == "-accessibility" )
797 dictionary[ "ACCESSIBILITY" ] = "yes";
798 else if( configCmdLine.at(i) == "-no-accessibility" ) {
799 dictionary[ "ACCESSIBILITY" ] = "no";
800 cout << "Setting accessibility to NO" << endl;
803 else if (configCmdLine.at(i) == "-no-mmx")
804 dictionary[ "MMX" ] = "no";
805 else if (configCmdLine.at(i) == "-mmx")
806 dictionary[ "MMX" ] = "yes";
807 else if (configCmdLine.at(i) == "-no-3dnow")
808 dictionary[ "3DNOW" ] = "no";
809 else if (configCmdLine.at(i) == "-3dnow")
810 dictionary[ "3DNOW" ] = "yes";
811 else if (configCmdLine.at(i) == "-no-sse")
812 dictionary[ "SSE" ] = "no";
813 else if (configCmdLine.at(i) == "-sse")
814 dictionary[ "SSE" ] = "yes";
815 else if (configCmdLine.at(i) == "-no-sse2")
816 dictionary[ "SSE2" ] = "no";
817 else if (configCmdLine.at(i) == "-sse2")
818 dictionary[ "SSE2" ] = "yes";
819 else if (configCmdLine.at(i) == "-no-iwmmxt")
820 dictionary[ "IWMMXT" ] = "no";
821 else if (configCmdLine.at(i) == "-iwmmxt")
822 dictionary[ "IWMMXT" ] = "yes";
824 else if( configCmdLine.at(i) == "-no-openssl" ) {
825 dictionary[ "OPENSSL"] = "no";
826 } else if( configCmdLine.at(i) == "-openssl" ) {
827 dictionary[ "OPENSSL" ] = "yes";
828 } else if( configCmdLine.at(i) == "-openssl-linked" ) {
829 dictionary[ "OPENSSL" ] = "linked";
830 } else if( configCmdLine.at(i) == "-no-qdbus" ) {
831 dictionary[ "DBUS" ] = "no";
832 } else if( configCmdLine.at(i) == "-qdbus" ) {
833 dictionary[ "DBUS" ] = "yes";
834 } else if( configCmdLine.at(i) == "-no-dbus" ) {
835 dictionary[ "DBUS" ] = "no";
836 } else if( configCmdLine.at(i) == "-dbus" ) {
837 dictionary[ "DBUS" ] = "yes";
838 } else if( configCmdLine.at(i) == "-dbus-linked" ) {
839 dictionary[ "DBUS" ] = "linked";
840 } else if( configCmdLine.at(i) == "-no-script" ) {
841 dictionary[ "SCRIPT" ] = "no";
842 } else if( configCmdLine.at(i) == "-script" ) {
843 dictionary[ "SCRIPT" ] = "yes";
844 } else if( configCmdLine.at(i) == "-no-scripttools" ) {
845 dictionary[ "SCRIPTTOOLS" ] = "no";
846 } else if( configCmdLine.at(i) == "-scripttools" ) {
847 dictionary[ "SCRIPTTOOLS" ] = "yes";
848 } else if( configCmdLine.at(i) == "-no-xmlpatterns" ) {
849 dictionary[ "XMLPATTERNS" ] = "no";
850 } else if( configCmdLine.at(i) == "-xmlpatterns" ) {
851 dictionary[ "XMLPATTERNS" ] = "yes";
852 } else if( configCmdLine.at(i) == "-no-multimedia" ) {
853 dictionary[ "MULTIMEDIA" ] = "no";
854 } else if( configCmdLine.at(i) == "-multimedia" ) {
855 dictionary[ "MULTIMEDIA" ] = "yes";
856 } else if( configCmdLine.at(i) == "-no-phonon" ) {
857 dictionary[ "PHONON" ] = "no";
858 } else if( configCmdLine.at(i) == "-phonon" ) {
859 dictionary[ "PHONON" ] = "yes";
860 } else if( configCmdLine.at(i) == "-no-phonon-backend" ) {
861 dictionary[ "PHONON_BACKEND" ] = "no";
862 } else if( configCmdLine.at(i) == "-phonon-backend" ) {
863 dictionary[ "PHONON_BACKEND" ] = "yes";
864 } else if( configCmdLine.at(i) == "-phonon-wince-ds9" ) {
865 dictionary[ "DIRECTSHOW" ] = "yes";
866 } else if( configCmdLine.at(i) == "-no-webkit" ) {
867 dictionary[ "WEBKIT" ] = "no";
868 } else if( configCmdLine.at(i) == "-webkit" ) {
869 dictionary[ "WEBKIT" ] = "yes";
870 } else if( configCmdLine.at(i) == "-no-plugin-manifests" ) {
871 dictionary[ "PLUGIN_MANIFESTS" ] = "no";
872 } else if( configCmdLine.at(i) == "-plugin-manifests" ) {
873 dictionary[ "PLUGIN_MANIFESTS" ] = "yes";
876 else if( configCmdLine.at(i) == "-internal" )
877 dictionary[ "QMAKE_INTERNAL" ] = "yes";
879 else if( configCmdLine.at(i) == "-no-qmake" )
880 dictionary[ "BUILD_QMAKE" ] = "no";
881 else if( configCmdLine.at(i) == "-qmake" )
882 dictionary[ "BUILD_QMAKE" ] = "yes";
884 else if( configCmdLine.at(i) == "-dont-process" )
885 dictionary[ "NOPROCESS" ] = "yes";
886 else if( configCmdLine.at(i) == "-process" )
887 dictionary[ "NOPROCESS" ] = "no";
889 else if( configCmdLine.at(i) == "-no-qmake-deps" )
890 dictionary[ "DEPENDENCIES" ] = "no";
891 else if( configCmdLine.at(i) == "-qmake-deps" )
892 dictionary[ "DEPENDENCIES" ] = "yes";
895 else if( configCmdLine.at(i) == "-qtnamespace" ) {
896 ++i;
897 if(i==argCount)
898 break;
899 qmakeDefines += "QT_NAMESPACE="+configCmdLine.at(i);
900 } else if( configCmdLine.at(i) == "-qtlibinfix" ) {
901 ++i;
902 if(i==argCount)
903 break;
904 dictionary[ "QT_LIBINFIX" ] = configCmdLine.at(i);
905 } else if( configCmdLine.at(i) == "-D" ) {
906 ++i;
907 if (i==argCount)
908 break;
909 qmakeDefines += configCmdLine.at(i);
910 } else if( configCmdLine.at(i) == "-I" ) {
911 ++i;
912 if (i==argCount)
913 break;
914 qmakeIncludes += configCmdLine.at(i);
915 } else if( configCmdLine.at(i) == "-L" ) {
916 ++i;
917 if (i==argCount)
918 break;
919 QFileInfo check(configCmdLine.at(i));
920 if (!check.isDir()) {
921 cout << "Argument passed to -L option is not a directory path. Did you mean the -l option?" << endl;
922 dictionary[ "DONE" ] = "error";
923 break;
925 qmakeLibs += QString("-L" + configCmdLine.at(i));
926 } else if( configCmdLine.at(i) == "-l" ) {
927 ++i;
928 if (i==argCount)
929 break;
930 qmakeLibs += QString("-l" + configCmdLine.at(i));
931 } else if (configCmdLine.at(i).startsWith("OPENSSL_LIBS=")) {
932 opensslLibs = configCmdLine.at(i);
935 else if( ( configCmdLine.at(i) == "-override-version" ) || ( configCmdLine.at(i) == "-version-override" ) ){
936 ++i;
937 if (i==argCount)
938 break;
939 dictionary[ "VERSION" ] = configCmdLine.at(i);
942 else if( configCmdLine.at(i) == "-saveconfig" ) {
943 ++i;
944 if (i==argCount)
945 break;
946 dictionary[ "CUSTOMCONFIG" ] = "_" + configCmdLine.at(i);
949 else if (configCmdLine.at(i) == "-confirm-license") {
950 dictionary["LICENSE_CONFIRMED"] = "yes";
953 else if (configCmdLine.at(i) == "-nomake") {
954 ++i;
955 if (i==argCount)
956 break;
957 disabledBuildParts += configCmdLine.at(i);
960 // Directories ----------------------------------------------
961 else if( configCmdLine.at(i) == "-prefix" ) {
962 ++i;
963 if(i==argCount)
964 break;
965 dictionary[ "QT_INSTALL_PREFIX" ] = configCmdLine.at(i);
968 else if( configCmdLine.at(i) == "-bindir" ) {
969 ++i;
970 if(i==argCount)
971 break;
972 dictionary[ "QT_INSTALL_BINS" ] = configCmdLine.at(i);
975 else if( configCmdLine.at(i) == "-libdir" ) {
976 ++i;
977 if(i==argCount)
978 break;
979 dictionary[ "QT_INSTALL_LIBS" ] = configCmdLine.at(i);
982 else if( configCmdLine.at(i) == "-docdir" ) {
983 ++i;
984 if(i==argCount)
985 break;
986 dictionary[ "QT_INSTALL_DOCS" ] = configCmdLine.at(i);
989 else if( configCmdLine.at(i) == "-headerdir" ) {
990 ++i;
991 if(i==argCount)
992 break;
993 dictionary[ "QT_INSTALL_HEADERS" ] = configCmdLine.at(i);
996 else if( configCmdLine.at(i) == "-plugindir" ) {
997 ++i;
998 if(i==argCount)
999 break;
1000 dictionary[ "QT_INSTALL_PLUGINS" ] = configCmdLine.at(i);
1003 else if( configCmdLine.at(i) == "-datadir" ) {
1004 ++i;
1005 if(i==argCount)
1006 break;
1007 dictionary[ "QT_INSTALL_DATA" ] = configCmdLine.at(i);
1010 else if( configCmdLine.at(i) == "-translationdir" ) {
1011 ++i;
1012 if(i==argCount)
1013 break;
1014 dictionary[ "QT_INSTALL_TRANSLATIONS" ] = configCmdLine.at(i);
1017 else if( configCmdLine.at(i) == "-examplesdir" ) {
1018 ++i;
1019 if(i==argCount)
1020 break;
1021 dictionary[ "QT_INSTALL_EXAMPLES" ] = configCmdLine.at(i);
1024 else if( configCmdLine.at(i) == "-demosdir" ) {
1025 ++i;
1026 if(i==argCount)
1027 break;
1028 dictionary[ "QT_INSTALL_DEMOS" ] = configCmdLine.at(i);
1031 else if( configCmdLine.at(i) == "-hostprefix" ) {
1032 ++i;
1033 if(i==argCount)
1034 break;
1035 dictionary[ "QT_HOST_PREFIX" ] = configCmdLine.at(i);
1038 else if( configCmdLine.at(i) == "-make" ) {
1039 ++i;
1040 if(i==argCount)
1041 break;
1042 dictionary[ "MAKE" ] = configCmdLine.at(i);
1045 else if (configCmdLine.at(i) == "-graphicssystem") {
1046 ++i;
1047 if (i == argCount)
1048 break;
1049 QString system = configCmdLine.at(i);
1050 if (system == QLatin1String("raster") || system == QLatin1String("opengl"))
1051 dictionary["GRAPHICS_SYSTEM"] = configCmdLine.at(i);
1054 else if( configCmdLine.at(i).indexOf( QRegExp( "^-(en|dis)able-" ) ) != -1 ) {
1055 // Scan to see if any specific modules and drivers are enabled or disabled
1056 for( QStringList::Iterator module = modules.begin(); module != modules.end(); ++module ) {
1057 if( configCmdLine.at(i) == QString( "-enable-" ) + (*module) ) {
1058 enabledModules += (*module);
1059 break;
1061 else if( configCmdLine.at(i) == QString( "-disable-" ) + (*module) ) {
1062 disabledModules += (*module);
1063 break;
1068 else {
1069 dictionary[ "HELP" ] = "yes";
1070 cout << "Unknown option " << configCmdLine.at(i) << endl;
1071 break;
1074 #endif
1077 // Ensure that QMAKESPEC exists in the mkspecs folder
1078 QDir mkspec_dir = fixSeparators(sourcePath + "/mkspecs");
1079 QStringList mkspecs = mkspec_dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot);
1081 if (dictionary["QMAKESPEC"].toLower() == "features"
1082 || !mkspecs.contains(dictionary["QMAKESPEC"], Qt::CaseInsensitive)) {
1083 dictionary[ "HELP" ] = "yes";
1084 if (dictionary ["QMAKESPEC_FROM"] == "commandline") {
1085 cout << "Invalid option \"" << dictionary["QMAKESPEC"] << "\" for -platform." << endl;
1086 } else if (dictionary ["QMAKESPEC_FROM"] == "env") {
1087 cout << "QMAKESPEC environment variable is set to \"" << dictionary["QMAKESPEC"]
1088 << "\" which is not a supported platform" << endl;
1089 } else { // was autodetected from environment
1090 cout << "Unable to detect the platform from environment. Use -platform command line"
1091 "argument or set the QMAKESPEC environment variable and run configure again" << endl;
1093 cout << "See the README file for a list of supported operating systems and compilers." << endl;
1094 } else {
1095 if( dictionary[ "QMAKESPEC" ].endsWith( "-icc" ) ||
1096 dictionary[ "QMAKESPEC" ].endsWith( "-msvc" ) ||
1097 dictionary[ "QMAKESPEC" ].endsWith( "-msvc.net" ) ||
1098 dictionary[ "QMAKESPEC" ].endsWith( "-msvc2002" ) ||
1099 dictionary[ "QMAKESPEC" ].endsWith( "-msvc2003" ) ||
1100 dictionary[ "QMAKESPEC" ].endsWith( "-msvc2005" ) ||
1101 dictionary[ "QMAKESPEC" ].endsWith( "-msvc2008" )) {
1102 if ( dictionary[ "MAKE" ].isEmpty() ) dictionary[ "MAKE" ] = "nmake";
1103 dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32";
1104 } else if ( dictionary[ "QMAKESPEC" ] == QString( "win32-g++" ) ) {
1105 if ( dictionary[ "MAKE" ].isEmpty() ) dictionary[ "MAKE" ] = "mingw32-make";
1106 if (Environment::detectExecutable("sh.exe")) {
1107 dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32-g++-sh";
1108 } else {
1109 dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32-g++";
1111 } else {
1112 if ( dictionary[ "MAKE" ].isEmpty() ) dictionary[ "MAKE" ] = "make";
1113 dictionary[ "QMAKEMAKEFILE" ] = "Makefile.win32";
1117 // Ensure that -spec (XQMAKESPEC) exists in the mkspecs folder as well
1118 if (dictionary.contains("XQMAKESPEC") &&
1119 !mkspecs.contains(dictionary["XQMAKESPEC"], Qt::CaseInsensitive)) {
1120 dictionary["HELP"] = "yes";
1121 cout << "Invalid option \"" << dictionary["XQMAKESPEC"] << "\" for -xplatform." << endl;
1124 // Ensure that the crt to be deployed can be found
1125 if (dictionary["CE_CRT"] != QLatin1String("yes") && dictionary["CE_CRT"] != QLatin1String("no")) {
1126 QDir cDir(dictionary["CE_CRT"]);
1127 QStringList entries = cDir.entryList();
1128 bool hasDebug = entries.contains("msvcr80.dll");
1129 bool hasRelease = entries.contains("msvcr80d.dll");
1130 if ((dictionary["BUILDALL"] == "auto") && (!hasDebug || !hasRelease)) {
1131 cout << "Could not find debug and release c-runtime." << endl;
1132 cout << "You need to have msvcr80.dll and msvcr80d.dll in" << endl;
1133 cout << "the path specified. Setting to -no-crt";
1134 dictionary[ "CE_CRT" ] = "no";
1135 } else if ((dictionary["BUILD"] == "debug") && !hasDebug) {
1136 cout << "Could not find debug c-runtime (msvcr80d.dll) in the directory specified." << endl;
1137 cout << "Setting c-runtime automatic deployment to -no-crt" << endl;
1138 dictionary[ "CE_CRT" ] = "no";
1139 } else if ((dictionary["BUILD"] == "release") && !hasRelease) {
1140 cout << "Could not find release c-runtime (msvcr80.dll) in the directory specified." << endl;
1141 cout << "Setting c-runtime automatic deployment to -no-crt" << endl;
1142 dictionary[ "CE_CRT" ] = "no";
1146 useUnixSeparators = (dictionary["QMAKESPEC"] == "win32-g++");
1148 // Allow tests for private classes to be compiled against internal builds
1149 if (dictionary["BUILDDEV"] == "yes")
1150 qtConfig += "private_tests";
1153 #if !defined(EVAL)
1154 for( QStringList::Iterator dis = disabledModules.begin(); dis != disabledModules.end(); ++dis ) {
1155 modules.removeAll( (*dis) );
1157 for( QStringList::Iterator ena = enabledModules.begin(); ena != enabledModules.end(); ++ena ) {
1158 if( modules.indexOf( (*ena) ) == -1 )
1159 modules += (*ena);
1161 qtConfig += modules;
1163 for( QStringList::Iterator it = disabledModules.begin(); it != disabledModules.end(); ++it )
1164 qtConfig.removeAll(*it);
1166 if( ( dictionary[ "REDO" ] != "yes" ) && ( dictionary[ "HELP" ] != "yes" ) )
1167 saveCmdLine();
1168 #endif
1171 #if !defined(EVAL)
1172 void Configure::validateArgs()
1174 QStringList configs;
1175 // Validate the specified config
1177 QDir dir;
1178 QStringList filters;
1179 filters << "qconfig-*.h";
1180 dir.setNameFilters(filters);
1181 dir.setPath(sourcePath + "/src/corelib/global/");
1183 QStringList stringList = dir.entryList();
1185 QStringList::Iterator it;
1186 for( it = stringList.begin(); it != stringList.end(); ++it )
1187 allConfigs << it->remove("qconfig-").remove(".h");
1188 allConfigs << "full";
1190 QStringList::Iterator config;
1191 for( config = allConfigs.begin(); config != allConfigs.end(); ++config ) {
1192 configs += (*config) + "-config";
1193 if( (*config) == dictionary[ "QCONFIG" ] )
1194 break;
1196 if( config == allConfigs.end() ) {
1197 dictionary[ "HELP" ] = "yes";
1198 cout << "No such configuration \"" << qPrintable(dictionary[ "QCONFIG" ]) << "\"" << endl ;
1200 else
1201 qmakeConfig += configs;
1203 #endif
1206 // Output helper functions --------------------------------[ Start ]-
1208 Determines the length of a string token.
1210 static int tokenLength(const char *str)
1212 if (*str == 0)
1213 return 0;
1215 const char *nextToken = strpbrk(str, " _/\n\r");
1216 if (nextToken == str || !nextToken)
1217 return 1;
1219 return int(nextToken - str);
1223 Prints out a string which starts at position \a startingAt, and
1224 indents each wrapped line with \a wrapIndent characters.
1225 The wrap point is set to the console width, unless that width
1226 cannot be determined, or is too small.
1228 void Configure::desc(const char *description, int startingAt, int wrapIndent)
1230 int linePos = startingAt;
1232 bool firstLine = true;
1233 const char *nextToken = description;
1234 while (*nextToken) {
1235 int nextTokenLen = tokenLength(nextToken);
1236 if (*nextToken == '\n' // Wrap on newline, duh
1237 || (linePos + nextTokenLen > outputWidth)) // Wrap at outputWidth
1239 printf("\n");
1240 linePos = 0;
1241 firstLine = false;
1242 if (*nextToken == '\n')
1243 ++nextToken;
1244 continue;
1246 if (!firstLine && linePos < wrapIndent) { // Indent to wrapIndent
1247 printf("%*s", wrapIndent , "");
1248 linePos = wrapIndent;
1249 if (*nextToken == ' ') {
1250 ++nextToken;
1251 continue;
1254 printf("%.*s", nextTokenLen, nextToken);
1255 linePos += nextTokenLen;
1256 nextToken += nextTokenLen;
1261 Prints out an option with its description wrapped at the
1262 description starting point. If \a skipIndent is true, the
1263 indentation to the option is not outputted (used by marked option
1264 version of desc()). Extra spaces between option and its
1265 description is filled with\a fillChar, if there's available
1266 space.
1268 void Configure::desc(const char *option, const char *description, bool skipIndent, char fillChar)
1270 if (!skipIndent)
1271 printf("%*s", optionIndent, "");
1273 int remaining = descIndent - optionIndent - strlen(option);
1274 int wrapIndent = descIndent + qMax(0, 1 - remaining);
1275 printf("%s", option);
1277 if (remaining > 2) {
1278 printf(" "); // Space in front
1279 for (int i = remaining; i > 2; --i)
1280 printf("%c", fillChar); // Fill, if available space
1282 printf(" "); // Space between option and description
1284 desc(description, wrapIndent, wrapIndent);
1285 printf("\n");
1289 Same as above, except it also marks an option with an '*', if
1290 the option is default action.
1292 void Configure::desc(const char *mark_option, const char *mark, const char *option, const char *description, char fillChar)
1294 const QString markedAs = dictionary.value(mark_option);
1295 if (markedAs == "auto" && markedAs == mark) // both "auto", always => +
1296 printf(" + ");
1297 else if (markedAs == "auto") // setting marked as "auto" and option is default => +
1298 printf(" %c " , (defaultTo(mark_option) == QLatin1String(mark))? '+' : ' ');
1299 else if (QLatin1String(mark) == "auto" && markedAs != "no") // description marked as "auto" and option is available => +
1300 printf(" %c " , checkAvailability(mark_option) ? '+' : ' ');
1301 else // None are "auto", (markedAs == mark) => *
1302 printf(" %c " , markedAs == QLatin1String(mark) ? '*' : ' ');
1304 desc(option, description, true, fillChar);
1308 Modifies the default configuration based on given -platform option.
1309 Eg. switches to different default styles for Windows CE.
1311 void Configure::applySpecSpecifics()
1313 if (dictionary[ "XQMAKESPEC" ].startsWith("wince")) {
1314 dictionary[ "STYLE_WINDOWSXP" ] = "no";
1315 dictionary[ "STYLE_WINDOWSVISTA" ] = "no";
1316 dictionary[ "STYLE_PLASTIQUE" ] = "no";
1317 dictionary[ "STYLE_CLEANLOOKS" ] = "no";
1318 dictionary[ "STYLE_WINDOWSCE" ] = "yes";
1319 dictionary[ "STYLE_WINDOWSMOBILE" ] = "yes";
1320 dictionary[ "STYLE_MOTIF" ] = "no";
1321 dictionary[ "STYLE_CDE" ] = "no";
1322 dictionary[ "QT3SUPPORT" ] = "no";
1323 dictionary[ "OPENGL" ] = "no";
1324 dictionary[ "OPENSSL" ] = "no";
1325 dictionary[ "STL" ] = "no";
1326 dictionary[ "EXCEPTIONS" ] = "no";
1327 dictionary[ "RTTI" ] = "no";
1328 dictionary[ "ARCHITECTURE" ] = "windowsce";
1329 dictionary[ "3DNOW" ] = "no";
1330 dictionary[ "SSE" ] = "no";
1331 dictionary[ "SSE2" ] = "no";
1332 dictionary[ "MMX" ] = "no";
1333 dictionary[ "IWMMXT" ] = "no";
1334 dictionary[ "CE_CRT" ] = "yes";
1335 dictionary[ "WEBKIT" ] = "no";
1336 dictionary[ "PHONON" ] = "yes";
1337 dictionary[ "DIRECTSHOW" ] = "no";
1338 dictionary[ "LTCG" ] = "yes";
1339 // We only apply MMX/IWMMXT for mkspecs we know they work
1340 if (dictionary[ "XQMAKESPEC" ].startsWith("wincewm")) {
1341 dictionary[ "MMX" ] = "yes";
1342 dictionary[ "IWMMXT" ] = "yes";
1343 dictionary[ "DIRECTSHOW" ] = "yes";
1345 dictionary[ "QT_HOST_PREFIX" ] = dictionary[ "QT_INSTALL_PREFIX" ];
1346 dictionary[ "QT_INSTALL_PREFIX" ] = "";
1348 } else if(dictionary[ "XQMAKESPEC" ].startsWith("linux")) { //TODO actually wrong.
1349 //TODO
1350 dictionary[ "STYLE_WINDOWSXP" ] = "no";
1351 dictionary[ "STYLE_WINDOWSVISTA" ] = "no";
1352 dictionary[ "KBD_DRIVERS" ] = "tty";
1353 dictionary[ "GFX_DRIVERS" ] = "linuxfb vnc";
1354 dictionary[ "MOUSE_DRIVERS" ] = "pc linuxtp";
1355 dictionary[ "QT3SUPPORT" ] = "no";
1356 dictionary[ "OPENGL" ] = "no";
1357 dictionary[ "EXCEPTIONS" ] = "no";
1358 dictionary[ "DBUS"] = "no";
1359 dictionary[ "QT_QWS_DEPTH" ] = "4 8 16 24 32";
1360 dictionary[ "QT_SXE" ] = "no";
1361 dictionary[ "QT_INOTIFY" ] = "no";
1362 dictionary[ "QT_LPR" ] = "no";
1363 dictionary[ "QT_CUPS" ] = "no";
1364 dictionary[ "QT_GLIB" ] = "no";
1365 dictionary[ "QT_ICONV" ] = "no";
1367 dictionary["DECORATIONS"] = "default windows styled";
1368 dictionary[ "QMAKEADDITIONALARGS" ] = "-unix";
1372 QString Configure::locateFileInPaths(const QString &fileName, const QStringList &paths)
1374 QDir d;
1375 for( QStringList::ConstIterator it = paths.begin(); it != paths.end(); ++it ) {
1376 // Remove any leading or trailing ", this is commonly used in the environment
1377 // variables
1378 QString path = (*it);
1379 if ( path.startsWith( "\"" ) )
1380 path = path.right( path.length() - 1 );
1381 if ( path.endsWith( "\"" ) )
1382 path = path.left( path.length() - 1 );
1383 if( d.exists(path + QDir::separator() + fileName) ) {
1384 return (path);
1387 return QString();
1390 QString Configure::locateFile( const QString &fileName )
1392 QString file = fileName.toLower();
1393 QStringList paths;
1394 #if defined(Q_OS_WIN32)
1395 QRegExp splitReg("[;,]");
1396 #else
1397 QRegExp splitReg("[:]");
1398 #endif
1399 if (file.endsWith(".h"))
1400 paths = QString::fromLocal8Bit(getenv("INCLUDE")).split(splitReg, QString::SkipEmptyParts);
1401 else if ( file.endsWith( ".lib" ) )
1402 paths = QString::fromLocal8Bit(getenv("LIB")).split(splitReg, QString::SkipEmptyParts);
1403 else
1404 paths = QString::fromLocal8Bit(getenv("PATH")).split(splitReg, QString::SkipEmptyParts);
1405 return locateFileInPaths(file, paths);
1408 // Output helper functions ---------------------------------[ Stop ]-
1411 bool Configure::displayHelp()
1413 if( dictionary[ "HELP" ] == "yes" ) {
1414 desc("Usage: configure [-buildkey <key>]\n"
1415 // desc("Usage: configure [-prefix dir] [-bindir <dir>] [-libdir <dir>]\n"
1416 // "[-docdir <dir>] [-headerdir <dir>] [-plugindir <dir>]\n"
1417 // "[-datadir <dir>] [-translationdir <dir>]\n"
1418 // "[-examplesdir <dir>] [-demosdir <dir>][-buildkey <key>]\n"
1419 "[-release] [-debug] [-debug-and-release] [-shared] [-static]\n"
1420 "[-no-fast] [-fast] [-no-exceptions] [-exceptions]\n"
1421 "[-no-accessibility] [-accessibility] [-no-rtti] [-rtti]\n"
1422 "[-no-stl] [-stl] [-no-sql-<driver>] [-qt-sql-<driver>]\n"
1423 "[-plugin-sql-<driver>] [-system-sqlite] [-arch <arch>]\n"
1424 "[-D <define>] [-I <includepath>] [-L <librarypath>]\n"
1425 "[-help] [-no-dsp] [-dsp] [-no-vcproj] [-vcproj]\n"
1426 "[-no-qmake] [-qmake] [-dont-process] [-process]\n"
1427 "[-no-style-<style>] [-qt-style-<style>] [-redo]\n"
1428 "[-saveconfig <config>] [-loadconfig <config>]\n"
1429 "[-qt-zlib] [-system-zlib] [-no-gif] [-qt-gif] [-no-libpng]\n"
1430 "[-qt-libpng] [-system-libpng] [-no-libtiff] [-qt-libtiff]\n"
1431 "[-system-libtiff] [-no-libjpeg] [-qt-libjpeg] [-system-libjpeg]\n"
1432 "[-no-libmng] [-qt-libmng] [-system-libmng] [-no-qt3support] [-mmx]\n"
1433 "[-no-mmx] [-3dnow] [-no-3dnow] [-sse] [-no-sse] [-sse2] [-no-sse2]\n"
1434 "[-no-iwmmxt] [-iwmmxt] [-openssl] [-openssl-linked]\n"
1435 "[-no-openssl] [-no-dbus] [-dbus] [-dbus-linked] [-platform <spec>]\n"
1436 "[-qtnamespace <namespace>] [-qtlibinfix <infix>] [-no-phonon]\n"
1437 "[-phonon] [-no-phonon-backend] [-phonon-backend]\n"
1438 "[-no-multimedia] [-multimedia] [-no-webkit] [-webkit]\n"
1439 "[-no-script] [-script] [-no-scripttools] [-scripttools]\n"
1440 "[-graphicssystem raster|opengl]\n\n", 0, 7);
1442 desc("Installation options:\n\n");
1444 #if !defined(EVAL)
1446 desc(" These are optional, but you may specify install directories.\n\n", 0, 1);
1448 desc( "-prefix dir", "This will install everything relative to dir\n(default $QT_INSTALL_PREFIX)\n");
1450 desc(" You may use these to separate different parts of the install:\n\n", 0, 1);
1452 desc( "-bindir <dir>", "Executables will be installed to dir\n(default PREFIX/bin)");
1453 desc( "-libdir <dir>", "Libraries will be installed to dir\n(default PREFIX/lib)");
1454 desc( "-docdir <dir>", "Documentation will be installed to dir\n(default PREFIX/doc)");
1455 desc( "-headerdir <dir>", "Headers will be installed to dir\n(default PREFIX/include)");
1456 desc( "-plugindir <dir>", "Plugins will be installed to dir\n(default PREFIX/plugins)");
1457 desc( "-datadir <dir>", "Data used by Qt programs will be installed to dir\n(default PREFIX)");
1458 desc( "-translationdir <dir>","Translations of Qt programs will be installed to dir\n(default PREFIX/translations)\n");
1459 desc( "-examplesdir <dir>", "Examples will be installed to dir\n(default PREFIX/examples)");
1460 desc( "-demosdir <dir>", "Demos will be installed to dir\n(default PREFIX/demos)");
1462 desc(" You may use these options to turn on strict plugin loading:\n\n", 0, 1);
1464 desc( "-buildkey <key>", "Build the Qt library and plugins using the specified <key>. "
1465 "When the library loads plugins, it will only load those that have a matching <key>.\n");
1467 desc("Configure options:\n\n");
1469 desc(" The defaults (*) are usually acceptable. A plus (+) denotes a default value"
1470 " that needs to be evaluated. If the evaluation succeeds, the feature is"
1471 " included. Here is a short explanation of each option:\n\n", 0, 1);
1473 desc("BUILD", "release","-release", "Compile and link Qt with debugging turned off.");
1474 desc("BUILD", "debug", "-debug", "Compile and link Qt with debugging turned on.");
1475 desc("BUILDALL", "yes", "-debug-and-release", "Compile and link two Qt libraries, with and without debugging turned on.\n");
1477 desc("OPENSOURCE", "opensource", "-opensource", "Compile and link the Open-Source Edition of Qt.");
1478 desc("COMMERCIAL", "commercial", "-commercial", "Compile and link the Commercial Edition of Qt.\n");
1480 desc("BUILDDEV", "yes", "-developer-build", "Compile and link Qt with Qt developer options (including auto-tests exporting)\n");
1482 desc("SHARED", "yes", "-shared", "Create and use shared Qt libraries.");
1483 desc("SHARED", "no", "-static", "Create and use static Qt libraries.\n");
1485 desc("LTCG", "yes", "-ltcg", "Use Link Time Code Generation. (Release builds only)");
1486 desc("LTCG", "no", "-no-ltcg", "Do not use Link Time Code Generation.\n");
1488 desc("FAST", "no", "-no-fast", "Configure Qt normally by generating Makefiles for all project files.");
1489 desc("FAST", "yes", "-fast", "Configure Qt quickly by generating Makefiles only for library and "
1490 "subdirectory targets. All other Makefiles are created as wrappers "
1491 "which will in turn run qmake\n");
1493 desc("EXCEPTIONS", "no", "-no-exceptions", "Disable exceptions on platforms that support it.");
1494 desc("EXCEPTIONS", "yes","-exceptions", "Enable exceptions on platforms that support it.\n");
1496 desc("ACCESSIBILITY", "no", "-no-accessibility", "Do not compile Windows Active Accessibility support.");
1497 desc("ACCESSIBILITY", "yes", "-accessibility", "Compile Windows Active Accessibility support.\n");
1499 desc("STL", "no", "-no-stl", "Do not compile STL support.");
1500 desc("STL", "yes", "-stl", "Compile STL support.\n");
1502 desc( "-no-sql-<driver>", "Disable SQL <driver> entirely, by default none are turned on.");
1503 desc( "-qt-sql-<driver>", "Enable a SQL <driver> in the Qt Library.");
1504 desc( "-plugin-sql-<driver>", "Enable SQL <driver> as a plugin to be linked to at run time.\n"
1505 "Available values for <driver>:");
1506 desc("SQL_MYSQL", "auto", "", " mysql", ' ');
1507 desc("SQL_PSQL", "auto", "", " psql", ' ');
1508 desc("SQL_OCI", "auto", "", " oci", ' ');
1509 desc("SQL_ODBC", "auto", "", " odbc", ' ');
1510 desc("SQL_TDS", "auto", "", " tds", ' ');
1511 desc("SQL_DB2", "auto", "", " db2", ' ');
1512 desc("SQL_SQLITE", "auto", "", " sqlite", ' ');
1513 desc("SQL_SQLITE2", "auto", "", " sqlite2", ' ');
1514 desc("SQL_IBASE", "auto", "", " ibase", ' ');
1515 desc( "", "(drivers marked with a '+' have been detected as available on this system)\n", false, ' ');
1517 desc( "-system-sqlite", "Use sqlite from the operating system.\n");
1519 desc("QT3SUPPORT", "no","-no-qt3support", "Disables the Qt 3 support functionality.\n");
1520 desc("OPENGL", "no","-no-opengl", "Disables OpenGL functionality\n");
1522 #endif
1523 desc( "-platform <spec>", "The operating system and compiler you are building on.\n(default %QMAKESPEC%)\n");
1524 desc( "-xplatform <spec>", "The operating system and compiler you are cross compiling to.\n");
1525 desc( "", "See the README file for a list of supported operating systems and compilers.\n", false, ' ');
1527 #if !defined(EVAL)
1528 desc( "-qtnamespace <namespace>", "Wraps all Qt library code in 'namespace name {...}");
1529 desc( "-qtlibinfix <infix>", "Renames all Qt* libs to Qt*<infix>\n");
1530 desc( "-D <define>", "Add an explicit define to the preprocessor.");
1531 desc( "-I <includepath>", "Add an explicit include path.");
1532 desc( "-L <librarypath>", "Add an explicit library path.");
1533 desc( "-l <libraryname>", "Add an explicit library name, residing in a librarypath.\n");
1534 #endif
1535 desc( "-graphicssystem <sys>", "Specify which graphicssystem should be used.\n"
1536 "Available values for <sys>:");
1537 desc("GRAPHICS_SYSTEM", "raster", "", " raster - Software rasterizer", ' ');
1538 desc("GRAPHICS_SYSTEM", "opengl", "", " opengl - Using OpenGL acceleration, experimental!", ' ');
1541 desc( "-help, -h, -?", "Display this information.\n");
1543 #if !defined(EVAL)
1544 // 3rd party stuff options go below here --------------------------------------------------------------------------------
1545 desc("Third Party Libraries:\n\n");
1547 desc("ZLIB", "qt", "-qt-zlib", "Use the zlib bundled with Qt.");
1548 desc("ZLIB", "system", "-system-zlib", "Use zlib from the operating system.\nSee http://www.gzip.org/zlib\n");
1550 desc("GIF", "no", "-no-gif", "Do not compile the plugin for GIF reading support.");
1551 desc("GIF", "auto", "-qt-gif", "Compile the plugin for GIF reading support.\nSee also src/plugins/imageformats/gif/qgifhandler.h\n");
1553 desc("LIBPNG", "no", "-no-libpng", "Do not compile in PNG support.");
1554 desc("LIBPNG", "qt", "-qt-libpng", "Use the libpng bundled with Qt.");
1555 desc("LIBPNG", "system","-system-libpng", "Use libpng from the operating system.\nSee http://www.libpng.org/pub/png\n");
1557 desc("LIBMNG", "no", "-no-libmng", "Do not compile in MNG support.");
1558 desc("LIBMNG", "qt", "-qt-libmng", "Use the libmng bundled with Qt.");
1559 desc("LIBMNG", "system","-system-libmng", "Use libmng from the operating system.\nSee See http://www.libmng.com\n");
1561 desc("LIBTIFF", "no", "-no-libtiff", "Do not compile the plugin for TIFF support.");
1562 desc("LIBTIFF", "qt", "-qt-libtiff", "Use the libtiff bundled with Qt.");
1563 desc("LIBTIFF", "system","-system-libtiff", "Use libtiff from the operating system.\nSee http://www.libtiff.org\n");
1565 desc("LIBJPEG", "no", "-no-libjpeg", "Do not compile the plugin for JPEG support.");
1566 desc("LIBJPEG", "qt", "-qt-libjpeg", "Use the libjpeg bundled with Qt.");
1567 desc("LIBJPEG", "system","-system-libjpeg", "Use libjpeg from the operating system.\nSee http://www.ijg.org\n");
1569 #endif
1570 // Qt\Windows only options go below here --------------------------------------------------------------------------------
1571 desc("Qt for Windows only:\n\n");
1573 desc("DSPFILES", "no", "-no-dsp", "Do not generate VC++ .dsp files.");
1574 desc("DSPFILES", "yes", "-dsp", "Generate VC++ .dsp files, only if spec \"win32-msvc\".\n");
1576 desc("VCPROJFILES", "no", "-no-vcproj", "Do not generate VC++ .vcproj files.");
1577 desc("VCPROJFILES", "yes", "-vcproj", "Generate VC++ .vcproj files, only if platform \"win32-msvc.net\".\n");
1579 desc("INCREDIBUILD_XGE", "no", "-no-incredibuild-xge", "Do not add IncrediBuild XGE distribution commands to custom build steps.");
1580 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");
1582 desc("PLUGIN_MANIFESTS", "no", "-no-plugin-manifests", "Do not embed manifests in plugins.");
1583 desc("PLUGIN_MANIFESTS", "yes", "-plugin-manifests", "Embed manifests in plugins.\n");
1585 #if !defined(EVAL)
1586 desc("BUILD_QMAKE", "no", "-no-qmake", "Do not compile qmake.");
1587 desc("BUILD_QMAKE", "yes", "-qmake", "Compile qmake.\n");
1589 desc("NOPROCESS", "yes", "-dont-process", "Do not generate Makefiles/Project files. This will override -no-fast if specified.");
1590 desc("NOPROCESS", "no", "-process", "Generate Makefiles/Project files.\n");
1592 desc("RTTI", "no", "-no-rtti", "Do not compile runtime type information.");
1593 desc("RTTI", "yes", "-rtti", "Compile runtime type information.\n");
1594 desc("MMX", "no", "-no-mmx", "Do not compile with use of MMX instructions");
1595 desc("MMX", "yes", "-mmx", "Compile with use of MMX instructions");
1596 desc("3DNOW", "no", "-no-3dnow", "Do not compile with use of 3DNOW instructions");
1597 desc("3DNOW", "yes", "-3dnow", "Compile with use of 3DNOW instructions");
1598 desc("SSE", "no", "-no-sse", "Do not compile with use of SSE instructions");
1599 desc("SSE", "yes", "-sse", "Compile with use of SSE instructions");
1600 desc("SSE2", "no", "-no-sse2", "Do not compile with use of SSE2 instructions");
1601 desc("SSE2", "yes", "-sse2", "Compile with use of SSE2 instructions");
1602 desc("OPENSSL", "no", "-no-openssl", "Do not compile in OpenSSL support");
1603 desc("OPENSSL", "yes", "-openssl", "Compile in run-time OpenSSL support");
1604 desc("OPENSSL", "linked","-openssl-linked", "Compile in linked OpenSSL support");
1605 desc("DBUS", "no", "-no-dbus", "Do not compile in D-Bus support");
1606 desc("DBUS", "yes", "-dbus", "Compile in D-Bus support and load libdbus-1 dynamically");
1607 desc("DBUS", "linked", "-dbus-linked", "Compile in D-Bus support and link to libdbus-1");
1608 desc("PHONON", "no", "-no-phonon", "Do not compile in the Phonon module");
1609 desc("PHONON", "yes", "-phonon", "Compile the Phonon module (Phonon is built if a decent C++ compiler is used.)");
1610 desc("PHONON_BACKEND","no", "-no-phonon-backend","Do not compile the platform-specific Phonon backend-plugin");
1611 desc("PHONON_BACKEND","yes","-phonon-backend", "Compile in the platform-specific Phonon backend-plugin");
1612 desc("MULTIMEDIA", "no", "-no-multimedia", "Do not compile the multimedia module");
1613 desc("MULTIMEDIA", "yes","-multimedia", "Compile in multimedia module");
1614 desc("WEBKIT", "no", "-no-webkit", "Do not compile in the WebKit module");
1615 desc("WEBKIT", "yes", "-webkit", "Compile in the WebKit module (WebKit is built if a decent C++ compiler is used.)");
1616 desc("SCRIPT", "no", "-no-script", "Do not build the QtScript module.");
1617 desc("SCRIPT", "yes", "-script", "Build the QtScript module.");
1618 desc("SCRIPTTOOLS", "no", "-no-scripttools", "Do not build the QtScriptTools module.");
1619 desc("SCRIPTTOOLS", "yes", "-scripttools", "Build the QtScriptTools module.");
1621 desc( "-arch <arch>", "Specify an architecture.\n"
1622 "Available values for <arch>:");
1623 desc("ARCHITECTURE","windows", "", " windows", ' ');
1624 desc("ARCHITECTURE","windowsce", "", " windowsce", ' ');
1625 desc("ARCHITECTURE","boundschecker", "", " boundschecker", ' ');
1626 desc("ARCHITECTURE","generic", "", " generic\n", ' ');
1628 desc( "-no-style-<style>", "Disable <style> entirely.");
1629 desc( "-qt-style-<style>", "Enable <style> in the Qt Library.\nAvailable styles: ");
1631 desc("STYLE_WINDOWS", "yes", "", " windows", ' ');
1632 desc("STYLE_WINDOWSXP", "auto", "", " windowsxp", ' ');
1633 desc("STYLE_WINDOWSVISTA", "auto", "", " windowsvista", ' ');
1634 desc("STYLE_PLASTIQUE", "yes", "", " plastique", ' ');
1635 desc("STYLE_CLEANLOOKS", "yes", "", " cleanlooks", ' ');
1636 desc("STYLE_MOTIF", "yes", "", " motif", ' ');
1637 desc("STYLE_CDE", "yes", "", " cde", ' ');
1638 desc("STYLE_WINDOWSCE", "yes", "", " windowsce", ' ');
1639 desc("STYLE_WINDOWSMOBILE" , "yes", "", " windowsmobile\n", ' ');
1641 /* We do not support -qconfig on Windows yet
1643 desc( "-qconfig <local>", "Use src/tools/qconfig-local.h rather than the default.\nPossible values for local:");
1644 for (int i=0; i<allConfigs.size(); ++i)
1645 desc( "", qPrintable(QString(" %1").arg(allConfigs.at(i))), false, ' ');
1646 printf("\n");
1648 #endif
1649 desc( "-loadconfig <config>", "Run configure with the parameters from file configure_<config>.cache.");
1650 desc( "-saveconfig <config>", "Run configure and save the parameters in file configure_<config>.cache.");
1651 desc( "-redo", "Run configure with the same parameters as last time.\n");
1653 // Qt\Windows CE only options go below here -----------------------------------------------------------------------------
1654 desc("Qt for Windows CE only:\n\n");
1655 desc("IWMMXT", "no", "-no-iwmmxt", "Do not compile with use of IWMMXT instructions");
1656 desc("IWMMXT", "yes", "-iwmmxt", "Do compile with use of IWMMXT instructions (Qt for Windows CE on Arm only)");
1657 desc("CE_CRT", "no", "-no-crt" , "Do not add the C runtime to default deployment rules");
1658 desc("CE_CRT", "yes", "-qt-crt", "Qt identifies C runtime during project generation");
1659 desc( "-crt <path>", "Specify path to C runtime used for project generation.");
1660 desc("CETEST", "no", "-no-cetest", "Do not compile Windows CE remote test application");
1661 desc("CETEST", "yes", "-cetest", "Compile Windows CE remote test application");
1662 desc( "-signature <file>", "Use file for signing the target project");
1663 desc("OPENGL_ES_CM", "no", "-opengl-es-cm", "Enable support for OpenGL ES Common");
1664 desc("OPENGL_ES_CL", "no", "-opengl-es-cl", "Enable support for OpenGL ES Common Lite");
1665 desc("OPENGL_ES_2", "no", "-opengl-es-2", "Enable support for OpenGL ES 2.0");
1666 desc("DIRECTSHOW", "no", "-phonon-wince-ds9", "Enable Phonon Direct Show 9 backend for Windows CE");
1668 return true;
1670 return false;
1673 QString Configure::findFileInPaths(const QString &fileName, const QString &paths)
1675 #if defined(Q_OS_WIN32)
1676 QRegExp splitReg("[;,]");
1677 #else
1678 QRegExp splitReg("[:]");
1679 #endif
1680 QStringList pathList = paths.split(splitReg, QString::SkipEmptyParts);
1681 QDir d;
1682 for( QStringList::ConstIterator it = pathList.begin(); it != pathList.end(); ++it ) {
1683 // Remove any leading or trailing ", this is commonly used in the environment
1684 // variables
1685 QString path = (*it);
1686 if ( path.startsWith( '\"' ) )
1687 path = path.right( path.length() - 1 );
1688 if ( path.endsWith( '\"' ) )
1689 path = path.left( path.length() - 1 );
1690 if( d.exists( path + QDir::separator() + fileName ) )
1691 return path;
1693 return QString();
1696 bool Configure::findFile( const QString &fileName )
1698 const QString file = fileName.toLower();
1699 const QString pathEnvVar = QString::fromLocal8Bit(getenv("PATH"));
1700 const QString mingwPath = dictionary["QMAKESPEC"].endsWith("-g++") ?
1701 findFileInPaths("mingw32-g++.exe", pathEnvVar) : QString();
1703 QString paths;
1704 if (file.endsWith(".h")) {
1705 if (!mingwPath.isNull() && !findFileInPaths(file, mingwPath + QLatin1String("/../include")).isNull())
1706 return true;
1707 paths = QString::fromLocal8Bit(getenv("INCLUDE"));
1708 } else if ( file.endsWith( ".lib" ) || file.endsWith( ".a" ) ) {
1709 if (!mingwPath.isNull() && !findFileInPaths(file, mingwPath + QLatin1String("/../lib")).isNull())
1710 return true;
1711 paths = QString::fromLocal8Bit(getenv("LIB"));
1712 } else {
1713 paths = pathEnvVar;
1715 return !findFileInPaths(file, paths).isNull();
1719 Default value for options marked as "auto" if the test passes.
1720 (Used both by the autoDetection() below, and the desc() function
1721 to mark (+) the default option of autodetecting options.
1723 QString Configure::defaultTo(const QString &option)
1725 // We prefer using the system version of the 3rd party libs
1726 if (option == "ZLIB"
1727 || option == "LIBJPEG"
1728 || option == "LIBPNG"
1729 || option == "LIBMNG"
1730 || option == "LIBTIFF")
1731 return "system";
1733 // We want PNG built-in
1734 if (option == "PNG")
1735 return "qt";
1737 // The JPEG image library can only be a plugin
1738 if (option == "JPEG"
1739 || option == "MNG" || option == "TIFF")
1740 return "plugin";
1742 // GIF off by default
1743 if (option == "GIF") {
1744 if (dictionary["SHARED"] == "yes")
1745 return "plugin";
1746 else
1747 return "yes";
1750 // By default we do not want to compile OCI driver when compiling with
1751 // MinGW, due to lack of such support from Oracle. It prob. wont work.
1752 // (Customer may force the use though)
1753 if (dictionary["QMAKESPEC"].endsWith("-g++")
1754 && option == "SQL_OCI")
1755 return "no";
1757 if (option == "SQL_MYSQL"
1758 || option == "SQL_MYSQL"
1759 || option == "SQL_ODBC"
1760 || option == "SQL_OCI"
1761 || option == "SQL_PSQL"
1762 || option == "SQL_TDS"
1763 || option == "SQL_DB2"
1764 || option == "SQL_SQLITE"
1765 || option == "SQL_SQLITE2"
1766 || option == "SQL_IBASE")
1767 return "plugin";
1769 if (option == "SYNCQT"
1770 && (!QFile::exists(sourcePath + "/bin/syncqt") ||
1771 !QFile::exists(sourcePath + "/bin/syncqt.bat")))
1772 return "no";
1774 return "yes";
1778 Checks the system for the availability of a feature.
1779 Returns true if the feature is available, else false.
1781 bool Configure::checkAvailability(const QString &part)
1783 bool available = false;
1784 if (part == "STYLE_WINDOWSXP")
1785 available = (findFile("uxtheme.h"));
1787 else if (part == "ZLIB")
1788 available = findFile("zlib.h");
1790 else if (part == "LIBJPEG")
1791 available = findFile("jpeglib.h");
1792 else if (part == "LIBPNG")
1793 available = findFile("png.h");
1794 else if (part == "LIBMNG")
1795 available = findFile("libmng.h");
1796 else if (part == "LIBTIFF")
1797 available = findFile("tiffio.h");
1798 else if (part == "SQL_MYSQL")
1799 available = findFile("mysql.h") && findFile("libmySQL.lib");
1800 else if (part == "SQL_ODBC")
1801 available = findFile("sql.h") && findFile("sqlext.h") && findFile("odbc32.lib");
1802 else if (part == "SQL_OCI")
1803 available = findFile("oci.h") && findFile("oci.lib");
1804 else if (part == "SQL_PSQL")
1805 available = findFile("libpq-fe.h") && findFile("libpq.lib") && findFile("ws2_32.lib") && findFile("advapi32.lib");
1806 else if (part == "SQL_TDS")
1807 available = findFile("sybfront.h") && findFile("sybdb.h") && findFile("ntwdblib.lib");
1808 else if (part == "SQL_DB2")
1809 available = findFile("sqlcli.h") && findFile("sqlcli1.h") && findFile("db2cli.lib");
1810 else if (part == "SQL_SQLITE")
1811 available = true; // Built in, we have a fork
1812 else if (part == "SQL_SQLITE_LIB") {
1813 if (dictionary[ "SQL_SQLITE_LIB" ] == "system") {
1814 available = findFile("sqlite3.h") && findFile("sqlite3.lib");
1815 if (available)
1816 dictionary[ "QT_LFLAGS_SQLITE" ] += "sqlite3.lib";
1817 } else
1818 available = true;
1819 } else if (part == "SQL_SQLITE2")
1820 available = findFile("sqlite.h") && findFile("sqlite.lib");
1821 else if (part == "SQL_IBASE")
1822 available = findFile("ibase.h") && (findFile("gds32_ms.lib") || findFile("gds32.lib"));
1823 else if (part == "IWMMXT")
1824 available = (dictionary[ "ARCHITECTURE" ] == "windowsce");
1825 else if (part == "OPENGL_ES_CM")
1826 available = (dictionary[ "ARCHITECTURE" ] == "windowsce");
1827 else if (part == "OPENGL_ES_CL")
1828 available = (dictionary[ "ARCHITECTURE" ] == "windowsce");
1829 else if (part == "OPENGL_ES_2")
1830 available = (dictionary[ "ARCHITECTURE" ] == "windowsce");
1831 else if (part == "DIRECTSHOW")
1832 available = (dictionary[ "ARCHITECTURE" ] == "windowsce");
1833 else if (part == "SSE2")
1834 available = (dictionary.value("QMAKESPEC") != "win32-msvc") && (dictionary.value("QMAKESPEC") != "win32-g++");
1835 else if (part == "3DNOW" )
1836 available = (dictionary.value("QMAKESPEC") != "win32-msvc") && (dictionary.value("QMAKESPEC") != "win32-icc") && findFile("mm3dnow.h") && (dictionary.value("QMAKESPEC") != "win32-g++");
1837 else if (part == "MMX" || part == "SSE")
1838 available = (dictionary.value("QMAKESPEC") != "win32-msvc") && (dictionary.value("QMAKESPEC") != "win32-g++");
1839 else if (part == "OPENSSL")
1840 available = findFile("openssl\\ssl.h");
1841 else if (part == "DBUS")
1842 available = findFile("dbus\\dbus.h");
1843 else if (part == "CETEST") {
1844 QString rapiHeader = locateFile("rapi.h");
1845 QString rapiLib = locateFile("rapi.lib");
1846 available = (dictionary[ "ARCHITECTURE" ] == "windowsce") && !rapiHeader.isEmpty() && !rapiLib.isEmpty();
1847 if (available) {
1848 dictionary[ "QT_CE_RAPI_INC" ] += QLatin1String("\"") + rapiHeader + QLatin1String("\"");
1849 dictionary[ "QT_CE_RAPI_LIB" ] += QLatin1String("\"") + rapiLib + QLatin1String("\"");
1851 else if (dictionary[ "CETEST_REQUESTED" ] == "yes") {
1852 cout << "cetest could not be enabled: rapi.h and rapi.lib could not be found." << endl;
1853 cout << "Make sure the environment is set up for compiling with ActiveSync." << endl;
1854 dictionary[ "DONE" ] = "error";
1857 else if (part == "INCREDIBUILD_XGE")
1858 available = findFile("BuildConsole.exe") && findFile("xgConsole.exe");
1859 else if (part == "XMLPATTERNS")
1861 /* MSVC 6.0 and MSVC 2002/7.0 has too poor C++ support for QtXmlPatterns. */
1862 return dictionary.value("QMAKESPEC") != "win32-msvc"
1863 && 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
1864 && dictionary.value("QMAKESPEC") != "win32-msvc2002"
1865 && dictionary.value("EXCEPTIONS") == "yes";
1866 } else if (part == "PHONON") {
1867 available = findFile("vmr9.h") && findFile("dshow.h") && findFile("dmo.h") && findFile("dmodshow.h")
1868 && (findFile("strmiids.lib") || findFile("libstrmiids.a"))
1869 && (findFile("dmoguids.lib") || findFile("libdmoguids.a"))
1870 && (findFile("msdmo.lib") || findFile("libmsdmo.a"))
1871 && findFile("d3d9.h");
1873 if (!available) {
1874 cout << "All the required DirectShow/Direct3D files couldn't be found." << endl
1875 << "Make sure you have either the platform SDK AND the DirectShow SDK or the Windows SDK installed." << endl
1876 << "If you have the DirectShow SDK installed, please make sure that you have run the <path to SDK>\\SetEnv.Cmd script." << endl;
1877 if (!findFile("vmr9.h")) cout << "vmr9.h not found" << endl;
1878 if (!findFile("dshow.h")) cout << "dshow.h not found" << endl;
1879 if (!findFile("strmiids.lib")) cout << "strmiids.lib not found" << endl;
1880 if (!findFile("dmoguids.lib")) cout << "dmoguids.lib not found" << endl;
1881 if (!findFile("msdmo.lib")) cout << "msdmo.lib not found" << endl;
1882 if (!findFile("d3d9.h")) cout << "d3d9.h not found" << endl;
1884 } else if (part == "MULTIMEDIA") {
1885 available = true;
1886 } else if (part == "WEBKIT" || part == "SCRIPT" || part == "SCRIPTTOOLS") {
1887 available = (dictionary.value("QMAKESPEC") == "win32-msvc2005") || (dictionary.value("QMAKESPEC") == "win32-msvc2008") || (dictionary.value("QMAKESPEC") == "win32-g++");
1890 return available;
1894 Autodetect options marked as "auto".
1896 void Configure::autoDetection()
1898 // Style detection
1899 if (dictionary["STYLE_WINDOWSXP"] == "auto")
1900 dictionary["STYLE_WINDOWSXP"] = checkAvailability("STYLE_WINDOWSXP") ? defaultTo("STYLE_WINDOWSXP") : "no";
1901 if (dictionary["STYLE_WINDOWSVISTA"] == "auto") // Vista style has the same requirements as XP style
1902 dictionary["STYLE_WINDOWSVISTA"] = checkAvailability("STYLE_WINDOWSXP") ? defaultTo("STYLE_WINDOWSVISTA") : "no";
1904 // Compression detection
1905 if (dictionary["ZLIB"] == "auto")
1906 dictionary["ZLIB"] = checkAvailability("ZLIB") ? defaultTo("ZLIB") : "qt";
1908 // Image format detection
1909 if (dictionary["GIF"] == "auto")
1910 dictionary["GIF"] = defaultTo("GIF");
1911 if (dictionary["JPEG"] == "auto")
1912 dictionary["JPEG"] = defaultTo("JPEG");
1913 if (dictionary["PNG"] == "auto")
1914 dictionary["PNG"] = defaultTo("PNG");
1915 if (dictionary["MNG"] == "auto")
1916 dictionary["MNG"] = defaultTo("MNG");
1917 if (dictionary["TIFF"] == "auto")
1918 dictionary["TIFF"] = dictionary["ZLIB"] == "no" ? "no" : defaultTo("TIFF");
1919 if (dictionary["LIBJPEG"] == "auto")
1920 dictionary["LIBJPEG"] = checkAvailability("LIBJPEG") ? defaultTo("LIBJPEG") : "qt";
1921 if (dictionary["LIBPNG"] == "auto")
1922 dictionary["LIBPNG"] = checkAvailability("LIBPNG") ? defaultTo("LIBPNG") : "qt";
1923 if (dictionary["LIBMNG"] == "auto")
1924 dictionary["LIBMNG"] = checkAvailability("LIBMNG") ? defaultTo("LIBMNG") : "qt";
1925 if (dictionary["LIBTIFF"] == "auto")
1926 dictionary["LIBTIFF"] = checkAvailability("LIBTIFF") ? defaultTo("LIBTIFF") : "qt";
1928 // SQL detection (not on by default)
1929 if (dictionary["SQL_MYSQL"] == "auto")
1930 dictionary["SQL_MYSQL"] = checkAvailability("SQL_MYSQL") ? defaultTo("SQL_MYSQL") : "no";
1931 if (dictionary["SQL_ODBC"] == "auto")
1932 dictionary["SQL_ODBC"] = checkAvailability("SQL_ODBC") ? defaultTo("SQL_ODBC") : "no";
1933 if (dictionary["SQL_OCI"] == "auto")
1934 dictionary["SQL_OCI"] = checkAvailability("SQL_OCI") ? defaultTo("SQL_OCI") : "no";
1935 if (dictionary["SQL_PSQL"] == "auto")
1936 dictionary["SQL_PSQL"] = checkAvailability("SQL_PSQL") ? defaultTo("SQL_PSQL") : "no";
1937 if (dictionary["SQL_TDS"] == "auto")
1938 dictionary["SQL_TDS"] = checkAvailability("SQL_TDS") ? defaultTo("SQL_TDS") : "no";
1939 if (dictionary["SQL_DB2"] == "auto")
1940 dictionary["SQL_DB2"] = checkAvailability("SQL_DB2") ? defaultTo("SQL_DB2") : "no";
1941 if (dictionary["SQL_SQLITE"] == "auto")
1942 dictionary["SQL_SQLITE"] = checkAvailability("SQL_SQLITE") ? defaultTo("SQL_SQLITE") : "no";
1943 if (dictionary["SQL_SQLITE_LIB"] == "system")
1944 if (!checkAvailability("SQL_SQLITE_LIB"))
1945 dictionary["SQL_SQLITE_LIB"] = "no";
1946 if (dictionary["SQL_SQLITE2"] == "auto")
1947 dictionary["SQL_SQLITE2"] = checkAvailability("SQL_SQLITE2") ? defaultTo("SQL_SQLITE2") : "no";
1948 if (dictionary["SQL_IBASE"] == "auto")
1949 dictionary["SQL_IBASE"] = checkAvailability("SQL_IBASE") ? defaultTo("SQL_IBASE") : "no";
1950 if (dictionary["MMX"] == "auto")
1951 dictionary["MMX"] = checkAvailability("MMX") ? "yes" : "no";
1952 if (dictionary["3DNOW"] == "auto")
1953 dictionary["3DNOW"] = checkAvailability("3DNOW") ? "yes" : "no";
1954 if (dictionary["SSE"] == "auto")
1955 dictionary["SSE"] = checkAvailability("SSE") ? "yes" : "no";
1956 if (dictionary["SSE2"] == "auto")
1957 dictionary["SSE2"] = checkAvailability("SSE2") ? "yes" : "no";
1958 if (dictionary["IWMMXT"] == "auto")
1959 dictionary["IWMMXT"] = checkAvailability("IWMMXT") ? "yes" : "no";
1960 if (dictionary["OPENSSL"] == "auto")
1961 dictionary["OPENSSL"] = checkAvailability("OPENSSL") ? "yes" : "no";
1962 if (dictionary["DBUS"] == "auto")
1963 dictionary["DBUS"] = checkAvailability("DBUS") ? "yes" : "no";
1964 if (dictionary["SCRIPT"] == "auto")
1965 dictionary["SCRIPT"] = checkAvailability("SCRIPT") ? "yes" : "no";
1966 if (dictionary["SCRIPTTOOLS"] == "auto")
1967 dictionary["SCRIPTTOOLS"] = checkAvailability("SCRIPTTOOLS") ? "yes" : "no";
1968 if (dictionary["XMLPATTERNS"] == "auto")
1969 dictionary["XMLPATTERNS"] = checkAvailability("XMLPATTERNS") ? "yes" : "no";
1970 if (dictionary["PHONON"] == "auto")
1971 dictionary["PHONON"] = checkAvailability("PHONON") ? "yes" : "no";
1972 if (dictionary["WEBKIT"] == "auto")
1973 dictionary["WEBKIT"] = checkAvailability("WEBKIT") ? "yes" : "no";
1975 // Qt/WinCE remote test application
1976 if (dictionary["CETEST"] == "auto")
1977 dictionary["CETEST"] = checkAvailability("CETEST") ? "yes" : "no";
1979 // Detection of IncrediBuild buildconsole
1980 if (dictionary["INCREDIBUILD_XGE"] == "auto")
1981 dictionary["INCREDIBUILD_XGE"] = checkAvailability("INCREDIBUILD_XGE") ? "yes" : "no";
1983 // Mark all unknown "auto" to the default value..
1984 for (QMap<QString,QString>::iterator i = dictionary.begin(); i != dictionary.end(); ++i) {
1985 if (i.value() == "auto")
1986 i.value() = defaultTo(i.key());
1990 bool Configure::verifyConfiguration()
1992 if (dictionary["SQL_SQLITE_LIB"] == "no" && dictionary["SQL_SQLITE"] != "no") {
1993 cout << "WARNING: Configure could not detect the presence of a system SQLite3 lib." << endl
1994 << "Configure will therefore continue with the SQLite3 lib bundled with Qt." << endl
1995 << "(Press any key to continue..)";
1996 if(_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
1997 exit(0); // Exit cleanly for Ctrl+C
1999 dictionary["SQL_SQLITE_LIB"] = "qt"; // Set to Qt's bundled lib an continue
2001 if (dictionary["QMAKESPEC"].endsWith("-g++")
2002 && dictionary["SQL_OCI"] != "no") {
2003 cout << "WARNING: Qt does not support compiling the Oracle database driver with" << endl
2004 << "MinGW, due to lack of such support from Oracle. Consider disabling the" << endl
2005 << "Oracle driver, as the current build will most likely fail." << endl;
2006 cout << "(Press any key to continue..)";
2007 if(_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
2008 exit(0); // Exit cleanly for Ctrl+C
2010 if (dictionary["QMAKESPEC"].endsWith("win32-msvc.net")) {
2011 cout << "WARNING: The makespec win32-msvc.net is deprecated. Consider using" << endl
2012 << "win32-msvc2002 or win32-msvc2003 instead." << endl;
2013 cout << "(Press any key to continue..)";
2014 if(_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
2015 exit(0); // Exit cleanly for Ctrl+C
2018 return true;
2022 Things that affect the Qt API/ABI:
2023 Options:
2024 minimal-config small-config medium-config large-config full-config
2026 Options:
2027 debug release
2030 Things that do not affect the Qt API/ABI:
2031 system-jpeg no-jpeg jpeg
2032 system-mng no-mng mng
2033 system-png no-png png
2034 system-zlib no-zlib zlib
2035 system-tiff no-tiff tiff
2036 no-gif gif
2037 dll staticlib
2039 nocrosscompiler
2040 GNUmake
2041 largefile
2044 tablet
2045 ipv6
2047 X11 : x11sm xinerama xcursor xfixes xrandr xrender fontconfig xkb
2048 Embedded: embedded freetype
2050 void Configure::generateBuildKey()
2052 QString spec = dictionary["QMAKESPEC"];
2054 QString compiler = "msvc"; // ICC is compatible
2055 if (spec.endsWith("-g++"))
2056 compiler = "mingw";
2057 else if (spec.endsWith("-borland"))
2058 compiler = "borland";
2060 // Build options which changes the Qt API/ABI
2061 QStringList build_options;
2062 if (!dictionary["QCONFIG"].isEmpty())
2063 build_options += dictionary["QCONFIG"] + "-config ";
2064 build_options.sort();
2066 // Sorted defines that start with QT_NO_
2067 QStringList build_defines = qmakeDefines.filter(QRegExp("^QT_NO_"));
2068 build_defines.sort();
2070 // Build up the QT_BUILD_KEY ifdef
2071 QString buildKey = "QT_BUILD_KEY \"";
2072 if (!dictionary["USER_BUILD_KEY"].isEmpty())
2073 buildKey += dictionary["USER_BUILD_KEY"] + " ";
2075 QString build32Key = buildKey + "Windows " + compiler + " %1 " + build_options.join(" ") + " " + build_defines.join(" ");
2076 QString build64Key = buildKey + "Windows x64 " + compiler + " %1 " + build_options.join(" ") + " " + build_defines.join(" ");
2077 build32Key = build32Key.simplified();
2078 build64Key = build64Key.simplified();
2079 build32Key.prepend("# define ");
2080 build64Key.prepend("# define ");
2082 QString buildkey = // Debug builds
2083 "#if (defined(_DEBUG) || defined(DEBUG))\n"
2084 "# if (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))\n"
2085 + build64Key.arg("debug") + "\"\n"
2086 "# else\n"
2087 + build32Key.arg("debug") + "\"\n"
2088 "# endif\n"
2089 "#else\n"
2090 // Release builds
2091 "# if (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))\n"
2092 + build64Key.arg("release") + "\"\n"
2093 "# else\n"
2094 + build32Key.arg("release") + "\"\n"
2095 "# endif\n"
2096 "#endif\n";
2098 dictionary["BUILD_KEY"] = buildkey;
2101 void Configure::generateOutputVars()
2103 // Generate variables for output
2104 // Build key ----------------------------------------------------
2105 if ( dictionary.contains("BUILD_KEY") ) {
2106 qmakeVars += dictionary.value("BUILD_KEY");
2109 QString build = dictionary[ "BUILD" ];
2110 bool buildAll = (dictionary[ "BUILDALL" ] == "yes");
2111 if ( build == "debug") {
2112 if (buildAll)
2113 qtConfig += "release";
2114 qtConfig += "debug";
2115 } else if (build == "release") {
2116 if (buildAll)
2117 qtConfig += "debug";
2118 qtConfig += "release";
2121 // Compression --------------------------------------------------
2122 if( dictionary[ "ZLIB" ] == "qt" )
2123 qtConfig += "zlib";
2124 else if( dictionary[ "ZLIB" ] == "system" )
2125 qtConfig += "system-zlib";
2127 // Image formates -----------------------------------------------
2128 if( dictionary[ "GIF" ] == "no" )
2129 qtConfig += "no-gif";
2130 else if( dictionary[ "GIF" ] == "yes" )
2131 qtConfig += "gif";
2132 else if( dictionary[ "GIF" ] == "plugin" )
2133 qmakeFormatPlugins += "gif";
2135 if( dictionary[ "TIFF" ] == "no" )
2136 qtConfig += "no-tiff";
2137 else if( dictionary[ "TIFF" ] == "plugin" )
2138 qmakeFormatPlugins += "tiff";
2139 if( dictionary[ "LIBTIFF" ] == "system" )
2140 qtConfig += "system-tiff";
2142 if( dictionary[ "JPEG" ] == "no" )
2143 qtConfig += "no-jpeg";
2144 else if( dictionary[ "JPEG" ] == "plugin" )
2145 qmakeFormatPlugins += "jpeg";
2146 if( dictionary[ "LIBJPEG" ] == "system" )
2147 qtConfig += "system-jpeg";
2149 if( dictionary[ "PNG" ] == "no" )
2150 qtConfig += "no-png";
2151 else if( dictionary[ "PNG" ] == "qt" )
2152 qtConfig += "png";
2153 if( dictionary[ "LIBPNG" ] == "system" )
2154 qtConfig += "system-png";
2156 if( dictionary[ "MNG" ] == "no" )
2157 qtConfig += "no-mng";
2158 else if( dictionary[ "MNG" ] == "qt" )
2159 qtConfig += "mng";
2160 if( dictionary[ "LIBMNG" ] == "system" )
2161 qtConfig += "system-mng";
2163 // Styles -------------------------------------------------------
2164 if ( dictionary[ "STYLE_WINDOWS" ] == "yes" )
2165 qmakeStyles += "windows";
2167 if ( dictionary[ "STYLE_PLASTIQUE" ] == "yes" )
2168 qmakeStyles += "plastique";
2170 if ( dictionary[ "STYLE_CLEANLOOKS" ] == "yes" )
2171 qmakeStyles += "cleanlooks";
2173 if ( dictionary[ "STYLE_WINDOWSXP" ] == "yes" )
2174 qmakeStyles += "windowsxp";
2176 if ( dictionary[ "STYLE_WINDOWSVISTA" ] == "yes" )
2177 qmakeStyles += "windowsvista";
2179 if ( dictionary[ "STYLE_MOTIF" ] == "yes" )
2180 qmakeStyles += "motif";
2182 if ( dictionary[ "STYLE_SGI" ] == "yes" )
2183 qmakeStyles += "sgi";
2185 if ( dictionary[ "STYLE_WINDOWSCE" ] == "yes" )
2186 qmakeStyles += "windowsce";
2188 if ( dictionary[ "STYLE_WINDOWSMOBILE" ] == "yes" )
2189 qmakeStyles += "windowsmobile";
2191 if ( dictionary[ "STYLE_CDE" ] == "yes" )
2192 qmakeStyles += "cde";
2194 // Databases ----------------------------------------------------
2195 if ( dictionary[ "SQL_MYSQL" ] == "yes" )
2196 qmakeSql += "mysql";
2197 else if ( dictionary[ "SQL_MYSQL" ] == "plugin" )
2198 qmakeSqlPlugins += "mysql";
2200 if ( dictionary[ "SQL_ODBC" ] == "yes" )
2201 qmakeSql += "odbc";
2202 else if ( dictionary[ "SQL_ODBC" ] == "plugin" )
2203 qmakeSqlPlugins += "odbc";
2205 if ( dictionary[ "SQL_OCI" ] == "yes" )
2206 qmakeSql += "oci";
2207 else if ( dictionary[ "SQL_OCI" ] == "plugin" )
2208 qmakeSqlPlugins += "oci";
2210 if ( dictionary[ "SQL_PSQL" ] == "yes" )
2211 qmakeSql += "psql";
2212 else if ( dictionary[ "SQL_PSQL" ] == "plugin" )
2213 qmakeSqlPlugins += "psql";
2215 if ( dictionary[ "SQL_TDS" ] == "yes" )
2216 qmakeSql += "tds";
2217 else if ( dictionary[ "SQL_TDS" ] == "plugin" )
2218 qmakeSqlPlugins += "tds";
2220 if ( dictionary[ "SQL_DB2" ] == "yes" )
2221 qmakeSql += "db2";
2222 else if ( dictionary[ "SQL_DB2" ] == "plugin" )
2223 qmakeSqlPlugins += "db2";
2225 if ( dictionary[ "SQL_SQLITE" ] == "yes" )
2226 qmakeSql += "sqlite";
2227 else if ( dictionary[ "SQL_SQLITE" ] == "plugin" )
2228 qmakeSqlPlugins += "sqlite";
2230 if ( dictionary[ "SQL_SQLITE_LIB" ] == "system" )
2231 qmakeConfig += "system-sqlite";
2233 if ( dictionary[ "SQL_SQLITE2" ] == "yes" )
2234 qmakeSql += "sqlite2";
2235 else if ( dictionary[ "SQL_SQLITE2" ] == "plugin" )
2236 qmakeSqlPlugins += "sqlite2";
2238 if ( dictionary[ "SQL_IBASE" ] == "yes" )
2239 qmakeSql += "ibase";
2240 else if ( dictionary[ "SQL_IBASE" ] == "plugin" )
2241 qmakeSqlPlugins += "ibase";
2243 // Other options ------------------------------------------------
2244 if( dictionary[ "BUILDALL" ] == "yes" ) {
2245 qmakeConfig += "build_all";
2247 qmakeConfig += dictionary[ "BUILD" ];
2248 dictionary[ "QMAKE_OUTDIR" ] = dictionary[ "BUILD" ];
2250 if ( dictionary[ "SHARED" ] == "yes" ) {
2251 QString version = dictionary[ "VERSION" ];
2252 if (!version.isEmpty()) {
2253 qmakeVars += "QMAKE_QT_VERSION_OVERRIDE = " + version.left(version.indexOf("."));
2254 version.remove(QLatin1Char('.'));
2256 dictionary[ "QMAKE_OUTDIR" ] += "_shared";
2257 } else {
2258 dictionary[ "QMAKE_OUTDIR" ] += "_static";
2261 if( dictionary[ "ACCESSIBILITY" ] == "yes" )
2262 qtConfig += "accessibility";
2264 if( !qmakeLibs.isEmpty() )
2265 qmakeVars += "LIBS += " + qmakeLibs.join( " " );
2267 if( !dictionary["QT_LFLAGS_SQLITE"].isEmpty() )
2268 qmakeVars += "QT_LFLAGS_SQLITE += " + dictionary["QT_LFLAGS_SQLITE"];
2270 if (dictionary[ "QT3SUPPORT" ] == "yes")
2271 qtConfig += "qt3support";
2273 if (dictionary[ "OPENGL" ] == "yes")
2274 qtConfig += "opengl";
2276 if ( dictionary["OPENGL_ES_CM"] == "yes" ) {
2277 qtConfig += "opengles1";
2280 if ( dictionary["OPENGL_ES_2"] == "yes" ) {
2281 qtConfig += "opengles2";
2284 if ( dictionary["OPENGL_ES_CL"] == "yes" ) {
2285 qtConfig += "opengles1cl";
2288 if ( dictionary["DIRECTSHOW"] == "yes" )
2289 qtConfig += "directshow";
2291 if (dictionary[ "OPENSSL" ] == "yes")
2292 qtConfig += "openssl";
2293 else if (dictionary[ "OPENSSL" ] == "linked")
2294 qtConfig += "openssl-linked";
2296 if (dictionary[ "DBUS" ] == "yes")
2297 qtConfig += "dbus";
2298 else if (dictionary[ "DBUS" ] == "linked")
2299 qtConfig += "dbus dbus-linked";
2301 if (dictionary["IPV6"] == "yes")
2302 qtConfig += "ipv6";
2303 else if (dictionary["IPV6"] == "no")
2304 qtConfig += "no-ipv6";
2306 if (dictionary[ "CETEST" ] == "yes")
2307 qtConfig += "cetest";
2309 if (dictionary[ "SCRIPT" ] == "yes")
2310 qtConfig += "script";
2312 if (dictionary[ "SCRIPTTOOLS" ] == "yes") {
2313 if (dictionary[ "SCRIPT" ] == "no") {
2314 cout << "QtScriptTools was requested, but it can't be built due to QtScript being "
2315 "disabled." << endl;
2316 dictionary[ "DONE" ] = "error";
2318 qtConfig += "scripttools";
2321 if (dictionary[ "XMLPATTERNS" ] == "yes")
2322 qtConfig += "xmlpatterns";
2324 if (dictionary["PHONON"] == "yes") {
2325 qtConfig += "phonon";
2326 if (dictionary["PHONON_BACKEND"] == "yes")
2327 qtConfig += "phonon-backend";
2330 if (dictionary["MULTIMEDIA"] == "yes")
2331 qtConfig += "multimedia";
2333 if (dictionary["WEBKIT"] == "yes")
2334 qtConfig += "webkit";
2336 // We currently have no switch for QtSvg, so add it unconditionally.
2337 qtConfig += "svg";
2339 // Add config levels --------------------------------------------
2340 QStringList possible_configs = QStringList()
2341 << "minimal"
2342 << "small"
2343 << "medium"
2344 << "large"
2345 << "full";
2347 QString set_config = dictionary["QCONFIG"];
2348 if (possible_configs.contains(set_config)) {
2349 foreach(QString cfg, possible_configs) {
2350 qtConfig += (cfg + "-config");
2351 if (cfg == set_config)
2352 break;
2356 // Directories and settings for .qmake.cache --------------------
2358 // if QT_INSTALL_* have not been specified on commandline, define them now from QT_INSTALL_PREFIX
2359 // if prefix is empty (WINCE), make all of them empty, if they aren't set
2360 bool qipempty = false;
2361 if(dictionary[ "QT_INSTALL_PREFIX" ].isEmpty())
2362 qipempty = true;
2364 if( !dictionary[ "QT_INSTALL_DOCS" ].size() )
2365 dictionary[ "QT_INSTALL_DOCS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/doc" );
2366 if( !dictionary[ "QT_INSTALL_HEADERS" ].size() )
2367 dictionary[ "QT_INSTALL_HEADERS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/include" );
2368 if( !dictionary[ "QT_INSTALL_LIBS" ].size() )
2369 dictionary[ "QT_INSTALL_LIBS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/lib" );
2370 if( !dictionary[ "QT_INSTALL_BINS" ].size() )
2371 dictionary[ "QT_INSTALL_BINS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/bin" );
2372 if( !dictionary[ "QT_INSTALL_PLUGINS" ].size() )
2373 dictionary[ "QT_INSTALL_PLUGINS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/plugins" );
2374 if( !dictionary[ "QT_INSTALL_DATA" ].size() )
2375 dictionary[ "QT_INSTALL_DATA" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] );
2376 if( !dictionary[ "QT_INSTALL_TRANSLATIONS" ].size() )
2377 dictionary[ "QT_INSTALL_TRANSLATIONS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/translations" );
2378 if( !dictionary[ "QT_INSTALL_EXAMPLES" ].size() )
2379 dictionary[ "QT_INSTALL_EXAMPLES" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/examples");
2380 if( !dictionary[ "QT_INSTALL_DEMOS" ].size() )
2381 dictionary[ "QT_INSTALL_DEMOS" ] = qipempty ? "" : fixSeparators( dictionary[ "QT_INSTALL_PREFIX" ] + "/demos" );
2383 if(dictionary.contains("XQMAKESPEC") && dictionary[ "XQMAKESPEC" ].startsWith("linux"))
2384 dictionary[ "QMAKE_RPATHDIR" ] = dictionary[ "QT_INSTALL_LIBS" ];
2386 qmakeVars += QString("OBJECTS_DIR = ") + fixSeparators( "tmp/obj/" + dictionary[ "QMAKE_OUTDIR" ] );
2387 qmakeVars += QString("MOC_DIR = ") + fixSeparators( "tmp/moc/" + dictionary[ "QMAKE_OUTDIR" ] );
2388 qmakeVars += QString("RCC_DIR = ") + fixSeparators("tmp/rcc/" + dictionary["QMAKE_OUTDIR"]);
2390 if (!qmakeDefines.isEmpty())
2391 qmakeVars += QString("DEFINES += ") + qmakeDefines.join( " " );
2392 if (!qmakeIncludes.isEmpty())
2393 qmakeVars += QString("INCLUDEPATH += ") + qmakeIncludes.join( " " );
2394 if (!opensslLibs.isEmpty())
2395 qmakeVars += opensslLibs;
2396 else if (dictionary[ "OPENSSL" ] == "linked")
2397 qmakeVars += QString("OPENSSL_LIBS = -lssleay32 -llibeay32");
2398 if (!qmakeSql.isEmpty())
2399 qmakeVars += QString("sql-drivers += ") + qmakeSql.join( " " );
2400 if (!qmakeSqlPlugins.isEmpty())
2401 qmakeVars += QString("sql-plugins += ") + qmakeSqlPlugins.join( " " );
2402 if (!qmakeStyles.isEmpty())
2403 qmakeVars += QString("styles += ") + qmakeStyles.join( " " );
2404 if (!qmakeStylePlugins.isEmpty())
2405 qmakeVars += QString("style-plugins += ") + qmakeStylePlugins.join( " " );
2406 if (!qmakeFormatPlugins.isEmpty())
2407 qmakeVars += QString("imageformat-plugins += ") + qmakeFormatPlugins.join( " " );
2409 if (dictionary["QMAKESPEC"].endsWith("-g++")) {
2410 QString includepath = qgetenv("INCLUDE");
2411 bool hasSh = Environment::detectExecutable("sh.exe");
2412 QChar separator = (!includepath.contains(":\\") && hasSh ? QChar(':') : QChar(';'));
2413 qmakeVars += QString("TMPPATH = $$quote($$(INCLUDE))");
2414 qmakeVars += QString("QMAKE_INCDIR_POST += $$split(TMPPATH,\"%1\")").arg(separator);
2415 qmakeVars += QString("TMPPATH = $$quote($$(LIB))");
2416 qmakeVars += QString("QMAKE_LIBDIR_POST += $$split(TMPPATH,\"%1\")").arg(separator);
2419 if( !dictionary[ "QMAKESPEC" ].length() ) {
2420 cout << "Configure could not detect your compiler. QMAKESPEC must either" << endl
2421 << "be defined as an environment variable, or specified as an" << endl
2422 << "argument with -platform" << endl;
2423 dictionary[ "HELP" ] = "yes";
2425 QStringList winPlatforms;
2426 QDir mkspecsDir( sourcePath + "/mkspecs" );
2427 const QFileInfoList &specsList = mkspecsDir.entryInfoList();
2428 for(int i = 0; i < specsList.size(); ++i) {
2429 const QFileInfo &fi = specsList.at(i);
2430 if( fi.fileName().left( 5 ) == "win32" ) {
2431 winPlatforms += fi.fileName();
2434 cout << "Available platforms are: " << qPrintable(winPlatforms.join( ", " )) << endl;
2435 dictionary[ "DONE" ] = "error";
2439 #if !defined(EVAL)
2440 void Configure::generateCachefile()
2442 // Generate .qmake.cache
2443 QFile cacheFile( buildPath + "/.qmake.cache" );
2444 if( cacheFile.open( QFile::WriteOnly | QFile::Text ) ) { // Truncates any existing file.
2445 QTextStream cacheStream( &cacheFile );
2446 for( QStringList::Iterator var = qmakeVars.begin(); var != qmakeVars.end(); ++var ) {
2447 cacheStream << (*var) << endl;
2449 cacheStream << "CONFIG += " << qmakeConfig.join( " " ) << " incremental create_prl link_prl depend_includepath QTDIR_build" << endl;
2451 QStringList buildParts;
2452 buildParts << "libs" << "tools" << "examples" << "demos" << "docs" << "translations";
2453 foreach(QString item, disabledBuildParts) {
2454 buildParts.removeAll(item);
2456 cacheStream << "QT_BUILD_PARTS = " << buildParts.join( " " ) << endl;
2458 QString targetSpec = dictionary.contains("XQMAKESPEC") ? dictionary[ "XQMAKESPEC" ] : dictionary[ "QMAKESPEC" ];
2459 QString mkspec_path = fixSeparators(sourcePath + "/mkspecs/" + targetSpec);
2460 if(QFile::exists(mkspec_path))
2461 cacheStream << "QMAKESPEC = " << mkspec_path << endl;
2462 else
2463 cacheStream << "QMAKESPEC = " << fixSeparators(targetSpec) << endl;
2464 cacheStream << "ARCH = " << fixSeparators(dictionary[ "ARCHITECTURE" ]) << endl;
2465 cacheStream << "QT_BUILD_TREE = " << fixSeparators(dictionary[ "QT_BUILD_TREE" ]) << endl;
2466 cacheStream << "QT_SOURCE_TREE = " << fixSeparators(dictionary[ "QT_SOURCE_TREE" ]) << endl;
2468 if (dictionary["QT_EDITION"] != "QT_EDITION_OPENSOURCE")
2469 cacheStream << "DEFINES *= QT_EDITION=QT_EDITION_DESKTOP" << endl;
2471 //so that we can build without an install first (which would be impossible)
2472 cacheStream << "QMAKE_MOC = $$QT_BUILD_TREE" << fixSeparators("/bin/moc.exe") << endl;
2473 cacheStream << "QMAKE_UIC = $$QT_BUILD_TREE" << fixSeparators("/bin/uic.exe") << endl;
2474 cacheStream << "QMAKE_UIC3 = $$QT_BUILD_TREE" << fixSeparators("/bin/uic3.exe") << endl;
2475 cacheStream << "QMAKE_RCC = $$QT_BUILD_TREE" << fixSeparators("/bin/rcc.exe") << endl;
2476 cacheStream << "QMAKE_DUMPCPP = $$QT_BUILD_TREE" << fixSeparators("/bin/dumpcpp.exe") << endl;
2477 cacheStream << "QMAKE_INCDIR_QT = $$QT_BUILD_TREE" << fixSeparators("/include") << endl;
2478 cacheStream << "QMAKE_LIBDIR_QT = $$QT_BUILD_TREE" << fixSeparators("/lib") << endl;
2479 if (dictionary["CETEST"] == "yes") {
2480 cacheStream << "QT_CE_RAPI_INC = " << fixSeparators(dictionary[ "QT_CE_RAPI_INC" ]) << endl;
2481 cacheStream << "QT_CE_RAPI_LIB = " << fixSeparators(dictionary[ "QT_CE_RAPI_LIB" ]) << endl;
2484 // embedded
2485 if( !dictionary["KBD_DRIVERS"].isEmpty())
2486 cacheStream << "kbd-drivers += "<< dictionary["KBD_DRIVERS"]<<endl;
2487 if( !dictionary["GFX_DRIVERS"].isEmpty())
2488 cacheStream << "gfx-drivers += "<< dictionary["GFX_DRIVERS"]<<endl;
2489 if( !dictionary["MOUSE_DRIVERS"].isEmpty())
2490 cacheStream << "mouse-drivers += "<< dictionary["MOUSE_DRIVERS"]<<endl;
2491 if( !dictionary["DECORATIONS"].isEmpty())
2492 cacheStream << "decorations += "<<dictionary["DECORATIONS"]<<endl;
2494 if( !dictionary["QMAKE_RPATHDIR"].isEmpty() )
2495 cacheStream << "QMAKE_RPATHDIR += "<<dictionary["QMAKE_RPATHDIR"];
2497 cacheStream.flush();
2498 cacheFile.close();
2500 QFile configFile( dictionary[ "QT_BUILD_TREE" ] + "/mkspecs/qconfig.pri" );
2501 if( configFile.open( QFile::WriteOnly | QFile::Text ) ) { // Truncates any existing file.
2502 QTextStream configStream( &configFile );
2503 configStream << "CONFIG+= ";
2504 configStream << dictionary[ "BUILD" ];
2505 if( dictionary[ "SHARED" ] == "yes" )
2506 configStream << " shared";
2507 else
2508 configStream << " static";
2510 if( dictionary[ "LTCG" ] == "yes" )
2511 configStream << " ltcg";
2512 if( dictionary[ "STL" ] == "yes" )
2513 configStream << " stl";
2514 if ( dictionary[ "EXCEPTIONS" ] == "yes" )
2515 configStream << " exceptions";
2516 if ( dictionary[ "EXCEPTIONS" ] == "no" )
2517 configStream << " exceptions_off";
2518 if ( dictionary[ "RTTI" ] == "yes" )
2519 configStream << " rtti";
2520 if ( dictionary[ "MMX" ] == "yes" )
2521 configStream << " mmx";
2522 if ( dictionary[ "3DNOW" ] == "yes" )
2523 configStream << " 3dnow";
2524 if ( dictionary[ "SSE" ] == "yes" )
2525 configStream << " sse";
2526 if ( dictionary[ "SSE2" ] == "yes" )
2527 configStream << " sse2";
2528 if ( dictionary[ "IWMMXT" ] == "yes" )
2529 configStream << " iwmmxt";
2530 if ( dictionary["INCREDIBUILD_XGE"] == "yes" )
2531 configStream << " incredibuild_xge";
2532 if ( dictionary["PLUGIN_MANIFESTS"] == "no" )
2533 configStream << " no_plugin_manifest";
2535 configStream << endl;
2536 configStream << "QT_ARCH = " << dictionary[ "ARCHITECTURE" ] << endl;
2537 if (dictionary["QT_EDITION"].contains("OPENSOURCE"))
2538 configStream << "QT_EDITION = " << QLatin1String("OpenSource") << endl;
2539 else
2540 configStream << "QT_EDITION = " << dictionary["EDITION"] << endl;
2541 configStream << "QT_CONFIG += " << qtConfig.join(" ") << endl;
2543 configStream << "#versioning " << endl
2544 << "QT_VERSION = " << dictionary["VERSION"] << endl
2545 << "QT_MAJOR_VERSION = " << dictionary["VERSION_MAJOR"] << endl
2546 << "QT_MINOR_VERSION = " << dictionary["VERSION_MINOR"] << endl
2547 << "QT_PATCH_VERSION = " << dictionary["VERSION_PATCH"] << endl;
2549 configStream << "#Qt for Windows CE c-runtime deployment" << endl
2550 << "QT_CE_C_RUNTIME = " << fixSeparators(dictionary[ "CE_CRT" ]) << endl;
2552 if(dictionary["CE_SIGNATURE"] != QLatin1String("no"))
2553 configStream << "DEFAULT_SIGNATURE=" << dictionary["CE_SIGNATURE"] << endl;
2555 if(!dictionary["QMAKE_RPATHDIR"].isEmpty())
2556 configStream << "QMAKE_RPATHDIR += " << dictionary["QMAKE_RPATHDIR"] << endl;
2558 if (!dictionary["QT_LIBINFIX"].isEmpty())
2559 configStream << "QT_LIBINFIX = " << dictionary["QT_LIBINFIX"] << endl;
2561 configStream.flush();
2562 configFile.close();
2565 #endif
2567 QString Configure::addDefine(QString def)
2569 QString result, defNeg, defD = def;
2571 defD.replace(QRegExp("=.*"), "");
2572 def.replace(QRegExp("="), " ");
2574 if(def.startsWith("QT_NO_")) {
2575 defNeg = defD;
2576 defNeg.replace("QT_NO_", "QT_");
2577 } else if(def.startsWith("QT_")) {
2578 defNeg = defD;
2579 defNeg.replace("QT_", "QT_NO_");
2582 if (defNeg.isEmpty()) {
2583 result = "#ifndef $DEFD\n"
2584 "# define $DEF\n"
2585 "#endif\n\n";
2586 } else {
2587 result = "#if defined($DEFD) && defined($DEFNEG)\n"
2588 "# undef $DEFD\n"
2589 "#elif !defined($DEFD)\n"
2590 "# define $DEF\n"
2591 "#endif\n\n";
2593 result.replace("$DEFNEG", defNeg);
2594 result.replace("$DEFD", defD);
2595 result.replace("$DEF", def);
2596 return result;
2599 #if !defined(EVAL)
2600 void Configure::generateConfigfiles()
2602 QDir(buildPath).mkpath("src/corelib/global");
2603 QString outName( buildPath + "/src/corelib/global/qconfig.h" );
2604 QTemporaryFile tmpFile;
2605 QTextStream tmpStream;
2607 if(tmpFile.open()) {
2608 tmpStream.setDevice(&tmpFile);
2610 if( dictionary[ "QCONFIG" ] == "full" ) {
2611 tmpStream << "/* Everything */" << endl;
2612 } else {
2613 QString configName( "qconfig-" + dictionary[ "QCONFIG" ] + ".h" );
2614 tmpStream << "/* Copied from " << configName << "*/" << endl;
2615 tmpStream << "#ifndef QT_BOOTSTRAPPED" << endl;
2616 QFile inFile( sourcePath + "/src/corelib/global/" + configName );
2617 if( inFile.open( QFile::ReadOnly ) ) {
2618 QByteArray buffer = inFile.readAll();
2619 tmpFile.write( buffer.constData(), buffer.size() );
2620 inFile.close();
2622 tmpStream << "#endif // QT_BOOTSTRAPPED" << endl;
2624 tmpStream << endl;
2626 if( dictionary[ "SHARED" ] == "yes" ) {
2627 tmpStream << "#ifndef QT_DLL" << endl;
2628 tmpStream << "#define QT_DLL" << endl;
2629 tmpStream << "#endif" << endl;
2631 tmpStream << endl;
2632 tmpStream << "/* License information */" << endl;
2633 tmpStream << "#define QT_PRODUCT_LICENSEE \"" << licenseInfo[ "LICENSEE" ] << "\"" << endl;
2634 tmpStream << "#define QT_PRODUCT_LICENSE \"" << dictionary[ "EDITION" ] << "\"" << endl;
2635 tmpStream << endl;
2636 tmpStream << "// Qt Edition" << endl;
2637 tmpStream << "#ifndef QT_EDITION" << endl;
2638 tmpStream << "# define QT_EDITION " << dictionary["QT_EDITION"] << endl;
2639 tmpStream << "#endif" << endl;
2640 tmpStream << endl;
2641 tmpStream << dictionary["BUILD_KEY"];
2642 tmpStream << endl;
2643 if (dictionary["BUILDDEV"] == "yes") {
2644 dictionary["QMAKE_INTERNAL"] = "yes";
2645 tmpStream << "/* Used for example to export symbols for the certain autotests*/" << endl;
2646 tmpStream << "#define QT_BUILD_INTERNAL" << endl;
2647 tmpStream << endl;
2649 tmpStream << "/* Machine byte-order */" << endl;
2650 tmpStream << "#define Q_BIG_ENDIAN 4321" << endl;
2651 tmpStream << "#define Q_LITTLE_ENDIAN 1234" << endl;
2652 if ( QSysInfo::ByteOrder == QSysInfo::BigEndian )
2653 tmpStream << "#define Q_BYTE_ORDER Q_BIG_ENDIAN" << endl;
2654 else
2655 tmpStream << "#define Q_BYTE_ORDER Q_LITTLE_ENDIAN" << endl;
2657 tmpStream << endl << "// Compile time features" << endl;
2658 tmpStream << "#define QT_ARCH_" << dictionary["ARCHITECTURE"].toUpper() << endl;
2659 QStringList qconfigList;
2660 if(dictionary["STL"] == "no") qconfigList += "QT_NO_STL";
2661 if(dictionary["STYLE_WINDOWS"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWS";
2662 if(dictionary["STYLE_PLASTIQUE"] != "yes") qconfigList += "QT_NO_STYLE_PLASTIQUE";
2663 if(dictionary["STYLE_CLEANLOOKS"] != "yes") qconfigList += "QT_NO_STYLE_CLEANLOOKS";
2664 if(dictionary["STYLE_WINDOWSXP"] != "yes" && dictionary["STYLE_WINDOWSVISTA"] != "yes")
2665 qconfigList += "QT_NO_STYLE_WINDOWSXP";
2666 if(dictionary["STYLE_WINDOWSVISTA"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWSVISTA";
2667 if(dictionary["STYLE_MOTIF"] != "yes") qconfigList += "QT_NO_STYLE_MOTIF";
2668 if(dictionary["STYLE_CDE"] != "yes") qconfigList += "QT_NO_STYLE_CDE";
2669 if(dictionary["STYLE_WINDOWSCE"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWSCE";
2670 if(dictionary["STYLE_WINDOWSMOBILE"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWSMOBILE";
2671 if(dictionary["STYLE_GTK"] != "yes") qconfigList += "QT_NO_STYLE_GTK";
2673 if(dictionary["GIF"] == "yes") qconfigList += "QT_BUILTIN_GIF_READER=1";
2674 if(dictionary["PNG"] == "no") qconfigList += "QT_NO_IMAGEFORMAT_PNG";
2675 if(dictionary["MNG"] == "no") qconfigList += "QT_NO_IMAGEFORMAT_MNG";
2676 if(dictionary["JPEG"] == "no") qconfigList += "QT_NO_IMAGEFORMAT_JPEG";
2677 if(dictionary["TIFF"] == "no") qconfigList += "QT_NO_IMAGEFORMAT_TIFF";
2678 if(dictionary["ZLIB"] == "no") {
2679 qconfigList += "QT_NO_ZLIB";
2680 qconfigList += "QT_NO_COMPRESS";
2683 if(dictionary["QT3SUPPORT"] == "no") qconfigList += "QT_NO_QT3SUPPORT";
2684 if(dictionary["ACCESSIBILITY"] == "no") qconfigList += "QT_NO_ACCESSIBILITY";
2685 if(dictionary["EXCEPTIONS"] == "no") qconfigList += "QT_NO_EXCEPTIONS";
2686 if(dictionary["OPENGL"] == "no") qconfigList += "QT_NO_OPENGL";
2687 if(dictionary["OPENSSL"] == "no") qconfigList += "QT_NO_OPENSSL";
2688 if(dictionary["OPENSSL"] == "linked") qconfigList += "QT_LINKED_OPENSSL";
2689 if(dictionary["DBUS"] == "no") qconfigList += "QT_NO_DBUS";
2690 if(dictionary["IPV6"] == "no") qconfigList += "QT_NO_IPV6";
2691 if(dictionary["WEBKIT"] == "no") qconfigList += "QT_NO_WEBKIT";
2692 if(dictionary["PHONON"] == "no") qconfigList += "QT_NO_PHONON";
2693 if(dictionary["MULTIMEDIA"] == "no") qconfigList += "QT_NO_MULTIMEDIA";
2694 if(dictionary["XMLPATTERNS"] == "no") qconfigList += "QT_NO_XMLPATTERNS";
2695 if(dictionary["SCRIPT"] == "no") qconfigList += "QT_NO_SCRIPT";
2696 if(dictionary["SCRIPTTOOLS"] == "no") qconfigList += "QT_NO_SCRIPTTOOLS";
2698 if(dictionary["OPENGL_ES_CM"] == "yes" ||
2699 dictionary["OPENGL_ES_CL"] == "yes" ||
2700 dictionary["OPENGL_ES_2"] == "yes") qconfigList += "QT_OPENGL_ES";
2702 if(dictionary["OPENGL_ES_CM"] == "yes") qconfigList += "QT_OPENGL_ES_1";
2703 if(dictionary["OPENGL_ES_2"] == "yes") qconfigList += "QT_OPENGL_ES_2";
2704 if(dictionary["OPENGL_ES_CL"] == "yes") qconfigList += "QT_OPENGL_ES_1_CL";
2706 if(dictionary["SQL_MYSQL"] == "yes") qconfigList += "QT_SQL_MYSQL";
2707 if(dictionary["SQL_ODBC"] == "yes") qconfigList += "QT_SQL_ODBC";
2708 if(dictionary["SQL_OCI"] == "yes") qconfigList += "QT_SQL_OCI";
2709 if(dictionary["SQL_PSQL"] == "yes") qconfigList += "QT_SQL_PSQL";
2710 if(dictionary["SQL_TDS"] == "yes") qconfigList += "QT_SQL_TDS";
2711 if(dictionary["SQL_DB2"] == "yes") qconfigList += "QT_SQL_DB2";
2712 if(dictionary["SQL_SQLITE"] == "yes") qconfigList += "QT_SQL_SQLITE";
2713 if(dictionary["SQL_SQLITE2"] == "yes") qconfigList += "QT_SQL_SQLITE2";
2714 if(dictionary["SQL_IBASE"] == "yes") qconfigList += "QT_SQL_IBASE";
2716 if (dictionary["GRAPHICS_SYSTEM"] == "opengl") qconfigList += "QT_GRAPHICSSYSTEM_OPENGL";
2717 if (dictionary["GRAPHICS_SYSTEM"] == "raster") qconfigList += "QT_GRAPHICSSYSTEM_RASTER";
2719 qconfigList.sort();
2720 for (int i = 0; i < qconfigList.count(); ++i)
2721 tmpStream << addDefine(qconfigList.at(i));
2723 if(dictionary["EMBEDDED"] == "yes")
2725 // Check for keyboard, mouse, gfx.
2726 QStringList kbdDrivers = dictionary["KBD_DRIVERS"].split(" ");;
2727 QStringList allKbdDrivers;
2728 allKbdDrivers<<"tty"<<"usb"<<"sl5000"<<"yopy"<<"vr41xx"<<"qvfb"<<"um";
2729 foreach(QString kbd, allKbdDrivers) {
2730 if( !kbdDrivers.contains(kbd))
2731 tmpStream<<"#define QT_NO_QWS_KBD_"<<kbd.toUpper()<<endl;
2734 QStringList mouseDrivers = dictionary["MOUSE_DRIVERS"].split(" ");
2735 QStringList allMouseDrivers;
2736 allMouseDrivers << "pc"<<"bus"<<"linuxtp"<<"yopy"<<"vr41xx"<<"tslib"<<"qvfb";
2737 foreach(QString mouse, allMouseDrivers) {
2738 if( !mouseDrivers.contains(mouse) )
2739 tmpStream<<"#define QT_NO_QWS_MOUSE_"<<mouse.toUpper()<<endl;
2742 QStringList gfxDrivers = dictionary["GFX_DRIVERS"].split(" ");
2743 QStringList allGfxDrivers;
2744 allGfxDrivers<<"linuxfb"<<"transformed"<<"qvfb"<<"vnc"<<"multiscreen"<<"ahi";
2745 foreach(QString gfx, allGfxDrivers) {
2746 if( !gfxDrivers.contains(gfx))
2747 tmpStream<<"#define QT_NO_QWS_"<<gfx.toUpper()<<endl;
2750 tmpStream<<"#define Q_WS_QWS"<<endl;
2752 QStringList depths = dictionary[ "QT_QWS_DEPTH" ].split(" ");
2753 foreach(QString depth, depths)
2754 tmpStream<<"#define QT_QWS_DEPTH_"+depth<<endl;
2757 if( dictionary[ "QT_CUPS" ] == "no")
2758 tmpStream<<"#define QT_NO_CUPS"<<endl;
2760 if( dictionary[ "QT_ICONV" ] == "no")
2761 tmpStream<<"#define QT_NO_ICONV"<<endl;
2763 if(dictionary[ "QT_GLIB" ] == "no")
2764 tmpStream<<"#define QT_NO_GLIB"<<endl;
2766 if(dictionary[ "QT_LPR" ] == "no")
2767 tmpStream<<"#define QT_NO_LPR"<<endl;
2769 if(dictionary[ "QT_INOTIFY" ] == "no" )
2770 tmpStream<<"#define QT_NO_INOTIFY"<<endl;
2772 if(dictionary[ "QT_SXE" ] == "no")
2773 tmpStream<<"#define QT_NO_SXE"<<endl;
2775 tmpStream.flush();
2776 tmpFile.flush();
2778 // Replace old qconfig.h with new one
2779 ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL);
2780 QFile::remove(outName);
2781 tmpFile.copy(outName);
2782 tmpFile.close();
2784 if(!QFile::exists(buildPath + "/include/QtCore/qconfig.h")) {
2785 if (!writeToFile("#include \"../../src/corelib/global/qconfig.h\"\n",
2786 buildPath + "/include/QtCore/qconfig.h")
2787 || !writeToFile("#include \"../../src/corelib/global/qconfig.h\"\n",
2788 buildPath + "/include/Qt/qconfig.h")) {
2789 dictionary["DONE"] = "error";
2790 return;
2795 // Copy configured mkspec to default directory, but remove the old one first, if there is any
2796 QString defSpec = buildPath + "/mkspecs/default";
2797 QFileInfo defSpecInfo(defSpec);
2798 if (defSpecInfo.exists()) {
2799 if (!Environment::rmdir(defSpec)) {
2800 cout << "Couldn't update default mkspec! Are files in " << qPrintable(defSpec) << " read-only?" << endl;
2801 dictionary["DONE"] = "error";
2802 return;
2806 QString spec = dictionary.contains("XQMAKESPEC") ? dictionary["XQMAKESPEC"] : dictionary["QMAKESPEC"];
2807 QString pltSpec = sourcePath + "/mkspecs/" + spec;
2808 if (!Environment::cpdir(pltSpec, defSpec)) {
2809 cout << "Couldn't update default mkspec! Does " << qPrintable(pltSpec) << " exist?" << endl;
2810 dictionary["DONE"] = "error";
2811 return;
2814 outName = defSpec + "/qmake.conf";
2815 ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL );
2816 QFile qmakeConfFile(outName);
2817 if (qmakeConfFile.open(QFile::Append | QFile::WriteOnly | QFile::Text)) {
2818 QTextStream qmakeConfStream;
2819 qmakeConfStream.setDevice(&qmakeConfFile);
2820 qmakeConfStream << endl << "QMAKESPEC_ORIGINAL=" << pltSpec << endl;
2821 qmakeConfStream.flush();
2822 qmakeConfFile.close();
2825 // Generate the new qconfig.cpp file
2826 QDir(buildPath).mkpath("src/corelib/global");
2827 outName = buildPath + "/src/corelib/global/qconfig.cpp";
2829 QTemporaryFile tmpFile2;
2830 if (tmpFile2.open()) {
2831 tmpStream.setDevice(&tmpFile2);
2832 tmpStream << "/* Licensed */" << endl
2833 << "static const char qt_configure_licensee_str [512 + 12] = \"qt_lcnsuser=" << licenseInfo["LICENSEE"] << "\";" << endl
2834 << "static const char qt_configure_licensed_products_str [512 + 12] = \"qt_lcnsprod=" << dictionary["EDITION"] << "\";" << endl;
2835 if(!dictionary[ "QT_HOST_PREFIX" ].isNull())
2836 tmpStream << "#if !defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE)" << endl;
2837 tmpStream << "static const char qt_configure_prefix_path_str [512 + 12] = \"qt_prfxpath=" << QString(dictionary["QT_INSTALL_PREFIX"]).replace( "\\", "\\\\" ) << "\";" << endl
2838 << "static const char qt_configure_documentation_path_str[512 + 12] = \"qt_docspath=" << QString(dictionary["QT_INSTALL_DOCS"]).replace( "\\", "\\\\" ) << "\";" << endl
2839 << "static const char qt_configure_headers_path_str [512 + 12] = \"qt_hdrspath=" << QString(dictionary["QT_INSTALL_HEADERS"]).replace( "\\", "\\\\" ) << "\";" << endl
2840 << "static const char qt_configure_libraries_path_str [512 + 12] = \"qt_libspath=" << QString(dictionary["QT_INSTALL_LIBS"]).replace( "\\", "\\\\" ) << "\";" << endl
2841 << "static const char qt_configure_binaries_path_str [512 + 12] = \"qt_binspath=" << QString(dictionary["QT_INSTALL_BINS"]).replace( "\\", "\\\\" ) << "\";" << endl
2842 << "static const char qt_configure_plugins_path_str [512 + 12] = \"qt_plugpath=" << QString(dictionary["QT_INSTALL_PLUGINS"]).replace( "\\", "\\\\" ) << "\";" << endl
2843 << "static const char qt_configure_data_path_str [512 + 12] = \"qt_datapath=" << QString(dictionary["QT_INSTALL_DATA"]).replace( "\\", "\\\\" ) << "\";" << endl
2844 << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << QString(dictionary["QT_INSTALL_TRANSLATIONS"]).replace( "\\", "\\\\" ) << "\";" << endl
2845 << "static const char qt_configure_examples_path_str [512 + 12] = \"qt_xmplpath=" << QString(dictionary["QT_INSTALL_EXAMPLES"]).replace( "\\", "\\\\" ) << "\";" << endl
2846 << "static const char qt_configure_demos_path_str [512 + 12] = \"qt_demopath=" << QString(dictionary["QT_INSTALL_DEMOS"]).replace( "\\", "\\\\" ) << "\";" << endl
2847 //<< "static const char qt_configure_settings_path_str [256] = \"qt_stngpath=" << QString(dictionary["QT_INSTALL_SETTINGS"]).replace( "\\", "\\\\" ) << "\";" << endl
2849 if(!dictionary[ "QT_HOST_PREFIX" ].isNull()) {
2850 tmpStream << "#else" << endl
2851 << "static const char qt_configure_prefix_path_str [512 + 12] = \"qt_prfxpath=" << QString(dictionary[ "QT_HOST_PREFIX" ]).replace( "\\", "\\\\" ) << "\";" << endl
2852 << "static const char qt_configure_documentation_path_str[512 + 12] = \"qt_docspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/doc").replace( "\\", "\\\\" ) <<"\";" << endl
2853 << "static const char qt_configure_headers_path_str [512 + 12] = \"qt_hdrspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/include").replace( "\\", "\\\\" ) <<"\";" << endl
2854 << "static const char qt_configure_libraries_path_str [512 + 12] = \"qt_libspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/lib").replace( "\\", "\\\\" ) <<"\";" << endl
2855 << "static const char qt_configure_binaries_path_str [512 + 12] = \"qt_binspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/bin").replace( "\\", "\\\\" ) <<"\";" << endl
2856 << "static const char qt_configure_plugins_path_str [512 + 12] = \"qt_plugpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/plugins").replace( "\\", "\\\\" ) <<"\";" << endl
2857 << "static const char qt_configure_data_path_str [512 + 12] = \"qt_datapath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ]).replace( "\\", "\\\\" ) <<"\";" << endl
2858 << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/translations").replace( "\\", "\\\\" ) <<"\";" << endl
2859 << "static const char qt_configure_examples_path_str [512 + 12] = \"qt_xmplpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/example").replace( "\\", "\\\\" ) <<"\";" << endl
2860 << "static const char qt_configure_demos_path_str [512 + 12] = \"qt_demopath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/demos").replace( "\\", "\\\\" ) <<"\";" << endl
2861 << "#endif //QT_BOOTSTRAPPED" << endl;
2863 tmpStream << "/* strlen( \"qt_lcnsxxxx\" ) == 12 */" << endl
2864 << "#define QT_CONFIGURE_LICENSEE qt_configure_licensee_str + 12;" << endl
2865 << "#define QT_CONFIGURE_LICENSED_PRODUCTS qt_configure_licensed_products_str + 12;" << endl
2866 << "#define QT_CONFIGURE_PREFIX_PATH qt_configure_prefix_path_str + 12;" << endl
2867 << "#define QT_CONFIGURE_DOCUMENTATION_PATH qt_configure_documentation_path_str + 12;" << endl
2868 << "#define QT_CONFIGURE_HEADERS_PATH qt_configure_headers_path_str + 12;" << endl
2869 << "#define QT_CONFIGURE_LIBRARIES_PATH qt_configure_libraries_path_str + 12;" << endl
2870 << "#define QT_CONFIGURE_BINARIES_PATH qt_configure_binaries_path_str + 12;" << endl
2871 << "#define QT_CONFIGURE_PLUGINS_PATH qt_configure_plugins_path_str + 12;" << endl
2872 << "#define QT_CONFIGURE_DATA_PATH qt_configure_data_path_str + 12;" << endl
2873 << "#define QT_CONFIGURE_TRANSLATIONS_PATH qt_configure_translations_path_str + 12;" << endl
2874 << "#define QT_CONFIGURE_EXAMPLES_PATH qt_configure_examples_path_str + 12;" << endl
2875 << "#define QT_CONFIGURE_DEMOS_PATH qt_configure_demos_path_str + 12;" << endl
2876 //<< "#define QT_CONFIGURE_SETTINGS_PATH qt_configure_settings_path_str + 12;" << endl
2877 << endl;
2879 tmpStream.flush();
2880 tmpFile2.flush();
2882 // Replace old qconfig.cpp with new one
2883 ::SetFileAttributes((wchar_t*)outName.utf16(), FILE_ATTRIBUTE_NORMAL );
2884 QFile::remove( outName );
2885 tmpFile2.copy(outName);
2886 tmpFile2.close();
2889 #endif
2891 #if !defined(EVAL)
2892 void Configure::displayConfig()
2894 // Give some feedback
2895 cout << "Environment:" << endl;
2896 QString env = QString::fromLocal8Bit(getenv("INCLUDE")).replace(QRegExp("[;,]"), "\r\n ");
2897 if (env.isEmpty())
2898 env = "Unset";
2899 cout << " INCLUDE=\r\n " << env << endl;
2900 env = QString::fromLocal8Bit(getenv("LIB")).replace(QRegExp("[;,]"), "\r\n ");
2901 if (env.isEmpty())
2902 env = "Unset";
2903 cout << " LIB=\r\n " << env << endl;
2904 env = QString::fromLocal8Bit(getenv("PATH")).replace(QRegExp("[;,]"), "\r\n ");
2905 if (env.isEmpty())
2906 env = "Unset";
2907 cout << " PATH=\r\n " << env << endl;
2909 if (dictionary["EDITION"] == "OpenSource") {
2910 cout << "You are licensed to use this software under the terms of the GNU GPL version 3.";
2911 cout << "You are licensed to use this software under the terms of the Lesser GNU LGPL version 2.1." << endl;
2912 cout << "See " << dictionary["LICENSE FILE"] << "3" << endl << endl
2913 << " or " << dictionary["LICENSE FILE"] << "L" << endl << endl;
2914 } else {
2915 QString l1 = licenseInfo[ "LICENSEE" ];
2916 QString l2 = licenseInfo[ "LICENSEID" ];
2917 QString l3 = dictionary["EDITION"] + ' ' + "Edition";
2918 QString l4 = licenseInfo[ "EXPIRYDATE" ];
2919 cout << "Licensee...................." << (l1.isNull() ? "" : l1) << endl;
2920 cout << "License ID.................." << (l2.isNull() ? "" : l2) << endl;
2921 cout << "Product license............." << (l3.isNull() ? "" : l3) << endl;
2922 cout << "Expiry Date................." << (l4.isNull() ? "" : l4) << endl << endl;
2925 cout << "Configuration:" << endl;
2926 cout << " " << qmakeConfig.join( "\r\n " ) << endl;
2927 cout << "Qt Configuration:" << endl;
2928 cout << " " << qtConfig.join( "\r\n " ) << endl;
2929 cout << endl;
2931 if (dictionary.contains("XQMAKESPEC"))
2932 cout << "QMAKESPEC..................." << dictionary[ "XQMAKESPEC" ] << " (" << dictionary["QMAKESPEC_FROM"] << ")" << endl;
2933 else
2934 cout << "QMAKESPEC..................." << dictionary[ "QMAKESPEC" ] << " (" << dictionary["QMAKESPEC_FROM"] << ")" << endl;
2935 cout << "Architecture................" << dictionary[ "ARCHITECTURE" ] << endl;
2936 cout << "Maketool...................." << dictionary[ "MAKE" ] << endl;
2937 cout << "Debug symbols..............." << (dictionary[ "BUILD" ] == "debug" ? "yes" : "no") << endl;
2938 cout << "Link Time Code Generation..." << dictionary[ "LTCG" ] << endl;
2939 cout << "Accessibility support......." << dictionary[ "ACCESSIBILITY" ] << endl;
2940 cout << "STL support................." << dictionary[ "STL" ] << endl;
2941 cout << "Exception support..........." << dictionary[ "EXCEPTIONS" ] << endl;
2942 cout << "RTTI support................" << dictionary[ "RTTI" ] << endl;
2943 cout << "MMX support................." << dictionary[ "MMX" ] << endl;
2944 cout << "3DNOW support..............." << dictionary[ "3DNOW" ] << endl;
2945 cout << "SSE support................." << dictionary[ "SSE" ] << endl;
2946 cout << "SSE2 support................" << dictionary[ "SSE2" ] << endl;
2947 cout << "IWMMXT support.............." << dictionary[ "IWMMXT" ] << endl;
2948 cout << "OpenGL support.............." << dictionary[ "OPENGL" ] << endl;
2949 cout << "OpenSSL support............." << dictionary[ "OPENSSL" ] << endl;
2950 cout << "QtDBus support.............." << dictionary[ "DBUS" ] << endl;
2951 cout << "QtXmlPatterns support......." << dictionary[ "XMLPATTERNS" ] << endl;
2952 cout << "Phonon support.............." << dictionary[ "PHONON" ] << endl;
2953 cout << "Multimedia support.........." << dictionary[ "MULTIMEDIA" ] << endl;
2954 cout << "WebKit support.............." << dictionary[ "WEBKIT" ] << endl;
2955 cout << "QtScript support............" << dictionary[ "SCRIPT" ] << endl;
2956 cout << "QtScriptTools support......." << dictionary[ "SCRIPTTOOLS" ] << endl;
2957 cout << "Graphics System............." << dictionary[ "GRAPHICS_SYSTEM" ] << endl;
2958 cout << "Qt3 compatibility..........." << dictionary[ "QT3SUPPORT" ] << endl << endl;
2960 cout << "Third Party Libraries:" << endl;
2961 cout << " ZLIB support............" << dictionary[ "ZLIB" ] << endl;
2962 cout << " GIF support............." << dictionary[ "GIF" ] << endl;
2963 cout << " TIFF support............" << dictionary[ "TIFF" ] << endl;
2964 cout << " JPEG support............" << dictionary[ "JPEG" ] << endl;
2965 cout << " PNG support............." << dictionary[ "PNG" ] << endl;
2966 cout << " MNG support............." << dictionary[ "MNG" ] << endl << endl;
2968 cout << "Styles:" << endl;
2969 cout << " Windows................." << dictionary[ "STYLE_WINDOWS" ] << endl;
2970 cout << " Windows XP.............." << dictionary[ "STYLE_WINDOWSXP" ] << endl;
2971 cout << " Windows Vista..........." << dictionary[ "STYLE_WINDOWSVISTA" ] << endl;
2972 cout << " Plastique..............." << dictionary[ "STYLE_PLASTIQUE" ] << endl;
2973 cout << " Cleanlooks.............." << dictionary[ "STYLE_CLEANLOOKS" ] << endl;
2974 cout << " Motif..................." << dictionary[ "STYLE_MOTIF" ] << endl;
2975 cout << " CDE....................." << dictionary[ "STYLE_CDE" ] << endl;
2976 cout << " Windows CE.............." << dictionary[ "STYLE_WINDOWSCE" ] << endl;
2977 cout << " Windows Mobile.........." << dictionary[ "STYLE_WINDOWSMOBILE" ] << endl << endl;
2979 cout << "Sql Drivers:" << endl;
2980 cout << " ODBC...................." << dictionary[ "SQL_ODBC" ] << endl;
2981 cout << " MySQL..................." << dictionary[ "SQL_MYSQL" ] << endl;
2982 cout << " OCI....................." << dictionary[ "SQL_OCI" ] << endl;
2983 cout << " PostgreSQL.............." << dictionary[ "SQL_PSQL" ] << endl;
2984 cout << " TDS....................." << dictionary[ "SQL_TDS" ] << endl;
2985 cout << " DB2....................." << dictionary[ "SQL_DB2" ] << endl;
2986 cout << " SQLite.................." << dictionary[ "SQL_SQLITE" ] << " (" << dictionary[ "SQL_SQLITE_LIB" ] << ")" << endl;
2987 cout << " SQLite2................." << dictionary[ "SQL_SQLITE2" ] << endl;
2988 cout << " InterBase..............." << dictionary[ "SQL_IBASE" ] << endl << endl;
2990 cout << "Sources are in.............." << dictionary[ "QT_SOURCE_TREE" ] << endl;
2991 cout << "Build is done in............" << dictionary[ "QT_BUILD_TREE" ] << endl;
2992 cout << "Install prefix.............." << dictionary[ "QT_INSTALL_PREFIX" ] << endl;
2993 cout << "Headers installed to........" << dictionary[ "QT_INSTALL_HEADERS" ] << endl;
2994 cout << "Libraries installed to......" << dictionary[ "QT_INSTALL_LIBS" ] << endl;
2995 cout << "Plugins installed to........" << dictionary[ "QT_INSTALL_PLUGINS" ] << endl;
2996 cout << "Binaries installed to......." << dictionary[ "QT_INSTALL_BINS" ] << endl;
2997 cout << "Docs installed to..........." << dictionary[ "QT_INSTALL_DOCS" ] << endl;
2998 cout << "Data installed to..........." << dictionary[ "QT_INSTALL_DATA" ] << endl;
2999 cout << "Translations installed to..." << dictionary[ "QT_INSTALL_TRANSLATIONS" ] << endl;
3000 cout << "Examples installed to......." << dictionary[ "QT_INSTALL_EXAMPLES" ] << endl;
3001 cout << "Demos installed to.........." << dictionary[ "QT_INSTALL_DEMOS" ] << endl << endl;
3003 if (dictionary.contains("XQMAKESPEC") && dictionary["XQMAKESPEC"].startsWith(QLatin1String("wince"))) {
3004 cout << "Using c runtime detection..." << dictionary[ "CE_CRT" ] << endl;
3005 cout << "Cetest support.............." << dictionary[ "CETEST" ] << endl;
3006 cout << "Signature..................." << dictionary[ "CE_SIGNATURE"] << endl << endl;
3009 if(dictionary["ASSISTANT_WEBKIT"] == "yes")
3010 cout << "Using WebKit as html rendering engine in Qt Assistant." << endl;
3012 if(checkAvailability("INCREDIBUILD_XGE"))
3013 cout << "Using IncrediBuild XGE......" << dictionary["INCREDIBUILD_XGE"] << endl;
3014 if( !qmakeDefines.isEmpty() ) {
3015 cout << "Defines.....................";
3016 for( QStringList::Iterator defs = qmakeDefines.begin(); defs != qmakeDefines.end(); ++defs )
3017 cout << (*defs) << " ";
3018 cout << endl;
3020 if( !qmakeIncludes.isEmpty() ) {
3021 cout << "Include paths...............";
3022 for( QStringList::Iterator incs = qmakeIncludes.begin(); incs != qmakeIncludes.end(); ++incs )
3023 cout << (*incs) << " ";
3024 cout << endl;
3026 if( !qmakeLibs.isEmpty() ) {
3027 cout << "Additional libraries........";
3028 for( QStringList::Iterator libs = qmakeLibs.begin(); libs != qmakeLibs.end(); ++libs )
3029 cout << (*libs) << " ";
3030 cout << endl;
3032 if( dictionary[ "QMAKE_INTERNAL" ] == "yes" ) {
3033 cout << "Using internal configuration." << endl;
3035 if( dictionary[ "SHARED" ] == "no" ) {
3036 cout << "WARNING: Using static linking will disable the use of plugins." << endl;
3037 cout << " Make sure you compile ALL needed modules into the library." << endl;
3039 if( dictionary[ "OPENSSL" ] == "linked" && opensslLibs.isEmpty() ) {
3040 cout << "NOTE: When linking against OpenSSL, you can override the default" << endl;
3041 cout << "library names through OPENSSL_LIBS." << endl;
3042 cout << "For example:" << endl;
3043 cout << " configure -openssl-linked OPENSSL_LIBS='-lssleay32 -llibeay32'" << endl;
3045 if( dictionary[ "ZLIB_FORCED" ] == "yes" ) {
3046 QString which_zlib = "supplied";
3047 if( dictionary[ "ZLIB" ] == "system")
3048 which_zlib = "system";
3050 cout << "NOTE: The -no-zlib option was supplied but is no longer supported." << endl
3051 << endl
3052 << "Qt now requires zlib support in all builds, so the -no-zlib" << endl
3053 << "option was ignored. Qt will be built using the " << which_zlib
3054 << "zlib" << endl;
3057 #endif
3059 #if !defined(EVAL)
3060 void Configure::generateHeaders()
3062 if (dictionary["SYNCQT"] == "yes"
3063 && findFile("perl.exe")) {
3064 cout << "Running syncqt..." << endl;
3065 QStringList args;
3066 args += buildPath + "/bin/syncqt.bat";
3067 QStringList env;
3068 env += QString("QTDIR=" + sourcePath);
3069 env += QString("PATH=" + buildPath + "/bin/;" + qgetenv("PATH"));
3070 Environment::execute(args, env, QStringList());
3074 void Configure::buildQmake()
3076 if( dictionary[ "BUILD_QMAKE" ] == "yes" ) {
3077 QStringList args;
3079 // Build qmake
3080 QString pwd = QDir::currentPath();
3081 QDir::setCurrent(buildPath + "/qmake" );
3083 QString makefile = "Makefile";
3085 QFile out(makefile);
3086 if(out.open(QFile::WriteOnly | QFile::Text)) {
3087 QTextStream stream(&out);
3088 stream << "#AutoGenerated by configure.exe" << endl
3089 << "BUILD_PATH = " << QDir::convertSeparators(buildPath) << endl
3090 << "SOURCE_PATH = " << QDir::convertSeparators(sourcePath) << endl;
3091 stream << "QMAKESPEC = " << dictionary["QMAKESPEC"] << endl;
3093 if (dictionary["EDITION"] == "OpenSource" ||
3094 dictionary["QT_EDITION"].contains("OPENSOURCE"))
3095 stream << "QMAKE_OPENSOURCE_EDITION = yes" << endl;
3096 stream << "\n\n";
3098 QFile in(sourcePath + "/qmake/" + dictionary["QMAKEMAKEFILE"]);
3099 if(in.open(QFile::ReadOnly | QFile::Text)) {
3100 QString d = in.readAll();
3101 //### need replaces (like configure.sh)? --Sam
3102 stream << d << endl;
3104 stream.flush();
3105 out.close();
3109 args += dictionary[ "MAKE" ];
3110 args += "-f";
3111 args += makefile;
3113 cout << "Creating qmake..." << endl;
3114 int exitCode = 0;
3115 if( exitCode = Environment::execute(args, QStringList(), QStringList()) ) {
3116 args.clear();
3117 args += dictionary[ "MAKE" ];
3118 args += "-f";
3119 args += makefile;
3120 args += "clean";
3121 if( exitCode = Environment::execute(args, QStringList(), QStringList())) {
3122 cout << "Cleaning qmake failed, return code " << exitCode << endl << endl;
3123 dictionary[ "DONE" ] = "error";
3124 } else {
3125 args.clear();
3126 args += dictionary[ "MAKE" ];
3127 args += "-f";
3128 args += makefile;
3129 if (exitCode = Environment::execute(args, QStringList(), QStringList())) {
3130 cout << "Building qmake failed, return code " << exitCode << endl << endl;
3131 dictionary[ "DONE" ] = "error";
3135 QDir::setCurrent( pwd );
3138 #endif
3140 void Configure::buildHostTools()
3142 if (dictionary[ "NOPROCESS" ] == "yes")
3143 dictionary[ "DONE" ] = "yes";
3145 if (!dictionary.contains("XQMAKESPEC"))
3146 return;
3148 QString pwd = QDir::currentPath();
3149 QStringList hostToolsDirs;
3150 hostToolsDirs
3151 << "src/tools/bootstrap"
3152 << "src/tools/moc"
3153 << "src/tools/rcc"
3154 << "src/tools/uic"
3155 << "tools/checksdk";
3157 if (dictionary[ "CETEST" ] == "yes")
3158 hostToolsDirs << "tools/qtestlib/wince/cetest";
3160 for (int i = 0; i < hostToolsDirs.count(); ++i) {
3161 cout << "Creating " << hostToolsDirs.at(i) << " ..." << endl;
3162 QString toolBuildPath = buildPath + "/" + hostToolsDirs.at(i);
3163 QString toolSourcePath = sourcePath + "/" + hostToolsDirs.at(i);
3165 // generate Makefile
3166 QStringList args;
3167 args << QDir::toNativeSeparators(buildPath + "/bin/qmake");
3168 args << "-spec" << dictionary["QMAKESPEC"] << "-r";
3169 args << "-o" << QDir::toNativeSeparators(toolBuildPath + "/Makefile");
3171 QDir().mkpath(toolBuildPath);
3172 QDir::setCurrent(toolSourcePath);
3173 int exitCode = 0;
3174 if (exitCode = Environment::execute(args, QStringList(), QStringList())) {
3175 cout << "qmake failed, return code " << exitCode << endl << endl;
3176 dictionary["DONE"] = "error";
3177 break;
3180 // build app
3181 args.clear();
3182 args += dictionary["MAKE"];
3183 QDir::setCurrent(toolBuildPath);
3184 if (exitCode = Environment::execute(args, QStringList(), QStringList())) {
3185 args.clear();
3186 args += dictionary["MAKE"];
3187 args += "clean";
3188 if(exitCode = Environment::execute(args, QStringList(), QStringList())) {
3189 cout << "Cleaning " << hostToolsDirs.at(i) << " failed, return code " << exitCode << endl << endl;
3190 dictionary["DONE"] = "error";
3191 break;
3192 } else {
3193 args.clear();
3194 args += dictionary["MAKE"];
3195 if (exitCode = Environment::execute(args, QStringList(), QStringList())) {
3196 cout << "Building " << hostToolsDirs.at(i) << " failed, return code " << exitCode << endl << endl;
3197 dictionary["DONE"] = "error";
3198 break;
3203 QDir::setCurrent(pwd);
3206 void Configure::findProjects( const QString& dirName )
3208 if( dictionary[ "NOPROCESS" ] == "no" ) {
3209 QDir dir( dirName );
3210 QString entryName;
3211 int makeListNumber;
3212 ProjectType qmakeTemplate;
3213 const QFileInfoList &list = dir.entryInfoList(QStringList(QLatin1String("*.pro")),
3214 QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
3215 for(int i = 0; i < list.size(); ++i) {
3216 const QFileInfo &fi = list.at(i);
3217 if(fi.fileName() != "qmake.pro") {
3218 entryName = dirName + "/" + fi.fileName();
3219 if(fi.isDir()) {
3220 findProjects( entryName );
3221 } else {
3222 qmakeTemplate = projectType( fi.absoluteFilePath() );
3223 switch ( qmakeTemplate ) {
3224 case Lib:
3225 case Subdirs:
3226 makeListNumber = 1;
3227 break;
3228 default:
3229 makeListNumber = 2;
3230 break;
3232 makeList[makeListNumber].append(new MakeItem(sourceDir.relativeFilePath(fi.absolutePath()),
3233 fi.fileName(),
3234 "Makefile",
3235 qmakeTemplate));
3243 void Configure::appendMakeItem(int inList, const QString &item)
3245 QString dir;
3246 if (item != "src")
3247 dir = "/" + item;
3248 dir.prepend("/src");
3249 makeList[inList].append(new MakeItem(sourcePath + dir,
3250 item + ".pro", buildPath + dir + "/Makefile", Lib ) );
3251 if( dictionary[ "DSPFILES" ] == "yes" ) {
3252 makeList[inList].append( new MakeItem(sourcePath + dir,
3253 item + ".pro", buildPath + dir + "/" + item + ".dsp", Lib ) );
3255 if( dictionary[ "VCPFILES" ] == "yes" ) {
3256 makeList[inList].append( new MakeItem(sourcePath + dir,
3257 item + ".pro", buildPath + dir + "/" + item + ".vcp", Lib ) );
3259 if( dictionary[ "VCPROJFILES" ] == "yes" ) {
3260 makeList[inList].append( new MakeItem(sourcePath + dir,
3261 item + ".pro", buildPath + dir + "/" + item + ".vcproj", Lib ) );
3265 void Configure::generateMakefiles()
3267 if( dictionary[ "NOPROCESS" ] == "no" ) {
3268 #if !defined(EVAL)
3269 cout << "Creating makefiles in src..." << endl;
3270 #endif
3272 QString spec = dictionary.contains("XQMAKESPEC") ? dictionary[ "XQMAKESPEC" ] : dictionary[ "QMAKESPEC" ];
3273 if( spec != "win32-msvc" )
3274 dictionary[ "DSPFILES" ] = "no";
3276 if( spec != "win32-msvc.net" && !spec.startsWith("win32-msvc2") && !spec.startsWith(QLatin1String("wince")))
3277 dictionary[ "VCPROJFILES" ] = "no";
3279 int i = 0;
3280 QString pwd = QDir::currentPath();
3281 if (dictionary["FAST"] != "yes") {
3282 QString dirName;
3283 bool generate = true;
3284 bool doDsp = (dictionary["DSPFILES"] == "yes" || dictionary["VCPFILES"] == "yes"
3285 || dictionary["VCPROJFILES"] == "yes");
3286 while (generate) {
3287 QString pwd = QDir::currentPath();
3288 QString dirPath = fixSeparators(buildPath + dirName);
3289 QStringList args;
3291 args << fixSeparators( buildPath + "/bin/qmake" );
3293 if (doDsp) {
3294 if( dictionary[ "DEPENDENCIES" ] == "no" )
3295 args << "-nodepend";
3296 args << "-tp" << "vc";
3297 doDsp = false; // DSP files will be done
3298 printf("Generating Visual Studio project files...\n");
3299 } else {
3300 printf("Generating Makefiles...\n");
3301 generate = false; // Now Makefiles will be done
3303 args << "-spec";
3304 args << spec;
3305 args << "-r";
3306 args << (sourcePath + "/projects.pro");
3307 args << "-o";
3308 args << buildPath;
3309 if(!dictionary[ "QMAKEADDITIONALARGS" ].isEmpty())
3310 args << dictionary[ "QMAKEADDITIONALARGS" ];
3312 QDir::setCurrent( fixSeparators( dirPath ) );
3313 if( int exitCode = Environment::execute(args, QStringList(), QStringList()) ) {
3314 cout << "Qmake failed, return code " << exitCode << endl << endl;
3315 dictionary[ "DONE" ] = "error";
3318 } else {
3319 findProjects(sourcePath);
3320 for ( i=0; i<3; i++ ) {
3321 for ( int j=0; j<makeList[i].size(); ++j) {
3322 MakeItem *it=makeList[i][j];
3323 QString dirPath = fixSeparators( it->directory + "/" );
3324 QString projectName = it->proFile;
3325 QString makefileName = buildPath + "/" + dirPath + it->target;
3327 // For shadowbuilds, we need to create the path first
3328 QDir buildPathDir(buildPath);
3329 if (sourcePath != buildPath && !buildPathDir.exists(dirPath))
3330 buildPathDir.mkpath(dirPath);
3332 QStringList args;
3334 args << fixSeparators( buildPath + "/bin/qmake" );
3335 args << sourcePath + "/" + dirPath + projectName;
3336 args << dictionary[ "QMAKE_ALL_ARGS" ];
3338 cout << "For " << qPrintable(dirPath + projectName) << endl;
3339 args << "-o";
3340 args << it->target;
3341 args << "-spec";
3342 args << spec;
3343 if(!dictionary[ "QMAKEADDITIONALARGS" ].isEmpty())
3344 args << dictionary[ "QMAKEADDITIONALARGS" ];
3346 QDir::setCurrent( fixSeparators( dirPath ) );
3348 QFile file(makefileName);
3349 if (!file.open(QFile::WriteOnly)) {
3350 printf("failed on dirPath=%s, makefile=%s\n",
3351 qPrintable(dirPath), qPrintable(makefileName));
3352 continue;
3354 QTextStream txt(&file);
3355 txt << "all:\n";
3356 txt << "\t" << args.join(" ") << "\n";
3357 txt << "\t" << dictionary[ "MAKE" ] << " -f " << it->target << "\n";
3358 txt << "first: all\n";
3359 txt << "qmake:\n";
3360 txt << "\t" << args.join(" ") << "\n";
3364 QDir::setCurrent( pwd );
3365 } else {
3366 cout << "Processing of project files have been disabled." << endl;
3367 cout << "Only use this option if you really know what you're doing." << endl << endl;
3368 return;
3372 void Configure::showSummary()
3374 QString make = dictionary[ "MAKE" ];
3375 if (!dictionary.contains("XQMAKESPEC")) {
3376 cout << endl << endl << "Qt is now configured for building. Just run " << qPrintable(make) << "." << endl;
3377 cout << "To reconfigure, run " << qPrintable(make) << " confclean and configure." << endl << endl;
3378 } else {
3379 // we are cross compiling for Windows CE
3380 cout << endl << endl << "Qt is now configured for building. To start the build run:" << endl
3381 << "\tsetcepaths " << dictionary.value("XQMAKESPEC") << endl
3382 << "\t" << qPrintable(make) << endl
3383 << "To reconfigure, run " << qPrintable(make) << " confclean and configure." << endl << endl;
3387 Configure::ProjectType Configure::projectType( const QString& proFileName )
3389 QFile proFile( proFileName );
3390 if( proFile.open( QFile::ReadOnly ) ) {
3391 QString buffer = proFile.readLine(1024);
3392 while (!buffer.isEmpty()) {
3393 QStringList segments = buffer.split(QRegExp( "\\s" ));
3394 QStringList::Iterator it = segments.begin();
3396 if(segments.size() >= 3) {
3397 QString keyword = (*it++);
3398 QString operation = (*it++);
3399 QString value = (*it++);
3401 if( keyword == "TEMPLATE" ) {
3402 if( value == "lib" )
3403 return Lib;
3404 else if( value == "subdirs" )
3405 return Subdirs;
3408 // read next line
3409 buffer = proFile.readLine(1024);
3411 proFile.close();
3413 // Default to app handling
3414 return App;
3417 #if !defined(EVAL)
3419 bool Configure::showLicense(QString orgLicenseFile)
3421 if (dictionary["LICENSE_CONFIRMED"] == "yes") {
3422 cout << "You have already accepted the terms of the license." << endl << endl;
3423 return true;
3426 QString licenseFile = orgLicenseFile;
3427 QString theLicense;
3428 if (dictionary["EDITION"] == "OpenSource" || dictionary["EDITION"] == "Snapshot") {
3429 theLicense = "GNU General Public License (GPL) version 3 \nor the GNU Lesser General Public License (LGPL) version 2.1";
3430 } else {
3431 // the first line of the license file tells us which license it is
3432 QFile file(licenseFile);
3433 if (!file.open(QFile::ReadOnly)) {
3434 cout << "Failed to load LICENSE file" << endl;
3435 return false;
3437 theLicense = file.readLine().trimmed();
3440 forever {
3441 char accept = '?';
3442 cout << "You are licensed to use this software under the terms of" << endl
3443 << "the " << theLicense << "." << endl
3444 << endl;
3445 if (dictionary["EDITION"] == "OpenSource" || dictionary["EDITION"] == "Snapshot") {
3446 cout << "Type '3' to view the GNU General Public License version 3 (GPLv3)." << endl;
3447 cout << "Type 'L' to view the Lesser GNU General Public License version 2.1 (LGPLv2.1)." << endl;
3448 } else {
3449 cout << "Type '?' to view the " << theLicense << "." << endl;
3451 cout << "Type 'y' to accept this license offer." << endl
3452 << "Type 'n' to decline this license offer." << endl
3453 << endl
3454 << "Do you accept the terms of the license?" << endl;
3455 cin >> accept;
3456 accept = tolower(accept);
3458 if (accept == 'y') {
3459 return true;
3460 } else if (accept == 'n') {
3461 return false;
3462 } else {
3463 if (dictionary["EDITION"] == "OpenSource" || dictionary["EDITION"] == "Snapshot") {
3464 if (accept == '3')
3465 licenseFile = orgLicenseFile + "/LICENSE.GPL3";
3466 else
3467 licenseFile = orgLicenseFile + "/LICENSE.LGPL";
3469 // Get console line height, to fill the screen properly
3470 int i = 0, screenHeight = 25; // default
3471 CONSOLE_SCREEN_BUFFER_INFO consoleInfo;
3472 HANDLE stdOut = GetStdHandle(STD_OUTPUT_HANDLE);
3473 if (GetConsoleScreenBufferInfo(stdOut, &consoleInfo))
3474 screenHeight = consoleInfo.srWindow.Bottom
3475 - consoleInfo.srWindow.Top
3476 - 1; // Some overlap for context
3478 // Prompt the license content to the user
3479 QFile file(licenseFile);
3480 if (!file.open(QFile::ReadOnly)) {
3481 cout << "Failed to load LICENSE file" << licenseFile << endl;
3482 return false;
3484 QStringList licenseContent = QString(file.readAll()).split('\n');
3485 while(i < licenseContent.size()) {
3486 cout << licenseContent.at(i) << endl;
3487 if (++i % screenHeight == 0) {
3488 cout << "(Press any key for more..)";
3489 if(_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout)
3490 exit(0); // Exit cleanly for Ctrl+C
3491 cout << "\r"; // Overwrite text above
3498 void Configure::readLicense()
3500 dictionary[ "PLATFORM NAME" ] = (QFile::exists(dictionary["QT_SOURCE_TREE"] + "/src/corelib/kernel/qfunctions_wince.h")
3501 && (dictionary.value("QMAKESPEC").startsWith("wince") || dictionary.value("XQMAKESPEC").startsWith("wince")))
3502 ? "Qt for Windows CE" : "Qt for Windows";
3503 dictionary["LICENSE FILE"] = sourcePath;
3505 bool openSource = false;
3506 bool hasOpenSource = QFile::exists(dictionary["LICENSE FILE"] + "/LICENSE.GPL3") || QFile::exists(dictionary["LICENSE FILE"] + "/LICENSE.LGPL");
3507 if (dictionary["BUILDNOKIA"] == "yes" || dictionary["BUILDTYPE"] == "commercial") {
3508 openSource = false;
3509 } else if (dictionary["BUILDTYPE"] == "opensource") {
3510 openSource = true;
3511 } else if (hasOpenSource) { // No Open Source? Just display the commercial license right away
3512 forever {
3513 char accept = '?';
3514 cout << "Which edition of Qt do you want to use ?" << endl;
3515 cout << "Type 'c' if you want to use the Commercial Edition." << endl;
3516 cout << "Type 'o' if you want to use the Open Source Edition." << endl;
3517 cin >> accept;
3518 accept = tolower(accept);
3520 if (accept == 'c') {
3521 openSource = false;
3522 break;
3523 } else if (accept == 'o') {
3524 openSource = true;
3525 break;
3529 if (hasOpenSource && openSource) {
3530 cout << endl << "This is the " << dictionary["PLATFORM NAME"] << " Open Source Edition." << endl;
3531 licenseInfo["LICENSEE"] = "Open Source";
3532 dictionary["EDITION"] = "OpenSource";
3533 dictionary["QT_EDITION"] = "QT_EDITION_OPENSOURCE";
3534 cout << endl;
3535 if (!showLicense(dictionary["LICENSE FILE"])) {
3536 cout << "Configuration aborted since license was not accepted";
3537 dictionary["DONE"] = "error";
3538 return;
3540 } else if (openSource) {
3541 cout << endl << "Cannot find the GPL license files! Please download the Open Source version of the library." << endl;
3542 dictionary["DONE"] = "error";
3544 #ifdef COMMERCIAL_VERSION
3545 else {
3546 Tools::checkLicense(dictionary, licenseInfo, firstLicensePath());
3547 if (dictionary["DONE"] != "error" && dictionary["BUILDNOKIA"] != "yes") {
3548 // give the user some feedback, and prompt for license acceptance
3549 cout << endl << "This is the " << dictionary["PLATFORM NAME"] << " " << dictionary["EDITION"] << " Edition."<< endl << endl;
3550 if (!showLicense(dictionary["LICENSE FILE"])) {
3551 cout << "Configuration aborted since license was not accepted";
3552 dictionary["DONE"] = "error";
3553 return;
3557 #else // !COMMERCIAL_VERSION
3558 else {
3559 cout << endl << "Cannot build commercial edition from the open source version of the library." << endl;
3560 dictionary["DONE"] = "error";
3562 #endif
3565 void Configure::reloadCmdLine()
3567 if( dictionary[ "REDO" ] == "yes" ) {
3568 QFile inFile( buildPath + "/configure" + dictionary[ "CUSTOMCONFIG" ] + ".cache" );
3569 if( inFile.open( QFile::ReadOnly ) ) {
3570 QTextStream inStream( &inFile );
3571 QString buffer;
3572 inStream >> buffer;
3573 while( buffer.length() ) {
3574 configCmdLine += buffer;
3575 inStream >> buffer;
3577 inFile.close();
3582 void Configure::saveCmdLine()
3584 if( dictionary[ "REDO" ] != "yes" ) {
3585 QFile outFile( buildPath + "/configure" + dictionary[ "CUSTOMCONFIG" ] + ".cache" );
3586 if( outFile.open( QFile::WriteOnly | QFile::Text ) ) {
3587 QTextStream outStream( &outFile );
3588 for( QStringList::Iterator it = configCmdLine.begin(); it != configCmdLine.end(); ++it ) {
3589 outStream << (*it) << " " << endl;
3591 outStream.flush();
3592 outFile.close();
3596 #endif // !EVAL
3598 bool Configure::isDone()
3600 return !dictionary["DONE"].isEmpty();
3603 bool Configure::isOk()
3605 return (dictionary[ "DONE" ] != "error");
3608 bool
3609 Configure::filesDiffer(const QString &fn1, const QString &fn2)
3611 QFile file1(fn1), file2(fn2);
3612 if(!file1.open(QFile::ReadOnly) || !file2.open(QFile::ReadOnly))
3613 return true;
3614 const int chunk = 2048;
3615 int used1 = 0, used2 = 0;
3616 char b1[chunk], b2[chunk];
3617 while(!file1.atEnd() && !file2.atEnd()) {
3618 if(!used1)
3619 used1 = file1.read(b1, chunk);
3620 if(!used2)
3621 used2 = file2.read(b2, chunk);
3622 if(used1 > 0 && used2 > 0) {
3623 const int cmp = qMin(used1, used2);
3624 if(memcmp(b1, b2, cmp))
3625 return true;
3626 if((used1 -= cmp))
3627 memcpy(b1, b1+cmp, used1);
3628 if((used2 -= cmp))
3629 memcpy(b2, b2+cmp, used2);
3632 return !file1.atEnd() || !file2.atEnd();
3635 QT_END_NAMESPACE