blob: d41c3de3b6e7340de8ce354bd1681dbcbe5a2ba0 [file] [log] [blame]
Brad Bishopd7bf8c12018-02-25 22:55:05 -05001From 72b9e9040d58c15f0302bd8abda28179f04e1c5f Mon Sep 17 00:00:00 2001
2From: Richard Purdie <richard.purdie@linuxfoundation.org>
3Date: Wed, 16 Aug 2017 10:43:18 +0800
4Subject: [PATCH 1/4] Add and use pkg-config for libgcrypt instead of -config
5 scripts.
6
7Upstream-Status: Denied [upstream have indicated they don't want a
8pkg-config dependency]
9
10RP 2014/5/22
11
12Rebase to 1.8.0
13
14Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
15---
16 configure.ac | 1 +
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
21
22diff --git a/configure.ac b/configure.ac
23index bbe8104..3d2de73 100644
24--- a/configure.ac
25+++ b/configure.ac
26@@ -2607,6 +2607,7 @@ random/Makefile
27 doc/Makefile
28 src/Makefile
29 src/gcrypt.h
30+src/libgcrypt.pc
31 src/libgcrypt-config
32 src/versioninfo.rc
33 tests/Makefile
34diff --git a/src/libgcrypt.m4 b/src/libgcrypt.m4
35index 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.
39 dnl
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"
49- else
50- case "${SYSROOT}" in
51- /*)
52- if test -x "${SYSROOT}/bin/libgcrypt-config" ; then
53- LIBGCRYPT_CONFIG="${SYSROOT}/bin/libgcrypt-config"
54- fi
55- ;;
56- '')
57- ;;
58- *)
59- AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.])
60- ;;
61- esac
62- fi
63- fi
64-
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"
71 fi
72
73- AC_MSG_CHECKING(for LIBGCRYPT - version >= $min_libgcrypt_version)
74- ok=no
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
90- ok=yes
91- else
92- if test "$major" -eq "$req_major"; then
93- if test "$minor" -gt "$req_minor"; then
94- ok=yes
95- else
96- if test "$minor" -eq "$req_minor"; then
97- if test "$micro" -ge "$req_micro"; then
98- ok=yes
99- fi
100- fi
101- fi
102- fi
103- fi
104- fi
105- if test $ok = yes; then
106- AC_MSG_RESULT([yes ($libgcrypt_config_version)])
107- else
108- AC_MSG_RESULT(no)
109- fi
110+ PKG_CHECK_MODULES(LIBGCRYPT, [libgcrypt >= $min_libgcrypt_version], [ok=yes], [ok=no])
111+
112 if test $ok = yes; then
113 # If we have a recent libgcrypt, we should also check that the
114 # API is compatible
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],
122 fi
123 fi
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
132 AC_MSG_WARN([[
133@@ -134,8 +73,6 @@ AC_DEFUN([AM_PATH_LIBGCRYPT],
134 fi
135 fi
136 else
137- LIBGCRYPT_CFLAGS=""
138- LIBGCRYPT_LIBS=""
139 ifelse([$3], , :, [$3])
140 fi
141 AC_SUBST(LIBGCRYPT_CFLAGS)
142diff --git a/src/libgcrypt.pc.in b/src/libgcrypt.pc.in
143new file mode 100644
144index 0000000..2fc8f53
145--- /dev/null
146+++ b/src/libgcrypt.pc.in
147@@ -0,0 +1,33 @@
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
151+#
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.
155+#
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.
159+
160+prefix=@prefix@
161+exec_prefix=@exec_prefix@
162+libdir=@libdir@
163+includedir=@includedir@
164+
165+# API info
166+api_version=@LIBGCRYPT_CONFIG_API_VERSION@
167+host=@LIBGCRYPT_CONFIG_HOST@
168+
169+# Misc information.
170+symmetric_ciphers=@LIBGCRYPT_CIPHERS@
171+asymmetric_ciphers=@LIBGCRYPT_PUBKEY_CIPHERS@
172+digests=@LIBGCRYPT_DIGESTS@
173+
174+Name: libgcrypt
175+Description: GNU crypto library
176+URL: http://www.gnupg.org
177+Version: @VERSION@
178+Libs: -L${libdir} -lgcrypt
179+Libs.private: -L${libdir} -lgpg-error
180+Cflags: -I${includedir}
181--
1821.8.3.1
183