Skip to content
Snippets Groups Projects
Commit bfc637da authored by Jan Včelák's avatar Jan Včelák :rocket:
Browse files

Merge branch 'install_headers' into 'master'

Enables libknot headers and .pc installation, allowing use of libknot in
external projects.

* install_headers:
  pkg-config: use PKG_INSTALLDIR [review]
  Makefile: fix broken linking of systemd [review]
  Makefile: clean duplicate headers [review]
  pkg-config: don't publish already prefixed include path
  makefile: generate pkg-config file for libknot, versioning
  makefile: merge libknotcs -> libknot
  makefile: clean duplicates
parents 1b8c410e fb722b4c
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@ AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_USE_SYSTEM_EXTENSIONS([_GNU_SOURCE])
AC_CANONICAL_HOST
AX_SET_VERSION_INFO
# Automatically update release date based on configure.ac date
case "$host_os" in
......@@ -40,6 +41,8 @@ LT_INIT
# Use pkg-config
PKG_PROG_PKG_CONFIG
PKG_INSTALLDIR
AC_CONFIG_FILES([libknot.pc])
AC_CACHE_CHECK([for reentrant lex], [ac_cv_path_LEX],
[AC_PATH_PROGS_FEATURE_CHECK([LEX], [$LEX flex gflex],
......@@ -391,6 +394,7 @@ AC_CONFIG_FILES([Makefile
man/knsec3hash.1
])
AC_OUTPUT
AC_MSG_RESULT([
$PACKAGE $VERSION
......
prefix=@prefix@
exec_prefix=@prefix@
libdir=@libdir@
includedir=@includedir@
Name: libknot
Description: Knot DNS library
URL: http://www.knot-dns.cz
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -lknot @LIBS@
Cflags: -I${includedir}
dnl @synopsis AX_SET_VERSION_INFO [(VERSION [,PREFIX])]
dnl @synopsis default $1 = $PACKAGE_VERSION
dnl @synopsis default $2 = <none>
dnl
dnl This macro is the successor of AC_SET_RELEASEINFO_VERSIONINFO but
dnl it can be used in parallel because it uses all different variables.
dnl
dnl check the $VERSION number and cut the two last digit-sequences off
dnl which will form a -version-info in a @VERSION_INFO@ ac_subst while
dnl the rest is going to the -release name in a @RELEASE_INFO@
dnl ac_subst.
dnl
dnl you should keep these two seperate - the release-name may contain
dnl alpha-characters and can be modified later with extra release-hints
dnl e.g. RELEASE_INFO="$RELEASE_INFO-debug" for a debug version of your
dnl lib. The $VERSION_INFO however should not be touched.
dnl
dnl example: a VERSION="2.4.18" will be transformed into
dnl
dnl RELEASE_INFO = -release 2
dnl VERSION_INFO = -versioninfo 4:18
dnl
dnl then use these two variables and push them to your libtool linker
dnl
dnl libtest_la_LIBADD = @RELEASE_INFO@ @VERSION_INFO@
dnl
dnl and for a linux-target this will tell libtool to install the lib as
dnl
dnl libmy.so libmy.la libmy.a libmy-2.so.4 libmy-2.so.4.0.18
dnl
dnl and executables will get link-resolve-infos for libmy-2.so.4 -
dnl therefore the patch-level is ignored during ldso linking, and ldso
dnl will use the one with the highest patchlevel. Using just "-release
dnl $(VERSION)" during libtool-linking would not do that - omitting the
dnl -version-info will libtool install libmy.so libmy.la libmy.a
dnl libmy-2.4.18.so and executables would get hardlinked with the
dnl 2.4.18 version of your lib.
dnl
dnl This background does also explain the default dll name for a win32
dnl target : libtool will choose to make up libmy-2-4.dll for this
dnl version spec.
dnl
dnl this macro does also set the usual three parts of a version spec
dnl $MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION but does not ac_subst
dnl for the plain AX_SET_VERSION_INFO macro. Use instead one of the
dnl numbered macros AX_SET_VERSION_INFO1 (use first number for release
dnl part) or that AX_SET_VERSION_INFO2 (use the first two numbers for
dnl release part).
dnl
dnl You may add sublevel parts like "1.4.2-ac5" where the sublevel is
dnl just killed from these version/release substvars. That allows to
dnl grab the version off a .spec file like with AX_SPEC_PACKAGE_VERSION
dnl where the $VERSION is used to name a tarball or distpack like
dnl mylib-2.2.9pre4
dnl
dnl Unlike earlier macros, you can use this one to break up different
dnl VERSIONs and put them into different variables, just hint with
dnl PREFIX-setting - i.e. _VERSION(2.4.5,TEST) will set variables named
dnl TEST_MAJOR_VERSION=2... and of course $TEST_RELEASE_INFO etc. (for
dnl the moment, it needs to be a literal prefix *sigh*)
dnl
dnl @category Misc
dnl @author Guido U. Draheim <guidod@gmx.de>
dnl @version 2006-10-13
dnl @license GPLWithACException
AC_DEFUN([AX_SET_VERSION_INFO1],[dnl
AS_VAR_PUSHDEF([MAJOR],ifelse($2,,[MAJOR_VERSION],[$2_MAJOR_VERSION]))dnl
AS_VAR_PUSHDEF([MINOR],ifelse($2,,[MINOR_VERSION],[$2_MINOR_VERSION]))dnl
AS_VAR_PUSHDEF([MICRO],ifelse($2,,[MICRO_VERSION],[$2_MICRO_VERSION]))dnl
AS_VAR_PUSHDEF([PATCH],ifelse($2,,[PATCH_VERSION],[$2_PATCH_VERSION]))dnl
AS_VAR_PUSHDEF([LTREL],ifelse($2,,[RELEASE_INFO],[$2_RELEASE_INFO]))dnl
AS_VAR_PUSHDEF([LTVER],ifelse($2,,[VERSION_INFO],[$2_VERSION_INFO]))dnl
test ".$PACKAGE_VERSION" = "." && PACKAGE_VERSION="$VERSION"
AC_MSG_CHECKING(ifelse($2,,,[$2 ])out linker version info dnl
ifelse($1,,$PACKAGE_VERSION,$1) )
MINOR=`echo ifelse( $1, , $PACKAGE_VERSION, $1 )`
MAJOR=`echo "$MINOR" | sed -e 's/[[.]].*//'`
MINOR=`echo "$MINOR" | sed -e "s/^$MAJOR//" -e 's/^.//'`
MICRO="$MINOR"
MINOR=`echo "$MICRO" | sed -e 's/[[.]].*//'`
MICRO=`echo "$MICRO" | sed -e "s/^$MINOR//" -e 's/^.//'`
PATCH="$MICRO"
MICRO=`echo "$PATCH" | sed -e 's/[[^0-9]].*//'`
PATCH=`echo "$PATCH" | sed -e "s/^$MICRO//" -e 's/^[[-.]]//'`
if test "_$MICRO" = "_" ; then MICRO="0" ; fi
if test "_$MINOR" = "_" ; then MINOR="$MAJOR" ; MAJOR="0" ; fi
MINOR=`echo "$MINOR" | sed -e 's/[[^0-9]].*//'`
LTREL="-release $MAJOR"
LTVER="-version-info $MINOR:$MICRO"
AC_MSG_RESULT([/$MAJOR/$MINOR:$MICRO (-$MAJOR.so.$MINOR.0.$MICRO)])
AC_SUBST(MAJOR)
AC_SUBST(MINOR)
AC_SUBST(MICRO)
AC_SUBST(PATCH)
AC_SUBST(LTREL)
AC_SUBST(LTVER)
AS_VAR_POPDEF([LTVER])dnl
AS_VAR_POPDEF([LTREL])dnl
AS_VAR_POPDEF([PATCH])dnl
AS_VAR_POPDEF([MICRO])dnl
AS_VAR_POPDEF([MINOR])dnl
AS_VAR_POPDEF([MAJOR])dnl
])
AC_DEFUN([AX_SET_VERSION_INFO2],[dnl
AS_VAR_PUSHDEF([MAJOR],ifelse($2,,[MAJOR_VERSION],[$2_MAJOR_VERSION]))dnl
AS_VAR_PUSHDEF([MINOR],ifelse($2,,[MINOR_VERSION],[$2_MINOR_VERSION]))dnl
AS_VAR_PUSHDEF([MICRO],ifelse($2,,[MICRO_VERSION],[$2_MICRO_VERSION]))dnl
AS_VAR_PUSHDEF([PATCH],ifelse($2,,[PATCH_VERSION],[$2_PATCH_VERSION]))dnl
AS_VAR_PUSHDEF([LTREL],ifelse($2,,[RELEASE_INFO],[$2_RELEASE_INFO]))dnl
AS_VAR_PUSHDEF([LTVER],ifelse($2,,[VERSION_INFO],[$2_VERSION_INFO]))dnl
test ".$PACKAGE_VERSION" = "." && PACKAGE_VERSION="$VERSION"
AC_MSG_CHECKING(ifelse($2,,,[$2 ])out linker version info dnl
ifelse($1,,$PACKAGE_VERSION,$1) )
MINOR=`echo ifelse( $1, , $PACKAGE_VERSION, $1 )`
MAJOR=`echo "$MINOR" | sed -e 's/[[.]].*//'`
MINOR=`echo "$MINOR" | sed -e "s/^$MAJOR//" -e 's/^.//'`
MICRO="$MINOR"
MINOR=`echo "$MICRO" | sed -e 's/[[.]].*//'`
MICRO=`echo "$MICRO" | sed -e "s/^$MINOR//" -e 's/^.//'`
PATCH="$MICRO"
MICRO=`echo "$PATCH" | sed -e 's/[[^0-9]].*//'`
PATCH=`echo "$PATCH" | sed -e "s/^$MICRO//" -e 's/^[[-.]]//'`
test "_$MICRO" != "_" || MICRO="0"
if test "_$MINOR" != "_" ; then MINOR="$MAJOR" ; MAJOR="0" ; fi
MINOR=`echo "$MINOR" | sed -e 's/[[^0-9]].*//'`
LTREL="-release $MAJOR.$MINOR"
LTVER="-version-info 0:$MICRO"
AC_MSG_RESULT([/$MAJOR/$MINOR:$MICRO (-$MAJOR.so.$MINOR.0.$MICRO)])
AC_SUBST(MAJOR)
AC_SUBST(MINOR)
AC_SUBST(MICRO)
AC_SUBST(PATCH)
AC_SUBST(LTREL)
AC_SUBST(LTVER)
AS_VAR_POPDEF([LTVER])dnl
AS_VAR_POPDEF([LTREL])dnl
AS_VAR_POPDEF([PATCH])dnl
AS_VAR_POPDEF([MICRO])dnl
AS_VAR_POPDEF([MINOR])dnl
AS_VAR_POPDEF([MAJOR])dnl
])
AC_DEFUN([AX_SET_VERSION_INFO],[dnl
AS_VAR_PUSHDEF([MAJOR],ifelse($2,,[MAJOR_VERSION],[$2_MAJOR_VERSION]))dnl
AS_VAR_PUSHDEF([MINOR],ifelse($2,,[MINOR_VERSION],[$2_MINOR_VERSION]))dnl
AS_VAR_PUSHDEF([MICRO],ifelse($2,,[MICRO_VERSION],[$2_MICRO_VERSION]))dnl
AS_VAR_PUSHDEF([PATCH],ifelse($2,,[PATCH_VERSION],[$2_PATCH_VERSION]))dnl
AS_VAR_PUSHDEF([LTREL],ifelse($2,,[RELEASE_INFO],[$2_RELEASE_INFO]))dnl
AS_VAR_PUSHDEF([LTVER],ifelse($2,,[VERSION_INFO],[$2_VERSION_INFO]))dnl
test ".$PACKAGE_VERSION" = "." && PACKAGE_VERSION="$VERSION"
AC_MSG_CHECKING(ifelse($2,,,[$2 ])out linker version info dnl
ifelse($1,,$PACKAGE_VERSION,$1) )
MINOR=`echo ifelse( $1, , $PACKAGE_VERSION, $1 )`
MAJOR=`echo "$MINOR" | sed -e 's/[[.]].*//'`
MINOR=`echo "$MINOR" | sed -e "s/^$MAJOR//" -e 's/^.//'`
MICRO="$MINOR"
MINOR=`echo "$MICRO" | sed -e 's/[[.]].*//'`
MICRO=`echo "$MICRO" | sed -e "s/^$MINOR//" -e 's/^.//'`
PATCH="$MICRO"
MICRO=`echo "$PATCH" | sed -e 's/[[^0-9]].*//'`
PATCH=`echo "$PATCH" | sed -e "s/^$MICRO//" -e 's/[[-.]]//'`
if test "_$MICRO" = "_" ; then MICRO="0" ; fi
if test "_$MINOR" = "_" ; then MINOR="$MAJOR" ; MAJOR="0" ; fi
MINOR=`echo "$MINOR" | sed -e 's/[[^0-9]].*//'`
LTREL="-release $MAJOR"
LTVER="-version-info $MINOR:$MICRO"
AC_MSG_RESULT([/$MAJOR/$MINOR:$MICRO (-$MAJOR.so.$MINOR.0.$MICRO)])
AC_SUBST(LTREL)
AC_SUBST(LTVER)
AS_VAR_POPDEF([LTVER])dnl
AS_VAR_POPDEF([LTREL])dnl
AS_VAR_POPDEF([PATCH])dnl
AS_VAR_POPDEF([MICRO])dnl
AS_VAR_POPDEF([MINOR])dnl
AS_VAR_POPDEF([MAJOR])dnl
])
......@@ -4,7 +4,7 @@ SUBDIRS = zscanner dnstap .
sbin_PROGRAMS = knotc knotd
bin_PROGRAMS = kdig khost knsupdate knsec3hash
lib_LTLIBRARIES = libknot.la
noinst_LTLIBRARIES = libknotd.la libknotus.la libknotcs.la
noinst_LTLIBRARIES = libknotd.la libknotus.la
# $(YACC) will generate header file
AM_CPPFLAGS = \
......@@ -60,59 +60,6 @@ knsupdate_SOURCES = \
knsec3hash_SOURCES = \
utils/knsec3hash/knsec3hash_main.c
# static: common shared (also in libknot)
libknotcs_la_SOURCES = \
libknot/internal/array-sort.h \
libknot/internal/base32hex.c \
libknot/internal/base32hex.h \
libknot/internal/base64.c \
libknot/internal/base64.h \
libknot/internal/binsearch.h \
libknot/internal/debug.h \
libknot/internal/endian.h \
libknot/internal/errors.c \
libknot/internal/errors.h \
libknot/internal/getline.c \
libknot/internal/getline.h \
libknot/internal/heap.c \
libknot/internal/heap.h \
libknot/internal/hhash.c \
libknot/internal/hhash.h \
libknot/internal/lists.c \
libknot/internal/lists.h \
libknot/internal/log.c \
libknot/internal/log.h \
libknot/internal/macros.h \
libknot/internal/mem.c \
libknot/internal/mem.h \
libknot/internal/mempattern.c \
libknot/internal/mempattern.h \
libknot/internal/mempool.c \
libknot/internal/mempool.h \
libknot/internal/namedb/namedb.h \
libknot/internal/namedb/namedb_lmdb.c \
libknot/internal/namedb/namedb_lmdb.h \
libknot/internal/namedb/namedb_trie.c \
libknot/internal/namedb/namedb_trie.h \
libknot/internal/net.c \
libknot/internal/net.h \
libknot/internal/print.c \
libknot/internal/print.h \
libknot/internal/sockaddr.c \
libknot/internal/sockaddr.h \
libknot/internal/strlcat.c \
libknot/internal/strlcat.h \
libknot/internal/strlcpy.c \
libknot/internal/strlcpy.h \
libknot/internal/tolower.c \
libknot/internal/tolower.h \
libknot/internal/trie/hat-trie.c \
libknot/internal/trie/hat-trie.h \
libknot/internal/trie/murmurhash3.c \
libknot/internal/trie/murmurhash3.h \
libknot/internal/utils.c \
libknot/internal/utils.h
# static: utilities shared
libknotus_la_SOURCES = \
utils/common/exec.c \
......@@ -134,76 +81,127 @@ libknotus_la_SOURCES = \
# dynamic: libknot
libknot_la_LDFLAGS = \
$(AM_LDFLAGS) \
-version-info 0:1:0
$(RELEASE_INFO) $(VERSION_INFO)
libknot_la_SOURCES = \
libknot/binary.c \
# dynamic: libknot headers
nobase_libknot_la_HEADERS = \
libknot/binary.h \
libknot/consts.c \
libknot/consts.h \
libknot/consts.h \
libknot/descriptor.c \
libknot/descriptor.h \
libknot/dname.c \
libknot/dname.h \
libknot/dnssec/bitmap.h \
libknot/dnssec/config.h \
libknot/dnssec/crypto.c \
libknot/dnssec/crypto.h \
libknot/dnssec/key.c \
libknot/dnssec/key.h \
libknot/dnssec/policy.c \
libknot/dnssec/policy.h \
libknot/dnssec/random.h \
libknot/dnssec/rrset-sign.c \
libknot/dnssec/rrset-sign.h \
libknot/dnssec/sig0.c \
libknot/dnssec/sig0.h \
libknot/dnssec/sign.c \
libknot/dnssec/sign.h \
libknot/errcode.c \
libknot/errcode.h \
libknot/libknot.h \
libknot/packet/compr.c \
libknot/packet/compr.h \
libknot/packet/pkt.c \
libknot/packet/pkt.h \
libknot/packet/rrset-wire.c \
libknot/packet/rrset-wire.h \
libknot/packet/wire.h \
libknot/processing/layer.c \
libknot/processing/layer.h \
libknot/processing/overlay.c \
libknot/processing/overlay.h \
libknot/processing/requestor.c \
libknot/processing/requestor.h \
libknot/rdata.c \
libknot/rdata.h \
libknot/rdataset.c \
libknot/rdataset.h \
libknot/rrset-dump.c \
libknot/rrset-dump.h \
libknot/rrset.c \
libknot/rrset.h \
libknot/rrtype/aaaa.h \
libknot/rrtype/dnskey.h \
libknot/rrtype/naptr.h \
libknot/rrtype/nsec.h \
libknot/rrtype/nsec.h \
libknot/rrtype/nsec.h \
libknot/rrtype/nsec3.c \
libknot/rrtype/nsec3.h \
libknot/rrtype/nsec3param.c \
libknot/rrtype/nsec3param.h \
libknot/rrtype/opt.c \
libknot/rrtype/opt.h \
libknot/rrtype/rdname.h \
libknot/rrtype/rrsig.h \
libknot/rrtype/soa.h \
libknot/rrtype/tsig.c \
libknot/rrtype/tsig.h \
libknot/tsig-op.h \
libknot/internal/array-sort.h \
libknot/internal/base32hex.h \
libknot/internal/base64.h \
libknot/internal/binsearch.h \
libknot/internal/debug.h \
libknot/internal/endian.h \
libknot/internal/errors.h \
libknot/internal/getline.h \
libknot/internal/heap.h \
libknot/internal/hhash.h \
libknot/internal/lists.h \
libknot/internal/log.h \
libknot/internal/macros.h \
libknot/internal/mem.h \
libknot/internal/mempattern.h \
libknot/internal/mempool.h \
libknot/internal/namedb/namedb.h \
libknot/internal/namedb/namedb_lmdb.h \
libknot/internal/namedb/namedb_trie.h \
libknot/internal/net.h \
libknot/internal/print.h \
libknot/internal/sockaddr.h \
libknot/internal/strlcat.h \
libknot/internal/strlcpy.h \
libknot/internal/tolower.h \
libknot/internal/trie/hat-trie.h \
libknot/internal/trie/murmurhash3.h \
libknot/internal/utils.h
libknot_la_SOURCES = \
libknot/binary.c \
libknot/consts.c \
libknot/descriptor.c \
libknot/dname.c \
libknot/dnssec/crypto.c \
libknot/dnssec/key.c \
libknot/dnssec/policy.c \
libknot/dnssec/rrset-sign.c \
libknot/dnssec/sig0.c \
libknot/dnssec/sign.c \
libknot/errcode.c \
libknot/packet/compr.c \
libknot/packet/pkt.c \
libknot/packet/rrset-wire.c \
libknot/processing/layer.c \
libknot/processing/overlay.c \
libknot/processing/requestor.c \
libknot/rdata.c \
libknot/rdataset.c \
libknot/rrset-dump.c \
libknot/rrset.c \
libknot/rrtype/nsec3.c \
libknot/rrtype/nsec3param.c \
libknot/rrtype/opt.c \
libknot/rrtype/tsig.c \
libknot/tsig-op.c \
libknot/tsig-op.h
libknot/internal/base32hex.c \
libknot/internal/base64.c \
libknot/internal/errors.c \
libknot/internal/getline.c \
libknot/internal/heap.c \
libknot/internal/hhash.c \
libknot/internal/lists.c \
libknot/internal/log.c \
libknot/internal/mem.c \
libknot/internal/mempattern.c \
libknot/internal/mempool.c \
libknot/internal/namedb/namedb_lmdb.c \
libknot/internal/namedb/namedb_trie.c \
libknot/internal/net.c \
libknot/internal/print.c \
libknot/internal/sockaddr.c \
libknot/internal/strlcat.c \
libknot/internal/strlcpy.c \
libknot/internal/tolower.c \
libknot/internal/trie/hat-trie.c \
libknot/internal/trie/murmurhash3.c \
libknot/internal/utils.c \
$(libknot_la_HEADERS)
# static: server shared
libknotd_la_SOURCES = \
......@@ -329,18 +327,19 @@ libknotd_la_SOURCES = \
knot/zone/zonefile.h
# libraries
libknot_la_LIBADD = libknotcs.la zscanner/libzscanner.la
libknotd_la_LIBADD = libknotcs.la libknot.la
libknotus_la_LIBADD = libknotcs.la libknot.la
libknot_la_LIBADD = zscanner/libzscanner.la $(systemd_LIBS) $(lmdb_LIBS)
libknotd_la_LIBADD = libknot.la
libknotus_la_LIBADD = libknot.la
libknotd_la_CPPFLAGS = $(AM_CPPFLAGS) $(lmdb_CFLAGS)
libknotd_la_LDFLAGS = $(AM_LDFLAGS) $(lmdb_LIBS)
libknotus_la_CPPFLAGS = $(AM_CPPFLAGS) $(libidn_CFLAGS)
libknotus_la_LDFLAGS = $(AM_LDFLAGS) $(libidn_LIBS)
libknotcs_la_CPPFLAGS = $(AM_CPPFLAGS) $(systemd_CFLAGS) $(lmdb_CFLAGS)
libknotcs_la_LDFLAGS = $(AM_LDFLAGS) $(systemd_LIBS) $(lmdb_LIBS)
# includes
libknot_ladir = $(includedir)
# sbin programs
knotd_LDADD = libknot.la libknotd.la $(systemd_LIBS) $(lmdb_LIBS)
knotd_LDADD = libknot.la libknotd.la
knotc_LDADD = libknot.la libknotd.la
# bin programs
......@@ -360,6 +359,9 @@ khost_LDADD += dnstap/libdnstap.la
libknotd_la_LIBADD += dnstap/libdnstap.la
endif
# pkg-config
pkgconfig_DATA = $(top_srcdir)/libknot.pc
# Create storage and run-time directories
install-data-hook:
$(INSTALL) -d $(DESTDIR)/@config_dir@
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment