From 0bbefc1e7b2fa311e983259f934eb2c9102e92f4 Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Wed, 18 Dec 2013 16:07:25 +0100 Subject: [PATCH] Fix compilation and runtime when no LDAP is asked. --- configure.ac | 19 ++++++++++++++----- gtk/linphone.h | 8 ++++++-- gtk/main.c | 14 ++++++++------ gtk/propertybox.c | 3 +++ 4 files changed, 31 insertions(+), 13 deletions(-) diff --git a/configure.ac b/configure.ac index 19087a244..a35089e36 100644 --- a/configure.ac +++ b/configure.ac @@ -167,21 +167,30 @@ AC_ARG_ENABLE(x11, dnl conditional build of LDAP support AC_ARG_ENABLE(ldap, - [AS_HELP_STRING([--disable-ldap], [Disable LDAP support (default=no)])], + [AS_HELP_STRING([--enable-ldap], [Enables LDAP support (default=no)])], [case "${enableval}" in yes) enable_ldap=true ;; no) enable_ldap=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --disable-ldap) ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-ldap) ;; esac], - [enable_ldap=true] + [enable_ldap=false] ) -AM_CONDITIONAL(BUILD_LDAP, test x$enable_ldap != xfalse) if test "$enable_ldap" = "true"; then - AC_CHECK_LIB(ldap,ldap_initialize, LDAP_LIBS="-lldap") + AC_CHECK_LIB(sasl2, sasl_client_init , [foo=bar], + [AC_MSG_ERROR(You need SASL for LDAP support)] + ) + + AC_CHECK_LIB(ldap,ldap_initialize, LDAP_LIBS="-lldap -llber -lsasl2", + [AC_MSG_ERROR(You need libldap for LDAP support)] + ) + + AC_CHECK_HEADERS(ldap.h) + AC_CHECK_HEADERS(sasl/sasl.h) AC_SUBST(LDAP_LIBS) AC_DEFINE(BUILD_LDAP,1,[Defined if LDAP build option enabled]) fi +AM_CONDITIONAL(BUILD_LDAP, test x$enable_ldap != xfalse) dnl conditionnal build of console interface. AC_ARG_ENABLE(console_ui, diff --git a/gtk/linphone.h b/gtk/linphone.h index c77a02e6d..bec8e7591 100644 --- a/gtk/linphone.h +++ b/gtk/linphone.h @@ -73,8 +73,6 @@ void linphone_gtk_show_assistant(void); void linphone_gtk_close_assistant(void); LinphoneCore *linphone_gtk_get_core(void); -LinphoneLDAPContactProvider* linphone_gtk_get_ldap(void); -void linphone_gtk_set_ldap(LinphoneLDAPContactProvider* ldap); GtkWidget *linphone_gtk_get_main_window(); void linphone_gtk_display_something(GtkMessageType type,const gchar *message); void linphone_gtk_start_call(GtkWidget *button); @@ -97,6 +95,12 @@ int linphone_gtk_get_ui_config_int(const char *key, int def); void linphone_gtk_set_ui_config_int(const char *key , int val); void linphone_gtk_visibility_set(const char *hiddens, const char *window_name, GtkWidget *w, gboolean show); +#ifdef BUILD_LDAP +LinphoneLDAPContactProvider* linphone_gtk_get_ldap(void); +void linphone_gtk_set_ldap(LinphoneLDAPContactProvider* ldap); +#endif + + void linphone_gtk_open_browser(const char *url); void linphone_gtk_check_for_new_version(void); const char *linphone_gtk_get_lang(const char *config_file); diff --git a/gtk/main.c b/gtk/main.c index db9568cb0..e39c37801 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -50,8 +50,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. const char *this_program_ident_string="linphone_ident_string=" LINPHONE_VERSION; static LinphoneCore *the_core=NULL; -static LinphoneLDAPContactProvider* ldap_provider = NULL; static GtkWidget *the_ui=NULL; +#ifdef BUILD_LDAP +static LinphoneLDAPContactProvider* ldap_provider = NULL; +#endif static void linphone_gtk_registration_state_changed(LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneRegistrationState rs, const char *msg); static void linphone_gtk_notify_recv(LinphoneCore *lc, LinphoneFriend * fid); @@ -232,12 +234,9 @@ static const char *linphone_gtk_get_factory_config_file(){ return _factory_config_file; } -LinphoneLDAPContactProvider* linphone_gtk_get_ldap(void){ #ifdef BUILD_LDAP +LinphoneLDAPContactProvider* linphone_gtk_get_ldap(void){ return ldap_provider; -#else - return NULL; -#endif } void linphone_gtk_set_ldap(LinphoneLDAPContactProvider* ldap) @@ -248,6 +247,7 @@ void linphone_gtk_set_ldap(LinphoneLDAPContactProvider* ldap) ldap_provider = ldap ? LINPHONE_LDAP_CONTACT_PROVIDER(belle_sip_object_ref( ldap )) : NULL; } +#endif /* BUILD_LDAP */ static void linphone_gtk_init_liblinphone(const char *config_file, const char *factory_config_file, const char *db_file) { @@ -751,6 +751,7 @@ static void completion_add_text(GtkEntry *entry, const char *text){ save_uri_history(); } +#ifdef BUILD_LDAP void on_contact_provider_search_results( LinphoneContactSearch* req, MSList* friends, void* data ) { GtkTreeIter iter; @@ -853,6 +854,7 @@ static gboolean launch_contact_provider_search(void *userdata) } return FALSE; } +#endif /* BUILD_LDAP */ void linphone_gtk_on_uribar_changed(GtkEditable *uribar, gpointer user_data) { @@ -868,7 +870,7 @@ void linphone_gtk_on_uribar_changed(GtkEditable *uribar, gpointer user_data) timeout = g_timeout_add_seconds(1,(GSourceFunc)launch_contact_provider_search, uribar); gtk_object_set_data(GTK_OBJECT(uribar),"complete_timeout", GINT_TO_POINTER(timeout) ); -#endif +#endif /* BUILD_LDAP */ } bool_t linphone_gtk_video_enabled(void){ diff --git a/gtk/propertybox.c b/gtk/propertybox.c index 20c0b01cd..53605f317 100644 --- a/gtk/propertybox.c +++ b/gtk/propertybox.c @@ -60,6 +60,7 @@ static void linphone_gtk_fill_combo_box(GtkWidget *combo, const char **devices, gtk_combo_box_set_active(GTK_COMBO_BOX(combo),active); } +#ifdef BUILD_LDAP static void linphone_gtk_ldap_load_settings(GtkWidget* param) { GtkWidget *mw = linphone_gtk_get_main_window(); @@ -185,6 +186,8 @@ void linphone_gtk_ldap_save(GtkWidget *tabmgr) lp_config_load_dict_to_section(conf, "ldap", dict); } +#endif /* BUILD_LDAP */ + void linphone_gtk_fill_video_sizes(GtkWidget *combo){ const MSVideoSizeDef *def=linphone_core_get_supported_video_sizes(linphone_gtk_get_core());; int i,active=0;