bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bison: new module


From: Akim Demaille
Subject: Re: bison: new module
Date: Sun, 3 May 2020 09:13:06 +0200

Hi Bruno,

> Le 2 mai 2020 à 19:50, Akim Demaille <address@hidden> a écrit :
> 
>> At configure time, both solutions are nearly on par: the time to
>> create a temporary file is negligible. And both will fail the same
>> way for a 'bison' program that references missing shared libraries.
>> 
>> Patch welcome!
> 
> Will do.

Here is my proposal.  I didn't see the need for a temporary directory.

Cheers!

commit 9011943076adc1885d57626763bb00276b7243af
Author: Akim Demaille <address@hidden>
Date:   Sun May 3 08:54:58 2020 +0200

    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.

commit 8d9b4d6e105571814d374d0d4689e75554f22902
Author: Akim Demaille <address@hidden>
Date:   Sun May 3 08:54:58 2020 +0200

    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.

diff --git a/ChangeLog b/ChangeLog
index 0bf6ca0dd..1ac3d104f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2020-05-03  Akim Demaille  <address@hidden>
+
+       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.
+
+
 2020-05-02  Bruno Haible  <address@hidden>
 
        list: Add get_first, get_last, set_first, set_last operations.
diff --git a/m4/bison.m4 b/m4/bison.m4
index 5802a5ca5..bda34777b 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 _AC_DO_VAR([$1 conftest.y -o conftest.c]); 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 0849b8203..3bb487f9b 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])




reply via email to

[Prev in Thread] Current Thread [Next in Thread]