diff --git a/CMakeLists.txt b/CMakeLists.txt index 6bdc928d5..a63f9f11d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,8 +45,9 @@ option(ENABLE_DOC "Enable documentation generation with Doxygen." YES) option(ENABLE_JAVADOC "Add a target to generate documentation for Java API" NO) option(ENABLE_GTK_UI "Turn on or off compilation of gtk interface." YES) option(ENABLE_LDAP "Enable LDAP support." NO) -option(ENABLE_LIME "Enable Instant Messaging Encryption." YES) option(ENABLE_SQLITE_STORAGE "Turn on compilation sqlite storage, for messages, contacts, history" YES) +option(ENABLE_ZRTP "Buid linphone with ZRTP support" YES) +cmake_dependent_option(ENABLE_LIME "Enable Instant Messaging Encryption." YES "ENABLE_ZRTP;ENABLE_SQLITE_STORAGE" NO) cmake_dependent_option(ENABLE_NOTIFY "Enable libnotify support." YES "ENABLE_GTK_UI;NOT APPLE" NO) option(ENABLE_RELATIVE_PREFIX "Find resources relatively to the installation directory." NO) option(ENABLE_STRICT "Build with strict compile options." YES) @@ -171,14 +172,27 @@ if(ENABLE_NLS) find_package(Gettext REQUIRED) find_package(Intl REQUIRED) endif() +if(ENABLE_ZRTP) + if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS) + include("${EP_bzrtp_CONFIG_DIR}/BZRTPConfig.cmake") + else() + find_package(BZRTP) + endif() + if(NOT BZRTP_FOUND) + message(WARNING "Could not find bzrtp library, linphone will be compiled without ZRTP support.") + set(ENABLE_ZRTP OFF CACHE BOOL "Build linphone with ZRTP support." FORCE) + endif() +endif() if(ENABLE_LIME) - if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS) - include("${EP_bzrtp_CONFIG_DIR}/BZRTPConfig.cmake") - else() - find_package(BZRTP) - endif() - set(HAVE_LIME 1) - set(HAVE_BZRTP 1) + if(BZRTP_FOUND) + set(HAVE_LIME 1) + else() + message(WARNING "LIME enabled but could not find bzrtp library, linphone will be compiled without LIME support.") + set(ENABLE_LIME OFF CACHE BOOL "Enable Instant Messaging Encryption." FORCE) + endif() +endif() +if(BZRTP_FOUND) + set(HAVE_ZRTP 1) endif() if(ENABLE_CXX_WRAPPER) find_package(PythonInterp REQUIRED) @@ -205,9 +219,11 @@ include_directories( set(LINPHONE_INCLUDE_DIRS ${BELLESIP_INCLUDE_DIRS} ${MEDIASTREAMER2_INCLUDE_DIRS} - ${BZRTP_INCLUDE_DIRS} ${BCTOOLBOX_CORE_INCLUDE_DIRS} ) +if (BZRTP_FOUND) + list(APPEND LINPHONE_INCLUDE_DIRS ${BZRTP_INCLUDE_DIRS}) +endif() if(ANDROID) include_directories(${CMAKE_CURRENT_BINARY_DIR}/java) endif() diff --git a/configure.ac b/configure.ac index 4467a0e55..46a0e2b85 100644 --- a/configure.ac +++ b/configure.ac @@ -648,7 +648,7 @@ if test "$zrtp" != "false" ; then fi if test "$found_zrtp" = "true" ; then zrtp=true - AC_DEFINE(HAVE_BZRTP, 1, [Defined if bzrtp is available]) + AC_DEFINE(HAVE_ZRTP, 1, [Defined if bzrtp is available]) else zrtp=false fi diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index a8c3f2c6f..3d9016ef2 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -28,7 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #ifdef SQLITE_STORAGE_ENABLED #include "sqlite3_bctbx_vfs.h" -# ifdef HAVE_BZRTP +# ifdef HAVE_ZRTP # include "bzrtp/bzrtp.h" # endif #endif @@ -6208,7 +6208,7 @@ void linphone_core_remove_iterate_hook(LinphoneCore *lc, LinphoneCoreIterateHook } -#ifdef HAVE_BZRTP +#ifdef HAVE_ZRTP 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)) { @@ -6255,11 +6255,11 @@ void linphone_core_set_zrtp_secrets_file(LinphoneCore *lc, const char* file){ linphone_core_zrtp_cache_db_init(lc, file); } } -#else +#else /* HAVE_ZRTP */ 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 +#endif /* HAVE_ZRTP */ void *linphone_core_get_zrtp_cache_db(LinphoneCore *lc){ #ifdef SQLITE_STORAGE_ENABLED @@ -6278,7 +6278,7 @@ static void linphone_core_zrtp_cache_close(LinphoneCore *lc) { #endif /* SQLITE_STORAGE_ENABLED */ } -#if defined(SQLITE_STORAGE_ENABLED) && defined (HAVE_BZRTP) +#if defined(SQLITE_STORAGE_ENABLED) && defined (HAVE_ZRTP) void linphone_core_zrtp_cache_db_init(LinphoneCore *lc, const char *fileName) { int ret;