# Process this file with autoconf to produce a configure script.
# Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-# 2004, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+# 2004, 2006, 2007, 2008, 2009, 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
# 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 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])
+# We don't want YACC and LEX defined as make variables, otherwise the
+# values determined at configure time will override those from the
+# environment, even in the make-spawned testcases.
+AM_SUBST_NOTMAKE([YACC])
+AM_SUBST_NOTMAKE([LEX])
+
# Generate man pages.
AM_MISSING_PROG([HELP2MAN], [help2man])