summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-01-10 21:53:01 -0800
committerKaz Kylheku <kaz@kylheku.com>2020-01-10 21:53:01 -0800
commitfb43ab6c8ffff2fc8517d07a2d36e39f870cfd90 (patch)
tree471ef4b7141f296482d0bd40c2b7ce03d150476d /configure
parent7d5f0b7e3613f8e8be84ac0d541a7bbcb4782f1d (diff)
downloadtxr-fb43ab6c8ffff2fc8517d07a2d36e39f870cfd90.tar.gz
txr-fb43ab6c8ffff2fc8517d07a2d36e39f870cfd90.tar.bz2
txr-fb43ab6c8ffff2fc8517d07a2d36e39f870cfd90.zip
build: deal with the mess of new Bison warnings.
Newer versions of Bison produce spurious warnings in Yacc mode about %pure-parser being not POSIX conforming and also deprecated. Plus some strange fluff about "fix-its" that can be applied if option --update is specified. Let's detect at configure time whether the Yacc program being used is actually Bison 3.0 or greater, and if so, give it some flags to shut up these warnings. * Makefile (YACC_FLAGS): New variable, conditionally set based on yacc_is_newer_bison, also new variable, that being generated into config.make. (y.tab.c): Invoke $(TXR_YACC) with $(YACC_FLAGS). (conftest.yacc-version): New phony target for running Yacc with --version, out of the configure script. * configure (yacc_is_newer_bison): New variable. (gen_config_make): Generate yacc_is_newer_bison make variable. New test for whether Yacc is Bison. If so, and the version is >= 3.0, sets the yacc_is_newer_bison variable to y.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure18
1 files changed, 18 insertions, 0 deletions
diff --git a/configure b/configure
index a621a9f8..a070755d 100755
--- a/configure
+++ b/configure
@@ -106,6 +106,7 @@ yaccname_given=
yaccname='' # test tries $(YACC) first
yacc='$(cross)$(tool_prefix)$(yaccname)'
yacc_given=
+yacc_is_newer_bison=
nm='$(cross)$(tool_prefix)nm'
opt_flags='-O2 -fno-stack-protector'
lang_flags='-ansi -D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=200112 -D_GNU_SOURCE'
@@ -748,6 +749,8 @@ have_git := $have_git
add_win_res := $([ -n "$have_windows_h" -a -n "$have_windres" ] && echo "y")
+yacc_is_newer_bison := $yacc_is_newer_bison
+
TXR_CC := $cc
TXR_LEX := $lex
TXR_YACC := $yacc
@@ -1623,6 +1626,21 @@ else
esac
fi
+printf "Checking if yacc program is GNU Bison ... "
+
+gen_config_make
+
+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"
+fi
+
#
# sys/wait.h
#