configure.ac (16973B)
1 # -*- Autoconf -*- 2 # Process this file with autoconf to produce a configure script. 3 # 4 # This file is part of TALER 5 # Copyright (C) 2014-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 # This configure file is in the public domain 19 20 AC_PREREQ([2.69]) 21 AC_INIT([taler-merchant],[1.2.6],[taler-bug@gnunet.org]) 22 AC_CONFIG_SRCDIR([src/backend/taler-merchant-httpd.c]) 23 AC_CONFIG_HEADERS([taler_merchant_config.h]) 24 # support for non-recursive builds 25 AM_INIT_AUTOMAKE([subdir-objects 1.9 tar-pax]) 26 27 # pretty build rules 28 AM_SILENT_RULES([yes]) 29 30 AC_CONFIG_MACRO_DIR([m4]) 31 AC_PROG_AWK 32 AC_PROG_CC 33 AC_PROG_OBJC 34 AC_PROG_INSTALL 35 AC_PROG_LN_S 36 AC_PROG_MAKE_SET 37 AM_PROG_CC_C_O 38 39 LT_INIT([disable-static dlopen]) 40 41 DX_INIT_DOXYGEN([taler-merchant],,, 42 DX_PS_FEATURE(OFF), 43 DX_PDF_FEATURE(OFF), 44 DX_RTF_FEATURE(OFF), 45 DX_CHI_FEATURE(OFF), 46 DX_XML_FEATURE(OFF)) 47 48 49 AC_CHECK_PROG([DPKG_ARCH], [dpkg-architecture], [yes], [no]) 50 if test "x$DPKG_ARCH" = "xyes"; then 51 MULTIARCH=`dpkg-architecture -qDEB_HOST_MULTIARCH` 52 else 53 MULTIARCH="" 54 fi 55 56 AC_MSG_CHECKING([whether to compile documentation ONLY]) 57 AC_ARG_ENABLE([only-doc], 58 [AS_HELP_STRING([--enable-only-doc], [only compile Taler documentation])], 59 [doc_only=${enableval}], 60 [doc_only=no]) 61 AC_MSG_RESULT($doc_only) 62 AM_CONDITIONAL([DOC_ONLY], [test "$doc_only" = "yes"]) 63 64 65 # Not indented as it covers most of the file... 66 AS_IF([test "x$doc_only" != xyes],[ 67 68 69 # Checks for programs. 70 AC_PROG_CC 71 72 73 74 CFLAGS="-Wall -Wno-address-of-packed-member $CFLAGS" 75 76 # Adam shostack suggests the following for Windows: 77 # -D_FORTIFY_SOURCE=2 -fstack-protector-all 78 AC_ARG_ENABLE(gcc-hardening, 79 AS_HELP_STRING(--enable-gcc-hardening, enable compiler security checks), 80 [AS_IF([test x$enableval = xyes],[ 81 CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all" 82 CFLAGS="$CFLAGS -fwrapv -fPIE -Wstack-protector" 83 CFLAGS="$CFLAGS --param ssp-buffer-size=1" 84 LDFLAGS="$LDFLAGS -pie"])]) 85 86 87 # Linker hardening options 88 # Currently these options are ELF specific - you can't use this with MacOSX 89 AC_ARG_ENABLE(linker-hardening, 90 AS_HELP_STRING(--enable-linker-hardening, enable linker security fixups), 91 [AS_IF([test x$enableval = xyes],[LDFLAGS="$LDFLAGS -z relro -z now"])]) 92 93 94 AC_ARG_ENABLE(sanitizer, 95 AS_HELP_STRING(--enable-sanitizer, enable Address Sanitizer and Undefined Behavior Sanitizer), 96 [AS_IF([test x$enableval = xyes],[ 97 LDFLAGS="$CFLAGS -fsanitize=address,undefined -fno-omit-frame-pointer" 98 ])]) 99 100 # Checks for header files. 101 AC_CHECK_HEADERS([stdint.h stdlib.h string.h unistd.h]) 102 103 # check for libmicrohttpd 104 AC_MSG_CHECKING([for microhttpd]) 105 AC_ARG_WITH([microhttpd], 106 [AS_HELP_STRING([--with-microhttpd=PFX], [base of microhttpd installation])], 107 [AC_MSG_RESULT([given as $with_microhttpd])], 108 [AC_MSG_RESULT([not given]) 109 with_microhttpd=yes]) 110 AS_CASE([$with_microhttpd], 111 [yes], [], 112 [no], [AC_MSG_ERROR([--with-microhttpd is required])], 113 [LDFLAGS="-L$with_microhttpd/lib/$MULTIARCH -L$with_microhttpd/lib/ $LDFLAGS" 114 CPPFLAGS="-I$with_microhttpd/include $CPPFLAGS"]) 115 MHD_VERSION_AT_LEAST([0.9.71]) 116 117 118 jansson=0 119 PKG_CHECK_MODULES([JANSSON], [jansson >= 2.3], 120 [LDFLAGS="$JANSSON_LIBS $LDFLAGS" 121 CPPFLAGS="$JANSSON_CFLAGS $CPPFLAGS"], 122 [AC_MSG_ERROR([[ 123 *** 124 *** You need libjansson to build this program. 125 ***]])]) 126 127 128 # Require minimum libgcrypt version 129 need_libgcrypt_version=1.6.1 130 AC_DEFINE_UNQUOTED([NEED_LIBGCRYPT_VERSION], ["$need_libgcrypt_version"], 131 [minimum version of libgcrypt required]) 132 AM_PATH_LIBGCRYPT([$need_libgcrypt_version]) 133 134 135 # NOTE: If we find libcurl here we set LIBCURL to -lcurl 136 # This affects the LIBCURL_CHECK_CONFIG call below as it takes LIBCURL into 137 # account when checking for curl. 138 AC_CHECK_LIB([curl], 139 [curl_easy_getinfo], 140 [LIBCURL="-lcurl" 141 curl_gnutls=1], 142 [curl_gnutls=0]) 143 144 LIBCURL_CHECK_CONFIG([], [7.34.0], [], 145 [AC_MSG_ERROR([cURL must have a version >= 7.34.0])]) 146 147 # Even if curl is found, we check for this constant in order to determine 148 # if we can use this feature. 149 AC_CHECK_HEADER([curl/curl.h], 150 [AC_CHECK_DECLS([CURLINFO_TLS_SSL_PTR], 151 [], 152 [AC_MSG_ERROR([cURL must support CURLINFO_TLS_SSL_PTR])], 153 [[#include <curl/curl.h>]])]) 154 155 # test for libqrencode 156 qrencode=0 157 QR_LIBS="-lqrencode" 158 AC_MSG_CHECKING(for libqrencode) 159 AC_ARG_WITH(qrencode, 160 [ --with-qrencode=PFX Base of libqrencode installation], 161 [AC_MSG_RESULT([$with_qrencode]) 162 AS_CASE([$with_qrencode], 163 [no],[], 164 [yes],[ 165 AC_CHECK_HEADERS(qrencode.h,qrencode=1) 166 ], 167 [ 168 CPPFLAGS="-I$with_qrencode/include $CPPFLAGS" 169 QR_CFLAGS="-I$with_qrencode/include" 170 QR_LIBS="-L$with_qrencode/lib/$MULTIARCH -L$with_qrencode/lib/ -lqrencode" 171 AC_CHECK_HEADERS(qrencode.h,qrencode=1) 172 ]) 173 ], 174 [AC_MSG_RESULT([--with-qrencode not specified]) 175 AC_CHECK_HEADERS(qrencode.h,qrencode=1)]) 176 177 AS_IF([test "$qrencode" != 1], 178 [AC_MSG_ERROR([[ 179 *** 180 *** You need libqrencode to build this program. 181 *** ]])]) 182 183 AC_SUBST(QR_CFLAGS) 184 AC_SUBST(QR_LIBS) 185 186 187 # test for postgres 188 AX_LIB_POSTGRESQL([15.0]) 189 AS_IF([test "x$found_postgresql" = "xyes"], 190 [SAVE_CPPFLAGS="$CPPFLAGS" 191 CPPFLAGS="$POSTGRES_CPPFLAGS $CPPFLAGS" 192 AC_CHECK_HEADERS([libpq-fe.h], [postgres=1], [postgres=0])]) 193 AS_IF([test "x$postgres" != "x1"], 194 [AC_MSG_ERROR([[ 195 *** 196 *** You need libpq(-dev) >= 15.0 to build this program. 197 *** ]])]) 198 AM_CONDITIONAL([HAVE_POSTGRESQL], [test "x$postgres" = "x1"]) 199 AC_DEFINE_UNQUOTED([HAVE_POSTGRESQL], [$postgres], 200 [Define to 1 if Postgres is available]) 201 202 203 CPPFLAGS="$CPPFLAGS $POSTGRESQL_CPPFLAGS" 204 205 # Check for GNUnet's libgnunetutil. 206 libgnunetutil=0 207 AC_MSG_CHECKING([for libgnunetutil]) 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_util_lib.h], 219 [AC_CHECK_LIB([gnunetutil], [GNUNET_TIME_round_up], libgnunetutil=1)]) 220 AS_IF([test $libgnunetutil != 1], 221 [AC_MSG_ERROR([[ 222 *** 223 *** You need libgnunetutil >= 0.25.3 to build this program. 224 *** This library is part of GNUnet, available at 225 *** https://gnunet.org 226 *** ]])]) 227 228 libgnunetpq=0 229 AC_CHECK_HEADERS([gnunet/gnunet_pq_lib.h], 230 [AC_CHECK_LIB([gnunetpq], [GNUNET_PQ_query_param_blind_sign_priv], libgnunetpq=1)]) 231 232 AS_IF([test $libgnunetpq != 1], 233 [AC_MSG_ERROR([[ 234 *** 235 *** You need libgnunetpq >= 0.25.3 (API v7) to build this program. 236 *** This library is part of GNUnet, available at 237 *** https://gnunet.org 238 *** ]])]) 239 240 AM_CONDITIONAL(HAVE_GNUNETPQ, test x$libgnunetpq = x1) 241 242 TALER_LIB_LDFLAGS="-export-dynamic -no-undefined" 243 TALER_PLUGIN_LDFLAGS="-export-dynamic -avoid-version -module -no-undefined" 244 245 246 AC_SUBST(TALER_LIB_LDFLAGS) 247 AC_SUBST(TALER_PLUGIN_LDFLAGS) 248 249 250 libtalerutil=0 251 AC_MSG_CHECKING([for libtalerutil]) 252 AC_ARG_WITH(exchange, 253 [AS_HELP_STRING([--with-exchange=PFX], [base of Taler EXCHANGE installation])], 254 [AC_MSG_RESULT([given as $with_exchange])], 255 [AC_MSG_RESULT(not given) 256 with_exchange=yes]) 257 AS_CASE([$with_exchange], 258 [yes], [], 259 [no], [AC_MSG_ERROR([--with-exchange is required])], 260 [LDFLAGS="-L$with_exchange/lib/$MULTIARCH -L$with_exchange/lib/ $LDFLAGS" 261 CPPFLAGS="-I$with_exchange/include $CPPFLAGS $POSTGRESQL_CPPFLAGS"]) 262 263 AC_CHECK_HEADERS([taler/taler_util.h], 264 [AC_CHECK_LIB([talerutil], [TALER_merchant_instance_auth_hash_with_salt], libtalerutil=1)]) 265 AM_CONDITIONAL(HAVE_TALERUTIL, test x$libtalerutil = x1) 266 AS_IF([test $libtalerutil != 1], 267 [AC_MSG_ERROR([[ 268 *** 269 *** You need libtalerutil >= 1.1.0 (ABI v8) to build this program. 270 *** This library is part of the GNU Taler exchange, available at 271 *** https://taler.net 272 *** ]])]) 273 274 libtalerexchange=0 275 AC_MSG_CHECKING([for libtalerexchange]) 276 AC_ARG_WITH(exchange, 277 [AS_HELP_STRING([--with-exchange=PFX], [base of Taler EXCHANGE installation])], 278 [AC_MSG_RESULT([given as $with_exchange])], 279 [AC_MSG_RESULT(not given) 280 with_exchange=yes]) 281 AS_CASE([$with_exchange], 282 [yes], [], 283 [no], [AC_MSG_ERROR([--with-exchange is required])], 284 [LDFLAGS="-L$with_exchange/lib/$MULTIARCH -L$with_exchange/lib/ $LDFLAGS" 285 CPPFLAGS="-I$with_exchange/include $CPPFLAGS $POSTGRESQL_CPPFLAGS"]) 286 287 AC_CHECK_HEADERS([taler/taler_exchange_service.h], 288 [AC_CHECK_LIB([talerexchange], [TALER_EXCHANGE_keys_test_account_allowed], libtalerexchange=1)]) 289 AM_CONDITIONAL(HAVE_TALEREXCHANGE, test x$libtalerexchange = x1) 290 AS_IF([test $libtalerexchange != 1], 291 [AC_MSG_ERROR([[ 292 *** 293 *** You need libtalerexchange >= 15:0:0 to build this program. 294 *** This library is part of the GNU Taler exchange, available at 295 *** https://taler.net 296 *** ]])]) 297 298 299 libdonau=0 300 AC_MSG_CHECKING([for libdonau]) 301 AC_ARG_WITH(donau, 302 [AS_HELP_STRING([--with-donau=PFX], [base of Taler DONAU installation])], 303 [AC_MSG_RESULT([given as $with_donau])], 304 [AC_MSG_RESULT(not given) 305 with_donau=yes]) 306 AS_CASE([$with_donau], 307 [yes], [], 308 [no], [], 309 [LDFLAGS="-L$with_donau/lib/$MULTIARCH -L$with_donau/lib/ $LDFLAGS" 310 CPPFLAGS="-I$with_donau/include $CPPFLAGS $POSTGRESQL_CPPFLAGS"]) 311 312 AC_CHECK_HEADERS([donau/donau_service.h], 313 [AC_CHECK_LIB([donau], [DONAU_get_keys], libdonau=1)]) 314 AM_CONDITIONAL(HAVE_DONAU, test x$libdonau = x1) 315 316 317 318 libtalermhd=0 319 AC_MSG_CHECKING([for libtalermhd]) 320 AC_ARG_WITH(exchange, 321 [AS_HELP_STRING([--with-exchange=PFX], [base of Taler EXCHANGE installation])], 322 [AC_MSG_RESULT([given as $with_exchange])], 323 [AC_MSG_RESULT(not given) 324 with_exchange=yes]) 325 AS_CASE([$with_exchange], 326 [yes], [], 327 [no], [AC_MSG_ERROR([--with-exchange is required])], 328 [LDFLAGS="-L$with_exchange/lib/$MULTIARCH -L$with_exchange/lib/ $LDFLAGS" 329 CPPFLAGS="-I$with_exchange/include $CPPFLAGS $POSTGRESQL_CPPFLAGS"]) 330 331 AC_CHECK_HEADERS([taler/taler_mhd_lib.h], 332 [AC_CHECK_LIB([talermhd], [TALER_MHD_parse_request_arg_rel_time], libtalermhd=1)]) 333 AM_CONDITIONAL(HAVE_TALERMHD, test x$libtalermhd = x1) 334 AS_IF([test $libtalermhd != 1], 335 [AC_MSG_ERROR([[ 336 *** 337 *** You need libtalermhd >= 1.1.0 (API v8) to build this program. 338 *** This library is part of the GNU Taler exchange, available at 339 *** https://taler.net 340 *** ]])]) 341 342 libtalerjson=0 343 AC_MSG_CHECKING([for libtalerjson]) 344 AC_CHECK_HEADERS([taler/taler_json_lib.h], 345 [AC_CHECK_LIB([talerjson], [TALER_JSON_currency_specs_to_json], libtalerjson=1)]) 346 AM_CONDITIONAL(HAVE_TALERJSON, test x$libtalerjson = x1) 347 AS_IF([test $libtalerjson != 1], 348 [AC_MSG_ERROR([[ 349 *** 350 *** You need libtalerjson >= 1.1 (API v6) to build this program. 351 *** This library is part of the GNU Taler exchange, available at 352 *** https://taler.net 353 *** ]])]) 354 355 356 # Check for Taler's libtalerpq 357 358 libtalerpq=0 359 AC_MSG_CHECKING([for libtalerpq]) 360 AC_CHECK_HEADERS([taler/taler_pq_lib.h], 361 [AC_CHECK_LIB([talerpq], [TALER_PQ_query_param_array_blinded_denom_sig], libtalerpq=1)]) 362 AM_CONDITIONAL(HAVE_TALERPQ, test x$libtalerpq = x1) 363 AS_IF([test $libtalerpq != 1], 364 [AC_MSG_ERROR([[ 365 *** 366 *** You need libtalerpq >= 0.9.4 to build this program. 367 *** This library is part of the GNU Taler exchange, available at 368 *** https://taler.net 369 *** ]])]) 370 371 372 # Check for Taler's libtalerfakebank 373 libtalerfakebank=0 374 AC_MSG_CHECKING([for libtalerfakebank]) 375 AC_CHECK_HEADERS([taler/taler_fakebank_lib.h], 376 [AC_CHECK_LIB([talerfakebank], [TALER_FAKEBANK_start], libtalerfakebank=1)]) 377 AM_CONDITIONAL(HAVE_TALERFAKEBANK, test x$libtalerfakebank = x1) 378 379 380 381 # check for libtalertwister 382 twistertesting=0 383 AC_MSG_CHECKING([for talerwtistertesting]) 384 AC_ARG_WITH([twister], 385 [AS_HELP_STRING([--with-twister=PFX], [base of libtalertwistertesting])], 386 [AC_MSG_RESULT([given as $with_twister])], 387 [AC_MSG_RESULT([not given]) 388 with_twister=yes]) 389 AS_CASE([$with_twister], 390 [yes], [], 391 [no], [AC_MSG_WARN([no twister-testing will be compiled])], 392 [LDFLAGS="-L$with_twister/lib/$MULTIARCH -L$with_twister/lib/ $LDFLAGS" 393 CPPFLAGS="-I$with_twister/include $CPPFLAGS"]) 394 AC_CHECK_LIB(talertwistertesting,TALER_TWISTER_run_twister, 395 [AC_CHECK_HEADER([taler/taler_twister_testing_lib.h],[twistertesting=1])]) 396 AM_CONDITIONAL(HAVE_TWISTER, test x$twistertesting = x1) 397 398 399 # gcov compilation 400 AC_MSG_CHECKING(whether to compile with support for code coverage analysis) 401 AC_ARG_ENABLE([coverage], 402 AS_HELP_STRING([--enable-coverage], 403 [compile the library with code coverage support]), 404 [use_gcov=${enableval}], 405 [use_gcov=no]) 406 AC_MSG_RESULT($use_gcov) 407 AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"]) 408 409 410 # logging 411 extra_logging=0 412 AC_ARG_ENABLE([logging], 413 AS_HELP_STRING([--enable-logging@<:@=value@:>@],[Enable logging calls. Possible values: yes,no,verbose ('yes' is the default)]), 414 [AS_IF([test "x$enableval" = "xyes"], [], 415 [test "x$enableval" = "xno"], [AC_DEFINE([GNUNET_CULL_LOGGING],[],[Define to cull all logging calls])], 416 [test "x$enableval" = "xverbose"], [extra_logging=1] 417 [test "x$enableval" = "xveryverbose"], [extra_logging=2]) 418 ], []) 419 AC_DEFINE_UNQUOTED([GNUNET_EXTRA_LOGGING],[$extra_logging],[1 if extra logging is enabled, 2 for very verbose extra logging, 0 otherwise]) 420 421 # version info 422 AC_PATH_PROG(gitcommand, git) 423 AC_MSG_CHECKING(for source being under a VCS) 424 git_version= 425 AS_IF([test ! "X$gitcommand" = "X"], 426 [ 427 git_version=$(cd $srcdir ; git rev-list -n 1 --abbrev-commit HEAD 2>/dev/null) 428 ]) 429 AS_IF([test "X$git_version" = "X"], 430 [ 431 vcs_name="no" 432 vcs_version="\"release\"" 433 ], 434 [ 435 vcs_name="yes, git-svn" 436 vcs_version="\"git-$git_version\"" 437 ]) 438 AC_MSG_RESULT($vcs_name) 439 440 AC_MSG_CHECKING(VCS version) 441 AC_MSG_RESULT($vcs_version) 442 AC_DEFINE_UNQUOTED(VCS_VERSION, [$vcs_version], [VCS revision/hash or tarball version]) 443 444 # Checks for typedefs, structures, and compiler characteristics. 445 AC_TYPE_PID_T 446 AC_TYPE_SIZE_T 447 AC_TYPE_UINT16_T 448 AC_TYPE_UINT32_T 449 AC_TYPE_UINT64_T 450 AC_TYPE_INTMAX_T 451 AC_TYPE_UINTMAX_T 452 453 # Checks for library functions. 454 AC_CHECK_FUNCS([strdup]) 455 456 457 AC_ARG_ENABLE([[doc]], 458 [AS_HELP_STRING([[--disable-doc]], [do not build any documentation])], , 459 [enable_doc=yes]) 460 test "x$enable_doc" = "xno" || enable_doc=yes 461 AM_CONDITIONAL([ENABLE_DOC], [test "x$enable_doc" = "xyes"]) 462 463 464 ],[ # this is about the doc-only if on top of the file 465 466 # logic if doc_only is set, make sure conditionals are still defined 467 AM_CONDITIONAL([HAVE_GNUNETPQ], [false]) 468 AM_CONDITIONAL([HAVE_POSTGRESQL], [false]) 469 AM_CONDITIONAL([HAVE_TALERUTIL], [false]) 470 AM_CONDITIONAL(HAVE_TALEREXCHANGE, [false]) 471 AM_CONDITIONAL([HAVE_TALERPQ], [false]) 472 AM_CONDITIONAL([HAVE_DONAU], [false]) 473 AM_CONDITIONAL([HAVE_TALERMHD], [false]) 474 AM_CONDITIONAL([HAVE_TALERJSON], [false]) 475 AM_CONDITIONAL([HAVE_TALERFAKEBANK], [false]) 476 AM_CONDITIONAL([USE_COVERAGE], [false]) 477 AM_CONDITIONAL([ENABLE_DOC], [true]) 478 AM_CONDITIONAL([HAVE_TWISTER], [true]) 479 480 481 # end of 'doc_only' 482 ]) 483 484 485 # should experimental code be compiled (code that may not yet compile / have passing test cases)? 486 AC_MSG_CHECKING(whether to compile experimental code) 487 AC_ARG_ENABLE([experimental], 488 [AS_HELP_STRING([--enable-experimental], [enable compiling experimental code])], 489 [enable_experimental=${enableval}], 490 [enable_experimental=no]) 491 AC_MSG_RESULT($enable_experimental) 492 AM_CONDITIONAL([HAVE_EXPERIMENTAL], [test "x$enable_experimental" = "xyes"]) 493 494 495 AC_CONFIG_FILES([Makefile 496 contrib/Makefile 497 doc/Makefile 498 doc/doxygen/Makefile 499 src/Makefile 500 src/bank/Makefile 501 src/backend/Makefile 502 src/backenddb/Makefile 503 src/include/Makefile 504 src/lib/Makefile 505 src/merchant-tools/Makefile 506 src/util/Makefile 507 src/testing/Makefile 508 ]) 509 AC_OUTPUT