Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | Add and use pkg-config for libgcrypt instead of -config scripts. |
| 2 | |
| 3 | Upstream-Status: Denied [upstream have indicated they don't want a pkg-config dependency] |
| 4 | |
| 5 | RP 2014/5/22 |
| 6 | |
| 7 | Index: libgcrypt-1.2.4/configure.ac |
| 8 | =================================================================== |
| 9 | --- libgcrypt-1.2.4.orig/configure.ac 2008-03-19 22:14:50.000000000 +0000 |
| 10 | +++ libgcrypt-1.2.4/configure.ac 2008-03-19 22:14:58.000000000 +0000 |
| 11 | @@ -807,6 +807,7 @@ |
| 12 | doc/Makefile |
| 13 | src/Makefile |
| 14 | src/gcrypt.h |
| 15 | +src/libgcrypt.pc |
| 16 | src/libgcrypt-config |
| 17 | tests/Makefile |
| 18 | w32-dll/Makefile |
| 19 | Index: libgcrypt-1.2.4/src/libgcrypt.pc.in |
| 20 | =================================================================== |
| 21 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 22 | +++ libgcrypt-1.2.4/src/libgcrypt.pc.in 2008-03-19 22:14:58.000000000 +0000 |
| 23 | @@ -0,0 +1,33 @@ |
| 24 | +# Process this file with autoconf to produce a pkg-config metadata file. |
| 25 | +# Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation |
| 26 | +# Author: Simon Josefsson |
| 27 | +# |
| 28 | +# This file is free software; as a special exception the author gives |
| 29 | +# unlimited permission to copy and/or distribute it, with or without |
| 30 | +# modifications, as long as this notice is preserved. |
| 31 | +# |
| 32 | +# This file is distributed in the hope that it will be useful, but |
| 33 | +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the |
| 34 | +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 35 | + |
| 36 | +prefix=@prefix@ |
| 37 | +exec_prefix=@exec_prefix@ |
| 38 | +libdir=@libdir@ |
| 39 | +includedir=@includedir@ |
| 40 | + |
| 41 | +# API info |
| 42 | +api_version=@LIBGCRYPT_CONFIG_API_VERSION@ |
| 43 | +host=@LIBGCRYPT_CONFIG_HOST@ |
| 44 | + |
| 45 | +# Misc information. |
| 46 | +symmetric_ciphers=@LIBGCRYPT_CIPHERS@ |
| 47 | +asymmetric_ciphers=@LIBGCRYPT_PUBKEY_CIPHERS@ |
| 48 | +digests=@LIBGCRYPT_DIGESTS@ |
| 49 | + |
| 50 | +Name: libgcrypt |
| 51 | +Description: GNU crypto library |
| 52 | +URL: http://www.gnupg.org |
| 53 | +Version: @VERSION@ |
| 54 | +Libs: -L${libdir} -lgcrypt |
| 55 | +Libs.private: -L${libdir} -lgpg-error |
| 56 | +Cflags: -I${includedir} |
| 57 | Index: libgcrypt-1.6.1/src/libgcrypt.m4 |
| 58 | =================================================================== |
| 59 | --- libgcrypt-1.6.1.orig/src/libgcrypt.m4 2013-12-16 17:44:32.000000000 +0000 |
| 60 | +++ libgcrypt-1.6.1/src/libgcrypt.m4 2014-05-13 21:25:37.478389833 +0000 |
| 61 | @@ -22,17 +22,7 @@ |
| 62 | dnl |
| 63 | AC_DEFUN([AM_PATH_LIBGCRYPT], |
| 64 | [ AC_REQUIRE([AC_CANONICAL_HOST]) |
| 65 | - AC_ARG_WITH(libgcrypt-prefix, |
| 66 | - AC_HELP_STRING([--with-libgcrypt-prefix=PFX], |
| 67 | - [prefix where LIBGCRYPT is installed (optional)]), |
| 68 | - libgcrypt_config_prefix="$withval", libgcrypt_config_prefix="") |
| 69 | - if test x$libgcrypt_config_prefix != x ; then |
| 70 | - if test x${LIBGCRYPT_CONFIG+set} != xset ; then |
| 71 | - LIBGCRYPT_CONFIG=$libgcrypt_config_prefix/bin/libgcrypt-config |
| 72 | - fi |
| 73 | - fi |
| 74 | |
| 75 | - AC_PATH_TOOL(LIBGCRYPT_CONFIG, libgcrypt-config, no) |
| 76 | tmp=ifelse([$1], ,1:1.2.0,$1) |
| 77 | if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then |
| 78 | req_libgcrypt_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'` |
| 79 | @@ -42,48 +32,13 @@ |
| 80 | min_libgcrypt_version="$tmp" |
| 81 | fi |
| 82 | |
| 83 | - AC_MSG_CHECKING(for LIBGCRYPT - version >= $min_libgcrypt_version) |
| 84 | - ok=no |
| 85 | - if test "$LIBGCRYPT_CONFIG" != "no" ; then |
| 86 | - req_major=`echo $min_libgcrypt_version | \ |
| 87 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` |
| 88 | - req_minor=`echo $min_libgcrypt_version | \ |
| 89 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` |
| 90 | - req_micro=`echo $min_libgcrypt_version | \ |
| 91 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` |
| 92 | - libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version` |
| 93 | - major=`echo $libgcrypt_config_version | \ |
| 94 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` |
| 95 | - minor=`echo $libgcrypt_config_version | \ |
| 96 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` |
| 97 | - micro=`echo $libgcrypt_config_version | \ |
| 98 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'` |
| 99 | - if test "$major" -gt "$req_major"; then |
| 100 | - ok=yes |
| 101 | - else |
| 102 | - if test "$major" -eq "$req_major"; then |
| 103 | - if test "$minor" -gt "$req_minor"; then |
| 104 | - ok=yes |
| 105 | - else |
| 106 | - if test "$minor" -eq "$req_minor"; then |
| 107 | - if test "$micro" -ge "$req_micro"; then |
| 108 | - ok=yes |
| 109 | - fi |
| 110 | - fi |
| 111 | - fi |
| 112 | - fi |
| 113 | - fi |
| 114 | - fi |
| 115 | - if test $ok = yes; then |
| 116 | - AC_MSG_RESULT([yes ($libgcrypt_config_version)]) |
| 117 | - else |
| 118 | - AC_MSG_RESULT(no) |
| 119 | - fi |
| 120 | + PKG_CHECK_MODULES(LIBGCRYPT, [libgcrypt >= $min_libgcrypt_version], [ok=yes], [ok=no]) |
| 121 | + |
| 122 | if test $ok = yes; then |
| 123 | # If we have a recent libgcrypt, we should also check that the |
| 124 | # API is compatible |
| 125 | if test "$req_libgcrypt_api" -gt 0 ; then |
| 126 | - tmp=`$LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0` |
| 127 | + tmp=`$PKG_CONFIG --variable=api_version libgcrypt` |
| 128 | if test "$tmp" -gt 0 ; then |
| 129 | AC_MSG_CHECKING([LIBGCRYPT API version]) |
| 130 | if test "$req_libgcrypt_api" -eq "$tmp" ; then |
| 131 | @@ -96,10 +51,8 @@ |
| 132 | fi |
| 133 | fi |
| 134 | if test $ok = yes; then |
| 135 | - LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags` |
| 136 | - LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs` |
| 137 | ifelse([$2], , :, [$2]) |
| 138 | - libgcrypt_config_host=`$LIBGCRYPT_CONFIG --host 2>/dev/null || echo none` |
| 139 | + libgcrypt_config_host=`$PKG_CONFIG --variable=host libgcrypt` |
| 140 | if test x"$libgcrypt_config_host" != xnone ; then |
| 141 | if test x"$libgcrypt_config_host" != x"$host" ; then |
| 142 | AC_MSG_WARN([[ |
| 143 | @@ -113,8 +66,6 @@ |
| 144 | fi |
| 145 | fi |
| 146 | else |
| 147 | - LIBGCRYPT_CFLAGS="" |
| 148 | - LIBGCRYPT_LIBS="" |
| 149 | ifelse([$3], , :, [$3]) |
| 150 | fi |
| 151 | AC_SUBST(LIBGCRYPT_CFLAGS) |