Andrew Geissler | 706d5aa | 2021-02-12 15:55:30 -0600 | [diff] [blame^] | 1 | From 7bd2b060e9ea3e2ff11e67d1e98ab882819b28b7 Mon Sep 17 00:00:00 2001 |
Andrew Geissler | 5a43b43 | 2020-06-13 10:46:56 -0500 | [diff] [blame] | 2 | From: Chen Qi <Qi.Chen@windriver.com> |
| 3 | Date: Mon, 3 Dec 2012 18:17:31 +0800 |
| 4 | Subject: [PATCH] libksba: add pkgconfig support |
| 5 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 6 | Upstream-Status: Denied |
| 7 | |
| 8 | Add pkgconfig support to libksba. |
| 9 | This patch is rejected by upstream for the reason below: |
| 10 | They think pkgconfig adds no portability and maintaining them is not worthwhile. |
| 11 | |
| 12 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> |
| 13 | |
Andrew Geissler | 5a43b43 | 2020-06-13 10:46:56 -0500 | [diff] [blame] | 14 | diff --git a/src/ksba.m4 b/src/ksba.m4 |
Andrew Geissler | 706d5aa | 2021-02-12 15:55:30 -0600 | [diff] [blame^] | 15 | index ad8de4f..af903ad 100644 |
Andrew Geissler | 5a43b43 | 2020-06-13 10:46:56 -0500 | [diff] [blame] | 16 | --- a/src/ksba.m4 |
| 17 | +++ b/src/ksba.m4 |
Andrew Geissler | 706d5aa | 2021-02-12 15:55:30 -0600 | [diff] [blame^] | 18 | @@ -22,37 +22,6 @@ dnl with a changed API. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 19 | dnl |
| 20 | AC_DEFUN([AM_PATH_KSBA], |
Andrew Geissler | 5a43b43 | 2020-06-13 10:46:56 -0500 | [diff] [blame] | 21 | [ AC_REQUIRE([AC_CANONICAL_HOST]) |
| 22 | - dnl --with-libksba-prefix=PFX is the preferred name for this option, |
| 23 | - dnl since that is consistent with how our three siblings use the directory/ |
| 24 | - dnl package name in --with-$dir_name-prefix=PFX. |
| 25 | - AC_ARG_WITH(libksba-prefix, |
Andrew Geissler | 706d5aa | 2021-02-12 15:55:30 -0600 | [diff] [blame^] | 26 | - AC_HELP_STRING([--with-libksba-prefix=PFX], |
Andrew Geissler | 5a43b43 | 2020-06-13 10:46:56 -0500 | [diff] [blame] | 27 | - [prefix where KSBA is installed (optional)]), |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 28 | - ksba_config_prefix="$withval", ksba_config_prefix="") |
Andrew Geissler | 5a43b43 | 2020-06-13 10:46:56 -0500 | [diff] [blame] | 29 | - |
| 30 | - dnl Accept --with-ksba-prefix and make it work the same as |
| 31 | - dnl --with-libksba-prefix above, for backwards compatibility, |
| 32 | - dnl but do not document this old, inconsistently-named option. |
| 33 | - AC_ARG_WITH(ksba-prefix,, |
| 34 | - ksba_config_prefix="$withval", ksba_config_prefix="") |
| 35 | - |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 36 | - if test x$ksba_config_prefix != x ; then |
Andrew Geissler | 5a43b43 | 2020-06-13 10:46:56 -0500 | [diff] [blame] | 37 | - if test x${KSBA_CONFIG+set} != xset ; then |
| 38 | - KSBA_CONFIG=$ksba_config_prefix/bin/ksba-config |
| 39 | - fi |
| 40 | - fi |
| 41 | - |
| 42 | - use_gpgrt_config="" |
| 43 | - if test x"$KSBA_CONFIG" = x -a x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then |
| 44 | - if $GPGRT_CONFIG ksba --exists; then |
| 45 | - KSBA_CONFIG="$GPGRT_CONFIG ksba" |
| 46 | - AC_MSG_NOTICE([Use gpgrt-config as ksba-config]) |
| 47 | - use_gpgrt_config=yes |
| 48 | - fi |
| 49 | - fi |
| 50 | - if test -z "$use_gpgrt_config"; then |
| 51 | - AC_PATH_PROG(KSBA_CONFIG, ksba-config, no) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 52 | - fi |
| 53 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 54 | tmp=ifelse([$1], ,1:1.0.0,$1) |
| 55 | if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then |
Andrew Geissler | 706d5aa | 2021-02-12 15:55:30 -0600 | [diff] [blame^] | 56 | @@ -63,56 +32,13 @@ AC_DEFUN([AM_PATH_KSBA], |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 57 | min_ksba_version="$tmp" |
| 58 | fi |
| 59 | |
| 60 | - AC_MSG_CHECKING(for KSBA - version >= $min_ksba_version) |
| 61 | - ok=no |
| 62 | - if test "$KSBA_CONFIG" != "no" ; then |
| 63 | - req_major=`echo $min_ksba_version | \ |
| 64 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` |
| 65 | - req_minor=`echo $min_ksba_version | \ |
| 66 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` |
| 67 | - req_micro=`echo $min_ksba_version | \ |
| 68 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` |
Andrew Geissler | 5a43b43 | 2020-06-13 10:46:56 -0500 | [diff] [blame] | 69 | - if test -z "$use_gpgrt_config"; then |
| 70 | - ksba_config_version=`$KSBA_CONFIG --version` |
| 71 | - else |
| 72 | - ksba_config_version=`$KSBA_CONFIG --modversion` |
| 73 | - fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 74 | - major=`echo $ksba_config_version | \ |
| 75 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` |
| 76 | - minor=`echo $ksba_config_version | \ |
| 77 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` |
| 78 | - micro=`echo $ksba_config_version | \ |
| 79 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'` |
| 80 | - if test "$major" -gt "$req_major"; then |
| 81 | - ok=yes |
| 82 | - else |
| 83 | - if test "$major" -eq "$req_major"; then |
| 84 | - if test "$minor" -gt "$req_minor"; then |
| 85 | - ok=yes |
| 86 | - else |
| 87 | - if test "$minor" -eq "$req_minor"; then |
| 88 | - if test "$micro" -ge "$req_micro"; then |
| 89 | - ok=yes |
| 90 | - fi |
| 91 | - fi |
| 92 | - fi |
| 93 | - fi |
| 94 | - fi |
| 95 | - fi |
| 96 | - if test $ok = yes; then |
| 97 | - AC_MSG_RESULT([yes ($ksba_config_version)]) |
| 98 | - else |
| 99 | - AC_MSG_RESULT(no) |
| 100 | - fi |
| 101 | + PKG_CHECK_MODULES(KSBA, [ksba >= $min_ksba_version], [ok=yes], [ok=no]) |
| 102 | + |
| 103 | if test $ok = yes; then |
| 104 | # Even if we have a recent libksba, we should check that the |
| 105 | # API is compatible. |
| 106 | if test "$req_ksba_api" -gt 0 ; then |
Andrew Geissler | 5a43b43 | 2020-06-13 10:46:56 -0500 | [diff] [blame] | 107 | - if test -z "$use_gpgrt_config"; then |
| 108 | - tmp=`$KSBA_CONFIG --api-version 2>/dev/null || echo 0` |
| 109 | - else |
| 110 | - tmp=`$KSBA_CONFIG --variable=api_version 2>/dev/null || echo 0` |
| 111 | - fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 112 | + tmp=`$PKG_CONFIG --variable=api_version ksba` |
| 113 | if test "$tmp" -gt 0 ; then |
| 114 | AC_MSG_CHECKING([KSBA API version]) |
| 115 | if test "$req_ksba_api" -eq "$tmp" ; then |
Andrew Geissler | 706d5aa | 2021-02-12 15:55:30 -0600 | [diff] [blame^] | 116 | @@ -125,14 +51,8 @@ AC_DEFUN([AM_PATH_KSBA], |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 117 | fi |
| 118 | fi |
| 119 | if test $ok = yes; then |
Andrew Geissler | 5a43b43 | 2020-06-13 10:46:56 -0500 | [diff] [blame] | 120 | - KSBA_CFLAGS=`$KSBA_CONFIG --cflags` |
| 121 | - KSBA_LIBS=`$KSBA_CONFIG --libs` |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 122 | ifelse([$2], , :, [$2]) |
Andrew Geissler | 5a43b43 | 2020-06-13 10:46:56 -0500 | [diff] [blame] | 123 | - if test -z "$use_gpgrt_config"; then |
| 124 | - libksba_config_host=`$KSBA_CONFIG --host 2>/dev/null || echo none` |
| 125 | - else |
| 126 | - libksba_config_host=`$KSBA_CONFIG --variable=host 2>/dev/null || echo none` |
| 127 | - fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 128 | + libksba_config_host=`$PKG_CONFIG --variable=host ksba` |
| 129 | if test x"$libksba_config_host" != xnone ; then |
| 130 | if test x"$libksba_config_host" != x"$host" ; then |
| 131 | AC_MSG_WARN([[ |
Andrew Geissler | 706d5aa | 2021-02-12 15:55:30 -0600 | [diff] [blame^] | 132 | @@ -146,8 +66,6 @@ AC_DEFUN([AM_PATH_KSBA], |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 133 | fi |
| 134 | fi |
| 135 | else |
| 136 | - KSBA_CFLAGS="" |
| 137 | - KSBA_LIBS="" |
| 138 | ifelse([$3], , :, [$3]) |
| 139 | fi |
| 140 | AC_SUBST(KSBA_CFLAGS) |