Commit de8bd747 authored by jehan's avatar jehan

fix autotools to make use of bctoolbox

parent acf9c009
...@@ -4,7 +4,7 @@ The library written in C 89 is fully portable and can be executed on many platf ...@@ -4,7 +4,7 @@ The library written in C 89 is fully portable and can be executed on many platf
Licensing: The source code is licensed under GPLv2. Licensing: The source code is licensed under GPLv2.
Dependencies: Dependencies:
- polarssl 1.3 OR mbedTLS 1.3 - bctoolbox
By default, the upstream package installs into /usr/local. Please use By default, the upstream package installs into /usr/local. Please use
'./configure --prefix' to change it './configure --prefix' to change it
......
...@@ -31,81 +31,13 @@ if test "$found_cunit" = "no" ; then ...@@ -31,81 +31,13 @@ if test "$found_cunit" = "no" ; then
]) ])
fi fi
dnl check mbedtls unless we specified a with-polarssl
crypto_lib=mbedtls
AC_ARG_WITH( polarssl,
[ --with-polarssl Set prefix where polarssl can be found (ex:/usr, /usr/local)[default=PREFIX], if set, force usage of polarssl instead of mbedtls when both are present ],
[
polarssl_prefix=${withval}
crypto_lib=polarssl
],[ polarssl_prefix=${prefix} ])
if test "$crypto_lib" == "mbedtls" ; then dnl check bctoolbox
PKG_CHECK_MODULES(BCTOOLBOX, [bctoolbox] ,[bctoolbox_found=yes] ,foo=bar)
AC_ARG_WITH( mbedtls, if test "$bctoolbox_found" != "yes" ; then
[ --with-mbedtls Set prefix where mbedTLS can be found (ex:/usr, /usr/local)[default=PREFIX] ], AC_MSG_ERROR([bctoolbox not found, aborting. ])
[ mbedtls_prefix=${withval} ],[ mbedtls_prefix=${prefix} ])
if test "mbedtls_prefix" != "NONE" ; then
MBEDTLS_CFLAGS="-I${mbedtls_prefix}/include"
MBEDTLS_LIBS="-L${mbedtls_prefix}/lib"
fi
LIBS_save=$LIBS
LIBS="$LIBS $MBEDTLS_LIBS"
AC_CHECK_LIB(mbedtls, mbedtls_ssl_init, [
mbedtls_found=yes
MBEDTLS_LIBS="$MBEDTLS_LIBS -lmbedtls -lmbedx509 -lmbedcrypto"
AC_MSG_NOTICE("Use mbed TLS as crypto library")
],
[mbdetls_found=no],
[-lmbedx509 -lmbedcrypto]
)
LIBS=$LIBS_save
AC_SUBST(MBEDTLS_LIBS)
AC_SUBST(MBEDTLS_CFLAGS)
fi
AM_CONDITIONAL(LIBMBEDTLS, test x$mbedtls_found == xyes)
dnl check polarssl if no mbedtls was found
polarssl_found=no
if test "$mbedtls_found" != "yes" ; then
if test "$polarssl_prefix" != "NONE" ; then
POLARSSL_CFLAGS="-I${polarssl_prefix}/include"
POLARSSL_LIBS="-L${polarssl_prefix}/lib"
fi
LIBS_save=$LIBS
LIBS="$LIBS $POLARSSL_LIBS"
AC_CHECK_LIB(polarssl, ssl_init , [
POLARSSL_LIBS="$POLARSSL_LIBS -lpolarssl"
polarssl_found=yes
AC_MSG_NOTICE("Use polar SSL as crypto library")
],
[
dnl try -lmbedtls for mbedtls 1.3 which is actually the same as polarssl.
AC_CHECK_LIB(mbedtls, ssl_init , [
POLARSSL_LIBS="$POLARSSL_LIBS -lmbedtls"
polarssl_found=yes
AC_MSG_NOTICE("Use mbedtls 1.3 as crypto library")
],
[AC_MSG_ERROR([MbedTLS nor PolarSSL library not found])])
]
)
LIBS=$LIBS_save
AC_SUBST(POLARSSL_LIBS)
AC_SUBST(POLARSSL_CFLAGS)
fi fi
AM_CONDITIONAL(LIBPOLARSSL, test x$polarssl_found == xyes)
dnl check libxml2 dnl check libxml2
PKG_CHECK_MODULES(LIBXML2, [libxml-2.0] ,[libxml2_found=yes] ,foo=bar) PKG_CHECK_MODULES(LIBXML2, [libxml-2.0] ,[libxml2_found=yes] ,foo=bar)
if test "$libxml2_found" != "yes" ; then if test "$libxml2_found" != "yes" ; then
......
lib_LTLIBRARIES = libbzrtp.la lib_LTLIBRARIES = libbzrtp.la
libbzrtp_la_LIBADD= $(LIBXML2_LIBS) libbzrtp_la_LIBADD= $(LIBXML2_LIBS) $(BCTOOLBOX_LIBS)
libbzrtp_la_SOURCES= bzrtp.c cryptoUtils.c packetParser.c zidCache.c stateMachine.c pgpwords.c libbzrtp_la_SOURCES= bzrtp.c cryptoUtils.c packetParser.c zidCache.c stateMachine.c pgpwords.c
AM_CPPFLAGS= -I$(top_srcdir)/include AM_CPPFLAGS= -I$(top_srcdir)/include
AM_CFLAGS= $(LIBXML2_CFLAGS) AM_CFLAGS= $(LIBXML2_CFLAGS) $(BCTOOLBOX_CFLAGS)
if LIBPOLARSSL
libbzrtp_la_LIBADD += $(POLARSSL_LIBS)
libbzrtp_la_SOURCES += cryptoPolarssl.c
AM_CFLAGS += $(POLARSSL_CFLAGS)
endif
if LIBMBEDTLS
libbzrtp_la_LIBADD += $(MBEDTLS_LIBS)
libbzrtp_la_SOURCES += cryptoMbedtls.c
AM_CFLAGS += $(MBEDTLS_CFLAGS)
endif
libbzrtp_la_LDFLAGS=-fvisibility=hidden -no-undefined libbzrtp_la_LDFLAGS=-fvisibility=hidden -no-undefined
......
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