Commit 33ff07e7 authored by Daniel Salzman's avatar Daniel Salzman

configure: improve dependency check for dnstap

parent 97396269
......@@ -318,17 +318,30 @@ AM_SUBST_NOTMAKE([STATIC_MODULES_INIT])
AC_SUBST([DOC_MODULES], [$(printf "$doc_modules")])
AM_SUBST_NOTMAKE([DOC_MODULES])
opt_dnstap=no
AS_IF([test "$enable_daemon" = "yes" -o "$enable_utilities" = "yes"],[
dnl Check for dnstap.
dt_DNSTAP([
AC_DEFINE([USE_DNSTAP], [1], [Define to 1 to enable dnstap support for kdig])
AC_SUBST(DNSTAP_CFLAGS)
AC_SUBST(DNSTAP_LIBS)
])
# Check for Dnstap
AC_ARG_ENABLE([dnstap],
AS_HELP_STRING([--enable-dnstap], [Enable dnstap support for kdig (requires fstrm, protobuf-c)]),
[], [enable_dnstap=no])
AS_IF([test "$enable_dnstap" != "no" -o "$STATIC_MODULE_dnstap" != "no" -o "$SHARED_MODULE_dnstap" != "no"],[
AC_PATH_PROG([PROTOC_C], [protoc-c])
AS_IF([test -z "$PROTOC_C"],[
AC_MSG_ERROR([The protoc-c program was not found. Please install protobuf-c!])
])
PKG_CHECK_MODULES([libfstrm], [libfstrm])
PKG_CHECK_MODULES([libprotobuf_c], [libprotobuf-c >= 1.0.0])
AC_SUBST([DNSTAP_CFLAGS], ["$libfstrm_CFLAGS $libprotobuf_c_CFLAGS"])
AC_SUBST([DNSTAP_LIBS], ["$libfstrm_LIBS $libprotobuf_c_LIBS"])
])
AS_IF([test "$enable_dnstap" != "no"],[
AC_DEFINE([USE_DNSTAP], [1], [Define to 1 to enable dnstap support for kdig])
])
AM_CONDITIONAL([HAVE_DNSTAP], test "$enable_dnstap" != "no")
AM_CONDITIONAL([HAVE_DNSTAP], test "$opt_dnstap" != "no")
AM_CONDITIONAL([HAVE_LIBDNSTAP], test "$enable_dnstap" != "no" -o \
"$STATIC_MODULE_dnstap" != "no" -o \
"$SHARED_MODULE_dnstap" != "no")
dnl Check for LMDB
lmdb_MIN_VERSION_MAJOR=0
......@@ -565,7 +578,7 @@ result_msg_base=" Knot DNS $VERSION
Use SO_REUSEPORT: ${enable_reuseport}
Fast zone parser: ${enable_fastparser}
Utilities with IDN: ${with_libidn}
Utilities with Dnstap: ${opt_dnstap}
Utilities with Dnstap: ${enable_dnstap}
Systemd integration: ${enable_systemd}
PKCS #11 support: ${enable_pkcs11}
Ed25519 support: ${enable_ed25519}
......
# dnstap.m4
# dt_DNSTAP([action-if-true], [action-if-false])
# --------------------------------------------------------------------------
# Check for required dnstap libraries and add dnstap configure args.
AC_DEFUN([dt_DNSTAP],
[
AC_ARG_ENABLE([dnstap],
AS_HELP_STRING([--enable-dnstap],
[Enable dnstap support for kdig (requires fstrm, protobuf-c)]),
[opt_dnstap=$enableval], [opt_dnstap=no])
AS_IF([test "$STATIC_MODULE_dnstap" != "no" -o "$SHARED_MODULE_dnstap" != "no"],
[opt_dnstap=yes])
AS_IF([test "$opt_dnstap" != "no"],[
AC_PATH_PROG([PROTOC_C], [protoc-c])
AS_IF([test -z "$PROTOC_C"],[
AC_MSG_ERROR([The protoc-c program was not found. Please install protobuf-c!])
])
PKG_CHECK_MODULES([libfstrm], [libfstrm])
PKG_CHECK_MODULES([libprotobuf_c], [libprotobuf-c >= 1.0.0])
DNSTAP_CFLAGS="$libfstrm_CFLAGS $libprotobuf_c_CFLAGS"
DNSTAP_LIBS="$libfstrm_LIBS $libprotobuf_c_LIBS"
$1
m4_ifvaln([$2], [else
$2])dnl
])
])
......@@ -65,7 +65,12 @@ libcontrib_la_SOURCES += \
contrib/lmdb/midl.h
endif !HAVE_LMDB
if HAVE_DNSTAP
if HAVE_LIBDNSTAP
noinst_LTLIBRARIES += libdnstap.la
libdnstap_la_CPPFLAGS = $(AM_CPPFLAGS) $(DNSTAP_CFLAGS)
libdnstap_la_LDFLAGS = $(AM_LDFLAGS) $(DNSTAP_LIBS)
SUFFIXES = .proto .pb-c.c .pb-c.h
.proto.pb-c.c:
......@@ -74,7 +79,7 @@ SUFFIXES = .proto .pb-c.c .pb-c.h
.proto.pb-c.h:
$(AM_V_GEN)@PROTOC_C@ --c_out=. -I$(srcdir) $<
libcontrib_la_SOURCES += \
libdnstap_la_SOURCES = \
contrib/dnstap/convert.c \
contrib/dnstap/convert.h \
contrib/dnstap/dnstap.c \
......@@ -86,13 +91,10 @@ libcontrib_la_SOURCES += \
contrib/dnstap/writer.c \
contrib/dnstap/writer.h
nodist_libcontrib_la_SOURCES = \
nodist_libdnstap_la_SOURCES = \
contrib/dnstap/dnstap.pb-c.c \
contrib/dnstap/dnstap.pb-c.h
libcontrib_la_CPPFLAGS += $(DNSTAP_CFLAGS)
libcontrib_la_LDFLAGS += $(DNSTAP_LIBS)
BUILT_SOURCES += $(nodist_libcontrib_la_SOURCES)
CLEANFILES += $(nodist_libcontrib_la_SOURCES)
endif HAVE_DNSTAP
BUILT_SOURCES += $(nodist_libdnstap_la_SOURCES)
CLEANFILES += $(nodist_libdnstap_la_SOURCES)
endif HAVE_LIBDNSTAP
......@@ -4,12 +4,12 @@ EXTRA_DIST += knot/modules/dnstap/dnstap.rst
if STATIC_MODULE_dnstap
libknotd_la_SOURCES += $(knot_modules_dnstap_la_SOURCES)
libknotd_la_CPPFLAGS += $(DNSTAP_CFLAGS)
libknotd_la_LIBADD += $(DNSTAP_LIBS) libcontrib.la
libknotd_la_LIBADD += $(DNSTAP_LIBS) libdnstap.la
endif
if SHARED_MODULE_dnstap
knot_modules_dnstap_la_LDFLAGS = $(KNOTD_MOD_LDFLAGS)
knot_modules_dnstap_la_CPPFLAGS = $(KNOTD_MOD_CPPFLAGS) $(DNSTAP_CFLAGS)
knot_modules_dnstap_la_LIBADD = $(DNSTAP_LIBS) libcontrib.la
knot_modules_dnstap_la_LIBADD = $(DNSTAP_LIBS) libdnstap.la
pkglib_LTLIBRARIES += knot/modules/dnstap.la
endif
......@@ -67,6 +67,13 @@ knsec3hash_CPPFLAGS = $(AM_CPPFLAGS)
knsec3hash_LDADD = libcontrib.la libdnssec.la libknot.la libshared.la
knsupdate_CPPFLAGS = $(AM_CPPFLAGS) $(gnutls_CFLAGS)
knsupdate_LDADD = libknotus.la libzscanner.la
if HAVE_DNSTAP
kdig_LDADD += $(DNSTAP_LIBS) libdnstap.la
khost_LDADD += $(DNSTAP_LIBS) libdnstap.la
kdig_CPPFLAGS += $(DNSTAP_CFLAGS)
khost_CPPFLAGS += $(DNSTAP_CFLAGS)
endif HAVE_DNSTAP
endif HAVE_UTILS
if HAVE_DAEMON
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment