bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] md5, sha1, sha256, sha512: add 'auto', and a way to specify defa


From: Paul Eggert
Subject: [PATCH] md5, sha1, sha256, sha512: add 'auto', and a way to specify default
Date: Sat, 07 Dec 2013 17:02:53 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1

I needed something like this for Emacs, and these changes should
affect existing uses so I took the liberty of pushing them.

---
 ChangeLog        |  9 +++++++++
 m4/gl-openssl.m4 | 17 ++++++++++-------
 2 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1f2b13c..5d935ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2013-12-07  Paul Eggert  <address@hidden>
+
+       md5, sha1, sha256, sha512: add 'auto', and a way to specify default
+       * m4/gl-openssl.m4 (gl_CRYPTO_CHECK):
+       Add support for a new option, --with-openssl=auto, which causes
+       the library to be used if available and silently ignored if not.
+       Add support to allow allow configure.ac to specify its own
+       default, by setting with_openssl_default before invoking gl_INIT.
+
 2013-12-05  Paul Eggert  <address@hidden>
 
        open-tests: port to glibc with _FORTIFY_SOURCE and -O1
diff --git a/m4/gl-openssl.m4 b/m4/gl-openssl.m4
index 85bf85f..a14408d 100644
--- a/m4/gl-openssl.m4
+++ b/m4/gl-openssl.m4
@@ -1,4 +1,4 @@
-# gl-openssl.m4 serial 1
+# gl-openssl.m4 serial 2
 dnl Copyright (C) 2013 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -6,12 +6,15 @@ dnl with or without modifications, as long as this notice is 
preserved.
 
 AC_DEFUN([gl_CRYPTO_CHECK],
 [
+  m4_divert_text([DEFAULTS], [with_openssl_default=no])
+
   AC_ARG_WITH([openssl],
     [AS_HELP_STRING([--with-openssl],
       [use libcrypto hash routines. Valid ARGs are:
-       'yes', 'no', 'optional' => use if available])],
+       'yes', 'no', 'auto' => use if available,
+       'optional' => use if available and warn if not available])],
     [],
-    [with_openssl=no])
+    [with_openssl=$with_openssl_default])
 
   if test "x$1" = xMD5; then
     ALG_header=md5.h
@@ -24,13 +27,13 @@ AC_DEFUN([gl_CRYPTO_CHECK],
   if test "x$with_openssl" != xno; then
     AC_CHECK_LIB([crypto], [$1],
       [AC_CHECK_HEADERS([openssl/$ALG_header],
-        [LIB_CRYPTO='-lcrypto'
-         AC_DEFINE([HAVE_OPENSSL_$1],[1],
-           [Define to 1 if libcrypto is used for $1])])])
+         [LIB_CRYPTO=-lcrypto
+          AC_DEFINE([HAVE_OPENSSL_$1], [1],
+            [Define to 1 if libcrypto is used for $1.])])])
     if test "x$LIB_CRYPTO" = x; then
       if test "x$with_openssl" = xyes; then
         AC_MSG_ERROR([openssl development library not found for $1])
-      else
+      elif test "x$with_openssl" = xoptional; then
         AC_MSG_WARN([openssl development library not found for $1])
       fi
     fi
-- 
1.8.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]