Hello community,

here is the log from the commit of package qconf for openSUSE:Factory checked 
in at 2015-09-30 05:53:27
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/qconf (Old)
 and      /work/SRC/openSUSE:Factory/.qconf.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "qconf"

Changes:
--------
--- /work/SRC/openSUSE:Factory/qconf/qconf.changes      2015-04-10 
09:51:47.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.qconf.new/qconf.changes 2015-09-30 
05:53:28.000000000 +0200
@@ -1,0 +2,8 @@
+Tue Sep 29 12:55:39 UTC 2015 - jsl...@suse.com
+
+- update to 20150608
+  * fix paths by escaping
+  * support multiple qt versions
+  * add extraconf flag
+
+-------------------------------------------------------------------

Old:
----
  qconf-20150319.c8e969fef8ce.tar.xz

New:
----
  qconf-20150608.4a9c329ba879.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ qconf.spec ++++++
--- /var/tmp/diff_new_pack.pMT2K4/_old  2015-09-30 05:53:29.000000000 +0200
+++ /var/tmp/diff_new_pack.pMT2K4/_new  2015-09-30 05:53:29.000000000 +0200
@@ -22,7 +22,7 @@
 
 Name:           qconf
 Url:            http://delta.affinix.com/qconf/
-Version:        20150319.c8e969fef8ce
+Version:        20150608.4a9c329ba879
 Release:        0
 Summary:        Configuration tool for qmake
 License:        GPL-2.0

++++++ qconf-20150319.c8e969fef8ce.tar.xz -> qconf-20150608.4a9c329ba879.tar.xz 
++++++
++++ 1611 lines of diff (skipped)
++++    retrying with extended exclude list
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/qconf-20150319.c8e969fef8ce/conf/conf4.cpp 
new/qconf-20150608.4a9c329ba879/conf/conf4.cpp
--- old/qconf-20150319.c8e969fef8ce/conf/conf4.cpp      2015-03-19 
10:05:24.000000000 +0100
+++ new/qconf-20150608.4a9c329ba879/conf/conf4.cpp      2015-09-29 
14:54:51.000000000 +0200
@@ -76,7 +76,7 @@
 QString qc_findself(const QString &argv0)
 {
 #ifdef Q_OS_WIN
-       if(argv0.contains('\\\\'))
+       if(argv0.contains('\\'))
 #else
        if(argv0.contains('/'))
 #endif
@@ -175,12 +175,77 @@
        return true;
 }
 
+// simple command line arguemnts splitter able to understand quoted args.
+// the splitter removes quotes and unescapes symbols as well.
+QStringList qc_splitflags(const QString &flags)
+{
+       QStringList ret;
+       bool searchStart = true;
+       bool inQuotes = false;
+       bool escaped = false;
+       QChar quote, backslash = QLatin1Char('\\');
+       QString buf;
+       buf.reserve(PATH_MAX);
+       for (int i=0; i < flags.length(); i++) {
+               if (searchStart && flags[i].isSpace()) {
+                       continue;
+               }
+               if (searchStart) {
+                       searchStart = false;
+                       buf.clear();
+               }
+               if (escaped) {
+                       buf += flags[i];
+                       escaped = false;
+                       continue;
+               }
+               //buf += flags[i];
+               if (inQuotes) {
+                       if (quote == QLatin1Char('\'')) {
+                               if (flags[i] == quote) {
+                                       inQuotes = false;
+                                       continue;
+                               }
+                       } else { // we are in double quoetes
+                               if (flags[i] == backslash && i < flags.length() 
- 1 &&
+                                               (flags[i+1] == QLatin1Char('"') 
|| flags[i+1] == backslash))
+                               {
+                                       // if next symbol is one of in 
parentheses ("\)
+                                       escaped = true;
+                                       continue;
+                               }
+                       }
+               } else {
+                       if (flags[i].isSpace()) {
+                               ret.append(buf);
+                               searchStart = true;
+                               buf.clear();
+                               continue;
+#ifndef Q_OS_WIN /* on windows backslash is just a path separator */
+                       } else if (flags[i] == backslash) {
+                               escaped = true;
+                               continue; // just add next symbol
+#endif
+                       } else if (flags[i] == QLatin1Char('\'') || flags[i] == 
QLatin1Char('"')) {
+                               inQuotes = true;
+                               quote = flags[i];
+                               continue;
+                       }
+               }
+               buf += flags[i];
+       }
+       if (buf.size()) {
+               ret.append(buf);
+       }
+       return ret;
+}
+
 void qc_splitcflags(const QString &cflags, QStringList *incs, QStringList 
*otherflags)
 {
        incs->clear();
        otherflags->clear();
 
-       QStringList cflagsList = cflags.split(" ");
+       QStringList cflagsList = qc_splitflags(cflags);
        for(int n = 0; n < cflagsList.count(); ++n)
        {
                QString str = cflagsList[n];
@@ -209,6 +274,90 @@
        return out;
 }
 
+
+QString qc_trim_char(const QString &s, const QChar &ch)
+{
+       if (s.startsWith(ch) && s.endsWith(ch)) {
+               return s.mid(1, s.size() - 2);
+       }
+       return s;
+}
+
+// removes surrounding quotes, removes trailing slashes, converts to native 
separators.
+// accepts unescaped but possible quoted path
+QString qc_normalize_path(const QString &str)
+{
+       QString path = str.trimmed();
+       path = qc_trim_char(path, QLatin1Char('"'));
+       path = qc_trim_char(path, QLatin1Char('\''));
+#ifdef Q_OS_WIN
+       QLatin1Char nativeSep('\\');
+       path.replace(QLatin1Char('/'), QLatin1Char('\\'));
+#else
+       QLatin1Char nativeSep('/');
+#endif
+       // trim trailing slashes
+       while (path.length() && path[path.length() - 1] == nativeSep) {
+               path.resize(path.length() - 1);
+       }
+       return path;
+}
+
+// escape filesystem path to be added to qmake pro/pri file.
+QString qc_escape_string_var(const QString &str)
+{
+       QString path = str;
+       path.replace(QLatin1Char('\\'), QLatin1String("\\\\"))
+                       .replace(QLatin1Char('"'), QLatin1String("\\\""));
+       if (path.indexOf(QLatin1Char(' ')) != -1) { // has spaces
+               return QLatin1Char('"') + path + QLatin1Char('"');
+       }
+       return path;
+}
+
+// escapes each path in incs and join into single string suiable for 
INCLUDEPATH var
+QString qc_prepare_includepath(const QStringList &incs)
+{
+       if (incs.empty()) {
+               return QString();
+       }
+       QStringList ret;
+       foreach (const QString &path, incs) {
+               ret.append(qc_escape_string_var(path));
+       }
+       return ret.join(QLatin1String(" "));
+}
+
+// escapes each path in libs and to make it suiable for LIBS var
+// notice, entries of libs are every single arg for linker.
+QString qc_prepare_libs(const QStringList &libs)
+{
+       if (libs.isEmpty()) {
+               return QString();
+       }
+       QSet<QString> pathSet;
+       QStringList paths;
+       QStringList ordered;
+       foreach (const QString &arg, libs) {
+               if (arg.startsWith(QLatin1String("-L"))) {
+                       QString path = qc_escape_string_var(arg.mid(2));
+                       if (!pathSet.contains(path)) {
+                               pathSet.insert(path);
+                               paths.append(path);
+                       }
+               } else if (arg.startsWith(QLatin1String("-l"))) {
+                       ordered.append(arg);
+               } else {
+                       ordered.append(qc_escape_string_var(arg));
+               }
+       }
+       QString ret;
+       if (paths.size()) {
+               ret += (QLatin1String(" -L") + paths.join(QLatin1String(" -L")) 
+ QLatin1Char(' '));
+       }
+       return ret + ordered.join(QLatin1String(" "));
+}
+
 //----------------------------------------------------------------------------
 // ConfObj
 //----------------------------------------------------------------------------
@@ -375,14 +524,34 @@
        return vars.value(s);
 }
 
+QString Conf::normalizePath(const QString &s) const
+{
+       return qc_normalize_path(s);
+}
+
+QString Conf::escapeQmakeVar(const QString &s) const
+{
+       return qc_escape_string_var(s);
+}
+
+QString Conf::escapedIncludes() const
+{
+       return qc_prepare_includepath(INCLUDEPATH);
+}
+
+QString Conf::escapedLibs() const
+{
+       return qc_prepare_libs(LIBS);
+}
+
 QString Conf::expandIncludes(const QString &inc)
 {
-       return QString("-I") + inc;
+       return QLatin1String("-I") + inc;
 }
 
 QString Conf::expandLibs(const QString &lib)
 {
-       return QString("-L") + lib;
+       return QLatin1String("-L") + lib;
 }
 
 int Conf::doCommand(const QString &s, QByteArray *out)
@@ -396,7 +565,7 @@
 int Conf::doCommand(const QString &prog, const QStringList &args, QByteArray 
*out)
 {
        QString fullcmd = prog;
-       QString argstr = args.join(" ");
+       QString argstr = args.join(QLatin1String(" "));
        if(!argstr.isEmpty())
                fullcmd += QString(" ") + argstr;
        debug(QString("[%1]").arg(fullcmd));
@@ -412,10 +581,14 @@
 #else
        QDir tmp(".qconftemp");
 #endif
+       QStringList normalizedLibs;
+       foreach (const QString &l, qc_splitflags(libs)) {
+               normalizedLibs.append(qc_normalize_path(l));
+       }
 
        if(!tmp.mkdir("atest"))
        {
-               debug("unable to create atest dir");
+               debug(QString("unable to create atest dir: 
%1").arg(tmp.absoluteFilePath("atest")));
                return false;
        }
        QDir dir(tmp.filePath("atest"));
@@ -447,11 +620,12 @@
                "CONFIG  -= qt app_bundle\n"
                "DESTDIR  = $$PWD\n"
                "SOURCES += atest.cpp\n");
-       QString inc = incs.join(" ");
+       QString inc = qc_prepare_includepath(incs);
        if(!inc.isEmpty())
                pro += "INCLUDEPATH += " + inc + '\n';
-       if(!libs.isEmpty())
-               pro += "LIBS += " + libs + '\n';
+       QString escaped_libs = qc_prepare_libs(normalizedLibs);
+       if(!escaped_libs.isEmpty())
+               pro += "LIBS += " + escaped_libs + '\n';
        pro += proextra;
 
        fname = dir.filePath("atest.pro");
@@ -512,10 +686,7 @@
 
 bool Conf::checkHeader(const QString &path, const QString &h)
 {
-       QFileInfo fi(path + '/' + h);
-       if(fi.exists())
-               return true;
-       return false;
+       return QDir(path).exists(h);
 }
 
 bool Conf::findHeader(const QString &h, const QStringList &ext, QString *inc)
@@ -652,7 +823,7 @@
        *version = version_out;
        *incs = incs_out;
        *libs = libs_out;
-       *otherflags = otherflags_out.join(" ");
+       *otherflags = otherflags_out.join(QLatin1String(" "));
        return true;
 }
 
@@ -716,7 +887,7 @@
        *version = version_out;
        *incs = incs_out;
        *libs = libs_out;
-       *otherflags = otherflags_out.join(" ");
+       *otherflags = otherflags_out.join(QLatin1String(" "));
        return true;
 }
 
@@ -731,19 +902,20 @@
 
 void Conf::addLib(const QString &str)
 {
-       if(LIBS.isEmpty())
-               LIBS = str;
-       else
-               LIBS += QString(" ") + str;
+       QStringList libs = qc_splitflags(str);
+       foreach (const QString &lib, libs) {
+               if (lib.startsWith("-l")) {
+                       LIBS.append(lib);
+               } else {
+                       LIBS.append(qc_normalize_path(lib)); // we don't care 
about -L prefix since normalier does not touch it.
+               }
+       }
        debug(QString("LIBS += %1").arg(str));
 }
 
 void Conf::addIncludePath(const QString &str)
 {
-       if(INCLUDEPATH.isEmpty())
-               INCLUDEPATH = str;
-       else
-               INCLUDEPATH += QString(" ") + str;
+       INCLUDEPATH.append(qc_normalize_path(str));
        debug(QString("INCLUDEPATH += %1").arg(str));
 }
 
@@ -762,8 +934,9 @@
 # include"modules.cpp"
 #endif
 
-int main()
+int main(int argc, char ** argv)
 {
+       QCoreApplication app(argc, argv);
        Conf *conf = new Conf;
        ConfObj *o = 0;
        Q_UNUSED(o);
@@ -849,13 +1022,17 @@
                if(!conf->DEFINES.isEmpty())
                        str += "DEFINES += " + conf->DEFINES + '\n';
                if(!conf->INCLUDEPATH.isEmpty())
-                       str += "INCLUDEPATH += " + conf->INCLUDEPATH + '\n';
+                       str += "INCLUDEPATH += " + 
qc_prepare_includepath(conf->INCLUDEPATH) + '\n';
                if(!conf->LIBS.isEmpty())
-                       str += "LIBS += " + conf->LIBS + '\n';
+                       str += "LIBS += " + qc_prepare_libs(conf->LIBS) + '\n';
                if(!conf->extra.isEmpty())
                        str += conf->extra;
                str += '\n';
 
+               var = qc_getenv("QC_EXTRACONF");
+               if (!var.isEmpty())
+                       str += ("\n# Extra conf from command line\n" + var + 
"\n");
+
                QByteArray cs = str.toLatin1();
                f.write(cs);
                f.close();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/qconf-20150319.c8e969fef8ce/conf/conf4.h 
new/qconf-20150608.4a9c329ba879/conf/conf4.h
--- old/qconf-20150319.c8e969fef8ce/conf/conf4.h        2015-03-19 
10:05:24.000000000 +0100
+++ new/qconf-20150608.4a9c329ba879/conf/conf4.h        2015-09-29 
14:54:51.000000000 +0200
@@ -62,8 +62,8 @@
        QString maketool;
 
        QString DEFINES;
-       QString INCLUDEPATH;
-       QString LIBS;
+       QStringList INCLUDEPATH;
+       QStringList LIBS;
        QString extra;
 
        QList<ConfObj*> list;
@@ -74,6 +74,12 @@
 
        QString getenv(const QString &var);
        QString qvar(const QString &s);
+       QString normalizePath(const QString &s) const;
+       QString escapeQmakeVar(const QString &s) const;
+       inline QString escapePath(const QString &s) /* prepare fs path for 
qmake file */
+       { return escapeQmakeVar(normalizePath(s)); }
+       QString escapedIncludes() const;
+       QString escapedLibs() const;
 
        bool exec();
 
Files old/qconf-20150319.c8e969fef8ce/configure.exe and 
new/qconf-20150608.4a9c329ba879/configure.exe differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/qconf-20150319.c8e969fef8ce/src/configexe/configexe.c 
new/qconf-20150608.4a9c329ba879/src/configexe/configexe.c
--- old/qconf-20150319.c8e969fef8ce/src/configexe/configexe.c   2015-03-19 
10:05:24.000000000 +0100
+++ new/qconf-20150608.4a9c329ba879/src/configexe/configexe.c   2015-09-29 
14:54:51.000000000 +0200
@@ -12,7 +12,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <errno.h>
-#include <unistd.h>
+//#include <unistd.h>
 #include "embed.h"
 
 #if defined(WIN32) || defined(_WIN32)
@@ -340,9 +340,9 @@
 {
        char *str;
 
-       str = strdup(qtdir);
+       str = separators_to_native(qtdir);
 #ifdef QC_OS_WIN
-       str = append_free(str, "/bin/qmake.exe");
+       str = append_free(str, "\\bin\\qmake.exe");
 #else
        str = append_free(str, "/bin/qmake");
 #endif
@@ -361,6 +361,8 @@
 {
        char *qtdir;
        char *path;
+       FILE *qmp;
+       char try_syspath = 1;
 
        qtdir = ex_qtdir;
        if(qtdir)
@@ -368,6 +370,7 @@
                path = check_qmake_path(qtdir);
                if(path)
                        return path;
+               try_syspath = 0;
        }
        if(qc_verbose)
                printf("Warning: qmake not found via --qtdir\n");
@@ -378,10 +381,50 @@
                path = check_qmake_path(qtdir);
                if(path)
                        return path;
+               try_syspath = 0;
        }
        if(qc_verbose)
                printf("Warning: qmake not found via %%QTDIR%%\n");
 
+       /* if not set explicitly try something implicit */
+       if (try_syspath) {
+               char *dname = 0;
+               int len;
+               qmp = popen("qmake -query QT_INSTALL_BINS", "r");
+               if (qmp) {
+                       char buf[PATH_MAX];
+                       int cnt;
+                       while ((cnt = fread(buf, 1, PATH_MAX - 1, qmp))) {
+                               buf[cnt] = 0;
+                               if (!dname) {
+                                       dname = strdup(buf);
+                               } else {
+                                       dname = append_free(dname, buf);
+                               }
+                       }
+                       pclose(qmp);
+               }
+               if (dname) {
+                       len = strlen(dname);
+                       while (len && dname[len - 1] < ' ')
+                               dname[--len] = '\0';
+                       if (len && file_exists(dname)) {
+#ifdef QC_OS_WIN
+                               dname = append_free(dname, "/qmake.exe"); /* it 
coud be *.cmd but we don't care */
+#else
+                               dname = append_free(dname, "/qmake");
+#endif
+                               char *ndname = separators_to_native(dname);
+                               free(dname);
+                               return ndname;
+                       }
+                       free(dname);
+               }
+       }
+
+       if(qc_verbose)
+               printf("Warning: qmake not found in PATH\n");
+
        return NULL;
 }
 
@@ -660,7 +703,7 @@
                        try_print_var(q->args[n].envvar, q->args[n].val);
        }
 
-       printf("Verifying Qt 4 build environment ... ");
+       printf("Verifying Qt 4+ build environment ... ");
        fflush(stdout);
 
        if(qc_verbose)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/qconf-20150319.c8e969fef8ce/src/configexe/configexe.pro 
new/qconf-20150608.4a9c329ba879/src/configexe/configexe.pro
--- old/qconf-20150319.c8e969fef8ce/src/configexe/configexe.pro 2015-03-19 
10:05:24.000000000 +0100
+++ new/qconf-20150608.4a9c329ba879/src/configexe/configexe.pro 2015-09-29 
14:54:51.000000000 +0200
@@ -4,6 +4,8 @@
 
 CONFIG += release
 
+*win32-g++*:QMAKE_LFLAGS += -static-libgcc
+
 HEADERS += \
        embed.h
 
Files old/qconf-20150319.c8e969fef8ce/src/configexe/configexe_stub.exe and 
new/qconf-20150608.4a9c329ba879/src/configexe/configexe_stub.exe differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude 
config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 
--exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh 
old/qconf-20150319.c8e969fef8ce/src/qconf.cpp 
new/qconf-20150608.4a9c329ba879/src/qconf.cpp
--- old/qconf-20150319.c8e969fef8ce/src/qconf.cpp       2015-03-19 
10:05:24.000000000 +0100
+++ new/qconf-20150608.4a9c329ba879/src/qconf.cpp       2015-09-29 
14:54:51.000000000 +0200
@@ -44,7 +44,7 @@
 {
        QString out;
        for(int n = 0; n < (int)str.length(); ++n) {
-               if(str[n] == '$' || str[n] == '`')
+               if(str[n] == '$' || str[n] == '`' || str[n] == '\\')
                        out += '\\';
                out += str[n];
        }
@@ -150,34 +150,6 @@
        return out;
 }
 
-// eat double-backslashes on windows, as we don't need the extra escaping to
-//   satisfy the unix shell script
-static QByteArray filter_backslashes(const QByteArray &in)
-{
-       QByteArray out;
-
-       bool inbs = false;
-       for(int n = 0; n < in.size(); ++n)
-       {
-               if(in[n] == '\\')
-               {
-                       if(inbs)
-                       {
-                               inbs = false;
-                               continue;
-                       }
-
-                       inbs = true;
-               }
-               else
-                       inbs = false;
-
-               out += in[n];
-       }
-
-       return out;
-}
-
 static QByteArray get_configexe_stub()
 {
        QFile f;
@@ -362,6 +334,8 @@
                if(libmode)
                        mainopts += ConfOpt("static", QString(), "QC_STATIC", 
"Create a static library instead of shared.");
 
+               mainopts += ConfOpt("extraconf", "conf", "QC_EXTRACONF", "Extra 
configuration for nonstandard cases");
+
                QString str;
                str += genHeader();
                str += genUsage();
@@ -406,7 +380,7 @@
 
                if(qt4) {
                        if(byoq) {
-                               str += "printf \"Preparing internal Qt 4 build 
environment ... \"\n\n";
+                               str += "printf \"Preparing internal Qt 4+ build 
environment ... \"\n\n";
 
                                str += "cd byoq\n";
                                str += "./byoq build\n";
@@ -442,6 +416,7 @@
                        str += QString("export %1\n").arg(i.var);
                }
                str += "export QC_VERBOSE\n"; // export verbose flag also
+               str += "export QC_QTSELECT\n";
 
                str += genDoQConf();
 
@@ -465,6 +440,8 @@
                if(libmode)
                        mainopts += ConfOpt("static", QString(), "QC_STATIC", 
"Create a static library instead of shared.");
 
+               mainopts += ConfOpt("extraconf", "conf", "QC_EXTRACONF", "Extra 
configuration for nonstandard cases");
+
                // combine main and extra opts together
                all = mainopts + appopts + depopts;
 
@@ -498,11 +475,11 @@
 
                write32((quint8 *)buf.data(), 5);
                out += buf;
-               out += embed_file("modules.cpp", 
filter_backslashes(filemodulescpp));
-               out += embed_file("modules_new.cpp", 
filter_backslashes(filemodulesnewcpp));
-               out += embed_file("conf4.h", filter_backslashes(fileconfh));
-               out += embed_file("conf4.cpp", filter_backslashes(fileconfcpp));
-               out += embed_file("conf4.pro", filter_backslashes(fileconfpro));
+               out += embed_file("modules.cpp", filemodulescpp);
+               out += embed_file("modules_new.cpp", filemodulesnewcpp);
+               out += embed_file("conf4.h", fileconfh);
+               out += embed_file("conf4.cpp", fileconfcpp);
+               out += embed_file("conf4.pro", fileconfpro);
 
                out += lenval(name.toLatin1());
                out += lenval(profile.toLatin1());
@@ -586,6 +563,7 @@
 
                QList<ConfUsageOpt> list = optsToUsage(mainopts);
                list += ConfUsageOpt("verbose",  "",   "Show extra configure 
output.");
+               list += ConfUsageOpt("qtselect",  "N",   "Select major Qt 
verion (4 or 5).");
                list += ConfUsageOpt("help",   "",     "This help text.");
                str += genUsageSection("Main options:", list);
 
@@ -611,6 +589,7 @@
 
                QList<ConfUsageOpt> list = optsToUsage(mainopts);
                list += ConfUsageOpt("verbose",  "",   "Show extra configure 
output.");
+               list += ConfUsageOpt("qtselect",  "N",   "Select major Qt 
verion (4 or 5).");
                list += ConfUsageOpt("help",   "",     "This help text.");
                str += genUsageSection("Main options:", list);
 
@@ -754,8 +733,13 @@
                "                       QC_VERBOSE=\"Y\"\n"
                "                       shift\n"
                "                       ;;\n"
+               "               --qtselect*)\n"
+               "                       [ \"$1\" = \"--qtselect\" ] && { shift; 
optarg=\"$1\"; }\n"
+               "                       QC_QTSELECT=\"${optarg}\"\n"
+               "                       shift\n"
+               "                       ;;\n"
                "               --help) show_usage; exit ;;\n"
-               "               *) show_usage; exit ;;\n"
+               "               *) show_usage; exit 1;;\n"
                "       esac\n"
                "done\n\n";
 
@@ -874,14 +858,19 @@
        QString genQt4Checks()
        {
                QString str =
+               "QTSEARCHTTEXT=\"$QC_QTSELECT\"\n"
+               "[ -z \"$QC_QTSELECT\" ] && QTSEARCHTTEXT=\"4 or 5\"\n"
+               "\n"
                "# run qmake -v and check version\n"
                "qmake_check_v4() {\n"
                "       if [ -x \"$1\" ]; then\n"
-               "       local v=`$1 -query QT_VERSION 2>&1`\n"
-               "       vmaj=\"${v%%.*}\"\n"
-               "       case \"${v}\" in ?.?.?) [ \"$vmaj\" = 4 -o \"$vmaj\" = 
5 ] && return 0 ;; esac\n"
+               "               local v=`$1 -query QT_VERSION 2>&1`\n"
+               "               vmaj=\"${v%%.*}\"\n"
+               "               case \"${v}\" in ?.?.?) [ -z \"$QC_QTSELECT\" ] 
&& [ \"$vmaj\" = 4 -o \"$vmaj\" = 5 ] && return 0;\n"
+               "                        [ -n \"$QC_QTSELECT\" ] && [ \"$vmaj\" 
= \"$QC_QTSELECT\" ] && return 0; ;;\n"
+               "               esac\n"
                "               if [ \"$QC_VERBOSE\" = \"Y\" ]; then\n"
-               "                       echo \"Warning: $1 not for Qt 4 or 
5\"\n"
+               "                       echo \"Warning: $1 not for Qt 
${QTSEARCHTTEXT}\"\n"
                "               fi\n"
                "       fi\n"
                "       return 1\n"
@@ -894,10 +883,18 @@
                "fi\n"
                "\n"
                "qm=\"\"\n"
-               "names=\"qmake-qt5 qmake5 qmake-qt4 qmake4 qmake\"\n"
+               "qt4_names=\"qmake-qt4 qmake4\"\n"
+               "qt5_names=\"qmake-qt5 qmake5\"\n"
+               "names=\"qmake\"\n"
+               "if [ -z \"$QC_QTSELECT\" ]; then\n"
+               "       names=\"${qt5_names} ${qt4_names} $names\"\n"
+               "else\n"
+               "       [ \"$QC_QTSELECT\" = \"4\" ] && names=\"${qt4_names} 
$names\"\n"
+               "       [ \"$QC_QTSELECT\" -ge \"5\" ] && names=\"${qt5_names} 
$names\"\n"
+               "fi\n"
                "\n"
-               "# qt4 check: --qtdir\n"
                "if [ -z \"$qm\" ] && [ ! -z \"$EX_QTDIR\" ]; then\n"
+               "# qt4 check: --qtdir\n"
                "       for n in $names; do\n"
                "               qstr=$EX_QTDIR/bin/$n\n"
                "               if qmake_check_v4 \"$qstr\"; then\n"
@@ -905,13 +902,12 @@
                "                       break;\n"
                "               fi\n"
                "       done\n"
-               "fi\n"
-               "if [ -z \"$qm\" ] && [ \"$QC_VERBOSE\" = \"Y\" ]; then\n"
-               "       echo \"Warning: qmake not found via --qtdir\"\n"
-               "fi\n"
+               "       if [ -z \"$qm\" ] && [ \"$QC_VERBOSE\" = \"Y\" ]; 
then\n"
+               "               echo \"Warning: qmake not found via --qtdir\"\n"
+               "       fi\n"
                "\n"
+               "elif [ -z \"$qm\" ] && [ ! -z \"$QTDIR\" ]; then\n"
                "# qt4 check: QTDIR\n"
-               "if [ -z \"$qm\" ] && [ ! -z \"$QTDIR\" ]; then\n"
                "       for n in $names; do\n"
                "               qstr=$QTDIR/bin/$n\n"
                "               if qmake_check_v4 \"$qstr\"; then\n"
@@ -919,9 +915,28 @@
                "                       break;\n"
                "               fi\n"
                "       done\n"
+               "       if [ -z \"$qm\" ] && [ \"$QC_VERBOSE\" = \"Y\" ]; 
then\n"
+               "               echo \"Warning: qmake not found via 
\\$QTDIR\"\n"
+               "       fi\n"
+               "\n"
+               "else\n"
+               "\n"
+               "# Try all other implicit checks\n"
+               "\n"
+               "# qtchooser\n"
+               "if [ -z \"$qm\" ]; then\n"
+               "       qtchooser=$($WHICH qtchooser 2>/dev/null)\n"
+               "       if [ ! -z \"$qtchooser\" ]; then\n"
+               "               cmd=\"$qtchooser -run-tool=qmake 
-qt=${QC_QTSELECT}\"\n"
+               "               qtbins=\"$($cmd -query QT_INSTALL_BINS 
2>/dev/null)\"\n"
+               "               if [ -n \"$qtbins\" ] && qmake_check_v4 
\"$qtbins/qmake\"; then\n"
+               "                       qm=\"$qtbins/qmake\"\n"
+               "                       break;\n"
+               "               fi\n"
+               "       fi\n"
                "fi\n"
                "if [ -z \"$qm\" ] && [ \"$QC_VERBOSE\" = \"Y\" ]; then\n"
-               "       echo \"Warning: qmake not found via \\$QTDIR\"\n"
+               "       echo \"Warning: qmake not found via qtchooser\"\n"
                "fi\n"
                "\n"
                "# qt4 check: pkg-config\n"
@@ -955,6 +970,9 @@
                "       echo \"Warning: qmake not found via \\$PATH\"\n"
                "fi\n"
                "\n"
+               "# end of implicit checks\n"
+               "fi\n"
+               "\n"
                "if [ -z \"$qm\" ]; then\n"
                "       if [ \"$QC_VERBOSE\" = \"Y\" ]; then\n"
                "               echo \" -> fail\"\n"
@@ -964,7 +982,7 @@
 
                str += echoBlock(1,
                "\n"
-               "Reason: Unable to find the 'qmake' tool for Qt 4.\n"
+               "Reason: Unable to find the 'qmake' tool for Qt 
${QTSEARCHTTEXT}.\n"
                "\n");
                str +=
                "       show_qt_info\n";
@@ -1011,16 +1029,16 @@
        QString genDoQConf()
        {
                QString outdir = ".qconftemp";
-               QString cleanup = QString("rm -rf %1").arg(outdir);
+               QString cleanup = QString("rm -rf \"%1\"").arg(outdir);
 
                QString str;
                str += QString("%1\n").arg(cleanup);
 
                str += QString(
                "(\n"
-               "       mkdir %1\n"
-               "       gen_files %2\n"
-               "       cd %3\n"
+               "       mkdir \"%1\"\n"
+               "       gen_files \"%2\"\n"
+               "       cd \"%3\"\n"
                ).arg(outdir).arg(outdir).arg(outdir);
 
                if(qt4) {
@@ -1097,7 +1115,7 @@
                        str += QString("export QC_COMMAND\n");
                        str += QString("QC_PROFILE=%1\n").arg(profile);
                        str += QString("export QC_PROFILE\n");
-                       str += QString("QC_QMAKE=$qm\n");
+                       str += QString("QC_QMAKE=\"$qm\"\n");
                        str += QString("export QC_QMAKE\n");
                        str += QString("QC_QMAKESPEC=$qm_spec\n");
                        str += QString("export QC_QMAKESPEC\n");
@@ -1105,7 +1123,7 @@
                        str += QString("export QC_MAKETOOL\n");
                }
 
-               str += QString("%1/conf\n").arg(outdir);
+               str += QString("\"%1/conf\"\n").arg(outdir);
 
                str += "ret=\"$?\"\n";
                str += "if [ \"$ret\" = \"1\" ]; then\n";
@@ -1181,7 +1199,7 @@
        QString genEmbeddedFile(const QString &name, const QByteArray &a)
        {
                QString str;
-               str += QString("cat >%1 <<EOT\n").arg(name);
+               str += QString("cat >\"%1\" <<EOT\n").arg(name);
                str += escapeFile(QString::fromLatin1(a));
                str += "\nEOT\n";
                return str;
@@ -1660,19 +1678,7 @@
                dep.section = info.section;
                dep.args = info.args;
 
-               // prepend #line
-               int oldsize = buf.size();
-               QString str = QString("#line 1 \"%1\"\n").arg(modfname);
-               QByteArray cs = str.toLocal8Bit();
-               int len = cs.length();
-               buf.resize(oldsize + len);
-               memmove(buf.data() + len, buf.data(), oldsize);
-               memcpy(buf.data(), cs.data(), len);
-
-               // append to the module buffer
-               oldsize = allmods.size();
-               allmods.resize(oldsize + buf.size());
-               memcpy(allmods.data() + oldsize, buf.data(), buf.size());
+               allmods += (QString("#line 1 
\"%1\"\n").arg(modfname).toLocal8Bit() + buf);
 
                modscreate += QString("    o = new qc_%1(conf);\n    
o->required = %2;\n    o->disabled = %3;\n"
                        ).arg(escapeArg(dep.name)).arg(dep.required ? "true": 
"false").arg(dep.disabled ? "true": "false");


Reply via email to