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