~ubuntu-branches/ubuntu/vivid/irssi-plugin-otr/vivid-proposed

« back to all changes in this revision

Viewing changes to config/libotr.m4

  • Committer: Package Import Robot
  • Author(s): Antoine Beaupré
  • Date: 2013-05-10 19:43:24 UTC
  • mfrom: (4.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20130510194324-cxrycs8zwiofjia9
Tags: 1.0.0~alpha2-1
* Ship a second binary package, with debugging symbols.
* New upstream patch: gmodule-nolink.patch to remove extra linking.
* Upload to unstable now that libotr5 is usable there.
* Restore the libotr5-4.0.0-2.1 dependency to make sure this is usuable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl
 
2
dnl  Off-the-Record Messaging library
 
3
dnl  Copyright (C) 2004-2007  Ian Goldberg, Chris Alexander, Nikita Borisov
 
4
dnl                           <otr@cypherpunks.ca>
 
5
dnl
 
6
dnl  This library is free software; you can redistribute it and/or
 
7
dnl  modify it under the terms of version 2.1 of the GNU Lesser General
 
8
dnl  Public License as published by the Free Software Foundation.
 
9
dnl
 
10
dnl  This library is distributed in the hope that it will be useful,
 
11
dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
dnl  Lesser General Public License for more details.
 
14
dnl
 
15
dnl  You should have received a copy of the GNU Lesser General Public
 
16
dnl  License along with this library; if not, write to the Free Software
 
17
dnl  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
18
dnl
 
19
 
 
20
dnl AM_PATH_LIBOTR([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
 
21
dnl Test for libotr, and define LIBOTR_CFLAGS and LIBOTR_LIBS as appropriate.
 
22
dnl enables arguments --with-libotr-prefix=
 
23
dnl                   --with-libotr-inc-prefix=
 
24
dnl
 
25
dnl You must already have found libgcrypt with AM_PATH_LIBGCRYPT
 
26
dnl
 
27
dnl Adapted from alsa.m4, originally by
 
28
dnl      Richard Boulton <richard-alsa@tartarus.org>
 
29
dnl      Christopher Lansdown <lansdoct@cs.alfred.edu>
 
30
dnl      Jaroslav Kysela <perex@suse.cz>
 
31
 
 
32
AC_DEFUN([AM_PATH_LIBOTR],
 
33
[dnl Save the original CFLAGS, LDFLAGS, and LIBS
 
34
libotr_save_CFLAGS="$CFLAGS"
 
35
libotr_save_LDFLAGS="$LDFLAGS"
 
36
libotr_save_LIBS="$LIBS"
 
37
libotr_found=yes
 
38
 
 
39
dnl
 
40
dnl Get the cflags and libraries for libotr
 
41
dnl
 
42
AC_ARG_WITH(libotr-prefix,
 
43
[  --with-libotr-prefix=PFX  Prefix where libotr is installed(optional)],
 
44
[libotr_prefix="$withval"], [libotr_prefix=""])
 
45
 
 
46
AC_ARG_WITH(libotr-inc-prefix,
 
47
[  --with-libotr-inc-prefix=PFX  Prefix where libotr includes are (optional)],
 
48
[libotr_inc_prefix="$withval"], [libotr_inc_prefix=""])
 
49
 
 
50
dnl Add any special include directories
 
51
AC_MSG_CHECKING(for libotr CFLAGS)
 
52
if test "$libotr_inc_prefix" != "" ; then
 
53
        LIBOTR_CFLAGS="$LIBOTR_CFLAGS -I$libotr_inc_prefix"
 
54
        CFLAGS="$CFLAGS $LIBOTR_CFLAGS"
 
55
fi
 
56
AC_MSG_RESULT($LIBOTR_CFLAGS)
 
57
 
 
58
dnl add any special lib dirs
 
59
AC_MSG_CHECKING(for libotr LIBS)
 
60
if test "$libotr_prefix" != "" ; then
 
61
        LIBOTR_LIBS="$LIBOTR_LIBS -L$libotr_prefix"
 
62
        LDFLAGS="$LDFLAGS $LIBOTR_LIBS"
 
63
fi
 
64
 
 
65
dnl add the libotr library
 
66
LIBOTR_LIBS="$LIBOTR_LIBS -lotr"
 
67
LIBS="$LIBOTR_LIBS $LIBS"
 
68
AC_MSG_RESULT($LIBOTR_LIBS)
 
69
 
 
70
dnl Check for a working version of libotr that is of the right version.
 
71
min_libotr_version=ifelse([$1], ,3.0.0,$1)
 
72
no_libotr=""
 
73
    libotr_min_major_version=`echo $min_libotr_version | \
 
74
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
 
75
    libotr_min_minor_version=`echo $min_libotr_version | \
 
76
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
 
77
    libotr_min_sub_version=`echo $min_libotr_version | \
 
78
           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
 
79
AC_MSG_CHECKING(for libotr headers version $libotr_min_major_version.x >= $min_libotr_version)
 
80
 
 
81
AC_LANG_SAVE
 
82
AC_LANG_C
 
83
AC_TRY_COMPILE([
 
84
#include <stdlib.h>
 
85
#include <libotr/version.h>
 
86
], [
 
87
#  if(OTRL_VERSION_MAJOR != $libotr_min_major_version)
 
88
#    error not present
 
89
#  else
 
90
 
 
91
#    if(OTRL_VERSION_MINOR > $libotr_min_minor_version)
 
92
       exit(0);
 
93
#    else
 
94
#      if(OTRL_VERSION_MINOR < $libotr_min_minor_version)
 
95
#        error not present
 
96
#      endif
 
97
 
 
98
#      if(OTRL_VERSION_SUB < $libotr_min_sub_version)
 
99
#        error not present
 
100
#      endif
 
101
#    endif
 
102
#  endif
 
103
exit(0);
 
104
],
 
105
  [AC_MSG_RESULT(found.)],
 
106
  [AC_MSG_RESULT(not present.)
 
107
   ifelse([$3], , [AC_MSG_ERROR(Sufficiently new version of libotr not found.)])
 
108
   libotr_found=no]
 
109
)
 
110
AC_LANG_RESTORE
 
111
 
 
112
dnl Now that we know that we have the right version, let's see if we have the library and not just the headers.
 
113
AC_CHECK_LIB([otr], [otrl_message_receiving],,
 
114
        [ifelse([$3], , [AC_MSG_ERROR(No linkable libotr was found.)])
 
115
         libotr_found=no],
 
116
         $LIBGCRYPT_LIBS
 
117
)
 
118
 
 
119
LDFLAGS="$libotr_save_LDFLAGS"
 
120
LIBS="$libotr_save_LIBS"
 
121
 
 
122
if test "x$libotr_found" = "xyes" ; then
 
123
   ifelse([$2], , :, [$2])
 
124
else
 
125
   LIBOTR_CFLAGS=""
 
126
   LIBOTR_LIBS=""
 
127
   ifelse([$3], , :, [$3])
 
128
fi
 
129
 
 
130
dnl That should be it.  Now just export our symbols:
 
131
AC_SUBST(LIBOTR_CFLAGS)
 
132
AC_SUBST(LIBOTR_LIBS)
 
133
])
 
134