build: drop variable HAVE_EMACS. use WITH_EMACS instead

The extra flexibility of having both HAVE_EMACS (for yes, there is an
emacs we can use) and WITH_EMACS (the user wants emacs support) lead
to confusion and bugs. We now just force WITH_EMACS to 0 if no
suitable emacs is detected.
This commit is contained in:
David Bremner 2019-06-11 21:12:38 -03:00
parent 0a2929c341
commit a6a8df7e03
4 changed files with 16 additions and 20 deletions

16
configure vendored
View file

@ -677,13 +677,14 @@ if [ -z "${EMACSETCDIR-}" ]; then
EMACSETCDIR="\$(prefix)/share/emacs/site-lisp"
fi
printf "Checking if emacs (>= 24) is available... "
if emacs --quick --batch --eval '(if (< emacs-major-version 24) (kill-emacs 1))' > /dev/null 2>&1; then
if [ $WITH_EMACS = "1" ]; then
printf "Checking if emacs (>= 24) is available... "
if emacs --quick --batch --eval '(if (< emacs-major-version 24) (kill-emacs 1))' > /dev/null 2>&1; then
printf "Yes.\n"
have_emacs=1
else
printf "No (so will not byte-compile emacs code)\n"
have_emacs=0
else
printf "No (disabling emacs related parts of build)\n"
WITH_EMACS=0
fi
fi
have_doxygen=0
@ -1165,9 +1166,6 @@ BASH_ABSOLUTE = ${bash_absolute}
HAVE_PERL = ${have_perl}
PERL_ABSOLUTE = ${perl_absolute}
# Whether there's an emacs binary available for byte-compiling
HAVE_EMACS = ${have_emacs}
# Whether there's a sphinx-build binary available for building documentation
HAVE_SPHINX=${have_sphinx}

View file

@ -4,7 +4,7 @@ dir := doc
# You can set these variables from the command line.
SPHINXOPTS := -q
SPHINXBUILD = HAVE_EMACS=${HAVE_EMACS} WITH_EMACS=${WITH_EMACS} sphinx-build
SPHINXBUILD = WITH_EMACS=${WITH_EMACS} sphinx-build
DOCBUILDDIR := $(dir)/_build
# Internal variables.
@ -29,8 +29,8 @@ MAN1_TEXI := $(patsubst $(srcdir)/doc/man1/%.rst,$(DOCBUILDDIR)/texinfo/%.texi,$
MAN5_TEXI := $(patsubst $(srcdir)/doc/man5/%.rst,$(DOCBUILDDIR)/texinfo/%.texi,$(MAN5_RST))
MAN7_TEXI := $(patsubst $(srcdir)/doc/man7/%.rst,$(DOCBUILDDIR)/texinfo/%.texi,$(MAN7_RST))
INFO_TEXI_FILES := $(MAN1_TEXI) $(MAN5_TEXI) $(MAN7_TEXI)
ifeq ($(HAVE_EMACS)$(WITH_EMACS),11)
INFO_TEXI_FILES := $(INFO_TEXI_FILES) $(DOCBUILDDIR)/texinfo/notmuch-emacs.texi
ifeq ($(WITH_EMACS),1)
INFO_TEXI_FILES += $(DOCBUILDDIR)/texinfo/notmuch-emacs.texi
endif
INFO_INFO_FILES := $(INFO_TEXI_FILES:.texi=.info)

View file

@ -32,7 +32,7 @@ exclude_patterns = ['_build']
# If we don't have emacs (or the user configured --without-emacs),
# don't build the notmuch-emacs docs, as they need emacs to generate
# the docstring include files
if os.environ.get('HAVE_EMACS') != '1' or os.environ.get('WITH_EMACS') != '1':
if os.environ.get('WITH_EMACS') != '1':
exclude_patterns.append('notmuch-emacs.rst')
# The name of the Pygments (syntax highlighting) style to use.

View file

@ -47,7 +47,7 @@ emacs_images := \
emacs_bytecode = $(emacs_sources:.el=.elc)
emacs_docstrings = $(emacs_sources:.el=.rsti)
ifneq ($(HAVE_SPHINX)$(HAVE_EMACS),11)
ifneq ($(HAVE_SPHINX)$(WITH_EMACS),11)
docstring.stamp:
@echo "Missing prerequisites, not collecting docstrings"
else
@ -60,7 +60,7 @@ endif
# the byte compiler may load an old .elc file when processing a
# "require" or we may fail to rebuild a .elc that depended on a macro
# from an updated file.
ifeq ($(HAVE_EMACS),1)
ifeq ($(WITH_EMACS),1)
$(dir)/.eldeps: $(dir)/Makefile.local $(dir)/make-deps.el $(emacs_sources)
$(call quiet,EMACS) --directory emacs -batch -l make-deps.el \
-f batch-make-deps $(emacs_sources) > $@.tmp && \
@ -82,7 +82,7 @@ $(dir)/notmuch-lib.elc: $(dir)/notmuch-version.elc
endif
CLEAN+=$(dir)/.eldeps $(dir)/.eldeps.tmp $(dir)/.eldeps.x
ifeq ($(HAVE_EMACS),1)
ifeq ($(WITH_EMACS),1)
%.elc: %.el $(global_deps)
$(call quiet,EMACS) --directory emacs -batch -f batch-byte-compile $<
%.rsti: %.el
@ -103,10 +103,8 @@ endif
rm -r .elpa-build
ifeq ($(WITH_EMACS),1)
ifeq ($(HAVE_EMACS),1)
all: $(emacs_bytecode) $(emacs_docstrings)
install-emacs: $(emacs_bytecode)
endif
install: install-emacs
endif
@ -115,7 +113,7 @@ endif
install-emacs: $(emacs_sources) $(emacs_images)
mkdir -p "$(DESTDIR)$(emacslispdir)"
install -m0644 $(emacs_sources) "$(DESTDIR)$(emacslispdir)"
ifeq ($(HAVE_EMACS),1)
ifeq ($(WITH_EMACS),1)
install -m0644 $(emacs_bytecode) "$(DESTDIR)$(emacslispdir)"
endif
mkdir -p "$(DESTDIR)$(emacsetcdir)"