bison-patches
[Top][All Lists]
Advanced

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

configure: perl is not required


From: Akim Demaille
Subject: configure: perl is not required
Date: Fri, 11 Oct 2019 06:56:14 +0200

commit 3dd2ae4415841c6296b5dcaadec91c722eecbbca
Author: Akim Demaille <address@hidden>
Date:   Thu Oct 10 21:28:08 2019 +0200

    configure: perl is not required
    
    But it's used in various places, including in some tests.
    
    * configure.ac: here.

diff --git a/configure.ac b/configure.ac
index 90320fb7..0c1efde1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -225,9 +225,6 @@ AC_DEFINE_UNQUOTED([M4], ["$M4"], [Define to the GNU M4 
executable name.])
 AC_DEFINE_UNQUOTED([M4_GNU_OPTION], ["$M4_GNU"], [Define to "-g" if GNU M4
 supports -g, otherwise to "".])
 AC_PATH_PROG([PERL], [perl])
-if test -z "$PERL"; then
-   AC_MSG_ERROR([perl not found])
-fi
 AM_MISSING_PROG([HELP2MAN], [help2man])
 AC_PATH_PROG([XSLTPROC], [xsltproc])
 AC_SUBST([XSLTPROC])



commit 0c56c195e0f469b2bb93c975622513b383b97316
Author: Akim Demaille <address@hidden>
Date:   Fri Oct 11 06:36:17 2019 +0200

    tests: be really robust to Perl missing
    
    My previous tests (with ./configure PERL=false) have been fooled by
    configure, that managed to find perl anyway.  This time, I ran this on
    a Fedora in Docker, without Perl.
    
    * tests/calc.at, tests/diagnostics.at, tests/headers.at,
    * tests/input.at, tests/local.at, tests/named-refs.at,
    * tests/output.at, tests/regression.at, tests/skeletons.at,
    * tests/synclines.at, tests/torture.at: Don't require Perl.

diff --git a/tests/calc.at b/tests/calc.at
index 408e3ab2..6355a5b4 100644
--- a/tests/calc.at
+++ b/tests/calc.at
@@ -619,7 +619,7 @@ AT_CHECK([cat stderr], 0, [expout])
 # Make sure we did not introduce bad spaces.  Checked here because all
 # the skeletons are (or should be) exercized here.
 m4_define([AT_CHECK_SPACES],
-[AT_CHECK([$PERL -ne '
+[AT_CHECK(["$PERL" -ne '
   chomp;
   print "$ARGV:$.: {$_}\n"
     if (# No starting/ending empty lines.
@@ -628,7 +628,7 @@ m4_define([AT_CHECK_SPACES],
         || /\s$/
         # No tabs.
         || /\t/
-        )' $1
+        )' $1 || exit 77
 ])dnl
 ])
 
diff --git a/tests/diagnostics.at b/tests/diagnostics.at
index d92d134b..a1754ab3 100644
--- a/tests/diagnostics.at
+++ b/tests/diagnostics.at
@@ -39,14 +39,14 @@ AT_DATA_GRAMMAR([[input.y]], [$2])
 # For some reason, literal ^M in the input are removed and don't end
 # in `input.y`.  So use the two-character ^M represent it, and let
 # Perl insert real CR characters.
-AT_CHECK([perl -pi -e 's{\^M}{\r}gx' input.y])
+AT_CHECK([$PERL -pi -e 's{\^M}{\r}gx' input.y || exit 77])
 
 AT_DATA([experr], [$4])
 
 AT_CHECK([LC_ALL=en_US.UTF-8 $5 bison -fcaret --color=debug -Wall input.y], 
[$3], [], [experr])
 
 # When no style, same messages, but without style.
-AT_CHECK([perl -pi -e 's{(</?(-|\w)+>)}{ $[]1 eq "<tag>" ? $[]1 : "" }ge' 
experr])
+AT_CHECK(["$PERL" -pi -e 's{(</?(-|\w)+>)}{ $[]1 eq "<tag>" ? $[]1 : "" }ge' 
experr || exit 77])
 
 # Cannot use AT_BISON_CHECK easily as we need to change the
 # environment.
diff --git a/tests/headers.at b/tests/headers.at
index fa3556ac..8103d592 100644
--- a/tests/headers.at
+++ b/tests/headers.at
@@ -314,7 +314,7 @@ AT_TEST([x9], [%locations %code requires {#include 
"location.hh"} %define api.lo
 #   Ignore comments, YYChar (template parameter), YYPUSH_MORE(_DEFINED)?
 #   (constant definition), YY_\w+_INCLUDED (header guards).
 #   YYDEBUG (not renamed) can be read, but not changed.
-AT_CHECK([[$PERL -n -0777 -e '
+AT_CHECK([["$PERL" -n -0777 -e '
   s{/\*.*?\*/}{}gs;
   s{//.*}{}g;
   s{\b((defined|if)\ YYDEBUG
@@ -347,7 +347,7 @@ AT_CHECK([[$PERL -n -0777 -e '
       print "$ARGV: invalid exported yy: $1\n";
     }
   }
-' -- *.hh *.h]])
+' -- *.hh *.h || exit 77]])
 
 # Do this late, so that other checks have been performed.
 AT_SKIP_IF_CANNOT_LINK_C_AND_CXX
diff --git a/tests/input.at b/tests/input.at
index e77ae90c..881938c1 100644
--- a/tests/input.at
+++ b/tests/input.at
@@ -90,7 +90,7 @@ default: 'a' }
 %-
 %{
 ]])
-AT_CHECK([[$PERL -pi -e 's/\\(\d{3})/chr(oct($1))/ge' input.y || exit 77]])
+AT_CHECK([["$PERL" -pi -e 's/\\(\d{3})/chr(oct($1))/ge' input.y || exit 77]])
 
 AT_BISON_CHECK([input.y], [1], [],
 [[input.y:1.1-2: error: invalid characters: '\0\001\002\377?'
@@ -2184,7 +2184,7 @@ AT_DATA([empty.y],
 start: '';
 start: '
 ]])
-AT_CHECK([[$PERL -e "print 'start: \'';" >> empty.y || exit 77]])
+AT_CHECK([["$PERL" -e "print 'start: \'';" >> empty.y || exit 77]])
 
 AT_BISON_CHECK([-fcaret empty.y], [1], [],
 [[empty.y:2.8-9: warning: empty character literal [-Wother]
@@ -2209,7 +2209,7 @@ AT_DATA([two.y],
 start: 'ab';
 start: 'ab
 ]])
-AT_CHECK([[$PERL -e "print 'start: \'ab';" >> two.y || exit 77]])
+AT_CHECK([["$PERL" -e "print 'start: \'ab';" >> two.y || exit 77]])
 
 AT_BISON_CHECK([two.y], [1], [],
 [[two.y:2.8-11: warning: extra characters in character literal [-Wother]
@@ -2224,7 +2224,7 @@ AT_DATA([three.y],
 start: 'abc';
 start: 'abc
 ]])
-AT_CHECK([[$PERL -e "print 'start: \'abc';" >> three.y || exit 77]])
+AT_CHECK([["$PERL" -e "print 'start: \'abc';" >> three.y || exit 77]])
 
 AT_BISON_CHECK([three.y], [1], [],
 [[three.y:2.8-12: warning: extra characters in character literal [-Wother]
@@ -2254,7 +2254,7 @@ start: '\777' '\0' '\xfff' '\x0'
 # Beside we cannot even expect "echo '\0'" to output two characters
 # (well three with \n): at least Bash 3.2 converts the two-character
 # sequence "\0" into a single NUL character.
-AT_CHECK([[$PERL -e 'print "start: \"\\\t\\\f\\\0\\\1\" ;";' >> input.y \
+AT_CHECK([["$PERL" -e 'print "start: \"\\\t\\\f\\\0\\\1\" ;";' >> input.y \
            || exit 77]])
 
 AT_BISON_CHECK([input.y], [1], [],
diff --git a/tests/local.at b/tests/local.at
index 24899352..8193d93c 100644
--- a/tests/local.at
+++ b/tests/local.at
@@ -55,10 +55,10 @@ m4_define([AT_SETUP_STRIP],
 # Expect COUNT matches of the PERL-REGEXP in FILE.  The file is
 # taken in "slurp" mode, i.e., one can match end-of-lines.
 m4_define([AT_MATCHES_CHECK],
-[AT_CHECK([$PERL -0777 -ne '
+[AT_CHECK(["$PERL" -0777 -ne '
 my $count = 0;
 s{$2}{ ++$count; "" }gem;
-printf "$count\n";' $1], [0], [$3
+printf "$count\n";' $1 || exit 77], [0], [$3
 ])])
 
 
@@ -857,17 +857,19 @@ if test "$POSIXLY_CORRECT_IS_EXPORTED" = false; then
   # Run with -Werror.
   ]AT_BISON_CHECK_([$1[ -Werror]], [[1]], [expout], [stderr])[
 
-  # Build expected stderr up to and including the "warnings being
-  # treated as errors" message.
-  ]AT_DATA([[experr]], [$4])[
-  $PERL -pi -e 's{(.*): warning:}{$][1: error:};' \
-            -e 's{\[-W(.*)\]$}{@<:@-Werror=$][1@:>@}' \
-                 experr
-  ]AT_CHECK([[sed 's,.*/$,,' stderr 1>&2]], [[0]], [[]], [experr])[
-
-  # Now check --warnings=error.
-  cp stderr experr
-  ]AT_BISON_CHECK_([$1[ --warnings=error]], [[1]], [expout], [experr])[
+  if test x"$PERL" != x; then
+    # Build expected stderr up to and including the "warnings being
+    # treated as errors" message.
+    ]AT_DATA([[experr]], [$4])[
+    "$PERL" -pi -e 's{(.*): warning:}{$][1: error:};' \
+                -e 's{\[-W(.*)\]$}{@<:@-Werror=$][1@:>@}' \
+                    experr
+    ]AT_CHECK([[sed 's,.*/$,,' stderr 1>&2]], [[0]], [[]], [experr])[
+
+    # Now check --warnings=error.
+    cp stderr experr
+    ]AT_BISON_CHECK_([$1[ --warnings=error]], [[1]], [expout], [experr])[
+  fi
 
   # Now check -Wnone and --warnings=none by making sure that
   # -Werror doesn't change the exit status when -Wnone or
diff --git a/tests/named-refs.at b/tests/named-refs.at
index fa67dbe5..e4c3d38f 100644
--- a/tests/named-refs.at
+++ b/tests/named-refs.at
@@ -604,7 +604,7 @@ AT_DATA_GRAMMAR([test.y],
 start: foo[ % /* aaa */ *&-.+\000\001\002\377 ] bar
   { s = $foo; }
 ]])
-AT_CHECK([[$PERL -pi -e 's/\\(\d{3})/chr(oct($1))/ge' test.y || exit 77]])
+AT_CHECK([["$PERL" -pi -e 's/\\(\d{3})/chr(oct($1))/ge' test.y || exit 77]])
 AT_BISON_CHECK([-o test.c test.y], 1, [],
 [[test.y:11.13: error: invalid character in bracketed name: '%'
 test.y:11.25-27: error: invalid characters in bracketed name: '*&-'
diff --git a/tests/output.at b/tests/output.at
index fd880f04..5f0ca876 100644
--- a/tests/output.at
+++ b/tests/output.at
@@ -23,10 +23,10 @@ AT_BANNER([[Output file names.]])
 # Check that the current directory contains FILE... (sorted).
 m4_define([AT_CHECK_FILES],
 [AT_CHECK([[find . -type f |
-           $PERL -ne '
+           "$PERL" -ne '
       s,\./,,; chomp;
       push @file, $_ unless m{^($2|testsuite.log)$};
-      END { print join (" ", sort @file), "\n" }']],
+      END { print join (" ", sort @file), "\n" }' || exit 77]],
           [], [$1
 ])])
 
@@ -48,7 +48,7 @@ foo: '0' {};
 ]])
 
 # There is not AT_DATA_UNQUOTED.
-AT_CHECK([$PERL -pi -e 's{\$at_dir}'"{$at_group_dir}g" $1])
+AT_CHECK(["$PERL" -pi -e 's{\$at_dir}'"{$at_group_dir}g" $1 || exit 77])
 
 
 AT_BISON_CHECK([$3 $1], [$5], [], [ignore])[
diff --git a/tests/regression.at b/tests/regression.at
index 9bfaf67b..76f7a580 100644
--- a/tests/regression.at
+++ b/tests/regression.at
@@ -1352,18 +1352,18 @@ AT_CHECK([[grep 'syntax error,' stderr.txt]], [[0]],
 
 # Check number of default reductions in inconsistent states to be sure
 # syntax error is detected before unnecessary reductions are performed.
-AT_CHECK([[$PERL -0777 -ne 'print s/inconsistent default reduction//g;' \
+AT_CHECK([["$PERL" -0777 -ne 'print s/inconsistent default reduction//g;' \
            < stdout.txt || exit 77]], [[0]], [[14]])
 
 # Check number of default reductions in consistent states to be sure
 # it is performed before the syntax error is detected.
-AT_CHECK([[$PERL -0777 -ne 'print s/\bconsistent default reduction//g;' \
+AT_CHECK([["$PERL" -0777 -ne 'print s/\bconsistent default reduction//g;' \
            < stdout.txt || exit 77]], [[0]], [[2]])
 
 ]AT_C_IF([[
   # Check number of reallocs to be sure reallocated memory isn't somehow
   # lost between LAC invocations.
-  AT_CHECK([[$PERL -0777 -ne 'print s/\(realloc//g;' < stderr.txt \
+  AT_CHECK([["$PERL" -0777 -ne 'print s/\(realloc//g;' < stderr.txt \
              || exit 77]], [[0]], [[3]])
 ]])[
 
diff --git a/tests/skeletons.at b/tests/skeletons.at
index bfd696e4..6cb52497 100644
--- a/tests/skeletons.at
+++ b/tests/skeletons.at
@@ -311,7 +311,7 @@ print '@output(@,@,@)', "\n";
 (print "garbage"x10, "\n") for (1..1000);
 print "${M4}_divert_pop(0)\n";
 ]])
-AT_CHECK([[$PERL gen-skel.pl > skel.c || exit 77]])
+AT_CHECK([["$PERL" gen-skel.pl > skel.c || exit 77]])
 
 AT_DATA([[input.y]],
 [[%skeleton "./skel.c"
diff --git a/tests/synclines.at b/tests/synclines.at
index 978d4943..bc63ea8b 100644
--- a/tests/synclines.at
+++ b/tests/synclines.at
@@ -97,7 +97,7 @@ m4_define([_AT_SYNCLINES_COMPILE],
 #    syncline.c:4:2: error: #error "4"
 #        4 | #error "4"
 #          |  ^~~~~
-AT_CHECK([[$PERL -p -0777 - stderr <<\EOF
+AT_CHECK([["$PERL" -p -0777 - stderr <<\EOF || exit 77
   # Remove left-hand margin.
   s/^[\d ]{6}\| //gm;
 
diff --git a/tests/torture.at b/tests/torture.at
index d4f4f48c..eeb586cd 100644
--- a/tests/torture.at
+++ b/tests/torture.at
@@ -120,7 +120,7 @@ EOF
 ]])
 AT_BISON_OPTION_POPDEFS
 
-AT_CHECK([$PERL -w ./gengram.pl $2 || exit 77], 0, [stdout])
+AT_CHECK(["$PERL" -w ./gengram.pl $2 || exit 77], 0, [stdout])
 mv stdout $1
 ])
 
@@ -203,7 +203,7 @@ yylex (void)
 EOF
 ]])
 
-AT_CHECK([$PERL -w ./gengram.pl $2 || exit 77], 0, [stdout])
+AT_CHECK(["$PERL" -w ./gengram.pl $2 || exit 77], 0, [stdout])
 mv stdout $1
 AT_BISON_OPTION_POPDEFS
 ])
@@ -375,7 +375,7 @@ yylex (void)
 EOF
 ]])
 
-AT_CHECK([$PERL -w ./gengram.pl $2 || exit 77], 0, [stdout])
+AT_CHECK(["$PERL" -w ./gengram.pl $2 || exit 77], 0, [stdout])
 mv stdout $1
 AT_BISON_OPTION_POPDEFS
 ])




reply via email to

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