fix automake build and simplify sqlite enablement options

This commit is contained in:
Simon Morlat 2016-05-20 09:37:53 +02:00
parent 662df7811a
commit b79535afe9
14 changed files with 45 additions and 140 deletions

View file

@ -44,7 +44,7 @@ option(ENABLE_DOC "Enable documentation generation with Doxygen." YES)
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." NO)
option(ENABLE_MSG_STORAGE "Turn on compilation of message storage." YES)
option(ENABLE_SQLITE_STORAGE "Turn on compilation sqlite storage, for messages, contacts, history" YES)
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)
@ -57,8 +57,6 @@ option(ENABLE_VIDEO "Build with video support." YES)
cmake_dependent_option(ENABLE_ASSISTANT "Turn on assistant compiling." YES "ENABLE_GTK_UI" NO)
option(ENABLE_DEBUG_LOGS "Turn on or off debug level logs." NO)
option(ENABLE_NLS "Build with internationalisation support" YES)
option(ENABLE_CALL_LOGS_STORAGE "Turn on compilation of call logs storage." YES)
option(ENABLE_FRIENDS_SQL_STORAGE "Turn on compilation of friends sql storage." YES)
option(ENABLE_VCARD "Turn on compilation of vcard4 support." YES)
@ -120,7 +118,7 @@ if(ENABLE_TUNNEL)
set(ENABLE_TUNNEL OFF CACHE BOOL "Enable tunnel support." FORCE)
endif()
endif()
if(ENABLE_MSG_STORAGE)
if(SQLITE_STORAGE_ENABLED)
find_package(Sqlite3 REQUIRED)
endif()
if(ENABLE_NOTIFY)
@ -158,12 +156,6 @@ if(ENABLE_NLS)
find_package(Gettext REQUIRED)
find_package(Intl REQUIRED)
endif()
if(ENABLE_CALL_LOGS_STORAGE)
find_package(Sqlite3 REQUIRED)
endif()
if (ENABLE_FRIENDS_SQL_STORAGE)
find_package(Sqlite3 REQUIRED)
endif()
if(ENABLE_LIME)
set(HAVE_LIME 1)
endif()
@ -212,14 +204,8 @@ if(ZLIB_FOUND)
endif()
if(SQLITE3_FOUND)
include_directories(${SQLITE3_INCLUDE_DIRS})
if(ENABLE_MSG_STORAGE)
add_definitions("-DMSG_STORAGE_ENABLED")
endif()
if(ENABLE_CALL_LOGS_STORAGE)
add_definitions("-DCALL_LOGS_STORAGE_ENABLED")
endif()
if(ENABLE_FRIENDS_SQL_STORAGE)
add_definitions("-DFRIENDS_SQL_STORAGE_ENABLED")
if(SQLITE_STORAGE_ENABLED)
add_definitions("-DSQLITE_STORAGE_ENABLED")
endif()
endif()
if(INTL_FOUND)

View file

@ -914,31 +914,31 @@ fi
AM_CONDITIONAL(BUILD_VCARD, test x$enable_vcard = xtrue)
AC_ARG_ENABLE(msg-storage,
[AS_HELP_STRING([--enable-msg-storage=[yes/no]], [Turn on compilation of message storage (default=auto)])],
AC_ARG_ENABLE(sqlite-storage,
[AS_HELP_STRING([--sqlite-msg-storage=[yes/no]], [Turn on compilation of sqlite storage for call history, messages, friends (default=auto)])],
[case "${enableval}" in
yes) enable_msg_storage=true ;;
no) enable_msg_storage=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-msg-storage) ;;
yes) enable_sqlite_storage=true ;;
no) enable_sqlite_storage=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-sqlite-storage) ;;
esac],
[enable_msg_storage=auto]
[enable_sqlite_storage=auto]
)
if test x$enable_msg_storage != xfalse; then
if test x$enable_sqlite_storage != xfalse; then
PKG_CHECK_MODULES(SQLITE3,[sqlite3 >= 3.6.0],[found_sqlite=yes],[found_sqlite=no])
if test "$found_sqlite" = "no"; then
dnl Check the lib presence in case the PKG-CONFIG version is not found
AC_CHECK_LIB(sqlite3, sqlite3_open, [SQLITE3_LIBS+=" -lsqlite3 "; found_sqlite=yes], [foo=bar])
fi
if test "$found_sqlite" = "yes"; then
SQLITE3_CFLAGS+=" -DMSG_STORAGE_ENABLED"
SQLITE3_CFLAGS+=" -DSQLITE_STORAGE_ENABLED"
if test "$build_macos" = "yes" -o "$ios_found" = "yes"; then
SQLITE3_LIBS+=" -liconv"
fi
enable_msg_storage=true
else
if test x$enable_msg_storage = xtrue; then
AC_MSG_ERROR([sqlite3, required for message storage, not found])
if test x$enable_sqlite_storage = xtrue; then
AC_MSG_ERROR([sqlite3, required for storage, not found])
fi
enable_msg_storage=false
fi
@ -947,79 +947,10 @@ if test x$enable_msg_storage != xfalse; then
AC_SUBST(SQLITE3_LIBS)
fi
AM_CONDITIONAL(BUILD_MSG_STORAGE, test x$enable_msg_storage = xtrue)
AM_CONDITIONAL(BUILD_SQLITE_STORAGE, test x$enable_sqlite_storage = xtrue)
AC_ARG_ENABLE(call-logs-storage,
[AS_HELP_STRING([--enable-call-logs-storage=[yes/no]], [Turn on compilation of call logs storage (default=auto)])],
[case "${enableval}" in
yes) enable_call_logs_storage=true ;;
no) enable_call_logs_storage=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-call-logs-storage) ;;
esac],
[enable_call_logs_storage=auto]
)
if test x$enable_call_logs_storage != xfalse; then
PKG_CHECK_MODULES(SQLITE3,[sqlite3 >= 3.6.0],[found_sqlite=yes],[found_sqlite=no])
if test "$found_sqlite" = "no"; then
dnl Check the lib presence in case the PKG-CONFIG version is not found
AC_CHECK_LIB(sqlite3, sqlite3_open, [SQLITE3_LIBS+=" -lsqlite3 "; found_sqlite=yes], [foo=bar])
fi
if test "$found_sqlite" = "yes"; then
SQLITE3_CFLAGS+=" -DCALL_LOGS_STORAGE_ENABLED"
if test "$build_macos" = "yes" -o "$ios_found" = "yes"; then
SQLITE3_LIBS+=" -liconv"
fi
enable_call_logs_storage=true
else
if test x$enable_call_logs_storage = xtrue; then
AC_MSG_ERROR([sqlite3, required for call logs storage, not found])
fi
enable_call_logs_storage=false
fi
AC_SUBST(SQLITE3_CFLAGS)
AC_SUBST(SQLITE3_LIBS)
fi
AM_CONDITIONAL(BUILD_CALL_LOGS_STORAGE, test x$enable_call_logs_storage = xtrue)
AC_ARG_ENABLE(friends-db-storage,
[AS_HELP_STRING([--enable-friends-db-storage=[yes/no]], [Turn on compilation of friends database storage (default=auto)])],
[case "${enableval}" in
yes) enable_friends_db_storage=true ;;
no) enable_friends_db_storage=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-friends-db-storage) ;;
esac],
[enable_friends_db_storage=auto]
)
if test x$enable_friends_db_storage != xfalse; then
PKG_CHECK_MODULES(SQLITE3,[sqlite3 >= 3.6.0],[found_sqlite=yes],[found_sqlite=no])
if test "$found_sqlite" = "no"; then
dnl Check the lib presence in case the PKG-CONFIG version is not found
AC_CHECK_LIB(sqlite3, sqlite3_open, [SQLITE3_LIBS+=" -lsqlite3 "; found_sqlite=yes], [foo=bar])
fi
if test "$found_sqlite" = "yes"; then
SQLITE3_CFLAGS+=" -DFRIENDS_SQL_STORAGE_ENABLED"
if test "$build_macos" = "yes" -o "$ios_found" = "yes"; then
SQLITE3_LIBS+=" -liconv"
fi
enable_friends_db_storage=true
else
if test x$enable_friends_db_storage = xtrue; then
AC_MSG_ERROR([sqlite3, required for friends database storage, not found])
fi
enable_friends_db_storage=false
fi
AC_SUBST(SQLITE3_CFLAGS)
AC_SUBST(SQLITE3_LIBS)
fi
AM_CONDITIONAL(BUILD_FRIENDS_DB_STORAGE, test x$enable_friends_db_storage = xtrue)
PKG_CHECK_MODULES(BELLESIP, [belle-sip >= 1.4.0])
PKG_CHECK_MODULES(BELLESIP, [belle-sip >= 1.4.2])
SIPSTACK_CFLAGS="$BELLESIP_CFLAGS"
SIPSTACK_LIBS="$BELLESIP_LIBS"
@ -1146,9 +1077,7 @@ printf "* %-30s %s\n" "GTK interface" $gtk_ui
printf "* %-30s %s\n" "Account assistant" $build_wizard
printf "* %-30s %s\n" "Console interface" $console_ui
printf "* %-30s %s\n" "Tools" $build_tools
printf "* %-30s %s\n" "Message storage" $enable_msg_storage
printf "* %-30s %s\n" "Call logs storage" $enable_call_logs_storage
printf "* %-30s %s\n" "Friends db storage" $enable_friends_db_storage
printf "* %-30s %s\n" "Sqlite storage" $enable_sqlite_storage
printf "* %-30s %s\n" "VCard support" $enable_vcard
printf "* %-30s %s\n" "IM encryption" $lime
printf "* %-30s %s\n" "uPnP support" $build_upnp

View file

@ -96,6 +96,7 @@ liblinphone_la_SOURCES=\
vtables.c \
carddav.c \
ringtoneplayer.c ringtoneplayer.h\
sqlite3_bctbx_vfs.c sqlite3_bctbx_vfs.h\
$(GITVERSION_FILE)
if BUILD_UPNP

View file

@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <time.h>
#include "private.h"
#ifdef CALL_LOGS_STORAGE_ENABLED
#ifdef SQLITE_STORAGE_ENABLED
#ifndef _WIN32
#if !defined(ANDROID) && !defined(__QNXNTO__)
# include <langinfo.h>
@ -325,7 +325,7 @@ BELLE_SIP_INSTANCIATE_VPTR(LinphoneCallLog, belle_sip_object_t,
* SQL storage related functions *
******************************************************************************/
#ifdef CALL_LOGS_STORAGE_ENABLED
#ifdef SQLITE_STORAGE_ENABLED
static void linphone_create_table(sqlite3* db) {
char* errmsg=NULL;

View file

@ -26,7 +26,7 @@
#include "private.h"
#include "lpconfig.h"
#ifdef FRIENDS_SQL_STORAGE_ENABLED
#ifdef SQLITE_STORAGE_ENABLED
#ifndef _WIN32
#if !defined(ANDROID) && !defined(__QNXNTO__)
# include <langinfo.h>
@ -602,7 +602,7 @@ void linphone_friend_update_subscribes(LinphoneFriend *fr, LinphoneProxyConfig *
void linphone_friend_save(LinphoneFriend *fr, LinphoneCore *lc) {
if (!lc) return;
#ifdef FRIENDS_SQL_STORAGE_ENABLED
#ifdef SQLITE_STORAGE_ENABLED
if (lc->friends_db_file) {
linphone_core_store_friend_in_db(lc, fr);
} else {
@ -1092,7 +1092,7 @@ BELLE_SIP_INSTANCIATE_VPTR(LinphoneFriend, belle_sip_object_t,
* SQL storage related functions *
******************************************************************************/
#ifdef FRIENDS_SQL_STORAGE_ENABLED
#ifdef SQLITE_STORAGE_ENABLED
static void linphone_create_table(sqlite3* db) {
char* errmsg = NULL;
@ -1503,7 +1503,7 @@ void linphone_core_migrate_friends_from_rc_to_db(LinphoneCore *lc) {
LinphoneFriend *lf = NULL;
LinphoneFriendList *lfl = linphone_core_get_default_friend_list(lc);
int i;
#ifndef FRIENDS_SQL_STORAGE_ENABLED
#ifndef SQLITE_STORAGE_ENABLED
ms_warning("linphone has been compiled without sqlite, can't migrate friends");
return;
#endif

View file

@ -453,7 +453,7 @@ static LinphoneFriendListStatus _linphone_friend_list_remove_friend(LinphoneFrie
MSList *elem = ms_list_find(list->friends, lf);
if (elem == NULL) return LinphoneFriendListNonExistentFriend;
#ifdef FRIENDS_SQL_STORAGE_ENABLED
#ifdef SQLITE_STORAGE_ENABLED
if (lf && lf->lc && lf->lc->friends_db) {
linphone_core_remove_friend_from_db(lf->lc, lf);
}

View file

@ -4640,7 +4640,7 @@ void linphone_call_log_completed(LinphoneCall *call){
ms_free(info);
}
#ifdef CALL_LOGS_STORAGE_ENABLED
#ifdef SQLITE_STORAGE_ENABLED
if (lc->logs_db) {
call_logs_sqlite_db_found = TRUE;
linphone_core_store_call_log(lc, call->log);

View file

@ -1386,7 +1386,7 @@ static void read_friends_from_rc(LinphoneCore *lc)
static void ui_config_read(LinphoneCore *lc)
{
#ifndef FRIENDS_SQL_STORAGE_ENABLED
#ifndef SQLITE_STORAGE_ENABLED
read_friends_from_rc(lc);
#else
if (!lc->friends_db) {
@ -2001,7 +2001,7 @@ LinphoneFriendList* linphone_core_get_default_friend_list(const LinphoneCore *lc
void linphone_core_remove_friend_list(LinphoneCore *lc, LinphoneFriendList *list) {
MSList *elem = ms_list_find(lc->friends_lists, list);
if (elem == NULL) return;
#ifdef FRIENDS_SQL_STORAGE_ENABLED
#ifdef SQLITE_STORAGE_ENABLED
linphone_core_remove_friends_list_from_db(lc, list);
#endif
linphone_core_notify_friend_list_removed(lc, list);
@ -2016,7 +2016,7 @@ void linphone_core_add_friend_list(LinphoneCore *lc, LinphoneFriendList *list) {
list->lc = lc;
}
lc->friends_lists = ms_list_append(lc->friends_lists, linphone_friend_list_ref(list));
#ifdef FRIENDS_SQL_STORAGE_ENABLED
#ifdef SQLITE_STORAGE_ENABLED
linphone_core_store_friends_list_in_db(lc, list);
#endif
linphone_core_notify_friend_list_created(lc, list);
@ -5247,7 +5247,7 @@ void linphone_core_set_call_logs_database_path(LinphoneCore *lc, const char *pat
}
const MSList* linphone_core_get_call_logs(LinphoneCore *lc) {
#ifdef CALL_LOGS_STORAGE_ENABLED
#ifdef SQLITE_STORAGE_ENABLED
if (lc->logs_db) {
linphone_core_get_call_history(lc);
}
@ -5258,7 +5258,7 @@ const MSList* linphone_core_get_call_logs(LinphoneCore *lc) {
void linphone_core_clear_call_logs(LinphoneCore *lc) {
bool_t call_logs_sqlite_db_found = FALSE;
lc->missed_calls=0;
#ifdef CALL_LOGS_STORAGE_ENABLED
#ifdef SQLITE_STORAGE_ENABLED
if (lc->logs_db) {
call_logs_sqlite_db_found = TRUE;
linphone_core_delete_call_history(lc);
@ -5281,7 +5281,7 @@ void linphone_core_reset_missed_calls_count(LinphoneCore *lc) {
void linphone_core_remove_call_log(LinphoneCore *lc, LinphoneCallLog *cl) {
bool_t call_logs_sqlite_db_found = FALSE;
#ifdef CALL_LOGS_STORAGE_ENABLED
#ifdef SQLITE_STORAGE_ENABLED
if (lc->logs_db) {
call_logs_sqlite_db_found = TRUE;
linphone_core_delete_call_log(lc, cl);
@ -5300,7 +5300,7 @@ void linphone_core_migrate_logs_from_rc_to_db(LinphoneCore *lc) {
int original_logs_count, migrated_logs_count;
int i;
#ifndef CALL_LOGS_STORAGE_ENABLED
#ifndef SQLITE_STORAGE_ENABLED
ms_warning("linphone has been compiled without sqlite, can't migrate call logs");
return;
#endif

View file

@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "linphonecore.h"
#if defined(MSG_STORAGE_ENABLED) || defined(CALL_LOGS_STORAGE_ENABLED)
#ifdef SQLITE_STORAGE_ENABLED
#ifndef PRIu64
#define PRIu64 "I64u"
@ -95,7 +95,7 @@ int _linphone_sqlite3_open(const char *db_file, sqlite3 **db) {
#ifdef MSG_STORAGE_ENABLED
#ifdef SQLITE_STORAGE_ENABLED
static ORTP_INLINE LinphoneChatMessage* get_transient_message(LinphoneChatRoom* cr, unsigned int storage_id){

View file

@ -53,7 +53,7 @@
#include "upnp.h"
#endif //BUILD_UPNP
#ifdef MSG_STORAGE_ENABLED
#ifdef SQLITE_STORAGE_ENABLED
#include "sqlite3.h"
#endif
@ -984,17 +984,13 @@ struct _LinphoneCore
char* device_id;
MSList *last_recv_msg_ids;
char *chat_db_file;
#ifdef MSG_STORAGE_ENABLED
sqlite3 *db;
bool_t debug_storage;
#endif
char *logs_db_file;
#ifdef CALL_LOGS_STORAGE_ENABLED
sqlite3 *logs_db;
#endif
char *friends_db_file;
#ifdef FRIENDS_SQL_STORAGE_ENABLED
#ifdef SQLITE_STORAGE_ENABLED
sqlite3 *db;
sqlite3 *logs_db;
sqlite3 *friends_db;
bool_t debug_storage;
#endif
#ifdef BUILD_UPNP
UpnpContext *upnp;
@ -1127,11 +1123,8 @@ int linphone_core_get_edge_ptime(LinphoneCore *lc);
int linphone_upnp_init(LinphoneCore *lc);
void linphone_upnp_destroy(LinphoneCore *lc);
#if defined(MSG_STORAGE_ENABLED) || defined(CALL_LOGS_STORAGE_ENABLED)
#ifdef SQLITE_STORAGE_ENABLED
int _linphone_sqlite3_open(const char *db_file, sqlite3 **db);
#endif
#ifdef MSG_STORAGE_ENABLED
sqlite3 * linphone_message_storage_init(void);
void linphone_message_storage_init_chat_rooms(LinphoneCore *lc);
#endif

View file

@ -17,6 +17,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef SQLITE_STORAGE_ENABLED
#include "sqlite3_bctbx_vfs.h"
#include <sqlite3.h>
@ -360,5 +361,6 @@ void sqlite3_bctbx_vfs_unregister(void)
sqlite3_vfs_unregister(pVfs);
}
#endif

View file

@ -630,7 +630,7 @@ void linphone_gtk_text_received ( LinphoneCore *lc, LinphoneChatRoom *room,
}
} else {
/* Chat window closed */
#ifdef MSG_STORAGE_ENABLED
#ifdef SQLITE_STORAGE_ENABLED
send=FALSE;
#else
send=TRUE;

View file

@ -1913,9 +1913,7 @@ static void linphone_gtk_init_main_window(void){
load_uri_history();
linphone_core_reset_missed_calls_count(linphone_gtk_get_core());
main_window=linphone_gtk_get_main_window();
#ifndef CALL_LOGS_STORAGE_ENABLED
linphone_gtk_call_log_update(main_window);
#endif
linphone_gtk_update_call_buttons (NULL);
g_object_set_data(G_OBJECT(main_window),"keypad",NULL);
@ -2264,12 +2262,8 @@ core_start:
g_free(call_logs_db_file);
g_free(friends_db_file);
#ifdef CALL_LOGS_STORAGE_ENABLED
linphone_gtk_call_log_update(the_ui);
#endif
#ifdef FRIENDS_SQL_STORAGE_ENABLED
linphone_gtk_show_friends();
#endif
/* do not lower timeouts under 30 ms because it exhibits a bug on gtk+/win32, with cpu running 20% all the time...*/
gtk_timeout_add(30,(GtkFunction)linphone_gtk_iterate,(gpointer)linphone_gtk_get_core());

2
oRTP

@ -1 +1 @@
Subproject commit 97e51cbc661ba123846cbf219d652c459b7bf39b
Subproject commit 5d4738492a9fd1018ad2508c1b7729766e980b29