changeset 24236:e39cafdbe089

Only build SSL plugins if the corresponding library is present. Previously, stub versions of the plugins were built which refused to load if the corresponding library was missing, which seems ... unconventional to me.
author Will Thompson <will.thompson@collabora.co.uk>
date Sat, 25 Oct 2008 14:33:54 +0000
parents 9fc78d436de3
children 7ed27ecdab51 b0f0f830f15f
files libpurple/plugins/ssl/Makefile.am libpurple/plugins/ssl/ssl-gnutls.c libpurple/plugins/ssl/ssl-nss.c
diffstat 3 files changed, 21 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/plugins/ssl/Makefile.am	Sat Oct 25 14:26:30 2008 +0000
+++ b/libpurple/plugins/ssl/Makefile.am	Sat Oct 25 14:33:54 2008 +0000
@@ -9,10 +9,31 @@
 
 if PLUGINS
 
+# I'm sorry to report that Automake Conditionals don't support
+#   if USE_GNUTLS && USE_NSS
+# but only support testing a single variable. Hence:
+
+if USE_GNUTLS
+if USE_NSS
 plugin_LTLIBRARIES = \
 	ssl.la           \
 	ssl-gnutls.la    \
 	ssl-nss.la
+else
+plugin_LTLIBRARIES = \
+	ssl.la           \
+	ssl-gnutls.la
+endif
+else
+if USE_NSS
+plugin_LTLIBRARIES = \
+	ssl.la           \
+	ssl-nss.la
+else
+plugin_LTLIBRARIES = \
+	ssl.la
+endif
+endif
 
 ssl_la_SOURCES        = ssl.c
 ssl_gnutls_la_SOURCES = ssl-gnutls.c
--- a/libpurple/plugins/ssl/ssl-gnutls.c	Sat Oct 25 14:26:30 2008 +0000
+++ b/libpurple/plugins/ssl/ssl-gnutls.c	Sat Oct 25 14:33:54 2008 +0000
@@ -29,8 +29,6 @@
 
 #define SSL_GNUTLS_PLUGIN_ID "ssl-gnutls"
 
-#ifdef HAVE_GNUTLS
-
 #include <gnutls/gnutls.h>
 #include <gnutls/x509.h>
 
@@ -943,12 +941,9 @@
 	NULL
 };
 
-#endif /* HAVE_GNUTLS */
-
 static gboolean
 plugin_load(PurplePlugin *plugin)
 {
-#ifdef HAVE_GNUTLS
 	if(!purple_ssl_get_ops()) {
 		purple_ssl_set_ops(&ssl_ops);
 	}
@@ -960,21 +955,16 @@
 	purple_certificate_register_scheme( &x509_gnutls );
 
 	return TRUE;
-#else
-	return FALSE;
-#endif
 }
 
 static gboolean
 plugin_unload(PurplePlugin *plugin)
 {
-#ifdef HAVE_GNUTLS
 	if(purple_ssl_get_ops() == &ssl_ops) {
 		purple_ssl_set_ops(NULL);
 	}
 
 	purple_certificate_unregister_scheme( &x509_gnutls );
-#endif
 
 	return TRUE;
 }
--- a/libpurple/plugins/ssl/ssl-nss.c	Sat Oct 25 14:26:30 2008 +0000
+++ b/libpurple/plugins/ssl/ssl-nss.c	Sat Oct 25 14:33:54 2008 +0000
@@ -29,8 +29,6 @@
 
 #define SSL_NSS_PLUGIN_ID "ssl-nss"
 
-#ifdef HAVE_NSS
-
 #undef HAVE_LONG_LONG /* Make Mozilla less angry. If angry, Mozilla SMASH! */
 
 #include <nspr.h>
@@ -891,13 +889,10 @@
 	NULL
 };
 
-#endif /* HAVE_NSS */
-
 
 static gboolean
 plugin_load(PurplePlugin *plugin)
 {
-#ifdef HAVE_NSS
 	if (!purple_ssl_get_ops()) {
 		purple_ssl_set_ops(&ssl_ops);
 	}
@@ -909,22 +904,17 @@
 	purple_certificate_register_scheme(&x509_nss);
 
 	return TRUE;
-#else
-	return FALSE;
-#endif
 }
 
 static gboolean
 plugin_unload(PurplePlugin *plugin)
 {
-#ifdef HAVE_NSS
 	if (purple_ssl_get_ops() == &ssl_ops) {
 		purple_ssl_set_ops(NULL);
 	}
 
 	/* Unregister our X.509 functions */
 	purple_certificate_unregister_scheme(&x509_nss);
-#endif
 
 	return TRUE;
 }