forked from Imagelibrary/binutils-gdb
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.
74 lines
2.1 KiB
Plaintext
74 lines
2.1 KiB
Plaintext
AC_INIT
|
|
AC_USE_SYSTEM_EXTENSIONS
|
|
AC_CONFIG_SRCDIR(gettext.c)
|
|
AC_CONFIG_HEADER(config.h)
|
|
AC_CONFIG_MACRO_DIR(../config)
|
|
AM_GNU_GETTEXT_VERSION(0.12.1)
|
|
AM_GNU_GETTEXT([], [need-ngettext])
|
|
|
|
# This replaces the extensive use of DEFS in the original Makefile.in.
|
|
AC_DEFINE(IN_LIBINTL, 1, [Define because this is libintl.])
|
|
AC_DEFINE(IN_LIBRARY, 1, [Define because this is a library.])
|
|
AC_DEFINE(DEPENDS_ON_LIBICONV, 1, [Define because we depend on libiconv.])
|
|
AC_DEFINE(ENABLE_RELOCATABLE, 1, [Define to enable relocation.])
|
|
AC_DEFINE(NO_XMALLOC, 1, [Define if there is no xmalloc.])
|
|
AC_DEFINE(set_relocation_prefix, libintl_set_relocation_prefix,
|
|
[Define this entry point correctly.])
|
|
AC_DEFINE(relocate, libintl_relocate,
|
|
[Define this entry point correctly.])
|
|
|
|
MISSING=`cd $ac_aux_dir && ${PWDCMD-pwd}`/missing
|
|
AC_CHECK_PROGS([ACLOCAL], [aclocal], [$MISSING aclocal])
|
|
AC_CHECK_PROGS([AUTOCONF], [autoconf], [$MISSING autoconf])
|
|
AC_CHECK_PROGS([AUTOHEADER], [autoheader], [$MISSING autoheader])
|
|
|
|
AC_ARG_ENABLE(maintainer-mode,
|
|
[ --enable-maintainer-mode enable rules only needed by maintainers],,
|
|
enable_maintainer_mode=no)
|
|
if test "x$enable_maintainer_mode" = xno; then
|
|
MAINT='#'
|
|
else
|
|
MAINT=
|
|
fi
|
|
AC_SUBST(MAINT)
|
|
|
|
# Additional info for config.intl.
|
|
AC_SUBST(LIBINTL_DEP)
|
|
AC_SUBST(INCINTL)
|
|
|
|
LIBINTL_DEP=
|
|
INCINTL=
|
|
case $USE_INCLUDED_LIBINTL in
|
|
yes)
|
|
LIBINTL=`echo $LIBINTL | sed 's,${top_builddir},&/..,' `
|
|
LTLIBINTL=`echo $LTLIBINTL | sed 's,${top_builddir},&/..,' `
|
|
LIBINTL_DEP='${top_builddir}/../intl/libintl.a'
|
|
INCINTL='-I${top_builddir}/../intl'
|
|
;;
|
|
esac
|
|
|
|
BISON3_YES='#'
|
|
BISON3_NO=
|
|
if test "$INTLBISON" != :; then
|
|
ac_bison3=no
|
|
AC_MSG_CHECKING([bison 3 or later])
|
|
changequote(<<,>>)dnl
|
|
ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
|
|
case $ac_prog_version in
|
|
[3-9].*)
|
|
changequote([,])dnl
|
|
ac_prog_version="$ac_prog_version, bison3"; ac_bison3=yes;;
|
|
*) ac_prog_version="$ac_prog_version, old";;
|
|
esac
|
|
AC_MSG_RESULT([$ac_prog_version])
|
|
if test $ac_bison3 = yes; then
|
|
BISON3_YES=
|
|
BISON3_NO='#'
|
|
fi
|
|
fi
|
|
AC_SUBST(BISON3_YES)
|
|
AC_SUBST(BISON3_NO)
|
|
|
|
AC_CONFIG_FILES(Makefile config.intl)
|
|
AC_OUTPUT
|