]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[gitlab9] Detection of Sysrepo-cpp implemented.
authorTomek Mrugalski <tomasz@isc.org>
Fri, 10 Aug 2018 15:35:26 +0000 (17:35 +0200)
committerTomek Mrugalski <tomasz@isc.org>
Tue, 21 Aug 2018 10:18:56 +0000 (12:18 +0200)
configure.ac
src/bin/netconf/tests/Makefile.am

index dcab81dfaba4251273ef6f9193c153096b516459..49f8dab1925df0d41fb2a0156305d4ceffc782e2 100644 (file)
@@ -878,11 +878,32 @@ if test "SYSREPO_CONFIG" != "" ; then
         AC_MSG_ERROR([--with-sysrepo should point to a sysrepo_config program])
     fi
 
+    # Let's get the configuration environment for pure Sysrepo (written in C) first
     SYSREPO_INCLUDEDIR=`$SYSREPO_CONFIG --cflags-only-I libsysrepo`
     SYSREPO_CPPFLAGS="$SYSREPO_INCLUDEDIR `$SYSREPO_CONFIG --cflags-only-other libsysrepo`"
     SYSREPO_LIBS="`$SYSREPO_CONFIG --libs libsysrepo`"
     SYSREPO_VERSION=`$SYSREPO_CONFIG --modversion libsysrepo`
 
+    # Now get the environment for C++ bindings for Sysrepo.
+    SYSREPOCPP_INCLUDEDIR=`$SYSREPO_CONFIG --cflags-only-I libSysrepo-cpp`
+    SYSREPOCPP_CPPFLAGS="$SYSREPO_INCLUDEDIR `$SYSREPO_CONFIG --cflags-only-other libSysrepo-cpp`"
+    SYSREPOCPP_LIBS="`$SYSREPO_CONFIG --libs libSysrepo-cpp`"
+    SYSREPOCPP_VERSION=`$SYSREPO_CONFIG --modversion libSysrepo-cpp`
+
+    # If include paths are equal, there's no need to include both. But if they're different,
+    # we need both.
+    if test "${SYSREPO_INCLUDEDIR}" != "${SYSREPOCPP_INCLUDEDIR}"; then
+       SYSREPO_INCLUDEDIR="${SYSREPO_INCLUDEDIR} ${SYSREPOCPP_INCLUDEDIR}"
+    fi
+
+    if test "${SYSREPO_CPPFLAGS}" != "${SYSREPOCPP_CPPFLAGS}"; then
+       SYSREPO_CPPFLAGS="${SYSREPO_CPPFLAGS} ${SYSREPOCPP_CPPFLAGS}"
+    fi
+
+    if test "${SYSREPO_LIBS}" != "${SYSREPOCPP_LIBS}"; then
+       SYSREPO_LIBS="${SYSREPO_LIBS} ${SYSREPOCPP_LIBS}"
+    fi
+
     AC_SUBST(SYSREPO_CPPFLAGS)
     AC_SUBST(SYSREPO_LIBS)
 
@@ -905,6 +926,15 @@ if test "SYSREPO_CONFIG" != "" ; then
             [AC_MSG_RESULT([checking for Sysrepo headers and library... no])
              AC_MSG_ERROR([Needs Sysrepo library])]
     )
+
+    AC_LINK_IFELSE(
+            [AC_LANG_PROGRAM([#include <sysrepo-cpp/Session.h>],
+                              [Connection("conn-name");])],
+            [AC_MSG_RESULT([checking for Sysrepo C++ bindings headers and library... yes])],
+            [AC_MSG_RESULT([checking for Sysrepo C++ bindings headers and library... no])
+             AC_MSG_ERROR([Needs Sysrepo C++ bindings (unable to find Sysrepo-ccp library. To get it, you need to compile sysrepo with -DGEN_CPP_BINDINGS=ON.])]
+    )
+
     CPPFLAGS=$CPPFLAGS_SAVED
     LIBS=$LIBS_SAVED
 
index 63ab0ca16f630edc14f22d6e2fab042f9096d28d..7285f8daa03f769a7cce796503cf61bfd00fa0b5 100644 (file)
@@ -14,7 +14,7 @@ AM_CPPFLAGS += -I$(top_srcdir)/src -I$(top_builddir)/src
 AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin
 AM_CPPFLAGS += $(BOOST_INCLUDES)
 
-CLEANFILES += *.json *.log
+CLEANFILES = *.json *.log
 
 AM_CXXFLAGS = $(KEA_CXXFLAGS)