]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
configure: look for a lex program to be used by the testsuite
authorStefano Lattarini <stefano.lattarini@gmail.com>
Fri, 28 Jan 2011 22:04:14 +0000 (23:04 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 29 Jan 2011 11:57:56 +0000 (12:57 +0100)
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.

21 files changed:
ChangeLog
Makefile.in
configure
configure.ac
doc/Makefile.in
lib/Automake/Makefile.in
lib/Automake/tests/Makefile.in
lib/Makefile.in
lib/am/Makefile.in
m4/Makefile.in
tests/Makefile.in
tests/cond35.test
tests/cond36.test
tests/defs.in
tests/lex3.test
tests/lex5.test
tests/lexvpath.test
tests/silent-lex-gcc.test
tests/silent-lex-generic.test
tests/silent-many-gcc.test
tests/silent-many-generic.test

index 4470c28ff6bc8211026d71e48bd02dbccbde6162..a372c6c5aa8840313e2ad3fcd5edd6f517852b1c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+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
index dd2b0855254391f0c01a4884e5f0544608e48034..23ffa296804844bf0faf88edec4ef4d4eddeb842 100644 (file)
@@ -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@
index 789a8d39d14bb7eb6c87be4dfd5608d9b77437ad..ffb4514747cd41ab9b0c7edaf551ec3bd8ff93ac 100755 (executable)
--- a/configure
+++ b/configure
@@ -575,6 +575,7 @@ GREP
 MODIFICATION_DELAY
 LN
 HELP2MAN
+LEX
 YACC
 TEX
 PERL_THREADS
@@ -2405,12 +2406,16 @@ fi
 
 
 
-# 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
@@ -2455,6 +2460,49 @@ fi
 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.
 
index 343bca549b82e33320ad96fb72f14d97930c5502..ddd0af6ccc843ea094d7b5c7807d682c7293ae22 100644 (file)
@@ -94,14 +94,19 @@ AC_SUBST([PERL_THREADS])
 # 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])
index a3cfbba7d84e40536ded6c132153ed142c790ca6..8eda666fad875f80e0dc57f845204bd5d6dac5c9 100644 (file)
@@ -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@
index dd331feb82d8fd49a07175ed020568767edfb736..a86e8997bdf851aa3f87e9f0983e20bb046b22d5 100644 (file)
@@ -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@
index 80427fb779fd57567ba74348393b15da664251e6..9b2b38cde4947a9bc4d843ec02fcacb874dbe8c9 100644 (file)
@@ -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@
index 63edec9f7329a48e03bff5b69799eb93b1a36d0e..4d5f77efa668067579af0fe2d22069d41ec3b2da 100644 (file)
@@ -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@
index e24400b5b87392537f2b502a56be67d0797fbe3e..225977f2abb15c67f60018bd56f535889936ec9d 100644 (file)
@@ -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@
index baaf5485100688d44d7bde5dc5daa5f760743021..caf019cdea64b177d44bd228019a278737abe2e3 100644 (file)
@@ -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@
index 25fc4a83c6722fd234a55fc276b84faec094e084..e97042761f0e4c52b0e638dd4e1ec389b53e85bd 100644 (file)
@@ -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@
index 34a7e7ff70341ff473f441b7e2325f65d0eecc97..6e8fba44c167f217b4430db6e048c08c19b2a62c 100755 (executable)
@@ -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
index d06ed87bebcea936ae69b32c7ec981f533a28d32..6f0df844dc0340c34ba28d5cfa7898d70090e253 100755 (executable)
@@ -16,7 +16,7 @@
 
 # Check rules output for parser defined conditionally.
 
-required='flex yacc gcc'
+required='lex yacc gcc'
 . ./defs || Exit 1
 
 set -e
index cfa9fd35e418f8173179f28a0e901fb8d334f946..d755c261633ee7b97711079f6cc83731624755ca 100644 (file)
@@ -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,15 @@ 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
+      fi
+      export LEX
+      ;;
     yacc)
       if test x"$YACC" = x"false"; then
         # No yacc program was found at configure time, or the user has
index e2b01d882128004d4ee6d443289a3df8b0e70e3e..536239b2eb072a3e33eb831897b818c8e4e7d00c 100755 (executable)
@@ -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
index 5c688d78241e578c0b81b8aac8d8721df69e7646..f3ddcccf6008b95c855b4c2fd51a152738441c25 100755 (executable)
@@ -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
index 378795ec0ea0d4a422f4a432b6de751912cf7fc4..54a517a2c6328c743d751f33ee1fd51276ad5e11 100755 (executable)
@@ -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
index 75503933aaf4fa51598493619d216713481b2b1b..a3cb0c5575396db8d38ed71c4cb04c917986b3df 100755 (executable)
@@ -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
index 532232633914a2a84c9479faf724a9eb1e416fe4..2c398619e8ac0d61a6f1cb5b19d64501823c3c88 100755 (executable)
@@ -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
index 1732d9d817e9237701f73a26a594c174550454ab..6515c1986782c9672ef402270e37fbafc39d095d 100755 (executable)
@@ -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
index 0502bf88a1060be59f22d594d8d216792ea7b38d..2a328ea512fe28754b992d1fc3a692f75f505777 100755 (executable)
@@ -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