1 From 72b9e9040d58c15f0302bd8abda28179f04e1c5f Mon Sep 17 00:00:00 2001
2 From: Richard Purdie <richard.purdie@linuxfoundation.org>
3 Date: Wed, 16 Aug 2017 10:43:18 +0800
4 Subject: [PATCH 1/4] Add and use pkg-config for libgcrypt instead of -config
7 Upstream-Status: Denied [upstream have indicated they don't want a
14 Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
17 src/libgcrypt.m4 | 71 +++--------------------------------------------------
18 src/libgcrypt.pc.in | 33 +++++++++++++++++++++++++
19 3 files changed, 38 insertions(+), 67 deletions(-)
20 create mode 100644 src/libgcrypt.pc.in
22 diff --git a/configure.ac b/configure.ac
23 index bbe8104..3d2de73 100644
26 @@ -2607,6 +2607,7 @@ random/Makefile
34 diff --git a/src/libgcrypt.m4 b/src/libgcrypt.m4
35 index c67cfec..4ea5f2c 100644
36 --- a/src/libgcrypt.m4
37 +++ b/src/libgcrypt.m4
38 @@ -29,30 +29,6 @@ dnl is added to the gpg_config_script_warn variable.
40 AC_DEFUN([AM_PATH_LIBGCRYPT],
41 [ AC_REQUIRE([AC_CANONICAL_HOST])
42 - AC_ARG_WITH(libgcrypt-prefix,
43 - AC_HELP_STRING([--with-libgcrypt-prefix=PFX],
44 - [prefix where LIBGCRYPT is installed (optional)]),
45 - libgcrypt_config_prefix="$withval", libgcrypt_config_prefix="")
46 - if test x"${LIBGCRYPT_CONFIG}" = x ; then
47 - if test x"${libgcrypt_config_prefix}" != x ; then
48 - LIBGCRYPT_CONFIG="${libgcrypt_config_prefix}/bin/libgcrypt-config"
50 - case "${SYSROOT}" in
52 - if test -x "${SYSROOT}/bin/libgcrypt-config" ; then
53 - LIBGCRYPT_CONFIG="${SYSROOT}/bin/libgcrypt-config"
59 - AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.])
65 - AC_PATH_PROG(LIBGCRYPT_CONFIG, libgcrypt-config, no)
66 tmp=ifelse([$1], ,1:1.2.0,$1)
67 if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
68 req_libgcrypt_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'`
69 @@ -62,48 +38,13 @@ AC_DEFUN([AM_PATH_LIBGCRYPT],
70 min_libgcrypt_version="$tmp"
73 - AC_MSG_CHECKING(for LIBGCRYPT - version >= $min_libgcrypt_version)
75 - if test "$LIBGCRYPT_CONFIG" != "no" ; then
76 - req_major=`echo $min_libgcrypt_version | \
77 - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
78 - req_minor=`echo $min_libgcrypt_version | \
79 - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
80 - req_micro=`echo $min_libgcrypt_version | \
81 - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
82 - libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version`
83 - major=`echo $libgcrypt_config_version | \
84 - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
85 - minor=`echo $libgcrypt_config_version | \
86 - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
87 - micro=`echo $libgcrypt_config_version | \
88 - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
89 - if test "$major" -gt "$req_major"; then
92 - if test "$major" -eq "$req_major"; then
93 - if test "$minor" -gt "$req_minor"; then
96 - if test "$minor" -eq "$req_minor"; then
97 - if test "$micro" -ge "$req_micro"; then
105 - if test $ok = yes; then
106 - AC_MSG_RESULT([yes ($libgcrypt_config_version)])
110 + PKG_CHECK_MODULES(LIBGCRYPT, [libgcrypt >= $min_libgcrypt_version], [ok=yes], [ok=no])
112 if test $ok = yes; then
113 # If we have a recent libgcrypt, we should also check that the
115 if test "$req_libgcrypt_api" -gt 0 ; then
116 - tmp=`$LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0`
117 + tmp=`$PKG_CONFIG --variable=api_version libgcrypt`
118 if test "$tmp" -gt 0 ; then
119 AC_MSG_CHECKING([LIBGCRYPT API version])
120 if test "$req_libgcrypt_api" -eq "$tmp" ; then
121 @@ -116,10 +57,8 @@ AC_DEFUN([AM_PATH_LIBGCRYPT],
124 if test $ok = yes; then
125 - LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags`
126 - LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs`
127 ifelse([$2], , :, [$2])
128 - libgcrypt_config_host=`$LIBGCRYPT_CONFIG --host 2>/dev/null || echo none`
129 + libgcrypt_config_host=`$PKG_CONFIG --variable=host libgcrypt`
130 if test x"$libgcrypt_config_host" != xnone ; then
131 if test x"$libgcrypt_config_host" != x"$host" ; then
133 @@ -134,8 +73,6 @@ AC_DEFUN([AM_PATH_LIBGCRYPT],
137 - LIBGCRYPT_CFLAGS=""
139 ifelse([$3], , :, [$3])
141 AC_SUBST(LIBGCRYPT_CFLAGS)
142 diff --git a/src/libgcrypt.pc.in b/src/libgcrypt.pc.in
144 index 0000000..2fc8f53
146 +++ b/src/libgcrypt.pc.in
148 +# Process this file with autoconf to produce a pkg-config metadata file.
149 +# Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation
150 +# Author: Simon Josefsson
152 +# This file is free software; as a special exception the author gives
153 +# unlimited permission to copy and/or distribute it, with or without
154 +# modifications, as long as this notice is preserved.
156 +# This file is distributed in the hope that it will be useful, but
157 +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
158 +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
161 +exec_prefix=@exec_prefix@
163 +includedir=@includedir@
166 +api_version=@LIBGCRYPT_CONFIG_API_VERSION@
167 +host=@LIBGCRYPT_CONFIG_HOST@
170 +symmetric_ciphers=@LIBGCRYPT_CIPHERS@
171 +asymmetric_ciphers=@LIBGCRYPT_PUBKEY_CIPHERS@
172 +digests=@LIBGCRYPT_DIGESTS@
175 +Description: GNU crypto library
176 +URL: http://www.gnupg.org
178 +Libs: -L${libdir} -lgcrypt
179 +Libs.private: -L${libdir} -lgpg-error
180 +Cflags: -I${includedir}