diff options
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | cmake/modules/FindGCRYPT.cmake | 14 | ||||
-rw-r--r-- | configure.ac | 6 |
3 files changed, 17 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f39d3bc029..d9ba012e0f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -702,6 +702,8 @@ endif() # GNU crypto if(ENABLE_GCRYPT) set(PACKAGELIST ${PACKAGELIST} GCRYPT) + # Minimum version needed. + set(GCRYPT_OPTIONS "1.4.2") endif() # GNU SSL/TLS support diff --git a/cmake/modules/FindGCRYPT.cmake b/cmake/modules/FindGCRYPT.cmake index 0b4271a8ed..8c0a367033 100644 --- a/cmake/modules/FindGCRYPT.cmake +++ b/cmake/modules/FindGCRYPT.cmake @@ -28,10 +28,20 @@ SET(GCRYPT_NAMES gcrypt libgcrypt-20) FIND_LIBRARY(GCRYPT_LIBRARY NAMES ${GCRYPT_NAMES} libgcc_s_sjlj-1 HINTS "${GCRYPT_HINTS}/bin") FIND_LIBRARY(GCRYPT_ERROR_LIBRARY NAMES gpg-error libgpg-error-0 libgpg-error6-0 HINTS "${GCRYPT_HINTS}/bin") +# Try to retrieve version from header if found (available since libgcrypt 1.3.0) +if(GCRYPT_INCLUDE_DIR) + set(_version_regex "^#define[ \t]+GCRYPT_VERSION[ \t]+\"([^\"]+)\".*") + file(STRINGS "${GCRYPT_INCLUDE_DIR}/gcrypt.h" GCRYPT_VERSION REGEX "${_version_regex}") + string(REGEX REPLACE "${_version_regex}" "\\1" GCRYPT_VERSION "${GCRYPT_VERSION}") + unset(_version_regex) +endif() + # handle the QUIETLY and REQUIRED arguments and set GCRYPT_FOUND to TRUE if -# all listed variables are TRUE +# all listed variables are TRUE and the requested version matches. INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GCRYPT DEFAULT_MSG GCRYPT_LIBRARY GCRYPT_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GCRYPT + REQUIRED_VARS GCRYPT_LIBRARY GCRYPT_INCLUDE_DIR + VERSION_VAR GCRYPT_VERSION) IF(GCRYPT_FOUND) SET( GCRYPT_LIBRARIES ${GCRYPT_LIBRARY} ${GCRYPT_ERROR_LIBRARY}) diff --git a/configure.ac b/configure.ac index f5bef94174..f086f53d35 100644 --- a/configure.ac +++ b/configure.ac @@ -607,9 +607,9 @@ AC_ARG_WITH([gcrypt], [ with_gcrypt="$withval"; want_gcrypt="yes" ], with_gcrypt="yes") if test "x$with_gcrypt" = "xyes"; then - AM_PATH_LIBGCRYPT(1.1.92, + AM_PATH_LIBGCRYPT(1.4.2, [ - echo "libgcrypt found, enabling ipsec decryption" + echo "libgcrypt found, enabling decryption for ipsec, ssl, etc." AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to use libgcrypt]) gcrypt_message="yes" ] @@ -617,7 +617,7 @@ if test "x$with_gcrypt" = "xyes"; then if test x$libgcrypt_config_prefix != x ; then AC_MSG_ERROR([[libgcrypt not found; install libgcrypt-devel package for your system]]) else - echo "libgcrypt not found, disabling ipsec decryption" + echo "libgcrypt not found, disabling decryption for ipsec, ssl, etc." gcrypt_message="no" fi |