# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. # # This configure file is in the public domain AC_PREREQ([2.69]) AC_INIT([taler-mdb],[0.10.0],[taler@gnu.org]) AC_CONFIG_SRCDIR([src/taler-mdb.c]) AC_CONFIG_HEADERS([config.h]) # Checks for programs. AM_INIT_AUTOMAKE AC_PROG_CC # Checks for libraries. AC_CHECK_LIB([nfc], [nfc_open]) # Checks for header files. AC_CHECK_HEADERS([stdlib.h string.h unistd.h sys/un.h netinet/in.h netinet/ip.h]) # Checks for typedefs, structures, and compiler characteristics. AC_CHECK_HEADER_STDBOOL AC_TYPE_SIZE_T AC_TYPE_UINT8_T # 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]) # 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" ])]) # 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"]) # Checks for library functions. AC_FUNC_MALLOC AC_FUNC_REALLOC AC_CHECK_FUNCS([strstr]) # Save before checking for libraries LIBS_SAVE=$LIBS # 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], [ AM_CONDITIONAL(HAVE_QR, false) QR_LIBS="" QR_CFLAGS="" ], [AM_CONDITIONAL(HAVE_QR, true)]) AC_SUBST(QR_CFLAGS) AC_SUBST(QR_LIBS) # Check for Taler's libtalermerchant libtalermerchant=0 AC_MSG_CHECKING([for libtalermerchant]) AC_ARG_WITH(merchant, [AS_HELP_STRING([--with-merchant=PFX], [base of Taler MERCHANT installation])], [AC_MSG_RESULT([given as $with_merchant])], [AC_MSG_RESULT(not given) with_merchant=yes]) AS_CASE([$with_merchant], [yes], [], [no], [AC_MSG_ERROR([--with-merchant is required])], [LDFLAGS="-L$with_merchant/lib $LDFLAGS" CPPFLAGS="-I$with_merchant/include $CPPFLAGS $POSTGRESQL_CPPFLAGS"]) AC_CHECK_HEADERS([taler/taler_merchant_service.h], [AC_CHECK_LIB([talermerchant], [TALER_MERCHANT_poll_payment], libtalermerchant=1)], [], [#ifdef HAVE_TALER_PLATFORM_H #include #endif]) # 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 to build this program. *** This library is part of GNUnet, available at *** https://gnunet.org *** ]])]) # Check for GNUnet's libgnunetjson. libgnunetjson=0 AC_MSG_CHECKING([for libgnunetjson]) 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_json_lib.h], [AC_CHECK_LIB([gnunetjson], [GNUNET_JSON_parse], libgnunetjson=1)]) AS_IF([test $libgnunetjson != 1], [AC_MSG_ERROR([[ *** *** You need libgnunetjson to build this program. *** Make sure you have libjansson installed while *** building GNUnet. *** ]])]) # Check for GNUnet's libgnunetcurl. libgnunetcurl=0 AC_MSG_CHECKING([for libgnunetcurl]) 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_curl_lib.h], [AC_CHECK_LIB([gnunetcurl], [GNUNET_CURL_get_select_info], libgnunetcurl=1)]) AS_IF([test $libgnunetcurl != 1], [AC_MSG_ERROR([[ *** *** You need libgnunetcurl to build this program. *** Make sure you have libcurl installed while *** building GNUnet. *** ]])]) # Save before checking libcurl CFLAGS_SAVE=$CFLAGS LDFLAGS_SAVE=$LDFLAGS # 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 ]])]) # Restore after curl checks messed up these values CFLAGS=$CFLAGS_SAVE LDFLAGS=$LDFLAGS_SAVE LIBS=$LIBS_SAVE # check for libjansson (Jansson JSON library) jansson=0 AC_MSG_CHECKING([for jansson]) AC_ARG_WITH([jansson], [AS_HELP_STRING([--with-jansson=PFX], [base of jansson installation])], [AC_MSG_RESULT([given as $with_jansson])], [AC_MSG_RESULT([not given]) with_jansson=yes]) AS_CASE([$with_jansson], [yes], [], [no], [AC_MSG_ERROR([--with-jansson is required])], [LDFLAGS="-L$with_jansson/lib $LDFLAGS" CPPFLAGS="-I$with_jansson/include $CPPFLAGS"]) AC_CHECK_LIB(jansson,json_dumpb, [AC_CHECK_HEADER([jansson.h],[jansson=1])]) AS_IF([test $jansson = 0], [AC_MSG_ERROR([[ *** *** You need libjansson >= 2.10 to build this program. *** ]])]) # Restore, we link each binary individually as needed CFLAGS=$CFLAGS_SAVE LDFLAGS=$LDFLAGS_SAVE LIBS=$LIBS_SAVE AC_CONFIG_FILES([Makefile contrib/Makefile src/Makefile]) AC_OUTPUT if test "$qrencode" != 1 then AC_MSG_WARN([taler-mdb will not include QR support]) fi