From 2ed99db9b1ec167327ef8fd7bfa2603b4f1ea009 Mon Sep 17 00:00:00 2001 From: Adrien Beraud Date: Sun, 18 Jun 2017 22:14:27 +0200 Subject: [PATCH] pkg-config: add argon2 dependency when not using included version --- CMakeLists.txt | 5 ++++- configure.ac | 5 ++++- opendht.pc.in | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e653a69..efdec314 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,10 @@ endif () if (NOT OPENDHT_ARGON2) find_package(PkgConfig) pkg_search_module(argon2 libargon2) - if (NOT argon2_FOUND) + if (argon2_FOUND) + message("Argon2 found " ${argon2_req}) + set(argon2_lib ", libargon2") + else () message("Argon2 not found, using included version.") set(OPENDHT_ARGON2 ON) endif() diff --git a/configure.ac b/configure.ac index e5eec72b..336dd486 100644 --- a/configure.ac +++ b/configure.ac @@ -104,7 +104,10 @@ AC_ARG_WITH([argon2], AS_HELP_STRING([--without-argon2], [Use included Argon2])) AS_IF([test "x$with_argon2" != "xno"], [PKG_CHECK_MODULES([Argon2], [libargon2], [have_argon2=yes], [have_argon2=no])], [have_argon2=no]) -AS_IF([test "x$have_argon2" = "xyes"], [], [ +AS_IF([test "x$have_argon2" = "xyes"], [ + AC_MSG_NOTICE([Using system Argon2]) + AC_SUBST(argon2_lib, [", libargon2"]) +], [ AS_IF([test "x$with_argon2" = "xyes"], [ AC_MSG_ERROR([Argon2 requested but not found]) ],[ diff --git a/opendht.pc.in b/opendht.pc.in index ee7506ab..0aae92c6 100644 --- a/opendht.pc.in +++ b/opendht.pc.in @@ -7,5 +7,5 @@ Description: C++ Distributed Hash Table library Version: @VERSION@ Libs: -L${libdir} -lopendht Libs.private: -lpthread -Requires.private: gnutls >= 3.1 +Requires.private: gnutls >= 3.1@argon2_lib@ Cflags: -I${includedir}