[evolution-data-server] Bug #642984 - Drop --enable-ssl configure option (nss/nspr always required)



commit b50ab076778f2afa43927555e6c750fbbaa04314
Author: Milan Crha <mcrha redhat com>
Date:   Mon Sep 26 21:42:45 2011 +0200

    Bug #642984 - Drop --enable-ssl configure option (nss/nspr always required)

 camel/camel-http-stream.c                   |    4 -
 camel/camel-msgport.c                       |   24 ---
 camel/camel-msgport.h                       |    2 -
 camel/camel-network-service.c               |   13 --
 camel/camel-operation.c                     |    6 -
 camel/camel-operation.h                     |    2 -
 camel/camel-tcp-stream-ssl.c                |    4 -
 camel/camel-tcp-stream-ssl.h                |    4 -
 camel/camel.c                               |    8 -
 camel/camel.pc.in                           |    2 +-
 camel/providers/imap/camel-imap-store.c     |    8 -
 camel/providers/imapx/camel-imapx-server.c  |    4 -
 camel/providers/pop3/camel-pop3-store.c     |    8 -
 camel/providers/smtp/camel-smtp-transport.c |    8 -
 configure.ac                                |  279 ++++++++++++---------------
 15 files changed, 129 insertions(+), 247 deletions(-)
---
diff --git a/camel/camel-http-stream.c b/camel/camel-http-stream.c
index 167abda..0d2a35f 100644
--- a/camel/camel-http-stream.c
+++ b/camel/camel-http-stream.c
@@ -40,9 +40,7 @@
 #include "camel-stream-buffer.h"
 #include "camel-tcp-stream-raw.h"
 
-#ifdef CAMEL_HAVE_SSL
 #include "camel-tcp-stream-ssl.h"
-#endif
 
 #define SSL_FLAGS (CAMEL_TCP_STREAM_SSL_ENABLE_SSL2 | CAMEL_TCP_STREAM_SSL_ENABLE_SSL3)
 
@@ -72,9 +70,7 @@ http_connect (CamelHttpStream *http,
 	d(printf("connecting to http stream @ '%s'\n", url->host));
 
 	if (!g_ascii_strcasecmp (url->protocol, "https")) {
-#ifdef CAMEL_HAVE_SSL
 		stream = camel_tcp_stream_ssl_new (http->session, url->host, SSL_FLAGS);
-#endif
 	} else {
 		stream = camel_tcp_stream_raw_new ();
 	}
diff --git a/camel/camel-msgport.c b/camel/camel-msgport.c
index 1344c10..23bdf75 100644
--- a/camel/camel-msgport.c
+++ b/camel/camel-msgport.c
@@ -25,9 +25,7 @@
 #include <errno.h>
 #include <unistd.h>
 
-#ifdef CAMEL_HAVE_NSS
 #include <nspr.h>
-#endif
 
 #ifdef G_OS_WIN32
 #define WIN32_LEAN_AND_MEAN
@@ -57,9 +55,7 @@ enum {
 struct _CamelMsgPort {
 	GAsyncQueue *queue;
 	gint pipe[2];  /* on Win32, actually a pair of SOCKETs */
-#ifdef CAMEL_HAVE_NSS
 	PRFileDesc *prpipe[2];
-#endif
 };
 
 static gint
@@ -192,7 +188,6 @@ out0:
 #endif
 }
 
-#ifdef CAMEL_HAVE_NSS
 static gint
 msgport_prpipe (PRFileDesc **fds)
 {
@@ -209,7 +204,6 @@ msgport_prpipe (PRFileDesc **fds)
 
 	return -1;
 }
-#endif
 
 static void
 msgport_sync_with_pipe (gint fd)
@@ -227,7 +221,6 @@ msgport_sync_with_pipe (gint fd)
 	}
 }
 
-#ifdef CAMEL_HAVE_NSS
 static void
 msgport_sync_with_prpipe (PRFileDesc *prfd)
 {
@@ -245,7 +238,6 @@ msgport_sync_with_prpipe (PRFileDesc *prfd)
 		}
 	}
 }
-#endif
 
 /**
  * camel_msgport_new:
@@ -261,10 +253,8 @@ camel_msgport_new (void)
 	msgport->queue = g_async_queue_new ();
 	msgport->pipe[0] = -1;
 	msgport->pipe[1] = -1;
-#ifdef CAMEL_HAVE_NSS
 	msgport->prpipe[0] = NULL;
 	msgport->prpipe[1] = NULL;
-#endif
 
 	return msgport;
 }
@@ -283,12 +273,10 @@ camel_msgport_destroy (CamelMsgPort *msgport)
 		MP_CLOSE (msgport->pipe[0]);
 		MP_CLOSE (msgport->pipe[1]);
 	}
-#ifdef CAMEL_HAVE_NSS
 	if (msgport->prpipe[0] != NULL) {
 		PR_Close (msgport->prpipe[0]);
 		PR_Close (msgport->prpipe[1]);
 	}
-#endif
 
 	g_async_queue_unref (msgport->queue);
 	g_slice_free (CamelMsgPort, msgport);
@@ -315,7 +303,6 @@ camel_msgport_fd (CamelMsgPort *msgport)
 	return fd;
 }
 
-#ifdef CAMEL_HAVE_NSS
 /**
  * camel_msgport_prfd:
  *
@@ -336,7 +323,6 @@ camel_msgport_prfd (CamelMsgPort *msgport)
 
 	return prfd;
 }
-#endif
 
 /**
  * camel_msgport_push:
@@ -348,9 +334,7 @@ camel_msgport_push (CamelMsgPort *msgport,
                     CamelMsg *msg)
 {
 	gint fd;
-#ifdef CAMEL_HAVE_NSS
 	PRFileDesc *prfd;
-#endif
 
 	g_return_if_fail (msgport != NULL);
 	g_return_if_fail (msg != NULL);
@@ -371,7 +355,6 @@ camel_msgport_push (CamelMsgPort *msgport,
 		}
 	}
 
-#ifdef CAMEL_HAVE_NSS
 	prfd = msgport->prpipe[1];
 	while (prfd != NULL) {
 		if (PR_Write (prfd, "E", 1) > 0) {
@@ -385,7 +368,6 @@ camel_msgport_push (CamelMsgPort *msgport,
 			break;
 		}
 	}
-#endif
 
 	g_async_queue_push_unlocked (msgport->queue, msg);
 	g_async_queue_unlock (msgport->queue);
@@ -411,10 +393,8 @@ camel_msgport_pop (CamelMsgPort *msgport)
 
 	if (msg->flags & MSG_FLAG_SYNC_WITH_PIPE)
 		msgport_sync_with_pipe (msgport->pipe[0]);
-#ifdef CAMEL_HAVE_NSS
 	if (msg->flags & MSG_FLAG_SYNC_WITH_PR_PIPE)
 		msgport_sync_with_prpipe (msgport->prpipe[0]);
-#endif
 
 	g_async_queue_unlock (msgport->queue);
 
@@ -439,10 +419,8 @@ camel_msgport_try_pop (CamelMsgPort *msgport)
 
 	if (msg != NULL && msg->flags & MSG_FLAG_SYNC_WITH_PIPE)
 		msgport_sync_with_pipe (msgport->pipe[0]);
-#ifdef CAMEL_HAVE_NSS
 	if (msg != NULL && msg->flags & MSG_FLAG_SYNC_WITH_PR_PIPE)
 		msgport_sync_with_prpipe (msgport->prpipe[0]);
-#endif
 
 	g_async_queue_unlock (msgport->queue);
 
@@ -470,10 +448,8 @@ camel_msgport_timed_pop (CamelMsgPort *msgport,
 
 	if (msg != NULL && msg->flags & MSG_FLAG_SYNC_WITH_PIPE)
 		msgport_sync_with_pipe (msgport->pipe[0]);
-#ifdef CAMEL_HAVE_NSS
 	if (msg != NULL && msg->flags & MSG_FLAG_SYNC_WITH_PR_PIPE)
 		msgport_sync_with_prpipe (msgport->prpipe[0]);
-#endif
 
 	g_async_queue_unlock (msgport->queue);
 
diff --git a/camel/camel-msgport.h b/camel/camel-msgport.h
index 05901d9..5a49a6e 100644
--- a/camel/camel-msgport.h
+++ b/camel/camel-msgport.h
@@ -59,9 +59,7 @@ CamelMsg *	camel_msgport_try_pop		(CamelMsgPort *msgport);
 CamelMsg *	camel_msgport_timed_pop		(CamelMsgPort *msgport, GTimeVal *end_time);
 void		camel_msgport_reply		(CamelMsg *msg);
 
-#ifdef CAMEL_HAVE_NSS
 struct PRFileDesc * camel_msgport_prfd		(CamelMsgPort *msgport);
-#endif
 
 G_END_DECLS
 
diff --git a/camel/camel-network-service.c b/camel/camel-network-service.c
index 7914e7d..c6f5377 100644
--- a/camel/camel-network-service.c
+++ b/camel/camel-network-service.c
@@ -27,9 +27,7 @@
 #include <camel/camel-session.h>
 #include <camel/camel-tcp-stream-raw.h>
 
-#if CAMEL_HAVE_SSL
 #include <camel/camel-tcp-stream-ssl.h>
-#endif
 
 G_DEFINE_INTERFACE (
 	CamelNetworkService,
@@ -77,7 +75,6 @@ network_service_connect_sync (CamelNetworkService *service,
 			stream = camel_tcp_stream_raw_new ();
 			break;
 
-#ifdef CAMEL_HAVE_SSL
 		case CAMEL_NETWORK_SECURITY_METHOD_STARTTLS_ON_STANDARD_PORT:
 			stream = camel_tcp_stream_ssl_new_raw (
 				session, url->host,
@@ -90,16 +87,6 @@ network_service_connect_sync (CamelNetworkService *service,
 				CAMEL_TCP_STREAM_SSL_ENABLE_SSL2 |
 				CAMEL_TCP_STREAM_SSL_ENABLE_SSL3);
 			break;
-#else
-		case CAMEL_NETWORK_SECURITY_METHOD_SSL_ON_ALTERNATE_PORT:
-		case CAMEL_NETWORK_SECURITY_METHOD_STARTTLS_ON_STANDARD_PORT:
-			g_set_error (
-				error, CAMEL_SERVICE_ERROR,
-				CAMEL_SERVICE_ERROR_UNAVAILABLE,
-				_("Could not connect to %s: %s"),
-				url->host, _("SSL unavailable"));
-			return NULL;
-#endif
 
 		default:
 			g_return_val_if_reached (NULL);
diff --git a/camel/camel-operation.c b/camel/camel-operation.c
index d97ba86..87d8dc8 100644
--- a/camel/camel-operation.c
+++ b/camel/camel-operation.c
@@ -23,9 +23,7 @@
 #include <unistd.h>
 #include <sys/time.h>
 
-#ifdef CAMEL_HAVE_NSS
 #include <nspr.h>
-#endif
 
 #include "camel-marshal.h"
 #include "camel-msgport.h"
@@ -50,9 +48,7 @@ struct _CamelOperationPrivate {
 	GQueue status_stack;
 
 	CamelMsgPort *cancel_port;
-#ifdef CAMEL_HAVE_NSS
 	PRFileDesc *cancel_prfd;
-#endif
 };
 
 enum {
@@ -357,7 +353,6 @@ camel_operation_cancel_fd (CamelOperation *operation)
 	return g_cancellable_get_fd (G_CANCELLABLE (operation));
 }
 
-#ifdef CAMEL_HAVE_NSS
 /**
  * camel_operation_cancel_prfd:
  * @operation: a #CamelOperation
@@ -389,7 +384,6 @@ camel_operation_cancel_prfd (CamelOperation *operation)
 
 	return priv->cancel_prfd;
 }
-#endif /* CAMEL_HAVE_NSS */
 
 /**
  * camel_operation_push_message:
diff --git a/camel/camel-operation.h b/camel/camel-operation.h
index ccbaf36..f08e21e 100644
--- a/camel/camel-operation.h
+++ b/camel/camel-operation.h
@@ -74,10 +74,8 @@ void		camel_operation_uncancel	(CamelOperation *operation);
 /* called internally by camel, for the current thread */
 gboolean	camel_operation_cancel_check	(CamelOperation *operation);
 gint		camel_operation_cancel_fd	(CamelOperation *operation);
-#ifdef CAMEL_HAVE_NSS
 struct PRFileDesc *
 		camel_operation_cancel_prfd	(CamelOperation *operation);
-#endif
 
 /* Since Camel methods pass around GCancellable pointers instead of
  * CamelOperation pointers, it's more convenient to callers to take
diff --git a/camel/camel-tcp-stream-ssl.c b/camel/camel-tcp-stream-ssl.c
index 957774d..ff6b57f 100644
--- a/camel/camel-tcp-stream-ssl.c
+++ b/camel/camel-tcp-stream-ssl.c
@@ -28,8 +28,6 @@
 #include <config.h>
 #endif
 
-#ifdef CAMEL_HAVE_NSS
-
 #include <errno.h>
 #include <fcntl.h>
 #include <string.h>
@@ -878,5 +876,3 @@ camel_tcp_stream_ssl_enable_ssl (CamelTcpStreamSSL *ssl,
 
 	return 0;
 }
-
-#endif /* CAMEL_HAVE_NSS */
diff --git a/camel/camel-tcp-stream-ssl.h b/camel/camel-tcp-stream-ssl.h
index b53e899..c8e4a4f 100644
--- a/camel/camel-tcp-stream-ssl.h
+++ b/camel/camel-tcp-stream-ssl.h
@@ -27,8 +27,6 @@
 #ifndef CAMEL_TCP_STREAM_SSL_H
 #define CAMEL_TCP_STREAM_SSL_H
 
-#ifdef CAMEL_HAVE_SSL
-
 #include <camel/camel-enums.h>
 #include <camel/camel-session.h>
 #include <camel/camel-tcp-stream-raw.h>
@@ -79,6 +77,4 @@ gint		camel_tcp_stream_ssl_enable_ssl	(CamelTcpStreamSSL *ssl,
 
 G_END_DECLS
 
-#endif /* CAMEL_HAVE_SSL */
-
 #endif /* CAMEL_TCP_STREAM_SSL_H */
diff --git a/camel/camel.c b/camel/camel.c
index ce26323..acf2ac8 100644
--- a/camel/camel.c
+++ b/camel/camel.c
@@ -27,13 +27,11 @@
 
 #include <signal.h>
 
-#ifdef CAMEL_HAVE_NSS
 #include <nspr.h>
 #include <prthread.h>
 #include "nss.h"      /* Don't use <> here or it will include the system nss.h instead */
 #include <ssl.h>
 #include <errno.h>
-#endif /* CAMEL_HAVE_NSS */
 
 #include <glib/gi18n-lib.h>
 
@@ -43,7 +41,6 @@
 #include "camel-provider.h"
 #include "camel-win32.h"
 
-#ifdef CAMEL_HAVE_NSS
 /* To protect NSS initialization and shutdown. This prevents
  * concurrent calls to shutdown () and init () by different threads */
 PRLock *nss_initlock = NULL;
@@ -53,7 +50,6 @@ PRLock *nss_initlock = NULL;
  * library before. This boolean ensures that we only perform a cleanup
  * if and only if Camel is the one that previously initialized NSS */
 volatile gboolean nss_initialized = FALSE;
-#endif
 
 static gint initialised = FALSE;
 
@@ -98,7 +94,6 @@ camel_init (const gchar *configdir,
 
 	camel_debug_init ();
 
-#ifdef CAMEL_HAVE_NSS
 	if (nss_init) {
 		gchar *nss_configdir = NULL;
 		gchar *nss_sql_configdir = NULL;
@@ -201,7 +196,6 @@ skip_nss_init:
 		g_free (nss_configdir);
 		g_free (nss_sql_configdir);
 	}
-#endif /* CAMEL_HAVE_NSS */
 
 	path = g_strdup_printf ("%s/camel-cert.db", configdir);
 	certdb = camel_certdb_new ();
@@ -242,14 +236,12 @@ camel_shutdown (void)
 
 	/* These next calls must come last. */
 
-#if defined (CAMEL_HAVE_NSS)
 	if (nss_initlock != NULL) {
 		PR_Lock (nss_initlock);
 		if (nss_initialized)
 			NSS_Shutdown ();
 		PR_Unlock (nss_initlock);
 	}
-#endif /* CAMEL_HAVE_NSS */
 
 	initialised = FALSE;
 }
diff --git a/camel/camel.pc.in b/camel/camel.pc.in
index 6a2806e..b3f629c 100644
--- a/camel/camel.pc.in
+++ b/camel/camel.pc.in
@@ -11,4 +11,4 @@ Description: the Evolution MIME message handling library
 Version: @VERSION@
 Requires: gio-2.0 libedataserver- API_VERSION@ sqlite3 @mozilla_nss@ @mozilla_nspr@
 Libs: -L${libdir} -lcamel- API_VERSION@ @MANUAL_NSS_LIBS@
-Cflags: -I${privincludedir} @CAMEL_SSL_DEFINES@ @MANUAL_NSS_CFLAGS@
+Cflags: -I${privincludedir} @MANUAL_NSS_CFLAGS@
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index d6d62e3..4aa299a 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -346,7 +346,6 @@ connect_to_server (CamelService *service,
 	if (method != CAMEL_NETWORK_SECURITY_METHOD_STARTTLS_ON_STANDARD_PORT)
 		return TRUE;  /* we're done */
 
-#ifdef CAMEL_HAVE_SSL
 	/* as soon as we send a STARTTLS command, all hope is lost of a clean QUIT if problems arise */
 	clean_quit = FALSE;
 
@@ -377,13 +376,6 @@ connect_to_server (CamelService *service,
 			url->host);
 		goto exception;
 	}
-#else
-	g_set_error (
-		error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
-		_("Failed to connect to IMAP server %s in secure mode: %s"),
-		url->host, _("SSL is not available in this build"));
-	goto exception;
-#endif /* CAMEL_HAVE_SSL */
 
 	/* rfc2595, section 4 states that after a successful STLS
 	 * command, the client MUST discard prior CAPA responses */
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 12f3881..a1caa17 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -30,12 +30,10 @@
 // fixme, use own type funcs
 #include <ctype.h>
 
-#ifdef CAMEL_HAVE_NSS
 #include <nspr.h>
 #include <prio.h>
 #include <prerror.h>
 #include <prerr.h>
-#endif
 
 #include "camel-imapx-utils.h"
 #include "camel-imapx-stream.h"
@@ -3038,7 +3036,6 @@ imapx_connect_to_server (CamelIMAPXServer *is,
 		camel_imapx_command_free (ic);
 	}
 
-#ifdef CAMEL_HAVE_SSL
 	if (method == CAMEL_NETWORK_SECURITY_METHOD_STARTTLS_ON_STANDARD_PORT) {
 
 		if (!(is->cinfo->capa & IMAPX_CAPABILITY_STARTTLS)) {
@@ -3103,7 +3100,6 @@ imapx_connect_to_server (CamelIMAPXServer *is,
 			camel_imapx_command_free (ic);
 		}
 	}
-#endif
 
 exit:
 	if (local_error != NULL) {
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index e2f60cb..9ee43bb 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -140,7 +140,6 @@ connect_to_server (CamelService *service,
 		return TRUE;
 	}
 
-#ifdef CAMEL_HAVE_SSL
 	/* as soon as we send a STLS command, all hope is lost of a clean QUIT if problems arise */
 	clean_quit = FALSE;
 
@@ -183,13 +182,6 @@ connect_to_server (CamelService *service,
 			url->host);
 		goto stls_exception;
 	}
-#else
-	g_set_error (
-		error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
-		_("Failed to connect to POP server %s in secure mode: %s"),
-		url->host, _("TLS is not available in this build"));
-	goto stls_exception;
-#endif /* CAMEL_HAVE_SSL */
 
 	g_object_unref (tcp_stream);
 
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c
index 5ba3676..330b4c8 100644
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ b/camel/providers/smtp/camel-smtp-transport.c
@@ -184,7 +184,6 @@ connect_to_server (CamelService *service,
 	if (method != CAMEL_NETWORK_SECURITY_METHOD_STARTTLS_ON_STANDARD_PORT)
 		return TRUE;  /* we're done */
 
-#ifdef CAMEL_HAVE_SSL
 	if (!(transport->flags & CAMEL_SMTP_TRANSPORT_STARTTLS)) {
 		g_set_error (
 			error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
@@ -231,13 +230,6 @@ connect_to_server (CamelService *service,
 			url->host);
 		goto exception_cleanup;
 	}
-#else
-	g_set_error (
-		error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
-		_("Failed to connect to SMTP server %s in secure mode: %s"),
-		url->host, _("SSL is not available in this build"));
-	goto exception_cleanup;
-#endif /* CAMEL_HAVE_SSL */
 
 	/* We are supposed to re-EHLO after a successful STARTTLS to
 	 * re-fetch any supported extensions. */
diff --git a/configure.ac b/configure.ac
index 172d181..44fc9fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -641,17 +641,11 @@ dnl needed by Camel (SSL and S/MIME).
 dnl
 dnl The Evolution security extensions are only built if these libraries are found
 dnl ********************************************************************************
-msg_ssl="no"
 msg_smime="no"
 
-AC_ARG_ENABLE([ssl],
-	AS_HELP_STRING([--enable-ssl],
-	[Enable SSL support through Mozilla nss @<:@default=yes@:>@]),
-	[enable_ssl="$enableval"],[enable_ssl="yes"])
-
 AC_ARG_ENABLE([smime],
 	AS_HELP_STRING([--enable-smime],
-	[Enable SMIME support through Mozilla nss @<:@default=yes,requires --enable-ssl@:>@ ]),
+	[Enable SMIME support through Mozilla nss @<:@default=yes@:>@ ]),
 	[enable_smime="$enableval"],[enable_smime="yes"])
 
 AC_ARG_WITH([nspr-includes],
@@ -674,172 +668,157 @@ AC_ARG_WITH([nss-libs],
 	[Prefix of Mozilla nss3 libs.]),
 	[with_nss_libs="$withval"])
 
-if test "x${enable_ssl}" = "xyes"; then
-	if test -n "${with_nspr_includes}" || test -n "${with_nspr_libs}" || test -n "${with_nss_includes}" || test -n "${with_nss_libs}"; then
-		check_manually="yes"
-	else
-		check_manually="no"
-	fi
+if test -n "${with_nspr_includes}" || test -n "${with_nspr_libs}" || test -n "${with_nss_includes}" || test -n "${with_nss_libs}"; then
+	check_manually="yes"
+else
+	check_manually="no"
+fi
 
 dnl check if pkg-config files exist (which are only shipped by distributions, not upstream)
-	if test "x${check_manually}" = "xno"; then
-		AC_MSG_CHECKING(Mozilla NSPR pkg-config module name)
-		mozilla_nspr_pcs="nspr mozilla-nspr firefox-nspr xulrunner-nspr seamonkey-nspr"
-		for pc in $mozilla_nspr_pcs; do
-			if $PKG_CONFIG --exists $pc; then
-				AC_MSG_RESULT($pc)
-				mozilla_nspr=$pc
-				break;
-			fi
-		done
-
-		AC_MSG_CHECKING(Mozilla NSS pkg-config module name)
-		mozilla_nss_pcs="nss mozilla-nss firefox-nss xulrunner-nss seamonkey-nss"
-		for pc in $mozilla_nss_pcs; do
-			if $PKG_CONFIG --exists $pc; then
-				AC_MSG_RESULT($pc)
-				mozilla_nss=$pc
-				break;
-			fi
-		done
+if test "x${check_manually}" = "xno"; then
+	AC_MSG_CHECKING(Mozilla NSPR pkg-config module name)
+	mozilla_nspr_pcs="nspr mozilla-nspr firefox-nspr xulrunner-nspr seamonkey-nspr"
+	for pc in $mozilla_nspr_pcs; do
+		if $PKG_CONFIG --exists $pc; then
+			AC_MSG_RESULT($pc)
+			mozilla_nspr=$pc
+			break;
+		fi
+	done
+
+	AC_MSG_CHECKING(Mozilla NSS pkg-config module name)
+	mozilla_nss_pcs="nss mozilla-nss firefox-nss xulrunner-nss seamonkey-nss"
+	for pc in $mozilla_nss_pcs; do
+		if $PKG_CONFIG --exists $pc; then
+			AC_MSG_RESULT($pc)
+			mozilla_nss=$pc
+			break;
+		fi
+	done
 
-		if test -n "$mozilla_nspr" -a -n "$mozilla_nss"; then
-			msg_ssl="yes"
-			if test "x$enable_smime" = "xyes"; then
-				AC_DEFINE(ENABLE_SMIME,1,[Define if SMIME should be enabled])
-				msg_smime="yes"
-			fi
-			AC_DEFINE(CAMEL_HAVE_NSS,1,[Define if you have NSS])
-			AC_DEFINE(CAMEL_HAVE_SSL,1,[Define if you have a supported SSL library])
-			MANUAL_NSPR_CFLAGS=""
-			MANUAL_NSPR_LIBS=""
-			MANUAL_NSS_CFLAGS=""
-			MANUAL_NSS_LIBS=""
-		else
-			check_manually="yes"
-			mozilla_nspr=""
-			mozilla_nss=""
+	if test -n "$mozilla_nspr" -a -n "$mozilla_nss"; then
+		if test "x$enable_smime" = "xyes"; then
+			AC_DEFINE(ENABLE_SMIME,1,[Define if SMIME should be enabled])
+			msg_smime="yes"
 		fi
+		MANUAL_NSPR_CFLAGS=""
+		MANUAL_NSPR_LIBS=""
+		MANUAL_NSS_CFLAGS=""
+		MANUAL_NSS_LIBS=""
+	else
+		check_manually="yes"
+		mozilla_nspr=""
+		mozilla_nss=""
 	fi
+fi
 
-	if test "x${check_manually}" = "xyes"; then
-	dnl ******************
-	dnl Check for NSPR 4
-	dnl ******************
-		AC_MSG_CHECKING([for Mozilla nspr4 includes])
-			CPPFLAGS_save="$CPPFLAGS"
-			if test -n "$with_nspr_includes"; then
-				CPPFLAGS="$CPPFLAGS -I$with_nspr_includes"
-			fi
+if test "x${check_manually}" = "xyes"; then
+dnl ******************
+dnl Check for NSPR 4
+dnl ******************
+	AC_MSG_CHECKING([for Mozilla nspr4 includes])
+		CPPFLAGS_save="$CPPFLAGS"
+		if test -n "$with_nspr_includes"; then
+			CPPFLAGS="$CPPFLAGS -I$with_nspr_includes"
+		fi
 
-			AC_CHECK_HEADERS(nspr.h prio.h,
-			[moz_nspr_includes="yes"],[moz_nspr_includes="no"])
-			CPPFLAGS="$CPPFLAGS_save"
+		AC_CHECK_HEADERS(nspr.h prio.h,
+		[moz_nspr_includes="yes"],[moz_nspr_includes="no"])
+		CPPFLAGS="$CPPFLAGS_save"
 
-			if test "x${moz_nspr_includes}" = "xyes"; then
-				MANUAL_NSPR_CFLAGS="-I$with_nspr_includes"
-			else
-				AC_MSG_FAILURE([NSPR headers not found. Use --with-nspr-includes to specify the include dir of NSPR.])
-			fi
-		AC_MSG_RESULT([$moz_nspr_includes])
+		if test "x${moz_nspr_includes}" = "xyes"; then
+			MANUAL_NSPR_CFLAGS="-I$with_nspr_includes"
+		else
+			AC_MSG_FAILURE([NSPR headers not found. Use --with-nspr-includes to specify the include dir of NSPR.])
+		fi
+	AC_MSG_RESULT([$moz_nspr_includes])
+
+	AC_MSG_CHECKING([for Mozilla nspr libraries])
+		CFLAGS_save="$CFLAGS"
+		LDFLAGS_save="$LDFLAGS"
+		LIBS_save="$LIBS"
+		nsprlibs="$DL_LIB -lplc4 -lplds4 -lnspr4"
+
+		CFLAGS="$CFLAGS $MANUAL_NSPR_CFLAGS"
+		LIBS="$nsprlibs"
+		dnl Test to protect from giving libtool an -L , which results in failure (used below,too)
+		if test -n "${with_nspr_libs}"; then
+			LDFLAGS="$LDFLAGS -L$with_nspr_libs"
+		else
+			LDFLAGS="$LDFLAGS"
+		fi
 
-		AC_MSG_CHECKING([for Mozilla nspr libraries])
-			CFLAGS_save="$CFLAGS"
-			LDFLAGS_save="$LDFLAGS"
-			LIBS_save="$LIBS"
-			nsprlibs="$DL_LIB -lplc4 -lplds4 -lnspr4"
+		AC_LINK_IFELSE([AC_LANG_CALL([],[PR_Init])],
+		[moz_nspr_libs="yes"],[moz_nspr_libs="no"])
 
-			CFLAGS="$CFLAGS $MANUAL_NSPR_CFLAGS"
-			LIBS="$nsprlibs"
-			dnl Test to protect from giving libtool an -L , which results in failure (used below,too)
+		CFLAGS="$CFLAGS_save"
+		LDFLAGS="$LDFLAGS_save"
+		LIBS="$LIBS_save"
+
+		if test "x${moz_nspr_libs}" = "xyes"; then
 			if test -n "${with_nspr_libs}"; then
-				LDFLAGS="$LDFLAGS -L$with_nspr_libs"
+				MANUAL_NSPR_LIBS="-L$with_nspr_libs $nsprlibs"
 			else
-				LDFLAGS="$LDFLAGS"
+				MANUAL_NSPR_LIBS="$nsprlibs"
 			fi
+		else
+			AC_MSG_FAILURE([NSPR libs not found. Use --with-nspr-libs to specify the libdir of NSPR.])
+		fi
+	AC_MSG_RESULT([$moz_nspr_libs])
 
-			AC_LINK_IFELSE([AC_LANG_CALL([],[PR_Init])],
-			[moz_nspr_libs="yes"],[moz_nspr_libs="no"])
-
-			CFLAGS="$CFLAGS_save"
-			LDFLAGS="$LDFLAGS_save"
-			LIBS="$LIBS_save"
+dnl *****************
+dnl Check for NSS 3
+dnl *****************
+	AC_MSG_CHECKING([for Mozilla nss3 includes])
+		CPPFLAGS_save="$CPPFLAGS"
+		CPPFLAGS="$CPPFLAGS -I$with_nspr_includes -I$with_nss_includes"
 
-			if test "x${moz_nspr_libs}" = "xyes"; then
-				if test -n "${with_nspr_libs}"; then
-					MANUAL_NSPR_LIBS="-L$with_nspr_libs $nsprlibs"
-				else
-					MANUAL_NSPR_LIBS="$nsprlibs"
-				fi
-			else
-				AC_MSG_FAILURE([NSPR libs not found. Use --with-nspr-libs to specify the libdir of NSPR.])
-			fi
-		AC_MSG_RESULT([$moz_nspr_libs])
+		AC_CHECK_HEADERS(nss.h ssl.h smime.h,
+		[moz_nss_includes="yes"],[moz_nss_includes="no"])
+		CPPFLAGS="$CPPFLAGS_save"
 
-	dnl *****************
-	dnl Check for NSS 3
-	dnl *****************
-		AC_MSG_CHECKING([for Mozilla nss3 includes])
-			CPPFLAGS_save="$CPPFLAGS"
-			CPPFLAGS="$CPPFLAGS -I$with_nspr_includes -I$with_nss_includes"
+		if test "x${moz_nss_includes}" = "xyes"; then
+			MANUAL_NSS_CFLAGS="-I$with_nss_includes"
+		else
+			AC_MSG_FAILURE([NSS headers not found. Use --with-nss-includes to specify the include dir of NSS.])
+		fi
+	AC_MSG_RESULT($moz_nss_includes)
 
-			AC_CHECK_HEADERS(nss.h ssl.h smime.h,
-			[moz_nss_includes="yes"],[moz_nss_includes="no"])
-			CPPFLAGS="$CPPFLAGS_save"
+	AC_MSG_CHECKING([for Mozilla nss libraries])
+		LDFLAGS_save="$LDFLAGS"
+		LIBS_save="$LIBS"
+		nsslibs="-lssl3 -lsmime3 -lnss3"
 
-			if test "x${moz_nss_includes}" = "xyes"; then
-				MANUAL_NSS_CFLAGS="-I$with_nss_includes"
-			else
-				AC_MSG_FAILURE([NSS headers not found. Use --with-nss-includes to specify the include dir of NSS.])
-			fi
-		AC_MSG_RESULT($moz_nss_includes)
+		LIBS="$nsslibs $nsprlibs"
+		dnl Test to protect from giving libtool an -L , which results in failure (used below,too)
+		if test -n "${with_nss_libs}"; then
+			LDFLAGS="$LDFLAGS -L$with_nss_libs $MANUAL_NSPR_LIBS"
+		else
+			LDFLAGS="$LDFLAGS $LDFLAGS_NSPR $MANUAL_NSPR_LIBS"
+		fi
 
-		AC_MSG_CHECKING([for Mozilla nss libraries])
-			LDFLAGS_save="$LDFLAGS"
-			LIBS_save="$LIBS"
-			nsslibs="-lssl3 -lsmime3 -lnss3"
+		AC_LINK_IFELSE([AC_LANG_CALL([],[NSS_Init])],
+		[moz_nss_libs="yes"],[moz_nss_libs="no"])
+		LDFLAGS="$LDFLAGS_save"
+		LIBS="$LIBS_save"
 
-			LIBS="$nsslibs $nsprlibs"
-			dnl Test to protect from giving libtool an -L , which results in failure (used below,too)
-			if test -n "${with_nss_libs}"; then
-				LDFLAGS="$LDFLAGS -L$with_nss_libs $MANUAL_NSPR_LIBS"
-			else
-				LDFLAGS="$LDFLAGS $LDFLAGS_NSPR $MANUAL_NSPR_LIBS"
+		if test "x${moz_nss_libs}" = "xyes"; then
+			if test "x${enable_smime}" = "xyes"; then
+				AC_DEFINE(ENABLE_SMIME,1,[Define if SMIME should be enabled])
+				msg_smime="yes"
 			fi
-
-			AC_LINK_IFELSE([AC_LANG_CALL([],[NSS_Init])],
-			[moz_nss_libs="yes"],[moz_nss_libs="no"])
-			LDFLAGS="$LDFLAGS_save"
-			LIBS="$LIBS_save"
-
-			if test "x${moz_nss_libs}" = "xyes"; then
-				AC_DEFINE(CAMEL_HAVE_NSS)
-				AC_DEFINE(CAMEL_HAVE_SSL)
-				msg_ssl="yes"
-				if test "x${enable_smime}" = "xyes"; then
-					AC_DEFINE(ENABLE_SMIME,1,[Define if SMIME should be enabled])
-					msg_smime="yes"
-				fi
-				if test -n "${with_nss_libs}"; then
-					MANUAL_NSS_LIBS="-L$with_nss_libs $nsslibs"
-				else
-					MANUAL_NSS_LIBS="$nsslibs"
-				fi
+			if test -n "${with_nss_libs}"; then
+				MANUAL_NSS_LIBS="-L$with_nss_libs $nsslibs"
 			else
-				AC_MSG_FAILURE([NSS libs not found. Use --with-nss-libs to specify the libdir of NSS.])
+				MANUAL_NSS_LIBS="$nsslibs"
 			fi
-		AC_MSG_RESULT([$moz_nss_libs])
-
-		MANUAL_NSS_CFLAGS="$MANUAL_NSPR_CFLAGS $MANUAL_NSS_CFLAGS"
-		MANUAL_NSS_LIBS="$MANUAL_NSPR_LIBS $MANUAL_NSS_LIBS"
-	fi
-fi
+		else
+			AC_MSG_FAILURE([NSS libs not found. Use --with-nss-libs to specify the libdir of NSS.])
+		fi
+	AC_MSG_RESULT([$moz_nss_libs])
 
-dnl These flags are used in camel.pc.in.
-if test "x${msg_ssl}" = "xyes"; then
-	CAMEL_SSL_DEFINES="-DCAMEL_HAVE_NSS -DCAMEL_HAVE_SSL"
-else
-	CAMEL_SSL_DEFINES=""
+	MANUAL_NSS_CFLAGS="$MANUAL_NSPR_CFLAGS $MANUAL_NSS_CFLAGS"
+	MANUAL_NSS_LIBS="$MANUAL_NSPR_LIBS $MANUAL_NSS_LIBS"
 fi
 
 AM_CONDITIONAL(ENABLE_SMIME, test "x$msg_smime" != "xno")
@@ -848,7 +827,6 @@ dnl For pkgconfig files.
 AC_SUBST(mozilla_nss)
 AC_SUBST(mozilla_nspr)
 
-AC_SUBST(CAMEL_SSL_DEFINES)
 AC_SUBST(MANUAL_NSPR_CFLAGS)
 AC_SUBST(MANUAL_NSPR_LIBS)
 AC_SUBST(MANUAL_NSS_CFLAGS)
@@ -1657,7 +1635,6 @@ echo "
 	LDAP support:		$msg_ldap
 	NNTP support:		$msg_nntp
 	Kerberos 5:		$msg_krb5
-	SSL support:		$msg_ssl
 	SMIME support:		$msg_smime
 	IPv6 support:		$msg_ipv6
 	Dot Locking:		$msg_dot



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]