Patch for libgrypt autoconf macro

Evgeny Grin k2k at yandex.ru
Wed Mar 5 11:02:56 CET 2014


Hi!

I modified libgcrypt.m4 for my local needs and want to share my patch:


>From 003dba7cc64b0a4760d3c4b918faf4264b913633 Mon Sep 17 00:00:00 2001
From: Karlson2k <k2k at narod.ru>
Date: Thu, 27 Feb 2014 10:59:41 +0400
Subject: [PATCH] Updated src/libgcrypt.m4 to use $SED and $GREP instead of
 hardcoded names

---
 src/libgcrypt.m4 | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/src/libgcrypt.m4 b/src/libgcrypt.m4
index 6cf482f..75863ba 100644
--- a/src/libgcrypt.m4
+++ b/src/libgcrypt.m4
@@ -1,5 +1,6 @@
 dnl Autoconf macros for libgcrypt
 dnl       Copyright (C) 2002, 2004, 2011 Free Software Foundation, Inc.
+dnl       Copyright (C) 2014 Karlson2k (Evgeny Grin)
 dnl
 dnl This file is free software; as a special exception the author gives
 dnl unlimited permission to copy and/or distribute it, with or without
@@ -20,8 +21,12 @@ dnl version of libgcrypt is at least 1.2.5 *and* the API number is 1.  Using
 dnl this features allows to prevent build against newer versions of libgcrypt
 dnl with a changed API.
 dnl
+dnl Updated by Karlson2k to be more tolerant to host tools variations.
+dnl
 AC_DEFUN([AM_PATH_LIBGCRYPT],
 [ AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([AC_PROG_GREP])
+  AC_REQUIRE([AC_PROG_SED])
   AC_ARG_WITH(libgcrypt-prefix,
             AC_HELP_STRING([--with-libgcrypt-prefix=PFX],
                            [prefix where LIBGCRYPT is installed (optional)]),
@@ -34,9 +39,9 @@ AC_DEFUN([AM_PATH_LIBGCRYPT],
 
   AC_PATH_TOOL(LIBGCRYPT_CONFIG, libgcrypt-config, no)
   tmp=ifelse([$1], ,1:1.2.0,$1)
-  if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
-     req_libgcrypt_api=`echo "$tmp"     | sed 's/\(.*\):\(.*\)/\1/'`
-     min_libgcrypt_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
+  if echo "$tmp" | $GREP ':' >/dev/null 2>/dev/null ; then
+     req_libgcrypt_api=`echo "$tmp"     | $SED 's/\(.*\):\(.*\)/\1/'`
+     min_libgcrypt_version=`echo "$tmp" | $SED 's/\(.*\):\(.*\)/\2/'`
   else
      req_libgcrypt_api=0
      min_libgcrypt_version="$tmp"
@@ -46,18 +51,18 @@ AC_DEFUN([AM_PATH_LIBGCRYPT],
   ok=no
   if test "$LIBGCRYPT_CONFIG" != "no" ; then
     req_major=`echo $min_libgcrypt_version | \
-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
+               $SED 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
     req_minor=`echo $min_libgcrypt_version | \
-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
+               $SED 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
     req_micro=`echo $min_libgcrypt_version | \
-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
+               $SED 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
     libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version`
     major=`echo $libgcrypt_config_version | \
-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
+               $SED 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
     minor=`echo $libgcrypt_config_version | \
-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
+               $SED 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
     micro=`echo $libgcrypt_config_version | \
-               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
+               $SED 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
     if test "$major" -gt "$req_major"; then
         ok=yes
     else
-- 
1.8.5.5

Hope you'll find it useful.

-- 
Best Wishes,
Evgeny Grin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libgcrypt.m4.patch
Type: text/x-diff
Size: 3367 bytes
Desc: not available
URL: </pipermail/attachments/20140305/b6dda519/attachment.patch>


More information about the Gcrypt-devel mailing list