aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/libotr/libotr-3.2.0/libotr.m4
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xlinden/indra/libotr/libotr-3.2.0/libotr.m4134
1 files changed, 134 insertions, 0 deletions
diff --git a/linden/indra/libotr/libotr-3.2.0/libotr.m4 b/linden/indra/libotr/libotr-3.2.0/libotr.m4
new file mode 100755
index 0000000..a21ac3e
--- /dev/null
+++ b/linden/indra/libotr/libotr-3.2.0/libotr.m4
@@ -0,0 +1,134 @@
1dnl
2dnl Off-the-Record Messaging library
3dnl Copyright (C) 2004-2007 Ian Goldberg, Chris Alexander, Nikita Borisov
4dnl <otr@cypherpunks.ca>
5dnl
6dnl This library is free software; you can redistribute it and/or
7dnl modify it under the terms of version 2.1 of the GNU Lesser General
8dnl Public License as published by the Free Software Foundation.
9dnl
10dnl This library is distributed in the hope that it will be useful,
11dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13dnl Lesser General Public License for more details.
14dnl
15dnl You should have received a copy of the GNU Lesser General Public
16dnl License along with this library; if not, write to the Free Software
17dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18dnl
19
20dnl AM_PATH_LIBOTR([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
21dnl Test for libotr, and define LIBOTR_CFLAGS and LIBOTR_LIBS as appropriate.
22dnl enables arguments --with-libotr-prefix=
23dnl --with-libotr-inc-prefix=
24dnl
25dnl You must already have found libgcrypt with AM_PATH_LIBGCRYPT
26dnl
27dnl Adapted from alsa.m4, originally by
28dnl Richard Boulton <richard-alsa@tartarus.org>
29dnl Christopher Lansdown <lansdoct@cs.alfred.edu>
30dnl Jaroslav Kysela <perex@suse.cz>
31
32AC_DEFUN([AM_PATH_LIBOTR],
33[dnl Save the original CFLAGS, LDFLAGS, and LIBS
34libotr_save_CFLAGS="$CFLAGS"
35libotr_save_LDFLAGS="$LDFLAGS"
36libotr_save_LIBS="$LIBS"
37libotr_found=yes
38
39dnl
40dnl Get the cflags and libraries for libotr
41dnl
42AC_ARG_WITH(libotr-prefix,
43[ --with-libotr-prefix=PFX Prefix where libotr is installed(optional)],
44[libotr_prefix="$withval"], [libotr_prefix=""])
45
46AC_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
50dnl Add any special include directories
51AC_MSG_CHECKING(for libotr CFLAGS)
52if test "$libotr_inc_prefix" != "" ; then
53 LIBOTR_CFLAGS="$LIBOTR_CFLAGS -I$libotr_inc_prefix"
54 CFLAGS="$CFLAGS $LIBOTR_CFLAGS"
55fi
56AC_MSG_RESULT($LIBOTR_CFLAGS)
57
58dnl add any special lib dirs
59AC_MSG_CHECKING(for libotr LIBS)
60if test "$libotr_prefix" != "" ; then
61 LIBOTR_LIBS="$LIBOTR_LIBS -L$libotr_prefix"
62 LDFLAGS="$LDFLAGS $LIBOTR_LIBS"
63fi
64
65dnl add the libotr library
66LIBOTR_LIBS="$LIBOTR_LIBS -lotr"
67LIBS="$LIBOTR_LIBS $LIBS"
68AC_MSG_RESULT($LIBOTR_LIBS)
69
70dnl Check for a working version of libotr that is of the right version.
71min_libotr_version=ifelse([$1], ,3.0.0,$1)
72no_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/'`
79AC_MSG_CHECKING(for libotr headers version $libotr_min_major_version.x >= $min_libotr_version)
80
81AC_LANG_SAVE
82AC_LANG_C
83AC_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
103exit(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)
110AC_LANG_RESTORE
111
112dnl Now that we know that we have the right version, let's see if we have the library and not just the headers.
113AC_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
119LDFLAGS="$libotr_save_LDFLAGS"
120LIBS="$libotr_save_LIBS"
121
122if test "x$libotr_found" = "xyes" ; then
123 ifelse([$2], , :, [$2])
124else
125 LIBOTR_CFLAGS=""
126 LIBOTR_LIBS=""
127 ifelse([$3], , :, [$3])
128fi
129
130dnl That should be it. Now just export our symbols:
131AC_SUBST(LIBOTR_CFLAGS)
132AC_SUBST(LIBOTR_LIBS)
133])
134