Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 1 | From ec309e20b5a27d42a5fb915c328d61e924ab5f19 Mon Sep 17 00:00:00 2001 |
| 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> |
| 14 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 15 | --- |
| 16 | configure.ac | 1 + |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 17 | src/gpg-error.m4 | 71 +++-------------------------------------------------- |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 18 | 4 files changed, 18 insertions(+), 69 deletions(-) |
| 19 | create mode 100644 src/gpg-error.pc.in |
| 20 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 21 | Index: libgpg-error-1.33/src/gpg-error.m4 |
| 22 | =================================================================== |
| 23 | --- libgpg-error-1.33.orig/src/gpg-error.m4 |
| 24 | +++ libgpg-error-1.33/src/gpg-error.m4 |
| 25 | @@ -26,139 +26,13 @@ dnl is added to the gpg_config_script_wa |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 26 | dnl |
| 27 | AC_DEFUN([AM_PATH_GPG_ERROR], |
| 28 | [ AC_REQUIRE([AC_CANONICAL_HOST]) |
| 29 | - gpg_error_config_prefix="" |
| 30 | - dnl --with-libgpg-error-prefix=PFX is the preferred name for this option, |
| 31 | - dnl since that is consistent with how our three siblings use the directory/ |
| 32 | - dnl package name in --with-$dir_name-prefix=PFX. |
| 33 | - AC_ARG_WITH(libgpg-error-prefix, |
| 34 | - AC_HELP_STRING([--with-libgpg-error-prefix=PFX], |
| 35 | - [prefix where GPG Error is installed (optional)]), |
| 36 | - [gpg_error_config_prefix="$withval"]) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 37 | + min_gpg_error_version=ifelse([$1], ,0.0,$1) |
| 38 | + PKG_CHECK_MODULES(GPG_ERROR, [gpg-error >= $min_gpg_error_version], [ok=yes], [ok=no]) |
| 39 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 40 | - dnl Accept --with-gpg-error-prefix and make it work the same as |
| 41 | - dnl --with-libgpg-error-prefix above, for backwards compatibility, |
| 42 | - dnl but do not document this old, inconsistently-named option. |
| 43 | - AC_ARG_WITH(gpg-error-prefix,, |
| 44 | - [gpg_error_config_prefix="$withval"]) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 45 | - |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 46 | - if test x"${GPG_ERROR_CONFIG}" = x ; then |
| 47 | - if test x"${gpg_error_config_prefix}" != x ; then |
| 48 | - GPG_ERROR_CONFIG="${gpg_error_config_prefix}/bin/gpg-error-config" |
| 49 | - else |
| 50 | - case "${SYSROOT}" in |
| 51 | - /*) |
| 52 | - if test -x "${SYSROOT}/bin/gpg-error-config" ; then |
| 53 | - GPG_ERROR_CONFIG="${SYSROOT}/bin/gpg-error-config" |
| 54 | - fi |
| 55 | - ;; |
| 56 | - '') |
| 57 | - ;; |
| 58 | - *) |
| 59 | - AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.]) |
| 60 | - ;; |
| 61 | - esac |
| 62 | - fi |
| 63 | - fi |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 64 | - |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 65 | - AC_PATH_PROG(GPG_ERROR_CONFIG, gpg-error-config, no) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 66 | - min_gpg_error_version=ifelse([$1], ,1.33,$1) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 67 | - ok=no |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 68 | - |
| 69 | - if test "$prefix" = NONE ; then |
| 70 | - prefix_option_expanded=/usr/local |
| 71 | - else |
| 72 | - prefix_option_expanded="$prefix" |
| 73 | - fi |
| 74 | - if test "$exec_prefix" = NONE ; then |
| 75 | - exec_prefix_option_expanded=$prefix_option_expanded |
| 76 | - else |
| 77 | - exec_prefix_option_expanded=$(prefix=$prefix_option_expanded eval echo $exec_prefix) |
| 78 | - fi |
| 79 | - libdir_option_expanded=$(prefix=$prefix_option_expanded exec_prefix=$exec_prefix_option_expanded eval echo $libdir) |
| 80 | - |
| 81 | - if test -f $libdir_option_expanded/pkgconfig/gpg-error.pc; then |
| 82 | - gpgrt_libdir=$libdir_option_expanded |
| 83 | - else |
| 84 | - if crt1_path=$(${CC:-cc} -print-file-name=crt1.o 2>/dev/null); then |
| 85 | - if possible_libdir=$(cd ${crt1_path%/*} && pwd 2>/dev/null); then |
| 86 | - if test -f $possible_libdir/pkgconfig/gpg-error.pc; then |
| 87 | - gpgrt_libdir=$possible_libdir |
| 88 | - fi |
| 89 | - fi |
| 90 | - fi |
| 91 | - fi |
| 92 | - |
| 93 | - if test "$GPG_ERROR_CONFIG" = "no" -a -n "$gpgrt_libdir"; then |
| 94 | - AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no) |
| 95 | - if test "$GPGRT_CONFIG" = "no"; then |
| 96 | - unset GPGRT_CONFIG |
| 97 | - else |
| 98 | - GPGRT_CONFIG="$GPGRT_CONFIG --libdir=$gpgrt_libdir" |
| 99 | - if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then |
| 100 | - GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" |
| 101 | - AC_MSG_NOTICE([Use gpgrt-config with $gpgrt_libdir as gpg-error-config]) |
| 102 | - gpg_error_config_version=`$GPG_ERROR_CONFIG --modversion` |
| 103 | - else |
| 104 | - unset GPGRT_CONFIG |
| 105 | - fi |
| 106 | - fi |
| 107 | - else |
| 108 | - gpg_error_config_version=`$GPG_ERROR_CONFIG --version` |
| 109 | - fi |
| 110 | - if test "$GPG_ERROR_CONFIG" != "no"; then |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 111 | - req_major=`echo $min_gpg_error_version | \ |
| 112 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` |
| 113 | - req_minor=`echo $min_gpg_error_version | \ |
| 114 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 115 | - major=`echo $gpg_error_config_version | \ |
| 116 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` |
| 117 | - minor=`echo $gpg_error_config_version | \ |
| 118 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` |
| 119 | - if test "$major" -gt "$req_major"; then |
| 120 | - ok=yes |
| 121 | - else |
| 122 | - if test "$major" -eq "$req_major"; then |
| 123 | - if test "$minor" -ge "$req_minor"; then |
| 124 | - ok=yes |
| 125 | - fi |
| 126 | - fi |
| 127 | - fi |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 128 | - if test -z "$GPGRT_CONFIG" -a -n "$gpgrt_libdir"; then |
| 129 | - if test "$major" -gt 1 -o "$major" -eq 1 -a "$minor" -ge 33; then |
| 130 | - AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no) |
| 131 | - if test "$GPGRT_CONFIG" = "no"; then |
| 132 | - unset GPGRT_CONFIG |
| 133 | - else |
| 134 | - GPGRT_CONFIG="$GPGRT_CONFIG --libdir=$gpgrt_libdir" |
| 135 | - if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then |
| 136 | - GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" |
| 137 | - AC_MSG_NOTICE([Use gpgrt-config with $gpgrt_libdir as gpg-error-config]) |
| 138 | - else |
| 139 | - unset GPGRT_CONFIG |
| 140 | - fi |
| 141 | - fi |
| 142 | - fi |
| 143 | - fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 144 | - fi |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 145 | - AC_MSG_CHECKING(for GPG Error - version >= $min_gpg_error_version) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 146 | if test $ok = yes; then |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 147 | - GPG_ERROR_CFLAGS=`$GPG_ERROR_CONFIG --cflags` |
| 148 | - GPG_ERROR_LIBS=`$GPG_ERROR_CONFIG --libs` |
| 149 | - if test -z "$GPGRT_CONFIG"; then |
| 150 | - GPG_ERROR_MT_CFLAGS=`$GPG_ERROR_CONFIG --mt --cflags 2>/dev/null` |
| 151 | - GPG_ERROR_MT_LIBS=`$GPG_ERROR_CONFIG --mt --libs 2>/dev/null` |
| 152 | - else |
| 153 | - GPG_ERROR_MT_CFLAGS=`$GPG_ERROR_CONFIG --variable=mtcflags 2>/dev/null` |
| 154 | - GPG_ERROR_MT_CFLAGS="$GPG_ERROR_CFLAGS${GPG_ERROR_CFLAGS:+ }$GPG_ERROR_MT_CFLAGS" |
| 155 | - GPG_ERROR_MT_LIBS=`$GPG_ERROR_CONFIG --variable=mtlibs 2>/dev/null` |
| 156 | - GPG_ERROR_MT_LIBS="$GPG_ERROR_LIBS${GPG_ERROR_LIBS:+ }$GPG_ERROR_MT_LIBS" |
| 157 | - fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 158 | - AC_MSG_RESULT([yes ($gpg_error_config_version)]) |
| 159 | ifelse([$2], , :, [$2]) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 160 | if test -z "$GPGRT_CONFIG"; then |
| 161 | - gpg_error_config_host=`$GPG_ERROR_CONFIG --host 2>/dev/null || echo none` |
| 162 | - else |
| 163 | - gpg_error_config_host=`$GPG_ERROR_CONFIG --variable=host 2>/dev/null || echo none` |
| 164 | + gpg_error_config_host=`$PKG_CONFIG --variable=host gpg-error` |
| 165 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 166 | if test x"$gpg_error_config_host" != xnone ; then |
| 167 | if test x"$gpg_error_config_host" != x"$host" ; then |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 168 | @@ -174,15 +48,6 @@ AC_DEFUN([AM_PATH_GPG_ERROR], |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 169 | fi |
| 170 | fi |
| 171 | else |
| 172 | - GPG_ERROR_CFLAGS="" |
| 173 | - GPG_ERROR_LIBS="" |
| 174 | - GPG_ERROR_MT_CFLAGS="" |
| 175 | - GPG_ERROR_MT_LIBS="" |
| 176 | - AC_MSG_RESULT(no) |
| 177 | ifelse([$3], , :, [$3]) |
| 178 | fi |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame^] | 179 | - AC_SUBST(GPG_ERROR_CFLAGS) |
| 180 | - AC_SUBST(GPG_ERROR_LIBS) |
| 181 | - AC_SUBST(GPG_ERROR_MT_CFLAGS) |
| 182 | - AC_SUBST(GPG_ERROR_MT_LIBS) |
| 183 | ]) |