]> granicus.if.org Git - libnl/commitdiff
Switch to libtool versioning system
authorThomas Graf <tgraf@redhat.com>
Tue, 13 Sep 2011 20:58:08 +0000 (22:58 +0200)
committerThomas Graf <tgraf@redhat.com>
Tue, 13 Sep 2011 20:58:08 +0000 (22:58 +0200)
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)

Makefile.am
configure.in
doc/core.txt
include/netlink/version.h.in
lib/Makefile.am
libnl-3.0.pc.in [moved from libnl-3.pc.in with 85% similarity]
libnl-genl-3.0.pc.in [moved from libnl-genl-3.pc.in with 76% similarity]
libnl-nf-3.0.pc.in [moved from libnl-nf-3.pc.in with 75% similarity]
libnl-route-3.0.pc.in [moved from libnl-route-3.pc.in with 77% similarity]
src/lib/Makefile.am

index 6706e4bdc47df5d341db67eccac7ea7e681a3988..a936c4971eda85f09b8f20653e93b2d2c69b595e 100644 (file)
@@ -10,10 +10,10 @@ endif
 
 SUBDIRS = include lib doc man python $(OPT_DIRS)
 
-pkgconfig_DATA = libnl-3.pc \
-                libnl-route-3.pc \
-                libnl-genl-3.pc \
-                libnl-nf-3.pc
+pkgconfig_DATA = libnl-3.0.pc \
+                libnl-route-3.0.pc \
+                libnl-genl-3.0.pc \
+                libnl-nf-3.0.pc
 
 pkgsysconfdir = ${sysconfdir}/libnl
 pkgsysconf_DATA = etc/pktloc etc/classid
index 2ee35c36bf3ed176e6c080ff80af527980a0668f..b1b4f11fbd98e2b787c07e1c8aba7222ab0dc22d 100644 (file)
@@ -9,16 +9,43 @@
 # 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_MACRO_DIR([m4])
 AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)], [])
 
-MAJ_VERSION=3
-AC_SUBST([MAJ_VERSION])
-MIN_VERSION=2
-AC_SUBST([MIN_VERSION])
+MAJ_VERSION=libnl_major_version
+AC_SUBST(MAJ_VERSION)
+MIN_VERSION=libnl_minor_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
 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([pthread], [pthread_mutex_lock], [], AC_MSG_ERROR([libpthread is required]))
 
-AC_CONFIG_FILES([Makefile doc/Doxyfile doc/Makefile lib/Makefile
-       include/Makefile src/Makefile src/lib/Makefile man/Makefile
-       libnl-3.pc libnl-route-3.pc libnl-genl-3.pc libnl-nf-3.pc
-       python/Makefile python/setup.py python/netlink/Makefile
-       python/netlink/route/Makefile
-       include/netlink/version.h])
+AC_CONFIG_FILES([
+Makefile
+libnl-3.0.pc
+libnl-route-3.0.pc
+libnl-genl-3.0.pc
+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
 
-echo -------------------------------------------------------------------------------
-echo                                   NOTE
-echo 
-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  expected, otherwise you will have to extend the CLFAGS of your project with
-echo
-echo              -I${includedir}/libnl${MAJ_VERSION}
-echo
-echo  Also, pkg-config files for sub libraries have been added, so you can
-echo  verify their presence
-echo
-echo -------------------------------------------------------------------------------
+echo "-------------------------------------------------------------------------------"
+echo "                                  NOTE"
+echo ""
+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 " expected, otherwise you will have to extend the CLFAGS of your project with"
+echo ""
+echo "             -I${includedir}/libnl${MAJ_VERSION}"
+echo ""
+echo " Also, pkg-config files for sub libraries have been added, so you can"
+echo " verify their presence"
+echo ""
+echo "-------------------------------------------------------------------------------"
 
index 796e9fc5230c1f1cf6b2be89c3e5686fdbc5483f..c10cbc07b033d6dd243eaaec37bf51dee5eebbdd 100644 (file)
@@ -7,7 +7,7 @@
 Netlink Library (libnl)
 =======================
 Thomas Graf <tgraf@suug.ch>
-3.1, Aug 11 2011:
+3.2, Sep 13 2011:
 :numbered:
 
 == Introduction
@@ -59,6 +59,25 @@ The low level APIs are described in:
 
 === 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
 
 The main header is `<netlink/netlink.h>`. Additional headers need to
@@ -77,7 +96,7 @@ makes use of.
 
 .Linking to libnl
 -----
-$ gcc myprogram.c -o myprogram -lnl
+$ gcc myprogram.c -o myprogram $(pkgconfig --cflags --libs libnl-3.0)
 -----
 
 === Debugging
index 9deb365bfd24c8ae7013d8d7a14de187d0a2a619..4d32dad3e582eb6793de43ba9797d02d3fea8a63 100644 (file)
@@ -20,4 +20,8 @@
 #define LIBNL_VER(maj,min)     ((maj) << 8 | (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
index 90c98e9453c98ee63de2b41f39bb39ae020c740a..da2dbf639b142056fdc45f5cef3b193f6f86ad7f 100644 (file)
@@ -1,21 +1,30 @@
 # -*- 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_LDFLAGS = -version-info @MAJ_VERSION@:@MIN_VERSION@:0
+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_LDFLAGS = \
+       -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
 
 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 \
        error.c handlers.c msg.c nl.c object.c socket.c utils.c
 
-libnl_genl_la_LIBADD  = libnl.la
-libnl_genl_la_SOURCES = \
+libnl_genl_3_la_LIBADD  = libnl-3.la
+libnl_genl_3_la_SOURCES = \
        genl/ctrl.c genl/family.c genl/genl.c genl/mngt.c
 
-libnl_nf_la_LIBADD  = libnl-route.la
-libnl_nf_la_SOURCES = \
+libnl_nf_3_la_LIBADD  = libnl-route-3.la
+libnl_nf_3_la_SOURCES = \
        netfilter/ct.c netfilter/ct_obj.c netfilter/log.c \
        netfilter/log_msg.c netfilter/log_msg_obj.c netfilter/log_obj.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
        $(AM_V_GEN) $(YACC) -d $(YFLAGS) -o $@ $^
 
-libnl_route_la_LIBADD  = libnl.la
-libnl_route_la_SOURCES = \
+libnl_route_3_la_LIBADD  = libnl-3.la
+libnl_route_3_la_SOURCES = \
        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/route.c route/route_obj.c route/route_utils.c route/rtnl.c \
@@ -69,7 +78,7 @@ libnl_route_la_SOURCES = \
        \
        route/pktloc.c
 
-nodist_libnl_route_la_SOURCES = \
+nodist_libnl_route_3_la_SOURCES = \
        route/pktloc_syntax.c route/pktloc_syntax.h \
        route/pktloc_grammar.c route/pktloc_grammar.h \
        route/cls/ematch_syntax.c route/cls/ematch_syntax.h \
similarity index 85%
rename from libnl-3.pc.in
rename to libnl-3.0.pc.in
index 05a06fc4728272d7a1fc5ef4d609e00501227e1a..b87e3dcde0816804409d4554c5c3481b27dc1eed 100644 (file)
@@ -6,5 +6,5 @@ includedir=@includedir@
 Name: libnl
 Description: Convenience library for netlink sockets
 Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -lnl
+Libs: -L${libdir} -lnl-@MAJ_VERSION@
 Cflags: -I${includedir}/libnl@MAJ_VERSION@
similarity index 76%
rename from libnl-genl-3.pc.in
rename to libnl-genl-3.0.pc.in
index e9cbe62e5bd224eaa63e4c3445474d518ad9ca86..d6b69b8ee31e91df367e1f525958c22d01f0c63a 100644 (file)
@@ -6,6 +6,6 @@ includedir=@includedir@
 Name: libnl-genl
 Description: Generic Netlink Library
 Version: @PACKAGE_VERSION@
-Requires: libnl-3
-Libs: -L${libdir} -lnl-genl
+Requires: libnl-3.0
+Libs: -L${libdir} -lnl-genl-@MAJ_VERSION@
 Cflags: -I${includedir}/libnl@MAJ_VERSION@
similarity index 75%
rename from libnl-nf-3.pc.in
rename to libnl-nf-3.0.pc.in
index b45eb51a91a8c4ee484a12c65befed6566ddd983..d82e1a69b09af4c5a14b97d174f455eef5275d4c 100644 (file)
@@ -6,6 +6,6 @@ includedir=@includedir@
 Name: libnl-nf
 Description: Netfilter Netlink Library
 Version: @PACKAGE_VERSION@
-Requires: libnl-3
-Libs: -L${libdir} -lnl-nf
+Requires: libnl-route-3.0
+Libs: -L${libdir} -lnl-nf-@MAJ_VERSION@
 Cflags: -I${includedir}/libnl@MAJ_VERSION@
similarity index 77%
rename from libnl-route-3.pc.in
rename to libnl-route-3.0.pc.in
index 498861687c0d106b059e97f322255dd4e784caec..372a4f4dd6b5034cfce0a63434d4cdafba28fe98 100644 (file)
@@ -6,6 +6,6 @@ includedir=@includedir@
 Name: libnl-route
 Description: Netlink Routing Family Library
 Version: @PACKAGE_VERSION@
-Requires: libnl-3
-Libs: -L${libdir} -lnl-route
+Requires: libnl-3.0
+Libs: -L${libdir} -lnl-route-@MAJ_VERSION@
 Cflags: -I${includedir}/libnl@MAJ_VERSION@
index 3236dbe037f0288b4ac24d4debd3ed1958f61214..a88163a2391d506f30aee11e7427037b137a1fd5 100644 (file)
@@ -1,7 +1,10 @@
 # -*- Makefile -*-
 
 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
 #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
 
 lib_LTLIBRARIES = \
-       libnl-cli.la
+       libnl-cli-3.la
 
-libnl_cli_la_LIBADD  = ${top_builddir}/lib/libnl.la \
-                      ${top_builddir}/lib/libnl-route.la \
-                      ${top_builddir}/lib/libnl-nf.la \
-                      ${top_builddir}/lib/libnl-genl.la
+libnl_cli_3_la_LIBADD  = ${top_builddir}/lib/libnl-3.la \
+                      ${top_builddir}/lib/libnl-route-3.la \
+                      ${top_builddir}/lib/libnl-nf-3.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 \
        tc.c qdisc.c class.c cls.c
 #      cls/ematch_syntax.c cls/ematch_grammar.c cls/ematch.c