[PATCH 1/3] Build shared objects with libtool

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Vasil Velichckov vasil_vel at abv.bg
Wed Sep 18 17:04:27 UTC 2013


Convert static libraries to shared objects.
Link the test programs to the shared objects
---
 .gitignore             |    5 +++++
 configure.ac           |    2 +-
 src/Makefile.am        |   18 +++++++++++++-----
 tests/m2ua/Makefile.am |    2 +-
 tests/sccp/Makefile.am |    4 ++--
 5 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/.gitignore b/.gitignore
index 65fb1ef..1bb2d00 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,9 @@
 *.o
 *.a
+*.la
+*.lo
 .deps
+.libs
 Makefile
 Makefile.in
 bscconfig.h
@@ -23,6 +26,8 @@ depcomp
 install-sh
 missing
 stamp-h1
+libtool
+ltmain.sh
 
 # git-version-gen magic
 .tarball-version
diff --git a/configure.ac b/configure.ac
index 98a6b1f..9dea792 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13,7 +13,7 @@ dnl checks for programs
 AC_PROG_MAKE_SET
 AC_PROG_CC
 AC_PROG_INSTALL
-AC_PROG_RANLIB
+LT_INIT
 
 PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.3.0)
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 584c3bd..0c29085 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,9 +1,17 @@
+# This is _NOT_ the library release version, it's an API version.
+# Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification
+LIBVERSION=1:0:0
+
 AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -I$(top_builddir)
 AM_CFLAGS=-Wall $(LIBOSMOCORE_CFLAGS)
 
-sccpdir = $(libdir)
-sccp_LIBRARIES = libsccp.a libmtp.a libm2ua.a
+lib_LTLIBRARIES = libsccp.la libmtp.la libm2ua.la
+
+libsccp_la_SOURCES = sccp.c
+libsccp_la_LDFLAGS = -version-info $(LIBVERSION) $(LIBOSMOCORE_LDFLAGS) -no-undefined
+
+libmtp_la_SOURCES = mtp_pcap.c
+libmtp_la_LDFLAGS = -version-info $(LIBVERSION) -no-undefined
 
-libsccp_a_SOURCES = sccp.c
-libmtp_a_SOURCES = mtp_pcap.c 
-libm2ua_a_SOURCES = m2ua_msg.c
+libm2ua_la_SOURCES = m2ua_msg.c
+libm2ua_la_LDFLAGS = -version-info $(LIBVERSION) $(LIBOSMOCORE_LDFLAGS) -no-undefined
diff --git a/tests/m2ua/Makefile.am b/tests/m2ua/Makefile.am
index 7299e9b..128fc68 100644
--- a/tests/m2ua/Makefile.am
+++ b/tests/m2ua/Makefile.am
@@ -5,4 +5,4 @@ EXTRA_DIST = m2ua_test.ok
 
 noinst_PROGRAMS = m2ua_test
 m2ua_test_SOURCES = m2ua_test.c
-m2ua_test_LDADD = $(top_builddir)/src/libm2ua.a $(LIBOSMOCORE_LIBS)
+m2ua_test_LDADD = $(top_builddir)/src/libm2ua.la $(LIBOSMOCORE_LIBS)
diff --git a/tests/sccp/Makefile.am b/tests/sccp/Makefile.am
index 8cce20c..7c4cb20 100644
--- a/tests/sccp/Makefile.am
+++ b/tests/sccp/Makefile.am
@@ -5,6 +5,6 @@ EXTRA_DIST = sccp_test.ok
 
 noinst_PROGRAMS = sccp_test
 
-sccp_test_SOURCES = sccp_test.c $(top_srcdir)/src/sccp.c
-sccp_test_LDADD = $(LIBOSMOCORE_LIBS)
+sccp_test_SOURCES = sccp_test.c
+sccp_test_LDADD = $(top_builddir)/src/libsccp.la $(LIBOSMOCORE_LIBS)
 
-- 
1.7.10.4





More information about the OpenBSC mailing list