diff options
| author | Paul Eggert | 2017-08-02 19:46:41 -0700 |
|---|---|---|
| committer | Paul Eggert | 2017-08-02 19:49:43 -0700 |
| commit | a8a81df8da1adad2d4feb22b1fd6aac0f7ca98d2 (patch) | |
| tree | 765664da2f91c54802c663e1cb8c9ba81c4ebb5c | |
| parent | 2d2c12fc5f45ff73387efd6241447f3d9cbadf09 (diff) | |
| download | emacs-a8a81df8da1adad2d4feb22b1fd6aac0f7ca98d2.tar.gz emacs-a8a81df8da1adad2d4feb22b1fd6aac0f7ca98d2.zip | |
Simplify configuration of HAVE_GNUTLS3 etc.
There's only one GnuTLS, so configuring these symbols at
'configure' time is overkill. Simplify things by moving their
configuration to src/gnutls.h (Bug#27708).
* 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.
| -rw-r--r-- | configure.ac | 83 | ||||
| -rw-r--r-- | src/gnutls.h | 12 |
2 files changed, 10 insertions, 85 deletions
diff --git a/configure.ac b/configure.ac index c9e8c0dd1c7..9f80620a807 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -2840,89 +2840,6 @@ if test "${with_gnutls}" = "yes" ; then | |||
| 2840 | [HAVE_GNUTLS=yes], [HAVE_GNUTLS=no]) | 2840 | [HAVE_GNUTLS=yes], [HAVE_GNUTLS=no]) |
| 2841 | if test "${HAVE_GNUTLS}" = "yes"; then | 2841 | if test "${HAVE_GNUTLS}" = "yes"; then |
| 2842 | AC_DEFINE(HAVE_GNUTLS, 1, [Define if using GnuTLS.]) | 2842 | AC_DEFINE(HAVE_GNUTLS, 1, [Define if using GnuTLS.]) |
| 2843 | EMACS_CHECK_MODULES([LIBGNUTLS3], [gnutls >= 3.0.0], | ||
| 2844 | [AC_DEFINE(HAVE_GNUTLS3, 1, [Define if using GnuTLS v3.])], []) | ||
| 2845 | |||
| 2846 | AC_CACHE_CHECK([for GnuTLS v3 with HMAC], [emacs_cv_gnutls3_hmac], | ||
| 2847 | [AC_COMPILE_IFELSE( | ||
| 2848 | [AC_LANG_PROGRAM([[ | ||
| 2849 | #include <gnutls/gnutls.h> | ||
| 2850 | #include <gnutls/crypto.h> | ||
| 2851 | ]], [[ | ||
| 2852 | int | ||
| 2853 | main (void) | ||
| 2854 | { | ||
| 2855 | gnutls_hmac_hd_t handle; | ||
| 2856 | gnutls_hmac_deinit (handle, NULL); | ||
| 2857 | } | ||
| 2858 | ]])], | ||
| 2859 | [emacs_cv_gnutls3_hmac=yes], | ||
| 2860 | [emacs_cv_gnutls3_hmac=no])]) | ||
| 2861 | if test "$emacs_cv_gnutls3_hmac" = yes; then | ||
| 2862 | AC_DEFINE([HAVE_GNUTLS3_HMAC], [1], | ||
| 2863 | [Define if using GnuTLS v3 with HMAC support.]) | ||
| 2864 | fi | ||
| 2865 | |||
| 2866 | AC_CACHE_CHECK([for GnuTLS v3 with AEAD], [emacs_cv_gnutls3_aead], | ||
| 2867 | [AC_COMPILE_IFELSE( | ||
| 2868 | [AC_LANG_PROGRAM([[ | ||
| 2869 | #include <gnutls/gnutls.h> | ||
| 2870 | #include <gnutls/crypto.h> | ||
| 2871 | ]], [[ | ||
| 2872 | int | ||
| 2873 | main (void) | ||
| 2874 | { | ||
| 2875 | gnutls_aead_cipher_hd_t handle; | ||
| 2876 | gnutls_aead_cipher_deinit (handle); | ||
| 2877 | } | ||
| 2878 | ]])], | ||
| 2879 | [emacs_cv_gnutls3_aead=yes], | ||
| 2880 | [emacs_cv_gnutls3_aead=no])]) | ||
| 2881 | if test "$emacs_cv_gnutls3_aead" = yes; then | ||
| 2882 | AC_DEFINE([HAVE_GNUTLS3_AEAD], [1], | ||
| 2883 | [Define if using GnuTLS v3 with AEAD support.]) | ||
| 2884 | fi | ||
| 2885 | |||
| 2886 | AC_CACHE_CHECK([for GnuTLS v3 with cipher], [emacs_cv_gnutls3_cipher], | ||
| 2887 | [AC_COMPILE_IFELSE( | ||
| 2888 | [AC_LANG_PROGRAM([[ | ||
| 2889 | #include <gnutls/gnutls.h> | ||
| 2890 | #include <gnutls/crypto.h> | ||
| 2891 | ]], [[ | ||
| 2892 | int | ||
| 2893 | main (void) | ||
| 2894 | { | ||
| 2895 | gnutls_cipher_hd_t handle; | ||
| 2896 | gnutls_cipher_encrypt2 (handle, NULL, 0, NULL, 0); | ||
| 2897 | gnutls_cipher_deinit (handle); | ||
| 2898 | } | ||
| 2899 | ]])], | ||
| 2900 | [emacs_cv_gnutls3_cipher=yes], | ||
| 2901 | [emacs_cv_gnutls3_cipher=no])]) | ||
| 2902 | if test "$emacs_cv_gnutls3_cipher" = yes; then | ||
| 2903 | AC_DEFINE([HAVE_GNUTLS3_CIPHER], [1], | ||
| 2904 | [Define if using GnuTLS v3 with cipher support.]) | ||
| 2905 | fi | ||
| 2906 | |||
| 2907 | AC_CACHE_CHECK([for GnuTLS v3 with digest], [emacs_cv_gnutls3_digest], | ||
| 2908 | [AC_COMPILE_IFELSE( | ||
| 2909 | [AC_LANG_PROGRAM([[ | ||
| 2910 | #include <gnutls/gnutls.h> | ||
| 2911 | #include <gnutls/crypto.h> | ||
| 2912 | ]], [[ | ||
| 2913 | int | ||
| 2914 | main (void) | ||
| 2915 | { | ||
| 2916 | gnutls_hash_hd_t handle; | ||
| 2917 | gnutls_hash_deinit (handle, NULL); | ||
| 2918 | } | ||
| 2919 | ]])], | ||
| 2920 | [emacs_cv_gnutls3_digest=yes], | ||
| 2921 | [emacs_cv_gnutls3_digest=no])]) | ||
| 2922 | if test "$emacs_cv_gnutls3_digest" = yes; then | ||
| 2923 | AC_DEFINE([HAVE_GNUTLS3_DIGEST], [1], | ||
| 2924 | [Define if using GnuTLS v3 with digest support.]) | ||
| 2925 | fi | ||
| 2926 | fi | 2843 | fi |
| 2927 | 2844 | ||
| 2928 | # Windows loads GnuTLS dynamically | 2845 | # Windows loads GnuTLS dynamically |
diff --git a/src/gnutls.h b/src/gnutls.h index 3ec86a8892d..19c16867d7a 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/>. */ | |||
| 23 | #include <gnutls/gnutls.h> | 23 | #include <gnutls/gnutls.h> |
| 24 | #include <gnutls/x509.h> | 24 | #include <gnutls/x509.h> |
| 25 | 25 | ||
| 26 | #ifdef HAVE_GNUTLS3 | 26 | #if 0x030000 <= GNUTLS_VERSION_NUMBER |
| 27 | #include <gnutls/crypto.h> | 27 | # define HAVE_GNUTLS3 |
| 28 | # include <gnutls/crypto.h> | ||
| 29 | #endif | ||
| 30 | |||
| 31 | #if 0x030400 <= GNUTLS_VERSION_NUMBER | ||
| 32 | # define HAVE_GNUTLS3_AEAD | ||
| 33 | # define HAVE_GNUTLS3_CIPHER | ||
| 34 | # define HAVE_GNUTLS3_DIGEST | ||
| 35 | # define HAVE_GNUTLS3_HMAC | ||
| 28 | #endif | 36 | #endif |
| 29 | 37 | ||
| 30 | #include "lisp.h" | 38 | #include "lisp.h" |