dect
/
libnl
Archived
13
0
Fork 0

Switch to libtool versioning system

It has been a request that multiple libnl versions should be installabe
in parallel.

In order to achieve this, the basename of the library was changed to
libnl-3 which reflects the 3rd generation of libnl APIs. It also means
that release based library versioning is left behind and libtool
versioning is used instead.

Projects using pkgconfig will automatically link against the new library
basename and will not notice a difference.

The SO versioning is based on the glib model:
  current := 100 * minor + micro - revision
  revision := revision
  age := age (number of backwards compatible versions)
This commit is contained in:
Thomas Graf 2011-09-13 22:58:08 +02:00
parent a73cb2f269
commit 4c210adcb5
10 changed files with 131 additions and 55 deletions

View File

@ -10,10 +10,10 @@ endif
SUBDIRS = include lib doc man python $(OPT_DIRS) SUBDIRS = include lib doc man python $(OPT_DIRS)
pkgconfig_DATA = libnl-3.pc \ pkgconfig_DATA = libnl-3.0.pc \
libnl-route-3.pc \ libnl-route-3.0.pc \
libnl-genl-3.pc \ libnl-genl-3.0.pc \
libnl-nf-3.pc libnl-nf-3.0.pc
pkgsysconfdir = ${sysconfdir}/libnl pkgsysconfdir = ${sysconfdir}/libnl
pkgsysconf_DATA = etc/pktloc etc/classid pkgsysconf_DATA = etc/pktloc etc/classid

View File

@ -9,16 +9,43 @@
# Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch> # Copyright (c) 2003-2011 Thomas Graf <tgraf@suug.ch>
# #
AC_INIT(libnl, 3.2, tgraf@suug.ch)
# copied from glib
m4_define([libnl_major_version], [3])
m4_define([libnl_minor_version], [2])
m4_define([libnl_micro_version], [0]) # bump for every release unless minor was bumped
m4_define([libnl_lt_revision], [0]) # bump or reset to 0 if interfaces were added
m4_define([libnl_lt_age], [0]) # bump whenever a release is backwards compatible
# bump with +100 if a minor release is compatible
# reset to 0 if interfaces were removed
m4_define([libnl_version],
[libnl_major_version.libnl_minor_version.libnl_micro_version])
m4_define([libnl_lt_current],
[m4_eval(100 * libnl_minor_version + libnl_micro_version - libnl_lt_revision)])
AC_INIT(libnl, [libnl_version], [http://www.infradead.org/~tgr/libnl/])
AC_CONFIG_HEADERS([lib/defs.h]) AC_CONFIG_HEADERS([lib/defs.h])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([-Wall foreign subdir-objects]) AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)], []) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)], [])
MAJ_VERSION=3 MAJ_VERSION=libnl_major_version
AC_SUBST([MAJ_VERSION]) AC_SUBST(MAJ_VERSION)
MIN_VERSION=2 MIN_VERSION=libnl_minor_version
AC_SUBST([MIN_VERSION]) AC_SUBST(MIN_VERSION)
MIC_VERSION=libnl_micro_version
AC_SUBST(MIC_VERSION)
LIBNL_VERSION=libnl_version
AC_SUBST(LIBNL_VERSION)
LT_CURRENT=libnl_lt_current
AC_SUBST(LT_CURRENT)
LT_REVISION=libnl_lt_revision
AC_SUBST(LT_REVISION)
LT_AGE=libnl_lt_age
AC_SUBST(LT_AGE)
AC_PROG_CC AC_PROG_CC
AM_PROG_CC_C_O AM_PROG_CC_C_O
@ -43,25 +70,39 @@ AM_CONDITIONAL([ENABLE_CLI], [test "$enable_cli" = "yes"])
AC_CHECK_LIB([m], [pow], [], AC_MSG_ERROR([libm is required])) AC_CHECK_LIB([m], [pow], [], AC_MSG_ERROR([libm is required]))
AC_CHECK_LIB([pthread], [pthread_mutex_lock], [], AC_MSG_ERROR([libpthread is required])) AC_CHECK_LIB([pthread], [pthread_mutex_lock], [], AC_MSG_ERROR([libpthread is required]))
AC_CONFIG_FILES([Makefile doc/Doxyfile doc/Makefile lib/Makefile AC_CONFIG_FILES([
include/Makefile src/Makefile src/lib/Makefile man/Makefile Makefile
libnl-3.pc libnl-route-3.pc libnl-genl-3.pc libnl-nf-3.pc libnl-3.0.pc
python/Makefile python/setup.py python/netlink/Makefile libnl-route-3.0.pc
python/netlink/route/Makefile libnl-genl-3.0.pc
include/netlink/version.h]) libnl-nf-3.0.pc
doc/Doxyfile
doc/Makefile
lib/Makefile
include/Makefile
src/Makefile
src/lib/Makefile
man/Makefile
python/Makefile
python/setup.py
python/netlink/Makefile
python/netlink/route/Makefile
include/netlink/version.h
])
AC_OUTPUT AC_OUTPUT
echo ------------------------------------------------------------------------------- echo "-------------------------------------------------------------------------------"
echo NOTE echo " NOTE"
echo echo ""
echo Headers will be installed in ${includedir}/libnl${MAJ_VERSION} starting with echo " Headers will be installed in ${includedir}/libnl${MAJ_VERSION} starting with"
echo version 3.2. If you are using pkg-config things should continue to work as echo " version 3.2. If you are using pkg-config things should continue to work as"
echo expected, otherwise you will have to extend the CLFAGS of your project with echo " expected, otherwise you will have to extend the CLFAGS of your project with"
echo echo ""
echo -I${includedir}/libnl${MAJ_VERSION} echo " -I${includedir}/libnl${MAJ_VERSION}"
echo echo ""
echo Also, pkg-config files for sub libraries have been added, so you can echo " Also, pkg-config files for sub libraries have been added, so you can"
echo verify their presence echo " verify their presence"
echo echo ""
echo ------------------------------------------------------------------------------- echo "-------------------------------------------------------------------------------"

View File

@ -7,7 +7,7 @@
Netlink Library (libnl) Netlink Library (libnl)
======================= =======================
Thomas Graf <tgraf@suug.ch> Thomas Graf <tgraf@suug.ch>
3.1, Aug 11 2011: 3.2, Sep 13 2011:
:numbered: :numbered:
== Introduction == Introduction
@ -59,6 +59,25 @@ The low level APIs are described in:
=== Linking to this Library === Linking to this Library
.Checking the presence using autoconf
Projects using autoconf may use +PKG_CHECK_MODULES()+ to check if
a specific version of libnl is available on the system. The example
below also shows how to retrieve the +CFLAGS+ and linking dependencies
required to link against the library.
[source]
----
PKG_CHECK_MODULES(LIBNL3, libnl-3.0 >= 3.1, [have_libnl3=yes], [have_libnl3=no])
if (test "${have_libnl3}" = "yes"); then
CFLAGS += "$LIBNL3_CFLAGS"
LIBS += "$LIBNL3_LIBS"
fi
----
NOTE: The pkgconfig file is named +libnl-3.0.pc+ for historic reasons, it also
covers library versions >= 3.1.
.Main Header .Main Header
The main header is `<netlink/netlink.h>`. Additional headers need to The main header is `<netlink/netlink.h>`. Additional headers need to
@ -77,7 +96,7 @@ makes use of.
.Linking to libnl .Linking to libnl
----- -----
$ gcc myprogram.c -o myprogram -lnl $ gcc myprogram.c -o myprogram $(pkgconfig --cflags --libs libnl-3.0)
----- -----
=== Debugging === Debugging

View File

@ -20,4 +20,8 @@
#define LIBNL_VER(maj,min) ((maj) << 8 | (min)) #define LIBNL_VER(maj,min) ((maj) << 8 | (min))
#define LIBNL_VER_NUM LIBNL_VER(LIBNL_VER_MAJ, LIBNL_VER_MIN) #define LIBNL_VER_NUM LIBNL_VER(LIBNL_VER_MAJ, LIBNL_VER_MIN)
#define LIBNL_CURRENT @LT_CURRENT@
#define LIBNL_REVISION @LT_REVISION@
#define LIBNL_AGE @LT_AGE@
#endif #endif

View File

@ -1,21 +1,30 @@
# -*- Makefile -*- # -*- Makefile -*-
AM_CPPFLAGS = -Wall -I${top_srcdir}/include -I${top_builddir}/include -I${builddir}/route -I${builddir}/route/cls -D_GNU_SOURCE -DSYSCONFDIR=\"$(sysconfdir)/libnl\" AM_CPPFLAGS = \
AM_LDFLAGS = -version-info @MAJ_VERSION@:@MIN_VERSION@:0 -Wall \
-I${top_srcdir}/include \
-I${top_builddir}/include \
-I${builddir}/route \
-I${builddir}/route/cls \
-D_GNU_SOURCE \
-DSYSCONFDIR=\"$(sysconfdir)/libnl\"
AM_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
lib_LTLIBRARIES = \ lib_LTLIBRARIES = \
libnl.la libnl-genl.la libnl-route.la libnl-nf.la libnl-3.la libnl-genl-3.la libnl-route-3.la libnl-nf-3.la
libnl_la_SOURCES = \ libnl_3_la_SOURCES = \
addr.c attr.c cache.c cache_mngr.c cache_mngt.c data.c \ addr.c attr.c cache.c cache_mngr.c cache_mngt.c data.c \
error.c handlers.c msg.c nl.c object.c socket.c utils.c error.c handlers.c msg.c nl.c object.c socket.c utils.c
libnl_genl_la_LIBADD = libnl.la libnl_genl_3_la_LIBADD = libnl-3.la
libnl_genl_la_SOURCES = \ libnl_genl_3_la_SOURCES = \
genl/ctrl.c genl/family.c genl/genl.c genl/mngt.c genl/ctrl.c genl/family.c genl/genl.c genl/mngt.c
libnl_nf_la_LIBADD = libnl-route.la libnl_nf_3_la_LIBADD = libnl-route-3.la
libnl_nf_la_SOURCES = \ libnl_nf_3_la_SOURCES = \
netfilter/ct.c netfilter/ct_obj.c netfilter/log.c \ netfilter/ct.c netfilter/ct_obj.c netfilter/log.c \
netfilter/log_msg.c netfilter/log_msg_obj.c netfilter/log_obj.c \ netfilter/log_msg.c netfilter/log_msg_obj.c netfilter/log_obj.c \
netfilter/netfilter.c netfilter/nfnl.c netfilter/queue.c \ netfilter/netfilter.c netfilter/nfnl.c netfilter/queue.c \
@ -41,8 +50,8 @@ route/cls/ematch_grammar.c: route/cls/ematch_grammar.l
route/cls/ematch_syntax.c: route/cls/ematch_syntax.y route/cls/ematch_syntax.c: route/cls/ematch_syntax.y
$(AM_V_GEN) $(YACC) -d $(YFLAGS) -o $@ $^ $(AM_V_GEN) $(YACC) -d $(YFLAGS) -o $@ $^
libnl_route_la_LIBADD = libnl.la libnl_route_3_la_LIBADD = libnl-3.la
libnl_route_la_SOURCES = \ libnl_route_3_la_SOURCES = \
route/addr.c route/class.c route/cls.c route/link.c \ route/addr.c route/class.c route/cls.c route/link.c \
route/neigh.c route/neightbl.c route/nexthop.c route/qdisc.c \ route/neigh.c route/neightbl.c route/nexthop.c route/qdisc.c \
route/route.c route/route_obj.c route/route_utils.c route/rtnl.c \ route/route.c route/route_obj.c route/route_utils.c route/rtnl.c \
@ -69,7 +78,7 @@ libnl_route_la_SOURCES = \
\ \
route/pktloc.c route/pktloc.c
nodist_libnl_route_la_SOURCES = \ nodist_libnl_route_3_la_SOURCES = \
route/pktloc_syntax.c route/pktloc_syntax.h \ route/pktloc_syntax.c route/pktloc_syntax.h \
route/pktloc_grammar.c route/pktloc_grammar.h \ route/pktloc_grammar.c route/pktloc_grammar.h \
route/cls/ematch_syntax.c route/cls/ematch_syntax.h \ route/cls/ematch_syntax.c route/cls/ematch_syntax.h \

View File

@ -6,5 +6,5 @@ includedir=@includedir@
Name: libnl Name: libnl
Description: Convenience library for netlink sockets Description: Convenience library for netlink sockets
Version: @PACKAGE_VERSION@ Version: @PACKAGE_VERSION@
Libs: -L${libdir} -lnl Libs: -L${libdir} -lnl-@MAJ_VERSION@
Cflags: -I${includedir}/libnl@MAJ_VERSION@ Cflags: -I${includedir}/libnl@MAJ_VERSION@

View File

@ -6,6 +6,6 @@ includedir=@includedir@
Name: libnl-genl Name: libnl-genl
Description: Generic Netlink Library Description: Generic Netlink Library
Version: @PACKAGE_VERSION@ Version: @PACKAGE_VERSION@
Requires: libnl-3 Requires: libnl-3.0
Libs: -L${libdir} -lnl-genl Libs: -L${libdir} -lnl-genl-@MAJ_VERSION@
Cflags: -I${includedir}/libnl@MAJ_VERSION@ Cflags: -I${includedir}/libnl@MAJ_VERSION@

View File

@ -6,6 +6,6 @@ includedir=@includedir@
Name: libnl-nf Name: libnl-nf
Description: Netfilter Netlink Library Description: Netfilter Netlink Library
Version: @PACKAGE_VERSION@ Version: @PACKAGE_VERSION@
Requires: libnl-3 Requires: libnl-route-3.0
Libs: -L${libdir} -lnl-nf Libs: -L${libdir} -lnl-nf-@MAJ_VERSION@
Cflags: -I${includedir}/libnl@MAJ_VERSION@ Cflags: -I${includedir}/libnl@MAJ_VERSION@

View File

@ -6,6 +6,6 @@ includedir=@includedir@
Name: libnl-route Name: libnl-route
Description: Netlink Routing Family Library Description: Netlink Routing Family Library
Version: @PACKAGE_VERSION@ Version: @PACKAGE_VERSION@
Requires: libnl-3 Requires: libnl-3.0
Libs: -L${libdir} -lnl-route Libs: -L${libdir} -lnl-route-@MAJ_VERSION@
Cflags: -I${includedir}/libnl@MAJ_VERSION@ Cflags: -I${includedir}/libnl@MAJ_VERSION@

View File

@ -1,7 +1,10 @@
# -*- Makefile -*- # -*- Makefile -*-
AM_CPPFLAGS = -Wall -I${top_srcdir}/include -I${top_builddir}/include -D_GNU_SOURCE -DPKGLIBDIR=\"$(pkglibdir)\" -DSYSCONFDIR=\"$(sysconfdir)\" -rdynamic AM_CPPFLAGS = -Wall -I${top_srcdir}/include -I${top_builddir}/include -D_GNU_SOURCE -DPKGLIBDIR=\"$(pkglibdir)\" -DSYSCONFDIR=\"$(sysconfdir)\" -rdynamic
AM_LDFLAGS = -L${top_builddir}/lib -ldl -version-info 3:0:0 AM_LDFLAGS = \
-L${top_builddir}/lib \
-ldl \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
#nobase_pkglib_LTLIBRARIES = cls/basic.la cls/ematch/cmp.la #nobase_pkglib_LTLIBRARIES = cls/basic.la cls/ematch/cmp.la
#cls_basic_la_LDFLAGS = -module -version-info 2:0:0 #cls_basic_la_LDFLAGS = -module -version-info 2:0:0
@ -26,14 +29,14 @@ AM_LDFLAGS = -L${top_builddir}/lib -ldl -version-info 3:0:0
# cls/pktloc_syntax.c cls/pktloc_syntax.h # cls/pktloc_syntax.c cls/pktloc_syntax.h
lib_LTLIBRARIES = \ lib_LTLIBRARIES = \
libnl-cli.la libnl-cli-3.la
libnl_cli_la_LIBADD = ${top_builddir}/lib/libnl.la \ libnl_cli_3_la_LIBADD = ${top_builddir}/lib/libnl-3.la \
${top_builddir}/lib/libnl-route.la \ ${top_builddir}/lib/libnl-route-3.la \
${top_builddir}/lib/libnl-nf.la \ ${top_builddir}/lib/libnl-nf-3.la \
${top_builddir}/lib/libnl-genl.la ${top_builddir}/lib/libnl-genl-3.la
libnl_cli_la_SOURCES = \ libnl_cli_3_la_SOURCES = \
utils.c addr.c ct.c link.c neigh.c rule.c route.c \ utils.c addr.c ct.c link.c neigh.c rule.c route.c \
tc.c qdisc.c class.c cls.c tc.c qdisc.c class.c cls.c
# cls/ematch_syntax.c cls/ematch_grammar.c cls/ematch.c # cls/ematch_syntax.c cls/ematch_grammar.c cls/ematch.c