summaryrefslogtreecommitdiff
path: root/intl/Makefile.in
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-04-16 11:55:00 +0200
committerNick Alcock <nick.alcock@oracle.com>2021-02-10 15:26:57 +0000
commitadda0248ed0f7a2245f53a79ef6dbc2093a1be22 (patch)
treed0a4056659793dfe46efc8f53c0346d2582aec30 /intl/Makefile.in
parent830c5a1ffb0ee5f064b0ba0b07cb111aa7f85141 (diff)
downloadbinutils-gdb-adda0248ed0f7a2245f53a79ef6dbc2093a1be22.tar.gz
intl: Unbreak intl build with bison 3 when no regeneration is needed [PR92008]
As Iain reported, my change broke the case when one has bison >= 3, but make decides there is no reason to regenerate plural.c, unfortunately that seems to be a scenario I haven't tested. The problem is that the pregenerated plural.c has been generated with bison 1.35, but when config.h says HAVE_BISON3, the code assumes it is the bison3 variant. What used to work fine is when one has bison >= 3 and plural.c has been regenerated (e.g. do touch intl/plural.y and it will work), or when one doesn't have any bison (then nothing is regenerated, but HAVE_BISON3 isn't defined either), or when one has bison < 3 and doesn't need to regenerate, or when one has bison < 3 and it is regenerated. The following patch fixes this, by killing the HAVE_BISON3 macro from config.h, and instead remembering the fact whether plural.c has been created with bison < 3 or bison >= 3 in a separate new plural-config.h header. The way this works: - user doesn't have bison - user has bison >= 3, but intl/{plural-config.h,plural.c} aren't older than intl/plural.y - user has bison < 3, but intl/{plural-config.h,plural.c} aren't older than intl/plural.y pregenerated !USE_BISON3 plural.c and plural-config.h from source dir is used, nothing in the objdir - user has bison >= 3 and intl/plural.y is newer Makefile generates plural.c and USE_BISON3 plural-config.h in the objdir, which is then used in preference to srcdir copies - user has bison < 3 and intl/plural.y is newer Makefile generates plural.c and !USE_BISON3 plural-config.h in the objdir, which is then used in preference to srcdir copies I have tested all these cases and make all-yes worked in all the cases. If one uses the unsupported ./configure where srcdir == objdir, I guess (though haven't tested) that it should still work, just it would be nice if such people didn't try to check in the plural{.c,-config.h} they have regenerated. What doesn't work, but didn't work before either (just tested gcc-9 branch too) is when one doesn't have bison and plural.y is newer than plural.c. Don't do that ;) intl/ChangeLog 2020-04-16 Jakub Jelinek <jakub@redhat.com> PR bootstrap/92008 * configure.ac: Remove HAVE_BISON3 AC_DEFINE. * Makefile.in (HEADERS): Add plural-config.h. (.y.c): Also create plural-config.h. (dcigettext.o loadmsgcat.o plural.o plural-exp.o): Also depend on plural-config.h. (plural-config.h): Depend on plural.c. * plural-exp.h: Include plural-config.h. Use USE_BISON3 instead of HAVE_BISON3. * plural.y: Use USE_BISON3 instead of HAVE_BISON3. * configure: Regenerated. * plural.c: Regenerated. * config.h.in: Regenerated. * plural-config.h: Generated.
Diffstat (limited to 'intl/Makefile.in')
-rw-r--r--intl/Makefile.in7
1 files changed, 6 insertions, 1 deletions
diff --git a/intl/Makefile.in b/intl/Makefile.in
index bdb74ebb78c..356c8ab9b65 100644
--- a/intl/Makefile.in
+++ b/intl/Makefile.in
@@ -57,6 +57,7 @@ HEADERS = \
gettextP.h \
hash-string.h \
loadinfo.h \
+ plural-config.h \
plural-exp.h \
eval-plural.h \
localcharset.h \
@@ -133,10 +134,12 @@ libintl.h: $(srcdir)/libgnuintl.h
$(COMPILE) $<
.y.c:
+@BISON3_YES@ echo '#define USE_BISON3' > $(patsubst %.c,%-config.h,$@)
@BISON3_YES@ sed 's,%pure_parser,,;s,^/\* BISON3 \(.*\) \*/$$,\1,' $< > $@.y
@BISON3_YES@ $(YACC) $(YFLAGS) --output $@.c $@.y
@BISON3_YES@ sed 's/\.c\.y"/.y"/' $@.c > $@
@BISON3_YES@ rm -f $@.c $@.y $@.h
+@BISON3_NO@ echo '/* #define USE_BISON3 */' > $(patsubst %.c,%-config.h,$@)
@BISON3_NO@ $(YACC) $(YFLAGS) --output $@ $<
rm -f $*.h
@@ -165,7 +168,7 @@ dngettext.o finddomain.o gettext.o intl-compat.o loadmsgcat.o \
localealias.o ngettext.o textdomain.o: gettextP.h gmo.h loadinfo.h
dcigettext.o loadmsgcat.o: hash-string.h
explodename.o l10nflist.o: loadinfo.h
-dcigettext.o loadmsgcat.o plural.o plural-exp.o: plural-exp.h
+dcigettext.o loadmsgcat.o plural.o plural-exp.o: plural-exp.h plural-config.h
dcigettext.o: eval-plural.h
localcharset.o: localcharset.h
localealias.o localcharset.o relocatable.o: relocatable.h
@@ -242,6 +245,8 @@ $(srcdir)/aclocal.m4: @MAINT@ $(aclocal_deps)
config.h: stamp-h1
test -f config.h || (rm -f stamp-h1 && $(MAKE) stamp-h1)
+plural-config.h: plural.c
+
stamp-h1: $(srcdir)/config.h.in config.status
-rm -f stamp-h1
$(SHELL) ./config.status config.h