+2011-01-28 Stefano Lattarini <stefano.lattarini@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.lattarini@gmail.com>
configure: look for a yacc program to be used by the testsuite
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LEX = @LEX@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LN = @LN@
MODIFICATION_DELAY
LN
HELP2MAN
+LEX
YACC
TEX
PERL_THREADS
-# The test suite will skip some tests if no yacc program is available.
-# We don't use AC_PROG_YACC because:
-# 1. we don't want bison to be preferred to system yacc;
-# 2. we don't want $YACC to be defined to 'yacc' by default;
-# 3. we prefer not to have the YFLAGS variable to be AC_SUBST'd,
-# 4. we prefer that the YACC variable is not reported in the
+# The test suite will skip some tests if no lex or yacc program is
+# available.
+# We don't use AC_PROG_LEX nor AC_PROG_YACC here because:
+# 1. we don't want flex (resp. bison) to be preferred to system lex
+# (resp. system yacc);
+# 2. we don't want $LEX (resp. $YACC) to be defined to ':' (resp. 'yacc')
+# by default;
+# 3. we prefer not to have the variables YFLAGS, LEX_OUTPUT_ROOT and
+# LEXLIB to be calculated and/or AC_SUBST'd;
+# 4. we prefer that the YACC and LEX variables are not reported in the
# configure help screen.
for ac_prog in yacc byacc 'bison -y'
do
done
test -n "$YACC" || YACC="false"
+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.
# The test suite will skip some tests if tex is absent.
AC_CHECK_PROG([TEX], [tex], [tex])
-# The test suite will skip some tests if no yacc program is available.
-# We don't use AC_PROG_YACC because:
-# 1. we don't want bison to be preferred to system yacc;
-# 2. we don't want $YACC to be defined to 'yacc' by default;
-# 3. we prefer not to have the YFLAGS variable to be AC_SUBST'd,
-# 4. we prefer that the YACC variable is not reported in the
+# The test suite will skip some tests if no lex or yacc program is
+# available.
+# We don't use AC_PROG_LEX nor AC_PROG_YACC here because:
+# 1. we don't want flex (resp. bison) to be preferred to system lex
+# (resp. system yacc);
+# 2. we don't want $LEX (resp. $YACC) to be defined to ':' (resp. 'yacc')
+# by default;
+# 3. we prefer not to have the variables YFLAGS, LEX_OUTPUT_ROOT and
+# LEXLIB to be calculated and/or AC_SUBST'd;
+# 4. we prefer that the YACC and LEX variables are not reported in the
# configure help screen.
AC_CHECK_PROGS([YACC], [yacc byacc 'bison -y'], [false])
+AC_CHECK_PROGS([LEX], [lex flex], [false])
# Generate man pages.
AM_MISSING_PROG([HELP2MAN], [help2man])
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LEX = @LEX@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LN = @LN@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LEX = @LEX@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LN = @LN@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LEX = @LEX@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LN = @LN@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LEX = @LEX@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LN = @LN@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LEX = @LEX@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LN = @LN@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LEX = @LEX@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LN = @LN@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LEX = @LEX@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LN = @LN@
# Check rules output for parser defined conditionally.
# Report from Roman Fietze.
-required='flex yacc gcc'
+required='lex yacc gcc'
. ./defs || Exit 1
set -e
# Check rules output for parser defined conditionally.
-required='flex yacc gcc'
+required='lex yacc gcc'
. ./defs || Exit 1
set -e
# 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@"
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
+ fi
+ export LEX
+ ;;
yacc)
if test x"$YACC" = x"false"; then
# No yacc program was found at configure time, or the user has
#! /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
# Test associated with PR 19.
# From Matthew D. Langston.
-required='gcc flex GNUmake'
+required='gcc lex GNUmake'
. ./defs || Exit 1
set -e
#! /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
# Test for subdir lexers.
-required='gcc GNUmake flex'
+required='gcc GNUmake lex'
. ./defs || Exit 1
set -e
#! /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
# Please keep this in sync with sister test `yaccvapth.test'.
-required='gcc flex'
+required='gcc lex'
. ./defs || Exit 1
set -e
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
# 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
# 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
# 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
# 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