1Add pkgconfig support to libassuan.
2This patch is rejected by upstream for the reason below:
3They think pkgconfig adds no portability and maintaining them is not worthwhile.
4
5Upstream-Status: Denied
6Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
7Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
8
9forward ported to 2.4.4
10Signed-off-by: Armin Kuster <akuster@mvista.com>
11---
12 src/libassuan.m4 | 81 ++----------------------------------------------
13 1 file changed, 3 insertions(+), 78 deletions(-)
14
15diff --git a/src/libassuan.m4 b/src/libassuan.m4
16index df50484..380a48a 100644
17--- a/src/libassuan.m4
18+++ b/src/libassuan.m4
19@@ -17,27 +17,6 @@ dnl Returns ok set to yes or no.
20 dnl
21 AC_DEFUN([_AM_PATH_LIBASSUAN_COMMON],
22 [ AC_REQUIRE([AC_CANONICAL_HOST])
23-  AC_ARG_WITH(libassuan-prefix,
24-              AS_HELP_STRING([--with-libassuan-prefix=PFX],
25-                             [prefix where LIBASSUAN is installed (optional)]),
26-     libassuan_config_prefix="$withval", libassuan_config_prefix="")
27-  if test x$libassuan_config_prefix != x ; then
28-    if test x${LIBASSUAN_CONFIG+set} != xset ; then
29-      LIBASSUAN_CONFIG=$libassuan_config_prefix/bin/libassuan-config
30-    fi
31-  fi
32-
33-  use_gpgrt_config=""
34-  if test x"${LIBASSUAN_CONFIG}" = x -a x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then
35-    if $GPGRT_CONFIG libassuan --exists; then
36-      LIBASSUAN_CONFIG="$GPGRT_CONFIG libassuan"
37-      AC_MSG_NOTICE([Use gpgrt-config as libassuan-config])
38-      use_gpgrt_config=yes
39-    fi
40-  fi
41-  if test -z "$use_gpgrt_config"; then
42-    AC_PATH_PROG(LIBASSUAN_CONFIG, libassuan-config, no)
43-  fi
44
45   tmp=ifelse([$1], ,1:0.9.2,$1)
46   if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
47@@ -47,59 +26,11 @@ AC_DEFUN([_AM_PATH_LIBASSUAN_COMMON],
48     req_libassuan_api=0
49     min_libassuan_version="$tmp"
50   fi
51-
52-  AC_MSG_CHECKING(for LIBASSUAN - version >= $min_libassuan_version)
53-  ok=no
54-  if test "$LIBASSUAN_CONFIG" != "no"; then
55-    req_major=`echo $min_libassuan_version | \
56-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
57-    req_minor=`echo $min_libassuan_version | \
58-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
59-    req_micro=`echo $min_libassuan_version | \
60-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
61-
62-    if test -z "$use_gpgrt_config"; then
63-      libassuan_config_version=`$LIBASSUAN_CONFIG --version`
64-    else
65-      libassuan_config_version=`$LIBASSUAN_CONFIG --modversion`
66-    fi
67-    major=`echo $libassuan_config_version | \
68-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
69-    minor=`echo $libassuan_config_version | \
70-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
71-    micro=`echo $libassuan_config_version | \
72-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
73-
74-    if test "$major" -gt "$req_major"; then
75-        ok=yes
76-    else
77-        if test "$major" -eq "$req_major"; then
78-            if test "$minor" -gt "$req_minor"; then
79-               ok=yes
80-            else
81-               if test "$minor" -eq "$req_minor"; then
82-                   if test "$micro" -ge "$req_micro"; then
83-                     ok=yes
84-                   fi
85-               fi
86-            fi
87-        fi
88-    fi
89-  fi
90-
91-  if test $ok = yes; then
92-    AC_MSG_RESULT([yes ($libassuan_config_version)])
93-  else
94-    AC_MSG_RESULT(no)
95-  fi
96+  PKG_CHECK_MODULES(LIBASSUAN, [libassuan >= $min_libassuan_version], [ok=yes], [ok=no])
97
98   if test $ok = yes; then
99     if test "$req_libassuan_api" -gt 0 ; then
100-      if test -z "$use_gpgrt_config"; then
101-        tmp=`$LIBASSUAN_CONFIG --api-version 2>/dev/null || echo 0`
102-      else
103-        tmp=`$LIBASSUAN_CONFIG --variable=api_version 2>/dev/null || echo 0`
104-      fi
105+      tmp=`$PKG_CONFIG --variable=api_version libassuan`
106       if test "$tmp" -gt 0 ; then
107         AC_MSG_CHECKING([LIBASSUAN API version])
108         if test "$req_libassuan_api" -eq "$tmp" ; then
109@@ -115,9 +46,7 @@ AC_DEFUN([_AM_PATH_LIBASSUAN_COMMON],
110   if test $ok = yes; then
111     if test x"$host" != x ; then
112       if test -z "$use_gpgrt_config"; then
113-        libassuan_config_host=`$LIBASSUAN_CONFIG --host 2>/dev/null || echo none`
114-      else
115-        libassuan_config_host=`$LIBASSUAN_CONFIG --variable=host 2>/dev/null || echo none`
116+        libassuan_config_host=`$PKG_CONFIG --variable=host libassuan`
117       fi
118       if test x"$libassuan_config_host" != xnone ; then
119         if test x"$libassuan_config_host" != x"$host" ; then
120@@ -159,12 +88,8 @@ dnl
121 AC_DEFUN([AM_PATH_LIBASSUAN],
122 [ _AM_PATH_LIBASSUAN_COMMON($1)
123   if test $ok = yes; then
124-    LIBASSUAN_CFLAGS=`$LIBASSUAN_CONFIG --cflags`
125-    LIBASSUAN_LIBS=`$LIBASSUAN_CONFIG --libs`
126     ifelse([$2], , :, [$2])
127   else
128-    LIBASSUAN_CFLAGS=""
129-    LIBASSUAN_LIBS=""
130     ifelse([$3], , :, [$3])
131   fi
132   AC_SUBST(LIBASSUAN_CFLAGS)
133--
1342.25.1
135
136