summaryrefslogtreecommitdiffstats
path: root/m4/want_sodium.m4
blob: f82edeb55d18f06972ca9e6dbb91e0a30e4474db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
AC_DEFUN([DOVECOT_WANT_SODIUM], [
  AS_IF([test "$want_sodium" != "no"], [
    PKG_CHECK_MODULES(LIBSODIUM, libsodium, [
      OLD_LIBS="$LIBS"
      LIBS="$LIBS $LIBSODIUM_LIBS"
      AC_CHECK_FUNC([crypto_pwhash_str_verify], [
        have_sodium=yes
        AUTH_LIBS="$AUTH_LIBS $LIBSODIUM_LIBS"
        AC_DEFINE(HAVE_LIBSODIUM, [1], [Define if you have libsodium])
      ])
      LIBS="$OLD_LIBS"
    ], [have_sodium=no])
    AS_IF([test "$want_sodium" = "yes" && test "$have_sodium" != "yes"] , [
      AC_ERROR([Can't build with libsodium: not found])
    ])
  ])
  AM_CONDITIONAL(BUILD_LIBSODIUM, test "$have_sodium" = "yes")
])