unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#27708: [PROPOSED] Simplify configuration of HAVE_GNUTLS3 etc.
@ 2017-07-15 16:14 Paul Eggert
  2017-07-15 16:33 ` Eli Zaretskii
  0 siblings, 1 reply; 20+ messages in thread
From: Paul Eggert @ 2017-07-15 16:14 UTC (permalink / raw)
  To: 27708; +Cc: Paul Eggert

There's only one GnuTLS, so configuring these symbols at
'configure' time is overkill.  Simplify things by moving their
configuration to src/gnutls.h.
* configure.ac (HAVE_GNUTLS3, HAVE_GNUTLS3_HMAC, HAVE_GNUTLS3_AEAD)
(HAVE_GNUTLS3_CIPHER, HAVE_GNUTLS3_DIGEST): Move these definitions
from here ...
* src/gnutls.h: ... to here, and simplify.
---
 configure.ac | 83 ------------------------------------------------------------
 src/gnutls.h | 12 +++++++--
 2 files changed, 10 insertions(+), 85 deletions(-)

diff --git a/configure.ac b/configure.ac
index 056c8c3..329a590 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2829,89 +2829,6 @@ AC_DEFUN
     [HAVE_GNUTLS=yes], [HAVE_GNUTLS=no])
   if test "${HAVE_GNUTLS}" = "yes"; then
     AC_DEFINE(HAVE_GNUTLS, 1, [Define if using GnuTLS.])
-    EMACS_CHECK_MODULES([LIBGNUTLS3], [gnutls >= 3.0.0],
-      [AC_DEFINE(HAVE_GNUTLS3, 1, [Define if using GnuTLS v3.])], [])
-
-    AC_CACHE_CHECK([for GnuTLS v3 with HMAC], [emacs_cv_gnutls3_hmac],
-      [AC_COMPILE_IFELSE(
-	[AC_LANG_PROGRAM([[
-	      #include <gnutls/gnutls.h>
-	      #include <gnutls/crypto.h>
-	   ]], [[
-	     int
-	     main (void)
-	     {
-	       gnutls_hmac_hd_t handle;
-	       gnutls_hmac_deinit (handle, NULL);
-	     }
-	   ]])],
-	[emacs_cv_gnutls3_hmac=yes],
-	[emacs_cv_gnutls3_hmac=no])])
-    if test "$emacs_cv_gnutls3_hmac" = yes; then
-      AC_DEFINE([HAVE_GNUTLS3_HMAC], [1],
-	[Define if using GnuTLS v3 with HMAC support.])
-    fi
-
-    AC_CACHE_CHECK([for GnuTLS v3 with AEAD], [emacs_cv_gnutls3_aead],
-      [AC_COMPILE_IFELSE(
-	[AC_LANG_PROGRAM([[
-	      #include <gnutls/gnutls.h>
-	      #include <gnutls/crypto.h>
-	   ]], [[
-	     int
-	     main (void)
-	     {
-	       gnutls_aead_cipher_hd_t handle;
-	       gnutls_aead_cipher_deinit (handle);
-	     }
-	   ]])],
-	[emacs_cv_gnutls3_aead=yes],
-	[emacs_cv_gnutls3_aead=no])])
-    if test "$emacs_cv_gnutls3_aead" = yes; then
-      AC_DEFINE([HAVE_GNUTLS3_AEAD], [1],
-	[Define if using GnuTLS v3 with AEAD support.])
-    fi
-
-    AC_CACHE_CHECK([for GnuTLS v3 with cipher], [emacs_cv_gnutls3_cipher],
-      [AC_COMPILE_IFELSE(
-	[AC_LANG_PROGRAM([[
-	      #include <gnutls/gnutls.h>
-	      #include <gnutls/crypto.h>
-	   ]], [[
-	     int
-	     main (void)
-	     {
-	       gnutls_cipher_hd_t handle;
-	       gnutls_cipher_encrypt2 (handle, NULL, 0, NULL, 0);
-	       gnutls_cipher_deinit (handle);
-	     }
-	   ]])],
-	[emacs_cv_gnutls3_cipher=yes],
-	[emacs_cv_gnutls3_cipher=no])])
-    if test "$emacs_cv_gnutls3_cipher" = yes; then
-      AC_DEFINE([HAVE_GNUTLS3_CIPHER], [1],
-	[Define if using GnuTLS v3 with cipher support.])
-    fi
-
-    AC_CACHE_CHECK([for GnuTLS v3 with digest], [emacs_cv_gnutls3_digest],
-      [AC_COMPILE_IFELSE(
-	[AC_LANG_PROGRAM([[
-	      #include <gnutls/gnutls.h>
-	      #include <gnutls/crypto.h>
-	   ]], [[
-	     int
-	     main (void)
-	     {
-	       gnutls_hash_hd_t handle;
-	       gnutls_hash_deinit (handle, NULL);
-	     }
-	   ]])],
-	[emacs_cv_gnutls3_digest=yes],
-	[emacs_cv_gnutls3_digest=no])])
-    if test "$emacs_cv_gnutls3_digest" = yes; then
-      AC_DEFINE([HAVE_GNUTLS3_DIGEST], [1],
-	[Define if using GnuTLS v3 with digest support.])
-    fi
   fi
 
   # Windows loads GnuTLS dynamically
diff --git a/src/gnutls.h b/src/gnutls.h
index 3ec86a8..19c1686 100644
--- a/src/gnutls.h
+++ b/src/gnutls.h
@@ -23,8 +23,16 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <gnutls/gnutls.h>
 #include <gnutls/x509.h>
 
-#ifdef HAVE_GNUTLS3
-#include <gnutls/crypto.h>
+#if 0x030000 <= GNUTLS_VERSION_NUMBER
+# define HAVE_GNUTLS3
+# include <gnutls/crypto.h>
+#endif
+
+#if 0x030400 <= GNUTLS_VERSION_NUMBER
+# define HAVE_GNUTLS3_AEAD
+# define HAVE_GNUTLS3_CIPHER
+# define HAVE_GNUTLS3_DIGEST
+# define HAVE_GNUTLS3_HMAC
 #endif
 
 #include "lisp.h"
-- 
2.7.4






^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2017-08-04 13:32 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-15 16:14 bug#27708: [PROPOSED] Simplify configuration of HAVE_GNUTLS3 etc Paul Eggert
2017-07-15 16:33 ` Eli Zaretskii
2017-07-15 19:11   ` Ted Zlatanov
2017-07-15 19:22     ` Eli Zaretskii
2017-07-16  0:31       ` Paul Eggert
2017-07-16  2:36         ` Eli Zaretskii
2017-07-16 15:18           ` Paul Eggert
2017-07-16 16:08             ` Eli Zaretskii
2017-07-17 15:03               ` Ted Zlatanov
2017-07-26 21:04                 ` Ted Zlatanov
2017-07-26 23:23                   ` Paul Eggert
2017-07-27 21:11                     ` Ted Zlatanov
2017-08-03  2:50                       ` Paul Eggert
2017-08-03 16:06                         ` Glenn Morris
2017-08-03 20:20                           ` Ted Zlatanov
2017-08-03 20:31                             ` Paul Eggert
2017-08-03 20:45                               ` Ted Zlatanov
2017-08-03 21:32                             ` Glenn Morris
2017-08-04  1:41                               ` Paul Eggert
2017-08-04 13:32                                 ` Ted Zlatanov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).