Commit 5cb6762f authored by jehan's avatar jehan

fix configura.ac in case of no polarssl

parent a8865b89
......@@ -1093,13 +1093,30 @@ AC_ARG_WITH( polarssl,
[ --with-polarssl Set prefix where polarssl can be found (ex:/usr, /usr/local)[default=PREFIX] ],
[ polarssl_prefix=${withval}],[ polarssl_prefix=${prefix} ])
found_polarssl=no
if test "$polarssl_prefix" != "NONE" ; then
POLARSSL_CFLAGS="-I${polarssl_prefix}/include"
POLARSSL_LIBS="-L${polarssl_prefix}/lib"
POLARSSL_LIBS="-L${polarssl_prefix}/lib -lpolarssl"
CPPFLAGS_save=$CPPFLAGS
LIBS_save=$LIBS
CPPFLAGS="$CPPFLAGS $POLARSSL_CFLAGS"
LIBS="$LIBS $POLARSSL_LIBS"
AC_CHECK_HEADERS(polarssl/ssl.h, [
AC_CHECK_LIB(polarssl,sha1_hmac
,[found_polarssl=yes
AC_MSG_NOTICE([polarssl usable])]
,[POLARSSL_CFLAGS=""
POLARSSL_LIBS=""
AC_MSG_WARN([polarssl not usable])])
],[POLARSSL_CFLAGS=""
POLARSSL_LIBS=""])
CPPFLAGS=$CPPFLAGS_save
LIBS=$LIBS_save
fi
POLARSSL_LIBS="$POLARSSL_LIBS -lpolarssl"
found_polarssl=no
dnl check for DTLS-SRTP support, need polarssl version >= 1.4
AC_ARG_ENABLE(dtls,
......@@ -1117,38 +1134,31 @@ if test "$dtls" = "true" ; then
AC_MSG_ERROR("DTLS-SRTP requires SRTP")
fi
if test "x$found_polarssl" != "xyes" ; then
AC_MSG_ERROR("DTLS-SRTP requires POLARSSL")
fi
dnl check for polarssl presence and support for DTLS
CPPFLAGS_save=$CPPFLAGS
LIBS_save=$LIBS
CPPFLAGS="$CPPFLAGS $POLARSSL_CFLAGS"
LIBS="$LIBS $POLARSSL_LIBS"
AC_CHECK_HEADERS(polarssl/ssl.h,
[
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <polarssl/ssl.h>
]],
[[ssl_set_dtls_srtp_protection_profiles(0,0,0)]])]
,[found_polarssl=yes
AC_MSG_NOTICE([polarssl usable for DTLS-SRTP])]
,[AC_MSG_ERROR([polarssl not usable for DTLS-SRTP])])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <polarssl/ssl.h>
]],
[[ssl_set_dtls_srtp_protection_profiles(0,0,0)]])]
,[AC_DEFINE(HAVE_DTLS, 1, [Defined when dtls support is compiled])
AC_MSG_NOTICE([polarssl usable for DTLS-SRTP])]
,[AC_MSG_ERROR([polarssl not usable for DTLS-SRTP])])
])
CPPFLAGS=$CPPFLAGS_save
LIBS=$LIBS_save
if test "x$found_polarssl" = "xyes" ; then
AC_DEFINE(HAVE_DTLS, 1, [Defined when dtls support is compiled])
AC_MSG_NOTICE([polarssl usable for DTLS-SRTP])
AC_SUBST(POLARSSL_CFLAGS)
AC_SUBST(POLARSSL_LIBS)
fi
else
echo "DTLS-SRTP compilation is disabled."
fi
AC_SUBST(POLARSSL_CFLAGS)
AC_SUBST(POLARSSL_LIBS)
dnl ##################################################
dnl # Check for doxygen
dnl ##################################################
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment