laforge submitted this change.

View Change

Approvals: Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve laforge: Looks good to me, approved
configure: Support libsctp < 1.0.17 without libsctp.pc

libsctp 1.0.17 is the first to contain a pkgconfig file in upstream.
Current OpenSure Leap 15.3 as well as our OpenEmbedded meta-telephony
layer still ship 1.0.16 which contain no pkgconfig file.

Let's attempt first finding the .pc file, and otherwise manually link
against the lib.

Related: https://bugzilla.opensuse.org/show_bug.cgi?id=1197590
Related: https://build.opensuse.org/request/show/965348
Fixes: 12eed19066a11aece6f346b54b85326bc6ba7f0b
Change-Id: I241634388c2d32adffebd860c88bdd13002a6af0
---
M configure.ac
M libosmocore.pc.in
2 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/configure.ac b/configure.ac
index 89615fd..0210926 100644
--- a/configure.ac
+++ b/configure.ac
@@ -223,16 +223,22 @@
[ENABLE_LIBSCTP=$enableval], [ENABLE_LIBSCTP="yes"])
AM_CONDITIONAL(ENABLE_LIBSCTP, test x"$ENABLE_LIBSCTP" = x"yes")
AS_IF([test "x$ENABLE_LIBSCTP" = "xyes"], [
- old_LIBS=$LIBS
- AC_SEARCH_LIBS([sctp_bindx], [sctp], [
- AC_DEFINE(HAVE_LIBSCTP, 1, [Define 1 to enable SCTP support])
- AC_SUBST(HAVE_LIBSCTP, [1])
- if test -n "$ac_lib"; then
- AC_SUBST(LIBSCTP_LIBS, [-l$ac_lib])
- fi
- ], [
- AC_MSG_ERROR([sctp_bindx not found in searched libs])])
- LIBS=$old_LIBS
+ AC_DEFINE(HAVE_LIBSCTP, 1, [Define 1 to enable SCTP support])
+ # Attempt finding .pc, otherwise set manually (<1.0.17 have no .pc file)
+ PKG_CHECK_MODULES(LIBSCTP, libsctp,
+ [AC_SUBST(LIBSCTP_PC, [libsctp])],
+ [
+ AC_MSG_NOTICE([libsctp.pc not found (building against <1.0.17 ?), attempting manual lib lookup])
+ old_LIBS=$LIBS
+ AC_SEARCH_LIBS([sctp_bindx], [sctp], [
+ AC_SUBST(HAVE_LIBSCTP, [1])
+ if test -n "$ac_lib"; then
+ AC_SUBST(LIBSCTP_LIBS, [-l$ac_lib])
+ fi
+ ], [
+ AC_MSG_ERROR([sctp_bindx not found in searched libs])])
+ LIBS=$old_LIBS
+ ])
])

AC_ARG_ENABLE([sctp-tests], [AS_HELP_STRING([--disable-sctp-tests], [Do not run socket tests requiring system SCTP support])],
diff --git a/libosmocore.pc.in b/libosmocore.pc.in
index 6296417..d804b8e 100644
--- a/libosmocore.pc.in
+++ b/libosmocore.pc.in
@@ -7,7 +7,7 @@
Description: C Utility Library
Version: @VERSION@
Requires: talloc
-Requires.private: libsctp
+Requires.private: @LIBSCTP_PC@
Libs: -L${libdir} -losmocore
-Libs.private: @PTHREAD_LIBS@
+Libs.private: @PTHREAD_LIBS@ @LIBSCTP_LIBS@
Cflags: -I${includedir}/ @PTHREAD_CFLAGS@

To view, visit change 27598. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I241634388c2d32adffebd860c88bdd13002a6af0
Gerrit-Change-Number: 27598
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>
Gerrit-MessageType: merged