From 380c16a82b96dfde2700c60938a2ffc021b33bf2 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 9 Apr 2024 14:52:38 +0200 Subject: [PATCH] configure: add --with-libgcrypt option libgcrypt is a relatively large dependency that is used only for the sake of computing MD5 in the CHAP authentication protocol. Allow distributions to disable it forcibly and rely on the embedded MD5 implementation. Signed-off-by: Paolo Bonzini --- configure.ac | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index c81b916..b7d214f 100644 --- a/configure.ac +++ b/configure.ac @@ -78,8 +78,21 @@ AM_CONDITIONAL([BUILD_EXAMPLES], AC_CONFIG_HEADERS([config.h]) -AC_CHECK_LIB([gcrypt], [gcry_control]) -AM_CONDITIONAL([HAVE_LIBGCRYPT], [test $ac_cv_lib_gcrypt_gcry_control = yes]) +AC_ARG_WITH([libgcrypt], + [AS_HELP_STRING([--with-libgcrypt], + [Use libgcrypt to compute MD5])], + [WITH_LIBGCRYPT=$withval], + [WITH_LIBGCRYPT=auto]) +if test "$WITH_LIBGCRYPT" != no; then + AC_CHECK_LIB([gcrypt], [gcry_control]) + if test "$WITH_LIBGCRYPT" = yes && test "$ac_cv_lib_gcrypt_gcry_control" != yes; then + AC_MSG_ERROR([libgcrypt not found]) + fi + WITH_LIBGCRYPT=$ac_cv_lib_gcrypt_gcry_control +fi + +AM_CONDITIONAL([HAVE_LIBGCRYPT], + [expr "$WITH_LIBGCRYPT" : yes > /dev/null 2>&1]) # For MinGW. AC_CHECK_LIB([ws2_32], [gethostbyname])