forked from Mirror/frr
build: fix bison < 3.0 compatibility
bison-2.7.x really wants "foo" for api.prefix while bison-3.0.x really wants {foo} ... great. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
parent
eed831e065
commit
0d37f9f325
39
configure.ac
39
configure.ac
|
@ -1419,7 +1419,46 @@ if test "x$LEX" != xflex; then
|
||||||
AC_SUBST([LEX_OUTPUT_ROOT], [lex.yy])
|
AC_SUBST([LEX_OUTPUT_ROOT], [lex.yy])
|
||||||
AC_SUBST([LEXLIB], [''])
|
AC_SUBST([LEXLIB], [''])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_PROG_YACC
|
AC_PROG_YACC
|
||||||
|
dnl thanks GNU bison for this b*llshit...
|
||||||
|
AC_MSG_CHECKING(version of bison)
|
||||||
|
quagga_ac_bison_version="$(eval $YACC -V | grep bison | head -n 1)"
|
||||||
|
quagga_ac_bison_version="${quagga_ac_bison_version##* }"
|
||||||
|
quagga_ac_bison_missing="false"
|
||||||
|
case "x${quagga_ac_bison_version}" in
|
||||||
|
x2.7*)
|
||||||
|
BISON_OPENBRACE='"'
|
||||||
|
BISON_CLOSEBRACE='"'
|
||||||
|
AC_MSG_RESULT([$quagga_ac_bison_version - 2.7 or older])
|
||||||
|
;;
|
||||||
|
x2.*|x1.*)
|
||||||
|
AC_MSG_RESULT([$quagga_ac_bison_version])
|
||||||
|
AC_MSG_WARN([installed bison is too old. Please install GNU bison 2.7.x or newer.])
|
||||||
|
quagga_ac_bison_missing="true"
|
||||||
|
;;
|
||||||
|
x)
|
||||||
|
AC_MSG_RESULT([none])
|
||||||
|
AC_MSG_WARN([could not determine bison version. Please install GNU bison 2.7.x or newer.])
|
||||||
|
quagga_ac_bison_missing="true"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
BISON_OPENBRACE='{'
|
||||||
|
BISON_CLOSEBRACE='}'
|
||||||
|
AC_MSG_RESULT([$quagga_ac_bison_version - 3.0 or newer])
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
AC_SUBST(BISON_OPENBRACE)
|
||||||
|
AC_SUBST(BISON_CLOSEBRACE)
|
||||||
|
|
||||||
|
if $quagga_ac_bison_missing; then
|
||||||
|
YACC="$SHELL $missing_dir/missing bison -y"
|
||||||
|
if test -f "${srcdir}/lib/command_parse.c" -a -f "${srcdir}/lib/command_parse.h"; then
|
||||||
|
AC_MSG_WARN([using pregenerated bison output files])
|
||||||
|
else
|
||||||
|
AC_MSG_ERROR([bison failure and pregenerated files not included (probably a git build)])
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
dnl -------------------
|
dnl -------------------
|
||||||
dnl capabilities checks
|
dnl capabilities checks
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
|
AM_CPPFLAGS = -I.. -I$(top_srcdir) -I$(top_srcdir)/lib -I$(top_builddir)/lib
|
||||||
AM_CFLAGS = $(WERROR)
|
AM_CFLAGS = $(WERROR)
|
||||||
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
|
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
|
||||||
AM_YFLAGS = -d
|
AM_YFLAGS = -d -Dapi.prefix=@BISON_OPENBRACE@cmd_yy@BISON_CLOSEBRACE@
|
||||||
|
|
||||||
command_lex.h: command_lex.c
|
command_lex.h: command_lex.c
|
||||||
@if test ! -f $@; then rm -f command_lex.c; else :; fi
|
@if test ! -f $@; then rm -f command_lex.c; else :; fi
|
||||||
|
|
|
@ -33,7 +33,7 @@ typedef union CMD_YYSTYPE CMD_YYSTYPE;
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%define api.pure full
|
%define api.pure full
|
||||||
%define api.prefix {cmd_yy}
|
/* define api.prefix {cmd_yy} */
|
||||||
|
|
||||||
/* names for generated header and parser files */
|
/* names for generated header and parser files */
|
||||||
%defines "command_parse.h"
|
%defines "command_parse.h"
|
||||||
|
|
Loading…
Reference in a new issue