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
config.log
config.status
configure
git-describe
git-describe.h
libtool
m4
pathdefs.h
......
......@@ -85,11 +85,11 @@ if MU_COND_LIBMU_SCM
LIBMU_SCM_DIR = libmu_scm
endif
if MU_COND_LIBMU_CPP
if MU_COND_SUPPORT_CXX
LIBMU_CPP_DIR = libmu_cpp
endif
SUBDIRS = \
SUBDIRS = . \
mu-aux\
include\
po\
......@@ -124,8 +124,8 @@ SUBDIRS = \
$(MOVEMAIL_DIR)\
$(MIMEVIEW_DIR)
EXTRA_DIST = COPYING.LESSER paths
EXTRA_DIST = COPYING.LESSER paths git-describe git-describe.h
BUILT_SOURCES = git-describe git-describe.h
DISTCLEANFILES = pathdefs.h
gen_start_date = "2008-12-08"
......@@ -155,12 +155,45 @@ ChangeLog:
mv cl-t ChangeLog; \
fi
alpha:
$(MAKE) dist distdir=$(PACKAGE)-$(VERSION)-`date +"%Y%m%d"`
.PHONY: git-describe
git-describe:
$(AM_V_GEN)if test -d .git; then \
dirty=`git diff-index --name-only HEAD 2>/dev/null` || dirty=;\
test -n "$$dirty" && dirty="-dirty"; \
descr=`git describe`; \
echo $${descr}$$dirty > git-describe; \
fi
alphacheck:
$(MAKE) distcheck distdir=$(PACKAGE)-$(VERSION)-`date +"%Y%m%d"`
dist-hook: ChangeLog git-describe
@PATCHLEV=`echo "$(PACKAGE_VERSION)" | \
sed -r "s/[0-9]+\.[0-9]+\.?//"`; \
if test $${PATCHLEV:-0} -lt 50; then \
if grep -q FIXME NEWS; then \
echo >&2 "NEWS file contains FIXMEs"; \
exit 1; \
fi; \
fi
git-describe.h: git-describe
$(AM_V_GEN)if test -f $(srcdir)/git-describe; then \
sed '1s/.*/#define GIT_DESCRIBE "&"/' $(srcdir)/git-describe; \
else \
echo "/* No git tag */"; \
fi > git-describe.h
alpha: git-describe
$(AM_V_GEN)if test -f $(srcdir)/git-describe; then \
tag=`head -n 1 $(srcdir)/git-describe`; \
else \
tag=`date +"%Y%m%d"`; \
fi; \
$(MAKE) dist distdir=$(PACKAGE)-$(VERSION)-$$tag
rpm: dist
rpm -ta --clean mailutils-$(VERSION).tar.gz
alphacheck:
$(AM_V_GEN)if test -f $(srcdir)/git-describe; then \
tag=`head -n 1 $(srcdir)/git-describe`; \
else \
tag=`date +"%Y%m%d"`; \
fi; \
$(MAKE) distcheck distdir=$(PACKAGE)-$(VERSION)-$$tag
......
......@@ -23,6 +23,7 @@ dnl [default-value])
AC_DEFUN([MU_ENABLE_SUPPORT], [
pushdef([mu_upcase],translit($1,[a-z+-],[A-ZX_]))
pushdef([mu_cache_var],[mu_cv_enable_]translit($1,[+-],[x_]))
pushdef([mu_cond],[MU_COND_SUPPORT_]mu_upcase)
AC_ARG_ENABLE($1,
AC_HELP_STRING([--disable-]$1,
......@@ -43,8 +44,11 @@ AC_DEFUN([MU_ENABLE_SUPPORT], [
if test x"[$]mu_cache_var" = x"yes"; then
AC_DEFINE([ENABLE_]mu_upcase,1,[Define this if you enable $1 support])
fi
popdef([mu_upcase])
AM_CONDITIONAL(mu_cond,
[test x"[$]mu_cache_var" = x"yes" ifelse($4,,,[&& $4])])
popdef([mu_cond])
popdef([mu_cache_var])
popdef([mu_upcase])
])
dnl MU_ENABLE_BUILD(feature, [action-if-true], [action-if-false],
......
......@@ -40,16 +40,16 @@ dnl Library paths
AC_SUBST(MU_LIB_AUTH,'${top_builddir}/libmu_auth/libmu_auth.la')
AC_SUBST(MU_LIB_MAILUTILS,'${top_builddir}/mailbox/libmailutils.la')
AC_SUBST(MU_LIB_SQL,'${top_builddir}/sql/libsql.la')
AC_SUBST(MU_LIB_IMAP,'${top_builddir}/libproto/imap/libmu_imap.la')
AC_SUBST(MU_LIB_MAILDIR,'${top_builddir}/libproto/maildir/libmu_maildir.la')
AC_SUBST(MU_LIB_IMAP)
AC_SUBST(MU_LIB_MAILDIR)
AC_SUBST(MU_LIB_MAILER,'${top_builddir}/libproto/mailer/libmu_mailer.la')
AC_SUBST(MU_LIB_MBOX,'${top_builddir}/libproto/mbox/libmu_mbox.la')
AC_SUBST(MU_LIB_MH,'${top_builddir}/libproto/mh/libmu_mh.la')
AC_SUBST(MU_LIB_NNTP,'${top_builddir}/libproto/nntp/libmu_nntp.la')
AC_SUBST(MU_LIB_POP,'${top_builddir}/libproto/pop/libmu_pop.la')
AC_SUBST(MU_LIB_MH)
AC_SUBST(MU_LIB_NNTP)
AC_SUBST(MU_LIB_POP)
AC_SUBST(MU_LIB_SIEVE,'${top_builddir}/libmu_sieve/libmu_sieve.la')
AC_SUBST(MU_LIB_SCM,'${top_builddir}/libmu_scm/libmu_scm.la')
AC_SUBST(MU_LIB_CPP,'${top_builddir}/libmu_cpp/libmu_cpp.la')
AC_SUBST(MU_LIB_SCM)
AC_SUBST(MU_LIB_CPP)
AC_SUBST(MU_LIB_ARGP,'${top_builddir}/libmu_argp/libmu_argp.la')
AC_SUBST(MU_LIB_PY)
......@@ -805,9 +805,17 @@ AC_ARG_WITH([virtual-pwddir],
*) SITE_VIRTUAL_PWDDIR="\$(sysconfdir)/${withval}";;
esac],
[SITE_VIRTUAL_PWDDIR="\$(sysconfdir)/domain"])
MU_ENABLE_SUPPORT(imap)
MU_ENABLE_SUPPORT(pop)
MU_ENABLE_SUPPORT(nntp)
MU_ENABLE_SUPPORT([imap],
[MU_LIB_IMAP='${top_builddir}/libproto/imap/libmu_imap.la'])
MU_ENABLE_SUPPORT([pop],
[MU_LIB_POP='${top_builddir}/libproto/pop/libmu_pop.la'])
MU_ENABLE_SUPPORT([nntp],
[MU_LIB_NNTP='${top_builddir}/libproto/nntp/libmu_nntp.la'])
MU_ENABLE_SUPPORT([mh],
[MU_LIB_MH='${top_builddir}/libproto/mh/libmu_mh.la'])
MU_ENABLE_SUPPORT([maildir],
[MU_LIB_MAILDIR='${top_builddir}/libproto/maildir/libmu_maildir.la'])
AC_SUBST(MU_SMTP_PROGRAMS_BUILD)
AC_SUBST(MU_SMTP_DEJATOOL)
......@@ -819,9 +827,6 @@ MU_ENABLE_SUPPORT(sendmail)
MU_ENABLE_SUPPORT(prog)
MU_ENABLE_SUPPORT(mh)
MU_ENABLE_SUPPORT(maildir)
# FIXME: Should be --with-radius
MU_ENABLE_SUPPORT(radius,
......@@ -1091,14 +1096,14 @@ fi
AC_SUBST(lisp_LISP)
# Check for Python
AC_ARG_WITH([python],
AC_HELP_STRING([--without-python],
[do not build Python interface]),
[
case "${withval}" in
AC_ARG_ENABLE([python],
AC_HELP_STRING([--disable-python],
[do not build Python interface]),
[
case "${enableval}" in
yes) status_python=yes ;;
no) status_python=no ;;
*) AC_MSG_ERROR(bad value ${withval} for --without-python) ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-python) ;;
esac],[status_python=yes])
AC_SUBST(PYTHON_LIBS)
......@@ -1138,8 +1143,8 @@ AM_CONDITIONAL([MU_COND_PYTHON], [test "$status_python" = yes])
AC_SUBST(MU_CXX_EXAMPLES_BUILD)
MU_ENABLE_SUPPORT(cxx,
[MU_CXX_EXAMPLES_BUILD='$(MU_CXX_EXAMPLES_LIST)'])
AM_CONDITIONAL([MU_COND_LIBMU_CPP], [test "$mu_cv_enable_cxx" = yes])
[MU_CXX_EXAMPLES_BUILD='$(MU_CXX_EXAMPLES_LIST)'
MU_LIB_CPP='${top_builddir}/libmu_cpp/libmu_cpp.la'])
# Default mailbox record
# Note: 1. Support for mbox type is always enabled.
......@@ -1224,12 +1229,13 @@ case `echo $VERSION|sed 's/[[^.]]//g'` in
"..") if test `echo $VERSION | sed 's/.*\.//'` -lt 50; then
RENDITION=DISTRIB
else
AC_DEFINE_UNQUOTED([MU_ALPHA_RELEASE], 1,
[Define if this is an alpha release])
RENDITION=PROOF
fi;;
*) RENDITION=PROOF;;
esac
AC_CONFIG_COMMANDS([status],[
cat <<EOF
......
......@@ -18,7 +18,19 @@
## Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA
## 02110-1301 USA
SUBDIRS = config cpp python scheme
if MU_COND_SUPPORT_POP
POP3CLIENT = pop3client
endif
if MU_COND_SUPPORT_NNTP
NNTPCLIENT = nntpclient
endif
if MU_COND_SUPPORT_CXX
CPP_DIR = cpp
endif
SUBDIRS = config $(CPP_DIR) python scheme
noinst_PROGRAMS = \
aclck\
......@@ -40,11 +52,13 @@ noinst_PROGRAMS = \
muauth\
muemail\
murun\
nntpclient\
pop3client \
$(NNTPCLIENT)\
$(POP3CLIENT)\
sfrom\
url-parse
EXTRA_PROGRAMS = pop3client nntpclient
## NOTE: Numaddr must be an installable target, otherwise libtool
## will not create a shared library and `make check' will fail in
## sieve. Pity.
......
......@@ -98,7 +98,7 @@ pkginclude_HEADERS = \
vartab.h\
version.h
if MU_COND_LIBMU_CPP
if MU_COND_SUPPORT_CXX
CPP_DIR = cpp
endif
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2004, 2005, 2007, 2009, 2010 Free
Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA */
#ifndef _MAILUTILS_ARGP_H
#define _MAILUTILS_ARGP_H
#include <mailutils/types.h>
#include <argp.h>
#include <errno.h> /* May declare program_invocation_name */
extern char *mu_license_text;
#ifdef __cplusplus
extern "C" {
#endif
extern void mu_argp_init (struct argp *argp, const char *vers,
const char *bugaddr, const char *capa[]);
extern void mu_argp_done (struct argp *argp);
extern int mu_register_argp_capa (const char *name, struct argp_child *child);
extern void mu_print_options (void);
#ifdef __cplusplus
}
#endif
#endif
......@@ -17,5 +17,25 @@
## Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA
## 02110-1301 USA
SUBDIRS = include mbox pop nntp imap mh maildir mailer
if MU_COND_SUPPORT_POP
POP_DIR = pop
endif
if MU_COND_SUPPORT_IMAP
IMAP_DIR = imap
endif
if MU_COND_SUPPORT_NNTP
NNTP_DIR = nntp
endif
if MU_COND_SUPPORT_MH
MH_DIR = mh
endif
if MU_COND_SUPPORT_MAILDIR
MAILDIR_DIR = maildir
endif
SUBDIRS = include mbox $(POP_DIR) $(NNTP_DIR) $(IMAP_DIR) $(MH_DIR) $(MAILDIR_DIR) mailer
......
......@@ -318,7 +318,6 @@ print_stream (mu_stream_t stream, FILE *out)
{
char buffer[512];
size_t n = 0;
int rc;
while (mu_stream_read (stream, buffer, sizeof (buffer) - 1, &n) == 0
&& n != 0)
......
......@@ -114,6 +114,7 @@ libmailutils_la_SOURCES = \
muerror.c\
muerrno.c\
nls.c\
nullrec.c\
observer.c\
opool.c\
parse822.c\
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2002, 2004,
2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. */
/* This file provides replacement definitions for mu_record_t defined
in those MU libraries which are disabled at configure time. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdlib.h>
#include <mailutils/types.h>
#include <mailutils/registrar.h>
#ifndef ENABLE_IMAP
mu_record_t mu_imap_record = NULL;
mu_record_t mu_imaps_record = NULL;
#endif
#ifndef ENABLE_POP
mu_record_t mu_pop_record = NULL;
mu_record_t mu_pops_record = NULL;
#endif
#ifndef ENABLE_NNTP
mu_record_t mu_nntp_record = NULL;
#endif
#ifndef ENABLE_MH
mu_record_t mu_mh_record = NULL;
#endif
#ifndef ENABLE_MAILDIR
mu_record_t mu_maildir_record = NULL;
#endif
......@@ -156,7 +156,6 @@ static int
_streamref_seek (struct _mu_stream *str, mu_off_t off, mu_off_t *ppos)
{
struct _mu_streamref *sp = (struct _mu_streamref *)str;
mu_off_t cur = sp->offset - sp->start;
mu_off_t size;
int rc;
......