William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 1 | From 62651c5c7b4a391f16dbe1b09c6e220efe5c8a35 Mon Sep 17 00:00:00 2001 |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 2 | From: Hongxu Jia <hongxu.jia@windriver.com> |
| 3 | Date: Thu, 29 Mar 2018 15:12:17 +0800 |
| 4 | Subject: [PATCH] support pkgconfig |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 5 | |
| 6 | Upstream-Status: Pending |
| 7 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 8 | Rebase to 1.28 |
| 9 | |
| 10 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 11 | |
| 12 | Refactored for 1.33 |
| 13 | Signed-off-by: Armin Kuster <akuster808@gmail.com> |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 14 | Signed-off-by: Zheng Ruoqin <zhengrq.fnst@cn.fujitsu.com> |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 15 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 16 | --- |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 17 | src/gpg-error.m4 | 159 +---------------------------------------------- |
| 18 | 1 file changed, 3 insertions(+), 156 deletions(-) |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 19 | |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 20 | diff --git a/src/gpg-error.m4 b/src/gpg-error.m4 |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 21 | index d910754..76f045c 100644 |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 22 | --- a/src/gpg-error.m4 |
| 23 | +++ b/src/gpg-error.m4 |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 24 | @@ -27,156 +27,12 @@ dnl is added to the gpg_config_script_warn variable. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 25 | dnl |
| 26 | AC_DEFUN([AM_PATH_GPG_ERROR], |
| 27 | [ AC_REQUIRE([AC_CANONICAL_HOST]) |
| 28 | - gpg_error_config_prefix="" |
| 29 | - dnl --with-libgpg-error-prefix=PFX is the preferred name for this option, |
| 30 | - dnl since that is consistent with how our three siblings use the directory/ |
| 31 | - dnl package name in --with-$dir_name-prefix=PFX. |
| 32 | - AC_ARG_WITH(libgpg-error-prefix, |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 33 | - AS_HELP_STRING([--with-libgpg-error-prefix=PFX], |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 34 | - [prefix where GPG Error is installed (optional)]), |
| 35 | - [gpg_error_config_prefix="$withval"]) |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 36 | - |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 37 | - dnl Accept --with-gpg-error-prefix and make it work the same as |
| 38 | - dnl --with-libgpg-error-prefix above, for backwards compatibility, |
| 39 | - dnl but do not document this old, inconsistently-named option. |
| 40 | - AC_ARG_WITH(gpg-error-prefix,, |
| 41 | - [gpg_error_config_prefix="$withval"]) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 42 | - |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 43 | - if test x"${GPG_ERROR_CONFIG}" = x ; then |
| 44 | - if test x"${gpg_error_config_prefix}" != x ; then |
| 45 | - GPG_ERROR_CONFIG="${gpg_error_config_prefix}/bin/gpg-error-config" |
| 46 | - else |
| 47 | - case "${SYSROOT}" in |
| 48 | - /*) |
| 49 | - if test -x "${SYSROOT}/bin/gpg-error-config" ; then |
| 50 | - GPG_ERROR_CONFIG="${SYSROOT}/bin/gpg-error-config" |
| 51 | - fi |
| 52 | - ;; |
| 53 | - '') |
| 54 | - ;; |
| 55 | - *) |
| 56 | - AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.]) |
| 57 | - ;; |
| 58 | - esac |
| 59 | - fi |
| 60 | - fi |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 61 | - |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 62 | - AC_PATH_PROG(GPG_ERROR_CONFIG, gpg-error-config, no) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 63 | - min_gpg_error_version=ifelse([$1], ,1.33,$1) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 64 | - ok=no |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 65 | - |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 66 | - AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no) |
| 67 | - if test "$GPGRT_CONFIG" != "no"; then |
| 68 | - # Determine gpgrt_libdir |
| 69 | - # |
| 70 | - # Get the prefix of gpgrt-config assuming it's something like: |
| 71 | - # <PREFIX>/bin/gpgrt-config |
| 72 | - gpgrt_prefix=${GPGRT_CONFIG%/*/*} |
| 73 | - possible_libdir1=${gpgrt_prefix}/lib |
| 74 | - # Determine by using system libdir-format with CC, it's like: |
| 75 | - # Normal style: /usr/lib |
| 76 | - # GNU cross style: /usr/<triplet>/lib |
| 77 | - # Debian style: /usr/lib/<multiarch-name> |
| 78 | - # Fedora/openSUSE style: /usr/lib, /usr/lib32 or /usr/lib64 |
| 79 | - # It is assumed that CC is specified to the one of host on cross build. |
| 80 | - if libdir_candidates=$(${CC:-cc} -print-search-dirs | \ |
| 81 | - sed -n -e "/^libraries/{s/libraries: =//;s/:/\n/gp}"); then |
| 82 | - # From the output of -print-search-dirs, select valid pkgconfig dirs. |
| 83 | - libdir_candidates=$(for dir in $libdir_candidates; do |
| 84 | - if p=$(cd $dir 2>/dev/null && pwd); then |
| 85 | - test -d "$p/pkgconfig" && echo $p; |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 86 | - fi |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 87 | - done) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 88 | - |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 89 | - for possible_libdir0 in $libdir_candidates; do |
| 90 | - # possible_libdir0: |
| 91 | - # Fallback candidate, the one of system-installed (by $CC) |
| 92 | - # (/usr/<triplet>/lib, /usr/lib/<multiarch-name> or /usr/lib32) |
| 93 | - # possible_libdir1: |
| 94 | - # Another candidate, user-locally-installed |
| 95 | - # (<gpgrt_prefix>/lib) |
| 96 | - # possible_libdir2 |
| 97 | - # Most preferred |
| 98 | - # (<gpgrt_prefix>/<triplet>/lib, |
| 99 | - # <gpgrt_prefix>/lib/<multiarch-name> or <gpgrt_prefix>/lib32) |
| 100 | - if test "${possible_libdir0##*/}" = "lib"; then |
| 101 | - possible_prefix0=${possible_libdir0%/lib} |
| 102 | - possible_prefix0_triplet=${possible_prefix0##*/} |
| 103 | - if test -z "$possible_prefix0_triplet"; then |
| 104 | - continue |
| 105 | - fi |
| 106 | - possible_libdir2=${gpgrt_prefix}/$possible_prefix0_triplet/lib |
| 107 | - else |
| 108 | - possible_prefix0=${possible_libdir0%%/lib*} |
| 109 | - possible_libdir2=${gpgrt_prefix}${possible_libdir0#$possible_prefix0} |
| 110 | - fi |
| 111 | - if test -f ${possible_libdir2}/pkgconfig/gpg-error.pc; then |
| 112 | - gpgrt_libdir=${possible_libdir2} |
| 113 | - elif test -f ${possible_libdir1}/pkgconfig/gpg-error.pc; then |
| 114 | - gpgrt_libdir=${possible_libdir1} |
| 115 | - elif test -f ${possible_libdir0}/pkgconfig/gpg-error.pc; then |
| 116 | - gpgrt_libdir=${possible_libdir0} |
| 117 | - fi |
| 118 | - if test -n "$gpgrt_libdir"; then break; fi |
| 119 | - done |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 120 | - else |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 121 | - # When we cannot determine system libdir-format, use this: |
| 122 | - gpgrt_libdir=${possible_libdir1} |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 123 | - fi |
| 124 | - else |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 125 | - unset GPGRT_CONFIG |
| 126 | - fi |
| 127 | - |
| 128 | - if test -n "$gpgrt_libdir"; then |
| 129 | - GPGRT_CONFIG="$GPGRT_CONFIG --libdir=$gpgrt_libdir" |
| 130 | - if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then |
| 131 | - GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" |
| 132 | - AC_MSG_NOTICE([Use gpgrt-config with $gpgrt_libdir as gpg-error-config]) |
| 133 | - gpg_error_config_version=`$GPG_ERROR_CONFIG --modversion` |
| 134 | - else |
| 135 | - unset GPGRT_CONFIG |
| 136 | - fi |
| 137 | - elif test "$GPG_ERROR_CONFIG" != "no"; then |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 138 | - gpg_error_config_version=`$GPG_ERROR_CONFIG --version` |
| 139 | - fi |
| 140 | - if test "$GPG_ERROR_CONFIG" != "no"; then |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 141 | - req_major=`echo $min_gpg_error_version | \ |
| 142 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` |
| 143 | - req_minor=`echo $min_gpg_error_version | \ |
| 144 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 145 | - major=`echo $gpg_error_config_version | \ |
| 146 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` |
| 147 | - minor=`echo $gpg_error_config_version | \ |
| 148 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` |
| 149 | - if test "$major" -gt "$req_major"; then |
| 150 | - ok=yes |
| 151 | - else |
| 152 | - if test "$major" -eq "$req_major"; then |
| 153 | - if test "$minor" -ge "$req_minor"; then |
| 154 | - ok=yes |
| 155 | - fi |
| 156 | - fi |
| 157 | - fi |
| 158 | - fi |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 159 | - AC_MSG_CHECKING(for GPG Error - version >= $min_gpg_error_version) |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 160 | + min_gpg_error_version=ifelse([$1], ,0.0,$1) |
| 161 | + PKG_CHECK_MODULES(GPG_ERROR, [gpg-error >= $min_gpg_error_version], [ok=yes], [ok=no]) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 162 | if test $ok = yes; then |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 163 | - GPG_ERROR_CFLAGS=`$GPG_ERROR_CONFIG --cflags` |
| 164 | - GPG_ERROR_LIBS=`$GPG_ERROR_CONFIG --libs` |
| 165 | - if test -z "$GPGRT_CONFIG"; then |
| 166 | - GPG_ERROR_MT_CFLAGS=`$GPG_ERROR_CONFIG --mt --cflags 2>/dev/null` |
| 167 | - GPG_ERROR_MT_LIBS=`$GPG_ERROR_CONFIG --mt --libs 2>/dev/null` |
| 168 | - else |
| 169 | - GPG_ERROR_MT_CFLAGS=`$GPG_ERROR_CONFIG --variable=mtcflags 2>/dev/null` |
| 170 | - GPG_ERROR_MT_CFLAGS="$GPG_ERROR_CFLAGS${GPG_ERROR_CFLAGS:+ }$GPG_ERROR_MT_CFLAGS" |
| 171 | - GPG_ERROR_MT_LIBS=`$GPG_ERROR_CONFIG --variable=mtlibs 2>/dev/null` |
| 172 | - GPG_ERROR_MT_LIBS="$GPG_ERROR_LIBS${GPG_ERROR_LIBS:+ }$GPG_ERROR_MT_LIBS" |
| 173 | - fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 174 | - AC_MSG_RESULT([yes ($gpg_error_config_version)]) |
| 175 | ifelse([$2], , :, [$2]) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 176 | if test -z "$GPGRT_CONFIG"; then |
| 177 | - gpg_error_config_host=`$GPG_ERROR_CONFIG --host 2>/dev/null || echo none` |
| 178 | - else |
| 179 | - gpg_error_config_host=`$GPG_ERROR_CONFIG --variable=host 2>/dev/null || echo none` |
| 180 | + gpg_error_config_host=`$PKG_CONFIG --variable=host gpg-error` |
| 181 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 182 | if test x"$gpg_error_config_host" != xnone ; then |
| 183 | if test x"$gpg_error_config_host" != x"$host" ; then |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 184 | @@ -192,15 +48,6 @@ AC_DEFUN([AM_PATH_GPG_ERROR], |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 185 | fi |
| 186 | fi |
| 187 | else |
| 188 | - GPG_ERROR_CFLAGS="" |
| 189 | - GPG_ERROR_LIBS="" |
| 190 | - GPG_ERROR_MT_CFLAGS="" |
| 191 | - GPG_ERROR_MT_LIBS="" |
| 192 | - AC_MSG_RESULT(no) |
| 193 | ifelse([$3], , :, [$3]) |
| 194 | fi |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 195 | - AC_SUBST(GPG_ERROR_CFLAGS) |
| 196 | - AC_SUBST(GPG_ERROR_LIBS) |
| 197 | - AC_SUBST(GPG_ERROR_MT_CFLAGS) |
| 198 | - AC_SUBST(GPG_ERROR_MT_LIBS) |
| 199 | ]) |