diff --git a/CMakeLists.txt b/CMakeLists.txt index e4eba9c0c..6bdc928d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -178,6 +178,7 @@ if(ENABLE_LIME) find_package(BZRTP) endif() set(HAVE_LIME 1) + set(HAVE_BZRTP 1) endif() if(ENABLE_CXX_WRAPPER) find_package(PythonInterp REQUIRED) diff --git a/configure.ac b/configure.ac index 0a61de025..4467a0e55 100644 --- a/configure.ac +++ b/configure.ac @@ -630,7 +630,7 @@ AC_ARG_ENABLE(alsa, [alsa=true] ) -dnl this options are just for passing to mediastreamer2 subproject + AC_ARG_ENABLE(zrtp, [AS_HELP_STRING([--enable-zrtp], [Turn on zrtp support])], [case "${enableval}" in @@ -638,9 +638,22 @@ AC_ARG_ENABLE(zrtp, no) zrtp=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-zrtp) ;; esac], - [zrtp=false] + [zrtp=auto] ) +if test "$zrtp" != "false" ; then + PKG_CHECK_MODULES(LIBBZRTP, libbzrtp >= 1.0.0, found_zrtp=true, found_zrtp=false) + if test "$zrtp$found_zrtp" = "truefalse" ; then + AC_MSG_ERROR("Cound not find bZRTP library.") + fi + if test "$found_zrtp" = "true" ; then + zrtp=true + AC_DEFINE(HAVE_BZRTP, 1, [Defined if bzrtp is available]) + else + zrtp=false + fi +fi + dnl this options are just for passing to mediastreamer2 subproject AC_ARG_ENABLE(dtls, [AS_HELP_STRING([--enable-dtls], [Turn on srtp-dtls support - requires polarssl > 1.4])], @@ -701,18 +714,21 @@ AC_ARG_ENABLE(lime, no) lime=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-lime) ;; esac], - [lime=false] + [lime=auto] ) +if test "$lime" = "true" ; then + if test "$zrtp" = "false" ; then + AC_MSG_ERROR([LIME requires zrtp]) + fi +fi + if test "$lime" != "false" ; then - if test "x$found_polarssl" != "xyes" ; then - if test "$lime" = "true" ; then - AC_MSG_ERROR("LIME requires POLARSSL in version >= 1.3") - fi - lime=false - else + if test "$found_zrtp" = "true" ; then AC_DEFINE(HAVE_LIME, 1, [Defined when LIME support is compiled]) lime=true + else + lime = false fi fi @@ -1091,6 +1107,7 @@ printf "* %-30s %s\n" "Console interface" $console_ui printf "* %-30s %s\n" "Tools" $build_tools printf "* %-30s %s\n" "Sqlite storage" $enable_sqlite_storage printf "* %-30s %s\n" "VCard support" $enable_vcard +printf "* %-30s %s\n" "ZRTP" $zrtp printf "* %-30s %s\n" "IM encryption" $lime printf "* %-30s %s\n" "uPnP support" $build_upnp printf "* %-30s %s\n" "LDAP support" $enable_ldap diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 6a25d6a48..a8c3f2c6f 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -28,7 +28,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #ifdef SQLITE_STORAGE_ENABLED #include "sqlite3_bctbx_vfs.h" -#include "bzrtp/bzrtp.h" +# ifdef HAVE_BZRTP +# include "bzrtp/bzrtp.h" +# endif #endif #include @@ -106,7 +108,7 @@ static void set_media_network_reachable(LinphoneCore* lc,bool_t isReachable); static void linphone_core_run_hooks(LinphoneCore *lc); static void linphone_core_uninit(LinphoneCore *lc); static void linphone_core_zrtp_cache_close(LinphoneCore *lc); -static void linphone_core_zrtp_cache_db_init(LinphoneCore *lc, const char *fileName); +void linphone_core_zrtp_cache_db_init(LinphoneCore *lc, const char *fileName); #include "enum.h" #include "contact_providers_priv.h" @@ -6206,6 +6208,7 @@ void linphone_core_remove_iterate_hook(LinphoneCore *lc, LinphoneCoreIterateHook } +#ifdef HAVE_BZRTP void linphone_core_set_zrtp_secrets_file(LinphoneCore *lc, const char* file){ /* shall we perform cache migration ? */ if (!lp_config_get_int(lc->config,"sip","zrtp_cache_migration_done",FALSE)) { @@ -6252,6 +6255,11 @@ void linphone_core_set_zrtp_secrets_file(LinphoneCore *lc, const char* file){ linphone_core_zrtp_cache_db_init(lc, file); } } +#else +void linphone_core_set_zrtp_secrets_file(LinphoneCore *lc, const char* file){ + ms_error("linphone_core_set_zrtp_secrets_file(): no zrtp support in this build."); +} +#endif void *linphone_core_get_zrtp_cache_db(LinphoneCore *lc){ #ifdef SQLITE_STORAGE_ENABLED @@ -6270,9 +6278,9 @@ static void linphone_core_zrtp_cache_close(LinphoneCore *lc) { #endif /* SQLITE_STORAGE_ENABLED */ } -#ifdef SQLITE_STORAGE_ENABLED +#if defined(SQLITE_STORAGE_ENABLED) && defined (HAVE_BZRTP) -static void linphone_core_zrtp_cache_db_init(LinphoneCore *lc, const char *fileName) { +void linphone_core_zrtp_cache_db_init(LinphoneCore *lc, const char *fileName) { int ret; const char *errmsg; sqlite3 *db; @@ -6298,10 +6306,6 @@ static void linphone_core_zrtp_cache_db_init(LinphoneCore *lc, const char *fileN lc->zrtp_cache_db = db; } -#else /* SQLITE_STORAGE_ENABLED */ -static void linphone_core_zrtp_cache_db_init(LinphoneCore *lc, const char *fileName) { - ms_warning("Tried to open %s as zrtp_cache_db_file, but SQLITE_STORAGE is not enabled", lc->zrtp_cache_db_file); -} #endif /* SQLITE_STORAGE_ENABLED */ void linphone_core_set_user_certificates_path(LinphoneCore *lc, const char* path){