anastasis

Credential backup and recovery protocol and service
Log | Files | Refs | Submodules | README | LICENSE

configure.ac (11783B)


      1 #                                               -*- Autoconf -*-
      2 # Process this file with autoconf to produce a configure script.
      3 #
      4 # This configure file is in the public domain
      5 
      6 AC_PREREQ([2.71])
      7 AC_INIT([anastasis],[0.7.0],[taler-bug@gnu.org])
      8 AC_CONFIG_SRCDIR([src/backend/anastasis-httpd.c])
      9 AC_CONFIG_HEADERS([anastasis_config.h])
     10 # support for non-recursive builds
     11 AM_INIT_AUTOMAKE([subdir-objects 1.9 tar-pax])
     12 
     13 # pretty build rules
     14 AM_SILENT_RULES([yes])
     15 
     16 AC_CONFIG_MACRO_DIR([m4])
     17 
     18 AC_PROG_AWK
     19 AC_PROG_CC
     20 AC_PROG_OBJC
     21 AC_PROG_INSTALL
     22 AC_PROG_LN_S
     23 AC_PROG_MAKE_SET
     24 AM_PROG_CC_C_O
     25 
     26 LT_INIT([disable-static dlopen])
     27 
     28 DX_INIT_DOXYGEN([anastasis],,,
     29 DX_PS_FEATURE(OFF),
     30 DX_PDF_FEATURE(OFF),
     31 DX_RTF_FEATURE(OFF),
     32 DX_CHI_FEATURE(OFF),
     33 DX_XML_FEATURE(OFF))
     34 
     35 
     36 AC_CHECK_PROG([DPKG_ARCH], [dpkg-architecture], [yes], [no])
     37 if test "x$DPKG_ARCH" = "xyes"; then
     38   MULTIARCH=`dpkg-architecture -qDEB_HOST_MULTIARCH`
     39 else
     40   MULTIARCH=""
     41 fi
     42 
     43 AC_MSG_CHECKING([whether to compile documentation ONLY])
     44 AC_ARG_ENABLE([only-doc],
     45   [AS_HELP_STRING([--enable-only-doc], [only compile Taler documentation])],
     46   [doc_only=${enableval}],
     47   [doc_only=no])
     48 AC_MSG_RESULT($doc_only)
     49 AM_CONDITIONAL([DOC_ONLY], [test "$doc_only" = "yes"])
     50 
     51 
     52 # Not indented as it covers most of the file...
     53 AS_IF([test "x$doc_only" != xyes],[
     54 
     55 
     56 # Checks for programs.
     57 AC_PROG_CC
     58 
     59 # check for gettext
     60 AM_GNU_GETTEXT([external])
     61 AM_GNU_GETTEXT_VERSION([0.19.8])
     62 
     63 
     64 CFLAGS="-Wall $CFLAGS"
     65 
     66 # Checks for header files.
     67 AC_CHECK_HEADERS([stdint.h stdlib.h string.h unistd.h])
     68 
     69 ANASTASIS_LIB_LDFLAGS="-export-dynamic -no-undefined"
     70 ANASTASIS_PLUGIN_LDFLAGS="-export-dynamic -avoid-version -module -no-undefined"
     71 
     72 AC_SUBST(ANASTASIS_LIB_LDFLAGS)
     73 AC_SUBST(ANASTASIS_PLUGIN_LDFLAGS)
     74 
     75 
     76 # Save before checks clobber them
     77 CFLAGS_SAVE=$CFLAGS
     78 LDFLAGS_SAVE=$LDFLAGS
     79 LIBS_SAVE=$LIBS
     80 
     81 
     82 # Check for GNUnet's libgnunetutil.
     83 libgnunetutil=0
     84 AC_MSG_CHECKING([for libgnunetutil])
     85 AC_ARG_WITH(gnunet,
     86             [AS_HELP_STRING([--with-gnunet=PFX], [base of GNUnet installation])],
     87             [AC_MSG_RESULT([given as $with_gnunet])],
     88             [AC_MSG_RESULT(not given)
     89              with_gnunet=yes])
     90 AS_CASE([$with_gnunet],
     91         [yes], [],
     92         [no], [AC_MSG_ERROR([--with-gnunet is required])],
     93         [LDFLAGS="-L$with_gnunet/lib/$MULTIARCH -L$with_gnunet/lib/ $LDFLAGS"
     94          CPPFLAGS="-I$with_gnunet/include $CPPFLAGS"])
     95 AC_CHECK_HEADERS([gnunet/gnunet_util_lib.h],
     96  [AC_CHECK_LIB([gnunetutil],
     97                [GNUNET_SCHEDULER_run],
     98                [libgnunetutil=1])])
     99 AS_IF([test $libgnunetutil != 1],
    100   [AC_MSG_ERROR([[
    101 ***
    102 *** You need libgnunetutil >= 0.20.0 to build this program.
    103 *** This library is part of GNUnet, available at
    104 ***   https://gnunet.org
    105 *** ]])])
    106 
    107 
    108 AC_CHECK_HEADERS([taler/taler_mhd_lib.h],
    109  [AC_CHECK_LIB([talermhd], [TALER_MHD_listen_bind], libtalermhd=1)])
    110 AM_CONDITIONAL(HAVE_TALERMHD, test x$libtalermhd = x1)
    111 AS_IF([test $libtalermhd != 1],
    112   [AC_MSG_ERROR([[
    113 ***
    114 *** You need libtalermhd >= 1.1.0 (API v6) to build this program.
    115 *** This library is part of the GNU Taler exchange, available at
    116 ***   https://taler.net
    117 *** ]])])
    118 
    119 # check for libcurl
    120 LIBCURL_CHECK_CONFIG(,7.34.0,[curl=1],[curl=0])
    121 
    122 # cURL must support CURLINFO_TLS_SESSION, version >= 7.34
    123 AS_IF([test "x$curl" = x1],[
    124  AC_CHECK_HEADER([curl/curl.h],
    125   [AC_CHECK_DECLS(CURLINFO_TLS_SESSION,[curl=1],[curl=0],[[#include <curl/curl.h>]])],
    126   [curl=0])
    127 ])
    128 
    129 # libcurl should be mutually exclusive
    130 AS_IF([test "$curl" = 1],
    131       AM_CONDITIONAL(HAVE_LIBCURL, true)
    132       AC_DEFINE([HAVE_LIBCURL],[1],[Have libcurl])
    133       [LIBCURL_LIBS="-lcurl"],
    134       [AC_MSG_ERROR([FATAL: No libcurl])])
    135 
    136 AC_SUBST([LIBCURL_LIBS])
    137 
    138 # Check for GNUnet's libgnunetcurl.
    139 libgnunetcurl=0
    140 AC_MSG_CHECKING([for libgnunetcurl])
    141 AC_ARG_WITH(gnunet,
    142             [AS_HELP_STRING([--with-gnunet=PFX], [base of GNUnet installation])],
    143             [AC_MSG_RESULT([given as $with_gnunet])],
    144             [AC_MSG_RESULT(not given)
    145              with_gnunet=yes])
    146 AS_CASE([$with_gnunet],
    147         [yes], [],
    148         [no], [AC_MSG_ERROR([--with-gnunet is required])],
    149         [LDFLAGS="-L$with_gnunet/lib/$MULTIARCH -L$with_gnunet/lib/ $LDFLAGS"
    150          CPPFLAGS="-I$with_gnunet/include $CPPFLAGS"])
    151 AC_CHECK_HEADERS([gnunet/gnunet_curl_lib.h],
    152  [AC_CHECK_LIB([gnunetcurl], [GNUNET_CURL_get_select_info], libgnunetcurl=1)])
    153 AS_IF([test $libgnunetcurl != 1],
    154   [AC_MSG_ERROR([[
    155 ***
    156 *** You need libgnunetcurl to build this program.
    157 *** Make sure you have libcurl installed while
    158 *** building GNUnet.
    159 *** ]])])
    160 
    161 
    162 # Restore after curl checks messed up these values
    163 CFLAGS=$CFLAGS_SAVE
    164 LDFLAGS=$LDFLAGS_SAVE
    165 LIBS=$LIBS_SAVE
    166 
    167 
    168 # gcov compilation
    169 AC_MSG_CHECKING(whether to compile with support for code coverage analysis)
    170 AC_ARG_ENABLE([coverage],
    171               AS_HELP_STRING([--enable-coverage],
    172                              [compile the library with code coverage support]),
    173               [use_gcov=${enableval}],
    174               [use_gcov=no])
    175 AC_MSG_RESULT($use_gcov)
    176 AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"])
    177 
    178 
    179 # test for postgres
    180 AX_LIB_POSTGRESQL([15])
    181 AS_IF([test "x$found_postgresql" = "xyes"],[postgres=true])
    182 AM_CONDITIONAL(HAVE_POSTGRESQL, test x$postgres = xtrue)
    183 
    184 libsodium=0
    185 # test for libsodium >=1.018 (introduction of
    186 # crypto_scalarmult_ed25519_base_noclamp API)
    187 AC_CHECK_HEADER([sodium.h],
    188                 [AC_CHECK_LIB([sodium], [crypto_core_ed25519_scalar_mul],
    189                               [libsodium=1])])
    190 
    191 AS_IF([test x$libsodium = x0],
    192       [AC_MSG_ERROR([Anastasis requires libsodium >= 1.0.18.])])
    193 
    194 
    195 # Check for Taler's libtalerutil
    196 libtalerutil=0
    197 AC_MSG_CHECKING([for libtalerutil])
    198 AC_ARG_WITH(exchange,
    199             [AS_HELP_STRING([--with-exchange=PFX], [base of Taler EXCHANGE installation])],
    200             [AC_MSG_RESULT([given as $with_exchange])],
    201             [AC_MSG_RESULT(not given)
    202              with_exchange=yes])
    203 AS_CASE([$with_exchange],
    204         [yes], [],
    205         [no], [AC_MSG_ERROR([--with-exchange is required])],
    206         [LDFLAGS="-L$with_exchange/lib/$MULTIARCH -L$with_exchange/lib/ $LDFLAGS"
    207          CPPFLAGS="-I$with_exchange/include $CPPFLAGS $POSTGRESQL_CPPFLAGS"])
    208 
    209 AC_CHECK_HEADERS([taler/taler_util.h],
    210  [AC_CHECK_LIB([talerutil],
    211                [TALER_pattern_matches],
    212                [with_exchange=yes],
    213                [AC_MSG_ERROR([libtalerutil too old])])],
    214  [AC_MSG_ERROR([taler/taler_util.h found])],
    215  [#include <taler/platform.h>])
    216 
    217 
    218 CPPFLAGS="$CPPFLAGS $POSTGRESQL_CPPFLAGS"
    219 
    220 # Require minimum libgcrypt version
    221 need_libgcrypt_version=1.6.1
    222 AC_DEFINE_UNQUOTED([NEED_LIBGCRYPT_VERSION], ["$need_libgcrypt_version"],
    223                                              [minimum version of libgcrypt required])
    224 AM_PATH_LIBGCRYPT([$need_libgcrypt_version])
    225 
    226 AC_CHECK_HEADERS([taler/taler_util.h],
    227  [AC_CHECK_LIB([talerutil],
    228                [TALER_b2s],
    229                [libtalerutil=1],
    230                [AC_MSG_ERROR([libtalerutil not found])])],
    231  [AC_MSG_ERROR([taler/taler_util.h not found])],
    232  [#include <taler/platform.h>])
    233 
    234 # Check for Taler's libtalermerchant
    235 libtalermerchant=0
    236 AC_MSG_CHECKING([for libtalermerchant])
    237 AC_ARG_WITH(merchant,
    238             [AS_HELP_STRING([--with-merchant=PFX], [base of Taler MERCHANT installation])],
    239             [AC_MSG_RESULT([given as $with_merchant])],
    240             [AC_MSG_RESULT(not given)
    241              with_merchant=yes])
    242 AS_CASE([$with_merchant],
    243         [yes], [],
    244         [no], [AC_MSG_ERROR([--with-merchant is required])],
    245         [LDFLAGS="-L$with_merchant/lib/$MULTIARCH -L$with_merchant/lib/ $LDFLAGS"
    246          CPPFLAGS="-I$with_merchant/include $CPPFLAGS $POSTGRESQL_CPPFLAGS"])
    247 
    248 AC_CHECK_HEADERS([taler/taler_merchant_service.h],
    249  [AC_CHECK_LIB([talermerchant],
    250                [TALER_MERCHANT_parse_pay_uri],
    251                [libtalermerchant=1],
    252                [AC_MSG_ERROR([libtalermerchant not found])])],
    253  [AC_MSG_ERROR([taler/taler_merchant_service.h found])],
    254  [#include <taler/platform.h>])
    255 
    256 
    257 
    258 
    259 # check for libmicrohttpd
    260 microhttpd=0
    261 AC_MSG_CHECKING([for microhttpd])
    262 AC_ARG_WITH([microhttpd],
    263             [AS_HELP_STRING([--with-microhttpd=PFX], [base of microhttpd installation])],
    264             [AC_MSG_RESULT([given as $with_microhttpd])],
    265             [AC_MSG_RESULT([not given])
    266              with_microhttpd=yes])
    267 AS_CASE([$with_microhttpd],
    268         [yes], [],
    269         [no], [AC_MSG_ERROR([--with-microhttpd is required])],
    270         [LDFLAGS="-L$with_microhttpd/lib/$MULTIARCH -L$with_microhttpd/lib/ $LDFLAGS"
    271          CPPFLAGS="-I$with_microhttpd/include $CPPFLAGS"])
    272 AC_CHECK_LIB(microhttpd,MHD_start_daemon,
    273   [AC_CHECK_HEADER([microhttpd.h],[microhttpd=1])])
    274 AS_IF([test $microhttpd = 0],
    275   [AC_MSG_ERROR([[
    276 ***
    277 *** You need libmicrohttpd to build this program.
    278 *** ]])])
    279 
    280 jansson=0
    281 PKG_CHECK_MODULES([JANSSON], [jansson >= 2.3],
    282                   [LDFLAGS="$JANSSON_LIBS $LDFLAGS"
    283                    CPPFLAGS="$JANSSON_CFLAGS $CPPFLAGS"],
    284                   [AC_MSG_ERROR([[
    285 ***
    286 *** You need libjansson to build this program.
    287 ***]])])
    288 
    289 # logging
    290 extra_logging=0
    291 AC_ARG_ENABLE([logging],
    292    AS_HELP_STRING([--enable-logging@<:@=value@:>@],[Enable logging calls. Possible values: yes,no,verbose ('yes' is the default)]),
    293    [AS_IF([test "x$enableval" = "xyes"], [],
    294           [test "x$enableval" = "xno"], [AC_DEFINE([GNUNET_CULL_LOGGING],[],[Define to cull all logging calls])],
    295           [test "x$enableval" = "xverbose"], [extra_logging=1]
    296           [test "x$enableval" = "xveryverbose"], [extra_logging=2])
    297    ], [])
    298 AC_DEFINE_UNQUOTED([GNUNET_EXTRA_LOGGING],[$extra_logging],[1 if extra logging is enabled, 2 for very verbose extra logging, 0 otherwise])
    299 
    300 # version info
    301 AC_PATH_PROG(gitcommand, git)
    302 AC_MSG_CHECKING(for source being under a VCS)
    303 git_version=
    304 AS_IF([test ! "X$gitcommand" = "X"],
    305 [
    306   git_version=$(cd $srcdir ; git rev-list --full-history --all --abbrev-commit | head -n 1 2>/dev/null)
    307 ])
    308 AS_IF([test "X$git_version" = "X"],
    309   [
    310     vcs_name="no"
    311     vcs_version="\"release\""
    312   ],
    313   [
    314     vcs_name="yes, git-svn"
    315     vcs_version="\"git-$git_version\""
    316   ])
    317 AC_MSG_RESULT($vcs_name)
    318 
    319 AC_MSG_CHECKING(VCS version)
    320 AC_MSG_RESULT($vcs_version)
    321 AC_DEFINE_UNQUOTED(VCS_VERSION, [$vcs_version], [VCS revision/hash or tarball version])
    322 
    323 # Checks for typedefs, structures, and compiler characteristics.
    324 AC_TYPE_PID_T
    325 AC_TYPE_SIZE_T
    326 AC_TYPE_UINT16_T
    327 AC_TYPE_UINT32_T
    328 AC_TYPE_UINT64_T
    329 AC_TYPE_INTMAX_T
    330 AC_TYPE_UINTMAX_T
    331 
    332 # Checks for library functions.
    333 AC_CHECK_FUNCS([strdup])
    334 
    335 
    336 AC_ARG_ENABLE([[doc]],
    337   [AS_HELP_STRING([[--disable-doc]], [do not build any documentation])], ,
    338     [enable_doc=yes])
    339 test "x$enable_doc" = "xno" || enable_doc=yes
    340 AM_CONDITIONAL([ENABLE_DOC], [test "x$enable_doc" = "xyes"])
    341 
    342 
    343 ],[  # this is about the doc-only if on top of the file
    344 
    345 # logic if doc_only is set, make sure conditionals are still defined
    346 AM_CONDITIONAL([HAVE_POSTGRESQL], [false])
    347 AM_CONDITIONAL([HAVE_LIBCURL], [false])
    348 AM_CONDITIONAL([USE_COVERAGE], [false])
    349 AM_CONDITIONAL([ENABLE_DOC], [true])
    350 
    351 
    352 # end of 'doc_only'
    353 ])
    354 
    355 
    356 # should experimental code be compiled (code that may not yet compile / have passing test cases)?
    357 AC_MSG_CHECKING(whether to compile experimental code)
    358 AC_ARG_ENABLE([experimental],
    359    [AS_HELP_STRING([--enable-experimental], [enable compiling experimental code])],
    360    [enable_experimental=${enableval}],
    361    [enable_experimental=no])
    362 AC_MSG_RESULT($enable_experimental)
    363 AM_CONDITIONAL([HAVE_EXPERIMENTAL], [test "x$enable_experimental" = "xyes"])
    364 
    365 
    366 AC_CONFIG_FILES([
    367 Makefile
    368 contrib/Makefile
    369 doc/Makefile
    370 po/Makefile.in
    371 src/Makefile
    372 src/authorization/Makefile
    373 src/authorization/libanastasiseufin/Makefile
    374 src/backend/Makefile
    375 src/cli/Makefile
    376 src/include/Makefile
    377 src/lib/Makefile
    378 src/util/Makefile
    379 src/reducer/Makefile
    380 src/restclient/Makefile
    381 src/stasis/Makefile
    382 src/testing/Makefile
    383 ])
    384 AC_OUTPUT