Skip to content
Snippets Groups Projects
Commit 68812462 authored by Ondřej Surý's avatar Ondřej Surý
Browse files

Allow disabling of daemon, utilities and documentation build

parent 5a06e8fc
Branches
Tags
No related merge requests found
......@@ -36,44 +36,32 @@ LT_INIT
m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR], [AC_SUBST([pkgconfigdir], ['${libdir}/pkgconfig'])])
AC_CONFIG_FILES([libknot.pc])
AC_CACHE_CHECK([for reentrant lex], [ac_cv_path_LEX],
[AC_PATH_PROGS_FEATURE_CHECK([LEX], [$LEX flex gflex],
[cat >conftest.l <<_ACEOF
%{
%}
# Build Knot DNS daemon
AC_ARG_ENABLE([daemon],
AS_HELP_STRING([--disable-daemon], [Don't build Knot DNS main daemon]), [], [enable_daemon=yes])
AM_CONDITIONAL([HAVE_DAEMON], [test "$enable_daemon" = "yes"])
%option reentrant
%option bison-bridge
%option noinput
%option nounput
%option noreject
# Build Knot DNS utilities
AC_ARG_ENABLE([utilities],
AS_HELP_STRING([--disable-utilities], [Don't build Knot DNS utilities]), [], [enable_utilities=yes])
AM_CONDITIONAL([HAVE_UTILS], [test "$enable_utilities" = "yes"])
BLANK [ \t\n]
# Build Knot DNS documentation
AC_ARG_ENABLE([documentation],
AS_HELP_STRING([--disable-documentation], [Don't build Knot DNS documentation]), [], [enable_documentation=yes])
AM_CONDITIONAL([HAVE_DOCS], [test "$enable_documentation" = "yes"])
%%
<<EOF>> return 0;
%%
_ACEOF
_AC_DO_VAR(ac_path_LEX conftest.l)
test $ac_status -eq 0 && ac_cv_path_LEX=$ac_path_LEX ac_path_LEX_found=true
rm -f conftest.l lexyy.c lex.yy.c
],
[AC_MSG_ERROR([could not find lex that supports reentrant parsers])])])
AC_SUBST([LEX], [$ac_cv_path_LEX])
AM_PROG_LEX
######################
# Generic dependencies
######################
AC_PROG_YACC
YACC_BISON=`bison --version | awk '{print $1;exit}'`
AS_IF([test "x$YACC_BISON" != "xbison"],
[AC_MSG_ERROR([GNU bison needed for reentrant parsers, set the \$YACC variable before running configure])])
AC_PROG_INSTALL
# Set zone parser type
AC_ARG_ENABLE([fastparser],
AS_HELP_STRING([--disable-fastparser], [Use slower zone parser]),
[], [enable_fastparser=yes])
AM_CONDITIONAL([FAST_PARSER], [test "$enable_fastparser" = yes])
AM_CONDITIONAL([FAST_PARSER], [test "$enable_fastparser" = "yes"])
# GnuTLS crypto backend
PKG_CHECK_MODULES([gnutls], [gnutls >= 3.0 nettle])
......@@ -81,21 +69,6 @@ PKG_CHECK_MODULES([gnutls], [gnutls >= 3.0 nettle])
# JSON for DNSSEC status storage
PKG_CHECK_MODULES([jansson], [jansson >= 2.3])
# Systemd integration
AC_ARG_ENABLE([systemd],
AS_HELP_STRING([--enable-systemd=auto|yes|no], [enable systemd integration [default=auto]]),
[enable_systemd="$enableval"], [enable_systemd=auto])
AS_IF([test "$enable_system" != "no"],[
AS_CASE([$enable_systemd],
[auto],[PKG_CHECK_MODULES([systemd], [libsystemd-daemon libsystemd-journal], [enable_systemd=yes], [enable_systemd=no])],
[yes],[PKG_CHECK_MODULES([systemd], [libsystemd-daemon libsystemd-journal])],
[*],[AC_MSG_ERROR([Invalid value of --enable-systemd.])])
])
AS_IF([test "$enable_systemd" = "yes"],[
AC_DEFINE([ENABLE_SYSTEMD], [1], [Use systemd integration.])])
# Debug modules
AC_ARG_ENABLE([debug],
AS_HELP_STRING([--enable-debug=server,zones,ns,loader,dnssec],
......@@ -183,17 +156,74 @@ AC_ARG_WITH([configdir],
[config_dir=$withval])
AC_SUBST(config_dir)
# Checks for libraries.
# FIXME: Replace `main' with a function in `-lm':
#########################################
# Dependencies needed for Knot DNS daemon
#########################################
AS_IF([test "$enable_daemon" = "yes"],[
AC_CACHE_CHECK([for reentrant lex], [ac_cv_path_LEX],
[AC_PATH_PROGS_FEATURE_CHECK([LEX], [$LEX flex gflex],
[cat >conftest.l <<_ACEOF
%{
%}
%option reentrant
%option bison-bridge
%option noinput
%option nounput
%option noreject
BLANK [ \t\n]
%%
<<EOF>> return 0;
%%
_ACEOF
_AC_DO_VAR(ac_path_LEX conftest.l)
test $ac_status -eq 0 && ac_cv_path_LEX=$ac_path_LEX ac_path_LEX_found=true
rm -f conftest.l lexyy.c lex.yy.c
],
[AC_MSG_ERROR([could not find lex that supports reentrant parsers])])])
AC_SUBST([LEX], [$ac_cv_path_LEX])
AM_PROG_LEX
AC_PROG_YACC
YACC_BISON=`bison --version | awk '{print $1;exit}'`
AS_IF([test "x$YACC_BISON" != "xbison"],
[AC_MSG_ERROR([GNU bison needed for reentrant parsers, set the \$YACC variable before running configure])])
])
# Systemd integration
AC_ARG_ENABLE([systemd],
AS_HELP_STRING([--enable-systemd=auto|yes|no], [enable systemd integration [default=auto]]),
[enable_systemd="$enableval"], [enable_systemd=auto])
AS_IF([test "$enable_daemon" = "yes"],[
AS_IF([test "$enable_system" != "no"],[
AS_CASE([$enable_systemd],
[auto],[PKG_CHECK_MODULES([systemd], [libsystemd-daemon libsystemd-journal], [enable_systemd=yes], [enable_systemd=no])],
[yes],[PKG_CHECK_MODULES([systemd], [libsystemd-daemon libsystemd-journal])],
[*],[AC_MSG_ERROR([Invalid value of --enable-systemd.])])
])
AS_IF([test "$enable_systemd" = "yes"],[
AC_DEFINE([ENABLE_SYSTEMD], [1], [Use systemd integration.])])
])
dnl Check for userspace-rcu library
AC_ARG_WITH(urcu,
[ --with-urcu=DIR where to find userspace-rcu library])
AS_IF([test "$enable_daemon" = "yes"],[
AS_IF([test "$with_urcu" != "no"], [
PKG_CHECK_MODULES([liburcu], liburcu, [
CPPFLAGS="$CPPFLAGS $liburcu_CFLAGS"
LIBS="$LIBS $liburcu_LIBS"
liburcu_PKGCONFIG="liburcu"
AC_SUBST([liburcu_PKGCONFIG])
with_urcu=yes
],[
for try_urcu in "$with_urcu" "" "/usr/local"; do
......@@ -213,6 +243,8 @@ AS_IF([test "$with_urcu" != "no"], [
AC_SEARCH_LIBS([rcu_set_pointer_sym], [urcu], [
with_urcu=yes
AC_SUBST([liburcu_CFLAGS])
AC_SUBST([liburcu_LIBS])
break
],[
CPPFLAGS="$save_CPPFLAGS"
......@@ -225,34 +257,23 @@ AS_IF([test "$with_urcu" != "no"], [
AS_IF([test "$with_urcu" = "no"],[
AC_MSG_ERROR([liburcu is required])
])
],[
])
])
])
AC_SEARCH_LIBS([urcu_init], [urcu], [AC_MSG_ERROR([liburcu is too old (< 0.4.0), urcu_init symbol found])], [])
])
dnl Check for libidn.
AC_ARG_WITH(libidn,
AC_HELP_STRING([--with-libidn=[DIR]], [Support IDN (needs GNU Libidn)]),
with_libidn=$withval,
with_libidn=yes
)
AS_IF([test "$with_libidn" != "no"],[
PKG_CHECK_MODULES([libidn], [libidn >= 0.0.0], [
with_libidn=yes
AC_DEFINE([LIBIDN], [1], [Define to 1 to enable IDN support])
],[
with_libidn=no
AC_MSG_WARN([libidn not found])
])])
opt_dnstap=no
AS_IF([test "$enable_daemon" = "yes"],[
dnl Check for dnstap.
dt_DNSTAP([
LIBS="$LIBS $DNSTAP_LIBS"
CPPFLAGS="$CPPFLAGS $DNSTAP_CFLAGS"
AC_DEFINE([USE_DNSTAP], [1], [Define to 1 to enable dnstap support])
])
])
AM_CONDITIONAL([HAVE_DNSTAP], test "$opt_dnstap" != "no")
......@@ -264,6 +285,7 @@ AC_ARG_WITH([lmdb],
])
have_lmdb=no
AS_IF([test "$with_lmdb" != "no"],[
save_CPPFLAGS=$CPPFLAGS
save_LIBS=$LIBS
......@@ -283,6 +305,7 @@ AS_IF([test "$with_lmdb" != "no"],[
AC_SEARCH_LIBS([mdb_env_open], [lmdb], [
AC_CHECK_HEADERS([lmdb.h], [], [
AC_ERROR([lmdb headers not found in `$try_lmdb', is your installation complete?])])
lmdb_LIBS="-llmdb"
have_lmdb=yes
break
],[
......@@ -297,19 +320,46 @@ AS_IF([test "$with_lmdb" != "no"],[
])
AS_IF([test "$have_lmdb" != "no"],[
enable_lmdb=shared
],[
enable_lmdb=embedded
])
AC_SUBST([lmdb_CFLAGS])
AC_SUBST([lmdb_LIBS])
enable_lmdb=shared
],[enable_lmdb=embedded])
AM_CONDITIONAL([HAVE_LMDB], test "$have_lmdb" != "no")
AS_IF([test "$enable_daemon" = "yes"],[
dnl Check for rosedb module
AC_ARG_ENABLE([rosedb],
AS_HELP_STRING([--disable-rosedb], [Do not enable static RR query module.]),
[], [enable_rosedb=no])
AM_CONDITIONAL([HAVE_ROSEDB], [test "$enable_rosedb" = yes])
]) # Knot DNS daemon dependencies
AS_IF([test "$enable_rosedb" = yes], [AC_DEFINE([HAVE_ROSEDB], [1], [Define to 1 to enable static RR query module.])])
AM_CONDITIONAL([HAVE_ROSEDB], [test "$enable_rosedb" = yes])
############################################
# Dependencies needed for Knot DNS utilities
############################################
dnl Check for libidn.
AC_ARG_WITH(libidn,
AC_HELP_STRING([--with-libidn=[DIR]], [Support IDN (needs GNU Libidn)]),
with_libidn=$withval,
with_libidn=yes
)
AS_IF([test "$enable_utilities" = "yes"],[
AS_IF([test "$with_libidn" != "no"],[
PKG_CHECK_MODULES([libidn], [libidn >= 0.0.0], [
with_libidn=yes
AC_DEFINE([LIBIDN], [1], [Define to 1 to enable IDN support])
],[
with_libidn=no
AC_MSG_WARN([libidn not found])
])])
]) # Knot DNS utilities dependencies
AC_SEARCH_LIBS([pow], [m])
AC_SEARCH_LIBS([pthread_create], [pthread], [], [AC_MSG_ERROR([pthreads not found])])
......@@ -349,6 +399,8 @@ CPPFLAGS="$CPPFLAGS $CFLAG_VISIBILITY"
# Add code coverage macro
AX_CODE_COVERAGE
AS_IF([test "$enable_documentation" = "yes"],[
AC_PATH_PROGS([SPHINXBUILD], [sphinx-build sphinx-build-3], [false])
AS_IF([test "$SPHINXBUILD" = "false"],
[AC_MSG_WARN([Could not find the 'sphinx-build' executable, you will be unable to regenerate documentation.])],
......@@ -360,6 +412,13 @@ AS_IF([test "$SPHINXBUILD" = "false"],
[AC_MSG_WARN([Could not find the 'makeinfo' executable, you will be unable to generate info documentation.])])
])
])
AC_SUBST([libknot_pc_REQ])
AC_SUBST([libknot_pc_REQP])
AC_SUBST([libknot_pc_LIBS])
AC_SUBST([libknot_pc_LIBSP])
AM_CONDITIONAL([HAVE_SPHINXBUILD], test "$SPHINXBUILD" != "false")
AM_CONDITIONAL([HAVE_PDFLATEX], test "$PDFLATEX" != "false")
AM_CONDITIONAL([HAVE_MAKEINFO], test "$MAKEINFO" != "false")
......@@ -406,6 +465,11 @@ AC_MSG_RESULT([
Storage dir: ${storage_dir}
Config dir: ${config_dir}
Knot DNS libraries: yes
Knot DNS daemon: ${enable_daemon}
Knot DNS utils: ${enable_utilities}
Knot DNS documentation: ${enable_documentation}
Fast zone parser: ${enable_fastparser}
Utilities with IDN: ${with_libidn}
Systemd integration: ${enable_systemd}
......
......@@ -45,7 +45,7 @@ libdnssec_la_CPPFLAGS = \
libdnssec_la_LDFLAGS = \
$(gnutls_LIBS) \
$(jansson_LIBS) \
-version-info 0:1:0
$(VERSION_INFO)
libdnssec_la_LIBADD = \
libshared.la
......
if HAVE_UTILS
MANPAGES = keymgr.8 knsec3hash.1
endif # HAVE_UTILS
dist_man_MANS = $(MANPAGES)
clean-local:
......
if HAVE_UTILS
noinst_LTLIBRARIES = libutils.la
AM_CPPFLAGS = \
......@@ -43,3 +45,5 @@ knsec3hash_LDADD = \
bin_PROGRAMS = \
keymgr \
knsec3hash
endif # HAVE_UTILS
......@@ -17,6 +17,8 @@ ALLSPHINXOPTS = -n -d $(SPHINXBUILDDIR)/doctrees -D latex_paper_size=a4 $(SPHIN
.PHONY: html-local singlehtml pdf-local info-local
if HAVE_DOCS
if HAVE_SPHINXBUILD
html-local:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(SPHINXBUILDDIR)/html
......@@ -56,5 +58,7 @@ html-local singlehtml pdf-local info-local:
@echo "Please install sphinx (python-sphinx) to generate Knot DNS documentation."
endif
endif # HAVE_DOCS
clean-local:
-rm -rf _build
......@@ -5,7 +5,10 @@ includedir=@includedir@
Name: libknot
Description: Knot DNS library
URL: http://www.knot-dns.cz
URL: https://www.knot-dns.cz
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -lknot -lknot-int @LIBS@
Cflags: -I${includedir}
Requires.private: gnutls >= 3.0, nettle, jansson, @liburcu_PKGCONFIG@
Libs: -L${libdir} -lknot
Libs.private: -lknot-int -ldnssec @liburcu_LIBS@ @lmdb_LIBS@
Cflags: -I${includedir} @liburcu_CFLAGS@ @lmdb_CFLAGS@
......@@ -10,11 +10,11 @@ AC_DEFUN([dt_DNSTAP],
[Enable dnstap support (requires fstrm, protobuf-c)]),
[opt_dnstap=$enableval], [opt_dnstap=no])
if test "x$opt_dnstap" != "xno"; then
AS_IF([test "$opt_dnstap" != "no"],[
AC_PATH_PROG([PROTOC_C], [protoc-c])
if test -z "$PROTOC_C"; then
AS_IF([test -z "$PROTOC_C"],[
AC_MSG_ERROR([The protoc-c program was not found. Please install protobuf-c!])
fi
])
PKG_CHECK_MODULES([libfstrm], [libfstrm])
PKG_CHECK_MODULES([libprotobuf_c], [libprotobuf-c >= 1.0.0])
DNSTAP_CFLAGS="$libfstrm_CFLAGS $libprotobuf_c_CFLAGS"
......@@ -22,5 +22,5 @@ AC_DEFUN([dt_DNSTAP],
$1
m4_ifvaln([$2], [else
$2])dnl
fi
])
])
MANPAGES = knot.conf.5 knotc.8 knotd.8 kdig.1 khost.1 knsupdate.1
MANPAGES =
if HAVE_DAEMON
MANPAGES += knot.conf.5 knotc.8 knotd.8
endif # HAVE_DAEMON
if HAVE_UTILS
MANPAGES += kdig.1 khost.1 knsupdate.1
endif # HAVE_UTILS
dist_man_MANS = $(MANPAGES)
clean-local:
......
ACLOCAL_AMFLAGS = -I $(top_srcdir)/m4
SUBDIRS = dnstap .
lib_LTLIBRARIES = libknot-int.la libknot.la
noinst_LTLIBRARIES =
if HAVE_DAEMON
sbin_PROGRAMS = knotc knotd
noinst_LTLIBRARIES += libknotd.la
endif
if HAVE_UTILS
bin_PROGRAMS = kdig khost knsupdate
lib_LTLIBRARIES = libknot-int.la libknot.la
noinst_LTLIBRARIES = libknotd.la libknotus.la
noinst_LTLIBRARIES += libknotus.la
endif
# $(YACC) will generate header file
AM_CPPFLAGS = \
......@@ -20,6 +28,8 @@ AM_YFLAGS = -d
libknotd_la_YFLAGS = -pcf_ -d
libknotd_la_LFLAGS = # TODO: reentrant parser, prefix
if HAVE_DAEMON
BUILT_SOURCES = \
knot/conf/libknotd_la-cf-lex.c \
knot/conf/libknotd_la-cf-parse.c \
......@@ -36,6 +46,10 @@ knotc_SOURCES = \
knotd_SOURCES = \
knot/main.c
endif # HAVE_DAEMON
if HAVE_UTILS
kdig_SOURCES = \
utils/kdig/kdig_exec.c \
utils/kdig/kdig_exec.h \
......@@ -77,6 +91,8 @@ libknotus_la_SOURCES = \
utils/common/token.c \
utils/common/token.h
endif # HAVE_UTILS
# dynamic: libknot internal headers
nobase_libknot_int_la_HEADERS = \
libknot/internal/array-sort.h \
......@@ -199,6 +215,8 @@ libknot_la_SOURCES = \
libknot/tsig-op.c \
$(libknot_la_HEADERS)
if HAVE_DAEMON
# static: server shared
libknotd_la_SOURCES = \
knot/conf/cf-lex.l \
......@@ -333,6 +351,8 @@ libknotd_la_SOURCES = \
knot/zone/zonefile.c \
knot/zone/zonefile.h
endif # HAVE_DAEMON
# linking
libknot_int_la_CPPFLAGS = $(AM_CPPFLAGS) $(lmdb_CFLAGS)
libknot_int_la_CFLAGS = $(AM_CFLAGS) -fvisibility=default
......@@ -342,6 +362,8 @@ libknot_la_CPPFLAGS = $(AM_CPPFLAGS)
libknot_la_LDFLAGS = $(AM_LDFLAGS) $(RELEASE_INFO) $(VERSION_INFO)
libknot_la_LIBADD = libknot-int.la ../dnssec/libdnssec.la zscanner/libzscanner.la
if HAVE_DAEMON
libknotd_la_CPPFLAGS = $(AM_CPPFLAGS) $(systemd_CFLAGS)
libknotd_la_LDFLAGS = $(AM_LDFLAGS) $(systemd_LIBS)
libknotd_la_LIBADD = libknot.la
......@@ -350,45 +372,65 @@ libknotus_la_CPPFLAGS = $(AM_CPPFLAGS) $(libidn_CFLAGS)
libknotus_la_LDFLAGS = $(AM_LDFLAGS) $(libidn_LIBS)
libknotus_la_LIBADD = libknot.la
endif # HAVE_DAEMON
# includes
libknot_ladir = $(includedir)
libknot_int_ladir = $(includedir)
if HAVE_DAEMON
# sbin programs
knotd_LDADD = libknot.la libknotd.la
knotc_LDADD = libknot.la libknotd.la
endif # HAVE_DAEMON
if HAVE_UTILS
# bin programs
BIN_LIBS = libknotus.la
BIN_LIBS = ../dnssec/libdnssec.la libknot.la libknot-int.la libknotus.la
kdig_LDADD = $(BIN_LIBS) $(libidn_LIBS)
khost_LDADD = $(BIN_LIBS) $(libidn_LIBS)
knsupdate_LDADD = $(BIN_LIBS) zscanner/libzscanner.la
endif # HAVE_UTILS
if HAVE_DNSTAP
if HAVE_DAEMON
libknotd_la_SOURCES += \
knot/modules/dnstap.c \
knot/modules/dnstap.h
libknotd_la_LIBADD += dnstap/libdnstap.la
endif # HAVE_DAEMOM
if HAVE_UTILS
kdig_LDADD += dnstap/libdnstap.la
khost_LDADD += dnstap/libdnstap.la
libknotd_la_LIBADD += dnstap/libdnstap.la
endif
endif # HAVE_UTILS
endif # HAVE_DNSTAP
if HAVE_DAEMON
# rose sources and client tool
if HAVE_ROSEDB
libknotd_la_SOURCES += \
knot/modules/rosedb.c \
knot/modules/rosedb.c \
knot/modules/rosedb.h
rosedb_tool_SOURCES = \
rosedb_tool_SOURCES = \
knot/modules/rosedb_tool.c
if HAVE_UTILS
bin_PROGRAMS += rosedb_tool
rosedb_tool_LDADD = libknot.la libknotd.la
endif
endif # HAVE_UTILS
endif # HAVE_ROSEDB
endif # HAVE_DAEMON
if HAVE_LMDB
else
if !HAVE_LMDB
libknot_int_la_SOURCES += \
libknot/internal/namedb/mdb.c \
libknot/internal/namedb/midl.c
......@@ -402,8 +444,10 @@ endif
# pkg-config
pkgconfig_DATA = $(top_srcdir)/libknot.pc
if HAVE_DAEMON
# Create storage and run-time directories
install-data-hook:
$(INSTALL) -d $(DESTDIR)/@config_dir@
$(INSTALL) -d $(DESTDIR)/@run_dir@
$(INSTALL) -d $(DESTDIR)/@storage_dir@
endif # HAVE_DAEMON
......@@ -36,6 +36,6 @@ nodist_libzscanner_la_SOURCES = \
libzscanner_la_CFLAGS = $(CODE_COVERAGE_CFLAGS)
libzscanner_la_LDFLAGS = \
$(CODE_COVERAGE_LDFLAGS) \
-version-info 0:1:0
$(VERSION_INFO)
include $(srcdir)/tests/Makefile.inc
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