# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. # # This file is part of TALER # Copyright (C) 2014-2024 Taler Systems SA # # TALER is free software; you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation; either version 3, or (at your option) any later version. # # TALER is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along with # TALER; see the file COPYING. If not, If not, see # # This configure file is in the public domain AC_PREREQ([2.69]) AC_INIT([taler-merchant],[0.14.0],[taler-bug@gnunet.org]) AC_CONFIG_SRCDIR([src/backend/taler-merchant-httpd.c]) AC_CONFIG_HEADERS([taler_merchant_config.h]) # support for non-recursive builds AM_INIT_AUTOMAKE([subdir-objects 1.9 tar-pax]) # pretty build rules AM_SILENT_RULES([yes]) AC_CONFIG_MACRO_DIR([m4]) AC_PROG_AWK AC_PROG_CC AC_PROG_OBJC AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET AM_PROG_CC_C_O LT_INIT([disable-static dlopen]) DX_INIT_DOXYGEN([taler-merchant],,, DX_PS_FEATURE(OFF), DX_PDF_FEATURE(OFF), DX_RTF_FEATURE(OFF), DX_CHI_FEATURE(OFF), DX_XML_FEATURE(OFF)) AC_MSG_CHECKING([whether to compile documentation ONLY]) AC_ARG_ENABLE([only-doc], [AS_HELP_STRING([--enable-only-doc], [only compile Taler documentation])], [doc_only=${enableval}], [doc_only=no]) AC_MSG_RESULT($doc_only) AM_CONDITIONAL([DOC_ONLY], [test "$doc_only" = "yes"]) # Not indented as it covers most of the file... AS_IF([test "x$doc_only" != xyes],[ # Checks for programs. AC_PROG_CC CFLAGS="-Wall -Wno-address-of-packed-member $CFLAGS" # Adam shostack suggests the following for Windows: # -D_FORTIFY_SOURCE=2 -fstack-protector-all AC_ARG_ENABLE(gcc-hardening, AS_HELP_STRING(--enable-gcc-hardening, enable compiler security checks), [AS_IF([test x$enableval = xyes],[ CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all" CFLAGS="$CFLAGS -fwrapv -fPIE -Wstack-protector" CFLAGS="$CFLAGS --param ssp-buffer-size=1" LDFLAGS="$LDFLAGS -pie"])]) # Linker hardening options # Currently these options are ELF specific - you can't use this with MacOSX AC_ARG_ENABLE(linker-hardening, AS_HELP_STRING(--enable-linker-hardening, enable linker security fixups), [AS_IF([test x$enableval = xyes],[LDFLAGS="$LDFLAGS -z relro -z now"])]) AC_ARG_ENABLE(sanitizer, AS_HELP_STRING(--enable-sanitizer, enable Address Sanitizer and Undefined Behavior Sanitizer), [AS_IF([test x$enableval = xyes],[ LDFLAGS="$CFLAGS -fsanitize=address,undefined -fno-omit-frame-pointer" ])]) # Checks for header files. AC_CHECK_HEADERS([stdint.h stdlib.h string.h unistd.h]) # check for libmicrohttpd AC_MSG_CHECKING([for microhttpd]) AC_ARG_WITH([microhttpd], [AS_HELP_STRING([--with-microhttpd=PFX], [base of microhttpd installation])], [AC_MSG_RESULT([given as $with_microhttpd])], [AC_MSG_RESULT([not given]) with_microhttpd=yes]) AS_CASE([$with_microhttpd], [yes], [], [no], [AC_MSG_ERROR([--with-microhttpd is required])], [LDFLAGS="-L$with_microhttpd/lib $LDFLAGS" CPPFLAGS="-I$with_microhttpd/include $CPPFLAGS"]) MHD_VERSION_AT_LEAST([0.9.71]) jansson=0 PKG_CHECK_MODULES([JANSSON], [jansson >= 2.3], [LDFLAGS="$JANSSON_LIBS $LDFLAGS" CPPFLAGS="$JANSSON_CFLAGS $CPPFLAGS"], [AC_MSG_ERROR([[ *** *** You need libjansson to build this program. ***]])]) # Require minimum libgcrypt version need_libgcrypt_version=1.6.1 AC_DEFINE_UNQUOTED([NEED_LIBGCRYPT_VERSION], ["$need_libgcrypt_version"], [minimum version of libgcrypt required]) AM_PATH_LIBGCRYPT([$need_libgcrypt_version]) # NOTE: If we find libcurl here we set LIBCURL to -lcurl # This affects the LIBCURL_CHECK_CONFIG call below as it takes LIBCURL into # account when checking for curl. AC_CHECK_LIB([curl], [curl_easy_getinfo], [LIBCURL="-lcurl" curl_gnutls=1], [curl_gnutls=0]) LIBCURL_CHECK_CONFIG([], [7.34.0], [], [AC_MSG_ERROR([cURL must have a version >= 7.34.0])]) # Even if curl is found, we check for this constant in order to determine # if we can use this feature. AC_CHECK_HEADER([curl/curl.h], [AC_CHECK_DECLS([CURLINFO_TLS_SSL_PTR], [], [AC_MSG_ERROR([cURL must support CURLINFO_TLS_SSL_PTR])], [[#include ]])]) # test for libqrencode qrencode=0 QR_LIBS="-lqrencode" AC_MSG_CHECKING(for libqrencode) AC_ARG_WITH(qrencode, [ --with-qrencode=PFX Base of libqrencode installation], [AC_MSG_RESULT([$with_qrencode]) AS_CASE([$with_qrencode], [no],[], [yes],[ AC_CHECK_HEADERS(qrencode.h,qrencode=1) ], [ CPPFLAGS="-I$with_qrencode/include $CPPFLAGS" QR_CFLAGS="-I$with_qrencode/include" QR_LIBS="-L$with_qrencode/lib -lqrencode" AC_CHECK_HEADERS(qrencode.h,qrencode=1) ]) ], [AC_MSG_RESULT([--with-qrencode not specified]) AC_CHECK_HEADERS(qrencode.h,qrencode=1)]) AS_IF([test "$qrencode" != 1], [AC_MSG_ERROR([[ *** *** You need libqrencode to build this program. *** ]])]) AC_SUBST(QR_CFLAGS) AC_SUBST(QR_LIBS) # test for postgres AX_LIB_POSTGRESQL([15.0]) AS_IF([test "x$found_postgresql" = "xyes"], [SAVE_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$POSTGRES_CPPFLAGS $CPPFLAGS" AC_CHECK_HEADERS([libpq-fe.h], [postgres=1], [postgres=0])]) AS_IF([test "x$postgres" != "x1"], [AC_MSG_ERROR([[ *** *** You need libpq(-dev) >= 15.0 to build this program. *** ]])]) AM_CONDITIONAL([HAVE_POSTGRESQL], [test "x$postgres" = "x1"]) AC_DEFINE_UNQUOTED([HAVE_POSTGRESQL], [$postgres], [Define to 1 if Postgres is available]) CPPFLAGS="$CPPFLAGS $POSTGRESQL_CPPFLAGS" # Check for GNUnet's libgnunetutil. libgnunetutil=0 AC_MSG_CHECKING([for libgnunetutil]) AC_ARG_WITH(gnunet, [AS_HELP_STRING([--with-gnunet=PFX], [base of GNUnet installation])], [AC_MSG_RESULT([given as $with_gnunet])], [AC_MSG_RESULT(not given) with_gnunet=yes]) AS_CASE([$with_gnunet], [yes], [], [no], [AC_MSG_ERROR([--with-gnunet is required])], [LDFLAGS="-L$with_gnunet/lib $LDFLAGS" CPPFLAGS="-I$with_gnunet/include $CPPFLAGS"]) AC_CHECK_HEADERS([gnunet/gnunet_util_lib.h], [AC_CHECK_LIB([gnunetutil], [GNUNET_SCHEDULER_run], libgnunetutil=1)]) AS_IF([test $libgnunetutil != 1], [AC_MSG_ERROR([[ *** *** You need libgnunetutil >= 0.21.0 to build this program. *** This library is part of GNUnet, available at *** https://gnunet.org *** ]])]) libgnunetpq=0 AC_CHECK_HEADERS([gnunet/gnunet_pq_lib.h], [AC_CHECK_LIB([gnunetpq], [GNUNET_PQ_query_param_blind_sign_priv], libgnunetpq=1)]) AS_IF([test $libgnunetpq != 1], [AC_MSG_ERROR([[ *** *** You need libgnunetpq >= 0.21.2 (API v7) to build this program. *** This library is part of GNUnet, available at *** https://gnunet.org *** ]])]) AM_CONDITIONAL(HAVE_GNUNETPQ, test x$libgnunetpq = x1) TALER_LIB_LDFLAGS="-export-dynamic -no-undefined" TALER_PLUGIN_LDFLAGS="-export-dynamic -avoid-version -module -no-undefined" AC_SUBST(TALER_LIB_LDFLAGS) AC_SUBST(TALER_PLUGIN_LDFLAGS) libtalerutil=0 AC_MSG_CHECKING([for libtalerutil]) AC_ARG_WITH(exchange, [AS_HELP_STRING([--with-exchange=PFX], [base of Taler EXCHANGE installation])], [AC_MSG_RESULT([given as $with_exchange])], [AC_MSG_RESULT(not given) with_exchange=yes]) AS_CASE([$with_exchange], [yes], [], [no], [AC_MSG_ERROR([--with-exchange is required])], [LDFLAGS="-L$with_exchange/lib $LDFLAGS" CPPFLAGS="-I$with_exchange/include $CPPFLAGS $POSTGRESQL_CPPFLAGS"]) AC_CHECK_HEADERS([taler/taler_util.h], [AC_CHECK_LIB([talerutil], [TALER_kyc_measure_authorization_hash], libtalerutil=1)]) AM_CONDITIONAL(HAVE_TALERUTIL, test x$libtalerutil = x1) AS_IF([test $libtalerutil != 1], [AC_MSG_ERROR([[ *** *** You need libtalerutil >= 0.13.0 to build this program. *** This library is part of the GNU Taler exchange, available at *** https://taler.net *** ]])]) libtalerexchange=0 AC_MSG_CHECKING([for libtalerexchange]) AC_ARG_WITH(exchange, [AS_HELP_STRING([--with-exchange=PFX], [base of Taler EXCHANGE installation])], [AC_MSG_RESULT([given as $with_exchange])], [AC_MSG_RESULT(not given) with_exchange=yes]) AS_CASE([$with_exchange], [yes], [], [no], [AC_MSG_ERROR([--with-exchange is required])], [LDFLAGS="-L$with_exchange/lib $LDFLAGS" CPPFLAGS="-I$with_exchange/include $CPPFLAGS $POSTGRESQL_CPPFLAGS"]) AC_CHECK_HEADERS([taler/taler_exchange_service.h], [AC_CHECK_LIB([talerexchange], [TALER_EXCHANGE_test_account_allowed], libtalerexchange=1)]) AM_CONDITIONAL(HAVE_TALEREXCHANGE, test x$libtalerexchange = x1) AS_IF([test $libtalerexchange != 1], [AC_MSG_ERROR([[ *** *** You need libtalerexchange >= 0.14.0 to build this program. *** This library is part of the GNU Taler exchange, available at *** https://taler.net *** ]])]) libtalermhd=0 AC_MSG_CHECKING([for libtalermhd]) AC_ARG_WITH(exchange, [AS_HELP_STRING([--with-exchange=PFX], [base of Taler EXCHANGE installation])], [AC_MSG_RESULT([given as $with_exchange])], [AC_MSG_RESULT(not given) with_exchange=yes]) AS_CASE([$with_exchange], [yes], [], [no], [AC_MSG_ERROR([--with-exchange is required])], [LDFLAGS="-L$with_exchange/lib $LDFLAGS" CPPFLAGS="-I$with_exchange/include $CPPFLAGS $POSTGRESQL_CPPFLAGS"]) AC_CHECK_HEADERS([taler/taler_mhd_lib.h], [AC_CHECK_LIB([talermhd], [TALER_MHD_parse_request_arg_snumber], libtalermhd=1)]) AM_CONDITIONAL(HAVE_TALERMHD, test x$libtalermhd = x1) AS_IF([test $libtalermhd != 1], [AC_MSG_ERROR([[ *** *** You need libtalermhd >= 0.10.1 (API v2) to build this program. *** This library is part of the GNU Taler exchange, available at *** https://taler.net *** ]])]) libtalerjson=0 AC_CHECK_HEADERS([taler/taler_json_lib.h], [AC_CHECK_LIB([talerjson], [TALER_JSON_spec_otp_type], libtalerjson=1)]) AM_CONDITIONAL(HAVE_TALERJSON, test x$libtalerjson = x1) AS_IF([test $libtalerjson != 1], [AC_MSG_ERROR([[ *** *** You need libtalerjson >= 0.9.4 to build this program. *** This library is part of the GNU Taler exchange, available at *** https://taler.net *** ]])]) # Check for Taler's libtalerpq libtalerpq=0 AC_MSG_CHECKING([for libtalerpq]) AC_CHECK_HEADERS([taler/taler_pq_lib.h], [AC_CHECK_LIB([talerpq], [TALER_PQ_query_param_array_blinded_denom_sig], libtalerpq=1)]) AM_CONDITIONAL(HAVE_TALERPQ, test x$libtalerpq = x1) AS_IF([test $libtalerpq != 1], [AC_MSG_ERROR([[ *** *** You need libtalerpq >= 0.9.4 to build this program. *** This library is part of the GNU Taler exchange, available at *** https://taler.net *** ]])]) # Check for Taler's libtalerfakebank libtalerfakebank=0 AC_MSG_CHECKING([for libtalerfakebank]) AC_CHECK_HEADERS([taler/taler_fakebank_lib.h], [AC_CHECK_LIB([talerfakebank], [TALER_FAKEBANK_start], libtalerfakebank=1)]) AM_CONDITIONAL(HAVE_TALERFAKEBANK, test x$libtalerfakebank = x1) # check for libtalertwister twistertesting=0 AC_MSG_CHECKING([for talerwtistertesting]) AC_ARG_WITH([twister], [AS_HELP_STRING([--with-twister=PFX], [base of libtalertwistertesting])], [AC_MSG_RESULT([given as $with_twister])], [AC_MSG_RESULT([not given]) with_twister=yes]) AS_CASE([$with_twister], [yes], [], [no], [AC_MSG_WARN([no twister-testing will be compiled])], [LDFLAGS="-L$with_twister/lib $LDFLAGS" CPPFLAGS="-I$with_twister/include $CPPFLAGS"]) AC_CHECK_LIB(talertwistertesting,TALER_TWISTER_run_twister, [AC_CHECK_HEADER([taler/taler_twister_testing_lib.h],[twistertesting=1])]) AM_CONDITIONAL(HAVE_TWISTER, test x$twistertesting = x1) # gcov compilation AC_MSG_CHECKING(whether to compile with support for code coverage analysis) AC_ARG_ENABLE([coverage], AS_HELP_STRING([--enable-coverage], [compile the library with code coverage support]), [use_gcov=${enableval}], [use_gcov=no]) AC_MSG_RESULT($use_gcov) AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"]) # logging extra_logging=0 AC_ARG_ENABLE([logging], AS_HELP_STRING([--enable-logging@<:@=value@:>@],[Enable logging calls. Possible values: yes,no,verbose ('yes' is the default)]), [AS_IF([test "x$enableval" = "xyes"], [], [test "x$enableval" = "xno"], [AC_DEFINE([GNUNET_CULL_LOGGING],[],[Define to cull all logging calls])], [test "x$enableval" = "xverbose"], [extra_logging=1] [test "x$enableval" = "xveryverbose"], [extra_logging=2]) ], []) AC_DEFINE_UNQUOTED([GNUNET_EXTRA_LOGGING],[$extra_logging],[1 if extra logging is enabled, 2 for very verbose extra logging, 0 otherwise]) # version info AC_PATH_PROG(gitcommand, git) AC_MSG_CHECKING(for source being under a VCS) git_version= AS_IF([test ! "X$gitcommand" = "X"], [ git_version=$(cd $srcdir ; git rev-list -n 1 --abbrev-commit HEAD 2>/dev/null) ]) AS_IF([test "X$git_version" = "X"], [ vcs_name="no" vcs_version="\"release\"" ], [ vcs_name="yes, git-svn" vcs_version="\"git-$git_version\"" ]) AC_MSG_RESULT($vcs_name) AC_MSG_CHECKING(VCS version) AC_MSG_RESULT($vcs_version) AC_DEFINE_UNQUOTED(VCS_VERSION, [$vcs_version], [VCS revision/hash or tarball version]) # Checks for typedefs, structures, and compiler characteristics. AC_TYPE_PID_T AC_TYPE_SIZE_T AC_TYPE_UINT16_T AC_TYPE_UINT32_T AC_TYPE_UINT64_T AC_TYPE_INTMAX_T AC_TYPE_UINTMAX_T # Checks for library functions. AC_CHECK_FUNCS([strdup]) AC_ARG_ENABLE([[doc]], [AS_HELP_STRING([[--disable-doc]], [do not build any documentation])], , [enable_doc=yes]) test "x$enable_doc" = "xno" || enable_doc=yes AM_CONDITIONAL([ENABLE_DOC], [test "x$enable_doc" = "xyes"]) ],[ # this is about the doc-only if on top of the file # logic if doc_only is set, make sure conditionals are still defined AM_CONDITIONAL([HAVE_GNUNETPQ], [false]) AM_CONDITIONAL([HAVE_POSTGRESQL], [false]) AM_CONDITIONAL([HAVE_TALERUTIL], [false]) AM_CONDITIONAL(HAVE_TALEREXCHANGE, [false]) AM_CONDITIONAL([HAVE_TALERPQ], [false]) AM_CONDITIONAL([HAVE_TALERMHD], [false]) AM_CONDITIONAL([HAVE_TALERJSON], [false]) AM_CONDITIONAL([HAVE_TALERFAKEBANK], [false]) AM_CONDITIONAL([USE_COVERAGE], [false]) AM_CONDITIONAL([ENABLE_DOC], [true]) AM_CONDITIONAL([HAVE_TWISTER], [true]) # end of 'doc_only' ]) # should experimental code be compiled (code that may not yet compile / have passing test cases)? AC_MSG_CHECKING(whether to compile experimental code) AC_ARG_ENABLE([experimental], [AS_HELP_STRING([--enable-experimental], [enable compiling experimental code])], [enable_experimental=${enableval}], [enable_experimental=no]) AC_MSG_RESULT($enable_experimental) AM_CONDITIONAL([HAVE_EXPERIMENTAL], [test "x$enable_experimental" = "xyes"]) AC_CONFIG_FILES([Makefile contrib/Makefile doc/Makefile doc/doxygen/Makefile src/Makefile src/bank/Makefile src/backend/Makefile src/backenddb/Makefile src/include/Makefile src/lib/Makefile src/merchant-tools/Makefile src/testing/Makefile ]) AC_OUTPUT