From: Stefano Lattarini Date: Sat, 22 Jan 2011 20:11:06 +0000 (+0100) Subject: configure: look for a yacc program to be used by the testsuite X-Git-Tag: ylwrap-refactor-abandoned-branch~64 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d86a273998952c09a569121c252512556b00d985;p=thirdparty%2Fautomake.git configure: look for a yacc program to be used by the testsuite Instead of forcing the user to manually export 'YACC' in the testsuite to use a non-bison yacc, we now look for a yacc program at configure time, and use that as the default in the testsuite. * configure.ac: Look for a yacc program, using AC_CHECK_PROGS. * tests/defs.in: Updated to use the value of $YACC precomputed by configure, unless the user overrides that in the environment. --- diff --git a/ChangeLog b/ChangeLog index 331246c77..4470c28ff 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2011-01-22 Stefano Lattarini + + configure: look for a yacc program to be used by the testsuite + Instead of forcing the user to manually export 'YACC' in the + testsuite to use a non-bison yacc, we now look for a yacc program + at configure time, and use that as the default in the testsuite. + * configure.ac: Look for a yacc program, using AC_CHECK_PROGS. + * tests/defs.in: Updated to use the value of $YACC precomputed by + configure, unless the user overrides that in the environment. + 2011-01-22 Stefano Lattarini tests: more coverage on yacc/lex silent-rules, plus minor cleanups diff --git a/Makefile.in b/Makefile.in index 25d580d60..dd2b08552 100644 --- a/Makefile.in +++ b/Makefile.in @@ -188,6 +188,7 @@ SHELL = @SHELL@ STRIP = @STRIP@ TEX = @TEX@ VERSION = @VERSION@ +YACC = @YACC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ diff --git a/configure b/configure index 5af3df868..789a8d39d 100755 --- a/configure +++ b/configure @@ -575,6 +575,7 @@ GREP MODIFICATION_DELAY LN HELP2MAN +YACC TEX PERL_THREADS PERL @@ -2404,6 +2405,57 @@ 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 +# configure help screen. +for ac_prog in yacc byacc 'bison -y' +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_YACC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$YACC"; then + ac_cv_prog_YACC="$YACC" # 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_YACC="$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 +YACC=$ac_cv_prog_YACC +if test -n "$YACC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5 +$as_echo "$YACC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$YACC" && break +done +test -n "$YACC" || YACC="false" + + # Generate man pages. HELP2MAN=${HELP2MAN-"${am_missing_run}help2man"} diff --git a/configure.ac b/configure.ac index de4583d67..343bca549 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,8 @@ # 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 @@ -93,6 +94,15 @@ 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 +# configure help screen. +AC_CHECK_PROGS([YACC], [yacc byacc 'bison -y'], [false]) + # Generate man pages. AM_MISSING_PROG([HELP2MAN], [help2man]) diff --git a/doc/Makefile.in b/doc/Makefile.in index c1739e546..a3cfbba7d 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -155,6 +155,7 @@ SHELL = @SHELL@ STRIP = @STRIP@ TEX = @TEX@ VERSION = @VERSION@ +YACC = @YACC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ diff --git a/lib/Automake/Makefile.in b/lib/Automake/Makefile.in index 5f051ed57..dd331feb8 100644 --- a/lib/Automake/Makefile.in +++ b/lib/Automake/Makefile.in @@ -175,6 +175,7 @@ SHELL = @SHELL@ STRIP = @STRIP@ TEX = @TEX@ VERSION = @VERSION@ +YACC = @YACC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ diff --git a/lib/Automake/tests/Makefile.in b/lib/Automake/tests/Makefile.in index 4b2c57f22..80427fb77 100644 --- a/lib/Automake/tests/Makefile.in +++ b/lib/Automake/tests/Makefile.in @@ -220,6 +220,7 @@ SHELL = @SHELL@ STRIP = @STRIP@ TEX = @TEX@ VERSION = @VERSION@ +YACC = @YACC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ diff --git a/lib/Makefile.in b/lib/Makefile.in index d9e41e2d8..63edec9f7 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -177,6 +177,7 @@ SHELL = @SHELL@ STRIP = @STRIP@ TEX = @TEX@ VERSION = @VERSION@ +YACC = @YACC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ diff --git a/lib/am/Makefile.in b/lib/am/Makefile.in index 352c64f41..e24400b5b 100644 --- a/lib/am/Makefile.in +++ b/lib/am/Makefile.in @@ -135,6 +135,7 @@ SHELL = @SHELL@ STRIP = @STRIP@ TEX = @TEX@ VERSION = @VERSION@ +YACC = @YACC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ diff --git a/m4/Makefile.in b/m4/Makefile.in index cd80415fb..baaf54851 100644 --- a/m4/Makefile.in +++ b/m4/Makefile.in @@ -135,6 +135,7 @@ SHELL = @SHELL@ STRIP = @STRIP@ TEX = @TEX@ VERSION = @VERSION@ +YACC = @YACC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ diff --git a/tests/Makefile.in b/tests/Makefile.in index 5eedb7686..25fc4a83c 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -225,6 +225,7 @@ SHELL = @SHELL@ STRIP = @STRIP@ TEX = @TEX@ VERSION = @VERSION@ +YACC = @YACC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ diff --git a/tests/defs.in b/tests/defs.in index dfb5f2ef3..cfa9fd35e 100644 --- a/tests/defs.in +++ b/tests/defs.in @@ -62,6 +62,7 @@ SHELL='@SHELL@' export SHELL # User can override various tools used. test -z "$PERL" && PERL='@PERL@' +test -z "$YACC" && YACC='@YACC@' test -z "$MAKE" && MAKE=make test -z "$AUTOCONF" && AUTOCONF="@am_AUTOCONF@" test -z "$AUTOHEADER" && AUTOHEADER="@am_AUTOHEADER@" @@ -210,19 +211,14 @@ do ( texi2dvi -o /dev/null --version ) || exit 77 ;; yacc) - if test x"$YACC" = x"no"; then - # The user has explicitly told he doesn't want a yacc program - # to be used. - echo "$me: \$YACC is \"no\", skipping test" >&2 + if test x"$YACC" = x"false"; then + # No yacc program was found at configure time, or the user has + # explicitly told he doesn't want a yacc program to be used. + echo "$me: \$YACC is \"false\", skipping test" >&2 exit 77 - elif test -z "$YACC"; then - # The user hasn't explicitly specified any yacc program in the - # environment, so we try to use bison, skipping the test if it's - # not found. - YACC='bison -y' + else + # Make YACC available to configure by exporting it. export YACC - echo "$me: running bison --version" - bison --version || exit 77 fi ;; # Generic case: the tool must support --version.