Commit fa54cb19 fa54cb19078773382fb1db24bbf450a9962e186d by Sergey Poznyakoff

Fix conditional compilation.

* .gitignore: Add git-describe and git-describe.h.
* Makefile.am (MU_COND_LIBMU_CPP): Replaced with MU_COND_SUPPORT_CXX
(SUBDIRS): Begin with .
(EXTRA_DIST, BUILT_SOURCES): Add git-describe and git-describe.h.
(git-describe, git-describe.h): New rules.
(alpha, alphacheck): Use git-describe to produce additional suffix.
* enable.m4 (MU_ENABLE_SUPPORT): Create an Automake condition.
* configure.ac: Fix MU_ENABLE_SUPPORT calls.
(--without-python): Replace with --disable-python.
* examples/Makefile.am: Disable components based on MU_COND conditions.
* libproto/Makefile.am: Likewise.
* include/mailutils/Makefile.am (MU_COND_LIBMU_CPP): Replace with
MU_COND_SUPPORT_CXX.

* mailbox/nullrec.c: New file.
* mailbox/Makefile.am (libmailutils_la_SOURCES): Add nullrec.c.

* mail/decode.c: Remove unused variable.
* mailbox/streamref.c: Likewise.
1 parent dfea400b
...@@ -22,6 +22,8 @@ config.h.in ...@@ -22,6 +22,8 @@ config.h.in
22 config.log 22 config.log
23 config.status 23 config.status
24 configure 24 configure
25 git-describe
26 git-describe.h
25 libtool 27 libtool
26 m4 28 m4
27 pathdefs.h 29 pathdefs.h
......
...@@ -85,11 +85,11 @@ if MU_COND_LIBMU_SCM ...@@ -85,11 +85,11 @@ if MU_COND_LIBMU_SCM
85 LIBMU_SCM_DIR = libmu_scm 85 LIBMU_SCM_DIR = libmu_scm
86 endif 86 endif
87 87
88 if MU_COND_LIBMU_CPP 88 if MU_COND_SUPPORT_CXX
89 LIBMU_CPP_DIR = libmu_cpp 89 LIBMU_CPP_DIR = libmu_cpp
90 endif 90 endif
91 91
92 SUBDIRS = \ 92 SUBDIRS = . \
93 mu-aux\ 93 mu-aux\
94 include\ 94 include\
95 po\ 95 po\
...@@ -124,8 +124,8 @@ SUBDIRS = \ ...@@ -124,8 +124,8 @@ SUBDIRS = \
124 $(MOVEMAIL_DIR)\ 124 $(MOVEMAIL_DIR)\
125 $(MIMEVIEW_DIR) 125 $(MIMEVIEW_DIR)
126 126
127 EXTRA_DIST = COPYING.LESSER paths 127 EXTRA_DIST = COPYING.LESSER paths git-describe git-describe.h
128 128 BUILT_SOURCES = git-describe git-describe.h
129 DISTCLEANFILES = pathdefs.h 129 DISTCLEANFILES = pathdefs.h
130 130
131 gen_start_date = "2008-12-08" 131 gen_start_date = "2008-12-08"
...@@ -155,12 +155,45 @@ ChangeLog: ...@@ -155,12 +155,45 @@ ChangeLog:
155 mv cl-t ChangeLog; \ 155 mv cl-t ChangeLog; \
156 fi 156 fi
157 157
158 alpha: 158 .PHONY: git-describe
159 $(MAKE) dist distdir=$(PACKAGE)-$(VERSION)-`date +"%Y%m%d"` 159 git-describe:
160 $(AM_V_GEN)if test -d .git; then \
161 dirty=`git diff-index --name-only HEAD 2>/dev/null` || dirty=;\
162 test -n "$$dirty" && dirty="-dirty"; \
163 descr=`git describe`; \
164 echo $${descr}$$dirty > git-describe; \
165 fi
160 166
161 alphacheck: 167 dist-hook: ChangeLog git-describe
162 $(MAKE) distcheck distdir=$(PACKAGE)-$(VERSION)-`date +"%Y%m%d"` 168 @PATCHLEV=`echo "$(PACKAGE_VERSION)" | \
169 sed -r "s/[0-9]+\.[0-9]+\.?//"`; \
170 if test $${PATCHLEV:-0} -lt 50; then \
171 if grep -q FIXME NEWS; then \
172 echo >&2 "NEWS file contains FIXMEs"; \
173 exit 1; \
174 fi; \
175 fi
176
177 git-describe.h: git-describe
178 $(AM_V_GEN)if test -f $(srcdir)/git-describe; then \
179 sed '1s/.*/#define GIT_DESCRIBE "&"/' $(srcdir)/git-describe; \
180 else \
181 echo "/* No git tag */"; \
182 fi > git-describe.h
183
184 alpha: git-describe
185 $(AM_V_GEN)if test -f $(srcdir)/git-describe; then \
186 tag=`head -n 1 $(srcdir)/git-describe`; \
187 else \
188 tag=`date +"%Y%m%d"`; \
189 fi; \
190 $(MAKE) dist distdir=$(PACKAGE)-$(VERSION)-$$tag
163 191
164 rpm: dist 192 alphacheck:
165 rpm -ta --clean mailutils-$(VERSION).tar.gz 193 $(AM_V_GEN)if test -f $(srcdir)/git-describe; then \
194 tag=`head -n 1 $(srcdir)/git-describe`; \
195 else \
196 tag=`date +"%Y%m%d"`; \
197 fi; \
198 $(MAKE) distcheck distdir=$(PACKAGE)-$(VERSION)-$$tag
166 199
......
...@@ -23,6 +23,7 @@ dnl [default-value]) ...@@ -23,6 +23,7 @@ dnl [default-value])
23 AC_DEFUN([MU_ENABLE_SUPPORT], [ 23 AC_DEFUN([MU_ENABLE_SUPPORT], [
24 pushdef([mu_upcase],translit($1,[a-z+-],[A-ZX_])) 24 pushdef([mu_upcase],translit($1,[a-z+-],[A-ZX_]))
25 pushdef([mu_cache_var],[mu_cv_enable_]translit($1,[+-],[x_])) 25 pushdef([mu_cache_var],[mu_cv_enable_]translit($1,[+-],[x_]))
26 pushdef([mu_cond],[MU_COND_SUPPORT_]mu_upcase)
26 27
27 AC_ARG_ENABLE($1, 28 AC_ARG_ENABLE($1,
28 AC_HELP_STRING([--disable-]$1, 29 AC_HELP_STRING([--disable-]$1,
...@@ -43,8 +44,11 @@ AC_DEFUN([MU_ENABLE_SUPPORT], [ ...@@ -43,8 +44,11 @@ AC_DEFUN([MU_ENABLE_SUPPORT], [
43 if test x"[$]mu_cache_var" = x"yes"; then 44 if test x"[$]mu_cache_var" = x"yes"; then
44 AC_DEFINE([ENABLE_]mu_upcase,1,[Define this if you enable $1 support]) 45 AC_DEFINE([ENABLE_]mu_upcase,1,[Define this if you enable $1 support])
45 fi 46 fi
46 popdef([mu_upcase]) 47 AM_CONDITIONAL(mu_cond,
48 [test x"[$]mu_cache_var" = x"yes" ifelse($4,,,[&& $4])])
49 popdef([mu_cond])
47 popdef([mu_cache_var]) 50 popdef([mu_cache_var])
51 popdef([mu_upcase])
48 ]) 52 ])
49 53
50 dnl MU_ENABLE_BUILD(feature, [action-if-true], [action-if-false], 54 dnl MU_ENABLE_BUILD(feature, [action-if-true], [action-if-false],
......
...@@ -40,16 +40,16 @@ dnl Library paths ...@@ -40,16 +40,16 @@ dnl Library paths
40 AC_SUBST(MU_LIB_AUTH,'${top_builddir}/libmu_auth/libmu_auth.la') 40 AC_SUBST(MU_LIB_AUTH,'${top_builddir}/libmu_auth/libmu_auth.la')
41 AC_SUBST(MU_LIB_MAILUTILS,'${top_builddir}/mailbox/libmailutils.la') 41 AC_SUBST(MU_LIB_MAILUTILS,'${top_builddir}/mailbox/libmailutils.la')
42 AC_SUBST(MU_LIB_SQL,'${top_builddir}/sql/libsql.la') 42 AC_SUBST(MU_LIB_SQL,'${top_builddir}/sql/libsql.la')
43 AC_SUBST(MU_LIB_IMAP,'${top_builddir}/libproto/imap/libmu_imap.la') 43 AC_SUBST(MU_LIB_IMAP)
44 AC_SUBST(MU_LIB_MAILDIR,'${top_builddir}/libproto/maildir/libmu_maildir.la') 44 AC_SUBST(MU_LIB_MAILDIR)
45 AC_SUBST(MU_LIB_MAILER,'${top_builddir}/libproto/mailer/libmu_mailer.la') 45 AC_SUBST(MU_LIB_MAILER,'${top_builddir}/libproto/mailer/libmu_mailer.la')
46 AC_SUBST(MU_LIB_MBOX,'${top_builddir}/libproto/mbox/libmu_mbox.la') 46 AC_SUBST(MU_LIB_MBOX,'${top_builddir}/libproto/mbox/libmu_mbox.la')
47 AC_SUBST(MU_LIB_MH,'${top_builddir}/libproto/mh/libmu_mh.la') 47 AC_SUBST(MU_LIB_MH)
48 AC_SUBST(MU_LIB_NNTP,'${top_builddir}/libproto/nntp/libmu_nntp.la') 48 AC_SUBST(MU_LIB_NNTP)
49 AC_SUBST(MU_LIB_POP,'${top_builddir}/libproto/pop/libmu_pop.la') 49 AC_SUBST(MU_LIB_POP)
50 AC_SUBST(MU_LIB_SIEVE,'${top_builddir}/libmu_sieve/libmu_sieve.la') 50 AC_SUBST(MU_LIB_SIEVE,'${top_builddir}/libmu_sieve/libmu_sieve.la')
51 AC_SUBST(MU_LIB_SCM,'${top_builddir}/libmu_scm/libmu_scm.la') 51 AC_SUBST(MU_LIB_SCM)
52 AC_SUBST(MU_LIB_CPP,'${top_builddir}/libmu_cpp/libmu_cpp.la') 52 AC_SUBST(MU_LIB_CPP)
53 AC_SUBST(MU_LIB_ARGP,'${top_builddir}/libmu_argp/libmu_argp.la') 53 AC_SUBST(MU_LIB_ARGP,'${top_builddir}/libmu_argp/libmu_argp.la')
54 AC_SUBST(MU_LIB_PY) 54 AC_SUBST(MU_LIB_PY)
55 55
...@@ -805,9 +805,17 @@ AC_ARG_WITH([virtual-pwddir], ...@@ -805,9 +805,17 @@ AC_ARG_WITH([virtual-pwddir],
805 *) SITE_VIRTUAL_PWDDIR="\$(sysconfdir)/${withval}";; 805 *) SITE_VIRTUAL_PWDDIR="\$(sysconfdir)/${withval}";;
806 esac], 806 esac],
807 [SITE_VIRTUAL_PWDDIR="\$(sysconfdir)/domain"]) 807 [SITE_VIRTUAL_PWDDIR="\$(sysconfdir)/domain"])
808 MU_ENABLE_SUPPORT(imap) 808
809 MU_ENABLE_SUPPORT(pop) 809 MU_ENABLE_SUPPORT([imap],
810 MU_ENABLE_SUPPORT(nntp) 810 [MU_LIB_IMAP='${top_builddir}/libproto/imap/libmu_imap.la'])
811 MU_ENABLE_SUPPORT([pop],
812 [MU_LIB_POP='${top_builddir}/libproto/pop/libmu_pop.la'])
813 MU_ENABLE_SUPPORT([nntp],
814 [MU_LIB_NNTP='${top_builddir}/libproto/nntp/libmu_nntp.la'])
815 MU_ENABLE_SUPPORT([mh],
816 [MU_LIB_MH='${top_builddir}/libproto/mh/libmu_mh.la'])
817 MU_ENABLE_SUPPORT([maildir],
818 [MU_LIB_MAILDIR='${top_builddir}/libproto/maildir/libmu_maildir.la'])
811 819
812 AC_SUBST(MU_SMTP_PROGRAMS_BUILD) 820 AC_SUBST(MU_SMTP_PROGRAMS_BUILD)
813 AC_SUBST(MU_SMTP_DEJATOOL) 821 AC_SUBST(MU_SMTP_DEJATOOL)
...@@ -819,9 +827,6 @@ MU_ENABLE_SUPPORT(sendmail) ...@@ -819,9 +827,6 @@ MU_ENABLE_SUPPORT(sendmail)
819 827
820 MU_ENABLE_SUPPORT(prog) 828 MU_ENABLE_SUPPORT(prog)
821 829
822 MU_ENABLE_SUPPORT(mh)
823
824 MU_ENABLE_SUPPORT(maildir)
825 830
826 # FIXME: Should be --with-radius 831 # FIXME: Should be --with-radius
827 MU_ENABLE_SUPPORT(radius, 832 MU_ENABLE_SUPPORT(radius,
...@@ -1091,14 +1096,14 @@ fi ...@@ -1091,14 +1096,14 @@ fi
1091 AC_SUBST(lisp_LISP) 1096 AC_SUBST(lisp_LISP)
1092 1097
1093 # Check for Python 1098 # Check for Python
1094 AC_ARG_WITH([python], 1099 AC_ARG_ENABLE([python],
1095 AC_HELP_STRING([--without-python], 1100 AC_HELP_STRING([--disable-python],
1096 [do not build Python interface]), 1101 [do not build Python interface]),
1097 [ 1102 [
1098 case "${withval}" in 1103 case "${enableval}" in
1099 yes) status_python=yes ;; 1104 yes) status_python=yes ;;
1100 no) status_python=no ;; 1105 no) status_python=no ;;
1101 *) AC_MSG_ERROR(bad value ${withval} for --without-python) ;; 1106 *) AC_MSG_ERROR(bad value ${enableval} for --enable-python) ;;
1102 esac],[status_python=yes]) 1107 esac],[status_python=yes])
1103 1108
1104 AC_SUBST(PYTHON_LIBS) 1109 AC_SUBST(PYTHON_LIBS)
...@@ -1138,8 +1143,8 @@ AM_CONDITIONAL([MU_COND_PYTHON], [test "$status_python" = yes]) ...@@ -1138,8 +1143,8 @@ AM_CONDITIONAL([MU_COND_PYTHON], [test "$status_python" = yes])
1138 1143
1139 AC_SUBST(MU_CXX_EXAMPLES_BUILD) 1144 AC_SUBST(MU_CXX_EXAMPLES_BUILD)
1140 MU_ENABLE_SUPPORT(cxx, 1145 MU_ENABLE_SUPPORT(cxx,
1141 [MU_CXX_EXAMPLES_BUILD='$(MU_CXX_EXAMPLES_LIST)']) 1146 [MU_CXX_EXAMPLES_BUILD='$(MU_CXX_EXAMPLES_LIST)'
1142 AM_CONDITIONAL([MU_COND_LIBMU_CPP], [test "$mu_cv_enable_cxx" = yes]) 1147 MU_LIB_CPP='${top_builddir}/libmu_cpp/libmu_cpp.la'])
1143 1148
1144 # Default mailbox record 1149 # Default mailbox record
1145 # Note: 1. Support for mbox type is always enabled. 1150 # Note: 1. Support for mbox type is always enabled.
...@@ -1224,12 +1229,13 @@ case `echo $VERSION|sed 's/[[^.]]//g'` in ...@@ -1224,12 +1229,13 @@ case `echo $VERSION|sed 's/[[^.]]//g'` in
1224 "..") if test `echo $VERSION | sed 's/.*\.//'` -lt 50; then 1229 "..") if test `echo $VERSION | sed 's/.*\.//'` -lt 50; then
1225 RENDITION=DISTRIB 1230 RENDITION=DISTRIB
1226 else 1231 else
1232 AC_DEFINE_UNQUOTED([MU_ALPHA_RELEASE], 1,
1233 [Define if this is an alpha release])
1227 RENDITION=PROOF 1234 RENDITION=PROOF
1228 fi;; 1235 fi;;
1229 *) RENDITION=PROOF;; 1236 *) RENDITION=PROOF;;
1230 esac 1237 esac
1231 1238
1232
1233 AC_CONFIG_COMMANDS([status],[ 1239 AC_CONFIG_COMMANDS([status],[
1234 cat <<EOF 1240 cat <<EOF
1235 1241
......
...@@ -18,7 +18,19 @@ ...@@ -18,7 +18,19 @@
18 ## Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 18 ## Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA
19 ## 02110-1301 USA 19 ## 02110-1301 USA
20 20
21 SUBDIRS = config cpp python scheme 21 if MU_COND_SUPPORT_POP
22 POP3CLIENT = pop3client
23 endif
24
25 if MU_COND_SUPPORT_NNTP
26 NNTPCLIENT = nntpclient
27 endif
28
29 if MU_COND_SUPPORT_CXX
30 CPP_DIR = cpp
31 endif
32
33 SUBDIRS = config $(CPP_DIR) python scheme
22 34
23 noinst_PROGRAMS = \ 35 noinst_PROGRAMS = \
24 aclck\ 36 aclck\
...@@ -40,11 +52,13 @@ noinst_PROGRAMS = \ ...@@ -40,11 +52,13 @@ noinst_PROGRAMS = \
40 muauth\ 52 muauth\
41 muemail\ 53 muemail\
42 murun\ 54 murun\
43 nntpclient\ 55 $(NNTPCLIENT)\
44 pop3client \ 56 $(POP3CLIENT)\
45 sfrom\ 57 sfrom\
46 url-parse 58 url-parse
47 59
60 EXTRA_PROGRAMS = pop3client nntpclient
61
48 ## NOTE: Numaddr must be an installable target, otherwise libtool 62 ## NOTE: Numaddr must be an installable target, otherwise libtool
49 ## will not create a shared library and `make check' will fail in 63 ## will not create a shared library and `make check' will fail in
50 ## sieve. Pity. 64 ## sieve. Pity.
......
...@@ -98,7 +98,7 @@ pkginclude_HEADERS = \ ...@@ -98,7 +98,7 @@ pkginclude_HEADERS = \
98 vartab.h\ 98 vartab.h\
99 version.h 99 version.h
100 100
101 if MU_COND_LIBMU_CPP 101 if MU_COND_SUPPORT_CXX
102 CPP_DIR = cpp 102 CPP_DIR = cpp
103 endif 103 endif
104 104
......
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2001, 2004, 2005, 2007, 2009, 2010 Free
3 Software Foundation, Inc.
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 3 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General
16 Public License along with this library; if not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301 USA */
19
20 #ifndef _MAILUTILS_ARGP_H
21 #define _MAILUTILS_ARGP_H
22
23 #include <mailutils/types.h>
24 #include <argp.h>
25 #include <errno.h> /* May declare program_invocation_name */
26
27 extern char *mu_license_text;
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 extern void mu_argp_init (struct argp *argp, const char *vers,
34 const char *bugaddr, const char *capa[]);
35 extern void mu_argp_done (struct argp *argp);
36
37 extern int mu_register_argp_capa (const char *name, struct argp_child *child);
38
39 extern void mu_print_options (void);
40
41 #ifdef __cplusplus
42 }
43 #endif
44
45 #endif
46
...@@ -17,5 +17,25 @@ ...@@ -17,5 +17,25 @@
17 ## Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 17 ## Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA
18 ## 02110-1301 USA 18 ## 02110-1301 USA
19 19
20 SUBDIRS = include mbox pop nntp imap mh maildir mailer 20 if MU_COND_SUPPORT_POP
21 POP_DIR = pop
22 endif
23
24 if MU_COND_SUPPORT_IMAP
25 IMAP_DIR = imap
26 endif
27
28 if MU_COND_SUPPORT_NNTP
29 NNTP_DIR = nntp
30 endif
31
32 if MU_COND_SUPPORT_MH
33 MH_DIR = mh
34 endif
35
36 if MU_COND_SUPPORT_MAILDIR
37 MAILDIR_DIR = maildir
38 endif
39
40 SUBDIRS = include mbox $(POP_DIR) $(NNTP_DIR) $(IMAP_DIR) $(MH_DIR) $(MAILDIR_DIR) mailer
21 41
......
...@@ -318,7 +318,6 @@ print_stream (mu_stream_t stream, FILE *out) ...@@ -318,7 +318,6 @@ print_stream (mu_stream_t stream, FILE *out)
318 { 318 {
319 char buffer[512]; 319 char buffer[512];
320 size_t n = 0; 320 size_t n = 0;
321 int rc;
322 321
323 while (mu_stream_read (stream, buffer, sizeof (buffer) - 1, &n) == 0 322 while (mu_stream_read (stream, buffer, sizeof (buffer) - 1, &n) == 0
324 && n != 0) 323 && n != 0)
......
...@@ -114,6 +114,7 @@ libmailutils_la_SOURCES = \ ...@@ -114,6 +114,7 @@ libmailutils_la_SOURCES = \
114 muerror.c\ 114 muerror.c\
115 muerrno.c\ 115 muerrno.c\
116 nls.c\ 116 nls.c\
117 nullrec.c\
117 observer.c\ 118 observer.c\
118 opool.c\ 119 opool.c\
119 parse822.c\ 120 parse822.c\
......
1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2001, 2002, 2004,
3 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
4
5 This library is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 3, or (at your option)
8 any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. */
17
18 /* This file provides replacement definitions for mu_record_t defined
19 in those MU libraries which are disabled at configure time. */
20 #ifdef HAVE_CONFIG_H
21 # include <config.h>
22 #endif
23
24 #include <stdlib.h>
25 #include <mailutils/types.h>
26 #include <mailutils/registrar.h>
27
28 #ifndef ENABLE_IMAP
29 mu_record_t mu_imap_record = NULL;
30 mu_record_t mu_imaps_record = NULL;
31 #endif
32
33 #ifndef ENABLE_POP
34 mu_record_t mu_pop_record = NULL;
35 mu_record_t mu_pops_record = NULL;
36 #endif
37
38 #ifndef ENABLE_NNTP
39 mu_record_t mu_nntp_record = NULL;
40 #endif
41
42 #ifndef ENABLE_MH
43 mu_record_t mu_mh_record = NULL;
44 #endif
45
46 #ifndef ENABLE_MAILDIR
47 mu_record_t mu_maildir_record = NULL;
48 #endif
49
...@@ -156,7 +156,6 @@ static int ...@@ -156,7 +156,6 @@ static int
156 _streamref_seek (struct _mu_stream *str, mu_off_t off, mu_off_t *ppos) 156 _streamref_seek (struct _mu_stream *str, mu_off_t off, mu_off_t *ppos)
157 { 157 {
158 struct _mu_streamref *sp = (struct _mu_streamref *)str; 158 struct _mu_streamref *sp = (struct _mu_streamref *)str;
159 mu_off_t cur = sp->offset - sp->start;
160 mu_off_t size; 159 mu_off_t size;
161 int rc; 160 int rc;
162 161
......