xref: /OK3568_Linux_fs/yocto/poky/meta/recipes-support/libksba/libksba/ksba-add-pkgconfig-support.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From ca8174aa81d7bf364b33f7254a9e887735c4996d Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 3 Dec 2012 18:17:31 +0800
4Subject: [PATCH] libksba: add pkgconfig support
5
6Upstream-Status: Denied
7
8Add pkgconfig support to libksba.
9This patch is rejected by upstream for the reason below:
10They think pkgconfig adds no portability and maintaining them is not worthwhile.
11
12Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
13
14---
15 src/ksba.m4 | 90 +++--------------------------------------------------
16 1 file changed, 4 insertions(+), 86 deletions(-)
17
18diff --git a/src/ksba.m4 b/src/ksba.m4
19index 452c245..aa96255 100644
20--- a/src/ksba.m4
21+++ b/src/ksba.m4
22@@ -23,37 +23,6 @@ dnl with a changed API.
23 dnl
24 AC_DEFUN([AM_PATH_KSBA],
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,
30-              AS_HELP_STRING([--with-libksba-prefix=PFX],
31-                             [prefix where KSBA is installed (optional)]),
32-     ksba_config_prefix="$withval", ksba_config_prefix="")
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-
40-  if test x$ksba_config_prefix != x ; then
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=""
47-  if test x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then
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)
56-  fi
57
58   tmp=ifelse([$1], ,1:1.0.0,$1)
59   if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
60@@ -64,56 +33,13 @@ AC_DEFUN([AM_PATH_KSBA],
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/'`
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
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
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
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
120@@ -126,14 +52,8 @@ AC_DEFUN([AM_PATH_KSBA],
121      fi
122   fi
123   if test $ok = yes; then
124-    KSBA_CFLAGS=`$KSBA_CONFIG --cflags`
125-    KSBA_LIBS=`$KSBA_CONFIG --libs`
126     ifelse([$2], , :, [$2])
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
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([[
136@@ -147,8 +67,6 @@ AC_DEFUN([AM_PATH_KSBA],
137       fi
138     fi
139   else
140-    KSBA_CFLAGS=""
141-    KSBA_LIBS=""
142     ifelse([$3], , :, [$3])
143   fi
144   AC_SUBST(KSBA_CFLAGS)
145