0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-23 02:01:55 +00:00

M4: generate synchronization lines

This also includes Bison version check. Versions before 3.0 don't
support them in a reliable way and we don't promise to work with
versions older than 2.4.
This commit is contained in:
Jan Maria Matejka 2018-07-17 15:30:59 +02:00
parent afa14f1868
commit 73587c1260
4 changed files with 32 additions and 5 deletions

19
aclocal.m4 vendored
View File

@ -141,3 +141,22 @@ AC_DEFUN([BIRD_CHECK_PROG_FLAVOR_GNU],
) )
esac esac
]) ])
AC_DEFUN([BIRD_CHECK_BISON_VERSION],
[
$1=`bison --version | ( read line; echo ${line##* } )`
case "$$1" in
1.* | 2.0* | 2.1* | 2.2* | 2.3*)
AC_MSG_ERROR([Provided Bison version $$1 is too old, need at least 2.4])
;;
2.*)
bird_bison_synclines=no
;;
3.* | 4.* | 5.* | 6.* | 7.* | 8.* | 9.*)
bird_bison_synclines=yes
;;
*)
AC_MSG_ERROR([Couldn't parse Bison version $$1. Call the developers for help.])
;;
esac
])

View File

@ -11,19 +11,17 @@ BISON_DEBUG=-t
#FLEX_DEBUG=-d #FLEX_DEBUG=-d
endif endif
cf-parse.tab.h: cf-parse.tab.c
cf-parse.tab.c: cf-parse.y cf-parse.tab.c: cf-parse.y
$(BISON) -bcf-parse -dv -pcf_ $(BISON_DEBUG) cf-parse.y $(BISON) -bcf-parse -dv -pcf_ $(BISON_DEBUG) cf-parse.y
cf-parse.y: $(conf-fragments) $(conf-src)/gen_parser.m4 cf-parse.y: $(conf-fragments) $(conf-src)/gen_parser.m4
$(M4) -P $(conf-src)/gen_parser.m4 $(conf-fragments) >cf-parse.y $(M4) $(M4FLAGS) -P $(conf-src)/gen_parser.m4 $(conf-fragments) >cf-parse.y
keywords.h: $(conf-fragments) $(conf-src)/gen_keywords.m4 keywords.h: $(conf-fragments) $(conf-src)/gen_keywords.m4
$(M4) -P $(conf-src)/gen_keywords.m4 $(conf-fragments) >keywords.h $(M4) $(M4FLAGS) -P $(conf-src)/gen_keywords.m4 $(conf-fragments) >keywords.h
commands.h: $(conf-fragments) $(conf-src)/gen_commands.m4 $(srcdir)/client/cmds.m4 commands.h: $(conf-fragments) $(conf-src)/gen_commands.m4 $(srcdir)/client/cmds.m4
$(M4) -P $(conf-src)/gen_commands.m4 $(srcdir)/client/cmds.m4 $(conf-fragments) | sort >commands.h $(M4) $(M4FLAGS) -P $(conf-src)/gen_commands.m4 $(srcdir)/client/cmds.m4 $(conf-fragments) | sort >commands.h
cf-lex.c: cf-lex.l cf-lex.c: cf-lex.l
$(FLEX) $(FLEX_DEBUG) -s -B -8 -ocf-lex.c -Pcf_ cf-lex.l $(FLEX) $(FLEX_DEBUG) -s -B -8 -ocf-lex.c -Pcf_ cf-lex.l

View File

@ -178,6 +178,15 @@ test -z "$FLEX" && AC_MSG_ERROR([Flex is missing.])
test -z "$BISON" && AC_MSG_ERROR([Bison is missing.]) test -z "$BISON" && AC_MSG_ERROR([Bison is missing.])
test -z "$M4" && AC_MSG_ERROR([M4 is missing.]) test -z "$M4" && AC_MSG_ERROR([M4 is missing.])
AC_MSG_CHECKING([bison version])
BIRD_CHECK_BISON_VERSION(BISON_VERSION)
AC_MSG_RESULT([$BISON_VERSION])
if test "$bird_bison_synclines" = yes; then
M4FLAGS="$M4FLAGS -s"
fi
AC_SUBST([M4FLAGS])
BIRD_CHECK_PROG_FLAVOR_GNU([$M4], BIRD_CHECK_PROG_FLAVOR_GNU([$M4],
[], [],
[AC_MSG_ERROR([Provided M4 is not GNU M4.])] [AC_MSG_ERROR([Provided M4 is not GNU M4.])]

View File

@ -22,6 +22,7 @@ clean-dirs:=$(all-dirs) proto sysdep
CPPFLAGS=-I$(root-rel) -I$(srcdir) @CPPFLAGS@ CPPFLAGS=-I$(root-rel) -I$(srcdir) @CPPFLAGS@
CFLAGS=$(CPPFLAGS) @CFLAGS@ CFLAGS=$(CPPFLAGS) @CFLAGS@
LDFLAGS=@LDFLAGS@ LDFLAGS=@LDFLAGS@
M4FLAGS=@M4FLAGS@
LIBS=@LIBS@ LIBS=@LIBS@
CLIENT_LIBS=@CLIENT_LIBS@ CLIENT_LIBS=@CLIENT_LIBS@
CC=@CC@ CC=@CC@