| 1 | #!/bin/sh | 
|---|
| 2 |  | 
|---|
| 3 | show_usage() { | 
|---|
| 4 | cat <<EOT | 
|---|
| 5 | Usage: ./configure [OPTION]... | 
|---|
| 6 |  | 
|---|
| 7 | This script creates necessary configuration files to build/install. | 
|---|
| 8 |  | 
|---|
| 9 | Main options: | 
|---|
| 10 | --qtdir=[path]    Directory where Qt is installed. | 
|---|
| 11 | --help            This help text. | 
|---|
| 12 |  | 
|---|
| 13 | Dependency options: | 
|---|
| 14 | --with-openssl-inc=[path]    Path to OpenSSL include files | 
|---|
| 15 | --with-openssl-lib=[path]    Path to OpenSSL library files | 
|---|
| 16 |  | 
|---|
| 17 | EOT | 
|---|
| 18 | } | 
|---|
| 19 |  | 
|---|
| 20 | while [ $# -gt 0 ]; do | 
|---|
| 21 | case "$1" in | 
|---|
| 22 | --qtdir=*) | 
|---|
| 23 | QTDIR=`expr "${1}" : "--qtdir=\(.*\)"` | 
|---|
| 24 | shift | 
|---|
| 25 | ;; | 
|---|
| 26 |  | 
|---|
| 27 | --with-openssl-inc=*) | 
|---|
| 28 | QC_WITH_OPENSSL_INC=`expr "${1}" : "--with-openssl-inc=\(.*\)"` | 
|---|
| 29 | shift | 
|---|
| 30 | ;; | 
|---|
| 31 |  | 
|---|
| 32 | --with-openssl-lib=*) | 
|---|
| 33 | QC_WITH_OPENSSL_LIB=`expr "${1}" : "--with-openssl-lib=\(.*\)"` | 
|---|
| 34 | shift | 
|---|
| 35 | ;; | 
|---|
| 36 |  | 
|---|
| 37 | --debug) | 
|---|
| 38 | QC_DEBUG="Y" | 
|---|
| 39 | shift | 
|---|
| 40 | ;; | 
|---|
| 41 | --help) show_usage; exit ;; | 
|---|
| 42 | *) show_usage; exit ;; | 
|---|
| 43 | esac | 
|---|
| 44 | done | 
|---|
| 45 |  | 
|---|
| 46 |  | 
|---|
| 47 | echo "Configuring qca-tls ..." | 
|---|
| 48 |  | 
|---|
| 49 | if [ "$QC_DEBUG" = "Y" ]; then | 
|---|
| 50 | echo | 
|---|
| 51 | echo QTDIR=$QTDIR | 
|---|
| 52 | echo QC_WITH_OPENSSL_INC=$QC_WITH_OPENSSL_INC | 
|---|
| 53 | echo QC_WITH_OPENSSL_LIB=$QC_WITH_OPENSSL_LIB | 
|---|
| 54 | echo | 
|---|
| 55 | fi | 
|---|
| 56 |  | 
|---|
| 57 | printf "Verifying Qt 3.x Multithreaded (MT) build environment ... " | 
|---|
| 58 |  | 
|---|
| 59 | if [ -z "$QTDIR" ]; then | 
|---|
| 60 | if [ "$QC_DEBUG" = "Y" ]; then | 
|---|
| 61 | echo \$QTDIR not set... trying to find Qt manually | 
|---|
| 62 | fi | 
|---|
| 63 | for p in /usr/lib/qt /usr/share/qt /usr/share/qt3 /usr/local/lib/qt /usr/local/share/qt /usr/lib/qt3 /usr/local/lib/qt3 /usr/X11R6/share/qt /usr/qt/3 ; do | 
|---|
| 64 | if [ -d "$p/mkspecs" ]; then | 
|---|
| 65 | QTDIR=$p | 
|---|
| 66 | break; | 
|---|
| 67 | fi; | 
|---|
| 68 | done | 
|---|
| 69 | if [ -z "$QTDIR" ]; then | 
|---|
| 70 | echo fail | 
|---|
| 71 | echo | 
|---|
| 72 | echo Unable to find Qt 'mkspecs'. Please set QTDIR | 
|---|
| 73 | echo manually. Perhaps you need to install Qt 3 | 
|---|
| 74 | echo development utilities. You may download them either | 
|---|
| 75 | echo from the vendor of your operating system or from | 
|---|
| 76 | echo www.trolltech.com | 
|---|
| 77 | echo | 
|---|
| 78 | exit 1; | 
|---|
| 79 | fi | 
|---|
| 80 | fi | 
|---|
| 81 |  | 
|---|
| 82 | if [ ! -x "$QTDIR/bin/qmake" ]; then | 
|---|
| 83 | if [ "$QC_DEBUG" = "Y" ]; then | 
|---|
| 84 | echo Warning: qmake not in \$QTDIR/bin/qmake | 
|---|
| 85 | echo trying to find it in \$PATH | 
|---|
| 86 | fi | 
|---|
| 87 | qm=`type -p qmake` | 
|---|
| 88 | if [ -x "$qm" ]; then | 
|---|
| 89 | if [ "$QC_DEBUG" = "Y" ]; then | 
|---|
| 90 | echo qmake found in $qm | 
|---|
| 91 | fi | 
|---|
| 92 | else | 
|---|
| 93 | echo fail | 
|---|
| 94 | echo | 
|---|
| 95 | echo Sorry, you seem to have a very unusual setup, | 
|---|
| 96 | echo or I missdetected \$QTDIR=$QTDIR | 
|---|
| 97 | echo | 
|---|
| 98 | echo Please set \$QTDIR manually and make sure that | 
|---|
| 99 | echo \$QTDIR/bin/qmake exists. | 
|---|
| 100 | echo | 
|---|
| 101 | exit 1; | 
|---|
| 102 | fi | 
|---|
| 103 | else | 
|---|
| 104 | qm=$QTDIR/bin/qmake | 
|---|
| 105 | fi | 
|---|
| 106 |  | 
|---|
| 107 | gen_files() { | 
|---|
| 108 | cat >$1/modules.cpp <<EOT | 
|---|
| 109 | /* | 
|---|
| 110 | -----BEGIN QCMOD----- | 
|---|
| 111 | name: OpenSSL | 
|---|
| 112 | arg: with-openssl-inc=[path],Path to OpenSSL include files | 
|---|
| 113 | arg: with-openssl-lib=[path],Path to OpenSSL library files | 
|---|
| 114 | -----END QCMOD----- | 
|---|
| 115 | */ | 
|---|
| 116 | class qc_openssl : public ConfObj | 
|---|
| 117 | { | 
|---|
| 118 | public: | 
|---|
| 119 | qc_openssl(Conf *c) : ConfObj(c) {} | 
|---|
| 120 | QString name() const { return "OpenSSL"; } | 
|---|
| 121 | QString shortname() const { return "openssl"; } | 
|---|
| 122 | bool exec() | 
|---|
| 123 | { | 
|---|
| 124 | QString inc, lib; | 
|---|
| 125 | QString s; | 
|---|
| 126 | bool kb = false; | 
|---|
| 127 | QString kbdir = "/usr/kerberos/include"; | 
|---|
| 128 |  | 
|---|
| 129 | // Redhat 9? | 
|---|
| 130 | if(QFileInfo(kbdir).exists()) | 
|---|
| 131 | kb = true; | 
|---|
| 132 |  | 
|---|
| 133 | s = conf->getenv("QC_WITH_OPENSSL_INC"); | 
|---|
| 134 | if(!s.isEmpty()) { | 
|---|
| 135 | if(!conf->checkHeader(s, "openssl/ssl.h")) | 
|---|
| 136 | return false; | 
|---|
| 137 | inc = s; | 
|---|
| 138 | } | 
|---|
| 139 | else { | 
|---|
| 140 | if(!conf->findHeader("openssl/ssl.h", QStringList(), &s)) | 
|---|
| 141 | return false; | 
|---|
| 142 | inc = s; | 
|---|
| 143 | } | 
|---|
| 144 |  | 
|---|
| 145 | s = conf->getenv("QC_WITH_OPENSSL_LIB"); | 
|---|
| 146 | if(!s.isEmpty()) { | 
|---|
| 147 | if(!conf->checkLibrary(s, "ssl")) | 
|---|
| 148 | return false; | 
|---|
| 149 | lib = s; | 
|---|
| 150 | } | 
|---|
| 151 | else { | 
|---|
| 152 | if(!conf->findLibrary("ssl", &s)) | 
|---|
| 153 | return false; | 
|---|
| 154 | lib = s; | 
|---|
| 155 | } | 
|---|
| 156 |  | 
|---|
| 157 | // is it at least openssl 0.9.7? | 
|---|
| 158 | QString str = | 
|---|
| 159 | "#include<openssl/opensslv.h>\n" | 
|---|
| 160 | "int main()\n" | 
|---|
| 161 | "{\n" | 
|---|
| 162 | "  unsigned long x = OPENSSL_VERSION_NUMBER;\n" | 
|---|
| 163 | "  if(x >= 0x00907000) return 0; else return 1;\n" | 
|---|
| 164 | "}\n"; | 
|---|
| 165 | QString ext; | 
|---|
| 166 | if(!inc.isEmpty()) | 
|---|
| 167 | ext += QString("-I") + inc + ' '; | 
|---|
| 168 | if(kb) | 
|---|
| 169 | ext += QString("-I") + kbdir + ' '; | 
|---|
| 170 | if(!lib.isEmpty()) | 
|---|
| 171 | ext += QString("-L") + lib + " -lssl -lcrypto "; | 
|---|
| 172 | int ret; | 
|---|
| 173 | if(!conf->doCompileAndLink(str, ext, &ret)) | 
|---|
| 174 | return false; | 
|---|
| 175 | if(ret == 0) | 
|---|
| 176 | conf->addDefine("OSSL_097"); | 
|---|
| 177 |  | 
|---|
| 178 | if(!inc.isEmpty()) | 
|---|
| 179 | conf->addIncludePath(inc); | 
|---|
| 180 | if(kb) | 
|---|
| 181 | conf->addIncludePath(kbdir); | 
|---|
| 182 | if(!lib.isEmpty()) | 
|---|
| 183 | conf->addLib(QString("-L") + s); | 
|---|
| 184 | conf->addLib("-lssl -lcrypto"); | 
|---|
| 185 |  | 
|---|
| 186 | return true; | 
|---|
| 187 | } | 
|---|
| 188 | }; | 
|---|
| 189 |  | 
|---|
| 190 | EOT | 
|---|
| 191 | cat >$1/modules_new.cpp <<EOT | 
|---|
| 192 | o = new qc_openssl(conf); | 
|---|
| 193 | o->required = true; | 
|---|
| 194 | o->disabled = false; | 
|---|
| 195 |  | 
|---|
| 196 | EOT | 
|---|
| 197 | cat >$1/conf.cpp <<EOT | 
|---|
| 198 | #include<stdio.h> | 
|---|
| 199 | #include<stdlib.h> | 
|---|
| 200 | #include<qstring.h> | 
|---|
| 201 | #include<qdict.h> | 
|---|
| 202 | #include<qptrlist.h> | 
|---|
| 203 | #include<qfileinfo.h> | 
|---|
| 204 | #include<qfile.h> | 
|---|
| 205 | #include<qdir.h> | 
|---|
| 206 | #include<qstringlist.h> | 
|---|
| 207 |  | 
|---|
| 208 | class Conf; | 
|---|
| 209 |  | 
|---|
| 210 | class ConfObj | 
|---|
| 211 | { | 
|---|
| 212 | public: | 
|---|
| 213 | ConfObj(Conf *c); | 
|---|
| 214 | virtual ~ConfObj(); | 
|---|
| 215 |  | 
|---|
| 216 | virtual QString name() const=0; | 
|---|
| 217 | virtual QString shortname() const=0; | 
|---|
| 218 | virtual bool exec()=0; | 
|---|
| 219 |  | 
|---|
| 220 | Conf *conf; | 
|---|
| 221 | bool required; | 
|---|
| 222 | bool disabled; | 
|---|
| 223 | }; | 
|---|
| 224 |  | 
|---|
| 225 | typedef QPtrList<ConfObj> ConfObjList; | 
|---|
| 226 | typedef QPtrListIterator<ConfObj> ConfObjListIt; | 
|---|
| 227 |  | 
|---|
| 228 | class Conf | 
|---|
| 229 | { | 
|---|
| 230 | public: | 
|---|
| 231 | Conf() : vars(17) | 
|---|
| 232 | { | 
|---|
| 233 | list.setAutoDelete(true); | 
|---|
| 234 | vars.setAutoDelete(true); | 
|---|
| 235 |  | 
|---|
| 236 | vars.insert("QMAKE_INCDIR_X11", new QString(X11_INC)); | 
|---|
| 237 | vars.insert("QMAKE_LIBDIR_X11", new QString(X11_LIBDIR)); | 
|---|
| 238 | vars.insert("QMAKE_LIBS_X11",   new QString(X11_LIB)); | 
|---|
| 239 | vars.insert("QMAKE_CC",         new QString(CC)); | 
|---|
| 240 | } | 
|---|
| 241 |  | 
|---|
| 242 | ~Conf() | 
|---|
| 243 | { | 
|---|
| 244 | } | 
|---|
| 245 |  | 
|---|
| 246 | void added(ConfObj *o) | 
|---|
| 247 | { | 
|---|
| 248 | list.append(o); | 
|---|
| 249 | } | 
|---|
| 250 |  | 
|---|
| 251 | QString getenv(const QString &var) | 
|---|
| 252 | { | 
|---|
| 253 | char *p = ::getenv(var.latin1()); | 
|---|
| 254 | if(!p) | 
|---|
| 255 | return QString::null; | 
|---|
| 256 | return QString(p); | 
|---|
| 257 | } | 
|---|
| 258 |  | 
|---|
| 259 | bool exec() | 
|---|
| 260 | { | 
|---|
| 261 | ConfObjListIt it(list); | 
|---|
| 262 | for(ConfObj *o; (o = it.current()); ++it) { | 
|---|
| 263 | // if this was a disabled-by-default option, check if it was enabled | 
|---|
| 264 | if(o->disabled) { | 
|---|
| 265 | QString v = QString("QC_ENABLE_") + o->shortname(); | 
|---|
| 266 | if(getenv(v) != "Y") | 
|---|
| 267 | continue; | 
|---|
| 268 | } | 
|---|
| 269 | // and the opposite? | 
|---|
| 270 | else { | 
|---|
| 271 | QString v = QString("QC_DISABLE_") + o->shortname(); | 
|---|
| 272 | if(getenv(v) == "Y") | 
|---|
| 273 | continue; | 
|---|
| 274 | } | 
|---|
| 275 |  | 
|---|
| 276 | printf("Checking for %s ...", o->name().latin1()); | 
|---|
| 277 | fflush(stdout); | 
|---|
| 278 | bool ok = o->exec(); | 
|---|
| 279 | if(ok) | 
|---|
| 280 | printf(" yes\n"); | 
|---|
| 281 | else | 
|---|
| 282 | printf(" no\n"); | 
|---|
| 283 | if(!ok && o->required) { | 
|---|
| 284 | printf("\nError: need %s!\n", o->name().latin1()); | 
|---|
| 285 | return false; | 
|---|
| 286 | } | 
|---|
| 287 | } | 
|---|
| 288 | return true; | 
|---|
| 289 | } | 
|---|
| 290 |  | 
|---|
| 291 | const QString & qvar(const QString &s) | 
|---|
| 292 | { | 
|---|
| 293 | QString *p = vars.find(s); | 
|---|
| 294 | if(p) | 
|---|
| 295 | return *p; | 
|---|
| 296 | else | 
|---|
| 297 | return blank; | 
|---|
| 298 | } | 
|---|
| 299 |  | 
|---|
| 300 | QString expandIncludes(const QString &inc) | 
|---|
| 301 | { | 
|---|
| 302 | return QString("-I") + inc; | 
|---|
| 303 | } | 
|---|
| 304 |  | 
|---|
| 305 | QString expandLibs(const QString &lib) | 
|---|
| 306 | { | 
|---|
| 307 | return QString("-L") + lib; | 
|---|
| 308 | } | 
|---|
| 309 |  | 
|---|
| 310 | int doCommand(const QString &s) | 
|---|
| 311 | { | 
|---|
| 312 | //printf("[%s]\n", s.latin1()); | 
|---|
| 313 | int r = system((s + " 1>/dev/null 2>/dev/null").latin1()); | 
|---|
| 314 | //printf("returned: %d\n", r); | 
|---|
| 315 | return r; | 
|---|
| 316 | } | 
|---|
| 317 |  | 
|---|
| 318 | bool doCompileAndLink(const QString &filedata, const QString &flags, int *retcode=0) | 
|---|
| 319 | { | 
|---|
| 320 | QDir dir("."); | 
|---|
| 321 | QString fname = "atest.c"; | 
|---|
| 322 | QString out = "atest"; | 
|---|
| 323 | QFile f(fname); | 
|---|
| 324 | QCString cs = filedata.latin1(); | 
|---|
| 325 | if(!f.open(IO_WriteOnly | IO_Truncate)) | 
|---|
| 326 | return false; | 
|---|
| 327 | f.writeBlock(cs.data(), cs.length()); | 
|---|
| 328 | f.close(); | 
|---|
| 329 |  | 
|---|
| 330 | QString str = qvar("QMAKE_CC") + ' ' + fname + " -o " + out + ' ' + flags; | 
|---|
| 331 | int r = doCommand(str); | 
|---|
| 332 | if(r == 0 && retcode) | 
|---|
| 333 | *retcode = doCommand(QString("./") + out); | 
|---|
| 334 | dir.remove(fname); | 
|---|
| 335 | dir.remove(out); | 
|---|
| 336 | if(r != 0) | 
|---|
| 337 | return false; | 
|---|
| 338 | return true; | 
|---|
| 339 | } | 
|---|
| 340 |  | 
|---|
| 341 | bool checkHeader(const QString &path, const QString &h) | 
|---|
| 342 | { | 
|---|
| 343 | QFileInfo fi(path + '/' + h); | 
|---|
| 344 | if(fi.exists()) | 
|---|
| 345 | return true; | 
|---|
| 346 | return false; | 
|---|
| 347 | } | 
|---|
| 348 |  | 
|---|
| 349 | bool findHeader(const QString &h, const QStringList &ext, QString *inc) | 
|---|
| 350 | { | 
|---|
| 351 | if(checkHeader("/usr/include", h)) { | 
|---|
| 352 | *inc = ""; | 
|---|
| 353 | return true; | 
|---|
| 354 | } | 
|---|
| 355 | QStringList dirs; | 
|---|
| 356 | dirs += "/usr/local/include"; | 
|---|
| 357 | dirs += ext; | 
|---|
| 358 | for(QStringList::ConstIterator it = dirs.begin(); it != dirs.end(); ++it) { | 
|---|
| 359 | if(checkHeader(*it, h)) { | 
|---|
| 360 | *inc = *it; | 
|---|
| 361 | return true; | 
|---|
| 362 | } | 
|---|
| 363 | } | 
|---|
| 364 | return false; | 
|---|
| 365 | } | 
|---|
| 366 |  | 
|---|
| 367 | bool checkLibrary(const QString &path, const QString &name) | 
|---|
| 368 | { | 
|---|
| 369 | QString str = | 
|---|
| 370 | "int main()\n" | 
|---|
| 371 | "{\n" | 
|---|
| 372 | "    return 0;\n" | 
|---|
| 373 | "}\n"; | 
|---|
| 374 |  | 
|---|
| 375 | QString extra; | 
|---|
| 376 | if(!path.isEmpty()) | 
|---|
| 377 | extra += QString("-L") + path + ' '; | 
|---|
| 378 | extra += QString("-l") + name; | 
|---|
| 379 | if(!doCompileAndLink(str, extra)) | 
|---|
| 380 | return false; | 
|---|
| 381 | return true; | 
|---|
| 382 | } | 
|---|
| 383 |  | 
|---|
| 384 | bool findLibrary(const QString &name, QString *lib) | 
|---|
| 385 | { | 
|---|
| 386 | if(checkLibrary("", name)) { | 
|---|
| 387 | *lib = ""; | 
|---|
| 388 | return true; | 
|---|
| 389 | } | 
|---|
| 390 | if(checkLibrary("/usr/local/lib", name)) { | 
|---|
| 391 | *lib = "/usr/local/lib"; | 
|---|
| 392 | return true; | 
|---|
| 393 | } | 
|---|
| 394 | return false; | 
|---|
| 395 | } | 
|---|
| 396 |  | 
|---|
| 397 | void addDefine(const QString &str) | 
|---|
| 398 | { | 
|---|
| 399 | if(DEFINES.isEmpty()) | 
|---|
| 400 | DEFINES = str; | 
|---|
| 401 | else | 
|---|
| 402 | DEFINES += QString(" ") + str; | 
|---|
| 403 | } | 
|---|
| 404 |  | 
|---|
| 405 | void addLib(const QString &str) | 
|---|
| 406 | { | 
|---|
| 407 | if(LIBS.isEmpty()) | 
|---|
| 408 | LIBS = str; | 
|---|
| 409 | else | 
|---|
| 410 | LIBS += QString(" ") + str; | 
|---|
| 411 | } | 
|---|
| 412 |  | 
|---|
| 413 | void addIncludePath(const QString &str) | 
|---|
| 414 | { | 
|---|
| 415 | if(INCLUDEPATH.isEmpty()) | 
|---|
| 416 | INCLUDEPATH = str; | 
|---|
| 417 | else | 
|---|
| 418 | INCLUDEPATH += QString(" ") + str; | 
|---|
| 419 | } | 
|---|
| 420 |  | 
|---|
| 421 | void addExtra(const QString &str) | 
|---|
| 422 | { | 
|---|
| 423 | extra += str + '\n'; | 
|---|
| 424 | } | 
|---|
| 425 |  | 
|---|
| 426 | QString DEFINES; | 
|---|
| 427 | QString INCLUDEPATH; | 
|---|
| 428 | QString LIBS; | 
|---|
| 429 | QString extra; | 
|---|
| 430 |  | 
|---|
| 431 | private: | 
|---|
| 432 | ConfObjList list; | 
|---|
| 433 | QDict<QString> vars; | 
|---|
| 434 | QString blank; | 
|---|
| 435 | }; | 
|---|
| 436 |  | 
|---|
| 437 | ConfObj::ConfObj(Conf *c) | 
|---|
| 438 | { | 
|---|
| 439 | conf = c; | 
|---|
| 440 | conf->added(this); | 
|---|
| 441 | required = false; | 
|---|
| 442 | disabled = false; | 
|---|
| 443 | } | 
|---|
| 444 |  | 
|---|
| 445 | ConfObj::~ConfObj() | 
|---|
| 446 | { | 
|---|
| 447 | } | 
|---|
| 448 |  | 
|---|
| 449 | #include"modules.cpp" | 
|---|
| 450 |  | 
|---|
| 451 | //---------------------------------------------------------------------------- | 
|---|
| 452 | // main | 
|---|
| 453 | //---------------------------------------------------------------------------- | 
|---|
| 454 | int main() | 
|---|
| 455 | { | 
|---|
| 456 | Conf *conf = new Conf; | 
|---|
| 457 | ConfObj *o; | 
|---|
| 458 | o = 0; | 
|---|
| 459 | #include"modules_new.cpp" | 
|---|
| 460 |  | 
|---|
| 461 | printf("ok\n"); | 
|---|
| 462 | bool success = false; | 
|---|
| 463 | if(conf->exec()) { | 
|---|
| 464 | QFile f("conf.pri"); | 
|---|
| 465 | if(!f.open(IO_WriteOnly | IO_Truncate)) { | 
|---|
| 466 | printf("Error writing %s\n", f.name().latin1()); | 
|---|
| 467 | return 1; | 
|---|
| 468 | } | 
|---|
| 469 |  | 
|---|
| 470 | QString str; | 
|---|
| 471 | str += "# qconf\n"; | 
|---|
| 472 | str += "QT_PATH_PLUGINS = " + QString(qInstallPathPlugins()) + '\n'; | 
|---|
| 473 | if(!conf->DEFINES.isEmpty()) | 
|---|
| 474 | str += "DEFINES += " + conf->DEFINES + '\n'; | 
|---|
| 475 | if(!conf->INCLUDEPATH.isEmpty()) | 
|---|
| 476 | str += "INCLUDEPATH += " + conf->INCLUDEPATH + '\n'; | 
|---|
| 477 | if(!conf->LIBS.isEmpty()) | 
|---|
| 478 | str += "LIBS += " + conf->LIBS + '\n'; | 
|---|
| 479 | if(!conf->extra.isEmpty()) | 
|---|
| 480 | str += conf->extra; | 
|---|
| 481 | str += '\n'; | 
|---|
| 482 |  | 
|---|
| 483 | char *p = getenv("BINDIR"); | 
|---|
| 484 | if(p) { | 
|---|
| 485 | str += QString("target.path = ") + p + '\n'; | 
|---|
| 486 | str += "INSTALLS += target\n"; | 
|---|
| 487 | } | 
|---|
| 488 |  | 
|---|
| 489 | QCString cs = str.latin1(); | 
|---|
| 490 | f.writeBlock(cs.data(), cs.length()); | 
|---|
| 491 | f.close(); | 
|---|
| 492 | success = true; | 
|---|
| 493 | } | 
|---|
| 494 | delete conf; | 
|---|
| 495 |  | 
|---|
| 496 | if(success) | 
|---|
| 497 | return 0; | 
|---|
| 498 | else | 
|---|
| 499 | return 1; | 
|---|
| 500 | } | 
|---|
| 501 |  | 
|---|
| 502 | EOT | 
|---|
| 503 | cat >$1/conf.pro <<EOT | 
|---|
| 504 | TEMPLATE = app | 
|---|
| 505 | CONFIG += qt x11 thread console | 
|---|
| 506 | TARGET = conf | 
|---|
| 507 |  | 
|---|
| 508 | DEFINES += X11_INC='"\$\$QMAKE_INCDIR_X11"' | 
|---|
| 509 | DEFINES += X11_LIBDIR='"\$\$QMAKE_LIBDIR_X11"' | 
|---|
| 510 | DEFINES += X11_LIB='"\$\$QMAKE_LIBS_X11"' | 
|---|
| 511 | DEFINES += CC='"\$\$QMAKE_CC"' | 
|---|
| 512 |  | 
|---|
| 513 | SOURCES += conf.cpp | 
|---|
| 514 |  | 
|---|
| 515 | EOT | 
|---|
| 516 | } | 
|---|
| 517 |  | 
|---|
| 518 | export QTDIR | 
|---|
| 519 | export QC_WITH_OPENSSL_INC | 
|---|
| 520 | export QC_WITH_OPENSSL_LIB | 
|---|
| 521 | rm -rf .qconftemp | 
|---|
| 522 | ( | 
|---|
| 523 | mkdir .qconftemp | 
|---|
| 524 | gen_files .qconftemp | 
|---|
| 525 | cd .qconftemp | 
|---|
| 526 | $qm conf.pro >/dev/null | 
|---|
| 527 | QTDIR=$QTDIR make clean >/dev/null 2>&1 | 
|---|
| 528 | QTDIR=$QTDIR make >../conf.log 2>&1 | 
|---|
| 529 | ) | 
|---|
| 530 |  | 
|---|
| 531 | if [ "$?" != "0" ]; then | 
|---|
| 532 | rm -rf .qconftemp | 
|---|
| 533 | echo fail | 
|---|
| 534 | echo | 
|---|
| 535 | echo "There was an error compiling 'conf'.  Be sure you have a proper" | 
|---|
| 536 | echo "Qt 3.x Multithreaded (MT) build environment set up." | 
|---|
| 537 | if [ ! -f "$QTDIR/lib/libqt-mt.so.3" ]; then | 
|---|
| 538 | echo | 
|---|
| 539 | echo "One possible reason is that you don't have" | 
|---|
| 540 | echo "libqt-mt.so.3 installed in $QTDIR/lib/." | 
|---|
| 541 | fi | 
|---|
| 542 | echo | 
|---|
| 543 | exit 1; | 
|---|
| 544 | fi | 
|---|
| 545 |  | 
|---|
| 546 | .qconftemp/conf | 
|---|
| 547 | ret="$?" | 
|---|
| 548 | if [ "$ret" = "1" ]; then | 
|---|
| 549 | rm -rf .qconftemp | 
|---|
| 550 | echo | 
|---|
| 551 | exit 1; | 
|---|
| 552 | else | 
|---|
| 553 | if [ "$ret" != "0" ]; then | 
|---|
| 554 | rm -rf .qconftemp | 
|---|
| 555 | echo fail | 
|---|
| 556 | echo | 
|---|
| 557 | echo Unexpected error launching 'conf' | 
|---|
| 558 | echo | 
|---|
| 559 | exit 1; | 
|---|
| 560 | fi | 
|---|
| 561 | fi | 
|---|
| 562 | rm -rf .qconftemp | 
|---|
| 563 |  | 
|---|
| 564 | if [ -x "./qcextra" ]; then | 
|---|
| 565 | ./qcextra | 
|---|
| 566 | fi | 
|---|
| 567 | # run qmake | 
|---|
| 568 | $qm qca-tls.pro | 
|---|
| 569 | if [ "$?" != "0" ]; then | 
|---|
| 570 | echo | 
|---|
| 571 | exit 1; | 
|---|
| 572 | fi | 
|---|
| 573 | cat >Makefile.tmp <<EOT | 
|---|
| 574 | export QTDIR = $QTDIR | 
|---|
| 575 | EOT | 
|---|
| 576 | cat Makefile >> Makefile.tmp | 
|---|
| 577 | rm -f Makefile | 
|---|
| 578 | cp -f Makefile.tmp Makefile | 
|---|
| 579 | rm -f Makefile.tmp | 
|---|
| 580 |  | 
|---|
| 581 | echo | 
|---|
| 582 | echo Good, your configure finished.  Now run \'make\'. | 
|---|
| 583 | echo | 
|---|