diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2020-09-24 23:10:51 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-09-24 23:10:51 -0700 |
commit | 1d12e4169ffa4148ddaabc91e515850d341267ae (patch) | |
tree | 96e3a339739bd8dbc1e877b8cef3cf2e430ca558 /configure | |
parent | b2c4389575185b5526370d3fb682c6ac06367b87 (diff) | |
download | txr-1d12e4169ffa4148ddaabc91e515850d341267ae.tar.gz txr-1d12e4169ffa4148ddaabc91e515850d341267ae.tar.bz2 txr-1d12e4169ffa4148ddaabc91e515850d341267ae.zip |
configure: detect yacc only in maintainer mode.
* Makefile (YACC_FLAGS): Removed. We don't need these because we
won't be trying to get newer Bison to behave like older Bison.
(y.tab.c): Drop reference to $(YACC_FLAGS).
* configure: Entire yacc-detecting section is conditional on
the maintainer Boolean variable. If the yacc program is
detected as Bison, check for version 2.5 and fail if not
found.
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 85 |
1 files changed, 45 insertions, 40 deletions
@@ -1698,54 +1698,59 @@ rm -f lex.yy.c printf '"%s"\n' "$lexname" -printf "Checking for yacc program ... " +if [ $maintainer ] ; then + printf "Checking for yacc program ... " + + if [ -z "$yacc_given" -a -z "$yaccname_given" ] ; then + for yaccname in '$(YACC)' "yacc" "byacc" "bison -y" "" ; do + yaccpath=$($make yaccname="$yaccname" conftest.yacc) + if command -v $yaccpath > /dev/null ; then + break; + fi + done -if [ -z "$yacc_given" -a -z "$yaccname_given" ] ; then - for yaccname in '$(YACC)' "yacc" "byacc" "bison -y" "" ; do - yaccpath=$($make yaccname="$yaccname" conftest.yacc) - if command -v $yaccpath > /dev/null ; then - break; + if [ -z "$yaccname" ] ; then + printf "not found\n" + exit 1 fi - done - - if [ -z "$yaccname" ] ; then - printf "not found\n" - exit 1 - fi - printf '"%s" (path "%s")\n' "$yaccname" "$yaccpath" -else - yaccpath=$($make conftest.yacc) - case $yaccpath in - *bison ) - printf "error\n\n" - printf "GNU Bison needs -y to behave like yacc\n\n" - printf "This needs to be specified in the --yaccname or --yacc option\n\n" - exit 1 - ;; - * ) - if ! command -v $yaccpath > /dev/null ; then - printf "not found\n\n" + printf '"%s" (path "%s")\n' "$yaccname" "$yaccpath" + else + yaccpath=$($make conftest.yacc) + case $yaccpath in + *bison ) + printf "error\n\n" + printf "GNU Bison needs -y to behave like yacc\n\n" + printf "This needs to be specified in the --yaccname or --yacc option\n\n" exit 1 - fi - printf "given\n" - ;; - esac -fi + ;; + * ) + if ! command -v $yaccpath > /dev/null ; then + printf "not found\n\n" + exit 1 + fi + printf "given\n" + ;; + esac + fi -printf "Checking if yacc program is GNU Bison ... " + printf "Checking if yacc program is GNU Bison ... " -gen_config_make + gen_config_make -bison_version="$($make conftest.yacc-version | grep -E '[Bb]ison')" || true + bison_version="$($make conftest.yacc-version | grep -E '[Bb]ison')" || true -if [ -n "$bison_version" ] ; then - set -- $bison_version - printf "yes (%s)\n" "$4" - save_ifs=$IFS ; IFS=. ; set -- $4 ; IFS=$save_ifs - [ $1 -ge 3 ] && yacc_is_newer_bison=y -else - printf "no\n" + if [ -n "$bison_version" ] ; then + set -- $bison_version + printf "yes (%s)\n" "$4" + save_ifs=$IFS ; IFS=. ; set -- $4 ; IFS=$save_ifs + if [ "$1.$2" != "2.5" ] ; then + echo "GNU Bison 2.5 is required" + exit 1 + fi + else + printf "no\n" + fi fi # |