From 3ccf773d344625ae306c55855cedd5d718212718 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Tue, 14 Jul 2009 10:29:53 +0200 Subject: update to the configure program to support mingw+phonon --- tools/configure/configureapp.cpp | 60 +++++++++++++++++++++++++--------------- tools/configure/configureapp.h | 4 +-- 2 files changed, 39 insertions(+), 25 deletions(-) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 80cfc64..ccb2665 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1656,39 +1656,50 @@ bool Configure::displayHelp() return false; } -bool Configure::findFileInPaths(const QString &fileName, const QStringList &paths) +QString Configure::findFileInPaths(const QString &fileName, const QString &paths) { +#if defined(Q_OS_WIN32) + QRegExp splitReg("[;,]"); +#else + QRegExp splitReg("[:]"); +#endif + QStringList pathList = paths.split(splitReg, QString::SkipEmptyParts); QDir d; - for( QStringList::ConstIterator it = paths.begin(); it != paths.end(); ++it ) { + for( QStringList::ConstIterator it = pathList.begin(); it != pathList.end(); ++it ) { // Remove any leading or trailing ", this is commonly used in the environment // variables QString path = (*it); - if ( path.startsWith( "\"" ) ) + if ( path.startsWith( '\"' ) ) path = path.right( path.length() - 1 ); - if ( path.endsWith( "\"" ) ) + if ( path.endsWith( '\"' ) ) path = path.left( path.length() - 1 ); if( d.exists( path + QDir::separator() + fileName ) ) - return true; + return path; } - return false; + return QString(); } bool Configure::findFile( const QString &fileName ) { - QString file = fileName.toLower(); - QStringList paths; -#if defined(Q_OS_WIN32) - QRegExp splitReg("[;,]"); -#else - QRegExp splitReg("[:]"); -#endif - if (file.endsWith(".h")) - paths = QString::fromLocal8Bit(getenv("INCLUDE")).split(splitReg, QString::SkipEmptyParts); - else if ( file.endsWith( ".lib" ) ) - paths = QString::fromLocal8Bit(getenv("LIB")).split(splitReg, QString::SkipEmptyParts); - else - paths = QString::fromLocal8Bit(getenv("PATH")).split(splitReg, QString::SkipEmptyParts); - return findFileInPaths(file, paths); + const QString file = fileName.toLower(); + const QString pathEnvVar = QString::fromLocal8Bit(getenv("PATH")); + const QString mingwPath = dictionary["QMAKESPEC"].endsWith("-g++") ? + findFileInPaths("mingw32-g++.exe", pathEnvVar) : QString(); + + QString paths; + if (file.endsWith(".h")) { + if (!mingwPath.isNull()) + paths = mingwPath + QLatin1String("/../include"); + else + paths = QString::fromLocal8Bit(getenv("INCLUDE")); + } else if ( file.endsWith( ".lib" ) ) { + paths = QString::fromLocal8Bit(getenv("LIB")); + } else if (file.endsWith( ".a" ) && !mingwPath.isNull() ) { + paths = mingwPath + QLatin1String("/../lib"); + } else { + paths = pathEnvVar; + } + return !findFileInPaths(file, paths).isNull(); } /*! @@ -1758,7 +1769,7 @@ bool Configure::checkAvailability(const QString &part) { bool available = false; if (part == "STYLE_WINDOWSXP") - available = (dictionary.value("QMAKESPEC") == "win32-g++" || findFile("uxtheme.h")); + available = (findFile("uxtheme.h")); else if (part == "ZLIB") available = findFile("zlib.h"); @@ -1840,8 +1851,11 @@ bool Configure::checkAvailability(const QString &part) && dictionary.value("QMAKESPEC") != "win32-msvc2002" && dictionary.value("EXCEPTIONS") == "yes"; } else if (part == "PHONON") { - available = findFile("vmr9.h") && findFile("dshow.h") && findFile("strmiids.lib") && - findFile("dmoguids.lib") && findFile("msdmo.lib") && findFile("d3d9.h"); + available = findFile("vmr9.h") && findFile("dshow.h") && findFile("dmo.h") && findFile("dmodshow.h") + && (findFile("strmiids.lib") || findFile("libstrmiids.a")) + && (findFile("dmoguids.lib") || findFile("libdmoguids.a")) + && (findFile("msdmo.lib") || findFile("libmsdmo.a")) + && findFile("d3d9.h"); if (!available) { cout << "All the required DirectShow/Direct3D files couldn't be found." << endl diff --git a/tools/configure/configureapp.h b/tools/configure/configureapp.h index dc22ac9..03df28e 100644 --- a/tools/configure/configureapp.h +++ b/tools/configure/configureapp.h @@ -150,8 +150,8 @@ private: QString fixSeparators(QString somePath); bool filesDiffer(const QString &file1, const QString &file2); - static bool findFile(const QString &fileName); - static bool findFileInPaths(const QString &fileName, const QStringList &paths); + bool findFile(const QString &fileName); + static QString findFileInPaths(const QString &fileName, const QString &paths); #if !defined(EVAL) void reloadCmdLine(); void saveCmdLine(); -- cgit v0.12