Hi Bernhard, > + parse-datetime: avoid "%pure-parser" deprecation warning from Bison 3.4
I've pushed your change. However, I think it would be good for "make" to behave reasonably when bison is not found or too old. Here's a proposed patch (untested so far): 2019-07-19 Bruno Haible <br...@clisp.org> parse-datetime: Require Bison 2.7 or newer. * m4/parse-datetime.m4 (gl_PARSE_DATETIME): Set PARSE_DATETIME_BISON. Code taken from gettext's intl.m4. * modules/parse-datetime (Makefile.am): Use PARSE_DATETIME_BISON instead of YACC. diff --git a/m4/parse-datetime.m4 b/m4/parse-datetime.m4 index 597a44c..dd5e643 100644 --- a/m4/parse-datetime.m4 +++ b/m4/parse-datetime.m4 @@ -1,4 +1,4 @@ -# parse-datetime.m4 serial 22 +# parse-datetime.m4 serial 23 dnl Copyright (C) 2002-2006, 2008-2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -26,6 +26,37 @@ AC_DEFUN([gl_C_COMPOUND_LITERALS], AC_DEFUN([gl_PARSE_DATETIME], [ + dnl parse-datetime.c is generated from parse-datetime.y. It requires bison, + dnl because parse-datetime.y uses bison specific features. It requires at + dnl least bison-2.7 for %define api.pure. + dnl bison is only needed for the maintainer (who touches parse-datetime.y). + dnl But in order to avoid separate Makefiles or --enable-maintainer-mode, + dnl we put the rule in general Makefile. Now, some people carelessly touch + dnl the files or have a broken "make" program, hence the parse-datetime.c + dnl rule will sometimes fire. To avoid an error, defines PARSE_DATETIME_BISON + dnl to ":" if it is not present or too old. + AC_CHECK_PROGS([PARSE_DATETIME_BISON], [bison]) + if test -z "$PARSE_DATETIME_BISON"; then + ac_verc_fail=yes + else + dnl Found it, now check the version. + AC_MSG_CHECKING([version of bison]) +changequote(<<,>>)dnl + ac_prog_version=`$PARSE_DATETIME_BISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` + case $ac_prog_version in + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; + 2.[7-9]* | [3-9].*) +changequote([,])dnl + ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; + *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; + esac + AC_MSG_RESULT([$ac_prog_version]) + fi + if test $ac_verc_fail = yes; then + PARSE_DATETIME_BISON=: + fi + AC_SUBST([PARSE_DATETIME_BISON]) + dnl Prerequisites of lib/parse-datetime.h. AC_REQUIRE([AM_STDBOOL_H]) AC_REQUIRE([gl_TIMESPEC]) diff --git a/modules/parse-datetime b/modules/parse-datetime index 692da25..d54dafd 100644 --- a/modules/parse-datetime +++ b/modules/parse-datetime @@ -38,7 +38,7 @@ parse-datetime.c: parse-datetime.y y.tab.c parse-datetime.c \ y.tab.h parse-datetime.h \ y.output parse-datetime.output \ - -- $(YACC) $(YFLAGS) $(AM_YFLAGS) && \ + -- $(PARSE_DATETIME_BISON) -y -d $(YFLAGS) $(AM_YFLAGS) && \ sed -e 's|".*/parse-datetime.y"|"parse-datetime.y"|' \ < parse-datetime.c > parse-datetime.c-t && \ rm -f parse-datetime.c && \