From 699a8b2fc82949bfd5a39acc5b00670a5c350b4d Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 18 Jun 2011 17:25:35 -0400 Subject: Fix extras compilation under Windows --- src/modules/extra/m_geoip.cpp | 11 +++++++++-- src/modules/extra/m_ldapauth.cpp | 5 +++++ src/modules/extra/m_ldapoper.cpp | 5 +++++ src/modules/extra/m_mysql.cpp | 4 +++- src/modules/extra/m_regex_pcre.cpp | 2 +- src/modules/extra/m_ssl_gnutls.cpp | 8 ++------ src/modules/extra/m_ssl_openssl.cpp | 13 +++++++++---- 7 files changed, 34 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/modules/extra/m_geoip.cpp b/src/modules/extra/m_geoip.cpp index cdd269003..5b78be88b 100644 --- a/src/modules/extra/m_geoip.cpp +++ b/src/modules/extra/m_geoip.cpp @@ -16,6 +16,10 @@ #include +#ifdef WINDOWS +# pragma comment(lib, "GeoIP.lib") +#endif + /* $ModDesc: Provides a way to restrict users by country using GeoIP lookup */ /* $LinkerFlags: -lGeoIP */ @@ -25,13 +29,16 @@ class ModuleGeoIP : public Module GeoIP* gi; public: - ModuleGeoIP() : ext("geoip_cc", this) + ModuleGeoIP() : ext("geoip_cc", this), gi(NULL) { - gi = GeoIP_new(GEOIP_STANDARD); } void init() { + gi = GeoIP_new(GEOIP_STANDARD); + if (gi == NULL) + throw ModuleException("Unable to initialize geoip, are you missing GeoIP.dat?"); + ServerInstance->Modules->AddService(ext); Implementation eventlist[] = { I_OnSetConnectClass }; ServerInstance->Modules->Attach(eventlist, this, 1); diff --git a/src/modules/extra/m_ldapauth.cpp b/src/modules/extra/m_ldapauth.cpp index 85a0181c4..4fae7a2e7 100644 --- a/src/modules/extra/m_ldapauth.cpp +++ b/src/modules/extra/m_ldapauth.cpp @@ -28,6 +28,11 @@ #include +#ifdef WINDOWS +# pragma comment(lib, "ldap.lib") +# pragma comment(lib, "lber.lib") +#endif + /* $ModDesc: Allow/Deny connections based upon answer from LDAP server */ /* $LinkerFlags: -lldap */ diff --git a/src/modules/extra/m_ldapoper.cpp b/src/modules/extra/m_ldapoper.cpp index 45f03aa8e..77e5989db 100644 --- a/src/modules/extra/m_ldapoper.cpp +++ b/src/modules/extra/m_ldapoper.cpp @@ -28,6 +28,11 @@ #include +#ifdef WINDOWS +# pragma comment(lib, "ldap.lib") +# pragma comment(lib, "lber.lib") +#endif + /* $ModDesc: Allow/Deny connections based upon answer from LDAP server */ /* $LinkerFlags: -lldap */ diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index 1eb65794d..d9df1ed61 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -19,7 +19,9 @@ #include "sql.h" #ifdef WINDOWS -#pragma comment(lib, "mysqlclient.lib") +# pragma comment(lib, "mysqlclient.lib") +# pragma comment(lib, "advapi32.lib") +# pragma comment(linker, "/NODEFAULTLIB:LIBCMT") #endif /* VERSION 3 API: With nonblocking (threaded) requests */ diff --git a/src/modules/extra/m_regex_pcre.cpp b/src/modules/extra/m_regex_pcre.cpp index 095513782..99f62a2c2 100644 --- a/src/modules/extra/m_regex_pcre.cpp +++ b/src/modules/extra/m_regex_pcre.cpp @@ -21,7 +21,7 @@ /* $LinkerFlags: exec("pcre-config --libs") rpath("pcre-config --libs") -lpcre */ #ifdef WINDOWS -#pragma comment(lib, "pcre.lib") +# pragma comment(lib, "libpcre.lib") #endif class PCREException : public ModuleException diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index ff7a1654b..95638417b 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -18,10 +18,6 @@ #include "ssl.h" #include "m_cap.h" -#ifdef WINDOWS -#pragma comment(lib, "libgnutls-13.lib") -#endif - /* $ModDesc: Provides SSL support for clients */ /* $CompileFlags: pkgconfincludes("gnutls","/gnutls/gnutls.h","") */ /* $LinkerFlags: rpath("pkg-config --libs gnutls") pkgconflibs("gnutls","/libgnutls.so","-lgnutls") */ @@ -50,7 +46,7 @@ static ssize_t gnutls_pull_wrapper(gnutls_transport_ptr_t user_wrap, void* buffe errno = EAGAIN; return -1; } - int rv = recv(user->GetFd(), buffer, size, 0); + int rv = recv(user->GetFd(), reinterpret_cast(buffer), size, 0); if (rv < (int)size) ServerInstance->SE->ChangeEventMask(user, FD_READ_WILL_BLOCK); return rv; @@ -64,7 +60,7 @@ static ssize_t gnutls_push_wrapper(gnutls_transport_ptr_t user_wrap, const void* errno = EAGAIN; return -1; } - int rv = send(user->GetFd(), buffer, size, 0); + int rv = send(user->GetFd(), reinterpret_cast(buffer), size, 0); if (rv < (int)size) ServerInstance->SE->ChangeEventMask(user, FD_WRITE_WILL_BLOCK); return rv; diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index d163cebb7..7cae1a344 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -17,10 +17,15 @@ #include "ssl.h" #ifdef WINDOWS -#pragma comment(lib, "libeay32MTd") -#pragma comment(lib, "ssleay32MTd") -#undef MAX_DESCRIPTORS -#define MAX_DESCRIPTORS 10000 +# pragma comment(lib, "libcrypto.lib") +# pragma comment(lib, "libssl.lib") +# pragma comment(lib, "user32.lib") +# pragma comment(lib, "advapi32.lib") +# pragma comment(lib, "libgcc.lib") +# pragma comment(lib, "libmingwex.lib") +# pragma comment(lib, "gdi32.lib") +# undef MAX_DESCRIPTORS +# define MAX_DESCRIPTORS 10000 #endif /* $ModDesc: Provides SSL support for clients */ -- cgit v1.2.3