summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2020-05-03 08:54:58 +0200
committerAkim Demaille <akim.demaille@gmail.com>2020-05-03 11:39:36 +0200
commit3db0ae5f4fd5948baa6c133e01892aebc9db844f (patch)
tree1621f7b701ebd307d45bd822ee626b6c196074e9 /m4
parent1d131c99c96bd6c8424f0ee562a9db9f0e90e437 (diff)
downloadgnulib-3db0ae5f4fd5948baa6c133e01892aebc9db844f.tar.gz
bison: rely on bison's %require to check a version requirement
See https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00021.html. * m4/bison.m4 (gl_PROG_BISON): Let bison itself decide if it it recent enough of not. So far it is the only know Yacc tool that supports '%require'. Other yaccs will actually even choke on seeing the -o option after the input file name. * m4/parse-datetime.m4: Simplify gl_PROG_BISON invocation.
Diffstat (limited to 'm4')
-rw-r--r--m4/bison.m433
-rw-r--r--m4/parse-datetime.m42
2 files changed, 20 insertions, 15 deletions
diff --git a/m4/bison.m4 b/m4/bison.m4
index 5802a5ca51..76b62baf80 100644
--- a/m4/bison.m4
+++ b/m4/bison.m4
@@ -1,4 +1,4 @@
-# serial 8
+# serial 9
# Copyright (C) 2002-2006, 2008-2020 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
@@ -25,9 +25,9 @@
# - %define api.pure requires bison 2.7 or newer,
# - %precedence requires bison 3.0 or newer.
# For these, in the configure.ac you will need an invocation of
-# gl_PROG_BISON([VARIABLE], [MIN_BISON_VERSION], [BISON_VERSIONS_TO_EXCLUDE])
+# gl_PROG_BISON([VARIABLE], [MIN_BISON_VERSION])
# Example:
-# gl_PROG_BISON([PARSE_DATETIME_BISON], [2.4], [1.* | 2.[0-3] | 2.[0-3].*])
+# gl_PROG_BISON([PARSE_DATETIME_BISON], [2.4])
# With this preparation, in the Makefile.am there are two ways to formulate
# the invocation. Both are direct, without use of 'ylwrap'.
# (a) You can invoke
@@ -47,18 +47,23 @@ AC_DEFUN([gl_PROG_BISON],
if test -z "$[$1]"; then
ac_verc_fail=yes
else
- dnl Found it, now check the version.
- AC_MSG_CHECKING([version of bison])
-changequote(<<,>>)dnl
- ac_prog_version=`$<<$1>> --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;;
- <<$3>>)
- ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
- *) ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
- esac
-changequote([,])dnl
+ cat >conftest.y <<_ACEOF
+%require "$2"
+%%
+exp:
+_ACEOF
+ AC_MSG_CHECKING([for bison $2 or newer])
+ ac_prog_version=`$$1 --version 2>&1 | sed -n 's/^.*GNU Bison.* \([[0-9]]*\.[[0-9.]]*\).*$/\1/p'`
+ : ${ac_prog_version:='v. ?.??'}
+ if $$1 conftest.y -o conftest.c 2>/dev/null; then
+ ac_prog_version="$ac_prog_version, ok"
+ ac_verc_fail=false
+ else
+ ac_prog_version="$ac_prog_version, bad"
+ ac_verc_fail=true
+ fi
AC_MSG_RESULT([$ac_prog_version])
+ rm -f conftest.y conftest.c
fi
if test $ac_verc_fail = yes; then
[$1]=:
diff --git a/m4/parse-datetime.m4 b/m4/parse-datetime.m4
index 0849b82036..3bb487f9be 100644
--- a/m4/parse-datetime.m4
+++ b/m4/parse-datetime.m4
@@ -35,7 +35,7 @@ AC_DEFUN([gl_PARSE_DATETIME],
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.
- gl_PROG_BISON([PARSE_DATETIME_BISON], [2.4], [1.* | 2.[0-3] | 2.[0-3].*])
+ gl_PROG_BISON([PARSE_DATETIME_BISON], [2.4])
dnl Prerequisites of lib/parse-datetime.h.
AC_REQUIRE([AM_STDBOOL_H])