diff mbox series

[ovs-dev,v3,3/3] configure: Also find and verify version of ovsdb2ddlog.

Message ID 20210524173319.962817-4-blp@ovn.org
State Accepted
Headers show
Series Check ddlog version and improve configure process | expand

Commit Message

Ben Pfaff May 24, 2021, 5:33 p.m. UTC
This tool is also needed and also varies from one version of DDlog to
another, so we should find it and check its version in the same way.

Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 acinclude.m4       | 24 ++++++++++++++++--------
 northd/automake.mk |  4 ++--
 2 files changed, 18 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/acinclude.m4 b/acinclude.m4
index 2fbcab8463c3..e7f829520029 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -85,14 +85,22 @@  AC_DEFUN([OVS_CHECK_DDLOG], [
         AC_MSG_ERROR([ddlog is required to build with DDlog])
     fi
 
-    AC_MSG_CHECKING([$DDLOG version])
-    $DDLOG --version >&AS_MESSAGE_LOG_FD 2>&1
-    ddlog_version=$($DDLOG --version | sed -n 's/^DDlog v\([[0-9]][[^ ]]*\).*/\1/p')
-    AC_MSG_RESULT([$ddlog_version])
-    m4_if([$1], [], [], [
-        AS_CASE([$ddlog_version],
-            [$1 | $1.*], [],
-            [*], [AC_MSG_ERROR([DDlog version $1.x is required, but $ddlog_version is installed])])])
+    AC_ARG_VAR([OVSDB2DDLOG], [path to ovsdb2ddlog binary])
+    AC_PATH_PROGS([OVSDB2DDLOG], [ovsdb2ddlog], [none], [$DDLOG_PATH])
+    if test X"$OVSDB2DDLOG" = X"none"; then
+        AC_MSG_ERROR([ovsdb2ddlog is required to build with DDlog])
+    fi
+
+    for tool in "$DDLOG" "$OVSDB2DDLOG"; do
+      AC_MSG_CHECKING([$tool version])
+      $tool --version >&AS_MESSAGE_LOG_FD 2>&1
+      tool_version=$($tool --version | sed -n 's/^.* v\([[0-9]][[^ ]]*\).*/\1/p')
+      AC_MSG_RESULT([$tool_version])
+      m4_if([$1], [], [], [
+          AS_CASE([$tool_version],
+              [$1 | $1.*], [],
+              [*], [AC_MSG_ERROR([DDlog version $1.x is required, but $tool is version $tool_version])])])
+    done
 
     AC_ARG_VAR([CARGO])
     AC_CHECK_PROGS([CARGO], [cargo], [none])
diff --git a/northd/automake.mk b/northd/automake.mk
index aaea7e1b1336..4fc81c17bfa3 100644
--- a/northd/automake.mk
+++ b/northd/automake.mk
@@ -50,13 +50,13 @@  northd_ovn_northd_ddlog_LDADD = \
 
 nb_opts = $$(cat $(srcdir)/northd/ovn-nb.dlopts)
 northd/OVN_Northbound.dl: ovn-nb.ovsschema northd/ovn-nb.dlopts
-	$(AM_V_GEN)ovsdb2ddlog -f $< --output-file $@ $(nb_opts)
+	$(AM_V_GEN)$(OVSDB2DDLOG) -f $< --output-file $@ $(nb_opts)
 northd/ovn-northd-ddlog-nb.inc: ovn-nb.ovsschema northd/ovn-nb.dlopts northd/ovsdb2ddlog2c
 	$(AM_V_GEN)$(run_python) $(srcdir)/northd/ovsdb2ddlog2c -p nb_ -f $< --output-file $@ $(nb_opts)
 
 sb_opts = $$(cat $(srcdir)/northd/ovn-sb.dlopts)
 northd/OVN_Southbound.dl: ovn-sb.ovsschema northd/ovn-sb.dlopts
-	$(AM_V_GEN)ovsdb2ddlog -f $< --output-file $@ $(sb_opts)
+	$(AM_V_GEN)$(OVSDB2DDLOG) -f $< --output-file $@ $(sb_opts)
 northd/ovn-northd-ddlog-sb.inc: ovn-sb.ovsschema northd/ovn-sb.dlopts northd/ovsdb2ddlog2c
 	$(AM_V_GEN)$(run_python) $(srcdir)/northd/ovsdb2ddlog2c -p sb_ -f $< --output-file $@ $(sb_opts)