Changed msg_style and msg_delim to be file static to m_getfld.c
[mmh] / Makefile.am
index 5b473c3..27ffdfb 100644 (file)
@@ -33,36 +33,65 @@ auxexecdir = @libdir@
 ##
 ## nmh _does_ have a test suite!
 ##
-
-TESTS_ENVIRONMENT = MH_TEST_DIR=`pwd`/test/testdir \
-                   MH_TEST_COMMON=`pwd`/test/common.sh \
-                   MH_OBJ_DIR=`pwd` mandir=$(mandir) bindir=$(bindir) \
-                   sysconfdir=$(sysconfdir) auxexecdir=$(auxexecdir)
+TESTS_ENVIRONMENT = MH_OBJ_DIR="@abs_builddir@" \
+                   MH_TEST_DIR="@abs_builddir@/test/testdir" \
+                   auxexecdir="$(auxexecdir)" bindir="$(bindir)" \
+                   mandir="$(mandir)" sysconfdir="$(sysconfdir)" \
+                   MULTIBYTE_ENABLED=$(MULTIBYTE_ENABLED) \
+                   $(TESTS_SHELL) ## Keep at end of TESTS_ENVIRONMENT.
 ##
 ## Important note: the "cleanup" test should always be last
 ##
-TESTS = test/bad-input/test-header test/folder/test-create \
-       test/folder/test-total test/format/test-localmbox \
-       test/format/test-myname test/format/test-myhost \
-       test/format/test-mymbox \
+TESTS = test/ali/test-ali test/anno/test-anno \
+       test/bad-input/test-header \
+       test/burst/test-burst \
+       test/comp/test-comp-format test/dist/test-dist \
+       test/folder/test-create test/folder/test-packf \
+       test/folder/test-recurse test/folder/test-sortm \
+       test/folder/test-total \
+       test/format/test-dp test/format/test-fmtdump \
+       test/format/test-localmbox test/format/test-myname \
+       test/format/test-myhost test/format/test-mymbox \
+       test/forw/test-forw-digest test/forw/test-forw-format \
        test/inc/test-deb359167 test/inc/test-eom-align \
-       test/manpages/test-manpages test/mhbuild/test-forw \
+       test/inc/test-inc-scanout test/inc/test-msgchk \
+       test/inc/test-pop \
+       test/install-mh/test-install-mh test/manpages/test-manpages \
+       test/mhbuild/test-forw test/mhbuild/test-utf8-body \
+       test/mhlist/test-mhlist test/mhmail/test-mhmail \
+       test/mhparam/test-mhparam test/mhpath/test-mhpath \
        test/mhshow/test-cte-binary test/mhshow/test-qp \
-       test/mhshow/test-subpart test/new/test-basic test/pick/test-stderr \
-       test/repl/test-if-str test/scan/test-scan \
+       test/mhshow/test-subpart test/mhstore/test-mhstore \
+       test/new/test-basic \
+       test/pick/test-pick test/pick/test-stderr \
+       test/post/test-post-aliases test/post/test-post-basic \
+       test/post/test-post-multiple test/post/test-post-bcc \
+       test/post/test-post-dcc test/post/test-post-fcc \
+       test/post/test-post-multifrom test/post/test-post-envelope \
+       test/post/test-post-group test/post/test-mts test/post/test-messageid \
+       test/post/test-sendfiles test/prompter/test-prompter \
+       test/rcv/test-rcvdist test/rcv/test-rcvpack test/rcv/test-rcvstore \
+       test/rcv/test-rcvtty test/refile/test-refile \
+       test/repl/test-if-str test/repl/test-trailing-newline \
+       test/repl/test-multicomp test/repl/test-repl \
+       test/scan/test-scan test/scan/test-scan-multibyte \
+       test/sequences/test-flist test/sequences/test-mark \
+       test/slocal/test-slocal \
        test/whatnow/test-attach-detach test/whatnow/test-cd \
-       test/whatnow/test-ls test/cleanup
+       test/whatnow/test-ls test/whom/test-whom \
+       test/cleanup ## The "cleanup" test should always be last.
 
 check_SCRIPTS = test/common.sh
-check_PROGRAMS = test/getfullname
+check_PROGRAMS = test/getfullname test/getfqdn test/fakepop test/fakesmtp
+DISTCHECK_CONFIGURE_FLAGS = DISABLE_SETGID_MAIL=1
 
 ##
 ## Stuff that should be cleaned via "make clean"
 ##
-CLEANFILES = config/version.c sbr/sigmsg.h etc/mts.conf etc/sendfiles \
-            etc/mhn.defaults man/man.sed $(man_MANS)
+CLEANFILES = config/version.c sbr/sigmsg.h etc/mts.conf \
+            etc/mhn.defaults man/man.sed man/mh-chart.man $(man_MANS)
 clean-local:
-       @rm -rf RPM a.out.DSYM uip/a.out.DSYM
+       @rm -rf RPM a.out.dSYM uip/a.out.dSYM
        @rm -rf test/testdir
 
 ##
@@ -75,7 +104,7 @@ MAINTAINERCLEANFILES = cscope.files cscope.out
 ##
 SUPERCLEANFILES = ChangeLog Makefile.in aclocal.m4 compile config.guess \
                  config.h.in config.h.in~ config.sub configure depcomp \
-                 install-sh missing ylwrap nmh-*.tar.gz
+                 install-sh missing ylwrap nmh-*.tar.gz nmh-*.tar.gz.sig
 superclean: maintainer-clean
        @rm -f $(SUPERCLEANFILES)
 .PHONY: superclean
@@ -92,20 +121,22 @@ BUILT_SOURCES = sbr/sigmsg.h
 ##
 bin_PROGRAMS = uip/ali uip/anno uip/burst uip/comp uip/dist uip/flist \
               uip/folder uip/forw uip/inc uip/install-mh uip/mark \
-              uip/mhbuild uip/mhlist uip/mhmail uip/mhn uip/mhparam \
+              uip/mhbuild uip/mhlist uip/mhn uip/mhparam \
               uip/mhpath uip/mhshow uip/mhstore uip/msgchk uip/msh uip/new \
               uip/packf uip/pick uip/prompter uip/refile uip/repl uip/rmf \
               uip/rmm uip/scan uip/send uip/show uip/sortm uip/whatnow \
               uip/whom
 
-bin_SCRIPTS = etc/sendfiles
+bin_SCRIPTS = uip/mhmail etc/sendfiles
 
 ##
 ## This is all programs that get installed in the "lib" directory
 ##
 auxexec_PROGRAMS = uip/ap uip/conflict uip/dp uip/fmtdump uip/mhl uip/post \
                   uip/rcvdist uip/rcvpack uip/rcvstore uip/rcvtty uip/slocal \
-                  uip/spost uip/viamail uip/mhtest
+                  uip/viamail uip/mhtest
+
+auxexec_SCRIPTS = uip/spost
 
 ##
 ## Internal libraries that we create as part of the build process
@@ -118,7 +149,7 @@ noinst_LIBRARIES = sbr/libmh.a sbr/libdtimep.a mts/libmts.a
 ## them, but that might change in the future.
 ##
 noinst_HEADERS = h/addrsbr.h h/aliasbr.h h/crawl_folders.h h/dropsbr.h \
-                h/fmt_compile.h h/fmt_scan.h h/m_setjmp.h h/md5.h h/mf.h \
+                h/fmt_compile.h h/fmt_scan.h h/md5.h h/mf.h \
                 h/mh.h h/mhcachesbr.h h/mhparse.h h/mime.h h/msh.h \
                 h/mts.h h/nmh.h h/picksbr.h h/popsbr.h h/prototypes.h \
                 h/rcvmail.h h/scansbr.h h/signals.h h/tws.h h/utils.h \
@@ -132,8 +163,8 @@ dist_sysconf_DATA = etc/MailAliases etc/components etc/digestcomps \
                    etc/mhl.format etc/mhl.forward etc/mhl.headers \
                    etc/mhl.reply etc/rcvdistcomps etc/rcvdistcomps.outbox \
                    etc/replcomps etc/replgroupcomps etc/scan.MMDDYY \
-                   etc/scan.YYYYMMDD etc/scan.default etc/scan.mailx \
-                   etc/scan.nomime etc/scan.size etc/scan.time \
+                   etc/scan.YYYYMMDD etc/scan.default etc/scan.highlighted \
+                   etc/scan.mailx etc/scan.nomime etc/scan.size etc/scan.time \
                    etc/scan.timely etc/scan.unseen
 
 ##
@@ -142,26 +173,37 @@ dist_sysconf_DATA = etc/MailAliases etc/components etc/digestcomps \
 ##
 sysconf_DATA = etc/mhn.defaults etc/mts.conf
 
-dist_doc_DATA = COPYRIGHT VERSION docs/COMPLETION-BASH docs/COMPLETION-TCSH \
+##
+## Documentation that gets installed in docdir
+##
+dist_doc_DATA = COPYRIGHT INSTALL NEWS README VERSION \
+               docs/COMPLETION-BASH docs/COMPLETION-TCSH \
                docs/COMPLETION-ZSH docs/DIFFERENCES docs/FAQ \
                docs/MAIL.FILTERING docs/MAILING-LISTS docs/README-ATTACHMENTS \
-               docs/README-HOOKS docs/README.about docs/README.SASL \
-               docs/README.developers docs/README.manpages docs/TODO
+               docs/README-HOOKS docs/README-components docs/README.about \
+               docs/README.SASL docs/README.developers docs/README.manpages \
+               docs/TODO
 
 ##
-## Our man pages
+## Contribs that get installed in docdir/contrib/
 ##
+contribdir = $(docdir)/contrib
+dist_contrib_DATA = docs/contrib/replyfilter docs/contrib/build_nmh \
+                   docs/contrib/ml
 
+##
+## Our man pages
+##
 man_MANS = man/ali.1 man/anno.1 man/ap.8 man/burst.1 man/comp.1 \
           man/conflict.8 man/dist.1 man/dp.8 man/flist.1 man/flists.1 \
           man/fmtdump.8 man/fnext.1 man/folder.1 man/folders.1 \
           man/forw.1 man/fprev.1 man/inc.1 man/install-mh.1 man/mark.1 \
-          man/mh-alias.5 man/mh-chart.1 man/mh-draft.5 man/mh-format.5 \
-          man/mh-mail.5 man/mh-profile.5 man/mh-sequence.5 \
+          man/mh-alias.5 man/mh-chart.7 man/mh-draft.5 man/mh-format.5 \
+          man/mh-mail.5 man/mh-profile.5 man/mh_profile.5 man/mh-sequence.5 \
           man/mh-tailor.5 man/mhbuild.1 man/mhl.1 man/mhlist.1 \
           man/mhmail.1 man/mhn.1 man/mhparam.1 man/mhpath.1 \
           man/mhshow.1 man/mhstore.1 man/msgchk.1 man/msh.1 \
-          man/mts.conf.5 man/new.1 man/next.1 man/nmh.1 man/packf.1 \
+          man/mts.conf.5 man/new.1 man/next.1 man/nmh.7 man/packf.1 \
           man/pick.1 man/post.8 man/prev.1 man/prompter.1 man/rcvdist.1 \
           man/rcvpack.1 man/rcvstore.1 man/rcvtty.1 man/refile.1 \
           man/repl.1 man/rmf.1 man/rmm.1 man/scan.1 man/send.1 \
@@ -172,29 +214,32 @@ man_MANS = man/ali.1 man/anno.1 man/ap.8 man/burst.1 man/comp.1 \
 ## Files we need to include in the distribution which aren't found by
 ## Automake using the automatic rules
 ##
-
-EXTRA_DIST = config/version.sh sbr/sigmsg.awk etc/mts.conf.in etc/sendfiles.in \
-            etc/mhn.defaults.sh $(MHNSEARCHPROG) nmh.spec DATE \
+EXTRA_DIST = config/version.sh sbr/sigmsg.awk etc/mts.conf.in \
+            etc/mhn.defaults.sh etc/sendfiles $(MHNSEARCHPROG) DATE MACHINES \
             docs/ChangeLog_MH-3_to_MH-6.6 \
             docs/ChangeLog_MH-6.7.0_to_MH-6.8.4.html \
             man/ali.man man/anno.man man/ap.man man/burst.man man/comp.man \
             man/conflict.man man/dist.man man/dp.man man/flist.man \
             man/flists.man man/fmtdump.man man/fnext.man man/folder.man \
             man/folders.man man/forw.man man/fprev.man man/inc.man \
-            man/install-mh.man man/mark.man man/mh-alias.man man/mh-chart.man \
-            man/mh-draft.man man/mh-format.man man/mh-mail.man \
-            man/mh-profile.man man/mh-sequence.man man/mh-tailor.man \
-            man/mhbuild.man man/mhl.man man/mhlist.man man/mhmail.man \
-            man/mhn.man man/mhparam.man man/mhpath.man man/mhshow.man \
-            man/mhstore.man man/msgchk.man man/msh.man man/mts.conf.man \
-            man/new.man man/next.man man/nmh.man man/packf.man man/pick.man \
-            man/post.man man/prev.man man/prompter.man man/rcvdist.man \
-            man/rcvpack.man man/rcvstore.man man/rcvtty.man man/refile.man \
-            man/repl.man man/rmf.man man/rmm.man man/scan.man man/send.man \
+            man/install-mh.man man/mark.man man/mh-alias.man \
+            man/mh-chart-gen.sh man/mh-draft.man man/mh-format.man \
+            man/mh-mail.man man/mh-profile.man man/mh_profile.man \
+            man/mh-sequence.man man/mh-tailor.man man/mhbuild.man man/mhl.man \
+            man/mhlist.man man/mhmail.man man/mhn.man man/mhparam.man \
+            man/mhpath.man man/mhshow.man man/mhstore.man man/msgchk.man \
+            man/msh.man man/mts.conf.man man/new.man man/next.man man/nmh.man \
+            man/packf.man man/pick.man man/post.man man/prev.man \
+            man/prompter.man man/rcvdist.man man/rcvpack.man \
+            man/rcvstore.man man/rcvtty.man man/refile.man man/repl.man \
+            man/rmf.man man/rmm.man man/scan.man man/send.man \
             man/sendfiles.man man/show.man man/slocal.man man/sortm.man \
-            man/unseen.man man/whatnow.man man/whom.man test/README $(TESTS) \
-            test/inc/deb359167.mbox test/inc/fromline.txt \
-            test/inc/msgheader.txt test/inc/filler.txt test/inc/md5sums
+            man/unseen.man man/whatnow.man man/whom.man \
+            test/README test/fakesendmail $(TESTS) test/inc/deb359167.mbox \
+            test/inc/fromline.txt test/inc/msgheader.txt test/inc/filler.txt \
+            test/inc/md5sums test/mhmail/attachment.txt \
+            test/post/test-post-common.sh uip/mhmail \
+            SPECS/nmh.spec SPECS/build-nmh-cygwin
 
 ##
 ## These are all of the definitions for each of the programs listed above.
@@ -210,17 +255,19 @@ uip_burst_SOURCES = uip/burst.c
 
 uip_comp_SOURCES = uip/comp.c uip/whatnowproc.c uip/whatnowsbr.c uip/sendsbr.c \
                   uip/annosbr.c uip/distsbr.c
+uip_comp_LDADD = $(LDADD) $(ICONVLIB) $(READLINELIB)
 
 uip_dist_SOURCES = uip/dist.c uip/whatnowproc.c uip/whatnowsbr.c uip/sendsbr.c \
-                  uip/annosbr.c uip/distsbr.c
+                  uip/annosbr.c uip/distsbr.c uip/forwsbr.c
+uip_dist_LDADD = $(LDADD) $(ICONVLIB) $(READLINELIB)
 
 uip_flist_SOURCES = uip/flist.c
 
 uip_folder_SOURCES = uip/folder.c
 
 uip_forw_SOURCES = uip/forw.c uip/whatnowproc.c uip/whatnowsbr.c uip/sendsbr.c \
-                  uip/annosbr.c uip/distsbr.c
-uip_forw_LDADD = $(LDADD) $(ICONVLIB)
+                  uip/annosbr.c uip/distsbr.c uip/forwsbr.c
+uip_forw_LDADD = $(LDADD) $(ICONVLIB) $(READLINELIB)
 
 uip_inc_SOURCES = uip/inc.c uip/scansbr.c uip/dropsbr.c uip/termsbr.c \
                  uip/popsbr.c
@@ -240,8 +287,6 @@ uip_mhlist_SOURCES = uip/mhlist.c uip/mhparse.c uip/mhcachesbr.c \
                     uip/md5.c
 uip_mhlist_LDADD = $(LDADD) $(TERMLIB)
 
-uip_mhmail_SOURCES = uip/mhmail.c
-
 uip_mhn_SOURCES = uip/mhn.c uip/mhparse.c uip/mhcachesbr.c uip/mhshowsbr.c \
                  uip/mhlistsbr.c uip/mhstoresbr.c uip/mhmisc.c uip/mhfree.c \
                  uip/termsbr.c uip/md5.c
@@ -273,6 +318,7 @@ uip_new_SOURCES = uip/new.c
 uip_packf_SOURCES = uip/packf.c uip/dropsbr.c
 
 uip_pick_SOURCES = uip/pick.c uip/picksbr.c
+uip_pick_LDADD = $(LDADD) $(ICONVLIB)
 
 uip_prompter_SOURCES = uip/prompter.c
 
@@ -280,7 +326,7 @@ uip_refile_SOURCES = uip/refile.c
 
 uip_repl_SOURCES = uip/repl.c uip/replsbr.c uip/whatnowproc.c \
                   uip/whatnowsbr.c uip/sendsbr.c uip/annosbr.c uip/distsbr.c
-uip_repl_LDADD = $(LDADD) $(ICONVLIB)
+uip_repl_LDADD = $(LDADD) $(ICONVLIB) $(READLINELIB)
 
 uip_rmf_SOURCES = uip/rmf.c
 
@@ -298,6 +344,7 @@ uip_sortm_SOURCES = uip/sortm.c
 
 uip_whatnow_SOURCES = uip/whatnow.c uip/whatnowsbr.c uip/sendsbr.c \
                      uip/annosbr.c uip/distsbr.c
+uip_whatnow_LDADD = $(LDADD) $(READLINELIB)
 
 uip_whom_SOURCES = uip/whom.c uip/distsbr.c
 
@@ -340,13 +387,20 @@ uip_rcvtty_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB)
 uip_slocal_SOURCES = uip/slocal.c uip/aliasbr.c uip/dropsbr.c
 uip_slocal_LDADD = $(LDADD) $(NDBM_LIBS)
 
-uip_spost_SOURCES = uip/spost.c uip/aliasbr.c
-
 uip_viamail_SOURCES = uip/viamail.c uip/mhmisc.c uip/mhoutsbr.c uip/sendsbr.c \
                      uip/annosbr.c uip/distsbr.c
 
 test_getfullname_SOURCES = test/getfullname.c
-test_getfullname_LDADD =
+test_getfullname_LDADD = sbr/libmh.a
+
+test_getfqdn_SOURCES = test/getfqdn.c
+test_getfqdn_LDADD =
+
+test_fakepop_SOURCES = test/fakepop.c
+test_fakepop_LDADD =
+
+test_fakesmtp_SOURCES = test/fakesmtp.c
+test_fakesmtp_LDADD =
 
 ##
 ## Our rebuild rules for files that aren't built via the normal mechanisms
@@ -358,49 +412,46 @@ sbr/sigmsg.h: $(srcdir)/sbr/sigmsg.awk $(SIGNAL_H)
        $(AWK) -f $(srcdir)/sbr/sigmsg.awk $(SIGNAL_H) > $@
 
 etc/mts.conf: $(srcdir)/etc/mts.conf.in Makefile
-       rm -f $@
+       @rm -f $@
        $(SED) -e 's,%mts%,$(MTS),' \
               -e 's,%mailspool%,$(mailspool),' \
-              -e 's,%etcdir%,$(sysconfdir),' \
-              -e 's,%masquerade%,$(masquerade),' \
               -e 's,%smtpservers%,$(smtpservers),' \
-                               < $(srcdir)/etc/mts.conf.in > $@
+                               < $(srcdir)/etc/mts.conf.in > $@
 
 etc/mhn.defaults: $(srcdir)/etc/mhn.defaults.sh $(MHNSEARCHPROG)
-       rm -f $@
+       @rm -f $@
        $(srcdir)/etc/mhn.defaults.sh $(MHNSEARCHPATH) $(MHNSEARCHPROG) > $@
 
-etc/sendfiles: $(srcdir)/etc/sendfiles.in Makefile
-       rm -f $@
-       $(SED) -e 's,%libdir%,$(libdir),' < $(srcdir)/etc/sendfiles.in > $@
+##
+## Use configure to set up default LN, but through a make variable so
+## that it can be overridden at install time.
+##
+LN = @LN@
 
 ##
 ## This rule gets called at "make install" time; we use it to create links
 ## between different programs.
 ##
 install-exec-hook:
-       rm -f $(DESTDIR)$(bindir)/flists$(EXEEXT)
-       rm -f $(DESTDIR)$(bindir)/folders$(EXEEXT)
-       rm -f $(DESTDIR)$(bindir)/fnext$(EXEEXT)
-       rm -f $(DESTDIR)$(bindir)/fprev$(EXEEXT)
-       rm -f $(DESTDIR)$(bindir)/unseen$(EXEEXT)
-       rm -f $(DESTDIR)$(bindir)/prev$(EXEEXT)
-       rm -f $(DESTDIR)$(bindir)/next$(EXEEXT)
-       ln $(DESTDIR)$(bindir)/flist$(EXEEXT) $(DESTDIR)$(bindir)/flists$(EXEEXT)
-       ln $(DESTDIR)$(bindir)/folder$(EXEEXT) $(DESTDIR)$(bindir)/folders$(EXEEXT)
-       ln $(DESTDIR)$(bindir)/new$(EXEEXT) $(DESTDIR)$(bindir)/fnext$(EXEEXT)
-       ln $(DESTDIR)$(bindir)/new$(EXEEXT) $(DESTDIR)$(bindir)/fprev$(EXEEXT)
-       ln $(DESTDIR)$(bindir)/new$(EXEEXT) $(DESTDIR)$(bindir)/unseen$(EXEEXT)
-       ln $(DESTDIR)$(bindir)/show$(EXEEXT) $(DESTDIR)$(bindir)/prev$(EXEEXT)
-       ln $(DESTDIR)$(bindir)/show$(EXEEXT) $(DESTDIR)$(bindir)/next$(EXEEXT)
+       @rm -f $(DESTDIR)$(bindir)/flists$(EXEEXT)
+       @rm -f $(DESTDIR)$(bindir)/folders$(EXEEXT)
+       @rm -f $(DESTDIR)$(bindir)/fnext$(EXEEXT)
+       @rm -f $(DESTDIR)$(bindir)/fprev$(EXEEXT)
+       @rm -f $(DESTDIR)$(bindir)/unseen$(EXEEXT)
+       @rm -f $(DESTDIR)$(bindir)/prev$(EXEEXT)
+       @rm -f $(DESTDIR)$(bindir)/next$(EXEEXT)
+       $(LN) $(DESTDIR)$(bindir)/flist$(EXEEXT) $(DESTDIR)$(bindir)/flists$(EXEEXT)
+       $(LN) $(DESTDIR)$(bindir)/folder$(EXEEXT) $(DESTDIR)$(bindir)/folders$(EXEEXT)
+       $(LN) $(DESTDIR)$(bindir)/new$(EXEEXT) $(DESTDIR)$(bindir)/fnext$(EXEEXT)
+       $(LN) $(DESTDIR)$(bindir)/new$(EXEEXT) $(DESTDIR)$(bindir)/fprev$(EXEEXT)
+       $(LN) $(DESTDIR)$(bindir)/new$(EXEEXT) $(DESTDIR)$(bindir)/unseen$(EXEEXT)
+       $(LN) $(DESTDIR)$(bindir)/show$(EXEEXT) $(DESTDIR)$(bindir)/prev$(EXEEXT)
+       $(LN) $(DESTDIR)$(bindir)/show$(EXEEXT) $(DESTDIR)$(bindir)/next$(EXEEXT)
        if test x$(SETGID_MAIL) != x; then \
-               chgrp $(MAIL_SPOOL_GRP) $(DESTDIR)$(bindir)/inc$(EXEEXT); \
+               chgrp $(MAIL_SPOOL_GRP) $(DESTDIR)$(bindir)/inc$(EXEEXT) && \
                chmod 2755 $(DESTDIR)$(bindir)/inc$(EXEEXT); \
        fi
 
-install-data-hook:
-       rm -f $(DESTDIR)$(man5dir)/mh_profile.5
-       ln $(DESTDIR)$(man5dir)/mh-profile.5 $(DESTDIR)$(man5dir)/mh_profile.5
 ##
 ## Make sure we remove those links at uninstall time
 ##
@@ -412,20 +463,19 @@ uninstall-hook:
        rm -f $(DESTDIR)$(bindir)/unseen$(EXEEXT)
        rm -f $(DESTDIR)$(bindir)/prev$(EXEEXT)
        rm -f $(DESTDIR)$(bindir)/next$(EXEEXT)
-       rm -f $(DESTDIR)$(man5dir)/mh_profile.5
 
 ##
 ## Our rules to build our internal libraries (libmh.a, libmts.a)
 ##
-sbr_libmh_a_SOURCES = sbr/addrsbr.c sbr/ambigsw.c sbr/atooi.c sbr/brkstring.c \
-                     sbr/check_charset.c sbr/client.c sbr/closefds.c \
-                     sbr/concat.c sbr/context_del.c sbr/context_find.c \
-                     sbr/context_foil.c sbr/context_read.c \
+sbr_libmh_a_SOURCES = sbr/addrsbr.c sbr/ambigsw.c sbr/atooi.c sbr/base64.c \
+                     sbr/brkstring.c sbr/check_charset.c sbr/client.c \
+                     sbr/closefds.c sbr/concat.c sbr/context_del.c \
+                     sbr/context_find.c sbr/context_foil.c sbr/context_read.c \
                      sbr/context_replace.c sbr/context_save.c \
                      sbr/copy.c sbr/copyip.c sbr/cpydata.c \
                      sbr/cpydgst.c sbr/crawl_folders.c sbr/discard.c \
-                     sbr/done.c sbr/dtime.c \
-                     sbr/error.c  sbr/ext_hook.c sbr/fdcompare.c \
+                     sbr/done.c sbr/dtime.c sbr/escape_addresses.c \
+                     sbr/error.c sbr/ext_hook.c sbr/fdcompare.c \
                      sbr/folder_addmsg.c sbr/folder_delmsgs.c \
                      sbr/folder_free.c sbr/folder_pack.c \
                      sbr/folder_read.c sbr/folder_realloc.c sbr/gans.c \
@@ -435,8 +485,9 @@ sbr_libmh_a_SOURCES = sbr/addrsbr.c sbr/ambigsw.c sbr/atooi.c sbr/brkstring.c \
                      sbr/fmt_rfc2047.c sbr/fmt_scan.c sbr/lock_file.c \
                      sbr/m_atoi.c sbr/m_backup.c sbr/m_convert.c \
                      sbr/m_draft.c sbr/m_getfld.c sbr/m_gmprot.c \
-                     sbr/m_maildir.c sbr/m_name.c sbr/m_setjmp.c \
-                     sbr/makedir.c sbr/mts.c sbr/norm_charmap.c sbr/path.c \
+                     sbr/m_maildir.c sbr/m_name.c sbr/m_rand.c \
+                     sbr/makedir.c sbr/message_id.c sbr/mts.c \
+                     sbr/norm_charmap.c sbr/path.c \
                      sbr/peekc.c sbr/pidwait.c sbr/pidstatus.c \
                      sbr/print_help.c sbr/print_sw.c sbr/print_version.c \
                      sbr/push.c sbr/putenv.c sbr/refile.c sbr/remdir.c \
@@ -449,58 +500,58 @@ sbr_libmh_a_SOURCES = sbr/addrsbr.c sbr/ambigsw.c sbr/atooi.c sbr/brkstring.c \
                      sbr/snprintb.c sbr/ssequal.c sbr/strcasecmp.c \
                      sbr/strindex.c sbr/trimcpy.c sbr/uprf.c sbr/vfgets.c \
                      sbr/fmt_def.c sbr/m_msgdef.c sbr/mf.c sbr/utils.c \
-                     sbr/m_mktemp.c config/config.c config/version.c
+                     sbr/m_mktemp.c sbr/getansreadline.c config/config.c \
+                     config/version.c
 
 sbr_libmh_a_CPPFLAGS = -I./sbr -DNMHETCDIR='"$(sysconfdir)"' \
                -DMAILSPOOL='"$(mailspool)"' \
                -DSENDMAILPATH='"$(sendmailpath)"' -DNMHBINDIR='"$(bindir)"' \
                -DNMHLIBDIR='"$(libdir)"' \
-               -DDEFAULT_EDITOR='"$(default_editor)"' \
-               -DDEFAULT_PAGER='"$(default_pager)"'
+               -DDEFAULT_EDITOR='"$(editorpath)"' \
+               -DDEFAULT_PAGER='"$(pagerpath)"'
 
 sbr_libdtimep_a_SOURCES = sbr/dtimep.l
-sbr_libdtimep_a_CFLAGS = $(sbr_libmh_a_CPPFLAGS) $(DISABLE_UNUSED_MACROS_WARNING)
+sbr_libdtimep_a_CFLAGS = $(sbr_libmh_a_CPPFLAGS) \
+                        $(DISABLE_UNUSED_MACROS_WARNING) \
+                        $(DISABLE_SIGN_COMPARE_WARNING)
 
-mts_libmts_a_SOURCES = mts/smtp/hosts.c mts/smtp/smtp.c
+mts_libmts_a_SOURCES = mts/smtp/smtp.c
 
 ##
 ## Our rules for generating man pages (both the rule for man.sed and
 ## the implicit rules for man page generation).
 ##
-
 manext1 = 1
 manext5 = 5
+manext7 = 7
 manext8 = 8
 
 $(man_MANS): man/man.sed
 
 man/man.sed: Makefile
-       echo 's,%nmhwarning%,THIS FILE HAS BEEN AUTOMATICALLY GENERATED.  DO NOT EDIT.,g' > $@
-       echo 's,%nmhversion%,nmh-$(VERSION),g' >> $@
-       echo 's,%nmhdate%,$(DATE),g' >> $@
-       echo 's,%bindir%,$(bindir),g' >> $@
-       echo 's,%etcdir%,$(sysconfdir),g' >> $@
-       echo 's,%libdir%,$(libdir),g' >> $@
-       echo 's,%mandir%,$(mandir),g' >> $@
-       echo 's,%mailspool%,$(mailspool),g' >> $@
-       echo 's,%sendmailpath%,$(sendmailpath),g' >> $@
-       echo 's,%default_editor%,$(default_editor),g' >> $@
-       echo 's,%default_pager%,$(default_pager),g' >> $@
-       echo 's,%manext1%,$(manext1),g' >> $@
-       echo 's,%manext5%,$(manext5),g' >> $@
-       echo 's,%manext8%,$(manext8),g' >> $@
-       echo '/%components%/r $(top_srcdir)/etc/components' >> $@
-       echo ' s,%components%,,g' >> $@
-       echo '/%distcomps%/r $(top_srcdir)/etc/distcomps' >> $@
-       echo ' s,%distcomps%,,g' >> $@
-       echo '/%forwcomps%/r $(top_srcdir)/etc/forwcomps' >> $@
-       echo ' s,%forwcomps%,,g' >> $@
-       echo '/%mhl_forward%/r $(top_srcdir)/etc/mhl.forward' >> $@
-       echo ' s,%mhl_forward%,,g' >> $@
-       echo '/%mhl_format%/r $(top_srcdir)/etc/mhl.format' >> $@
-       echo ' s,%mhl_format%,,g' >> $@
-       echo '/%mhl_reply%/r $(top_srcdir)/etc/mhl.reply' >> $@
-       echo ' s,%mhl_reply%,,g' >> $@
+       @echo 's,%nmhwarning%,THIS FILE HAS BEEN AUTOMATICALLY GENERATED.  DO NOT EDIT.,g' > $@
+       @echo 's,%nmhversion%,nmh-$(VERSION),g' >> $@
+       @echo 's,%bindir%,$(bindir),g' >> $@
+       @echo 's,%etcdir%,$(sysconfdir),g' >> $@
+       @echo 's,%libdir%,$(libdir),g' >> $@
+       @echo 's,%mandir%,$(mandir),g' >> $@
+       @echo 's,%mailspool%,$(mailspool),g' >> $@
+       @echo 's,%sendmailpath%,$(sendmailpath),g' >> $@
+       @echo 's,%default_editor%,$(editorpath),g' >> $@
+       @echo 's,%default_pager%,$(pagerpath),g' >> $@
+       @echo 's,%manext1%,$(manext1),g' >> $@
+       @echo 's,%manext5%,$(manext5),g' >> $@
+       @echo 's,%manext7%,$(manext7),g' >> $@
+       @echo 's,%manext8%,$(manext8),g' >> $@
+       @echo '/%mhl_forward%/r $(top_srcdir)/etc/mhl.forward' >> $@
+       @echo ' s,%mhl_forward%,,g' >> $@
+       @echo '/%mhl_format%/r $(top_srcdir)/etc/mhl.format' >> $@
+       @echo ' s,%mhl_format%,,g' >> $@
+       @echo '/%mhl_reply%/r $(top_srcdir)/etc/mhl.reply' >> $@
+       @echo ' s,%mhl_reply%,,g' >> $@
+
+man/mh-chart.man:
+       $(srcdir)/man/mh-chart-gen.sh > $@
 
 .man.$(manext1):
        $(SED) -f man/man.sed $< > $@
@@ -508,9 +559,19 @@ man/man.sed: Makefile
 .man.$(manext5):
        $(SED) -f man/man.sed $< > $@
 
+.man.$(manext7):
+       $(SED) -f man/man.sed $< > $@
+
 .man.$(manext8):
        $(SED) -f man/man.sed $< > $@
 
+man: $(man_MANS)
+
+cleanman:
+       rm -f $(man_MANS)
+
+.PHONY: man cleanman
+
 ## Don't include commit hashes in ChangeLog.
 ChangeLog:
        @[ -d .git ]  &&  git --no-pager log --abbrev-commit | \
@@ -523,30 +584,55 @@ ChangeLog:
 ##
 ## Our RPM build target
 ##
-
 rpm: dist
        @test -d $(rpmdir)/SOURCES || $(MKDIR_P) $(rpmdir)/SOURCES
-       @test -d $(rpmdir)/SPECS || $(MKDIR_P) $(rpmdir)/SPECS
        @mv -f $(DIST_ARCHIVES) $(rpmdir)/SOURCES
        @cp -p VERSION $(rpmdir)/SOURCES
-       @cp -p nmh.spec $(rpmdir)/SPECS
        @rpmbuild --define '_topdir $(rpmdir)' \
          --define '_tmppath %{_topdir}/TMP' \
-         -ba $(rpmdir)/SPECS/nmh.spec
+         --define "_sysconfdir $(DESTDIR)$(sysconfdir)" \
+         -ba SPECS/nmh.spec
 .PHONY: rpm
 
 ##
 ## A target to build information needed by cscope
 ##
-
 cscope:
        echo "-I $(srcdir)/h -I $(srcdir)/sbr -I $(srcdir)/uip -I $(srcdir)/mts/smtp" > cscope.files
-       find $(srcdir) \( -name \*.c -o -name \*.l \) -print | grep -v dtimep.c >> cscope.files
+       find $(srcdir) \( -name docs -prune \) -o \( -name \*.c -o -name \*.l \) -print | grep -v dtimep.c >> cscope.files
+.PHONY: cscope
+
+
+##
+## Use GNU gcov to find the coverage of the test suite.
+## These targets are not integrated into the other automake
+## targets because they will be used so infrequently, if at all.
+##
+gcov:
+       @if ./config.status --config | grep -e --enable-debug >/dev/null; then \
+          echo For best results with gcov, configure without --enable-debug; \
+        fi
+       @echo rebuilding with AM_CFLAGS=--coverage . . .
+       @(make clean  &&  make AM_CFLAGS=--coverage) > /dev/null  && \
+         make check AM_CFLAGS=--coverage
+       @for i in `find . -name '*.gcda'`; do \
+          gcov -p -o `echo $$i | $(SED) 's%\\(.*\\)/%\\1 %'`; \
+        done
+       @for i in `find . -name '*.gcno'`; do \
+          if test -f `echo $$i | sed 's%\.gcno%.gcda%'`; then :; else \
+            echo untested: $$i; \
+          fi; \
+        done
+gcov-mostlyclean:
+       @find . -name '*.gcno' -o -name '*.gcda' | xargs rm
+gcov-clean: gcov-mostlyclean
+       @find . -name '*.gcov' | xargs rm
+.PHONY: gcov gcov-mostlyclean gcov-clean
+
 
 ##
 ## Rules to upload the distribution to savannah
 ##
-
 upload: dist
        @if test -z "$(SAVANNAH_USERNAME)"; then \
                echo "You need to set SAVANNAH_USERNAME to the your username on savannah.gnu.org." ;\
@@ -556,7 +642,7 @@ upload: dist
        @echo "Did you run 'make distcheck' already?"
        @if test -z "$(SKIP_GPG_SIG)"; then \
                echo "Creating GPG signature (set SKIP_GPG_SIG to bypass this step)"; \
-               gpg --output $(DIST_ARCHIVES).sig --detatch-sig $(DIST_ARCHIVES); \
+               gpg --output $(DIST_ARCHIVES).sig --detach-sig $(DIST_ARCHIVES); \
        fi
        @echo "Setting permissions for savannah.gnu.org"
        chmod 664 $(DIST_ARCHIVES)
@@ -564,5 +650,5 @@ upload: dist
                chmod 664 $(DIST_ARCHIVES).sig; \
        fi
        @echo "Uploading to savannah"
-       scp -p $(DIST_ARCHIVES)* $(SAVANNAH_USERNAME)@savannah.gnu.org:/releases/nmh
+       scp -p $(DIST_ARCHIVES)* $(SAVANNAH_USERNAME)@dl.sv.nongnu.org:/releases/nmh
 .PHONY: upload