configure.ac (11081B)
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 TALER_LIB_LDFLAGS="-export-dynamic -no-undefined" 192 TALER_PLUGIN_LDFLAGS="-export-dynamic -avoid-version -module -no-undefined" 193 194 AC_SUBST(TALER_LIB_LDFLAGS) 195 AC_SUBST(TALER_PLUGIN_LDFLAGS) 196 197 CFLAGS_SAVE=$CFLAGS 198 LDFLAGS_SAVE=$LDFLAGS 199 LIBS_SAVE="$LIBS" 200 201 202 # test for zlib 203 SAVE_LDFLAGS=$LDFLAGS 204 SAVE_CPPFLAGS=$CPPFLAGS 205 AC_ARG_WITH(zlib, 206 [ --with-zlib[[=DIR]] use libz in DIR], 207 [AS_IF([test "$withval" = "no"], 208 [AC_MSG_ERROR([Twister requires zlib])], 209 [test "$withval" != "yes"], 210 [ 211 Z_DIR=$withval 212 CPPFLAGS="${CPPFLAGS} -I$withval/include" 213 LDFLAGS="${LDFLAGS} -L$withval/lib" 214 ]) 215 ]) 216 AC_CHECK_HEADER(zlib.h, 217 [], 218 [AC_MSG_ERROR([GNUnet requires zlib])]) 219 AC_CHECK_LIB(z, compress2, 220 [ 221 AC_DEFINE([HAVE_ZLIB], [], [Have compression library]) 222 if test "x${Z_DIR}" != "x"; then 223 Z_CFLAGS="-I${Z_DIR}/include" 224 Z_LIBS="-L${Z_DIR}/lib -lz" 225 else 226 Z_LIBS="-lz" 227 fi], 228 [AC_MSG_ERROR([Twister requires zlib])]) 229 AC_SUBST(Z_CFLAGS) 230 AC_SUBST(Z_LIBS) 231 232 233 # should developer logic be compiled (not-for-production code)? 234 AC_MSG_CHECKING(whether to compile developer logic) 235 AC_ARG_ENABLE([developer-mode], 236 [AS_HELP_STRING([--enable-developer-mode], [enable compiling developer code])], 237 [enable_developer=${enableval}], 238 [enable_developer=yes]) 239 AC_MSG_RESULT($enable_developer) 240 AM_CONDITIONAL([HAVE_DEVELOPER], [test "x$enable_developer" = "xyes"]) 241 enable_dev=1 242 AS_IF([test "x$enableval" = "xno"], [enable_dev=0]) 243 # developer-logic requires a more recent MHD than usual. 244 AC_CHECK_DECL([MHD_OPTION_NOTIFY_CONNECTION],,[enable_dev=0],[[#include <microhttpd.h>]]) 245 AC_DEFINE_UNQUOTED([HAVE_DEVELOPER],[$enable_dev],[1 if developer logic is enabled, 0 otherwise]) 246 247 248 249 # Adam shostack suggests the following for Windows: 250 # -D_FORTIFY_SOURCE=2 -fstack-protector-all 251 AC_ARG_ENABLE(gcc-hardening, 252 AS_HELP_STRING(--enable-gcc-hardening, enable compiler security checks), 253 [if test x$enableval = xyes; then 254 CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all" 255 CFLAGS="$CFLAGS -fwrapv -fPIE -Wstack-protector" 256 CFLAGS="$CFLAGS --param ssp-buffer-size=1" 257 LDFLAGS="$LDFLAGS -pie" 258 fi]) 259 260 261 # Linker hardening options 262 # Currently these options are ELF specific - you can't use this with MacOSX 263 AC_ARG_ENABLE(linker-hardening, 264 AS_HELP_STRING(--enable-linker-hardening, enable linker security fixups), 265 [if test x$enableval = xyes; then 266 LDFLAGS="$LDFLAGS -z relro -z now" 267 fi]) 268 269 270 # logging 271 extra_logging=0 272 AC_ARG_ENABLE([logging], 273 AS_HELP_STRING([--enable-logging@<:@=value@:>@],[Enable logging calls. Possible values: yes,no,verbose ('yes' is the default)]), 274 [AS_IF([test "x$enableval" = "xyes"], [], 275 [test "x$enableval" = "xno"], [AC_DEFINE([GNUNET_CULL_LOGGING],[],[Define to cull all logging calls])], 276 [test "x$enableval" = "xverbose"], [extra_logging=1] 277 [test "x$enableval" = "xveryverbose"], [extra_logging=2]) 278 ], []) 279 AC_DEFINE_UNQUOTED([GNUNET_EXTRA_LOGGING],[$extra_logging],[1 if extra logging is enabled, 2 for very verbose extra logging, 0 otherwise]) 280 281 # gcov compilation 282 AC_MSG_CHECKING(whether to compile with support for code coverage analysis) 283 AC_ARG_ENABLE([coverage], 284 AS_HELP_STRING([--enable-coverage], 285 [compile the library with code coverage support]), 286 [use_gcov=${enableval}], 287 [use_gcov=no]) 288 AC_MSG_RESULT($use_gcov) 289 AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"]) 290 291 # version info 292 AC_PATH_PROG(gitcommand, git) 293 AC_MSG_CHECKING(for source being under a VCS) 294 git_version= 295 AS_IF([test ! "X$gitcommand" = "X"], 296 [ 297 git_version=$(cd $srcdir ; git rev-list --full-history --all --abbrev-commit | head -n 1 2>/dev/null) 298 ]) 299 AS_IF([test "X$git_version" = "X"], 300 [ 301 vcs_name="no" 302 vcs_version="\"release\"" 303 ], 304 [ 305 vcs_name="yes, git-svn" 306 vcs_version="\"git-$git_version\"" 307 ]) 308 AC_MSG_RESULT($vcs_name) 309 310 AC_MSG_CHECKING(VCS version) 311 AC_MSG_RESULT($vcs_version) 312 AC_DEFINE_UNQUOTED(VCS_VERSION, [$vcs_version], [VCS revision/hash or tarball version]) 313 314 315 # Checks for typedefs, structures, and compiler characteristics. 316 AC_TYPE_PID_T 317 AC_TYPE_SIZE_T 318 AC_TYPE_UINT16_T 319 AC_TYPE_UINT32_T 320 AC_TYPE_UINT64_T 321 AC_TYPE_INTMAX_T 322 AC_TYPE_UINTMAX_T 323 324 # Checks for library functions. 325 AC_CHECK_FUNCS([strdup]) 326 327 328 AC_ARG_ENABLE([[doc]], 329 [AS_HELP_STRING([[--disable-doc]], [do not build any documentation])], , 330 [enable_doc=yes]) 331 test "x$enable_doc" = "xno" || enable_doc=yes 332 AM_CONDITIONAL([ENABLE_DOC], [test "x$enable_doc" = "xyes"]) 333 334 335 AC_CONFIG_FILES([Makefile 336 contrib/Makefile 337 doc/Makefile 338 src/Makefile 339 src/include/Makefile 340 src/backend/Makefile 341 ]) 342 AC_OUTPUT