Add patch to build with gpgrt-config instead of gpg-error-config (Closes: #1022298)
Andreas Rönnquist
1 year, 6 months ago
0 | From: NIIBE Yutaka <gniibe@fsij.org> | |
1 | Date: Thu, 15 Apr 2021 14:31:49 +0900 | |
2 | Subject: build: Update m4/gpg-error.m4 | |
3 | ||
4 | * m4/gpg-error.m4: Update from libgpg-error. | |
5 | ||
6 | -- | |
7 | ||
8 | Signed-off-by: NIIBE Yutaka <gniibe@fsij.org> | |
9 | --- | |
10 | m4/gpg-error.m4 | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- | |
11 | 1 file changed, 79 insertions(+), 1 deletion(-) | |
12 | ||
13 | diff --git a/m4/gpg-error.m4 b/m4/gpg-error.m4 | |
14 | index 9d96d16..be9413d 100644 | |
15 | --- a/m4/gpg-error.m4 | |
16 | +++ b/m4/gpg-error.m4 | |
17 | @@ -8,6 +8,8 @@ | |
18 | # This file is distributed in the hope that it will be useful, but | |
19 | # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the | |
20 | # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
21 | +# | |
22 | +# Last-changed: 2021-03-31 | |
23 | ||
24 | dnl AM_PATH_GPG_ERROR([MINIMUM-VERSION, | |
25 | dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) | |
26 | @@ -28,7 +30,83 @@ AC_DEFUN([AM_PATH_GPG_ERROR], | |
27 | min_gpg_error_version=ifelse([$1], ,0.0,$1) | |
28 | AC_MSG_CHECKING(for GPG Error - version >= $min_gpg_error_version) | |
29 | ok=no | |
30 | - if test "$GPG_ERROR_CONFIG" != "no" ; then | |
31 | + | |
32 | + AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no, [$prefix/bin:$PATH]) | |
33 | + if test "$GPGRT_CONFIG" != "no"; then | |
34 | + # Determine gpgrt_libdir | |
35 | + # | |
36 | + # Get the prefix of gpgrt-config assuming it's something like: | |
37 | + # <PREFIX>/bin/gpgrt-config | |
38 | + gpgrt_prefix=${GPGRT_CONFIG%/*/*} | |
39 | + possible_libdir1=${gpgrt_prefix}/lib | |
40 | + # Determine by using system libdir-format with CC, it's like: | |
41 | + # Normal style: /usr/lib | |
42 | + # GNU cross style: /usr/<triplet>/lib | |
43 | + # Debian style: /usr/lib/<multiarch-name> | |
44 | + # Fedora/openSUSE style: /usr/lib, /usr/lib32 or /usr/lib64 | |
45 | + # It is assumed that CC is specified to the one of host on cross build. | |
46 | + if libdir_candidates=$(${CC:-cc} -print-search-dirs | \ | |
47 | + sed -n -e "/^libraries/{s/libraries: =//;s/:/\\ | |
48 | +/g;p;}"); then | |
49 | + # From the output of -print-search-dirs, select valid pkgconfig dirs. | |
50 | + libdir_candidates=$(for dir in $libdir_candidates; do | |
51 | + if p=$(cd $dir 2>/dev/null && pwd); then | |
52 | + test -d "$p/pkgconfig" && echo $p; | |
53 | + fi | |
54 | + done) | |
55 | + | |
56 | + for possible_libdir0 in $libdir_candidates; do | |
57 | + # possible_libdir0: | |
58 | + # Fallback candidate, the one of system-installed (by $CC) | |
59 | + # (/usr/<triplet>/lib, /usr/lib/<multiarch-name> or /usr/lib32) | |
60 | + # possible_libdir1: | |
61 | + # Another candidate, user-locally-installed | |
62 | + # (<gpgrt_prefix>/lib) | |
63 | + # possible_libdir2 | |
64 | + # Most preferred | |
65 | + # (<gpgrt_prefix>/<triplet>/lib, | |
66 | + # <gpgrt_prefix>/lib/<multiarch-name> or <gpgrt_prefix>/lib32) | |
67 | + if test "${possible_libdir0##*/}" = "lib"; then | |
68 | + possible_prefix0=${possible_libdir0%/lib} | |
69 | + possible_prefix0_triplet=${possible_prefix0##*/} | |
70 | + if test -z "$possible_prefix0_triplet"; then | |
71 | + continue | |
72 | + fi | |
73 | + possible_libdir2=${gpgrt_prefix}/$possible_prefix0_triplet/lib | |
74 | + else | |
75 | + possible_prefix0=${possible_libdir0%%/lib*} | |
76 | + possible_libdir2=${gpgrt_prefix}${possible_libdir0#$possible_prefix0} | |
77 | + fi | |
78 | + if test -f ${possible_libdir2}/pkgconfig/gpg-error.pc; then | |
79 | + gpgrt_libdir=${possible_libdir2} | |
80 | + elif test -f ${possible_libdir1}/pkgconfig/gpg-error.pc; then | |
81 | + gpgrt_libdir=${possible_libdir1} | |
82 | + elif test -f ${possible_libdir0}/pkgconfig/gpg-error.pc; then | |
83 | + gpgrt_libdir=${possible_libdir0} | |
84 | + fi | |
85 | + if test -n "$gpgrt_libdir"; then break; fi | |
86 | + done | |
87 | + else | |
88 | + # When we cannot determine system libdir-format, use this: | |
89 | + gpgrt_libdir=${possible_libdir1} | |
90 | + fi | |
91 | + else | |
92 | + unset GPGRT_CONFIG | |
93 | + fi | |
94 | + | |
95 | + if test -n "$gpgrt_libdir"; then | |
96 | + GPGRT_CONFIG="$GPGRT_CONFIG --libdir=$gpgrt_libdir" | |
97 | + if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then | |
98 | + GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" | |
99 | + AC_MSG_NOTICE([Use gpgrt-config with $gpgrt_libdir as gpg-error-config]) | |
100 | + gpg_error_config_version=`$GPG_ERROR_CONFIG --modversion` | |
101 | + else | |
102 | + unset GPGRT_CONFIG | |
103 | + fi | |
104 | + elif test "$GPG_ERROR_CONFIG" != "no"; then | |
105 | + gpg_error_config_version=`$GPG_ERROR_CONFIG --version` | |
106 | + fi | |
107 | + if test "$GPG_ERROR_CONFIG" != "no"; then | |
108 | req_major=`echo $min_gpg_error_version | \ | |
109 | sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` | |
110 | req_minor=`echo $min_gpg_error_version | \ |