1
0
mirror of https://git.savannah.gnu.org/git/gnulib.git synced 2025-08-08 17:22:05 +03:00

parse-datetime: Require Bison 2.4 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.
This commit is contained in:
Bruno Haible
2019-07-19 05:00:10 +02:00
parent c01635497d
commit 56d28ccbbc
3 changed files with 41 additions and 2 deletions

View File

@@ -1,3 +1,11 @@
2019-07-19 Bruno Haible <bruno@clisp.org>
parse-datetime: Require Bison 2.4 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.
2019-07-19 Bruno Haible <bruno@clisp.org>
areadlink-with-size, xgethostname, xgetdomainname: Fix GCC warning.

View File

@@ -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.4 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;;
1.* | 2.[0-3] | 2.[0-3].*)
changequote([,])dnl
ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
*) ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
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])

View File

@@ -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 && \