From de953fa7bcdcfa78606753285911a6a49120327f Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 28 May 2015 11:34:06 +0200 Subject: [PATCH] add --enable-wallet-only flag to build libtalerutil_wallet which ONLY contains the wallet-specific API subset --- configure.ac | 77 +++++++++++++++++++++++++++++++++-------- src/Makefile.am | 8 ++++- src/include/Makefile.am | 11 ++++++ src/util/Makefile.am | 19 ++++++++++ 4 files changed, 99 insertions(+), 16 deletions(-) diff --git a/configure.ac b/configure.ac index f2ebc3f6e..0a5959bc6 100644 --- a/configure.ac +++ b/configure.ac @@ -38,6 +38,21 @@ CFLAGS="-Wall $CFLAGS" # Checks for header files. AC_CHECK_HEADERS([stdint.h stdlib.h string.h unistd.h]) + +# should the build process be restricted to the code required +# for GNU Taler wallets? +AC_MSG_CHECKING(whether to compile GNU Taler Wallet library ONLY) +AC_ARG_ENABLE([wallet], + [AS_HELP_STRING([--wallet], [only compile for Taler wallet])], + [wallet_only=${enableval}], + [wallet_only=no]) +AC_MSG_RESULT($wallet_only) +AM_CONDITIONAL([WALLET_ONLY], [test "x$wallet_only" = "xyes"]) + +if test "$wallet_only" != yes +then + + # Check for GNUnet's libgnunetutil. libgnunetutil=0 AC_MSG_CHECKING([for libgnunetutil]) @@ -64,14 +79,6 @@ AS_IF([test $libgnunetutil != 1], *** https://gnunet.org *** ]])]) - -TALER_LIB_LDFLAGS="-export-dynamic -no-undefined" -TALER_PLUGIN_LDFLAGS="-export-dynamic -avoid-version -module -no-undefined" - -AC_SUBST(TALER_LIB_LDFLAGS) -AC_SUBST(TALER_PLUGIN_LDFLAGS) - - # check for libmicrohttpd microhttpd=0 AC_MSG_CHECKING([for microhttpd]) @@ -94,13 +101,6 @@ AS_IF([test $microhttpd = 0], *** ]])]) -# test for postgres -AX_LIB_POSTGRESQL([9.3]) -if test "$found_postgresql" = "yes"; then - postgres=true -fi -AM_CONDITIONAL(HAVE_POSTGRESQL, test x$postgres = xtrue) - # check for libjansson (Jansson JSON library) jansson=0 AC_MSG_CHECKING([for jansson]) @@ -122,6 +122,53 @@ AS_IF([test $jansson = 0], *** You need libjansson to build this program. *** ]])]) + + +else + +# Check for GNUnet's libgnunetutil_taler_wallet. +libgnunetutil_taler_wallet=0 +AC_MSG_CHECKING([for libgnunetutil_taler_wallet]) +AC_ARG_WITH(gnunet, + [AS_HELP_STRING([--with-gnunet=PFX], [base of GNUnet installation])], + [AC_MSG_RESULT([given as $with_gnunet])], + [AC_MSG_RESULT(not given) + with_gnunet=yes]) +AS_CASE([$with_gnunet], + [yes], [], + [no], [AC_MSG_ERROR([--with-gnunet is required])], + [LDFLAGS="-L$with_gnunet/lib $LDFLAGS" + CPPFLAGS="-I$with_gnunet/include $CPPFLAGS"]) +AC_CHECK_HEADERS([gnunet/platform.h gnunet/gnunet_util_taler_wallet_lib.h], + [AC_CHECK_LIB([gnunetutil_taler_wallet], [GNUNET_CRYPTO_hash], libgnunetutil_taler_wallet=1)], + [], [#ifdef HAVE_GNUNET_PLATFORM_H + #include + #endif]) +AS_IF([test $libgnunetutil_taler_wallet != 1], + [AC_MSG_ERROR([[ +*** +*** You need libgnunetutil_taler_wallet to build this program. +*** This library is part of GNUnet, available at +*** https://gnunet.org/ +*** Run GNUnet's configure with --enable-taler-wallet as well! +*** ]])]) + +fi + +TALER_LIB_LDFLAGS="-export-dynamic -no-undefined" +TALER_PLUGIN_LDFLAGS="-export-dynamic -avoid-version -module -no-undefined" + +AC_SUBST(TALER_LIB_LDFLAGS) +AC_SUBST(TALER_PLUGIN_LDFLAGS) + + +# test for postgres +AX_LIB_POSTGRESQL([9.3]) +if test "$found_postgresql" = "yes"; then + postgres=true +fi +AM_CONDITIONAL(HAVE_POSTGRESQL, test x$postgres = xtrue) + # check for libgnurl # libgnurl LIBGNURL_CHECK_CONFIG(,7.34.0,gnurl=1,gnurl=0) diff --git a/src/Makefile.am b/src/Makefile.am index e3a17f723..888cbabf1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,7 +3,13 @@ AM_CPPFLAGS = -I$(top_srcdir)/src/include if HAVE_POSTGRESQL PQ_DIR = pq endif -SUBDIRS = include util $(PQ_DIR) mintdb mint mint-tools +if WALLET_ONLY +SUBDIRS = include util +else + +SUBDIRS = include util $(PQ_DIR) mintdb mint mint-tools if HAVE_LIBCURL SUBDIRS += mint-lib endif + +endif diff --git a/src/include/Makefile.am b/src/include/Makefile.am index 5bb4cfa20..9c3ee9071 100644 --- a/src/include/Makefile.am +++ b/src/include/Makefile.am @@ -1,6 +1,15 @@ # This Makefile.am is in the public domain talerincludedir = $(includedir)/taler +if WALLET_ONLY +talerinclude_HEADERS = \ + platform.h \ + taler_amount_lib.h \ + taler_crypto_lib.h \ + taler_util_wallet.h + +else + talerinclude_HEADERS = \ platform.h \ taler_amount_lib.h \ @@ -12,3 +21,5 @@ talerinclude_HEADERS = \ taler_mintdb_plugin.h \ taler_pq_lib.h \ taler_signatures.h + +endif diff --git a/src/util/Makefile.am b/src/util/Makefile.am index 804ff85a2..0c44570ed 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am @@ -6,8 +6,27 @@ if USE_COVERAGE XLIB = -lgcov endif +if WALLET_ONLY +lib_LTLIBRARIES = \ + libtalerutil_wallet.la +else lib_LTLIBRARIES = \ libtalerutil.la +endif + +libtalerutil_wallet_la_SOURCES = \ + amount.c \ + crypto.c \ + util.c + +libtalerutil_wallet_la_LIBADD = \ + -lgnunetutil_taler_wallet \ + $(LIBGCRYPT_LIBS) \ + $(XLIB) + +libtalerutil_wallet_la_LDFLAGS = \ + -version-info 0:0:0 \ + -export-dynamic -no-undefined libtalerutil_la_SOURCES = \ amount.c \