"Fossies" - the Fresh Open Source Software Archive

Member "kea-1.6.2/configure.ac" (21 Feb 2020, 77099 Bytes) of package /linux/misc/kea-1.6.2.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "configure.ac": 1.6.1_vs_1.6.2.

    1 #                                               -*- Autoconf -*-
    2 # Process this file with autoconf to produce a configure script.
    3 
    4 AC_PREREQ([2.69])
    5 
    6 # For released versions, this is in x.y.z format.
    7 # For GIT versions, this is x.y.z-git, where x.y.z denotes the software
    8 # version that was used as a base + changes that were made later, but
    9 # are not released yet.
   10 AC_INIT(kea,1.6.2, kea-dev@lists.isc.org)
   11 AC_CONFIG_SRCDIR(README)
   12 
   13 # serial-tests is not available in automake version before 1.13, so
   14 # we'll check that and conditionally use serial-tests. This check is
   15 # adopted from code by Richard W.M. Jones:
   16 # https://www.redhat.com/archives/libguestfs/2013-February/msg00102.html
   17 m4_define([serial_tests], [
   18     m4_esyscmd([automake --version |
   19                 head -1 |
   20                 awk '{split ($NF,a,"."); if (a[1] == 1 && a[2] >= 12) { print "serial-tests" }}'
   21     ])
   22 ])
   23 AM_INIT_AUTOMAKE(foreign serial_tests)
   24 
   25 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])dnl be backward compatible
   26 AC_CONFIG_HEADERS([config.h])
   27 AC_CONFIG_MACRO_DIR([m4macros])
   28 
   29 AC_CANONICAL_HOST
   30 AC_CANONICAL_BUILD
   31 
   32 # Checks for programs.
   33 AC_PROG_CXX
   34 
   35 # Check for exact Kea version.
   36 AC_MSG_CHECKING(whether this is a tarball or git source)
   37 if test -d "${srcdir}/.git"; then
   38         KEA_SRCID="git `(cd "${top_srcdir}";git rev-parse HEAD)`"
   39         AC_MSG_RESULT("git")
   40 else
   41         KEA_SRCID="tarball"
   42         AC_MSG_RESULT("tarball")
   43 fi
   44 # Export EXTENDED_VERSION to config.h
   45 # This will be either "tarball" or "git abcd".
   46 # We do not want to put this in a config.h, because it messes up ccache
   47 # horribly. When building different branches, the commit-id is different
   48 # and since the config.h is included in most files *and* has a different
   49 # content, ccache can't use cached content and thus has to do full compilation.
   50 # Now it is in kea_version.h and config.status substitutes it.
   51 AC_SUBST(KEA_SRCID)
   52 
   53 # Find a separator for path_replacer
   54 for sep in "+" "," ";" "&" "__NONE__"; do
   55         if `pwd | grep -q $sep`; then continue; fi
   56         if `echo ${prefix} | grep -q $sep`; then continue; fi
   57         if `echo ${sysconfdir} | grep -q $sep`; then continue; fi
   58         if `echo ${localstatedir} | grep -q $sep`; then continue; fi
   59         SEP=$sep
   60         break
   61 done
   62 if test "$sep" = "__NONE__"; then
   63         AC_MSG_ERROR([can't find a separator character in '+,;&' for the path_replacer shell script])
   64 fi
   65 AC_SUBST(SEP)
   66 
   67 # pkg-config can be required.
   68 AC_PATH_PROG([PKG_CONFIG], [pkg-config])
   69 
   70 # Enable low-performing debugging facilities? This option optionally
   71 # enables some debugging aids that perform slowly and hence aren't built
   72 # by default.
   73 AC_ARG_ENABLE([debug],
   74   AS_HELP_STRING([--enable-debug],
   75     [enable debugging (default is no)]),
   76   [case "${enableval}" in
   77     yes) debug_enabled=yes ;;
   78     no)  debug_enabled=no ;;
   79     *)   AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
   80   esac],[debug_enabled=no])
   81 AM_CONDITIONAL([DEBUG_ENABLED], [test x$debug_enabled = xyes])
   82 AM_COND_IF([DEBUG_ENABLED], [AC_DEFINE([ENABLE_DEBUG], [1], [Enable low-performing debugging facilities?])])
   83 
   84 # Include premium configuration
   85 INCLUDED_HOOKS=
   86 
   87 PREMIUM_DIR=
   88 DISTCHECK_PREMIUM_CONFIGURE_FLAG=
   89 AC_DEFUN([AX_PREMIUM],[])
   90 # m4_sinclude includes the file if it exists at autoreconf time
   91 m4_sinclude(premium/config.m4)
   92 AC_SUBST(PREMIUM_DIR)
   93 AC_SUBST(DISTCHECK_PREMIUM_CONFIGURE_FLAG)
   94 AX_PREMIUM
   95 
   96 # Include contrib configuration
   97 # (currently only a provision copied from premium support)
   98 CONTRIB_DIR=
   99 DISTCHECK_CONTRIB_CONFIGURE_FLAG=
  100 AC_DEFUN([AX_CONTRIB],[])
  101 m4_sinclude(contrib/config.m4)
  102 AC_SUBST(CONTRIB_DIR)
  103 AC_SUBST(DISTCHECK_CONTRIB_CONFIGURE_FLAG)
  104 AX_CONTRIB
  105 
  106 # Libtool configuration
  107 #
  108 
  109 # libtool cannot handle spaces in paths, so exit early if there is one
  110 if [ test `echo $PWD | grep -c ' '` != "0"  ]; then
  111     AC_MSG_ERROR([Kea cannot be built in a directory that contains spaces, because of libtool limitations. Please change the directory name, or use a symbolic link that does not contain spaces.])
  112 fi
  113 
  114 # On FreeBSD (and probably some others), clang++ does not meet an autoconf
  115 # assumption in identifying libtool configuration regarding shared library:
  116 # the configure script will execute "$CC -shared $CFLAGS/$CXXFLAGS -v" and
  117 # expect the output contains -Lxxx or -Ryyy.  This is the case for g++, but
  118 # not for clang++, and, as a result, it will cause various errors in linking
  119 # programs or running them with a shared object (such as some of our python
  120 # scripts).
  121 # To work around this problem we define a temporary variable
  122 # "CXX_LIBTOOL_LDFLAGS".  It's expected to be defined as, e.g, "-L/usr/lib"
  123 # to temporarily fake the output so that it will be compatible with that of
  124 # g++.
  125 CFLAGS_SAVED=$CFLAGS
  126 CXXFLAGS_SAVED=$CXXFLAGS
  127 CFLAGS="$CFLAGS $CXX_LIBTOOL_LDFLAGS"
  128 CXXFLAGS="$CXXFLAGS $CXX_LIBTOOL_LDFLAGS"
  129 LT_INIT
  130 CFLAGS=$CFLAGS_SAVED
  131 CXXFLAGS=$CXXFLAGS_SAVED
  132 
  133 # Use C++ language
  134 AC_LANG([C++])
  135 
  136 # Identify the compiler: this check must be after AC_PROG_CXX and AC_LANG.
  137 AM_CONDITIONAL(USE_GXX, test "X${GXX}" = "Xyes")
  138 AC_CHECK_DECL([__SUNPRO_CC], [SUNCXX="yes"], [SUNCXX="no"])
  139 AC_CHECK_DECL([__clang__], [CLANGPP="yes"], [CLANGPP="no"])
  140 # USE_CLANGPP is no longer used, keep it by symmetry with USE_GXX?
  141 AM_CONDITIONAL(USE_CLANGPP, test "X${CLANGPP}" = "Xyes")
  142 
  143 # Check for C++11 features support
  144 AX_ISC_CPP11
  145 
  146 # Check for std::is_base_of support
  147 AC_MSG_CHECKING([for std::is_base_of])
  148 AC_COMPILE_IFELSE(
  149     [AC_LANG_PROGRAM(
  150         [#include <type_traits>
  151         class A {};
  152         class B : A {};]
  153         [static_assert(std::is_base_of<A, B>::value, "");])],
  154     [AC_MSG_RESULT(yes)
  155     AC_DEFINE([HAVE_IS_BASE_OF], [1],
  156     [Define to 1 if std::is_base_of is available])],
  157     [AC_MSG_RESULT(no)])
  158 
  159 dnl Determine if we are using GNU sed
  160 GNU_SED=no
  161 $SED --version 2> /dev/null | grep GNU > /dev/null 2>&1
  162 if test $? -eq 0; then
  163   GNU_SED=yes
  164 fi
  165 
  166 # Display the C++ version
  167 AC_MSG_CHECKING([C++ version])
  168 cat > conftest.cpp << EOF
  169 long v = __cplusplus;
  170 EOF
  171 CXX_STANDARD=`$CXX $CXXFLAGS -E -o - conftest.cpp | grep '^long v = ' | $SED -e 's/^long v = //' -e 's/[[^0-9]]*$//' 2> /dev/null`
  172 if test -z "$CXX_STANDARD"; then
  173         CXX_STANDARD="unknown"
  174 fi
  175 AC_MSG_RESULT([$CXX_STANDARD])
  176 
  177 # Linker options
  178 
  179 # check -R, "-Wl,-R" or -rpath
  180 AX_ISC_RPATH
  181 
  182 # Compiler dependent settings: define some mandatory CXXFLAGS here.
  183 # We also use a separate variable KEA_CXXFLAGS.  This will (and should) be
  184 # used as the default value for each specific AM_CXXFLAGS:
  185 # AM_CXXFLAGS = $(KEA_CXXFLAGS)
  186 # AM_CXXFLAGS += ... # add module specific flags
  187 # We need this so that we can disable some specific compiler warnings per
  188 # module basis; since AM_CXXFLAGS are placed before CXXFLAGS, and since
  189 # gcc's -Wno-XXX option must be specified after -Wall or -Wextra, we cannot
  190 # specify the default warning flags in CXXFLAGS and let specific modules
  191 # "override" the default.
  192 
  193 # This may be used to try linker flags.
  194 AC_DEFUN([KEA_CXX_TRY_FLAG], [
  195   AC_MSG_CHECKING([whether $CXX supports $1])
  196 
  197   kea_save_CXXFLAGS="$CXXFLAGS"
  198   CXXFLAGS="$CXXFLAGS -Werror $1"
  199 
  200   AC_LINK_IFELSE([AC_LANG_SOURCE([int main(){ return 0;}])],
  201                  [kea_cxx_flag=yes], [kea_cxx_flag=no])
  202   CXXFLAGS="$kea_save_CXXFLAGS"
  203 
  204   if test "x$kea_cxx_flag" = "xyes"; then
  205     ifelse([$2], , :, [$2])
  206   else
  207     ifelse([$3], , :, [$3])
  208   fi
  209 
  210   AC_MSG_RESULT([$kea_cxx_flag])
  211 ])
  212 
  213 CXX_VERSION="unknown"
  214 
  215 # SunStudio compiler requires special compiler options for boost
  216 # (http://blogs.sun.com/sga/entry/boost_mini_howto)
  217 if test "$SUNCXX" = "yes"; then
  218 CXX_VERSION=`$CXX -V 2> /dev/null | head -1`
  219 CXXFLAGS="$CXXFLAGS -library=stlport4 -features=tmplife -features=tmplrefstatic"
  220 KEA_CXXFLAGS="$KEA_CXXFLAGS -mt"
  221 MULTITHREADING_FLAG="-mt"
  222 fi
  223 
  224 # Newer versions of clang++ promotes "unused driver arguments" warnings to
  225 # a fatal error with -Werror, causing build failure.  Since we use multiple
  226 # compilers on multiple systems, this can easily happen due to settings for
  227 # non clang++ environments that could be just ignored otherwise.  It can also
  228 # happen if clang++ is used via ccache.  So, although probably suboptimal,
  229 # we suppress this particular warning.  Note that it doesn't weaken checks
  230 # on the source code.
  231 if test "X$CLANGPP" = "Xyes"; then
  232 CXX_VERSION=`$CXX --version 2> /dev/null | head -1`
  233 KEA_CXXFLAGS="$KEA_CXXFLAGS -Qunused-arguments"
  234 fi
  235 
  236 # gcc/clang specific settings:
  237 if test "X$GXX" = "Xyes"; then
  238 CXX_VERSION=`$CXX --version 2> /dev/null | head -1`
  239 KEA_CXXFLAGS="$KEA_CXXFLAGS -Wall -Wextra -Wnon-virtual-dtor -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare"
  240 # gcc 4.4 would emit warnings about breaking strict aliasing rules.
  241 # See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41874
  242 CXX_DUMP_VERSION=`$CXX -dumpversion | cut -f1-2 -d.`
  243 if expr "$CXX_DUMP_VERSION" \< "4.5" > /dev/null; then
  244        WARNING_GCC_44_STRICT_ALIASING_CFLAG="-fno-strict-aliasing"
  245 fi
  246 AC_SUBST(WARNING_GCC_44_STRICT_ALIASING_CFLAG)
  247 CPPP="$CPP"
  248 # gcc 5 preprocessor requires -P for checking its output
  249 if expr "$CXX_DUMP_VERSION" \> "5" > /dev/null; then
  250        CPPP="$CPP -P"
  251 fi
  252 
  253 case "$host" in
  254 *-solaris*)
  255         MULTITHREADING_FLAG=-pthreads
  256         # In Solaris, IN6ADDR_ANY_INIT and IN6ADDR_LOOPBACK_INIT need -Wno-missing-braces
  257         KEA_CXXFLAGS="$KEA_CXXFLAGS -Wno-missing-braces"
  258         ;;
  259 *-apple-darwin*)
  260         MULTITHREADING_FLAG=
  261         ;;
  262 *)
  263         MULTITHREADING_FLAG=-pthread
  264         ;;
  265 esac
  266 KEA_CXXFLAGS="$KEA_CXXFLAGS $MULTITHREADING_FLAG"
  267 
  268 # Disable -Werror by default. Only use it if specifically enabled.
  269 # The usage of this flag is:
  270 #
  271 # No flag:            -Werror is disabled
  272 # --with-werror:      -Werror is enabled
  273 # --with-werror=yes:  -Werror is enabled
  274 # --with-werror=no:   -Werror is disabled
  275 # --with-werror=value -Werror is enabled and "value" is included in the compiler flags
  276 #
  277 # In the last case, "value" may be one or more compiler flags, e.g.
  278 
  279 # --with-werror=-Wundef
  280 # --with-werror='-Wundef -Wconversion'
  281 
  282 werror_extras=
  283 AC_ARG_WITH(werror,
  284     AC_HELP_STRING([--with-werror], [Compile using -Werror (default=no)]),
  285     [
  286      case "${withval}" in
  287          yes) with_werror=1 ;;
  288          no)  with_werror=0 ;;
  289          -*)  with_werror=1; werror_extras=${withval} ;;
  290          *)   AC_MSG_ERROR(bad value ${withval} for --with-werror) ;;
  291      esac],
  292      [with_werror=0])
  293 
  294 werror_ok=0
  295 
  296 # Certain versions of gcc (g++) have a bug that incorrectly warns about
  297 # the use of anonymous name spaces even if they're closed in a single
  298 # translation unit.  For these versions we have to disable -Werror.
  299 if test $with_werror = 1; then
  300    CXXFLAGS_SAVED="$CXXFLAGS"
  301    CXXFLAGS="$CXXFLAGS $KEA_CXXFLAGS -Werror"
  302    AC_MSG_CHECKING(for in-TU anonymous namespace breakage)
  303    # We use struct, not class, here, because some compilers complain about
  304    # "unused private members", causing a false positive.
  305    AC_TRY_COMPILE([namespace { struct Foo {}; }
  306    namespace isc {struct Bar {Foo foo_;};} ],,
  307         [AC_MSG_RESULT(no)
  308          werror_ok=1
  309          KEA_CXXFLAGS="$KEA_CXXFLAGS -Werror"],
  310         [AC_MSG_RESULT(yes)])
  311    CXXFLAGS="$CXXFLAGS_SAVED"
  312 fi
  313 
  314 # Added flags after -Werror
  315 
  316 # Some versions of GCC warn about some versions of Boost regarding
  317 # missing initializer for members in its posix_time.
  318 # https://svn.boost.org/trac/boost/ticket/3477
  319 # But older GCC compilers don't have the flag.
  320 KEA_CXX_TRY_FLAG([-Wno-missing-field-initializers],
  321         [KEA_CXXFLAGS="$KEA_CXXFLAGS -Wno-missing-field-initializers"])
  322 
  323 if test "X$CLANGPP" = "Xyes"; then
  324         # This is to workaround unused variables tcout and tcerr in
  325         # log4cplus's streams.h and unused parameters from some of the
  326         # Boost headers.
  327         KEA_CXXFLAGS="$KEA_CXXFLAGS -Wno-unused-variable -Wno-unused-parameter"
  328 fi
  329 
  330 # Add the extras at the very last
  331 # Note it can be used to re-enable a (fatal) warning
  332 for extra in $werror_extras; do
  333         KEA_CXX_TRY_FLAG([$extra],
  334                 [KEA_CXXFLAGS="$KEA_CXXFLAGS $extra"],
  335                 [AC_MSG_ERROR([$CXX does not support $extra"])])
  336 done
  337 
  338 fi                              dnl GXX = yes
  339 
  340 # allow building programs with static link.  we need to make it selective
  341 # because loadable modules cannot be statically linked.
  342 AC_ARG_ENABLE([static-link],
  343 AC_HELP_STRING([--enable-static-link],
  344   [build programs with static link [[default=no]]]),
  345   [enable_static_link=yes], [enable_static_link=no])
  346 AM_CONDITIONAL(USE_STATIC_LINK, test $enable_static_link = yes)
  347 AM_COND_IF([USE_STATIC_LINK], [AC_DEFINE([USE_STATIC_LINK], [1], [Was Kea statically linked?])])
  348 
  349 # Check validity about some libtool options
  350 if test $enable_static_link = yes -a $enable_static = no; then
  351         AC_MSG_ERROR([--enable-static-link requires --enable-static])
  352 fi
  353 if test $enable_static_link = no -a $enable_shared = no; then
  354         AC_MSG_ERROR([--disable-static-link requires --enable-shared])
  355 fi
  356 
  357 # OS dependent configuration
  358 kea_undefined_pthread_behavior=no
  359 
  360 case "$host" in
  361 *-solaris*)
  362         # Solaris requires special definitions to get some standard libraries
  363         # (e.g. getopt(3)) available with common used header files.
  364         CPPFLAGS="$CPPFLAGS -D_XPG4_2 -D__EXTENSIONS__"
  365         # "now" binding is necessary to prevent deadlocks in C++ static initialization code
  366         LDFLAGS="$LDFLAGS -z now"
  367         # Destroying locked mutexes, condition variables being waited
  368         # on, etc. are undefined behavior on Solaris, so we set it as
  369         # such here.
  370         kea_undefined_pthread_behavior=yes
  371         ;;
  372 *-apple-darwin*)
  373         # Starting with OSX 10.7 (Lion) we must choose which IPv6 API to use
  374         # (RFC2292 or RFC3542).
  375         CPPFLAGS="$CPPFLAGS -D__APPLE_USE_RFC_3542"
  376 
  377         # In OS X 10.9 (and possibly any future versions?) pthread_cond_destroy
  378         # doesn't work as documented, which makes some of unit tests fail.
  379         AC_MSG_CHECKING([OS X versions where destroying locked locks do not fail])
  380         AC_TRY_COMPILE(
  381         [#include <Availability.h>],
  382         [#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
  383          #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
  384          #error " OS X >= 10.9"
  385          #endif
  386          #endif
  387          return 1;],
  388         [AC_MSG_RESULT([OS X < 10.9])],
  389         [AC_MSG_RESULT([OS X >= 10.9])
  390          kea_undefined_pthread_behavior=yes])
  391         ;;
  392 *-freebsd*)
  393         # On FreeBSD10.1 pthread_cond_destroy doesn't work as documented, which
  394         # causes the CondVarTest.destroyWhileWait test to fail. According to the
  395         # pthread_cond_destroy documentation for FreeBSD, this function should
  396         # return EBUSY error when there is a thread waiting for the conditional
  397         # variable, whereas this function returned success code. We treat it here
  398         # as an undefined behavior. Also note that this issue was only visible
  399         # when gtest 1.7 was in use, because the previous versions of gtest
  400         # didn't seem to have support for the death tests on FreeBSD. As a
  401         # result, the test was not executed and the error didn't occur.
  402         kea_undefined_pthread_behavior=yes
  403         ;;
  404 esac
  405 if [ test $kea_undefined_pthread_behavior = "yes" ]; then
  406    AC_DEFINE([HAS_UNDEFINED_PTHREAD_BEHAVIOR], [1], [Does this platform have some undefined pthreads behavior?])
  407 fi
  408 
  409 # Our experiments have shown Solaris 10 has broken support for the
  410 # IPV6_USE_MIN_MTU socket option for getsockopt(); it doesn't return the value
  411 # previously set via setsockopt().  We know it doesn't happen on one instance
  412 # on Solaris 11, but we don't know whether it happens for any Solaris 10
  413 # implementations or for earlier versions of Solaris.  In any case, at the
  414 # moment this matters for only one unittest case, so we'll simply disable
  415 # the affected test using the following definition with the specific hardcoding
  416 # of that version of Solaris.
  417 case "$host" in
  418 *-solaris2.10)
  419         AC_DEFINE([HAVE_BROKEN_GET_IPV6_USE_MIN_MTU], [1],
  420         [Define to 1 if getsockopt(IPV6_USE_MIN_MTU) does not work])
  421         ;;
  422 esac
  423 
  424 # Made perfdhcp optional.
  425 AC_ARG_ENABLE(perfdhcp, [AC_HELP_STRING([--enable-perfdhcp],
  426   [enable perfdhcp, a DHCP benchmarking tool [default=no]])],
  427   enable_perfdhcp=$enableval, enable_perfdhcp=no)
  428 
  429 DISTCHECK_PERFDHCP_CONFIGURE_FLAG=
  430 if test "x$enable_perfdhcp" != xno ; then
  431   DISTCHECK_PERFDHCP_CONFIGURE_FLAG="--enable-perfdhcp"
  432 fi
  433 
  434 # Export to makefiles the info whether we have perfdhcp enabled or not
  435 AM_CONDITIONAL(PERFDHCP, test x$enable_perfdhcp != xno)
  436 AC_SUBST(DISTCHECK_PERFDHCP_CONFIGURE_FLAG)
  437 
  438 # produce PIC unless we disable shared libraries. need this for python bindings.
  439 if test $enable_shared != "no" -a "X$GXX" = "Xyes"; then
  440    KEA_CXXFLAGS="$KEA_CXXFLAGS -fPIC"
  441 fi
  442 
  443 # Look for glib static libs if they're trying to do static builds
  444 if test $enable_static_link != "no"; then
  445    CXX_SAVED=$CXX
  446    CXX="$CXX -static"
  447 
  448    AC_LINK_IFELSE(
  449      [AC_LANG_PROGRAM([#include <math.h>],[(void)sqrt(-1.0);])],
  450      [AC_MSG_RESULT([checking for static glib libraries... yes])],
  451      [AC_MSG_RESULT([checking for static glib libraries... no])
  452       AC_MSG_ERROR([Building with --enable-static-link does not work. You appear to be missing glib static libraries. Check config.log for details.])])
  453 
  454    CXX=$CXX_SAVED
  455 fi
  456 
  457 AC_SUBST(KEA_CXXFLAGS)
  458 
  459 # Checks for libraries.
  460 
  461 AC_SEARCH_LIBS(inet_pton, [nsl])
  462 AC_SEARCH_LIBS(recvfrom, [socket])
  463 AC_SEARCH_LIBS(nanosleep, [rt])
  464 AC_SEARCH_LIBS(dlsym, [dl])
  465 
  466 # Checks for header files.
  467 
  468 # Checks for typedefs, structures, and compiler characteristics.
  469 AC_HEADER_STDBOOL
  470 AC_TYPE_SIZE_T
  471 
  472 
  473 # Detect OS type (it may be used to do OS-specific things, e.g.
  474 # interface detection in DHCP)
  475 AC_MSG_CHECKING(OS type)
  476 BSD_TYPE="notaBSD"
  477 case $host in
  478     *-linux*)
  479       AC_DEFINE([OS_LINUX], [1], [Running on Linux?])
  480       OS_TYPE="Linux"
  481       CPPFLAGS="$CPPFLAGS -DOS_LINUX"
  482       ;;
  483     *-apple-darwin*)
  484       AC_DEFINE([OS_BSD], [1], [Running on BSD?])
  485       AC_DEFINE([OS_OSX], [1], [Running on OSX?])
  486       OS_TYPE="BSD"
  487       BSD_TYPE="OSX"
  488       CPPFLAGS="$CPPFLAGS -DOS_BSD"
  489       ;;
  490     *-freebsd*)
  491       AC_DEFINE([OS_BSD], [1], [Running on BSD?])
  492       AC_DEFINE([OS_FREEBSD], [1], [Running on FreeBSD?])
  493       OS_TYPE="BSD"
  494       BSD_TYPE="FreeBSD"
  495       CPPFLAGS="$CPPFLAGS -DOS_BSD"
  496       ;;
  497     *-netbsd*)
  498       AC_DEFINE([OS_BSD], [1], [Running on BSD?])
  499       AC_DEFINE([OS_NETBSD], [1], [Running on NetBSD?])
  500       OS_TYPE="BSD"
  501       BSD_TYPE="NetBSD"
  502       CPPFLAGS="$CPPFLAGS -DOS_BSD"
  503       ;;
  504     *-openbsd*)
  505       AC_DEFINE([OS_BSD], [1], [Running on BSD?])
  506       AC_DEFINE([OS_OPENBSD], [1], [Running on OpenBSD?])
  507       OS_TYPE="BSD"
  508       BSD_TYPE="OpenBSD"
  509       CPPFLAGS="$CPPFLAGS -DOS_BSD"
  510       ;;
  511     *-solaris*)
  512       AC_DEFINE([OS_SOLARIS], [1], [Running on Solaris?])
  513       OS_TYPE="Solaris"
  514       CPPFLAGS="$CPPFLAGS -DOS_SUN"
  515       ;;
  516     *)
  517       OS_TYPE="Unknown"
  518       # $host_os is more user friendly than full $host
  519       AC_MSG_WARN("Unsupported OS: $host_os")
  520       ;;
  521 esac
  522 AC_MSG_RESULT($OS_TYPE)
  523 
  524 AM_CONDITIONAL(OS_LINUX, test $OS_TYPE = Linux)
  525 AM_CONDITIONAL(OS_BSD, test $OS_TYPE = BSD)
  526 AM_CONDITIONAL(OS_SOLARIS, test $OS_TYPE = Solaris)
  527 AM_CONDITIONAL(OS_OSX, test $BSD_TYPE = OSX)
  528 AM_CONDITIONAL(OS_FREEBSD, test $BSD_TYPE = FreeBSD)
  529 AM_CONDITIONAL(OS_NETBSD, test $BSD_TYPE = NetBSD)
  530 AM_CONDITIONAL(OS_OPENBSD, test $BSD_TYPE = OpenBSD)
  531 
  532 
  533 AC_MSG_CHECKING(for sa_len in struct sockaddr)
  534 AC_TRY_COMPILE([
  535 #include <sys/types.h>
  536 #include <sys/socket.h>],
  537 [struct sockaddr sa; sa.sa_len = 0; return (0);],
  538         [AC_MSG_RESULT(yes)
  539         AC_DEFINE(HAVE_SA_LEN, 1, [Define to 1 if sockaddr has a sa_len member, and corresponding sin_len and sun_len])],
  540         AC_MSG_RESULT(no))
  541 
  542 AC_MSG_CHECKING(for usuable C++11 regex)
  543 AC_TRY_RUN([
  544 #include <regex>
  545 #include <iostream>
  546 int main() {
  547   const std::regex regex(".*");
  548   const std::string string = "This should match!";
  549   const auto result = std::regex_search(string, regex);
  550   return result ? EXIT_SUCCESS : EXIT_FAILURE;
  551 }],
  552         [AC_MSG_RESULT(yes)
  553         AC_DEFINE(USE_REGEX, 1, [Define to 1 if C++11 regex is usable])],
  554         AC_MSG_RESULT(no))
  555 
  556 enable_gtest="no"
  557 GTEST_INCLUDES=
  558 
  559 AC_ARG_WITH([gtest-source],
  560             [AS_HELP_STRING([--with-gtest-source=PATH],
  561                             [location of the Googletest source])],
  562             [enable_gtest="yes" ; GTEST_SOURCE="$withval"])
  563 
  564 AC_ARG_WITH([gtest],
  565             [AS_HELP_STRING([--with-gtest=PATH],
  566                             [specify a path to gtest header files (PATH/include) and library (PATH/lib)])],
  567         [gtest_path="$withval"; enable_gtest="yes"], [gtest_path="no"])
  568 
  569 AC_ARG_WITH([lcov],
  570             [AS_HELP_STRING([--with-lcov=PROGRAM],
  571                             [enable gtest and coverage target using the specified lcov])],
  572                             [lcov="$withval"],
  573                             [lcov="no"])
  574 
  575 USE_LCOV="no"
  576 if test "$lcov" != "no"; then
  577         # force gtest if not set
  578         if test "$enable_gtest" = "no"; then
  579 #               AC_MSG_ERROR("lcov needs gtest for test coverage report")
  580                 AC_MSG_NOTICE([gtest support is now enabled, because used by coverage tests])
  581                 enable_gtest="yes"
  582         fi
  583         if test "$lcov" != "yes"; then
  584                 LCOV=$lcov
  585         else
  586                 AC_PATH_PROG([LCOV], [lcov])
  587         fi
  588         if test -x "${LCOV}"; then
  589                 USE_LCOV="yes"
  590         else
  591                 AC_MSG_ERROR([Cannot find lcov.])
  592         fi
  593         # is genhtml always in the same directory?
  594         GENHTML=`echo "$LCOV" | ${SED} s/lcov$/genhtml/`
  595         if test ! -x $GENHTML; then
  596                 AC_MSG_ERROR([genhtml not found, needed for lcov])
  597         fi
  598         # GCC specific?
  599         CXXFLAGS="$CXXFLAGS -fprofile-arcs -ftest-coverage"
  600         LIBS=" $LIBS -lgcov"
  601         AC_SUBST(CPPFLAGS)
  602         AC_SUBST(LIBS)
  603         AC_SUBST(LCOV)
  604         AC_SUBST(GENHTML)
  605 fi
  606 AC_SUBST(USE_LCOV)
  607 
  608 enable_benchmark="no"
  609 BENCHMARK_INCLUDES=
  610 
  611 AC_ARG_WITH([benchmark-source],
  612             [AS_HELP_STRING([--with-benchmark-source=PATH],
  613                             [location of the benchmark source])],
  614             [enable_benchmark="yes" ; BENCHMARK_SOURCE="$withval"])
  615 
  616 AC_ARG_WITH([benchmark],
  617             [AS_HELP_STRING([--with-benchmark=PATH],
  618                             [specify a path to benchmark header files (PATH/include) and library (PATH/lib)])],
  619         [benchmark_path="$withval"; enable_benchmark="yes"], [benchmark_path="no"])
  620 
  621 # Sets up for use of botan unless openssl is specified
  622 # sets variables CRYPTO_*
  623 AX_CRYPTO
  624 
  625 # List of directories, where tools like mysql_config or pgsql_config will be
  626 # searched for
  627 defaultdirs="/usr /usr/local /usr/pkg /opt /opt/local"
  628 
  629 # Check for MySql.  The path to the mysql_config program is given with
  630 # the --with-mysql-config (default to /usr/bin/mysql-config).  By default,
  631 # the software is not built with MySQL support enabled.
  632 mysql_config="no"
  633 AC_ARG_WITH([mysql],
  634   AC_HELP_STRING([--with-mysql=PATH],
  635     [path to the MySQL 'mysql_config' script (MySQL is used for the DHCP database)]),
  636     [mysql_config="$withval"])
  637 
  638 deprec_msg="no"
  639 AC_ARG_WITH([dhcp-mysql],,
  640     [mysql_config="$withval";deprec_msg="yes"])
  641 
  642 if test "${deprec_msg}" = "yes" ; then
  643     AC_MSG_WARN([--with-dhcp-mysql has been deprecated, please use --with-mysql])
  644 fi
  645 
  646 if test "${mysql_config}" = "yes" ; then
  647     MYSQL_CONFIG="/usr/bin/mysql_config"
  648     for d in $defaultdirs
  649     do
  650         if test -f $d/bin/mysql_config; then
  651             MYSQL_CONFIG="$d/bin/mysql_config"
  652             break
  653         fi
  654     done
  655 elif test "${mysql_config}" != "no" ; then
  656     MYSQL_CONFIG="${withval}"
  657 fi
  658 
  659 if test "$MYSQL_CONFIG" != "" ; then
  660     if test -d "$MYSQL_CONFIG" -o ! -x "$MYSQL_CONFIG" ; then
  661         AC_MSG_ERROR([MySQL dependencies cannot be found. Please install MySQL libraries or point --with-mysql to mysql_config program if it is located in non-default directory, eg. --with-mysql=/opt/mysql/bin/mysql_config.])
  662     fi
  663 
  664     MYSQL_CPPFLAGS=`$MYSQL_CONFIG --cflags`
  665     MYSQL_LIBS=`$MYSQL_CONFIG --libs`
  666     MYSQL_LIBS="$MYSQL_LIBS $CRYPTO_LIBS"
  667     MYSQL_VERSION=`$MYSQL_CONFIG --version`
  668 
  669     AC_SUBST(MYSQL_CPPFLAGS)
  670     AC_SUBST(MYSQL_LIBS)
  671 
  672     # Check that a simple program using MySQL functions can compile and link.
  673     CPPFLAGS_SAVED="$CPPFLAGS"
  674     LIBS_SAVED="$LIBS"
  675 
  676     CPPFLAGS="$MYSQL_CPPFLAGS $CPPFLAGS"
  677     LIBS="$MYSQL_LIBS $LIBS"
  678 
  679     AC_LINK_IFELSE(
  680         [AC_LANG_PROGRAM([#include <mysql.h>],
  681                          [MYSQL mysql_handle;
  682                           (void) mysql_init(&mysql_handle);
  683                          ])],
  684         [AC_MSG_RESULT([checking for MySQL headers and library... yes])],
  685         [AC_MSG_RESULT([checking for MySQL headers and library... no])
  686          AC_MSG_ERROR([Needs MySQL library])]
  687     )
  688 
  689     # Note that MYSQL is present in the config.h file
  690     AC_DEFINE([HAVE_MYSQL], [1], [MySQL is present])
  691 
  692     # Check is my_bool is defined.
  693     AC_COMPILE_IFELSE(
  694         [AC_LANG_PROGRAM([#include <mysql.h>
  695                           const my_bool MLM_FALSE = 0;]
  696                          [])],
  697         [AC_MSG_RESULT([checking for MySQL my_bool... yes])
  698          AC_DEFINE([HAVE_MYSQL_MY_BOOL], [1], [MySQL uses my_bool])],
  699         [AC_MSG_RESULT([checking for MySQL my_bool... no])])
  700 
  701     CPPFLAGS=$CPPFLAGS_SAVED
  702     LIBS=$LIBS_SAVED
  703 
  704 fi
  705 
  706 # Solaris puts FIONREAD in filio.h
  707 AC_CHECK_HEADERS(sys/filio.h,,,)
  708 
  709 # ... and at the shell level, so Makefile.am can take action depending on this.
  710 AM_CONDITIONAL(HAVE_MYSQL, test "$MYSQL_CONFIG" != "")
  711 
  712 pg_config="no"
  713 AC_ARG_WITH([pgsql],
  714   AC_HELP_STRING([--with-pgsql=PATH],
  715     [path to the PostgreSQL 'pg_config' script]),
  716     [pg_config="$withval"])
  717 
  718 deprec_msg="no"
  719 AC_ARG_WITH([dhcp-pgsql],,
  720     [pg_config="$withval";deprec_msg="yes"])
  721 
  722 if test "${deprec_msg}" = "yes" ; then
  723     AC_MSG_WARN([--with-dhcp-pgsql has been deprecated, please use --with-pgsql])
  724 fi
  725 
  726 if test "${pg_config}" = "yes" ; then
  727     PG_CONFIG="/usr/bin/pg_config"
  728     for d in $defaultdirs
  729     do
  730         if test -f $d/bin/pg_config; then
  731             PG_CONFIG="$d/bin/pg_config"
  732             break
  733         fi
  734     done
  735 elif test "${pg_config}" != "no" ; then
  736     PG_CONFIG="${withval}"
  737 fi
  738 
  739 if test "$PG_CONFIG" != "" ; then
  740     if test -d "$PG_CONFIG" -o ! -x "$PG_CONFIG" ; then
  741         AC_MSG_ERROR([PostgreSQL dependencies cannot be found. Please install PostgreSQL libraries or point --with-pgsql to pg_config program if it is located in non-default directory, eg. --with-pgsql=/opt/pgsql/bin/pg_config.])
  742     fi
  743 
  744     PGSQL_CPPFLAGS=`$PG_CONFIG --cppflags`
  745     PGSQL_INCLUDEDIR=`$PG_CONFIG --includedir`
  746     PGSQL_INCLUDEDIR_SERVER=`$PG_CONFIG --includedir-server`
  747     PGSQL_CPPFLAGS="$PGSQL_CPPFLAGS -I$PGSQL_INCLUDEDIR -I$PGSQL_INCLUDEDIR_SERVER"
  748     PGSQL_LIBS=`$PG_CONFIG --libdir`
  749     PGSQL_LIBS="-L$PGSQL_LIBS -lpq"
  750     PGSQL_VERSION=`$PG_CONFIG --version`
  751 
  752     AC_SUBST(PGSQL_CPPFLAGS)
  753     AC_SUBST(PGSQL_LIBS)
  754 
  755     # Check that a simple program using PostgreSQL functions can compile and link.
  756     CPPFLAGS_SAVED="$CPPFLAGS"
  757     LIBS_SAVED="$LIBS"
  758 
  759     CPPFLAGS="$PGSQL_CPPFLAGS $CPPFLAGS"
  760     LIBS="$PGSQL_LIBS $LIBS"
  761 
  762     AC_LINK_IFELSE(
  763             [AC_LANG_PROGRAM([#include <libpq-fe.h>],
  764                              [PGconn * c = PQconnectdb("dbname = 'postgres'");
  765                               PQfinish(c);])],
  766             [AC_MSG_RESULT([checking for PostgreSQL headers and library... yes])],
  767             [AC_MSG_RESULT([checking for PostgreSQL headers and library... no])
  768              AC_MSG_ERROR([Needs PostgreSQL library])]
  769     )
  770 
  771     AC_CHECK_HEADERS([utils/errcodes.h],,
  772     AC_MSG_ERROR([Missing required header file (errcodes.h) from PostgreSQL server-development package]))
  773 
  774     CPPFLAGS=$CPPFLAGS_SAVED
  775     LIBS=$LIBS_SAVED
  776 
  777     # Note that PostgreSQL is present in the config.h file
  778     AC_DEFINE([HAVE_PGSQL], [1], [PostgreSQL is present])
  779 fi
  780 
  781 # ... and at the shell level, so Makefile.am can take action depending on this.
  782 AM_CONDITIONAL(HAVE_PGSQL, test "$PG_CONFIG" != "")
  783 
  784 # allow building kea programs with static link to cassandra cpp-driver.
  785 AC_ARG_ENABLE([cql-static-lib],
  786 AS_HELP_STRING([--enable-cql-static-lib],
  787     [build programs with cassandra cpp driver static library [[default=no]]]),
  788     [enable_cql_static_lib=yes], [enable_cql_static_lib=no])
  789 AM_CONDITIONAL(USE_CQL_STATIC_LIB, test "$enable_cql_static_lib" = yes)
  790 #AC_DEFINE USE_CQL_STATIC_LIB? (unused)
  791 
  792 cql_lib="cassandra"
  793 if test "${enable_cql_static_lib}" = "yes" ; then
  794     cql_lib="${cql_lib}_static"
  795 fi
  796 
  797 cql_config="no"
  798 AC_ARG_WITH([cql],
  799   AC_HELP_STRING([--with-cql=PATH],
  800     [path to pkg-config or the Cassandra CQL 'cql_config' script]),
  801     [cql_config="$withval"])
  802 
  803 if test "${cql_config}" = "yes" ; then
  804     CQL_CONFIG="$PKG_CONFIG"
  805 elif test "${cql_config}" != "no" ; then
  806     CQL_CONFIG="${cql_config}"
  807 fi
  808 
  809 if test "$CQL_CONFIG" != "" ; then
  810     if test -d "$CQL_CONFIG" -o ! -x "$CQL_CONFIG" ; then
  811         AC_MSG_ERROR([--with-cql should point to a pkg-config or cql_config program])
  812     fi
  813 
  814     $CQL_CONFIG --print-errors $cql_lib
  815     if test $? -ne 0; then
  816         AC_MSG_ERROR([$CQL_CONFIG $cql_lib failed])
  817     fi
  818 
  819     CQL_INCLUDEDIR=`$CQL_CONFIG --cflags-only-I $cql_lib`
  820     CQL_CPPFLAGS=`$CQL_CONFIG --cflags-only-other $cql_lib`
  821     CQL_LIBS=`$CQL_CONFIG --libs $cql_lib`
  822     CQL_LIBS="$CQL_LIBS $CRYPTO_LIBS"
  823     CQL_VERSION=`$CQL_CONFIG --modversion $cql_lib`
  824 
  825     CQL_CPPFLAGS="${CQL_CPPFLAGS} ${CQL_INCLUDEDIR}"
  826     AC_SUBST(CQL_CPPFLAGS)
  827     AC_SUBST(CQL_LIBS)
  828 
  829     # Check that a simple program using CQL functions can compile and link.
  830     CPPFLAGS_SAVED="$CPPFLAGS"
  831     LIBS_SAVED="$LIBS"
  832 
  833     CPPFLAGS="$CQL_CPPFLAGS $CPPFLAGS"
  834     LIBS="$CQL_LIBS $LIBS"
  835 
  836     AC_LINK_IFELSE(
  837             [AC_LANG_PROGRAM([#include <cassandra.h>],
  838                              [CassCluster* cluster = cass_cluster_new();
  839                               cass_cluster_free(cluster);])],
  840             [AC_MSG_RESULT([checking for Cassandra CQL headers and library... yes])],
  841             [AC_MSG_RESULT([checking for Cassandra CQL headers and library... no])
  842              AC_MSG_ERROR([Needs Cassandra CQL library])]
  843     )
  844     CPPFLAGS=$CPPFLAGS_SAVED
  845     LIBS=$LIBS_SAVED
  846 
  847     # Note that CQL is present in the config.h file
  848     AC_DEFINE([HAVE_CQL], [1], [CQL is present])
  849 fi
  850 
  851 # ... and at the shell level, so Makefile.am can take action depending on this.
  852 AM_CONDITIONAL(HAVE_CQL, test "$CQL_CONFIG" != "")
  853 
  854 DISTCHECK_SYSREPO_CONFIGURE_FLAG=
  855 sysrepo_config="no"
  856 AC_ARG_WITH([sysrepo],
  857   AC_HELP_STRING([--with-sysrepo=PATH],
  858     [path to pkg-config or the Sysrepo 'sysrepo_config' script]),
  859     [sysrepo_config="$withval"])
  860 
  861 if test "${sysrepo_config}" = "yes" ; then
  862     if test "$PKG_CONFIG" = ""; then
  863         AC_MSG_ERROR([--with-sysrepo specified without any parameter and pkg-config was not found. Either use --with-sysrepo=path or install pkg-config])
  864     fi
  865     SYSREPO_CONFIG="$PKG_CONFIG"
  866     DISTCHECK_SYSREPO_CONFIGURE_FLAG="-with-sysrepo=${sysrepo_config}"
  867 elif test "${sysrepo_config}" != "no" ; then
  868     SYSREPO_CONFIG="${sysrepo_config}"
  869     DISTCHECK_SYSREPO_CONFIGURE_FLAG="-with-sysrepo=${sysrepo_config}"
  870 fi
  871 AC_SUBST(DISTCHECK_SYSREPO_CONFIGURE_FLAG)
  872 
  873 if test "$SYSREPO_CONFIG" != "" ; then
  874     if test -d "$SYSREPO_CONFIG" -o ! -x "$SYSREPO_CONFIG" ; then
  875         AC_MSG_ERROR([--with-sysrepo should point to a pkg-config or sysrepo_config program])
  876     fi
  877 
  878     # Let's get the configuration environment for pure Sysrepo (written in C) first
  879     SYSREPO_INCLUDEDIR=`$SYSREPO_CONFIG --cflags-only-I libsysrepo`
  880     SYSREPO_CPPFLAGS="$SYSREPO_INCLUDEDIR `$SYSREPO_CONFIG --cflags-only-other libsysrepo`"
  881     SYSREPO_LIBS="`$SYSREPO_CONFIG --libs libsysrepo`"
  882     SYSREPO_VERSION=`$SYSREPO_CONFIG --modversion libsysrepo`
  883     SYSREPO_REPO=`$SYSREPO_CONFIG --variable=SR_REPOSITORY_LOC libsysrepo`
  884 
  885     # Now get the environment for C++ bindings for Sysrepo.
  886     SYSREPOCPP_INCLUDEDIR=`$SYSREPO_CONFIG --cflags-only-I libSysrepo-cpp`
  887     SYSREPOCPP_CPPFLAGS="$SYSREPO_INCLUDEDIR `$SYSREPO_CONFIG --cflags-only-other libSysrepo-cpp`"
  888     SYSREPOCPP_LIBS="`$SYSREPO_CONFIG --libs libSysrepo-cpp`"
  889     SYSREPOCPP_VERSION=`$SYSREPO_CONFIG --modversion libSysrepo-cpp`
  890 
  891     # If include paths are equal, there's no need to include both. But if they're different,
  892     # we need both.
  893     if test "${SYSREPO_INCLUDEDIR}" != "${SYSREPOCPP_INCLUDEDIR}"; then
  894        SYSREPO_INCLUDEDIR="${SYSREPO_INCLUDEDIR} ${SYSREPOCPP_INCLUDEDIR}"
  895     fi
  896 
  897     if test "${SYSREPO_CPPFLAGS}" != "${SYSREPOCPP_CPPFLAGS}"; then
  898        SYSREPO_CPPFLAGS="${SYSREPO_CPPFLAGS} ${SYSREPOCPP_CPPFLAGS}"
  899     fi
  900 
  901     if test "${SYSREPO_LIBS}" != "${SYSREPOCPP_LIBS}"; then
  902        SYSREPO_LIBS="${SYSREPO_LIBS} ${SYSREPOCPP_LIBS}"
  903     fi
  904 
  905     AC_SUBST(SYSREPO_INCLUDEDIR)
  906     AC_SUBST(SYSREPO_CPPFLAGS)
  907     AC_SUBST(SYSREPO_LIBS)
  908     AC_SUBST(SYSREPO_REPO)
  909 
  910     # Check that a simple program using Sysrepo functions can compile and link.
  911     CPPFLAGS_SAVED="$CPPFLAGS"
  912     LIBS_SAVED="$LIBS"
  913 
  914     CPPFLAGS="$SYSREPO_CPPFLAGS $CPPFLAGS"
  915     LIBS="$SYSREPO_LIBS $LIBS"
  916 
  917     AC_LINK_IFELSE(
  918             [AC_LANG_PROGRAM([extern "C" {
  919                               #include <sysrepo.h>
  920                               }],
  921                               [sr_conn_ctx_t *connection = NULL;
  922                               sr_session_ctx_t *session = NULL;
  923                               sr_connect("configure_test", SR_CONN_DEFAULT, &connection);
  924                               sr_disconnect(connection);])],
  925             [AC_MSG_RESULT([checking for Sysrepo headers and library... yes])],
  926             [AC_MSG_RESULT([checking for Sysrepo headers and library... no])
  927              AC_MSG_ERROR([Needs Sysrepo library])]
  928     )
  929 
  930     AC_LINK_IFELSE(
  931         [AC_LANG_PROGRAM(
  932             [#include <sysrepo-cpp/Session.hpp>],
  933             [sysrepo::Connection("conn-name");])],
  934         [AC_LINK_IFELSE(
  935             [AC_LANG_PROGRAM(
  936                 [#include <sysrepo-cpp/Session.hpp>],
  937                 [auto is_empty = [[]](sysrepo::S_Val v){
  938                     return (v->empty()); };
  939                 ])],
  940             [AC_MSG_RESULT([checking for Sysrepo C++ bindings headers and library, new])
  941              AC_DEFINE([HAVE_POST_0_7_7_SYSREPO], [1], [Using sysrepo > 0.7.7])],
  942             [AC_MSG_RESULT([checking for Sysrepo C++ bindings headers and library, yes])])],
  943         [AC_LINK_IFELSE(
  944             [AC_LANG_PROGRAM(
  945                 [#include <sysrepo-cpp/Session.h>],
  946                 [Connection("conn-name");])],
  947             [AC_MSG_RESULT([checking for Sysrepo C++ bindings headers and library... old])
  948              AC_DEFINE([HAVE_PRE_0_7_6_SYSREPO], [1], [Using sysrepo < 0.7.6])],
  949              [AC_MSG_RESULT([checking for Sysrepo C++ bindings headers and library... no])
  950               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.)])]
  951         )]
  952     )
  953 
  954     CPPFLAGS=$CPPFLAGS_SAVED
  955     LIBS=$LIBS_SAVED
  956 
  957     # Note that Sysrepo is present in the config.h file
  958     AC_DEFINE([HAVE_SYSREPO], [1], [SYSREPO is present])
  959 fi
  960 
  961 # ... and at the shell level, so Makefile.am can take action depending on this.
  962 AM_CONDITIONAL(HAVE_SYSREPO, test "$SYSREPO_CONFIG" != "")
  963 
  964 # Check for log4cplus
  965 DISTCHECK_LOG4CPLUS_CONFIGURE_FLAG=
  966 log4cplus_path="yes"
  967 AC_ARG_WITH([log4cplus],
  968   AC_HELP_STRING([--with-log4cplus=PATH],
  969     [specify exact directory of log4cplus library and headers]),
  970     [log4cplus_path="$withval"])
  971 if test "${log4cplus_path}" = "no" ; then
  972     AC_MSG_ERROR([Need log4cplus])
  973 elif test "${log4cplus_path}" != "yes" ; then
  974   DISTCHECK_LOG4CPLUS_CONFIGURE_FLAG="-with-log4cplus=${log4cplus_path}"
  975   LOG4CPLUS_INCLUDES="-I${log4cplus_path}/include"
  976   LOG4CPLUS_LIBS="-L${log4cplus_path}/lib"
  977 else
  978 # If not specified, try some common paths.
  979         for d in $defaultdirs
  980         do
  981                 if test -f $d/include/log4cplus/logger.h; then
  982                         LOG4CPLUS_INCLUDES="-I$d/include"
  983                         LOG4CPLUS_LIBS="-L$d/lib"
  984                         if test -d $d/lib64; then
  985                                 LOG4CPLUS_LIBS="$LOG4CPLUS_LIBS -L$d/lib64"
  986                         fi
  987                         break
  988                 fi
  989         done
  990         DISTCHECK_LOG4CPLUS_CONFIGURE_FLAG="-with-log4cplus"
  991 fi
  992 
  993 LOG4CPLUS_LIBS="$LOG4CPLUS_LIBS -llog4cplus"
  994 
  995 AC_SUBST(DISTCHECK_LOG4CPLUS_CONFIGURE_FLAG)
  996 AC_SUBST(LOG4CPLUS_LIBS)
  997 AC_SUBST(LOG4CPLUS_INCLUDES)
  998 
  999 CPPFLAGS_SAVED=$CPPFLAGS
 1000 CPPFLAGS="$LOG4CPLUS_INCLUDES $CPPFLAGS"
 1001 LIBS_SAVED="$LIBS"
 1002 LIBS="$LOG4CPLUS_LIBS $MULTITHREADING_FLAG $LIBS"
 1003 
 1004 AC_CHECK_HEADERS([log4cplus/logger.h],,AC_MSG_ERROR([Missing required header files.]))
 1005 AC_LINK_IFELSE(
 1006         [AC_LANG_PROGRAM([#include <log4cplus/logger.h>
 1007                          ],
 1008                          [using namespace log4cplus;
 1009                           Logger logger = Logger::getInstance("main");
 1010                          ])],
 1011         [AC_MSG_RESULT([checking for log4cplus library... yes])],
 1012         [AC_MSG_RESULT([checking for log4cplus library... no])
 1013          AC_MSG_ERROR([Needs log4cplus library])]
 1014 )
 1015 
 1016 dnl Determine the log4cplus version, used mainly for config.report.
 1017 AC_MSG_CHECKING([log4cplus version])
 1018 cat > conftest.cpp << EOF
 1019 #include <log4cplus/version.h>
 1020 AUTOCONF_LOG4CPLUS_VERSION=LOG4CPLUS_VERSION_STR
 1021 EOF
 1022 
 1023 LOG4CPLUS_VERSION=`$CPPP $CPPFLAGS conftest.cpp | grep '^AUTOCONF_LOG4CPLUS_VERSION=' | $SED -e 's/^AUTOCONF_LOG4CPLUS_VERSION=//' -e 's/[[ 	]]//g' -e 's/"//g' 2> /dev/null`
 1024 if test -z "$LOG4CPLUS_VERSION"; then
 1025   LOG4CPLUS_VERSION="unknown"
 1026 fi
 1027 $RM -f conftest.cpp
 1028 AC_MSG_RESULT([$LOG4CPLUS_VERSION])
 1029 
 1030 CPPFLAGS=$CPPFLAGS_SAVED
 1031 LIBS=$LIBS_SAVED
 1032 
 1033 # Older log4cplus versions (1.2.0) don't have the initializer.h header that
 1034 # would allow explicit initialization. Newer versions (2.0.4 for sure, possibly
 1035 # older as well) have it and it's recommended to use it. We detect whether
 1036 # it's present or not and do explicit initalization if possible.
 1037 CPPFLAGS_SAVED=$CPPFLAGS
 1038 CPPFLAGS="$LOG4CPLUS_INCLUDES $CPPFLAGS"
 1039 LIBS_SAVED="$LIBS"
 1040 LIBS="$LOG4CPLUS_LIBS $LIBS"
 1041 AC_MSG_CHECKING([log4cplus explicit initialization (log4cplus/initializer.h)])
 1042 AC_LINK_IFELSE(
 1043         [AC_LANG_PROGRAM([#include <log4cplus/initializer.h>],
 1044                          [log4cplus::Initializer initializer;]
 1045                          )],
 1046         [AC_MSG_RESULT([yes])
 1047          AC_DEFINE(LOG4CPLUS_INITIALIZER_H, [1], [Explicit initialization of log4cplus possible])],
 1048         [AC_MSG_RESULT(no)])
 1049 LIBS="$LIBS_SAVED"
 1050 CPPFLAGS=$CPPFLAGS_SAVED
 1051 
 1052 #
 1053 # Configure Boost header path
 1054 #
 1055 AX_BOOST_FOR_KEA
 1056 # Boost offset_ptr is required in one library and not optional right now, so
 1057 # we unconditionally fail here if it doesn't work.
 1058 if test "$BOOST_OFFSET_PTR_WOULDFAIL" = "yes" -a X"$werror_ok" = X1; then
 1059     AC_MSG_ERROR([Failed to compile a required header file.  Try upgrading Boost to 1.44 or higher (when using clang++) or specifying --without-werror.  See the ChangeLog entry for Trac no. 2147 for more details.])
 1060 fi
 1061 
 1062 if test "$BOOST_STATIC_ASSERT_WOULDFAIL" = "yes" -a X"$werror_ok" = X1; then
 1063     AC_MSG_ERROR([Failed to use Boost static assertions. Try upgrading Boost to 1.54 or higher (when using GCC 4.8) or specifying --without-werror.  See trac ticket no. 3039 for more details.])
 1064 fi
 1065 
 1066 # There's a known bug in FreeBSD ports for Boost that would trigger a false
 1067 # warning in build with g++ and -Werror (we exclude clang++ explicitly to
 1068 # avoid unexpected false positives).
 1069 if test "$BOOST_NUMERIC_CAST_WOULDFAIL" = "yes" -a X"$werror_ok" = X1 -a $CLANGPP = "no"; then
 1070     AC_MSG_ERROR([Failed to compile a required header file.  If you are using FreeBSD and Boost installed via ports, retry with specifying --without-werror.  See the ChangeLog entry for Trac no. 1991 for more details.])
 1071 fi
 1072 
 1073 # Add some default CPP flags needed for Boost, identified by the AX macro.
 1074 CPPFLAGS="$CPPFLAGS $CPPFLAGS_BOOST_THREADCONF"
 1075 
 1076 # Can be required by gtest, boost and perhaps still asio
 1077 AC_CHECK_LIB(pthread, pthread_create,[ LDFLAGS="$LDFLAGS -lpthread" ], [])
 1078 
 1079 #
 1080 # Check availability of gtest, which will be used for unit tests.
 1081 #
 1082 GTEST_LDFLAGS=
 1083 GTEST_LDADD=
 1084 DISTCHECK_GTEST_CONFIGURE_FLAG=
 1085 GTEST_VERSION="unknown"
 1086 
 1087 if test "x$enable_gtest" = "xyes" ; then
 1088 
 1089     DISTCHECK_GTEST_CONFIGURE_FLAG="--with-gtest=$gtest_path"
 1090 
 1091     if test -n "$with_gtest_source" ; then
 1092 
 1093         if test "x$GTEST_SOURCE" = "xyes" ; then
 1094 
 1095             AC_MSG_CHECKING([for gtest source])
 1096             # If not specified, try some common paths.
 1097             GTEST_SOURCE=
 1098             for d in /usr/src/gtest /usr/local /usr/pkg /opt /opt/local ; do
 1099                 if test -f $d/src/gtest-all.cc -a $d/src/gtest_main.cc; then
 1100                     GTEST_SOURCE=$d
 1101                     AC_MSG_RESULT([$GTEST_SOURCE])
 1102                     break
 1103                 fi
 1104             done
 1105             if test -z $GTEST_SOURCE ; then
 1106                 AC_MSG_ERROR([no gtest source but it was selected])
 1107             fi
 1108         else
 1109             if test ! -d $GTEST_SOURCE/src -a -d $GTEST_SOURCE/googletest; then
 1110                 GTEST_SOURCE=$GTEST_SOURCE/googletest
 1111             fi
 1112             AC_CHECK_FILES([$GTEST_SOURCE/src/gtest-all.cc]
 1113                 [$GTEST_SOURCE/src/gtest_main.cc],
 1114                 [have_gtest_source=yes],
 1115                 [AC_MSG_ERROR([no gtest source at $GTEST_SOURCE])])
 1116         fi
 1117         have_gtest_source=yes
 1118         GTEST_LDADD="\$(top_builddir)/ext/gtest/libgtest.a"
 1119         DISTCHECK_GTEST_CONFIGURE_FLAG="--with-gtest-source=$GTEST_SOURCE"
 1120         GTEST_INCLUDES="-I$GTEST_SOURCE -I$GTEST_SOURCE/include"
 1121         GTEST_VERSION="`basename $GTEST_SOURCE`"
 1122     fi
 1123 
 1124     if test "$gtest_path" != "no" ; then
 1125         if test "$gtest_path" != "yes"; then
 1126             GTEST_PATHS=$gtest_path
 1127             if test -x "${gtest_path}/bin/gtest-config" ; then
 1128                 GTEST_CONFIG="${gtest_path}/bin/gtest-config"
 1129             fi
 1130         else
 1131             AC_PATH_PROG([GTEST_CONFIG], [gtest-config])
 1132         fi
 1133         if test -x "${GTEST_CONFIG}" ; then :
 1134             # using cppflags instead of cxxflags
 1135             GTEST_INCLUDES=`${GTEST_CONFIG} --cppflags`
 1136             GTEST_LDFLAGS=`${GTEST_CONFIG} --ldflags`
 1137             GTEST_LDADD=`${GTEST_CONFIG} --libs`
 1138             GTEST_VERSION=`${GTEST_CONFIG} --version`
 1139             GTEST_FOUND="true"
 1140         else
 1141             AC_MSG_WARN([Unable to locate Google Test gtest-config.])
 1142             if test -z "${GTEST_PATHS}" ; then
 1143                 GTEST_PATHS="/usr /usr/local"
 1144             fi
 1145             GTEST_FOUND="false"
 1146         fi
 1147         if test "${GTEST_FOUND}" != "true"; then
 1148             GTEST_FOUND="false"
 1149             for dir in $GTEST_PATHS; do
 1150                 if test -f "$dir/include/gtest/gtest.h"; then
 1151                     if ! test -f "$dir/lib/libgtests.a"; then
 1152                         AC_MSG_WARN([Found Google Test include but not the library in $dir.])
 1153                         continue
 1154                     fi
 1155                     GTEST_INCLUDES="-I$dir/include"
 1156                     GTEST_LDFLAGS="-L$dir/lib"
 1157                     GTEST_LDADD="-lgtest"
 1158                     GTEST_FOUND="true"
 1159                     break
 1160                 fi
 1161             done
 1162         fi
 1163         if test "${GTEST_FOUND}" != "true"; then
 1164             AC_MSG_ERROR([Cannot find gtest in: $GTEST_PATHS])
 1165         fi
 1166 
 1167     fi
 1168 fi
 1169 AM_CONDITIONAL(HAVE_GTEST, test $enable_gtest != "no")
 1170 AM_CONDITIONAL(HAVE_GTEST_SOURCE, test "X$have_gtest_source" = "Xyes")
 1171 AC_SUBST(DISTCHECK_GTEST_CONFIGURE_FLAG)
 1172 AC_SUBST(GTEST_INCLUDES)
 1173 AC_SUBST(GTEST_LDFLAGS)
 1174 AC_SUBST(GTEST_LDADD)
 1175 AC_SUBST(GTEST_SOURCE)
 1176 
 1177 #
 1178 # Check availability of benchmark.
 1179 #
 1180 BENCHMARK_CPPFLAGS=
 1181 BENCHMARK_LDFLAGS=
 1182 BENCHMARK_LDADD=
 1183 DISTCHECK_BENCHMARK_CONFIGURE_FLAG=
 1184 BENCHMARK_VERSION="unknown"
 1185 
 1186 if test "x$enable_benchmark" = "xyes" ; then
 1187 
 1188     DISTCHECK_BENCHMARK_CONFIGURE_FLAG="--with-benchmark=$benchmark_path"
 1189 
 1190     if test -n "$with_benchmark_source" ; then
 1191 
 1192         if test "x$BENCHMARK_SOURCE" = "xyes" ; then
 1193 
 1194             AC_MSG_CHECKING([for benchmark source])
 1195             # If not specified, try some common paths.
 1196             BENCHMARK_SOURCE=
 1197             for d in /usr/src/benchmark /usr/local /usr/pkg /opt /opt/local ; do
 1198                 if test -f $d/src/benchmark.cc; then
 1199                     BENCHMARK_SOURCE=$d
 1200                     AC_MSG_RESULT([$BENCHMARK_SOURCE])
 1201                     break
 1202                 fi
 1203             done
 1204             if test -z $BENCHMARK_SOURCE ; then
 1205                 AC_MSG_ERROR([no benchmark source but it was selected])
 1206             fi
 1207         else
 1208             if test ! -d $BENCHMARK_SOURCE/src; then
 1209                 BENCHMARK_SOURCE=$BENCHMARK_SOURCE/benchmark
 1210             fi
 1211             AC_CHECK_FILES([$BENCHMARK_SOURCE/src/benchmark.cc],
 1212                 [have_benchmark_source=yes],
 1213                 [AC_MSG_ERROR([no benchmark source at $BENCHMARK_SOURCE])])
 1214         fi
 1215         have_benchmark_source=yes
 1216         BENCHMARK_CPPFLAGS=`cat \${BENCHMARK_SOURCE}/build/src/CMakeFiles/benchmark.dir/flags.make | grep CXX_DEFINES | cut -d "=" -f 2`
 1217         BENCHMARK_LDADD="\$(BENCHMARK_SOURCE)/build/src/libbenchmark.a"
 1218         DISTCHECK_BENCHMARK_CONFIGURE_FLAG="--with-benchmark-source=$BENCHMARK_SOURCE"
 1219         BENCHMARK_INCLUDES="-I$BENCHMARK_SOURCE \
 1220                             -I$BENCHMARK_SOURCE/src \
 1221                             -I$BENCHMARK_SOURCE/include \
 1222                             -I$BENCHMARK_SOURCE/include/benchmark"
 1223         BENCHMARK_VERSION="$(basename $BENCHMARK_SOURCE)"
 1224     fi
 1225 
 1226     if test "$benchmark_path" != "no" ; then
 1227         if test "$benchmark_path" != "yes"; then
 1228             BENCHMARK_PATHS=$benchmark_path
 1229         fi
 1230         if test -z "${BENCHMARK_PATHS}" ; then
 1231             BENCHMARK_PATHS="/usr /usr/local"
 1232         fi
 1233         BENCHMARK_FOUND="false"
 1234         for dir in ${BENCHMARK_PATHS}; do
 1235             if test -f "$dir/include/benchmark/benchmark.h"; then
 1236                 if ! test -f "$dir/lib/libbenchmark.a"; then
 1237                     AC_MSG_WARN([Found Google Benchmark include but not the library in $dir.])
 1238                     continue
 1239                 fi
 1240                 BENCHMARK_INCLUDES="-I$dir/include"
 1241                 BENCHMARK_LDFLAGS="-L$dir/lib"
 1242                 BENCHMARK_LDADD="$dir/lib/libbenchmark.a "
 1243                 BENCHMARK_FOUND="true"
 1244                 break
 1245             fi
 1246         done
 1247         if test "${BENCHMARK_FOUND}" != "true"; then
 1248             AC_MSG_ERROR([Cannot find benchmark in: $BENCHMARK_PATHS])
 1249         fi
 1250 
 1251     fi
 1252 
 1253     if test $enable_gtest = no; then
 1254         AC_MSG_ERROR([--with-benchmark and --with-benchmark-source require --with-gtest or --with-gtest-source])
 1255     fi
 1256 
 1257 fi
 1258 AM_CONDITIONAL(HAVE_BENCHMARK, test $enable_benchmark != "no")
 1259 AM_CONDITIONAL(HAVE_BENCHMARK_SOURCE, test "X$have_benchmark_source" = "Xyes")
 1260 AC_SUBST(DISTCHECK_BENCHMARK_CONFIGURE_FLAG)
 1261 AC_SUBST(BENCHMARK_CPPFLAGS)
 1262 AC_SUBST(BENCHMARK_INCLUDES)
 1263 AC_SUBST(BENCHMARK_LDFLAGS)
 1264 AC_SUBST(BENCHMARK_LDADD)
 1265 AC_SUBST(BENCHMARK_SOURCE)
 1266 
 1267 #
 1268 # Some Googletest versions bug with C++11 compilers
 1269 #
 1270 if test $enable_gtest != "no"; then
 1271    AC_MSG_CHECKING([if Google Test is compatible with the compiler])
 1272    CPPFLAGS_SAVED=$CPPFLAGS
 1273    CPPFLAGS="$CPPFLAGS $BOOST_INCLUDES $GTEST_INCLUDES"
 1274    AC_COMPILE_IFELSE(
 1275        [AC_LANG_PROGRAM(
 1276             [#include <boost/shared_ptr.hpp>
 1277             #include <gtest/gtest.h>
 1278             void foo() {
 1279                 boost::shared_ptr<int> bar;
 1280                 ASSERT_TRUE(bar);
 1281             }],
 1282             [return 0;])],
 1283         [AC_MSG_RESULT(yes)],
 1284         [AC_MSG_ERROR([XXX_TRUE() Google Test macros won't compile; the most likely reason is that a later version of Google Test is required])])
 1285     CPPFLAGS=$CPPFLAGS_SAVED
 1286 fi
 1287 
 1288 # Check for CreateUnifiedDiff from gtest >= 1.8.0
 1289 if test $enable_gtest != "no"; then
 1290    AC_MSG_CHECKING([for CreateUnifiedDiff in $GTEST_INCLUDES/gtest.h])
 1291    CPPFLAGS_SAVED=$CPPFLAGS
 1292    CPPFLAGS="$CPPFLAGS $BOOST_INCLUDES $GTEST_INCLUDES"
 1293    AC_COMPILE_IFELSE(
 1294        [AC_LANG_PROGRAM(
 1295             [#include <boost/algorithm/string.hpp>
 1296             #include <gtest/gtest.h>
 1297             #include <string>
 1298             #include <vector>
 1299             std::string nodiff(std::string text) {
 1300                 std::vector<std::string> lines;
 1301                 boost::split(lines, text, boost::is_any_of("\n"));
 1302                 using namespace testing::internal;
 1303                 return (edit_distance::CreateUnifiedDiff(lines, lines));
 1304             }],
 1305             [return 0;])],
 1306         [AC_MSG_RESULT(yes)
 1307         AC_DEFINE([HAVE_CREATE_UNIFIED_DIFF], [1],
 1308         [Define to 1 if gtest defines edit_distance::CreateUnifiedDiff])],
 1309         [AC_MSG_RESULT(no)])
 1310     CPPFLAGS=$CPPFLAGS_SAVED
 1311 fi
 1312 
 1313 #
 1314 # ASIO: we extensively use it as the C++ event management module.
 1315 #
 1316 # Use our 'coroutine' header from ext
 1317 # CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/ext/coroutine"
 1318 
 1319 #
 1320 # Doesn't seem to be required?
 1321 #CPPFLAGS="$CPPFLAGS -DBOOST_ASIO_HEADER_ONLY"
 1322 #
 1323 # Disable threads: they seems to break things on some systems
 1324 # As now we use threads in boost ASIO this is commented out...
 1325 # CPPFLAGS="$CPPFLAGS -DBOOST_ASIO_DISABLE_THREADS=1"
 1326 
 1327 # We tried to stay header only
 1328 if test "x${BOOST_LIBS}" = "x"; then
 1329    # Don't want boost system library
 1330    CPPFLAGS="$CPPFLAGS -DBOOST_ERROR_CODE_HEADER_ONLY"
 1331    # Avoid boost::system::throws multiple defines
 1332    CPPFLAGS="$CPPFLAGS -DBOOST_SYSTEM_NO_DEPRECATED"
 1333 fi
 1334 
 1335 # Check for functions that are not available on all platforms
 1336 AC_CHECK_FUNCS([pselect])
 1337 
 1338 # /dev/poll issue: ASIO uses /dev/poll by default if it's available (generally
 1339 # the case with Solaris).  Unfortunately its /dev/poll specific code would
 1340 # trigger the gcc's "missing-field-initializers" warning, which would
 1341 # subsequently make the build fail with -Werror.  Further, older versions of
 1342 # gcc don't provide an option to selectively suppress this warning.
 1343 # So, for the moment, we simply disable the use of /dev/poll.  Unless we
 1344 # implement recursive DNS server with randomized ports, we don't need the
 1345 # scalability that /dev/poll can provide, so this decision wouldn't affect
 1346 # run time performance.  Hopefully we can find a better solution or the ASIO
 1347 # code will be updated by the time we really need it.
 1348 AC_CHECK_HEADERS(sys/devpoll.h, ac_cv_have_devpoll=yes, ac_cv_have_devpoll=no)
 1349 if test "X$ac_cv_have_devpoll" = "Xyes" -a "X$GXX" = "Xyes"; then
 1350     CPPFLAGS="$CPPFLAGS -DBOOST_ASIO_DISABLE_DEV_POLL=1"
 1351 fi
 1352 
 1353 #
 1354 # Perl is optional; it is used only by some of the system test scripts.
 1355 #
 1356 AC_PATH_PROGS(PERL, perl5 perl)
 1357 AC_SUBST(PERL)
 1358 AC_PATH_PROGS(AWK, gawk awk)
 1359 AC_SUBST(AWK)
 1360 
 1361 AC_ARG_ENABLE(generate_messages, [AC_HELP_STRING([--enable-generate-messages],
 1362   [indicates that the messages files will be regenerated. [default=no]])],
 1363   enable_generate_messages=$enableval, enable_generate_messages=no)
 1364 
 1365 AM_CONDITIONAL([GENERATE_MESSAGES], [test x$enable_generate_messages != xno])
 1366 
 1367 # cross compiling is not compatible with enable-generate-messages.
 1368 if test "$cross_compiling" = "yes"; then
 1369     if test "$enable_generate_messages" != "no"; then
 1370         AC_MSG_WARN([To build the message compiler is not compatible with cross compiling])
 1371     fi
 1372 fi
 1373 
 1374 AC_ARG_ENABLE(generate_parser, [AC_HELP_STRING([--enable-generate-parser],
 1375   [indicates that the parsers will be regenerated. This implies that the
 1376    bison and flex are required [default=no]])],
 1377    enable_generate_parser=$enableval, enable_generate_parser=no)
 1378 
 1379 # Check if flex is available. Flex is not needed for building Kea sources,
 1380 # unless you want to regenerate grammars
 1381 AC_PROG_LEX
 1382 
 1383 # Check if bison is available. Bison is not needed for building Kea sources,
 1384 # unless you want to regenerate grammars
 1385 AC_PATH_PROG(YACC, bison)
 1386 AC_SUBST(YACC)
 1387 
 1388 if test "x$enable_generate_parser" != "xno"; then
 1389 
 1390     if test "x$LEX" != "xflex"; then
 1391        AC_MSG_ERROR([Flex is required for enable-generate-parser, but was not found])
 1392     fi
 1393 
 1394     if test "x$YACC" == "x"; then
 1395        AC_MSG_ERROR([Bison is required for enable-generate-parser, but was not found])
 1396     fi
 1397 
 1398 # Ok, let's check if we have at least 3.0.0 version of the bison. The code used
 1399 # to generate parsers is roughly based on bison 3.0 examples.
 1400    cat > bisontest.y << EOF
 1401 %require "3.0.0"
 1402 %token X
 1403 %%
 1404 %start Y;
 1405 Y: X;
 1406 EOF
 1407 # Try to compile.
 1408     $YACC bisontest.y -o bisontest.cc
 1409 
 1410     if test $? -ne 0 ; then
 1411         $YACC -V
 1412         $RM -f bisontest.y bisontest.cc
 1413         AC_MSG_ERROR("Error with $YACC. Possibly incorrect version? Required at least 3.0.0.")
 1414     fi
 1415     $RM -f bisontest.y bisontest.cc
 1416 fi
 1417 
 1418 AM_CONDITIONAL([GENERATE_PARSER], [test x$enable_generate_parser != xno])
 1419 
 1420 # Kea-shell is written in python. It can work with python 2.7 or any 3.x.
 1421 # It may likely work with earlier versions, but 2.7 was the oldest one we tested
 1422 # it with. We require python only if kea-shell was enabled. It is disabled
 1423 # by default to not introduce hard dependency on python.
 1424 AC_ARG_ENABLE(shell, [AC_HELP_STRING([--enable-shell],
 1425   [enable kea-shell, a text management client for Control Agent [default=no]])],
 1426   enable_shell=$enableval, enable_shell=no)
 1427 
 1428 
 1429 AC_ARG_ENABLE(generate_docs, [AC_HELP_STRING([--enable-generate-docs],
 1430   [regenerate documentation using Sphinx [default=no]])],
 1431   enable_generate_docs=$enableval, enable_generate_docs=no)
 1432 
 1433 
 1434 DISTCHECK_KEA_SHELL_CONFIGURE_FLAG=
 1435 PKGPYTHONDIR=
 1436 shell_report=no
 1437 m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
 1438  [python3 python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 dnl
 1439   python3.3 python3.2 python3.1 python3.0 python python2 python2.7])
 1440 if test "x$enable_shell" != xno -o "x$enable_generate_docs" != xno; then
 1441 # If kea-shell is enabled, we really need python. 2.7 or anything newer will do.
 1442 # We try to find 3.x first. If not found, we can do with 2.7.
 1443   AM_PATH_PYTHON([2.7])
 1444 
 1445   AC_ARG_WITH(site-packages,
 1446            AC_HELP_STRING([--with-site-packages],
 1447                           [place to install Kea Python module]),
 1448            [pythondir=$withval;
 1449             pkgpythondir=${pythondir}/$PACKAGE_NAME])
 1450   if test "$pythondir" = "yes"; then
 1451      AC_MSG_ERROR([If enabled, site-packages must be specified explicitly, e.g. --site-packages=/usr/lib/python3/dist-packages])
 1452   fi
 1453 
 1454   # pkgpythondir needs to be expanded
 1455   saved_prefix="$prefix"
 1456   if test "$prefix" = "NONE"; then
 1457     prefix=$ac_default_prefix
 1458   fi
 1459   PKGPYTHONDIR="$pkgpythondir"
 1460   OLD=
 1461   while test "x$OLD" != "x$PKGPYTHONDIR"; do
 1462     OLD="$PKGPYTHONDIR"
 1463     eval PKGPYTHONDIR="\"$OLD\""
 1464   done
 1465   prefix="$saved_prefix"
 1466   DISTCHECK_KEA_SHELL_CONFIGURE_FLAG="--enable-shell"
 1467   shell_report="yes, install to $pythondir"
 1468 else
 1469   PYTHON=no
 1470 fi
 1471 
 1472 # Export to makefiles the info whether we have shell enabled or not
 1473 AM_CONDITIONAL(KEA_SHELL, test x$enable_shell != xno)
 1474 AC_SUBST(DISTCHECK_KEA_SHELL_CONFIGURE_FLAG)
 1475 AC_SUBST(PKGPYTHONDIR)
 1476 
 1477 AC_ARG_WITH([sphinx],
 1478   AC_HELP_STRING([--with-sphinx=PATH], [path to sphinx-build tool]),
 1479   [sphinx_path="$withval"])
 1480 
 1481 AC_ARG_WITH([pdflatex],
 1482   AC_HELP_STRING([--with-pdflatex=PATH], [path to pdflatex tool]),
 1483   [pdflatex_path="$withval"])
 1484 PDFLATEX=no
 1485 
 1486 if test "x$enable_generate_docs" != xno ; then
 1487   # Check for sphinx-build
 1488   AC_MSG_CHECKING([for sphinx-build])
 1489   if test -z "$sphinx_path"; then
 1490      AC_PATH_PROGS([SPHINXBUILD], [sphinx-build sphinx-build-3])
 1491   else
 1492      SPHINXBUILD="$sphinx_path"
 1493   fi
 1494 
 1495   if test -z "$SPHINXBUILD"; then
 1496     AC_MSG_ERROR([sphinx-build not found; it is required for --enable-generate-docs, please see http://www.sphinx-doc.org/en/master/usage/installation.html for details])
 1497   else
 1498     AC_MSG_RESULT([$SPHINXBUILD])
 1499 
 1500     AC_MSG_CHECKING([whether $SPHINXBUILD is runnable])
 1501     $SPHINXBUILD --version > conftest.err 2>&1
 1502     if test $? -ne 0 ; then
 1503       AC_MSG_ERROR([error with $SPHINXBUILD --version, check conftest.err for details])
 1504     fi
 1505     rm -f conftest.err
 1506     AC_MSG_RESULT([yes])
 1507   fi
 1508 
 1509   # Check for pdflatex
 1510   if test -z "$pdflatex_path"; then
 1511      AC_PATH_PROG([PDFLATEX], [pdflatex])
 1512   else
 1513      PDFLATEX="$pdflatex_path"
 1514   fi
 1515 
 1516   if test -z "$PDFLATEX"; then
 1517     PDFLATEX=no
 1518   elif test "x$PDFLATEX" == "xno"; then
 1519     AC_MSG_CHECKING([for pdflatex])
 1520     AC_MSG_RESULT([no (disabled)])
 1521   else
 1522     AC_MSG_CHECKING([whether $PDFLATEX is runnable])
 1523     $PDFLATEX --version > /dev/null 2>&1
 1524     if test $? -ne 0 ; then
 1525       AC_MSG_RESULT([no - disabled building docs in PDF])
 1526       PDFLATEX=no
 1527     else
 1528       AC_MSG_RESULT([yes])
 1529     fi
 1530   fi
 1531 
 1532   if test -n "$SPHINXBUILD" -a "x$PDFLATEX" != "xno"; then
 1533     AC_MSG_CHECKING([whether $SPHINXBUILD and $PDFLATEX work])
 1534     ti=`mktemp -d`
 1535     to=`mktemp -d`
 1536     echo 'hello' > $ti/contents.rst
 1537     sphinx-build -b latex -C $ti $to > /dev/null 2>&1
 1538     pushd $to > /dev/null 2>&1
 1539     $PDFLATEX -interaction nonstopmode Python.tex > /dev/null 2>&1
 1540     popd > /dev/null 2>&1
 1541     file $to/Python.pdf | grep PDF > /dev/null 2>&1
 1542     if test $? -ne 0 ; then
 1543       AC_MSG_RESULT([no - disabled building docs in PDF])
 1544       PDFLATEX=no
 1545     else
 1546       AC_MSG_RESULT([ok])
 1547     fi
 1548     rm -rf $ti $to
 1549   fi
 1550 
 1551   if test "x$PDFLATEX" != "xno"; then
 1552     generate_docs_report="html, man and pdf"
 1553   else
 1554     generate_docs_report="html, man but no pdf"
 1555   fi
 1556 else
 1557   generate_docs_report="no"
 1558 fi
 1559 
 1560 AM_CONDITIONAL(HAVE_PDFLATEX, test "x$PDFLATEX" != "xno")
 1561 AM_CONDITIONAL(GENERATE_DOCS, test x$enable_generate_docs != xno)
 1562 
 1563 AC_ARG_ENABLE(install-configurations,
 1564   [AC_HELP_STRING([--disable-install-configurations],
 1565   [do not install configuration])], install_configurations=$enableval, install_configurations=yes)
 1566 
 1567 AM_CONDITIONAL(INSTALL_CONFIGURATIONS, test x$install_configurations = xyes || test x$install_configurations = xtrue)
 1568 
 1569 AC_ARG_ENABLE(logger-checks, [AC_HELP_STRING([--enable-logger-checks],
 1570   [check logger messages [default=no]])], enable_logger_checks=$enableval, enable_logger_checks=no)
 1571 AM_CONDITIONAL(ENABLE_LOGGER_CHECKS, test x$enable_logger_checks != xno)
 1572 AM_COND_IF([ENABLE_LOGGER_CHECKS], [AC_DEFINE([ENABLE_LOGGER_CHECKS], [1], [Check logger messages?])])
 1573 
 1574 # Check for asciidoc
 1575 AC_PATH_PROG(ASCIIDOC, asciidoc, no)
 1576 AM_CONDITIONAL(HAVE_ASCIIDOC, test "x$ASCIIDOC" != "xno")
 1577 
 1578 # Check for plantuml
 1579 AC_PATH_PROG(PLANTUML, plantuml, no)
 1580 AM_CONDITIONAL(HAVE_PLANTUML, test "x$PLANTUML" != "xno")
 1581 
 1582 # Check for valgrind
 1583 AC_PATH_PROG(VALGRIND, valgrind, no)
 1584 AM_CONDITIONAL(HAVE_VALGRIND, test "x$VALGRIND" != "xno")
 1585 
 1586 # Also check for valgrind headers
 1587 # We could consider adding them to the source code tree, as this
 1588 # is the encouraged method of using them; they are BSD-licensed.
 1589 # However, until we find that this is a problem, we just use
 1590 # the system-provided ones, if available
 1591 AC_CHECK_HEADERS(valgrind/valgrind.h, [AC_DEFINE([HAVE_VALGRIND_HEADERS], [1], [Check valgrind headers])])
 1592 
 1593 found_valgrind="not found"
 1594 if test "x$VALGRIND" != "xno"; then
 1595    found_valgrind="found"
 1596 fi
 1597 
 1598 # Check for optreset in unistd.h. On BSD systems the optreset is
 1599 # used to reset the state of getopt() function. Resetting its state
 1600 # is required if command line arguments are parsed multiple times
 1601 # during a program. On Linux this variable will not exist because
 1602 # getopt() reset is performed by setting optind = 0. On Operating
 1603 # Systems where optreset is defined use optreset = 1 and optind = 1
 1604 # to reset internal state of getopt(). Failing to do so will result
 1605 # in unpredictable output from getopt().
 1606 AC_MSG_CHECKING([whether optreset variable is defined in unistd.h])
 1607 AC_TRY_LINK(
 1608     [#include <unistd.h>],
 1609     [extern int optreset; optreset=1;],
 1610     [ AC_MSG_RESULT(yes)
 1611       var_optreset_exists=yes],
 1612     [ AC_MSG_RESULT(no)
 1613       var_optreset_exists=no]
 1614 )
 1615 AM_CONDITIONAL(HAVE_OPTRESET, test "x$var_optreset_exists" != "xno")
 1616 AM_COND_IF([HAVE_OPTRESET], [AC_DEFINE([HAVE_OPTRESET], [1], [Check for optreset?])])
 1617 
 1618 AC_DEFINE([CONFIG_H_WAS_INCLUDED], [1], [config.h inclusion marker])
 1619 
 1620 # Autoconf 2.70 has runstatedir but is not yet released.
 1621 m4_version_prereq([2.70], [], [dnl
 1622     AC_ARG_VAR(runstatedir, [$localstatedir/run for autoconf < 2.70])dnl
 1623     AC_SUBST(runstatedir)dnl
 1624 ])
 1625 if test "x$runstatedir" = "x"; then
 1626     runstatedir="$localstatedir/run"
 1627 fi
 1628 
 1629 # Expand runstatedir to remove ${localstatedir} from it
 1630 if (echo ${runstatedir} | grep -q localstatedir); then
 1631     runstatedir="$(eval echo ${runstatedir})"
 1632 fi
 1633 
 1634 AC_CONFIG_FILES([Makefile
 1635                  doc/Makefile
 1636                  doc/sphinx/Makefile
 1637                  doc/devel/Makefile
 1638                  ext/Makefile
 1639                  ext/gtest/Makefile
 1640                  ext/coroutine/Makefile
 1641                  kea_version.h
 1642                  m4macros/Makefile
 1643                  src/Makefile
 1644                  src/bin/Makefile
 1645                  src/bin/admin/Makefile
 1646                  src/bin/admin/kea-admin
 1647                  src/bin/admin/tests/Makefile
 1648                  src/bin/admin/tests/cql_tests.sh
 1649                  src/bin/admin/tests/data/Makefile
 1650                  src/bin/admin/tests/memfile_tests.sh
 1651                  src/bin/admin/tests/mysql_tests.sh
 1652                  src/bin/admin/tests/pgsql_tests.sh
 1653                  src/bin/agent/Makefile
 1654                  src/bin/agent/tests/Makefile
 1655                  src/bin/agent/tests/ca_process_tests.sh
 1656                  src/bin/agent/tests/test_data_files_config.h
 1657                  src/bin/agent/tests/test_libraries.h
 1658                  src/bin/d2/Makefile
 1659                  src/bin/d2/tests/Makefile
 1660                  src/bin/d2/tests/d2_process_tests.sh
 1661                  src/bin/d2/tests/test_data_files_config.h
 1662                  src/bin/dhcp4/Makefile
 1663                  src/bin/dhcp4/tests/Makefile
 1664                  src/bin/dhcp4/tests/dhcp4_process_tests.sh
 1665                  src/bin/dhcp4/tests/marker_file.h
 1666                  src/bin/dhcp4/tests/test_data_files_config.h
 1667                  src/bin/dhcp4/tests/test_libraries.h
 1668                  src/bin/dhcp6/Makefile
 1669                  src/bin/dhcp6/tests/Makefile
 1670                  src/bin/dhcp6/tests/dhcp6_process_tests.sh
 1671                  src/bin/dhcp6/tests/marker_file.h
 1672                  src/bin/dhcp6/tests/test_data_files_config.h
 1673                  src/bin/dhcp6/tests/test_libraries.h
 1674                  src/bin/keactrl/Makefile
 1675                  src/bin/keactrl/keactrl
 1676                  src/bin/keactrl/keactrl.conf
 1677                  src/bin/keactrl/tests/Makefile
 1678                  src/bin/keactrl/tests/keactrl_tests.sh
 1679                  src/bin/lfc/Makefile
 1680                  src/bin/lfc/tests/Makefile
 1681                  src/bin/netconf/Makefile
 1682                  src/bin/netconf/tests/Makefile
 1683                  src/bin/netconf/tests/shtests/Makefile
 1684                  src/bin/netconf/tests/shtests/netconf_tests.sh
 1685                  src/bin/netconf/tests/test_data_files_config.h
 1686                  src/bin/netconf/tests/test_libraries.h
 1687                  src/bin/perfdhcp/Makefile
 1688                  src/bin/perfdhcp/tests/Makefile
 1689                  src/bin/perfdhcp/tests/testdata/Makefile
 1690                  src/bin/shell/Makefile
 1691                  src/bin/shell/kea-shell
 1692                  src/bin/shell/tests/Makefile
 1693                  src/bin/shell/tests/shell_process_tests.sh
 1694                  src/bin/shell/tests/shell_unittest.py
 1695                  src/hooks/Makefile
 1696                  src/hooks/dhcp/Makefile
 1697                  src/hooks/dhcp/high_availability/Makefile
 1698                  src/hooks/dhcp/high_availability/tests/Makefile
 1699                  src/hooks/dhcp/lease_cmds/Makefile
 1700                  src/hooks/dhcp/lease_cmds/tests/Makefile
 1701                  src/hooks/dhcp/mysql_cb/Makefile
 1702                  src/hooks/dhcp/mysql_cb/tests/Makefile
 1703                  src/hooks/dhcp/user_chk/Makefile
 1704                  src/hooks/dhcp/user_chk/tests/Makefile
 1705                  src/hooks/dhcp/user_chk/tests/test_data_files_config.h
 1706                  src/hooks/dhcp/stat_cmds/Makefile
 1707                  src/hooks/dhcp/stat_cmds/tests/Makefile
 1708                  src/lib/Makefile
 1709                  src/lib/asiodns/Makefile
 1710                  src/lib/asiodns/tests/Makefile
 1711                  src/lib/asiolink/Makefile
 1712                  src/lib/asiolink/testutils/Makefile
 1713                  src/lib/asiolink/tests/Makefile
 1714                  src/lib/cc/Makefile
 1715                  src/lib/cc/tests/Makefile
 1716                  src/lib/cfgrpt/Makefile
 1717                  src/lib/cfgrpt/tests/Makefile
 1718                  src/lib/config/Makefile
 1719                  src/lib/config/tests/Makefile
 1720                  src/lib/config/tests/data_def_unittests_config.h
 1721                  src/lib/config/tests/testdata/Makefile
 1722                  src/lib/config_backend/Makefile
 1723                  src/lib/config_backend/tests/Makefile
 1724                  src/lib/cryptolink/Makefile
 1725                  src/lib/cryptolink/tests/Makefile
 1726                  src/lib/database/Makefile
 1727                  src/lib/database/tests/Makefile
 1728                  src/lib/database/testutils/Makefile
 1729                  src/lib/dhcp/Makefile
 1730                  src/lib/dhcp/tests/Makefile
 1731                  src/lib/dhcp_ddns/Makefile
 1732                  src/lib/dhcp_ddns/tests/Makefile
 1733                  src/lib/dhcpsrv/Makefile
 1734                  src/lib/dhcpsrv/benchmarks/Makefile
 1735                  src/lib/dhcpsrv/tests/Makefile
 1736                  src/lib/dhcpsrv/tests/test_libraries.h
 1737                  src/lib/dhcpsrv/testutils/Makefile
 1738                  src/lib/dns/Makefile
 1739                  src/lib/dns/gen-rdatacode.py
 1740                  src/lib/dns/tests/Makefile
 1741                  src/lib/dns/tests/testdata/Makefile
 1742                  src/lib/eval/Makefile
 1743                  src/lib/eval/tests/Makefile
 1744                  src/lib/exceptions/Makefile
 1745                  src/lib/exceptions/tests/Makefile
 1746                  src/lib/hooks/Makefile
 1747                  src/lib/hooks/tests/Makefile
 1748                  src/lib/hooks/tests/marker_file.h
 1749                  src/lib/hooks/tests/test_libraries.h
 1750                  src/lib/http/Makefile
 1751                  src/lib/http/tests/Makefile
 1752                  src/lib/log/Makefile
 1753                  src/lib/log/compiler/Makefile
 1754                  src/lib/log/interprocess/Makefile
 1755                  src/lib/log/interprocess/tests/Makefile
 1756                  src/lib/log/tests/Makefile
 1757                  src/lib/log/tests/buffer_logger_test.sh
 1758                  src/lib/log/tests/console_test.sh
 1759                  src/lib/log/tests/destination_test.sh
 1760                  src/lib/log/tests/init_logger_test.sh
 1761                  src/lib/log/tests/local_file_test.sh
 1762                  src/lib/log/tests/logger_lock_test.sh
 1763                  src/lib/log/tests/severity_test.sh
 1764                  src/lib/log/tests/tempdir.h
 1765                  src/lib/mysql/Makefile
 1766                  src/lib/mysql/testutils/Makefile
 1767                  src/lib/mysql/tests/Makefile
 1768                  src/lib/pgsql/Makefile
 1769                  src/lib/pgsql/tests/Makefile
 1770                  src/lib/pgsql/testutils/Makefile
 1771                  src/lib/cql/Makefile
 1772                  src/lib/cql/tests/Makefile
 1773                  src/lib/cql/testutils/Makefile
 1774                  src/lib/process/Makefile
 1775                  src/lib/process/tests/Makefile
 1776                  src/lib/process/testutils/Makefile
 1777                  src/lib/stats/Makefile
 1778                  src/lib/stats/tests/Makefile
 1779                  src/lib/testutils/Makefile
 1780                  src/lib/testutils/dhcp_test_lib.sh
 1781                  src/lib/util/Makefile
 1782                  src/lib/util/io/Makefile
 1783                  src/lib/util/python/Makefile
 1784                  src/lib/util/python/gen_wiredata.py
 1785                  src/lib/util/tests/Makefile
 1786                  src/lib/util/tests/process_spawn_app.sh
 1787                  src/lib/util/threads/Makefile
 1788                  src/lib/util/threads/tests/Makefile
 1789                  src/lib/util/unittests/Makefile
 1790                  src/lib/yang/Makefile
 1791                  src/lib/yang/pretests/Makefile
 1792                  src/lib/yang/tests/Makefile
 1793                  src/lib/yang/testutils/Makefile
 1794                  src/share/Makefile
 1795                  src/share/database/Makefile
 1796                  src/share/database/scripts/Makefile
 1797                  src/share/database/scripts/cql/Makefile
 1798                  src/share/database/scripts/cql/upgrade_1.0_to_2.0.sh
 1799                  src/share/database/scripts/cql/upgrade_2.0_to_3.0.sh
 1800                  src/share/database/scripts/cql/upgrade_3.0_to_4.0.sh
 1801                  src/share/database/scripts/cql/wipe_data.sh
 1802                  src/share/database/scripts/mysql/Makefile
 1803                  src/share/database/scripts/mysql/upgrade_1.0_to_2.0.sh
 1804                  src/share/database/scripts/mysql/upgrade_2.0_to_3.0.sh
 1805                  src/share/database/scripts/mysql/upgrade_3.0_to_4.0.sh
 1806                  src/share/database/scripts/mysql/upgrade_4.0_to_4.1.sh
 1807                  src/share/database/scripts/mysql/upgrade_4.1_to_5.0.sh
 1808                  src/share/database/scripts/mysql/upgrade_5.0_to_5.1.sh
 1809                  src/share/database/scripts/mysql/upgrade_5.1_to_5.2.sh
 1810                  src/share/database/scripts/mysql/upgrade_5.2_to_6.0.sh
 1811                  src/share/database/scripts/mysql/upgrade_6.0_to_7.0.sh
 1812                  src/share/database/scripts/mysql/upgrade_7.0_to_8.0.sh
 1813                  src/share/database/scripts/mysql/upgrade_8.0_to_8.1.sh
 1814                  src/share/database/scripts/mysql/upgrade_8.1_to_8.2.sh
 1815                  src/share/database/scripts/mysql/wipe_data.sh
 1816                  src/share/database/scripts/pgsql/Makefile
 1817                  src/share/database/scripts/pgsql/upgrade_1.0_to_2.0.sh
 1818                  src/share/database/scripts/pgsql/upgrade_2.0_to_3.0.sh
 1819                  src/share/database/scripts/pgsql/upgrade_3.0_to_3.1.sh
 1820                  src/share/database/scripts/pgsql/upgrade_3.1_to_3.2.sh
 1821                  src/share/database/scripts/pgsql/upgrade_3.2_to_3.3.sh
 1822                  src/share/database/scripts/pgsql/upgrade_3.3_to_4.0.sh
 1823                  src/share/database/scripts/pgsql/upgrade_4.0_to_5.0.sh
 1824                  src/share/database/scripts/pgsql/upgrade_5.0_to_5.1.sh
 1825                  src/share/database/scripts/pgsql/wipe_data.sh
 1826                  src/share/yang/Makefile
 1827                  src/share/yang/modules/Makefile
 1828                  tools/Makefile
 1829                  tools/path_replacer.sh
 1830 ])
 1831 
 1832 AC_CONFIG_COMMANDS([permissions], [
 1833            chmod +x src/bin/admin/kea-admin
 1834            chmod +x src/bin/dhcp4/tests/dhcp4_process_tests.sh
 1835            chmod +x src/bin/dhcp6/tests/dhcp6_process_tests.sh
 1836            chmod +x src/bin/keactrl/keactrl
 1837            chmod +x src/bin/keactrl/tests/keactrl_tests.sh
 1838            chmod +x src/bin/shell/kea-shell
 1839            chmod +x src/bin/shell/tests/shell_process_tests.sh
 1840            chmod +x src/bin/shell/tests/shell_unittest.py
 1841            chmod +x src/lib/dns/gen-rdatacode.py
 1842            chmod +x src/lib/log/tests/buffer_logger_test.sh
 1843            chmod +x src/lib/log/tests/console_test.sh
 1844            chmod +x src/lib/log/tests/destination_test.sh
 1845            chmod +x src/lib/log/tests/init_logger_test.sh
 1846            chmod +x src/lib/log/tests/local_file_test.sh
 1847            chmod +x src/lib/log/tests/logger_lock_test.sh
 1848            chmod +x src/lib/log/tests/severity_test.sh
 1849            chmod +x src/lib/util/python/gen_wiredata.py
 1850            chmod +x src/lib/util/tests/process_spawn_app.sh
 1851            chmod +x tools/path_replacer.sh
 1852 ])
 1853 
 1854 AC_OUTPUT
 1855 
 1856 dnl Print the results
 1857 dnl
 1858 
 1859 EXTENDED_VERSION=${PACKAGE_VERSION}
 1860 if test "$KEA_SRCID" != ""; then
 1861    EXTENDED_VERSION="${EXTENDED_VERSION} ($KEA_SRCID)"
 1862 fi
 1863 
 1864 # By default the following variables are defined:
 1865 # - prefix = /usr/local
 1866 # - exec_prefix = ${prefix}
 1867 # - libdir = ${exec_prefix}/lib
 1868 # The exec_prefix and libdir variables contain unexpanded,literal ${prefix}.
 1869 # This is done on purpose. The idea is to be able to make this expansion
 1870 # late, so use can do:
 1871 # make install prefix=/my/own/prefix
 1872 #
 1873 # Now, we want to print those directories in the config.report, but we
 1874 # don't want to modify the actual variables. So we need to expand them.
 1875 # Since libdir contains $exec_prefix and exec_prefix contains $prefix, then
 1876 # to get the real value, we need to expand it twice.
 1877 libdir_real="$(eval echo ${libdir})"
 1878 libdir_real="$(eval echo ${libdir_real})"
 1879 
 1880 cat > config.report << END
 1881 
 1882        Kea source configure results:
 1883     -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 1884 
 1885 Package:
 1886   Name:              ${PACKAGE_NAME}
 1887   Version:           ${PACKAGE_VERSION}
 1888   Extended version:  ${EXTENDED_VERSION}
 1889   OS Family:         ${OS_TYPE}
 1890 
 1891   Prefix:            ${prefix}
 1892   Hooks directory:   ${libdir_real}/kea/hooks
 1893 END
 1894 if test "$PREMIUM" != ""; then
 1895 cat >> config.report << END
 1896   Premium hooks:     yes
 1897   Included Hooks:   ${INCLUDED_HOOKS}
 1898 END
 1899 else
 1900 cat >> config.report << END
 1901   Premium hooks:     no
 1902 END
 1903 fi
 1904 cat >> config.report << END
 1905 
 1906 C++ Compiler:
 1907   CXX:             ${CXX}
 1908   CXX_VERSION:     ${CXX_VERSION}
 1909   CXX_STANDARD:    ${CXX_STANDARD}
 1910   DEFS:            ${DEFS}
 1911   CPPFLAGS:        ${CPPFLAGS}
 1912   CXXFLAGS:        ${CXXFLAGS}
 1913   LDFLAGS:         ${LDFLAGS}
 1914   KEA_CXXFLAGS:    ${KEA_CXXFLAGS}
 1915 END
 1916 
 1917 if test "$PYTHON" != "no" ; then
 1918 cat >> config.report << END
 1919 
 1920 Python:
 1921   PYTHON:          ${PYTHON}
 1922   PYTHON_VERSION:  ${PYTHON_VERSION}
 1923 
 1924 END
 1925 else
 1926 cat >> config.report << END
 1927 
 1928 Python:
 1929   PYTHON_VERSION:  not needed (because kea-shell is disabled)
 1930 
 1931 END
 1932 fi
 1933 
 1934 cat >> config.report << END
 1935 Boost:
 1936   BOOST_VERSION:   ${BOOST_VERSION}
 1937   BOOST_INCLUDES:  ${BOOST_INCLUDES}
 1938   BOOST_LIBS:      ${BOOST_LIBS}
 1939 
 1940 END
 1941 if test x"$BOOST_LIBS" = "x"; then
 1942    cat >> config.report << END
 1943     WARNING: You will be building with boost headers only rather
 1944     than linking with boost_system library. This is NOT recommended as
 1945     it may result in non-optimized code on some platforms and
 1946     introduce runtime errors on others.
 1947 
 1948 END
 1949 fi
 1950 
 1951 cat >> config.report << END
 1952 ${CRYPTO_NAME}:
 1953   CRYPTO_VERSION:  ${CRYPTO_VERSION}
 1954   CRYPTO_CFLAGS:   ${CRYPTO_CFLAGS}
 1955   CRYPTO_INCLUDES: ${CRYPTO_INCLUDES}
 1956   CRYPTO_LDFLAGS:  ${CRYPTO_LDFLAGS}
 1957   CRYPTO_LIBS:     ${CRYPTO_LIBS}
 1958 
 1959 ${DISABLED_CRYPTO}: no
 1960 
 1961 Log4cplus:
 1962   LOG4CPLUS_VERSION:  ${LOG4CPLUS_VERSION}
 1963   LOG4CPLUS_INCLUDES: ${LOG4CPLUS_INCLUDES}
 1964   LOG4CPLUS_LIBS:     ${LOG4CPLUS_LIBS}
 1965 
 1966 Flex/bison:
 1967   FLEX:  ${LEX}
 1968   BISON: ${YACC}
 1969 END
 1970 
 1971 # Avoid confusion on DNS/DHCP and only mention MySQL if it
 1972 # were specified on the command line.
 1973 if test "$MYSQL_CPPFLAGS" != "" ; then
 1974 cat >> config.report << END
 1975 
 1976 MySQL:
 1977   MYSQL_VERSION:   ${MYSQL_VERSION}
 1978   MYSQL_CPPFLAGS:  ${MYSQL_CPPFLAGS}
 1979   MYSQL_LIBS:      ${MYSQL_LIBS}
 1980 END
 1981 else
 1982 cat >> config.report << END
 1983 
 1984 MySQL:
 1985   no
 1986 END
 1987 fi
 1988 
 1989 if test "$PGSQL_CPPFLAGS" != "" ; then
 1990 cat >> config.report << END
 1991 
 1992 PostgreSQL:
 1993   PGSQL_VERSION:   ${PGSQL_VERSION}
 1994   PGSQL_CPPFLAGS:  ${PGSQL_CPPFLAGS}
 1995   PGSQL_LIBS:      ${PGSQL_LIBS}
 1996 END
 1997 else
 1998 cat >> config.report << END
 1999 
 2000 PostgreSQL:
 2001   no
 2002 END
 2003 fi
 2004 
 2005 if test "$CQL_CPPFLAGS" != "" ; then
 2006 cat >> config.report << END
 2007 
 2008 Cassandra CQL:
 2009   CQL_VERSION:     ${CQL_VERSION}
 2010   CQL_CPPFLAGS:    ${CQL_CPPFLAGS}
 2011   CQL_LIBS:        ${CQL_LIBS}
 2012 END
 2013 else
 2014 cat >> config.report << END
 2015 
 2016 Cassandra CQL:
 2017   no
 2018 END
 2019 fi
 2020 
 2021 if test "$SYSREPO_CPPFLAGS" != "" ; then
 2022 cat >> config.report << END
 2023 
 2024 Sysrepo:
 2025   SYSREPO_VERSION:     ${SYSREPO_VERSION}
 2026   SYSREPO_CPPFLAGS:    ${SYSREPO_CPPFLAGS}
 2027   SYSREPO_LIBS:        ${SYSREPO_LIBS}
 2028   SYSREPO_REPO:        ${SYSREPO_REPO}
 2029 END
 2030 else
 2031 cat >> config.report << END
 2032 
 2033 Sysrepo:
 2034   no
 2035 END
 2036 fi
 2037 
 2038 if test "$enable_gtest" != "no"; then
 2039 cat >> config.report << END
 2040 
 2041 Google Test:
 2042   GTEST_VERSION:   ${GTEST_VERSION}
 2043   GTEST_INCLUDES:  ${GTEST_INCLUDES}
 2044   GTEST_LDFLAGS:   ${GTEST_LDFLAGS}
 2045   GTEST_LDADD:     ${GTEST_LDADD}
 2046   GTEST_SOURCE:    ${GTEST_SOURCE}
 2047 END
 2048 else
 2049 cat >> config.report << END
 2050 
 2051 Google Test:
 2052   no
 2053 END
 2054 fi
 2055 
 2056 if test "$enable_benchmark" != "no"; then
 2057 cat >> config.report << END
 2058 
 2059 Google Benchmark:
 2060   BENCHMARK_VERSION:   ${BENCHMARK_VERSION}
 2061   BENCHMARK_CPPFLAGS:  ${BENCHMARK_CPPFLAGS}
 2062   BENCHMARK_INCLUDES:  ${BENCHMARK_INCLUDES}
 2063   BENCHMARK_LDFLAGS:   ${BENCHMARK_LDFLAGS}
 2064   BENCHMARK_LDADD:     ${BENCHMARK_LDADD}
 2065   BENCHMARK_SOURCE:    ${BENCHMARK_SOURCE}
 2066 END
 2067 else
 2068 cat >> config.report << END
 2069 
 2070 Google Benchmark:
 2071   no
 2072 END
 2073 fi
 2074 
 2075 if test "$FREERADIUS_INCLUDE" != ""; then
 2076 cat >> config.report << END
 2077 
 2078 FreeRADIUS client:
 2079   FREERADIUS_INCLUDE:    ${FREERADIUS_INCLUDE}
 2080   FREERADIUS_LIB:        ${FREERADIUS_LIB}
 2081   FREERADIUS_DICTIONARY: ${FREERADIUS_DICTIONARY}
 2082 END
 2083 fi
 2084 
 2085 cat >> config.report << END
 2086 
 2087 Developer:
 2088   Enable Debugging:          $debug_enabled
 2089   Google Tests:              $enable_gtest
 2090   Google Benchmark:          $enable_benchmark
 2091   Valgrind:                  $found_valgrind
 2092   C++ Code Coverage:         $USE_LCOV
 2093   Logger checks:             $enable_logger_checks
 2094   Generate Documentation:    $generate_docs_report
 2095   Generate Parser:           $enable_generate_parser
 2096   Generate Messages Files:   $enable_generate_messages
 2097   Perfdhcp:                  $enable_perfdhcp
 2098   Kea-shell:                 $shell_report
 2099 
 2100 END
 2101 
 2102 cat config.report
 2103 cat <<EOF
 2104 
 2105   Now you can type "make" to build Kea. Note that if you intend to
 2106   run "make check", you must run "make" first as some files need to be
 2107   generated by "make" before "make check" can be run.
 2108 
 2109   When running "make install" do not use any form of parallel or job
 2110   server options (such as GNU make's -j option). Doing so may cause
 2111   errors.
 2112 
 2113 EOF