[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] md5, sha1, sha256, sha512:: support --with-openssl=auto_gpl_comp
From: |
Pádraig Brady |
Subject: |
[PATCH] md5, sha1, sha256, sha512:: support --with-openssl=auto_gpl_compat |
Date: |
Wed, 1 Jan 2020 17:43:13 +0000 |
* m4/gl-openssl.m4: Add a new "auto_gpl_compat" mode,
which will auto enable use of openssl, only for >= version 3,
which is newly licensed under the Apache Software License.
This will be used from coreutils for example by adding
gl_SET_CRYPTO_CHECK_DEFAULT([auto_gpl_compat]) to configure.ac.
Even though "auto_gpl_compat" is less aggressive than "auto",
we leave the default at "no" so projects can opt in to the
extra dependency.
---
ChangeLog | 7 +++++++
m4/gl-openssl.m4 | 32 +++++++++++++++++++++++++-------
2 files changed, 32 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ac61fdf..740a982 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2020-01-01 Pádraig Brady <address@hidden>
+
+ md5, sha1, sha256, sha512:: support --with-openssl=auto_gpl_compat
+ * m4/gl-openssl.m4: Add a new "auto_gpl_compat" mode,
+ which will auto enable use of openssl, only for >= version 3,
+ which is newly licensed under the Apache Software License.
+
2020-01-01 Bruno Haible <address@hidden>
doc: Update documentation about wchar_t.
diff --git a/m4/gl-openssl.m4 b/m4/gl-openssl.m4
index 0195202..d2d1d6f 100644
--- a/m4/gl-openssl.m4
+++ b/m4/gl-openssl.m4
@@ -1,4 +1,4 @@
-# gl-openssl.m4 serial 3
+# gl-openssl.m4 serial 4
dnl Copyright (C) 2013-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -21,7 +21,9 @@ AC_DEFUN([gl_CRYPTO_CHECK],
AC_ARG_WITH([openssl],
[AS_HELP_STRING([--with-openssl],
[use libcrypto hash routines. Valid ARGs are:
- 'yes', 'no', 'auto' => use if available,
+ 'yes', 'no',
+ 'auto' => use if any version available,
+ 'auto_gpl_compat' => use if gpl compatible version available,
'optional' => use if available and warn if not available;
default is ']gl_CRYPTO_CHECK_DEFAULT['.
Note also --with-linux-crypto, which will enable
@@ -37,11 +39,27 @@ AC_DEFUN([gl_CRYPTO_CHECK],
AC_SUBST([LIB_CRYPTO])
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.])])])
+ if test "x$with_openssl" = xauto_gpl_compat; then
+ AC_CACHE_CHECK([whether openssl is GPL compatible],
+ [gl_cv_openssl_gpl_compat],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[
+ #include <openssl/opensslv.h>
+ #if OPENSSL_VERSION_MAJOR < 3
+ #error "openssl >= version 3 not found"
+ #endif
+ ]])],
+ [gl_cv_openssl_gpl_compat=yes],
+ [gl_cv_openssl_gpl_compat=no])])
+ fi
+ if test "x$with_openssl" != xauto_gpl_compat ||
+ test "x$gl_cv_openssl_gpl_compat" = xyes; 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.])])])
+ fi
if test "x$LIB_CRYPTO" = x; then
if test "x$with_openssl" = xyes; then
AC_MSG_ERROR([openssl development library not found for $1])
--
2.9.3
- [PATCH] md5, sha1, sha256, sha512:: support --with-openssl=auto_gpl_compat,
Pádraig Brady <=
- Re: [PATCH] md5, sha1, sha256, sha512:: support --with-openssl=auto_gpl_compat, Paul Eggert, 2020/01/01
- Re: [PATCH] md5, sha1, sha256, sha512:: support --with-openssl=auto_gpl_compat, Bruno Haible, 2020/01/01
- Re: [PATCH] md5, sha1, sha256, sha512:: support --with-openssl=auto_gpl_compat, Pádraig Brady, 2020/01/01