summaryrefslogtreecommitdiff
path: root/autoconf
diff options
context:
space:
mode:
authorSean Bright <sean.bright@gmail.com>2017-05-26 12:06:34 -0400
committerSean Bright <sean.bright@gmail.com>2017-05-26 12:06:34 -0400
commit5e9cd1f20d86de1c25b7a9accffb7d3e2601878b (patch)
tree6f0b0fb740f41b0761475657087611c563766f10 /autoconf
parentd4ccd3a6c088f4d2fefda1a44e4555dd54335cda (diff)
res_srtp: Add support for libsrtp2
ASTERISK-25294 #close Reported by: Tzafrir Cohen ASTERISK-26976 #close Reported by: Alex Change-Id: I789b1c3d1ed31365bbd9339fa58ef36f48833c40
Diffstat (limited to 'autoconf')
-rw-r--r--autoconf/ast_ext_lib.m436
1 files changed, 36 insertions, 0 deletions
diff --git a/autoconf/ast_ext_lib.m4 b/autoconf/ast_ext_lib.m4
index 2c73b40c5..cd5a3a779 100644
--- a/autoconf/ast_ext_lib.m4
+++ b/autoconf/ast_ext_lib.m4
@@ -164,3 +164,39 @@ _ACEOF
fi
m4_ifval([$7], [AH_TEMPLATE(m4_bpatsubst([[HAVE_$1_VERSION]], [(.*)]), [Define to the version of the $2 library.])])
])
+
+# Check if the previously discovered library can be dynamically linked.
+#
+# AST_EXT_LIB_CHECK_SHARED([package], [library], [function], [header],
+# [extra libs], [extra cflags], [action-if-true], [action-if-false])
+AC_DEFUN([AST_EXT_LIB_CHECK_SHARED],
+[
+if test "x${PBX_$1}" = "x1"; then
+ ast_ext_lib_check_shared_saved_libs="${LIBS}"
+ ast_ext_lib_check_shared_saved_ldflags="${LDFLAGS}"
+ ast_ext_lib_check_shared_saved_cflags="${CFLAGS}"
+ LIBS="${LIBS} ${$1_LIB} $5"
+ LDFLAGS="${LDFLAGS} -shared -fPIC"
+ CFLAGS="${CFLAGS} ${$1_INCLUDE} $6"
+ AC_MSG_CHECKING(for the ability of -l$2 to be linked in a shared object)
+ AC_LINK_IFELSE(
+ [
+ AC_LANG_PROGRAM(
+ [#include <$4>],
+ [$3();]
+ )
+ ],
+ [
+ AC_MSG_RESULT(yes)
+ $7
+ ],
+ [
+ AC_MSG_RESULT(no)
+ $8
+ ]
+ )
+ CFLAGS="${ast_ext_lib_check_shared_saved_cflags}"
+ LDFLAGS="${ast_ext_lib_check_shared_saved_ldflags}"
+ LIBS="${ast_ext_lib_check_shared_saved_libs}"
+fi
+])