aboutsummaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-01-09 13:27:01 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2020-01-09 14:10:20 +0100
commitd1b1ff77a6bc2f70366c5d2f5079c70f5eae52a0 (patch)
treed047bf43cc6a46ed6e693e6a6c456249f77ed850 /configure.ac
parentc633f54a3cdc95d6d1130be6cc5dc930c104beac (diff)
configure.ac: Introduce --{enable,disable}-libsctp configure flag
Similar to what we do in libosmocore already, we want to deterministically enable or disable support for the feature without having into account if the system has a libsctp. If libsctp is missing and support is enabled, then fail. Extra checks are also added: * Check netinet/sctp.h header * Check libosmocore was built with libsctp support (API osmo_sock_init2_multiaddr() we require). * In stream.c make sure it can be built without HAVE_LIBSCTP, and that set_addrs() fails for more than 1 address (since that feature is only supported through osmo_sock_init2_multiaddrs()). Change-Id: I4b3e1f1894f13ac1175a71a5139c02a2633be26d
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac28
1 files changed, 18 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac
index 7af10ec..a96fb70 100644
--- a/configure.ac
+++ b/configure.ac
@@ -87,16 +87,24 @@ PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 1.3.0)
dnl FIXME: We depend on libosmoabis by now until we can move LAPD code here
PKG_CHECK_MODULES(LIBOSMOABIS, libosmoabis >= 0.6.0)
-old_LIBS=$LIBS
-AC_SEARCH_LIBS([sctp_send], [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_send not found in searched libs])])
-LIBS=$old_LIBS
+AC_ARG_ENABLE([libsctp], [AS_HELP_STRING([--disable-libsctp], [Do not enable socket multiaddr APIs requiring libsctp])],
+ [ENABLE_LIBSCTP=$enableval], [ENABLE_LIBSCTP="yes"])
+AM_CONDITIONAL(ENABLE_LIBSCTP, test x"$ENABLE_LIBSCTP" = x"yes")
+AS_IF([test "x$ENABLE_LIBSCTP" = "xyes"], [
+ AC_CHECK_HEADERS(netinet/sctp.h,,AC_MSG_ERROR(netinet/sctp.h not found))
+ old_LIBS=$LIBS
+ AC_CHECK_LIB(osmocore, osmo_sock_init2_multiaddr,, AC_MSG_ERROR(libosmocore built without libsctp support), $LIBOSMOCORE_LIBS)
+ LIBS=$old_LIBS
+ AC_SEARCH_LIBS([sctp_send], [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_send not found in searched libs])])
+ LIBS=$old_LIBS
+])
AC_CHECK_HEADERS(dahdi/user.h,,AC_MSG_WARN(DAHDI input driver will not be built))