Commit Graph

4 Commits

Author SHA1 Message Date
Jakub Jelinek 437eea66a4 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 ;)

2020-04-16  Jakub Jelinek  <jakub@redhat.com>

	PR bootstrap/92008
intl/
	* 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.
contrib/
	* gcc_update: Add intl/plural.y dependency for intl/plural-config.h.
2020-04-16 11:55:00 +02:00
Jakub Jelinek 2ca17e0a89 intl: Allow building both with old bison and bison >= 3 [PR92008]
bison 3 apparently made a backwards incompatible change, dropped
YYLEX_PARAM/YYPARSE_PARAM support and instead needs %param or %lex-param
and %parse-param.  Furthermore, there is no easy way to conditionalize
on bison version in the *.y files.
While e.g. glibc bumped bison requirement and just has the bison 3
compatible version, Richi said there are still systems with older bison
where we want to build gcc.

So, this patch instead determines during configure bison version, and
depending on that when building plural.c (if building it at all) tweaks
what is passed over to bison if needed.

Tested with both bison 3 and bison 1.35, in each case with reconfiguring
intl and building with make all-yes (as in my setup intl isn't normally
used).

2020-04-16  Jakub Jelinek  <jakub@redhat.com>

	PR bootstrap/92008
	* configure.ac: Add check for bison >= 3, AC_DEFINE HAVE_BISON3
	and AC_SUBST BISON3_YES and BISON3_NO.
	* Makefile.in (.y.c): Prefix $(YACC) invocation with @BISON3_NO@,
	add @BISON3_YES@ prefixed rule to adjust the *.y source using sed
	and adjust output afterwards.
	* plural-exp.h (PLURAL_PARSE): If HAVE_BISON3 is defined, use
	struct parse_args * type for arg instead of void *.
	* plural.y: Add magic /* BISON3 ... */ comments with bison >= 3
	directives.
	(YYLEX_PARAM, YYPARSE_PARAM): Don't define if HAVE_BISON3 is defined.
	(yylex, yyerror): Adjust prototypes and definitions if HAVE_BISON3
	is defined.
	* plural.c: Regenerated.
	* config.h.in: Regenerated.
	* configure: Regenerated.
2020-04-16 10:12:30 +02:00
Nick Clifton 0e687cb4f1 Update the address and telephone number of the FSF organization
From-SVN: r99650
2005-05-13 08:03:47 +00:00
Zack Weinberg 6eb95e99e7 intl: New directory; see intl/ChangeLog for details.
top:
	* intl: New directory; see intl/ChangeLog for details.
	* ABOUT-NLS, config.rpath: Import from gettext 0.12.1.
	* Makefile.tpl: all-gcc depends on maybe-all-intl.
	* Makefile.in: Regenerate.
config:
	* gettext.m4: New file - copy of gettext.m4 from binutils
	CVS, with added AC_ISC_POSIX macro from gcc/aclocal.m4.
gcc:
	* ABOUT-NLS: Delete.
	* intl: Delete entire directory.
	* aclocal.m4: Include ../config/gettext.m4.  Delete
	AC_ISC_POSIX, AM_LANGINFO_CODESET, jm_GLIBC21, AM_LC_MESSAGES,
	AM_PATH_PROG_WITH_TEST, AM_WITH_NLS, and AM_GNU_GETTEXT.
	* configure.in: Use CY_GNU_GETTEXT, not AM_GNU_GETTEXT.
	Remove intl/Makefile from all_outputs.
	* configure, config.in: Regenerate.
	* Makefile.in: Expunge all references to intl subdirectory.
	Add -I../intl to INCLUDES.
	* intl.h: Include libintl.h if and only if ENABLE_NLS is defined.
intl:
	* Makefile.in: Remove unnecessary capabilities for
	installation, build of shared libraries, generation of
	distribution tarballs, etc.  Fix all the places that rely on
	the parent directory.  Don't generate libgnuintl.h from
	anything; do generate $(objdir)/libintl.h from libgnuintl.h if
	necessary.  Adjust DEFS for use of config.h.
	* libgnuintl.h.in: Rename libgnuintl.h.
	* README: New file.
	* config.charset, ref-add.sin, ref-del.sin: Delete (unused).
	* COPYING.LIB-2.0, COPYING.LIB-2.1: Delete (redundant).
	* aclocal.m4: New; generated per instructions in gettext manual.
	* configure.in: New; written from scratch for this configuration.
	* configure, config.h.in: Generated.
contrib:
	* gcc_update: Remove gcc/intl/plural.c from list.
	Add new generated files intl/plural.c, intl/configure,
	intl/config.h.in.

From-SVN: r68928
2003-07-04 18:18:54 +00:00