From: Aki Tuomi Date: Wed, 13 Dec 2017 08:50:38 +0000 (+0200) Subject: m4: Fix sodium checks X-Git-Tag: 2.3.0.rc1~122 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=47758f9335a08d249461f35813f65e4ca24d4e73;p=thirdparty%2Fdovecot%2Fcore.git m4: Fix sodium checks Make sure it actually has password checking function --- 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") ])