diff --git a/configure.ac b/configure.ac index 9a12675826..9f9336a83c 100644 --- a/configure.ac +++ b/configure.ac @@ -1864,38 +1864,85 @@ PostgreSQL: END fi -if "${HAVE_SYSREPO}"; then +cat >> config.report << END + +NETCONF: + ${HAVE_NETCONF-no} +END + +if test -n "${LIBYANG_VERSION}"; then cat >> config.report << END -Sysrepo: - LIBYANG_VERSION: ${LIBYANG_VERSION} - LIBYANG_SOVERSION: ${LIBYANG_SOVERSION} - LIBYANG_INCLUDEDIR: ${LIBYANG_INCLUDEDIR} - LIBYANG_CPPFLAGS: ${LIBYANG_CPPFLAGS} - LIBYANG_LIBS ${LIBYANG_LIBS} - - LIBYANGCPP_VERSION: ${LIBYANGCPP_VERSION} - LIBYANGCPP_INCLUDEDIR: ${LIBYANGCPP_INCLUDEDIR} - LIBYANGCPP_CPPFLAGS: ${LIBYANGCPP_CPPFLAGS} - LIBYANGCPP_LIBS ${LIBYANGCPP_LIBS} - - SYSREPO_VERSION: ${SYSREPO_VERSION} - SYSREPO_CPPFLAGS: ${SYSREPO_CPPFLAGS} - SYSREPO_INCLUDEDIR: ${SYSREPO_INCLUDEDIR} - SYSREPO_LIBS: ${SYSREPO_LIBS} - SR_REPO_PATH: ${SR_REPO_PATH} - SRPD_PLUGINS_PATH: ${SRPD_PLUGINS_PATH} - - SYSREPOCPP_VERSION: ${SYSREPOCPP_VERSION} - SYSREPOCPP_CPPFLAGS: ${SYSREPOCPP_CPPFLAGS} - SYSREPOCPP_INCLUDEDIR: ${SYSREPOCPP_INCLUDEDIR} - SYSREPOCPP_LIBS: ${SYSREPOCPP_LIBS} + libyang: + LIBYANG_CPPFLAGS: ${LIBYANG_CPPFLAGS} + LIBYANG_INCLUDEDIR: ${LIBYANG_INCLUDEDIR} + LIBYANG_LIBS: ${LIBYANG_LIBS} + LIBYANG_PREFIX: ${LIBYANG_PREFIX} + LIBYANG_VERSION: ${LIBYANG_VERSION} END else cat >> config.report << END -Sysrepo: - no + libyang: + no +END +fi + +if test -n "${LIBYANGCPP_VERSION}"; then + cat >> config.report << END + + libyang-cpp: + LIBYANGCPP_CPPFLAGS: ${LIBYANGCPP_CPPFLAGS} + LIBYANGCPP_INCLUDEDIR: ${LIBYANGCPP_INCLUDEDIR} + LIBYANGCPP_LIBS: ${LIBYANGCPP_LIBS} + LIBYANGCPP_PREFIX: ${LIBYANGCPP_PREFIX} + LIBYANGCPP_VERSION: ${LIBYANGCPP_VERSION} +END +else + cat >> config.report << END + + libyang-cpp: + no +END +fi + +if test -n "${SYSREPO_VERSION}"; then + cat >> config.report << END + + sysrepo: + SYSREPO_CPPFLAGS: ${SYSREPO_CPPFLAGS} + SYSREPO_INCLUDEDIR: ${SYSREPO_INCLUDEDIR} + SYSREPO_LIBS: ${SYSREPO_LIBS} + SYSREPO_PREFIX: ${SYSREPO_PREFIX} + SYSREPO_VERSION: ${SYSREPO_VERSION} + + SR_REPO_PATH: ${SR_REPO_PATH} + SR_PLUGINS_PATH: ${SR_PLUGINS_PATH} + SRPD_PLUGINS_PATH: ${SRPD_PLUGINS_PATH} +END +else + cat >> config.report << END + + sysrepo: + no +END +fi + +if test -n "${SYSREPOCPP_VERSION}"; then + cat >> config.report << END + + sysrepo-cpp: + SYSREPOCPP_CPPFLAGS: ${SYSREPOCPP_CPPFLAGS} + SYSREPOCPP_INCLUDEDIR: ${SYSREPOCPP_INCLUDEDIR} + SYSREPOCPP_LIBS: ${SYSREPOCPP_LIBS} + SYSREPOCPP_PREFIX : ${SYSREPOCPP_PREFIX} + SYSREPOCPP_VERSION: ${SYSREPOCPP_VERSION} +END +else + cat >> config.report << END + + sysrepo-cpp: + no END fi @@ -1964,5 +2011,4 @@ cat <], + [struct lyd_node* node = NULL; + lyd_free_all(node);] + )], + [], + [AC_MSG_RESULT([no]) + AX_DISPLAY_LIBRARY_WARNINGS() + AC_MSG_ERROR([libyang program failed to compile: + +$(cat conftest.cpp) + +$(cat conftest.err)])] + ) + + # Restore flags. + CPPFLAGS="${CPPFLAGS_SAVED}" + LIBS="${LIBS_SAVED}" + + AC_SUBST(LIBYANG_CPPFLAGS) + AC_SUBST(LIBYANG_INCLUDEDIR) + AC_SUBST(LIBYANG_LIBS) + AC_SUBST(LIBYANG_PREFIX) + AC_SUBST(LIBYANG_VERSION) + + AC_DEFINE([LIBYANG_VERSION], ["${LIBYANG_VERSION}"], [libyang version]) + AC_MSG_RESULT([${LIBYANG_VERSION}]) + else + AC_MSG_RESULT([no]) + AX_DISPLAY_LIBRARY_WARNINGS() + AC_MSG_ERROR([Could not enable libyang.]) + fi + fi + + if test -n "${with_libyangcpp}"; then + AC_MSG_CHECKING([libyang-cpp]) + AX_FIND_LIBRARY([libyang-cpp], ["${with_libyangcpp}"], [libyang/Libyang.hpp], [libyang-cpp.so], [], ["${LIBYANG_PREFIX}/lib/pkgconfig:${LIBYANG_PREFIX}/lib64/pkgconfig"]) + if "${LIBRARY_FOUND}"; then + LIBYANGCPP_CPPFLAGS="${LIBRARY_CPPFLAGS}" + LIBYANGCPP_INCLUDEDIR="${LIBRARY_INCLUDEDIR}" + LIBYANGCPP_LIBS="${LIBRARY_LIBS}" + LIBYANGCPP_PREFIX="${LIBRARY_PREFIX}" + LIBYANGCPP_VERSION="${LIBRARY_VERSION}" + + # Save flags. + CPPFLAGS_SAVED="${CPPFLAGS}" + LIBS_SAVED="${LIBS}" + + # Provide libyang-cpp flags temporarily. + CPPFLAGS="${CPPFLAGS} ${LIBYANG_INCLUDEDIR} ${LIBYANGCPP_INCLUDEDIR} ${LIBYANG_CPPFLAGS} ${LIBYANGCPP_CPPFLAGS} -std=c++20" + LIBS="${LIBS} ${LIBYANG_LIBS} ${LIBYANGCPP_LIBS}" + + # Check that a simple program using libyang C++ API can compile and link. + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [#include ], + [libyang::DataNode *node = nullptr; + node->findPath("/path");] + )], + [], + [AC_MSG_RESULT([no]) + AX_DISPLAY_LIBRARY_WARNINGS() + AC_MSG_ERROR([libyang-cpp program failed to compile: + +$(cat conftest.cpp) + +$(cat conftest.err)])] + ) + + # Restore flags. + CPPFLAGS="${CPPFLAGS_SAVED}" + LIBS="${LIBS_SAVED}" + + AC_SUBST(LIBYANGCPP_CPPFLAGS) + AC_SUBST(LIBYANGCPP_INCLUDEDIR) + AC_SUBST(LIBYANGCPP_LIBS) + AC_SUBST(LIBYANGCPP_PREFIX) + AC_SUBST(LIBYANGCPP_VERSION) + + AC_MSG_RESULT([${LIBYANGCPP_VERSION}]) + else + AC_MSG_RESULT([no]) + AX_DISPLAY_LIBRARY_WARNINGS() + AC_MSG_ERROR([Could not enable libyang-cpp.]) + fi + fi + + if test -n "${with_sysrepo}"; then + AC_MSG_CHECKING([sysrepo]) + AX_FIND_LIBRARY([sysrepo], ["${with_sysrepo}"], [sysrepo.h], [libsysrepo.so], [SR_REPO_PATH,SR_PLUGINS_PATH,SRPD_PLUGINS_PATH], ["${LIBYANG_PREFIX}/lib/pkgconfig:${LIBYANG_PREFIX}/lib64/pkgconfig"]) + if "${LIBRARY_FOUND}"; then + SYSREPO_CPPFLAGS="${LIBRARY_CPPFLAGS}" + SYSREPO_INCLUDEDIR="${LIBRARY_INCLUDEDIR}" + SYSREPO_LIBS="${LIBRARY_LIBS}" + SYSREPO_PREFIX="${LIBRARY_PREFIX}" + SYSREPO_VERSION="${LIBRARY_VERSION}" + + # Save flags. + CPPFLAGS_SAVED="${CPPFLAGS}" + LIBS_SAVED="${LIBS}" + + # Provide sysrepo flags temporarily. + CPPFLAGS="${CPPFLAGS} ${LIBYANG_INCLUDEDIR} ${SYSREPO_INCLUDEDIR} ${LIBYANG_CPPFLAGS} ${SYSREPO_CPPFLAGS}" + LIBS="${LIBS} ${LIBYANG_LIBS} ${SYSREPO_LIBS}" + + # Check that a simple program using sysrepo C API can compile and link. + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [#include ], + [sr_conn_ctx_t* connection = NULL; + sr_disconnect(connection);] + )], + [], + [AC_MSG_RESULT([no]) + AX_DISPLAY_LIBRARY_WARNINGS() + AC_MSG_ERROR([sysrepo program failed to compile: + +$(cat conftest.cpp) + +$(cat conftest.err)])] + ) + + # Restore flags. + CPPFLAGS="${CPPFLAGS_SAVED}" + LIBS="${LIBS_SAVED}" + + AC_SUBST(SYSREPO_CPPFLAGS) + AC_SUBST(SYSREPO_INCLUDEDIR) + AC_SUBST(SYSREPO_LIBS) + AC_SUBST(SYSREPO_PREFIX) + AC_SUBST(SYSREPO_VERSION) + + AC_SUBST(SR_REPO_PATH) + AC_SUBST(SR_PLUGINS_PATH) + AC_SUBST(SRPD_PLUGINS_PATH) + + AC_DEFINE([SYSREPO_VERSION], ["${SYSREPO_VERSION}"], [sysrepo version]) + AC_MSG_RESULT([${SYSREPO_VERSION}]) + else + AC_MSG_RESULT([no]) + AX_DISPLAY_LIBRARY_WARNINGS() + AC_MSG_ERROR([Could not enable sysrepo.]) + fi + fi + + if test -n "${with_sysrepocpp}"; then + AC_MSG_CHECKING([sysrepo-cpp]) + AX_FIND_LIBRARY([sysrepo-cpp], ["${with_sysrepocpp}"], [sysrepo-cpp/Session.hpp], [libsysrepo-cpp.so], [], ["${LIBYANG_PREFIX}/lib/pkgconfig:${LIBYANG_PREFIX}/lib64/pkgconfig:${LIBYANGCPP_PREFIX}/lib/pkgconfig:${LIBYANGCPP_PREFIX}/lib64/pkgconfig:${SYSREPO_PREFIX}/lib/pkgconfig:${SYSREPOCPP_PREFIX}/lib64/pkgconfig"]) + if "${LIBRARY_FOUND}"; then + SYSREPOCPP_CPPFLAGS="${LIBRARY_CPPFLAGS}" + SYSREPOCPP_INCLUDEDIR="${LIBRARY_INCLUDEDIR}" + SYSREPOCPP_LIBS="${LIBRARY_LIBS}" + SYSREPOCPP_PREFIX="${LIBRARY_PREFIX}" + SYSREPOCPP_VERSION="${LIBRARY_VERSION}" + + # Save flags. + CPPFLAGS_SAVED="${CPPFLAGS}" + LIBS_SAVED="${LIBS}" + + # Provide sysrepo-cpp flags temporarily. + CPPFLAGS="${CPPFLAGS} ${LIBYANG_INCLUDEDIR} ${LIBYANG_CPPFLAGS} ${LIBYANGCPP_INCLUDEDIR} ${LIBYANGCPP_CPPFLAGS} ${SYSREPO_INCLUDEDIR} ${SYSREPO_CPPFLAGS} ${SYSREPOCPP_INCLUDEDIR} ${SYSREPOCPP_CPPFLAGS} -std=c++20" + LIBS="${LIBS} ${LIBYANG_LIBS} ${LIBYANGCPP_LIBS} ${SYSREPO_LIBS} ${SYSREPOCPP_LIBS}" + + # Check that a simple program using sysrepo C++ API can compile and link. + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [#include ], + [sysrepo::Connection connection; + connection.sessionStart();] + )], + [], + [AC_MSG_RESULT([no]) + AX_DISPLAY_LIBRARY_WARNINGS() + AC_MSG_ERROR([sysrepo-cpp program failed to compile: + +$(cat conftest.cpp) + +$(cat conftest.err)])] + ) + + # Restore flags. + CPPFLAGS="${CPPFLAGS_SAVED}" + LIBS="${LIBS_SAVED}" + + AC_SUBST(SYSREPOCPP_CPPFLAGS) + AC_SUBST(SYSREPOCPP_INCLUDEDIR) + AC_SUBST(SYSREPOCPP_LIBS) + AC_SUBST(SYSREPOCPP_PREFIX) + AC_SUBST(SYSREPOCPP_VERSION) + + AC_MSG_RESULT([${SYSREPOCPP_VERSION}]) + else + AC_MSG_RESULT([no]) + AX_DISPLAY_LIBRARY_WARNINGS() + AC_MSG_ERROR([Could not enable sysrepo-cpp.]) + fi + fi + + # Set HAVE_NETCONF. + if test -n "${LIBYANG_VERSION}" && \ + test -n "${LIBYANGCPP_VERSION}" && \ + test -n "${SYSREPO_VERSION}" && \ + test -n "${SYSREPOCPP_VERSION}"; then + HAVE_NETCONF=yes + + # C++20 support is already proven to be supported, but it may not be the + # default for the current compiler, so enforce it. + CPPFLAGS="${CPPFLAGS} -std=c++20" + else + HAVE_NETCONF=no + fi + AM_CONDITIONAL(HAVE_NETCONF, test "${HAVE_NETCONF}" = 'yes') + AM_COND_IF([HAVE_NETCONF], AC_DEFINE([HAVE_NETCONF], [true], [NETCONF capabilities enabled])) + AC_SUBST(HAVE_NETCONF) + + AC_SUBST(DISTCHECK_LIBYANG_CONFIGURE_FLAG) + AC_SUBST(DISTCHECK_LIBYANGCPP_CONFIGURE_FLAG) + AC_SUBST(DISTCHECK_SYSREPO_CONFIGURE_FLAG) + AC_SUBST(DISTCHECK_SYSREPOCPP_CONFIGURE_FLAG) +]) diff --git a/m4macros/ax_sysrepo.m4 b/m4macros/ax_sysrepo.m4 deleted file mode 100644 index bef4db2a2a..0000000000 --- a/m4macros/ax_sysrepo.m4 +++ /dev/null @@ -1,232 +0,0 @@ -AC_DEFUN([AX_SYSREPO], [ - - AC_ARG_WITH([libyang], - [AS_HELP_STRING([--with-libyang[[=PATH]]], [optional path to the libyang installation directory])], - [with_libyang="${withval}"]) - - DISTCHECK_LIBYANG_CONFIGURE_FLAG="--with-libyang=$with_libyang" - - AC_ARG_WITH([sysrepo], - [AS_HELP_STRING([--with-sysrepo[[=PATH]]], [optional path to the sysrepo installation directory])], - [with_sysrepo="${withval}"]) - - DISTCHECK_SYSREPO_CONFIGURE_FLAG="--with-sysrepo=$with_sysrepo" - - # If --with-libyang was omitted, assume it was passed and give it the value - # from --with-sysrepo. - if test -z "${with_libyang}"; then - with_libyang="${with_sysrepo}" - fi - - AC_MSG_CHECKING([libyang]) - AX_FIND_LIBRARY([libyang], ["${with_libyang}"], [libyang/libyang.h], [libyang.so], [LIBYANG_SOVERSION]) - if "${LIBRARY_FOUND}"; then - LIBYANG_CPPFLAGS="${LIBRARY_CPPFLAGS}" - LIBYANG_INCLUDEDIR="${LIBRARY_INCLUDEDIR}" - LIBYANG_LIBS="${LIBRARY_LIBS}" - LIBYANG_VERSION="${LIBRARY_VERSION}" - LIBYANG_PREFIX="${LIBRARY_PREFIX}" - - libyang_found=true - AC_MSG_RESULT([yes]) - else - libyang_found=false - AC_MSG_RESULT([no]) - AX_DISPLAY_LIBRARY_WARNINGS() - fi - - AC_MSG_CHECKING([libyang-cpp]) - AX_FIND_LIBRARY([libyang-cpp], ["${with_libyang}"], [libyang/Libyang.hpp], [libyang-cpp.so]) - if "${LIBRARY_FOUND}"; then - - LIBYANGCPP_CPPFLAGS="${LIBRARY_CPPFLAGS}" - LIBYANGCPP_INCLUDEDIR="${LIBRARY_INCLUDEDIR}" - LIBYANGCPP_LIBS="${LIBRARY_LIBS}" - LIBYANGCPP_VERSION="${LIBRARY_VERSION}" - LIBYANGCPP_PREFIX="${LIBRARY_PREFIX}" - - # If include paths are equal, there's no need to include both. But if - # they're different, we need both. - if test "${LIBYANG_INCLUDEDIR}" != "${LIBYANGCPP_INCLUDEDIR}"; then - LIBYANG_INCLUDEDIR="${LIBYANG_INCLUDEDIR} ${LIBYANGCPP_INCLUDEDIR}" - fi - - if test "${LIBYANG_CPPFLAGS}" != "${LIBYANGCPP_CPPFLAGS}"; then - LIBYANG_CPPFLAGS="${LIBYANG_CPPFLAGS} ${LIBYANGCPP_CPPFLAGS}" - fi - - if test "${LIBYANG_LIBS}" != "${LIBYANGCPP_LIBS}"; then - LIBYANG_LIBS="${LIBYANG_LIBS} ${LIBYANGCPP_LIBS}" - fi - - libyang_cpp_found=true - AC_MSG_RESULT([yes]) - else - libyang_cpp_found=false - AC_MSG_RESULT([no]) - AX_DISPLAY_LIBRARY_WARNINGS() - fi - - AC_MSG_CHECKING([sysrepo]) - AX_FIND_LIBRARY([sysrepo], ["${with_sysrepo}"], [sysrepo.h], [libsysrepo.so], [], ["${LIBYANG_PREFIX}/lib/pkgconfig"]) - if "${LIBRARY_FOUND}"; then - SYSREPO_CPPFLAGS="${LIBRARY_CPPFLAGS} ${LIBYANG_CPPFLAGS}" - SYSREPO_INCLUDEDIR="${LIBRARY_INCLUDEDIR} ${LIBYANG_INCLUDEDIR}" - SYSREPO_LIBS="${LIBRARY_LIBS} ${LIBYANG_LIBS}" - SYSREPO_VERSION="${LIBRARY_VERSION}" - SYSREPO_PREFIX="${LIBRARY_PREFIX}" - - sysrepo_found=true - else - sysrepo_found=false - fi - - if "${sysrepo_found}"; then - AC_SUBST(SYSREPO_CPPFLAGS) - AC_SUBST(SYSREPO_INCLUDEDIR) - AC_SUBST(SYSREPO_LIBS) - - # Save flags. - CPPFLAGS_SAVED="${CPPFLAGS}" - LIBS_SAVED="${LIBS}" - - # Provide Sysrepo flags temporarily. - CPPFLAGS="${CPPFLAGS} ${SYSREPO_INCLUDEDIR} ${SYSREPO_CPPFLAGS}" - LIBS="${LIBS} ${SYSREPO_LIBS}" - - # Check that a simple program using Sysrepo C API can compile and link. - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [extern "C" { - #include - }], - [sr_conn_ctx_t *connection; - sr_session_ctx_t *session; - sr_disconnect(connection);])], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - AX_DISPLAY_LIBRARY_WARNINGS() - AC_MSG_ERROR([Cannot integrate with Sysrepo's C API. Make sure that the sysrepo.h header and the libsysrepo.so library can be found.])] - ) - - # Restore flags. - CPPFLAGS="${CPPFLAGS_SAVED}" - LIBS="${LIBS_SAVED}" - else - AC_MSG_RESULT([no]) - AX_DISPLAY_LIBRARY_WARNINGS() - fi - - AC_MSG_CHECKING([sysrepo-cpp]) - AX_FIND_LIBRARY([sysrepo-cpp], ["${with_sysrepo}"], [sysrepo-cpp/Session.hpp], [libsysrepo-cpp.so], [SR_REPO_PATH,SRPD_PLUGINS_PATH], ["${LIBYANGCPP_PREFIX}/lib/pkgconfig"]) - if "${LIBRARY_FOUND}"; then - SYSREPOCPP_CPPFLAGS="${LIBRARY_CPPFLAGS}" - SYSREPOCPP_INCLUDEDIR="${LIBRARY_INCLUDEDIR}" - SYSREPOCPP_LIBS="${LIBRARY_LIBS}" - SYSREPOCPP_VERSION="${LIBRARY_VERSION}" - - sysrepo_cpp_found=true - else - sysrepo_cpp_found=false - fi - - if "${sysrepo_cpp_found}"; then - # 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_INCLUDEDIR) - AC_SUBST(SYSREPO_CPPFLAGS) - AC_SUBST(SYSREPO_LIBS) - - # Save flags. - CPPFLAGS_SAVED="${CPPFLAGS}" - LIBS_SAVED="${LIBS}" - - # Provide Sysrepo flags temporarily. - CPPFLAGS="${CPPFLAGS} ${SYSREPO_INCLUDEDIR} ${SYSREPO_CPPFLAGS}" - LIBS="${LIBS} ${SYSREPO_LIBS}" - - # Check that a simple program using Sysrepo C++ bindings can compile and link. - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [#include ], - [])], - [AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [#include ], - [sysrepo::Connection();] - )], - [AC_MSG_RESULT([v1.x]) - AX_DISPLAY_LIBRARY_WARNINGS() - AC_DEFINE([HAVE_SYSREPO_V1], [true], [Using sysrepo 1.x])], - [AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [#include ], - [sysrepo::S_Val value; - value->empty();] - )], - [AC_MSG_RESULT([>= v0.7.7]) - AX_DISPLAY_LIBRARY_WARNINGS() - AC_MSG_ERROR([Using legacy sysrepo >= 0.7.7 which is no longer supported. Upgrade to the latest version with C++ bindings: 1.4.140.])], - [AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [#include ], - [Connection("conn-name");])], - [AC_MSG_RESULT([<= v0.7.6]) - AX_DISPLAY_LIBRARY_WARNINGS() - AC_MSG_ERROR([Using sysrepo <= 0.7.6 which is no longer supported. Upgrade to the latest version with C++ bindings: 1.4.140.])], - [AC_MSG_RESULT([no]) - AX_DISPLAY_LIBRARY_WARNINGS() - AC_MSG_ERROR([Found Sysrepo C++ bindings, but could not identify their version. If you think Kea should support this version of sysrepo, please contact ISC.])] - )] - )] - )], - [AC_MSG_RESULT([no]) - AX_DISPLAY_LIBRARY_WARNINGS() - AC_MSG_ERROR([Could not integrate with Sysrepo C++ bindings. Make sure that the sysrepo-cpp/Session.hpp header and the libsysrepo-cpp.so library can be found.])] - ) - - # Restore flags. - CPPFLAGS="${CPPFLAGS_SAVED}" - LIBS="${LIBS_SAVED}" - else - AC_MSG_RESULT([no]) - AX_DISPLAY_LIBRARY_WARNINGS() - fi - - if "${libyang_found}" && "${libyang_cpp_found}" && "${sysrepo_found}" && "${sysrepo_cpp_found}"; then - HAVE_SYSREPO=true - else - HAVE_SYSREPO=false - fi - - # Report error if sysrepo was requested but not enabled. - if test -n "${with_sysrepo}" && test "${with_sysrepo}" != 'no' && ! "${HAVE_SYSREPO}"; then - AC_MSG_ERROR([Could not enable NETCONF support.]) - fi - - AM_CONDITIONAL(HAVE_SYSREPO, "${HAVE_SYSREPO}") - AC_SUBST(HAVE_SYSREPO) - AC_SUBST(LIBYANG_PREFIX) - AC_SUBST(SYSREPO_CPPFLAGS) - AC_SUBST(SYSREPO_INCLUDEDIR) - AC_SUBST(SYSREPO_LIBS) - AC_SUBST(SYSREPO_PREFIX) - AC_SUBST(SR_REPO_PATH) - AC_SUBST(SRPD_PLUGINS_PATH) - AC_SUBST(SYSREPO_VERSION) - AC_SUBST(SYSREPOCPP_VERSION) - AC_SUBST(DISTCHECK_LIBYANG_CONFIGURE_FLAG) - AC_SUBST(DISTCHECK_SYSREPO_CONFIGURE_FLAG) -]) diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index 5b78621f96..37d8104d23 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -9,7 +9,7 @@ if KEA_SHELL SUBDIRS += shell endif -if HAVE_SYSREPO +if HAVE_NETCONF SUBDIRS += netconf endif diff --git a/src/bin/keactrl/Makefile.am b/src/bin/keactrl/Makefile.am index aee58bdebb..296445e0b9 100644 --- a/src/bin/keactrl/Makefile.am +++ b/src/bin/keactrl/Makefile.am @@ -8,7 +8,7 @@ KEA_CONFIGFILES += kea-dhcp6.conf KEA_CONFIGFILES += kea-dhcp-ddns.conf KEA_CONFIGFILES += kea-ctrl-agent.conf -if HAVE_SYSREPO +if HAVE_NETCONF KEA_CONFIGFILES += kea-netconf.conf endif diff --git a/src/bin/keactrl/keactrl.in b/src/bin/keactrl/keactrl.in index 15fe4dafcc..450e997201 100644 --- a/src/bin/keactrl/keactrl.in +++ b/src/bin/keactrl/keactrl.in @@ -27,7 +27,7 @@ set -eu VERSION="@PACKAGE_VERSION@" # Set the have_netconf flag to know if netconf is available. -if test -z '@HAVE_SYSREPO_TRUE@'; then +if test '@HAVE_NETCONF@' = 'yes'; then have_netconf=true else have_netconf=false diff --git a/src/bin/keactrl/tests/keactrl_tests.sh.in b/src/bin/keactrl/tests/keactrl_tests.sh.in index f4809a14d2..b4b49cb625 100644 --- a/src/bin/keactrl/tests/keactrl_tests.sh.in +++ b/src/bin/keactrl/tests/keactrl_tests.sh.in @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (C) 2014-2021 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2014-2022 Internet Systems Consortium, Inc. ("ISC") # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this @@ -27,7 +27,7 @@ set -eu keactrl="@abs_top_builddir@/src/bin/keactrl/keactrl" # Set the have_netconf flag to know if netconf is available. -if test -z '@HAVE_SYSREPO_TRUE@'; then +if test '@HAVE_NETCONF@' = 'yes'; then have_netconf=true else have_netconf=false diff --git a/src/bin/netconf/Makefile.am b/src/bin/netconf/Makefile.am index b3b762bd11..8475234bcb 100644 --- a/src/bin/netconf/Makefile.am +++ b/src/bin/netconf/Makefile.am @@ -4,8 +4,14 @@ AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin AM_CPPFLAGS += -I$(top_srcdir)/src -I$(top_builddir)/src AM_CPPFLAGS += $(BOOST_INCLUDES) $(CRYPTO_CFLAGS) $(CRYPTO_INCLUDES) +AM_CPPFLAGS += $(LIBYANG_CPPFLAGS) +AM_CPPFLAGS += $(LIBYANG_INCLUDEDIR) +AM_CPPFLAGS += $(LIBYANGCPP_CPPFLAGS) +AM_CPPFLAGS += $(LIBYANGCPP_INCLUDEDIR) AM_CPPFLAGS += $(SYSREPO_CPPFLAGS) AM_CPPFLAGS += $(SYSREPO_INCLUDEDIR) +AM_CPPFLAGS += $(SYSREPOCPP_CPPFLAGS) +AM_CPPFLAGS += $(SYSREPOCPP_INCLUDEDIR) AM_CXXFLAGS = $(KEA_CXXFLAGS) @@ -59,7 +65,11 @@ kea_netconf_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la kea_netconf_LDADD += $(top_builddir)/src/lib/log/libkea-log.la kea_netconf_LDADD += $(top_builddir)/src/lib/util/libkea-util.la kea_netconf_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la -kea_netconf_LDADD += $(LOG4CPLUS_LIBS) $(CRYPTO_LIBS) $(BOOST_LIBS) $(SYSREPO_LIBS) +kea_netconf_LDADD += $(LOG4CPLUS_LIBS) $(CRYPTO_LIBS) $(BOOST_LIBS) +kea_netconf_LDADD += $(LIBYANG_LIBS) +kea_netconf_LDADD += $(LIBYANGCPP_LIBS) +kea_netconf_LDADD += $(SYSREPO_LIBS) +kea_netconf_LDADD += $(SYSREPOCPP_LIBS) kea_netconfdir = $(pkgdatadir) diff --git a/src/bin/netconf/tests/Makefile.am b/src/bin/netconf/tests/Makefile.am index e736f848a4..65d5657a98 100644 --- a/src/bin/netconf/tests/Makefile.am +++ b/src/bin/netconf/tests/Makefile.am @@ -10,8 +10,14 @@ AM_CPPFLAGS += -DCFG_EXAMPLES=\"$(abs_top_srcdir)/doc/examples/netconf\" AM_CPPFLAGS += -DTEST_DATA_BUILDDIR=\"$(abs_top_builddir)/src/bin/netconf/tests\" AM_CPPFLAGS += -DSYNTAX_FILE=\"$(abs_srcdir)/../netconf_parser.yy\" AM_CPPFLAGS += $(BOOST_INCLUDES) $(CRYPTO_CFLAGS) $(CRYPTO_INCLUDES) +AM_CPPFLAGS += $(LIBYANG_CPPFLAGS) +AM_CPPFLAGS += $(LIBYANG_INCLUDEDIR) +AM_CPPFLAGS += $(LIBYANGCPP_CPPFLAGS) +AM_CPPFLAGS += $(LIBYANGCPP_INCLUDEDIR) AM_CPPFLAGS += $(SYSREPO_CPPFLAGS) AM_CPPFLAGS += $(SYSREPO_INCLUDEDIR) +AM_CPPFLAGS += $(SYSREPOCPP_CPPFLAGS) +AM_CPPFLAGS += $(SYSREPOCPP_INCLUDEDIR) CLEANFILES = *.json *.log @@ -71,7 +77,11 @@ netconf_unittests_LDADD += $(top_builddir)/src/lib/util/unittests/libutil_unitte netconf_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la netconf_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la netconf_unittests_LDADD += $(LOG4CPLUS_LIBS) $(CRYPTO_LIBS) -netconf_unittests_LDADD += $(BOOST_LIBS) $(GTEST_LDADD) $(SYSREPO_LIBS) +netconf_unittests_LDADD += $(BOOST_LIBS) $(GTEST_LDADD) +netconf_unittests_LDADD += $(LIBYANG_LIBS) +netconf_unittests_LDADD += $(LIBYANGCPP_LIBS) +netconf_unittests_LDADD += $(SYSREPO_LIBS) +netconf_unittests_LDADD += $(SYSREPOCPP_LIBS) # The basic callout library - contains standard callouts libbasic_la_SOURCES = basic_library.cc diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index f776adcffe..26944d166d 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -11,7 +11,7 @@ endif SUBDIRS += config_backend hooks dhcp http config stats -if HAVE_SYSREPO +if HAVE_NETCONF SUBDIRS += yang endif diff --git a/src/lib/yang/Makefile.am b/src/lib/yang/Makefile.am index f7c82f87c5..f0230100f2 100644 --- a/src/lib/yang/Makefile.am +++ b/src/lib/yang/Makefile.am @@ -2,8 +2,14 @@ SUBDIRS = . testutils pretests tests AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib AM_CPPFLAGS += $(BOOST_INCLUDES) +AM_CPPFLAGS += $(LIBYANG_CPPFLAGS) +AM_CPPFLAGS += $(LIBYANG_INCLUDEDIR) +AM_CPPFLAGS += $(LIBYANGCPP_CPPFLAGS) +AM_CPPFLAGS += $(LIBYANGCPP_INCLUDEDIR) AM_CPPFLAGS += $(SYSREPO_CPPFLAGS) AM_CPPFLAGS += $(SYSREPO_INCLUDEDIR) +AM_CPPFLAGS += $(SYSREPOCPP_CPPFLAGS) +AM_CPPFLAGS += $(SYSREPOCPP_INCLUDEDIR) AM_CXXFLAGS = $(KEA_CXXFLAGS) lib_LTLIBRARIES = libkea-yang.la @@ -38,7 +44,11 @@ libkea_yang_la_LIBADD += $(top_builddir)/src/lib/cc/libkea-cc.la libkea_yang_la_LIBADD += $(top_builddir)/src/lib/log/libkea-log.la libkea_yang_la_LIBADD += $(top_builddir)/src/lib/util/libkea-util.la libkea_yang_la_LIBADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la -libkea_yang_la_LIBADD += $(LOG4CPLUS_LIBS) $(BOOST_LIBS) $(SYSREPO_LIBS) +libkea_yang_la_LIBADD += $(LOG4CPLUS_LIBS) $(BOOST_LIBS) +libkea_yang_la_LIBADD += $(LIBYANG_LIBS) +libkea_yang_la_LIBADD += $(LIBYANGCPP_LIBS) +libkea_yang_la_LIBADD += $(SYSREPO_LIBS) +libkea_yang_la_LIBADD += $(SYSREPOCPP_LIBS) libkea_yang_la_LDFLAGS = -no-undefined -version-info 39:0:0 diff --git a/src/lib/yang/pretests/Makefile.am b/src/lib/yang/pretests/Makefile.am index e27e5030ad..1fb72e8138 100644 --- a/src/lib/yang/pretests/Makefile.am +++ b/src/lib/yang/pretests/Makefile.am @@ -5,10 +5,20 @@ TESTS = sysrepo_setup_tests sysrepo_setup_tests_SOURCES = sysrepo_setup_tests.cc sysrepo_setup_tests_CPPFLAGS = -I$(top_builddir)/src/lib sysrepo_setup_tests_CPPFLAGS += -I$(top_srcdir)/src/lib +sysrepo_setup_tests_CPPFLAGS += $(LIBYANG_CPPFLAGS) +sysrepo_setup_tests_CPPFLAGS += $(LIBYANG_INCLUDEDIR) +sysrepo_setup_tests_CPPFLAGS += $(LIBYANGCPP_CPPFLAGS) +sysrepo_setup_tests_CPPFLAGS += $(LIBYANGCPP_INCLUDEDIR) sysrepo_setup_tests_CPPFLAGS += $(SYSREPO_CPPFLAGS) sysrepo_setup_tests_CPPFLAGS += $(SYSREPO_INCLUDEDIR) +sysrepo_setup_tests_CPPFLAGS += $(SYSREPOCPP_CPPFLAGS) +sysrepo_setup_tests_CPPFLAGS += $(SYSREPOCPP_INCLUDEDIR) sysrepo_setup_tests_CPPFLAGS += -DSYSREPO_REPO=\"@SR_REPO_PATH@\" sysrepo_setup_tests_LDFLAGS = $(AM_LDFLAGS) -sysrepo_setup_tests_LDADD = $(SYSREPO_LIBS) +sysrepo_setup_tests_LDADD = +sysrepo_setup_tests_LDADD += $(LIBYANG_LIBS) +sysrepo_setup_tests_LDADD += $(LIBYANGCPP_LIBS) +sysrepo_setup_tests_LDADD += $(SYSREPO_LIBS) +sysrepo_setup_tests_LDADD += $(SYSREPOCPP_LIBS) noinst_PROGRAMS = $(TESTS) diff --git a/src/lib/yang/tests/Makefile.am b/src/lib/yang/tests/Makefile.am index 09c42d7ef5..517a07d656 100644 --- a/src/lib/yang/tests/Makefile.am +++ b/src/lib/yang/tests/Makefile.am @@ -1,7 +1,13 @@ AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib AM_CPPFLAGS += $(BOOST_INCLUDES) +AM_CPPFLAGS += $(LIBYANG_CPPFLAGS) +AM_CPPFLAGS += $(LIBYANG_INCLUDEDIR) +AM_CPPFLAGS += $(LIBYANGCPP_CPPFLAGS) +AM_CPPFLAGS += $(LIBYANGCPP_INCLUDEDIR) AM_CPPFLAGS += $(SYSREPO_CPPFLAGS) AM_CPPFLAGS += $(SYSREPO_INCLUDEDIR) +AM_CPPFLAGS += $(SYSREPOCPP_CPPFLAGS) +AM_CPPFLAGS += $(SYSREPOCPP_INCLUDEDIR) AM_CPPFLAGS += -DCFG_EXAMPLES=\"$(abs_top_srcdir)/doc/examples\" AM_CXXFLAGS = $(KEA_CXXFLAGS) @@ -51,8 +57,11 @@ run_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la run_unittests_LDADD += $(top_builddir)/src/lib/util/unittests/libutil_unittests.la run_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la run_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la -run_unittests_LDADD += $(LOG4CPLUS_LIBS) $(BOOST_LIBS) -run_unittests_LDADD += $(SYSREPO_LIBS) $(GTEST_LDADD) +run_unittests_LDADD += $(LOG4CPLUS_LIBS) $(BOOST_LIBS) $(GTEST_LDADD) +run_unittests_LDADD += $(LIBYANG_LIBS) +run_unittests_LDADD += $(LIBYANGCPP_LIBS) +run_unittests_LDADD += $(SYSREPO_LIBS) +run_unittests_LDADD += $(SYSREPOCPP_LIBS) endif diff --git a/src/lib/yang/testutils/Makefile.am b/src/lib/yang/testutils/Makefile.am index 21035d0454..8811301377 100644 --- a/src/lib/yang/testutils/Makefile.am +++ b/src/lib/yang/testutils/Makefile.am @@ -2,8 +2,14 @@ SUBDIRS = . AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib AM_CPPFLAGS += $(BOOST_INCLUDES) +AM_CPPFLAGS += $(LIBYANG_CPPFLAGS) +AM_CPPFLAGS += $(LIBYANG_INCLUDEDIR) +AM_CPPFLAGS += $(LIBYANGCPP_CPPFLAGS) +AM_CPPFLAGS += $(LIBYANGCPP_INCLUDEDIR) AM_CPPFLAGS += $(SYSREPO_CPPFLAGS) AM_CPPFLAGS += $(SYSREPO_INCLUDEDIR) +AM_CPPFLAGS += $(SYSREPOCPP_CPPFLAGS) +AM_CPPFLAGS += $(SYSREPOCPP_INCLUDEDIR) AM_CXXFLAGS = $(KEA_CXXFLAGS) CLEANFILES = *.gcno *.gcda diff --git a/src/share/yang/modules/Makefile.am b/src/share/yang/modules/Makefile.am index 9a2f88dd6a..643458482f 100644 --- a/src/share/yang/modules/Makefile.am +++ b/src/share/yang/modules/Makefile.am @@ -21,6 +21,6 @@ yangmodules_list += keatest-module@2018-11-20.yang EXTRA_DIST = hashes ${yangmodules_list} -if HAVE_SYSREPO +if HAVE_NETCONF yangmodules_DATA = ${yangmodules_list} endif diff --git a/src/share/yang/modules/utils/Makefile.am b/src/share/yang/modules/utils/Makefile.am index 277f93d688..bf79fbb711 100644 --- a/src/share/yang/modules/utils/Makefile.am +++ b/src/share/yang/modules/utils/Makefile.am @@ -8,7 +8,7 @@ yang_list += check-revisions.sh EXTRA_DIST = ${yang_list} -if HAVE_SYSREPO +if HAVE_NETCONF yang_SCRIPTS = reinstall.sh