This is to fix the error Will Yardley just reported.

See the patch for a detailed discusion, but this affects builds using
--with-included-gettext and enabling the header cache.

The patch seems a little hackish, but is actually fairly clean compared
to trying to force automake to change its ordering.

On my machine, the patch did not result in a change in hcversion.h
(which is good), but the patch is pretty important for machines without
a builtin libintl: their hcversion.h was never changing.

If you have a chance, I'd appreciate any/all testing.  I will push this
up first thing tomorrow.

Thank you.

-- 
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA
http://www.8t8.us/configs/gpg-key-transition-statement.txt
# HG changeset patch
# User Kevin McCarthy <ke...@8t8.us>
# Date 1459464131 25200
#      Thu Mar 31 15:42:11 2016 -0700
# Node ID 47cc6566138d11fe962fa53236af0c8141b85d26
# Parent  6e0aca94cdb026205509eaf4fe405c478f769ea4
Fix hcversion.h generation error when using included gettext.

When configuring mutt with --enable-hcache and
--with-included-gettext, there is an automake ordering issue:
BUILT_SOURCES are processed before SUBDIRS.  Therefore, the
'hcversion.h' target is run before the included gettext (intl) is
built.

The hcversion.h target runs the cpp over config.h and mutt.h,
but mutt.h includes lib.h which tries to #include <libintl.h>.
Unfortunately, libintl.h (in this configuration) is generated by the
intl subdir build and so doesn't exist yet.

While the build doesn't completely fail, the resulting hcversion.h is
incorrect: it's just the md5sum of the initial value of BASEVERSION.

This fix is somewhat of a hack but is cleaner than trying to change
automake's behavior.  It inserts a '#undef ENABLE_NLS' in between the
config.h and mutt.h sent to the cpp.  Since hcachever.sh is just
scanning the data structures used by mutt, this shouldn't affect the
hash generated.

Thanks to Will Yardley for reporting this issue.

diff --git a/Makefile.am b/Makefile.am
--- a/Makefile.am
+++ b/Makefile.am
@@ -135,18 +135,23 @@
                $(srcdir)/OPS.MIX $(srcdir)/OPS.CRYPT $(srcdir)/OPS.SMIME \
                        > keymap_alldefs.h
 
 reldate.h: $(srcdir)/ChangeLog
        echo 'const char *ReleaseDate = "'`head -n 1 $(srcdir)/ChangeLog | 
LC_ALL=C cut -d ' ' -f 1`'";' > reldate.h.tmp; \
        cmp -s reldate.h.tmp reldate.h || cp reldate.h.tmp reldate.h; \
        rm reldate.h.tmp
 
+# The '#undef ENABLE_NLS' is to work around an automake ordering issue:
+# BUILT_SOURCES are processed before SUBDIRS.
+# If configured with --with-included-gettext this means that intl will
+# not have generated libintl.h yet, and mutt.h -> lib.h will generate
+# an error.
 hcversion.h: $(srcdir)/mutt.h $(srcdir)/rfc822.h hcachever.sh $(MUTT_MD5)
-       ( echo '#include "config.h"'; echo '#include "mutt.h"'; ) \
+       ( echo '#include "config.h"'; echo '#undef ENABLE_NLS'; echo '#include 
"mutt.h"'; ) \
        | $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) 
$(CPPFLAGS) - | sh ./hcachever.sh hcversion.h
 
 patchlist.c: $(srcdir)/PATCHES $(srcdir)/patchlist.sh
        $(srcdir)/patchlist.sh < $(srcdir)/PATCHES > patchlist.c
 
 install-exec-hook:
        if test -f $(DESTDIR)$(bindir)/mutt.dotlock && test -f 
$(DESTDIR)$(bindir)/mutt_dotlock ; then  \
                rm -f $(DESTDIR)$(bindir)/mutt.dotlock ;                \

Attachment: signature.asc
Description: PGP signature

Reply via email to