$NetBSD: patch-bd,v 1.12 2006/09/11 19:03:50 joerg Exp $ --- kio/kssl/kopenssl.cc.orig 2006-07-22 08:16:39.000000000 +0000 +++ kio/kssl/kopenssl.cc @@ -217,7 +217,7 @@ void KOpenSSLProxy::destroy() { _me = 0L; } -#ifdef __OpenBSD__ +#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) #include #include #include @@ -240,10 +240,20 @@ static QString findMostRecentLib(QString for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { QString numberpart = (*it).mid(s); uint endmaj = numberpart.find('.'); - if (endmaj == -1) - continue; bool ok; - int maj = numberpart.left(endmaj).toInt(&ok); + int maj; + if (endmaj == -1) { + int maj = numberpart.toInt(&ok); + if (!ok) + continue; + if (maj <= bestmaj) + continue; + bestmaj = maj; + bestmin = -1; + best = (*it); + continue; + } + maj = numberpart.left(endmaj).toInt(&ok); if (!ok) continue; int min = numberpart.mid(endmaj+1).toInt(&ok); @@ -280,42 +290,23 @@ KConfig *cfg; delete cfg; -#ifdef __OpenBSD__ - { - QString libname = findMostRecentLib("/usr/lib" KDELIBSUFF, "crypto"); - if (!libname.isNull()) - _cryptoLib = ll->globalLibrary(libname.latin1()); - } -#elif defined(__CYGWIN__) - libpaths << "/usr/bin/" - << "/usr/local/bin" - << "/usr/local/openssl/bin" - << "/opt/openssl/bin" - << "/opt/kde3/bin" - << ""; - - libnamess << "cygssl-0.9.7.dll" - << "cygssl.dll" - << "libssl.dll" - << ""; - - libnamesc << "cygcrypto.dll" - << "libcrypto.dll" - << ""; -#else libpaths - #ifdef _AIX +#ifdef _AIX << "/opt/freeware/lib/" - #endif +#endif << "/usr/lib" KDELIBSUFF "/" + << "/usr/pkg/lib/" +#if !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__DragonFly__) << "/usr/ssl/lib" KDELIBSUFF "/" << "/usr/local/lib" KDELIBSUFF "/" << "/usr/local/openssl/lib" KDELIBSUFF "/" << "/usr/local/ssl/lib" KDELIBSUFF "/" << "/opt/openssl/lib" KDELIBSUFF "/" << "/lib" KDELIBSUFF "/" +#endif << ""; +#if !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(__DragonFly__) // FIXME: #define here for the various OS types to optimize libnamess #ifdef hpux @@ -355,6 +346,11 @@ KConfig *cfg; for (QStringList::Iterator it = libpaths.begin(); it != libpaths.end(); ++it) { +#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) + QString libname = findMostRecentLib(*it, "crypto"); + if (!libname.isNull()) + _cryptoLib = ll->globalLibrary(libname.latin1()); +#else for (QStringList::Iterator shit = libnamesc.begin(); shit != libnamesc.end(); ++shit) { @@ -368,6 +364,7 @@ KConfig *cfg; _cryptoLib = ll->globalLibrary(alib.latin1()); if (_cryptoLib) break; } +#endif if (_cryptoLib) break; } @@ -497,16 +494,14 @@ KConfig *cfg; #endif } -#ifdef __OpenBSD__ - { - QString libname = findMostRecentLib("/usr/lib", "ssl"); - if (!libname.isNull()) - _sslLib = ll->globalLibrary(libname.latin1()); - } -#else for (QStringList::Iterator it = libpaths.begin(); it != libpaths.end(); ++it) { +#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) + QString libname = findMostRecentLib(*it, "ssl"); + if (!libname.isNull()) + _sslLib = ll->globalLibrary(libname.latin1()); +#else for (QStringList::Iterator shit = libnamess.begin(); shit != libnamess.end(); ++shit) { @@ -520,10 +515,10 @@ KConfig *cfg; _sslLib = ll->globalLibrary(alib.latin1()); if (_sslLib) break; } +#endif if (_sslLib) break; } -#endif - + if (_sslLib) { #ifdef KSSL_HAVE_SSL // stand back from your monitor and look at this. it's fun! :)