From 08fa240d29322ece4c7bceebfae6c6d3fb856f0e Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Sat, 11 Nov 2006 23:50:44 +0100 Subject: [PATCH] lib-network Signed-off-by: Pierre Habouzit --- Makefile.am | 13 +++---- configure.ac | 38 +++++++++---------- imap/imap.c | 2 +- imap/imap_private.h | 2 +- imap/util.c | 2 +- init.c | 2 +- init.h | 2 +- lib-network/Makefile.am | 8 ++++ mutt_socket.c => lib-network/mutt_socket.c | 0 mutt_socket.h => lib-network/mutt_socket.h | 0 mutt_ssl.c => lib-network/mutt_ssl.c | 0 mutt_ssl.h => lib-network/mutt_ssl.h | 2 +- .../mutt_ssl_gnutls.c | 0 mutt_tunnel.c => lib-network/mutt_tunnel.c | 0 mutt_tunnel.h => lib-network/mutt_tunnel.h | 0 mutt_sasl.c | 2 +- mutt_sasl.h | 2 +- nntp/nntp.h | 2 +- pop/pop.h | 2 +- pop/pop_lib.c | 2 +- 20 files changed, 41 insertions(+), 40 deletions(-) create mode 100644 lib-network/Makefile.am rename mutt_socket.c => lib-network/mutt_socket.c (100%) rename mutt_socket.h => lib-network/mutt_socket.h (100%) rename mutt_ssl.c => lib-network/mutt_ssl.c (100%) rename mutt_ssl.h => lib-network/mutt_ssl.h (91%) rename mutt_ssl_gnutls.c => lib-network/mutt_ssl_gnutls.c (100%) rename mutt_tunnel.c => lib-network/mutt_tunnel.c (100%) rename mutt_tunnel.h => lib-network/mutt_tunnel.h (100%) diff --git a/Makefile.am b/Makefile.am index fae6d91..b7fbfcc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,7 +10,7 @@ NNTP_INCLUDES = -I$(top_srcdir)/nntp endif SUBDIRS = intl m4 po $(XXXXXXXXXXXX_doc) contrib \ - lib-lib lib-mime lib-crypt lib-hash lib-ui lib \ + lib-lib lib-mime lib-crypt lib-hash lib-network lib-ui lib \ pop imap $(NNTP_SUBDIR) BUILT_SOURCES = keymap_defs.h version.h @@ -27,13 +27,12 @@ madmutt_SOURCES = $(BUILT_SOURCES) \ pager.c pattern.c postpone.c query.c \ recvattach.c recvcmd.c rfc1524.c rfc3676.c \ score.c send.c sendlib.c sidebar.c signal.c sort.c state.c status.c system.c \ - thread.c url.c utf8.c wcwidth.c \ - account.c mutt_socket.c mutt_tunnel.c + thread.c url.c utf8.c wcwidth.c account.c madmutt_LDADD = @MUTT_LIB_OBJECTS@ @LIBOBJS@ \ -Limap -limap -Lpop -lpop $(LIBNNTP) \ -Llib-lib -llib -Llib-mime -lmime -Llib-crypt -lcrypt -Llib-hash -lhash \ - -Llib-ui -lui \ + -Llib-network -lnetwork -Llib-ui -lui \ -Llib -lsane $(MUTTLIBS) $(INTLLIBS) $(LIBICONV) madmutt_DEPENDENCIES = @MUTT_LIB_OBJECTS@ @LIBOBJS@ \ @@ -63,8 +62,7 @@ INCLUDES=-I. -I$(top_srcdir) $(IMAP_INCLUDES) $(NNTP_INCLUDES) $(GPGME_CFLAGS) - CPPFLAGS=@CPPFLAGS@ -I$(includedir) EXTRA_madmutt_SOURCES = \ - account.c mutt_sasl.c mutt_socket.c mutt_ssl.c \ - mutt_tunnel.c resize.c dotlock.c remailer.c \ + account.c mutt_sasl.c resize.c dotlock.c remailer.c \ alias.h browser.h mbyte.h remailer.h url.h state.h \ mutt_idna.h mutt_libesmtp.c sidebar.h state.h @@ -74,8 +72,7 @@ EXTRA_DIST = config.rpath COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO \ dotlock.h functions.def gen_defs \ recvattach.h handler.h thread.h \ globals.h history.h init.h keymap.h mutt_crypt.h \ - mime.h mutt.h mutt_sasl.h mutt_socket.h mutt_ssl.h mutt_tunnel.h \ - mbox.h mh.h mx.h pager.h protos.h rfc1524.h \ + mime.h mutt.h mutt_sasl.h mbox.h mh.h mx.h pager.h protos.h rfc1524.h \ rfc3676.h sort.h mime.types autogen.sh \ OPS.MIX remailer.c remailer.h browser.h state.h \ mbyte.h lib.h extlib.c pgpewrap.c smime_keys.pl pgplib.h madmuttrc.head madmuttrc \ diff --git a/configure.ac b/configure.ac index c229080..2a889f4 100644 --- a/configure.ac +++ b/configure.ac @@ -406,27 +406,23 @@ AM_CONDITIONAL(USE_GSS, test x$need_gss = xyes) dnl -- end imap dependencies -- AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl[=PFX]], [Compile in SSL support for POP/IMAP]), -[ if test "$with_ssl" != "no" - then - if test "$with_ssl" != "yes" - then - LDFLAGS="$LDFLAGS -L$withval/lib" - CPPFLAGS="$CPPFLAGS -I$withval/include" - fi - saved_LIBS="$LIBS" - - AC_CHECK_LIB(crypto, X509_new,, AC_MSG_ERROR([Unable to find SSL library])) - AC_CHECK_LIB(ssl, SSL_new,, AC_MSG_ERROR([Unable to find SSL library]), -lcrypto) +[ if test "$with_ssl" != "no"; then + if test "$with_ssl" != "yes"; then + LDFLAGS="$LDFLAGS -L$withval/lib" + CPPFLAGS="$CPPFLAGS -I$withval/include" + fi + saved_LIBS="$LIBS" - AC_CHECK_FUNCS(RAND_status RAND_egd) + AC_CHECK_LIB(crypto, X509_new,, AC_MSG_ERROR([Unable to find SSL library])) + AC_CHECK_LIB(ssl, SSL_new,, AC_MSG_ERROR([Unable to find SSL library]), -lcrypto) - AC_DEFINE(USE_SSL,1,[ Define if you want support for SSL. ]) - LIBS="$saved_LIBS" - MUTTLIBS="$MUTTLIBS -lssl -lcrypto" - MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_ssl.o" - need_ssl=yes + AC_CHECK_FUNCS(RAND_status RAND_egd) - fi + AC_DEFINE(USE_SSL,1,[ Define if you want support for SSL. ]) + LIBS="$saved_LIBS" + MUTTLIBS="$MUTTLIBS -lssl -lcrypto" + need_ssl=yes + fi ]) AC_ARG_WITH([gnutls], AC_HELP_STRING([--with-gnutls], [Enable SSL support using gnutls]), @@ -439,12 +435,12 @@ if test "$gnutls_prefix" != "no"; then CPPFLAGS="$CPPFLAGS $LIBGNUTLS_CFLAGS" MUTTLIBS="$MUTTLIBS $LIBGNUTLS_LIBS" AC_DEFINE(USE_GNUTLS, 1, [Define if you want support for SSL via the gnutls library.]) - MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_ssl_gnutls.o" need_ssl=yes], [AC_MSG_ERROR([could not find libgnutls]) ]) fi AM_CONDITIONAL(USE_SSL, test x$need_ssl = xyes) +AC_SUBST(MUTT_SSL_OBJECTS) AC_ARG_WITH(sasl2, AC_HELP_STRING([--with-sasl2[=PFX]], [Use Cyrus SASL library version 2 for POP/IMAP authentication]),[ @@ -456,8 +452,7 @@ AC_ARG_WITH(sasl2, AC_HELP_STRING([--with-sasl2[=PFX]], saved_LIBS="$LIBS" - AC_CHECK_LIB(sasl2, sasl_client_init,, - AC_MSG_ERROR([could not find libsasl2]),) + AC_CHECK_LIB(sasl2, sasl_client_init,,AC_MSG_ERROR([could not find libsasl2])) MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_sasl.o" MUTTLIBS="$MUTTLIBS -lsasl2" @@ -912,6 +907,7 @@ AC_OUTPUT(Makefile intl/Makefile m4/Makefile lib-mime/Makefile lib-crypt/Makefile lib-hash/Makefile + lib-network/Makefile lib-ui/Makefile lib/Makefile imap/Makefile diff --git a/imap/imap.c b/imap/imap.c index 57648c6..005c15f 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -28,7 +28,7 @@ #include "message.h" #include "imap_private.h" #if defined(USE_SSL) || defined(USE_GNUTLS) -# include "mutt_ssl.h" +# include #endif #include "buffy.h" diff --git a/imap/imap_private.h b/imap/imap_private.h index 290f81a..b61b9b2 100644 --- a/imap/imap_private.h +++ b/imap/imap_private.h @@ -16,7 +16,7 @@ #include #include "imap.h" -#include "mutt_socket.h" +#include /* -- symbols -- */ #define IMAP_PORT 143 diff --git a/imap/util.c b/imap/util.c index f869a98..8c294d2 100644 --- a/imap/util.c +++ b/imap/util.c @@ -20,7 +20,7 @@ #include "mx.h" /* for M_IMAP */ #include "url.h" #include "imap_private.h" -#include "mutt_ssl.h" +#include #include #include "lib/debug.h" diff --git a/init.c b/init.c index 7ff48e9..ce6054e 100644 --- a/init.c +++ b/init.c @@ -34,7 +34,7 @@ #include "mutt_idna.h" #if defined(USE_SSL) || defined(USE_GNUTLS) -#include "mutt_ssl.h" +#include #endif #if defined (USE_LIBESMTP) && (defined (USE_SSL) || defined (USE_GNUTLS)) diff --git a/init.h b/init.h index aa2c2bd..d76776e 100644 --- a/init.h +++ b/init.h @@ -1345,7 +1345,7 @@ struct option_t MuttVars[] = { ** files when the header cache is in use. This incurs one \fTstat(2)\fP per ** message every time the folder is opened. */ -#if HAVE_GDBM || HAVE_DB4 +#if defined(HAVE_GDBM) || defined(HAVE_DB4) {"header_cache_pagesize", DT_STR, R_NONE, UL &HeaderCachePageSize, "16384"}, /* ** .pp diff --git a/lib-network/Makefile.am b/lib-network/Makefile.am new file mode 100644 index 0000000..aadbab1 --- /dev/null +++ b/lib-network/Makefile.am @@ -0,0 +1,8 @@ +noinst_LIBRARIES = libnetwork.a + +libnetwork_a_SOURCES = mutt_socket.h mutt_tunnel.c mutt_ssl.h \ + mutt_socket.c mutt_tunnel.h mutt_ssl.c mutt_ssl_gnutls.c + +noinst_HEADERS = mutt_socket.h mutt_tunnel.c mutt_ssl.h + +-include ../cflags.mk diff --git a/mutt_socket.c b/lib-network/mutt_socket.c similarity index 100% rename from mutt_socket.c rename to lib-network/mutt_socket.c diff --git a/mutt_socket.h b/lib-network/mutt_socket.h similarity index 100% rename from mutt_socket.h rename to lib-network/mutt_socket.h diff --git a/mutt_ssl.c b/lib-network/mutt_ssl.c similarity index 100% rename from mutt_ssl.c rename to lib-network/mutt_ssl.c diff --git a/mutt_ssl.h b/lib-network/mutt_ssl.h similarity index 91% rename from mutt_ssl.h rename to lib-network/mutt_ssl.h index 97a3fab..b0e6ee6 100644 --- a/mutt_ssl.h +++ b/lib-network/mutt_ssl.h @@ -12,7 +12,7 @@ #include "mutt_socket.h" -#if defined (USE_SSL) || defined (USE_GNUTLS) +#if defined(USE_SSL) || defined(USE_GNUTLS) int mutt_ssl_starttls (CONNECTION * conn); int mutt_ssl_socket_setup (CONNECTION * conn); diff --git a/mutt_ssl_gnutls.c b/lib-network/mutt_ssl_gnutls.c similarity index 100% rename from mutt_ssl_gnutls.c rename to lib-network/mutt_ssl_gnutls.c diff --git a/mutt_tunnel.c b/lib-network/mutt_tunnel.c similarity index 100% rename from mutt_tunnel.c rename to lib-network/mutt_tunnel.c diff --git a/mutt_tunnel.h b/lib-network/mutt_tunnel.h similarity index 100% rename from mutt_tunnel.h rename to lib-network/mutt_tunnel.h diff --git a/mutt_sasl.c b/mutt_sasl.c index 699e677..d5738b6 100644 --- a/mutt_sasl.c +++ b/mutt_sasl.c @@ -18,7 +18,7 @@ #include "mutt.h" #include "account.h" #include "mutt_sasl.h" -#include "mutt_socket.h" +#include #include "lib/debug.h" diff --git a/mutt_sasl.h b/mutt_sasl.h index 763c8d9..9c71a67 100644 --- a/mutt_sasl.h +++ b/mutt_sasl.h @@ -14,7 +14,7 @@ #include -#include "mutt_socket.h" +#include int mutt_sasl_client_new (CONNECTION *, sasl_conn_t **); sasl_callback_t *mutt_sasl_get_callbacks (ACCOUNT *); diff --git a/nntp/nntp.h b/nntp/nntp.h index 261a156..d82bd60 100644 --- a/nntp/nntp.h +++ b/nntp/nntp.h @@ -12,7 +12,7 @@ #ifndef _NNTP_H_ #define _NNTP_H_ 1 -#include "mutt_socket.h" +#include #include "mx.h" #include diff --git a/pop/pop.h b/pop/pop.h index edde8b7..495849b 100644 --- a/pop/pop.h +++ b/pop/pop.h @@ -13,7 +13,7 @@ #include #include "mx.h" -#include "mutt_socket.h" +#include #define POP_PORT 110 #define POP_SSL_PORT 995 diff --git a/pop/pop_lib.c b/pop/pop_lib.c index fae3c9b..e462a6a 100644 --- a/pop/pop_lib.c +++ b/pop/pop_lib.c @@ -21,7 +21,7 @@ #include "url.h" #include "pop.h" #if defined (USE_SSL) || defined (USE_GNUTLS) -# include "mutt_ssl.h" +# include #endif #include "lib/debug.h" -- 2.20.1