Bug 625039 - Commonly named macros in Camel header files
authorMatthew Barnes <mbarnes@redhat.com>
Thu, 29 Jul 2010 01:53:58 +0000 (21:53 -0400)
committerMatthew Barnes <mbarnes@redhat.com>
Thu, 29 Jul 2010 01:53:58 +0000 (21:53 -0400)
15 files changed:
camel/camel-http-stream.c
camel/camel-msgport.c
camel/camel-msgport.h
camel/camel-operation.c
camel/camel-operation.h
camel/camel-tcp-stream-ssl.c
camel/camel-tcp-stream-ssl.h
camel/camel.c
camel/camel.pc.in
camel/providers/imap/camel-imap-store.c
camel/providers/imapx/camel-imapx-server.c
camel/providers/nntp/camel-nntp-store.c
camel/providers/pop3/camel-pop3-store.c
camel/providers/smtp/camel-smtp-transport.c
configure.ac

index efa0486..506b11d 100644 (file)
@@ -38,7 +38,7 @@
 #include "camel-stream-buffer.h"
 #include "camel-tcp-stream-raw.h"
 
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
 #include "camel-tcp-stream-ssl.h"
 #endif
 
@@ -67,7 +67,7 @@ http_connect (CamelHttpStream *http,
        d(printf("connecting to http stream @ '%s'\n", url->host));
 
        if (!g_ascii_strcasecmp (url->protocol, "https")) {
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
                stream = camel_tcp_stream_ssl_new (http->session, url->host, SSL_FLAGS);
 #endif
        } else {
index 43d4b6a..fb8a28d 100644 (file)
@@ -25,7 +25,7 @@
 #include <errno.h>
 #include <unistd.h>
 
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
 #include <nspr.h>
 #endif
 
@@ -59,7 +59,7 @@ enum {
 struct _CamelMsgPort {
        GAsyncQueue *queue;
        gint pipe[2];  /* on Win32, actually a pair of SOCKETs */
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
        PRFileDesc *prpipe[2];
 #endif
 };
@@ -194,7 +194,7 @@ out0:
 #endif
 }
 
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
 static gint
 msgport_prpipe (PRFileDesc **fds)
 {
@@ -229,7 +229,7 @@ msgport_sync_with_pipe (gint fd)
        }
 }
 
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
 static void
 msgport_sync_with_prpipe (PRFileDesc *prfd)
 {
@@ -263,7 +263,7 @@ camel_msgport_new (void)
        msgport->queue = g_async_queue_new ();
        msgport->pipe[0] = -1;
        msgport->pipe[1] = -1;
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
        msgport->prpipe[0] = NULL;
        msgport->prpipe[1] = NULL;
 #endif
@@ -285,7 +285,7 @@ camel_msgport_destroy (CamelMsgPort *msgport)
                MP_CLOSE (msgport->pipe[0]);
                MP_CLOSE (msgport->pipe[1]);
        }
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
        if (msgport->prpipe[0] != NULL) {
                PR_Close (msgport->prpipe[0]);
                PR_Close (msgport->prpipe[1]);
@@ -317,7 +317,7 @@ camel_msgport_fd (CamelMsgPort *msgport)
        return fd;
 }
 
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
 /**
  * camel_msgport_prfd:
  *
@@ -349,7 +349,7 @@ void
 camel_msgport_push (CamelMsgPort *msgport, CamelMsg *msg)
 {
        gint fd;
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
        PRFileDesc *prfd;
 #endif
 
@@ -372,7 +372,7 @@ camel_msgport_push (CamelMsgPort *msgport, CamelMsg *msg)
                }
        }
 
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
        prfd = msgport->prpipe[1];
        while (prfd != NULL) {
                if (PR_Write (prfd, "E", 1) > 0) {
@@ -412,7 +412,7 @@ camel_msgport_pop (CamelMsgPort *msgport)
 
        if (msg->flags & MSG_FLAG_SYNC_WITH_PIPE)
                msgport_sync_with_pipe (msgport->pipe[0]);
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
        if (msg->flags & MSG_FLAG_SYNC_WITH_PR_PIPE)
                msgport_sync_with_prpipe (msgport->prpipe[0]);
 #endif
@@ -440,7 +440,7 @@ camel_msgport_try_pop (CamelMsgPort *msgport)
 
        if (msg != NULL && msg->flags & MSG_FLAG_SYNC_WITH_PIPE)
                msgport_sync_with_pipe (msgport->pipe[0]);
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
        if (msg != NULL && msg->flags & MSG_FLAG_SYNC_WITH_PR_PIPE)
                msgport_sync_with_prpipe (msgport->prpipe[0]);
 #endif
@@ -470,7 +470,7 @@ camel_msgport_timed_pop (CamelMsgPort *msgport, GTimeVal *end_time)
 
        if (msg != NULL && msg->flags & MSG_FLAG_SYNC_WITH_PIPE)
                msgport_sync_with_pipe (msgport->pipe[0]);
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
        if (msg != NULL && msg->flags & MSG_FLAG_SYNC_WITH_PR_PIPE)
                msgport_sync_with_prpipe (msgport->prpipe[0]);
 #endif
index 975517b..368b087 100644 (file)
@@ -60,7 +60,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 HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
 struct PRFileDesc * camel_msgport_prfd         (CamelMsgPort *msgport);
 #endif
 
index f8f68e4..45b832e 100644 (file)
@@ -28,7 +28,7 @@
 #include <unistd.h>
 #include <sys/time.h>
 
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
 #include <nspr.h>
 #endif
 
@@ -66,7 +66,7 @@ struct _CamelOperation {
 
        CamelMsgPort *cancel_port;
        gint cancel_fd;
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
        PRFileDesc *cancel_prfd;
 #endif
 };
@@ -398,7 +398,7 @@ camel_operation_cancel_fd (CamelOperation *cc)
        return cc->cancel_fd;
 }
 
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
 /**
  * camel_operation_cancel_prfd:
  * @cc: operation context
@@ -427,7 +427,7 @@ camel_operation_cancel_prfd (CamelOperation *cc)
 
        return cc->cancel_prfd;
 }
-#endif /* HAVE_NSS */
+#endif /* CAMEL_HAVE_NSS */
 
 /**
  * camel_operation_start:
index 7803fb7..1d05cfb 100644 (file)
@@ -55,7 +55,7 @@ void camel_operation_unregister (CamelOperation *cc);
 /* called internally by camel, for the current thread */
 gint camel_operation_cancel_check(CamelOperation *cc);
 gint camel_operation_cancel_fd(CamelOperation *cc);
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
 struct PRFileDesc *camel_operation_cancel_prfd(CamelOperation *cc);
 #endif
 /* return the registered operation for this thread, if there is one */
index cf386f7..72e0af2 100644 (file)
@@ -28,7 +28,7 @@
 #include <config.h>
 #endif
 
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
 
 #include <errno.h>
 #include <fcntl.h>
@@ -1525,4 +1525,4 @@ camel_tcp_stream_ssl_enable_ssl (CamelTcpStreamSSL *ssl)
        return 0;
 }
 
-#endif /* HAVE_NSS */
+#endif /* CAMEL_HAVE_NSS */
index 928f578..74b1174 100644 (file)
@@ -27,7 +27,7 @@
 #ifndef CAMEL_TCP_STREAM_SSL_H
 #define CAMEL_TCP_STREAM_SSL_H
 
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
 
 #include <camel/camel-tcp-stream.h>
 #include <prio.h>
@@ -85,6 +85,6 @@ PRFileDesc * camel_tcp_stream_ssl_sockfd (CamelTcpStreamSSL *stream);
 
 G_END_DECLS
 
-#endif /* HAVE_SSL */
+#endif /* CAMEL_HAVE_SSL */
 
 #endif /* CAMEL_TCP_STREAM_SSL_H */
index 6dadaad..1989e6f 100644 (file)
 
 #include <signal.h>
 
-#ifdef HAVE_NSS
+#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 /* HAVE_NSS */
+#endif /* CAMEL_HAVE_NSS */
 
 #include <glib/gi18n-lib.h>
 
@@ -43,7 +43,7 @@
 #include "camel-provider.h"
 #include "camel-win32.h"
 
-#ifdef HAVE_NSS
+#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;
@@ -97,7 +97,7 @@ camel_init (const gchar *configdir, gboolean nss_init)
 
        camel_debug_init();
 
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
        if (nss_init) {
                gchar *nss_configdir = NULL;
                gchar *nss_sql_configdir = NULL;
@@ -200,7 +200,7 @@ skip_nss_init:
                g_free (nss_configdir);
                g_free (nss_sql_configdir);
        }
-#endif /* HAVE_NSS */
+#endif /* CAMEL_HAVE_NSS */
 
        path = g_strdup_printf ("%s/camel-cert.db", configdir);
        certdb = camel_certdb_new ();
@@ -241,14 +241,14 @@ camel_shutdown (void)
 
        /* These next calls must come last. */
 
-#if defined (HAVE_NSS)
+#if defined (CAMEL_HAVE_NSS)
        if (nss_initlock != NULL) {
                PR_Lock(nss_initlock);
                if (nss_initialized)
                        NSS_Shutdown ();
                PR_Unlock(nss_initlock);
        }
-#endif /* HAVE_NSS */
+#endif /* CAMEL_HAVE_NSS */
 
        initialised = FALSE;
 }
index 461b6f0..c050205 100644 (file)
@@ -11,4 +11,4 @@ Description: the Evolution MIME message handling library
 Version: @VERSION@
 Requires: glib-2.0 libedataserver-@API_VERSION@ sqlite3 @mozilla_nss@ @mozilla_nspr@
 Libs: -L${libdir} -lcamel-@API_VERSION@ @MANUAL_NSS_LIBS@
-Cflags: -I${privincludedir} @MANUAL_NSS_CFLAGS@
+Cflags: -I${privincludedir} @CAMEL_SSL_DEFINES@ @MANUAL_NSS_CFLAGS@
index bd5bc8f..7b74354 100644 (file)
@@ -414,7 +414,7 @@ enum {
        MODE_TLS
 };
 
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
 #define SSL_PORT_FLAGS (CAMEL_TCP_STREAM_SSL_ENABLE_SSL2 | CAMEL_TCP_STREAM_SSL_ENABLE_SSL3)
 #define STARTTLS_FLAGS (CAMEL_TCP_STREAM_SSL_ENABLE_TLS)
 #endif
@@ -434,7 +434,7 @@ connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, GE
        gchar *buf;
 
        if (ssl_mode != MODE_CLEAR) {
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
                if (ssl_mode == MODE_TLS)
                        tcp_stream = camel_tcp_stream_ssl_new_raw (service->session, service->url->host, STARTTLS_FLAGS);
                else
@@ -448,7 +448,7 @@ connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, GE
 
                return FALSE;
 
-#endif /* HAVE_SSL */
+#endif /* CAMEL_HAVE_SSL */
        } else
                tcp_stream = camel_tcp_stream_raw_new ();
 
@@ -561,7 +561,7 @@ connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, GE
                return TRUE;
        }
 
-#ifdef HAVE_SSL
+#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;
 
@@ -598,7 +598,7 @@ connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, GE
                _("Failed to connect to IMAP server %s in secure mode: %s"),
                service->url->host, _("SSL is not available in this build"));
        goto exception;
-#endif /* HAVE_SSL */
+#endif /* CAMEL_HAVE_SSL */
 
        /* rfc2595, section 4 states that after a successful STLS
            command, the client MUST discard prior CAPA responses */
index bab7c5c..c012941 100644 (file)
@@ -13,7 +13,7 @@
 // fixme, use own type funcs
 #include <ctype.h>
 
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
 #include <nspr.h>
 #include <prio.h>
 #include <prerror.h>
@@ -2676,7 +2676,7 @@ imapx_connect_to_server (CamelIMAPXServer *is, GError **error)
        CamelSockOptData sockopt;
        gint ret, ssl_mode = 0;
 
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
        const gchar *mode;
 #endif
        guint len;
@@ -2706,7 +2706,7 @@ imapx_connect_to_server (CamelIMAPXServer *is, GError **error)
                serv = "imap";
                port = "143";
        }
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
        mode = camel_url_get_param(is->url, "use_ssl");
        if (mode && strcmp(mode, "never") != 0) {
                if (!strcmp(mode, "when-possible")) {
@@ -2727,7 +2727,7 @@ imapx_connect_to_server (CamelIMAPXServer *is, GError **error)
 #else
        tcp_stream = camel_tcp_stream_raw_new ();
        is->is_ssl_stream = FALSE;
-#endif /* HAVE_SSL */
+#endif /* CAMEL_HAVE_SSL */
 
        camel_session_get_socks_proxy (is->session, &socks_host, &socks_port);
 
@@ -2817,7 +2817,7 @@ imapx_connect_to_server (CamelIMAPXServer *is, GError **error)
                camel_imapx_command_free(ic);
        }
 
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
        if (ssl_mode == 2)
        {
 
@@ -4607,7 +4607,7 @@ imapx_parser_thread (gpointer d)
 
        while (local_error == NULL && is->stream) {
                camel_operation_uncancel (op);
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
                if (is->is_ssl_stream)  {
                        PRPollDesc pollfds[2] = { };
                        gint res;
index ba2272c..cda5b18 100644 (file)
@@ -199,7 +199,7 @@ enum {
        MODE_TLS
 };
 
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
 #define SSL_PORT_FLAGS (CAMEL_TCP_STREAM_SSL_ENABLE_SSL2 | CAMEL_TCP_STREAM_SSL_ENABLE_SSL3)
 #define STARTTLS_FLAGS (CAMEL_TCP_STREAM_SSL_ENABLE_TLS)
 #endif
@@ -221,7 +221,7 @@ connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, GE
        camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
 
        if (ssl_mode != MODE_CLEAR) {
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
                if (ssl_mode == MODE_TLS) {
                        tcp_stream = camel_tcp_stream_ssl_new_raw (service->session, service->url->host, STARTTLS_FLAGS);
                } else {
@@ -234,7 +234,7 @@ connect_to_server (CamelService *service, struct addrinfo *ai, gint ssl_mode, GE
                        _("Could not connect to %s: %s"),
                        service->url->host, _("SSL unavailable"));
                goto fail;
-#endif /* HAVE_SSL */
+#endif /* CAMEL_HAVE_SSL */
        } else {
                tcp_stream = camel_tcp_stream_raw_new ();
        }
index 2271d80..00c5eaa 100644 (file)
@@ -58,7 +58,7 @@ enum {
        MODE_TLS
 };
 
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
 #define SSL_PORT_FLAGS (CAMEL_TCP_STREAM_SSL_ENABLE_SSL2 | CAMEL_TCP_STREAM_SSL_ENABLE_SSL3)
 #define STARTTLS_FLAGS (CAMEL_TCP_STREAM_SSL_ENABLE_TLS)
 #endif
@@ -119,7 +119,7 @@ connect_to_server (CamelService *service,
        const gchar *delete_days;
 
        if (ssl_mode != MODE_CLEAR) {
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
                if (ssl_mode == MODE_TLS) {
                        tcp_stream = camel_tcp_stream_ssl_new_raw (service->session, service->url->host, STARTTLS_FLAGS);
                } else {
@@ -133,7 +133,7 @@ connect_to_server (CamelService *service,
                        service->url->host, _("SSL unavailable"));
 
                return FALSE;
-#endif /* HAVE_SSL */
+#endif /* CAMEL_HAVE_SSL */
        } else
                tcp_stream = camel_tcp_stream_raw_new ();
 
@@ -176,7 +176,7 @@ connect_to_server (CamelService *service,
                return TRUE;
        }
 
-#ifdef HAVE_SSL
+#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;
 
@@ -224,7 +224,7 @@ connect_to_server (CamelService *service,
                _("Failed to connect to POP server %s in secure mode: %s"),
                service->url->host, _("TLS is not available in this build"));
        goto stls_exception;
-#endif /* HAVE_SSL */
+#endif /* CAMEL_HAVE_SSL */
 
        g_object_unref (tcp_stream);
 
index 5ffdf63..53b41bf 100644 (file)
@@ -176,7 +176,7 @@ enum {
        MODE_TLS
 };
 
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
 #define SSL_PORT_FLAGS (CAMEL_TCP_STREAM_SSL_ENABLE_SSL2 | CAMEL_TCP_STREAM_SSL_ENABLE_SSL3)
 #define STARTTLS_FLAGS (CAMEL_TCP_STREAM_SSL_ENABLE_TLS)
 #endif
@@ -202,7 +202,7 @@ connect_to_server (CamelService *service,
        transport->authtypes = NULL;
 
        if (ssl_mode != MODE_CLEAR) {
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
                if (ssl_mode == MODE_TLS) {
                        tcp_stream = camel_tcp_stream_ssl_new_raw (service->session, service->url->host, STARTTLS_FLAGS);
                } else {
@@ -216,7 +216,7 @@ connect_to_server (CamelService *service,
                        service->url->host, _("SSL unavailable"));
 
                return FALSE;
-#endif /* HAVE_SSL */
+#endif /* CAMEL_HAVE_SSL */
        } else {
                tcp_stream = camel_tcp_stream_raw_new ();
        }
@@ -287,7 +287,7 @@ connect_to_server (CamelService *service,
                return TRUE;
        }
 
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
        if (!(transport->flags & CAMEL_SMTP_TRANSPORT_STARTTLS)) {
                g_set_error (
                        error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
@@ -338,7 +338,7 @@ connect_to_server (CamelService *service,
                _("Failed to connect to SMTP server %s in secure mode: %s"),
                service->url->host, _("SSL is not available in this build"));
        goto exception_cleanup;
-#endif /* HAVE_SSL */
+#endif /* CAMEL_HAVE_SSL */
 
        /* We are supposed to re-EHLO after a successful STARTTLS to
            re-fetch any supported extensions. */
index 664b152..a603287 100644 (file)
@@ -585,8 +585,8 @@ dnl check if pkg-config files exist (which are only shipped by distributions, no
                                AC_DEFINE(ENABLE_SMIME,1,[Define if SMIME should be enabled])
                                msg_smime="yes"
                        fi
-                       AC_DEFINE(HAVE_NSS,1,[Define if you have NSS])
-                       AC_DEFINE(HAVE_SSL,1,[Define if you have a supported SSL library])
+                       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=""
@@ -687,8 +687,8 @@ dnl check if pkg-config files exist (which are only shipped by distributions, no
                        LIBS="$LIBS_save"
 
                        if test "x${moz_nss_libs}" = "xyes"; then
-                               AC_DEFINE(HAVE_NSS)
-                               AC_DEFINE(HAVE_SSL)
+                               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])
@@ -709,12 +709,20 @@ dnl check if pkg-config files exist (which are only shipped by distributions, no
        fi
 fi
 
+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=""
+fi
+
 AM_CONDITIONAL(ENABLE_SMIME, test "x$msg_smime" != "xno")
 
 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)