archrelease: copy trunk to community-x86_64
[ArchLinux/community.git] / geany-plugins / repos / community-x86_64 / update-gpgme-m4.patch
blob18157cce33303ec12ee3aeecaf0c4dc181b9339d
1 From e90e293ea5055da1ef4636c22e947e689cffb983 Mon Sep 17 00:00:00 2001
2 From: Chow Loong Jin <hyperair@debian.org>
3 Date: Thu, 15 Dec 2022 11:45:20 +0800
4 Subject: [PATCH] Update bundled gpgme.m4
6 gpgme.m4 taken from current git master version at
7 https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gpgme.git;a=blob;f=src/gpgme.m4;hb=2ba11f9bfb1f51a481eb1240b8cf2c8ad260c222.
9 Fixes: #1213
10 ---
11 build/bundled/gpgme.m4 | 316 +++++++++++++++++++++++++++--------------
12 1 file changed, 211 insertions(+), 105 deletions(-)
14 diff --git a/build/bundled/gpgme.m4 b/build/bundled/gpgme.m4
15 index 44bf43cb9..f2906c161 100644
16 --- a/build/bundled/gpgme.m4
17 +++ b/build/bundled/gpgme.m4
18 @@ -1,5 +1,5 @@
19 # gpgme.m4 - autoconf macro to detect GPGME.
20 -# Copyright (C) 2002, 2003, 2004 g10 Code GmbH
21 +# Copyright (C) 2002, 2003, 2004, 2014, 2018, 2022 g10 Code GmbH
23 # This file is free software; as a special exception the author gives
24 # unlimited permission to copy and/or distribute it, with or without
25 @@ -8,20 +8,141 @@
26 # This file is distributed in the hope that it will be useful, but
27 # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
28 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
30 +# Last-changed: 2022-11-25
33 +dnl
34 +dnl Find gpgrt-config, which uses .pc file
35 +dnl (minimum pkg-config functionality, supporting cross build)
36 +dnl
37 +dnl _AM_PATH_GPGRT_CONFIG
38 +AC_DEFUN([_AM_PATH_GPGRT_CONFIG],[dnl
39 + AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no, [$prefix/bin:$PATH])
40 + if test "$GPGRT_CONFIG" != "no"; then
41 + # Determine gpgrt_libdir
42 + #
43 + # Get the prefix of gpgrt-config assuming it's something like:
44 + # <PREFIX>/bin/gpgrt-config
45 + gpgrt_prefix=${GPGRT_CONFIG%/*/*}
46 + possible_libdir1=${gpgrt_prefix}/lib
47 + # Determine by using system libdir-format with CC, it's like:
48 + # Normal style: /usr/lib
49 + # GNU cross style: /usr/<triplet>/lib
50 + # Debian style: /usr/lib/<multiarch-name>
51 + # Fedora/openSUSE style: /usr/lib, /usr/lib32 or /usr/lib64
52 + # It is assumed that CC is specified to the one of host on cross build.
53 + if libdir_candidates=$(${CC:-cc} -print-search-dirs | \
54 + sed -n -e "/^libraries/{s/libraries: =//;s/:/\\
55 +/g;p;}"); then
56 + # From the output of -print-search-dirs, select valid pkgconfig dirs.
57 + libdir_candidates=$(for dir in $libdir_candidates; do
58 + if p=$(cd $dir 2>/dev/null && pwd); then
59 + test -d "$p/pkgconfig" && echo $p;
60 + fi
61 + done)
63 + for possible_libdir0 in $libdir_candidates; do
64 + # possible_libdir0:
65 + # Fallback candidate, the one of system-installed (by $CC)
66 + # (/usr/<triplet>/lib, /usr/lib/<multiarch-name> or /usr/lib32)
67 + # possible_libdir1:
68 + # Another candidate, user-locally-installed
69 + # (<gpgrt_prefix>/lib)
70 + # possible_libdir2
71 + # Most preferred
72 + # (<gpgrt_prefix>/<triplet>/lib,
73 + # <gpgrt_prefix>/lib/<multiarch-name> or <gpgrt_prefix>/lib32)
74 + if test "${possible_libdir0##*/}" = "lib"; then
75 + possible_prefix0=${possible_libdir0%/lib}
76 + possible_prefix0_triplet=${possible_prefix0##*/}
77 + if test -z "$possible_prefix0_triplet"; then
78 + continue
79 + fi
80 + possible_libdir2=${gpgrt_prefix}/$possible_prefix0_triplet/lib
81 + else
82 + possible_prefix0=${possible_libdir0%%/lib*}
83 + possible_libdir2=${gpgrt_prefix}${possible_libdir0#$possible_prefix0}
84 + fi
85 + if test -f ${possible_libdir2}/pkgconfig/gpg-error.pc; then
86 + gpgrt_libdir=${possible_libdir2}
87 + elif test -f ${possible_libdir1}/pkgconfig/gpg-error.pc; then
88 + gpgrt_libdir=${possible_libdir1}
89 + elif test -f ${possible_libdir0}/pkgconfig/gpg-error.pc; then
90 + gpgrt_libdir=${possible_libdir0}
91 + fi
92 + if test -n "$gpgrt_libdir"; then break; fi
93 + done
94 + if test -z "$libdir_candidates"; then
95 + # No valid pkgconfig dir in any of the system directories, fallback
96 + gpgrt_libdir=${possible_libdir1}
97 + fi
98 + else
99 + # When we cannot determine system libdir-format, use this:
100 + gpgrt_libdir=${possible_libdir1}
101 + fi
102 + else
103 + unset GPGRT_CONFIG
104 + fi
106 -AC_DEFUN([_AM_PATH_GPGME_CONFIG],
107 -[ AC_ARG_WITH(gpgme-prefix,
108 - AC_HELP_STRING([--with-gpgme-prefix=PFX],
109 - [prefix where GPGME is installed (optional)]),
110 + if test -n "$gpgrt_libdir"; then
111 + GPGRT_CONFIG="$GPGRT_CONFIG --libdir=$gpgrt_libdir"
112 + if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then
113 + GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error"
114 + AC_MSG_NOTICE([Use gpgrt-config with $gpgrt_libdir as gpg-error-config])
115 + gpg_error_config_version=`$GPG_ERROR_CONFIG --modversion`
116 + else
117 + unset GPGRT_CONFIG
118 + fi
119 + elif test "$GPG_ERROR_CONFIG" != "no"; then
120 + gpg_error_config_version=`$GPG_ERROR_CONFIG --version`
121 + unset GPGRT_CONFIG
122 + fi
125 +AC_DEFUN([_AM_PATH_GPGME_CONFIG],[dnl
126 +AC_REQUIRE([_AM_PATH_GPGRT_CONFIG])dnl
127 + AC_ARG_WITH(gpgme-prefix,
128 + AS_HELP_STRING([--with-gpgme-prefix=PFX],
129 + [prefix where GPGME is installed (optional)]),
130 gpgme_config_prefix="$withval", gpgme_config_prefix="")
131 - if test "x$gpgme_config_prefix" != x ; then
132 - GPGME_CONFIG="$gpgme_config_prefix/bin/gpgme-config"
133 + if test x"${GPGME_CONFIG}" = x ; then
134 + if test x"${gpgme_config_prefix}" != x ; then
135 + GPGME_CONFIG="${gpgme_config_prefix}/bin/gpgme-config"
136 + else
137 + case "${SYSROOT}" in
138 + /*)
139 + if test -x "${SYSROOT}/bin/gpgme-config" ; then
140 + GPGME_CONFIG="${SYSROOT}/bin/gpgme-config"
141 + fi
142 + ;;
143 + '')
144 + ;;
145 + *)
146 + AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.])
147 + ;;
148 + esac
149 + fi
150 + fi
152 + use_gpgrt_config=""
153 + if test x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then
154 + if $GPGRT_CONFIG gpgme --exists; then
155 + GPGME_CONFIG="$GPGRT_CONFIG gpgme"
156 + AC_MSG_NOTICE([Use gpgrt-config as gpgme-config])
157 + use_gpgrt_config=yes
158 + fi
159 + fi
160 + if test -z "$use_gpgrt_config"; then
161 + AC_PATH_PROG(GPGME_CONFIG, gpgme-config, no)
163 - AC_PATH_PROG(GPGME_CONFIG, gpgme-config, no)
165 if test "$GPGME_CONFIG" != "no" ; then
166 - gpgme_version=`$GPGME_CONFIG --version`
167 + if test -z "$use_gpgrt_config"; then
168 + gpgme_version=`$GPGME_CONFIG --version`
169 + else
170 + gpgme_version=`$GPGME_CONFIG --modversion`
171 + fi
173 gpgme_version_major=`echo $gpgme_version | \
174 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
175 @@ -31,10 +152,39 @@ AC_DEFUN([_AM_PATH_GPGME_CONFIG],
176 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
180 +AC_DEFUN([_AM_PATH_GPGME_CONFIG_HOST_CHECK],
182 + if test -z "$use_gpgrt_config"; then
183 + gpgme_config_host=`$GPGME_CONFIG --host 2>/dev/null || echo none`
184 + else
185 + gpgme_config_host=`$GPGME_CONFIG --variable=host 2>/dev/null || echo none`
186 + fi
187 + if test x"$gpgme_config_host" != xnone ; then
188 + if test x"$gpgme_config_host" != x"$host" ; then
189 + AC_MSG_WARN([[
190 +***
191 +*** The config script "$GPGME_CONFIG" was
192 +*** built for $gpgme_config_host and thus may not match the
193 +*** used host $host.
194 +*** You may want to use the configure option --with-gpgme-prefix
195 +*** to specify a matching config script or use \$SYSROOT.
196 +***]])
197 + gpg_config_script_warn="$gpg_config_script_warn gpgme"
198 + fi
199 + fi
203 dnl AM_PATH_GPGME([MINIMUM-VERSION,
204 dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
205 dnl Test for libgpgme and define GPGME_CFLAGS and GPGME_LIBS.
207 +dnl If a prefix option is not used, the config script is first
208 +dnl searched in $SYSROOT/bin and then along $PATH. If the used
209 +dnl config script does not match the host specification the script
210 +dnl is added to the gpg_config_script_warn variable.
211 +dnl
212 AC_DEFUN([AM_PATH_GPGME],
213 [ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl
214 tmp=ifelse([$1], ,1:0.4.2,$1)
215 @@ -57,7 +207,7 @@ AC_DEFUN([AM_PATH_GPGME],
216 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
217 if test "$gpgme_version_major" -gt "$req_major"; then
218 ok=yes
219 - else
220 + else
221 if test "$gpgme_version_major" -eq "$req_major"; then
222 if test "$gpgme_version_minor" -gt "$req_minor"; then
223 ok=yes
224 @@ -75,7 +225,11 @@ AC_DEFUN([AM_PATH_GPGME],
225 # If we have a recent GPGME, we should also check that the
226 # API is compatible.
227 if test "$req_gpgme_api" -gt 0 ; then
228 - tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0`
229 + if test -z "$use_gpgrt_config"; then
230 + tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0`
231 + else
232 + tmp=`$GPGME_CONFIG --variable=api_version 2>/dev/null || echo 0`
233 + fi
234 if test "$tmp" -gt 0 ; then
235 if test "$req_gpgme_api" -ne "$tmp" ; then
236 ok=no
237 @@ -88,6 +242,7 @@ AC_DEFUN([AM_PATH_GPGME],
238 GPGME_LIBS=`$GPGME_CONFIG --libs`
239 AC_MSG_RESULT(yes)
240 ifelse([$2], , :, [$2])
241 + _AM_PATH_GPGME_CONFIG_HOST_CHECK
242 else
243 GPGME_CFLAGS=""
244 GPGME_LIBS=""
245 @@ -98,82 +253,14 @@ AC_DEFUN([AM_PATH_GPGME],
246 AC_SUBST(GPGME_LIBS)
249 -dnl AM_PATH_GPGME_PTH([MINIMUM-VERSION,
250 -dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
251 -dnl Test for libgpgme and define GPGME_PTH_CFLAGS and GPGME_PTH_LIBS.
252 -dnl
253 -AC_DEFUN([AM_PATH_GPGME_PTH],
254 -[ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl
255 - tmp=ifelse([$1], ,1:0.4.2,$1)
256 - if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
257 - req_gpgme_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'`
258 - min_gpgme_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
259 - else
260 - req_gpgme_api=0
261 - min_gpgme_version="$tmp"
262 - fi
264 - AC_MSG_CHECKING(for GPGME Pth - version >= $min_gpgme_version)
265 - ok=no
266 - if test "$GPGME_CONFIG" != "no" ; then
267 - if `$GPGME_CONFIG --thread=pth 2> /dev/null` ; then
268 - req_major=`echo $min_gpgme_version | \
269 - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
270 - req_minor=`echo $min_gpgme_version | \
271 - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
272 - req_micro=`echo $min_gpgme_version | \
273 - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
274 - if test "$gpgme_version_major" -gt "$req_major"; then
275 - ok=yes
276 - else
277 - if test "$gpgme_version_major" -eq "$req_major"; then
278 - if test "$gpgme_version_minor" -gt "$req_minor"; then
279 - ok=yes
280 - else
281 - if test "$gpgme_version_minor" -eq "$req_minor"; then
282 - if test "$gpgme_version_micro" -ge "$req_micro"; then
283 - ok=yes
284 - fi
285 - fi
286 - fi
287 - fi
288 - fi
289 - fi
290 - fi
291 - if test $ok = yes; then
292 - # If we have a recent GPGME, we should also check that the
293 - # API is compatible.
294 - if test "$req_gpgme_api" -gt 0 ; then
295 - tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0`
296 - if test "$tmp" -gt 0 ; then
297 - if test "$req_gpgme_api" -ne "$tmp" ; then
298 - ok=no
299 - fi
300 - fi
301 - fi
302 - fi
303 - if test $ok = yes; then
304 - GPGME_PTH_CFLAGS=`$GPGME_CONFIG --thread=pth --cflags`
305 - GPGME_PTH_LIBS=`$GPGME_CONFIG --thread=pth --libs`
306 - AC_MSG_RESULT(yes)
307 - ifelse([$2], , :, [$2])
308 - else
309 - GPGME_PTH_CFLAGS=""
310 - GPGME_PTH_LIBS=""
311 - AC_MSG_RESULT(no)
312 - ifelse([$3], , :, [$3])
313 - fi
314 - AC_SUBST(GPGME_PTH_CFLAGS)
315 - AC_SUBST(GPGME_PTH_LIBS)
318 dnl AM_PATH_GPGME_PTHREAD([MINIMUM-VERSION,
319 dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
320 dnl Test for libgpgme and define GPGME_PTHREAD_CFLAGS
321 dnl and GPGME_PTHREAD_LIBS.
323 -AC_DEFUN([AM_PATH_GPGME_PTHREAD],
324 -[ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl
325 +AC_DEFUN([AM_PATH_GPGME_PTHREAD],[
326 + AC_OBSOLETE([$0], [; use AM_PATH_GPGME instead to use GPGME_CFLAGS and GPGME_LIBS])dnl
327 + AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl
328 tmp=ifelse([$1], ,1:0.4.2,$1)
329 if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
330 req_gpgme_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'`
331 @@ -186,35 +273,37 @@ AC_DEFUN([AM_PATH_GPGME_PTHREAD],
332 AC_MSG_CHECKING(for GPGME pthread - version >= $min_gpgme_version)
333 ok=no
334 if test "$GPGME_CONFIG" != "no" ; then
335 - if `$GPGME_CONFIG --thread=pthread 2> /dev/null` ; then
336 - req_major=`echo $min_gpgme_version | \
337 + req_major=`echo $min_gpgme_version | \
338 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
339 - req_minor=`echo $min_gpgme_version | \
340 + req_minor=`echo $min_gpgme_version | \
341 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
342 - req_micro=`echo $min_gpgme_version | \
343 + req_micro=`echo $min_gpgme_version | \
344 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
345 - if test "$gpgme_version_major" -gt "$req_major"; then
346 + if test "$gpgme_version_major" -gt "$req_major"; then
347 ok=yes
348 - else
349 + else
350 if test "$gpgme_version_major" -eq "$req_major"; then
351 - if test "$gpgme_version_minor" -gt "$req_minor"; then
352 - ok=yes
353 - else
354 - if test "$gpgme_version_minor" -eq "$req_minor"; then
355 - if test "$gpgme_version_micro" -ge "$req_micro"; then
356 - ok=yes
357 - fi
358 + if test "$gpgme_version_minor" -gt "$req_minor"; then
359 + ok=yes
360 + else
361 + if test "$gpgme_version_minor" -eq "$req_minor"; then
362 + if test "$gpgme_version_micro" -ge "$req_micro"; then
363 + ok=yes
364 + fi
365 + fi
367 - fi
369 - fi
372 if test $ok = yes; then
373 # If we have a recent GPGME, we should also check that the
374 # API is compatible.
375 if test "$req_gpgme_api" -gt 0 ; then
376 - tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0`
377 + if test -z "$use_gpgrt_config"; then
378 + tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0`
379 + else
380 + tmp=`$GPGME_CONFIG --variable=api_version 2>/dev/null || echo 0`
381 + fi
382 if test "$tmp" -gt 0 ; then
383 if test "$req_gpgme_api" -ne "$tmp" ; then
384 ok=no
385 @@ -223,10 +312,11 @@ AC_DEFUN([AM_PATH_GPGME_PTHREAD],
388 if test $ok = yes; then
389 - GPGME_PTHREAD_CFLAGS=`$GPGME_CONFIG --thread=pthread --cflags`
390 - GPGME_PTHREAD_LIBS=`$GPGME_CONFIG --thread=pthread --libs`
391 + GPGME_PTHREAD_CFLAGS=`$GPGME_CONFIG --cflags`
392 + GPGME_PTHREAD_LIBS=`$GPGME_CONFIG --libs`
393 AC_MSG_RESULT(yes)
394 ifelse([$2], , :, [$2])
395 + _AM_PATH_GPGME_CONFIG_HOST_CHECK
396 else
397 GPGME_PTHREAD_CFLAGS=""
398 GPGME_PTHREAD_LIBS=""
399 @@ -264,7 +354,7 @@ AC_DEFUN([AM_PATH_GPGME_GLIB],
400 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
401 if test "$gpgme_version_major" -gt "$req_major"; then
402 ok=yes
403 - else
404 + else
405 if test "$gpgme_version_major" -eq "$req_major"; then
406 if test "$gpgme_version_minor" -gt "$req_minor"; then
407 ok=yes
408 @@ -282,7 +372,11 @@ AC_DEFUN([AM_PATH_GPGME_GLIB],
409 # If we have a recent GPGME, we should also check that the
410 # API is compatible.
411 if test "$req_gpgme_api" -gt 0 ; then
412 - tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0`
413 + if test -z "$use_gpgrt_config"; then
414 + tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0`
415 + else
416 + tmp=`$GPGME_CONFIG --variable=api_version 2>/dev/null || echo 0`
417 + fi
418 if test "$tmp" -gt 0 ; then
419 if test "$req_gpgme_api" -ne "$tmp" ; then
420 ok=no
421 @@ -291,10 +385,23 @@ AC_DEFUN([AM_PATH_GPGME_GLIB],
424 if test $ok = yes; then
425 - GPGME_GLIB_CFLAGS=`$GPGME_CONFIG --glib --cflags`
426 - GPGME_GLIB_LIBS=`$GPGME_CONFIG --glib --libs`
427 + if test -z "$use_gpgrt_config"; then
428 + GPGME_GLIB_CFLAGS=`$GPGME_CONFIG --glib --cflags`
429 + GPGME_GLIB_LIBS=`$GPGME_CONFIG --glib --libs`
430 + else
431 + if $GPGRT_CONFIG gpgme-glib --exists; then
432 + GPGME_CONFIG="$GPGRT_CONFIG gpgme-glib"
433 + GPGME_GLIB_CFLAGS=`$GPGME_CONFIG --cflags`
434 + GPGME_GLIB_LIBS=`$GPGME_CONFIG --libs`
435 + else
436 + ok = no
437 + fi
438 + fi
439 + fi
440 + if test $ok = yes; then
441 AC_MSG_RESULT(yes)
442 ifelse([$2], , :, [$2])
443 + _AM_PATH_GPGME_CONFIG_HOST_CHECK
444 else
445 GPGME_GLIB_CFLAGS=""
446 GPGME_GLIB_LIBS=""
447 @@ -304,4 +411,3 @@ AC_DEFUN([AM_PATH_GPGME_GLIB],
448 AC_SUBST(GPGME_GLIB_CFLAGS)
449 AC_SUBST(GPGME_GLIB_LIBS)