]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
m4: Fix sodium checks
authorAki Tuomi <aki.tuomi@dovecot.fi>
Wed, 13 Dec 2017 08:50:38 +0000 (10:50 +0200)
committerAki Tuomi <aki.tuomi@dovecot.fi>
Wed, 13 Dec 2017 08:50:51 +0000 (10:50 +0200)
Make sure it actually has password checking function

m4/want_sodium.m4

index 7a331b546c0a7e768ae0c4a5d849c0cee9dbcf2c..b73f973fb0e4213a30c76375849a944a0d4fb076 100644 (file)
@@ -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")
 ])