diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2022-10-30 12:56:33 +0900 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2022-10-30 12:56:33 +0900 |
commit | e98464378ea71c9e2df25de5b11477475df3fed7 (patch) | |
tree | c6982cfb3420503089cec5bcd6a530e73b2f29be | |
parent | 69520b095904669e5b5de4725028bb13001ff2ad (diff) |
Example gnunet detection
-rw-r--r-- | configure.ac | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 052b856..b56e90f 100644 --- a/configure.ac +++ b/configure.ac @@ -51,6 +51,87 @@ LT_INIT([disable-static dlopen]) AS_IF([test "x$enable_shared" = "xno"], [AC_MSG_ERROR([GNUnet works only with shared libraries, sorry])]) +# test for GNUnet core +gnunet=0 +gnunet_conversation=0 +lookin=${prefix} +GNUNET_CFLAGS="" +GNUNET_CPPFLAGS="" +GNUNET_LIBS="" +AC_MSG_CHECKING(for GNUnet core) +AC_ARG_WITH(gnunet, + [ --with-gnunet=PFX Base of GNUnet installation], + [AC_MSG_RESULT([$with_gnunet]) + AS_CASE([$with_gnunet], + [no],[lookin=""], + [yes],[lookin="${prefix}"], + [lookin="$with_gnunet"]) + ], + [ + AC_MSG_RESULT([--with-gnunet not specified]) + PKG_CHECK_MODULES([GNUNET], [gnunetutil >= 0.18.0], gnunet=1) + AC_CHECK_HEADERS([gnunet/gnunet_messenger_service.h], + AC_CHECK_LIB([gnunetmessenger], [GNUNET_MESSENGER_connect], + [ + EXT_LIB_PATH="-L${lookin}/lib $EXT_LIB_PATH" + if test -d "${lookin}/lib64"; then + EXT_LIB_PATH="-L${lookin}/lib64 $EXT_LIB_PATH" + fi + ] + ),,[#include <gnunet/platform.h>] + ) + ] +) + +AS_IF([test "x$gnunet" = "x0" -a ! "x$lookin" = "x"], +[ + AC_MSG_CHECKING(for GNUnet util library in $lookin) + backup_LIBS="$LIBS" + backup_CFLAGS="$CFLAGS" + backup_CPPFLAGS="$CPPFLAGS" + GNUNET_LIBS="-L${lookin}/lib" + if test -d "${lookin}/lib64"; then + GNUNET_LIBS="-L${lookin}/lib64 $GNUNET_LIBS" + fi + GNUNET_CFLAGS="-I${lookin}/include" + GNUNET_CPPFLAGS="-I${lookin}/include" + LIBS="$GNUNET_LIBS $backup_LIBS" + CFLAGS="$GNUNET_CFLAGS $backup_CFLAGS" + CPPFLAGS="$GNUNET_CPPFLAGS $backup_CPPFLAGS" + AC_CHECK_HEADERS([gnunet/gnunet_util_lib.h], + AC_CHECK_LIB([gnunetutil], [GNUNET_xfree_], + [ + gnunet=1 + EXT_LIB_PATH="-L${lookin}/lib $EXT_LIB_PATH" + if test -d "${lookin}/lib64"; then + EXT_LIB_PATH="-L${lookin}/lib64 $EXT_LIB_PATH" + fi + + ] + ),,[#include <gnunet/platform.h>] + ) + AC_CHECK_HEADERS([gnunet/gnunet_messenger_service.h], + AC_CHECK_LIB([gnunetmessenger], [GNUNET_MESSENGER_connect], + [ + gnunet_messenger=1 + ] + ),,[#include <gnunet/platform.h>] + ) + LIBS="$backup_LIBS" + CFLAGS="$backup_CFLAGS" + CPPFLAGS="$backup_CPPFLAGS" +]) + +AS_IF([test "x$gnunet" = "x0" || test "x$gnunet_messenger" = "x0" ], + [AC_MSG_ERROR([libgnunetchat requires GNUnet])]) + + + +AC_SUBST(GNUNET_CFLAGS) +AC_SUBST(GNUNET_LIBS) +CFLAGS="$GNUNET_CFLAGS $CFLAGS" +LIBS="$GNUNET_LIBS $LIBS" + AC_ARG_ENABLE([debug], [ --enable-debug turn on debugging], [case "${enableval}" in |