diff --git a/Makefile.am b/Makefile.am index 17cf94dd..7b8a94c8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -39,8 +39,7 @@ core_sources = \ src/tools/tinyurl.c src/tools/tinyurl.h \ src/config/accounts.c src/config/accounts.h \ src/config/preferences.c src/config/preferences.h \ - src/config/theme.c src/config/theme.h \ - src/otr.c src/otr.h + src/config/theme.c src/config/theme.h test_sources = \ src/contact.c src/contact.h src/common.c \ @@ -61,7 +60,6 @@ test_sources = \ src/config/accounts.h \ src/config/preferences.c src/config/preferences.h \ src/config/theme.c src/config/theme.h \ - src/otr.c src/otr.h \ tests/xmpp/mock_xmpp.h tests/xmpp/mock_xmpp.c \ tests/ui/mock_ui.h tests/ui/mock_ui.c \ tests/config/mock_accounts.h tests/config/mock_accounts.c \ @@ -84,6 +82,9 @@ main_source = src/main.c git_sources = \ src/gitversion.c +otr_sources = \ + src/otr.c src/otr.h + if INCLUDE_GIT_VERSION with_git_sources = $(git_sources) $(core_sources) tests_with_git_sources = $(git_sources) $(test_sources) @@ -92,12 +93,20 @@ with_git_sources = $(core_sources) tests_with_git_sources = $(test_sources) endif +if BUILD_OTR +with_otr_sources = $(with_git_sources) $(otr_sources) +tests_with_otr_sources = $(tests_with_git_sources) $(otr_sources) +else +with_otr_sources = $(with_git_sources) +tests_with_otr_sources = $(tests_with_git_sources) +endif + bin_PROGRAMS = profanity -profanity_SOURCES = $(with_git_sources) $(main_source) +profanity_SOURCES = $(with_otr_sources) $(main_source) TESTS = tests/testsuite check_PROGRAMS = tests/testsuite -tests_testsuite_SOURCES = $(tests_with_git_sources) +tests_testsuite_SOURCES = $(tests_with_otr_sources) tests_testsuite_LDADD = -lcmocka man_MANS = docs/profanity.1 diff --git a/configure.ac b/configure.ac index 4fb4deda..708432b1 100644 --- a/configure.ac +++ b/configure.ac @@ -130,12 +130,13 @@ elif test "x$with_xscreensaver" = x; then [AC_MSG_NOTICE([libX11 not found, falling back to profanity auto-away])]) fi +AM_CONDITIONAL([BUILD_OTR], [true]) if test "x$enable_otr" = xyes; then AC_CHECK_LIB([otr], [main], [], [AC_MSG_ERROR([libotr is required for otr encryption support])]) elif test "x$enable_otr" = x; then AC_CHECK_LIB([otr], [main], [], - [AC_MSG_NOTICE([libotr not found, otr entryption support no enabled])]) + [AM_CONDITIONAL([BUILD_OTR], [false]) AC_MSG_NOTICE([libotr not found, otr entryption support not enabled])]) fi ### cmocka is required only for tests, profanity shouldn't be linked with it diff --git a/src/command/commands.c b/src/command/commands.c index 69e80414..d7ce2742 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -2391,7 +2391,7 @@ cmd_otr(gchar **args, struct cmd_help_t help) return TRUE; } #else - cons_show("This version of Profanity has not been build with OTR support enabled"); + cons_show("This version of Profanity has not been built with OTR support enabled"); return TRUE; #endif } diff --git a/src/profanity.c b/src/profanity.c index b4149d3a..049d4bc4 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -44,7 +44,9 @@ #include "roster_list.h" #include "log.h" #include "muc.h" +#ifdef HAVE_LIBOTR #include "otr.h" +#endif #include "resource.h" #include "ui/ui.h" #include "xmpp/xmpp.h" diff --git a/src/server_events.c b/src/server_events.c index 5e478a51..792415be 100644 --- a/src/server_events.c +++ b/src/server_events.c @@ -28,7 +28,9 @@ #include "config/preferences.h" #include "roster_list.h" #include "ui/ui.h" +#ifdef HAVE_LIBOTR #include "otr.h" +#endif void handle_error_message(const char *from, const char *err_msg) @@ -49,7 +51,9 @@ void handle_login_account_success(char *account_name) { ProfAccount *account = accounts_get_account(account_name); +#ifdef HAVE_LIBOTR otr_on_connect(account); +#endif resource_presence_t resource_presence = accounts_get_login_presence(account->name); contact_presence_t contact_presence = contact_presence_from_resource_presence(resource_presence); cons_show_login_success(account);