taler-mdb

GNU Taler Extensions and Integrations
Log | Files | Refs | Submodules | README | LICENSE

configure.ac (9383B)


      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.69])
      7 AC_INIT([taler-mdb],[1.1.0],[taler@gnu.org])
      8 AC_CONFIG_SRCDIR([src/taler-mdb.c])
      9 AC_CONFIG_HEADERS([config.h])
     10 
     11 # Checks for programs.
     12 AM_INIT_AUTOMAKE
     13 
     14 # pretty build rules
     15 AM_SILENT_RULES([yes])
     16 
     17 AC_CHECK_PROG([DPKG_ARCH], [dpkg-architecture], [yes], [no])
     18 if test "x$DPKG_ARCH" = "xyes"; then
     19   MULTIARCH=`dpkg-architecture -qDEB_HOST_MULTIARCH`
     20 else
     21   MULTIARCH=""
     22 fi
     23 
     24 AC_PROG_CC
     25 LT_INIT([disable-static])
     26 
     27 # Checks for libraries.
     28 AC_CHECK_LIB([nfc], [nfc_open])
     29 
     30 # Checks for header files.
     31 AC_CHECK_HEADERS([stdlib.h string.h unistd.h sys/un.h netinet/in.h netinet/ip.h])
     32 
     33 # Checks for typedefs, structures, and compiler characteristics.
     34 AC_CHECK_HEADER_STDBOOL
     35 AC_TYPE_SIZE_T
     36 AC_TYPE_UINT8_T
     37 
     38 
     39 # logging
     40 extra_logging=0
     41 AC_ARG_ENABLE([logging],
     42    AS_HELP_STRING([--enable-logging@<:@=value@:>@],[Enable logging calls. Possible values: yes,no,verbose ('yes' is the default)]),
     43    [AS_IF([test "x$enableval" = "xyes"], [],
     44           [test "x$enableval" = "xno"], [AC_DEFINE([GNUNET_CULL_LOGGING],[],[Define to cull all logging calls])],
     45           [test "x$enableval" = "xverbose"], [extra_logging=1]
     46           [test "x$enableval" = "xveryverbose"], [extra_logging=2])
     47    ], [])
     48 AC_DEFINE_UNQUOTED([GNUNET_EXTRA_LOGGING],[$extra_logging],[1 if extra logging is enabled, 2 for very verbose extra logging, 0 otherwise])
     49 
     50 
     51 # Adam shostack suggests the following for Windows:
     52 # -D_FORTIFY_SOURCE=2 -fstack-protector-all
     53 AC_ARG_ENABLE(gcc-hardening,
     54    AS_HELP_STRING(--enable-gcc-hardening, enable compiler security checks),
     55 [AS_IF([test x$enableval = xyes],[
     56     CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all"
     57     CFLAGS="$CFLAGS -fwrapv -fPIE -Wstack-protector"
     58     CFLAGS="$CFLAGS --param ssp-buffer-size=1"
     59     LDFLAGS="$LDFLAGS -pie"
     60  ])])
     61 
     62 # Linker hardening options
     63 # Currently these options are ELF specific - you can't use this with MacOSX
     64 AC_ARG_ENABLE(linker-hardening,
     65   AS_HELP_STRING(--enable-linker-hardening, enable linker security fixups),
     66 [AS_IF([test x$enableval = xyes],
     67    [LDFLAGS="$LDFLAGS -z relro -z now"])])
     68 
     69 
     70 AC_ARG_ENABLE(sanitizer,
     71   AS_HELP_STRING(--enable-sanitizer, enable Address Sanitizer and Undefined Behavior Sanitizer),
     72 [AS_IF([test x$enableval = xyes],[
     73    LDFLAGS="$CFLAGS -fsanitize=address,undefined -fno-omit-frame-pointer"
     74  ])])
     75 
     76 
     77 # gcov compilation
     78 AC_MSG_CHECKING(whether to compile with support for code coverage analysis)
     79 AC_ARG_ENABLE([coverage],
     80               AS_HELP_STRING([--enable-coverage],
     81                              [compile the library with code coverage support]),
     82               [use_gcov=${enableval}],
     83               [use_gcov=no])
     84 AC_MSG_RESULT($use_gcov)
     85 AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"])
     86 
     87 
     88 # Checks for library functions.
     89 AC_FUNC_MALLOC
     90 AC_FUNC_REALLOC
     91 AC_CHECK_FUNCS([strstr])
     92 
     93 
     94 
     95 # Save before checking for libraries
     96 LIBS_SAVE=$LIBS
     97 
     98 
     99 # test for libqrencode
    100 qrencode=0
    101 QR_LIBS="-lqrencode"
    102 AC_MSG_CHECKING(for libqrencode)
    103 AC_ARG_WITH(qrencode,
    104    [  --with-qrencode=PFX    Base of libqrencode installation],
    105    [AC_MSG_RESULT([$with_qrencode])
    106     AS_CASE([$with_qrencode],
    107       [no],[],
    108       [yes],[
    109         AC_CHECK_HEADERS(qrencode.h,qrencode=1)
    110       ],
    111       [
    112         CPPFLAGS="-I$with_qrencode/include $CPPFLAGS"
    113         QR_CFLAGS="-I$with_qrencode/include"
    114         QR_LIBS="-L$with_qrencode/lib/$MULTIARCH -L$with_qrencode/lib -lqrencode"
    115         AC_CHECK_HEADERS(qrencode.h,qrencode=1)
    116       ])
    117    ],
    118    [AC_MSG_RESULT([--with-qrencode not specified])
    119     AC_CHECK_HEADERS(qrencode.h,qrencode=1)])
    120 
    121 AS_IF([test "$qrencode" != 1],
    122 [
    123 AM_CONDITIONAL(HAVE_QR, false)
    124 QR_LIBS=""
    125 QR_CFLAGS=""
    126 ],
    127 [AM_CONDITIONAL(HAVE_QR, true)])
    128 
    129 
    130 
    131 AC_SUBST(QR_CFLAGS)
    132 AC_SUBST(QR_LIBS)
    133 
    134 
    135 # Check for Taler's libtalermerchant
    136 libtalermerchant=0
    137 AC_MSG_CHECKING([for libtalermerchant])
    138 AC_ARG_WITH(merchant,
    139             [AS_HELP_STRING([--with-merchant=PFX], [base of Taler MERCHANT installation])],
    140             [AC_MSG_RESULT([given as $with_merchant])],
    141             [AC_MSG_RESULT(not given)
    142              with_merchant=yes])
    143 AS_CASE([$with_merchant],
    144         [yes], [],
    145         [no], [AC_MSG_ERROR([--with-merchant is required])],
    146         [LDFLAGS="-L$with_merchant/lib/$MULTIARCH -L$with_merchant/lib $LDFLAGS"
    147          CPPFLAGS="-I$with_merchant/include $CPPFLAGS $POSTGRESQL_CPPFLAGS"])
    148 
    149 AC_CHECK_HEADERS([taler/taler_merchant_service.h],
    150  [AC_CHECK_LIB([talermerchant], [TALER_MERCHANT_poll_payment], libtalermerchant=1)],
    151    [], [#ifdef HAVE_TALER_PLATFORM_H
    152         #include <taler/platform.h>
    153        #endif])
    154 
    155 
    156 
    157 # Check for GNUnet's libgnunetutil.
    158 libgnunetutil=0
    159 AC_MSG_CHECKING([for libgnunetutil])
    160 AC_ARG_WITH(gnunet,
    161             [AS_HELP_STRING([--with-gnunet=PFX], [base of GNUnet installation])],
    162             [AC_MSG_RESULT([given as $with_gnunet])],
    163             [AC_MSG_RESULT(not given)
    164              with_gnunet=yes])
    165 AS_CASE([$with_gnunet],
    166         [yes], [],
    167         [no], [AC_MSG_ERROR([--with-gnunet is required])],
    168         [LDFLAGS="-L$with_gnunet/lib/$MULTIARCH -L$with_gnunet/lib $LDFLAGS"
    169          CPPFLAGS="-I$with_gnunet/include $CPPFLAGS"])
    170 AC_CHECK_HEADERS([gnunet/gnunet_util_lib.h],
    171  [AC_CHECK_LIB([gnunetutil], [GNUNET_SCHEDULER_run], libgnunetutil=1)])
    172 AS_IF([test $libgnunetutil != 1],
    173   [AC_MSG_ERROR([[
    174 ***
    175 *** You need libgnunetutil to build this program.
    176 *** This library is part of GNUnet, available at
    177 ***   https://gnunet.org
    178 *** ]])])
    179 
    180 
    181 
    182 # Check for GNUnet's libgnunetjson.
    183 libgnunetjson=0
    184 AC_MSG_CHECKING([for libgnunetjson])
    185 AC_ARG_WITH(gnunet,
    186             [AS_HELP_STRING([--with-gnunet=PFX], [base of GNUnet installation])],
    187             [AC_MSG_RESULT([given as $with_gnunet])],
    188             [AC_MSG_RESULT(not given)
    189              with_gnunet=yes])
    190 AS_CASE([$with_gnunet],
    191         [yes], [],
    192         [no], [AC_MSG_ERROR([--with-gnunet is required])],
    193         [LDFLAGS="-L$with_gnunet/lib/$MULTIARCH -L$with_gnunet/lib $LDFLAGS"
    194          CPPFLAGS="-I$with_gnunet/include $CPPFLAGS"])
    195 AC_CHECK_HEADERS([gnunet/gnunet_json_lib.h],
    196  [AC_CHECK_LIB([gnunetjson], [GNUNET_JSON_parse], libgnunetjson=1)])
    197 AS_IF([test $libgnunetjson != 1],
    198   [AC_MSG_ERROR([[
    199 ***
    200 *** You need libgnunetjson to build this program.
    201 *** Make sure you have libjansson installed while
    202 *** building GNUnet.
    203 *** ]])])
    204 
    205 # Check for GNUnet's libgnunetcurl.
    206 libgnunetcurl=0
    207 AC_MSG_CHECKING([for libgnunetcurl])
    208 AC_ARG_WITH(gnunet,
    209             [AS_HELP_STRING([--with-gnunet=PFX], [base of GNUnet installation])],
    210             [AC_MSG_RESULT([given as $with_gnunet])],
    211             [AC_MSG_RESULT(not given)
    212              with_gnunet=yes])
    213 AS_CASE([$with_gnunet],
    214         [yes], [],
    215         [no], [AC_MSG_ERROR([--with-gnunet is required])],
    216         [LDFLAGS="-L$with_gnunet/lib/$MULTIARCH -L$with_gnunet/lib $LDFLAGS"
    217          CPPFLAGS="-I$with_gnunet/include $CPPFLAGS"])
    218 AC_CHECK_HEADERS([gnunet/gnunet_curl_lib.h],
    219  [AC_CHECK_LIB([gnunetcurl], [GNUNET_CURL_get_select_info], libgnunetcurl=1)])
    220 AS_IF([test $libgnunetcurl != 1],
    221   [AC_MSG_ERROR([[
    222 ***
    223 *** You need libgnunetcurl to build this program.
    224 *** Make sure you have libcurl installed while
    225 *** building GNUnet.
    226 *** ]])])
    227 
    228 
    229 # Save before checking libcurl
    230 CFLAGS_SAVE=$CFLAGS
    231 LDFLAGS_SAVE=$LDFLAGS
    232 
    233 
    234 
    235 # NOTE: If we find libcurl here we set LIBCURL to -lcurl
    236 # This affects the LIBCURL_CHECK_CONFIG call below as it takes LIBCURL into
    237 # account when checking for curl.
    238 AC_CHECK_LIB([curl],
    239              [curl_easy_getinfo],
    240              [LIBCURL="-lcurl"
    241               curl_gnutls=1],
    242              [curl_gnutls=0])
    243 
    244 LIBCURL_CHECK_CONFIG([], [7.34.0], [],
    245                      [AC_MSG_ERROR([cURL must have a version >= 7.34.0])])
    246 
    247 # Even if curl is found, we check for this constant in order to determine
    248 # if we can use this feature.
    249 AC_CHECK_HEADER([curl/curl.h],
    250                 [AC_CHECK_DECLS([CURLINFO_TLS_SSL_PTR],
    251                                 [],
    252                                 [AC_MSG_ERROR([cURL must support CURLINFO_TLS_SSL_PTR])],
    253                                 [[#include <curl/curl.h>]])])
    254 
    255 # Restore after curl checks messed up these values
    256 CFLAGS=$CFLAGS_SAVE
    257 LDFLAGS=$LDFLAGS_SAVE
    258 LIBS=$LIBS_SAVE
    259 
    260 
    261 # check for libjansson (Jansson JSON library)
    262 jansson=0
    263 AC_MSG_CHECKING([for jansson])
    264 AC_ARG_WITH([jansson],
    265             [AS_HELP_STRING([--with-jansson=PFX], [base of jansson installation])],
    266             [AC_MSG_RESULT([given as $with_jansson])],
    267             [AC_MSG_RESULT([not given])
    268              with_jansson=yes])
    269 AS_CASE([$with_jansson],
    270         [yes], [],
    271         [no], [AC_MSG_ERROR([--with-jansson is required])],
    272         [LDFLAGS="-L$with_jansson/lib/$MULTIARCH -L$with_jansson/lib $LDFLAGS"
    273          CPPFLAGS="-I$with_jansson/include $CPPFLAGS"])
    274 AC_CHECK_LIB(jansson,json_dumpb,
    275   [AC_CHECK_HEADER([jansson.h],[jansson=1])])
    276 AS_IF([test $jansson = 0],
    277   [AC_MSG_ERROR([[
    278 ***
    279 *** You need libjansson >= 2.10 to build this program.
    280 *** ]])])
    281 
    282 # Restore, we link each binary individually as needed
    283 CFLAGS=$CFLAGS_SAVE
    284 LDFLAGS=$LDFLAGS_SAVE
    285 LIBS=$LIBS_SAVE
    286 
    287 
    288 AC_CONFIG_FILES([Makefile
    289                  contrib/Makefile
    290                  doc/Makefile
    291                  src/Makefile])
    292 AC_OUTPUT
    293 
    294 if test "$qrencode" != 1
    295 then
    296  AC_MSG_WARN([taler-mdb will not include QR support])
    297 fi