Skip to content

Commit

Permalink
Fix hcversion.h generation error when using included gettext.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kevin8t8 committed Apr 1, 2016
1 parent c9f060b commit d18939a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Makefile.am
Expand Up @@ -140,8 +140,13 @@ reldate.h: $(srcdir)/ChangeLog
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
Expand Down

0 comments on commit d18939a

Please sign in to comment.