summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile12
-rwxr-xr-xconfigure18
2 files changed, 29 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 44b3f8a3..66fae7b3 100644
--- a/Makefile
+++ b/Makefile
@@ -93,6 +93,12 @@ OBJS := $(DBG_OBJS) $(OPT_OBJS)
TXR := ./$(PROG)
+ifneq ($(yacc_is_newer_bison),)
+YACC_FLAGS := -Wno-yacc -Wno-deprecated
+else
+YACC_FLAGS :=
+endif
+
.SUFFIXES:
MAKEFLAGS += --no-builtin-rules
@@ -288,7 +294,7 @@ y.tab.c: $(top_srcdir)parser.y
if [ -e y.tab.h ]; then mv y.tab.h y.tab.h.old ; fi)
$(call SH,rm -f y.tab.c)
$(call SH, \
- if $(TXR_YACC) -v -d $< ; then \
+ if $(TXR_YACC) $(YACC_FLAGS) -v -d $< ; then \
grep -qs '$(BS_LIC_FROM)' y.tab.c && \
grep -qs '$(BS_LIC_TO)' y.tab.c && \
sed -e '/$(BS_LIC_FROM)/$(CM)/$(BS_LIC_TO)/d' \
@@ -552,6 +558,10 @@ conftest.syms: conftest.o
conftest.yacc:
$(V)echo $(TXR_YACC)
+.PHONY: conftest.yacc-version
+conftest.yacc-version:
+ $(V)$(TXR_YACC) --version 2> /dev/null || true
+
.PHONY: conftest.ccver
conftest.ccver:
$(V)$(TXR_CC) --version
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
#