configure.ac (10517B)
1 # -*- Autoconf -*- 2 # Process this file with autoconf to produce a configure script. 3 # 4 # This configure file is in the public domain 5 6 AC_PREREQ([2.69]) 7 AC_INIT([challenger],[1.2.0],[taler-bug@gnu.org]) 8 AC_CONFIG_SRCDIR([src/challenger/challenger-httpd.c]) 9 AC_CONFIG_HEADERS([challenger_config.h]) 10 # support for non-recursive builds 11 AM_INIT_AUTOMAKE([subdir-objects 1.9 tar-pax]) 12 13 # pretty build rules 14 AM_SILENT_RULES([yes]) 15 16 AC_CONFIG_MACRO_DIR([m4]) 17 AC_PROG_AWK 18 AC_PROG_CC 19 AC_PROG_OBJC 20 AC_PROG_INSTALL 21 AC_PROG_LN_S 22 AC_PROG_MAKE_SET 23 AM_PROG_CC_C_O 24 25 LT_INIT([disable-static]) 26 27 28 DX_INIT_DOXYGEN([challenger],,, 29 DX_PS_FEATURE(OFF), 30 DX_PDF_FEATURE(OFF), 31 DX_RTF_FEATURE(OFF), 32 DX_CHI_FEATURE(OFF), 33 DX_XML_FEATURE(OFF)) 34 35 36 AC_CHECK_PROG([DPKG_ARCH], [dpkg-architecture], [yes], [no]) 37 if test "x$DPKG_ARCH" = "xyes"; then 38 MULTIARCH=`dpkg-architecture -qDEB_HOST_MULTIARCH` 39 else 40 MULTIARCH="" 41 fi 42 43 AC_MSG_CHECKING([whether to compile documentation ONLY]) 44 AC_ARG_ENABLE([only-doc], 45 [AS_HELP_STRING([--enable-only-doc], [only compile Challenger documentation])], 46 [doc_only=${enableval}], 47 [doc_only=no]) 48 AC_MSG_RESULT($doc_only) 49 AM_CONDITIONAL([DOC_ONLY], [test "$doc_only" = "yes"]) 50 51 52 # Not indented as it covers most of the file... 53 AS_IF([test "x$doc_only" != xyes],[ 54 55 # Force some CFLAGS 56 CFLAGS="-Wall -Wno-address-of-packed-member $CFLAGS" 57 58 # Checks for header files. 59 AC_CHECK_HEADERS([stdint.h stdlib.h string.h unistd.h]) 60 61 62 # Check for GNUnet's libgnunetutil. 63 libgnunetutil=0 64 AC_MSG_CHECKING([for libgnunetutil]) 65 AC_ARG_WITH(gnunet, 66 [AS_HELP_STRING([--with-gnunet=PFX], [base of GNUnet installation])], 67 [AC_MSG_RESULT([given as $with_gnunet])], 68 [AC_MSG_RESULT(not given) 69 with_gnunet=yes]) 70 AS_CASE([$with_gnunet], 71 [yes], [], 72 [no], [AC_MSG_ERROR([--with-gnunet is required])], 73 [LDFLAGS="-L$with_gnunet/lib/$MULTIARCH -L$with_gnunet/lib/ $LDFLAGS" 74 CPPFLAGS="-I$with_gnunet/include $CPPFLAGS"]) 75 AC_CHECK_HEADERS([gnunet/gnunet_util_lib.h], 76 [AC_CHECK_LIB([gnunetutil], [GNUNET_SCHEDULER_run], libgnunetutil=1)]) 77 AS_IF([test $libgnunetutil != 1], 78 [AC_MSG_ERROR([[ 79 *** 80 *** You need libgnunetutil to build this program. 81 *** This library is part of GNUnet, available at 82 *** https://gnunet.org 83 *** ]])]) 84 85 86 # test for postgres 87 AX_LIB_POSTGRESQL([14]) 88 AS_IF([test "x$found_postgresql" = "xyes"],[postgres=true]) 89 AM_CONDITIONAL(HAVE_POSTGRESQL, test x$postgres = xtrue) 90 91 SYNC_LIB_LDFLAGS="-export-dynamic -no-undefined" 92 SYNC_PLUGIN_LDFLAGS="-export-dynamic -avoid-version -module -no-undefined" 93 94 AC_SUBST(SYNC_LIB_LDFLAGS) 95 AC_SUBST(SYNC_PLUGIN_LDFLAGS) 96 97 # Check for Taler's libtalerpq 98 libtalerpq=0 99 AC_MSG_CHECKING([for libtalerpq]) 100 AC_ARG_WITH(exchange, 101 [AS_HELP_STRING([--with-exchange=PFX], [base of Taler EXCHANGE installation])], 102 [AC_MSG_RESULT([given as $with_exchange])], 103 [AC_MSG_RESULT(not given) 104 with_exchange=yes]) 105 AS_CASE([$with_exchange], 106 [yes], [], 107 [no], [AC_MSG_ERROR([--with-exchange is required])], 108 [LDFLAGS="-L$with_exchange/lib/$MULTIARCH -L$with_exchange/lib/ $LDFLAGS" 109 CPPFLAGS="-I$with_exchange/include $CPPFLAGS $POSTGRESQL_CPPFLAGS"]) 110 111 CPPFLAGS="$CPPFLAGS $POSTGRESQL_CPPFLAGS" 112 113 AC_CHECK_HEADERS([gnunet/gnunet_pq_lib.h], 114 [AC_CHECK_LIB([gnunetpq], [GNUNET_PQ_connect_with_cfg], libgnunetpq=1)]) 115 AM_CONDITIONAL(HAVE_GNUNETPQ, test x$libgnunetpq = x1) 116 117 118 libtalermhd=0 119 AC_MSG_CHECKING([for libtalermhd]) 120 AC_ARG_WITH(exchange, 121 [AS_HELP_STRING([--with-exchange=PFX], [base of Taler EXCHANGE installation])], 122 [AC_MSG_RESULT([given as $with_exchange])], 123 [AC_MSG_RESULT(not given) 124 with_exchange=yes]) 125 AS_CASE([$with_exchange], 126 [yes], [], 127 [no], [AC_MSG_ERROR([--with-exchange is required])], 128 [LDFLAGS="-L$with_exchange/lib/$MULTIARCH -L$with_exchange/lib/ $LDFLAGS" 129 CPPFLAGS="-I$with_exchange/include $CPPFLAGS $POSTGRESQL_CPPFLAGS"]) 130 131 AC_CHECK_HEADERS([taler/taler_mhd_lib.h], 132 [AC_CHECK_LIB([talermhd], [TALER_MHD_listen_bind], libtalermhd=1)]) 133 AM_CONDITIONAL(HAVE_TALERMHD, test x$libtalermhd = x1) 134 AS_IF([test $libtalermhd != 1], 135 [AC_MSG_ERROR([[ 136 *** 137 *** You need libtalermhd >= 1.1.0 (API v6) to build this program. 138 *** This library is part of the GNU Taler exchange, available at 139 *** https://taler.net 140 *** ]])]) 141 142 libtalertemplating=0 143 AC_CHECK_HEADERS([taler/taler_templating_lib.h], 144 [AC_CHECK_LIB([talertemplating], [TALER_TEMPLATING_fill2], libtalertemplating=1)]) 145 AM_CONDITIONAL(HAVE_TALERTEMPLATING, test x$libtalertemplating = x1) 146 AS_IF([test $libtalertemplating != 1], 147 [AC_MSG_ERROR([[ 148 *** 149 *** You need libtalertemplating >= 0.14.6 to build this program. 150 *** This library is part of the GNU Taler exchange, available at 151 *** https://taler.net 152 *** ]])]) 153 154 155 # check for libmicrohttpd 156 microhttpd=0 157 AC_MSG_CHECKING([for microhttpd]) 158 AC_ARG_WITH([microhttpd], 159 [AS_HELP_STRING([--with-microhttpd=PFX], [base of microhttpd installation])], 160 [AC_MSG_RESULT([given as $with_microhttpd])], 161 [AC_MSG_RESULT([not given]) 162 with_microhttpd=yes]) 163 AS_CASE([$with_microhttpd], 164 [yes], [], 165 [no], [AC_MSG_ERROR([--with-microhttpd is required])], 166 [LDFLAGS="-L$with_microhttpd/lib/$MULTIARCH -L$with_microhttpd/lib/ $LDFLAGS" 167 CPPFLAGS="-I$with_microhttpd/include $CPPFLAGS"]) 168 AC_CHECK_LIB(microhttpd,MHD_start_daemon, 169 [AC_CHECK_HEADER([microhttpd.h],[microhttpd=1])]) 170 AS_IF([test $microhttpd = 0], 171 [AC_MSG_ERROR([[ 172 *** 173 *** You need libmicrohttpd to build this program. 174 *** ]])]) 175 176 jansson=0 177 PKG_CHECK_MODULES([JANSSON], [jansson >= 2.3], 178 [LDFLAGS="$JANSSON_LIBS $LDFLAGS" 179 CPPFLAGS="$JANSSON_CFLAGS $CPPFLAGS"], 180 [AC_MSG_ERROR([[ 181 *** 182 *** You need libjansson to build this program. 183 ***]])]) 184 185 # Save before checking libcurl 186 CFLAGS_SAVE=$CFLAGS 187 LDFLAGS_SAVE=$LDFLAGS 188 LIBS_SAVE=$LIBS 189 190 # libcurl-gnutls 191 LIBCURL_CHECK_CONFIG(,7.34.0,[curl=1],[curl=0]) 192 193 # cURL must support CURLINFO_TLS_SESSION, version >= 7.34 194 AS_IF([test "x$curl" = x1],[ 195 AC_CHECK_HEADER([curl/curl.h], 196 [AC_CHECK_DECLS(CURLINFO_TLS_SESSION,[curl=1],[curl=0],[[#include <curl/curl.h>]])], 197 [curl=0]) 198 ]) 199 200 # libcurl should be mutually exclusive 201 AS_IF([test "$curl" = 1], 202 AM_CONDITIONAL(HAVE_LIBCURL, true) 203 AC_DEFINE([HAVE_LIBCURL],[1],[Have libcurl]) 204 [LIBCURL_LIBS="-lcurl"], 205 [AC_MSG_ERROR([FATAL: No libcurl])]) 206 207 AC_SUBST([LIBCURL_LIBS]) 208 209 210 # Check for GNUnet's libgnunetcurl. 211 libgnunetcurl=0 212 AC_MSG_CHECKING([for libgnunetcurl]) 213 AC_ARG_WITH(gnunet, 214 [AS_HELP_STRING([--with-gnunet=PFX], [base of GNUnet installation])], 215 [AC_MSG_RESULT([given as $with_gnunet])], 216 [AC_MSG_RESULT(not given) 217 with_gnunet=yes]) 218 AS_CASE([$with_gnunet], 219 [yes], [], 220 [no], [AC_MSG_ERROR([--with-gnunet is required])], 221 [LDFLAGS="-L$with_gnunet/lib/$MULTIARCH -L$with_gnunet/lib/ $LDFLAGS" 222 CPPFLAGS="-I$with_gnunet/include $CPPFLAGS"]) 223 AC_CHECK_HEADERS([gnunet/gnunet_curl_lib.h], 224 [AC_CHECK_LIB([gnunetcurl], [GNUNET_CURL_get_select_info], libgnunetcurl=1)]) 225 AS_IF([test $libgnunetcurl != 1], 226 [AC_MSG_ERROR([[ 227 *** 228 *** You need libgnunetcurl to build this program. 229 *** Make sure you have libcurl installed while 230 *** building GNUnet. 231 *** ]])]) 232 233 # Restore after curl checks messed up these values 234 CFLAGS=$CFLAGS_SAVE 235 LDFLAGS=$LDFLAGS_SAVE 236 LIBS=$LIBS_SAVE 237 238 239 # gcov compilation 240 AC_MSG_CHECKING(whether to compile with support for code coverage analysis) 241 AC_ARG_ENABLE([coverage], 242 AS_HELP_STRING([--enable-coverage], 243 [compile the library with code coverage support]), 244 [use_gcov=${enableval}], 245 [use_gcov=no]) 246 AC_MSG_RESULT($use_gcov) 247 AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"]) 248 249 # Require minimum libgcrypt version 250 need_libgcrypt_version=1.6.1 251 AC_DEFINE_UNQUOTED([NEED_LIBGCRYPT_VERSION], ["$need_libgcrypt_version"], 252 [minimum version of libgcrypt required]) 253 AM_PATH_LIBGCRYPT([$need_libgcrypt_version]) 254 255 # logging 256 extra_logging=0 257 AC_ARG_ENABLE([logging], 258 AS_HELP_STRING([--enable-logging@<:@=value@:>@],[Enable logging calls. Possible values: yes,no,verbose ('yes' is the default)]), 259 [AS_IF([test "x$enableval" = "xyes"], [], 260 [test "x$enableval" = "xno"], [AC_DEFINE([GNUNET_CULL_LOGGING],[],[Define to cull all logging calls])], 261 [test "x$enableval" = "xverbose"], [extra_logging=1] 262 [test "x$enableval" = "xveryverbose"], [extra_logging=2]) 263 ], []) 264 AC_DEFINE_UNQUOTED([GNUNET_EXTRA_LOGGING],[$extra_logging],[1 if extra logging is enabled, 2 for very verbose extra logging, 0 otherwise]) 265 266 # version info 267 AC_PATH_PROG(gitcommand, git) 268 AC_MSG_CHECKING(for source being under a VCS) 269 git_version= 270 AS_IF([test ! "X$gitcommand" = "X"], 271 [ 272 git_version=$(cd $srcdir ; git rev-list --full-history --all --abbrev-commit | head -n 1 2>/dev/null) 273 ]) 274 AS_IF([test "X$git_version" = "X"], 275 [ 276 vcs_name="no" 277 vcs_version="\"release\"" 278 ], 279 [ 280 vcs_name="yes, git-svn" 281 vcs_version="\"git-$git_version\"" 282 ]) 283 AC_MSG_RESULT($vcs_name) 284 285 AC_MSG_CHECKING(VCS version) 286 AC_MSG_RESULT($vcs_version) 287 AC_DEFINE_UNQUOTED(VCS_VERSION, [$vcs_version], [VCS revision/hash or tarball version]) 288 289 # Checks for typedefs, structures, and compiler characteristics. 290 AC_TYPE_PID_T 291 AC_TYPE_SIZE_T 292 AC_TYPE_UINT16_T 293 AC_TYPE_UINT32_T 294 AC_TYPE_UINT64_T 295 AC_TYPE_INTMAX_T 296 AC_TYPE_UINTMAX_T 297 298 # Checks for library functions. 299 AC_CHECK_FUNCS([strdup]) 300 301 302 AC_ARG_ENABLE([[doc]], 303 [AS_HELP_STRING([[--disable-doc]], [do not build any documentation])], , 304 [enable_doc=yes]) 305 test "x$enable_doc" = "xno" || enable_doc=yes 306 AM_CONDITIONAL([ENABLE_DOC], [test "x$enable_doc" = "xyes"]) 307 308 309 ],[ # this is about the doc-only if on top of the file 310 311 # logic if doc_only is set, make sure conditionals are still defined 312 AM_CONDITIONAL([HAVE_GNUNETPQ], [false]) 313 AM_CONDITIONAL([HAVE_POSTGRESQL], [false]) 314 AM_CONDITIONAL([HAVE_LIBCURL], [false]) 315 AM_CONDITIONAL([USE_COVERAGE], [false]) 316 AM_CONDITIONAL([ENABLE_DOC], [true]) 317 AM_CONDITIONAL(HAVE_TALERMHD, [false]) 318 AM_CONDITIONAL(HAVE_TALERTEMPLATING, [false]) 319 320 # end of 'doc_only' 321 ]) 322 323 324 AC_CONFIG_FILES([Makefile 325 contrib/Makefile 326 doc/Makefile 327 doc/doxygen/Makefile 328 src/Makefile 329 src/include/Makefile 330 src/util/Makefile 331 src/challengerdb/Makefile 332 src/challenger/Makefile 333 ]) 334 AC_OUTPUT