Try searching for libsodium with pkg-config in ./configure.

If libsodium can't be found with PKG_CHECK_MODULES, try AC_CHECK_LIB. If that
also fails, abort configure. If a user passes --with-libsodium-libs explicitly,
that overrides the pkg-config found location.
This commit is contained in:
iphydf 2016-08-17 18:05:27 +01:00
parent c603c8c9e7
commit 2fc5449870
No known key found for this signature in database
GPG Key ID: 3855DBA2D74403C9
2 changed files with 11 additions and 12 deletions

View File

@ -327,6 +327,14 @@ AC_SUBST(MATH_LDFLAGS)
# Checks for libraries.
PKG_CHECK_MODULES([LIBSODIUM], [libsodium],
[
LIBSODIUM_FOUND="yes"
],
[
LIBSODIUM_FOUND="no"
])
if test "x$WANT_NACL" = "xyes"; then
NACL_LIBS=
NACL_LDFLAGS=
@ -368,7 +376,7 @@ if test "x$WANT_NACL" = "xyes"; then
AC_SUBST(NACL_LDFLAGS)
AC_SUBST(NACL_OBJECTS)
AC_SUBST(NACL_OBJECTS_PKGCONFIG)
else
elif test "x$LIBSODIUM_FOUND" = "xno"; then
LIBSODIUM_LIBS=
LIBSODIUM_LDFLAGS=
LDFLAGS_SAVE="$LDFLAGS"
@ -428,7 +436,7 @@ if test "x$WANT_NACL" = "xyes"; then
CPPFLAGS="$CPPFLAGS_SAVE"
AC_SUBST(NACL_CFLAGS)
AC_DEFINE([VANILLA_NACL], [1], [use nacl instead of libsodium])
else
elif test "x$LIBSODIUM_FOUND" = "xno"; then
LIBSODIUM_CFLAGS=
CFLAGS_SAVE="$CFLAGS"
CPPFLAGS_SAVE="$CPPFLAGS"

View File

@ -15,13 +15,4 @@ RUN ./configure \
# We use make instead of RUN $MAKE here, because the autotools build will only
# ever run natively on the Linux container, never on a Windows cross compilation
# docker instance or an OSX machine.
make -j`nproc`
# This doesn't currently work on Travis, because the autotools build is broken.
# It does not look up libsodium by pkg-config, so without the --with flags it
# won't find it. We don't care that much about distcheck at this point, but we
# do care whether it configures/builds at all, which is exercised by the make
# call above. Tests are executed by the cmake build.
echo "*** make distcheck currently fails; see https://github.com/TokTok/toxcore/blob/master/other/travis/autotools-script#L16 ***"
make distcheck -j`nproc` \
|| echo "*** make distcheck has failed as expected; don't be alarmed ***"
make distcheck -j`nproc` -k