This will allow the testcases requiring a 'lex' program to run also with vendor/legacy lex implementations, not only with 'flex'.
* configure.ac: Look for a lex program, using AC_CHECK_PROGS. * tests/defs.in: New required entry 'lex'. ($LEX): Let the user override the lex program to be used by the testsuite. * tests/cond35.test ($required): Require 'lex', not 'flex'. * tests/cond36.test: Likewise. * tests/lexv3.test: Likewise. * tests/lexv3.test: Likewise. * tests/silent-lex-gcc.test: Likewise. * tests/silent-lex-generic.test: Likewise. * tests/silent-many-gcc.test: Likewise. * tests/silent-many-generic.test:likewise. * tests/lexvpath.test: Likewise, and fix typo in comments. -*-*- OK for the 'yacc-work' branch? (Branch which, at this point should probably be renamed to 'lex-yacc-work' ...) Regards, Stefano
From da75df3543f7ab1dea9b3543f129dba32c8cefac Mon Sep 17 00:00:00 2001 From: Stefano Lattarini <stefano.lattar...@gmail.com> Date: Fri, 28 Jan 2011 23:04:14 +0100 Subject: [PATCH] configure: look for a lex program to be used by the testsuite This will allow the testcases requiring a 'lex' program to run also with vendor/legacy lex implementations, not only with 'flex'. * configure.ac: Look for a lex program, using AC_CHECK_PROGS. * tests/defs.in: New required entry 'lex'. ($LEX): Let the user override the lex program to be used by the testsuite. * tests/cond35.test ($required): Require 'lex', not 'flex'. * tests/cond36.test: Likewise. * tests/lexv3.test: Likewise. * tests/lexv3.test: Likewise. * tests/silent-lex-gcc.test: Likewise. * tests/silent-lex-generic.test: Likewise. * tests/silent-many-gcc.test: Likewise. * tests/silent-many-generic.test:likewise. * tests/lexvpath.test: Likewise, and fix typo in comments. --- ChangeLog | 19 ++++++++++++++ Makefile.in | 1 + configure | 53 ++++++++++++++++++++++++++++++++++++++++ configure.ac | 10 +++++++ doc/Makefile.in | 1 + lib/Automake/Makefile.in | 1 + lib/Automake/tests/Makefile.in | 1 + lib/Makefile.in | 1 + lib/am/Makefile.in | 1 + m4/Makefile.in | 1 + tests/Makefile.in | 1 + tests/cond35.test | 2 +- tests/cond36.test | 2 +- tests/defs.in | 12 +++++++++ tests/lex3.test | 4 +- tests/lex5.test | 5 ++- tests/lexvpath.test | 8 +++--- tests/silent-lex-gcc.test | 2 +- tests/silent-lex-generic.test | 2 +- tests/silent-many-gcc.test | 2 +- tests/silent-many-generic.test | 2 +- 21 files changed, 117 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4470c28..a372c6c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2011-01-28 Stefano Lattarini <stefano.lattar...@gmail.com> + + configure: look for a lex program to be used by the testsuite + This will allow the testcases requiring a 'lex' program to run also + with vendor/legacy lex implementations, not only with 'flex'. + * configure.ac: Look for a lex program, using AC_CHECK_PROGS. + * tests/defs.in: New required entry 'lex'. + ($LEX): Let the user override the lex program to be used by the + testsuite. + * tests/cond35.test ($required): Require 'lex', not 'flex'. + * tests/cond36.test: Likewise. + * tests/lexv3.test: Likewise. + * tests/lexv3.test: Likewise. + * tests/silent-lex-gcc.test: Likewise. + * tests/silent-lex-generic.test: Likewise. + * tests/silent-many-gcc.test: Likewise. + * tests/silent-many-generic.test:likewise. + * tests/lexvpath.test: Likewise, and fix typo in comments. + 2011-01-22 Stefano Lattarini <stefano.lattar...@gmail.com> configure: look for a yacc program to be used by the testsuite diff --git a/Makefile.in b/Makefile.in index dd2b085..23ffa29 100644 --- a/Makefile.in +++ b/Makefile.in @@ -166,6 +166,7 @@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LEX = @LEX@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN = @LN@ diff --git a/configure b/configure index 789a8d3..e61343e 100755 --- a/configure +++ b/configure @@ -575,6 +575,7 @@ GREP MODIFICATION_DELAY LN HELP2MAN +LEX YACC TEX PERL_THREADS @@ -2456,6 +2457,58 @@ done test -n "$YACC" || YACC="false" +# The test suite will skip some tests if no yacc program is available. +# We don't use AC_PROG_LEX because: +# 1. we don't want flex to be preferred to system lex; +# 2. we don't want $LEX to be defined to ':' by default; +# 3. we prefer not to have the LEXLIB and LEX_OUTPUT_ROOT variables +# to be calculated and/or AC_SUBST'd; +# 4. we prefer that the LEX variable is not reported in the +# configure help screen. +for ac_prog in lex flex +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_LEX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$LEX"; then + ac_cv_prog_LEX="$LEX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_LEX="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +LEX=$ac_cv_prog_LEX +if test -n "$LEX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LEX" >&5 +$as_echo "$LEX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$LEX" && break +done +test -n "$LEX" || LEX="false" + + # Generate man pages. HELP2MAN=${HELP2MAN-"${am_missing_run}help2man"} diff --git a/configure.ac b/configure.ac index 343bca5..f5d45e7 100644 --- a/configure.ac +++ b/configure.ac @@ -103,6 +103,16 @@ AC_CHECK_PROG([TEX], [tex], [tex]) # configure help screen. AC_CHECK_PROGS([YACC], [yacc byacc 'bison -y'], [false]) +# The test suite will skip some tests if no yacc program is available. +# We don't use AC_PROG_LEX because: +# 1. we don't want flex to be preferred to system lex; +# 2. we don't want $LEX to be defined to ':' by default; +# 3. we prefer not to have the LEXLIB and LEX_OUTPUT_ROOT variables +# to be calculated and/or AC_SUBST'd; +# 4. we prefer that the LEX variable is not reported in the +# configure help screen. +AC_CHECK_PROGS([LEX], [lex flex], [false]) + # Generate man pages. AM_MISSING_PROG([HELP2MAN], [help2man]) diff --git a/doc/Makefile.in b/doc/Makefile.in index a3cfbba..8eda666 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -133,6 +133,7 @@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LEX = @LEX@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN = @LN@ diff --git a/lib/Automake/Makefile.in b/lib/Automake/Makefile.in index dd331fe..a86e899 100644 --- a/lib/Automake/Makefile.in +++ b/lib/Automake/Makefile.in @@ -153,6 +153,7 @@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LEX = @LEX@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN = @LN@ diff --git a/lib/Automake/tests/Makefile.in b/lib/Automake/tests/Makefile.in index 80427fb..9b2b38c 100644 --- a/lib/Automake/tests/Makefile.in +++ b/lib/Automake/tests/Makefile.in @@ -198,6 +198,7 @@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LEX = @LEX@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN = @LN@ diff --git a/lib/Makefile.in b/lib/Makefile.in index 63edec9..4d5f77e 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -155,6 +155,7 @@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LEX = @LEX@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN = @LN@ diff --git a/lib/am/Makefile.in b/lib/am/Makefile.in index e24400b..225977f 100644 --- a/lib/am/Makefile.in +++ b/lib/am/Makefile.in @@ -113,6 +113,7 @@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LEX = @LEX@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN = @LN@ diff --git a/m4/Makefile.in b/m4/Makefile.in index baaf548..caf019c 100644 --- a/m4/Makefile.in +++ b/m4/Makefile.in @@ -113,6 +113,7 @@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LEX = @LEX@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN = @LN@ diff --git a/tests/Makefile.in b/tests/Makefile.in index 25fc4a8..e970427 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -203,6 +203,7 @@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LEX = @LEX@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LN = @LN@ diff --git a/tests/cond35.test b/tests/cond35.test index 34a7e7f..6e8fba4 100755 --- a/tests/cond35.test +++ b/tests/cond35.test @@ -17,7 +17,7 @@ # Check rules output for parser defined conditionally. # Report from Roman Fietze. -required='flex yacc gcc' +required='lex yacc gcc' . ./defs || Exit 1 set -e diff --git a/tests/cond36.test b/tests/cond36.test index d06ed87..6f0df84 100755 --- a/tests/cond36.test +++ b/tests/cond36.test @@ -16,7 +16,7 @@ # Check rules output for parser defined conditionally. -required='flex yacc gcc' +required='lex yacc gcc' . ./defs || Exit 1 set -e diff --git a/tests/defs.in b/tests/defs.in index cfa9fd3..f449f01 100644 --- a/tests/defs.in +++ b/tests/defs.in @@ -63,6 +63,7 @@ export SHELL # User can override various tools used. test -z "$PERL" && PERL='@PERL@' test -z "$YACC" && YACC='@YACC@' +test -z "$LEX" && LEX='@LEX@' test -z "$MAKE" && MAKE=make test -z "$AUTOCONF" && AUTOCONF="@am_AUTOCONF@" test -z "$AUTOHEADER" && AUTOHEADER="@am_AUTOHEADER@" @@ -210,6 +211,17 @@ do echo "$me: running texi2dvi -o /dev/null --version" ( texi2dvi -o /dev/null --version ) || exit 77 ;; + lex) + if test x"$LEX" = x"false"; then + # No lex program was found at configure time, or the user has + # explicitly told he doesn't want a lex program to be used. + echo "$me: \$LEX is \"false\", skipping test" >&2 + exit 77 + else + # Make LEX available to configure by exporting it. + export LEX + fi + ;; yacc) if test x"$YACC" = x"false"; then # No yacc program was found at configure time, or the user has diff --git a/tests/lex3.test b/tests/lex3.test index e2b01d8..536239b 100755 --- a/tests/lex3.test +++ b/tests/lex3.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 1999, 2001, 2002, 2003, 2004, 2010 Free Software +# Copyright (C) 1999, 2001, 2002, 2003, 2004, 2010, 2011 Free Software # Foundation, Inc. # # This program is free software; you can redistribute it and/or modify @@ -19,7 +19,7 @@ # Test associated with PR 19. # From Matthew D. Langston. -required='gcc flex GNUmake' +required='gcc lex GNUmake' . ./defs || Exit 1 set -e diff --git a/tests/lex5.test b/tests/lex5.test index 5c688d7..f3ddccc 100755 --- a/tests/lex5.test +++ b/tests/lex5.test @@ -1,5 +1,6 @@ #! /bin/sh -# Copyright (C) 2002, 2003, 2004, 2010 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2004, 2010, 2011 Free Software Foundation, +# Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,7 +17,7 @@ # Test for subdir lexers. -required='gcc GNUmake flex' +required='gcc GNUmake lex' . ./defs || Exit 1 set -e diff --git a/tests/lexvpath.test b/tests/lexvpath.test index 378795e..54a517a 100755 --- a/tests/lexvpath.test +++ b/tests/lexvpath.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2010 Free Software Foundation, Inc. +# Copyright (C) 2010, 2011 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -22,7 +22,7 @@ # Please keep this in sync with sister test `yaccvapth.test'. -required='gcc flex' +required='gcc lex' . ./defs || Exit 1 set -e @@ -65,14 +65,14 @@ $AUTOMAKE -a mkdir sub -# We must run configure early, to find out whay $LEX_OUTPUT_ROOT is. +# We must run configure early, to find out why $LEX_OUTPUT_ROOT is. cd sub ../configure . ./lexoutroot test -n "$LEX_OUTPUT_ROOT" # sanity check cd .. -flex lexer.l +$LEX lexer.l mv "$LEX_OUTPUT_ROOT".c lexer.c cd sub diff --git a/tests/silent-lex-gcc.test b/tests/silent-lex-gcc.test index 7550393..a3cb0c5 100755 --- a/tests/silent-lex-gcc.test +++ b/tests/silent-lex-gcc.test @@ -17,7 +17,7 @@ # Check silent-rules mode for Lex, forcing gcc depmode. # Keep this in sync with sister test `silent-lex-generic.test'. -required='flex gcc' +required='lex gcc' . ./defs || Exit 1 set -e diff --git a/tests/silent-lex-generic.test b/tests/silent-lex-generic.test index 5322326..2c39861 100755 --- a/tests/silent-lex-generic.test +++ b/tests/silent-lex-generic.test @@ -17,7 +17,7 @@ # Check silent-rules mode for Lex. # Keep this in sync with sister test `silent-lex-gcc.test'. -required='flex' +required=lex . ./defs || Exit 1 set -e diff --git a/tests/silent-many-gcc.test b/tests/silent-many-gcc.test index 1732d9d..6515c19 100755 --- a/tests/silent-many-gcc.test +++ b/tests/silent-many-gcc.test @@ -21,7 +21,7 @@ # This test requires the GNU compilers; keep it in sync with sister test # `silent-many-generic.test', which should work with generic compilers. -required='gcc g++ gfortran flex yacc' +required='gcc g++ gfortran lex yacc' . ./defs || Exit 1 set -e diff --git a/tests/silent-many-generic.test b/tests/silent-many-generic.test index 0502bf8..2a328ea 100755 --- a/tests/silent-many-generic.test +++ b/tests/silent-many-generic.test @@ -23,7 +23,7 @@ # and forces the use of gcc depmode. # FIXME: generic C++/Fortran compilers should suffice here -required='g++ gfortran flex yacc' +required='g++ gfortran lex yacc' . ./defs || Exit 1 set -e -- 1.7.2.3