diff options
author | Luke Dashjr <luke-jr+git@utopios.org> | 2016-01-14 00:26:23 +0000 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2016-01-15 04:34:06 +0000 |
commit | ab22705a7b7796362ad7c6ec8f7465d3a450977f (patch) | |
tree | 75e45c178182f2ef7f7d8ad2b85c2497f666b6a0 /configure.ac | |
parent | 2adf7e2c90b22d89308f36355f8a6de395e24c36 (diff) |
Build against system UniValue when available
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 63a745393e..9819c2493c 100644 --- a/configure.ac +++ b/configure.ac @@ -148,6 +148,12 @@ AC_ARG_ENABLE([glibc-back-compat], [use_glibc_compat=$enableval], [use_glibc_compat=no]) +AC_ARG_WITH([system-univalue], + [AS_HELP_STRING([--without-system-univalue], + [Build with system UniValue (default is auto)])], + [system_univalue=$withval], + [system_univalue=auto] +) AC_ARG_ENABLE([zmq], [AS_HELP_STRING([--disable-zmq], [disable ZMQ notifications])], @@ -742,6 +748,44 @@ else fi fi +dnl univalue check + +if test x$system_univalue != xno ; then + found_univalue=no + if test x$use_pkgconfig = xyes; then + : #NOP + m4_ifdef( + [PKG_CHECK_MODULES], + [ + PKG_CHECK_MODULES([UNIVALUE],[libunivalue],[found_univalue=yes],[true]) + ] + ) + else + AC_CHECK_HEADER([univalue.h],[ + AC_CHECK_LIB([univalue], [main],[ + UNIVALUE_LIBS=-lunivalue + found_univalue=yes + ],[true]) + ],[true]) + fi + + if test x$found_univalue = xyes ; then + system_univalue=yes + elif test x$system_univalue = xyes ; then + AC_MSG_ERROR([univalue not found]) + else + system_univalue=no + fi +fi + +if test x$system_univalue = xno ; then + UNIVALUE_CFLAGS='-I$(srcdir)/univalue/include' + UNIVALUE_LIBS='univalue/libunivalue.la' +fi +AM_CONDITIONAL([EMBEDDED_UNIVALUE],[test x$system_univalue = xno]) +AC_SUBST(UNIVALUE_CFLAGS) +AC_SUBST(UNIVALUE_LIBS) + CXXFLAGS_TEMP="$CXXFLAGS" LIBS_TEMP="$LIBS" CXXFLAGS="$CXXFLAGS $SSL_CFLAGS $CRYPTO_CFLAGS" @@ -958,8 +1002,12 @@ PKGCONFIG_LIBDIR_TEMP="$PKG_CONFIG_LIBDIR" unset PKG_CONFIG_LIBDIR PKG_CONFIG_LIBDIR="$PKGCONFIG_LIBDIR_TEMP" +if test x$system_univalue = xno; then + AC_CONFIG_SUBDIRS([src/univalue]) +fi + ac_configure_args="${ac_configure_args} --disable-shared --with-pic --with-bignum=no --enable-module-recovery" -AC_CONFIG_SUBDIRS([src/secp256k1 src/univalue]) +AC_CONFIG_SUBDIRS([src/secp256k1]) AC_OUTPUT |