0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-09 05:29:00 +02:00

configure: Improve sodium related macros; fix missing SODIUM_LIBS assignment.

This commit is contained in:
Jason Volk 2019-06-13 13:51:49 -06:00
parent 9539b21789
commit 6aae730d5a

View file

@ -1064,19 +1064,18 @@ AC_SUBST(SODIUM_LIBS, [])
AC_ARG_WITH(sodium-includes, AC_ARG_WITH(sodium-includes,
AC_HELP_STRING([--with-sodium-includes=[[[DIR]]]], [Path to sodium include directory]), AC_HELP_STRING([--with-sodium-includes=[[[DIR]]]], [Path to sodium include directory]),
[ [
SODIUM_CPPFLAGS="-I$withval" SODIUM_CPPFLAGS+="-I$withval"
], []) ], [])
AC_ARG_WITH(sodium-libs, AC_ARG_WITH(sodium-libs,
AC_HELP_STRING([--with-sodium-libs=[[[DIR]]]], [Path to sodium library directory]), AC_HELP_STRING([--with-sodium-libs=[[[DIR]]]], [Path to sodium library directory]),
[ [
SODIUM_LDFLAGS="-L$withval" SODIUM_LDFLAGS+="-L$withval"
], []) ], [])
PKG_CHECK_MODULES(SODIUM, libsodium, PKG_CHECK_MODULES(SODIUM, libsodium,
[ [
have_sodium="yes" have_sodium="yes"
AC_DEFINE([HAVE_SODIUM], [1], [Have libsodium])
], [ ], [
dnl NOTE that PKG_CHECK_MODULES is preferred, but on some systems it gives dnl NOTE that PKG_CHECK_MODULES is preferred, but on some systems it gives
dnl a false negative and we end up here with an AC_CHECK_LIB fallback. dnl a false negative and we end up here with an AC_CHECK_LIB fallback.
@ -1084,15 +1083,21 @@ PKG_CHECK_MODULES(SODIUM, libsodium,
AC_CHECK_LIB([sodium], sodium_init, AC_CHECK_LIB([sodium], sodium_init,
[ [
have_sodium="yes" have_sodium="yes"
AC_DEFINE([HAVE_SODIUM], [1], [Have libsodium])
], [ ], [
have_sodium="no" have_sodium="no"
AC_MSG_ERROR([libsodium is required but not found. Try apt-get install libsodium-dev])
]) ])
]) ])
AM_CONDITIONAL([SODIUM], [test "x$have_sodium" = "xyes"]) AM_CONDITIONAL([SODIUM], [test "x$have_sodium" = "xyes"])
AM_COND_IF([SODIUM],
[
AC_DEFINE([HAVE_SODIUM], [1], [Have libsodium])
SODIUM_LIBS+="-lsodium"
], [
AC_MSG_ERROR([libsodium is required but not found. Try apt-get install libsodium-dev])
])
dnl dnl
dnl dnl
dnl OpenSSL support dnl OpenSSL support