1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-09 21:30:42 +00:00

Check for libotr version

This commit is contained in:
James Booth 2014-02-09 00:32:11 +00:00
parent 50afe7366e
commit fa89e2aa62
3 changed files with 40 additions and 7 deletions

View File

@ -94,8 +94,11 @@ main_source = src/main.c
git_sources = \
src/gitversion.c
otr_sources = \
src/otr.c src/otr.h
otr3_sources = \
src/otr3.c src/otr.h
otr4_sources = \
src/otr4.c src/otr.h
if INCLUDE_GIT_VERSION
with_git_sources = $(git_sources) $(core_sources)
@ -105,9 +108,15 @@ with_git_sources = $(core_sources)
tests_with_git_sources = $(test_sources)
endif
if BUILD_OTR
if BUILD_OTR3
with_otr_sources = $(with_git_sources) $(otr_sources)
tests_with_otr_sources = $(tests_with_git_sources) $(otr_sources)
with_otr_sources = $(with_git_sources) $(otr3_sources)
tests_with_otr_sources = $(tests_with_git_sources) $(otr3_sources)
endif
if BUILD_OTR4
with_otr_sources = $(with_git_sources) $(otr4_sources)
tests_with_otr_sources = $(tests_with_git_sources) $(otr4_sources)
endif
else
with_otr_sources = $(with_git_sources)
tests_with_otr_sources = $(tests_with_git_sources)

View File

@ -131,14 +131,38 @@ elif test "x$with_xscreensaver" = x; then
[AC_MSG_NOTICE([libX11 not found, falling back to profanity auto-away])])
fi
AM_CONDITIONAL([BUILD_OTR], [false])
AM_CONDITIONAL([BUILD_OTR3], [false])
AM_CONDITIONAL([BUILD_OTR4], [false])
if test "x$enable_otr" = xyes; then
AC_SEARCH_LIBS([otrl_init], [otr],
[AM_CONDITIONAL([BUILD_OTR3], [true]) AC_DEFINE([HAVE_LIBOTR], [1], [Have libotr])],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#include <libotr/version.h>
]],[[
#if OTRL_VERSION_MAJOR == 4
// OK
#else
# assume version 3
#endif
]])],
[AM_CONDITIONAL([BUILD_OTR], [true]) AM_CONDITIONAL([BUILD_OTR4], [true]) AC_DEFINE([HAVE_LIBOTR], [1], [Have libotr])],
[AM_CONDITIONAL([BUILD_OTR], [true]) AM_CONDITIONAL([BUILD_OTR3], [true]) AC_DEFINE([HAVE_LIBOTR], [1], [Have libotr])])],
[AC_MSG_ERROR([libotr is required for otr encryption support])])
elif test "x$enable_otr" = x; then
AC_SEARCH_LIBS([otrl_init], [otr],
[AM_CONDITIONAL([BUILD_OTR3], [true]) AC_DEFINE([HAVE_LIBOTR], [1], [Have libotr])],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#include <libotr/version.h>
]],[[
#if OTRL_VERSION_MAJOR == 4
// OK
#else
# assume version 3
#endif
]])],
[AM_CONDITIONAL([BUILD_OTR], [true]) AM_CONDITIONAL([BUILD_OTR4], [true]) AC_DEFINE([HAVE_LIBOTR], [1], [Have libotr])],
[AM_CONDITIONAL([BUILD_OTR], [true]) AM_CONDITIONAL([BUILD_OTR3], [true]) AC_DEFINE([HAVE_LIBOTR], [1], [Have libotr])])],
[AC_MSG_NOTICE([libotr not found, otr entryption support not enabled])])
fi

View File

@ -1,5 +1,5 @@
/*
* otr.c
* otr3.c
*
* Copyright (C) 2012, 2013 James Booth <boothj5@gmail.com>
*