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