[ovs-dev] [PATCH ovn 2/3] configure: Improve how to find ddlog binaries and libraries.

Ben Pfaff blp at ovn.org
Fri May 21 21:25:28 UTC 2021


There was no easy way to use a ddlog installation from one of the
tarballs provided by the ddlog developers, because these put the
binaries in a subdirectory of an installation directory instead of in
a system- or user-level bin directory.  This commit makes that easier:
just do "--with-ddlog=$INSTALLDIR".

Signed-off-by: Ben Pfaff <blp at ovn.org>
---
 Documentation/intro/install/general.rst | 37 +++++++++++++++++++-----
 acinclude.m4                            | 38 +++++++++++++++++--------
 2 files changed, 56 insertions(+), 19 deletions(-)

diff --git a/Documentation/intro/install/general.rst b/Documentation/intro/install/general.rst
index ee48272422fe..589518846233 100644
--- a/Documentation/intro/install/general.rst
+++ b/Documentation/intro/install/general.rst
@@ -213,13 +213,36 @@ the default database directory, add options as shown here::
   ``yum install`` or ``rpm -ivh``) and .deb (e.g. via
   ``apt-get install`` or ``dpkg -i``) use the above configure options.
 
-To build with DDlog support, add ``--with-ddlog=<path to ddlog>/lib``
-to the ``configure`` command line.  Building with DDLog adds a few
-minutes to the build because the Rust compiler is slow.  To speed this
-up by about 2x, also add ``--enable-ddlog-fast-build``.  This disables
-some Rust compiler optimizations, making a much slower
-``ovn-northd-ddlog`` executable, so it should not be used for
-production builds or for profiling.
+Use ``--with-ddlog`` to build with DDlog support.  To build with
+DDlog, the build system needs to be able to find the ``ddlog`` and
+``ovsdb2ddlog`` binaries and the DDlog library directory (the
+directory that contains ``ddlog_std.dl``).  This option supports a
+few ways to do that:
+
+  * If binaries are in $PATH, use the library directory as argument,
+    e.g. ``--with-ddlog=$HOME/differential-datalog/lib``.  This is
+    suitable if DDlog was installed from source via ``stack install`` or
+    from (hypothetical) distribution packaging.
+
+    The DDlog documentation recommends pointing $DDLOG_HOME to the
+    DDlog source directory.  If you did this, so that $DDLOG_HOME/lib
+    is the library directory, you may use ``--with-ddlog`` without an
+    argument.
+
+  * If the binaries and libraries are in the ``bin`` and ``lib``
+    subdirectories of an installation directory, use the installation
+    directory as the argument.  This is suitable if DDlog was
+    installed from one of the binary tarballs published by the DDlog
+    developers.
+
+.. note::
+
+   Building with DDLog adds a few minutes to the build because the
+   Rust compiler is slow.  Add ``--enable-ddlog-fast-build`` to make
+   this about 2x faster.  This disables some Rust compiler
+   optimizations, making a much slower ``ovn-northd-ddlog``
+   executable, so it should not be used for production builds or for
+   profiling.
 
 By default, static libraries are built and linked against. If you want to use
 shared libraries instead::
diff --git a/acinclude.m4 b/acinclude.m4
index d3fb15a1fa46..887c6cc73158 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -51,22 +51,36 @@ dnl ddlog (which is probably only useful for developers who are trying
 dnl different versions, since OVN is currently bound to a particular
 dnl DDlog version).
 AC_DEFUN([OVS_CHECK_DDLOG], [
-  AC_ARG_WITH([ddlog],
-              [AC_HELP_STRING([--with-ddlog=.../differential-datalog/lib],
-                              [Enables DDlog by pointing to its library dir])],
-              [DDLOGLIBDIR=$withval], [DDLOGLIBDIR=no])
+  AC_ARG_VAR([DDLOG_HOME], [Root of the DDlog installation])
+  AC_ARG_WITH(
+    [ddlog],
+    [AC_HELP_STRING([--with-ddlog[[=INSTALLDIR|LIBDIR]]], [Enables DDlog])],
+    [DDLOG_PATH=$PATH
+     if test "$withval" = yes; then
+       # --with-ddlog: $DDLOG_HOME must be set
+       if test -z "$DDLOG_HOME"; then
+         AC_MSG_ERROR([To build with DDlog, specify the DDlog install or library directory on --with-ddlog or in \$DDLOG_HOME])
+       fi
+       DDLOGLIBDIR=$DDLOG_HOME/lib
+       test -d "$DDLOG_HOME/bin" && DDLOG_PATH=$DDLOG_HOME/bin
+     elif test -f "$withval/lib/ddlog_std.dl"; then
+       # --with-ddlog=INSTALLDIR
+       DDLOGLIBDIR=$withval/lib
+       test -d "$withval/bin" && DDLOG_PATH=$withval/bin
+     elif test -f "$withval/ddlog_std.dl"; then
+       # --with-ddlog=LIBDIR
+       DDLOGLIBDIR=$withval/lib
+     else
+       AC_MSG_ERROR([$withval does not contain ddlog_std.dl or lib/ddlog_std.dl])
+     fi],
+    [DDLOGLIBDIR=no
+     DDLOG_PATH=no])
 
   AC_MSG_CHECKING([for DDlog library directory])
   AC_MSG_RESULT([$DDLOGLIBDIR])
   if test "$DDLOGLIBDIR" != no; then
-    if test ! -d "$DDLOGLIBDIR"; then
-      AC_MSG_ERROR([ddlog library dir "$DDLOGLIBDIR" doesn't exist])
-    elif test ! -f "$DDLOGLIBDIR"/ddlog_std.dl; then
-      AC_MSG_ERROR([ddlog library dir "$DDLOGLIBDIR" lacks ddlog_std.dl])
-    fi
-
-    AC_ARG_VAR([DDLOG])
-    AC_CHECK_PROGS([DDLOG], [ddlog], [none])
+    AC_ARG_VAR([DDLOG], [path to ddlog binary])
+    AC_PATH_PROGS([DDLOG], [ddlog], [none], [$DDLOG_PATH])
     if test X"$DDLOG" = X"none"; then
         AC_MSG_ERROR([ddlog is required to build with DDlog])
     fi
-- 
2.31.1



More information about the dev mailing list