From 47758f9335a08d249461f35813f65e4ca24d4e73 Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Wed, 13 Dec 2017 10:50:38 +0200 Subject: [PATCH] m4: Fix sodium checks Make sure it actually has password checking function --- m4/want_sodium.m4 | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/m4/want_sodium.m4 b/m4/want_sodium.m4 index 7a331b546c..b73f973fb0 100644 --- a/m4/want_sodium.m4 +++ b/m4/want_sodium.m4 @@ -1,12 +1,17 @@ AC_DEFUN([DOVECOT_WANT_SODIUM], [ - if test "$want_sodium" != "no"; then - if test "$PKG_CONFIG" != "" && $PKG_CONFIG --exists libsodium 2>/dev/null; then - PKG_CHECK_MODULES(LIBSODIUM, libsodium) - have_sodium=yes - AC_DEFINE(HAVE_LIBSODIUM,, [Define if you have libsodium]) - elif test "$want_sodium" = "yes"; then + AS_IF([test "$want_sodium" != "no"], [ + PKG_CHECK_MODULES(LIBSODIUM, libsodium, [ + OLD_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $LIBSODIUM_LIBS" + AC_CHECK_FUNC([crypto_pwhash_str_verify], [ + have_sodium=yes + AC_DEFINE(HAVE_LIBSODIUM, [1], [Define if you have libsodium]) + ]) + LDFLAGS="$OLD_LDFLAGS" + ], [have_sodium=no]) + AS_IF([test "$want_sodium" = "yes" && test "$have_sodium" != "yes"] , [ AC_ERROR([Can't build with libsodium: not found]) - fi - fi + ]) + ]) AM_CONDITIONAL(BUILD_LIBSODIUM, test "$have_sodium" = "yes") ]) -- 2.47.3