]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
M4: generate synchronization lines
authorJan Maria Matejka <mq@ucw.cz>
Tue, 17 Jul 2018 13:30:59 +0000 (15:30 +0200)
committerJan Maria Matejka <mq@ucw.cz>
Tue, 14 Aug 2018 12:01:39 +0000 (14:01 +0200)
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.

Makefile.in
aclocal.m4
conf/Makefile
configure.ac

index 8f6c0c8bf797f5925f7eccaecf05f9782ff84d2a..5665f1d39245c5efad5d54c0838dbd83017f0bd7 100644 (file)
@@ -9,6 +9,7 @@ MAKEFLAGS += -r
 CPPFLAGS=-I$(objdir) -I$(srcdir) @CPPFLAGS@
 CFLAGS=$(CPPFLAGS) @CFLAGS@
 LDFLAGS=@LDFLAGS@
+M4FLAGS=@M4FLAGS@
 LIBS=@LIBS@
 DAEMON_LIBS=@DAEMON_LIBS@
 CLIENT_LIBS=@CLIENT_LIBS@
index dcf1bd8bef07c75ccfb935717a7775ed803405c2..28a632c8ef39b9aab41ae7d42c7d32917adf7746 100644 (file)
@@ -175,3 +175,22 @@ AC_DEFUN([BIRD_CHECK_PROG_FLAVOR_GNU],
   )
   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
+])
index fb3dd0525ebb76144b957cc540234530374afc02..47024d26a72d34596f8c7056457aed830ae6e871 100644 (file)
@@ -11,7 +11,7 @@ BISON_DEBUG=-t
 endif
 
 $(conf-y-targets): $(s)confbase.Y $(s)flowspec.Y
-       $(M4) -P $| $^ >$@
+       $(M4) $(M4FLAGS) -P $| $^ >$@
 
 $(o)cf-parse.y: | $(s)gen_parser.m4
 $(o)keywords.h: | $(s)gen_keywords.m4
index 441842730eb055a8463a21132af5c733bb716419..9a2e55e20efe430c9fea7898dfa7f12bcffbc1d3 100644 (file)
@@ -157,6 +157,15 @@ test -z "$FLEX"     && AC_MSG_ERROR([Flex is missing.])
 test -z "$BISON" && AC_MSG_ERROR([Bison 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],
   [],
   [AC_MSG_ERROR([Provided M4 is not GNU M4.])]