summaryrefslogtreecommitdiff
path: root/third_party/srtp/configure.in
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/srtp/configure.in')
-rw-r--r--third_party/srtp/configure.in154
1 files changed, 103 insertions, 51 deletions
diff --git a/third_party/srtp/configure.in b/third_party/srtp/configure.in
index 49aaf8e0..445d8237 100644
--- a/third_party/srtp/configure.in
+++ b/third_party/srtp/configure.in
@@ -1,17 +1,48 @@
dnl Process this file with autoconf to produce a configure script.
-AC_INIT(srtp)
+AC_INIT([libsrtp], [1.5.4], [https://github.com/cisco/libsrtp/issues])
dnl Must come before AC_PROG_CC
if test -z "$CFLAGS"; then
dnl Default value for CFLAGS if not specified.
- CFLAGS="-Wall -O4 -fexpensive-optimizations -funroll-loops"
+ CFLAGS="-fPIC -Wall -O4 -fexpensive-optimizations -funroll-loops"
fi
dnl Checks for programs.
+AM_PROG_AR
AC_PROG_RANLIB
AC_PROG_CC
AC_PROG_INSTALL
+dnl Check the byte order
+AC_C_BIGENDIAN
+
+AC_CANONICAL_HOST
+
+dnl check host_cpu type, set defines appropriately
+case $host_cpu in
+ i*86 | x86_64 )
+ AC_DEFINE(CPU_CISC, 1,
+ [Define if building for a CISC machine (e.g. Intel).])
+ AC_DEFINE(HAVE_X86, 1,
+ [Define to use X86 inlined assembly code]);;
+ * )
+ AC_DEFINE(CPU_RISC, 1,
+ [Define if building for a RISC machine (assume slow byte access).])
+ ;;
+esac
+
+dnl Check if we are on a Windows platform.
+case $host_os in
+ *cygwin*|*mingw* )
+ EXE=.exe
+ HOST_IS_WINDOWS=yes
+ ;;
+ * )
+ EXE=""
+ ;;
+esac
+AC_SUBST(EXE) # define executable suffix; this is needed for `make clean'
+
AC_ARG_ENABLE(kernel-linux,
[AS_HELP_STRING([--enable-kernel-linux],
@@ -26,26 +57,12 @@ if test "$enable_kernel_linux" = "yes"; then
fi
AC_MSG_RESULT($enable_kernel_linux)
-if test "$cross_compiling" != yes; then
+if test "$cross_compiling" != yes -a "$HOST_IS_WINDOWS" != yes; then
dnl Check for /dev/urandom
AC_CHECK_FILE(/dev/urandom, DEV_URANDOM=/dev/urandom,
[AC_CHECK_FILE(/dev/random, DEV_URANDOM=/dev/random)])
fi
-AC_MSG_CHECKING(which random device to use)
-if test "$enable_kernel_linux" = "yes"; then
- RNG_OBJS=rand_linux_kernel.o
- AC_MSG_RESULT([Linux kernel builtin])
-else
- RNG_OBJS=rand_source.o
- if test -n "$DEV_URANDOM"; then
- AC_DEFINE_UNQUOTED(DEV_URANDOM, "$DEV_URANDOM",[Path to random device])
- AC_MSG_RESULT([$DEV_URANDOM])
- else
- AC_MSG_RESULT([standard rand() function...])
- fi
-fi
-AC_SUBST(RNG_OBJS)
dnl Checks for header files.
@@ -76,7 +93,7 @@ AC_C_INLINE
AC_TYPE_SIZE_T
dnl Checks for library functions.
-AC_CHECK_FUNCS(socket inet_aton usleep)
+AC_CHECK_FUNCS(socket inet_aton usleep sigaction)
dnl Find socket function if not found yet.
if test "x$ac_cv_func_socket" = "xno"; then
@@ -95,38 +112,6 @@ socket(0, 0, 0);
AC_MSG_RESULT(no))
fi
-dnl Check the byte order
-AC_C_BIGENDIAN
-
-AC_CANONICAL_HOST
-
-dnl check host_cpu type, set defines appropriately
-case $host_cpu in
- i*86 )
- AC_DEFINE(CPU_CISC, 1,
- [Define if building for a CISC machine (e.g. Intel).])
- AC_DEFINE(HAVE_X86, 1,
- [Define to use X86 inlined assembly code]);;
- * )
- # CPU_RISC is only supported for big endian machines.
- if test "$ac_cv_c_bigendian" = "yes"; then
- AC_DEFINE(CPU_RISC, 1,
- [Define if building for a RISC machine (assume slow byte access).])
- else
- AC_DEFINE(CPU_CISC, 1)
- fi
- ;;
-esac
-
-dnl Check if we're on a Windows platform.
-case $host_os in
- *cygwin*|*mingw* )
- EXE=.exe;;
- * ) EXE="";;
-esac
-
-AC_SUBST(EXE) # define executable suffix; this is needed for `make clean'
-
AC_MSG_CHECKING(whether to compile in debugging)
AC_ARG_ENABLE(debug,
[AS_HELP_STRING([--disable-debug],
@@ -148,6 +133,64 @@ if test "$enable_generic_aesicm" = "yes"; then
fi
AC_MSG_RESULT($enable_generic_aesicm)
+AC_MSG_CHECKING(whether to leverage OpenSSL crypto)
+AC_ARG_ENABLE(openssl,
+ [AS_HELP_STRING([--enable-openssl],
+ [compile in OpenSSL crypto engine])],
+ [], enable_openssl=no)
+AC_MSG_RESULT($enable_openssl)
+if test "$enable_openssl" = "yes"; then
+ LDFLAGS="$LDFLAGS $(pkg-config --libs openssl)";
+ CFLAGS="$CFLAGS $(pkg-config --cflags openssl)";
+
+ AC_CHECK_LIB([dl], [dlopen], [],
+ [AC_MSG_WARN([can't find libdl])])
+ AC_CHECK_LIB([z], [inflate], [],
+ [AC_MSG_WARN([can't find libz])])
+ AC_CHECK_LIB([crypto], [EVP_EncryptInit], [],
+ [AC_MSG_FAILURE([can't find openssl >1.0.1 crypto lib])])
+ AC_CHECK_LIB([crypto], [EVP_aes_128_ctr], [],
+ [AC_MSG_FAILURE([can't find openssl >1.0.1 crypto lib])])
+ AC_CHECK_LIB([crypto], [EVP_aes_128_gcm], [],
+ [AC_MSG_FAILURE([can't find openssl >1.0.1 crypto lib])])
+ AC_DEFINE(OPENSSL, 1, [Define this to use OpenSSL crypto.])
+ AES_ICM_OBJS="crypto/cipher/aes_icm_ossl.o crypto/cipher/aes_gcm_ossl.o"
+ RNG_OBJS=rand_source_ossl.o
+ HMAC_OBJS=crypto/hash/hmac_ossl.o
+ USE_OPENSSL=1
+ AC_SUBST(USE_OPENSSL)
+else
+ AES_ICM_OBJS="crypto/cipher/aes_icm.o crypto/cipher/aes.o crypto/cipher/aes_cbc.o"
+ AC_MSG_CHECKING(which random device to use)
+ if test "$enable_kernel_linux" = "yes"; then
+ RNG_OBJS=rand_linux_kernel.o
+ AC_MSG_RESULT([Linux kernel builtin])
+ else
+ RNG_OBJS=rand_source.o
+ if test -n "$DEV_URANDOM"; then
+ AC_DEFINE_UNQUOTED(DEV_URANDOM, "$DEV_URANDOM",[Path to random device])
+ AC_MSG_RESULT([$DEV_URANDOM])
+ else
+ AC_MSG_RESULT([standard rand() function...])
+ fi
+ fi
+ RNG_EXTRA_OBJS="crypto/rng/prng.o crypto/rng/ctr_prng.o"
+ HMAC_OBJS="crypto/hash/hmac.o crypto/hash/sha1.o"
+fi
+AC_SUBST(AES_ICM_OBJS)
+AC_SUBST(RNG_OBJS)
+AC_SUBST(RNG_EXTRA_OBJS)
+AC_SUBST(HMAC_OBJS)
+
+dnl Checking for PCAP
+AC_CHECK_LIB([pcap],[pcap_create],
+ [PCAP=1
+ LIBS="-lpcap $LIBS"
+ HAVE_PCAP=1
+ AC_DEFINE(HAVE_PCAP, 1, [Define to 1 if you have the `pcap' library (-lpcap)])
+ AC_SUBST(HAVE_PCAP)
+])
+
AC_MSG_CHECKING(whether to use syslog for error reporting)
AC_ARG_ENABLE(syslog,
[AS_HELP_STRING([--enable-syslog], [use syslog for error reporting])],
@@ -189,7 +232,16 @@ AC_MSG_RESULT($enable_gdoi)
AC_CONFIG_HEADER(crypto/include/config.h:config_in.h)
-AC_OUTPUT(Makefile crypto/Makefile doc/Makefile)
+AC_CHECK_PROG(PKG_CONFIG, pkg-config, yes)
+if test "x$PKG_CONFIG" != "x"; then
+ HAVE_PKG_CONFIG=1
+ AC_CONFIG_FILES([libsrtp.pc])
+else
+ HAVE_PKG_CONFIG=0
+fi
+AC_SUBST(HAVE_PKG_CONFIG)
+AC_CONFIG_FILES([Makefile crypto/Makefile doc/Makefile])
+AC_OUTPUT
# This is needed when building outside the source dir.
AS_MKDIR_P(crypto/ae_xfm)