Improve some sieve-related translations
[claws.git] / m4 / gpgme.m4
blob528cf7e38f35aaa9def89bddae8dc5676e17ea4f
1 # gpgme.m4 - autoconf macro to detect GPGME.
2 # Copyright (C) 2002, 2003, 2004 g10 Code GmbH
4 # This file is free software; as a special exception the author gives
5 # unlimited permission to copy and/or distribute it, with or without
6 # modifications, as long as this notice is preserved.
8 # This file is distributed in the hope that it will be useful, but
9 # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
10 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 AC_DEFUN([_AM_PATH_GPGME_CONFIG],
14 [ AC_ARG_WITH(gpgme-prefix,
15             AS_HELP_STRING([--with-gpgme-prefix=PFX],[prefix where GPGME is installed (optional)]),
16      gpgme_config_prefix="$withval", gpgme_config_prefix="")
17   if test "x$gpgme_config_prefix" != x ; then
18       GPGME_CONFIG="$gpgme_config_prefix/bin/gpgme-config"
19   fi
20   AC_PATH_PROG(GPGME_CONFIG, gpgme-config, no)
22   if test "$GPGME_CONFIG" != "no" ; then
23     gpgme_version=`$GPGME_CONFIG --version`
24   fi
25   gpgme_version_major=`echo $gpgme_version | \
26                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
27   gpgme_version_minor=`echo $gpgme_version | \
28                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
29   gpgme_version_micro=`echo $gpgme_version | \
30                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
33 dnl AM_PATH_GPGME([MINIMUM-VERSION,
34 dnl               [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
35 dnl Test for libgpgme and define GPGME_CFLAGS and GPGME_LIBS.
36 dnl
37 AC_DEFUN([AM_PATH_GPGME],
38 [ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl
39   tmp=ifelse([$1], ,1:0.4.2,$1)
40   if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
41      req_gpgme_api=`echo "$tmp"     | sed 's/\(.*\):\(.*\)/\1/'`
42      min_gpgme_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
43   else
44      req_gpgme_api=0
45      min_gpgme_version="$tmp"
46   fi
48   AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version)
49   ok=no
50   if test "$GPGME_CONFIG" != "no" ; then
51     req_major=`echo $min_gpgme_version | \
52                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
53     req_minor=`echo $min_gpgme_version | \
54                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
55     req_micro=`echo $min_gpgme_version | \
56                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
57     if test "$gpgme_version_major" -gt "$req_major"; then
58         ok=yes
59     else 
60         if test "$gpgme_version_major" -eq "$req_major"; then
61             if test "$gpgme_version_minor" -gt "$req_minor"; then
62                ok=yes
63             else
64                if test "$gpgme_version_minor" -eq "$req_minor"; then
65                    if test "$gpgme_version_micro" -ge "$req_micro"; then
66                      ok=yes
67                    fi
68                fi
69             fi
70         fi
71     fi
72   fi
73   if test $ok = yes; then
74      # If we have a recent GPGME, we should also check that the
75      # API is compatible.
76      if test "$req_gpgme_api" -gt 0 ; then
77         tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0`
78         if test "$tmp" -gt 0 ; then
79            if test "$req_gpgme_api" -ne "$tmp" ; then
80              ok=no
81            fi
82         fi
83      fi
84   fi
85   if test $ok = yes; then
86     GPGME_CFLAGS=`$GPGME_CONFIG --cflags`
87     GPGME_LIBS=`$GPGME_CONFIG --libs`
88     AC_MSG_RESULT(yes)
89     ifelse([$2], , :, [$2])
90   else
91     GPGME_CFLAGS=""
92     GPGME_LIBS=""
93     AC_MSG_RESULT(no)
94     ifelse([$3], , :, [$3])
95   fi
96   AC_SUBST(GPGME_CFLAGS)
97   AC_SUBST(GPGME_LIBS)
100 dnl AM_PATH_GPGME_PTH([MINIMUM-VERSION,
101 dnl                   [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
102 dnl Test for libgpgme and define GPGME_PTH_CFLAGS and GPGME_PTH_LIBS.
104 AC_DEFUN([AM_PATH_GPGME_PTH],
105 [ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl
106   tmp=ifelse([$1], ,1:0.4.2,$1)
107   if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
108      req_gpgme_api=`echo "$tmp"     | sed 's/\(.*\):\(.*\)/\1/'`
109      min_gpgme_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
110   else
111      req_gpgme_api=0
112      min_gpgme_version="$tmp"
113   fi
115   AC_MSG_CHECKING(for GPGME Pth - version >= $min_gpgme_version)
116   ok=no
117   if test "$GPGME_CONFIG" != "no" ; then
118     if `$GPGME_CONFIG --thread=pth 2> /dev/null` ; then
119       req_major=`echo $min_gpgme_version | \
120                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
121       req_minor=`echo $min_gpgme_version | \
122                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
123       req_micro=`echo $min_gpgme_version | \
124                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
125       if test "$gpgme_version_major" -gt "$req_major"; then
126         ok=yes
127       else 
128         if test "$gpgme_version_major" -eq "$req_major"; then
129           if test "$gpgme_version_minor" -gt "$req_minor"; then
130             ok=yes
131           else
132             if test "$gpgme_version_minor" -eq "$req_minor"; then
133               if test "$gpgme_version_micro" -ge "$req_micro"; then
134                 ok=yes
135               fi
136             fi
137           fi
138         fi
139       fi
140     fi
141   fi
142   if test $ok = yes; then
143      # If we have a recent GPGME, we should also check that the
144      # API is compatible.
145      if test "$req_gpgme_api" -gt 0 ; then
146         tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0`
147         if test "$tmp" -gt 0 ; then
148            if test "$req_gpgme_api" -ne "$tmp" ; then
149              ok=no
150            fi
151         fi
152      fi
153   fi
154   if test $ok = yes; then
155     GPGME_PTH_CFLAGS=`$GPGME_CONFIG --thread=pth --cflags`
156     GPGME_PTH_LIBS=`$GPGME_CONFIG --thread=pth --libs`
157     AC_MSG_RESULT(yes)
158     ifelse([$2], , :, [$2])
159   else
160     GPGME_PTH_CFLAGS=""
161     GPGME_PTH_LIBS=""
162     AC_MSG_RESULT(no)
163     ifelse([$3], , :, [$3])
164   fi
165   AC_SUBST(GPGME_PTH_CFLAGS)
166   AC_SUBST(GPGME_PTH_LIBS)
169 dnl AM_PATH_GPGME_PTHREAD([MINIMUM-VERSION,
170 dnl                       [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
171 dnl Test for libgpgme and define GPGME_PTHREAD_CFLAGS
172 dnl  and GPGME_PTHREAD_LIBS.
174 AC_DEFUN([AM_PATH_GPGME_PTHREAD],
175 [ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl
176   tmp=ifelse([$1], ,1:0.4.2,$1)
177   if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
178      req_gpgme_api=`echo "$tmp"     | sed 's/\(.*\):\(.*\)/\1/'`
179      min_gpgme_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
180   else
181      req_gpgme_api=0
182      min_gpgme_version="$tmp"
183   fi
185   AC_MSG_CHECKING(for GPGME pthread - version >= $min_gpgme_version)
186   ok=no
187   if test "$GPGME_CONFIG" != "no" ; then
188     if `$GPGME_CONFIG --thread=pthread 2> /dev/null` ; then
189       req_major=`echo $min_gpgme_version | \
190                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
191       req_minor=`echo $min_gpgme_version | \
192                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
193       req_micro=`echo $min_gpgme_version | \
194                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
195       if test "$gpgme_version_major" -gt "$req_major"; then
196         ok=yes
197       else 
198         if test "$gpgme_version_major" -eq "$req_major"; then
199           if test "$gpgme_version_minor" -gt "$req_minor"; then
200             ok=yes
201           else
202             if test "$gpgme_version_minor" -eq "$req_minor"; then
203               if test "$gpgme_version_micro" -ge "$req_micro"; then
204                 ok=yes
205               fi
206             fi
207           fi
208         fi
209       fi
210     fi
211   fi
212   if test $ok = yes; then
213      # If we have a recent GPGME, we should also check that the
214      # API is compatible.
215      if test "$req_gpgme_api" -gt 0 ; then
216         tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0`
217         if test "$tmp" -gt 0 ; then
218            if test "$req_gpgme_api" -ne "$tmp" ; then
219              ok=no
220            fi
221         fi
222      fi
223   fi
224   if test $ok = yes; then
225     GPGME_PTHREAD_CFLAGS=`$GPGME_CONFIG --thread=pthread --cflags`
226     GPGME_PTHREAD_LIBS=`$GPGME_CONFIG --thread=pthread --libs`
227     AC_MSG_RESULT(yes)
228     ifelse([$2], , :, [$2])
229   else
230     GPGME_PTHREAD_CFLAGS=""
231     GPGME_PTHREAD_LIBS=""
232     AC_MSG_RESULT(no)
233     ifelse([$3], , :, [$3])
234   fi
235   AC_SUBST(GPGME_PTHREAD_CFLAGS)
236   AC_SUBST(GPGME_PTHREAD_LIBS)