From a752b8cffead9b91e314892f1534b17869e178be Mon Sep 17 00:00:00 2001 From: Markus Teich Date: Tue, 12 Jul 2016 23:22:11 +0200 Subject: [PATCH] failed first attempt at linking against libgnunetutil --- configure.ac | 45 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 8fb077e..bd6e0be 100644 --- a/configure.ac +++ b/configure.ac @@ -13,6 +13,10 @@ AC_CONFIG_SRCDIR([brandt.c]) AC_PROG_CC_C99 LT_INIT([pic-only]) +# fix std +CC=$(echo "${CC}" | sed 's/-std=gnu99/-std=c99/') +CPP=$(echo "${CC}" | sed 's/-std=gnu99/-std=c99/') + # Checks for libraries. AC_SEARCH_LIBS([gcry_check_version], [gcrypt], [], [AC_MSG_ERROR([unable to find the gcry_check_version() function from libgcrypt])]) @@ -23,11 +27,42 @@ AC_CHECK_HEADER(gcrypt.h, [], [AC_MSG_ERROR([unable to find the gcrypt.h header AC_TYPE_SIZE_T AC_TYPE_UINT16_T -# Checks for library functions. - -# fix std -CC=$(echo "${CC}" | sed 's/-std=gnu99/-std=c99/') -CPP=$(echo "${CC}" | sed 's/-std=gnu99/-std=c99/') +SAVE_LIBS=$LIBS +gnunetutil=0 +AC_MSG_CHECKING(for libgnunetutil) +AC_ARG_WITH(gnunetutil, + [ --with-gnunetutil=PFX base of libgnunetutil installation], + [AC_MSG_RESULT([$with_gnunetutil]) + case $with_gnunetutil in + no) + ;; + yes) + AC_CHECK_HEADERS(gnunet/gnunet_util_lib.h, + AC_CHECK_LIB([gnunetutil], [GNUNET_CRYPTO_ecc_dlog], + gnunetutil=1)) + ;; + *) + LDFLAGS="-L$with_gnunetutil/lib $LDFLAGS" + CPPFLAGS="-I$with_gnunetutil/include $CPPFLAGS" + AC_CHECK_HEADERS(gnunet/gnunet_util_lib.h, + AC_CHECK_LIB([gnunetutil], [GNUNET_CRYPTO_ecc_dlog], + EXT_LIB_PATH="-L$with_gnunetutil/lib $EXT_LIB_PATH" + gnunetutil=1)) + ;; + esac + ], + [AC_MSG_RESULT([--with-gnunetutil not specified]) + AC_CHECK_HEADERS(gnunet/gnunet_util_lib.h, + AC_CHECK_LIB([gnunetutil], [GNUNET_CRYPTO_ecc_dlog], + gnunetutil=1))]) +if test x$gnunetutil = x1 +then + AC_MSG_RESULT([libgnunetutil found]) +else + AC_MSG_ERROR([libbrandt requires libgnunetutil]) +fi +# restore LIBS +LIBS=$SAVE_LIBS AC_CONFIG_FILES([ Makefile