paivana

HTTP paywall reverse proxy
Log | Files | Refs | README | LICENSE

configure.ac (11961B)


      1 #                                               -*- Autoconf -*-
      2 # Process this file with autoconf to produce a configure script.
      3 #
      4 #  This file is part of TALER
      5 #  Copyright (C) 2025 Taler Systems SA
      6 #
      7 #  TALER is free software; you can redistribute it and/or modify it under the
      8 #  terms of the GNU General Public License as published by the Free Software
      9 #  Foundation; either version 3, or (at your option) any later version.
     10 #
     11 #  TALER is distributed in the hope that it will be useful, but WITHOUT ANY
     12 #  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     13 #  A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
     14 #
     15 #  You should have received a copy of the GNU General Public License along with
     16 #  TALER; see the file COPYING.  If not, If not, see <http://www.gnu.org/license>
     17 #
     18 #
     19 AC_PREREQ([2.71])
     20 AC_INIT([paivana],[0.0.0],[taler-bug@gnunet.org])
     21 AC_CONFIG_SRCDIR([src/backend/paivana-httpd.c])
     22 AC_CONFIG_HEADERS([paivana_config.h])
     23 # support for non-recursive builds
     24 AM_INIT_AUTOMAKE([subdir-objects 1.9 tar-pax])
     25 
     26 # pretty build rules
     27 AM_SILENT_RULES([yes])
     28 
     29 AC_CONFIG_MACRO_DIR([m4])
     30 
     31 LT_INIT
     32 
     33 # Checks for programs.
     34 
     35 AC_PROG_CC
     36 
     37 CFLAGS="-Wall $CFLAGS"
     38 
     39 # Checks for header files.
     40 AC_CHECK_HEADERS([stdint.h stdlib.h string.h unistd.h])
     41 
     42 
     43 # Require minimum libgcrypt version
     44 need_libgcrypt_version=1.6.1
     45 AC_DEFINE_UNQUOTED([NEED_LIBGCRYPT_VERSION], ["$need_libgcrypt_version"],
     46                                              [minimum version of libgcrypt required])
     47 AM_PATH_LIBGCRYPT([$need_libgcrypt_version])
     48 
     49 
     50 # Check for GNUnet's libgnunetutil.
     51 libgnunetutil=0
     52 AC_MSG_CHECKING([for libgnunetutil])
     53 AC_ARG_WITH(gnunet,
     54             [AS_HELP_STRING([--with-gnunet=PFX], [base of GNUnet installation])],
     55             [AC_MSG_RESULT([given as $with_gnunet])],
     56             [AC_MSG_RESULT(not given)
     57              with_gnunet=yes])
     58 AS_CASE([$with_gnunet],
     59         [yes], [],
     60         [no], [AC_MSG_ERROR([--with-gnunet is required])],
     61         [LDFLAGS="-L$with_gnunet/lib $LDFLAGS"
     62          CPPFLAGS="-I$with_gnunet/include $CPPFLAGS"])
     63 AC_CHECK_HEADERS([gnunet/gnunet_util_lib.h],
     64  [AC_CHECK_LIB([gnunetutil], [GNUNET_SCHEDULER_run], libgnunetutil=1)])
     65 AS_IF([test $libgnunetutil != 1],
     66   [AC_MSG_ERROR([[
     67 ***
     68 *** You need libgnunetutil to build this program.
     69 *** This library is part of GNUnet, available at
     70 ***   https://gnunet.org
     71 *** ]])])
     72 
     73 # Check for GNUnet's libgnunetjson.
     74 libgnunetjson=0
     75 AC_MSG_CHECKING([for libgnunetjson])
     76 AC_ARG_WITH(gnunet,
     77             [AS_HELP_STRING([--with-gnunet=PFX], [base of GNUnet installation])],
     78             [AC_MSG_RESULT([given as $with_gnunet])],
     79             [AC_MSG_RESULT(not given)
     80              with_gnunet=yes])
     81 AS_CASE([$with_gnunet],
     82         [yes], [],
     83         [no], [AC_MSG_ERROR([--with-gnunet is required])],
     84         [LDFLAGS="-L$with_gnunet/lib $LDFLAGS"
     85          CPPFLAGS="-I$with_gnunet/include $CPPFLAGS"])
     86 AC_CHECK_HEADERS([gnunet/gnunet_json_lib.h],
     87  [AC_CHECK_LIB([gnunetjson], [GNUNET_JSON_parse], libgnunetjson=1)])
     88 AS_IF([test $libgnunetjson != 1],
     89   [AC_MSG_ERROR([[
     90 ***
     91 *** You need libgnunetjson to build this program.
     92 *** Make sure you have libjansson installed while
     93 *** building GNUnet.
     94 *** ]])])
     95 
     96 
     97 # Save before checking libcurl
     98 CFLAGS_SAVE=$CFLAGS
     99 LDFLAGS_SAVE=$LDFLAGS
    100 LIBS_SAVE=$LIBS
    101 
    102 # check for libcurl
    103 LIBCURL_CHECK_CONFIG(,7.34.0,[curl=1],[curl=0])
    104 
    105 # cURL must support CURLINFO_TLS_SESSION, version >= 7.34
    106 AS_IF([test "x$curl" = x1],[
    107  AC_CHECK_HEADER([curl/curl.h],
    108   [AC_CHECK_DECLS(CURLINFO_TLS_SESSION,[curl=1],[curl=0],[[#include <curl/curl.h>]])],
    109   [curl=0])
    110 ])
    111 
    112 # libcurl should be mutually exclusive
    113 AS_IF([test "$curl" = 1],
    114       AM_CONDITIONAL(HAVE_LIBCURL, true)
    115       AC_DEFINE([HAVE_LIBCURL],[1],[Have libcurl])
    116       [LIBCURL_LIBS="-lcurl"],
    117       [AC_MSG_ERROR([FATAL: No libcurl])])
    118 
    119 AC_SUBST([LIBCURL_LIBS])
    120 
    121 
    122 # Check for GNUnet's libgnunetcurl.
    123 libgnunetcurl=0
    124 AC_MSG_CHECKING([for libgnunetcurl])
    125 AC_ARG_WITH(gnunet,
    126             [AS_HELP_STRING([--with-gnunet=PFX], [base of GNUnet installation])],
    127             [AC_MSG_RESULT([given as $with_gnunet])],
    128             [AC_MSG_RESULT(not given)
    129              with_gnunet=yes])
    130 AS_CASE([$with_gnunet],
    131         [yes], [],
    132         [no], [AC_MSG_ERROR([--with-gnunet is required])],
    133         [LDFLAGS="-L$with_gnunet/lib $LDFLAGS"
    134          CPPFLAGS="-I$with_gnunet/include $CPPFLAGS"])
    135 AC_CHECK_HEADERS([gnunet/gnunet_curl_lib.h],
    136  [AC_CHECK_LIB([gnunetcurl], [GNUNET_CURL_get_select_info], libgnunetcurl=1)])
    137 AS_IF([test $libgnunetcurl != 1],
    138   [AC_MSG_ERROR([[
    139 ***
    140 *** You need libgnunetcurl to build this program.
    141 *** Make sure you have libcurl installed while
    142 *** building GNUnet.
    143 *** ]])])
    144 
    145 
    146 # check for libmicrohttpd
    147 microhttpd=0
    148 AC_MSG_CHECKING([for microhttpd])
    149 AC_ARG_WITH([microhttpd],
    150             [AS_HELP_STRING([--with-microhttpd=PFX], [base of microhttpd installation])],
    151             [AC_MSG_RESULT([given as $with_microhttpd])],
    152             [AC_MSG_RESULT([not given])
    153              with_microhttpd=yes])
    154 AS_CASE([$with_microhttpd],
    155         [yes], [],
    156         [no], [AC_MSG_ERROR([--with-microhttpd is required])],
    157         [LDFLAGS="-L$with_microhttpd/lib $LDFLAGS"
    158          CPPFLAGS="-I$with_microhttpd/include $CPPFLAGS"])
    159 AC_CHECK_LIB(microhttpd,MHD_start_daemon,
    160   [AC_CHECK_HEADER([microhttpd.h],[microhttpd=1])])
    161 AC_CHECK_DECL([MHD_DAEMON_INFO_CURRENT_CONNECTIONS],,[microhttpd=0],[[#include <microhttpd.h>]])
    162 AS_IF([test $microhttpd = 0],
    163   [AC_MSG_ERROR([[
    164 ***
    165 *** You need libmicrohttpd >= 0.9.39 to build this program.
    166 *** ]])])
    167 
    168 
    169 # check for libjansson (Jansson JSON library)
    170 jansson=0
    171 AC_MSG_CHECKING([for jansson])
    172 AC_ARG_WITH([jansson],
    173             [AS_HELP_STRING([--with-jansson=PFX], [base of jansson installation])],
    174             [AC_MSG_RESULT([given as $with_jansson])],
    175             [AC_MSG_RESULT([not given])
    176              with_jansson=yes])
    177 AS_CASE([$with_jansson],
    178         [yes], [],
    179         [no], [AC_MSG_ERROR([--with-jansson is required])],
    180         [LDFLAGS="-L$with_jansson/lib $LDFLAGS"
    181          CPPFLAGS="-I$with_jansson/include $CPPFLAGS"])
    182 AC_CHECK_LIB(jansson,json_pack,
    183   [AC_CHECK_HEADER([jansson.h],[jansson=1])])
    184 AS_IF([test $jansson = 0],
    185   [AC_MSG_ERROR([[
    186 ***
    187 *** You need libjansson to build this program.
    188 *** ]])])
    189 
    190 
    191 # Check for Taler's libtalermerchant
    192 libtalermerchant=0
    193 AC_MSG_CHECKING([for libtalermerchant])
    194 AC_ARG_WITH(merchant,
    195             [AS_HELP_STRING([--with-merchant=PFX], [base of Taler MERCHANT installation])],
    196             [AC_MSG_RESULT([given as $with_merchant])],
    197             [AC_MSG_RESULT(not given)
    198              with_merchant=yes])
    199 AS_CASE([$with_merchant],
    200         [yes], [],
    201         [no], [AC_MSG_ERROR([--with-merchant is required])],
    202         [LDFLAGS="-L$with_merchant/lib/$MULTIARCH -L$with_merchant/lib/ $LDFLAGS"
    203          CPPFLAGS="-I$with_merchant/include $CPPFLAGS $POSTGRESQL_CPPFLAGS"])
    204 
    205 AC_CHECK_HEADERS([taler/taler_merchant_service.h],
    206  [AC_CHECK_LIB([talermerchant], [TALER_MERCHANT_poll_payment], libtalermerchant=1)],
    207    [], [])
    208 
    209 
    210 # Check for Taler's libtalerexchange
    211 libtalerexchange=0
    212 AC_MSG_CHECKING([for libtalerexchange])
    213 AC_ARG_WITH(exchange,
    214             [AS_HELP_STRING([--with-exchange=PFX], [base of Taler EXCHANGE installation])],
    215             [AC_MSG_RESULT([given as $with_exchange])],
    216             [AC_MSG_RESULT(not given)
    217              with_exchange=yes])
    218 AS_CASE([$with_exchange],
    219         [yes], [],
    220         [no], [AC_MSG_ERROR([--with-exchange is required])],
    221         [LDFLAGS="-L$with_exchange/lib/$MULTIARCH -L$with_exchange/lib/ $LDFLAGS"
    222          CPPFLAGS="-I$with_exchange/include $CPPFLAGS $POSTGRESQL_CPPFLAGS"])
    223 
    224 AC_CHECK_HEADERS([taler/taler_exchange_service.h],
    225  [AC_CHECK_LIB([talerexchange], [TALER_EXCHANGE_parse_451], libtalerexchange=1)],
    226    [], [])
    227 
    228 
    229 TALER_LIB_LDFLAGS="-export-dynamic -no-undefined"
    230 TALER_PLUGIN_LDFLAGS="-export-dynamic -avoid-version -module -no-undefined"
    231 
    232 AC_SUBST(TALER_LIB_LDFLAGS)
    233 AC_SUBST(TALER_PLUGIN_LDFLAGS)
    234 
    235 CFLAGS_SAVE=$CFLAGS
    236 LDFLAGS_SAVE=$LDFLAGS
    237 LIBS_SAVE="$LIBS"
    238 
    239 
    240 # test for zlib
    241 SAVE_LDFLAGS=$LDFLAGS
    242 SAVE_CPPFLAGS=$CPPFLAGS
    243 AC_ARG_WITH(zlib,
    244 	    [  --with-zlib[[=DIR]] use libz in DIR],
    245 	    [AS_IF([test "$withval" = "no"],
    246 		   [AC_MSG_ERROR([Twister requires zlib])],
    247 		   [test "$withval" != "yes"],
    248 		   [
    249 		     Z_DIR=$withval
    250 		     CPPFLAGS="${CPPFLAGS} -I$withval/include"
    251 		     LDFLAGS="${LDFLAGS} -L$withval/lib"
    252 		   ])
    253 	    ])
    254 AC_CHECK_HEADER(zlib.h,
    255 		[],
    256 	       	[AC_MSG_ERROR([GNUnet requires zlib])])
    257 AC_CHECK_LIB(z, compress2,
    258 	     [
    259 	      AC_DEFINE([HAVE_ZLIB], [], [Have compression library])
    260 	      if test "x${Z_DIR}" != "x"; then
    261 		      Z_CFLAGS="-I${Z_DIR}/include"
    262 		      Z_LIBS="-L${Z_DIR}/lib -lz"
    263 	      else
    264 		      Z_LIBS="-lz"
    265 	      fi],
    266 	      [AC_MSG_ERROR([Twister requires zlib])])
    267 AC_SUBST(Z_CFLAGS)
    268 AC_SUBST(Z_LIBS)
    269 
    270 
    271 # should developer logic be compiled (not-for-production code)?
    272 AC_MSG_CHECKING(whether to compile developer logic)
    273 AC_ARG_ENABLE([developer-mode],
    274    [AS_HELP_STRING([--enable-developer-mode], [enable compiling developer code])],
    275    [enable_developer=${enableval}],
    276    [enable_developer=yes])
    277 AC_MSG_RESULT($enable_developer)
    278 AM_CONDITIONAL([HAVE_DEVELOPER], [test "x$enable_developer" = "xyes"])
    279 enable_dev=1
    280 AS_IF([test "x$enableval" = "xno"], [enable_dev=0])
    281 # developer-logic requires a more recent MHD than usual.
    282 AC_CHECK_DECL([MHD_OPTION_NOTIFY_CONNECTION],,[enable_dev=0],[[#include <microhttpd.h>]])
    283 AC_DEFINE_UNQUOTED([HAVE_DEVELOPER],[$enable_dev],[1 if developer logic is enabled, 0 otherwise])
    284 
    285 
    286 
    287 # Adam shostack suggests the following for Windows:
    288 # -D_FORTIFY_SOURCE=2 -fstack-protector-all
    289 AC_ARG_ENABLE(gcc-hardening,
    290    AS_HELP_STRING(--enable-gcc-hardening, enable compiler security checks),
    291 [if test x$enableval = xyes; then
    292     CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all"
    293     CFLAGS="$CFLAGS -fwrapv -fPIE -Wstack-protector"
    294     CFLAGS="$CFLAGS --param ssp-buffer-size=1"
    295     LDFLAGS="$LDFLAGS -pie"
    296 fi])
    297 
    298 
    299 # Linker hardening options
    300 # Currently these options are ELF specific - you can't use this with MacOSX
    301 AC_ARG_ENABLE(linker-hardening,
    302   AS_HELP_STRING(--enable-linker-hardening, enable linker security fixups),
    303 [if test x$enableval = xyes; then
    304    LDFLAGS="$LDFLAGS -z relro -z now"
    305 fi])
    306 
    307 
    308 # gcov compilation
    309 AC_MSG_CHECKING(whether to compile with support for code coverage analysis)
    310 AC_ARG_ENABLE([coverage],
    311               AS_HELP_STRING([--enable-coverage],
    312                              [compile the library with code coverage support]),
    313               [use_gcov=${enableval}],
    314               [use_gcov=no])
    315 AC_MSG_RESULT($use_gcov)
    316 AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"])
    317 
    318 # version info
    319 AC_PATH_PROG(gitcommand, git)
    320 AC_MSG_CHECKING(for source being under a VCS)
    321 git_version=
    322 AS_IF([test ! "X$gitcommand" = "X"],
    323 [
    324   git_version=$(cd $srcdir ; git rev-list --full-history --all --abbrev-commit | head -n 1 2>/dev/null)
    325 ])
    326 AS_IF([test "X$git_version" = "X"],
    327   [
    328     vcs_name="no"
    329     vcs_version="\"release\""
    330   ],
    331   [
    332     vcs_name="yes, git-svn"
    333     vcs_version="\"git-$git_version\""
    334   ])
    335 AC_MSG_RESULT($vcs_name)
    336 
    337 AC_MSG_CHECKING(VCS version)
    338 AC_MSG_RESULT($vcs_version)
    339 AC_DEFINE_UNQUOTED(VCS_VERSION, [$vcs_version], [VCS revision/hash or tarball version])
    340 
    341 
    342 # Checks for typedefs, structures, and compiler characteristics.
    343 AC_TYPE_PID_T
    344 AC_TYPE_SIZE_T
    345 AC_TYPE_UINT16_T
    346 AC_TYPE_UINT32_T
    347 AC_TYPE_UINT64_T
    348 AC_TYPE_INTMAX_T
    349 AC_TYPE_UINTMAX_T
    350 
    351 # Checks for library functions.
    352 AC_CHECK_FUNCS([strdup])
    353 
    354 
    355 AC_ARG_ENABLE([[doc]],
    356   [AS_HELP_STRING([[--disable-doc]], [do not build any documentation])], ,
    357     [enable_doc=yes])
    358 test "x$enable_doc" = "xno" || enable_doc=yes
    359 AM_CONDITIONAL([ENABLE_DOC], [test "x$enable_doc" = "xyes"])
    360 
    361 
    362 AC_CONFIG_FILES([Makefile
    363                  contrib/Makefile
    364                  doc/Makefile
    365                  src/Makefile
    366                  src/include/Makefile
    367                  src/backend/Makefile
    368                  ])
    369 AC_OUTPUT