1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
|
dnl BEGIN inline of gpgme.m4 from gpgme 0.4.4
dnl remaned from AM_PATH_GPGME to TDEPIM_PATH_GPGME and inlined here
dnl to not require aclocal fiddling...
dnl Autoconf macros for libgpgme
dnl Id: gpgme.m4,v 1.6 2003/09/03 01:15:56 marcus Exp
AC_DEFUN([_TDEPIM_PATH_GPGME_CONFIG],
[ AC_ARG_WITH(gpgme-prefix,
AC_HELP_STRING([--with-gpgme-prefix=PFX],
[prefix where GPGME is installed (optional)]),
gpgme_config_prefix="$withval", gpgme_config_prefix="")
if test "x$gpgme_config_prefix" != x ; then
gpgme_config_path="$gpgme_config_prefix/bin"
else
gpgme_config_path="$PATH:/usr/local/bin"
fi
AC_PATH_PROG(GPGME_CONFIG, gpgme-config, no, $gpgme_config_path)
if test "x$GPGME_CONFIG" != "xno" ; then
gpgme_version=`$GPGME_CONFIG --version`
gpgme_version_major=`echo $gpgme_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
gpgme_version_minor=`echo $gpgme_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
gpgme_version_micro=`echo $gpgme_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
fi
])
dnl AM_PATH_GPGME([MINIMUM-VERSION,
dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
dnl Test for libgpgme and define GPGME_CFLAGS and GPGME_LIBS.
dnl
AC_DEFUN([TDEPIM_PATH_GPGME],
[ AC_REQUIRE([_TDEPIM_PATH_GPGME_CONFIG])dnl
min_gpgme_version=ifelse([$1], ,0.4.2,$1)
AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version)
ok=no
if test "$GPGME_CONFIG" != "no" ; then
req_major=`echo $min_gpgme_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
req_minor=`echo $min_gpgme_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
req_micro=`echo $min_gpgme_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
if test "$gpgme_version_major" -gt "$req_major"; then
ok=yes
else
if test "$gpgme_version_major" -eq "$req_major"; then
if test "$gpgme_version_minor" -gt "$req_minor"; then
ok=yes
else
if test "$gpgme_version_minor" -eq "$req_minor"; then
if test "$gpgme_version_micro" -ge "$req_micro"; then
ok=yes
fi
fi
fi
fi
fi
fi
if test $ok = yes; then
GPGME_CFLAGS=`$GPGME_CONFIG --cflags`
GPGME_LIBS=`$GPGME_CONFIG --libs`
if test "x$GPGME_LIBS" != x ; then
if test "x`echo $GPGME_LIBS | grep lgpg-error`" = x ; then
GPGME_LIBS="$GPGME_LIBS -lgpg-error"
fi
fi
AC_MSG_RESULT([yes])
ifelse([$2], , :, [$2])
else
GPGME_CFLAGS=""
GPGME_LIBS=""
AC_MSG_RESULT([no, will use local libgpgme-copy])
ifelse([$3], , :, [$3])
fi
AC_SUBST(GPGME_CFLAGS)
AC_SUBST(GPGME_LIBS)
])
dnl
dnl snip AM_PATH_GPGME_{PTH,PTHREAD}
dnl
dnl END inline of gpgme.m4
# The minimum required gpgme version is 0.4.5.
# It was the first useable one for C++ (class keyword) and KDE (largefile support).
# If you change this minimum version here, update also configure.in.bot
tdepim_needs_gpgme_copy=""
TDEPIM_PATH_GPGME(0.4.5,[
AC_LANG_SAVE
AC_LANG_C
tdepim_gpgmepp_save_cflags="$CFLAGS"
tdepim_gpgmepp_save_libs="$LIBS"
CFLAGS="$GPGME_CFLAGS"
LIBS="$GPGME_LIBS"
AC_MSG_CHECKING([if gpgme has GPGME_KEYLIST_MODE_VALIDATE])
AC_TRY_COMPILE([#include <gpgme.h>], [
gpgme_keylist_mode_t mode = GPGME_KEYLIST_MODE_VALIDATE;
], [
AC_DEFINE(HAVE_GPGME_KEYLIST_MODE_VALIDATE, 1, [Define to 1 if your gpgme supports GPGME_KEYLIST_MODE_VALIDATE])
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
])
AC_MSG_CHECKING([if gpgme has gpgme_cancel])
AC_TRY_LINK([#include <gpgme.h>], [
gpgme_ctx_t ctx = 0;
gpgme_error_t e = gpgme_cancel( ctx );
], [
AC_DEFINE(HAVE_GPGME_CANCEL, 1, [Define to 1 if your gpgme supports gpgme_cancel()])
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
])
AC_MSG_CHECKING([if gpgme has gpgme_key_t->keylist_mode])
AC_TRY_COMPILE([#include <gpgme.h>], [
gpgme_key_t key = 0;
key->keylist_mode = 0;
], [
AC_DEFINE(HAVE_GPGME_KEY_T_KEYLIST_MODE, 1, [Define to 1 if your gpgme's gpgme_key_t has the keylist_mode member])
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
])
AC_MSG_CHECKING([if gpgme has gpgme_decrypt_result_t->wrong_key_usage])
AC_TRY_COMPILE([#include <gpgme.h>], [
gpgme_decrypt_result_t res;
unsigned int wku = res->wrong_key_usage;
], [
AC_DEFINE(HAVE_GPGME_WRONG_KEY_USAGE, 1, [Define to 1 if your gpgme's gpgme_decrypt_result_t has the wrong_key_usage member])
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
])
AC_MSG_CHECKING([if gpgme has GPGME_INCLUDE_CERTS_DEFAULT])
AC_TRY_COMPILE([#include <gpgme.h>], [
int i = GPGME_INCLUDE_CERTS_DEFAULT;
], [
AC_DEFINE(HAVE_GPGME_INCLUDE_CERTS_DEFAULT, 1, [Define to 1 if your gpgme has the GPGME_INCLUDE_CERTS_DEFAULT macro])
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
])
AC_MSG_CHECKING([if gpgme has gpgme_op_getauditlog])
AC_TRY_LINK([#include <gpgme.h>], [
gpgme_ctx_t ctx = 0;
gpgme_data_t data = 0;
unsigned int flags = 0;
gpgme_error_t e = gpgme_op_getauditlog( ctx, data, flags );
], [
AC_DEFINE(HAVE_GPGME_OP_GETAUDITLOG, 1, [Define to 1 if your gpgme supports gpgme_op_getauditlog])
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
])
CFLAGS="$tdepim_gpgmepp_save_cflags"
LIBS="$tdepim_gpgmepp_save_libs"
AC_LANG_RESTORE
],[
tdepim_needs_gpgme_copy="true"
GPGME_CFLAGS='-I$(top_srcdir)/libtdenetwork/libgpgme-copy/gpgme -I$(top_srcdir)/libtdenetwork/libgpg-error-copy -I$(top_builddir)/libtdenetwork/libgpg-error-copy'
GPGME_LIBS='$(top_builddir)/libtdenetwork/libgpgme-copy/gpgme/libgpgme.la'
GPGME_LIBS_DEP='$(GPGME_LIBS)'
# All of this is in gpgme-copy
AC_DEFINE(HAVE_GPGME_KEYLIST_MODE_VALIDATE, 1, [Define to 1 if your gpgme supports GPGME_KEYLIST_MODE_VALIDATE])
AC_DEFINE(HAVE_GPGME_KEY_T_KEYLIST_MODE, 1, [Define to 1 if your gpgme's gpgme_key_t has the keylist_mode member])
AC_DEFINE(HAVE_GPGME_CANCEL, 1, [Define to 1 if your gpgme supports gpgme_cancel()])
])
AC_SUBST(GPGME_LIBS_DEP)
AM_CONDITIONAL(needs_gpgme_copy, test -n "$tdepim_needs_gpgme_copy")
dnl Always true - either from the local copy or from the system lib.
dnl Still used in gpgmepp/gpgmefw.h for some reason.
AC_DEFINE(HAVE_GPGME_0_4_BRANCH, 1, [Always set since we use gpgme-copy if gpgme isn't available])
dnl Used by Makefile.am
AC_PROG_AWK
|