From b69e3bf14b5ed73962daa9dfc3f0103b63038177 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 13 Apr 2015 12:57:05 +0200 Subject: make build succeed even without libgnurl or libpq --- configure.ac | 57 ++++++++++++++++++++++++++++++++++++++------------ src/Makefile.am | 8 ++++++- src/mintdb/Makefile.am | 2 ++ 3 files changed, 53 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index 9e1fd9905..2a595a638 100644 --- a/configure.ac +++ b/configure.ac @@ -94,14 +94,12 @@ AS_IF([test $microhttpd = 0], *** ]])]) -# check for libpq (postgresql) +# test for postgres AX_LIB_POSTGRESQL([9.3]) -AS_IF([test ! "$found_postgresql" = "yes"], - [AC_MSG_ERROR([[ -*** -*** You need postgresql / libpq to build this program. -*** ]])]) - +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 @@ -125,7 +123,8 @@ AS_IF([test $jansson = 0], *** ]])]) # check for libgnurl -LIBGNURL_CHECK_CONFIG([], [7.34.0], [gnurl=1], [gnurl=0]) +# libgnurl +LIBGNURL_CHECK_CONFIG(,7.34.0,gnurl=1,gnurl=0) if test "$gnurl" = 1 then AM_CONDITIONAL(HAVE_LIBGNURL, true) @@ -133,11 +132,43 @@ then else AM_CONDITIONAL(HAVE_LIBGNURL, false) fi -AS_IF([test $gnurl = 0], - [AC_MSG_ERROR([[ -*** -*** You need libgnurl to build this program. -*** ]])]) + +# libcurl-gnutls +LIBCURL_CHECK_CONFIG(,7.34.0,[curl=true],[curl=false]) +if test "x$curl" = xtrue +then + AC_CHECK_HEADERS([curl/curl.h], + AC_CHECK_DECLS(CURLINFO_TLS_SESSION,[curl=true],[curl=false],[[#include ]]), + [curl=false]) + # need libcurl-gnutls.so, everything else is not acceptable + AC_CHECK_LIB([curl-gnutls],[curl_easy_getinfo],,[curl=false]) + # cURL must support CURLINFO_TLS_SESSION, version >= 7.34 + +fi +if test x$curl = xfalse +then + AM_CONDITIONAL(HAVE_LIBCURL, false) +if test "$gnurl" = 0 +then + AC_MSG_WARN([GNUnet requires libcurl-gnutls >= 7.34]) +fi +else + AM_CONDITIONAL(HAVE_LIBCURL, true) + AC_DEFINE([HAVE_LIBCURL],[1],[Have CURL]) +fi + +# libgnurl +if test "x$gnurl" = "x0" +then + if test "x$curl" = "x0" + then + AC_MSG_NOTICE([NOTICE: libgnurl not found. http client support will not be compiled.]) + AC_MSG_WARN([ERROR: libgnurl not found. hostlist daemon will not be compiled, and you probably WANT the hostlist daemon]) + else + AC_MSG_NOTICE([WARNING: libgnurl not found, trying to use libcurl-gnutls instead.]) + fi +fi + # Require minimum libgcrypt version need_libgcrypt_version=1.6.1 diff --git a/src/Makefile.am b/src/Makefile.am index a2d3ebcd9..e3a17f723 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,3 +1,9 @@ # This Makefile.am is in the public domain AM_CPPFLAGS = -I$(top_srcdir)/src/include -SUBDIRS = include util pq mintdb mint mint-tools mint-lib +if HAVE_POSTGRESQL + PQ_DIR = pq +endif +SUBDIRS = include util $(PQ_DIR) mintdb mint mint-tools +if HAVE_LIBCURL + SUBDIRS += mint-lib +endif diff --git a/src/mintdb/Makefile.am b/src/mintdb/Makefile.am index acd863468..be62d96fe 100644 --- a/src/mintdb/Makefile.am +++ b/src/mintdb/Makefile.am @@ -3,8 +3,10 @@ AM_CPPFLAGS = -I$(top_srcdir)/src/include -I$(top_srcdir)/src/pq/ $(POSTGRESQL_C plugindir = $(libdir)/taler +if HAVE_POSTGRESQL plugin_LTLIBRARIES = \ libtaler_plugin_mintdb_postgres.la +endif EXTRA_DIST = \ plugin_mintdb_common.c \ -- cgit v1.2.3